From e92492295ba6a716b69adcd14e80adf6b5900132 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 7 Nov 2009 22:03:32 +0100
Subject: r300: remove unneeded includes
---
src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 --
src/mesa/drivers/dri/r300/r300_emit.h | 1 -
src/mesa/drivers/dri/r300/r300_render.c | 2 --
3 files changed, 5 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 1e2a54f634..8a56b9e63c 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -46,14 +46,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_context.h"
#include "r300_ioctl.h"
-#include "radeon_reg.h"
#include "r300_reg.h"
#include "r300_cmdbuf.h"
#include "r300_emit.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_mipmap_tree.h"
#include "r300_state.h"
-#include "radeon_reg.h"
#include "radeon_queryobj.h"
/** # of dwords reserved for additional instructions that may need to be written
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h
index 8e57e354d1..a456d8867c 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.h
+++ b/src/mesa/drivers/dri/r300/r300_emit.h
@@ -42,7 +42,6 @@
#include "main/glheader.h"
#include "r300_context.h"
#include "r300_cmdbuf.h"
-#include "radeon_reg.h"
static INLINE uint32_t cmdpacket0(struct radeon_screen *rscrn,
int reg, int count)
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 3cd38753b8..4ae593cbe7 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -67,8 +67,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vbo/vbo_split.h"
#include "tnl/tnl.h"
#include "tnl/t_vp_build.h"
-#include "radeon_reg.h"
-#include "radeon_macros.h"
#include "r300_context.h"
#include "r300_ioctl.h"
#include "r300_state.h"
--
cgit v1.2.3
From 0aad2aee66392989777ee74078efda197f292ee7 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sun, 8 Nov 2009 16:58:07 +0100
Subject: r300: add missing texformat
---
src/mesa/drivers/dri/r300/r300_texstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 44ca24daf8..4699342994 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -83,6 +83,7 @@ static const struct tx_table {
_ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)),
_ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
#endif
+ _ASSIGN(XRGB8888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)),
_ASSIGN(RGB888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)),
_ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
_ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
--
cgit v1.2.3
From 49876ab6a7f2b06177d7ac9651bd7a07956cbb25 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Mon, 9 Nov 2009 23:11:29 +0100
Subject: radeon: remove unnecessary call to radeonEmitState
fixes bo space accounting errors
---
src/mesa/drivers/dri/radeon/radeon_common.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 097ab7cf61..420dce4ac9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -1123,8 +1123,6 @@ void radeonFlush(GLcontext *ctx)
if (radeon->dma.flush)
radeon->dma.flush( ctx );
- radeonEmitState(radeon);
-
if (radeon->cmdbuf.cs->cdw)
rcommonFlushCmdBuf(radeon, __FUNCTION__);
--
cgit v1.2.3
From 084f43c1502db1988ca53494ea590cf1351180ec Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 12:53:06 +0100
Subject: radeon: add radeon_bo_is_referenced_by_cs function
---
src/mesa/drivers/dri/radeon/radeon_bo_drm.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
index 7141371633..46e30b905a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h
@@ -39,6 +39,7 @@
#define RADEON_BO_FLAGS_MICRO_TILE 2
struct radeon_bo_manager;
+struct radeon_cs;
struct radeon_bo {
uint32_t alignment;
@@ -74,6 +75,7 @@ struct radeon_bo_funcs {
int (*bo_get_tiling)(struct radeon_bo *bo, uint32_t *tiling_flags,
uint32_t *pitch);
int (*bo_is_busy)(struct radeon_bo *bo, uint32_t *domain);
+ int (*bo_is_referenced_by_cs)(struct radeon_bo *bo, struct radeon_cs *cs);
};
struct radeon_bo_manager {
@@ -199,6 +201,15 @@ static inline int radeon_bo_is_static(struct radeon_bo *bo)
return 0;
}
+static inline int _radeon_bo_is_referenced_by_cs(struct radeon_bo *bo,
+ struct radeon_cs *cs,
+ const char *file,
+ const char *func,
+ unsigned line)
+{
+ return bo->cref > 1;
+}
+
#define radeon_bo_open(bom, h, s, a, d, f)\
_radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__)
#define radeon_bo_ref(bo)\
@@ -215,5 +226,7 @@ static inline int radeon_bo_is_static(struct radeon_bo *bo)
_radeon_bo_wait(bo, __FILE__, __func__, __LINE__)
#define radeon_bo_is_busy(bo, domain) \
_radeon_bo_is_busy(bo, domain, __FILE__, __func__, __LINE__)
+#define radeon_bo_is_referenced_by_cs(bo, cs) \
+ _radeon_bo_is_referenced_by_cs(bo, cs, __FILE__, __FUNCTION__, __LINE__)
#endif
--
cgit v1.2.3
From f6d0993212fac0eb67827716be1ab4a292c8b4e5 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 13:00:10 +0100
Subject: radeon: fix glBufferSubData
---
src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index 8fac5c6c51..99d3ec7005 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -136,8 +136,13 @@ radeonBufferSubData(GLcontext * ctx,
const GLvoid * data,
struct gl_buffer_object *obj)
{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj);
+ if (radeon_bo_is_referenced_by_cs(radeon_obj->bo, radeon->cmdbuf.cs)) {
+ radeon_firevertices(radeon);
+ }
+
radeon_bo_map(radeon_obj->bo, GL_TRUE);
_mesa_memcpy(radeon_obj->bo->ptr + offset, data, size);
--
cgit v1.2.3
From 286bf89e5a1fc931dbf523ded861b809859485e2 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 13:06:19 +0100
Subject: radeon/r300: no need to flush the cmdbuf when changing scissors state
in KMM mode
---
src/mesa/drivers/dri/r300/r300_state.c | 3 ++-
src/mesa/drivers/dri/radeon/radeon_common.c | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index ac20c08e20..1fd32d497b 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1741,7 +1741,8 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
r300SetPolygonOffsetState(ctx, state);
break;
case GL_SCISSOR_TEST:
- radeon_firevertices(&rmesa->radeon);
+ if (!rmesa->radeon.radeonScreen->kernel_mm)
+ radeon_firevertices(&rmesa->radeon);
rmesa->radeon.state.scissor.enabled = state;
radeonUpdateScissor( ctx );
break;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 420dce4ac9..cb344f1d21 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -257,7 +257,9 @@ void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
if (ctx->Scissor.Enabled) {
/* We don't pipeline cliprect changes */
- radeon_firevertices(radeon);
+ if (!radeon->radeonScreen->kernel_mm) {
+ radeon_firevertices(radeon);
+ }
radeonUpdateScissor(ctx);
}
}
--
cgit v1.2.3
From d3fa67c9b83b5736724ca57a0487857631e6c415 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 13:50:06 +0100
Subject: radeon/r300: don't flush cmdbuf if not necessary
---
src/mesa/drivers/dri/r300/r300_tex.c | 6 +++++-
src/mesa/drivers/dri/radeon/radeon_texture.c | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 27b78a912f..427237d200 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -270,7 +270,11 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
if (rmesa) {
int i;
- radeon_firevertices(&rmesa->radeon);
+ struct radeon_bo *bo;
+ bo = !t->mt ? t->bo : t->mt->bo;
+ if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->radeon.cmdbuf.cs)) {
+ radeon_firevertices(&rmesa->radeon);
+ }
for(i = 0; i < R300_MAX_TEXTURE_UNITS; ++i)
if (rmesa->hw.textures[i] == t)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index baa99b752b..59bc8c34de 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -534,7 +534,13 @@ static void radeon_teximage(
GLuint texelBytes;
GLuint face = radeon_face_for_target(target);
- radeon_firevertices(rmesa);
+ {
+ struct radeon_bo *bo;
+ bo = !image->mt ? image->bo : image->mt->bo;
+ if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) {
+ radeon_firevertices(rmesa);
+ }
+ }
t->validated = GL_FALSE;
@@ -731,7 +737,13 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
radeonTexObj* t = radeon_tex_obj(texObj);
radeon_texture_image* image = get_radeon_texture_image(texImage);
- radeon_firevertices(rmesa);
+ {
+ struct radeon_bo *bo;
+ bo = !image->mt ? image->bo : image->mt->bo;
+ if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) {
+ radeon_firevertices(rmesa);
+ }
+ }
t->validated = GL_FALSE;
if (compressed) {
--
cgit v1.2.3
From aa195611586cdfb21bb1707b12b16e461a92d42e Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 14:00:15 +0100
Subject: radeon: use radeon_bo_is_referenced_by_cs for query objects
---
src/mesa/drivers/dri/radeon/radeon_common.c | 3 ---
src/mesa/drivers/dri/radeon/radeon_common_context.c | 1 -
src/mesa/drivers/dri/radeon/radeon_common_context.h | 1 -
src/mesa/drivers/dri/radeon/radeon_queryobj.c | 21 +++------------------
4 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index cb344f1d21..3b4366aa61 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -1147,9 +1147,6 @@ void radeonFlush(GLcontext *ctx)
}
}
}
-
- make_empty_list(&radeon->query.not_flushed_head);
-
}
/* Make sure all commands have been sent to the hardware and have
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index fe99644907..2a38c4599c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -265,7 +265,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
radeon->texture_compressed_row_align = 64;
}
- make_empty_list(&radeon->query.not_flushed_head);
radeon_init_dma(radeon);
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 0309345393..5a0678b9d6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -502,7 +502,6 @@ struct radeon_context {
struct {
struct radeon_query_object *current;
- struct radeon_query_object not_flushed_head;
struct radeon_state_atom queryobj;
} query;
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index 6539c36268..b734f86eb3 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -31,20 +31,6 @@
#include "main/imports.h"
#include "main/simple_list.h"
-static int radeonQueryIsFlushed(GLcontext *ctx, struct gl_query_object *q)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- struct radeon_query_object *tmp, *query = (struct radeon_query_object *)q;
-
- foreach(tmp, &radeon->query.not_flushed_head) {
- if (tmp == query) {
- return 0;
- }
- }
-
- return 1;
-}
-
static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
@@ -120,10 +106,11 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q)
static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)
{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = (struct radeon_query_object *)q;
/* If the cmdbuf with packets for this query hasn't been flushed yet, do it now */
- if (!radeonQueryIsFlushed(ctx, q))
+ if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs))
ctx->Driver.Flush(ctx);
radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s: query id %d, bo %p, offset %d\n", __FUNCTION__, q->Id, query->bo, query->curr_offset);
@@ -155,8 +142,6 @@ static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q)
radeon->query.queryobj.dirty = GL_TRUE;
radeon->hw.is_dirty = GL_TRUE;
- insert_at_tail(&radeon->query.not_flushed_head, query);
-
}
void radeonEmitQueryEnd(GLcontext *ctx)
@@ -204,7 +189,7 @@ static void radeonCheckQuery(GLcontext *ctx, struct gl_query_object *q)
uint32_t domain;
/* Need to perform a flush, as per ARB_occlusion_query spec */
- if (!radeonQueryIsFlushed(ctx, q)) {
+ if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs)) {
ctx->Driver.Flush(ctx);
}
--
cgit v1.2.3
From 6e5d473cc16ca2d001df213fc1d907f2943a95bb Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 11 Nov 2009 18:55:49 +0100
Subject: r300: fix regression introduced in
1d5a06a1f7812c055db1d724e40d21a0e3686dd1
Spotted by Dave Airlie
---
src/mesa/drivers/dri/r300/r300_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 6f66e970e4..3ed49a85c5 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -439,7 +439,7 @@ static void r300InitGLExtensions(GLcontext *ctx)
if (r300->options.stencil_two_side_disabled)
_mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
- if (r300->options.s3tc_force_enabled) {
+ if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) {
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
_mesa_enable_extension(ctx, "GL_S3_s3tc");
} else if (r300->options.s3tc_force_disabled) {
--
cgit v1.2.3
From 7628b06ba32e42f57a4fdb322bc32e3b411c1f18 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 14 Nov 2009 14:55:13 +0100
Subject: radeon: rework mipmap tree reference counting
---
src/mesa/drivers/dri/r300/r300_tex.c | 13 ++++--------
src/mesa/drivers/dri/r300/r300_texstate.c | 12 ++++--------
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 12 ++++++++++--
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 5 +++--
src/mesa/drivers/dri/radeon/radeon_texture.c | 25 +++++++++---------------
5 files changed, 30 insertions(+), 37 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 427237d200..7e94e93df2 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -228,11 +228,8 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
* we just have to rely on loading the right subset of mipmap levels
* to simulate a clamped LOD.
*/
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- t->validated = GL_FALSE;
- }
+ radeon_miptree_unreference(&t->mt);
+ t->validated = GL_FALSE;
break;
case GL_DEPTH_TEXTURE_MODE:
@@ -286,10 +283,8 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
t->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- }
+ radeon_miptree_unreference(&t->mt);
+
_mesa_delete_texture_object(ctx, texObj);
}
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 4699342994..7b1adcf31d 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -438,14 +438,10 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
radeon_bo_unref(rImage->bo);
rImage->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = NULL;
- }
- if (rImage->mt) {
- radeon_miptree_unreference(rImage->mt);
- rImage->mt = NULL;
- }
+
+ radeon_miptree_unreference(&t->mt);
+ radeon_miptree_unreference(&rImage->mt);
+
_mesa_init_teximage_fields(radeon->glCtx, target, texImage,
rb->base.Width, rb->base.Height, 1, 0, rb->cpp);
texImage->RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index dadc72f4c1..f635f58d6a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -223,23 +223,31 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *
return mt;
}
-void radeon_miptree_reference(radeon_mipmap_tree *mt)
+void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr)
{
+ assert(!*ptr);
+
mt->refcount++;
assert(mt->refcount > 0);
+
+ *ptr = mt;
}
-void radeon_miptree_unreference(radeon_mipmap_tree *mt)
+void radeon_miptree_unreference(radeon_mipmap_tree **ptr)
{
+ radeon_mipmap_tree *mt = *ptr;
if (!mt)
return;
assert(mt->refcount > 0);
+
mt->refcount--;
if (!mt->refcount) {
radeon_bo_unref(mt->bo);
free(mt);
}
+
+ *ptr = 0;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
index db28252da3..57299ceafa 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
@@ -87,8 +87,9 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *
GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel,
GLuint width0, GLuint height0, GLuint depth0,
GLuint bpp, GLuint tilebits, GLuint compressed);
-void radeon_miptree_reference(radeon_mipmap_tree *mt);
-void radeon_miptree_unreference(radeon_mipmap_tree *mt);
+
+void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr);
+void radeon_miptree_unreference(radeon_mipmap_tree **ptr);
GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
struct gl_texture_image *texImage, GLuint face, GLuint level);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 59bc8c34de..607ce7864e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -81,8 +81,7 @@ void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage)
radeon_texture_image* image = get_radeon_texture_image(timage);
if (image->mt) {
- radeon_miptree_unreference(image->mt);
- image->mt = 0;
+ radeon_miptree_unreference(&image->mt);
assert(!image->base.Data);
} else {
_mesa_free_texture_image_data(ctx, timage);
@@ -240,8 +239,7 @@ static void radeon_generate_mipmap(GLcontext *ctx, GLenum target,
image->mtlevel = i;
image->mtface = face;
- radeon_miptree_unreference(image->mt);
- image->mt = NULL;
+ radeon_miptree_unreference(&image->mt);
}
}
@@ -571,18 +569,16 @@ static void radeon_teximage(
t->mt->lastLevel == level &&
t->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
!radeon_miptree_matches_image(t->mt, texImage, face, level)) {
- radeon_miptree_unreference(t->mt);
- t->mt = NULL;
+ radeon_miptree_unreference(&t->mt);
}
if (!t->mt)
radeon_try_alloc_miptree(rmesa, t, image, face, level);
if (t->mt && radeon_miptree_matches_image(t->mt, texImage, face, level)) {
radeon_mipmap_level *lvl;
- image->mt = t->mt;
image->mtlevel = level - t->mt->firstLevel;
image->mtface = face;
- radeon_miptree_reference(t->mt);
+ radeon_miptree_reference(t->mt, &image->mt);
lvl = &image->mt->levels[image->mtlevel];
dstRowStride = lvl->rowstride;
} else {
@@ -894,7 +890,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag
dstlvl->size);
radeon_bo_unmap(image->mt->bo);
- radeon_miptree_unreference(image->mt);
+ radeon_miptree_unreference(&image->mt);
} else {
uint32_t srcrowstride;
uint32_t height;
@@ -919,10 +915,9 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag
radeon_bo_unmap(mt->bo);
- image->mt = mt;
image->mtface = face;
image->mtlevel = level;
- radeon_miptree_reference(image->mt);
+ radeon_miptree_reference(mt, &image->mt);
}
int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj)
@@ -954,12 +949,10 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t
if (baseimage->mt &&
baseimage->mt != t->mt &&
radeon_miptree_matches_texture(baseimage->mt, &t->base)) {
- radeon_miptree_unreference(t->mt);
- t->mt = baseimage->mt;
- radeon_miptree_reference(t->mt);
+ radeon_miptree_unreference(&t->mt);
+ radeon_miptree_reference(baseimage->mt, &t->mt);
} else if (t->mt && !radeon_miptree_matches_texture(t->mt, &t->base)) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
+ radeon_miptree_unreference(&t->mt);
}
if (!t->mt) {
--
cgit v1.2.3
From 9d0af686b27b82dce8ad1ee4c951098660807be6 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 14 Nov 2009 15:03:31 +0100
Subject: radeon: minor refactoring of texture code
Also properly set dstImageOffsets for TexSubImage case.
---
src/mesa/drivers/dri/radeon/radeon_texture.c | 57 ++++++++++++++++++++++------
1 file changed, 46 insertions(+), 11 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 607ce7864e..8fc686581b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -508,6 +508,27 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
return MESA_FORMAT_NONE; /* never get here */
}
+static GLuint * allocate_image_offsets(GLcontext *ctx,
+ unsigned alignedWidth,
+ unsigned height,
+ unsigned depth)
+{
+ int i;
+ GLuint *offsets;
+
+ offsets = _mesa_malloc(depth * sizeof(GLuint)) ;
+ if (!offsets) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex[Sub]Image");
+ return NULL;
+ }
+
+ for (i = 0; i < depth; ++i) {
+ offsets[i] = alignedWidth * height * i;
+ }
+
+ return offsets;
+}
+
/**
* All glTexImage calls go through this function.
*/
@@ -605,8 +626,8 @@ static void radeon_teximage(
}
if (pixels) {
- radeon_teximage_map(image, GL_TRUE);
if (compressed) {
+ radeon_teximage_map(image, GL_TRUE);
if (image->mt) {
uint32_t srcRowStride, bytesPerRow, rows;
srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
@@ -629,19 +650,17 @@ static void radeon_teximage(
}
if (dims == 3) {
- int i;
-
- dstImageOffsets = _mesa_malloc(depth * sizeof(GLuint)) ;
- if (!dstImageOffsets)
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
-
- for (i = 0; i < depth; ++i) {
- dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat) * height * i;
+ unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
+ dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
+ if (!dstImageOffsets) {
+ return;
}
} else {
dstImageOffsets = texImage->ImageOffsets;
}
+ radeon_teximage_map(image, GL_TRUE);
+
if (!_mesa_texstore(ctx, dims,
texImage->_BaseFormat,
texImage->TexFormat,
@@ -752,7 +771,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
if (pixels) {
GLint dstRowStride;
- radeon_teximage_map(image, GL_TRUE);
+ GLuint *dstImageOffsets;
if (image->mt) {
radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
@@ -761,6 +780,18 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
}
+ if (dims == 3) {
+ unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
+ dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
+ if (!dstImageOffsets) {
+ return;
+ }
+ } else {
+ dstImageOffsets = texImage->ImageOffsets;
+ }
+
+ radeon_teximage_map(image, GL_TRUE);
+
if (compressed) {
uint32_t srcRowStride, bytesPerRow, rows;
GLubyte *img_start;
@@ -786,12 +817,16 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
texImage->TexFormat, texImage->Data,
xoffset, yoffset, zoffset,
dstRowStride,
- texImage->ImageOffsets,
+ dstImageOffsets,
width, height, depth,
format, type, pixels, packing)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
}
}
+
+ if (dims == 3) {
+ _mesa_free(dstImageOffsets);
+ }
}
radeon_teximage_unmap(image);
--
cgit v1.2.3
From 8f88cf3938f0156d4df6fcc5fde2711d40b85d03 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 14 Nov 2009 15:15:42 +0100
Subject: radeon: more texture code refactoring
---
src/mesa/drivers/dri/radeon/radeon_texture.c | 208 ++++++++++++---------------
1 file changed, 92 insertions(+), 116 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 8fc686581b..c093d1283d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -529,6 +529,83 @@ static GLuint * allocate_image_offsets(GLcontext *ctx,
return offsets;
}
+/**
+ * Update a subregion of the given texture image.
+ */
+static void radeon_store_teximage(GLcontext* ctx, int dims,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLsizei imageSize,
+ GLenum format, GLenum type,
+ const GLvoid * pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ int compressed)
+{
+ radeon_texture_image* image = get_radeon_texture_image(texImage);
+
+ GLint dstRowStride;
+ GLuint *dstImageOffsets;
+
+ if (image->mt) {
+ radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
+ dstRowStride = lvl->rowstride;
+ } else {
+ dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
+ }
+
+ if (dims == 3) {
+ unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
+ dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
+ if (!dstImageOffsets) {
+ return;
+ }
+ } else {
+ dstImageOffsets = texImage->ImageOffsets;
+ }
+
+ radeon_teximage_map(image, GL_TRUE);
+
+ if (compressed) {
+ uint32_t srcRowStride, bytesPerRow, rows;
+ GLubyte *img_start;
+ if (!image->mt) {
+ dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
+ img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
+ texImage->TexFormat,
+ texImage->Width, texImage->Data);
+ }
+ else {
+ uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4);
+ img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
+ }
+ srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
+ bytesPerRow = srcRowStride;
+ rows = (height + 3) / 4;
+
+ copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
+
+ }
+ else {
+ if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
+ texImage->TexFormat, texImage->Data,
+ xoffset, yoffset, zoffset,
+ dstRowStride,
+ dstImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
+ }
+ }
+
+ if (dims == 3) {
+ _mesa_free(dstImageOffsets);
+ }
+
+ radeon_teximage_unmap(image);
+}
+
/**
* All glTexImage calls go through this function.
*/
@@ -626,63 +703,16 @@ static void radeon_teximage(
}
if (pixels) {
- if (compressed) {
- radeon_teximage_map(image, GL_TRUE);
- if (image->mt) {
- uint32_t srcRowStride, bytesPerRow, rows;
- srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
- bytesPerRow = srcRowStride;
- rows = (height + 3) / 4;
- copy_rows(texImage->Data, image->mt->levels[level].rowstride,
- pixels, srcRowStride, rows, bytesPerRow);
- } else {
- memcpy(texImage->Data, pixels, imageSize);
- }
- } else {
- GLuint dstRowStride;
- GLuint *dstImageOffsets;
-
- if (image->mt) {
- radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
- dstRowStride = lvl->rowstride;
- } else {
- dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat);
- }
-
- if (dims == 3) {
- unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
- dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
- if (!dstImageOffsets) {
- return;
- }
- } else {
- dstImageOffsets = texImage->ImageOffsets;
- }
-
- radeon_teximage_map(image, GL_TRUE);
-
- if (!_mesa_texstore(ctx, dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- dstImageOffsets,
- width, height, depth,
- format, type, pixels, packing)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
- }
-
- if (dims == 3)
- _mesa_free(dstImageOffsets);
- }
+ radeon_store_teximage(ctx, dims,
+ 0, 0, 0,
+ width, height, depth,
+ imageSize, format, type,
+ pixels, packing,
+ texObj, texImage,
+ compressed);
}
_mesa_unmap_teximage_pbo(ctx, packing);
-
- if (pixels)
- radeon_teximage_unmap(image);
-
-
}
void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level,
@@ -735,7 +765,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level,
}
/**
- * Update a subregion of the given texture image.
+ * All glTexSubImage calls go through this function.
*/
static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level,
GLint xoffset, GLint yoffset, GLint zoffset,
@@ -770,70 +800,16 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
}
if (pixels) {
- GLint dstRowStride;
- GLuint *dstImageOffsets;
-
- if (image->mt) {
- radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
- dstRowStride = lvl->rowstride;
- } else {
- dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
- }
-
- if (dims == 3) {
- unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
- dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
- if (!dstImageOffsets) {
- return;
- }
- } else {
- dstImageOffsets = texImage->ImageOffsets;
- }
-
- radeon_teximage_map(image, GL_TRUE);
-
- if (compressed) {
- uint32_t srcRowStride, bytesPerRow, rows;
- GLubyte *img_start;
- if (!image->mt) {
- dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
- img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->TexFormat,
- texImage->Width, texImage->Data);
- }
- else {
- uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4);
- img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
- }
- srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
- bytesPerRow = srcRowStride;
- rows = (height + 3) / 4;
-
- copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
-
- }
- else {
- if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
- texImage->TexFormat, texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- dstImageOffsets,
- width, height, depth,
- format, type, pixels, packing)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
- }
- }
-
- if (dims == 3) {
- _mesa_free(dstImageOffsets);
- }
+ radeon_store_teximage(ctx, dims,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ imageSize, format, type,
+ pixels, packing,
+ texObj, texImage,
+ compressed);
}
- radeon_teximage_unmap(image);
-
_mesa_unmap_teximage_pbo(ctx, packing);
-
-
}
void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
--
cgit v1.2.3
From 23ec7c457483aae1e0d399e9b570f1860c27c780 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 14 Nov 2009 16:55:39 +0100
Subject: radeon: rework mipmap tree
---
src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +-
src/mesa/drivers/dri/r300/r300_tex.c | 6 -
src/mesa/drivers/dri/r300/r300_texstate.c | 8 +-
.../drivers/dri/radeon/radeon_common_context.h | 4 +
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 474 ++++++++++++++-------
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 24 +-
src/mesa/drivers/dri/radeon/radeon_texture.c | 243 +++--------
src/mesa/drivers/dri/radeon/radeon_texture.h | 3 +-
8 files changed, 400 insertions(+), 364 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 8a56b9e63c..4b5ed2d410 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -169,7 +169,7 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom)
if (t && !t->image_override) {
BEGIN_BATCH_NO_AUTOSTATE(4);
OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1);
- OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0,
+ OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t),
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
END_BATCH();
} else if (!t) {
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 7e94e93df2..726b3ff98e 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -223,12 +223,6 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- radeon_miptree_unreference(&t->mt);
t->validated = GL_FALSE;
break;
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 7b1adcf31d..e6f2c0c1a7 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -203,9 +203,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj)
static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
{
const struct gl_texture_image *firstImage;
- int firstlevel = t->mt ? t->mt->firstLevel : 0;
-
- firstImage = t->base.Image[0][firstlevel];
+ firstImage = t->base.Image[0][t->minLod];
if (!t->image_override
&& VALID_FORMAT(firstImage->TexFormat)) {
@@ -228,7 +226,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT)))
| ((R300_TX_HEIGHTMASK_MASK & ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT)))
| ((R300_TX_DEPTHMASK_MASK & ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT)))
- | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT))));
+ | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->maxLod - t->minLod) << R300_TX_MAX_MIP_LEVEL_SHIFT))));
t->tile_bits = 0;
@@ -239,7 +237,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
if (t->base.Target == GL_TEXTURE_RECTANGLE_NV) {
- unsigned int align = (64 / t->mt->bpp) - 1;
+ unsigned int align = (64 / _mesa_get_format_bytes(firstImage->TexFormat)) - 1;
t->pp_txsize |= R300_TX_SIZE_TXPITCH_EN;
if (!t->image_override)
t->pp_txpitch = ((firstImage->Width + align) & ~align) - 1;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 5a0678b9d6..ded81fff29 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -208,6 +208,10 @@ struct radeon_tex_obj {
* and so on.
*/
GLboolean validated;
+ /* Minimum LOD to be used during rendering */
+ unsigned minLod;
+ /* Miximum LOD to be used during rendering */
+ unsigned maxLod;
GLuint override_offset;
GLboolean image_override; /* Image overridden by GLX_EXT_tfp */
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index f635f58d6a..f01136b9d4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2009 Maciej Cencora.
* Copyright (C) 2008 Nicolai Haehnle.
*
* All Rights Reserved.
@@ -32,10 +33,14 @@
#include "main/simple_list.h"
#include "main/texcompress.h"
+#include "main/teximage.h"
+/* TODO: remove if texture completeness check is removed */
+#include "main/texobj.h"
+#include "radeon_texture.h"
static GLuint radeon_compressed_texture_size(GLcontext *ctx,
GLsizei width, GLsizei height, GLsizei depth,
- GLuint mesaFormat)
+ gl_format mesaFormat)
{
GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth);
@@ -55,29 +60,6 @@ static GLuint radeon_compressed_texture_size(GLcontext *ctx,
return size;
}
-
-static int radeon_compressed_num_bytes(GLuint mesaFormat)
-{
- int bytes = 0;
- switch(mesaFormat) {
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- bytes = 2;
- break;
-
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
- bytes = 4;
- default:
- break;
- }
-
- return bytes;
-}
-
/**
* Compute sizes and fill in offset and blit information for the given
* image (determined by \p face and \p level).
@@ -92,25 +74,24 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
uint32_t row_align;
/* Find image size in bytes */
- if (mt->compressed) {
+ if (_mesa_is_format_compressed(mt->mesaFormat)) {
/* TODO: Is this correct? Need test cases for compressed textures! */
row_align = rmesa->texture_compressed_row_align - 1;
- lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align;
- lvl->size = radeon_compressed_texture_size(mt->radeon->glCtx,
- lvl->width, lvl->height, lvl->depth, mt->compressed);
+ lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
+ lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat);
} else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
row_align = rmesa->texture_rect_row_align - 1;
- lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align;
+ lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
lvl->size = lvl->rowstride * lvl->height;
} else if (mt->tilebits & RADEON_TXO_MICRO_TILE) {
/* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned,
* though the actual offset may be different (if texture is less than
* 32 bytes width) to the untiled case */
- lvl->rowstride = (lvl->width * mt->bpp * 2 + 31) & ~31;
+ lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31;
lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth;
} else {
row_align = rmesa->texture_row_align - 1;
- lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align;
+ lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
lvl->size = lvl->rowstride * lvl->height * lvl->depth;
}
assert(lvl->size > 0);
@@ -138,17 +119,15 @@ static GLuint minify(GLuint size, GLuint levels)
static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_tree *mt)
{
GLuint curOffset;
- GLuint numLevels;
GLuint i;
GLuint face;
- numLevels = mt->lastLevel - mt->firstLevel + 1;
- assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels);
+ assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels);
curOffset = 0;
for(face = 0; face < mt->faces; face++) {
- for(i = 0; i < numLevels; i++) {
+ for(i = 0; i < mt->numLevels; i++) {
mt->levels[i].width = minify(mt->width0, i);
mt->levels[i].height = minify(mt->height0, i);
mt->levels[i].depth = minify(mt->depth0, i);
@@ -163,14 +142,12 @@ static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_
static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_tree *mt)
{
GLuint curOffset;
- GLuint numLevels;
GLuint i;
- numLevels = mt->lastLevel - mt->firstLevel + 1;
- assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels);
+ assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels);
curOffset = 0;
- for(i = 0; i < numLevels; i++) {
+ for(i = 0; i < mt->numLevels; i++) {
GLuint face;
mt->levels[i].width = minify(mt->width0, i);
@@ -188,27 +165,22 @@ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_
/**
* Create a new mipmap tree, calculate its layout and allocate memory.
*/
-radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *t,
- GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel,
- GLuint width0, GLuint height0, GLuint depth0,
- GLuint bpp, GLuint tilebits, GLuint compressed)
+static radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa,
+ GLenum target, gl_format mesaFormat, GLuint baseLevel, GLuint numLevels,
+ GLuint width0, GLuint height0, GLuint depth0, GLuint tilebits)
{
radeon_mipmap_tree *mt = CALLOC_STRUCT(_radeon_mipmap_tree);
- mt->radeon = rmesa;
- mt->internal_format = internal_format;
+ mt->mesaFormat = mesaFormat;
mt->refcount = 1;
- mt->t = t;
mt->target = target;
mt->faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- mt->firstLevel = firstLevel;
- mt->lastLevel = lastLevel;
+ mt->baseLevel = baseLevel;
+ mt->numLevels = numLevels;
mt->width0 = width0;
mt->height0 = height0;
mt->depth0 = depth0;
- mt->bpp = compressed ? radeon_compressed_num_bytes(compressed) : bpp;
mt->tilebits = tilebits;
- mt->compressed = compressed;
if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_R300)
calculate_miptree_layout_r300(rmesa, mt);
@@ -250,34 +222,16 @@ void radeon_miptree_unreference(radeon_mipmap_tree **ptr)
*ptr = 0;
}
-
/**
- * Calculate first and last mip levels for the given texture object,
- * where the dimensions are taken from the given texture image at
- * the given level.
- *
- * Note: level is the OpenGL level number, which is not necessarily the same
- * as the first level that is actually present.
- *
- * The base level image of the given texture face must be non-null,
- * or this will fail.
+ * Calculate min and max LOD for the given texture object.
+ * @param[in] tObj texture object whose LOD values to calculate
+ * @param[out] pminLod minimal LOD
+ * @param[out] pmaxLod maximal LOD
*/
-static void calculate_first_last_level(struct gl_texture_object *tObj,
- GLuint *pfirstLevel, GLuint *plastLevel,
- GLuint face, GLuint level)
+static void calculate_min_max_lod(struct gl_texture_object *tObj,
+ unsigned *pminLod, unsigned *pmaxLod)
{
- const struct gl_texture_image * const baseImage =
- tObj->Image[face][level];
-
- assert(baseImage);
-
- /* These must be signed values. MinLod and MaxLod can be negative numbers,
- * and having firstLevel and lastLevel as signed prevents the need for
- * extra sign checks.
- */
- int firstLevel;
- int lastLevel;
-
+ int minLod, maxLod;
/* Yes, this looks overly complicated, but it's all needed.
*/
switch (tObj->Target) {
@@ -288,55 +242,46 @@ static void calculate_first_last_level(struct gl_texture_object *tObj,
if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
/* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
*/
- firstLevel = lastLevel = tObj->BaseLevel;
+ minLod = maxLod = tObj->BaseLevel;
} else {
- firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- firstLevel = MIN2(firstLevel, level + baseImage->MaxLog2);
- lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, level + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
+ minLod = tObj->BaseLevel + (GLint)(tObj->MinLod);
+ minLod = MAX2(minLod, tObj->BaseLevel);
+ minLod = MIN2(minLod, tObj->MaxLevel);
+ maxLod = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
+ maxLod = MIN2(maxLod, tObj->MaxLevel);
+ maxLod = MIN2(maxLod, tObj->Image[0][minLod]->MaxLog2 + minLod);
+ maxLod = MAX2(maxLod, minLod); /* need at least one level */
}
break;
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_4D_SGIS:
- firstLevel = lastLevel = 0;
+ minLod = maxLod = 0;
break;
default:
return;
}
/* save these values */
- *pfirstLevel = firstLevel;
- *plastLevel = lastLevel;
+ *pminLod = minLod;
+ *pmaxLod = maxLod;
}
-
/**
* Checks whether the given miptree can hold the given texture image at the
* given face and level.
*/
GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
- struct gl_texture_image *texImage, GLuint face, GLuint level)
+ struct gl_texture_image *texImage, GLuint face, GLuint mtLevel)
{
- GLboolean isCompressed = _mesa_is_format_compressed(texImage->TexFormat);
radeon_mipmap_level *lvl;
- if (face >= mt->faces || level < mt->firstLevel || level > mt->lastLevel)
- return GL_FALSE;
-
- if (texImage->InternalFormat != mt->internal_format ||
- isCompressed != mt->compressed)
+ if (face >= mt->faces || mtLevel > mt->numLevels)
return GL_FALSE;
- if (!isCompressed &&
- !mt->compressed &&
- _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp)
+ if (texImage->TexFormat != mt->mesaFormat)
return GL_FALSE;
- lvl = &mt->levels[level - mt->firstLevel];
+ lvl = &mt->levels[mtLevel];
if (lvl->width != texImage->Width ||
lvl->height != texImage->Height ||
lvl->depth != texImage->Depth)
@@ -345,64 +290,72 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
return GL_TRUE;
}
-
/**
* Checks whether the given miptree has the right format to store the given texture object.
*/
-GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj)
+static GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj)
{
struct gl_texture_image *firstImage;
- GLuint compressed;
- GLuint numfaces = 1;
- GLuint firstLevel, lastLevel;
- GLuint texelBytes;
-
- calculate_first_last_level(texObj, &firstLevel, &lastLevel, 0, texObj->BaseLevel);
- if (texObj->Target == GL_TEXTURE_CUBE_MAP)
- numfaces = 6;
-
- firstImage = texObj->Image[0][firstLevel];
- compressed = _mesa_is_format_compressed(firstImage->TexFormat) ? firstImage->TexFormat : 0;
- texelBytes = _mesa_get_format_bytes(firstImage->TexFormat);
-
- return (mt->firstLevel == firstLevel &&
- mt->lastLevel == lastLevel &&
- mt->width0 == firstImage->Width &&
- mt->height0 == firstImage->Height &&
- mt->depth0 == firstImage->Depth &&
- mt->compressed == compressed &&
- (!mt->compressed ? (mt->bpp == texelBytes) : 1));
-}
+ unsigned numLevels;
+ radeon_mipmap_level *mtBaseLevel;
+ if (texObj->BaseLevel < mt->baseLevel)
+ return GL_FALSE;
+
+ mtBaseLevel = &mt->levels[texObj->BaseLevel - mt->baseLevel];
+ firstImage = texObj->Image[0][texObj->BaseLevel];
+ numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, firstImage->MaxLog2 + 1);
+
+ if (RADEON_DEBUG & RADEON_TEXTURE) {
+ fprintf(stderr, "Checking if miptree %p matches texObj %p\n", mt, texObj);
+ fprintf(stderr, "target %d vs %d\n", mt->target, texObj->Target);
+ fprintf(stderr, "format %d vs %d\n", mt->mesaFormat, firstImage->TexFormat);
+ fprintf(stderr, "numLevels %d vs %d\n", mt->numLevels, numLevels);
+ fprintf(stderr, "width0 %d vs %d\n", mtBaseLevel->width, firstImage->Width);
+ fprintf(stderr, "height0 %d vs %d\n", mtBaseLevel->height, firstImage->Height);
+ fprintf(stderr, "depth0 %d vs %d\n", mtBaseLevel->depth, firstImage->Depth);
+ if (mt->target == texObj->Target &&
+ mt->mesaFormat == firstImage->TexFormat &&
+ mt->numLevels >= numLevels &&
+ mtBaseLevel->width == firstImage->Width &&
+ mtBaseLevel->height == firstImage->Height &&
+ mtBaseLevel->depth == firstImage->Depth) {
+ fprintf(stderr, "MATCHED\n");
+ } else {
+ fprintf(stderr, "NOT MATCHED\n");
+ }
+ }
+
+ return (mt->target == texObj->Target &&
+ mt->mesaFormat == firstImage->TexFormat &&
+ mt->numLevels >= numLevels &&
+ mtBaseLevel->width == firstImage->Width &&
+ mtBaseLevel->height == firstImage->Height &&
+ mtBaseLevel->depth == firstImage->Depth);
+}
/**
- * Try to allocate a mipmap tree for the given texture that will fit the
- * given image in the given position.
+ * Try to allocate a mipmap tree for the given texture object.
+ * @param[in] rmesa radeon context
+ * @param[in] t radeon texture object
*/
-void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t,
- radeon_texture_image *image, GLuint face, GLuint level)
+void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t)
{
- GLuint compressed = _mesa_is_format_compressed(image->base.TexFormat) ? image->base.TexFormat : 0;
- GLuint numfaces = 1;
- GLuint firstLevel, lastLevel;
- GLuint texelBytes;
+ struct gl_texture_object *texObj = &t->base;
+ struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
+ GLuint numLevels;
assert(!t->mt);
- calculate_first_last_level(&t->base, &firstLevel, &lastLevel, face, level);
- if (t->base.Target == GL_TEXTURE_CUBE_MAP)
- numfaces = 6;
-
- if (level != firstLevel || face >= numfaces)
+ if (!texImg)
return;
- texelBytes = _mesa_get_format_bytes(image->base.TexFormat);
+ numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, texImg->MaxLog2 + 1);
- t->mt = radeon_miptree_create(rmesa, t, t->base.Target,
- image->base.InternalFormat,
- firstLevel, lastLevel,
- image->base.Width, image->base.Height, image->base.Depth,
- texelBytes, t->tile_bits, compressed);
+ t->mt = radeon_miptree_create(rmesa, t->base.Target,
+ texImg->TexFormat, texObj->BaseLevel,
+ numLevels, texImg->Width, texImg->Height,
+ texImg->Depth, t->tile_bits);
}
/* Although we use the image_offset[] array to store relative offsets
@@ -414,21 +367,238 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t,
void
radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets)
{
- if (mt->target != GL_TEXTURE_3D || mt->faces == 1)
- offsets[0] = 0;
- else {
- int i;
- for (i = 0; i < 6; i++)
- offsets[i] = mt->levels[level].faces[i].offset;
- }
+ if (mt->target != GL_TEXTURE_3D || mt->faces == 1) {
+ offsets[0] = 0;
+ } else {
+ int i;
+ for (i = 0; i < 6; i++) {
+ offsets[i] = mt->levels[level].faces[i].offset;
+ }
+ }
}
GLuint
radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level)
{
- if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
- return (mt->levels[level].faces[face].offset);
- else
- return mt->levels[level].faces[0].offset;
+ if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
+ return (mt->levels[level].faces[face].offset);
+ else
+ return mt->levels[level].faces[0].offset;
+}
+
+/**
+ * Convert radeon miptree texture level to GL texture level
+ * @param[in] tObj texture object whom level is to be converted
+ * @param[in] level radeon miptree texture level
+ * @return GL texture level
+ */
+unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level)
+{
+ return level + tObj->BaseLevel;
+}
+
+/**
+ * Convert GL texture level to radeon miptree texture level
+ * @param[in] tObj texture object whom level is to be converted
+ * @param[in] level GL texture level
+ * @return radeon miptree texture level
+ */
+unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level)
+{
+ return level - tObj->BaseLevel;
}
+
+/**
+ * Ensure that the given image is stored in the given miptree from now on.
+ */
+static void migrate_image_to_miptree(radeon_mipmap_tree *mt,
+ radeon_texture_image *image,
+ int face, int mtLevel)
+{
+ radeon_mipmap_level *dstlvl = &mt->levels[mtLevel];
+ unsigned char *dest;
+
+ assert(image->mt != mt);
+ assert(dstlvl->width == image->base.Width);
+ assert(dstlvl->height == image->base.Height);
+ assert(dstlvl->depth == image->base.Depth);
+
+ radeon_bo_map(mt->bo, GL_TRUE);
+ dest = mt->bo->ptr + dstlvl->faces[face].offset;
+
+ if (image->mt) {
+ /* Format etc. should match, so we really just need a memcpy().
+ * In fact, that memcpy() could be done by the hardware in many
+ * cases, provided that we have a proper memory manager.
+ */
+ assert(mt->mesaFormat == image->base.TexFormat);
+
+ radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel];
+
+ assert(srclvl->size == dstlvl->size);
+ assert(srclvl->rowstride == dstlvl->rowstride);
+
+ radeon_bo_map(image->mt->bo, GL_FALSE);
+
+ memcpy(dest,
+ image->mt->bo->ptr + srclvl->faces[face].offset,
+ dstlvl->size);
+ radeon_bo_unmap(image->mt->bo);
+
+ radeon_miptree_unreference(&image->mt);
+ } else {
+ /* need to confirm this value is correct */
+ if (_mesa_is_format_compressed(image->base.TexFormat)) {
+ unsigned size = _mesa_format_image_size(image->base.TexFormat,
+ image->base.Width,
+ image->base.Height,
+ image->base.Depth);
+ memcpy(dest, image->base.Data, size);
+ } else {
+ uint32_t srcrowstride;
+ uint32_t height;
+
+ height = image->base.Height * image->base.Depth;
+ srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat);
+ copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride,
+ height, srcrowstride);
+ }
+
+ _mesa_free_texmemory(image->base.Data);
+ image->base.Data = 0;
+ }
+
+ radeon_bo_unmap(mt->bo);
+
+ radeon_miptree_reference(mt, &image->mt);
+ image->mtface = face;
+ image->mtlevel = mtLevel;
+}
+
+/**
+ * Filter matching miptrees, and select one with the most of data.
+ * @param[in] texObj radeon texture object
+ * @param[in] firstLevel first texture level to check
+ * @param[in] lastLevel last texture level to check
+ */
+static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
+ unsigned firstLevel,
+ unsigned lastLevel)
+{
+ const unsigned numLevels = lastLevel - firstLevel;
+ unsigned *mtSizes = calloc(numLevels, sizeof(unsigned));
+ radeon_mipmap_tree **mts = calloc(numLevels, sizeof(radeon_mipmap_tree *));
+ unsigned mtCount = 0;
+ unsigned maxMtIndex = 0;
+
+ for (unsigned level = firstLevel; level <= lastLevel; ++level) {
+ radeon_texture_image *img = get_radeon_texture_image(texObj->base.Image[0][level]);
+ unsigned found = 0;
+ // TODO: why this hack??
+ if (!img)
+ break;
+
+ if (!img->mt || !radeon_miptree_matches_texture(img->mt, &texObj->base))
+ continue;
+
+ for (int i = 0; i < mtCount; ++i) {
+ if (mts[i] == img->mt) {
+ found = 1;
+ mtSizes[i] += img->mt->levels[img->mtlevel].size;
+ break;
+ }
+ }
+
+ if (!found) {
+ mtSizes[mtCount] += img->mt->levels[img->mtlevel].size;
+ mts[mtCount++] = img->mt;
+ mtCount++;
+ }
+ }
+
+ if (mtCount == 0) {
+ return NULL;
+ }
+
+ for (int i = 1; i < mtCount; ++i) {
+ if (mtSizes[i] > mtSizes[maxMtIndex]) {
+ maxMtIndex = i;
+ }
+ }
+
+ return mts[maxMtIndex];
+}
+
+/**
+ * Validate texture mipmap tree.
+ * If individual images are stored in different mipmap trees
+ * use the mipmap tree that has the most of the correct data.
+ */
+int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj)
+{
+ radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
+ radeonTexObj *t = radeon_tex_obj(texObj);
+
+ if (t->validated || t->image_override) {
+ return GL_TRUE;
+ }
+
+ if (texObj->Image[0][texObj->BaseLevel]->Border > 0)
+ return GL_FALSE;
+
+ /* TODO: is this really necessary? */
+ _mesa_test_texobj_completeness(rmesa->glCtx, texObj);
+ assert(texObj->_Complete);
+
+ calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod);
+
+ if (RADEON_DEBUG & RADEON_TEXTURE)
+ fprintf(stderr, "%s: Validating texture %p now, minLod = %d, maxLod = %d\n",
+ __FUNCTION__, texObj ,t->minLod, t->maxLod);
+
+ radeon_mipmap_tree *dst_miptree;
+ dst_miptree = get_biggest_matching_miptree(t, t->minLod, t->maxLod);
+
+ if (!dst_miptree) {
+ radeon_miptree_unreference(&t->mt);
+ radeon_try_alloc_miptree(rmesa, t);
+ dst_miptree = t->mt;
+ }
+
+ const unsigned faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ unsigned face, level;
+ radeon_texture_image *img;
+ /* Validate only the levels that will actually be used during rendering */
+ for (face = 0; face < faces; ++face) {
+ for (level = t->minLod; level <= t->maxLod; ++level) {
+ img = get_radeon_texture_image(texObj->Image[face][level]);
+
+ if (RADEON_DEBUG & RADEON_TEXTURE) {
+ fprintf(stderr, "Checking image level %d, face %d, mt %p ... ", level, face, img->mt);
+ }
+
+ if (img->mt != dst_miptree) {
+ if (RADEON_DEBUG & RADEON_TEXTURE) {
+ fprintf(stderr, "MIGRATING\n");
+ }
+ migrate_image_to_miptree(dst_miptree, img, face, radeon_gl_level_to_miptree_level(texObj, level));
+ } else if (RADEON_DEBUG & RADEON_TEXTURE) {
+ fprintf(stderr, "OK\n");
+ }
+ }
+ }
+
+ t->validated = GL_TRUE;
+
+ return GL_TRUE;
+}
+
+uint32_t get_base_teximage_offset(radeonTexObj *texObj)
+{
+ if (!texObj->mt) {
+ return 0;
+ } else {
+ return radeon_miptree_image_offset(texObj->mt, 0, texObj->minLod);
+ }
+}
\ No newline at end of file
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
index 57299ceafa..28b8485095 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
@@ -59,44 +59,38 @@ struct _radeon_mipmap_level {
* changed.
*/
struct _radeon_mipmap_tree {
- radeonContextPtr radeon;
- radeonTexObj *t;
struct radeon_bo *bo;
GLuint refcount;
GLuint totalsize; /** total size of the miptree, in bytes */
GLenum target; /** GL_TEXTURE_xxx */
- GLenum internal_format;
+ GLenum mesaFormat; /** MESA_FORMAT_xxx */
GLuint faces; /** # of faces: 6 for cubemaps, 1 otherwise */
- GLuint firstLevel; /** First mip level stored in this mipmap tree */
- GLuint lastLevel; /** Last mip level stored in this mipmap tree */
+ GLuint baseLevel; /** gl_texture_object->baseLevel it was created for */
+ GLuint numLevels; /** Number of mip levels stored in this mipmap tree */
GLuint width0; /** Width of firstLevel image */
GLuint height0; /** Height of firstLevel image */
GLuint depth0; /** Depth of firstLevel image */
- GLuint bpp; /** Bytes per texel */
GLuint tilebits; /** RADEON_TXO_xxx_TILE */
- GLuint compressed; /** MESA_FORMAT_xxx indicating a compressed format, or 0 if uncompressed */
radeon_mipmap_level levels[RADEON_MIPTREE_MAX_TEXTURE_LEVELS];
};
-radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *t,
- GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel,
- GLuint width0, GLuint height0, GLuint depth0,
- GLuint bpp, GLuint tilebits, GLuint compressed);
-
void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr);
void radeon_miptree_unreference(radeon_mipmap_tree **ptr);
GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
struct gl_texture_image *texImage, GLuint face, GLuint level);
-GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj);
-void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t,
- radeon_texture_image *texImage, GLuint face, GLuint level);
+void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t);
GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level);
void radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets);
+
+unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level);
+unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level);
+
+uint32_t get_base_teximage_offset(radeonTexObj *texObj);
#endif /* __RADEON_MIPMAP_TREE_H_ */
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index c093d1283d..6f11f1fa4a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2009 Maciej Cencora.
* Copyright (C) 2008 Nicolai Haehnle.
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
*
@@ -46,7 +47,7 @@
#include "radeon_mipmap_tree.h"
-static void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
+void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
GLuint numrows, GLuint rowsize)
{
assert(rowsize <= dststride);
@@ -107,7 +108,7 @@ static void teximage_set_map_data(radeon_texture_image *image)
lvl = &image->mt->levels[image->mtlevel];
image->base.Data = image->mt->bo->ptr + lvl->faces[image->mtface].offset;
- image->base.RowStride = lvl->rowstride / image->mt->bpp;
+ image->base.RowStride = lvl->rowstride / _mesa_get_format_bytes(image->base.TexFormat);
}
@@ -173,7 +174,7 @@ void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
radeon_bo_map(t->mt->bo, GL_FALSE);
for(face = 0; face < t->mt->faces; ++face) {
- for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level)
+ for(level = t->minLod; level <= t->maxLod; ++level)
teximage_set_map_data(get_radeon_texture_image(texObj->Image[face][level]));
}
}
@@ -190,7 +191,7 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
return;
for(face = 0; face < t->mt->faces; ++face) {
- for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level)
+ for(level = t->minLod; level <= t->maxLod; ++level)
texObj->Image[face][level]->Data = 0;
}
radeon_bo_unmap(t->mt->bo);
@@ -508,6 +509,31 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
return MESA_FORMAT_NONE; /* never get here */
}
+static void teximage_assign_miptree(radeonContextPtr rmesa,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ unsigned face,
+ unsigned level)
+{
+ radeonTexObj *t = radeon_tex_obj(texObj);
+ radeon_texture_image* image = get_radeon_texture_image(texImage);
+
+ /* Try using current miptree, or create new if there isn't any */
+ if (!t->mt || !radeon_miptree_matches_image(t->mt, texImage, face,
+ radeon_gl_level_to_miptree_level(texObj, level))) {
+ radeon_miptree_unreference(&t->mt);
+ radeon_try_alloc_miptree(rmesa, t);
+ }
+
+ /* Miptree alocation may have failed,
+ * when there was no image for baselevel specified */
+ if (t->mt) {
+ image->mtface = face;
+ image->mtlevel = radeon_gl_level_to_miptree_level(texObj, level);
+ radeon_miptree_reference(t->mt, &image->mt);
+ }
+}
+
static GLuint * allocate_image_offsets(GLcontext *ctx,
unsigned alignedWidth,
unsigned height,
@@ -543,16 +569,20 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
struct gl_texture_image *texImage,
int compressed)
{
+ radeonTexObj *t = radeon_tex_obj(texObj);
radeon_texture_image* image = get_radeon_texture_image(texImage);
- GLint dstRowStride;
+ GLuint dstRowStride;
GLuint *dstImageOffsets;
if (image->mt) {
- radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
- dstRowStride = lvl->rowstride;
+ dstRowStride = image->mt->levels[image->mtlevel].rowstride;
+ } else if (t->bo) {
+ /* TFP case */
+ /* TODO */
+ assert(0);
} else {
- dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
+ dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
}
if (dims == 3) {
@@ -577,8 +607,10 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
texImage->Width, texImage->Data);
}
else {
- uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4);
- img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
+ uint32_t blocks_x, block_width, block_height;
+ _mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height);
+ blocks_x = dstRowStride / block_width;
+ img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
}
srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
bytesPerRow = srcRowStride;
@@ -624,10 +656,8 @@ static void radeon_teximage(
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
radeon_texture_image* image = get_radeon_texture_image(texImage);
- GLuint dstRowStride;
GLint postConvWidth = width;
GLint postConvHeight = height;
- GLuint texelBytes;
GLuint face = radeon_face_for_target(target);
{
@@ -645,51 +675,30 @@ static void radeon_teximage(
&postConvHeight);
}
- if (_mesa_is_format_compressed(texImage->TexFormat)) {
- texelBytes = 0;
- } else {
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
+ if (!_mesa_is_format_compressed(texImage->TexFormat)) {
+ GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
- postConvWidth = 32 / texelBytes;
- texImage->RowStride = postConvWidth;
+ postConvWidth = 32 / texelBytes;
+ texImage->RowStride = postConvWidth;
}
- if (!image->mt) {
+ if (!image->mt) {
assert(texImage->RowStride == postConvWidth);
}
}
- /* Allocate memory for image */
- radeonFreeTexImageData(ctx, texImage); /* Mesa core only clears texImage->Data but not image->mt */
+ /* Mesa core only clears texImage->Data but not image->mt */
+ radeonFreeTexImageData(ctx, texImage);
- if (t->mt &&
- t->mt->firstLevel == level &&
- t->mt->lastLevel == level &&
- t->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
- !radeon_miptree_matches_image(t->mt, texImage, face, level)) {
- radeon_miptree_unreference(&t->mt);
- }
-
- if (!t->mt)
- radeon_try_alloc_miptree(rmesa, t, image, face, level);
- if (t->mt && radeon_miptree_matches_image(t->mt, texImage, face, level)) {
- radeon_mipmap_level *lvl;
- image->mtlevel = level - t->mt->firstLevel;
- image->mtface = face;
- radeon_miptree_reference(t->mt, &image->mt);
- lvl = &image->mt->levels[image->mtlevel];
- dstRowStride = lvl->rowstride;
- } else {
- int size;
- if (_mesa_is_format_compressed(texImage->TexFormat)) {
- size = _mesa_format_image_size(texImage->TexFormat,
- texImage->Width,
- texImage->Height,
- texImage->Depth);
- } else {
- size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
+ if (!t->bo) {
+ teximage_assign_miptree(rmesa, texObj, texImage, face, level);
+ if (!t->mt) {
+ int size = _mesa_format_image_size(texImage->TexFormat,
+ texImage->Width,
+ texImage->Height,
+ texImage->Depth);
+ texImage->Data = _mesa_alloc_texmemory(size);
}
- texImage->Data = _mesa_alloc_texmemory(size);
}
/* Upload texture image; note that the spec allows pixels to be NULL */
@@ -793,10 +802,10 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve
t->validated = GL_FALSE;
if (compressed) {
pixels = _mesa_validate_pbo_compressed_teximage(
- ctx, imageSize, pixels, packing, "glCompressedTexImage");
+ ctx, imageSize, pixels, packing, "glCompressedTexSubImage");
} else {
pixels = _mesa_validate_pbo_teximage(ctx, dims,
- width, height, depth, format, type, pixels, packing, "glTexSubImage1D");
+ width, height, depth, format, type, pixels, packing, "glTexSubImage");
}
if (pixels) {
@@ -865,140 +874,6 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
format, type, pixels, packing, texObj, texImage, 0);
}
-
-
-/**
- * Ensure that the given image is stored in the given miptree from now on.
- */
-static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_image *image, int face, int level)
-{
- radeon_mipmap_level *dstlvl = &mt->levels[level - mt->firstLevel];
- unsigned char *dest;
-
- assert(image->mt != mt);
- assert(dstlvl->width == image->base.Width);
- assert(dstlvl->height == image->base.Height);
- assert(dstlvl->depth == image->base.Depth);
-
-
- radeon_bo_map(mt->bo, GL_TRUE);
- dest = mt->bo->ptr + dstlvl->faces[face].offset;
-
- if (image->mt) {
- /* Format etc. should match, so we really just need a memcpy().
- * In fact, that memcpy() could be done by the hardware in many
- * cases, provided that we have a proper memory manager.
- */
- radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel-image->mt->firstLevel];
-
- assert(srclvl->size == dstlvl->size);
- assert(srclvl->rowstride == dstlvl->rowstride);
-
- radeon_bo_map(image->mt->bo, GL_FALSE);
-
- memcpy(dest,
- image->mt->bo->ptr + srclvl->faces[face].offset,
- dstlvl->size);
- radeon_bo_unmap(image->mt->bo);
-
- radeon_miptree_unreference(&image->mt);
- } else {
- uint32_t srcrowstride;
- uint32_t height;
- /* need to confirm this value is correct */
- if (mt->compressed) {
- height = (image->base.Height + 3) / 4;
- srcrowstride = _mesa_format_row_stride(image->base.TexFormat, image->base.Width);
- } else {
- height = image->base.Height * image->base.Depth;
- srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat);
- }
-
-// if (mt->tilebits)
-// WARN_ONCE("%s: tiling not supported yet", __FUNCTION__);
-
- copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride,
- height, srcrowstride);
-
- _mesa_free_texmemory(image->base.Data);
- image->base.Data = 0;
- }
-
- radeon_bo_unmap(mt->bo);
-
- image->mtface = face;
- image->mtlevel = level;
- radeon_miptree_reference(mt, &image->mt);
-}
-
-int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj)
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeonTexObj *t = radeon_tex_obj(texObj);
- radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[0][texObj->BaseLevel]);
- int face, level;
-
- if (t->validated || t->image_override)
- return GL_TRUE;
-
- if (RADEON_DEBUG & RADEON_TEXTURE)
- fprintf(stderr, "%s: Validating texture %p now\n", __FUNCTION__, texObj);
-
- if (baseimage->base.Border > 0)
- return GL_FALSE;
-
- /* Ensure a matching miptree exists.
- *
- * Differing mipmap trees can result when the app uses TexImage to
- * change texture dimensions.
- *
- * Prefer to use base image's miptree if it
- * exists, since that most likely contains more valid data (remember
- * that the base level is usually significantly larger than the rest
- * of the miptree, so cubemaps are the only possible exception).
- */
- if (baseimage->mt &&
- baseimage->mt != t->mt &&
- radeon_miptree_matches_texture(baseimage->mt, &t->base)) {
- radeon_miptree_unreference(&t->mt);
- radeon_miptree_reference(baseimage->mt, &t->mt);
- } else if (t->mt && !radeon_miptree_matches_texture(t->mt, &t->base)) {
- radeon_miptree_unreference(&t->mt);
- }
-
- if (!t->mt) {
- if (RADEON_DEBUG & RADEON_TEXTURE)
- fprintf(stderr, " Allocate new miptree\n");
- radeon_try_alloc_miptree(rmesa, t, baseimage, 0, texObj->BaseLevel);
- if (!t->mt) {
- _mesa_problem(ctx, "radeon_validate_texture failed to alloc miptree");
- return GL_FALSE;
- }
- }
-
- /* Ensure all images are stored in the single main miptree */
- for(face = 0; face < t->mt->faces; ++face) {
- for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) {
- radeon_texture_image *image = get_radeon_texture_image(texObj->Image[face][level]);
- if (RADEON_DEBUG & RADEON_TEXTURE)
- fprintf(stderr, " face %i, level %i... %p vs %p ", face, level, t->mt, image->mt);
- if (t->mt == image->mt || (!image->mt && !image->base.Data)) {
- if (RADEON_DEBUG & RADEON_TEXTURE)
- fprintf(stderr, "OK\n");
-
- continue;
- }
-
- if (RADEON_DEBUG & RADEON_TEXTURE)
- fprintf(stderr, "migrating\n");
- migrate_image_to_miptree(t->mt, image, face, level);
- }
- }
-
- return GL_TRUE;
-}
-
-
/**
* Need to map texture image into memory before copying image data,
* then unmap it.
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h
index 8995546d77..906daf12d0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.h
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.h
@@ -33,7 +33,8 @@
#include "main/formats.h"
-
+void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
+ GLuint numrows, GLuint rowsize);
struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx);
void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage);
--
cgit v1.2.3
From ad83aeccdc54beecf25f217e2dd24c8edf6d6767 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 14 Nov 2009 18:11:16 +0100
Subject: radeon: return false on texture validation if texture isn't complete
---
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index f01136b9d4..0497fa7db5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -34,7 +34,6 @@
#include "main/simple_list.h"
#include "main/texcompress.h"
#include "main/teximage.h"
-/* TODO: remove if texture completeness check is removed */
#include "main/texobj.h"
#include "radeon_texture.h"
@@ -547,9 +546,10 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t
if (texObj->Image[0][texObj->BaseLevel]->Border > 0)
return GL_FALSE;
- /* TODO: is this really necessary? */
_mesa_test_texobj_completeness(rmesa->glCtx, texObj);
- assert(texObj->_Complete);
+ if (!texObj->_Complete) {
+ return GL_FALSE;
+ }
calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod);
--
cgit v1.2.3
From b44b70dc114ddcfb4d359759928df4d7b9efaafb Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Sat, 14 Nov 2009 19:46:45 -0800
Subject: mesa/st: don't calculate unused vs input semantic tags
---
src/mesa/state_tracker/st_program.c | 71 ++-----------------------------------
1 file changed, 2 insertions(+), 69 deletions(-)
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index a9be80ce8f..b6c9e7463a 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -69,8 +69,6 @@ st_translate_vertex_program(struct st_context *st,
GLuint attr, i;
GLuint num_generic = 0;
- ubyte vs_input_semantic_name[PIPE_MAX_SHADER_INPUTS];
- ubyte vs_input_semantic_index[PIPE_MAX_SHADER_INPUTS];
uint vs_num_inputs = 0;
ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
@@ -100,71 +98,6 @@ st_translate_vertex_program(struct st_context *st,
stvp->input_to_index[attr] = slot;
stvp->index_to_input[slot] = attr;
- switch (attr) {
- case VERT_ATTRIB_POS:
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
- vs_input_semantic_index[slot] = 0;
- break;
- case VERT_ATTRIB_WEIGHT:
- /* fall-through */
- case VERT_ATTRIB_NORMAL:
- /* just label as a generic */
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- vs_input_semantic_index[slot] = 0;
- break;
- case VERT_ATTRIB_COLOR0:
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- vs_input_semantic_index[slot] = 0;
- break;
- case VERT_ATTRIB_COLOR1:
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- vs_input_semantic_index[slot] = 1;
- break;
- case VERT_ATTRIB_FOG:
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
- vs_input_semantic_index[slot] = 0;
- break;
- case VERT_ATTRIB_POINT_SIZE:
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
- vs_input_semantic_index[slot] = 0;
- break;
- case VERT_ATTRIB_TEX0:
- case VERT_ATTRIB_TEX1:
- case VERT_ATTRIB_TEX2:
- case VERT_ATTRIB_TEX3:
- case VERT_ATTRIB_TEX4:
- case VERT_ATTRIB_TEX5:
- case VERT_ATTRIB_TEX6:
- case VERT_ATTRIB_TEX7:
- assert(slot < Elements(vs_input_semantic_name));
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- vs_input_semantic_index[slot] = num_generic++;
- break;
- case VERT_ATTRIB_GENERIC0:
- case VERT_ATTRIB_GENERIC1:
- case VERT_ATTRIB_GENERIC2:
- case VERT_ATTRIB_GENERIC3:
- case VERT_ATTRIB_GENERIC4:
- case VERT_ATTRIB_GENERIC5:
- case VERT_ATTRIB_GENERIC6:
- case VERT_ATTRIB_GENERIC7:
- case VERT_ATTRIB_GENERIC8:
- case VERT_ATTRIB_GENERIC9:
- case VERT_ATTRIB_GENERIC10:
- case VERT_ATTRIB_GENERIC11:
- case VERT_ATTRIB_GENERIC12:
- case VERT_ATTRIB_GENERIC13:
- case VERT_ATTRIB_GENERIC14:
- case VERT_ATTRIB_GENERIC15:
- assert(attr < VERT_ATTRIB_MAX);
- assert(slot < Elements(vs_input_semantic_name));
- vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- vs_input_semantic_index[slot] = num_generic++;
- break;
- default:
- assert(0);
- }
-
input_flags[slot] = stvp->Base.Base.InputFlags[attr];
}
}
@@ -330,8 +263,8 @@ st_translate_vertex_program(struct st_context *st,
/* inputs */
vs_num_inputs,
stvp->input_to_index,
- vs_input_semantic_name,
- vs_input_semantic_index,
+ NULL, /* input semantic name */
+ NULL, /* input semantic index */
NULL,
input_flags,
/* outputs */
--
cgit v1.2.3
From 0ffdd1c1e897c448cbc359aea3e3a3ba098bbfe5 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Sat, 14 Nov 2009 19:48:42 -0800
Subject: mesa/st: don't calculate unused input_flags data
---
src/mesa/state_tracker/st_mesa_to_tgsi.c | 1 -
src/mesa/state_tracker/st_mesa_to_tgsi.h | 1 -
src/mesa/state_tracker/st_program.c | 16 ++--------------
3 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 3d6c215819..81f02d01e9 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -704,7 +704,6 @@ st_translate_mesa_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLbitfield inputFlags[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index c0d1ff59e1..384831762d 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -49,7 +49,6 @@ st_translate_mesa_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLbitfield inputFlags[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index b6c9e7463a..fd1b213eb8 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -75,11 +75,9 @@ st_translate_vertex_program(struct st_context *st,
ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint vs_num_outputs = 0;
- GLbitfield input_flags[MAX_PROGRAM_INPUTS];
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
// memset(&vs, 0, sizeof(vs));
- memset(input_flags, 0, sizeof(input_flags));
memset(output_flags, 0, sizeof(output_flags));
if (stvp->Base.IsPositionInvariant)
@@ -91,14 +89,10 @@ st_translate_vertex_program(struct st_context *st,
*/
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if (stvp->Base.Base.InputsRead & (1 << attr)) {
- const GLuint slot = vs_num_inputs;
+ stvp->input_to_index[attr] = vs_num_inputs;
+ stvp->index_to_input[vs_num_inputs] = attr;
vs_num_inputs++;
-
- stvp->input_to_index[attr] = slot;
- stvp->index_to_input[slot] = attr;
-
- input_flags[slot] = stvp->Base.Base.InputFlags[attr];
}
}
@@ -266,7 +260,6 @@ st_translate_vertex_program(struct st_context *st,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL,
- input_flags,
/* outputs */
vs_num_outputs,
outputMapping,
@@ -316,11 +309,9 @@ st_translate_fragment_program(struct st_context *st,
ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint fs_num_outputs = 0;
- GLbitfield input_flags[MAX_PROGRAM_INPUTS];
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
// memset(&fs, 0, sizeof(fs));
- memset(input_flags, 0, sizeof(input_flags));
memset(output_flags, 0, sizeof(output_flags));
/* which vertex output goes to the first fragment input: */
@@ -392,8 +383,6 @@ st_translate_fragment_program(struct st_context *st,
stfp->input_semantic_index[slot] = num_generic++;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
}
-
- input_flags[slot] = stfp->Base.Base.InputFlags[attr];
}
}
@@ -451,7 +440,6 @@ st_translate_fragment_program(struct st_context *st,
stfp->input_semantic_name,
stfp->input_semantic_index,
interpMode,
- input_flags,
/* outputs */
fs_num_outputs,
outputMapping,
--
cgit v1.2.3
From 9953fe4cb48b02a0d75735b88173f0ed170a77f2 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Sat, 14 Nov 2009 19:50:45 -0800
Subject: mesa/st: don't calculate unused output_flags data either
---
src/mesa/state_tracker/st_mesa_to_tgsi.c | 3 +--
src/mesa/state_tracker/st_mesa_to_tgsi.h | 3 +--
src/mesa/state_tracker/st_program.c | 22 ++--------------------
3 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 81f02d01e9..d84832f539 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -707,8 +707,7 @@ st_translate_mesa_program(
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
- const ubyte outputSemanticIndex[],
- const GLbitfield outputFlags[] )
+ const ubyte outputSemanticIndex[] )
{
struct st_translate translate, *t;
struct ureg_program *ureg;
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index 384831762d..dc0362fe79 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -52,8 +52,7 @@ st_translate_mesa_program(
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
- const ubyte outputSemanticIndex[],
- const GLbitfield outputFlags[] );
+ const ubyte outputSemanticIndex[] );
void
st_free_tokens(const struct tgsi_token *tokens);
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index fd1b213eb8..5450b59a2d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -75,11 +75,6 @@ st_translate_vertex_program(struct st_context *st,
ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint vs_num_outputs = 0;
- GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
-
-// memset(&vs, 0, sizeof(vs));
- memset(output_flags, 0, sizeof(output_flags));
-
if (stvp->Base.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
@@ -115,7 +110,6 @@ st_translate_vertex_program(struct st_context *st,
assert(i < Elements(vs_output_semantic_name));
vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC;
vs_output_semantic_index[i] = 0;
- output_flags[i] = 0x0;
}
num_generic = 0;
@@ -201,9 +195,6 @@ st_translate_vertex_program(struct st_context *st,
vs_output_semantic_index[slot] = num_generic++;
}
}
-
- assert(slot < Elements(output_flags));
- output_flags[slot] = stvp->Base.Base.OutputFlags[attr];
}
}
@@ -264,8 +255,7 @@ st_translate_vertex_program(struct st_context *st,
vs_num_outputs,
outputMapping,
vs_output_semantic_name,
- vs_output_semantic_index,
- output_flags );
+ vs_output_semantic_index );
stvp->num_inputs = vs_num_inputs;
stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state);
@@ -309,11 +299,6 @@ st_translate_fragment_program(struct st_context *st,
ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint fs_num_outputs = 0;
- GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
-
-// memset(&fs, 0, sizeof(fs));
- memset(output_flags, 0, sizeof(output_flags));
-
/* which vertex output goes to the first fragment input: */
if (inputsRead & FRAG_BIT_WPOS)
vslot = 0;
@@ -420,8 +405,6 @@ st_translate_fragment_program(struct st_context *st,
break;
}
- output_flags[fs_num_outputs] = stfp->Base.Base.OutputFlags[attr];
-
fs_num_outputs++;
}
}
@@ -444,8 +427,7 @@ st_translate_fragment_program(struct st_context *st,
fs_num_outputs,
outputMapping,
fs_output_semantic_name,
- fs_output_semantic_index,
- output_flags );
+ fs_output_semantic_index );
stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state);
--
cgit v1.2.3
From 1454f20a991ddda35f1a2ffda953012078b407ba Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Sun, 15 Nov 2009 10:26:35 -0800
Subject: mesa/st: emit tgsi vertex shader directly for drawpixels
One of several cases where we build mesa shaders and then translate
them to tgsi. Many of those cases it's because we're combining two
mesa programs and there are helpers for that, but in this case at
least can go straight to tgsi.
---
src/mesa/state_tracker/st_cb_drawpixels.c | 124 +++++++++++-------------------
1 file changed, 47 insertions(+), 77 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 1d33e81c2c..13e454b7a7 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -60,6 +60,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "tgsi/tgsi_ureg.h"
#include "util/u_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_math.h"
@@ -236,78 +237,41 @@ make_fragment_shader_z(struct st_context *st)
* Create a simple vertex shader that just passes through the
* vertex position and texcoord (and optionally, color).
*/
-static struct st_vertex_program *
-st_make_passthrough_vertex_shader(struct st_context *st, GLboolean passColor)
+static void *
+st_make_passthrough_vertex_shader(struct st_context *st,
+ GLboolean passColor)
{
- GLcontext *ctx = st->ctx;
- struct st_vertex_program *stvp;
- struct gl_program *p;
- GLuint ic = 0;
-
- if (st->drawpix.vert_shaders[passColor])
- return st->drawpix.vert_shaders[passColor];
-
- /*
- * Create shader now
- */
- p = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
- if (!p)
- return NULL;
-
- if (passColor)
- p->NumInstructions = 4;
- else
- p->NumInstructions = 3;
-
- p->Instructions = _mesa_alloc_instructions(p->NumInstructions);
- if (!p->Instructions) {
- ctx->Driver.DeleteProgram(ctx, p);
- return NULL;
- }
- _mesa_init_instructions(p->Instructions, p->NumInstructions);
- /* MOV result.pos, vertex.pos; */
- p->Instructions[0].Opcode = OPCODE_MOV;
- p->Instructions[0].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[0].DstReg.Index = VERT_RESULT_HPOS;
- p->Instructions[0].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[0].SrcReg[0].Index = VERT_ATTRIB_POS;
- /* MOV result.texcoord0, vertex.texcoord0; */
- p->Instructions[1].Opcode = OPCODE_MOV;
- p->Instructions[1].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[1].DstReg.Index = VERT_RESULT_TEX0;
- p->Instructions[1].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[1].SrcReg[0].Index = VERT_ATTRIB_TEX0;
- ic = 2;
- if (passColor) {
- /* MOV result.color0, vertex.color0; */
- p->Instructions[ic].Opcode = OPCODE_MOV;
- p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[ic].DstReg.Index = VERT_RESULT_COL0;
- p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = VERT_ATTRIB_COLOR0;
- ic++;
- }
-
- /* END; */
- p->Instructions[ic].Opcode = OPCODE_END;
- ic++;
-
- assert(ic == p->NumInstructions);
+ if (!st->drawpix.vert_shaders[passColor]) {
+ struct ureg_program *ureg =
+ ureg_create( TGSI_PROCESSOR_VERTEX );
+
+ if (ureg == NULL)
+ return NULL;
+
+ /* MOV result.pos, vertex.pos; */
+ ureg_MOV(ureg,
+ ureg_DECL_output( ureg, TGSI_SEMANTIC_POSITION, 0 ),
+ ureg_DECL_vs_input( ureg, 0 ));
+
+ /* MOV result.texcoord0, vertex.texcoord0; */
+ ureg_MOV(ureg,
+ ureg_DECL_output( ureg, TGSI_SEMANTIC_GENERIC, 0 ),
+ ureg_DECL_vs_input( ureg, 1 ));
+
+ if (passColor) {
+ /* MOV result.color0, vertex.color0; */
+ ureg_MOV(ureg,
+ ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, 0 ),
+ ureg_DECL_vs_input( ureg, 2 ));
+ }
- p->InputsRead = VERT_BIT_POS | VERT_BIT_TEX0;
- p->OutputsWritten = ((1 << VERT_RESULT_TEX0) |
- (1 << VERT_RESULT_HPOS));
- if (passColor) {
- p->InputsRead |= VERT_BIT_COLOR0;
- p->OutputsWritten |= (1 << VERT_RESULT_COL0);
+ ureg_END( ureg );
+
+ st->drawpix.vert_shaders[passColor] =
+ ureg_create_shader_and_destroy( ureg, st->pipe );
}
- stvp = (struct st_vertex_program *) p;
- st_translate_vertex_program(st, stvp, NULL, NULL, NULL);
-
- st->drawpix.vert_shaders[passColor] = stvp;
-
- return stvp;
+ return st->drawpix.vert_shaders[passColor];
}
@@ -539,8 +503,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
GLfloat zoomX, GLfloat zoomY,
struct pipe_texture *pt,
- struct st_vertex_program *stvp,
- struct st_fragment_program *stfp,
+ void *driver_vp,
+ void *driver_fp,
const GLfloat *color,
GLboolean invertTex)
{
@@ -575,10 +539,10 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
}
/* fragment shader state: TEX lookup program */
- cso_set_fragment_shader_handle(cso, stfp->driver_shader);
+ cso_set_fragment_shader_handle(cso, driver_fp);
/* vertex shader state: position + texcoord pass-through */
- cso_set_vertex_shader_handle(cso, stvp->driver_shader);
+ cso_set_vertex_shader_handle(cso, driver_vp);
/* texture sampling state: */
@@ -806,7 +770,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels)
{
struct st_fragment_program *stfp;
- struct st_vertex_program *stvp;
+ void *driver_vp;
struct st_context *st = st_context(ctx);
struct pipe_surface *ps;
const GLfloat *color;
@@ -826,13 +790,13 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
if (format == GL_DEPTH_COMPONENT) {
ps = st->state.framebuffer.zsbuf;
stfp = make_fragment_shader_z(st);
- stvp = st_make_passthrough_vertex_shader(st, GL_TRUE);
+ driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE);
color = ctx->Current.RasterColor;
}
else {
ps = st->state.framebuffer.cbufs[0];
stfp = combined_drawpix_fragment_program(ctx);
- stvp = st_make_passthrough_vertex_shader(st, GL_FALSE);
+ driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE);
color = NULL;
}
@@ -843,7 +807,10 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
if (pt) {
draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
- pt, stvp, stfp, color, GL_FALSE);
+ pt,
+ driver_vp,
+ stfp->driver_shader,
+ color, GL_FALSE);
pipe_texture_reference(&pt, NULL);
}
}
@@ -1148,7 +1115,10 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* draw textured quad */
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
- pt, stvp, stfp, color, GL_TRUE);
+ pt,
+ stvp->driver_shader,
+ stfp->driver_shader,
+ color, GL_TRUE);
pipe_texture_reference(&pt, NULL);
}
--
cgit v1.2.3
From 07fafc7c9346aa260829603bf3188596481e9e62 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Sun, 15 Nov 2009 11:15:25 -0800
Subject: mesa/st: refactor vertex and fragment shader translation
Translate vertex shaders independently of fragment shaders.
Previously tried to make fragment shader semantic indexes always start
at zero and exclude holes. This was unnecessary but meant that vertex
shader translation had to be adjusted to take this into account.
Now use a fixed scheme for labelling special FS input semantics
(color, etc), and another fixed scheme for the generics.
With this, vertex shaders can be translated independently of the bound
fragment shader, assuming mesa has done its own job and ensured that
the vertex shader provides at least the inputs the fragment shader is
looking for. The state-tracker didn't attempt to do anything about
this previously, so it shouldn't be needed now.
---
src/mesa/state_tracker/st_atom.c | 3 +-
src/mesa/state_tracker/st_atom.h | 3 +-
src/mesa/state_tracker/st_atom_shader.c | 326 ++++++++----------------------
src/mesa/state_tracker/st_cb_bitmap.c | 5 -
src/mesa/state_tracker/st_cb_drawpixels.c | 8 +-
src/mesa/state_tracker/st_cb_program.c | 43 +---
src/mesa/state_tracker/st_context.h | 2 +
src/mesa/state_tracker/st_debug.c | 3 +-
src/mesa/state_tracker/st_draw.c | 2 +-
src/mesa/state_tracker/st_draw_feedback.c | 8 +-
src/mesa/state_tracker/st_program.c | 267 +++++++++++-------------
src/mesa/state_tracker/st_program.h | 75 +++++--
12 files changed, 276 insertions(+), 469 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index ca15ce1b47..dfce955fd9 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -46,7 +46,8 @@ static const struct st_tracked_state *atoms[] =
&st_update_clip,
&st_finalize_textures,
- &st_update_shader,
+ &st_update_fp,
+ &st_update_vp,
&st_update_rasterizer,
&st_update_polygon_stipple,
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index c7cffd85c8..f34b49203b 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -47,7 +47,8 @@ void st_validate_state( struct st_context *st );
extern const struct st_tracked_state st_update_framebuffer;
extern const struct st_tracked_state st_update_clip;
extern const struct st_tracked_state st_update_depth_stencil_alpha;
-extern const struct st_tracked_state st_update_shader;
+extern const struct st_tracked_state st_update_fp;
+extern const struct st_tracked_state st_update_vp;
extern const struct st_tracked_state st_update_rasterizer;
extern const struct st_tracked_state st_update_polygon_stipple;
extern const struct st_tracked_state st_update_viewport;
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index ee649be885..09baff875b 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -56,82 +56,18 @@
#include "st_mesa_to_tgsi.h"
-/**
- * This represents a vertex program, especially translated to match
- * the inputs of a particular fragment shader.
- */
-struct translated_vertex_program
-{
- struct st_vertex_program *master;
-
- /** The fragment shader "signature" this vertex shader is meant for: */
- GLbitfield frag_inputs;
- /** Compared against master vertex program's serialNo: */
- GLuint serialNo;
- /** Maps VERT_RESULT_x to slot */
- GLuint output_to_slot[VERT_RESULT_MAX];
- ubyte output_to_semantic_name[VERT_RESULT_MAX];
- ubyte output_to_semantic_index[VERT_RESULT_MAX];
-
- /** Pointer to the translated vertex program */
- struct st_vertex_program *vp;
-
- struct translated_vertex_program *next; /**< next in linked list */
-};
-
-
-/**
- * Given a vertex program output attribute, return the corresponding
- * fragment program input attribute.
- * \return -1 for vertex outputs that have no corresponding fragment input
+/*
+ * Translate fragment program if needed.
*/
-static GLint
-vp_out_to_fp_in(GLuint vertResult)
-{
- if (vertResult >= VERT_RESULT_TEX0 &&
- vertResult < VERT_RESULT_TEX0 + MAX_TEXTURE_COORD_UNITS)
- return FRAG_ATTRIB_TEX0 + (vertResult - VERT_RESULT_TEX0);
-
- if (vertResult >= VERT_RESULT_VAR0 &&
- vertResult < VERT_RESULT_VAR0 + MAX_VARYING)
- return FRAG_ATTRIB_VAR0 + (vertResult - VERT_RESULT_VAR0);
-
- switch (vertResult) {
- case VERT_RESULT_HPOS:
- return FRAG_ATTRIB_WPOS;
- case VERT_RESULT_COL0:
- return FRAG_ATTRIB_COL0;
- case VERT_RESULT_COL1:
- return FRAG_ATTRIB_COL1;
- case VERT_RESULT_FOGC:
- return FRAG_ATTRIB_FOGC;
- default:
- /* Back-face colors, edge flags, etc */
- return -1;
- }
-}
-
-
-/**
- * Find a translated vertex program that corresponds to stvp and
- * has outputs matched to stfp's inputs.
- * This performs vertex and fragment translation (to TGSI) when needed.
- */
-static struct translated_vertex_program *
-find_translated_vp(struct st_context *st,
- struct st_vertex_program *stvp,
- struct st_fragment_program *stfp)
+static void
+translate_fp(struct st_context *st,
+ struct st_fragment_program *stfp)
{
- static const GLuint UNUSED = ~0;
- struct translated_vertex_program *xvp;
const GLbitfield fragInputsRead = stfp->Base.Base.InputsRead;
- /*
- * Translate fragment program if needed.
- */
if (!stfp->state.tokens) {
GLuint inAttr, numIn = 0;
@@ -141,7 +77,7 @@ find_translated_vp(struct st_context *st,
numIn++;
}
else {
- stfp->input_to_slot[inAttr] = UNUSED;
+ stfp->input_to_slot[inAttr] = -1;
}
}
@@ -151,170 +87,63 @@ find_translated_vp(struct st_context *st,
st_translate_fragment_program(st, stfp, stfp->input_to_slot);
}
+}
- /* See if we've got a translated vertex program whose outputs match
- * the fragment program's inputs.
- * XXX This could be a hash lookup, using InputsRead as the key.
- */
- for (xvp = stfp->vertex_programs; xvp; xvp = xvp->next) {
- if (xvp->master == stvp && xvp->frag_inputs == fragInputsRead) {
- break;
- }
- }
- /* No? Allocate translated vp object now */
- if (!xvp) {
- xvp = ST_CALLOC_STRUCT(translated_vertex_program);
- xvp->frag_inputs = fragInputsRead;
- xvp->master = stvp;
+/**
+ * Find a translated vertex program that corresponds to stvp and
+ * has outputs matched to stfp's inputs.
+ * This performs vertex and fragment translation (to TGSI) when needed.
+ */
+static struct st_vp_varient *
+find_translated_vp(struct st_context *st,
+ struct st_vertex_program *stvp )
+{
+ struct st_vp_varient *vpv;
+ struct st_vp_varient_key key;
- xvp->next = stfp->vertex_programs;
- stfp->vertex_programs = xvp;
- }
+ /* Nothing in our key yet. This will change:
+ */
+ memset(&key, 0, sizeof key);
+ key.dummy = 0;
- /* See if we need to translate vertex program to TGSI form */
- if (xvp->serialNo != stvp->serialNo) {
- GLuint outAttr;
- const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten;
- GLuint numVpOuts = 0;
- GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE;
- GLbitfield usedGenerics = 0x0;
- GLbitfield usedOutputSlots = 0x0;
-
- /* Compute mapping of vertex program outputs to slots, which depends
- * on the fragment program's input->slot mapping.
+ /* Do we need to throw away old translations after a change in the
+ * GL program string?
+ */
+ if (stvp->serialNo != stvp->lastSerialNo) {
+ /* These may have changed if the program string changed.
*/
- for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
- /* set defaults: */
- xvp->output_to_slot[outAttr] = UNUSED;
- xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_COUNT;
- xvp->output_to_semantic_index[outAttr] = 99;
-
- if (outAttr == VERT_RESULT_HPOS) {
- /* always put xformed position into slot zero */
- GLuint slot = 0;
- xvp->output_to_slot[VERT_RESULT_HPOS] = slot;
- xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_POSITION;
- xvp->output_to_semantic_index[outAttr] = 0;
- numVpOuts++;
- usedOutputSlots |= (1 << slot);
- }
- else if (outputsWritten & (1 << outAttr)) {
- /* see if the frag prog wants this vert output */
- GLint fpInAttrib = vp_out_to_fp_in(outAttr);
- if (fpInAttrib >= 0) {
- GLuint fpInSlot = stfp->input_to_slot[fpInAttrib];
- if (fpInSlot != ~0) {
- /* match this vp output to the fp input */
- GLuint vpOutSlot = stfp->input_map[fpInSlot];
- xvp->output_to_slot[outAttr] = vpOutSlot;
- xvp->output_to_semantic_name[outAttr] = stfp->input_semantic_name[fpInSlot];
- xvp->output_to_semantic_index[outAttr] = stfp->input_semantic_index[fpInSlot];
- numVpOuts++;
- usedOutputSlots |= (1 << vpOutSlot);
- }
- else {
-#if 0 /*debug*/
- printf("VP output %d not used by FP\n", outAttr);
-#endif
- }
- }
- else if (outAttr == VERT_RESULT_PSIZ)
- emitPntSize = GL_TRUE;
- else if (outAttr == VERT_RESULT_BFC0)
- emitBFC0 = GL_TRUE;
- else if (outAttr == VERT_RESULT_BFC1)
- emitBFC1 = GL_TRUE;
- }
-#if 0 /*debug*/
- printf("assign vp output_to_slot[%d] = %d\n", outAttr,
- xvp->output_to_slot[outAttr]);
-#endif
- }
-
- /* must do these last */
- if (emitPntSize) {
- GLuint slot = numVpOuts++;
- xvp->output_to_slot[VERT_RESULT_PSIZ] = slot;
- xvp->output_to_semantic_name[VERT_RESULT_PSIZ] = TGSI_SEMANTIC_PSIZE;
- xvp->output_to_semantic_index[VERT_RESULT_PSIZ] = 0;
- usedOutputSlots |= (1 << slot);
- }
- if (emitBFC0) {
- GLuint slot = numVpOuts++;
- xvp->output_to_slot[VERT_RESULT_BFC0] = slot;
- xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR;
- xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 0;
- usedOutputSlots |= (1 << slot);
- }
- if (emitBFC1) {
- GLuint slot = numVpOuts++;
- xvp->output_to_slot[VERT_RESULT_BFC1] = slot;
- xvp->output_to_semantic_name[VERT_RESULT_BFC1] = TGSI_SEMANTIC_COLOR;
- xvp->output_to_semantic_index[VERT_RESULT_BFC1] = 1;
- usedOutputSlots |= (1 << slot);
- }
-
- /* build usedGenerics mask */
- usedGenerics = 0x0;
- for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
- if (xvp->output_to_semantic_name[outAttr] == TGSI_SEMANTIC_GENERIC) {
- usedGenerics |= (1 << xvp->output_to_semantic_index[outAttr]);
- }
- }
+ st_prepare_vertex_program( st, stvp );
- /* For each vertex program output that doesn't match up to a fragment
- * program input, map the vertex program output to a free slot and
- * free generic attribute.
+ /* We are now up-to-date:
*/
- for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {
- if (outputsWritten & (1 << outAttr)) {
- if (xvp->output_to_slot[outAttr] == UNUSED) {
- GLint freeGeneric = _mesa_ffs(~usedGenerics) - 1;
- GLint freeSlot = _mesa_ffs(~usedOutputSlots) - 1;
- usedGenerics |= (1 << freeGeneric);
- usedOutputSlots |= (1 << freeSlot);
- xvp->output_to_slot[outAttr] = freeSlot;
- xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_GENERIC;
- xvp->output_to_semantic_index[outAttr] = freeGeneric;
- }
- }
-
-#if 0 /*debug*/
- printf("vp output_to_slot[%d] = %d\n", outAttr,
- xvp->output_to_slot[outAttr]);
-#endif
+ stvp->lastSerialNo = stvp->serialNo;
+ }
+
+ /* See if we've got a translated vertex program whose outputs match
+ * the fragment program's inputs.
+ */
+ for (vpv = stvp->varients; vpv; vpv = vpv->next) {
+ if (memcmp(&vpv->key, &key, sizeof key) == 0) {
+ break;
}
+ }
- assert(stvp->Base.Base.NumInstructions > 1);
-
- st_translate_vertex_program(st, stvp, xvp->output_to_slot,
- xvp->output_to_semantic_name,
- xvp->output_to_semantic_index);
-
- xvp->vp = stvp;
-
- /* translated VP is up to date now */
- xvp->serialNo = stvp->serialNo;
+ /* No? Perform new translation here. */
+ if (!vpv) {
+ vpv = st_translate_vertex_program(st, stvp, &key);
+ if (!vpv)
+ return NULL;
+
+ vpv->next = stvp->varients;
+ stvp->varients = vpv;
}
- return xvp;
+ return vpv;
}
-void
-st_free_translated_vertex_programs(struct st_context *st,
- struct translated_vertex_program *xvp)
-{
- struct translated_vertex_program *next;
-
- while (xvp) {
- next = xvp->next;
- _mesa_free(xvp);
- xvp = next;
- }
-}
static void *
@@ -328,32 +157,19 @@ get_passthrough_fs(struct st_context *st)
return st->passthrough_fs;
}
-
static void
-update_linkage( struct st_context *st )
+update_fp( struct st_context *st )
{
- struct st_vertex_program *stvp;
struct st_fragment_program *stfp;
- struct translated_vertex_program *xvp;
-
- /* find active shader and params -- Should be covered by
- * ST_NEW_VERTEX_PROGRAM
- */
- assert(st->ctx->VertexProgram._Current);
- stvp = st_vertex_program(st->ctx->VertexProgram._Current);
- assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
assert(st->ctx->FragmentProgram._Current);
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
- xvp = find_translated_vp(st, stvp, stfp);
+ translate_fp(st, stfp);
- st_reference_vertprog(st, &st->vp, stvp);
st_reference_fragprog(st, &st->fp, stfp);
- cso_set_vertex_shader_handle(st->cso_context, stvp->driver_shader);
-
if (st->missing_textures) {
/* use a pass-through frag shader that uses no textures */
void *fs = get_passthrough_fs(st);
@@ -362,16 +178,48 @@ update_linkage( struct st_context *st )
else {
cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader);
}
+}
+
+const struct st_tracked_state st_update_fp = {
+ "st_update_fp", /* name */
+ { /* dirty */
+ 0, /* mesa */
+ ST_NEW_FRAGMENT_PROGRAM /* st */
+ },
+ update_fp /* update */
+};
+
+
+
+
+static void
+update_vp( struct st_context *st )
+{
+ struct st_vertex_program *stvp;
+
+ /* find active shader and params -- Should be covered by
+ * ST_NEW_VERTEX_PROGRAM
+ */
+ assert(st->ctx->VertexProgram._Current);
+ stvp = st_vertex_program(st->ctx->VertexProgram._Current);
+ assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
+
+ st->vp_varient = find_translated_vp(st, stvp);
+
+ st_reference_vertprog(st, &st->vp, stvp);
+
+ cso_set_vertex_shader_handle(st->cso_context,
+ st->vp_varient->driver_shader);
- st->vertex_result_to_slot = xvp->output_to_slot;
+ st->vertex_result_to_slot = stvp->result_to_output;
}
-const struct st_tracked_state st_update_shader = {
- "st_update_shader", /* name */
+const struct st_tracked_state st_update_vp = {
+ "st_update_vp", /* name */
{ /* dirty */
0, /* mesa */
- ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM /* st */
+ ST_NEW_VERTEX_PROGRAM /* st */
},
- update_linkage /* update */
+ update_vp /* update */
};
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index a22fa68299..226d1ab14c 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -169,11 +169,6 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
stfp = (struct st_fragment_program *) p;
stfp->Base.UsesKill = GL_TRUE;
- /* No need to send this incomplete program down to hardware:
- *
- * st_translate_fragment_program(ctx->st, stfp, NULL);
- */
-
return stfp;
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 13e454b7a7..60394731f7 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -927,7 +927,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct st_renderbuffer *rbRead;
- struct st_vertex_program *stvp;
+ void *driver_vp;
struct st_fragment_program *stfp;
struct pipe_texture *pt;
GLfloat *color;
@@ -976,14 +976,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
rbRead = st_get_color_read_renderbuffer(ctx);
color = NULL;
stfp = combined_drawpix_fragment_program(ctx);
- stvp = st_make_passthrough_vertex_shader(st, GL_FALSE);
+ driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE);
}
else {
assert(type == GL_DEPTH);
rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
stfp = make_fragment_shader_z(st);
- stvp = st_make_passthrough_vertex_shader(st, GL_TRUE);
+ driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE);
}
srcFormat = rbRead->texture->format;
@@ -1116,7 +1116,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
pt,
- stvp->driver_shader,
+ driver_vp,
stfp->driver_shader,
color, GL_TRUE);
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index b2d5c39a3a..8c276f8128 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -138,24 +138,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
case GL_VERTEX_PROGRAM_ARB:
{
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
-
- if (stvp->driver_shader) {
- cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
- stvp->driver_shader = NULL;
- }
-
- if (stvp->draw_shader) {
-#if FEATURE_feedback || FEATURE_drawpix
- /* this would only have been allocated for the RasterPos path */
- draw_delete_vertex_shader(st->draw, stvp->draw_shader);
- stvp->draw_shader = NULL;
-#endif
- }
-
- if (stvp->state.tokens) {
- st_free_tokens(stvp->state.tokens);
- stvp->state.tokens = NULL;
- }
+ st_vp_release_varients( st, stvp );
}
break;
case GL_FRAGMENT_PROGRAM_ARB:
@@ -177,8 +160,6 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
_mesa_reference_program(ctx, &prg, NULL);
stfp->bitmap_program = NULL;
}
-
- st_free_translated_vertex_programs(st, stfp->vertex_programs);
}
break;
default:
@@ -219,8 +200,6 @@ static void st_program_string_notify( GLcontext *ctx,
stfp->state.tokens = NULL;
}
- stfp->param_state = stfp->Base.Base.Parameters->StateFlags;
-
if (st->fp == stfp)
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
}
@@ -229,25 +208,7 @@ static void st_program_string_notify( GLcontext *ctx,
stvp->serialNo++;
- if (stvp->driver_shader) {
- cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
- stvp->driver_shader = NULL;
- }
-
- if (stvp->draw_shader) {
-#if FEATURE_feedback || FEATURE_drawpix
- /* this would only have been allocated for the RasterPos path */
- draw_delete_vertex_shader(st->draw, stvp->draw_shader);
- stvp->draw_shader = NULL;
-#endif
- }
-
- if (stvp->state.tokens) {
- st_free_tokens(stvp->state.tokens);
- stvp->state.tokens = NULL;
- }
-
- stvp->param_state = stvp->Base.Base.Parameters->StateFlags;
+ st_vp_release_varients( st, stvp );
if (st->vp == stvp)
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 18adb35e87..b760728658 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -127,6 +127,8 @@ struct st_context
struct st_vertex_program *vp; /**< Currently bound vertex program */
struct st_fragment_program *fp; /**< Currently bound fragment program */
+ struct st_vp_varient *vp_varient;
+
struct gl_texture_object *default_texture;
struct {
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index 3009cde9d5..6e699ca552 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -86,7 +86,8 @@ st_print_current(void)
}
#endif
- tgsi_dump( st->vp->state.tokens, 0 );
+ if (st->vp->varients)
+ tgsi_dump( st->vp->varients[0].state.tokens, 0 );
if (st->vp->Base.Base.Parameters)
_mesa_print_parameter_list(st->vp->Base.Base.Parameters);
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index c76bff9181..337c21a6c4 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -563,7 +563,7 @@ st_draw_vbo(GLcontext *ctx,
/* must get these after state validation! */
vp = ctx->st->vp;
- vs = &ctx->st->vp->state;
+ vs = &ctx->st->vp_varient->state;
#if 0
if (MESA_VERBOSE & VERBOSE_GLSL) {
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index b2d682ef64..d793f820bc 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -120,10 +120,10 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* must get these after state validation! */
vp = ctx->st->vp;
- vs = &st->vp->state;
+ vs = &st->vp_varient->state;
- if (!st->vp->draw_shader) {
- st->vp->draw_shader = draw_create_vertex_shader(draw, vs);
+ if (!st->vp_varient->draw_shader) {
+ st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs);
}
/*
@@ -136,7 +136,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
draw_set_viewport_state(draw, &st->state.viewport);
draw_set_clip_state(draw, &st->state.clip);
draw_set_rasterizer_state(draw, &st->state.rasterizer);
- draw_bind_vertex_shader(draw, st->vp->draw_shader);
+ draw_bind_vertex_shader(draw, st->vp_varient->draw_shader);
set_feedback_vertex_format(ctx);
/* loop over TGSI shader inputs to determine vertex buffer
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 5450b59a2d..6a2b99cf1b 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -49,6 +49,36 @@
#include "st_mesa_to_tgsi.h"
#include "cso_cache/cso_context.h"
+ /* Clean out any old compilations:
+ */
+void
+st_vp_release_varients( struct st_context *st,
+ struct st_vertex_program *stvp )
+{
+ struct st_vp_varient *vpv;
+
+ for (vpv = stvp->varients; vpv; ) {
+ struct st_vp_varient *next = vpv->next;
+
+ if (vpv->driver_shader)
+ cso_delete_vertex_shader(st->cso_context, vpv->driver_shader);
+
+ if (vpv->draw_shader)
+ draw_delete_vertex_shader( st->draw, vpv->draw_shader );
+
+ if (vpv->state.tokens)
+ st_free_tokens(vpv->state.tokens);
+
+ FREE( vpv );
+
+ vpv = next;
+ }
+
+ stvp->varients = NULL;
+}
+
+
+
/**
* Translate a Mesa vertex shader into a TGSI shader.
@@ -58,22 +88,13 @@
* \return pointer to cached pipe_shader object.
*/
void
-st_translate_vertex_program(struct st_context *st,
- struct st_vertex_program *stvp,
- const GLuint outputMapping[],
- const ubyte *outputSemanticName,
- const ubyte *outputSemanticIndex)
+st_prepare_vertex_program(struct st_context *st,
+ struct st_vertex_program *stvp)
{
- struct pipe_context *pipe = st->pipe;
- GLuint defaultOutputMapping[VERT_RESULT_MAX];
- GLuint attr, i;
- GLuint num_generic = 0;
-
- uint vs_num_inputs = 0;
+ GLuint attr;
- ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
- ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
- uint vs_num_outputs = 0;
+ stvp->num_inputs = 0;
+ stvp->num_outputs = 0;
if (stvp->Base.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
@@ -84,92 +105,56 @@ st_translate_vertex_program(struct st_context *st,
*/
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if (stvp->Base.Base.InputsRead & (1 << attr)) {
- stvp->input_to_index[attr] = vs_num_inputs;
- stvp->index_to_input[vs_num_inputs] = attr;
-
- vs_num_inputs++;
+ stvp->input_to_index[attr] = stvp->num_inputs;
+ stvp->index_to_input[stvp->num_inputs] = attr;
+ stvp->num_inputs++;
}
}
-#if 0
- if (outputMapping && outputSemanticName) {
- printf("VERT_RESULT written out_slot semantic_name semantic_index\n");
- for (attr = 0; attr < VERT_RESULT_MAX; attr++) {
- printf(" %-2d %c %3d %2d %2d\n",
- attr,
- ((stvp->Base.Base.OutputsWritten & (1 << attr)) ? 'Y' : ' '),
- outputMapping[attr],
- outputSemanticName[attr],
- outputSemanticIndex[attr]);
- }
- }
-#endif
-
- /* initialize output semantics to defaults */
- for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; i++) {
- assert(i < Elements(vs_output_semantic_name));
- vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC;
- vs_output_semantic_index[i] = 0;
- }
-
- num_generic = 0;
- /*
- * Determine number of outputs, the (default) output register
- * mapping and the semantic information for each output.
+ /* Compute mapping of vertex program outputs to slots.
*/
for (attr = 0; attr < VERT_RESULT_MAX; attr++) {
- if (stvp->Base.Base.OutputsWritten & (1 << attr)) {
- GLuint slot;
-
- /* XXX
- * Pass in the fragment program's input's semantic info.
- * Use the generic semantic indexes from there, instead of
- * guessing below.
- */
-
- if (outputMapping) {
- slot = outputMapping[attr];
- assert(slot != ~0);
- }
- else {
- slot = vs_num_outputs;
- vs_num_outputs++;
- defaultOutputMapping[attr] = slot;
- }
+ if ((stvp->Base.Base.OutputsWritten & (1 << attr)) == 0) {
+ stvp->result_to_output[attr] = ~0;
+ }
+ else {
+ unsigned slot = stvp->num_outputs++;
+
+ stvp->result_to_output[attr] = slot;
switch (attr) {
case VERT_RESULT_HPOS:
- assert(slot == 0);
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
- vs_output_semantic_index[slot] = 0;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
+ stvp->output_semantic_index[slot] = 0;
break;
case VERT_RESULT_COL0:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- vs_output_semantic_index[slot] = 0;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ stvp->output_semantic_index[slot] = 0;
break;
case VERT_RESULT_COL1:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- vs_output_semantic_index[slot] = 1;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ stvp->output_semantic_index[slot] = 1;
break;
case VERT_RESULT_BFC0:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
- vs_output_semantic_index[slot] = 0;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
+ stvp->output_semantic_index[slot] = 0;
break;
case VERT_RESULT_BFC1:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
- vs_output_semantic_index[slot] = 1;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
+ stvp->output_semantic_index[slot] = 1;
break;
case VERT_RESULT_FOGC:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_FOG;
- vs_output_semantic_index[slot] = 0;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_FOG;
+ stvp->output_semantic_index[slot] = 0;
break;
case VERT_RESULT_PSIZ:
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
- vs_output_semantic_index[slot] = 0;
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
+ stvp->output_semantic_index[slot] = 0;
break;
case VERT_RESULT_EDGE:
assert(0);
break;
+
case VERT_RESULT_TEX0:
case VERT_RESULT_TEX1:
case VERT_RESULT_TEX2:
@@ -178,87 +163,50 @@ st_translate_vertex_program(struct st_context *st,
case VERT_RESULT_TEX5:
case VERT_RESULT_TEX6:
case VERT_RESULT_TEX7:
- /* fall-through */
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+ stvp->output_semantic_index[slot] = attr - VERT_RESULT_TEX0;
+ break;
+
case VERT_RESULT_VAR0:
- /* fall-through */
default:
- assert(slot < Elements(vs_output_semantic_name));
- if (outputSemanticName) {
- /* use provided semantic into */
- assert(outputSemanticName[attr] != TGSI_SEMANTIC_COUNT);
- vs_output_semantic_name[slot] = outputSemanticName[attr];
- vs_output_semantic_index[slot] = outputSemanticIndex[attr];
- }
- else {
- /* use default semantic info */
- vs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- vs_output_semantic_index[slot] = num_generic++;
- }
+ assert(attr < VERT_RESULT_MAX);
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+ stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 -
+ FRAG_ATTRIB_TEX0 +
+ attr -
+ VERT_RESULT_VAR0);
+ break;
}
}
}
+}
- if (outputMapping) {
- /* find max output slot referenced to compute vs_num_outputs */
- GLuint maxSlot = 0;
- for (attr = 0; attr < VERT_RESULT_MAX; attr++) {
- if (outputMapping[attr] != ~0 && outputMapping[attr] > maxSlot)
- maxSlot = outputMapping[attr];
- }
- vs_num_outputs = maxSlot + 1;
- }
- else {
- outputMapping = defaultOutputMapping;
- }
-#if 0 /* debug */
- {
- GLuint i;
- printf("outputMapping? %d\n", outputMapping ? 1 : 0);
- if (outputMapping) {
- printf("attr -> slot\n");
- for (i = 0; i < 16; i++) {
- printf(" %2d %3d\n", i, outputMapping[i]);
- }
- }
- printf("slot sem_name sem_index\n");
- for (i = 0; i < vs_num_outputs; i++) {
- printf(" %2d %d %d\n",
- i,
- vs_output_semantic_name[i],
- vs_output_semantic_index[i]);
- }
- }
-#endif
-
- /* free old shader state, if any */
- if (stvp->state.tokens) {
- st_free_tokens(stvp->state.tokens);
- stvp->state.tokens = NULL;
- }
- if (stvp->driver_shader) {
- cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
- stvp->driver_shader = NULL;
- }
+struct st_vp_varient *
+st_translate_vertex_program(struct st_context *st,
+ struct st_vertex_program *stvp,
+ const struct st_vp_varient_key *key)
+{
+ struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient);
+ struct pipe_context *pipe = st->pipe;
- stvp->state.tokens =
+ vpv->state.tokens =
st_translate_mesa_program(st->ctx,
TGSI_PROCESSOR_VERTEX,
&stvp->Base.Base,
/* inputs */
- vs_num_inputs,
+ stvp->num_inputs,
stvp->input_to_index,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL,
/* outputs */
- vs_num_outputs,
- outputMapping,
- vs_output_semantic_name,
- vs_output_semantic_index );
+ stvp->num_outputs,
+ stvp->result_to_output,
+ stvp->output_semantic_name,
+ stvp->output_semantic_index );
- stvp->num_inputs = vs_num_inputs;
- stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state);
+ vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state);
if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(&stvp->Base.Base);
@@ -266,9 +214,11 @@ st_translate_vertex_program(struct st_context *st,
}
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump( stvp->state.tokens, 0 );
+ tgsi_dump( vpv->state.tokens, 0 );
debug_printf("\n");
}
+
+ return vpv;
}
@@ -291,7 +241,6 @@ st_translate_fragment_program(struct st_context *st,
GLuint attr;
const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
GLuint vslot = 0;
- GLuint num_generic = 0;
uint fs_num_inputs = 0;
@@ -341,14 +290,25 @@ st_translate_fragment_program(struct st_context *st,
break;
case FRAG_ATTRIB_FACE:
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
- stfp->input_semantic_index[slot] = num_generic++;
+ stfp->input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
break;
- case FRAG_ATTRIB_PNTC:
- stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stfp->input_semantic_index[slot] = num_generic++;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
- break;
+
+ /* In most cases, there is nothing special about these
+ * inputs, so adopt a convention to use the generic
+ * semantic name and the mesa FRAG_ATTRIB_ number as the
+ * index.
+ *
+ * All that is required is that the vertex shader labels
+ * its own outputs similarly, and that the vertex shader
+ * generates at least every output required by the
+ * fragment shader plus fixed-function hardware (such as
+ * BFC).
+ *
+ * There is no requirement that semantic indexes start at
+ * zero or be restricted to a particular range -- nobody
+ * should be building tables based on semantic index.
+ */
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
case FRAG_ATTRIB_TEX2:
@@ -357,16 +317,17 @@ st_translate_fragment_program(struct st_context *st,
case FRAG_ATTRIB_TEX5:
case FRAG_ATTRIB_TEX6:
case FRAG_ATTRIB_TEX7:
- stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stfp->input_semantic_index[slot] = num_generic++;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
- break;
+ case FRAG_ATTRIB_PNTC:
case FRAG_ATTRIB_VAR0:
- /* fall-through */
default:
+ /* Actually, let's try and zero-base this just for
+ * readability of the generated TGSI.
+ */
+ assert(attr >= FRAG_ATTRIB_TEX0);
+ stfp->input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stfp->input_semantic_index[slot] = num_generic++;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ break;
}
}
}
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index e2e5eddef2..88aadbd751 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -64,41 +64,70 @@ struct st_fragment_program
struct pipe_shader_state state;
void *driver_shader;
- GLuint param_state;
-
- /** List of vertex programs which have been translated such that their
- * outputs match this fragment program's inputs.
- */
- struct translated_vertex_program *vertex_programs;
-
/** Program prefixed with glBitmap prologue */
struct st_fragment_program *bitmap_program;
uint bitmap_sampler;
};
+
+struct st_vp_varient_key
+{
+ char dummy; /* currently unused */
+};
+
+
+/**
+ * This represents a vertex program, especially translated to match
+ * the inputs of a particular fragment shader.
+ */
+struct st_vp_varient
+{
+ /* Parameters which generated this translated version of a vertex
+ * shader:
+ */
+ struct st_vp_varient_key key;
+
+ /** TGSI tokens -- why?
+ */
+ struct pipe_shader_state state;
+
+ /** Driver's compiled shader */
+ void *driver_shader;
+
+ /** For using our private draw module (glRasterPos) */
+ struct draw_vertex_shader *draw_shader;
+
+ /** Next in linked list */
+ struct st_vp_varient *next;
+};
+
+
+
+
/**
* Derived from Mesa gl_fragment_program:
*/
struct st_vertex_program
{
struct gl_vertex_program Base; /**< The Mesa vertex program */
- GLuint serialNo;
+ GLuint serialNo, lastSerialNo;
/** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */
GLuint input_to_index[VERT_ATTRIB_MAX];
/** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
-
GLuint num_inputs;
- struct pipe_shader_state state;
- void *driver_shader;
+ /** Maps VERT_RESULT_x to slot */
+ GLuint result_to_output[VERT_RESULT_MAX];
+ ubyte output_semantic_name[VERT_RESULT_MAX];
+ ubyte output_semantic_index[VERT_RESULT_MAX];
+ GLuint num_outputs;
- /** For using our private draw module (glRasterPos) */
- struct draw_vertex_shader *draw_shader;
-
- GLuint param_state;
+ /** List of translated varients of this vertex program.
+ */
+ struct st_vp_varient *varients;
};
@@ -143,13 +172,21 @@ st_translate_fragment_program(struct st_context *st,
const GLuint inputMapping[]);
+/* Called after program string change, discard all previous
+ * compilation results.
+ */
extern void
+st_prepare_vertex_program(struct st_context *st,
+ struct st_vertex_program *stvp);
+
+extern struct st_vp_varient *
st_translate_vertex_program(struct st_context *st,
- struct st_vertex_program *vp,
- const GLuint vert_output_to_slot[],
- const ubyte *fs_input_semantic_name,
- const ubyte *fs_input_semantic_index);
+ struct st_vertex_program *stvp,
+ const struct st_vp_varient_key *key);
+void
+st_vp_release_varients( struct st_context *st,
+ struct st_vertex_program *stvp );
extern void
st_print_shaders(GLcontext *ctx);
--
cgit v1.2.3
From 5fb07a4046a7f00f060bbc6dae92213e635d55f5 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:30:47 -0800
Subject: AL1616: Add macros to pack two GLushorts into a texel
---
src/mesa/main/colormac.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index 7ae781ae23..905f4e2283 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -210,6 +210,12 @@ do { \
#define PACK_COLOR_88_REV( L, A ) \
(((A) << 8) | (L))
+#define PACK_COLOR_1616( L, A ) \
+ (((L) << 16) | (A))
+
+#define PACK_COLOR_1616_REV( L, A ) \
+ (((A) << 16) | (L))
+
#define PACK_COLOR_332( R, G, B ) \
(((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
--
cgit v1.2.3
From eb437fabe017611e1f855fffa45f59cd38709be8 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:49:40 -0800
Subject: AL1616: Add formats for GL_LUMINANCE16_ALPHA16 textures
---
src/mesa/main/formats.c | 25 +++++++++++++++++++++++++
src/mesa/main/formats.h | 2 ++
2 files changed, 27 insertions(+)
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 7d0e2d2914..7d64c462b1 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -231,6 +231,24 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 2 /* BlockWidth/Height,Bytes */
},
+ {
+ MESA_FORMAT_AL1616, /* Name */
+ "MESA_FORMAT_AL1616", /* StrName */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
+ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
+ 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
+ 1, 1, 4 /* BlockWidth/Height,Bytes */
+ },
+ {
+ MESA_FORMAT_AL1616_REV, /* Name */
+ "MESA_FORMAT_AL1616_REV", /* StrName */
+ GL_LUMINANCE_ALPHA, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
+ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
+ 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
+ 1, 1, 4 /* BlockWidth/Height,Bytes */
+ },
{
MESA_FORMAT_RGB332, /* Name */
"MESA_FORMAT_RGB332", /* StrName */
@@ -974,6 +992,13 @@ _mesa_format_to_type_and_comps(gl_format format,
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
+
+ case MESA_FORMAT_AL1616:
+ case MESA_FORMAT_AL1616_REV:
+ *datatype = GL_UNSIGNED_SHORT;
+ *comps = 2;
+ return;
+
case MESA_FORMAT_RGB332:
*datatype = GL_UNSIGNED_BYTE_3_3_2;
*comps = 3;
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index fa6359f5c8..d3ac436b1b 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -66,6 +66,8 @@ typedef enum
MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */
MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */
+ MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
+ MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
MESA_FORMAT_RGB332, /* RRRG GGBB */
MESA_FORMAT_A8, /* AAAA AAAA */
MESA_FORMAT_L8, /* LLLL LLLL */
--
cgit v1.2.3
From 975871b4d5e25ddcd350f4e1600c00d37f65fea1 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:52:43 -0800
Subject: AL1616: Add texel fetch / store routines
---
src/mesa/main/texfetch.c | 14 +++++++++++++
src/mesa/main/texfetch_tmp.h | 48 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index 314ccb7b65..c431d3a1db 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -452,6 +452,20 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
fetch_texel_3d_f_al88_rev,
store_texel_al88_rev
},
+ {
+ MESA_FORMAT_AL1616,
+ fetch_texel_1d_f_al1616,
+ fetch_texel_2d_f_al1616,
+ fetch_texel_3d_f_al1616,
+ store_texel_al1616
+ },
+ {
+ MESA_FORMAT_AL1616_REV,
+ fetch_texel_1d_f_al1616_rev,
+ fetch_texel_2d_f_al1616_rev,
+ fetch_texel_3d_f_al1616_rev,
+ store_texel_al1616_rev
+ },
{
MESA_FORMAT_RGB332,
fetch_texel_1d_f_rgb332,
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
index 27434946ec..093e0abc49 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -834,6 +834,54 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage,
#endif
+/* MESA_FORMAT_AL1616 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
+static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = USHORT_TO_FLOAT( s & 0xffff );
+ texel[ACOMP] = USHORT_TO_FLOAT( s >> 16 );
+}
+
+#if DIM == 3
+static void store_texel_al1616(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLushort *rgba = (const GLushort *) texel;
+ GLuint *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_AL1616_REV ****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
+static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = USHORT_TO_FLOAT( s >> 16 );
+ texel[ACOMP] = USHORT_TO_FLOAT( s & 0xffff );
+}
+
+#if DIM == 3
+static void store_texel_al1616_rev(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLushort *rgba = (const GLushort *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[ACOMP]);
+}
+#endif
+
+
/* MESA_FORMAT_RGB332 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
--
cgit v1.2.3
From 3325dc91be2534079ebf7997700b6e5f17a75283 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:53:12 -0800
Subject: AL1616: Add TexImage storage path
---
src/mesa/main/texstore.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index e48d472061..f43e216bc5 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2145,6 +2145,77 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
}
+static GLboolean
+_mesa_texstore_al1616(TEXSTORE_PARAMS)
+{
+ const GLboolean littleEndian = _mesa_little_endian();
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+ ASSERT(dstFormat == MESA_FORMAT_AL1616 ||
+ dstFormat == MESA_FORMAT_AL1616_REV);
+ ASSERT(texelBytes == 4);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == MESA_FORMAT_AL1616 &&
+ baseInternalFormat == GL_LUMINANCE_ALPHA &&
+ srcFormat == GL_LUMINANCE_ALPHA &&
+ srcType == GL_UNSIGNED_SHORT &&
+ littleEndian) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ baseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLfloat *src = tempImage;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * texelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * texelBytes;
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *dstUI = (GLuint *) dstRow;
+ if (dstFormat == MESA_FORMAT_AL1616) {
+ for (col = 0; col < srcWidth; col++) {
+ /* src[0] is luminance, src[1] is alpha */
+ dstUI[col] = PACK_COLOR_88( FLOAT_TO_USHORT(src[1]),
+ FLOAT_TO_USHORT(src[0]) );
+ src += 2;
+ }
+ }
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ /* src[0] is luminance, src[1] is alpha */
+ dstUI[col] = PACK_COLOR_1616_REV( FLOAT_TO_UBYTE(src[1]),
+ FLOAT_TO_UBYTE(src[0]) );
+ src += 2;
+ }
+ }
+ dstRow += dstRowStride;
+ }
+ }
+ _mesa_free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
static GLboolean
_mesa_texstore_rgb332(TEXSTORE_PARAMS)
{
@@ -3073,6 +3144,8 @@ texstore_funcs[MESA_FORMAT_COUNT] =
{ MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 },
{ MESA_FORMAT_AL88, _mesa_texstore_al88 },
{ MESA_FORMAT_AL88_REV, _mesa_texstore_al88 },
+ { MESA_FORMAT_AL1616, _mesa_texstore_al1616 },
+ { MESA_FORMAT_AL1616_REV, _mesa_texstore_al1616 },
{ MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
{ MESA_FORMAT_A8, _mesa_texstore_a8 },
{ MESA_FORMAT_L8, _mesa_texstore_a8 },
--
cgit v1.2.3
From 12982e381d3474c5c00f89cc442d442df097339b Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:53:36 -0800
Subject: AL1616: Enable MESA_FORMAT_AL1616 for software paths
---
src/mesa/main/texformat.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 39c561e278..1a374e7bee 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -115,11 +115,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ return MESA_FORMAT_AL88;
+
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- case GL_LUMINANCE8_ALPHA8:
- return MESA_FORMAT_AL88;
+ return MESA_FORMAT_AL1616;
case GL_INTENSITY:
case GL_INTENSITY4:
--
cgit v1.2.3
From b1616b2a811b9a161d1ee2a8251e0efe32a8c192 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 14:56:17 -0800
Subject: Move 'static' to start of declaration to silence compiler warning
---
src/mesa/main/texstore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index f43e216bc5..7cf3287713 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3121,7 +3121,7 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS)
* Table mapping MESA_FORMAT_8 to _mesa_texstore_*()
* XXX this is somewhat temporary.
*/
-const static struct {
+static const struct {
gl_format Name;
StoreTexImageFunc Store;
}
--
cgit v1.2.3
From fdfbae3381553fc93202560abe3b41b4d543f0bf Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Mon, 16 Nov 2009 15:09:24 -0800
Subject: i965: Use MESA_FORMAT_AL1616 when appropriate
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 +++
src/mesa/drivers/dri/intel/intel_tex_format.c | 12 +++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index e2f0a383e7..47035cc6fc 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -86,6 +86,9 @@ static GLuint translate_tex_format( gl_format mesa_format,
case MESA_FORMAT_AL88:
return BRW_SURFACEFORMAT_L8A8_UNORM;
+ case MESA_FORMAT_AL1616:
+ return BRW_SURFACEFORMAT_L16A16_UNORM;
+
case MESA_FORMAT_RGB888:
assert(0); /* not supported for sampling */
return BRW_SURFACEFORMAT_R8G8B8_UNORM;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
index f37a545c7f..bfa3dba1f5 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -95,14 +95,20 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_COMPRESSED_LUMINANCE:
return MESA_FORMAT_L8;
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+#ifndef I915
+ return MESA_FORMAT_AL1616;
+#else
+ /* FALLTHROUGH */
+#endif
+
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE6_ALPHA2:
case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
return MESA_FORMAT_AL88;
--
cgit v1.2.3
From a1afe303deda320aadacdaf5b1c72631ca3f734f Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 16 Nov 2009 15:44:52 -0800
Subject: progs/demos: Fix memory leak in ipers.c.
---
progs/demos/ipers.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c
index 5d82b0dc92..ed03673cb6 100644
--- a/progs/demos/ipers.c
+++ b/progs/demos/ipers.c
@@ -133,6 +133,8 @@ initdlists(void)
glEndList();
}
+
+ gluDeleteQuadric(obj);
}
static void
--
cgit v1.2.3
From ee555e3d69c8820f27e71e5ebc028a768cef7d0b Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 16 Nov 2009 16:31:34 -0800
Subject: progs/demos: Fix memory leak in projtex.c.
---
progs/demos/projtex.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c
index 99154d7bdc..ad205c7413 100644
--- a/progs/demos/projtex.c
+++ b/progs/demos/projtex.c
@@ -245,6 +245,9 @@ loadImageTextures(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
+
+ free(texData3);
+ free(texData4);
}
}
--
cgit v1.2.3
From 648e8b4c46e9ab0374fdbe655321157125b7efe5 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 17 Nov 2009 00:39:09 +0100
Subject: st/xorg: Fix copy-pasto
Thanks Alan.
---
src/gallium/state_trackers/xorg/xorg_composite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 93a3e1b8cf..733bd53fca 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -237,7 +237,7 @@ picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, bool
if (pSrc->picture_format == pSrcPicture->format) {
if (pSrc->picture_format == PICT_a8)
- return mask ? FS_MASK_LUMINANCE : FS_MASK_LUMINANCE;
+ return mask ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE;
return 0;
}
--
cgit v1.2.3
From 6b480dc21dd489d48685b2268e495218aea74293 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 16 Nov 2009 18:06:40 -0800
Subject: progs/demos: Fix memory leak in ray.c.
---
progs/demos/ray.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/demos/ray.c b/progs/demos/ray.c
index c2d8e4f545..e9211aa339 100644
--- a/progs/demos/ray.c
+++ b/progs/demos/ray.c
@@ -834,6 +834,8 @@ initdlists(void)
gluQuadricTexture(obj, GL_TRUE);
gluSphere(obj, SPHERE_RADIUS, 16, 16);
glEndList();
+
+ gluDeleteQuadric(obj);
}
int
--
cgit v1.2.3
From 3192633d4abe262d413e41feb871fe8deed409d8 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Mon, 16 Nov 2009 19:56:18 +0100
Subject: svga: Add svga driver
---
src/gallium/drivers/svga/Makefile | 63 +
src/gallium/drivers/svga/SConscript | 75 +
src/gallium/drivers/svga/include/README | 3 +
src/gallium/drivers/svga/include/svga3d_caps.h | 139 +
src/gallium/drivers/svga/include/svga3d_reg.h | 1793 +++++++++++++
.../drivers/svga/include/svga3d_shaderdefs.h | 519 ++++
src/gallium/drivers/svga/include/svga_reg.h | 1346 ++++++++++
src/gallium/drivers/svga/include/svga_types.h | 46 +
src/gallium/drivers/svga/svga_cmd.c | 1427 ++++++++++
src/gallium/drivers/svga/svga_cmd.h | 235 ++
src/gallium/drivers/svga/svga_context.c | 269 ++
src/gallium/drivers/svga/svga_context.h | 443 ++++
src/gallium/drivers/svga/svga_debug.h | 74 +
src/gallium/drivers/svga/svga_draw.c | 370 +++
src/gallium/drivers/svga/svga_draw.h | 83 +
src/gallium/drivers/svga/svga_draw_arrays.c | 297 +++
src/gallium/drivers/svga/svga_draw_elements.c | 255 ++
src/gallium/drivers/svga/svga_draw_private.h | 158 ++
src/gallium/drivers/svga/svga_hw_reg.h | 42 +
src/gallium/drivers/svga/svga_pipe_blend.c | 246 ++
src/gallium/drivers/svga/svga_pipe_blit.c | 84 +
src/gallium/drivers/svga/svga_pipe_clear.c | 119 +
src/gallium/drivers/svga/svga_pipe_constants.c | 74 +
src/gallium/drivers/svga/svga_pipe_depthstencil.c | 153 ++
src/gallium/drivers/svga/svga_pipe_draw.c | 261 ++
src/gallium/drivers/svga/svga_pipe_flush.c | 68 +
src/gallium/drivers/svga/svga_pipe_fs.c | 124 +
src/gallium/drivers/svga/svga_pipe_misc.c | 187 ++
src/gallium/drivers/svga/svga_pipe_query.c | 267 ++
src/gallium/drivers/svga/svga_pipe_rasterizer.c | 250 ++
src/gallium/drivers/svga/svga_pipe_sampler.c | 243 ++
src/gallium/drivers/svga/svga_pipe_vertex.c | 115 +
src/gallium/drivers/svga/svga_pipe_vs.c | 189 ++
src/gallium/drivers/svga/svga_screen.c | 435 ++++
src/gallium/drivers/svga/svga_screen.h | 95 +
src/gallium/drivers/svga/svga_screen_buffer.c | 820 ++++++
src/gallium/drivers/svga/svga_screen_buffer.h | 190 ++
src/gallium/drivers/svga/svga_screen_cache.c | 307 +++
src/gallium/drivers/svga/svga_screen_cache.h | 135 +
src/gallium/drivers/svga/svga_screen_texture.c | 1065 ++++++++
src/gallium/drivers/svga/svga_screen_texture.h | 177 ++
src/gallium/drivers/svga/svga_state.c | 278 ++
src/gallium/drivers/svga/svga_state.h | 95 +
src/gallium/drivers/svga/svga_state_constants.c | 239 ++
src/gallium/drivers/svga/svga_state_framebuffer.c | 455 ++++
src/gallium/drivers/svga/svga_state_fs.c | 282 ++
src/gallium/drivers/svga/svga_state_need_swtnl.c | 200 ++
src/gallium/drivers/svga/svga_state_rss.c | 268 ++
src/gallium/drivers/svga/svga_state_tss.c | 279 ++
src/gallium/drivers/svga/svga_state_vdecl.c | 182 ++
src/gallium/drivers/svga/svga_state_vs.c | 239 ++
src/gallium/drivers/svga/svga_swtnl.h | 52 +
src/gallium/drivers/svga/svga_swtnl_backend.c | 349 +++
src/gallium/drivers/svga/svga_swtnl_draw.c | 170 ++
src/gallium/drivers/svga/svga_swtnl_private.h | 93 +
src/gallium/drivers/svga/svga_swtnl_state.c | 242 ++
src/gallium/drivers/svga/svga_tgsi.c | 266 ++
src/gallium/drivers/svga/svga_tgsi.h | 139 +
src/gallium/drivers/svga/svga_tgsi_decl_sm20.c | 280 ++
src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | 385 +++
src/gallium/drivers/svga/svga_tgsi_emit.h | 345 +++
src/gallium/drivers/svga/svga_tgsi_insn.c | 2716 ++++++++++++++++++++
src/gallium/drivers/svga/svga_winsys.h | 299 +++
src/gallium/drivers/svga/svgadump/st_shader.h | 214 ++
src/gallium/drivers/svga/svgadump/st_shader_dump.c | 649 +++++
src/gallium/drivers/svga/svgadump/st_shader_dump.h | 42 +
src/gallium/drivers/svga/svgadump/st_shader_op.c | 168 ++
src/gallium/drivers/svga/svgadump/st_shader_op.h | 46 +
src/gallium/drivers/svga/svgadump/svga_dump.c | 1736 +++++++++++++
src/gallium/drivers/svga/svgadump/svga_dump.h | 34 +
src/gallium/drivers/svga/svgadump/svga_dump.py | 329 +++
src/gallium/winsys/drm/vmware/Makefile | 12 +
src/gallium/winsys/drm/vmware/SConscript | 11 +
src/gallium/winsys/drm/vmware/core/Makefile | 47 +
src/gallium/winsys/drm/vmware/core/SConscript | 39 +
src/gallium/winsys/drm/vmware/core/vmw_buffer.c | 274 ++
src/gallium/winsys/drm/vmware/core/vmw_buffer.h | 65 +
src/gallium/winsys/drm/vmware/core/vmw_context.c | 297 +++
src/gallium/winsys/drm/vmware/core/vmw_context.h | 59 +
src/gallium/winsys/drm/vmware/core/vmw_fence.c | 108 +
src/gallium/winsys/drm/vmware/core/vmw_fence.h | 59 +
src/gallium/winsys/drm/vmware/core/vmw_screen.c | 74 +
src/gallium/winsys/drm/vmware/core/vmw_screen.h | 134 +
.../winsys/drm/vmware/core/vmw_screen_dri.c | 371 +++
.../winsys/drm/vmware/core/vmw_screen_ioctl.c | 503 ++++
.../winsys/drm/vmware/core/vmw_screen_pools.c | 79 +
.../winsys/drm/vmware/core/vmw_screen_svga.c | 295 +++
src/gallium/winsys/drm/vmware/core/vmw_surface.c | 59 +
src/gallium/winsys/drm/vmware/core/vmw_surface.h | 79 +
src/gallium/winsys/drm/vmware/dri/Makefile | 18 +
src/gallium/winsys/drm/vmware/dri/SConscript | 63 +
src/gallium/winsys/drm/vmware/egl/Makefile | 18 +
src/gallium/winsys/drm/vmware/xorg/Makefile | 54 +
src/gallium/winsys/drm/vmware/xorg/SConscript | 55 +
src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c | 150 ++
95 files changed, 27235 insertions(+)
create mode 100644 src/gallium/drivers/svga/Makefile
create mode 100644 src/gallium/drivers/svga/SConscript
create mode 100644 src/gallium/drivers/svga/include/README
create mode 100644 src/gallium/drivers/svga/include/svga3d_caps.h
create mode 100644 src/gallium/drivers/svga/include/svga3d_reg.h
create mode 100644 src/gallium/drivers/svga/include/svga3d_shaderdefs.h
create mode 100644 src/gallium/drivers/svga/include/svga_reg.h
create mode 100644 src/gallium/drivers/svga/include/svga_types.h
create mode 100644 src/gallium/drivers/svga/svga_cmd.c
create mode 100644 src/gallium/drivers/svga/svga_cmd.h
create mode 100644 src/gallium/drivers/svga/svga_context.c
create mode 100644 src/gallium/drivers/svga/svga_context.h
create mode 100644 src/gallium/drivers/svga/svga_debug.h
create mode 100644 src/gallium/drivers/svga/svga_draw.c
create mode 100644 src/gallium/drivers/svga/svga_draw.h
create mode 100644 src/gallium/drivers/svga/svga_draw_arrays.c
create mode 100644 src/gallium/drivers/svga/svga_draw_elements.c
create mode 100644 src/gallium/drivers/svga/svga_draw_private.h
create mode 100644 src/gallium/drivers/svga/svga_hw_reg.h
create mode 100644 src/gallium/drivers/svga/svga_pipe_blend.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_blit.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_clear.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_constants.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_depthstencil.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_draw.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_flush.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_fs.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_misc.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_query.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_rasterizer.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_sampler.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_vertex.c
create mode 100644 src/gallium/drivers/svga/svga_pipe_vs.c
create mode 100644 src/gallium/drivers/svga/svga_screen.c
create mode 100644 src/gallium/drivers/svga/svga_screen.h
create mode 100644 src/gallium/drivers/svga/svga_screen_buffer.c
create mode 100644 src/gallium/drivers/svga/svga_screen_buffer.h
create mode 100644 src/gallium/drivers/svga/svga_screen_cache.c
create mode 100644 src/gallium/drivers/svga/svga_screen_cache.h
create mode 100644 src/gallium/drivers/svga/svga_screen_texture.c
create mode 100644 src/gallium/drivers/svga/svga_screen_texture.h
create mode 100644 src/gallium/drivers/svga/svga_state.c
create mode 100644 src/gallium/drivers/svga/svga_state.h
create mode 100644 src/gallium/drivers/svga/svga_state_constants.c
create mode 100644 src/gallium/drivers/svga/svga_state_framebuffer.c
create mode 100644 src/gallium/drivers/svga/svga_state_fs.c
create mode 100644 src/gallium/drivers/svga/svga_state_need_swtnl.c
create mode 100644 src/gallium/drivers/svga/svga_state_rss.c
create mode 100644 src/gallium/drivers/svga/svga_state_tss.c
create mode 100644 src/gallium/drivers/svga/svga_state_vdecl.c
create mode 100644 src/gallium/drivers/svga/svga_state_vs.c
create mode 100644 src/gallium/drivers/svga/svga_swtnl.h
create mode 100644 src/gallium/drivers/svga/svga_swtnl_backend.c
create mode 100644 src/gallium/drivers/svga/svga_swtnl_draw.c
create mode 100644 src/gallium/drivers/svga/svga_swtnl_private.h
create mode 100644 src/gallium/drivers/svga/svga_swtnl_state.c
create mode 100644 src/gallium/drivers/svga/svga_tgsi.c
create mode 100644 src/gallium/drivers/svga/svga_tgsi.h
create mode 100644 src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
create mode 100644 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
create mode 100644 src/gallium/drivers/svga/svga_tgsi_emit.h
create mode 100644 src/gallium/drivers/svga/svga_tgsi_insn.c
create mode 100644 src/gallium/drivers/svga/svga_winsys.h
create mode 100644 src/gallium/drivers/svga/svgadump/st_shader.h
create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.c
create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.h
create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.c
create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.h
create mode 100644 src/gallium/drivers/svga/svgadump/svga_dump.c
create mode 100644 src/gallium/drivers/svga/svgadump/svga_dump.h
create mode 100755 src/gallium/drivers/svga/svgadump/svga_dump.py
create mode 100644 src/gallium/winsys/drm/vmware/Makefile
create mode 100644 src/gallium/winsys/drm/vmware/SConscript
create mode 100644 src/gallium/winsys/drm/vmware/core/Makefile
create mode 100644 src/gallium/winsys/drm/vmware/core/SConscript
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_buffer.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_buffer.h
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_context.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_context.h
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_fence.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_fence.h
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen.h
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_surface.c
create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_surface.h
create mode 100644 src/gallium/winsys/drm/vmware/dri/Makefile
create mode 100644 src/gallium/winsys/drm/vmware/dri/SConscript
create mode 100644 src/gallium/winsys/drm/vmware/egl/Makefile
create mode 100644 src/gallium/winsys/drm/vmware/xorg/Makefile
create mode 100644 src/gallium/winsys/drm/vmware/xorg/SConscript
create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile
new file mode 100644
index 0000000000..05ab4ab9b3
--- /dev/null
+++ b/src/gallium/drivers/svga/Makefile
@@ -0,0 +1,63 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = svga
+
+C_SOURCES = \
+ svgadump/st_shader_dump.c \
+ svgadump/st_shader_op.c \
+ svgadump/svga_dump.c \
+ svga_cmd.c \
+ svga_context.c \
+ svga_draw.c \
+ svga_draw_arrays.c \
+ svga_draw_elements.c \
+ svga_pipe_blend.c \
+ svga_pipe_blit.c \
+ svga_pipe_clear.c \
+ svga_pipe_constants.c \
+ svga_pipe_depthstencil.c \
+ svga_pipe_draw.c \
+ svga_pipe_flush.c \
+ svga_pipe_fs.c \
+ svga_pipe_misc.c \
+ svga_pipe_query.c \
+ svga_pipe_rasterizer.c \
+ svga_pipe_sampler.c \
+ svga_pipe_vertex.c \
+ svga_pipe_vs.c \
+ svga_screen.c \
+ svga_screen_buffer.c \
+ svga_screen_texture.c \
+ svga_screen_cache.c \
+ svga_state.c \
+ svga_state_need_swtnl.c \
+ svga_state_constants.c \
+ svga_state_framebuffer.c \
+ svga_state_rss.c \
+ svga_state_tss.c \
+ svga_state_vdecl.c \
+ svga_state_fs.c \
+ svga_state_vs.c \
+ svga_swtnl_backend.c \
+ svga_swtnl_draw.c \
+ svga_swtnl_state.c \
+ svga_tgsi.c \
+ svga_tgsi_decl_sm20.c \
+ svga_tgsi_decl_sm30.c \
+ svga_tgsi_insn.c
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/src/gallium/drivers/svga/include
+
+LIBRARY_DEFINES = \
+ -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H
+
+CC = gcc -fvisibility=hidden -msse -msse2
+
+# Set the gnu99 standard to enable anonymous structs in vmware headers.
+#
+CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \
+ $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
+
+include ../../Makefile.template
diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript
new file mode 100644
index 0000000000..0fa745c9b8
--- /dev/null
+++ b/src/gallium/drivers/svga/SConscript
@@ -0,0 +1,75 @@
+Import('*')
+
+env = env.Clone()
+
+if env['platform'] in ['linux']:
+ env.Append(CCFLAGS = ['-fvisibility=hidden'])
+
+if env['gcc']:
+ env.Append(CPPDEFINES = [
+ 'HAVE_STDINT_H',
+ 'HAVE_SYS_TYPES_H',
+ ])
+ if env['platform'] not in ['windows']:
+ # The Windows headers cause many gcc warnings
+ env.Append(CCFLAGS = ['-Werror'])
+
+env.Prepend(CPPPATH = [
+ 'include',
+])
+
+env.Append(CPPDEFINES = [
+])
+
+sources = [
+ 'svga_cmd.c',
+ 'svga_context.c',
+ 'svga_draw.c',
+ 'svga_draw_arrays.c',
+ 'svga_draw_elements.c',
+ 'svga_pipe_blend.c',
+ 'svga_pipe_blit.c',
+ 'svga_pipe_clear.c',
+ 'svga_pipe_constants.c',
+ 'svga_pipe_depthstencil.c',
+ 'svga_pipe_draw.c',
+ 'svga_pipe_flush.c',
+ 'svga_pipe_fs.c',
+ 'svga_pipe_misc.c',
+ 'svga_pipe_query.c',
+ 'svga_pipe_rasterizer.c',
+ 'svga_pipe_sampler.c',
+ 'svga_pipe_vertex.c',
+ 'svga_pipe_vs.c',
+ 'svga_screen.c',
+ 'svga_screen_buffer.c',
+ 'svga_screen_cache.c',
+ 'svga_screen_texture.c',
+ 'svga_state.c',
+ 'svga_state_constants.c',
+ 'svga_state_framebuffer.c',
+ 'svga_state_need_swtnl.c',
+ 'svga_state_rss.c',
+ 'svga_state_tss.c',
+ 'svga_state_vdecl.c',
+ 'svga_state_fs.c',
+ 'svga_state_vs.c',
+ 'svga_swtnl_backend.c',
+ 'svga_swtnl_draw.c',
+ 'svga_swtnl_state.c',
+ 'svga_tgsi.c',
+ 'svga_tgsi_decl_sm20.c',
+ 'svga_tgsi_decl_sm30.c',
+ 'svga_tgsi_insn.c',
+
+ 'svgadump/svga_dump.c',
+ 'svgadump/st_shader_dump.c',
+ 'svgadump/st_shader_op.c',
+]
+
+svga = env.ConvenienceLibrary(
+ target = 'svga',
+ source = sources,
+)
+
+Export('svga')
diff --git a/src/gallium/drivers/svga/include/README b/src/gallium/drivers/svga/include/README
new file mode 100644
index 0000000000..a0b8916104
--- /dev/null
+++ b/src/gallium/drivers/svga/include/README
@@ -0,0 +1,3 @@
+This directory contains the headers from the VMware SVGA Device Developer Kit:
+
+ https://vmware-svga.svn.sourceforge.net/svnroot/vmware-svga/trunk/lib/vmware/
diff --git a/src/gallium/drivers/svga/include/svga3d_caps.h b/src/gallium/drivers/svga/include/svga3d_caps.h
new file mode 100644
index 0000000000..714ce9f45f
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga3d_caps.h
@@ -0,0 +1,139 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga3d_caps.h --
+ *
+ * Definitions for SVGA3D hardware capabilities. Capabilities
+ * are used to query for optional rendering features during
+ * driver initialization. The capability data is stored as very
+ * basic key/value dictionary within the "FIFO register" memory
+ * area at the beginning of BAR2.
+ *
+ * Note that these definitions are only for 3D capabilities.
+ * The SVGA device also has "device capabilities" and "FIFO
+ * capabilities", which are non-3D-specific and are stored as
+ * bitfields rather than key/value pairs.
+ */
+
+#ifndef _SVGA3D_CAPS_H_
+#define _SVGA3D_CAPS_H_
+
+#define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - \
+ SVGA_FIFO_3D_CAPS + 1)
+
+
+/*
+ * SVGA3dCapsRecordType
+ *
+ * Record types that can be found in the caps block.
+ * Related record types are grouped together numerically so that
+ * SVGA3dCaps_FindRecord() can be applied on a range of record
+ * types.
+ */
+
+typedef enum {
+ SVGA3DCAPS_RECORD_UNKNOWN = 0,
+ SVGA3DCAPS_RECORD_DEVCAPS_MIN = 0x100,
+ SVGA3DCAPS_RECORD_DEVCAPS = 0x100,
+ SVGA3DCAPS_RECORD_DEVCAPS_MAX = 0x1ff,
+} SVGA3dCapsRecordType;
+
+
+/*
+ * SVGA3dCapsRecordHeader
+ *
+ * Header field leading each caps block record. Contains the offset (in
+ * register words, NOT bytes) to the next caps block record (or the end
+ * of caps block records which will be a zero word) and the record type
+ * as defined above.
+ */
+
+typedef
+struct SVGA3dCapsRecordHeader {
+ uint32 length;
+ SVGA3dCapsRecordType type;
+}
+SVGA3dCapsRecordHeader;
+
+
+/*
+ * SVGA3dCapsRecord
+ *
+ * Caps block record; "data" is a placeholder for the actual data structure
+ * contained within the record; for example a record containing a FOOBAR
+ * structure would be of size "sizeof(SVGA3dCapsRecordHeader) +
+ * sizeof(FOOBAR)".
+ */
+
+typedef
+struct SVGA3dCapsRecord {
+ SVGA3dCapsRecordHeader header;
+ uint32 data[1];
+}
+SVGA3dCapsRecord;
+
+
+typedef uint32 SVGA3dCapPair[2];
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3dCaps_FindRecord
+ *
+ * Finds the record with the highest-valued type within the given range
+ * in the caps block.
+ *
+ * Result: pointer to found record, or NULL if not found.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static INLINE SVGA3dCapsRecord *
+SVGA3dCaps_FindRecord(const uint32 *capsBlock,
+ SVGA3dCapsRecordType recordTypeMin,
+ SVGA3dCapsRecordType recordTypeMax)
+{
+ SVGA3dCapsRecord *record, *found = NULL;
+ uint32 offset;
+
+ /*
+ * Search linearly through the caps block records for the specified type.
+ */
+ for (offset = 0; capsBlock[offset] != 0; offset += capsBlock[offset]) {
+ record = (SVGA3dCapsRecord *) (capsBlock + offset);
+ if ((record->header.type >= recordTypeMin) &&
+ (record->header.type <= recordTypeMax) &&
+ (!found || (record->header.type > found->header.type))) {
+ found = record;
+ }
+ }
+
+ return found;
+}
+
+
+#endif // _SVGA3D_CAPS_H_
diff --git a/src/gallium/drivers/svga/include/svga3d_reg.h b/src/gallium/drivers/svga/include/svga3d_reg.h
new file mode 100644
index 0000000000..77cb453310
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga3d_reg.h
@@ -0,0 +1,1793 @@
+/**********************************************************
+ * Copyright 1998-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga3d_reg.h --
+ *
+ * SVGA 3D hardware definitions
+ */
+
+#ifndef _SVGA3D_REG_H_
+#define _SVGA3D_REG_H_
+
+#include "svga_reg.h"
+
+
+/*
+ * 3D Hardware Version
+ *
+ * The hardware version is stored in the SVGA_FIFO_3D_HWVERSION fifo
+ * register. Is set by the host and read by the guest. This lets
+ * us make new guest drivers which are backwards-compatible with old
+ * SVGA hardware revisions. It does not let us support old guest
+ * drivers. Good enough for now.
+ *
+ */
+
+#define SVGA3D_MAKE_HWVERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
+#define SVGA3D_MAJOR_HWVERSION(version) ((version) >> 16)
+#define SVGA3D_MINOR_HWVERSION(version) ((version) & 0xFF)
+
+typedef enum {
+ SVGA3D_HWVERSION_WS5_RC1 = SVGA3D_MAKE_HWVERSION(0, 1),
+ SVGA3D_HWVERSION_WS5_RC2 = SVGA3D_MAKE_HWVERSION(0, 2),
+ SVGA3D_HWVERSION_WS51_RC1 = SVGA3D_MAKE_HWVERSION(0, 3),
+ SVGA3D_HWVERSION_WS6_B1 = SVGA3D_MAKE_HWVERSION(1, 1),
+ SVGA3D_HWVERSION_FUSION_11 = SVGA3D_MAKE_HWVERSION(1, 4),
+ SVGA3D_HWVERSION_WS65_B1 = SVGA3D_MAKE_HWVERSION(2, 0),
+ SVGA3D_HWVERSION_CURRENT = SVGA3D_HWVERSION_WS65_B1,
+} SVGA3dHardwareVersion;
+
+/*
+ * Generic Types
+ */
+
+typedef uint32 SVGA3dBool; /* 32-bit Bool definition */
+#define SVGA3D_NUM_CLIPPLANES 6
+#define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS 8
+
+
+/*
+ * Surface formats.
+ *
+ * If you modify this list, be sure to keep GLUtil.c in sync. It
+ * includes the internal format definition of each surface in
+ * GLUtil_ConvertSurfaceFormat, and it contains a table of
+ * human-readable names in GLUtil_GetFormatName.
+ */
+
+typedef enum SVGA3dSurfaceFormat {
+ SVGA3D_FORMAT_INVALID = 0,
+
+ SVGA3D_X8R8G8B8 = 1,
+ SVGA3D_A8R8G8B8 = 2,
+
+ SVGA3D_R5G6B5 = 3,
+ SVGA3D_X1R5G5B5 = 4,
+ SVGA3D_A1R5G5B5 = 5,
+ SVGA3D_A4R4G4B4 = 6,
+
+ SVGA3D_Z_D32 = 7,
+ SVGA3D_Z_D16 = 8,
+ SVGA3D_Z_D24S8 = 9,
+ SVGA3D_Z_D15S1 = 10,
+
+ SVGA3D_LUMINANCE8 = 11,
+ SVGA3D_LUMINANCE4_ALPHA4 = 12,
+ SVGA3D_LUMINANCE16 = 13,
+ SVGA3D_LUMINANCE8_ALPHA8 = 14,
+
+ SVGA3D_DXT1 = 15,
+ SVGA3D_DXT2 = 16,
+ SVGA3D_DXT3 = 17,
+ SVGA3D_DXT4 = 18,
+ SVGA3D_DXT5 = 19,
+
+ SVGA3D_BUMPU8V8 = 20,
+ SVGA3D_BUMPL6V5U5 = 21,
+ SVGA3D_BUMPX8L8V8U8 = 22,
+ SVGA3D_BUMPL8V8U8 = 23,
+
+ SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */
+ SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */
+
+ SVGA3D_A2R10G10B10 = 26,
+
+ /* signed formats */
+ SVGA3D_V8U8 = 27,
+ SVGA3D_Q8W8V8U8 = 28,
+ SVGA3D_CxV8U8 = 29,
+
+ /* mixed formats */
+ SVGA3D_X8L8V8U8 = 30,
+ SVGA3D_A2W10V10U10 = 31,
+
+ SVGA3D_ALPHA8 = 32,
+
+ /* Single- and dual-component floating point formats */
+ SVGA3D_R_S10E5 = 33,
+ SVGA3D_R_S23E8 = 34,
+ SVGA3D_RG_S10E5 = 35,
+ SVGA3D_RG_S23E8 = 36,
+
+ /*
+ * Any surface can be used as a buffer object, but SVGA3D_BUFFER is
+ * the most efficient format to use when creating new surfaces
+ * expressly for index or vertex data.
+ */
+ SVGA3D_BUFFER = 37,
+
+ SVGA3D_Z_D24X8 = 38,
+
+ SVGA3D_V16U16 = 39,
+
+ SVGA3D_G16R16 = 40,
+ SVGA3D_A16B16G16R16 = 41,
+
+ /* Packed Video formats */
+ SVGA3D_UYVY = 42,
+ SVGA3D_YUY2 = 43,
+
+ SVGA3D_FORMAT_MAX
+} SVGA3dSurfaceFormat;
+
+typedef uint32 SVGA3dColor; /* a, r, g, b */
+
+/*
+ * These match the D3DFORMAT_OP definitions used by Direct3D. We need
+ * them so that we can query the host for what the supported surface
+ * operations are (when we're using the D3D backend, in particular),
+ * and so we can send those operations to the guest.
+ */
+typedef enum {
+ SVGA3DFORMAT_OP_TEXTURE = 0x00000001,
+ SVGA3DFORMAT_OP_VOLUMETEXTURE = 0x00000002,
+ SVGA3DFORMAT_OP_CUBETEXTURE = 0x00000004,
+ SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET = 0x00000008,
+ SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET = 0x00000010,
+ SVGA3DFORMAT_OP_ZSTENCIL = 0x00000040,
+ SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH = 0x00000080,
+
+/*
+ * This format can be used as a render target if the current display mode
+ * is the same depth if the alpha channel is ignored. e.g. if the device
+ * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the
+ * format op list entry for A8R8G8B8 should have this cap.
+ */
+ SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET = 0x00000100,
+
+/*
+ * This format contains DirectDraw support (including Flip). This flag
+ * should not to be set on alpha formats.
+ */
+ SVGA3DFORMAT_OP_DISPLAYMODE = 0x00000400,
+
+/*
+ * The rasterizer can support some level of Direct3D support in this format
+ * and implies that the driver can create a Context in this mode (for some
+ * render target format). When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE
+ * flag must also be set.
+ */
+ SVGA3DFORMAT_OP_3DACCELERATION = 0x00000800,
+
+/*
+ * This is set for a private format when the driver has put the bpp in
+ * the structure.
+ */
+ SVGA3DFORMAT_OP_PIXELSIZE = 0x00001000,
+
+/*
+ * Indicates that this format can be converted to any RGB format for which
+ * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified
+ */
+ SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000,
+
+/*
+ * Indicates that this format can be used to create offscreen plain surfaces.
+ */
+ SVGA3DFORMAT_OP_OFFSCREENPLAIN = 0x00004000,
+
+/*
+ * Indicated that this format can be read as an SRGB texture (meaning that the
+ * sampler will linearize the looked up data)
+ */
+ SVGA3DFORMAT_OP_SRGBREAD = 0x00008000,
+
+/*
+ * Indicates that this format can be used in the bumpmap instructions
+ */
+ SVGA3DFORMAT_OP_BUMPMAP = 0x00010000,
+
+/*
+ * Indicates that this format can be sampled by the displacement map sampler
+ */
+ SVGA3DFORMAT_OP_DMAP = 0x00020000,
+
+/*
+ * Indicates that this format cannot be used with texture filtering
+ */
+ SVGA3DFORMAT_OP_NOFILTER = 0x00040000,
+
+/*
+ * Indicates that format conversions are supported to this RGB format if
+ * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.
+ */
+ SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB = 0x00080000,
+
+/*
+ * Indicated that this format can be written as an SRGB target (meaning that the
+ * pixel pipe will DE-linearize data on output to format)
+ */
+ SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000,
+
+/*
+ * Indicates that this format cannot be used with alpha blending
+ */
+ SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000,
+
+/*
+ * Indicates that the device can auto-generated sublevels for resources
+ * of this format
+ */
+ SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000,
+
+/*
+ * Indicates that this format can be used by vertex texture sampler
+ */
+ SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000,
+
+/*
+ * Indicates that this format supports neither texture coordinate wrap
+ * modes, nor mipmapping
+ */
+ SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP = 0x01000000
+} SVGA3dFormatOp;
+
+/*
+ * This structure is a conversion of SVGA3DFORMAT_OP_*.
+ * Entries must be located at the same position.
+ */
+typedef union {
+ uint32 value;
+ struct {
+ uint32 texture : 1;
+ uint32 volumeTexture : 1;
+ uint32 cubeTexture : 1;
+ uint32 offscreenRenderTarget : 1;
+ uint32 sameFormatRenderTarget : 1;
+ uint32 unknown1 : 1;
+ uint32 zStencil : 1;
+ uint32 zStencilArbitraryDepth : 1;
+ uint32 sameFormatUpToAlpha : 1;
+ uint32 unknown2 : 1;
+ uint32 displayMode : 1;
+ uint32 acceleration3d : 1;
+ uint32 pixelSize : 1;
+ uint32 convertToARGB : 1;
+ uint32 offscreenPlain : 1;
+ uint32 sRGBRead : 1;
+ uint32 bumpMap : 1;
+ uint32 dmap : 1;
+ uint32 noFilter : 1;
+ uint32 memberOfGroupARGB : 1;
+ uint32 sRGBWrite : 1;
+ uint32 noAlphaBlend : 1;
+ uint32 autoGenMipMap : 1;
+ uint32 vertexTexture : 1;
+ uint32 noTexCoordWrapNorMip : 1;
+ };
+} SVGA3dSurfaceFormatCaps;
+
+/*
+ * SVGA_3D_CMD_SETRENDERSTATE Types. All value types
+ * must fit in a uint32.
+ */
+
+typedef enum {
+ SVGA3D_RS_INVALID = 0,
+ SVGA3D_RS_ZENABLE = 1, /* SVGA3dBool */
+ SVGA3D_RS_ZWRITEENABLE = 2, /* SVGA3dBool */
+ SVGA3D_RS_ALPHATESTENABLE = 3, /* SVGA3dBool */
+ SVGA3D_RS_DITHERENABLE = 4, /* SVGA3dBool */
+ SVGA3D_RS_BLENDENABLE = 5, /* SVGA3dBool */
+ SVGA3D_RS_FOGENABLE = 6, /* SVGA3dBool */
+ SVGA3D_RS_SPECULARENABLE = 7, /* SVGA3dBool */
+ SVGA3D_RS_STENCILENABLE = 8, /* SVGA3dBool */
+ SVGA3D_RS_LIGHTINGENABLE = 9, /* SVGA3dBool */
+ SVGA3D_RS_NORMALIZENORMALS = 10, /* SVGA3dBool */
+ SVGA3D_RS_POINTSPRITEENABLE = 11, /* SVGA3dBool */
+ SVGA3D_RS_POINTSCALEENABLE = 12, /* SVGA3dBool */
+ SVGA3D_RS_STENCILREF = 13, /* uint32 */
+ SVGA3D_RS_STENCILMASK = 14, /* uint32 */
+ SVGA3D_RS_STENCILWRITEMASK = 15, /* uint32 */
+ SVGA3D_RS_FOGSTART = 16, /* float */
+ SVGA3D_RS_FOGEND = 17, /* float */
+ SVGA3D_RS_FOGDENSITY = 18, /* float */
+ SVGA3D_RS_POINTSIZE = 19, /* float */
+ SVGA3D_RS_POINTSIZEMIN = 20, /* float */
+ SVGA3D_RS_POINTSIZEMAX = 21, /* float */
+ SVGA3D_RS_POINTSCALE_A = 22, /* float */
+ SVGA3D_RS_POINTSCALE_B = 23, /* float */
+ SVGA3D_RS_POINTSCALE_C = 24, /* float */
+ SVGA3D_RS_FOGCOLOR = 25, /* SVGA3dColor */
+ SVGA3D_RS_AMBIENT = 26, /* SVGA3dColor */
+ SVGA3D_RS_CLIPPLANEENABLE = 27, /* SVGA3dClipPlanes */
+ SVGA3D_RS_FOGMODE = 28, /* SVGA3dFogMode */
+ SVGA3D_RS_FILLMODE = 29, /* SVGA3dFillMode */
+ SVGA3D_RS_SHADEMODE = 30, /* SVGA3dShadeMode */
+ SVGA3D_RS_LINEPATTERN = 31, /* SVGA3dLinePattern */
+ SVGA3D_RS_SRCBLEND = 32, /* SVGA3dBlendOp */
+ SVGA3D_RS_DSTBLEND = 33, /* SVGA3dBlendOp */
+ SVGA3D_RS_BLENDEQUATION = 34, /* SVGA3dBlendEquation */
+ SVGA3D_RS_CULLMODE = 35, /* SVGA3dFace */
+ SVGA3D_RS_ZFUNC = 36, /* SVGA3dCmpFunc */
+ SVGA3D_RS_ALPHAFUNC = 37, /* SVGA3dCmpFunc */
+ SVGA3D_RS_STENCILFUNC = 38, /* SVGA3dCmpFunc */
+ SVGA3D_RS_STENCILFAIL = 39, /* SVGA3dStencilOp */
+ SVGA3D_RS_STENCILZFAIL = 40, /* SVGA3dStencilOp */
+ SVGA3D_RS_STENCILPASS = 41, /* SVGA3dStencilOp */
+ SVGA3D_RS_ALPHAREF = 42, /* float (0.0 .. 1.0) */
+ SVGA3D_RS_FRONTWINDING = 43, /* SVGA3dFrontWinding */
+ SVGA3D_RS_COORDINATETYPE = 44, /* SVGA3dCoordinateType */
+ SVGA3D_RS_ZBIAS = 45, /* float */
+ SVGA3D_RS_RANGEFOGENABLE = 46, /* SVGA3dBool */
+ SVGA3D_RS_COLORWRITEENABLE = 47, /* SVGA3dColorMask */
+ SVGA3D_RS_VERTEXMATERIALENABLE = 48, /* SVGA3dBool */
+ SVGA3D_RS_DIFFUSEMATERIALSOURCE = 49, /* SVGA3dVertexMaterial */
+ SVGA3D_RS_SPECULARMATERIALSOURCE = 50, /* SVGA3dVertexMaterial */
+ SVGA3D_RS_AMBIENTMATERIALSOURCE = 51, /* SVGA3dVertexMaterial */
+ SVGA3D_RS_EMISSIVEMATERIALSOURCE = 52, /* SVGA3dVertexMaterial */
+ SVGA3D_RS_TEXTUREFACTOR = 53, /* SVGA3dColor */
+ SVGA3D_RS_LOCALVIEWER = 54, /* SVGA3dBool */
+ SVGA3D_RS_SCISSORTESTENABLE = 55, /* SVGA3dBool */
+ SVGA3D_RS_BLENDCOLOR = 56, /* SVGA3dColor */
+ SVGA3D_RS_STENCILENABLE2SIDED = 57, /* SVGA3dBool */
+ SVGA3D_RS_CCWSTENCILFUNC = 58, /* SVGA3dCmpFunc */
+ SVGA3D_RS_CCWSTENCILFAIL = 59, /* SVGA3dStencilOp */
+ SVGA3D_RS_CCWSTENCILZFAIL = 60, /* SVGA3dStencilOp */
+ SVGA3D_RS_CCWSTENCILPASS = 61, /* SVGA3dStencilOp */
+ SVGA3D_RS_VERTEXBLEND = 62, /* SVGA3dVertexBlendFlags */
+ SVGA3D_RS_SLOPESCALEDEPTHBIAS = 63, /* float */
+ SVGA3D_RS_DEPTHBIAS = 64, /* float */
+
+
+ /*
+ * Output Gamma Level
+ *
+ * Output gamma effects the gamma curve of colors that are output from the
+ * rendering pipeline. A value of 1.0 specifies a linear color space. If the
+ * value is <= 0.0, gamma correction is ignored and linear color space is
+ * used.
+ */
+
+ SVGA3D_RS_OUTPUTGAMMA = 65, /* float */
+ SVGA3D_RS_ZVISIBLE = 66, /* SVGA3dBool */
+ SVGA3D_RS_LASTPIXEL = 67, /* SVGA3dBool */
+ SVGA3D_RS_CLIPPING = 68, /* SVGA3dBool */
+ SVGA3D_RS_WRAP0 = 69, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP1 = 70, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP2 = 71, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP3 = 72, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP4 = 73, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP5 = 74, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP6 = 75, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP7 = 76, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP8 = 77, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP9 = 78, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP10 = 79, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP11 = 80, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP12 = 81, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP13 = 82, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP14 = 83, /* SVGA3dWrapFlags */
+ SVGA3D_RS_WRAP15 = 84, /* SVGA3dWrapFlags */
+ SVGA3D_RS_MULTISAMPLEANTIALIAS = 85, /* SVGA3dBool */
+ SVGA3D_RS_MULTISAMPLEMASK = 86, /* uint32 */
+ SVGA3D_RS_INDEXEDVERTEXBLENDENABLE = 87, /* SVGA3dBool */
+ SVGA3D_RS_TWEENFACTOR = 88, /* float */
+ SVGA3D_RS_ANTIALIASEDLINEENABLE = 89, /* SVGA3dBool */
+ SVGA3D_RS_COLORWRITEENABLE1 = 90, /* SVGA3dColorMask */
+ SVGA3D_RS_COLORWRITEENABLE2 = 91, /* SVGA3dColorMask */
+ SVGA3D_RS_COLORWRITEENABLE3 = 92, /* SVGA3dColorMask */
+ SVGA3D_RS_SEPARATEALPHABLENDENABLE = 93, /* SVGA3dBool */
+ SVGA3D_RS_SRCBLENDALPHA = 94, /* SVGA3dBlendOp */
+ SVGA3D_RS_DSTBLENDALPHA = 95, /* SVGA3dBlendOp */
+ SVGA3D_RS_BLENDEQUATIONALPHA = 96, /* SVGA3dBlendEquation */
+ SVGA3D_RS_MAX
+} SVGA3dRenderStateName;
+
+typedef enum {
+ SVGA3D_VERTEXMATERIAL_NONE = 0, /* Use the value in the current material */
+ SVGA3D_VERTEXMATERIAL_DIFFUSE = 1, /* Use the value in the diffuse component */
+ SVGA3D_VERTEXMATERIAL_SPECULAR = 2, /* Use the value in the specular component */
+} SVGA3dVertexMaterial;
+
+typedef enum {
+ SVGA3D_FILLMODE_INVALID = 0,
+ SVGA3D_FILLMODE_POINT = 1,
+ SVGA3D_FILLMODE_LINE = 2,
+ SVGA3D_FILLMODE_FILL = 3,
+ SVGA3D_FILLMODE_MAX
+} SVGA3dFillModeType;
+
+
+typedef
+union {
+ struct {
+ uint16 mode; /* SVGA3dFillModeType */
+ uint16 face; /* SVGA3dFace */
+ };
+ uint32 uintValue;
+} SVGA3dFillMode;
+
+typedef enum {
+ SVGA3D_SHADEMODE_INVALID = 0,
+ SVGA3D_SHADEMODE_FLAT = 1,
+ SVGA3D_SHADEMODE_SMOOTH = 2,
+ SVGA3D_SHADEMODE_PHONG = 3, /* Not supported */
+ SVGA3D_SHADEMODE_MAX
+} SVGA3dShadeMode;
+
+typedef
+union {
+ struct {
+ uint16 repeat;
+ uint16 pattern;
+ };
+ uint32 uintValue;
+} SVGA3dLinePattern;
+
+typedef enum {
+ SVGA3D_BLENDOP_INVALID = 0,
+ SVGA3D_BLENDOP_ZERO = 1,
+ SVGA3D_BLENDOP_ONE = 2,
+ SVGA3D_BLENDOP_SRCCOLOR = 3,
+ SVGA3D_BLENDOP_INVSRCCOLOR = 4,
+ SVGA3D_BLENDOP_SRCALPHA = 5,
+ SVGA3D_BLENDOP_INVSRCALPHA = 6,
+ SVGA3D_BLENDOP_DESTALPHA = 7,
+ SVGA3D_BLENDOP_INVDESTALPHA = 8,
+ SVGA3D_BLENDOP_DESTCOLOR = 9,
+ SVGA3D_BLENDOP_INVDESTCOLOR = 10,
+ SVGA3D_BLENDOP_SRCALPHASAT = 11,
+ SVGA3D_BLENDOP_BLENDFACTOR = 12,
+ SVGA3D_BLENDOP_INVBLENDFACTOR = 13,
+ SVGA3D_BLENDOP_MAX
+} SVGA3dBlendOp;
+
+typedef enum {
+ SVGA3D_BLENDEQ_INVALID = 0,
+ SVGA3D_BLENDEQ_ADD = 1,
+ SVGA3D_BLENDEQ_SUBTRACT = 2,
+ SVGA3D_BLENDEQ_REVSUBTRACT = 3,
+ SVGA3D_BLENDEQ_MINIMUM = 4,
+ SVGA3D_BLENDEQ_MAXIMUM = 5,
+ SVGA3D_BLENDEQ_MAX
+} SVGA3dBlendEquation;
+
+typedef enum {
+ SVGA3D_FRONTWINDING_INVALID = 0,
+ SVGA3D_FRONTWINDING_CW = 1,
+ SVGA3D_FRONTWINDING_CCW = 2,
+ SVGA3D_FRONTWINDING_MAX
+} SVGA3dFrontWinding;
+
+typedef enum {
+ SVGA3D_FACE_INVALID = 0,
+ SVGA3D_FACE_NONE = 1,
+ SVGA3D_FACE_FRONT = 2,
+ SVGA3D_FACE_BACK = 3,
+ SVGA3D_FACE_FRONT_BACK = 4,
+ SVGA3D_FACE_MAX
+} SVGA3dFace;
+
+/*
+ * The order and the values should not be changed
+ */
+
+typedef enum {
+ SVGA3D_CMP_INVALID = 0,
+ SVGA3D_CMP_NEVER = 1,
+ SVGA3D_CMP_LESS = 2,
+ SVGA3D_CMP_EQUAL = 3,
+ SVGA3D_CMP_LESSEQUAL = 4,
+ SVGA3D_CMP_GREATER = 5,
+ SVGA3D_CMP_NOTEQUAL = 6,
+ SVGA3D_CMP_GREATEREQUAL = 7,
+ SVGA3D_CMP_ALWAYS = 8,
+ SVGA3D_CMP_MAX
+} SVGA3dCmpFunc;
+
+/*
+ * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows
+ * the fog factor to be specified in the alpha component of the specular
+ * (a.k.a. secondary) vertex color.
+ */
+typedef enum {
+ SVGA3D_FOGFUNC_INVALID = 0,
+ SVGA3D_FOGFUNC_EXP = 1,
+ SVGA3D_FOGFUNC_EXP2 = 2,
+ SVGA3D_FOGFUNC_LINEAR = 3,
+ SVGA3D_FOGFUNC_PER_VERTEX = 4
+} SVGA3dFogFunction;
+
+/*
+ * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex
+ * or per-pixel basis.
+ */
+typedef enum {
+ SVGA3D_FOGTYPE_INVALID = 0,
+ SVGA3D_FOGTYPE_VERTEX = 1,
+ SVGA3D_FOGTYPE_PIXEL = 2,
+ SVGA3D_FOGTYPE_MAX = 3
+} SVGA3dFogType;
+
+/*
+ * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is
+ * computed using the eye Z value of each pixel (or vertex), whereas range-
+ * based fog is computed using the actual distance (range) to the eye.
+ */
+typedef enum {
+ SVGA3D_FOGBASE_INVALID = 0,
+ SVGA3D_FOGBASE_DEPTHBASED = 1,
+ SVGA3D_FOGBASE_RANGEBASED = 2,
+ SVGA3D_FOGBASE_MAX = 3
+} SVGA3dFogBase;
+
+typedef enum {
+ SVGA3D_STENCILOP_INVALID = 0,
+ SVGA3D_STENCILOP_KEEP = 1,
+ SVGA3D_STENCILOP_ZERO = 2,
+ SVGA3D_STENCILOP_REPLACE = 3,
+ SVGA3D_STENCILOP_INCRSAT = 4,
+ SVGA3D_STENCILOP_DECRSAT = 5,
+ SVGA3D_STENCILOP_INVERT = 6,
+ SVGA3D_STENCILOP_INCR = 7,
+ SVGA3D_STENCILOP_DECR = 8,
+ SVGA3D_STENCILOP_MAX
+} SVGA3dStencilOp;
+
+typedef enum {
+ SVGA3D_CLIPPLANE_0 = (1 << 0),
+ SVGA3D_CLIPPLANE_1 = (1 << 1),
+ SVGA3D_CLIPPLANE_2 = (1 << 2),
+ SVGA3D_CLIPPLANE_3 = (1 << 3),
+ SVGA3D_CLIPPLANE_4 = (1 << 4),
+ SVGA3D_CLIPPLANE_5 = (1 << 5),
+} SVGA3dClipPlanes;
+
+typedef enum {
+ SVGA3D_CLEAR_COLOR = 0x1,
+ SVGA3D_CLEAR_DEPTH = 0x2,
+ SVGA3D_CLEAR_STENCIL = 0x4
+} SVGA3dClearFlag;
+
+typedef enum {
+ SVGA3D_RT_DEPTH = 0,
+ SVGA3D_RT_STENCIL = 1,
+ SVGA3D_RT_COLOR0 = 2,
+ SVGA3D_RT_COLOR1 = 3,
+ SVGA3D_RT_COLOR2 = 4,
+ SVGA3D_RT_COLOR3 = 5,
+ SVGA3D_RT_COLOR4 = 6,
+ SVGA3D_RT_COLOR5 = 7,
+ SVGA3D_RT_COLOR6 = 8,
+ SVGA3D_RT_COLOR7 = 9,
+ SVGA3D_RT_MAX,
+ SVGA3D_RT_INVALID = ((uint32)-1),
+} SVGA3dRenderTargetType;
+
+#define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)
+
+typedef
+union {
+ struct {
+ uint32 red : 1;
+ uint32 green : 1;
+ uint32 blue : 1;
+ uint32 alpha : 1;
+ };
+ uint32 uintValue;
+} SVGA3dColorMask;
+
+typedef enum {
+ SVGA3D_VBLEND_DISABLE = 0,
+ SVGA3D_VBLEND_1WEIGHT = 1,
+ SVGA3D_VBLEND_2WEIGHT = 2,
+ SVGA3D_VBLEND_3WEIGHT = 3,
+} SVGA3dVertexBlendFlags;
+
+typedef enum {
+ SVGA3D_WRAPCOORD_0 = 1 << 0,
+ SVGA3D_WRAPCOORD_1 = 1 << 1,
+ SVGA3D_WRAPCOORD_2 = 1 << 2,
+ SVGA3D_WRAPCOORD_3 = 1 << 3,
+ SVGA3D_WRAPCOORD_ALL = 0xF,
+} SVGA3dWrapFlags;
+
+/*
+ * SVGA_3D_CMD_TEXTURESTATE Types. All value types
+ * must fit in a uint32.
+ */
+
+typedef enum {
+ SVGA3D_TS_INVALID = 0,
+ SVGA3D_TS_BIND_TEXTURE = 1, /* SVGA3dSurfaceId */
+ SVGA3D_TS_COLOROP = 2, /* SVGA3dTextureCombiner */
+ SVGA3D_TS_COLORARG1 = 3, /* SVGA3dTextureArgData */
+ SVGA3D_TS_COLORARG2 = 4, /* SVGA3dTextureArgData */
+ SVGA3D_TS_ALPHAOP = 5, /* SVGA3dTextureCombiner */
+ SVGA3D_TS_ALPHAARG1 = 6, /* SVGA3dTextureArgData */
+ SVGA3D_TS_ALPHAARG2 = 7, /* SVGA3dTextureArgData */
+ SVGA3D_TS_ADDRESSU = 8, /* SVGA3dTextureAddress */
+ SVGA3D_TS_ADDRESSV = 9, /* SVGA3dTextureAddress */
+ SVGA3D_TS_MIPFILTER = 10, /* SVGA3dTextureFilter */
+ SVGA3D_TS_MAGFILTER = 11, /* SVGA3dTextureFilter */
+ SVGA3D_TS_MINFILTER = 12, /* SVGA3dTextureFilter */
+ SVGA3D_TS_BORDERCOLOR = 13, /* SVGA3dColor */
+ SVGA3D_TS_TEXCOORDINDEX = 14, /* uint32 */
+ SVGA3D_TS_TEXTURETRANSFORMFLAGS = 15, /* SVGA3dTexTransformFlags */
+ SVGA3D_TS_TEXCOORDGEN = 16, /* SVGA3dTextureCoordGen */
+ SVGA3D_TS_BUMPENVMAT00 = 17, /* float */
+ SVGA3D_TS_BUMPENVMAT01 = 18, /* float */
+ SVGA3D_TS_BUMPENVMAT10 = 19, /* float */
+ SVGA3D_TS_BUMPENVMAT11 = 20, /* float */
+ SVGA3D_TS_TEXTURE_MIPMAP_LEVEL = 21, /* uint32 */
+ SVGA3D_TS_TEXTURE_LOD_BIAS = 22, /* float */
+ SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL = 23, /* uint32 */
+ SVGA3D_TS_ADDRESSW = 24, /* SVGA3dTextureAddress */
+
+
+ /*
+ * Sampler Gamma Level
+ *
+ * Sampler gamma effects the color of samples taken from the sampler. A
+ * value of 1.0 will produce linear samples. If the value is <= 0.0 the
+ * gamma value is ignored and a linear space is used.
+ */
+
+ SVGA3D_TS_GAMMA = 25, /* float */
+ SVGA3D_TS_BUMPENVLSCALE = 26, /* float */
+ SVGA3D_TS_BUMPENVLOFFSET = 27, /* float */
+ SVGA3D_TS_COLORARG0 = 28, /* SVGA3dTextureArgData */
+ SVGA3D_TS_ALPHAARG0 = 29, /* SVGA3dTextureArgData */
+ SVGA3D_TS_MAX
+} SVGA3dTextureStateName;
+
+typedef enum {
+ SVGA3D_TC_INVALID = 0,
+ SVGA3D_TC_DISABLE = 1,
+ SVGA3D_TC_SELECTARG1 = 2,
+ SVGA3D_TC_SELECTARG2 = 3,
+ SVGA3D_TC_MODULATE = 4,
+ SVGA3D_TC_ADD = 5,
+ SVGA3D_TC_ADDSIGNED = 6,
+ SVGA3D_TC_SUBTRACT = 7,
+ SVGA3D_TC_BLENDTEXTUREALPHA = 8,
+ SVGA3D_TC_BLENDDIFFUSEALPHA = 9,
+ SVGA3D_TC_BLENDCURRENTALPHA = 10,
+ SVGA3D_TC_BLENDFACTORALPHA = 11,
+ SVGA3D_TC_MODULATE2X = 12,
+ SVGA3D_TC_MODULATE4X = 13,
+ SVGA3D_TC_DSDT = 14,
+ SVGA3D_TC_DOTPRODUCT3 = 15,
+ SVGA3D_TC_BLENDTEXTUREALPHAPM = 16,
+ SVGA3D_TC_ADDSIGNED2X = 17,
+ SVGA3D_TC_ADDSMOOTH = 18,
+ SVGA3D_TC_PREMODULATE = 19,
+ SVGA3D_TC_MODULATEALPHA_ADDCOLOR = 20,
+ SVGA3D_TC_MODULATECOLOR_ADDALPHA = 21,
+ SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,
+ SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,
+ SVGA3D_TC_BUMPENVMAPLUMINANCE = 24,
+ SVGA3D_TC_MULTIPLYADD = 25,
+ SVGA3D_TC_LERP = 26,
+ SVGA3D_TC_MAX
+} SVGA3dTextureCombiner;
+
+#define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)
+
+typedef enum {
+ SVGA3D_TEX_ADDRESS_INVALID = 0,
+ SVGA3D_TEX_ADDRESS_WRAP = 1,
+ SVGA3D_TEX_ADDRESS_MIRROR = 2,
+ SVGA3D_TEX_ADDRESS_CLAMP = 3,
+ SVGA3D_TEX_ADDRESS_BORDER = 4,
+ SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,
+ SVGA3D_TEX_ADDRESS_EDGE = 6,
+ SVGA3D_TEX_ADDRESS_MAX
+} SVGA3dTextureAddress;
+
+/*
+ * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is
+ * disabled, and the rasterizer should use the magnification filter instead.
+ */
+typedef enum {
+ SVGA3D_TEX_FILTER_NONE = 0,
+ SVGA3D_TEX_FILTER_NEAREST = 1,
+ SVGA3D_TEX_FILTER_LINEAR = 2,
+ SVGA3D_TEX_FILTER_ANISOTROPIC = 3,
+ SVGA3D_TEX_FILTER_FLATCUBIC = 4, // Deprecated, not implemented
+ SVGA3D_TEX_FILTER_GAUSSIANCUBIC = 5, // Deprecated, not implemented
+ SVGA3D_TEX_FILTER_PYRAMIDALQUAD = 6, // Not currently implemented
+ SVGA3D_TEX_FILTER_GAUSSIANQUAD = 7, // Not currently implemented
+ SVGA3D_TEX_FILTER_MAX
+} SVGA3dTextureFilter;
+
+typedef enum {
+ SVGA3D_TEX_TRANSFORM_OFF = 0,
+ SVGA3D_TEX_TRANSFORM_S = (1 << 0),
+ SVGA3D_TEX_TRANSFORM_T = (1 << 1),
+ SVGA3D_TEX_TRANSFORM_R = (1 << 2),
+ SVGA3D_TEX_TRANSFORM_Q = (1 << 3),
+ SVGA3D_TEX_PROJECTED = (1 << 15),
+} SVGA3dTexTransformFlags;
+
+typedef enum {
+ SVGA3D_TEXCOORD_GEN_OFF = 0,
+ SVGA3D_TEXCOORD_GEN_EYE_POSITION = 1,
+ SVGA3D_TEXCOORD_GEN_EYE_NORMAL = 2,
+ SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,
+ SVGA3D_TEXCOORD_GEN_SPHERE = 4,
+ SVGA3D_TEXCOORD_GEN_MAX
+} SVGA3dTextureCoordGen;
+
+/*
+ * Texture argument constants for texture combiner
+ */
+typedef enum {
+ SVGA3D_TA_INVALID = 0,
+ SVGA3D_TA_CONSTANT = 1,
+ SVGA3D_TA_PREVIOUS = 2,
+ SVGA3D_TA_DIFFUSE = 3,
+ SVGA3D_TA_TEXTURE = 4,
+ SVGA3D_TA_SPECULAR = 5,
+ SVGA3D_TA_MAX
+} SVGA3dTextureArgData;
+
+#define SVGA3D_TM_MASK_LEN 4
+
+/* Modifiers for texture argument constants defined above. */
+typedef enum {
+ SVGA3D_TM_NONE = 0,
+ SVGA3D_TM_ALPHA = (1 << SVGA3D_TM_MASK_LEN),
+ SVGA3D_TM_ONE_MINUS = (2 << SVGA3D_TM_MASK_LEN),
+} SVGA3dTextureArgModifier;
+
+#define SVGA3D_INVALID_ID ((uint32)-1)
+#define SVGA3D_MAX_CLIP_PLANES 6
+
+/*
+ * This is the limit to the number of fixed-function texture
+ * transforms and texture coordinates we can support. It does *not*
+ * correspond to the number of texture image units (samplers) we
+ * support!
+ */
+#define SVGA3D_MAX_TEXTURE_COORDS 8
+
+/*
+ * Vertex declarations
+ *
+ * Notes:
+ *
+ * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you
+ * draw with any POSITIONT vertex arrays, the programmable vertex
+ * pipeline will be implicitly disabled. Drawing will take place as if
+ * no vertex shader was bound.
+ */
+
+typedef enum {
+ SVGA3D_DECLUSAGE_POSITION = 0,
+ SVGA3D_DECLUSAGE_BLENDWEIGHT, // 1
+ SVGA3D_DECLUSAGE_BLENDINDICES, // 2
+ SVGA3D_DECLUSAGE_NORMAL, // 3
+ SVGA3D_DECLUSAGE_PSIZE, // 4
+ SVGA3D_DECLUSAGE_TEXCOORD, // 5
+ SVGA3D_DECLUSAGE_TANGENT, // 6
+ SVGA3D_DECLUSAGE_BINORMAL, // 7
+ SVGA3D_DECLUSAGE_TESSFACTOR, // 8
+ SVGA3D_DECLUSAGE_POSITIONT, // 9
+ SVGA3D_DECLUSAGE_COLOR, // 10
+ SVGA3D_DECLUSAGE_FOG, // 11
+ SVGA3D_DECLUSAGE_DEPTH, // 12
+ SVGA3D_DECLUSAGE_SAMPLE, // 13
+ SVGA3D_DECLUSAGE_MAX
+} SVGA3dDeclUsage;
+
+typedef enum {
+ SVGA3D_DECLMETHOD_DEFAULT = 0,
+ SVGA3D_DECLMETHOD_PARTIALU,
+ SVGA3D_DECLMETHOD_PARTIALV,
+ SVGA3D_DECLMETHOD_CROSSUV, // Normal
+ SVGA3D_DECLMETHOD_UV,
+ SVGA3D_DECLMETHOD_LOOKUP, // Lookup a displacement map
+ SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map
+} SVGA3dDeclMethod;
+
+typedef enum {
+ SVGA3D_DECLTYPE_FLOAT1 = 0,
+ SVGA3D_DECLTYPE_FLOAT2 = 1,
+ SVGA3D_DECLTYPE_FLOAT3 = 2,
+ SVGA3D_DECLTYPE_FLOAT4 = 3,
+ SVGA3D_DECLTYPE_D3DCOLOR = 4,
+ SVGA3D_DECLTYPE_UBYTE4 = 5,
+ SVGA3D_DECLTYPE_SHORT2 = 6,
+ SVGA3D_DECLTYPE_SHORT4 = 7,
+ SVGA3D_DECLTYPE_UBYTE4N = 8,
+ SVGA3D_DECLTYPE_SHORT2N = 9,
+ SVGA3D_DECLTYPE_SHORT4N = 10,
+ SVGA3D_DECLTYPE_USHORT2N = 11,
+ SVGA3D_DECLTYPE_USHORT4N = 12,
+ SVGA3D_DECLTYPE_UDEC3 = 13,
+ SVGA3D_DECLTYPE_DEC3N = 14,
+ SVGA3D_DECLTYPE_FLOAT16_2 = 15,
+ SVGA3D_DECLTYPE_FLOAT16_4 = 16,
+ SVGA3D_DECLTYPE_MAX,
+} SVGA3dDeclType;
+
+/*
+ * This structure is used for the divisor for geometry instancing;
+ * it's a direct translation of the Direct3D equivalent.
+ */
+typedef union {
+ struct {
+ /*
+ * For index data, this number represents the number of instances to draw.
+ * For instance data, this number represents the number of
+ * instances/vertex in this stream
+ */
+ uint32 count : 30;
+
+ /*
+ * This is 1 if this is supposed to be the data that is repeated for
+ * every instance.
+ */
+ uint32 indexedData : 1;
+
+ /*
+ * This is 1 if this is supposed to be the per-instance data.
+ */
+ uint32 instanceData : 1;
+ };
+
+ uint32 value;
+} SVGA3dVertexDivisor;
+
+typedef enum {
+ SVGA3D_PRIMITIVE_INVALID = 0,
+ SVGA3D_PRIMITIVE_TRIANGLELIST = 1,
+ SVGA3D_PRIMITIVE_POINTLIST = 2,
+ SVGA3D_PRIMITIVE_LINELIST = 3,
+ SVGA3D_PRIMITIVE_LINESTRIP = 4,
+ SVGA3D_PRIMITIVE_TRIANGLESTRIP = 5,
+ SVGA3D_PRIMITIVE_TRIANGLEFAN = 6,
+ SVGA3D_PRIMITIVE_MAX
+} SVGA3dPrimitiveType;
+
+typedef enum {
+ SVGA3D_COORDINATE_INVALID = 0,
+ SVGA3D_COORDINATE_LEFTHANDED = 1,
+ SVGA3D_COORDINATE_RIGHTHANDED = 2,
+ SVGA3D_COORDINATE_MAX
+} SVGA3dCoordinateType;
+
+typedef enum {
+ SVGA3D_TRANSFORM_INVALID = 0,
+ SVGA3D_TRANSFORM_WORLD = 1,
+ SVGA3D_TRANSFORM_VIEW = 2,
+ SVGA3D_TRANSFORM_PROJECTION = 3,
+ SVGA3D_TRANSFORM_TEXTURE0 = 4,
+ SVGA3D_TRANSFORM_TEXTURE1 = 5,
+ SVGA3D_TRANSFORM_TEXTURE2 = 6,
+ SVGA3D_TRANSFORM_TEXTURE3 = 7,
+ SVGA3D_TRANSFORM_TEXTURE4 = 8,
+ SVGA3D_TRANSFORM_TEXTURE5 = 9,
+ SVGA3D_TRANSFORM_TEXTURE6 = 10,
+ SVGA3D_TRANSFORM_TEXTURE7 = 11,
+ SVGA3D_TRANSFORM_WORLD1 = 12,
+ SVGA3D_TRANSFORM_WORLD2 = 13,
+ SVGA3D_TRANSFORM_WORLD3 = 14,
+ SVGA3D_TRANSFORM_MAX
+} SVGA3dTransformType;
+
+typedef enum {
+ SVGA3D_LIGHTTYPE_INVALID = 0,
+ SVGA3D_LIGHTTYPE_POINT = 1,
+ SVGA3D_LIGHTTYPE_SPOT1 = 2, /* 1-cone, in degrees */
+ SVGA3D_LIGHTTYPE_SPOT2 = 3, /* 2-cone, in radians */
+ SVGA3D_LIGHTTYPE_DIRECTIONAL = 4,
+ SVGA3D_LIGHTTYPE_MAX
+} SVGA3dLightType;
+
+typedef enum {
+ SVGA3D_CUBEFACE_POSX = 0,
+ SVGA3D_CUBEFACE_NEGX = 1,
+ SVGA3D_CUBEFACE_POSY = 2,
+ SVGA3D_CUBEFACE_NEGY = 3,
+ SVGA3D_CUBEFACE_POSZ = 4,
+ SVGA3D_CUBEFACE_NEGZ = 5,
+} SVGA3dCubeFace;
+
+typedef enum {
+ SVGA3D_SHADERTYPE_COMPILED_DX8 = 0,
+ SVGA3D_SHADERTYPE_VS = 1,
+ SVGA3D_SHADERTYPE_PS = 2,
+ SVGA3D_SHADERTYPE_MAX
+} SVGA3dShaderType;
+
+typedef enum {
+ SVGA3D_CONST_TYPE_FLOAT = 0,
+ SVGA3D_CONST_TYPE_INT = 1,
+ SVGA3D_CONST_TYPE_BOOL = 2,
+} SVGA3dShaderConstType;
+
+#define SVGA3D_MAX_SURFACE_FACES 6
+
+typedef enum {
+ SVGA3D_STRETCH_BLT_POINT = 0,
+ SVGA3D_STRETCH_BLT_LINEAR = 1,
+ SVGA3D_STRETCH_BLT_MAX
+} SVGA3dStretchBltMode;
+
+typedef enum {
+ SVGA3D_QUERYTYPE_OCCLUSION = 0,
+ SVGA3D_QUERYTYPE_MAX
+} SVGA3dQueryType;
+
+typedef enum {
+ SVGA3D_QUERYSTATE_PENDING = 0, /* Waiting on the host (set by guest) */
+ SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully (set by host) */
+ SVGA3D_QUERYSTATE_FAILED = 2, /* Completed unsuccessfully (set by host) */
+ SVGA3D_QUERYSTATE_NEW = 3, /* Never submitted (For guest use only) */
+} SVGA3dQueryState;
+
+typedef enum {
+ SVGA3D_WRITE_HOST_VRAM = 1,
+ SVGA3D_READ_HOST_VRAM = 2,
+} SVGA3dTransferType;
+
+/*
+ * The maximum number vertex arrays we're guaranteed to support in
+ * SVGA_3D_CMD_DRAWPRIMITIVES.
+ */
+#define SVGA3D_MAX_VERTEX_ARRAYS 32
+
+/*
+ * Identifiers for commands in the command FIFO.
+ *
+ * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of
+ * the SVGA3D protocol and remain reserved; they should not be used in the
+ * future.
+ *
+ * IDs between 1040 and 1999 (inclusive) are available for use by the
+ * current SVGA3D protocol.
+ *
+ * FIFO clients other than SVGA3D should stay below 1000, or at 2000
+ * and up.
+ */
+
+#define SVGA_3D_CMD_LEGACY_BASE 1000
+#define SVGA_3D_CMD_BASE 1040
+
+#define SVGA_3D_CMD_SURFACE_DEFINE SVGA_3D_CMD_BASE + 0
+#define SVGA_3D_CMD_SURFACE_DESTROY SVGA_3D_CMD_BASE + 1
+#define SVGA_3D_CMD_SURFACE_COPY SVGA_3D_CMD_BASE + 2
+#define SVGA_3D_CMD_SURFACE_STRETCHBLT SVGA_3D_CMD_BASE + 3
+#define SVGA_3D_CMD_SURFACE_DMA SVGA_3D_CMD_BASE + 4
+#define SVGA_3D_CMD_CONTEXT_DEFINE SVGA_3D_CMD_BASE + 5
+#define SVGA_3D_CMD_CONTEXT_DESTROY SVGA_3D_CMD_BASE + 6
+#define SVGA_3D_CMD_SETTRANSFORM SVGA_3D_CMD_BASE + 7
+#define SVGA_3D_CMD_SETZRANGE SVGA_3D_CMD_BASE + 8
+#define SVGA_3D_CMD_SETRENDERSTATE SVGA_3D_CMD_BASE + 9
+#define SVGA_3D_CMD_SETRENDERTARGET SVGA_3D_CMD_BASE + 10
+#define SVGA_3D_CMD_SETTEXTURESTATE SVGA_3D_CMD_BASE + 11
+#define SVGA_3D_CMD_SETMATERIAL SVGA_3D_CMD_BASE + 12
+#define SVGA_3D_CMD_SETLIGHTDATA SVGA_3D_CMD_BASE + 13
+#define SVGA_3D_CMD_SETLIGHTENABLED SVGA_3D_CMD_BASE + 14
+#define SVGA_3D_CMD_SETVIEWPORT SVGA_3D_CMD_BASE + 15
+#define SVGA_3D_CMD_SETCLIPPLANE SVGA_3D_CMD_BASE + 16
+#define SVGA_3D_CMD_CLEAR SVGA_3D_CMD_BASE + 17
+#define SVGA_3D_CMD_PRESENT SVGA_3D_CMD_BASE + 18 // Deprecated
+#define SVGA_3D_CMD_SHADER_DEFINE SVGA_3D_CMD_BASE + 19
+#define SVGA_3D_CMD_SHADER_DESTROY SVGA_3D_CMD_BASE + 20
+#define SVGA_3D_CMD_SET_SHADER SVGA_3D_CMD_BASE + 21
+#define SVGA_3D_CMD_SET_SHADER_CONST SVGA_3D_CMD_BASE + 22
+#define SVGA_3D_CMD_DRAW_PRIMITIVES SVGA_3D_CMD_BASE + 23
+#define SVGA_3D_CMD_SETSCISSORRECT SVGA_3D_CMD_BASE + 24
+#define SVGA_3D_CMD_BEGIN_QUERY SVGA_3D_CMD_BASE + 25
+#define SVGA_3D_CMD_END_QUERY SVGA_3D_CMD_BASE + 26
+#define SVGA_3D_CMD_WAIT_FOR_QUERY SVGA_3D_CMD_BASE + 27
+#define SVGA_3D_CMD_PRESENT_READBACK SVGA_3D_CMD_BASE + 28 // Deprecated
+#define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN SVGA_3D_CMD_BASE + 29
+#define SVGA_3D_CMD_MAX SVGA_3D_CMD_BASE + 30
+
+#define SVGA_3D_CMD_FUTURE_MAX 2000
+
+/*
+ * Common substructures used in multiple FIFO commands:
+ */
+
+typedef struct {
+ union {
+ struct {
+ uint16 function; // SVGA3dFogFunction
+ uint8 type; // SVGA3dFogType
+ uint8 base; // SVGA3dFogBase
+ };
+ uint32 uintValue;
+ };
+} SVGA3dFogMode;
+
+/*
+ * Uniquely identify one image (a 1D/2D/3D array) from a surface. This
+ * is a surface ID as well as face/mipmap indices.
+ */
+
+typedef
+struct SVGA3dSurfaceImageId {
+ uint32 sid;
+ uint32 face;
+ uint32 mipmap;
+} SVGA3dSurfaceImageId;
+
+typedef
+struct SVGA3dGuestImage {
+ SVGAGuestPtr ptr;
+
+ /*
+ * A note on interpretation of pitch: This value of pitch is the
+ * number of bytes between vertically adjacent image
+ * blocks. Normally this is the number of bytes between the first
+ * pixel of two adjacent scanlines. With compressed textures,
+ * however, this may represent the number of bytes between
+ * compression blocks rather than between rows of pixels.
+ *
+ * XXX: Compressed textures currently must be tightly packed in guest memory.
+ *
+ * If the image is 1-dimensional, pitch is ignored.
+ *
+ * If 'pitch' is zero, the SVGA3D device calculates a pitch value
+ * assuming each row of blocks is tightly packed.
+ */
+ uint32 pitch;
+} SVGA3dGuestImage;
+
+
+/*
+ * FIFO command format definitions:
+ */
+
+/*
+ * The data size header following cmdNum for every 3d command
+ */
+typedef
+struct {
+ uint32 id;
+ uint32 size;
+} SVGA3dCmdHeader;
+
+/*
+ * A surface is a hierarchy of host VRAM surfaces: 1D, 2D, or 3D, with
+ * optional mipmaps and cube faces.
+ */
+
+typedef
+struct {
+ uint32 width;
+ uint32 height;
+ uint32 depth;
+} SVGA3dSize;
+
+typedef enum {
+ SVGA3D_SURFACE_CUBEMAP = (1 << 0),
+ SVGA3D_SURFACE_HINT_STATIC = (1 << 1),
+ SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2),
+ SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3),
+ SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4),
+ SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5),
+ SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6),
+ SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7),
+ SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8),
+} SVGA3dSurfaceFlags;
+
+typedef
+struct {
+ uint32 numMipLevels;
+} SVGA3dSurfaceFace;
+
+typedef
+struct {
+ uint32 sid;
+ SVGA3dSurfaceFlags surfaceFlags;
+ SVGA3dSurfaceFormat format;
+ SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
+ /*
+ * Followed by an SVGA3dSize structure for each mip level in each face.
+ *
+ * A note on surface sizes: Sizes are always specified in pixels,
+ * even if the true surface size is not a multiple of the minimum
+ * block size of the surface's format. For example, a 3x3x1 DXT1
+ * compressed texture would actually be stored as a 4x4x1 image in
+ * memory.
+ */
+} SVGA3dCmdDefineSurface; /* SVGA_3D_CMD_SURFACE_DEFINE */
+
+typedef
+struct {
+ uint32 sid;
+} SVGA3dCmdDestroySurface; /* SVGA_3D_CMD_SURFACE_DESTROY */
+
+typedef
+struct {
+ uint32 cid;
+} SVGA3dCmdDefineContext; /* SVGA_3D_CMD_CONTEXT_DEFINE */
+
+typedef
+struct {
+ uint32 cid;
+} SVGA3dCmdDestroyContext; /* SVGA_3D_CMD_CONTEXT_DESTROY */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dClearFlag clearFlag;
+ uint32 color;
+ float depth;
+ uint32 stencil;
+ /* Followed by variable number of SVGA3dRect structures */
+} SVGA3dCmdClear; /* SVGA_3D_CMD_CLEAR */
+
+typedef
+struct SVGA3dCopyRect {
+ uint32 x;
+ uint32 y;
+ uint32 w;
+ uint32 h;
+ uint32 srcx;
+ uint32 srcy;
+} SVGA3dCopyRect;
+
+typedef
+struct SVGA3dCopyBox {
+ uint32 x;
+ uint32 y;
+ uint32 z;
+ uint32 w;
+ uint32 h;
+ uint32 d;
+ uint32 srcx;
+ uint32 srcy;
+ uint32 srcz;
+} SVGA3dCopyBox;
+
+typedef
+struct {
+ uint32 x;
+ uint32 y;
+ uint32 w;
+ uint32 h;
+} SVGA3dRect;
+
+typedef
+struct {
+ uint32 x;
+ uint32 y;
+ uint32 z;
+ uint32 w;
+ uint32 h;
+ uint32 d;
+} SVGA3dBox;
+
+typedef
+struct {
+ uint32 x;
+ uint32 y;
+ uint32 z;
+} SVGA3dPoint;
+
+typedef
+struct {
+ SVGA3dLightType type;
+ SVGA3dBool inWorldSpace;
+ float diffuse[4];
+ float specular[4];
+ float ambient[4];
+ float position[4];
+ float direction[4];
+ float range;
+ float falloff;
+ float attenuation0;
+ float attenuation1;
+ float attenuation2;
+ float theta;
+ float phi;
+} SVGA3dLightData;
+
+typedef
+struct {
+ uint32 sid;
+ /* Followed by variable number of SVGA3dCopyRect structures */
+} SVGA3dCmdPresent; /* SVGA_3D_CMD_PRESENT */
+
+typedef
+struct {
+ SVGA3dRenderStateName state;
+ union {
+ uint32 uintValue;
+ float floatValue;
+ };
+} SVGA3dRenderState;
+
+typedef
+struct {
+ uint32 cid;
+ /* Followed by variable number of SVGA3dRenderState structures */
+} SVGA3dCmdSetRenderState; /* SVGA_3D_CMD_SETRENDERSTATE */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dRenderTargetType type;
+ SVGA3dSurfaceImageId target;
+} SVGA3dCmdSetRenderTarget; /* SVGA_3D_CMD_SETRENDERTARGET */
+
+typedef
+struct {
+ SVGA3dSurfaceImageId src;
+ SVGA3dSurfaceImageId dest;
+ /* Followed by variable number of SVGA3dCopyBox structures */
+} SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */
+
+typedef
+struct {
+ SVGA3dSurfaceImageId src;
+ SVGA3dSurfaceImageId dest;
+ SVGA3dBox boxSrc;
+ SVGA3dBox boxDest;
+ SVGA3dStretchBltMode mode;
+} SVGA3dCmdSurfaceStretchBlt; /* SVGA_3D_CMD_SURFACE_STRETCHBLT */
+
+typedef
+struct {
+ /*
+ * If the discard flag is present in a surface DMA operation, the host may
+ * discard the contents of the current mipmap level and face of the target
+ * surface before applying the surface DMA contents.
+ */
+ uint32 discard : 1;
+
+ /*
+ * If the unsynchronized flag is present, the host may perform this upload
+ * without syncing to pending reads on this surface.
+ */
+ uint32 unsynchronized : 1;
+
+ /*
+ * Guests *MUST* set the reserved bits to 0 before submitting the command
+ * suffix as future flags may occupy these bits.
+ */
+ uint32 reserved : 30;
+} SVGA3dSurfaceDMAFlags;
+
+typedef
+struct {
+ SVGA3dGuestImage guest;
+ SVGA3dSurfaceImageId host;
+ SVGA3dTransferType transfer;
+ /*
+ * Followed by variable number of SVGA3dCopyBox structures. For consistency
+ * in all clipping logic and coordinate translation, we define the
+ * "source" in each copyBox as the guest image and the
+ * "destination" as the host image, regardless of transfer
+ * direction.
+ *
+ * For efficiency, the SVGA3D device is free to copy more data than
+ * specified. For example, it may round copy boxes outwards such
+ * that they lie on particular alignment boundaries.
+ */
+} SVGA3dCmdSurfaceDMA; /* SVGA_3D_CMD_SURFACE_DMA */
+
+/*
+ * SVGA3dCmdSurfaceDMASuffix --
+ *
+ * This is a command suffix that will appear after a SurfaceDMA command in
+ * the FIFO. It contains some extra information that hosts may use to
+ * optimize performance or protect the guest. This suffix exists to preserve
+ * backwards compatibility while also allowing for new functionality to be
+ * implemented.
+ */
+
+typedef
+struct {
+ uint32 suffixSize;
+
+ /*
+ * The maximum offset is used to determine the maximum offset from the
+ * guestPtr base address that will be accessed or written to during this
+ * surfaceDMA. If the suffix is supported, the host will respect this
+ * boundary while performing surface DMAs.
+ *
+ * Defaults to MAX_UINT32
+ */
+ uint32 maximumOffset;
+
+ /*
+ * A set of flags that describes optimizations that the host may perform
+ * while performing this surface DMA operation. The guest should never rely
+ * on behaviour that is different when these flags are set for correctness.
+ *
+ * Defaults to 0
+ */
+ SVGA3dSurfaceDMAFlags flags;
+} SVGA3dCmdSurfaceDMASuffix;
+
+/*
+ * SVGA_3D_CMD_DRAW_PRIMITIVES --
+ *
+ * This command is the SVGA3D device's generic drawing entry point.
+ * It can draw multiple ranges of primitives, optionally using an
+ * index buffer, using an arbitrary collection of vertex buffers.
+ *
+ * Each SVGA3dVertexDecl defines a distinct vertex array to bind
+ * during this draw call. The declarations specify which surface
+ * the vertex data lives in, what that vertex data is used for,
+ * and how to interpret it.
+ *
+ * Each SVGA3dPrimitiveRange defines a collection of primitives
+ * to render using the same vertex arrays. An index buffer is
+ * optional.
+ */
+
+typedef
+struct {
+ /*
+ * A range hint is an optional specification for the range of indices
+ * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed
+ * that the entire array will be used.
+ *
+ * These are only hints. The SVGA3D device may use them for
+ * performance optimization if possible, but it's also allowed to
+ * ignore these values.
+ */
+ uint32 first;
+ uint32 last;
+} SVGA3dArrayRangeHint;
+
+typedef
+struct {
+ /*
+ * Define the origin and shape of a vertex or index array. Both
+ * 'offset' and 'stride' are in bytes. The provided surface will be
+ * reinterpreted as a flat array of bytes in the same format used
+ * by surface DMA operations. To avoid unnecessary conversions, the
+ * surface should be created with the SVGA3D_BUFFER format.
+ *
+ * Index 0 in the array starts 'offset' bytes into the surface.
+ * Index 1 begins at byte 'offset + stride', etc. Array indices may
+ * not be negative.
+ */
+ uint32 surfaceId;
+ uint32 offset;
+ uint32 stride;
+} SVGA3dArray;
+
+typedef
+struct {
+ /*
+ * Describe a vertex array's data type, and define how it is to be
+ * used by the fixed function pipeline or the vertex shader. It
+ * isn't useful to have two VertexDecls with the same
+ * VertexArrayIdentity in one draw call.
+ */
+ SVGA3dDeclType type;
+ SVGA3dDeclMethod method;
+ SVGA3dDeclUsage usage;
+ uint32 usageIndex;
+} SVGA3dVertexArrayIdentity;
+
+typedef
+struct {
+ SVGA3dVertexArrayIdentity identity;
+ SVGA3dArray array;
+ SVGA3dArrayRangeHint rangeHint;
+} SVGA3dVertexDecl;
+
+typedef
+struct {
+ /*
+ * Define a group of primitives to render, from sequential indices.
+ *
+ * The value of 'primitiveType' and 'primitiveCount' imply the
+ * total number of vertices that will be rendered.
+ */
+ SVGA3dPrimitiveType primType;
+ uint32 primitiveCount;
+
+ /*
+ * Optional index buffer. If indexArray.surfaceId is
+ * SVGA3D_INVALID_ID, we render without an index buffer. Rendering
+ * without an index buffer is identical to rendering with an index
+ * buffer containing the sequence [0, 1, 2, 3, ...].
+ *
+ * If an index buffer is in use, indexWidth specifies the width in
+ * bytes of each index value. It must be less than or equal to
+ * indexArray.stride.
+ *
+ * (Currently, the SVGA3D device requires index buffers to be tightly
+ * packed. In other words, indexWidth == indexArray.stride)
+ */
+ SVGA3dArray indexArray;
+ uint32 indexWidth;
+
+ /*
+ * Optional index bias. This number is added to all indices from
+ * indexArray before they are used as vertex array indices. This
+ * can be used in multiple ways:
+ *
+ * - When not using an indexArray, this bias can be used to
+ * specify where in the vertex arrays to begin rendering.
+ *
+ * - A positive number here is equivalent to increasing the
+ * offset in each vertex array.
+ *
+ * - A negative number can be used to render using a small
+ * vertex array and an index buffer that contains large
+ * values. This may be used by some applications that
+ * crop a vertex buffer without modifying their index
+ * buffer.
+ *
+ * Note that rendering with a negative bias value may be slower and
+ * use more memory than rendering with a positive or zero bias.
+ */
+ int32 indexBias;
+} SVGA3dPrimitiveRange;
+
+typedef
+struct {
+ uint32 cid;
+ uint32 numVertexDecls;
+ uint32 numRanges;
+
+ /*
+ * There are two variable size arrays after the
+ * SVGA3dCmdDrawPrimitives structure. In order,
+ * they are:
+ *
+ * 1. SVGA3dVertexDecl, quantity 'numVertexDecls'
+ * 2. SVGA3dPrimitiveRange, quantity 'numRanges'
+ * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains
+ * the frequency divisor for this the corresponding vertex decl)
+ */
+} SVGA3dCmdDrawPrimitives; /* SVGA_3D_CMD_DRAWPRIMITIVES */
+
+typedef
+struct {
+ uint32 stage;
+ SVGA3dTextureStateName name;
+ union {
+ uint32 value;
+ float floatValue;
+ };
+} SVGA3dTextureState;
+
+typedef
+struct {
+ uint32 cid;
+ /* Followed by variable number of SVGA3dTextureState structures */
+} SVGA3dCmdSetTextureState; /* SVGA_3D_CMD_SETTEXTURESTATE */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dTransformType type;
+ float matrix[16];
+} SVGA3dCmdSetTransform; /* SVGA_3D_CMD_SETTRANSFORM */
+
+typedef
+struct {
+ float min;
+ float max;
+} SVGA3dZRange;
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dZRange zRange;
+} SVGA3dCmdSetZRange; /* SVGA_3D_CMD_SETZRANGE */
+
+typedef
+struct {
+ float diffuse[4];
+ float ambient[4];
+ float specular[4];
+ float emissive[4];
+ float shininess;
+} SVGA3dMaterial;
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dFace face;
+ SVGA3dMaterial material;
+} SVGA3dCmdSetMaterial; /* SVGA_3D_CMD_SETMATERIAL */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 index;
+ SVGA3dLightData data;
+} SVGA3dCmdSetLightData; /* SVGA_3D_CMD_SETLIGHTDATA */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 index;
+ uint32 enabled;
+} SVGA3dCmdSetLightEnabled; /* SVGA_3D_CMD_SETLIGHTENABLED */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dRect rect;
+} SVGA3dCmdSetViewport; /* SVGA_3D_CMD_SETVIEWPORT */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dRect rect;
+} SVGA3dCmdSetScissorRect; /* SVGA_3D_CMD_SETSCISSORRECT */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 index;
+ float plane[4];
+} SVGA3dCmdSetClipPlane; /* SVGA_3D_CMD_SETCLIPPLANE */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 shid;
+ SVGA3dShaderType type;
+ /* Followed by variable number of DWORDs for shader bycode */
+} SVGA3dCmdDefineShader; /* SVGA_3D_CMD_SHADER_DEFINE */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 shid;
+ SVGA3dShaderType type;
+} SVGA3dCmdDestroyShader; /* SVGA_3D_CMD_SHADER_DESTROY */
+
+typedef
+struct {
+ uint32 cid;
+ uint32 reg; /* register number */
+ SVGA3dShaderType type;
+ SVGA3dShaderConstType ctype;
+ uint32 values[4];
+} SVGA3dCmdSetShaderConst; /* SVGA_3D_CMD_SET_SHADER_CONST */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dShaderType type;
+ uint32 shid;
+} SVGA3dCmdSetShader; /* SVGA_3D_CMD_SET_SHADER */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dQueryType type;
+} SVGA3dCmdBeginQuery; /* SVGA_3D_CMD_BEGIN_QUERY */
+
+typedef
+struct {
+ uint32 cid;
+ SVGA3dQueryType type;
+ SVGAGuestPtr guestResult; /* Points to an SVGA3dQueryResult structure */
+} SVGA3dCmdEndQuery; /* SVGA_3D_CMD_END_QUERY */
+
+typedef
+struct {
+ uint32 cid; /* Same parameters passed to END_QUERY */
+ SVGA3dQueryType type;
+ SVGAGuestPtr guestResult;
+} SVGA3dCmdWaitForQuery; /* SVGA_3D_CMD_WAIT_FOR_QUERY */
+
+typedef
+struct {
+ uint32 totalSize; /* Set by guest before query is ended. */
+ SVGA3dQueryState state; /* Set by host or guest. See SVGA3dQueryState. */
+ union { /* Set by host on exit from PENDING state */
+ uint32 result32;
+ };
+} SVGA3dQueryResult;
+
+/*
+ * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --
+ *
+ * This is a blit from an SVGA3D surface to a Screen Object. Just
+ * like GMR-to-screen blits, this blit may be directed at a
+ * specific screen or to the virtual coordinate space.
+ *
+ * The blit copies from a rectangular region of an SVGA3D surface
+ * image to a rectangular region of a screen or screens.
+ *
+ * This command takes an optional variable-length list of clipping
+ * rectangles after the body of the command. If no rectangles are
+ * specified, there is no clipping region. The entire destRect is
+ * drawn to. If one or more rectangles are included, they describe
+ * a clipping region. The clip rectangle coordinates are measured
+ * relative to the top-left corner of destRect.
+ *
+ * This clipping region serves multiple purposes:
+ *
+ * - It can be used to perform an irregularly shaped blit more
+ * efficiently than by issuing many separate blit commands.
+ *
+ * - It is equivalent to allowing blits with non-integer
+ * source coordinates. You could blit just one half-pixel
+ * of a source, for example, by specifying a larger
+ * destination rectangle than you need, then removing
+ * part of it using a clip rectangle.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ *
+ * Limitations:
+ *
+ * - Currently, no backend supports blits from a mipmap or face
+ * other than the first one.
+ */
+
+typedef
+struct {
+ SVGA3dSurfaceImageId srcImage;
+ SVGASignedRect srcRect;
+ uint32 destScreenId; /* Screen ID or SVGA_ID_INVALID for virt. coords */
+ SVGASignedRect destRect; /* Supports scaling if src/rest different size */
+ /* Clipping: zero or more SVGASignedRects follow */
+} SVGA3dCmdBlitSurfaceToScreen; /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */
+
+
+/*
+ * Capability query index.
+ *
+ * Notes:
+ *
+ * 1. SVGA3D_DEVCAP_MAX_TEXTURES reflects the maximum number of
+ * fixed-function texture units available. Each of these units
+ * work in both FFP and Shader modes, and they support texture
+ * transforms and texture coordinates. The host may have additional
+ * texture image units that are only usable with shaders.
+ *
+ * 2. The BUFFER_FORMAT capabilities are deprecated, and they always
+ * return TRUE. Even on physical hardware that does not support
+ * these formats natively, the SVGA3D device will provide an emulation
+ * which should be invisible to the guest OS.
+ *
+ * In general, the SVGA3D device should support any operation on
+ * any surface format, it just may perform some of these
+ * operations in software depending on the capabilities of the
+ * available physical hardware.
+ *
+ * XXX: In the future, we will add capabilities that describe in
+ * detail what formats are supported in hardware for what kinds
+ * of operations.
+ */
+
+typedef enum {
+ SVGA3D_DEVCAP_3D = 0,
+ SVGA3D_DEVCAP_MAX_LIGHTS = 1,
+ SVGA3D_DEVCAP_MAX_TEXTURES = 2, /* See note (1) */
+ SVGA3D_DEVCAP_MAX_CLIP_PLANES = 3,
+ SVGA3D_DEVCAP_VERTEX_SHADER_VERSION = 4,
+ SVGA3D_DEVCAP_VERTEX_SHADER = 5,
+ SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION = 6,
+ SVGA3D_DEVCAP_FRAGMENT_SHADER = 7,
+ SVGA3D_DEVCAP_MAX_RENDER_TARGETS = 8,
+ SVGA3D_DEVCAP_S23E8_TEXTURES = 9,
+ SVGA3D_DEVCAP_S10E5_TEXTURES = 10,
+ SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND = 11,
+ SVGA3D_DEVCAP_D16_BUFFER_FORMAT = 12, /* See note (2) */
+ SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT = 13, /* See note (2) */
+ SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT = 14, /* See note (2) */
+ SVGA3D_DEVCAP_QUERY_TYPES = 15,
+ SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING = 16,
+ SVGA3D_DEVCAP_MAX_POINT_SIZE = 17,
+ SVGA3D_DEVCAP_MAX_SHADER_TEXTURES = 18,
+ SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH = 19,
+ SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT = 20,
+ SVGA3D_DEVCAP_MAX_VOLUME_EXTENT = 21,
+ SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT = 22,
+ SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO = 23,
+ SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY = 24,
+ SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT = 25,
+ SVGA3D_DEVCAP_MAX_VERTEX_INDEX = 26,
+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS = 27,
+ SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS = 28,
+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS = 29,
+ SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS = 30,
+ SVGA3D_DEVCAP_TEXTURE_OPS = 31,
+ SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8 = 32,
+ SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8 = 33,
+ SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10 = 34,
+ SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5 = 35,
+ SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5 = 36,
+ SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4 = 37,
+ SVGA3D_DEVCAP_SURFACEFMT_R5G6B5 = 38,
+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16 = 39,
+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8 = 40,
+ SVGA3D_DEVCAP_SURFACEFMT_ALPHA8 = 41,
+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8 = 42,
+ SVGA3D_DEVCAP_SURFACEFMT_Z_D16 = 43,
+ SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8 = 44,
+ SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8 = 45,
+ SVGA3D_DEVCAP_SURFACEFMT_DXT1 = 46,
+ SVGA3D_DEVCAP_SURFACEFMT_DXT2 = 47,
+ SVGA3D_DEVCAP_SURFACEFMT_DXT3 = 48,
+ SVGA3D_DEVCAP_SURFACEFMT_DXT4 = 49,
+ SVGA3D_DEVCAP_SURFACEFMT_DXT5 = 50,
+ SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8 = 51,
+ SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10 = 52,
+ SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8 = 53,
+ SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8 = 54,
+ SVGA3D_DEVCAP_SURFACEFMT_CxV8U8 = 55,
+ SVGA3D_DEVCAP_SURFACEFMT_R_S10E5 = 56,
+ SVGA3D_DEVCAP_SURFACEFMT_R_S23E8 = 57,
+ SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5 = 58,
+ SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8 = 59,
+ SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5 = 60,
+ SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8 = 61,
+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES = 63,
+
+ /*
+ * Note that MAX_SIMULTANEOUS_RENDER_TARGETS is a maximum count of color
+ * render targets. This does no include the depth or stencil targets.
+ */
+ SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS = 64,
+
+ SVGA3D_DEVCAP_SURFACEFMT_V16U16 = 65,
+ SVGA3D_DEVCAP_SURFACEFMT_G16R16 = 66,
+ SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 = 67,
+ SVGA3D_DEVCAP_SURFACEFMT_UYVY = 68,
+ SVGA3D_DEVCAP_SURFACEFMT_YUY2 = 69,
+
+ /*
+ * Don't add new caps into the previous section; the values in this
+ * enumeration must not change. You can put new values right before
+ * SVGA3D_DEVCAP_MAX.
+ */
+ SVGA3D_DEVCAP_MAX /* This must be the last index. */
+} SVGA3dDevCapIndex;
+
+typedef union {
+ Bool b;
+ uint32 u;
+ int32 i;
+ float f;
+} SVGA3dDevCapResult;
+
+#endif /* _SVGA3D_REG_H_ */
diff --git a/src/gallium/drivers/svga/include/svga3d_shaderdefs.h b/src/gallium/drivers/svga/include/svga3d_shaderdefs.h
new file mode 100644
index 0000000000..2078c4a8a4
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga3d_shaderdefs.h
@@ -0,0 +1,519 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga3d_shaderdefs.h --
+ *
+ * SVGA3D byte code format and limit definitions.
+ *
+ * The format of the byte code directly corresponds to that defined
+ * by Microsoft DirectX SDK 9.0c (file d3d9types.h). The format can
+ * also be extended so that different shader formats can be supported
+ * for example GLSL, ARB vp/fp, NV/ATI shader formats, etc.
+ *
+ */
+
+#ifndef __SVGA3D_SHADER_DEFS__
+#define __SVGA3D_SHADER_DEFS__
+
+/* SVGA3D shader hardware limits. */
+
+#define SVGA3D_INPUTREG_MAX 16
+#define SVGA3D_OUTPUTREG_MAX 12
+#define SVGA3D_VERTEX_SAMPLERREG_MAX 4
+#define SVGA3D_PIXEL_SAMPLERREG_MAX 16
+#define SVGA3D_SAMPLERREG_MAX (SVGA3D_PIXEL_SAMPLERREG_MAX+\
+ SVGA3D_VERTEX_SAMPLERREG_MAX)
+#define SVGA3D_TEMPREG_MAX 32
+#define SVGA3D_CONSTREG_MAX 256
+#define SVGA3D_CONSTINTREG_MAX 16
+#define SVGA3D_CONSTBOOLREG_MAX 16
+#define SVGA3D_ADDRREG_MAX 1
+#define SVGA3D_PREDREG_MAX 1
+
+/* SVGA3D byte code specific limits */
+
+#define SVGA3D_MAX_SRC_REGS 4
+#define SVGA3D_MAX_NESTING_LEVEL 32
+
+/* SVGA3D version information. */
+
+#define SVGA3D_VS_TYPE 0xFFFE
+#define SVGA3D_PS_TYPE 0xFFFF
+
+typedef struct {
+ union {
+ struct {
+ uint32 minor : 8;
+ uint32 major : 8;
+ uint32 type : 16;
+ };
+
+ uint32 value;
+ };
+} SVGA3dShaderVersion;
+
+#define SVGA3D_VS_10 ((SVGA3D_VS_TYPE << 16) | 1 << 8)
+#define SVGA3D_VS_11 (SVGA3D_VS_10 | 1)
+#define SVGA3D_VS_20 ((SVGA3D_VS_TYPE << 16) | 2 << 8)
+#define SVGA3D_VS_30 ((SVGA3D_VS_TYPE << 16) | 3 << 8)
+
+#define SVGA3D_PS_10 ((SVGA3D_PS_TYPE << 16) | 1 << 8)
+#define SVGA3D_PS_11 (SVGA3D_PS_10 | 1)
+#define SVGA3D_PS_12 (SVGA3D_PS_10 | 2)
+#define SVGA3D_PS_13 (SVGA3D_PS_10 | 3)
+#define SVGA3D_PS_14 (SVGA3D_PS_10 | 4)
+#define SVGA3D_PS_20 ((SVGA3D_PS_TYPE << 16) | 2 << 8)
+#define SVGA3D_PS_30 ((SVGA3D_PS_TYPE << 16) | 3 << 8)
+
+/* The *_ENABLED are for backwards compatibility with old drivers */
+typedef enum {
+ SVGA3DPSVERSION_NONE = 0,
+ SVGA3DPSVERSION_ENABLED = 1,
+ SVGA3DPSVERSION_11 = 3,
+ SVGA3DPSVERSION_12 = 5,
+ SVGA3DPSVERSION_13 = 7,
+ SVGA3DPSVERSION_14 = 9,
+ SVGA3DPSVERSION_20 = 11,
+ SVGA3DPSVERSION_30 = 13,
+ SVGA3DPSVERSION_40 = 15,
+ SVGA3DPSVERSION_MAX
+} SVGA3dPixelShaderVersion;
+
+typedef enum {
+ SVGA3DVSVERSION_NONE = 0,
+ SVGA3DVSVERSION_ENABLED = 1,
+ SVGA3DVSVERSION_11 = 3,
+ SVGA3DVSVERSION_20 = 5,
+ SVGA3DVSVERSION_30 = 7,
+ SVGA3DVSVERSION_40 = 9,
+ SVGA3DVSVERSION_MAX
+} SVGA3dVertexShaderVersion;
+
+/* SVGA3D instruction op codes. */
+
+typedef enum {
+ SVGA3DOP_NOP = 0,
+ SVGA3DOP_MOV,
+ SVGA3DOP_ADD,
+ SVGA3DOP_SUB,
+ SVGA3DOP_MAD,
+ SVGA3DOP_MUL,
+ SVGA3DOP_RCP,
+ SVGA3DOP_RSQ,
+ SVGA3DOP_DP3,
+ SVGA3DOP_DP4,
+ SVGA3DOP_MIN,
+ SVGA3DOP_MAX,
+ SVGA3DOP_SLT,
+ SVGA3DOP_SGE,
+ SVGA3DOP_EXP,
+ SVGA3DOP_LOG,
+ SVGA3DOP_LIT,
+ SVGA3DOP_DST,
+ SVGA3DOP_LRP,
+ SVGA3DOP_FRC,
+ SVGA3DOP_M4x4,
+ SVGA3DOP_M4x3,
+ SVGA3DOP_M3x4,
+ SVGA3DOP_M3x3,
+ SVGA3DOP_M3x2,
+ SVGA3DOP_CALL,
+ SVGA3DOP_CALLNZ,
+ SVGA3DOP_LOOP,
+ SVGA3DOP_RET,
+ SVGA3DOP_ENDLOOP,
+ SVGA3DOP_LABEL,
+ SVGA3DOP_DCL,
+ SVGA3DOP_POW,
+ SVGA3DOP_CRS,
+ SVGA3DOP_SGN,
+ SVGA3DOP_ABS,
+ SVGA3DOP_NRM,
+ SVGA3DOP_SINCOS,
+ SVGA3DOP_REP,
+ SVGA3DOP_ENDREP,
+ SVGA3DOP_IF,
+ SVGA3DOP_IFC,
+ SVGA3DOP_ELSE,
+ SVGA3DOP_ENDIF,
+ SVGA3DOP_BREAK,
+ SVGA3DOP_BREAKC,
+ SVGA3DOP_MOVA,
+ SVGA3DOP_DEFB,
+ SVGA3DOP_DEFI,
+ SVGA3DOP_TEXCOORD = 64,
+ SVGA3DOP_TEXKILL,
+ SVGA3DOP_TEX,
+ SVGA3DOP_TEXBEM,
+ SVGA3DOP_TEXBEML,
+ SVGA3DOP_TEXREG2AR,
+ SVGA3DOP_TEXREG2GB = 70,
+ SVGA3DOP_TEXM3x2PAD,
+ SVGA3DOP_TEXM3x2TEX,
+ SVGA3DOP_TEXM3x3PAD,
+ SVGA3DOP_TEXM3x3TEX,
+ SVGA3DOP_RESERVED0,
+ SVGA3DOP_TEXM3x3SPEC,
+ SVGA3DOP_TEXM3x3VSPEC,
+ SVGA3DOP_EXPP,
+ SVGA3DOP_LOGP,
+ SVGA3DOP_CND = 80,
+ SVGA3DOP_DEF,
+ SVGA3DOP_TEXREG2RGB,
+ SVGA3DOP_TEXDP3TEX,
+ SVGA3DOP_TEXM3x2DEPTH,
+ SVGA3DOP_TEXDP3,
+ SVGA3DOP_TEXM3x3,
+ SVGA3DOP_TEXDEPTH,
+ SVGA3DOP_CMP,
+ SVGA3DOP_BEM,
+ SVGA3DOP_DP2ADD = 90,
+ SVGA3DOP_DSX,
+ SVGA3DOP_DSY,
+ SVGA3DOP_TEXLDD,
+ SVGA3DOP_SETP,
+ SVGA3DOP_TEXLDL,
+ SVGA3DOP_BREAKP = 96,
+ SVGA3DOP_LAST_INST,
+ SVGA3DOP_PHASE = 0xFFFD,
+ SVGA3DOP_COMMENT = 0xFFFE,
+ SVGA3DOP_END = 0xFFFF,
+} SVGA3dShaderOpCodeType;
+
+/* SVGA3D operation control/comparison function types */
+
+typedef enum {
+ SVGA3DOPCONT_NONE,
+ SVGA3DOPCONT_PROJECT, /* Projective texturing */
+ SVGA3DOPCONT_BIAS, /* Texturing with a LOD bias */
+} SVGA3dShaderOpCodeControlFnType;
+
+typedef enum {
+ SVGA3DOPCOMP_RESERVED0 = 0,
+ SVGA3DOPCOMP_GT,
+ SVGA3DOPCOMP_EQ,
+ SVGA3DOPCOMP_GE,
+ SVGA3DOPCOMP_LT,
+ SVGA3DOPCOMPC_NE,
+ SVGA3DOPCOMP_LE,
+ SVGA3DOPCOMP_RESERVED1
+} SVGA3dShaderOpCodeCompFnType;
+
+/* SVGA3D register types */
+
+typedef enum {
+ SVGA3DREG_TEMP = 0, /* Temporary register file */
+ SVGA3DREG_INPUT, /* Input register file */
+ SVGA3DREG_CONST, /* Constant register file */
+ SVGA3DREG_ADDR, /* Address register for VS */
+ SVGA3DREG_TEXTURE = 3, /* Texture register file for PS */
+ SVGA3DREG_RASTOUT, /* Rasterizer register file */
+ SVGA3DREG_ATTROUT, /* Attribute output register file */
+ SVGA3DREG_TEXCRDOUT, /* Texture coordinate output register file */
+ SVGA3DREG_OUTPUT = 6, /* Output register file for VS 3.0+ */
+ SVGA3DREG_CONSTINT, /* Constant integer vector register file */
+ SVGA3DREG_COLOROUT, /* Color output register file */
+ SVGA3DREG_DEPTHOUT, /* Depth output register file */
+ SVGA3DREG_SAMPLER, /* Sampler state register file */
+ SVGA3DREG_CONST2, /* Constant register file 2048 - 4095 */
+ SVGA3DREG_CONST3, /* Constant register file 4096 - 6143 */
+ SVGA3DREG_CONST4, /* Constant register file 6144 - 8191 */
+ SVGA3DREG_CONSTBOOL, /* Constant boolean register file */
+ SVGA3DREG_LOOP, /* Loop counter register file */
+ SVGA3DREG_TEMPFLOAT16, /* 16-bit float temp register file */
+ SVGA3DREG_MISCTYPE, /* Miscellaneous (single) registers */
+ SVGA3DREG_LABEL, /* Label */
+ SVGA3DREG_PREDICATE, /* Predicate register */
+} SVGA3dShaderRegType;
+
+/* SVGA3D rasterizer output register types */
+
+typedef enum {
+ SVGA3DRASTOUT_POSITION = 0,
+ SVGA3DRASTOUT_FOG,
+ SVGA3DRASTOUT_PSIZE
+} SVGA3dShaderRastOutRegType;
+
+/* SVGA3D miscellaneous register types */
+
+typedef enum {
+ SVGA3DMISCREG_POSITION = 0, /* Input position x,y,z,rhw (PS) */
+ SVGA3DMISCREG_FACE /* Floating point primitive area (PS) */
+} SVGA3DShaderMiscRegType;
+
+/* SVGA3D sampler types */
+
+typedef enum {
+ SVGA3DSAMP_UNKNOWN = 0, /* Uninitialized value */
+ SVGA3DSAMP_2D = 2, /* dcl_2d s# (for declaring a 2-D texture) */
+ SVGA3DSAMP_CUBE, /* dcl_cube s# (for declaring a cube texture) */
+ SVGA3DSAMP_VOLUME, /* dcl_volume s# (for declaring a volume texture) */
+} SVGA3dShaderSamplerType;
+
+/* SVGA3D sampler format classes */
+
+typedef enum {
+ SVGA3DSAMPFORMAT_ARGB, /* ARGB formats */
+ SVGA3DSAMPFORMAT_V8U8, /* Sign and normalize (SNORM) V & U */
+ SVGA3DSAMPFORMAT_Q8W8V8U8, /* SNORM all */
+ SVGA3DSAMPFORMAT_CxV8U8, /* SNORM V & U, C=SQRT(1-U^2-V^2) */
+ SVGA3DSAMPFORMAT_X8L8V8U8, /* SNORM V & U */
+ SVGA3DSAMPFORMAT_A2W10V10U10, /* SNORM W, V & U */
+ SVGA3DSAMPFORMAT_DXT_PMA, /* DXT pre-multiplied alpha */
+ SVGA3DSAMPFORMAT_YUV, /* YUV video format */
+ SVGA3DSAMPFORMAT_UYVY, /* UYVY video format */
+ SVGA3DSAMPFORMAT_Rx, /* R16F/32F */
+ SVGA3DSAMPFORMAT_RxGx, /* R16FG16F, R32FG32F */
+ SVGA3DSAMPFORMAT_V16U16, /* SNORM all */
+} SVGA3DShaderSamplerFormatClass;
+
+/* SVGA3D write mask */
+
+#define SVGA3DWRITEMASK_0 1 /* Component 0 (X;Red) */
+#define SVGA3DWRITEMASK_1 2 /* Component 1 (Y;Green) */
+#define SVGA3DWRITEMASK_2 4 /* Component 2 (Z;Blue) */
+#define SVGA3DWRITEMASK_3 8 /* Component 3 (W;Alpha) */
+#define SVGA3DWRITEMASK_ALL 15 /* All components */
+
+/* SVGA3D destination modifiers */
+
+#define SVGA3DDSTMOD_NONE 0 /* nop */
+#define SVGA3DDSTMOD_SATURATE 1 /* clamp to [0, 1] */
+#define SVGA3DDSTMOD_PARTIALPRECISION 2 /* Partial precision hint */
+
+/*
+ * Relevant to multisampling only:
+ * When the pixel center is not covered, sample
+ * attribute or compute gradients/LOD
+ * using multisample "centroid" location.
+ * "Centroid" is some location within the covered
+ * region of the pixel.
+ */
+
+#define SVGA3DDSTMOD_MSAMPCENTROID 4
+
+/* SVGA3D source swizzle */
+
+#define SVGA3DSWIZZLE_REPLICATEX 0x00
+#define SVGA3DSWIZZLE_REPLICATEY 0x55
+#define SVGA3DSWIZZLE_REPLICATEZ 0xAA
+#define SVGA3DSWIZZLE_REPLICATEW 0xFF
+#define SVGA3DSWIZZLE_NONE 0xE4
+#define SVGA3DSWIZZLE_YZXW 0xC9
+#define SVGA3DSWIZZLE_ZXYW 0xD2
+#define SVGA3DSWIZZLE_WXYZ 0x1B
+
+/* SVGA3D source modifiers */
+
+typedef enum {
+ SVGA3DSRCMOD_NONE = 0, /* nop */
+ SVGA3DSRCMOD_NEG, /* negate */
+ SVGA3DSRCMOD_BIAS, /* bias */
+ SVGA3DSRCMOD_BIASNEG, /* bias and negate */
+ SVGA3DSRCMOD_SIGN, /* sign */
+ SVGA3DSRCMOD_SIGNNEG, /* sign and negate */
+ SVGA3DSRCMOD_COMP, /* complement */
+ SVGA3DSRCMOD_X2, /* x2 */
+ SVGA3DSRCMOD_X2NEG, /* x2 and negate */
+ SVGA3DSRCMOD_DZ, /* divide through by z component */
+ SVGA3DSRCMOD_DW, /* divide through by w component */
+ SVGA3DSRCMOD_ABS, /* abs() */
+ SVGA3DSRCMOD_ABSNEG, /* -abs() */
+ SVGA3DSRCMOD_NOT, /* ! (for predicate register) */
+} SVGA3dShaderSrcModType;
+
+/* SVGA3D instruction token */
+
+typedef struct {
+ union {
+ struct {
+ uint32 comment_op : 16;
+ uint32 comment_size : 16;
+ };
+
+ struct {
+ uint32 op : 16;
+ uint32 control : 3;
+ uint32 reserved2 : 5;
+ uint32 size : 4;
+ uint32 predicated : 1;
+ uint32 reserved1 : 1;
+ uint32 coissue : 1;
+ uint32 reserved0 : 1;
+ };
+
+ uint32 value;
+ };
+} SVGA3dShaderInstToken;
+
+/* SVGA3D destination parameter token */
+
+typedef struct {
+ union {
+ struct {
+ uint32 num : 11;
+ uint32 type_upper : 2;
+ uint32 relAddr : 1;
+ uint32 reserved1 : 2;
+ uint32 mask : 4;
+ uint32 dstMod : 4;
+ uint32 shfScale : 4;
+ uint32 type_lower : 3;
+ uint32 reserved0 : 1;
+ };
+
+ uint32 value;
+ };
+} SVGA3dShaderDestToken;
+
+/* SVGA3D source parameter token */
+
+typedef struct {
+ union {
+ struct {
+ uint32 num : 11;
+ uint32 type_upper : 2;
+ uint32 relAddr : 1;
+ uint32 reserved1 : 2;
+ uint32 swizzle : 8;
+ uint32 srcMod : 4;
+ uint32 type_lower : 3;
+ uint32 reserved0 : 1;
+ };
+
+ uint32 value;
+ };
+} SVGA3dShaderSrcToken;
+
+/* SVGA3DOP_DCL parameter tokens */
+
+typedef struct {
+ union {
+ struct {
+ union {
+ struct {
+ uint32 usage : 5;
+ uint32 reserved1 : 11;
+ uint32 index : 4;
+ uint32 reserved0 : 12;
+ }; /* input / output declaration */
+
+ struct {
+ uint32 reserved3 : 27;
+ uint32 type : 4;
+ uint32 reserved2 : 1;
+ }; /* sampler declaration */
+ };
+
+ SVGA3dShaderDestToken dst;
+ };
+
+ uint32 values[2];
+ };
+} SVGA3DOpDclArgs;
+
+/* SVGA3DOP_DEF parameter tokens */
+
+typedef struct {
+ union {
+ struct {
+ SVGA3dShaderDestToken dst;
+
+ union {
+ float constValues[4];
+ int constIValues[4];
+ Bool constBValue;
+ };
+ };
+
+ uint32 values[5];
+ };
+} SVGA3DOpDefArgs;
+
+/* SVGA3D shader token */
+
+typedef union {
+ uint32 value;
+ SVGA3dShaderInstToken inst;
+ SVGA3dShaderDestToken dest;
+ SVGA3dShaderSrcToken src;
+} SVGA3dShaderToken;
+
+/* SVGA3D shader program */
+
+typedef struct {
+ SVGA3dShaderVersion version;
+ /* SVGA3dShaderToken stream */
+} SVGA3dShaderProgram;
+
+/* SVGA3D version specific register assignments */
+
+static const uint32 SVGA3D_INPUT_REG_POSITION_VS11 = 0;
+static const uint32 SVGA3D_INPUT_REG_PSIZE_VS11 = 1;
+static const uint32 SVGA3D_INPUT_REG_FOG_VS11 = 3;
+static const uint32 SVGA3D_INPUT_REG_FOG_MASK_VS11 = SVGA3DWRITEMASK_3;
+static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_VS11 = 2;
+static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_VS11 = 4;
+
+static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_PS11 = 0;
+static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_PS11 = 2;
+static const uint32 SVGA3D_OUTPUT_REG_DEPTH_PS11 = 0;
+static const uint32 SVGA3D_OUTPUT_REG_COLOR_PS11 = 1;
+
+static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_PS20 = 0;
+static const uint32 SVGA3D_INPUT_REG_COLOR_NUM_PS20 = 2;
+static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_PS20 = 2;
+static const uint32 SVGA3D_INPUT_REG_TEXCOORD_NUM_PS20 = 8;
+static const uint32 SVGA3D_OUTPUT_REG_COLOR_BASE_PS20 = 1;
+static const uint32 SVGA3D_OUTPUT_REG_COLOR_NUM_PS20 = 4;
+static const uint32 SVGA3D_OUTPUT_REG_DEPTH_BASE_PS20 = 0;
+static const uint32 SVGA3D_OUTPUT_REG_DEPTH_NUM_PS20 = 1;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3dShaderGetRegType --
+ *
+ * As the register type is split into two non sequential fields,
+ * this function provides an useful way of accessing the actual
+ * register type without having to manually concatenate the
+ * type_upper and type_lower fields.
+ *
+ * Results:
+ * Returns the register type.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static INLINE SVGA3dShaderRegType
+SVGA3dShaderGetRegType(uint32 token)
+{
+ SVGA3dShaderSrcToken src;
+ src.value = token;
+ return (SVGA3dShaderRegType)(src.type_upper << 3 | src.type_lower);
+}
+
+#endif /* __SVGA3D_SHADER_DEFS__ */
diff --git a/src/gallium/drivers/svga/include/svga_reg.h b/src/gallium/drivers/svga/include/svga_reg.h
new file mode 100644
index 0000000000..1b96c2ec07
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga_reg.h
@@ -0,0 +1,1346 @@
+/**********************************************************
+ * Copyright 1998-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga_reg.h --
+ *
+ * Virtual hardware definitions for the VMware SVGA II device.
+ */
+
+#ifndef _SVGA_REG_H_
+#define _SVGA_REG_H_
+
+/*
+ * PCI device IDs.
+ */
+#define PCI_VENDOR_ID_VMWARE 0x15AD
+#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+
+/*
+ * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned
+ * cursor bypass mode. This is still supported, but no new guest
+ * drivers should use it.
+ */
+#define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */
+#define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */
+#define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */
+#define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */
+
+/*
+ * The maximum framebuffer size that can traced for e.g. guests in VESA mode.
+ * The changeMap in the monitor is proportional to this number. Therefore, we'd
+ * like to keep it as small as possible to reduce monitor overhead (using
+ * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area by over
+ * 4k!).
+ *
+ * NB: For compatibility reasons, this value must be greater than 0xff0000.
+ * See bug 335072.
+ */
+#define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
+
+#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
+#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
+#define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
+
+#define SVGA_MAGIC 0x900000UL
+#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
+
+/* Version 2 let the address of the frame buffer be unsigned on Win32 */
+#define SVGA_VERSION_2 2
+#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
+
+/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
+ PALETTE_BASE has moved */
+#define SVGA_VERSION_1 1
+#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
+
+/* Version 0 is the initial version */
+#define SVGA_VERSION_0 0
+#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
+
+/* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */
+#define SVGA_ID_INVALID 0xFFFFFFFF
+
+/* Port offsets, relative to BAR0 */
+#define SVGA_INDEX_PORT 0x0
+#define SVGA_VALUE_PORT 0x1
+#define SVGA_BIOS_PORT 0x2
+#define SVGA_IRQSTATUS_PORT 0x8
+
+/*
+ * Interrupt source flags for IRQSTATUS_PORT and IRQMASK.
+ *
+ * Interrupts are only supported when the
+ * SVGA_CAP_IRQMASK capability is present.
+ */
+#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */
+#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */
+#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */
+
+/*
+ * Registers
+ */
+
+enum {
+ SVGA_REG_ID = 0,
+ SVGA_REG_ENABLE = 1,
+ SVGA_REG_WIDTH = 2,
+ SVGA_REG_HEIGHT = 3,
+ SVGA_REG_MAX_WIDTH = 4,
+ SVGA_REG_MAX_HEIGHT = 5,
+ SVGA_REG_DEPTH = 6,
+ SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */
+ SVGA_REG_PSEUDOCOLOR = 8,
+ SVGA_REG_RED_MASK = 9,
+ SVGA_REG_GREEN_MASK = 10,
+ SVGA_REG_BLUE_MASK = 11,
+ SVGA_REG_BYTES_PER_LINE = 12,
+ SVGA_REG_FB_START = 13, /* (Deprecated) */
+ SVGA_REG_FB_OFFSET = 14,
+ SVGA_REG_VRAM_SIZE = 15,
+ SVGA_REG_FB_SIZE = 16,
+
+ /* ID 0 implementation only had the above registers, then the palette */
+
+ SVGA_REG_CAPABILITIES = 17,
+ SVGA_REG_MEM_START = 18, /* (Deprecated) */
+ SVGA_REG_MEM_SIZE = 19,
+ SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */
+ SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */
+ SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */
+ SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */
+ SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */
+ SVGA_REG_CURSOR_X = 25, /* (Deprecated) */
+ SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */
+ SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */
+ SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */
+ SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */
+ SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */
+ SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */
+ SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */
+ SVGA_REG_IRQMASK = 33, /* Interrupt mask */
+
+ /* Legacy multi-monitor support */
+ SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */
+ SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */
+ SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */
+ SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */
+ SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */
+ SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */
+ SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */
+
+ /* See "Guest memory regions" below. */
+ SVGA_REG_GMR_ID = 41,
+ SVGA_REG_GMR_DESCRIPTOR = 42,
+ SVGA_REG_GMR_MAX_IDS = 43,
+ SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
+
+ SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */
+ SVGA_REG_TOP = 46, /* Must be 1 more than the last register */
+
+ SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
+ /* Next 768 (== 256*3) registers exist for colormap */
+
+ SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
+ /* Base of scratch registers */
+ /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage:
+ First 4 are reserved for VESA BIOS Extension; any remaining are for
+ the use of the current SVGA driver. */
+};
+
+
+/*
+ * Guest memory regions (GMRs):
+ *
+ * This is a new memory mapping feature available in SVGA devices
+ * which have the SVGA_CAP_GMR bit set. Previously, there were two
+ * fixed memory regions available with which to share data between the
+ * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs
+ * are our name for an extensible way of providing arbitrary DMA
+ * buffers for use between the driver and the SVGA device. They are a
+ * new alternative to framebuffer memory, usable for both 2D and 3D
+ * graphics operations.
+ *
+ * Since GMR mapping must be done synchronously with guest CPU
+ * execution, we use a new pair of SVGA registers:
+ *
+ * SVGA_REG_GMR_ID --
+ *
+ * Read/write.
+ * This register holds the 32-bit ID (a small positive integer)
+ * of a GMR to create, delete, or redefine. Writing this register
+ * has no side-effects.
+ *
+ * SVGA_REG_GMR_DESCRIPTOR --
+ *
+ * Write-only.
+ * Writing this register will create, delete, or redefine the GMR
+ * specified by the above ID register. If this register is zero,
+ * the GMR is deleted. Any pointers into this GMR (including those
+ * currently being processed by FIFO commands) will be
+ * synchronously invalidated.
+ *
+ * If this register is nonzero, it must be the physical page
+ * number (PPN) of a data structure which describes the physical
+ * layout of the memory region this GMR should describe. The
+ * descriptor structure will be read synchronously by the SVGA
+ * device when this register is written. The descriptor need not
+ * remain allocated for the lifetime of the GMR.
+ *
+ * The guest driver should write SVGA_REG_GMR_ID first, then
+ * SVGA_REG_GMR_DESCRIPTOR.
+ *
+ * SVGA_REG_GMR_MAX_IDS --
+ *
+ * Read-only.
+ * The SVGA device may choose to support a maximum number of
+ * user-defined GMR IDs. This register holds the number of supported
+ * IDs. (The maximum supported ID plus 1)
+ *
+ * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH --
+ *
+ * Read-only.
+ * The SVGA device may choose to put a limit on the total number
+ * of SVGAGuestMemDescriptor structures it will read when defining
+ * a single GMR.
+ *
+ * The descriptor structure is an array of SVGAGuestMemDescriptor
+ * structures. Each structure may do one of three things:
+ *
+ * - Terminate the GMR descriptor list.
+ * (ppn==0, numPages==0)
+ *
+ * - Add a PPN or range of PPNs to the GMR's virtual address space.
+ * (ppn != 0, numPages != 0)
+ *
+ * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to
+ * support multi-page GMR descriptor tables without forcing the
+ * driver to allocate physically contiguous memory.
+ * (ppn != 0, numPages == 0)
+ *
+ * Note that each physical page of SVGAGuestMemDescriptor structures
+ * can describe at least 2MB of guest memory. If the driver needs to
+ * use more than one page of descriptor structures, it must use one of
+ * its SVGAGuestMemDescriptors to point to an additional page. The
+ * device will never automatically cross a page boundary.
+ *
+ * Once the driver has described a GMR, it is immediately available
+ * for use via any FIFO command that uses an SVGAGuestPtr structure.
+ * These pointers include a GMR identifier plus an offset into that
+ * GMR.
+ *
+ * The driver must check the SVGA_CAP_GMR bit before using the GMR
+ * registers.
+ */
+
+/*
+ * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer
+ * memory as well. In the future, these IDs could even be used to
+ * allow legacy memory regions to be redefined by the guest as GMRs.
+ *
+ * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA
+ * is being phased out. Please try to use user-defined GMRs whenever
+ * possible.
+ */
+#define SVGA_GMR_NULL ((uint32) -1)
+#define SVGA_GMR_FRAMEBUFFER ((uint32) -2) // Guest Framebuffer (GFB)
+
+typedef
+struct SVGAGuestMemDescriptor {
+ uint32 ppn;
+ uint32 numPages;
+} SVGAGuestMemDescriptor;
+
+typedef
+struct SVGAGuestPtr {
+ uint32 gmrId;
+ uint32 offset;
+} SVGAGuestPtr;
+
+
+/*
+ * SVGAGMRImageFormat --
+ *
+ * This is a packed representation of the source 2D image format
+ * for a GMR-to-screen blit. Currently it is defined as an encoding
+ * of the screen's color depth and bits-per-pixel, however, 16 bits
+ * are reserved for future use to identify other encodings (such as
+ * RGBA or higher-precision images).
+ *
+ * Currently supported formats:
+ *
+ * bpp depth Format Name
+ * --- ----- -----------
+ * 32 24 32-bit BGRX
+ * 24 24 24-bit BGR
+ * 16 16 RGB 5-6-5
+ * 16 15 RGB 5-5-5
+ *
+ */
+
+typedef
+struct SVGAGMRImageFormat {
+ union {
+ struct {
+ uint32 bitsPerPixel : 8;
+ uint32 colorDepth : 8;
+ uint32 reserved : 16; // Must be zero
+ };
+
+ uint32 value;
+ };
+} SVGAGMRImageFormat;
+
+/*
+ * SVGAColorBGRX --
+ *
+ * A 24-bit color format (BGRX), which does not depend on the
+ * format of the legacy guest framebuffer (GFB) or the current
+ * GMRFB state.
+ */
+
+typedef
+struct SVGAColorBGRX {
+ union {
+ struct {
+ uint32 b : 8;
+ uint32 g : 8;
+ uint32 r : 8;
+ uint32 x : 8; // Unused
+ };
+
+ uint32 value;
+ };
+} SVGAColorBGRX;
+
+
+/*
+ * SVGASignedRect --
+ * SVGASignedPoint --
+ *
+ * Signed rectangle and point primitives. These are used by the new
+ * 2D primitives for drawing to Screen Objects, which can occupy a
+ * signed virtual coordinate space.
+ *
+ * SVGASignedRect specifies a half-open interval: the (left, top)
+ * pixel is part of the rectangle, but the (right, bottom) pixel is
+ * not.
+ */
+
+typedef
+struct SVGASignedRect {
+ int32 left;
+ int32 top;
+ int32 right;
+ int32 bottom;
+} SVGASignedRect;
+
+typedef
+struct SVGASignedPoint {
+ int32 x;
+ int32 y;
+} SVGASignedPoint;
+
+
+/*
+ * Capabilities
+ *
+ * Note the holes in the bitfield. Missing bits have been deprecated,
+ * and must not be reused. Those capabilities will never be reported
+ * by new versions of the SVGA device.
+ */
+
+#define SVGA_CAP_NONE 0x00000000
+#define SVGA_CAP_RECT_COPY 0x00000002
+#define SVGA_CAP_CURSOR 0x00000020
+#define SVGA_CAP_CURSOR_BYPASS 0x00000040 // Legacy (Use Cursor Bypass 3 instead)
+#define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 // Legacy (Use Cursor Bypass 3 instead)
+#define SVGA_CAP_8BIT_EMULATION 0x00000100
+#define SVGA_CAP_ALPHA_CURSOR 0x00000200
+#define SVGA_CAP_3D 0x00004000
+#define SVGA_CAP_EXTENDED_FIFO 0x00008000
+#define SVGA_CAP_MULTIMON 0x00010000 // Legacy multi-monitor support
+#define SVGA_CAP_PITCHLOCK 0x00020000
+#define SVGA_CAP_IRQMASK 0x00040000
+#define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support
+#define SVGA_CAP_GMR 0x00100000
+#define SVGA_CAP_TRACES 0x00200000
+
+
+/*
+ * FIFO register indices.
+ *
+ * The FIFO is a chunk of device memory mapped into guest physmem. It
+ * is always treated as 32-bit words.
+ *
+ * The guest driver gets to decide how to partition it between
+ * - FIFO registers (there are always at least 4, specifying where the
+ * following data area is and how much data it contains; there may be
+ * more registers following these, depending on the FIFO protocol
+ * version in use)
+ * - FIFO data, written by the guest and slurped out by the VMX.
+ * These indices are 32-bit word offsets into the FIFO.
+ */
+
+enum {
+ /*
+ * Block 1 (basic registers): The originally defined FIFO registers.
+ * These exist and are valid for all versions of the FIFO protocol.
+ */
+
+ SVGA_FIFO_MIN = 0,
+ SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */
+ SVGA_FIFO_NEXT_CMD,
+ SVGA_FIFO_STOP,
+
+ /*
+ * Block 2 (extended registers): Mandatory registers for the extended
+ * FIFO. These exist if the SVGA caps register includes
+ * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their
+ * associated capability bit is enabled.
+ *
+ * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied
+ * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE.
+ * This means that the guest has to test individually (in most cases
+ * using FIFO caps) for the presence of registers after this; the VMX
+ * can define "extended FIFO" to mean whatever it wants, and currently
+ * won't enable it unless there's room for that set and much more.
+ */
+
+ SVGA_FIFO_CAPABILITIES = 4,
+ SVGA_FIFO_FLAGS,
+ // Valid with SVGA_FIFO_CAP_FENCE:
+ SVGA_FIFO_FENCE,
+
+ /*
+ * Block 3a (optional extended registers): Additional registers for the
+ * extended FIFO, whose presence isn't actually implied by
+ * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to
+ * leave room for them.
+ *
+ * These in block 3a, the VMX currently considers mandatory for the
+ * extended FIFO.
+ */
+
+ // Valid if exists (i.e. if extended FIFO enabled):
+ SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */
+ // Valid with SVGA_FIFO_CAP_PITCHLOCK:
+ SVGA_FIFO_PITCHLOCK,
+
+ // Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3:
+ SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */
+ SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */
+ SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */
+ SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */
+ SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */
+
+ // Valid with SVGA_FIFO_CAP_RESERVE:
+ SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */
+
+ /*
+ * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT:
+ *
+ * By default this is SVGA_ID_INVALID, to indicate that the cursor
+ * coordinates are specified relative to the virtual root. If this
+ * is set to a specific screen ID, cursor position is reinterpreted
+ * as a signed offset relative to that screen's origin. This is the
+ * only way to place the cursor on a non-rooted screen.
+ */
+ SVGA_FIFO_CURSOR_SCREEN_ID,
+
+ /*
+ * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new
+ * registers, but this must be done carefully and with judicious use of
+ * capability bits, since comparisons based on SVGA_FIFO_MIN aren't
+ * enough to tell you whether the register exists: we've shipped drivers
+ * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of
+ * the earlier ones. The actual order of introduction was:
+ * - PITCHLOCK
+ * - 3D_CAPS
+ * - CURSOR_* (cursor bypass 3)
+ * - RESERVED
+ * So, code that wants to know whether it can use any of the
+ * aforementioned registers, or anything else added after PITCHLOCK and
+ * before 3D_CAPS, needs to reason about something other than
+ * SVGA_FIFO_MIN.
+ */
+
+ /*
+ * 3D caps block space; valid with 3D hardware version >=
+ * SVGA3D_HWVERSION_WS6_B1.
+ */
+ SVGA_FIFO_3D_CAPS = 32,
+ SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
+
+ /*
+ * End of VMX's current definition of "extended-FIFO registers".
+ * Registers before here are always enabled/disabled as a block; either
+ * the extended FIFO is enabled and includes all preceding registers, or
+ * it's disabled entirely.
+ *
+ * Block 3b (truly optional extended registers): Additional registers for
+ * the extended FIFO, which the VMX already knows how to enable and
+ * disable with correct granularity.
+ *
+ * Registers after here exist if and only if the guest SVGA driver
+ * sets SVGA_FIFO_MIN high enough to leave room for them.
+ */
+
+ // Valid if register exists:
+ SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */
+ SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */
+ SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */
+
+ /*
+ * Always keep this last. This defines the maximum number of
+ * registers we know about. At power-on, this value is placed in
+ * the SVGA_REG_MEM_REGS register, and we expect the guest driver
+ * to allocate this much space in FIFO memory for registers.
+ */
+ SVGA_FIFO_NUM_REGS
+};
+
+
+/*
+ * Definition of registers included in extended FIFO support.
+ *
+ * The guest SVGA driver gets to allocate the FIFO between registers
+ * and data. It must always allocate at least 4 registers, but old
+ * drivers stopped there.
+ *
+ * The VMX will enable extended FIFO support if and only if the guest
+ * left enough room for all registers defined as part of the mandatory
+ * set for the extended FIFO.
+ *
+ * Note that the guest drivers typically allocate the FIFO only at
+ * initialization time, not at mode switches, so it's likely that the
+ * number of FIFO registers won't change without a reboot.
+ *
+ * All registers less than this value are guaranteed to be present if
+ * svgaUser->fifo.extended is set. Any later registers must be tested
+ * individually for compatibility at each use (in the VMX).
+ *
+ * This value is used only by the VMX, so it can change without
+ * affecting driver compatibility; keep it that way?
+ */
+#define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
+
+
+/*
+ * FIFO Synchronization Registers
+ *
+ * This explains the relationship between the various FIFO
+ * sync-related registers in IOSpace and in FIFO space.
+ *
+ * SVGA_REG_SYNC --
+ *
+ * The SYNC register can be used in two different ways by the guest:
+ *
+ * 1. If the guest wishes to fully sync (drain) the FIFO,
+ * it will write once to SYNC then poll on the BUSY
+ * register. The FIFO is sync'ed once BUSY is zero.
+ *
+ * 2. If the guest wants to asynchronously wake up the host,
+ * it will write once to SYNC without polling on BUSY.
+ * Ideally it will do this after some new commands have
+ * been placed in the FIFO, and after reading a zero
+ * from SVGA_FIFO_BUSY.
+ *
+ * (1) is the original behaviour that SYNC was designed to
+ * support. Originally, a write to SYNC would implicitly
+ * trigger a read from BUSY. This causes us to synchronously
+ * process the FIFO.
+ *
+ * This behaviour has since been changed so that writing SYNC
+ * will *not* implicitly cause a read from BUSY. Instead, it
+ * makes a channel call which asynchronously wakes up the MKS
+ * thread.
+ *
+ * New guests can use this new behaviour to implement (2)
+ * efficiently. This lets guests get the host's attention
+ * without waiting for the MKS to poll, which gives us much
+ * better CPU utilization on SMP hosts and on UP hosts while
+ * we're blocked on the host GPU.
+ *
+ * Old guests shouldn't notice the behaviour change. SYNC was
+ * never guaranteed to process the entire FIFO, since it was
+ * bounded to a particular number of CPU cycles. Old guests will
+ * still loop on the BUSY register until the FIFO is empty.
+ *
+ * Writing to SYNC currently has the following side-effects:
+ *
+ * - Sets SVGA_REG_BUSY to TRUE (in the monitor)
+ * - Asynchronously wakes up the MKS thread for FIFO processing
+ * - The value written to SYNC is recorded as a "reason", for
+ * stats purposes.
+ *
+ * If SVGA_FIFO_BUSY is available, drivers are advised to only
+ * write to SYNC if SVGA_FIFO_BUSY is FALSE. Drivers should set
+ * SVGA_FIFO_BUSY to TRUE after writing to SYNC. The MKS will
+ * eventually set SVGA_FIFO_BUSY on its own, but this approach
+ * lets the driver avoid sending multiple asynchronous wakeup
+ * messages to the MKS thread.
+ *
+ * SVGA_REG_BUSY --
+ *
+ * This register is set to TRUE when SVGA_REG_SYNC is written,
+ * and it reads as FALSE when the FIFO has been completely
+ * drained.
+ *
+ * Every read from this register causes us to synchronously
+ * process FIFO commands. There is no guarantee as to how many
+ * commands each read will process.
+ *
+ * CPU time spent processing FIFO commands will be billed to
+ * the guest.
+ *
+ * New drivers should avoid using this register unless they
+ * need to guarantee that the FIFO is completely drained. It
+ * is overkill for performing a sync-to-fence. Older drivers
+ * will use this register for any type of synchronization.
+ *
+ * SVGA_FIFO_BUSY --
+ *
+ * This register is a fast way for the guest driver to check
+ * whether the FIFO is already being processed. It reads and
+ * writes at normal RAM speeds, with no monitor intervention.
+ *
+ * If this register reads as TRUE, the host is guaranteeing that
+ * any new commands written into the FIFO will be noticed before
+ * the MKS goes back to sleep.
+ *
+ * If this register reads as FALSE, no such guarantee can be
+ * made.
+ *
+ * The guest should use this register to quickly determine
+ * whether or not it needs to wake up the host. If the guest
+ * just wrote a command or group of commands that it would like
+ * the host to begin processing, it should:
+ *
+ * 1. Read SVGA_FIFO_BUSY. If it reads as TRUE, no further
+ * action is necessary.
+ *
+ * 2. Write TRUE to SVGA_FIFO_BUSY. This informs future guest
+ * code that we've already sent a SYNC to the host and we
+ * don't need to send a duplicate.
+ *
+ * 3. Write a reason to SVGA_REG_SYNC. This will send an
+ * asynchronous wakeup to the MKS thread.
+ */
+
+
+/*
+ * FIFO Capabilities
+ *
+ * Fence -- Fence register and command are supported
+ * Accel Front -- Front buffer only commands are supported
+ * Pitch Lock -- Pitch lock register is supported
+ * Video -- SVGA Video overlay units are supported
+ * Escape -- Escape command is supported
+ *
+ * XXX: Add longer descriptions for each capability, including a list
+ * of the new features that each capability provides.
+ *
+ * SVGA_FIFO_CAP_SCREEN_OBJECT --
+ *
+ * Provides dynamic multi-screen rendering, for improved Unity and
+ * multi-monitor modes. With Screen Object, the guest can
+ * dynamically create and destroy 'screens', which can represent
+ * Unity windows or virtual monitors. Screen Object also provides
+ * strong guarantees that DMA operations happen only when
+ * guest-initiated. Screen Object deprecates the BAR1 guest
+ * framebuffer (GFB) and all commands that work only with the GFB.
+ *
+ * New registers:
+ * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID
+ *
+ * New 2D commands:
+ * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN,
+ * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY
+ *
+ * New 3D commands:
+ * BLIT_SURFACE_TO_SCREEN
+ *
+ * New guarantees:
+ *
+ * - The host will not read or write guest memory, including the GFB,
+ * except when explicitly initiated by a DMA command.
+ *
+ * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK,
+ * is guaranteed to complete before any subsequent FENCEs.
+ *
+ * - All legacy commands which affect a Screen (UPDATE, PRESENT,
+ * PRESENT_READBACK) as well as new Screen blit commands will
+ * all behave consistently as blits, and memory will be read
+ * or written in FIFO order.
+ *
+ * For example, if you PRESENT from one SVGA3D surface to multiple
+ * places on the screen, the data copied will always be from the
+ * SVGA3D surface at the time the PRESENT was issued in the FIFO.
+ * This was not necessarily true on devices without Screen Object.
+ *
+ * This means that on devices that support Screen Object, the
+ * PRESENT_READBACK command should not be necessary unless you
+ * actually want to read back the results of 3D rendering into
+ * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB
+ * command provides a strict superset of functionality.)
+ *
+ * - When a screen is resized, either using Screen Object commands or
+ * legacy multimon registers, its contents are preserved.
+ */
+
+#define SVGA_FIFO_CAP_NONE 0
+#define SVGA_FIFO_CAP_FENCE (1<<0)
+#define SVGA_FIFO_CAP_ACCELFRONT (1<<1)
+#define SVGA_FIFO_CAP_PITCHLOCK (1<<2)
+#define SVGA_FIFO_CAP_VIDEO (1<<3)
+#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4)
+#define SVGA_FIFO_CAP_ESCAPE (1<<5)
+#define SVGA_FIFO_CAP_RESERVE (1<<6)
+#define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7)
+
+
+/*
+ * FIFO Flags
+ *
+ * Accel Front -- Driver should use front buffer only commands
+ */
+
+#define SVGA_FIFO_FLAG_NONE 0
+#define SVGA_FIFO_FLAG_ACCELFRONT (1<<0)
+#define SVGA_FIFO_FLAG_RESERVED (1<<31) // Internal use only
+
+/*
+ * FIFO reservation sentinel value
+ */
+
+#define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
+
+
+/*
+ * Video overlay support
+ */
+
+#define SVGA_NUM_OVERLAY_UNITS 32
+
+
+/*
+ * Video capabilities that the guest is currently using
+ */
+
+#define SVGA_VIDEO_FLAG_COLORKEY 0x0001
+
+
+/*
+ * Offsets for the video overlay registers
+ */
+
+enum {
+ SVGA_VIDEO_ENABLED = 0,
+ SVGA_VIDEO_FLAGS,
+ SVGA_VIDEO_DATA_OFFSET,
+ SVGA_VIDEO_FORMAT,
+ SVGA_VIDEO_COLORKEY,
+ SVGA_VIDEO_SIZE, // Deprecated
+ SVGA_VIDEO_WIDTH,
+ SVGA_VIDEO_HEIGHT,
+ SVGA_VIDEO_SRC_X,
+ SVGA_VIDEO_SRC_Y,
+ SVGA_VIDEO_SRC_WIDTH,
+ SVGA_VIDEO_SRC_HEIGHT,
+ SVGA_VIDEO_DST_X, // Signed int32
+ SVGA_VIDEO_DST_Y, // Signed int32
+ SVGA_VIDEO_DST_WIDTH,
+ SVGA_VIDEO_DST_HEIGHT,
+ SVGA_VIDEO_PITCH_1,
+ SVGA_VIDEO_PITCH_2,
+ SVGA_VIDEO_PITCH_3,
+ SVGA_VIDEO_DATA_GMRID, // Optional, defaults to SVGA_GMR_FRAMEBUFFER
+ SVGA_VIDEO_DST_SCREEN_ID, // Optional, defaults to virtual coords (SVGA_ID_INVALID)
+ SVGA_VIDEO_NUM_REGS
+};
+
+
+/*
+ * SVGA Overlay Units
+ *
+ * width and height relate to the entire source video frame.
+ * srcX, srcY, srcWidth and srcHeight represent subset of the source
+ * video frame to be displayed.
+ */
+
+typedef struct SVGAOverlayUnit {
+ uint32 enabled;
+ uint32 flags;
+ uint32 dataOffset;
+ uint32 format;
+ uint32 colorKey;
+ uint32 size;
+ uint32 width;
+ uint32 height;
+ uint32 srcX;
+ uint32 srcY;
+ uint32 srcWidth;
+ uint32 srcHeight;
+ int32 dstX;
+ int32 dstY;
+ uint32 dstWidth;
+ uint32 dstHeight;
+ uint32 pitches[3];
+ uint32 dataGMRId;
+ uint32 dstScreenId;
+} SVGAOverlayUnit;
+
+
+/*
+ * SVGAScreenObject --
+ *
+ * This is a new way to represent a guest's multi-monitor screen or
+ * Unity window. Screen objects are only supported if the
+ * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set.
+ *
+ * If Screen Objects are supported, they can be used to fully
+ * replace the functionality provided by the framebuffer registers
+ * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY.
+ *
+ * The screen object is a struct with guaranteed binary
+ * compatibility. New flags can be added, and the struct may grow,
+ * but existing fields must retain their meaning.
+ *
+ */
+
+#define SVGA_SCREEN_HAS_ROOT (1 << 0) // Screen is present in the virtual coord space
+#define SVGA_SCREEN_IS_PRIMARY (1 << 1) // Guest considers this screen to be 'primary'
+#define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) // Guest is running a fullscreen app here
+
+typedef
+struct SVGAScreenObject {
+ uint32 structSize; // sizeof(SVGAScreenObject)
+ uint32 id;
+ uint32 flags;
+ struct {
+ uint32 width;
+ uint32 height;
+ } size;
+ struct {
+ int32 x;
+ int32 y;
+ } root; // Only used if SVGA_SCREEN_HAS_ROOT is set.
+} SVGAScreenObject;
+
+
+/*
+ * Commands in the command FIFO:
+ *
+ * Command IDs defined below are used for the traditional 2D FIFO
+ * communication (not all commands are available for all versions of the
+ * SVGA FIFO protocol).
+ *
+ * Note the holes in the command ID numbers: These commands have been
+ * deprecated, and the old IDs must not be reused.
+ *
+ * Command IDs from 1000 to 1999 are reserved for use by the SVGA3D
+ * protocol.
+ *
+ * Each command's parameters are described by the comments and
+ * structs below.
+ */
+
+typedef enum {
+ SVGA_CMD_INVALID_CMD = 0,
+ SVGA_CMD_UPDATE = 1,
+ SVGA_CMD_RECT_COPY = 3,
+ SVGA_CMD_DEFINE_CURSOR = 19,
+ SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
+ SVGA_CMD_UPDATE_VERBOSE = 25,
+ SVGA_CMD_FRONT_ROP_FILL = 29,
+ SVGA_CMD_FENCE = 30,
+ SVGA_CMD_ESCAPE = 33,
+ SVGA_CMD_DEFINE_SCREEN = 34,
+ SVGA_CMD_DESTROY_SCREEN = 35,
+ SVGA_CMD_DEFINE_GMRFB = 36,
+ SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
+ SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
+ SVGA_CMD_ANNOTATION_FILL = 39,
+ SVGA_CMD_ANNOTATION_COPY = 40,
+ SVGA_CMD_MAX
+} SVGAFifoCmdId;
+
+#define SVGA_CMD_MAX_ARGS 64
+
+
+/*
+ * SVGA_CMD_UPDATE --
+ *
+ * This is a DMA transfer which copies from the Guest Framebuffer
+ * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which
+ * intersect with the provided virtual rectangle.
+ *
+ * This command does not support using arbitrary guest memory as a
+ * data source- it only works with the pre-defined GFB memory.
+ * This command also does not support signed virtual coordinates.
+ * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with
+ * negative root x/y coordinates, the negative portion of those
+ * screens will not be reachable by this command.
+ *
+ * This command is not necessary when using framebuffer
+ * traces. Traces are automatically enabled if the SVGA FIFO is
+ * disabled, and you may explicitly enable/disable traces using
+ * SVGA_REG_TRACES. With traces enabled, any write to the GFB will
+ * automatically act as if a subsequent SVGA_CMD_UPDATE was issued.
+ *
+ * Traces and SVGA_CMD_UPDATE are the only supported ways to render
+ * pseudocolor screen updates. The newer Screen Object commands
+ * only support true color formats.
+ *
+ * Availability:
+ * Always available.
+ */
+
+typedef
+struct {
+ uint32 x;
+ uint32 y;
+ uint32 width;
+ uint32 height;
+} SVGAFifoCmdUpdate;
+
+
+/*
+ * SVGA_CMD_RECT_COPY --
+ *
+ * Perform a rectangular DMA transfer from one area of the GFB to
+ * another, and copy the result to any screens which intersect it.
+ *
+ * Availability:
+ * SVGA_CAP_RECT_COPY
+ */
+
+typedef
+struct {
+ uint32 srcX;
+ uint32 srcY;
+ uint32 destX;
+ uint32 destY;
+ uint32 width;
+ uint32 height;
+} SVGAFifoCmdRectCopy;
+
+
+/*
+ * SVGA_CMD_DEFINE_CURSOR --
+ *
+ * Provide a new cursor image, as an AND/XOR mask.
+ *
+ * The recommended way to position the cursor overlay is by using
+ * the SVGA_FIFO_CURSOR_* registers, supported by the
+ * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
+ *
+ * Availability:
+ * SVGA_CAP_CURSOR
+ */
+
+typedef
+struct {
+ uint32 id; // Reserved, must be zero.
+ uint32 hotspotX;
+ uint32 hotspotY;
+ uint32 width;
+ uint32 height;
+ uint32 andMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL
+ uint32 xorMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL
+ /*
+ * Followed by scanline data for AND mask, then XOR mask.
+ * Each scanline is padded to a 32-bit boundary.
+ */
+} SVGAFifoCmdDefineCursor;
+
+
+/*
+ * SVGA_CMD_DEFINE_ALPHA_CURSOR --
+ *
+ * Provide a new cursor image, in 32-bit BGRA format.
+ *
+ * The recommended way to position the cursor overlay is by using
+ * the SVGA_FIFO_CURSOR_* registers, supported by the
+ * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
+ *
+ * Availability:
+ * SVGA_CAP_ALPHA_CURSOR
+ */
+
+typedef
+struct {
+ uint32 id; // Reserved, must be zero.
+ uint32 hotspotX;
+ uint32 hotspotY;
+ uint32 width;
+ uint32 height;
+ /* Followed by scanline data */
+} SVGAFifoCmdDefineAlphaCursor;
+
+
+/*
+ * SVGA_CMD_UPDATE_VERBOSE --
+ *
+ * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle
+ * 'reason' value, an opaque cookie which is used by internal
+ * debugging tools. Third party drivers should not use this
+ * command.
+ *
+ * Availability:
+ * SVGA_CAP_EXTENDED_FIFO
+ */
+
+typedef
+struct {
+ uint32 x;
+ uint32 y;
+ uint32 width;
+ uint32 height;
+ uint32 reason;
+} SVGAFifoCmdUpdateVerbose;
+
+
+/*
+ * SVGA_CMD_FRONT_ROP_FILL --
+ *
+ * This is a hint which tells the SVGA device that the driver has
+ * just filled a rectangular region of the GFB with a solid
+ * color. Instead of reading these pixels from the GFB, the device
+ * can assume that they all equal 'color'. This is primarily used
+ * for remote desktop protocols.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_ACCELFRONT
+ */
+
+#define SVGA_ROP_COPY 0x03
+
+typedef
+struct {
+ uint32 color; // In the same format as the GFB
+ uint32 x;
+ uint32 y;
+ uint32 width;
+ uint32 height;
+ uint32 rop; // Must be SVGA_ROP_COPY
+} SVGAFifoCmdFrontRopFill;
+
+
+/*
+ * SVGA_CMD_FENCE --
+ *
+ * Insert a synchronization fence. When the SVGA device reaches
+ * this command, it will copy the 'fence' value into the
+ * SVGA_FIFO_FENCE register. It will also compare the fence against
+ * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the
+ * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will
+ * raise this interrupt.
+ *
+ * Availability:
+ * SVGA_FIFO_FENCE for this command,
+ * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL.
+ */
+
+typedef
+struct {
+ uint32 fence;
+} SVGAFifoCmdFence;
+
+
+/*
+ * SVGA_CMD_ESCAPE --
+ *
+ * Send an extended or vendor-specific variable length command.
+ * This is used for video overlay, third party plugins, and
+ * internal debugging tools. See svga_escape.h
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_ESCAPE
+ */
+
+typedef
+struct {
+ uint32 nsid;
+ uint32 size;
+ /* followed by 'size' bytes of data */
+} SVGAFifoCmdEscape;
+
+
+/*
+ * SVGA_CMD_DEFINE_SCREEN --
+ *
+ * Define or redefine an SVGAScreenObject. See the description of
+ * SVGAScreenObject above. The video driver is responsible for
+ * generating new screen IDs. They should be small positive
+ * integers. The virtual device will have an implementation
+ * specific upper limit on the number of screen IDs
+ * supported. Drivers are responsible for recycling IDs. The first
+ * valid ID is zero.
+ *
+ * - Interaction with other registers:
+ *
+ * For backwards compatibility, when the GFB mode registers (WIDTH,
+ * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
+ * deletes all screens other than screen #0, and redefines screen
+ * #0 according to the specified mode. Drivers that use
+ * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0.
+ *
+ * If you use screen objects, do not use the legacy multi-mon
+ * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*).
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGAScreenObject screen; // Variable-length according to version
+} SVGAFifoCmdDefineScreen;
+
+
+/*
+ * SVGA_CMD_DESTROY_SCREEN --
+ *
+ * Destroy an SVGAScreenObject. Its ID is immediately available for
+ * re-use.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ uint32 screenId;
+} SVGAFifoCmdDestroyScreen;
+
+
+/*
+ * SVGA_CMD_DEFINE_GMRFB --
+ *
+ * This command sets a piece of SVGA device state called the
+ * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a
+ * piece of light-weight state which identifies the location and
+ * format of an image in guest memory or in BAR1. The GMRFB has
+ * an arbitrary size, and it doesn't need to match the geometry
+ * of the GFB or any screen object.
+ *
+ * The GMRFB can be redefined as often as you like. You could
+ * always use the same GMRFB, you could redefine it before
+ * rendering from a different guest screen, or you could even
+ * redefine it before every blit.
+ *
+ * There are multiple ways to use this command. The simplest way is
+ * to use it to move the framebuffer either to elsewhere in the GFB
+ * (BAR1) memory region, or to a user-defined GMR. This lets a
+ * driver use a framebuffer allocated entirely out of normal system
+ * memory, which we encourage.
+ *
+ * Another way to use this command is to set up a ring buffer of
+ * updates in GFB memory. If a driver wants to ensure that no
+ * frames are skipped by the SVGA device, it is important that the
+ * driver not modify the source data for a blit until the device is
+ * done processing the command. One efficient way to accomplish
+ * this is to use a ring of small DMA buffers. Each buffer is used
+ * for one blit, then we move on to the next buffer in the
+ * ring. The FENCE mechanism is used to protect each buffer from
+ * re-use until the device is finished with that buffer's
+ * corresponding blit.
+ *
+ * This command does not affect the meaning of SVGA_CMD_UPDATE.
+ * UPDATEs always occur from the legacy GFB memory area. This
+ * command has no support for pseudocolor GMRFBs. Currently only
+ * true-color 15, 16, and 24-bit depths are supported. Future
+ * devices may expose capabilities for additional framebuffer
+ * formats.
+ *
+ * The default GMRFB value is undefined. Drivers must always send
+ * this command at least once before performing any blit from the
+ * GMRFB.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGAGuestPtr ptr;
+ uint32 bytesPerLine;
+ SVGAGMRImageFormat format;
+} SVGAFifoCmdDefineGMRFB;
+
+
+/*
+ * SVGA_CMD_BLIT_GMRFB_TO_SCREEN --
+ *
+ * This is a guest-to-host blit. It performs a DMA operation to
+ * copy a rectangular region of pixels from the current GMRFB to
+ * one or more Screen Objects.
+ *
+ * The destination coordinate may be specified relative to a
+ * screen's origin (if a screen ID is specified) or relative to the
+ * virtual coordinate system's origin (if the screen ID is
+ * SVGA_ID_INVALID). The actual destination may span zero or more
+ * screens, in the case of a virtual destination rect or a rect
+ * which extends off the edge of the specified screen.
+ *
+ * This command writes to the screen's "base layer": the underlying
+ * framebuffer which exists below any cursor or video overlays. No
+ * action is necessary to explicitly hide or update any overlays
+ * which exist on top of the updated region.
+ *
+ * The SVGA device is guaranteed to finish reading from the GMRFB
+ * by the time any subsequent FENCE commands are reached.
+ *
+ * This command consumes an annotation. See the
+ * SVGA_CMD_ANNOTATION_* commands for details.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGASignedPoint srcOrigin;
+ SVGASignedRect destRect;
+ uint32 destScreenId;
+} SVGAFifoCmdBlitGMRFBToScreen;
+
+
+/*
+ * SVGA_CMD_BLIT_SCREEN_TO_GMRFB --
+ *
+ * This is a host-to-guest blit. It performs a DMA operation to
+ * copy a rectangular region of pixels from a single Screen Object
+ * back to the current GMRFB.
+ *
+ * Usage note: This command should be used rarely. It will
+ * typically be inefficient, but it is necessary for some types of
+ * synchronization between 3D (GPU) and 2D (CPU) rendering into
+ * overlapping areas of a screen.
+ *
+ * The source coordinate is specified relative to a screen's
+ * origin. The provided screen ID must be valid. If any parameters
+ * are invalid, the resulting pixel values are undefined.
+ *
+ * This command reads the screen's "base layer". Overlays like
+ * video and cursor are not included, but any data which was sent
+ * using a blit-to-screen primitive will be available, no matter
+ * whether the data's original source was the GMRFB or the 3D
+ * acceleration hardware.
+ *
+ * Note that our guest-to-host blits and host-to-guest blits aren't
+ * symmetric in their current implementation. While the parameters
+ * are identical, host-to-guest blits are a lot less featureful.
+ * They do not support clipping: If the source parameters don't
+ * fully fit within a screen, the blit fails. They must originate
+ * from exactly one screen. Virtual coordinates are not directly
+ * supported.
+ *
+ * Host-to-guest blits do support the same set of GMRFB formats
+ * offered by guest-to-host blits.
+ *
+ * The SVGA device is guaranteed to finish writing to the GMRFB by
+ * the time any subsequent FENCE commands are reached.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGASignedPoint destOrigin;
+ SVGASignedRect srcRect;
+ uint32 srcScreenId;
+} SVGAFifoCmdBlitScreenToGMRFB;
+
+
+/*
+ * SVGA_CMD_ANNOTATION_FILL --
+ *
+ * This is a blit annotation. This command stores a small piece of
+ * device state which is consumed by the next blit-to-screen
+ * command. The state is only cleared by commands which are
+ * specifically documented as consuming an annotation. Other
+ * commands (such as ESCAPEs for debugging) may intervene between
+ * the annotation and its associated blit.
+ *
+ * This annotation is a promise about the contents of the next
+ * blit: The video driver is guaranteeing that all pixels in that
+ * blit will have the same value, specified here as a color in
+ * SVGAColorBGRX format.
+ *
+ * The SVGA device can still render the blit correctly even if it
+ * ignores this annotation, but the annotation may allow it to
+ * perform the blit more efficiently, for example by ignoring the
+ * source data and performing a fill in hardware.
+ *
+ * This annotation is most important for performance when the
+ * user's display is being remoted over a network connection.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGAColorBGRX color;
+} SVGAFifoCmdAnnotationFill;
+
+
+/*
+ * SVGA_CMD_ANNOTATION_COPY --
+ *
+ * This is a blit annotation. See SVGA_CMD_ANNOTATION_FILL for more
+ * information about annotations.
+ *
+ * This annotation is a promise about the contents of the next
+ * blit: The video driver is guaranteeing that all pixels in that
+ * blit will have the same value as those which already exist at an
+ * identically-sized region on the same or a different screen.
+ *
+ * Note that the source pixels for the COPY in this annotation are
+ * sampled before applying the anqnotation's associated blit. They
+ * are allowed to overlap with the blit's destination pixels.
+ *
+ * The copy source rectangle is specified the same way as the blit
+ * destination: it can be a rectangle which spans zero or more
+ * screens, specified relative to either a screen or to the virtual
+ * coordinate system's origin. If the source rectangle includes
+ * pixels which are not from exactly one screen, the results are
+ * undefined.
+ *
+ * Availability:
+ * SVGA_FIFO_CAP_SCREEN_OBJECT
+ */
+
+typedef
+struct {
+ SVGASignedPoint srcOrigin;
+ uint32 srcScreenId;
+} SVGAFifoCmdAnnotationCopy;
+
+#endif
diff --git a/src/gallium/drivers/svga/include/svga_types.h b/src/gallium/drivers/svga/include/svga_types.h
new file mode 100644
index 0000000000..7fd9bab03a
--- /dev/null
+++ b/src/gallium/drivers/svga/include/svga_types.h
@@ -0,0 +1,46 @@
+/**********************************************************
+ * Copyright 1998-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef _SVGA_TYPES_H_
+#define _SVGA_TYPES_H_
+
+#include "pipe/p_compiler.h"
+
+typedef int64_t int64;
+typedef uint64_t uint64;
+
+typedef int32_t int32;
+typedef uint32_t uint32;
+
+typedef int16_t int16;
+typedef uint16_t uint16;
+
+typedef int8_t int8;
+typedef uint8_t uint8;
+
+typedef uint8_t Bool;
+
+#endif /* _SVGA_TYPES_H_ */
+
diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c
new file mode 100644
index 0000000000..a0da7d7e5d
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_cmd.c
@@ -0,0 +1,1427 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * svga_cmd.c --
+ *
+ * Command construction utility for the SVGA3D protocol used by
+ * the VMware SVGA device, based on the svgautil library.
+ */
+
+#include "svga_winsys.h"
+#include "svga_screen_buffer.h"
+#include "svga_screen_texture.h"
+#include "svga_cmd.h"
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * surface_to_surfaceid --
+ *
+ * Utility function for surface ids.
+ * Can handle null surface. Does a surface_reallocation so you need
+ * to have allocated the fifo space before converting.
+ *
+ * Results:
+ * id is filld out.
+ *
+ * Side effects:
+ * One surface relocation is preformed for texture handle.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static INLINE
+void surface_to_surfaceid(struct svga_winsys_context *swc, // IN
+ struct pipe_surface *surface, // IN
+ SVGA3dSurfaceImageId *id, // OUT
+ unsigned flags) // IN
+{
+ if(surface) {
+ struct svga_surface *s = svga_surface(surface);
+ swc->surface_relocation(swc, &id->sid, s->handle, flags);
+ id->face = s->real_face; /* faces have the same order */
+ id->mipmap = s->real_level;
+ }
+ else {
+ id->sid = SVGA3D_INVALID_ID;
+ id->face = 0;
+ id->mipmap = 0;
+ }
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_FIFOReserve --
+ *
+ * Reserve space for an SVGA3D FIFO command.
+ *
+ * The 2D SVGA commands have been around for a while, so they
+ * have a rather asymmetric structure. The SVGA3D protocol is
+ * more uniform: each command begins with a header containing the
+ * command number and the full size.
+ *
+ * This is a convenience wrapper around SVGA_FIFOReserve. We
+ * reserve space for the whole command, and write the header.
+ *
+ * This function must be paired with SVGA_FIFOCommitAll().
+ *
+ * Results:
+ * Returns a pointer to the space reserved for command-specific
+ * data. It must be 'cmdSize' bytes long.
+ *
+ * Side effects:
+ * Begins a FIFO reservation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void *
+SVGA3D_FIFOReserve(struct svga_winsys_context *swc,
+ uint32 cmd, // IN
+ uint32 cmdSize, // IN
+ uint32 nr_relocs) // IN
+{
+ SVGA3dCmdHeader *header;
+
+ header = swc->reserve(swc, sizeof *header + cmdSize, nr_relocs);
+ if(!header)
+ return NULL;
+
+ header->id = cmd;
+ header->size = cmdSize;
+
+ return &header[1];
+}
+
+
+void
+SVGA_FIFOCommitAll(struct svga_winsys_context *swc)
+{
+ swc->commit(swc);
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DefineContext --
+ *
+ * Create a new context, to be referred to with the provided ID.
+ *
+ * Context objects encapsulate all render state, and shader
+ * objects are per-context.
+ *
+ * Surfaces are not per-context. The same surface can be shared
+ * between multiple contexts, and surface operations can occur
+ * without a context.
+ *
+ * If the provided context ID already existed, it is redefined.
+ *
+ * Context IDs are arbitrary small non-negative integers,
+ * global to the entire SVGA device.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DefineContext(struct svga_winsys_context *swc) // IN
+{
+ SVGA3dCmdDefineContext *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_CONTEXT_DEFINE, sizeof *cmd, 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DestroyContext --
+ *
+ * Delete a context created with SVGA3D_DefineContext.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DestroyContext(struct svga_winsys_context *swc) // IN
+{
+ SVGA3dCmdDestroyContext *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_CONTEXT_DESTROY, sizeof *cmd, 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginDefineSurface --
+ *
+ * Begin a SURFACE_DEFINE command. This reserves space for it in
+ * the FIFO, and returns pointers to the command's faces and
+ * mipsizes arrays.
+ *
+ * This function must be paired with SVGA_FIFOCommitAll().
+ * The faces and mipSizes arrays are initialized to zero.
+ *
+ * This creates a "surface" object in the SVGA3D device,
+ * with the provided surface ID (sid). Surfaces are generic
+ * containers for host VRAM objects like textures, vertex
+ * buffers, and depth/stencil buffers.
+ *
+ * Surfaces are hierarchial:
+ *
+ * - Surface may have multiple faces (for cube maps)
+ *
+ * - Each face has a list of mipmap levels
+ *
+ * - Each mipmap image may have multiple volume
+ * slices, if the image is three dimensional.
+ *
+ * - Each slice is a 2D array of 'blocks'
+ *
+ * - Each block may be one or more pixels.
+ * (Usually 1, more for DXT or YUV formats.)
+ *
+ * Surfaces are generic host VRAM objects. The SVGA3D device
+ * may optimize surfaces according to the format they were
+ * created with, but this format does not limit the ways in
+ * which the surface may be used. For example, a depth surface
+ * can be used as a texture, or a floating point image may
+ * be used as a vertex buffer. Some surface usages may be
+ * lower performance, due to software emulation, but any
+ * usage should work with any surface.
+ *
+ * If 'sid' is already defined, the old surface is deleted
+ * and this new surface replaces it.
+ *
+ * Surface IDs are arbitrary small non-negative integers,
+ * global to the entire SVGA device.
+ *
+ * Results:
+ * Returns pointers to arrays allocated in the FIFO for 'faces'
+ * and 'mipSizes'.
+ *
+ * Side effects:
+ * Begins a FIFO reservation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginDefineSurface(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *sid, // IN
+ SVGA3dSurfaceFlags flags, // IN
+ SVGA3dSurfaceFormat format, // IN
+ SVGA3dSurfaceFace **faces, // OUT
+ SVGA3dSize **mipSizes, // OUT
+ uint32 numMipSizes) // IN
+{
+ SVGA3dCmdDefineSurface *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_DEFINE, sizeof *cmd +
+ sizeof **mipSizes * numMipSizes, 1);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ swc->surface_relocation(swc, &cmd->sid, sid, PIPE_BUFFER_USAGE_GPU_WRITE);
+ cmd->surfaceFlags = flags;
+ cmd->format = format;
+
+ *faces = &cmd->face[0];
+ *mipSizes = (SVGA3dSize*) &cmd[1];
+
+ memset(*faces, 0, sizeof **faces * SVGA3D_MAX_SURFACE_FACES);
+ memset(*mipSizes, 0, sizeof **mipSizes * numMipSizes);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DefineSurface2D --
+ *
+ * This is a simplified version of SVGA3D_BeginDefineSurface(),
+ * which does not support cube maps, mipmaps, or volume textures.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DefineSurface2D(struct svga_winsys_context *swc, // IN
+ struct svga_winsys_surface *sid, // IN
+ uint32 width, // IN
+ uint32 height, // IN
+ SVGA3dSurfaceFormat format) // IN
+{
+ SVGA3dSize *mipSizes;
+ SVGA3dSurfaceFace *faces;
+ enum pipe_error ret;
+
+ ret = SVGA3D_BeginDefineSurface(swc,
+ sid, 0, format, &faces, &mipSizes, 1);
+ if(ret != PIPE_OK)
+ return ret;
+
+ faces[0].numMipLevels = 1;
+
+ mipSizes[0].width = width;
+ mipSizes[0].height = height;
+ mipSizes[0].depth = 1;
+
+ swc->commit(swc);;
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DestroySurface --
+ *
+ * Release the host VRAM encapsulated by a particular surface ID.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DestroySurface(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *sid) // IN
+{
+ SVGA3dCmdDestroySurface *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_DESTROY, sizeof *cmd, 1);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ swc->surface_relocation(swc, &cmd->sid, sid, PIPE_BUFFER_USAGE_GPU_READ);
+ swc->commit(swc);;
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginSurfaceDMA--
+ *
+ * Begin a SURFACE_DMA command. This reserves space for it in
+ * the FIFO, and returns a pointer to the command's box array.
+ * This function must be paired with SVGA_FIFOCommitAll().
+ *
+ * When the SVGA3D device asynchronously processes this FIFO
+ * command, a DMA operation is performed between host VRAM and
+ * a generic SVGAGuestPtr. The guest pointer may refer to guest
+ * VRAM (provided by the SVGA PCI device) or to guest system
+ * memory that has been set up as a Guest Memory Region (GMR)
+ * by the SVGA device.
+ *
+ * The guest's DMA buffer must remain valid (not freed, paged out,
+ * or overwritten) until the host has finished processing this
+ * command. The guest can determine that the host has finished
+ * by using the SVGA device's FIFO Fence mechanism.
+ *
+ * The guest's image buffer can be an arbitrary size and shape.
+ * Guest image data is interpreted according to the SVGA3D surface
+ * format specified when the surface was defined.
+ *
+ * The caller may optionally define the guest image's pitch.
+ * guestImage->pitch can either be zero (assume image is tightly
+ * packed) or it must be the number of bytes between vertically
+ * adjacent image blocks.
+ *
+ * The provided copybox list specifies which regions of the source
+ * image are to be copied, and where they appear on the destination.
+ *
+ * NOTE: srcx/srcy are always on the guest image and x/y are
+ * always on the host image, regardless of the actual transfer
+ * direction!
+ *
+ * For efficiency, the SVGA3D device is free to copy more data
+ * than specified. For example, it may round copy boxes outwards
+ * such that they lie on particular alignment boundaries.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
+ struct svga_transfer *st, // IN
+ SVGA3dTransferType transfer, // IN
+ const SVGA3dCopyBox *boxes, // IN
+ uint32 numBoxes) // IN
+{
+ struct svga_texture *texture = svga_texture(st->base.texture);
+ SVGA3dCmdSurfaceDMA *cmd;
+ SVGA3dCmdSurfaceDMASuffix *pSuffix;
+ uint32 boxesSize = sizeof *boxes * numBoxes;
+ unsigned region_flags;
+ unsigned surface_flags;
+
+ if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ }
+ else if(transfer == SVGA3D_READ_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ }
+ else {
+ assert(0);
+ return PIPE_ERROR_BAD_INPUT;
+ }
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_DMA,
+ sizeof *cmd + boxesSize + sizeof *pSuffix,
+ 2);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ swc->region_relocation(swc, &cmd->guest.ptr, st->hwbuf, 0, region_flags);
+ cmd->guest.pitch = st->base.stride;
+
+ swc->surface_relocation(swc, &cmd->host.sid, texture->handle, surface_flags);
+ cmd->host.face = st->base.face; /* PIPE_TEX_FACE_* and SVGA3D_CUBEFACE_* match */
+ cmd->host.mipmap = st->base.level;
+
+ cmd->transfer = transfer;
+
+ memcpy(&cmd[1], boxes, boxesSize);
+
+ pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + boxesSize);
+ pSuffix->suffixSize = sizeof *pSuffix;
+ pSuffix->maximumOffset = st->hw_nblocksy*st->base.stride;
+ memset(&pSuffix->flags, 0, sizeof pSuffix->flags);
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+enum pipe_error
+SVGA3D_BufferDMA(struct svga_winsys_context *swc,
+ struct svga_winsys_buffer *guest,
+ struct svga_winsys_surface *host,
+ SVGA3dTransferType transfer, // IN
+ uint32 size, // IN
+ uint32 offset, // IN
+ SVGA3dSurfaceDMAFlags flags) // IN
+{
+ SVGA3dCmdSurfaceDMA *cmd;
+ SVGA3dCopyBox *box;
+ SVGA3dCmdSurfaceDMASuffix *pSuffix;
+ unsigned region_flags;
+ unsigned surface_flags;
+
+ if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ }
+ else if(transfer == SVGA3D_READ_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ }
+ else {
+ assert(0);
+ return PIPE_ERROR_BAD_INPUT;
+ }
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_DMA,
+ sizeof *cmd + sizeof *box + sizeof *pSuffix,
+ 2);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ swc->region_relocation(swc, &cmd->guest.ptr, guest, 0, region_flags);
+ cmd->guest.pitch = 0;
+
+ swc->surface_relocation(swc, &cmd->host.sid, host, surface_flags);
+ cmd->host.face = 0;
+ cmd->host.mipmap = 0;
+
+ cmd->transfer = transfer;
+
+ box = (SVGA3dCopyBox *)&cmd[1];
+ box->x = offset;
+ box->y = 0;
+ box->z = 0;
+ box->w = size;
+ box->h = 1;
+ box->d = 1;
+ box->srcx = offset;
+ box->srcy = 0;
+ box->srcz = 0;
+
+ pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + sizeof *box);
+ pSuffix->suffixSize = sizeof *pSuffix;
+ pSuffix->maximumOffset = offset + size;
+ pSuffix->flags = flags;
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetRenderTarget --
+ *
+ * Bind a surface object to a particular render target attachment
+ * point on the current context. Render target attachment points
+ * exist for color buffers, a depth buffer, and a stencil buffer.
+ *
+ * The SVGA3D device is quite lenient about the types of surfaces
+ * that may be used as render targets. The color buffers must
+ * all be the same size, but the depth and stencil buffers do not
+ * have to be the same size as the color buffer. All attachments
+ * are optional.
+ *
+ * Some combinations of render target formats may require software
+ * emulation, depending on the capabilities of the host graphics
+ * API and graphics hardware.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetRenderTarget(struct svga_winsys_context *swc,
+ SVGA3dRenderTargetType type, // IN
+ struct pipe_surface *surface) // IN
+{
+ SVGA3dCmdSetRenderTarget *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETRENDERTARGET, sizeof *cmd, 1);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+
+ cmd->cid = swc->cid;
+
+ cmd->type = type;
+
+ surface_to_surfaceid(swc, surface, &cmd->target, PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DefineShader --
+ *
+ * Upload the bytecode for a new shader. The bytecode is "SVGA3D
+ * format", which is theoretically a binary-compatible superset
+ * of Microsoft's DirectX shader bytecode. In practice, the
+ * SVGA3D bytecode doesn't yet have any extensions to DirectX's
+ * bytecode format.
+ *
+ * The SVGA3D device supports shader models 1.1 through 2.0.
+ *
+ * The caller chooses a shader ID (small positive integer) by
+ * which this shader will be identified in future commands. This
+ * ID is in a namespace which is per-context and per-shader-type.
+ *
+ * 'bytecodeLen' is specified in bytes. It must be a multiple of 4.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DefineShader(struct svga_winsys_context *swc,
+ uint32 shid, // IN
+ SVGA3dShaderType type, // IN
+ const uint32 *bytecode, // IN
+ uint32 bytecodeLen) // IN
+{
+ SVGA3dCmdDefineShader *cmd;
+
+ assert(bytecodeLen % 4 == 0);
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SHADER_DEFINE, sizeof *cmd + bytecodeLen,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->shid = shid;
+ cmd->type = type;
+ memcpy(&cmd[1], bytecode, bytecodeLen);
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_DestroyShader --
+ *
+ * Delete a shader that was created by SVGA3D_DefineShader. If
+ * the shader was the current vertex or pixel shader for its
+ * context, rendering results are undefined until a new shader is
+ * bound.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_DestroyShader(struct svga_winsys_context *swc,
+ uint32 shid, // IN
+ SVGA3dShaderType type) // IN
+{
+ SVGA3dCmdDestroyShader *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SHADER_DESTROY, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->shid = shid;
+ cmd->type = type;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetShaderConst --
+ *
+ * Set the value of a shader constant.
+ *
+ * Shader constants are analogous to uniform variables in GLSL,
+ * except that they belong to the render context rather than to
+ * an individual shader.
+ *
+ * Constants may have one of three types: A 4-vector of floats,
+ * a 4-vector of integers, or a single boolean flag.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetShaderConst(struct svga_winsys_context *swc,
+ uint32 reg, // IN
+ SVGA3dShaderType type, // IN
+ SVGA3dShaderConstType ctype, // IN
+ const void *value) // IN
+{
+ SVGA3dCmdSetShaderConst *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SET_SHADER_CONST, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->reg = reg;
+ cmd->type = type;
+ cmd->ctype = ctype;
+
+ switch (ctype) {
+
+ case SVGA3D_CONST_TYPE_FLOAT:
+ case SVGA3D_CONST_TYPE_INT:
+ memcpy(&cmd->values, value, sizeof cmd->values);
+ break;
+
+ case SVGA3D_CONST_TYPE_BOOL:
+ memset(&cmd->values, 0, sizeof cmd->values);
+ cmd->values[0] = *(uint32*)value;
+ break;
+
+ default:
+ assert(0);
+ break;
+
+ }
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetShader --
+ *
+ * Switch active shaders. This binds a new vertex or pixel shader
+ * to the specified context.
+ *
+ * A shader ID of SVGA3D_INVALID_ID unbinds any shader, switching
+ * back to the fixed function vertex or pixel pipeline.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetShader(struct svga_winsys_context *swc,
+ SVGA3dShaderType type, // IN
+ uint32 shid) // IN
+{
+ SVGA3dCmdSetShader *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SET_SHADER, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->type = type;
+ cmd->shid = shid;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginClear --
+ *
+ * Begin a CLEAR command. This reserves space for it in the FIFO,
+ * and returns a pointer to the command's rectangle array. This
+ * function must be paired with SVGA_FIFOCommitAll().
+ *
+ * Clear is a rendering operation which fills a list of
+ * rectangles with constant values on all render target types
+ * indicated by 'flags'.
+ *
+ * Clear is not affected by clipping, depth test, or other
+ * render state which affects the fragment pipeline.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May write to attached render target surfaces.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginClear(struct svga_winsys_context *swc,
+ SVGA3dClearFlag flags, // IN
+ uint32 color, // IN
+ float depth, // IN
+ uint32 stencil, // IN
+ SVGA3dRect **rects, // OUT
+ uint32 numRects) // IN
+{
+ SVGA3dCmdClear *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_CLEAR,
+ sizeof *cmd + sizeof **rects * numRects,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->clearFlag = flags;
+ cmd->color = color;
+ cmd->depth = depth;
+ cmd->stencil = stencil;
+ *rects = (SVGA3dRect*) &cmd[1];
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_ClearRect --
+ *
+ * This is a simplified version of SVGA3D_BeginClear().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_ClearRect(struct svga_winsys_context *swc,
+ SVGA3dClearFlag flags, // IN
+ uint32 color, // IN
+ float depth, // IN
+ uint32 stencil, // IN
+ uint32 x, // IN
+ uint32 y, // IN
+ uint32 w, // IN
+ uint32 h) // IN
+{
+ SVGA3dRect *rect;
+ enum pipe_error ret;
+
+ ret = SVGA3D_BeginClear(swc, flags, color, depth, stencil, &rect, 1);
+ if(ret != PIPE_OK)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ memset(rect, 0, sizeof *rect);
+ rect->x = x;
+ rect->y = y;
+ rect->w = w;
+ rect->h = h;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginDrawPrimitives --
+ *
+ * Begin a DRAW_PRIMITIVES command. This reserves space for it in
+ * the FIFO, and returns a pointer to the command's arrays.
+ * This function must be paired with SVGA_FIFOCommitAll().
+ *
+ * Drawing commands consist of two variable-length arrays:
+ * SVGA3dVertexDecl elements declare a set of vertex buffers to
+ * use while rendering, and SVGA3dPrimitiveRange elements specify
+ * groups of primitives each with an optional index buffer.
+ *
+ * The decls and ranges arrays are initialized to zero.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May write to attached render target surfaces.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc,
+ SVGA3dVertexDecl **decls, // OUT
+ uint32 numVertexDecls, // IN
+ SVGA3dPrimitiveRange **ranges, // OUT
+ uint32 numRanges) // IN
+{
+ SVGA3dCmdDrawPrimitives *cmd;
+ SVGA3dVertexDecl *declArray;
+ SVGA3dPrimitiveRange *rangeArray;
+ uint32 declSize = sizeof **decls * numVertexDecls;
+ uint32 rangeSize = sizeof **ranges * numRanges;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_DRAW_PRIMITIVES,
+ sizeof *cmd + declSize + rangeSize,
+ numVertexDecls + numRanges);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->numVertexDecls = numVertexDecls;
+ cmd->numRanges = numRanges;
+
+ declArray = (SVGA3dVertexDecl*) &cmd[1];
+ rangeArray = (SVGA3dPrimitiveRange*) &declArray[numVertexDecls];
+
+ memset(declArray, 0, declSize);
+ memset(rangeArray, 0, rangeSize);
+
+ *decls = declArray;
+ *ranges = rangeArray;
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginSurfaceCopy --
+ *
+ * Begin a SURFACE_COPY command. This reserves space for it in
+ * the FIFO, and returns a pointer to the command's arrays. This
+ * function must be paired with SVGA_FIFOCommitAll().
+ *
+ * The box array is initialized with zeroes.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Asynchronously copies a list of boxes from surface to surface.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc,
+ struct pipe_surface *src, // IN
+ struct pipe_surface *dest, // IN
+ SVGA3dCopyBox **boxes, // OUT
+ uint32 numBoxes) // IN
+{
+ SVGA3dCmdSurfaceCopy *cmd;
+ uint32 boxesSize = sizeof **boxes * numBoxes;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_COPY, sizeof *cmd + boxesSize,
+ 2);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ surface_to_surfaceid(swc, src, &cmd->src, PIPE_BUFFER_USAGE_GPU_READ);
+ surface_to_surfaceid(swc, dest, &cmd->dest, PIPE_BUFFER_USAGE_GPU_WRITE);
+ *boxes = (SVGA3dCopyBox*) &cmd[1];
+
+ memset(*boxes, 0, boxesSize);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SurfaceStretchBlt --
+ *
+ * Issue a SURFACE_STRETCHBLT command: an asynchronous
+ * surface-to-surface blit, with scaling.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Asynchronously copies one box from surface to surface.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc,
+ struct pipe_surface *src, // IN
+ struct pipe_surface *dest, // IN
+ SVGA3dBox *boxSrc, // IN
+ SVGA3dBox *boxDest, // IN
+ SVGA3dStretchBltMode mode) // IN
+{
+ SVGA3dCmdSurfaceStretchBlt *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_STRETCHBLT, sizeof *cmd,
+ 2);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ surface_to_surfaceid(swc, src, &cmd->src, PIPE_BUFFER_USAGE_GPU_READ);
+ surface_to_surfaceid(swc, dest, &cmd->dest, PIPE_BUFFER_USAGE_GPU_WRITE);
+ cmd->boxSrc = *boxSrc;
+ cmd->boxDest = *boxDest;
+ cmd->mode = mode;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetViewport --
+ *
+ * Set the current context's viewport rectangle. The viewport
+ * is clipped to the dimensions of the current render target,
+ * then all rendering is clipped to the viewport.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetViewport(struct svga_winsys_context *swc,
+ SVGA3dRect *rect) // IN
+{
+ SVGA3dCmdSetViewport *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETVIEWPORT, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->rect = *rect;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetScissorRect --
+ *
+ * Set the current context's scissor rectangle. If scissor
+ * is enabled then all rendering is clipped to the scissor.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetScissorRect(struct svga_winsys_context *swc,
+ SVGA3dRect *rect) // IN
+{
+ SVGA3dCmdSetScissorRect *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETSCISSORRECT, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->rect = *rect;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetClipPlane --
+ *
+ * Set one of the current context's clip planes. If the clip
+ * plane is enabled then all 3d rendering is clipped to against
+ * the plane.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error SVGA3D_SetClipPlane(struct svga_winsys_context *swc,
+ uint32 index, const float *plane)
+{
+ SVGA3dCmdSetClipPlane *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETCLIPPLANE, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->index = index;
+ cmd->plane[0] = plane[0];
+ cmd->plane[1] = plane[1];
+ cmd->plane[2] = plane[2];
+ cmd->plane[3] = plane[3];
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_SetZRange --
+ *
+ * Set the range of the depth buffer to use. 'min' and 'max'
+ * are values between 0.0 and 1.0.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_SetZRange(struct svga_winsys_context *swc,
+ float zMin, // IN
+ float zMax) // IN
+{
+ SVGA3dCmdSetZRange *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETZRANGE, sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->zRange.min = zMin;
+ cmd->zRange.max = zMax;
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginSetTextureState --
+ *
+ * Begin a SETTEXTURESTATE command. This reserves space for it in
+ * the FIFO, and returns a pointer to the command's texture state
+ * array. This function must be paired with SVGA_FIFOCommitAll().
+ *
+ * This command sets rendering state which is per-texture-unit.
+ *
+ * XXX: Individual texture states need documentation. However,
+ * they are very similar to the texture states defined by
+ * Direct3D. The D3D documentation is a good starting point
+ * for understanding SVGA3D texture states.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc,
+ SVGA3dTextureState **states, // OUT
+ uint32 numStates) // IN
+{
+ SVGA3dCmdSetTextureState *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETTEXTURESTATE,
+ sizeof *cmd + sizeof **states * numStates,
+ numStates);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ *states = (SVGA3dTextureState*) &cmd[1];
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginSetRenderState --
+ *
+ * Begin a SETRENDERSTATE command. This reserves space for it in
+ * the FIFO, and returns a pointer to the command's texture state
+ * array. This function must be paired with SVGA_FIFOCommitAll().
+ *
+ * This command sets rendering state which is global to the context.
+ *
+ * XXX: Individual render states need documentation. However,
+ * they are very similar to the render states defined by
+ * Direct3D. The D3D documentation is a good starting point
+ * for understanding SVGA3D render states.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc,
+ SVGA3dRenderState **states, // OUT
+ uint32 numStates) // IN
+{
+ SVGA3dCmdSetRenderState *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SETRENDERSTATE,
+ sizeof *cmd + sizeof **states * numStates,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ *states = (SVGA3dRenderState*) &cmd[1];
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_BeginQuery--
+ *
+ * Issues a SVGA_3D_CMD_BEGIN_QUERY command.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commits space in the FIFO memory.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_BeginQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type) // IN
+{
+ SVGA3dCmdBeginQuery *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_BEGIN_QUERY,
+ sizeof *cmd,
+ 0);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->type = type;
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_EndQuery--
+ *
+ * Issues a SVGA_3D_CMD_END_QUERY command.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commits space in the FIFO memory.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_EndQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type, // IN
+ struct svga_winsys_buffer *buffer) // IN/OUT
+{
+ SVGA3dCmdEndQuery *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_END_QUERY,
+ sizeof *cmd,
+ 1);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->type = type;
+
+ swc->region_relocation(swc, &cmd->guestResult, buffer, 0,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SVGA3D_WaitForQuery--
+ *
+ * Issues a SVGA_3D_CMD_WAIT_FOR_QUERY command. This reserves space
+ * for it in the FIFO. This doesn't actually wait for the query to
+ * finish but instead tells the host to start a wait at the driver
+ * level. The caller can wait on the status variable in the
+ * guestPtr memory or send an insert fence instruction after this
+ * command and wait on the fence.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commits space in the FIFO memory.
+ *
+ *----------------------------------------------------------------------
+ */
+
+enum pipe_error
+SVGA3D_WaitForQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type, // IN
+ struct svga_winsys_buffer *buffer) // IN/OUT
+{
+ SVGA3dCmdWaitForQuery *cmd;
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_WAIT_FOR_QUERY,
+ sizeof *cmd,
+ 1);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ cmd->cid = swc->cid;
+ cmd->type = type;
+
+ swc->region_relocation(swc, &cmd->guestResult, buffer, 0,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
diff --git a/src/gallium/drivers/svga/svga_cmd.h b/src/gallium/drivers/svga/svga_cmd.h
new file mode 100644
index 0000000000..8041054769
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_cmd.h
@@ -0,0 +1,235 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/*
+ * svga_cmd.h --
+ *
+ * Command construction utility for the SVGA3D protocol used by
+ * the VMware SVGA device, based on the svgautil library.
+ */
+
+#ifndef __SVGA3D_H__
+#define __SVGA3D_H__
+
+
+#include "svga_types.h"
+#include "svga_reg.h"
+#include "svga3d_reg.h"
+
+#include "pipe/p_defines.h"
+
+
+struct pipe_buffer;
+struct pipe_surface;
+struct svga_transfer;
+struct svga_winsys_context;
+struct svga_winsys_buffer;
+struct svga_winsys_surface;
+
+
+/*
+ * SVGA Device Interoperability
+ */
+
+void *
+SVGA3D_FIFOReserve(struct svga_winsys_context *swc, uint32 cmd, uint32 cmdSize, uint32 nr_relocs);
+
+void
+SVGA_FIFOCommitAll(struct svga_winsys_context *swc);
+
+
+/*
+ * Context Management
+ */
+
+enum pipe_error
+SVGA3D_DefineContext(struct svga_winsys_context *swc);
+
+enum pipe_error
+SVGA3D_DestroyContext(struct svga_winsys_context *swc);
+
+
+/*
+ * Surface Management
+ */
+
+enum pipe_error
+SVGA3D_BeginDefineSurface(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *sid,
+ SVGA3dSurfaceFlags flags,
+ SVGA3dSurfaceFormat format,
+ SVGA3dSurfaceFace **faces,
+ SVGA3dSize **mipSizes,
+ uint32 numMipSizes);
+enum pipe_error
+SVGA3D_DefineSurface2D(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *sid,
+ uint32 width,
+ uint32 height,
+ SVGA3dSurfaceFormat format);
+enum pipe_error
+SVGA3D_DestroySurface(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *sid);
+
+
+/*
+ * Surface Operations
+ */
+
+enum pipe_error
+SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
+ struct svga_transfer *st,
+ SVGA3dTransferType transfer,
+ const SVGA3dCopyBox *boxes,
+ uint32 numBoxes);
+
+enum pipe_error
+SVGA3D_BufferDMA(struct svga_winsys_context *swc,
+ struct svga_winsys_buffer *guest,
+ struct svga_winsys_surface *host,
+ SVGA3dTransferType transfer,
+ uint32 size,
+ uint32 offset,
+ SVGA3dSurfaceDMAFlags flags);
+
+/*
+ * Drawing Operations
+ */
+
+
+enum pipe_error
+SVGA3D_BeginClear(struct svga_winsys_context *swc,
+ SVGA3dClearFlag flags,
+ uint32 color, float depth, uint32 stencil,
+ SVGA3dRect **rects, uint32 numRects);
+
+enum pipe_error
+SVGA3D_ClearRect(struct svga_winsys_context *swc,
+ SVGA3dClearFlag flags, uint32 color, float depth,
+ uint32 stencil, uint32 x, uint32 y, uint32 w, uint32 h);
+
+enum pipe_error
+SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc,
+ SVGA3dVertexDecl **decls,
+ uint32 numVertexDecls,
+ SVGA3dPrimitiveRange **ranges,
+ uint32 numRanges);
+
+/*
+ * Blits
+ */
+
+enum pipe_error
+SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc,
+ struct pipe_surface *src,
+ struct pipe_surface *dest,
+ SVGA3dCopyBox **boxes, uint32 numBoxes);
+
+
+enum pipe_error
+SVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc,
+ struct pipe_surface *src,
+ struct pipe_surface *dest,
+ SVGA3dBox *boxSrc, SVGA3dBox *boxDest,
+ SVGA3dStretchBltMode mode);
+
+/*
+ * Shared FFP/Shader Render State
+ */
+
+enum pipe_error
+SVGA3D_SetRenderTarget(struct svga_winsys_context *swc,
+ SVGA3dRenderTargetType type,
+ struct pipe_surface *surface);
+
+enum pipe_error
+SVGA3D_SetZRange(struct svga_winsys_context *swc,
+ float zMin, float zMax);
+
+enum pipe_error
+SVGA3D_SetViewport(struct svga_winsys_context *swc,
+ SVGA3dRect *rect);
+
+enum pipe_error
+SVGA3D_SetScissorRect(struct svga_winsys_context *swc,
+ SVGA3dRect *rect);
+
+enum pipe_error
+SVGA3D_SetClipPlane(struct svga_winsys_context *swc,
+ uint32 index, const float *plane);
+
+enum pipe_error
+SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc,
+ SVGA3dTextureState **states,
+ uint32 numStates);
+
+enum pipe_error
+SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc,
+ SVGA3dRenderState **states,
+ uint32 numStates);
+
+
+/*
+ * Shaders
+ */
+
+enum pipe_error
+SVGA3D_DefineShader(struct svga_winsys_context *swc,
+ uint32 shid, SVGA3dShaderType type,
+ const uint32 *bytecode, uint32 bytecodeLen);
+
+enum pipe_error
+SVGA3D_DestroyShader(struct svga_winsys_context *swc,
+ uint32 shid, SVGA3dShaderType type);
+
+enum pipe_error
+SVGA3D_SetShaderConst(struct svga_winsys_context *swc,
+ uint32 reg, SVGA3dShaderType type,
+ SVGA3dShaderConstType ctype, const void *value);
+
+enum pipe_error
+SVGA3D_SetShader(struct svga_winsys_context *swc,
+ SVGA3dShaderType type, uint32 shid);
+
+
+/*
+ * Queries
+ */
+
+enum pipe_error
+SVGA3D_BeginQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type);
+
+enum pipe_error
+SVGA3D_EndQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type,
+ struct svga_winsys_buffer *buffer);
+
+enum pipe_error
+SVGA3D_WaitForQuery(struct svga_winsys_context *swc,
+ SVGA3dQueryType type,
+ struct svga_winsys_buffer *buffer);
+
+#endif /* __SVGA3D_H__ */
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
new file mode 100644
index 0000000000..73233957f3
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -0,0 +1,269 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_defines.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_screen.h"
+#include "util/u_memory.h"
+#include "util/u_upload_mgr.h"
+
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_screen_texture.h"
+#include "svga_screen_buffer.h"
+#include "svga_winsys.h"
+#include "svga_swtnl.h"
+#include "svga_draw.h"
+#include "svga_debug.h"
+#include "svga_state.h"
+
+
+static void svga_destroy( struct pipe_context *pipe )
+{
+ struct svga_context *svga = svga_context( pipe );
+ unsigned shader;
+
+ svga_cleanup_framebuffer( svga );
+ svga_cleanup_tss_binding( svga );
+
+ svga_hwtnl_destroy( svga->hwtnl );
+
+ svga_cleanup_vertex_state(svga);
+
+ svga->swc->destroy(svga->swc);
+
+ svga_destroy_swtnl( svga );
+
+ u_upload_destroy( svga->upload_vb );
+ u_upload_destroy( svga->upload_ib );
+
+ for(shader = 0; shader < PIPE_SHADER_TYPES; ++shader)
+ pipe_buffer_reference( &svga->curr.cb[shader], NULL );
+
+ FREE( svga );
+}
+
+static unsigned int
+svga_is_texture_referenced( struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level)
+{
+ struct svga_texture *tex = svga_texture(texture);
+ struct svga_screen *ss = svga_screen(pipe->screen);
+
+ /**
+ * The screen does not cache texture writes.
+ */
+
+ if (!tex->handle || ss->sws->surface_is_flushed(ss->sws, tex->handle))
+ return PIPE_UNREFERENCED;
+
+ /**
+ * sws->surface_is_flushed() does not distinguish between read references
+ * and write references. So assume a reference is both.
+ */
+
+ return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+}
+
+static unsigned int
+svga_is_buffer_referenced( struct pipe_context *pipe,
+ struct pipe_buffer *buf)
+
+{
+ struct svga_screen *ss = svga_screen(pipe->screen);
+ struct svga_buffer *sbuf = svga_buffer(buf);
+
+ /**
+ * XXX: Check this.
+ * The screen may cache buffer writes, but when we map, we map out
+ * of those cached writes, so we don't need to set a
+ * PIPE_REFERENCED_FOR_WRITE flag for cached buffers.
+ */
+
+ if (!sbuf->handle || ss->sws->surface_is_flushed(ss->sws, sbuf->handle))
+ return PIPE_UNREFERENCED;
+
+ /**
+ * sws->surface_is_flushed() does not distinguish between read references
+ * and write references. So assume a reference is both,
+ * however, we make an exception for index- and vertex buffers, to avoid
+ * a flush in st_bufferobj_get_subdata, during display list replay.
+ */
+
+ if (sbuf->base.usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_INDEX))
+ return PIPE_REFERENCED_FOR_READ;
+
+ return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+}
+
+
+struct pipe_context *svga_context_create( struct pipe_screen *screen )
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+ struct svga_context *svga = NULL;
+ enum pipe_error ret;
+
+ svga = CALLOC_STRUCT(svga_context);
+ if (svga == NULL)
+ goto error1;
+
+ svga->pipe.winsys = screen->winsys;
+ svga->pipe.screen = screen;
+ svga->pipe.destroy = svga_destroy;
+ svga->pipe.clear = svga_clear;
+
+ svga->pipe.is_texture_referenced = svga_is_texture_referenced;
+ svga->pipe.is_buffer_referenced = svga_is_buffer_referenced;
+
+ svga->swc = svgascreen->sws->context_create(svgascreen->sws);
+ if(!svga->swc)
+ goto error2;
+
+ svga_init_blend_functions(svga);
+ svga_init_blit_functions(svga);
+ svga_init_depth_stencil_functions(svga);
+ svga_init_draw_functions(svga);
+ svga_init_flush_functions(svga);
+ svga_init_misc_functions(svga);
+ svga_init_rasterizer_functions(svga);
+ svga_init_sampler_functions(svga);
+ svga_init_fs_functions(svga);
+ svga_init_vs_functions(svga);
+ svga_init_vertex_functions(svga);
+ svga_init_constbuffer_functions(svga);
+ svga_init_query_functions(svga);
+
+ /* debug */
+ svga->debug.no_swtnl = debug_get_bool_option("SVGA_NO_SWTNL", FALSE);
+ svga->debug.force_swtnl = debug_get_bool_option("SVGA_FORCE_SWTNL", FALSE);
+ svga->debug.use_min_mipmap = debug_get_bool_option("SVGA_USE_MIN_MIPMAP", FALSE);
+ svga->debug.disable_shader = debug_get_num_option("SVGA_DISABLE_SHADER", ~0);
+
+ if (!svga_init_swtnl(svga))
+ goto error3;
+
+ svga->upload_ib = u_upload_create( svga->pipe.screen,
+ 32 * 1024,
+ 16,
+ PIPE_BUFFER_USAGE_INDEX );
+ if (svga->upload_ib == NULL)
+ goto error4;
+
+ svga->upload_vb = u_upload_create( svga->pipe.screen,
+ 128 * 1024,
+ 16,
+ PIPE_BUFFER_USAGE_VERTEX );
+ if (svga->upload_vb == NULL)
+ goto error5;
+
+ svga->hwtnl = svga_hwtnl_create( svga,
+ svga->upload_ib,
+ svga->swc );
+ if (svga->hwtnl == NULL)
+ goto error6;
+
+
+ ret = svga_emit_initial_state( svga );
+ if (ret)
+ goto error7;
+
+ /* Avoid shortcircuiting state with initial value of zero.
+ */
+ memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear));
+ memset(&svga->state.hw_clear.framebuffer, 0x0,
+ sizeof(svga->state.hw_clear.framebuffer));
+
+ memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw));
+ memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views));
+ svga->state.hw_draw.num_views = 0;
+
+ svga->dirty = ~0;
+ svga->state.white_fs_id = SVGA3D_INVALID_ID;
+
+ LIST_INITHEAD(&svga->dirty_buffers);
+
+ return &svga->pipe;
+
+error7:
+ svga_hwtnl_destroy( svga->hwtnl );
+error6:
+ u_upload_destroy( svga->upload_vb );
+error5:
+ u_upload_destroy( svga->upload_ib );
+error4:
+ svga_destroy_swtnl(svga);
+error3:
+ svga->swc->destroy(svga->swc);
+error2:
+ FREE(svga);
+error1:
+ return NULL;
+}
+
+
+void svga_context_flush( struct svga_context *svga,
+ struct pipe_fence_handle **pfence )
+{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
+
+ /* Unmap upload manager buffers:
+ */
+ u_upload_flush(svga->upload_vb);
+ u_upload_flush(svga->upload_ib);
+
+ /* Flush screen, to ensure that texture dma uploads are processed
+ * before submitting commands.
+ */
+ svga_screen_flush(svgascreen, NULL);
+
+ svga_context_flush_buffers(svga);
+
+ /* Flush pending commands to hardware:
+ */
+ svga->swc->flush(svga->swc, pfence);
+
+ if (SVGA_DEBUG & DEBUG_SYNC) {
+ if (pfence && *pfence)
+ svga->pipe.screen->fence_finish( svga->pipe.screen, *pfence, 0);
+ }
+}
+
+
+void svga_hwtnl_flush_retry( struct svga_context *svga )
+{
+ enum pipe_error ret = PIPE_OK;
+
+ ret = svga_hwtnl_flush( svga->hwtnl );
+ if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
+ svga_context_flush( svga, NULL );
+ ret = svga_hwtnl_flush( svga->hwtnl );
+ }
+
+ assert(ret == 0);
+}
+
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
new file mode 100644
index 0000000000..9a3e92fd8d
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -0,0 +1,443 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_CONTEXT_H
+#define SVGA_CONTEXT_H
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_state.h"
+
+#include "util/u_double_list.h"
+
+#include "tgsi/tgsi_scan.h"
+
+
+#define SVGA_TEX_UNITS 8
+
+struct draw_vertex_shader;
+struct svga_shader_result;
+struct SVGACmdMemory;
+struct u_upload_mgr;
+
+
+struct svga_shader
+{
+ const struct tgsi_token *tokens;
+
+ struct tgsi_shader_info info;
+
+ struct svga_shader_result *results;
+
+ unsigned id;
+
+ boolean use_sm30;
+};
+
+struct svga_fragment_shader
+{
+ struct svga_shader base;
+};
+
+struct svga_vertex_shader
+{
+ struct svga_shader base;
+
+ struct draw_vertex_shader *draw_shader;
+};
+
+
+struct svga_cache_context;
+struct svga_tracked_state;
+
+struct svga_blend_state {
+
+ boolean need_white_fragments;
+
+ /* Should be per-render-target:
+ */
+ struct {
+ uint8_t writemask;
+
+ boolean blend_enable;
+ uint8_t srcblend;
+ uint8_t dstblend;
+ uint8_t blendeq;
+
+ boolean separate_alpha_blend_enable;
+ uint8_t srcblend_alpha;
+ uint8_t dstblend_alpha;
+ uint8_t blendeq_alpha;
+
+ } rt[1];
+};
+
+struct svga_depth_stencil_state {
+ unsigned zfunc:8;
+ unsigned zenable:1;
+ unsigned zwriteenable:1;
+
+ unsigned alphatestenable:1;
+ unsigned alphafunc:8;
+
+ struct {
+ unsigned enabled:1;
+ unsigned func:8;
+ unsigned fail:8;
+ unsigned zfail:8;
+ unsigned pass:8;
+ } stencil[2];
+
+ /* SVGA3D has one ref/mask/writemask triple shared between front &
+ * back face stencil. We really need two:
+ */
+ unsigned stencil_ref:8;
+ unsigned stencil_mask:8;
+ unsigned stencil_writemask:8;
+
+ float alpharef;
+};
+
+#define SVGA_UNFILLED_DISABLE 0
+#define SVGA_UNFILLED_LINE 1
+#define SVGA_UNFILLED_POINT 2
+
+#define SVGA_PIPELINE_FLAG_POINTS (1<svga = svga;
+ hwtnl->upload_ib = upload_ib;
+
+ hwtnl->cmd.swc = swc;
+
+ return hwtnl;
+
+fail:
+ return NULL;
+}
+
+void svga_hwtnl_destroy( struct svga_hwtnl *hwtnl )
+{
+ int i, j;
+
+ for (i = 0; i < PIPE_PRIM_MAX; i++) {
+ for (j = 0; j < IDX_CACHE_MAX; j++) {
+ pipe_buffer_reference( &hwtnl->index_cache[i][j].buffer,
+ NULL );
+ }
+ }
+
+ for (i = 0; i < hwtnl->cmd.vdecl_count; i++)
+ pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i], NULL);
+
+ for (i = 0; i < hwtnl->cmd.prim_count; i++)
+ pipe_buffer_reference(&hwtnl->cmd.prim_ib[i], NULL);
+
+
+ FREE(hwtnl);
+}
+
+
+void svga_hwtnl_set_flatshade( struct svga_hwtnl *hwtnl,
+ boolean flatshade,
+ boolean flatshade_first )
+{
+ hwtnl->hw_pv = PV_FIRST;
+ hwtnl->api_pv = (flatshade && !flatshade_first) ? PV_LAST : PV_FIRST;
+}
+
+void svga_hwtnl_set_unfilled( struct svga_hwtnl *hwtnl,
+ unsigned mode )
+{
+ hwtnl->api_fillmode = mode;
+}
+
+void svga_hwtnl_reset_vdecl( struct svga_hwtnl *hwtnl,
+ unsigned count )
+{
+ unsigned i;
+
+ assert(hwtnl->cmd.prim_count == 0);
+
+ for (i = count; i < hwtnl->cmd.vdecl_count; i++) {
+ pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i],
+ NULL);
+ }
+
+ hwtnl->cmd.vdecl_count = count;
+}
+
+
+void svga_hwtnl_vdecl( struct svga_hwtnl *hwtnl,
+ unsigned i,
+ const SVGA3dVertexDecl *decl,
+ struct pipe_buffer *vb)
+{
+ assert(hwtnl->cmd.prim_count == 0);
+
+ assert( i < hwtnl->cmd.vdecl_count );
+
+ hwtnl->cmd.vdecl[i] = *decl;
+
+ pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i],
+ vb);
+}
+
+
+
+enum pipe_error
+svga_hwtnl_flush( struct svga_hwtnl *hwtnl )
+{
+ struct svga_winsys_context *swc = hwtnl->cmd.swc;
+ struct svga_context *svga = hwtnl->svga;
+ enum pipe_error ret;
+
+ if (hwtnl->cmd.prim_count) {
+ struct svga_winsys_surface *vb_handle[SVGA3D_INPUTREG_MAX];
+ struct svga_winsys_surface *ib_handle[QSZ];
+ struct svga_winsys_surface *handle;
+ SVGA3dVertexDecl *vdecl;
+ SVGA3dPrimitiveRange *prim;
+ unsigned i;
+
+ for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
+ handle = svga_buffer_handle(svga, hwtnl->cmd.vdecl_vb[i]);
+ if (handle == NULL)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ vb_handle[i] = handle;
+ }
+
+ for (i = 0; i < hwtnl->cmd.prim_count; i++) {
+ if (hwtnl->cmd.prim_ib[i]) {
+ handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]);
+ if (handle == NULL)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+ }
+ else
+ handle = NULL;
+
+ ib_handle[i] = handle;
+ }
+
+ ret = SVGA3D_BeginDrawPrimitives(swc,
+ &vdecl,
+ hwtnl->cmd.vdecl_count,
+ &prim,
+ hwtnl->cmd.prim_count);
+ if (ret != PIPE_OK)
+ return ret;
+
+
+ memcpy( vdecl,
+ hwtnl->cmd.vdecl,
+ hwtnl->cmd.vdecl_count * sizeof hwtnl->cmd.vdecl[0]);
+
+ for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
+ /* Given rangeHint is considered to be relative to indexBias, and
+ * indexBias varies per primitive, we cannot accurately supply an
+ * rangeHint when emitting more than one primitive per draw command.
+ */
+ if (hwtnl->cmd.prim_count == 1) {
+ vdecl[i].rangeHint.first = hwtnl->cmd.min_index[0];
+ vdecl[i].rangeHint.last = hwtnl->cmd.max_index[0] + 1;
+ }
+ else {
+ vdecl[i].rangeHint.first = 0;
+ vdecl[i].rangeHint.last = 0;
+ }
+
+ swc->surface_relocation(swc,
+ &vdecl[i].array.surfaceId,
+ vb_handle[i],
+ PIPE_BUFFER_USAGE_GPU_READ);
+ }
+
+ memcpy( prim,
+ hwtnl->cmd.prim,
+ hwtnl->cmd.prim_count * sizeof hwtnl->cmd.prim[0]);
+
+ for (i = 0; i < hwtnl->cmd.prim_count; i++) {
+ swc->surface_relocation(swc,
+ &prim[i].indexArray.surfaceId,
+ ib_handle[i],
+ PIPE_BUFFER_USAGE_GPU_READ);
+ pipe_buffer_reference(&hwtnl->cmd.prim_ib[i], NULL);
+ }
+
+ SVGA_FIFOCommitAll( swc );
+ hwtnl->cmd.prim_count = 0;
+ }
+
+ return PIPE_OK;
+}
+
+
+
+
+
+/***********************************************************************
+ * Internal functions:
+ */
+
+enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
+ const SVGA3dPrimitiveRange *range,
+ unsigned min_index,
+ unsigned max_index,
+ struct pipe_buffer *ib )
+{
+ int ret = PIPE_OK;
+
+#ifdef DEBUG
+ {
+ unsigned i;
+ for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
+ struct pipe_buffer *vb = hwtnl->cmd.vdecl_vb[i];
+ unsigned size = vb ? vb->size : 0;
+ unsigned offset = hwtnl->cmd.vdecl[i].array.offset;
+ unsigned stride = hwtnl->cmd.vdecl[i].array.stride;
+ unsigned index_bias = range->indexBias;
+ unsigned width;
+
+ assert(vb);
+ assert(size);
+ assert(offset < size);
+ assert(index_bias >= 0);
+ assert(min_index <= max_index);
+ assert(offset + index_bias*stride < size);
+ assert(offset + (index_bias + min_index)*stride < size);
+
+ switch (hwtnl->cmd.vdecl[i].identity.type) {
+ case SVGA3D_DECLTYPE_FLOAT1:
+ width = 4;
+ break;
+ case SVGA3D_DECLTYPE_FLOAT2:
+ width = 4*2;
+ break;
+ case SVGA3D_DECLTYPE_FLOAT3:
+ width = 4*3;
+ break;
+ case SVGA3D_DECLTYPE_FLOAT4:
+ width = 4*4;
+ break;
+ case SVGA3D_DECLTYPE_D3DCOLOR:
+ width = 4;
+ break;
+ case SVGA3D_DECLTYPE_UBYTE4:
+ width = 1*4;
+ break;
+ case SVGA3D_DECLTYPE_SHORT2:
+ width = 2*2;
+ break;
+ case SVGA3D_DECLTYPE_SHORT4:
+ width = 2*4;
+ break;
+ case SVGA3D_DECLTYPE_UBYTE4N:
+ width = 1*4;
+ break;
+ case SVGA3D_DECLTYPE_SHORT2N:
+ width = 2*2;
+ break;
+ case SVGA3D_DECLTYPE_SHORT4N:
+ width = 2*4;
+ break;
+ case SVGA3D_DECLTYPE_USHORT2N:
+ width = 2*2;
+ break;
+ case SVGA3D_DECLTYPE_USHORT4N:
+ width = 2*4;
+ break;
+ case SVGA3D_DECLTYPE_UDEC3:
+ width = 4;
+ break;
+ case SVGA3D_DECLTYPE_DEC3N:
+ width = 4;
+ break;
+ case SVGA3D_DECLTYPE_FLOAT16_2:
+ width = 2*2;
+ break;
+ case SVGA3D_DECLTYPE_FLOAT16_4:
+ width = 2*4;
+ break;
+ default:
+ assert(0);
+ width = 0;
+ break;
+ }
+
+ assert(!stride || width <= stride);
+ assert(offset + (index_bias + max_index)*stride + width <= size);
+ }
+
+ assert(range->indexWidth == range->indexArray.stride);
+
+ if(ib) {
+ unsigned size = ib->size;
+ unsigned offset = range->indexArray.offset;
+ unsigned stride = range->indexArray.stride;
+ unsigned count;
+
+ assert(size);
+ assert(offset < size);
+ assert(stride);
+
+ switch (range->primType) {
+ case SVGA3D_PRIMITIVE_POINTLIST:
+ count = range->primitiveCount;
+ break;
+ case SVGA3D_PRIMITIVE_LINELIST:
+ count = range->primitiveCount * 2;
+ break;
+ case SVGA3D_PRIMITIVE_LINESTRIP:
+ count = range->primitiveCount + 1;
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLELIST:
+ count = range->primitiveCount * 3;
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
+ count = range->primitiveCount + 2;
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLEFAN:
+ count = range->primitiveCount + 2;
+ break;
+ default:
+ assert(0);
+ count = 0;
+ break;
+ }
+
+ assert(offset + count*stride <= size);
+ }
+ }
+#endif
+
+ if (hwtnl->cmd.prim_count+1 >= QSZ) {
+ ret = svga_hwtnl_flush( hwtnl );
+ if (ret != PIPE_OK)
+ return ret;
+ }
+
+ /* min/max indices are relative to bias */
+ hwtnl->cmd.min_index[hwtnl->cmd.prim_count] = min_index;
+ hwtnl->cmd.max_index[hwtnl->cmd.prim_count] = max_index;
+
+ hwtnl->cmd.prim[hwtnl->cmd.prim_count] = *range;
+
+ pipe_buffer_reference(&hwtnl->cmd.prim_ib[hwtnl->cmd.prim_count], ib);
+ hwtnl->cmd.prim_count++;
+
+ return ret;
+}
diff --git a/src/gallium/drivers/svga/svga_draw.h b/src/gallium/drivers/svga/svga_draw.h
new file mode 100644
index 0000000000..14553b17b5
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_draw.h
@@ -0,0 +1,83 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_DRAW_H
+#define SVGA_DRAW_H
+
+#include "pipe/p_compiler.h"
+
+#include "svga_hw_reg.h"
+
+struct svga_hwtnl;
+struct svga_winsys_context;
+struct svga_screen;
+struct svga_context;
+struct pipe_buffer;
+struct u_upload_mgr;
+
+struct svga_hwtnl *svga_hwtnl_create( struct svga_context *svga,
+ struct u_upload_mgr *upload_ib,
+ struct svga_winsys_context *swc );
+
+void svga_hwtnl_destroy( struct svga_hwtnl *hwtnl );
+
+void svga_hwtnl_set_flatshade( struct svga_hwtnl *hwtnl,
+ boolean flatshade,
+ boolean flatshade_first );
+
+void svga_hwtnl_set_unfilled( struct svga_hwtnl *hwtnl,
+ unsigned mode );
+
+void svga_hwtnl_vdecl( struct svga_hwtnl *hwtnl,
+ unsigned i,
+ const SVGA3dVertexDecl *decl,
+ struct pipe_buffer *vb);
+
+void svga_hwtnl_reset_vdecl( struct svga_hwtnl *hwtnl,
+ unsigned count );
+
+
+enum pipe_error
+svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl,
+ unsigned prim,
+ unsigned start,
+ unsigned count);
+
+enum pipe_error
+svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl,
+ struct pipe_buffer *indexBuffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim,
+ unsigned start,
+ unsigned count,
+ unsigned bias );
+
+enum pipe_error
+svga_hwtnl_flush( struct svga_hwtnl *hwtnl );
+
+
+#endif /* SVGA_DRAW_H_ */
diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c
new file mode 100644
index 0000000000..75492dffca
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_draw_arrays.c
@@ -0,0 +1,297 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_inlines.h"
+#include "util/u_prim.h"
+#include "indices/u_indices.h"
+
+#include "svga_hw_reg.h"
+#include "svga_draw.h"
+#include "svga_draw_private.h"
+#include "svga_context.h"
+
+
+#define DBG 0
+
+
+
+
+static enum pipe_error generate_indices( struct svga_hwtnl *hwtnl,
+ unsigned nr,
+ unsigned index_size,
+ u_generate_func generate,
+ struct pipe_buffer **out_buf )
+{
+ struct pipe_screen *screen = hwtnl->svga->pipe.screen;
+ unsigned size = index_size * nr;
+ struct pipe_buffer *dst = NULL;
+ void *dst_map = NULL;
+
+ dst = screen->buffer_create( screen, 32,
+ PIPE_BUFFER_USAGE_INDEX |
+ PIPE_BUFFER_USAGE_CPU_WRITE |
+ PIPE_BUFFER_USAGE_GPU_READ,
+ size );
+ if (dst == NULL)
+ goto fail;
+
+ dst_map = pipe_buffer_map( screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE );
+ if (dst_map == NULL)
+ goto fail;
+
+ generate( nr,
+ dst_map );
+
+ pipe_buffer_unmap( screen, dst );
+
+ *out_buf = dst;
+ return PIPE_OK;
+
+fail:
+ if (dst_map)
+ screen->buffer_unmap( screen, dst );
+
+ if (dst)
+ screen->buffer_destroy( dst );
+
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+static boolean compare( unsigned cached_nr,
+ unsigned nr,
+ unsigned type )
+{
+ if (type == U_GENERATE_REUSABLE)
+ return cached_nr >= nr;
+ else
+ return cached_nr == nr;
+}
+
+static enum pipe_error retrieve_or_generate_indices( struct svga_hwtnl *hwtnl,
+ unsigned prim,
+ unsigned gen_type,
+ unsigned gen_nr,
+ unsigned gen_size,
+ u_generate_func generate,
+ struct pipe_buffer **out_buf )
+{
+ enum pipe_error ret = PIPE_OK;
+ int i;
+
+ for (i = 0; i < IDX_CACHE_MAX; i++) {
+ if (hwtnl->index_cache[prim][i].buffer != NULL &&
+ hwtnl->index_cache[prim][i].generate == generate)
+ {
+ if (compare(hwtnl->index_cache[prim][i].gen_nr, gen_nr, gen_type))
+ {
+ pipe_buffer_reference( out_buf,
+ hwtnl->index_cache[prim][i].buffer );
+
+ if (DBG)
+ debug_printf("%s retrieve %d/%d\n", __FUNCTION__, i, gen_nr);
+
+ return PIPE_OK;
+ }
+ else if (gen_type == U_GENERATE_REUSABLE)
+ {
+ pipe_buffer_reference( &hwtnl->index_cache[prim][i].buffer,
+ NULL );
+
+ if (DBG)
+ debug_printf("%s discard %d/%d\n", __FUNCTION__,
+ i, hwtnl->index_cache[prim][i].gen_nr);
+
+ break;
+ }
+ }
+ }
+
+ if (i == IDX_CACHE_MAX)
+ {
+ unsigned smallest = 0;
+ unsigned smallest_size = ~0;
+
+ for (i = 0; i < IDX_CACHE_MAX && smallest_size; i++) {
+ if (hwtnl->index_cache[prim][i].buffer == NULL)
+ {
+ smallest = i;
+ smallest_size = 0;
+ }
+ else if (hwtnl->index_cache[prim][i].gen_nr < smallest)
+ {
+ smallest = i;
+ smallest_size = hwtnl->index_cache[prim][i].gen_nr;
+ }
+ }
+
+ assert (smallest != IDX_CACHE_MAX);
+
+ pipe_buffer_reference( &hwtnl->index_cache[prim][smallest].buffer,
+ NULL );
+
+ if (DBG)
+ debug_printf("%s discard smallest %d/%d\n", __FUNCTION__,
+ smallest, smallest_size);
+
+ i = smallest;
+ }
+
+
+ ret = generate_indices( hwtnl,
+ gen_nr,
+ gen_size,
+ generate,
+ out_buf );
+ if (ret != PIPE_OK)
+ return ret;
+
+
+ hwtnl->index_cache[prim][i].generate = generate;
+ hwtnl->index_cache[prim][i].gen_nr = gen_nr;
+ pipe_buffer_reference( &hwtnl->index_cache[prim][i].buffer,
+ *out_buf );
+
+ if (DBG)
+ debug_printf("%s cache %d/%d\n", __FUNCTION__,
+ i, hwtnl->index_cache[prim][i].gen_nr);
+
+ return PIPE_OK;
+}
+
+
+
+static enum pipe_error
+simple_draw_arrays( struct svga_hwtnl *hwtnl,
+ unsigned prim, unsigned start, unsigned count )
+{
+ SVGA3dPrimitiveRange range;
+ unsigned hw_prim;
+ unsigned hw_count;
+
+ hw_prim = svga_translate_prim(prim, count, &hw_count);
+ if (hw_count == 0)
+ return PIPE_ERROR_BAD_INPUT;
+
+ range.primType = hw_prim;
+ range.primitiveCount = hw_count;
+ range.indexArray.surfaceId = SVGA3D_INVALID_ID;
+ range.indexArray.offset = 0;
+ range.indexArray.stride = 0;
+ range.indexWidth = 0;
+ range.indexBias = start;
+
+ /* Min/max index should be calculated prior to applying bias, so we
+ * end up with min_index = 0, max_index = count - 1 and everybody
+ * looking at those numbers knows to adjust them by
+ * range.indexBias.
+ */
+ return svga_hwtnl_prim( hwtnl, &range, 0, count - 1, NULL );
+}
+
+
+
+
+
+
+
+
+
+
+enum pipe_error
+svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl,
+ unsigned prim,
+ unsigned start,
+ unsigned count)
+{
+ unsigned gen_prim, gen_size, gen_nr, gen_type;
+ u_generate_func gen_func;
+ enum pipe_error ret = PIPE_OK;
+
+ if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL &&
+ prim >= PIPE_PRIM_TRIANGLES)
+ {
+ gen_type = u_unfilled_generator( prim,
+ start,
+ count,
+ hwtnl->api_fillmode,
+ &gen_prim,
+ &gen_size,
+ &gen_nr,
+ &gen_func );
+ }
+ else {
+ gen_type = u_index_generator( svga_hw_prims,
+ prim,
+ start,
+ count,
+ hwtnl->api_pv,
+ hwtnl->hw_pv,
+ &gen_prim,
+ &gen_size,
+ &gen_nr,
+ &gen_func );
+ }
+
+ if (gen_type == U_GENERATE_LINEAR) {
+ return simple_draw_arrays( hwtnl, gen_prim, start, count );
+ }
+ else {
+ struct pipe_buffer *gen_buf = NULL;
+
+ /* Need to draw as indexed primitive.
+ * Potentially need to run the gen func to build an index buffer.
+ */
+ ret = retrieve_or_generate_indices( hwtnl,
+ prim,
+ gen_type,
+ gen_nr,
+ gen_size,
+ gen_func,
+ &gen_buf );
+ if (ret)
+ goto done;
+
+ ret = svga_hwtnl_simple_draw_range_elements( hwtnl,
+ gen_buf,
+ gen_size,
+ 0,
+ count - 1,
+ gen_prim,
+ 0,
+ gen_nr,
+ start );
+ if (ret)
+ goto done;
+
+ done:
+ if (gen_buf)
+ pipe_buffer_reference( &gen_buf, NULL );
+
+ return ret;
+ }
+}
+
diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c
new file mode 100644
index 0000000000..167d817831
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_draw_elements.c
@@ -0,0 +1,255 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "util/u_prim.h"
+#include "util/u_upload_mgr.h"
+#include "indices/u_indices.h"
+
+#include "svga_cmd.h"
+#include "svga_draw.h"
+#include "svga_draw_private.h"
+#include "svga_screen_buffer.h"
+#include "svga_winsys.h"
+#include "svga_context.h"
+
+#include "svga_hw_reg.h"
+
+
+static enum pipe_error
+translate_indices( struct svga_hwtnl *hwtnl,
+ struct pipe_buffer *src,
+ unsigned offset,
+ unsigned nr,
+ unsigned index_size,
+ u_translate_func translate,
+ struct pipe_buffer **out_buf )
+{
+ struct pipe_screen *screen = hwtnl->svga->pipe.screen;
+ unsigned size = index_size * nr;
+ const void *src_map = NULL;
+ struct pipe_buffer *dst = NULL;
+ void *dst_map = NULL;
+
+ dst = screen->buffer_create( screen, 32,
+ PIPE_BUFFER_USAGE_INDEX |
+ PIPE_BUFFER_USAGE_CPU_WRITE |
+ PIPE_BUFFER_USAGE_GPU_READ,
+ size );
+ if (dst == NULL)
+ goto fail;
+
+ src_map = pipe_buffer_map( screen, src, PIPE_BUFFER_USAGE_CPU_READ );
+ if (src_map == NULL)
+ goto fail;
+
+ dst_map = pipe_buffer_map( screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE );
+ if (dst_map == NULL)
+ goto fail;
+
+ translate( (const char *)src_map + offset,
+ nr,
+ dst_map );
+
+ pipe_buffer_unmap( screen, src );
+ pipe_buffer_unmap( screen, dst );
+
+ *out_buf = dst;
+ return PIPE_OK;
+
+fail:
+ if (src_map)
+ screen->buffer_unmap( screen, src );
+
+ if (dst_map)
+ screen->buffer_unmap( screen, dst );
+
+ if (dst)
+ screen->buffer_destroy( dst );
+
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+
+
+
+
+enum pipe_error
+svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
+ struct pipe_buffer *index_buffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim,
+ unsigned start,
+ unsigned count,
+ unsigned bias )
+{
+ struct pipe_buffer *upload_buffer = NULL;
+ SVGA3dPrimitiveRange range;
+ unsigned hw_prim;
+ unsigned hw_count;
+ unsigned index_offset = start * index_size;
+ int ret = PIPE_OK;
+
+ hw_prim = svga_translate_prim(prim, count, &hw_count);
+ if (hw_count == 0)
+ goto done;
+
+ if (index_buffer &&
+ svga_buffer_is_user_buffer(index_buffer))
+ {
+ assert( index_buffer->size >= index_offset + count * index_size );
+
+ ret = u_upload_buffer( hwtnl->upload_ib,
+ index_offset,
+ count * index_size,
+ index_buffer,
+ &index_offset,
+ &upload_buffer );
+ if (ret)
+ goto done;
+
+ /* Don't need to worry about refcounting index_buffer as this is
+ * just a stack variable without a counted reference of its own.
+ * The caller holds the reference.
+ */
+ index_buffer = upload_buffer;
+ }
+
+ range.primType = hw_prim;
+ range.primitiveCount = hw_count;
+ range.indexArray.offset = index_offset;
+ range.indexArray.stride = index_size;
+ range.indexWidth = index_size;
+ range.indexBias = bias;
+
+ ret = svga_hwtnl_prim( hwtnl, &range, min_index, max_index, index_buffer );
+ if (ret)
+ goto done;
+
+done:
+ if (upload_buffer)
+ pipe_buffer_reference( &upload_buffer, NULL );
+
+ return ret;
+}
+
+
+
+
+enum pipe_error
+svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl,
+ struct pipe_buffer *index_buffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim, unsigned start, unsigned count,
+ unsigned bias)
+{
+ unsigned gen_prim, gen_size, gen_nr, gen_type;
+ u_translate_func gen_func;
+ enum pipe_error ret = PIPE_OK;
+
+ if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL &&
+ prim >= PIPE_PRIM_TRIANGLES)
+ {
+ gen_type = u_unfilled_translator( prim,
+ index_size,
+ count,
+ hwtnl->api_fillmode,
+ &gen_prim,
+ &gen_size,
+ &gen_nr,
+ &gen_func );
+ }
+ else
+ {
+ gen_type = u_index_translator( svga_hw_prims,
+ prim,
+ index_size,
+ count,
+ hwtnl->api_pv,
+ hwtnl->hw_pv,
+ &gen_prim,
+ &gen_size,
+ &gen_nr,
+ &gen_func );
+ }
+
+
+ if (gen_type == U_TRANSLATE_MEMCPY) {
+ /* No need for translation, just pass through to hardware:
+ */
+ return svga_hwtnl_simple_draw_range_elements( hwtnl, index_buffer,
+ index_size,
+ min_index,
+ max_index,
+ gen_prim, start, count, bias );
+ }
+ else {
+ struct pipe_buffer *gen_buf = NULL;
+
+ /* Need to allocate a new index buffer and run the translate
+ * func to populate it. Could potentially cache this translated
+ * index buffer with the original to avoid future
+ * re-translations. Not much point if we're just accelerating
+ * GL though, as index buffers are typically used only once
+ * there.
+ */
+ ret = translate_indices( hwtnl,
+ index_buffer,
+ start * index_size,
+ gen_nr,
+ gen_size,
+ gen_func,
+ &gen_buf );
+ if (ret)
+ goto done;
+
+ ret = svga_hwtnl_simple_draw_range_elements( hwtnl,
+ gen_buf,
+ gen_size,
+ min_index,
+ max_index,
+ gen_prim,
+ 0,
+ gen_nr,
+ bias );
+ if (ret)
+ goto done;
+
+ done:
+ if (gen_buf)
+ pipe_buffer_reference( &gen_buf, NULL );
+
+ return ret;
+ }
+}
+
+
+
+
+
diff --git a/src/gallium/drivers/svga/svga_draw_private.h b/src/gallium/drivers/svga/svga_draw_private.h
new file mode 100644
index 0000000000..9aa40e1664
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_draw_private.h
@@ -0,0 +1,158 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_DRAW_H_
+#define SVGA_DRAW_H_
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
+#include "indices/u_indices.h"
+#include "svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+struct svga_context;
+struct u_upload_mgr;
+
+/* Should include polygon?
+ */
+static const unsigned svga_hw_prims =
+ ((1 << PIPE_PRIM_POINTS) |
+ (1 << PIPE_PRIM_LINES) |
+ (1 << PIPE_PRIM_LINE_STRIP) |
+ (1 << PIPE_PRIM_TRIANGLES) |
+ (1 << PIPE_PRIM_TRIANGLE_STRIP) |
+ (1 << PIPE_PRIM_TRIANGLE_FAN));
+
+
+static INLINE unsigned svga_translate_prim(unsigned mode,
+ unsigned count,
+ unsigned *out_count)
+{
+ switch (mode) {
+ case PIPE_PRIM_POINTS:
+ *out_count = count;
+ return SVGA3D_PRIMITIVE_POINTLIST;
+
+ case PIPE_PRIM_LINES:
+ *out_count = count / 2;
+ return SVGA3D_PRIMITIVE_LINELIST;
+
+ case PIPE_PRIM_LINE_STRIP:
+ *out_count = count - 1;
+ return SVGA3D_PRIMITIVE_LINESTRIP;
+
+ case PIPE_PRIM_TRIANGLES:
+ *out_count = count / 3;
+ return SVGA3D_PRIMITIVE_TRIANGLELIST;
+
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ *out_count = count - 2;
+ return SVGA3D_PRIMITIVE_TRIANGLESTRIP;
+
+ case PIPE_PRIM_TRIANGLE_FAN:
+ *out_count = count - 2;
+ return SVGA3D_PRIMITIVE_TRIANGLEFAN;
+
+ default:
+ assert(0);
+ *out_count = 0;
+ return 0;
+ }
+}
+
+
+struct index_cache {
+ u_generate_func generate;
+ unsigned gen_nr;
+
+ /* If non-null, this buffer is filled by calling
+ * generate(nr, map(buffer))
+ */
+ struct pipe_buffer *buffer;
+};
+
+#define QSZ 32
+
+struct draw_cmd {
+ struct svga_winsys_context *swc;
+
+ SVGA3dVertexDecl vdecl[SVGA3D_INPUTREG_MAX];
+ struct pipe_buffer *vdecl_vb[SVGA3D_INPUTREG_MAX];
+ unsigned vdecl_count;
+
+ SVGA3dPrimitiveRange prim[QSZ];
+ struct pipe_buffer *prim_ib[QSZ];
+ unsigned prim_count;
+ unsigned min_index[QSZ];
+ unsigned max_index[QSZ];
+};
+
+#define IDX_CACHE_MAX 8
+
+struct svga_hwtnl {
+ struct svga_context *svga;
+ struct u_upload_mgr *upload_ib;
+
+ /* Flatshade information:
+ */
+ unsigned api_pv;
+ unsigned hw_pv;
+ unsigned api_fillmode;
+
+ /* Cache the results of running a particular generate func on each
+ * primitive type.
+ */
+ struct index_cache index_cache[PIPE_PRIM_MAX][IDX_CACHE_MAX];
+
+ /* Try to build the maximal draw command packet before emitting:
+ */
+ struct draw_cmd cmd;
+};
+
+
+
+/***********************************************************************
+ * Internal functions
+ */
+enum pipe_error
+svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
+ const SVGA3dPrimitiveRange *range,
+ unsigned min_index,
+ unsigned max_index,
+ struct pipe_buffer *ib );
+
+enum pipe_error
+svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
+ struct pipe_buffer *indexBuffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim,
+ unsigned start,
+ unsigned count,
+ unsigned bias );
+
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_hw_reg.h b/src/gallium/drivers/svga/svga_hw_reg.h
new file mode 100644
index 0000000000..183f4b918e
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_hw_reg.h
@@ -0,0 +1,42 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_HW_REG_H
+#define SVGA_HW_REG_H
+
+#include "pipe/p_compiler.h"
+
+#if defined(PIPE_CC_GCC)
+#ifndef HAVE_STDINT_H
+#define HAVE_STDINT_H
+#endif
+#endif
+
+#include "svga_types.h"
+
+#include "svga3d_reg.h"
+
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c
new file mode 100644
index 0000000000..855d228755
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -0,0 +1,246 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+
+#include "svga_hw_reg.h"
+
+
+static INLINE unsigned
+svga_translate_blend_factor(unsigned factor)
+{
+ switch (factor) {
+ case PIPE_BLENDFACTOR_ZERO: return SVGA3D_BLENDOP_ZERO;
+ case PIPE_BLENDFACTOR_SRC_ALPHA: return SVGA3D_BLENDOP_SRCALPHA;
+ case PIPE_BLENDFACTOR_ONE: return SVGA3D_BLENDOP_ONE;
+ case PIPE_BLENDFACTOR_SRC_COLOR: return SVGA3D_BLENDOP_SRCCOLOR;
+ case PIPE_BLENDFACTOR_INV_SRC_COLOR: return SVGA3D_BLENDOP_INVSRCCOLOR;
+ case PIPE_BLENDFACTOR_DST_COLOR: return SVGA3D_BLENDOP_DESTCOLOR;
+ case PIPE_BLENDFACTOR_INV_DST_COLOR: return SVGA3D_BLENDOP_INVDESTCOLOR;
+ case PIPE_BLENDFACTOR_INV_SRC_ALPHA: return SVGA3D_BLENDOP_INVSRCALPHA;
+ case PIPE_BLENDFACTOR_DST_ALPHA: return SVGA3D_BLENDOP_DESTALPHA;
+ case PIPE_BLENDFACTOR_INV_DST_ALPHA: return SVGA3D_BLENDOP_INVDESTALPHA;
+ case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: return SVGA3D_BLENDOP_SRCALPHASAT;
+ case PIPE_BLENDFACTOR_CONST_COLOR: return SVGA3D_BLENDOP_BLENDFACTOR;
+ case PIPE_BLENDFACTOR_INV_CONST_COLOR: return SVGA3D_BLENDOP_INVBLENDFACTOR;
+ case PIPE_BLENDFACTOR_CONST_ALPHA: return SVGA3D_BLENDOP_BLENDFACTOR; /* ? */
+ case PIPE_BLENDFACTOR_INV_CONST_ALPHA: return SVGA3D_BLENDOP_INVBLENDFACTOR; /* ? */
+ default:
+ assert(0);
+ return SVGA3D_BLENDOP_ZERO;
+ }
+}
+
+static INLINE unsigned
+svga_translate_blend_func(unsigned mode)
+{
+ switch (mode) {
+ case PIPE_BLEND_ADD: return SVGA3D_BLENDEQ_ADD;
+ case PIPE_BLEND_SUBTRACT: return SVGA3D_BLENDEQ_SUBTRACT;
+ case PIPE_BLEND_REVERSE_SUBTRACT: return SVGA3D_BLENDEQ_REVSUBTRACT;
+ case PIPE_BLEND_MIN: return SVGA3D_BLENDEQ_MINIMUM;
+ case PIPE_BLEND_MAX: return SVGA3D_BLENDEQ_MAXIMUM;
+ default:
+ assert(0);
+ return SVGA3D_BLENDEQ_ADD;
+ }
+}
+
+
+static void *
+svga_create_blend_state(struct pipe_context *pipe,
+ const struct pipe_blend_state *templ)
+{
+ struct svga_blend_state *blend = CALLOC_STRUCT( svga_blend_state );
+ unsigned i;
+
+
+ /* Fill in the per-rendertarget blend state. We currently only
+ * have one rendertarget.
+ */
+ for (i = 0; i < 1; i++) {
+ /* No way to set this in SVGA3D, and no way to correctly implement it on
+ * top of D3D9 API. Instead we try to simulate with various blend modes.
+ */
+ if (templ->logicop_enable) {
+ switch (templ->logicop_func) {
+ case PIPE_LOGICOP_XOR:
+ blend->need_white_fragments = TRUE;
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_ONE;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_ONE;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_SUBTRACT;
+ break;
+ case PIPE_LOGICOP_CLEAR:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_ZERO;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM;
+ break;
+ case PIPE_LOGICOP_COPY:
+ blend->rt[i].blend_enable = FALSE;
+ break;
+ case PIPE_LOGICOP_COPY_INVERTED:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD;
+ break;
+ case PIPE_LOGICOP_NOOP:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_ZERO;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD;
+ break;
+ case PIPE_LOGICOP_SET:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_ONE;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_ONE;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM;
+ break;
+ case PIPE_LOGICOP_INVERT:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD;
+ break;
+ case PIPE_LOGICOP_AND:
+ /* Approximate with minimum - works for the 0 & anything case: */
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM;
+ break;
+ case PIPE_LOGICOP_AND_REVERSE:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_INVDESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM;
+ break;
+ case PIPE_LOGICOP_AND_INVERTED:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM;
+ break;
+ case PIPE_LOGICOP_OR:
+ /* Approximate with maximum - works for the 1 | anything case: */
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM;
+ break;
+ case PIPE_LOGICOP_OR_REVERSE:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_INVDESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM;
+ break;
+ case PIPE_LOGICOP_OR_INVERTED:
+ blend->rt[i].blend_enable = TRUE;
+ blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR;
+ blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR;
+ blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM;
+ break;
+ case PIPE_LOGICOP_NAND:
+ case PIPE_LOGICOP_NOR:
+ case PIPE_LOGICOP_EQUIV:
+ /* Fill these in with plausible values */
+ blend->rt[i].blend_enable = FALSE;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ }
+ else {
+ blend->rt[i].blend_enable = templ->blend_enable;
+
+ if (templ->blend_enable) {
+ blend->rt[i].srcblend = svga_translate_blend_factor(templ->rgb_src_factor);
+ blend->rt[i].dstblend = svga_translate_blend_factor(templ->rgb_dst_factor);
+ blend->rt[i].blendeq = svga_translate_blend_func(templ->rgb_func);
+ blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->alpha_src_factor);
+ blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->alpha_dst_factor);
+ blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->alpha_func);
+
+ if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend ||
+ blend->rt[i].dstblend_alpha != blend->rt[i].dstblend ||
+ blend->rt[i].blendeq_alpha != blend->rt[i].blendeq)
+ {
+ blend->rt[i].separate_alpha_blend_enable = TRUE;
+ }
+ }
+ }
+
+ blend->rt[i].writemask = templ->colormask;
+ }
+
+ return blend;
+}
+
+static void svga_bind_blend_state(struct pipe_context *pipe,
+ void *blend)
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.blend = (struct svga_blend_state*)blend;
+ svga->dirty |= SVGA_NEW_BLEND;
+}
+
+
+static void svga_delete_blend_state(struct pipe_context *pipe, void *blend)
+{
+ FREE(blend);
+}
+
+static void svga_set_blend_color( struct pipe_context *pipe,
+ const struct pipe_blend_color *blend_color )
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.blend_color = *blend_color;
+
+ svga->dirty |= SVGA_NEW_BLEND;
+}
+
+
+void svga_init_blend_functions( struct svga_context *svga )
+{
+ svga->pipe.create_blend_state = svga_create_blend_state;
+ svga->pipe.bind_blend_state = svga_bind_blend_state;
+ svga->pipe.delete_blend_state = svga_delete_blend_state;
+
+ svga->pipe.set_blend_color = svga_set_blend_color;
+}
+
+
+
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
new file mode 100644
index 0000000000..5a4a8c0f5f
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -0,0 +1,84 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_screen_texture.h"
+#include "svga_context.h"
+#include "svga_cmd.h"
+
+#define FILE_DEBUG_FLAG DEBUG_BLIT
+
+
+static void svga_surface_copy(struct pipe_context *pipe,
+ struct pipe_surface *dest,
+ unsigned destx, unsigned desty,
+ struct pipe_surface *src,
+ unsigned srcx, unsigned srcy,
+ unsigned width, unsigned height)
+{
+ struct svga_context *svga = svga_context(pipe);
+ SVGA3dCopyBox *box;
+ enum pipe_error ret;
+
+ svga_hwtnl_flush_retry( svga );
+
+ ret = SVGA3D_BeginSurfaceCopy(svga->swc,
+ src,
+ dest,
+ &box,
+ 1);
+ if(ret != PIPE_OK) {
+
+ svga_context_flush(svga, NULL);
+
+ ret = SVGA3D_BeginSurfaceCopy(svga->swc,
+ src,
+ dest,
+ &box,
+ 1);
+ assert(ret == PIPE_OK);
+ }
+
+ box->x = destx;
+ box->y = desty;
+ box->z = 0;
+ box->w = width;
+ box->h = height;
+ box->d = 1;
+ box->srcx = srcx;
+ box->srcy = srcy;
+ box->srcz = 0;
+
+ SVGA_FIFOCommitAll(svga->swc);
+
+ svga_surface(dest)->dirty = TRUE;
+ svga_propagate_surface(pipe, dest);
+}
+
+
+void
+svga_init_blit_functions(struct svga_context *svga)
+{
+ svga->pipe.surface_copy = svga_surface_copy;
+}
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
new file mode 100644
index 0000000000..8977d26541
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -0,0 +1,119 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_defines.h"
+#include "util/u_pack_color.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+
+
+static enum pipe_error
+try_clear(struct svga_context *svga,
+ unsigned buffers,
+ const float *rgba,
+ double depth,
+ unsigned stencil)
+{
+ int ret = PIPE_OK;
+ SVGA3dRect rect = { 0, 0, 0, 0 };
+ boolean restore_viewport = FALSE;
+ SVGA3dClearFlag flags = 0;
+ struct pipe_framebuffer_state *fb = &svga->curr.framebuffer;
+ unsigned color = 0;
+
+ ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR);
+ if (ret)
+ return ret;
+
+ if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) {
+ flags |= SVGA3D_CLEAR_COLOR;
+ util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &color);
+
+ rect.w = fb->cbufs[0]->width;
+ rect.h = fb->cbufs[0]->height;
+ }
+
+ if ((buffers & PIPE_CLEAR_DEPTHSTENCIL) && fb->zsbuf) {
+ flags |= SVGA3D_CLEAR_DEPTH;
+
+ if (svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_Z24S8_UNORM)
+ flags |= SVGA3D_CLEAR_STENCIL;
+
+ rect.w = MAX2(rect.w, fb->zsbuf->width);
+ rect.h = MAX2(rect.h, fb->zsbuf->height);
+ }
+
+ if (memcmp(&rect, &svga->state.hw_clear.viewport, sizeof(rect)) != 0) {
+ restore_viewport = TRUE;
+ ret = SVGA3D_SetViewport(svga->swc, &rect);
+ if (ret)
+ return ret;
+ }
+
+ ret = SVGA3D_ClearRect(svga->swc, flags, color, depth, stencil,
+ rect.x, rect.y, rect.w, rect.h);
+ if (ret != PIPE_OK)
+ return ret;
+
+ if (restore_viewport) {
+ memcpy(&rect, &svga->state.hw_clear.viewport, sizeof rect);
+ ret = SVGA3D_SetViewport(svga->swc, &rect);
+ }
+
+ return ret;
+}
+
+/**
+ * Clear the given surface to the specified value.
+ * No masking, no scissor (clear entire buffer).
+ */
+void
+svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+ double depth, unsigned stencil)
+{
+ struct svga_context *svga = svga_context( pipe );
+ int ret;
+
+ ret = try_clear( svga, buffers, rgba, depth, stencil );
+
+ if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
+ /* Flush command buffer and retry:
+ */
+ svga_context_flush( svga, NULL );
+
+ ret = try_clear( svga, buffers, rgba, depth, stencil );
+ }
+
+ /*
+ * Mark target surfaces as dirty
+ * TODO Mark only cleared surfaces.
+ */
+ svga_mark_surfaces_dirty(svga);
+
+ assert (ret == PIPE_OK);
+}
diff --git a/src/gallium/drivers/svga/svga_pipe_constants.c b/src/gallium/drivers/svga/svga_pipe_constants.c
new file mode 100644
index 0000000000..10e7a12189
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_constants.c
@@ -0,0 +1,74 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_parse.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_hw_reg.h"
+#include "svga_cmd.h"
+
+/***********************************************************************
+ * Constant buffers
+ */
+
+struct svga_constbuf
+{
+ unsigned type;
+ float (*data)[4];
+ unsigned count;
+};
+
+
+
+static void svga_set_constant_buffer(struct pipe_context *pipe,
+ uint shader, uint index,
+ const struct pipe_constant_buffer *buf)
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ assert(shader < PIPE_SHADER_TYPES);
+ assert(index == 0);
+
+ pipe_buffer_reference( &svga->curr.cb[shader],
+ buf->buffer );
+
+ if (shader == PIPE_SHADER_FRAGMENT)
+ svga->dirty |= SVGA_NEW_FS_CONST_BUFFER;
+ else
+ svga->dirty |= SVGA_NEW_VS_CONST_BUFFER;
+}
+
+
+
+void svga_init_constbuffer_functions( struct svga_context *svga )
+{
+ svga->pipe.set_constant_buffer = svga_set_constant_buffer;
+}
+
diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
new file mode 100644
index 0000000000..df636c08a0
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -0,0 +1,153 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_hw_reg.h"
+
+
+static INLINE unsigned
+svga_translate_compare_func(unsigned func)
+{
+ switch (func) {
+ case PIPE_FUNC_NEVER: return SVGA3D_CMP_NEVER;
+ case PIPE_FUNC_LESS: return SVGA3D_CMP_LESS;
+ case PIPE_FUNC_LEQUAL: return SVGA3D_CMP_LESSEQUAL;
+ case PIPE_FUNC_GREATER: return SVGA3D_CMP_GREATER;
+ case PIPE_FUNC_GEQUAL: return SVGA3D_CMP_GREATEREQUAL;
+ case PIPE_FUNC_NOTEQUAL: return SVGA3D_CMP_NOTEQUAL;
+ case PIPE_FUNC_EQUAL: return SVGA3D_CMP_EQUAL;
+ case PIPE_FUNC_ALWAYS: return SVGA3D_CMP_ALWAYS;
+ default:
+ assert(0);
+ return SVGA3D_CMP_ALWAYS;
+ }
+}
+
+static INLINE unsigned
+svga_translate_stencil_op(unsigned op)
+{
+ switch (op) {
+ case PIPE_STENCIL_OP_KEEP: return SVGA3D_STENCILOP_KEEP;
+ case PIPE_STENCIL_OP_ZERO: return SVGA3D_STENCILOP_ZERO;
+ case PIPE_STENCIL_OP_REPLACE: return SVGA3D_STENCILOP_REPLACE;
+ case PIPE_STENCIL_OP_INCR: return SVGA3D_STENCILOP_INCR;
+ case PIPE_STENCIL_OP_DECR: return SVGA3D_STENCILOP_DECR;
+ case PIPE_STENCIL_OP_INCR_WRAP: return SVGA3D_STENCILOP_INCRSAT; /* incorrect? */
+ case PIPE_STENCIL_OP_DECR_WRAP: return SVGA3D_STENCILOP_DECRSAT; /* incorrect? */
+ case PIPE_STENCIL_OP_INVERT: return SVGA3D_STENCILOP_INVERT;
+ default:
+ assert(0);
+ return SVGA3D_STENCILOP_KEEP;
+ }
+}
+
+
+static void *
+svga_create_depth_stencil_state(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_alpha_state *templ)
+{
+ struct svga_depth_stencil_state *ds = CALLOC_STRUCT( svga_depth_stencil_state );
+
+ /* Don't try to figure out CW/CCW correspondence with
+ * stencil[0]/[1] at this point. Presumably this can change as
+ * back/front face are modified.
+ */
+ ds->stencil[0].enabled = templ->stencil[0].enabled;
+ if (ds->stencil[0].enabled) {
+ ds->stencil[0].func = svga_translate_compare_func(templ->stencil[0].func);
+ ds->stencil[0].fail = svga_translate_stencil_op(templ->stencil[0].fail_op);
+ ds->stencil[0].zfail = svga_translate_stencil_op(templ->stencil[0].zfail_op);
+ ds->stencil[0].pass = svga_translate_stencil_op(templ->stencil[0].zpass_op);
+
+ /* SVGA3D has one ref/mask/writemask triple shared between front &
+ * back face stencil. We really need two:
+ */
+ ds->stencil_ref = templ->stencil[0].ref_value & 0xff;
+ ds->stencil_mask = templ->stencil[0].valuemask & 0xff;
+ ds->stencil_writemask = templ->stencil[0].writemask & 0xff;
+ }
+
+
+ ds->stencil[1].enabled = templ->stencil[1].enabled;
+ if (templ->stencil[1].enabled) {
+ ds->stencil[1].func = svga_translate_compare_func(templ->stencil[1].func);
+ ds->stencil[1].fail = svga_translate_stencil_op(templ->stencil[1].fail_op);
+ ds->stencil[1].zfail = svga_translate_stencil_op(templ->stencil[1].zfail_op);
+ ds->stencil[1].pass = svga_translate_stencil_op(templ->stencil[1].zpass_op);
+
+ ds->stencil_ref = templ->stencil[1].ref_value & 0xff;
+ ds->stencil_mask = templ->stencil[1].valuemask & 0xff;
+ ds->stencil_writemask = templ->stencil[1].writemask & 0xff;
+ }
+
+
+ ds->zenable = templ->depth.enabled;
+ if (ds->zenable) {
+ ds->zfunc = svga_translate_compare_func(templ->depth.func);
+ ds->zwriteenable = templ->depth.writemask;
+ }
+
+ ds->alphatestenable = templ->alpha.enabled;
+ if (ds->alphatestenable) {
+ ds->alphafunc = svga_translate_compare_func(templ->alpha.func);
+ ds->alpharef = templ->alpha.ref_value;
+ }
+
+ return ds;
+}
+
+static void svga_bind_depth_stencil_state(struct pipe_context *pipe,
+ void *depth_stencil)
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.depth = (const struct svga_depth_stencil_state *)depth_stencil;
+ svga->dirty |= SVGA_NEW_DEPTH_STENCIL;
+}
+
+static void svga_delete_depth_stencil_state(struct pipe_context *pipe,
+ void *depth_stencil)
+{
+ FREE(depth_stencil);
+}
+
+
+
+void svga_init_depth_stencil_functions( struct svga_context *svga )
+{
+ svga->pipe.create_depth_stencil_alpha_state = svga_create_depth_stencil_state;
+ svga->pipe.bind_depth_stencil_alpha_state = svga_bind_depth_stencil_state;
+ svga->pipe.delete_depth_stencil_alpha_state = svga_delete_depth_stencil_state;
+}
+
+
+
+
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
new file mode 100644
index 0000000000..71a552862e
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -0,0 +1,261 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_inlines.h"
+#include "util/u_prim.h"
+#include "util/u_time.h"
+#include "indices/u_indices.h"
+
+#include "svga_hw_reg.h"
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_winsys.h"
+#include "svga_draw.h"
+#include "svga_state.h"
+#include "svga_swtnl.h"
+#include "svga_debug.h"
+
+
+
+static enum pipe_error
+retry_draw_range_elements( struct svga_context *svga,
+ struct pipe_buffer *index_buffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim,
+ unsigned start,
+ unsigned count,
+ boolean do_retry )
+{
+ enum pipe_error ret = 0;
+
+ svga_hwtnl_set_unfilled( svga->hwtnl,
+ svga->curr.rast->hw_unfilled );
+
+ svga_hwtnl_set_flatshade( svga->hwtnl,
+ svga->curr.rast->templ.flatshade,
+ svga->curr.rast->templ.flatshade_first );
+
+
+ ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
+ if (ret)
+ goto retry;
+
+ ret = svga_hwtnl_draw_range_elements( svga->hwtnl,
+ index_buffer, index_size,
+ min_index, max_index,
+ prim, start, count, 0 );
+ if (ret)
+ goto retry;
+
+ if (svga->curr.any_user_vertex_buffers) {
+ ret = svga_hwtnl_flush( svga->hwtnl );
+ if (ret)
+ goto retry;
+ }
+
+ return PIPE_OK;
+
+retry:
+ svga_context_flush( svga, NULL );
+
+ if (do_retry)
+ {
+ return retry_draw_range_elements( svga,
+ index_buffer, index_size,
+ min_index, max_index,
+ prim, start, count,
+ FALSE );
+ }
+
+ return ret;
+}
+
+
+static enum pipe_error
+retry_draw_arrays( struct svga_context *svga,
+ unsigned prim,
+ unsigned start,
+ unsigned count,
+ boolean do_retry )
+{
+ enum pipe_error ret;
+
+ svga_hwtnl_set_unfilled( svga->hwtnl,
+ svga->curr.rast->hw_unfilled );
+
+ svga_hwtnl_set_flatshade( svga->hwtnl,
+ svga->curr.rast->templ.flatshade,
+ svga->curr.rast->templ.flatshade_first );
+
+ ret = svga_update_state( svga, SVGA_STATE_HW_DRAW );
+ if (ret)
+ goto retry;
+
+ ret = svga_hwtnl_draw_arrays( svga->hwtnl, prim,
+ start, count );
+ if (ret)
+ goto retry;
+
+ if (svga->curr.any_user_vertex_buffers) {
+ ret = svga_hwtnl_flush( svga->hwtnl );
+ if (ret)
+ goto retry;
+ }
+
+ return 0;
+
+retry:
+ if (ret == PIPE_ERROR_OUT_OF_MEMORY && do_retry)
+ {
+ svga_context_flush( svga, NULL );
+
+ return retry_draw_arrays( svga,
+ prim,
+ start,
+ count,
+ FALSE );
+ }
+
+ return ret;
+}
+
+
+
+
+
+static boolean
+svga_draw_range_elements( struct pipe_context *pipe,
+ struct pipe_buffer *index_buffer,
+ unsigned index_size,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim, unsigned start, unsigned count)
+{
+ struct svga_context *svga = svga_context( pipe );
+ unsigned reduced_prim = u_reduced_prim(prim);
+ enum pipe_error ret = 0;
+
+ if (!u_trim_pipe_prim( prim, &count ))
+ return TRUE;
+
+ /*
+ * Mark currently bound target surfaces as dirty
+ * doesn't really matter if it is done before drawing.
+ *
+ * TODO If we ever normaly return something other then
+ * true we should not mark it as dirty then.
+ */
+ svga_mark_surfaces_dirty(svga_context(pipe));
+
+ if (svga->curr.reduced_prim != reduced_prim) {
+ svga->curr.reduced_prim = reduced_prim;
+ svga->dirty |= SVGA_NEW_REDUCED_PRIMITIVE;
+ }
+
+ svga_update_state_retry( svga, SVGA_STATE_NEED_SWTNL );
+
+#ifdef DEBUG
+ if (svga->curr.vs->base.id == svga->debug.disable_shader ||
+ svga->curr.fs->base.id == svga->debug.disable_shader)
+ return 0;
+#endif
+
+ if (svga->state.sw.need_swtnl)
+ {
+ ret = svga_swtnl_draw_range_elements( svga,
+ index_buffer,
+ index_size,
+ min_index, max_index,
+ prim,
+ start, count );
+ }
+ else {
+ if (index_buffer) {
+ ret = retry_draw_range_elements( svga,
+ index_buffer,
+ index_size,
+ min_index,
+ max_index,
+ prim,
+ start,
+ count,
+ TRUE );
+ }
+ else {
+ ret = retry_draw_arrays( svga,
+ prim,
+ start,
+ count,
+ TRUE );
+ }
+ }
+
+ if (SVGA_DEBUG & DEBUG_FLUSH) {
+ static unsigned id;
+ debug_printf("%s %d\n", __FUNCTION__, id++);
+ if (id > 1300)
+ util_time_sleep( 2000 );
+
+ svga_hwtnl_flush_retry( svga );
+ svga_context_flush(svga, NULL);
+ }
+
+ return ret == PIPE_OK;
+}
+
+
+static boolean
+svga_draw_elements( struct pipe_context *pipe,
+ struct pipe_buffer *index_buffer,
+ unsigned index_size,
+ unsigned prim, unsigned start, unsigned count)
+{
+ return svga_draw_range_elements( pipe, index_buffer,
+ index_size,
+ 0, 0xffffffff,
+ prim, start, count );
+}
+
+static boolean
+svga_draw_arrays( struct pipe_context *pipe,
+ unsigned prim, unsigned start, unsigned count)
+{
+ return svga_draw_range_elements(pipe, NULL, 0,
+ start, start + count - 1,
+ prim,
+ start, count);
+}
+
+
+void svga_init_draw_functions( struct svga_context *svga )
+{
+ svga->pipe.draw_arrays = svga_draw_arrays;
+ svga->pipe.draw_elements = svga_draw_elements;
+ svga->pipe.draw_range_elements = svga_draw_range_elements;
+}
diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c
new file mode 100644
index 0000000000..942366de72
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_flush.c
@@ -0,0 +1,68 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_defines.h"
+#include "svga_screen.h"
+#include "svga_screen_texture.h"
+#include "svga_context.h"
+#include "svga_winsys.h"
+#include "svga_draw.h"
+#include "svga_debug.h"
+
+#include "svga_hw_reg.h"
+
+
+
+
+static void svga_flush( struct pipe_context *pipe,
+ unsigned flags,
+ struct pipe_fence_handle **fence )
+{
+ struct svga_context *svga = svga_context(pipe);
+ int i;
+
+ /* Emit buffered drawing commands.
+ */
+ svga_hwtnl_flush_retry( svga );
+
+ /* Emit back-copy from render target view to texture.
+ */
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ if (svga->curr.framebuffer.cbufs[i])
+ svga_propagate_surface(pipe, svga->curr.framebuffer.cbufs[i]);
+ }
+ if (svga->curr.framebuffer.zsbuf)
+ svga_propagate_surface(pipe, svga->curr.framebuffer.zsbuf);
+
+ /* Flush command queue.
+ */
+ svga_context_flush(svga, fence);
+}
+
+
+void svga_init_flush_functions( struct svga_context *svga )
+{
+ svga->pipe.flush = svga_flush;
+}
diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c b/src/gallium/drivers/svga/svga_pipe_fs.c
new file mode 100644
index 0000000000..e3be840d92
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -0,0 +1,124 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_text.h"
+
+#include "svga_screen.h"
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_tgsi.h"
+#include "svga_hw_reg.h"
+#include "svga_cmd.h"
+#include "svga_draw.h"
+#include "svga_debug.h"
+
+
+/***********************************************************************
+ * Fragment shaders
+ */
+
+static void *
+svga_create_fs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_screen *svgascreen = svga_screen(pipe->screen);
+ struct svga_fragment_shader *fs;
+
+ fs = CALLOC_STRUCT(svga_fragment_shader);
+ if (!fs)
+ return NULL;
+
+ fs->base.tokens = tgsi_dup_tokens(templ->tokens);
+
+ /* Collect basic info that we'll need later:
+ */
+ tgsi_scan_shader(fs->base.tokens, &fs->base.info);
+
+ fs->base.id = svga->debug.shader_id++;
+ fs->base.use_sm30 = svgascreen->use_ps30;
+
+ if (SVGA_DEBUG & DEBUG_TGSI || 0) {
+ debug_printf("%s id: %u, inputs: %u, outputs: %u\n",
+ __FUNCTION__, fs->base.id,
+ fs->base.info.num_inputs, fs->base.info.num_outputs);
+ }
+
+ return fs;
+}
+
+static void
+svga_bind_fs_state(struct pipe_context *pipe, void *shader)
+{
+ struct svga_fragment_shader *fs = (struct svga_fragment_shader *) shader;
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.fs = fs;
+ svga->dirty |= SVGA_NEW_FS;
+}
+
+static
+void svga_delete_fs_state(struct pipe_context *pipe, void *shader)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_fragment_shader *fs = (struct svga_fragment_shader *) shader;
+ struct svga_shader_result *result, *tmp;
+ enum pipe_error ret;
+
+ svga_hwtnl_flush_retry( svga );
+
+ for (result = fs->base.results; result; result = tmp ) {
+ tmp = result->next;
+
+ ret = SVGA3D_DestroyShader(svga->swc,
+ result->id,
+ SVGA3D_SHADERTYPE_PS );
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_DestroyShader(svga->swc,
+ result->id,
+ SVGA3D_SHADERTYPE_PS );
+ assert(ret == PIPE_OK);
+ }
+
+ svga_destroy_shader_result( result );
+ }
+
+ FREE((void *)fs->base.tokens);
+ FREE(fs);
+}
+
+
+void svga_init_fs_functions( struct svga_context *svga )
+{
+ svga->pipe.create_fs_state = svga_create_fs_state;
+ svga->pipe.bind_fs_state = svga_bind_fs_state;
+ svga->pipe.delete_fs_state = svga_delete_fs_state;
+}
+
diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
new file mode 100644
index 0000000000..58cb1e6e23
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -0,0 +1,187 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "svga_context.h"
+#include "svga_screen_texture.h"
+#include "svga_state.h"
+#include "svga_winsys.h"
+
+#include "svga_hw_reg.h"
+
+
+
+
+static void svga_set_scissor_state( struct pipe_context *pipe,
+ const struct pipe_scissor_state *scissor )
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ memcpy( &svga->curr.scissor, scissor, sizeof(*scissor) );
+ svga->dirty |= SVGA_NEW_SCISSOR;
+}
+
+
+static void svga_set_polygon_stipple( struct pipe_context *pipe,
+ const struct pipe_poly_stipple *stipple )
+{
+ /* overridden by the draw module */
+}
+
+
+void svga_cleanup_framebuffer(struct svga_context *svga)
+{
+ struct pipe_framebuffer_state *curr = &svga->curr.framebuffer;
+ struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
+ int i;
+
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ pipe_surface_reference(&curr->cbufs[i], NULL);
+ pipe_surface_reference(&hw->cbufs[i], NULL);
+ }
+
+ pipe_surface_reference(&curr->zsbuf, NULL);
+ pipe_surface_reference(&hw->zsbuf, NULL);
+}
+
+
+#define DEPTH_BIAS_SCALE_FACTOR_D16 ((float)(1<<15))
+#define DEPTH_BIAS_SCALE_FACTOR_D24S8 ((float)(1<<23))
+#define DEPTH_BIAS_SCALE_FACTOR_D32 ((float)(1<<31))
+
+
+static void svga_set_framebuffer_state(struct pipe_context *pipe,
+ const struct pipe_framebuffer_state *fb)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct pipe_framebuffer_state *dst = &svga->curr.framebuffer;
+ boolean propagate = FALSE;
+ int i;
+
+ dst->width = fb->width;
+ dst->height = fb->height;
+ dst->nr_cbufs = fb->nr_cbufs;
+
+ /* check if we need to propaget any of the target surfaces */
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i])
+ if (svga_surface_needs_propagation(dst->cbufs[i]))
+ propagate = TRUE;
+ }
+
+ if (propagate) {
+ /* make sure that drawing calls comes before propagation calls */
+ svga_hwtnl_flush_retry( svga );
+
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
+ if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i])
+ svga_propagate_surface(pipe, dst->cbufs[i]);
+ }
+
+ /* XXX: Actually the virtual hardware may support rendertargets with
+ * different size, depending on the host API and driver, but since we cannot
+ * know that make no such assumption here. */
+ for(i = 0; i < fb->nr_cbufs; ++i) {
+ if (fb->zsbuf && fb->cbufs[i]) {
+ assert(fb->zsbuf->width == fb->cbufs[i]->width);
+ assert(fb->zsbuf->height == fb->cbufs[i]->height);
+ }
+ }
+
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
+ pipe_surface_reference(&dst->cbufs[i], fb->cbufs[i]);
+ pipe_surface_reference(&dst->zsbuf, fb->zsbuf);
+
+
+ if (svga->curr.framebuffer.zsbuf)
+ {
+ switch (svga->curr.framebuffer.zsbuf->format) {
+ case PIPE_FORMAT_Z16_UNORM:
+ svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D16;
+ break;
+ case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D24S8;
+ break;
+ case PIPE_FORMAT_Z32_UNORM:
+ svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D32;
+ break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ svga->curr.depthscale = 1.0f / ((float)(1<<23));
+ break;
+ default:
+ svga->curr.depthscale = 0.0f;
+ break;
+ }
+ }
+ else {
+ svga->curr.depthscale = 0.0f;
+ }
+
+ svga->dirty |= SVGA_NEW_FRAME_BUFFER;
+}
+
+
+
+static void svga_set_clip_state( struct pipe_context *pipe,
+ const struct pipe_clip_state *clip )
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.clip = *clip; /* struct copy */
+
+ svga->dirty |= SVGA_NEW_CLIP;
+}
+
+
+
+/* Called when driver state tracker notices changes to the viewport
+ * matrix:
+ */
+static void svga_set_viewport_state( struct pipe_context *pipe,
+ const struct pipe_viewport_state *viewport )
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.viewport = *viewport; /* struct copy */
+
+ svga->dirty |= SVGA_NEW_VIEWPORT;
+}
+
+
+
+void svga_init_misc_functions( struct svga_context *svga )
+{
+ svga->pipe.set_scissor_state = svga_set_scissor_state;
+ svga->pipe.set_polygon_stipple = svga_set_polygon_stipple;
+ svga->pipe.set_framebuffer_state = svga_set_framebuffer_state;
+ svga->pipe.set_clip_state = svga_set_clip_state;
+ svga->pipe.set_viewport_state = svga_set_viewport_state;
+}
+
+
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
new file mode 100644
index 0000000000..01336b0a2c
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -0,0 +1,267 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_state.h"
+#include "pipe/p_context.h"
+#include "util/u_memory.h"
+
+#include "svga_cmd.h"
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_screen_buffer.h"
+#include "svga_winsys.h"
+#include "svga_draw.h"
+#include "svga_debug.h"
+
+
+/* Fixme: want a public base class for all pipe structs, even if there
+ * isn't much in them.
+ */
+struct pipe_query {
+ int dummy;
+};
+
+struct svga_query {
+ struct pipe_query base;
+ SVGA3dQueryType type;
+ struct svga_winsys_buffer *hwbuf;
+ volatile SVGA3dQueryResult *queryResult;
+ struct pipe_fence_handle *fence;
+};
+
+/***********************************************************************
+ * Inline conversion functions. These are better-typed than the
+ * macros used previously:
+ */
+static INLINE struct svga_query *
+svga_query( struct pipe_query *q )
+{
+ return (struct svga_query *)q;
+}
+
+static boolean svga_get_query_result(struct pipe_context *pipe,
+ struct pipe_query *q,
+ boolean wait,
+ uint64_t *result);
+
+static struct pipe_query *svga_create_query( struct pipe_context *pipe,
+ unsigned query_type )
+{
+ struct svga_screen *svgascreen = svga_screen(pipe->screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_query *sq;
+
+ SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__);
+
+ sq = CALLOC_STRUCT(svga_query);
+ if (!sq)
+ goto no_sq;
+
+ sq->type = SVGA3D_QUERYTYPE_OCCLUSION;
+
+ sq->hwbuf = svga_winsys_buffer_create(svgascreen,
+ 1,
+ SVGA_BUFFER_USAGE_PINNED,
+ sizeof *sq->queryResult);
+ if(!sq->hwbuf)
+ goto no_hwbuf;
+
+ sq->queryResult = (SVGA3dQueryResult *)sws->buffer_map(sws,
+ sq->hwbuf,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
+ if(!sq->queryResult)
+ goto no_query_result;
+
+ sq->queryResult->totalSize = sizeof *sq->queryResult;
+ sq->queryResult->state = SVGA3D_QUERYSTATE_NEW;
+
+ /*
+ * We request the buffer to be pinned and assume it is always mapped.
+ *
+ * The reason is that we don't want to wait for fences when checking the
+ * query status.
+ */
+ sws->buffer_unmap(sws, sq->hwbuf);
+
+ return &sq->base;
+
+no_query_result:
+ sws->buffer_destroy(sws, sq->hwbuf);
+no_hwbuf:
+ FREE(sq);
+no_sq:
+ return NULL;
+}
+
+static void svga_destroy_query(struct pipe_context *pipe,
+ struct pipe_query *q)
+{
+ struct svga_screen *svgascreen = svga_screen(pipe->screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_query *sq = svga_query( q );
+
+ SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__);
+ sws->buffer_destroy(sws, sq->hwbuf);
+ sws->fence_reference(sws, &sq->fence, NULL);
+ FREE(sq);
+}
+
+static void svga_begin_query(struct pipe_context *pipe,
+ struct pipe_query *q)
+{
+ struct svga_screen *svgascreen = svga_screen(pipe->screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_context *svga = svga_context( pipe );
+ struct svga_query *sq = svga_query( q );
+ enum pipe_error ret;
+
+ SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__);
+
+ assert(!svga->sq);
+
+ /* Need to flush out buffered drawing commands so that they don't
+ * get counted in the query results.
+ */
+ svga_hwtnl_flush_retry(svga);
+
+ if(sq->queryResult->state == SVGA3D_QUERYSTATE_PENDING) {
+ /* The application doesn't care for the pending query result. We cannot
+ * let go the existing buffer and just get a new one because its storage
+ * may be reused for other purposes and clobbered by the host when it
+ * determines the query result. So the only option here is to wait for
+ * the existing query's result -- not a big deal, given that no sane
+ * application would do this.
+ */
+ uint64_t result;
+
+ svga_get_query_result(pipe, q, TRUE, &result);
+
+ assert(sq->queryResult->state != SVGA3D_QUERYSTATE_PENDING);
+ }
+
+ sq->queryResult->state = SVGA3D_QUERYSTATE_NEW;
+ sws->fence_reference(sws, &sq->fence, NULL);
+
+ ret = SVGA3D_BeginQuery(svga->swc, sq->type);
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_BeginQuery(svga->swc, sq->type);
+ assert(ret == PIPE_OK);
+ }
+
+ svga->sq = sq;
+}
+
+static void svga_end_query(struct pipe_context *pipe,
+ struct pipe_query *q)
+{
+ struct svga_context *svga = svga_context( pipe );
+ struct svga_query *sq = svga_query( q );
+ enum pipe_error ret;
+
+ SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__);
+ assert(svga->sq == sq);
+
+ svga_hwtnl_flush_retry(svga);
+
+ /* Set to PENDING before sending EndQuery. */
+ sq->queryResult->state = SVGA3D_QUERYSTATE_PENDING;
+
+ ret = SVGA3D_EndQuery( svga->swc, sq->type, sq->hwbuf);
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_EndQuery( svga->swc, sq->type, sq->hwbuf);
+ assert(ret == PIPE_OK);
+ }
+
+ /* TODO: Delay flushing. We don't really need to flush here, just ensure
+ * that there is one flush before svga_get_query_result attempts to get the
+ * result */
+ svga_context_flush(svga, NULL);
+
+ svga->sq = NULL;
+}
+
+static boolean svga_get_query_result(struct pipe_context *pipe,
+ struct pipe_query *q,
+ boolean wait,
+ uint64_t *result)
+{
+ struct svga_context *svga = svga_context( pipe );
+ struct svga_screen *svgascreen = svga_screen( pipe->screen );
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_query *sq = svga_query( q );
+ SVGA3dQueryState state;
+
+ SVGA_DBG(DEBUG_QUERY, "%s wait: %d\n", __FUNCTION__);
+
+ /* The query status won't be updated by the host unless
+ * SVGA_3D_CMD_WAIT_FOR_QUERY is emitted. Unfortunately this will cause a
+ * synchronous wait on the host */
+ if(!sq->fence) {
+ enum pipe_error ret;
+
+ ret = SVGA3D_WaitForQuery( svga->swc, sq->type, sq->hwbuf);
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_WaitForQuery( svga->swc, sq->type, sq->hwbuf);
+ assert(ret == PIPE_OK);
+ }
+
+ svga_context_flush(svga, &sq->fence);
+
+ assert(sq->fence);
+ }
+
+ state = sq->queryResult->state;
+ if(state == SVGA3D_QUERYSTATE_PENDING) {
+ if(!wait)
+ return FALSE;
+
+ sws->fence_finish(sws, sq->fence, 0);
+
+ state = sq->queryResult->state;
+ }
+
+ assert(state == SVGA3D_QUERYSTATE_SUCCEEDED ||
+ state == SVGA3D_QUERYSTATE_FAILED);
+
+ *result = (uint64_t)sq->queryResult->result32;
+
+ SVGA_DBG(DEBUG_QUERY, "%s result %d\n", __FUNCTION__, (unsigned)*result);
+
+ return TRUE;
+}
+
+
+
+void svga_init_query_functions( struct svga_context *svga )
+{
+ svga->pipe.create_query = svga_create_query;
+ svga->pipe.destroy_query = svga_destroy_query;
+ svga->pipe.begin_query = svga_begin_query;
+ svga->pipe.end_query = svga_end_query;
+ svga->pipe.get_query_result = svga_get_query_result;
+}
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
new file mode 100644
index 0000000000..b03f8eb9cf
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -0,0 +1,250 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "draw/draw_context.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+
+#include "svga_hw_reg.h"
+
+/* Hardware frontwinding is always set up as SVGA3D_FRONTWINDING_CW.
+ */
+static SVGA3dFace svga_translate_cullmode( unsigned mode,
+ unsigned front_winding )
+{
+ switch (mode) {
+ case PIPE_WINDING_NONE:
+ return SVGA3D_FACE_NONE;
+ case PIPE_WINDING_CCW:
+ return SVGA3D_FACE_BACK;
+ case PIPE_WINDING_CW:
+ return SVGA3D_FACE_FRONT;
+ case PIPE_WINDING_BOTH:
+ return SVGA3D_FACE_FRONT_BACK;
+ default:
+ assert(0);
+ return SVGA3D_FACE_NONE;
+ }
+}
+
+static SVGA3dShadeMode svga_translate_flatshade( unsigned mode )
+{
+ return mode ? SVGA3D_SHADEMODE_FLAT : SVGA3D_SHADEMODE_SMOOTH;
+}
+
+
+static void *
+svga_create_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *templ)
+{
+ struct svga_rasterizer_state *rast = CALLOC_STRUCT( svga_rasterizer_state );
+ /* need this for draw module. */
+ rast->templ = *templ;
+
+ /* light_twoside - XXX: need fragment shader varient */
+ /* poly_smooth - XXX: no fallback available */
+ /* poly_stipple_enable - draw module */
+ /* point_sprite - ? */
+ /* point_size_per_vertex - ? */
+ /* sprite_coord_mode - ??? */
+ /* bypass_vs_viewport_and_clip - handled by viewport setup */
+ /* flatshade_first - handled by index translation */
+ /* gl_rasterization_rules - XXX - viewport code */
+ /* line_width - draw module */
+ /* fill_cw, fill_ccw - draw module or index translation */
+
+ rast->shademode = svga_translate_flatshade( templ->flatshade );
+ rast->cullmode = svga_translate_cullmode( templ->cull_mode,
+ templ->front_winding );
+ rast->scissortestenable = templ->scissor;
+ rast->multisampleantialias = templ->multisample;
+ rast->antialiasedlineenable = templ->line_smooth;
+ rast->lastpixel = templ->line_last_pixel;
+ rast->pointsize = templ->point_size;
+ rast->pointsize_min = templ->point_size_min;
+ rast->pointsize_max = templ->point_size_max;
+ rast->hw_unfilled = PIPE_POLYGON_MODE_FILL;
+
+ /* Use swtnl + decomposition implement these:
+ */
+ if (templ->poly_stipple_enable)
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
+
+ if (templ->line_width != 1.0 &&
+ templ->line_width != 0.0)
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_LINES;
+
+ if (templ->line_stipple_enable) {
+ /* LinePattern not implemented on all backends.
+ */
+ if (0) {
+ SVGA3dLinePattern lp;
+ lp.repeat = templ->line_stipple_factor + 1;
+ lp.pattern = templ->line_stipple_pattern;
+ rast->linepattern = lp.uintValue;
+ }
+ else {
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_LINES;
+ }
+ }
+
+ if (templ->point_smooth)
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_POINTS;
+
+ {
+ boolean offset_cw = templ->offset_cw;
+ boolean offset_ccw = templ->offset_ccw;
+ boolean offset = 0;
+ int fill_cw = templ->fill_cw;
+ int fill_ccw = templ->fill_ccw;
+ int fill = PIPE_POLYGON_MODE_FILL;
+
+ switch (templ->cull_mode) {
+ case PIPE_WINDING_BOTH:
+ offset = 0;
+ fill = PIPE_POLYGON_MODE_FILL;
+ break;
+
+ case PIPE_WINDING_CW:
+ offset = offset_ccw;
+ fill = fill_ccw;
+ break;
+
+ case PIPE_WINDING_CCW:
+ offset = offset_cw;
+ fill = fill_cw;
+ break;
+
+ case PIPE_WINDING_NONE:
+ if (fill_cw != fill_ccw || offset_cw != offset_ccw)
+ {
+ /* Always need the draw module to work out different
+ * front/back fill modes:
+ */
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
+ }
+ else {
+ offset = offset_ccw;
+ fill = fill_ccw;
+ }
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+
+ /* Unfilled primitive modes aren't implemented on all virtual
+ * hardware. We can do some unfilled processing with index
+ * translation, but otherwise need the draw module:
+ */
+ if (fill != PIPE_POLYGON_MODE_FILL &&
+ (templ->flatshade ||
+ templ->light_twoside ||
+ offset ||
+ templ->cull_mode != PIPE_WINDING_NONE))
+ {
+ fill = PIPE_POLYGON_MODE_FILL;
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
+ }
+
+ /* If we are decomposing to lines, and lines need the pipeline,
+ * then we also need the pipeline for tris.
+ */
+ if (fill == PIPE_POLYGON_MODE_LINE &&
+ (rast->need_pipeline & SVGA_PIPELINE_FLAG_LINES))
+ {
+ fill = PIPE_POLYGON_MODE_FILL;
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
+ }
+
+ /* Similarly for points:
+ */
+ if (fill == PIPE_POLYGON_MODE_POINT &&
+ (rast->need_pipeline & SVGA_PIPELINE_FLAG_POINTS))
+ {
+ fill = PIPE_POLYGON_MODE_FILL;
+ rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS;
+ }
+
+ if (offset) {
+ rast->slopescaledepthbias = templ->offset_scale;
+ rast->depthbias = templ->offset_units;
+ }
+
+ rast->hw_unfilled = fill;
+ }
+
+
+
+
+ if (rast->need_pipeline & SVGA_PIPELINE_FLAG_TRIS) {
+ /* Turn off stuff which will get done in the draw module:
+ */
+ rast->hw_unfilled = PIPE_POLYGON_MODE_FILL;
+ rast->slopescaledepthbias = 0;
+ rast->depthbias = 0;
+ }
+
+ return rast;
+}
+
+static void svga_bind_rasterizer_state( struct pipe_context *pipe,
+ void *state )
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_rasterizer_state *raster = (struct svga_rasterizer_state *)state;
+
+ svga->curr.rast = raster;
+
+ draw_set_rasterizer_state(svga->swtnl.draw, raster ? &raster->templ : NULL);
+
+ svga->dirty |= SVGA_NEW_RAST;
+}
+
+static void svga_delete_rasterizer_state(struct pipe_context *pipe,
+ void *raster)
+{
+ FREE(raster);
+}
+
+
+void svga_init_rasterizer_functions( struct svga_context *svga )
+{
+ svga->pipe.create_rasterizer_state = svga_create_rasterizer_state;
+ svga->pipe.bind_rasterizer_state = svga_bind_rasterizer_state;
+ svga->pipe.delete_rasterizer_state = svga_delete_rasterizer_state;
+}
+
+
+/***********************************************************************
+ * Hardware state update
+ */
+
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
new file mode 100644
index 0000000000..3eeca6b784
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -0,0 +1,243 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_pack_color.h"
+#include "tgsi/tgsi_parse.h"
+
+#include "svga_context.h"
+#include "svga_screen_texture.h"
+#include "svga_state.h"
+
+#include "svga_hw_reg.h"
+
+#include "svga_debug.h"
+
+static INLINE unsigned
+translate_wrap_mode(unsigned wrap)
+{
+ switch (wrap) {
+ case PIPE_TEX_WRAP_REPEAT:
+ return SVGA3D_TEX_ADDRESS_WRAP;
+
+ case PIPE_TEX_WRAP_CLAMP:
+ return SVGA3D_TEX_ADDRESS_CLAMP;
+
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ /* Unfortunately SVGA3D_TEX_ADDRESS_EDGE not respected by
+ * hardware.
+ */
+ return SVGA3D_TEX_ADDRESS_CLAMP;
+
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ return SVGA3D_TEX_ADDRESS_BORDER;
+
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ return SVGA3D_TEX_ADDRESS_MIRROR;
+
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ return SVGA3D_TEX_ADDRESS_MIRRORONCE;
+
+ default:
+ assert(0);
+ return SVGA3D_TEX_ADDRESS_WRAP;
+ }
+}
+
+static INLINE unsigned translate_img_filter( unsigned filter )
+{
+ switch (filter) {
+ case PIPE_TEX_FILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST;
+ case PIPE_TEX_FILTER_LINEAR: return SVGA3D_TEX_FILTER_LINEAR;
+ case PIPE_TEX_FILTER_ANISO: return SVGA3D_TEX_FILTER_ANISOTROPIC;
+ default:
+ assert(0);
+ return SVGA3D_TEX_FILTER_NEAREST;
+ }
+}
+
+static INLINE unsigned translate_mip_filter( unsigned filter )
+{
+ switch (filter) {
+ case PIPE_TEX_MIPFILTER_NONE: return SVGA3D_TEX_FILTER_NONE;
+ case PIPE_TEX_MIPFILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST;
+ case PIPE_TEX_MIPFILTER_LINEAR: return SVGA3D_TEX_FILTER_LINEAR;
+ default:
+ assert(0);
+ return SVGA3D_TEX_FILTER_NONE;
+ }
+}
+
+static void *
+svga_create_sampler_state(struct pipe_context *pipe,
+ const struct pipe_sampler_state *sampler)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state );
+
+ cso->mipfilter = translate_mip_filter(sampler->min_mip_filter);
+ cso->magfilter = translate_img_filter( sampler->mag_img_filter );
+ cso->minfilter = translate_img_filter( sampler->min_img_filter );
+ cso->aniso_level = MAX2( (unsigned) sampler->max_anisotropy, 1 );
+ cso->lod_bias = sampler->lod_bias;
+ cso->addressu = translate_wrap_mode(sampler->wrap_s);
+ cso->addressv = translate_wrap_mode(sampler->wrap_t);
+ cso->addressw = translate_wrap_mode(sampler->wrap_r);
+ cso->normalized_coords = sampler->normalized_coords;
+ cso->compare_mode = sampler->compare_mode;
+ cso->compare_func = sampler->compare_func;
+
+ {
+ ubyte r = float_to_ubyte(sampler->border_color[0]);
+ ubyte g = float_to_ubyte(sampler->border_color[1]);
+ ubyte b = float_to_ubyte(sampler->border_color[2]);
+ ubyte a = float_to_ubyte(sampler->border_color[3]);
+
+ util_pack_color_ub( r, g, b, a,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ &cso->bordercolor );
+ }
+
+ /* No SVGA3D support for:
+ * - min/max LOD clamping
+ */
+ cso->min_lod = 0;
+ cso->view_min_lod = MAX2(sampler->min_lod, 0);
+ cso->view_max_lod = MAX2(sampler->max_lod, 0);
+
+ /* Use min_mipmap */
+ if (svga->debug.use_min_mipmap) {
+ if (cso->view_min_lod == cso->view_max_lod) {
+ cso->min_lod = cso->view_min_lod;
+ cso->view_min_lod = 0;
+ cso->view_max_lod = 1000; /* Just a high number */
+ cso->mipfilter = SVGA3D_TEX_FILTER_NONE;
+ }
+ }
+
+ SVGA_DBG(DEBUG_VIEWS, "min %u, view(min %u, max %u) lod, mipfilter %s\n",
+ cso->min_lod, cso->view_min_lod, cso->view_max_lod,
+ cso->mipfilter == SVGA3D_TEX_FILTER_NONE ? "SVGA3D_TEX_FILTER_NONE" : "SOMETHING");
+
+ return cso;
+}
+
+static void svga_bind_sampler_states(struct pipe_context *pipe,
+ unsigned num, void **sampler)
+{
+ struct svga_context *svga = svga_context(pipe);
+ unsigned i;
+
+ assert(num <= PIPE_MAX_SAMPLERS);
+
+ /* Check for no-op */
+ if (num == svga->curr.num_samplers &&
+ !memcmp(svga->curr.sampler, sampler, num * sizeof(void *))) {
+ debug_printf("sampler noop\n");
+ return;
+ }
+
+ for (i = 0; i < num; i++)
+ svga->curr.sampler[i] = sampler[i];
+
+ for (i = num; i < svga->curr.num_samplers; i++)
+ svga->curr.sampler[i] = NULL;
+
+ svga->curr.num_samplers = num;
+ svga->dirty |= SVGA_NEW_SAMPLER;
+}
+
+static void svga_delete_sampler_state(struct pipe_context *pipe,
+ void *sampler)
+{
+ FREE(sampler);
+}
+
+
+static void svga_set_sampler_textures(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_texture **texture)
+{
+ struct svga_context *svga = svga_context(pipe);
+ unsigned flag_1d = 0;
+ unsigned flag_srgb = 0;
+ uint i;
+
+ assert(num <= PIPE_MAX_SAMPLERS);
+
+ /* Check for no-op */
+ if (num == svga->curr.num_textures &&
+ !memcmp(svga->curr.texture, texture, num * sizeof(struct pipe_texture *))) {
+ if (0) debug_printf("texture noop\n");
+ return;
+ }
+
+ for (i = 0; i < num; i++) {
+ pipe_texture_reference(&svga->curr.texture[i],
+ texture[i]);
+
+ if (!texture[i])
+ continue;
+
+ if (texture[i]->format == PIPE_FORMAT_A8R8G8B8_SRGB)
+ flag_srgb |= 1 << i;
+
+ if (texture[i]->target == PIPE_TEXTURE_1D)
+ flag_1d |= 1 << i;
+ }
+
+ for (i = num; i < svga->curr.num_textures; i++)
+ pipe_texture_reference(&svga->curr.texture[i],
+ NULL);
+
+ svga->curr.num_textures = num;
+ svga->dirty |= SVGA_NEW_TEXTURE_BINDING;
+
+ if (flag_srgb != svga->curr.tex_flags.flag_srgb ||
+ flag_1d != svga->curr.tex_flags.flag_1d)
+ {
+ svga->dirty |= SVGA_NEW_TEXTURE_FLAGS;
+ svga->curr.tex_flags.flag_1d = flag_1d;
+ svga->curr.tex_flags.flag_srgb = flag_srgb;
+ }
+}
+
+
+
+void svga_init_sampler_functions( struct svga_context *svga )
+{
+ svga->pipe.create_sampler_state = svga_create_sampler_state;
+ svga->pipe.bind_sampler_states = svga_bind_sampler_states;
+ svga->pipe.delete_sampler_state = svga_delete_sampler_state;
+ svga->pipe.set_sampler_textures = svga_set_sampler_textures;
+}
+
+
+
diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c
new file mode 100644
index 0000000000..28e2787e0d
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_vertex.c
@@ -0,0 +1,115 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_parse.h"
+
+#include "svga_screen.h"
+#include "svga_screen_buffer.h"
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_winsys.h"
+
+#include "svga_hw_reg.h"
+
+
+static void svga_set_vertex_buffers(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_buffer *buffers)
+{
+ struct svga_context *svga = svga_context(pipe);
+ unsigned i;
+ boolean any_user_buffer = FALSE;
+
+ /* Check for no change */
+ if (count == svga->curr.num_vertex_buffers &&
+ memcmp(svga->curr.vb, buffers, count * sizeof buffers[0]) == 0)
+ return;
+
+ /* Adjust refcounts */
+ for (i = 0; i < count; i++) {
+ pipe_buffer_reference(&svga->curr.vb[i].buffer, buffers[i].buffer);
+ if (svga_buffer(buffers[i].buffer)->user)
+ any_user_buffer = TRUE;
+ }
+
+ for ( ; i < svga->curr.num_vertex_buffers; i++)
+ pipe_buffer_reference(&svga->curr.vb[i].buffer, NULL);
+
+ /* Copy remaining data */
+ memcpy(svga->curr.vb, buffers, count * sizeof buffers[0]);
+ svga->curr.num_vertex_buffers = count;
+ svga->curr.any_user_vertex_buffers = any_user_buffer;
+
+ svga->dirty |= SVGA_NEW_VBUFFER;
+}
+
+static void svga_set_vertex_elements(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *elements)
+{
+ struct svga_context *svga = svga_context(pipe);
+ unsigned i;
+
+ for (i = 0; i < count; i++)
+ svga->curr.ve[i] = elements[i];
+
+ svga->curr.num_vertex_elements = count;
+ svga->dirty |= SVGA_NEW_VELEMENT;
+}
+
+
+static void svga_set_edgeflags(struct pipe_context *pipe,
+ const unsigned *bitfield)
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ if (bitfield != NULL || svga->curr.edgeflags != NULL) {
+ svga->curr.edgeflags = bitfield;
+ svga->dirty |= SVGA_NEW_EDGEFLAGS;
+ }
+}
+
+
+void svga_cleanup_vertex_state( struct svga_context *svga )
+{
+ unsigned i;
+
+ for (i = 0 ; i < svga->curr.num_vertex_buffers; i++)
+ pipe_buffer_reference(&svga->curr.vb[i].buffer, NULL);
+}
+
+
+void svga_init_vertex_functions( struct svga_context *svga )
+{
+ svga->pipe.set_vertex_buffers = svga_set_vertex_buffers;
+ svga->pipe.set_vertex_elements = svga_set_vertex_elements;
+ svga->pipe.set_edgeflags = svga_set_edgeflags;
+}
+
+
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c
new file mode 100644
index 0000000000..e5ffe668c3
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -0,0 +1,189 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "draw/draw_context.h"
+#include "pipe/p_inlines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_text.h"
+
+#include "svga_screen.h"
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_tgsi.h"
+#include "svga_hw_reg.h"
+#include "svga_cmd.h"
+#include "svga_debug.h"
+
+
+static const struct tgsi_token *substitute_vs(
+ unsigned shader_id,
+ const struct tgsi_token *old_tokens )
+{
+#if 0
+ if (shader_id == 12) {
+ static struct tgsi_token tokens[300];
+
+ const char *text =
+ "VERT1.1\n"
+ "DCL IN[0]\n"
+ "DCL IN[1]\n"
+ "DCL IN[2]\n"
+ "DCL OUT[0], POSITION\n"
+ "DCL TEMP[0..4]\n"
+ "IMM FLT32 { 1.0000, 1.0000, 1.0000, 1.0000 }\n"
+ "IMM FLT32 { 0.45, 1.0000, 1.0000, 1.0000 }\n"
+ "IMM FLT32 { 1.297863, 0.039245, 0.035993, 0.035976}\n"
+ "IMM FLT32 { -0.019398, 1.696131, -0.202151, -0.202050 }\n"
+ "IMM FLT32 { 0.051711, -0.348713, -0.979204, -0.978714 }\n"
+ "IMM FLT32 { 0.000000, 0.000003, 139.491577, 141.421356 }\n"
+ "DCL CONST[0..7]\n"
+ "DCL CONST[9..16]\n"
+ " MOV TEMP[2], IMM[0]\n"
+
+ " MOV TEMP[2].xyz, IN[2]\n"
+ " MOV TEMP[2].xyz, IN[0]\n"
+ " MOV TEMP[2].xyz, IN[1]\n"
+
+ " MUL TEMP[1], IMM[3], TEMP[2].yyyy\n"
+ " MAD TEMP[3], IMM[2], TEMP[2].xxxx, TEMP[1]\n"
+ " MAD TEMP[1], IMM[4], TEMP[2].zzzz, TEMP[3]\n"
+ " MAD TEMP[4], IMM[5], TEMP[2].wwww, TEMP[1]\n"
+
+ " MOV OUT[0], TEMP[4]\n"
+ " END\n";
+
+ if (!tgsi_text_translate( text,
+ tokens,
+ Elements(tokens) ))
+ {
+ assert(0);
+ return NULL;
+ }
+
+ return tokens;
+ }
+#endif
+
+ return old_tokens;
+}
+
+
+/***********************************************************************
+ * Vertex shaders
+ */
+
+static void *
+svga_create_vs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_screen *svgascreen = svga_screen(pipe->screen);
+ struct svga_vertex_shader *vs = CALLOC_STRUCT(svga_vertex_shader);
+ if (!vs)
+ return NULL;
+
+ /* substitute a debug shader?
+ */
+ vs->base.tokens = tgsi_dup_tokens(substitute_vs(svga->debug.shader_id,
+ templ->tokens));
+
+
+ /* Collect basic info that we'll need later:
+ */
+ tgsi_scan_shader(vs->base.tokens, &vs->base.info);
+
+ {
+ /* Need to do construct a new template in case we substitued a
+ * debug shader.
+ */
+ struct pipe_shader_state tmp2 = *templ;
+ tmp2.tokens = vs->base.tokens;
+ vs->draw_shader = draw_create_vertex_shader(svga->swtnl.draw, &tmp2);
+ }
+
+ vs->base.id = svga->debug.shader_id++;
+ vs->base.use_sm30 = svgascreen->use_vs30;
+
+ if (SVGA_DEBUG & DEBUG_TGSI || 0) {
+ debug_printf("%s id: %u, inputs: %u, outputs: %u\n",
+ __FUNCTION__, vs->base.id,
+ vs->base.info.num_inputs, vs->base.info.num_outputs);
+ }
+
+ return vs;
+}
+
+static void svga_bind_vs_state(struct pipe_context *pipe, void *shader)
+{
+ struct svga_vertex_shader *vs = (struct svga_vertex_shader *)shader;
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.vs = vs;
+ svga->dirty |= SVGA_NEW_VS;
+}
+
+
+static void svga_delete_vs_state(struct pipe_context *pipe, void *shader)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_vertex_shader *vs = (struct svga_vertex_shader *)shader;
+ struct svga_shader_result *result, *tmp;
+ enum pipe_error ret;
+
+ svga_hwtnl_flush_retry( svga );
+
+ draw_delete_vertex_shader(svga->swtnl.draw, vs->draw_shader);
+
+ for (result = vs->base.results; result; result = tmp ) {
+ tmp = result->next;
+
+ ret = SVGA3D_DestroyShader(svga->swc,
+ result->id,
+ SVGA3D_SHADERTYPE_VS );
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_DestroyShader(svga->swc,
+ result->id,
+ SVGA3D_SHADERTYPE_VS );
+ assert(ret == PIPE_OK);
+ }
+
+ svga_destroy_shader_result( result );
+ }
+
+ FREE((void *)vs->base.tokens);
+ FREE(vs);
+}
+
+
+void svga_init_vs_functions( struct svga_context *svga )
+{
+ svga->pipe.create_vs_state = svga_create_vs_state;
+ svga->pipe.bind_vs_state = svga_bind_vs_state;
+ svga->pipe.delete_vs_state = svga_delete_vs_state;
+}
+
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
new file mode 100644
index 0000000000..3afcaffff5
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -0,0 +1,435 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "util/u_memory.h"
+#include "pipe/p_inlines.h"
+#include "util/u_string.h"
+#include "util/u_math.h"
+
+#include "svga_winsys.h"
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_screen_texture.h"
+#include "svga_screen_buffer.h"
+#include "svga_cmd.h"
+#include "svga_debug.h"
+
+#include "svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+
+#ifdef DEBUG
+int SVGA_DEBUG = 0;
+
+static const struct debug_named_value svga_debug_flags[] = {
+ { "dma", DEBUG_DMA },
+ { "tgsi", DEBUG_TGSI },
+ { "pipe", DEBUG_PIPE },
+ { "state", DEBUG_STATE },
+ { "screen", DEBUG_SCREEN },
+ { "tex", DEBUG_TEX },
+ { "swtnl", DEBUG_SWTNL },
+ { "const", DEBUG_CONSTS },
+ { "viewport", DEBUG_VIEWPORT },
+ { "views", DEBUG_VIEWS },
+ { "perf", DEBUG_PERF },
+ { "flush", DEBUG_FLUSH },
+ { "sync", DEBUG_SYNC },
+ {NULL, 0}
+};
+#endif
+
+static const char *
+svga_get_vendor( struct pipe_screen *pscreen )
+{
+ return "VMware, Inc.";
+}
+
+
+static const char *
+svga_get_name( struct pipe_screen *pscreen )
+{
+#ifdef DEBUG
+ /* Only return internal details in the DEBUG version:
+ */
+ return "SVGA3D; build: DEBUG; mutex: " PIPE_ATOMIC;
+#else
+ return "SVGA3D; build: RELEASE; ";
+#endif
+}
+
+
+
+
+static float
+svga_get_paramf(struct pipe_screen *screen, int param)
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ SVGA3dDevCapResult result;
+
+ switch (param) {
+ case PIPE_CAP_MAX_LINE_WIDTH:
+ /* fall-through */
+ case PIPE_CAP_MAX_LINE_WIDTH_AA:
+ return 7.0;
+
+ case PIPE_CAP_MAX_POINT_WIDTH:
+ /* fall-through */
+ case PIPE_CAP_MAX_POINT_WIDTH_AA:
+ /* Keep this to a reasonable size to avoid failures in
+ * conform/pntaa.c:
+ */
+ return 80.0;
+
+ case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+ return 4.0;
+
+ case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+ return 16.0;
+
+ case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
+ return 16;
+ case PIPE_CAP_NPOT_TEXTURES:
+ return 1;
+ case PIPE_CAP_TWO_SIDED_STENCIL:
+ return 1;
+ case PIPE_CAP_GLSL:
+ return svgascreen->use_ps30 && svgascreen->use_vs30;
+ case PIPE_CAP_ANISOTROPIC_FILTER:
+ return 1;
+ case PIPE_CAP_POINT_SPRITE:
+ return 1;
+ case PIPE_CAP_MAX_RENDER_TARGETS:
+ if(!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_RENDER_TARGETS, &result))
+ return 1;
+ if(!result.u)
+ return 1;
+ return MIN2(result.u, PIPE_MAX_COLOR_BUFS);
+ case PIPE_CAP_OCCLUSION_QUERY:
+ return 1;
+ case PIPE_CAP_TEXTURE_SHADOW_MAP:
+ return 1;
+ case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+ return SVGA_MAX_TEXTURE_LEVELS;
+ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+ return 8; /* max 128x128x128 */
+ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+ return SVGA_MAX_TEXTURE_LEVELS;
+
+ case PIPE_CAP_TEXTURE_MIRROR_REPEAT: /* req. for GL 1.4 */
+ return 1;
+
+ case PIPE_CAP_BLEND_EQUATION_SEPARATE: /* req. for GL 1.5 */
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
+
+/* This is a fairly pointless interface
+ */
+static int
+svga_get_param(struct pipe_screen *screen, int param)
+{
+ return (int) svga_get_paramf( screen, param );
+}
+
+
+static INLINE SVGA3dDevCapIndex
+svga_translate_format_cap(enum pipe_format format)
+{
+ switch(format) {
+
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8;
+
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_R5G6B5;
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5;
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4;
+
+ case PIPE_FORMAT_Z16_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_Z_D16;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8;
+
+ case PIPE_FORMAT_A8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_ALPHA8;
+ case PIPE_FORMAT_L8_UNORM:
+ return SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8;
+
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ return SVGA3D_DEVCAP_SURFACEFMT_DXT1;
+ case PIPE_FORMAT_DXT3_RGBA:
+ return SVGA3D_DEVCAP_SURFACEFMT_DXT3;
+ case PIPE_FORMAT_DXT5_RGBA:
+ return SVGA3D_DEVCAP_SURFACEFMT_DXT5;
+
+ default:
+ return SVGA3D_DEVCAP_MAX;
+ }
+}
+
+
+static boolean
+svga_is_format_supported( struct pipe_screen *screen,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned tex_usage,
+ unsigned geom_flags )
+{
+ struct svga_winsys_screen *sws = svga_screen(screen)->sws;
+ SVGA3dDevCapIndex index;
+ SVGA3dDevCapResult result;
+
+ assert(tex_usage);
+
+ /* Override host capabilities */
+ if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
+ switch(format) {
+
+ /* Often unsupported/problematic. This means we end up with the same
+ * visuals for all virtual hardware implementations.
+ */
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
+ return FALSE;
+
+ /* Simulate ability to render into compressed textures */
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ return TRUE;
+
+ default:
+ break;
+ }
+ }
+
+ /* Try to query the host */
+ index = svga_translate_format_cap(format);
+ if( index < SVGA3D_DEVCAP_MAX &&
+ sws->get_cap(sws, index, &result) )
+ {
+ SVGA3dSurfaceFormatCaps mask;
+
+ mask.value = 0;
+ if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
+ mask.offscreenRenderTarget = 1;
+ if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL)
+ mask.zStencil = 1;
+ if (tex_usage & PIPE_TEXTURE_USAGE_SAMPLER)
+ mask.texture = 1;
+
+ if ((result.u & mask.value) == mask.value)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ /* Use our translate functions directly rather than relying on a
+ * duplicated list of supported formats which is prone to getting
+ * out of sync:
+ */
+ if(tex_usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
+ return svga_translate_format_render(format) != SVGA3D_FORMAT_INVALID;
+ else
+ return svga_translate_format(format) != SVGA3D_FORMAT_INVALID;
+}
+
+
+static void
+svga_fence_reference(struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence)
+{
+ struct svga_winsys_screen *sws = svga_screen(screen)->sws;
+ sws->fence_reference(sws, ptr, fence);
+}
+
+
+static int
+svga_fence_signalled(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct svga_winsys_screen *sws = svga_screen(screen)->sws;
+ return sws->fence_signalled(sws, fence, flag);
+}
+
+
+static int
+svga_fence_finish(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct svga_winsys_screen *sws = svga_screen(screen)->sws;
+ return sws->fence_finish(sws, fence, flag);
+}
+
+
+static void
+svga_destroy_screen( struct pipe_screen *screen )
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+
+ svga_screen_cache_cleanup(svgascreen);
+
+ pipe_mutex_destroy(svgascreen->swc_mutex);
+ pipe_mutex_destroy(svgascreen->tex_mutex);
+
+ svgascreen->swc->destroy(svgascreen->swc);
+
+ svgascreen->sws->destroy(svgascreen->sws);
+
+ FREE(svgascreen);
+}
+
+
+/**
+ * Create a new svga_screen object
+ */
+struct pipe_screen *
+svga_screen_create(struct svga_winsys_screen *sws)
+{
+ struct svga_screen *svgascreen;
+ struct pipe_screen *screen;
+ SVGA3dDevCapResult result;
+
+#ifdef DEBUG
+ SVGA_DEBUG = debug_get_flags_option("SVGA_DEBUG", svga_debug_flags, 0 );
+#endif
+
+ svgascreen = CALLOC_STRUCT(svga_screen);
+ if (!svgascreen)
+ goto error1;
+
+ svgascreen->debug.force_level_surface_view =
+ debug_get_bool_option("SVGA_FORCE_LEVEL_SURFACE_VIEW", FALSE);
+ svgascreen->debug.force_surface_view =
+ debug_get_bool_option("SVGA_FORCE_SURFACE_VIEW", FALSE);
+ svgascreen->debug.force_sampler_view =
+ debug_get_bool_option("SVGA_FORCE_SAMPLER_VIEW", FALSE);
+ svgascreen->debug.no_surface_view =
+ debug_get_bool_option("SVGA_NO_SURFACE_VIEW", FALSE);
+ svgascreen->debug.no_sampler_view =
+ debug_get_bool_option("SVGA_NO_SAMPLER_VIEW", FALSE);
+
+ screen = &svgascreen->screen;
+
+ screen->destroy = svga_destroy_screen;
+ screen->get_name = svga_get_name;
+ screen->get_vendor = svga_get_vendor;
+ screen->get_param = svga_get_param;
+ screen->get_paramf = svga_get_paramf;
+ screen->is_format_supported = svga_is_format_supported;
+ screen->fence_reference = svga_fence_reference;
+ screen->fence_signalled = svga_fence_signalled;
+ screen->fence_finish = svga_fence_finish;
+ svgascreen->sws = sws;
+
+ svga_screen_init_texture_functions(screen);
+ svga_screen_init_buffer_functions(screen);
+
+ svgascreen->use_ps30 =
+ sws->get_cap(sws, SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION, &result) &&
+ result.u >= SVGA3DPSVERSION_30 ? TRUE : FALSE;
+
+ svgascreen->use_vs30 =
+ sws->get_cap(sws, SVGA3D_DEVCAP_VERTEX_SHADER_VERSION, &result) &&
+ result.u >= SVGA3DVSVERSION_30 ? TRUE : FALSE;
+
+#if 1
+ /* Shader model 2.0 is unsupported at the moment. */
+ if(!svgascreen->use_ps30 || !svgascreen->use_vs30)
+ goto error2;
+#else
+ if(debug_get_bool_option("SVGA_NO_SM30", FALSE))
+ svgascreen->use_vs30 = svgascreen->use_ps30 = FALSE;
+#endif
+
+ svgascreen->swc = sws->context_create(sws);
+ if(!svgascreen->swc)
+ goto error2;
+
+ pipe_mutex_init(svgascreen->tex_mutex);
+ pipe_mutex_init(svgascreen->swc_mutex);
+
+ LIST_INITHEAD(&svgascreen->cached_buffers);
+
+ svga_screen_cache_init(svgascreen);
+
+ return screen;
+error2:
+ FREE(svgascreen);
+error1:
+ return NULL;
+}
+
+void svga_screen_flush( struct svga_screen *svgascreen,
+ struct pipe_fence_handle **pfence )
+{
+ struct pipe_fence_handle *fence = NULL;
+
+ SVGA_DBG(DEBUG_PERF, "%s\n", __FUNCTION__);
+
+ pipe_mutex_lock(svgascreen->swc_mutex);
+ svgascreen->swc->flush(svgascreen->swc, &fence);
+ pipe_mutex_unlock(svgascreen->swc_mutex);
+
+ svga_screen_cache_flush(svgascreen, fence);
+
+ if(pfence)
+ *pfence = fence;
+ else
+ svgascreen->sws->fence_reference(svgascreen->sws, &fence, NULL);
+}
+
+struct svga_winsys_screen *
+svga_winsys_screen(struct pipe_screen *screen)
+{
+ return svga_screen(screen)->sws;
+}
+
+#ifdef DEBUG
+struct svga_screen *
+svga_screen(struct pipe_screen *screen)
+{
+ assert(screen);
+ assert(screen->destroy == svga_destroy_screen);
+ return (struct svga_screen *)screen;
+}
+#endif
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h
new file mode 100644
index 0000000000..b94ca7fc1c
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen.h
@@ -0,0 +1,95 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_SCREEN_H
+#define SVGA_SCREEN_H
+
+
+#include "pipe/p_screen.h"
+#include "pipe/p_thread.h"
+
+#include "util/u_double_list.h"
+
+#include "svga_screen_cache.h"
+
+
+struct svga_winsys_screen;
+struct svga_winsys_context;
+struct SVGACmdMemory;
+
+#define SVGA_COMBINE_USERBUFFERS 1
+
+/**
+ * Subclass of pipe_screen
+ */
+struct svga_screen
+{
+ struct pipe_screen screen;
+ struct svga_winsys_screen *sws;
+
+ unsigned use_ps30;
+ unsigned use_vs30;
+
+ struct {
+ boolean force_level_surface_view;
+ boolean force_surface_view;
+ boolean no_surface_view;
+ boolean force_sampler_view;
+ boolean no_sampler_view;
+ } debug;
+
+ /* The screen needs its own context */
+ struct svga_winsys_context *swc;
+ struct SVGACmdMemory *fifo;
+
+ unsigned texture_timestamp;
+ pipe_mutex tex_mutex;
+ pipe_mutex swc_mutex; /* Protects the use of swc and dirty_buffers */
+
+ /**
+ * List of buffers with cached GMR. Ordered from the most recently used to
+ * the least recently used
+ */
+ struct list_head cached_buffers;
+
+ struct svga_host_surface_cache cache;
+};
+
+#ifndef DEBUG
+/** cast wrapper */
+static INLINE struct svga_screen *
+svga_screen(struct pipe_screen *pscreen)
+{
+ return (struct svga_screen *) pscreen;
+}
+#else
+struct svga_screen *
+svga_screen(struct pipe_screen *screen);
+#endif
+
+void svga_screen_flush( struct svga_screen *svga_screen,
+ struct pipe_fence_handle **pfence );
+
+#endif /* SVGA_SCREEN_H */
diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c
new file mode 100644
index 0000000000..3b7811734e
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -0,0 +1,820 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_thread.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_screen_buffer.h"
+#include "svga_winsys.h"
+#include "svga_debug.h"
+
+
+/**
+ * Vertex and index buffers have to be treated slightly differently from
+ * regular guest memory regions because the SVGA device sees them as
+ * surfaces, and the state tracker can create/destroy without the pipe
+ * driver, therefore we must do the uploads from the vws.
+ */
+static INLINE boolean
+svga_buffer_needs_hw_storage(unsigned usage)
+{
+ return usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_INDEX);
+}
+
+
+static INLINE enum pipe_error
+svga_buffer_create_host_surface(struct svga_screen *ss,
+ struct svga_buffer *sbuf)
+{
+ if(!sbuf->handle) {
+ sbuf->key.flags = 0;
+
+ sbuf->key.format = SVGA3D_BUFFER;
+ if(sbuf->base.usage & PIPE_BUFFER_USAGE_VERTEX)
+ sbuf->key.flags |= SVGA3D_SURFACE_HINT_VERTEXBUFFER;
+ if(sbuf->base.usage & PIPE_BUFFER_USAGE_INDEX)
+ sbuf->key.flags |= SVGA3D_SURFACE_HINT_INDEXBUFFER;
+
+ sbuf->key.size.width = sbuf->base.size;
+ sbuf->key.size.height = 1;
+ sbuf->key.size.depth = 1;
+
+ sbuf->key.numFaces = 1;
+ sbuf->key.numMipLevels = 1;
+
+ sbuf->handle = svga_screen_surface_create(ss, &sbuf->key);
+ if(!sbuf->handle)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ /* Always set the discard flag on the first time the buffer is written
+ * as svga_screen_surface_create might have passed a recycled host
+ * buffer.
+ */
+ sbuf->hw.flags.discard = TRUE;
+
+ SVGA_DBG(DEBUG_DMA, " grab sid %p sz %d\n", sbuf->handle, sbuf->base.size);
+ }
+
+ return PIPE_OK;
+}
+
+
+static INLINE void
+svga_buffer_destroy_host_surface(struct svga_screen *ss,
+ struct svga_buffer *sbuf)
+{
+ if(sbuf->handle) {
+ SVGA_DBG(DEBUG_DMA, " ungrab sid %p sz %d\n", sbuf->handle, sbuf->base.size);
+ svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle);
+ }
+}
+
+
+static INLINE void
+svga_buffer_destroy_hw_storage(struct svga_screen *ss, struct svga_buffer *sbuf)
+{
+ struct svga_winsys_screen *sws = ss->sws;
+
+ assert(!sbuf->map.count);
+ assert(sbuf->hw.buf);
+ if(sbuf->hw.buf) {
+ sws->buffer_destroy(sws, sbuf->hw.buf);
+ sbuf->hw.buf = NULL;
+ assert(sbuf->head.prev && sbuf->head.next);
+ LIST_DEL(&sbuf->head);
+#ifdef DEBUG
+ sbuf->head.next = sbuf->head.prev = NULL;
+#endif
+ }
+}
+
+static INLINE enum pipe_error
+svga_buffer_backup(struct svga_screen *ss, struct svga_buffer *sbuf)
+{
+ if (sbuf->hw.buf && sbuf->hw.num_ranges) {
+ void *src;
+
+ if (!sbuf->swbuf)
+ sbuf->swbuf = align_malloc(sbuf->base.size, sbuf->base.alignment);
+ if (!sbuf->swbuf)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ src = ss->sws->buffer_map(ss->sws, sbuf->hw.buf,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ if (!src)
+ return PIPE_ERROR;
+
+ memcpy(sbuf->swbuf, src, sbuf->base.size);
+ ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf);
+ }
+
+ return PIPE_OK;
+}
+
+/**
+ * Try to make GMR space available by freeing the hardware storage of
+ * unmapped
+ */
+boolean
+svga_buffer_free_cached_hw_storage(struct svga_screen *ss)
+{
+ struct list_head *curr;
+ struct svga_buffer *sbuf;
+ enum pipe_error ret = PIPE_OK;
+
+ curr = ss->cached_buffers.prev;
+
+ /* free the least recently used buffer's hw storage which is not mapped */
+ do {
+ if(curr == &ss->cached_buffers)
+ return FALSE;
+
+ sbuf = LIST_ENTRY(struct svga_buffer, curr, head);
+
+ curr = curr->prev;
+ if (sbuf->map.count == 0)
+ ret = svga_buffer_backup(ss, sbuf);
+
+ } while(sbuf->map.count != 0 || ret != PIPE_OK);
+
+ svga_buffer_destroy_hw_storage(ss, sbuf);
+
+ return TRUE;
+}
+
+struct svga_winsys_buffer *
+svga_winsys_buffer_create( struct svga_screen *ss,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size )
+{
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_winsys_buffer *buf;
+
+ /* Just try */
+ buf = sws->buffer_create(sws, alignment, usage, size);
+ if(!buf) {
+
+ SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "flushing screen to find %d bytes GMR\n",
+ size);
+
+ /* Try flushing all pending DMAs */
+ svga_screen_flush(ss, NULL);
+ buf = sws->buffer_create(sws, alignment, usage, size);
+
+ SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "evicting buffers to find %d bytes GMR\n",
+ size);
+
+ /* Try evicing all buffer storage */
+ while(!buf && svga_buffer_free_cached_hw_storage(ss))
+ buf = sws->buffer_create(sws, alignment, usage, size);
+ }
+
+ return buf;
+}
+
+
+/**
+ * Allocate DMA'ble storage for the buffer.
+ *
+ * Called before mapping a buffer.
+ */
+static INLINE enum pipe_error
+svga_buffer_create_hw_storage(struct svga_screen *ss,
+ struct svga_buffer *sbuf)
+{
+ if(!sbuf->hw.buf) {
+ unsigned alignment = sbuf->base.alignment;
+ unsigned usage = 0;
+ unsigned size = sbuf->base.size;
+
+ sbuf->hw.buf = svga_winsys_buffer_create(ss, alignment, usage, size);
+ if(!sbuf->hw.buf)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ assert(!sbuf->needs_flush);
+ assert(!sbuf->head.prev && !sbuf->head.next);
+ LIST_ADD(&sbuf->head, &ss->cached_buffers);
+ }
+
+ return PIPE_OK;
+}
+
+
+/**
+ * Variant of SVGA3D_BufferDMA which leaves the copy box temporarily in blank.
+ */
+static enum pipe_error
+svga_buffer_upload_command(struct svga_context *svga,
+ struct svga_buffer *sbuf)
+{
+ struct svga_winsys_context *swc = svga->swc;
+ struct svga_winsys_buffer *guest = sbuf->hw.buf;
+ struct svga_winsys_surface *host = sbuf->handle;
+ SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM;
+ SVGA3dSurfaceDMAFlags flags = sbuf->hw.flags;
+ SVGA3dCmdSurfaceDMA *cmd;
+ uint32 numBoxes = sbuf->hw.num_ranges;
+ SVGA3dCopyBox *boxes;
+ SVGA3dCmdSurfaceDMASuffix *pSuffix;
+ unsigned region_flags;
+ unsigned surface_flags;
+ struct pipe_buffer *dummy;
+
+ if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ }
+ else if(transfer == SVGA3D_READ_HOST_VRAM) {
+ region_flags = PIPE_BUFFER_USAGE_GPU_WRITE;
+ surface_flags = PIPE_BUFFER_USAGE_GPU_READ;
+ }
+ else {
+ assert(0);
+ return PIPE_ERROR_BAD_INPUT;
+ }
+
+ assert(numBoxes);
+
+ cmd = SVGA3D_FIFOReserve(swc,
+ SVGA_3D_CMD_SURFACE_DMA,
+ sizeof *cmd + numBoxes * sizeof *boxes + sizeof *pSuffix,
+ 2);
+ if(!cmd)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ swc->region_relocation(swc, &cmd->guest.ptr, guest, 0, region_flags);
+ cmd->guest.pitch = 0;
+
+ swc->surface_relocation(swc, &cmd->host.sid, host, surface_flags);
+ cmd->host.face = 0;
+ cmd->host.mipmap = 0;
+
+ cmd->transfer = transfer;
+
+ sbuf->hw.boxes = (SVGA3dCopyBox *)&cmd[1];
+ sbuf->hw.svga = svga;
+
+ /* Increment reference count */
+ dummy = NULL;
+ pipe_buffer_reference(&dummy, &sbuf->base);
+
+ pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + numBoxes * sizeof *boxes);
+ pSuffix->suffixSize = sizeof *pSuffix;
+ pSuffix->maximumOffset = sbuf->base.size;
+ pSuffix->flags = flags;
+
+ swc->commit(swc);
+
+ return PIPE_OK;
+}
+
+
+/**
+ * Patch up the upload DMA command reserved by svga_buffer_upload_command
+ * with the final ranges.
+ */
+static void
+svga_buffer_upload_flush(struct svga_context *svga,
+ struct svga_buffer *sbuf)
+{
+ struct svga_screen *ss = svga_screen(svga->pipe.screen);
+ SVGA3dCopyBox *boxes;
+ unsigned i;
+
+ assert(sbuf->handle);
+ assert(sbuf->hw.buf);
+ assert(sbuf->hw.num_ranges);
+ assert(sbuf->hw.svga == svga);
+ assert(sbuf->hw.boxes);
+
+ /*
+ * Patch the DMA command with the final copy box.
+ */
+
+ SVGA_DBG(DEBUG_DMA, "dma to sid %p\n", sbuf->handle);
+
+ boxes = sbuf->hw.boxes;
+ for(i = 0; i < sbuf->hw.num_ranges; ++i) {
+ SVGA_DBG(DEBUG_DMA, " bytes %u - %u\n",
+ sbuf->hw.ranges[i].start, sbuf->hw.ranges[i].end);
+
+ boxes[i].x = sbuf->hw.ranges[i].start;
+ boxes[i].y = 0;
+ boxes[i].z = 0;
+ boxes[i].w = sbuf->hw.ranges[i].end - sbuf->hw.ranges[i].start;
+ boxes[i].h = 1;
+ boxes[i].d = 1;
+ boxes[i].srcx = sbuf->hw.ranges[i].start;
+ boxes[i].srcy = 0;
+ boxes[i].srcz = 0;
+ }
+
+ sbuf->hw.num_ranges = 0;
+ memset(&sbuf->hw.flags, 0, sizeof sbuf->hw.flags);
+
+ assert(sbuf->head.prev && sbuf->head.next);
+ LIST_DEL(&sbuf->head);
+ sbuf->needs_flush = FALSE;
+ /* XXX: do we care about cached_buffers any more ?*/
+ LIST_ADD(&sbuf->head, &ss->cached_buffers);
+
+ sbuf->hw.svga = NULL;
+ sbuf->hw.boxes = NULL;
+
+ /* Decrement reference count */
+ pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL);
+}
+
+
+/**
+ * Queue a DMA upload of a range of this buffer to the host.
+ *
+ * This function only notes the range down. It doesn't actually emit a DMA
+ * upload command. That only happens when a context tries to refer to this
+ * buffer, and the DMA upload command is added to that context's command buffer.
+ *
+ * We try to lump as many contiguous DMA transfers together as possible.
+ */
+static void
+svga_buffer_upload_queue(struct svga_buffer *sbuf,
+ unsigned start,
+ unsigned end)
+{
+ unsigned i;
+
+ assert(sbuf->hw.buf);
+ assert(end > start);
+
+ /*
+ * Try to grow one of the ranges.
+ *
+ * Note that it is not this function task to care about overlapping ranges,
+ * as the GMR was already given so it is too late to do anything. Situations
+ * where overlapping ranges may pose a problem should be detected via
+ * pipe_context::is_buffer_referenced and the context that refers to the
+ * buffer should be flushed.
+ */
+
+ for(i = 0; i < sbuf->hw.num_ranges; ++i) {
+ if(start <= sbuf->hw.ranges[i].end && sbuf->hw.ranges[i].start <= end) {
+ sbuf->hw.ranges[i].start = MIN2(sbuf->hw.ranges[i].start, start);
+ sbuf->hw.ranges[i].end = MAX2(sbuf->hw.ranges[i].end, end);
+ return;
+ }
+ }
+
+ /*
+ * We cannot add a new range to an existing DMA command, so patch-up the
+ * pending DMA upload and start clean.
+ */
+
+ if(sbuf->needs_flush)
+ svga_buffer_upload_flush(sbuf->hw.svga, sbuf);
+
+ assert(!sbuf->needs_flush);
+ assert(!sbuf->hw.svga);
+ assert(!sbuf->hw.boxes);
+
+ /*
+ * Add a new range.
+ */
+
+ sbuf->hw.ranges[sbuf->hw.num_ranges].start = start;
+ sbuf->hw.ranges[sbuf->hw.num_ranges].end = end;
+ ++sbuf->hw.num_ranges;
+}
+
+
+static void *
+svga_buffer_map_range( struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned offset, unsigned length,
+ unsigned usage )
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_buffer *sbuf = svga_buffer( buf );
+ void *map;
+
+ if(sbuf->swbuf) {
+ /* User/malloc buffer */
+ map = sbuf->swbuf;
+ }
+ else {
+ if(!sbuf->hw.buf) {
+ struct svga_winsys_surface *handle = sbuf->handle;
+
+ if(svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK)
+ return NULL;
+
+ /* Populate the hardware storage if the host surface pre-existed */
+ if((usage & PIPE_BUFFER_USAGE_CPU_READ) && handle) {
+ SVGA3dSurfaceDMAFlags flags;
+ enum pipe_error ret;
+ struct pipe_fence_handle *fence = NULL;
+
+ SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p, bytes %u - %u\n",
+ sbuf->handle, 0, sbuf->base.size);
+
+ memset(&flags, 0, sizeof flags);
+
+ ret = SVGA3D_BufferDMA(ss->swc,
+ sbuf->hw.buf,
+ sbuf->handle,
+ SVGA3D_READ_HOST_VRAM,
+ sbuf->base.size,
+ 0,
+ flags);
+ if(ret != PIPE_OK) {
+ ss->swc->flush(ss->swc, NULL);
+
+ ret = SVGA3D_BufferDMA(ss->swc,
+ sbuf->hw.buf,
+ sbuf->handle,
+ SVGA3D_READ_HOST_VRAM,
+ sbuf->base.size,
+ 0,
+ flags);
+ assert(ret == PIPE_OK);
+ }
+
+ ss->swc->flush(ss->swc, &fence);
+ sws->fence_finish(sws, fence, 0);
+ sws->fence_reference(sws, &fence, NULL);
+ }
+ }
+ else {
+ if((usage & PIPE_BUFFER_USAGE_CPU_READ) && !sbuf->needs_flush) {
+ /* We already had the hardware storage but we would have to issue
+ * a download if we hadn't, so move the buffer to the begginning
+ * of the LRU list.
+ */
+ assert(sbuf->head.prev && sbuf->head.next);
+ LIST_DEL(&sbuf->head);
+ LIST_ADD(&sbuf->head, &ss->cached_buffers);
+ }
+ }
+
+ map = sws->buffer_map(sws, sbuf->hw.buf, usage);
+ }
+
+ if(map) {
+ pipe_mutex_lock(ss->swc_mutex);
+
+ ++sbuf->map.count;
+
+ if (usage & PIPE_BUFFER_USAGE_CPU_WRITE) {
+ assert(sbuf->map.count <= 1);
+ sbuf->map.writing = TRUE;
+ if (usage & PIPE_BUFFER_USAGE_FLUSH_EXPLICIT)
+ sbuf->map.flush_explicit = TRUE;
+ }
+
+ pipe_mutex_unlock(ss->swc_mutex);
+ }
+
+ return map;
+}
+
+static void
+svga_buffer_flush_mapped_range( struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned offset, unsigned length)
+{
+ struct svga_buffer *sbuf = svga_buffer( buf );
+ struct svga_screen *ss = svga_screen(screen);
+
+ pipe_mutex_lock(ss->swc_mutex);
+ assert(sbuf->map.writing);
+ if(sbuf->map.writing) {
+ assert(sbuf->map.flush_explicit);
+ if(sbuf->hw.buf)
+ svga_buffer_upload_queue(sbuf, offset, offset + length);
+ }
+ pipe_mutex_unlock(ss->swc_mutex);
+}
+
+static void
+svga_buffer_unmap( struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_buffer *sbuf = svga_buffer( buf );
+
+ pipe_mutex_lock(ss->swc_mutex);
+
+ assert(sbuf->map.count);
+ if(sbuf->map.count)
+ --sbuf->map.count;
+
+ if(sbuf->hw.buf)
+ sws->buffer_unmap(sws, sbuf->hw.buf);
+
+ if(sbuf->map.writing) {
+ if(!sbuf->map.flush_explicit) {
+ /* No mapped range was flushed -- flush the whole buffer */
+ SVGA_DBG(DEBUG_DMA, "flushing the whole buffer\n");
+
+ if(sbuf->hw.buf)
+ svga_buffer_upload_queue(sbuf, 0, sbuf->base.size);
+ }
+
+ sbuf->map.writing = FALSE;
+ sbuf->map.flush_explicit = FALSE;
+ }
+
+ pipe_mutex_unlock(ss->swc_mutex);
+}
+
+static void
+svga_buffer_destroy( struct pipe_buffer *buf )
+{
+ struct svga_screen *ss = svga_screen(buf->screen);
+ struct svga_buffer *sbuf = svga_buffer( buf );
+
+ assert(!p_atomic_read(&buf->reference.count));
+
+ assert(!sbuf->needs_flush);
+
+ if(sbuf->handle) {
+ SVGA_DBG(DEBUG_DMA, "release sid %p sz %d\n", sbuf->handle, sbuf->base.size);
+ svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle);
+ }
+
+ if(sbuf->hw.buf)
+ svga_buffer_destroy_hw_storage(ss, sbuf);
+
+ if(sbuf->swbuf && !sbuf->user)
+ align_free(sbuf->swbuf);
+
+ FREE(sbuf);
+}
+
+static struct pipe_buffer *
+svga_buffer_create(struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_buffer *sbuf;
+
+ sbuf = CALLOC_STRUCT(svga_buffer);
+ if(!sbuf)
+ goto error1;
+
+ sbuf->magic = SVGA_BUFFER_MAGIC;
+
+ pipe_reference_init(&sbuf->base.reference, 1);
+ sbuf->base.screen = screen;
+ sbuf->base.alignment = alignment;
+ sbuf->base.usage = usage;
+ sbuf->base.size = size;
+
+ if(svga_buffer_needs_hw_storage(usage)) {
+ if(svga_buffer_create_host_surface(ss, sbuf) != PIPE_OK)
+ goto error2;
+ }
+ else {
+ if(alignment < sizeof(void*))
+ alignment = sizeof(void*);
+
+ usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+
+ sbuf->swbuf = align_malloc(size, alignment);
+ if(!sbuf->swbuf)
+ goto error2;
+ }
+
+ return &sbuf->base;
+
+error2:
+ FREE(sbuf);
+error1:
+ return NULL;
+}
+
+static struct pipe_buffer *
+svga_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes)
+{
+ struct svga_buffer *sbuf;
+
+ sbuf = CALLOC_STRUCT(svga_buffer);
+ if(!sbuf)
+ goto no_sbuf;
+
+ sbuf->magic = SVGA_BUFFER_MAGIC;
+
+ sbuf->swbuf = ptr;
+ sbuf->user = TRUE;
+
+ pipe_reference_init(&sbuf->base.reference, 1);
+ sbuf->base.screen = screen;
+ sbuf->base.alignment = 1;
+ sbuf->base.usage = 0;
+ sbuf->base.size = bytes;
+
+ return &sbuf->base;
+
+no_sbuf:
+ return NULL;
+}
+
+
+void
+svga_screen_init_buffer_functions(struct pipe_screen *screen)
+{
+ screen->buffer_create = svga_buffer_create;
+ screen->user_buffer_create = svga_user_buffer_create;
+ screen->buffer_map_range = svga_buffer_map_range;
+ screen->buffer_flush_mapped_range = svga_buffer_flush_mapped_range;
+ screen->buffer_unmap = svga_buffer_unmap;
+ screen->buffer_destroy = svga_buffer_destroy;
+}
+
+
+/**
+ * Copy the contents of the user buffer / malloc buffer to a hardware buffer.
+ */
+static INLINE enum pipe_error
+svga_buffer_update_hw(struct svga_screen *ss, struct svga_buffer *sbuf)
+{
+ if(!sbuf->hw.buf) {
+ enum pipe_error ret;
+ void *map;
+
+ assert(sbuf->swbuf);
+ if(!sbuf->swbuf)
+ return PIPE_ERROR;
+
+ ret = svga_buffer_create_hw_storage(ss, sbuf);
+ assert(ret == PIPE_OK);
+ if(ret != PIPE_OK)
+ return ret;
+
+ pipe_mutex_lock(ss->swc_mutex);
+ map = ss->sws->buffer_map(ss->sws, sbuf->hw.buf, PIPE_BUFFER_USAGE_CPU_WRITE);
+ assert(map);
+ if(!map) {
+ pipe_mutex_unlock(ss->swc_mutex);
+ return PIPE_ERROR_OUT_OF_MEMORY;
+ }
+
+ memcpy(map, sbuf->swbuf, sbuf->base.size);
+ ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf);
+
+ /* This user/malloc buffer is now indistinguishable from a gpu buffer */
+ assert(!sbuf->map.count);
+ if(!sbuf->map.count) {
+ if(sbuf->user)
+ sbuf->user = FALSE;
+ else
+ align_free(sbuf->swbuf);
+ sbuf->swbuf = NULL;
+ }
+
+ svga_buffer_upload_queue(sbuf, 0, sbuf->base.size);
+ }
+
+ pipe_mutex_unlock(ss->swc_mutex);
+ return PIPE_OK;
+}
+
+
+struct svga_winsys_surface *
+svga_buffer_handle(struct svga_context *svga,
+ struct pipe_buffer *buf)
+{
+ struct pipe_screen *screen = svga->pipe.screen;
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_buffer *sbuf;
+ enum pipe_error ret;
+
+ if(!buf)
+ return NULL;
+
+ sbuf = svga_buffer(buf);
+
+ assert(!sbuf->map.count);
+
+ if(!sbuf->handle) {
+ ret = svga_buffer_create_host_surface(ss, sbuf);
+ if(ret != PIPE_OK)
+ return NULL;
+
+ ret = svga_buffer_update_hw(ss, sbuf);
+ if(ret != PIPE_OK)
+ return NULL;
+ }
+
+ if(!sbuf->needs_flush && sbuf->hw.num_ranges) {
+ /* Queue the buffer for flushing */
+ ret = svga_buffer_upload_command(svga, sbuf);
+ if(ret != PIPE_OK)
+ /* XXX: Should probably have a richer return value */
+ return NULL;
+
+ assert(sbuf->hw.svga == svga);
+
+ sbuf->needs_flush = TRUE;
+ assert(sbuf->head.prev && sbuf->head.next);
+ LIST_DEL(&sbuf->head);
+ LIST_ADDTAIL(&sbuf->head, &svga->dirty_buffers);
+ }
+
+ return sbuf->handle;
+}
+
+struct pipe_buffer *
+svga_screen_buffer_wrap_surface(struct pipe_screen *screen,
+ enum SVGA3dSurfaceFormat format,
+ struct svga_winsys_surface *srf)
+{
+ struct pipe_buffer *buf;
+ struct svga_buffer *sbuf;
+ struct svga_winsys_screen *sws = svga_winsys_screen(screen);
+
+ buf = svga_buffer_create(screen, 0, SVGA_BUFFER_USAGE_WRAPPED, 0);
+ if (!buf)
+ return NULL;
+
+ sbuf = svga_buffer(buf);
+
+ /*
+ * We are not the creator of this surface and therefore we must not
+ * cache it for reuse. The caching code only caches SVGA3D_BUFFER surfaces
+ * so make sure this isn't one of those.
+ */
+
+ assert(format != SVGA3D_BUFFER);
+ sbuf->key.format = format;
+ sws->surface_reference(sws, &sbuf->handle, srf);
+
+ return buf;
+}
+
+
+struct svga_winsys_surface *
+svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer)
+{
+ struct svga_winsys_screen *sws = svga_winsys_screen(buffer->screen);
+ struct svga_winsys_surface *vsurf = NULL;
+
+ sws->surface_reference(sws, &vsurf, svga_buffer(buffer)->handle);
+ return vsurf;
+}
+
+void
+svga_context_flush_buffers(struct svga_context *svga)
+{
+ struct list_head *curr, *next;
+ struct svga_buffer *sbuf;
+
+ curr = svga->dirty_buffers.next;
+ next = curr->next;
+ while(curr != &svga->dirty_buffers) {
+ sbuf = LIST_ENTRY(struct svga_buffer, curr, head);
+
+ assert(p_atomic_read(&sbuf->base.reference.count) != 0);
+ assert(sbuf->needs_flush);
+
+ svga_buffer_upload_flush(svga, sbuf);
+
+ curr = next;
+ next = curr->next;
+ }
+}
diff --git a/src/gallium/drivers/svga/svga_screen_buffer.h b/src/gallium/drivers/svga/svga_screen_buffer.h
new file mode 100644
index 0000000000..5d7af5a7c5
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_buffer.h
@@ -0,0 +1,190 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_BUFFER_H
+#define SVGA_BUFFER_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+#include "util/u_double_list.h"
+
+#include "svga_screen_cache.h"
+
+
+#define SVGA_BUFFER_MAGIC 0x344f9005
+
+/**
+ * Maximum number of discontiguous ranges
+ */
+#define SVGA_BUFFER_MAX_RANGES 32
+
+
+struct svga_screen;
+struct svga_context;
+struct svga_winsys_buffer;
+struct svga_winsys_surface;
+
+
+struct svga_buffer_range
+{
+ unsigned start;
+ unsigned end;
+};
+
+
+/**
+ * Describe a
+ *
+ * This holds the information to emit a SVGA3dCmdSurfaceDMA.
+ */
+struct svga_buffer_upload
+{
+ /**
+ * Guest memory region.
+ */
+ struct svga_winsys_buffer *buf;
+
+ struct svga_buffer_range ranges[SVGA_BUFFER_MAX_RANGES];
+ unsigned num_ranges;
+
+ SVGA3dSurfaceDMAFlags flags;
+
+ /**
+ * Pointer to the DMA copy box *inside* the command buffer.
+ */
+ SVGA3dCopyBox *boxes;
+
+ /**
+ * Context that has the pending DMA to this buffer.
+ */
+ struct svga_context *svga;
+};
+
+
+/**
+ * SVGA pipe buffer.
+ */
+struct svga_buffer
+{
+ struct pipe_buffer base;
+
+ /**
+ * Marker to detect bad casts in runtime.
+ */
+ uint32_t magic;
+
+ /**
+ * Regular (non DMA'able) memory.
+ *
+ * Used for user buffers or for buffers which we know before hand that can
+ * never be used by the virtual hardware directly, such as constant buffers.
+ */
+ void *swbuf;
+
+ /**
+ * Whether swbuf was created by the user or not.
+ */
+ boolean user;
+
+ /**
+ * DMA'ble memory.
+ *
+ * A piece of GMR memory. It is created when mapping the buffer, and will be
+ * used to upload/download vertex data from the host.
+ */
+ struct svga_buffer_upload hw;
+
+ /**
+ * Creation key for the host surface handle.
+ *
+ * This structure describes all the host surface characteristics so that it
+ * can be looked up in cache, since creating a host surface is often a slow
+ * operation.
+ */
+ struct svga_host_surface_cache_key key;
+
+ /**
+ * Host surface handle.
+ *
+ * This is a platform independent abstraction for host SID. We create when
+ * trying to bind
+ */
+ struct svga_winsys_surface *handle;
+
+ struct {
+ unsigned count;
+ boolean writing;
+ boolean flush_explicit;
+ } map;
+
+ boolean needs_flush;
+ struct list_head head;
+};
+
+
+static INLINE struct svga_buffer *
+svga_buffer(struct pipe_buffer *buffer)
+{
+ if (buffer) {
+ assert(((struct svga_buffer *)buffer)->magic == SVGA_BUFFER_MAGIC);
+ return (struct svga_buffer *)buffer;
+ }
+ return NULL;
+}
+
+
+/**
+ * Returns TRUE for user buffers. We may
+ * decide to use an alternate upload path for these buffers.
+ */
+static INLINE boolean
+svga_buffer_is_user_buffer( struct pipe_buffer *buffer )
+{
+ return svga_buffer(buffer)->user;
+}
+
+
+void
+svga_screen_init_buffer_functions(struct pipe_screen *screen);
+
+struct svga_winsys_surface *
+svga_buffer_handle(struct svga_context *svga,
+ struct pipe_buffer *buf);
+
+void
+svga_context_flush_buffers(struct svga_context *svga);
+
+boolean
+svga_buffer_free_cached_hw_storage(struct svga_screen *ss);
+
+struct svga_winsys_buffer *
+svga_winsys_buffer_create(struct svga_screen *ss,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size);
+
+#endif /* SVGA_BUFFER_H */
diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
new file mode 100644
index 0000000000..7360c1688b
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -0,0 +1,307 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "util/u_memory.h"
+
+#include "svga_debug.h"
+#include "svga_winsys.h"
+#include "svga_screen.h"
+#include "svga_screen_cache.h"
+
+
+#define SVGA_SURFACE_CACHE_ENABLED 1
+
+
+/**
+ * Compute the bucket for this key.
+ *
+ * We simply compute log2(width) for now, but
+ */
+static INLINE unsigned
+svga_screen_cache_bucket(const struct svga_host_surface_cache_key *key)
+{
+ unsigned bucket = 0;
+ unsigned size = key->size.width;
+
+ while ((size >>= 1))
+ ++bucket;
+
+ if(key->flags & SVGA3D_SURFACE_HINT_INDEXBUFFER)
+ bucket += 32;
+
+ assert(bucket < SVGA_HOST_SURFACE_CACHE_BUCKETS);
+
+ return bucket;
+}
+
+
+static INLINE struct svga_winsys_surface *
+svga_screen_cache_lookup(struct svga_screen *svgascreen,
+ const struct svga_host_surface_cache_key *key)
+{
+ struct svga_host_surface_cache *cache = &svgascreen->cache;
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_host_surface_cache_entry *entry;
+ struct svga_winsys_surface *handle = NULL;
+ struct list_head *curr, *next;
+ unsigned bucket;
+ unsigned tries = 0;
+
+ bucket = svga_screen_cache_bucket(key);
+
+ pipe_mutex_lock(cache->mutex);
+
+ curr = cache->bucket[bucket].next;
+ next = curr->next;
+ while(curr != &cache->bucket[bucket]) {
+ ++tries;
+
+ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, bucket_head);
+
+ assert(entry->handle);
+
+ if(memcmp(&entry->key, key, sizeof *key) == 0 &&
+ sws->fence_signalled( sws, entry->fence, 0 ) == 0) {
+ assert(sws->surface_is_flushed(sws, entry->handle));
+
+ handle = entry->handle; // Reference is transfered here.
+ entry->handle = NULL;
+
+ LIST_DEL(&entry->bucket_head);
+
+ LIST_DEL(&entry->head);
+
+ LIST_ADD(&entry->head, &cache->empty);
+
+ break;
+ }
+
+ curr = next;
+ next = curr->next;
+ }
+
+ pipe_mutex_unlock(cache->mutex);
+
+#if 0
+ _debug_printf("%s: cache %s after %u tries\n", __FUNCTION__, handle ? "hit" : "miss", tries);
+#else
+ (void)tries;
+#endif
+
+ return handle;
+}
+
+
+/*
+ * Transfers a handle reference.
+ */
+
+static INLINE void
+svga_screen_cache_add(struct svga_screen *svgascreen,
+ const struct svga_host_surface_cache_key *key,
+ struct svga_winsys_surface **p_handle)
+{
+ struct svga_host_surface_cache *cache = &svgascreen->cache;
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_host_surface_cache_entry *entry = NULL;
+ struct svga_winsys_surface *handle = *p_handle;
+
+
+ assert(handle);
+ if(!handle)
+ return;
+
+ *p_handle = NULL;
+ pipe_mutex_lock(cache->mutex);
+
+ if(!LIST_IS_EMPTY(&cache->empty)) {
+ /* use the first empty entry */
+ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->empty.next, head);
+
+ LIST_DEL(&entry->head);
+ }
+ else if(!LIST_IS_EMPTY(&cache->unused)) {
+ /* free the last used buffer and reuse its entry */
+ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->unused.prev, head);
+ SVGA_DBG(DEBUG_DMA, "unref sid %p\n", entry->handle);
+ sws->surface_reference(sws, &entry->handle, NULL);
+
+ LIST_DEL(&entry->bucket_head);
+
+ LIST_DEL(&entry->head);
+ }
+
+ if(entry) {
+ entry->handle = handle;
+ memcpy(&entry->key, key, sizeof entry->key);
+
+ LIST_ADD(&entry->head, &cache->validated);
+ }
+ else {
+ /* Couldn't cache the buffer -- this really shouldn't happen */
+ SVGA_DBG(DEBUG_DMA, "unref sid %p\n", handle);
+ sws->surface_reference(sws, &handle, NULL);
+ }
+
+ pipe_mutex_unlock(cache->mutex);
+}
+
+
+/**
+ * Called during the screen flush to move all buffers not in a validate list
+ * into the unused list.
+ */
+void
+svga_screen_cache_flush(struct svga_screen *svgascreen,
+ struct pipe_fence_handle *fence)
+{
+ struct svga_host_surface_cache *cache = &svgascreen->cache;
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_host_surface_cache_entry *entry;
+ struct list_head *curr, *next;
+ unsigned bucket;
+
+ pipe_mutex_lock(cache->mutex);
+
+ curr = cache->validated.next;
+ next = curr->next;
+ while(curr != &cache->validated) {
+ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, head);
+
+ assert(entry->handle);
+
+ if(sws->surface_is_flushed(sws, entry->handle)) {
+ LIST_DEL(&entry->head);
+
+ svgascreen->sws->fence_reference(svgascreen->sws, &entry->fence, fence);
+
+ LIST_ADD(&entry->head, &cache->unused);
+
+ bucket = svga_screen_cache_bucket(&entry->key);
+ LIST_ADD(&entry->bucket_head, &cache->bucket[bucket]);
+ }
+
+ curr = next;
+ next = curr->next;
+ }
+
+ pipe_mutex_unlock(cache->mutex);
+}
+
+
+void
+svga_screen_cache_cleanup(struct svga_screen *svgascreen)
+{
+ struct svga_host_surface_cache *cache = &svgascreen->cache;
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ unsigned i;
+
+ for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) {
+ if(cache->entries[i].handle) {
+ SVGA_DBG(DEBUG_DMA, "unref sid %p\n", cache->entries[i].handle);
+ sws->surface_reference(sws, &cache->entries[i].handle, NULL);
+ }
+
+ if(cache->entries[i].fence)
+ svgascreen->sws->fence_reference(svgascreen->sws, &cache->entries[i].fence, NULL);
+ }
+
+ pipe_mutex_destroy(cache->mutex);
+}
+
+
+enum pipe_error
+svga_screen_cache_init(struct svga_screen *svgascreen)
+{
+ struct svga_host_surface_cache *cache = &svgascreen->cache;
+ unsigned i;
+
+ pipe_mutex_init(cache->mutex);
+
+ for(i = 0; i < SVGA_HOST_SURFACE_CACHE_BUCKETS; ++i)
+ LIST_INITHEAD(&cache->bucket[i]);
+
+ LIST_INITHEAD(&cache->unused);
+
+ LIST_INITHEAD(&cache->validated);
+
+ LIST_INITHEAD(&cache->empty);
+ for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i)
+ LIST_ADDTAIL(&cache->entries[i].head, &cache->empty);
+
+ return PIPE_OK;
+}
+
+
+struct svga_winsys_surface *
+svga_screen_surface_create(struct svga_screen *svgascreen,
+ struct svga_host_surface_cache_key *key)
+{
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_winsys_surface *handle = NULL;
+
+ if (SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) {
+ /* round the buffer size up to the nearest power of two to increase the
+ * probability of cache hits */
+ uint32_t size = 1;
+ while(size < key->size.width)
+ size <<= 1;
+ key->size.width = size;
+
+ handle = svga_screen_cache_lookup(svgascreen, key);
+ if (handle)
+ SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d\n", handle, size);
+ }
+
+ if (!handle) {
+ handle = sws->surface_create(sws,
+ key->flags,
+ key->format,
+ key->size,
+ key->numFaces,
+ key->numMipLevels);
+ if (handle)
+ SVGA_DBG(DEBUG_DMA, "create sid %p sz %d\n", handle, key->size);
+ }
+
+ return handle;
+}
+
+
+void
+svga_screen_surface_destroy(struct svga_screen *svgascreen,
+ const struct svga_host_surface_cache_key *key,
+ struct svga_winsys_surface **p_handle)
+{
+ struct svga_winsys_screen *sws = svgascreen->sws;
+
+ if(SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) {
+ svga_screen_cache_add(svgascreen, key, p_handle);
+ }
+ else {
+ SVGA_DBG(DEBUG_DMA, "unref sid %p\n", *p_handle);
+ sws->surface_reference(sws, p_handle, NULL);
+ }
+}
diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h
new file mode 100644
index 0000000000..1bbe987768
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_cache.h
@@ -0,0 +1,135 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_SCREEN_CACHE_H_
+#define SVGA_SCREEN_CACHE_H_
+
+
+#include "svga_types.h"
+#include "svga_reg.h"
+#include "svga3d_reg.h"
+
+#include "pipe/p_thread.h"
+
+#include "util/u_double_list.h"
+
+
+/* TODO: Reduce this once we don't allocate an index buffer per draw call */
+#define SVGA_HOST_SURFACE_CACHE_SIZE 1024
+
+#define SVGA_HOST_SURFACE_CACHE_BUCKETS 64
+
+
+struct svga_winsys_surface;
+struct svga_screen;
+
+/**
+ * Same as svga_winsys_screen::surface_create.
+ */
+struct svga_host_surface_cache_key
+{
+ SVGA3dSurfaceFlags flags;
+ SVGA3dSurfaceFormat format;
+ SVGA3dSize size;
+ uint32_t numFaces;
+ uint32_t numMipLevels;
+};
+
+
+struct svga_host_surface_cache_entry
+{
+ /**
+ * Head for the LRU list, svga_host_surface_cache::unused, and
+ * svga_host_surface_cache::empty
+ */
+ struct list_head head;
+
+ /** Head for the bucket lists. */
+ struct list_head bucket_head;
+
+ struct svga_host_surface_cache_key key;
+ struct svga_winsys_surface *handle;
+
+ struct pipe_fence_handle *fence;
+};
+
+
+/**
+ * Cache of the host surfaces.
+ *
+ * A cache entry can be in the following stages:
+ * 1. empty
+ * 2. holding a buffer in a validate list
+ * 3. holding a flushed buffer (not in any validate list) with an active fence
+ * 4. holding a flushed buffer with an expired fence
+ *
+ * An entry progresses from 1 -> 2 -> 3 -> 4. When we need an entry to put a
+ * buffer into we preferencial take from 1, or from the least recentely used
+ * buffer from 3/4.
+ */
+struct svga_host_surface_cache
+{
+ pipe_mutex mutex;
+
+ /* Unused buffers are put in buckets to speed up lookups */
+ struct list_head bucket[SVGA_HOST_SURFACE_CACHE_BUCKETS];
+
+ /* Entries with unused buffers, ordered from most to least recently used
+ * (3 and 4) */
+ struct list_head unused;
+
+ /* Entries with buffers still in validate lists (2) */
+ struct list_head validated;
+
+ /** Empty entries (1) */
+ struct list_head empty;
+
+ /** The actual storage for the entries */
+ struct svga_host_surface_cache_entry entries[SVGA_HOST_SURFACE_CACHE_SIZE];
+};
+
+
+void
+svga_screen_cache_cleanup(struct svga_screen *svgascreen);
+
+void
+svga_screen_cache_flush(struct svga_screen *svgascreen,
+ struct pipe_fence_handle *fence);
+
+enum pipe_error
+svga_screen_cache_init(struct svga_screen *svgascreen);
+
+
+struct svga_winsys_surface *
+svga_screen_surface_create(struct svga_screen *svgascreen,
+ struct svga_host_surface_cache_key *key);
+
+void
+svga_screen_surface_destroy(struct svga_screen *svgascreen,
+ const struct svga_host_surface_cache_key *key,
+ struct svga_winsys_surface **handle);
+
+
+#endif /* SVGA_SCREEN_CACHE_H_ */
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
new file mode 100644
index 0000000000..8472dea04d
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -0,0 +1,1065 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "svga_cmd.h"
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_thread.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "svga_screen.h"
+#include "svga_context.h"
+#include "svga_screen_texture.h"
+#include "svga_screen_buffer.h"
+#include "svga_winsys.h"
+#include "svga_debug.h"
+#include "svga_screen_buffer.h"
+
+#include
+
+
+/* XXX: This isn't a real hardware flag, but just a hack for kernel to
+ * know about primary surfaces. Find a better way to accomplish this.
+ */
+#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9)
+
+
+/*
+ * Helper function and arrays
+ */
+
+SVGA3dSurfaceFormat
+svga_translate_format(enum pipe_format format)
+{
+ switch(format) {
+
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ return SVGA3D_A8R8G8B8;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ return SVGA3D_X8R8G8B8;
+
+ /* Required for GL2.1:
+ */
+ case PIPE_FORMAT_A8R8G8B8_SRGB:
+ return SVGA3D_A8R8G8B8;
+
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ return SVGA3D_R5G6B5;
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
+ return SVGA3D_A1R5G5B5;
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ return SVGA3D_A4R4G4B4;
+
+
+ /* XXX: Doesn't seem to work properly.
+ case PIPE_FORMAT_Z32_UNORM:
+ return SVGA3D_Z_D32;
+ */
+ case PIPE_FORMAT_Z16_UNORM:
+ return SVGA3D_Z_D16;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ return SVGA3D_Z_D24S8;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ return SVGA3D_Z_D24X8;
+
+ case PIPE_FORMAT_A8_UNORM:
+ return SVGA3D_ALPHA8;
+ case PIPE_FORMAT_L8_UNORM:
+ return SVGA3D_LUMINANCE8;
+
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ return SVGA3D_DXT1;
+ case PIPE_FORMAT_DXT3_RGBA:
+ return SVGA3D_DXT3;
+ case PIPE_FORMAT_DXT5_RGBA:
+ return SVGA3D_DXT5;
+
+ default:
+ return SVGA3D_FORMAT_INVALID;
+ }
+}
+
+
+SVGA3dSurfaceFormat
+svga_translate_format_render(enum pipe_format format)
+{
+ switch(format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ case PIPE_FORMAT_A1R5G5B5_UNORM:
+ case PIPE_FORMAT_A4R4G4B4_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z32_UNORM:
+ case PIPE_FORMAT_Z16_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
+ return svga_translate_format(format);
+
+#if 1
+ /* For on host conversion */
+ case PIPE_FORMAT_DXT1_RGB:
+ return SVGA3D_X8R8G8B8;
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ return SVGA3D_A8R8G8B8;
+#endif
+
+ default:
+ return SVGA3D_FORMAT_INVALID;
+ }
+}
+
+
+static INLINE void
+svga_transfer_dma_band(struct svga_transfer *st,
+ SVGA3dTransferType transfer,
+ unsigned y, unsigned h, unsigned srcy)
+{
+ struct svga_texture *texture = svga_texture(st->base.texture);
+ struct svga_screen *screen = svga_screen(texture->base.screen);
+ SVGA3dCopyBox box;
+ enum pipe_error ret;
+
+ SVGA_DBG(DEBUG_DMA, "dma %s sid %p, face %u, (%u, %u, %u) - (%u, %u, %u), %ubpp\n",
+ transfer == SVGA3D_WRITE_HOST_VRAM ? "to" : "from",
+ texture->handle,
+ st->base.face,
+ st->base.x,
+ y,
+ st->base.zslice,
+ st->base.x + st->base.width,
+ y + h,
+ st->base.zslice + 1,
+ texture->base.block.size*8/(texture->base.block.width*texture->base.block.height));
+
+ box.x = st->base.x;
+ box.y = y;
+ box.z = st->base.zslice;
+ box.w = st->base.width;
+ box.h = h;
+ box.d = 1;
+ box.srcx = 0;
+ box.srcy = srcy;
+ box.srcz = 0;
+
+ pipe_mutex_lock(screen->swc_mutex);
+ ret = SVGA3D_SurfaceDMA(screen->swc, st, transfer, &box, 1);
+ if(ret != PIPE_OK) {
+ screen->swc->flush(screen->swc, NULL);
+ ret = SVGA3D_SurfaceDMA(screen->swc, st, transfer, &box, 1);
+ assert(ret == PIPE_OK);
+ }
+ pipe_mutex_unlock(screen->swc_mutex);
+}
+
+
+static INLINE void
+svga_transfer_dma(struct svga_transfer *st,
+ SVGA3dTransferType transfer)
+{
+ struct svga_texture *texture = svga_texture(st->base.texture);
+ struct svga_screen *screen = svga_screen(texture->base.screen);
+ struct svga_winsys_screen *sws = screen->sws;
+ struct pipe_fence_handle *fence = NULL;
+
+ if (transfer == SVGA3D_READ_HOST_VRAM) {
+ SVGA_DBG(DEBUG_PERF, "%s: readback transfer\n", __FUNCTION__);
+ }
+
+
+ if(!st->swbuf) {
+ /* Do the DMA transfer in a single go */
+
+ svga_transfer_dma_band(st, transfer, st->base.y, st->base.height, 0);
+
+ if(transfer == SVGA3D_READ_HOST_VRAM) {
+ svga_screen_flush(screen, &fence);
+ sws->fence_finish(sws, fence, 0);
+ //sws->fence_reference(sws, &fence, NULL);
+ }
+ }
+ else {
+ unsigned y, h, srcy;
+ h = st->hw_nblocksy * st->base.block.height;
+ srcy = 0;
+ for(y = 0; y < st->base.height; y += h) {
+ unsigned offset, length;
+ void *hw, *sw;
+
+ if (y + h > st->base.height)
+ h = st->base.height - y;
+
+ /* Transfer band must be aligned to pixel block boundaries */
+ assert(y % st->base.block.height == 0);
+ assert(h % st->base.block.height == 0);
+
+ offset = y * st->base.stride / st->base.block.height;
+ length = h * st->base.stride / st->base.block.height;
+
+ sw = (uint8_t *)st->swbuf + offset;
+
+ if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+ /* Wait for the previous DMAs to complete */
+ /* TODO: keep one DMA (at half the size) in the background */
+ if(y) {
+ svga_screen_flush(screen, &fence);
+ sws->fence_finish(sws, fence, 0);
+ //sws->fence_reference(sws, &fence, NULL);
+ }
+
+ hw = sws->buffer_map(sws, st->hwbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
+ assert(hw);
+ if(hw) {
+ memcpy(hw, sw, length);
+ sws->buffer_unmap(sws, st->hwbuf);
+ }
+ }
+
+ svga_transfer_dma_band(st, transfer, y, h, srcy);
+
+ if(transfer == SVGA3D_READ_HOST_VRAM) {
+ svga_screen_flush(screen, &fence);
+ sws->fence_finish(sws, fence, 0);
+
+ hw = sws->buffer_map(sws, st->hwbuf, PIPE_BUFFER_USAGE_CPU_READ);
+ assert(hw);
+ if(hw) {
+ memcpy(sw, hw, length);
+ sws->buffer_unmap(sws, st->hwbuf);
+ }
+ }
+ }
+ }
+}
+
+
+static struct pipe_texture *
+svga_texture_create(struct pipe_screen *screen,
+ const struct pipe_texture *templat)
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ struct svga_texture *tex = CALLOC_STRUCT(svga_texture);
+ unsigned width, height, depth;
+ SVGA3dSurfaceFlags flags = 0;
+ SVGA3dSurfaceFormat format;
+ SVGA3dSize size;
+ uint32 numFaces;
+ uint32 numMipLevels;
+ unsigned level;
+
+ if (!tex)
+ goto error1;
+
+ tex->base = *templat;
+ pipe_reference_init(&tex->base.reference, 1);
+ tex->base.screen = screen;
+
+ assert(templat->last_level < SVGA_MAX_TEXTURE_LEVELS);
+ if(templat->last_level >= SVGA_MAX_TEXTURE_LEVELS)
+ goto error2;
+
+ width = templat->width[0];
+ height = templat->height[0];
+ depth = templat->depth[0];
+ for(level = 0; level <= templat->last_level; ++level) {
+ tex->base.width[level] = width;
+ tex->base.height[level] = height;
+ tex->base.depth[level] = depth;
+ tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width);
+ tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height);
+ width = minify(width);
+ height = minify(height);
+ depth = minify(depth);
+ }
+
+ size.width = templat->width[0];
+ size.height = templat->height[0];
+ size.depth = templat->depth[0];
+
+ if(templat->target == PIPE_TEXTURE_CUBE) {
+ flags |= SVGA3D_SURFACE_CUBEMAP;
+ numFaces = 6;
+ }
+ else {
+ numFaces = 1;
+ }
+
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER)
+ flags |= SVGA3D_SURFACE_HINT_TEXTURE;
+
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+ flags |= SVGA3D_SURFACE_HINT_SCANOUT;
+
+ /*
+ * XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
+ * know beforehand whether a texture will be used as a rendertarget or not
+ * and it always requests PIPE_TEXTURE_USAGE_RENDER_TARGET, therefore
+ * passing the SVGA3D_SURFACE_HINT_RENDERTARGET here defeats its purpose.
+ */
+#if 0
+ if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) &&
+ !pf_is_compressed(templat->format))
+ flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
+#endif
+
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL)
+ flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL;
+
+ numMipLevels = templat->last_level + 1;
+
+ format = svga_translate_format(templat->format);
+ if(format == SVGA3D_FORMAT_INVALID)
+ goto error2;
+
+ tex->handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels);
+ if (tex->handle)
+ SVGA_DBG(DEBUG_DMA, "create sid %p (texture)\n", tex->handle);
+
+ return &tex->base;
+
+error2:
+ FREE(tex);
+error1:
+ return NULL;
+}
+
+
+static struct pipe_texture *
+svga_texture_blanket(struct pipe_screen * screen,
+ const struct pipe_texture *base,
+ const unsigned *stride,
+ struct pipe_buffer *buffer)
+{
+ struct svga_texture *tex;
+ struct svga_buffer *sbuf = svga_buffer(buffer);
+ struct svga_winsys_screen *sws = svga_winsys_screen(screen);
+ assert(screen);
+
+ /* Only supports one type */
+ if (base->target != PIPE_TEXTURE_2D ||
+ base->last_level != 0 ||
+ base->depth[0] != 1) {
+ return NULL;
+ }
+
+ /**
+ * We currently can't do texture blanket on
+ * SVGA3D_BUFFER. Need to blit to a temporary surface?
+ */
+
+ assert(sbuf->handle);
+ if (!sbuf->handle)
+ return NULL;
+
+ if (svga_translate_format(base->format) != sbuf->key.format) {
+ unsigned f1 = svga_translate_format(base->format);
+ unsigned f2 = sbuf->key.format;
+
+ /* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */
+ if ( !( (f1 == SVGA3D_X8R8G8B8 && f2 == SVGA3D_A8R8G8B8) ||
+ (f1 == SVGA3D_A8R8G8B8 && f2 == SVGA3D_X8R8G8B8) ||
+ (f1 == SVGA3D_Z_D24X8 && f2 == SVGA3D_Z_D24S8) ) ) {
+ debug_printf("%s wrong format %u != %u\n", __FUNCTION__, f1, f2);
+ return NULL;
+ }
+ }
+
+ tex = CALLOC_STRUCT(svga_texture);
+ if (!tex)
+ return NULL;
+
+ tex->base = *base;
+
+ if (sbuf->key.format == 1)
+ tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+ else if (sbuf->key.format == 2)
+ tex->base.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ pipe_reference_init(&tex->base.reference, 1);
+ tex->base.screen = screen;
+
+ sws->surface_reference(sws, &tex->handle, sbuf->handle);
+
+ return &tex->base;
+}
+
+
+static void
+svga_texture_destroy(struct pipe_texture *pt)
+{
+ struct svga_screen *ss = svga_screen(pt->screen);
+ struct svga_texture *tex = (struct svga_texture *)pt;
+
+ ss->texture_timestamp++;
+
+ svga_sampler_view_reference(&tex->cached_view, NULL);
+
+ /*
+ DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
+ */
+ SVGA_DBG(DEBUG_DMA, "unref sid %p (texture)\n", tex->handle);
+ ss->sws->surface_reference(ss->sws, &tex->handle, NULL);
+
+ FREE(tex);
+}
+
+
+static void
+svga_texture_copy_handle(struct svga_context *svga,
+ struct svga_screen *ss,
+ struct svga_winsys_surface *src_handle,
+ unsigned src_x, unsigned src_y, unsigned src_z,
+ unsigned src_level, unsigned src_face,
+ struct svga_winsys_surface *dst_handle,
+ unsigned dst_x, unsigned dst_y, unsigned dst_z,
+ unsigned dst_level, unsigned dst_face,
+ unsigned width, unsigned height, unsigned depth)
+{
+ struct svga_surface dst, src;
+ enum pipe_error ret;
+ SVGA3dCopyBox box, *boxes;
+
+ assert(svga || ss);
+
+ src.handle = src_handle;
+ src.real_level = src_level;
+ src.real_face = src_face;
+ src.real_zslice = 0;
+
+ dst.handle = dst_handle;
+ dst.real_level = dst_level;
+ dst.real_face = dst_face;
+ dst.real_zslice = 0;
+
+ box.x = dst_x;
+ box.y = dst_y;
+ box.z = dst_z;
+ box.w = width;
+ box.h = height;
+ box.d = depth;
+ box.srcx = src_x;
+ box.srcy = src_y;
+ box.srcz = src_z;
+
+/*
+ SVGA_DBG(DEBUG_VIEWS, "mipcopy src: %p %u (%ux%ux%u), dst: %p %u (%ux%ux%u)\n",
+ src_handle, src_level, src_x, src_y, src_z,
+ dst_handle, dst_level, dst_x, dst_y, dst_z);
+*/
+
+ if (svga) {
+ ret = SVGA3D_BeginSurfaceCopy(svga->swc,
+ &src.base,
+ &dst.base,
+ &boxes, 1);
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_BeginSurfaceCopy(svga->swc,
+ &src.base,
+ &dst.base,
+ &boxes, 1);
+ assert(ret == PIPE_OK);
+ }
+ *boxes = box;
+ SVGA_FIFOCommitAll(svga->swc);
+ } else {
+ pipe_mutex_lock(ss->swc_mutex);
+ ret = SVGA3D_BeginSurfaceCopy(ss->swc,
+ &src.base,
+ &dst.base,
+ &boxes, 1);
+ if(ret != PIPE_OK) {
+ ss->swc->flush(ss->swc, NULL);
+ ret = SVGA3D_BeginSurfaceCopy(ss->swc,
+ &src.base,
+ &dst.base,
+ &boxes, 1);
+ assert(ret == PIPE_OK);
+ }
+ *boxes = box;
+ SVGA_FIFOCommitAll(ss->swc);
+ pipe_mutex_unlock(ss->swc_mutex);
+ }
+}
+
+static struct svga_winsys_surface *
+svga_texture_view_surface(struct pipe_context *pipe,
+ struct svga_texture *tex,
+ SVGA3dSurfaceFormat format,
+ unsigned start_mip,
+ unsigned num_mip,
+ int face_pick,
+ int zslice_pick)
+{
+ struct svga_screen *ss = svga_screen(tex->base.screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_winsys_surface *handle;
+ int i, j;
+ SVGA3dSurfaceFlags flags = 0;
+ SVGA3dSize size;
+ uint32 numFaces;
+ uint32 numMipLevels = num_mip;
+ unsigned z_offset = 0;
+
+ SVGA_DBG(DEBUG_PERF,
+ "svga: Create surface view: face %d zslice %d mips %d..%d\n",
+ face_pick, zslice_pick, start_mip, start_mip+num_mip-1);
+
+ size.width = tex->base.width[start_mip];
+ size.height = tex->base.height[start_mip];
+ size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1;
+ assert(size.depth == 1);
+
+ if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) {
+ flags |= SVGA3D_SURFACE_CUBEMAP;
+ numFaces = 6;
+ } else {
+ numFaces = 1;
+ }
+
+ if(format == SVGA3D_FORMAT_INVALID)
+ return NULL;
+
+ handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels);
+
+ if (!handle)
+ return NULL;
+
+ SVGA_DBG(DEBUG_DMA, "create sid %p (texture view)\n", handle);
+
+ if (face_pick < 0)
+ face_pick = 0;
+
+ if (zslice_pick >= 0)
+ z_offset = zslice_pick;
+
+ for (i = 0; i < num_mip; i++) {
+ for (j = 0; j < numFaces; j++) {
+ if(tex->defined[j + face_pick][i + start_mip]) {
+ unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1;
+ svga_texture_copy_handle(svga_context(pipe), ss,
+ tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick,
+ handle, 0, 0, 0, i, j,
+ tex->base.width[i + start_mip], tex->base.height[i + start_mip], depth);
+ }
+ }
+ }
+
+ return handle;
+}
+
+
+static struct pipe_surface *
+svga_get_tex_surface(struct pipe_screen *screen,
+ struct pipe_texture *pt,
+ unsigned face, unsigned level, unsigned zslice,
+ unsigned flags)
+{
+ struct svga_texture *tex = svga_texture(pt);
+ struct svga_surface *s;
+ struct pipe_surface *ps;
+ boolean render = flags & PIPE_BUFFER_USAGE_GPU_WRITE ? TRUE : FALSE;
+ boolean view = FALSE;
+ SVGA3dSurfaceFormat format;
+
+ s = CALLOC_STRUCT(svga_surface);
+ ps = &s->base;
+ if (!ps)
+ return NULL;
+
+ pipe_reference_init(&ps->reference, 1);
+ pipe_texture_reference(&ps->texture, pt);
+ ps->format = pt->format;
+ ps->width = pt->width[level];
+ ps->height = pt->height[level];
+ ps->usage = flags;
+ ps->level = level;
+ ps->face = face;
+ ps->zslice = zslice;
+
+ if (!render)
+ format = svga_translate_format(pt->format);
+ else
+ format = svga_translate_format_render(pt->format);
+
+ assert(format != SVGA3D_FORMAT_INVALID);
+ assert(!(flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
+
+
+ if (svga_screen(screen)->debug.force_surface_view)
+ view = TRUE;
+
+ /* Currently only used for compressed textures */
+ if (render && (format != svga_translate_format(pt->format))) {
+ view = TRUE;
+ }
+
+ if (level != 0 && svga_screen(screen)->debug.force_level_surface_view)
+ view = TRUE;
+
+ if (pt->target == PIPE_TEXTURE_3D)
+ view = TRUE;
+
+ if (svga_screen(screen)->debug.no_surface_view)
+ view = FALSE;
+
+ if (view) {
+ SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: yes %p, level %u face %u z %u, %p\n",
+ pt, level, face, zslice, ps);
+
+ s->handle = svga_texture_view_surface(NULL, tex, format, level, 1, face, zslice);
+ s->real_face = 0;
+ s->real_level = 0;
+ s->real_zslice = 0;
+ } else {
+ struct svga_winsys_screen *sws = svga_winsys_screen(screen);
+
+ SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n",
+ pt, level, face, zslice, ps);
+
+ sws->surface_reference(sws, &s->handle, tex->handle);
+ s->real_face = face;
+ s->real_level = level;
+ s->real_zslice = zslice;
+ }
+
+ return ps;
+}
+
+
+static void
+svga_tex_surface_destroy(struct pipe_surface *surf)
+{
+ struct svga_surface *s = svga_surface(surf);
+ struct svga_screen *ss = svga_screen(surf->texture->screen);
+
+ SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle);
+ ss->sws->surface_reference(ss->sws, &s->handle, NULL);
+ pipe_texture_reference(&surf->texture, NULL);
+ FREE(surf);
+}
+
+
+static INLINE void
+svga_mark_surface_dirty(struct pipe_surface *surf)
+{
+ struct svga_surface *s = svga_surface(surf);
+
+ if(!s->dirty) {
+ struct svga_texture *tex = svga_texture(surf->texture);
+
+ s->dirty = TRUE;
+
+ if (s->handle == tex->handle)
+ tex->defined[surf->face][surf->level] = TRUE;
+ else {
+ /* this will happen later in svga_propagate_surface */
+ }
+ }
+}
+
+
+void svga_mark_surfaces_dirty(struct svga_context *svga)
+{
+ unsigned i;
+
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ if (svga->curr.framebuffer.cbufs[i])
+ svga_mark_surface_dirty(svga->curr.framebuffer.cbufs[i]);
+ }
+ if (svga->curr.framebuffer.zsbuf)
+ svga_mark_surface_dirty(svga->curr.framebuffer.zsbuf);
+}
+
+/**
+ * Progagate any changes from surfaces to texture.
+ * pipe is optional context to inline the blit command in.
+ */
+void
+svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf)
+{
+ struct svga_surface *s = svga_surface(surf);
+ struct svga_texture *tex = svga_texture(surf->texture);
+ struct svga_screen *ss = svga_screen(surf->texture->screen);
+
+ if (!s->dirty)
+ return;
+
+ s->dirty = FALSE;
+ ss->texture_timestamp++;
+ tex->view_age[surf->level] = ++(tex->age);
+
+ if (s->handle != tex->handle) {
+ SVGA_DBG(DEBUG_VIEWS, "svga: Surface propagate: tex %p, level %u, from %p\n", tex, surf->level, surf);
+ svga_texture_copy_handle(svga_context(pipe), ss,
+ s->handle, 0, 0, 0, s->real_level, s->real_face,
+ tex->handle, 0, 0, surf->zslice, surf->level, surf->face,
+ tex->base.width[surf->level], tex->base.height[surf->level], 1);
+ tex->defined[surf->face][surf->level] = TRUE;
+ }
+}
+
+/**
+ * Check if we should call svga_propagate_surface on the surface.
+ */
+extern boolean
+svga_surface_needs_propagation(struct pipe_surface *surf)
+{
+ struct svga_surface *s = svga_surface(surf);
+ struct svga_texture *tex = svga_texture(surf->texture);
+
+ return s->dirty && s->handle != tex->handle;
+}
+
+
+static struct pipe_transfer *
+svga_get_tex_transfer(struct pipe_screen *screen,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage, unsigned x, unsigned y,
+ unsigned w, unsigned h)
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_transfer *st;
+
+ /* We can't map texture storage directly */
+ if (usage & PIPE_TRANSFER_MAP_DIRECTLY)
+ return NULL;
+
+ st = CALLOC_STRUCT(svga_transfer);
+ if (!st)
+ return NULL;
+
+ st->base.format = texture->format;
+ st->base.block = texture->block;
+ st->base.x = x;
+ st->base.y = y;
+ st->base.width = w;
+ st->base.height = h;
+ st->base.nblocksx = pf_get_nblocksx(&texture->block, w);
+ st->base.nblocksy = pf_get_nblocksy(&texture->block, h);
+ st->base.stride = st->base.nblocksx*st->base.block.size;
+ st->base.usage = usage;
+ st->base.face = face;
+ st->base.level = level;
+ st->base.zslice = zslice;
+
+ st->hw_nblocksy = st->base.nblocksy;
+
+ st->hwbuf = svga_winsys_buffer_create(ss,
+ 1,
+ 0,
+ st->hw_nblocksy*st->base.stride);
+ while(!st->hwbuf && (st->hw_nblocksy /= 2)) {
+ st->hwbuf = svga_winsys_buffer_create(ss,
+ 1,
+ 0,
+ st->hw_nblocksy*st->base.stride);
+ }
+
+ if(!st->hwbuf)
+ goto no_hwbuf;
+
+ if(st->hw_nblocksy < st->base.nblocksy) {
+ /* We couldn't allocate a hardware buffer big enough for the transfer,
+ * so allocate regular malloc memory instead */
+ debug_printf("%s: failed to allocate %u KB of DMA, splitting into %u x %u KB DMA transfers\n",
+ __FUNCTION__,
+ (st->base.nblocksy*st->base.stride + 1023)/1024,
+ (st->base.nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy,
+ (st->hw_nblocksy*st->base.stride + 1023)/1024);
+ st->swbuf = MALLOC(st->base.nblocksy*st->base.stride);
+ if(!st->swbuf)
+ goto no_swbuf;
+ }
+
+ pipe_texture_reference(&st->base.texture, texture);
+
+ if (usage & PIPE_TRANSFER_READ)
+ svga_transfer_dma(st, SVGA3D_READ_HOST_VRAM);
+
+ return &st->base;
+
+no_swbuf:
+ sws->buffer_destroy(sws, st->hwbuf);
+no_hwbuf:
+ FREE(st);
+ return NULL;
+}
+
+
+static void *
+svga_transfer_map( struct pipe_screen *screen,
+ struct pipe_transfer *transfer )
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_transfer *st = svga_transfer(transfer);
+
+ if(st->swbuf)
+ return st->swbuf;
+ else
+ /* The wait for read transfers already happened when svga_transfer_dma
+ * was called. */
+ return sws->buffer_map(sws, st->hwbuf,
+ pipe_transfer_buffer_flags(transfer));
+}
+
+
+static void
+svga_transfer_unmap(struct pipe_screen *screen,
+ struct pipe_transfer *transfer)
+{
+ struct svga_screen *ss = svga_screen(screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_transfer *st = svga_transfer(transfer);
+
+ if(!st->swbuf)
+ sws->buffer_unmap(sws, st->hwbuf);
+}
+
+
+static void
+svga_tex_transfer_destroy(struct pipe_transfer *transfer)
+{
+ struct svga_texture *tex = svga_texture(transfer->texture);
+ struct svga_screen *ss = svga_screen(transfer->texture->screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_transfer *st = svga_transfer(transfer);
+
+ if (st->base.usage & PIPE_TRANSFER_WRITE) {
+ svga_transfer_dma(st, SVGA3D_WRITE_HOST_VRAM);
+ ss->texture_timestamp++;
+ tex->view_age[transfer->level] = ++(tex->age);
+ tex->defined[transfer->face][transfer->level] = TRUE;
+ }
+
+ pipe_texture_reference(&st->base.texture, NULL);
+ FREE(st->swbuf);
+ sws->buffer_destroy(sws, st->hwbuf);
+ FREE(st);
+}
+
+void
+svga_screen_init_texture_functions(struct pipe_screen *screen)
+{
+ screen->texture_create = svga_texture_create;
+ screen->texture_destroy = svga_texture_destroy;
+ screen->get_tex_surface = svga_get_tex_surface;
+ screen->tex_surface_destroy = svga_tex_surface_destroy;
+ screen->texture_blanket = svga_texture_blanket;
+ screen->get_tex_transfer = svga_get_tex_transfer;
+ screen->transfer_map = svga_transfer_map;
+ screen->transfer_unmap = svga_transfer_unmap;
+ screen->tex_transfer_destroy = svga_tex_transfer_destroy;
+}
+
+/***********************************************************************
+ */
+
+struct svga_sampler_view *
+svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
+ unsigned min_lod, unsigned max_lod)
+{
+ struct svga_screen *ss = svga_screen(pt->screen);
+ struct svga_winsys_screen *sws = ss->sws;
+ struct svga_texture *tex = svga_texture(pt);
+ struct svga_sampler_view *sv = NULL;
+ SVGA3dSurfaceFormat format = svga_translate_format(pt->format);
+ boolean view = TRUE;
+
+ assert(pt);
+ assert(min_lod >= 0);
+ assert(min_lod <= max_lod);
+ assert(max_lod <= pt->last_level);
+
+
+ /* Is a view needed */
+ {
+ /*
+ * Can't control max lod. For first level views and when we only
+ * look at one level we disable mip filtering to achive the same
+ * results as a view.
+ */
+ if (min_lod == 0 && max_lod >= pt->last_level)
+ view = FALSE;
+
+ if (pf_is_compressed(pt->format) && view) {
+ format = svga_translate_format_render(pt->format);
+ }
+
+ if (ss->debug.no_sampler_view)
+ view = FALSE;
+
+ if (ss->debug.force_sampler_view)
+ view = TRUE;
+ }
+
+ /* First try the cache */
+ if (view) {
+ pipe_mutex_lock(ss->tex_mutex);
+ if (tex->cached_view &&
+ tex->cached_view->min_lod == min_lod &&
+ tex->cached_view->max_lod == max_lod) {
+ svga_sampler_view_reference(&sv, tex->cached_view);
+ pipe_mutex_unlock(ss->tex_mutex);
+ SVGA_DBG(DEBUG_VIEWS, "svga: Sampler view: reuse %p, %u %u, last %u\n",
+ pt, min_lod, max_lod, pt->last_level);
+ svga_validate_sampler_view(svga_context(pipe), sv);
+ return sv;
+ }
+ pipe_mutex_unlock(ss->tex_mutex);
+ }
+
+ sv = CALLOC_STRUCT(svga_sampler_view);
+ pipe_reference_init(&sv->reference, 1);
+ sv->texture = tex;
+ sv->min_lod = min_lod;
+ sv->max_lod = max_lod;
+
+ /* No view needed just use the whole texture */
+ if (!view) {
+ SVGA_DBG(DEBUG_VIEWS,
+ "svga: Sampler view: no %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n",
+ pt, min_lod, max_lod,
+ max_lod - min_lod + 1,
+ pt->width[0],
+ pt->height[0],
+ pt->depth[0],
+ pt->last_level);
+ sws->surface_reference(sws, &sv->handle, tex->handle);
+ return sv;
+ }
+
+ SVGA_DBG(DEBUG_VIEWS,
+ "svga: Sampler view: yes %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n",
+ pt, min_lod, max_lod,
+ max_lod - min_lod + 1,
+ pt->width[0],
+ pt->height[0],
+ pt->depth[0],
+ pt->last_level);
+
+ sv->age = tex->age;
+ sv->handle = svga_texture_view_surface(pipe, tex, format,
+ min_lod,
+ max_lod - min_lod + 1,
+ -1, -1);
+
+ if (!sv->handle) {
+ assert(0);
+ sws->surface_reference(sws, &sv->handle, tex->handle);
+ return sv;
+ }
+
+ pipe_mutex_lock(ss->tex_mutex);
+ svga_sampler_view_reference(&tex->cached_view, sv);
+ pipe_mutex_unlock(ss->tex_mutex);
+
+ return sv;
+}
+
+void
+svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v)
+{
+ struct svga_texture *tex = v->texture;
+ unsigned numFaces;
+ unsigned age = 0;
+ int i, k;
+
+ assert(svga);
+
+ if (v->handle == v->texture->handle)
+ return;
+
+ age = tex->age;
+
+ if(tex->base.target == PIPE_TEXTURE_CUBE)
+ numFaces = 6;
+ else
+ numFaces = 1;
+
+ for (i = v->min_lod; i <= v->max_lod; i++) {
+ for (k = 0; k < numFaces; k++) {
+ if (v->age < tex->view_age[i])
+ svga_texture_copy_handle(svga, NULL,
+ tex->handle, 0, 0, 0, i, k,
+ v->handle, 0, 0, 0, i - v->min_lod, k,
+ tex->base.width[i],
+ tex->base.height[i],
+ tex->base.depth[i]);
+ }
+ }
+
+ v->age = age;
+}
+
+void
+svga_destroy_sampler_view_priv(struct svga_sampler_view *v)
+{
+ struct svga_screen *ss = svga_screen(v->texture->base.screen);
+
+ SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle);
+ ss->sws->surface_reference(ss->sws, &v->handle, NULL);
+
+ FREE(v);
+}
+
+boolean
+svga_screen_buffer_from_texture(struct pipe_texture *texture,
+ struct pipe_buffer **buffer,
+ unsigned *stride)
+{
+ struct svga_texture *stex = svga_texture(texture);
+
+ *buffer = svga_screen_buffer_wrap_surface
+ (texture->screen,
+ svga_translate_format(texture->format),
+ stex->handle);
+
+ *stride = pf_get_nblocksx(&texture->block, texture->width[0]) *
+ texture->block.size;
+
+ return *buffer != NULL;
+}
+
+
+struct svga_winsys_surface *
+svga_screen_texture_get_winsys_surface(struct pipe_texture *texture)
+{
+ struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen);
+ struct svga_winsys_surface *vsurf = NULL;
+
+ sws->surface_reference(sws, &vsurf, svga_texture(texture)->handle);
+ return vsurf;
+}
diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h
new file mode 100644
index 0000000000..1e6fef59a3
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_screen_texture.h
@@ -0,0 +1,177 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_TEXTURE_H
+#define SVGA_TEXTURE_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+
+struct pipe_context;
+struct pipe_screen;
+struct svga_context;
+struct svga_winsys_surface;
+enum SVGA3dSurfaceFormat;
+
+
+#define SVGA_MAX_TEXTURE_LEVELS 12 /* 2048x2048 */
+
+
+/**
+ * A sampler's view into a texture
+ *
+ * We currently cache one sampler view on
+ * the texture and in there by holding a reference
+ * from the texture to the sampler view.
+ *
+ * Because of this we can not hold a refernce to the
+ * texture from the sampler view. So the user
+ * of the sampler views must make sure that the
+ * texture has a reference take for as long as
+ * the sampler view is refrenced.
+ *
+ * Just unreferencing the sampler_view before the
+ * texture is enough.
+ */
+struct svga_sampler_view
+{
+ struct pipe_reference reference;
+
+ struct svga_texture *texture;
+
+ int min_lod;
+ int max_lod;
+
+ unsigned age;
+
+ struct svga_winsys_surface *handle;
+};
+
+
+struct svga_texture
+{
+ struct pipe_texture base;
+
+ struct svga_winsys_surface *handle;
+
+ boolean defined[6][PIPE_MAX_TEXTURE_LEVELS];
+
+ struct svga_sampler_view *cached_view;
+
+ unsigned view_age[SVGA_MAX_TEXTURE_LEVELS];
+ unsigned age;
+
+ boolean views_modified;
+};
+
+
+struct svga_surface
+{
+ struct pipe_surface base;
+
+ struct svga_winsys_surface *handle;
+
+ unsigned real_face;
+ unsigned real_level;
+ unsigned real_zslice;
+
+ boolean dirty;
+};
+
+
+struct svga_transfer
+{
+ struct pipe_transfer base;
+
+ struct svga_winsys_buffer *hwbuf;
+
+ /* Height of the hardware buffer in pixel blocks */
+ unsigned hw_nblocksy;
+
+ /* Temporary malloc buffer when we can't allocate a hardware buffer
+ * big enough */
+ void *swbuf;
+};
+
+
+static INLINE struct svga_texture *
+svga_texture(struct pipe_texture *texture)
+{
+ return (struct svga_texture *)texture;
+}
+
+static INLINE struct svga_surface *
+svga_surface(struct pipe_surface *surface)
+{
+ assert(surface);
+ return (struct svga_surface *)surface;
+}
+
+static INLINE struct svga_transfer *
+svga_transfer(struct pipe_transfer *transfer)
+{
+ assert(transfer);
+ return (struct svga_transfer *)transfer;
+}
+
+extern struct svga_sampler_view *
+svga_get_tex_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *pt,
+ unsigned min_lod, unsigned max_lod);
+
+void
+svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v);
+
+void
+svga_destroy_sampler_view_priv(struct svga_sampler_view *v);
+
+static INLINE void
+svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_view *v)
+{
+ struct svga_sampler_view *old = *ptr;
+
+ if (pipe_reference((struct pipe_reference **)ptr, &v->reference))
+ svga_destroy_sampler_view_priv(old);
+}
+
+extern void
+svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf);
+
+extern boolean
+svga_surface_needs_propagation(struct pipe_surface *surf);
+
+extern void
+svga_screen_init_texture_functions(struct pipe_screen *screen);
+
+enum SVGA3dSurfaceFormat
+svga_translate_format(enum pipe_format format);
+
+enum SVGA3dSurfaceFormat
+svga_translate_format_render(enum pipe_format format);
+
+
+#endif /* SVGA_TEXTURE_H */
diff --git a/src/gallium/drivers/svga/svga_state.c b/src/gallium/drivers/svga/svga_state.c
new file mode 100644
index 0000000000..1c21d3acfe
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state.c
@@ -0,0 +1,278 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "util/u_debug.h"
+#include "pipe/p_defines.h"
+#include "util/u_memory.h"
+#include "draw/draw_context.h"
+
+#include "svga_context.h"
+#include "svga_screen.h"
+#include "svga_state.h"
+#include "svga_draw.h"
+#include "svga_cmd.h"
+#include "svga_hw_reg.h"
+
+/* This is just enough to decide whether we need to use the draw
+ * module (swtnl) or not.
+ */
+static const struct svga_tracked_state *need_swtnl_state[] =
+{
+ &svga_update_need_swvfetch,
+ &svga_update_need_pipeline,
+ &svga_update_need_swtnl,
+ NULL
+};
+
+
+/* Atoms to update hardware state prior to emitting a clear or draw
+ * packet.
+ */
+static const struct svga_tracked_state *hw_clear_state[] =
+{
+ &svga_hw_scissor,
+ &svga_hw_viewport,
+ &svga_hw_framebuffer,
+ NULL
+};
+
+
+/* Atoms to update hardware state prior to emitting a draw packet.
+ */
+static const struct svga_tracked_state *hw_draw_state[] =
+{
+ &svga_hw_update_zero_stride,
+ &svga_hw_fs,
+ &svga_hw_vs,
+ &svga_hw_rss,
+ &svga_hw_tss,
+ &svga_hw_tss_binding,
+ &svga_hw_clip_planes,
+ &svga_hw_vdecl,
+ &svga_hw_fs_parameters,
+ &svga_hw_vs_parameters,
+ NULL
+};
+
+
+static const struct svga_tracked_state *swtnl_draw_state[] =
+{
+ &svga_update_swtnl_draw,
+ &svga_update_swtnl_vdecl,
+ NULL
+};
+
+/* Flattens the graph of state dependencies. Could swap the positions
+ * of hw_clear_state and need_swtnl_state without breaking anything.
+ */
+static const struct svga_tracked_state **state_levels[] =
+{
+ need_swtnl_state,
+ hw_clear_state,
+ hw_draw_state,
+ swtnl_draw_state
+};
+
+
+
+static unsigned check_state( unsigned a,
+ unsigned b )
+{
+ return (a & b);
+}
+
+static void accumulate_state( unsigned *a,
+ unsigned b )
+{
+ *a |= b;
+}
+
+
+static void xor_states( unsigned *result,
+ unsigned a,
+ unsigned b )
+{
+ *result = a ^ b;
+}
+
+
+
+static int update_state( struct svga_context *svga,
+ const struct svga_tracked_state *atoms[],
+ unsigned *state )
+{
+ boolean debug = TRUE;
+ enum pipe_error ret = 0;
+ unsigned i;
+
+ ret = svga_hwtnl_flush( svga->hwtnl );
+ if (ret != 0)
+ return ret;
+
+ if (debug) {
+ /* Debug version which enforces various sanity checks on the
+ * state flags which are generated and checked to help ensure
+ * state atoms are ordered correctly in the list.
+ */
+ unsigned examined, prev;
+
+ examined = 0;
+ prev = *state;
+
+ for (i = 0; atoms[i] != NULL; i++) {
+ unsigned generated;
+
+ assert(atoms[i]->dirty);
+ assert(atoms[i]->update);
+
+ if (check_state(*state, atoms[i]->dirty)) {
+ if (0)
+ debug_printf("update: %s\n", atoms[i]->name);
+ ret = atoms[i]->update( svga, *state );
+ if (ret != 0)
+ return ret;
+ }
+
+ /* generated = (prev ^ state)
+ * if (examined & generated)
+ * fail;
+ */
+ xor_states(&generated, prev, *state);
+ if (check_state(examined, generated)) {
+ debug_printf("state atom %s generated state already examined\n",
+ atoms[i]->name);
+ assert(0);
+ }
+
+ prev = *state;
+ accumulate_state(&examined, atoms[i]->dirty);
+ }
+ }
+ else {
+ for (i = 0; atoms[i] != NULL; i++) {
+ if (check_state(*state, atoms[i]->dirty)) {
+ ret = atoms[i]->update( svga, *state );
+ if (ret != 0)
+ return ret;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+
+int svga_update_state( struct svga_context *svga,
+ unsigned max_level )
+{
+ struct svga_screen *screen = svga_screen(svga->pipe.screen);
+ int ret = 0;
+ int i;
+
+ /* Check for updates to bound textures. This can't be done in an
+ * atom as there is no flag which could provoke this test, and we
+ * cannot create one.
+ */
+ if (svga->state.texture_timestamp != screen->texture_timestamp) {
+ svga->state.texture_timestamp = screen->texture_timestamp;
+ svga->dirty |= SVGA_NEW_TEXTURE;
+ }
+
+ for (i = 0; i <= max_level; i++) {
+ svga->dirty |= svga->state.dirty[i];
+
+ if (svga->dirty) {
+ ret = update_state( svga,
+ state_levels[i],
+ &svga->dirty );
+ if (ret != 0)
+ return ret;
+
+ svga->state.dirty[i] = 0;
+ }
+ }
+
+ for (; i < SVGA_STATE_MAX; i++)
+ svga->state.dirty[i] |= svga->dirty;
+
+ svga->dirty = 0;
+ return 0;
+}
+
+
+
+
+void svga_update_state_retry( struct svga_context *svga,
+ unsigned max_level )
+{
+ int ret;
+
+ ret = svga_update_state( svga, max_level );
+
+ if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
+ svga_context_flush(svga, NULL);
+ ret = svga_update_state( svga, max_level );
+ }
+
+ assert( ret == 0 );
+}
+
+
+
+#define EMIT_RS(_rs, _count, _name, _value) \
+do { \
+ _rs[_count].state = _name; \
+ _rs[_count].uintValue = _value; \
+ _count++; \
+} while (0)
+
+
+/* Setup any hardware state which will be constant through the life of
+ * a context.
+ */
+enum pipe_error svga_emit_initial_state( struct svga_context *svga )
+{
+ SVGA3dRenderState *rs;
+ unsigned count = 0;
+ const unsigned COUNT = 2;
+ enum pipe_error ret;
+
+ ret = SVGA3D_BeginSetRenderState( svga->swc, &rs, COUNT );
+ if (ret)
+ return ret;
+
+ /* Always use D3D style coordinate space as this is the only one
+ * which is implemented on all backends.
+ */
+ EMIT_RS(rs, count, SVGA3D_RS_COORDINATETYPE, SVGA3D_COORDINATE_LEFTHANDED );
+ EMIT_RS(rs, count, SVGA3D_RS_FRONTWINDING, SVGA3D_FRONTWINDING_CW );
+
+ assert( COUNT == count );
+ SVGA_FIFOCommitAll( svga->swc );
+
+ return 0;
+
+}
diff --git a/src/gallium/drivers/svga/svga_state.h b/src/gallium/drivers/svga/svga_state.h
new file mode 100644
index 0000000000..22d5a6d552
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state.h
@@ -0,0 +1,95 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_STATE_H
+#define SVGA_STATE_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
+
+struct svga_context;
+
+
+void svga_init_state( struct svga_context *svga );
+void svga_destroy_state( struct svga_context *svga );
+
+
+struct svga_tracked_state {
+ const char *name;
+ unsigned dirty;
+ int (*update)( struct svga_context *svga, unsigned dirty );
+};
+
+/* NEED_SWTNL
+ */
+extern struct svga_tracked_state svga_update_need_swvfetch;
+extern struct svga_tracked_state svga_update_need_pipeline;
+extern struct svga_tracked_state svga_update_need_swtnl;
+
+/* HW_CLEAR
+ */
+extern struct svga_tracked_state svga_hw_viewport;
+extern struct svga_tracked_state svga_hw_scissor;
+extern struct svga_tracked_state svga_hw_framebuffer;
+
+/* HW_DRAW
+ */
+extern struct svga_tracked_state svga_hw_vs;
+extern struct svga_tracked_state svga_hw_fs;
+extern struct svga_tracked_state svga_hw_rss;
+extern struct svga_tracked_state svga_hw_tss;
+extern struct svga_tracked_state svga_hw_tss_binding;
+extern struct svga_tracked_state svga_hw_clip_planes;
+extern struct svga_tracked_state svga_hw_vdecl;
+extern struct svga_tracked_state svga_hw_fs_parameters;
+extern struct svga_tracked_state svga_hw_vs_parameters;
+extern struct svga_tracked_state svga_hw_update_zero_stride;
+
+/* SWTNL_DRAW
+ */
+extern struct svga_tracked_state svga_update_swtnl_draw;
+extern struct svga_tracked_state svga_update_swtnl_vdecl;
+
+/* Bring the hardware fully up-to-date so that we can emit draw
+ * commands.
+ */
+#define SVGA_STATE_NEED_SWTNL 0
+#define SVGA_STATE_HW_CLEAR 1
+#define SVGA_STATE_HW_DRAW 2
+#define SVGA_STATE_SWTNL_DRAW 3
+#define SVGA_STATE_MAX 4
+
+
+enum pipe_error svga_update_state( struct svga_context *svga,
+ unsigned level );
+
+void svga_update_state_retry( struct svga_context *svga,
+ unsigned level );
+
+
+enum pipe_error svga_emit_initial_state( struct svga_context *svga );
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
new file mode 100644
index 0000000000..18cce7dde1
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -0,0 +1,239 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+#include "svga_tgsi.h"
+#include "svga_debug.h"
+
+#include "svga_hw_reg.h"
+
+/***********************************************************************
+ * Hardware update
+ */
+
+/* Convert from PIPE_SHADER_* to SVGA3D_SHADERTYPE_*
+ */
+static int svga_shader_type( int unit )
+{
+ return unit + 1;
+}
+
+
+static int emit_const( struct svga_context *svga,
+ int unit,
+ int i,
+ const float *value )
+{
+ int ret = PIPE_OK;
+
+ if (memcmp(svga->state.hw_draw.cb[unit][i], value, 4 * sizeof(float)) != 0) {
+ if (SVGA_DEBUG & DEBUG_CONSTS)
+ debug_printf("%s %s %d: %f %f %f %f\n",
+ __FUNCTION__,
+ unit == PIPE_SHADER_VERTEX ? "VERT" : "FRAG",
+ i,
+ value[0],
+ value[1],
+ value[2],
+ value[3]);
+
+ ret = SVGA3D_SetShaderConst( svga->swc,
+ i,
+ svga_shader_type(unit),
+ SVGA3D_CONST_TYPE_FLOAT,
+ value );
+ if (ret)
+ return ret;
+
+ memcpy(svga->state.hw_draw.cb[unit][i], value, 4 * sizeof(float));
+ }
+
+ return ret;
+}
+
+static int emit_consts( struct svga_context *svga,
+ int offset,
+ int unit )
+{
+ struct pipe_screen *screen = svga->pipe.screen;
+ unsigned count;
+ const float (*data)[4] = NULL;
+ unsigned i;
+ int ret = PIPE_OK;
+
+ if (svga->curr.cb[unit] == NULL)
+ goto done;
+
+ count = svga->curr.cb[unit]->size / (4 * sizeof(float));
+
+ data = (const float (*)[4])pipe_buffer_map(screen,
+ svga->curr.cb[unit],
+ PIPE_BUFFER_USAGE_CPU_READ);
+ if (data == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
+ goto done;
+ }
+
+ for (i = 0; i < count; i++) {
+ ret = emit_const( svga, unit, offset + i, data[i] );
+ if (ret)
+ goto done;
+ }
+
+done:
+ if (data)
+ pipe_buffer_unmap(screen, svga->curr.cb[unit]);
+
+ return ret;
+}
+
+static int emit_fs_consts( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct svga_shader_result *result = svga->state.hw_draw.fs;
+ const struct svga_fs_compile_key *key = &result->key.fkey;
+ int ret = 0;
+
+ ret = emit_consts( svga, 0, PIPE_SHADER_FRAGMENT );
+ if (ret)
+ return ret;
+
+ /* The internally generated fragment shader for xor blending
+ * doesn't have a 'result' struct. It should be fixed to avoid
+ * this special case, but work around it with a NULL check:
+ */
+ if (result != NULL &&
+ key->num_unnormalized_coords)
+ {
+ unsigned offset = result->shader->info.file_max[TGSI_FILE_CONSTANT] + 1;
+ int i;
+
+ for (i = 0; i < key->num_textures; i++) {
+ if (key->tex[i].unnormalized) {
+ struct pipe_texture *tex = svga->curr.texture[i];
+ float data[4];
+
+ data[0] = 1.0 / (float)tex->width[0];
+ data[1] = 1.0 / (float)tex->height[0];
+ data[2] = 1.0;
+ data[3] = 1.0;
+
+ ret = emit_const( svga,
+ PIPE_SHADER_FRAGMENT,
+ key->tex[i].width_height_idx + offset,
+ data );
+ if (ret)
+ return ret;
+ }
+ }
+
+ offset += key->num_unnormalized_coords;
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_hw_fs_parameters =
+{
+ "hw fs params",
+ (SVGA_NEW_FS_CONST_BUFFER |
+ SVGA_NEW_FS_RESULT |
+ SVGA_NEW_TEXTURE_BINDING),
+ emit_fs_consts
+};
+
+/***********************************************************************
+ */
+
+static int emit_vs_consts( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct svga_shader_result *result = svga->state.hw_draw.vs;
+ const struct svga_vs_compile_key *key = &result->key.vkey;
+ int ret = 0;
+ unsigned offset;
+
+ /* SVGA_NEW_VS_RESULT
+ */
+ if (result == NULL)
+ return 0;
+
+ /* SVGA_NEW_VS_CONST_BUFFER
+ */
+ ret = emit_consts( svga, 0, PIPE_SHADER_VERTEX );
+ if (ret)
+ return ret;
+
+ offset = result->shader->info.file_max[TGSI_FILE_CONSTANT] + 1;
+
+ /* SVGA_NEW_VS_RESULT
+ */
+ if (key->need_prescale) {
+ ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
+ svga->state.hw_clear.prescale.scale );
+ if (ret)
+ return ret;
+
+ ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
+ svga->state.hw_clear.prescale.translate );
+ if (ret)
+ return ret;
+ }
+
+ /* SVGA_NEW_ZERO_STRIDE
+ */
+ if (key->zero_stride_vertex_elements) {
+ unsigned i, curr_zero_stride = 0;
+ for (i = 0; i < PIPE_MAX_ATTRIBS; ++i) {
+ if (key->zero_stride_vertex_elements & (1 << i)) {
+ ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++,
+ svga->curr.zero_stride_constants +
+ 4 * curr_zero_stride );
+ if (ret)
+ return ret;
+ ++curr_zero_stride;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_hw_vs_parameters =
+{
+ "hw vs params",
+ (SVGA_NEW_VS_CONST_BUFFER |
+ SVGA_NEW_ZERO_STRIDE |
+ SVGA_NEW_VS_RESULT),
+ emit_vs_consts
+};
+
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
new file mode 100644
index 0000000000..7d7f93d8e3
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -0,0 +1,455 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+#include "svga_debug.h"
+
+#include "svga_hw_reg.h"
+
+
+/***********************************************************************
+ * Hardware state update
+ */
+
+
+static int emit_framebuffer( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct pipe_framebuffer_state *curr = &svga->curr.framebuffer;
+ struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
+ unsigned i;
+ enum pipe_error ret;
+
+ /* XXX: Need shadow state in svga->hw to eliminate redundant
+ * uploads, especially of NULL buffers.
+ */
+
+ for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) {
+ if (curr->cbufs[i] != hw->cbufs[i]) {
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]);
+ if (ret != PIPE_OK)
+ return ret;
+
+ pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
+ }
+ }
+
+
+ if (curr->zsbuf != hw->zsbuf) {
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_DEPTH, curr->zsbuf);
+ if (ret != PIPE_OK)
+ return ret;
+
+ if (curr->zsbuf &&
+ curr->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) {
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, curr->zsbuf);
+ if (ret != PIPE_OK)
+ return ret;
+ }
+ else {
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, NULL);
+ if (ret != PIPE_OK)
+ return ret;
+ }
+
+ pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
+ }
+
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_hw_framebuffer =
+{
+ "hw framebuffer state",
+ SVGA_NEW_FRAME_BUFFER,
+ emit_framebuffer
+};
+
+
+
+
+/***********************************************************************
+ */
+
+static int emit_viewport( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct pipe_viewport_state *viewport = &svga->curr.viewport;
+ struct svga_prescale prescale;
+ SVGA3dRect rect;
+ /* Not sure if this state is relevant with POSITIONT. Probably
+ * not, but setting to 0,1 avoids some state pingponging.
+ */
+ float range_min = 0.0;
+ float range_max = 1.0;
+ float flip = -1.0;
+ boolean degenerate = FALSE;
+ enum pipe_error ret;
+
+ float fb_width = svga->curr.framebuffer.width;
+ float fb_height = svga->curr.framebuffer.height;
+
+ memset( &prescale, 0, sizeof(prescale) );
+
+ if (svga->curr.rast->templ.bypass_vs_clip_and_viewport) {
+
+ /* Avoid POSITIONT as it has a non trivial implementation outside the D3D
+ * API. Always generate a vertex shader.
+ */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = svga->curr.framebuffer.width;
+ rect.h = svga->curr.framebuffer.height;
+
+ prescale.scale[0] = 2.0 / (float)rect.w;
+ prescale.scale[1] = - 2.0 / (float)rect.h;
+ prescale.scale[2] = 1.0;
+ prescale.scale[3] = 1.0;
+ prescale.translate[0] = -1.0f;
+ prescale.translate[1] = 1.0f;
+ prescale.translate[2] = 0;
+ prescale.translate[3] = 0;
+ prescale.enabled = TRUE;
+ } else {
+
+ /* Examine gallium viewport transformation and produce a screen
+ * rectangle and possibly vertex shader pre-transformation to
+ * get the same results.
+ */
+ float fx = viewport->scale[0] * -1.0 + viewport->translate[0];
+ float fy = flip * viewport->scale[1] * -1.0 + viewport->translate[1];
+ float fw = viewport->scale[0] * 2;
+ float fh = flip * viewport->scale[1] * 2;
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "\ninitial %f,%f %fx%f\n",
+ fx,
+ fy,
+ fw,
+ fh);
+
+ prescale.scale[0] = 1.0;
+ prescale.scale[1] = 1.0;
+ prescale.scale[2] = 1.0;
+ prescale.scale[3] = 1.0;
+ prescale.translate[0] = 0;
+ prescale.translate[1] = 0;
+ prescale.translate[2] = 0;
+ prescale.translate[3] = 0;
+ prescale.enabled = TRUE;
+
+
+
+ if (fw < 0) {
+ prescale.scale[0] *= -1.0;
+ prescale.translate[0] += -fw;
+ fw = -fw;
+ fx = viewport->scale[0] * 1.0 + viewport->translate[0];
+ }
+
+ if (fh < 0) {
+ prescale.scale[1] *= -1.0;
+ prescale.translate[1] += -fh;
+ fh = -fh;
+ fy = flip * viewport->scale[1] * 1.0 + viewport->translate[1];
+ }
+
+ if (fx < 0) {
+ prescale.translate[0] += fx;
+ prescale.scale[0] *= fw / (fw + fx);
+ fw += fx;
+ fx = 0;
+ }
+
+ if (fy < 0) {
+ prescale.translate[1] += fy;
+ prescale.scale[1] *= fh / (fh + fy);
+ fh += fy;
+ fy = 0;
+ }
+
+ if (fx + fw > fb_width) {
+ prescale.scale[0] *= fw / (fb_width - fx);
+ prescale.translate[0] -= fx * (fw / (fb_width - fx));
+ prescale.translate[0] += fx;
+ fw = fb_width - fx;
+
+ }
+
+ if (fy + fh > fb_height) {
+ prescale.scale[1] *= fh / (fb_height - fy);
+ prescale.translate[1] -= fy * (fh / (fb_height - fy));
+ prescale.translate[1] += fy;
+ fh = fb_height - fy;
+ }
+
+ if (fw < 0 || fh < 0) {
+ fw = fh = fx = fy = 0;
+ degenerate = TRUE;
+ goto out;
+ }
+
+
+ /* D3D viewport is integer space. Convert fx,fy,etc. to
+ * integers.
+ *
+ * TODO: adjust pretranslate correct for any subpixel error
+ * introduced converting to integers.
+ */
+ rect.x = fx;
+ rect.y = fy;
+ rect.w = fw;
+ rect.h = fh;
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "viewport error %f,%f %fx%f\n",
+ fabs((float)rect.x - fx),
+ fabs((float)rect.y - fy),
+ fabs((float)rect.w - fw),
+ fabs((float)rect.h - fh));
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "viewport %d,%d %dx%d\n",
+ rect.x,
+ rect.y,
+ rect.w,
+ rect.h);
+
+
+ /* Finally, to get GL rasterization rules, need to tweak the
+ * screen-space coordinates slightly relative to D3D which is
+ * what hardware implements natively.
+ */
+ if (svga->curr.rast->templ.gl_rasterization_rules) {
+ float adjust_x = 0.0;
+ float adjust_y = 0.0;
+
+ switch (svga->curr.reduced_prim) {
+ case PIPE_PRIM_LINES:
+ adjust_x = -0.5;
+ adjust_y = 0;
+ break;
+ case PIPE_PRIM_POINTS:
+ case PIPE_PRIM_TRIANGLES:
+ adjust_x = -0.375;
+ adjust_y = -0.5;
+ break;
+ }
+
+ prescale.translate[0] += adjust_x;
+ prescale.translate[1] += adjust_y;
+ prescale.translate[2] = 0.5; /* D3D clip space */
+ prescale.scale[2] = 0.5; /* D3D clip space */
+ }
+
+
+ range_min = viewport->scale[2] * -1.0 + viewport->translate[2];
+ range_max = viewport->scale[2] * 1.0 + viewport->translate[2];
+
+ /* D3D (and by implication SVGA) doesn't like dealing with zmax
+ * less than zmin. Detect that case, flip the depth range and
+ * invert our z-scale factor to achieve the same effect.
+ */
+ if (range_min > range_max) {
+ float range_tmp;
+ range_tmp = range_min;
+ range_min = range_max;
+ range_max = range_tmp;
+ prescale.scale[2] = -prescale.scale[2];
+ }
+ }
+
+ if (prescale.enabled) {
+ float H[2];
+ float J[2];
+ int i;
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "prescale %f,%f %fx%f\n",
+ prescale.translate[0],
+ prescale.translate[1],
+ prescale.scale[0],
+ prescale.scale[1]);
+
+ H[0] = (float)rect.w / 2.0;
+ H[1] = -(float)rect.h / 2.0;
+ J[0] = (float)rect.x + (float)rect.w / 2.0;
+ J[1] = (float)rect.y + (float)rect.h / 2.0;
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "H %f,%f\n"
+ "J %fx%f\n",
+ H[0],
+ H[1],
+ J[0],
+ J[1]);
+
+ /* Adjust prescale to take into account the fact that it is
+ * going to be applied prior to the perspective divide and
+ * viewport transformation.
+ *
+ * Vwin = H(Vc/Vc.w) + J
+ *
+ * We want to tweak Vwin with scale and translation from above,
+ * as in:
+ *
+ * Vwin' = S Vwin + T
+ *
+ * But we can only modify the values at Vc. Plugging all the
+ * above together, and rearranging, eventually we get:
+ *
+ * Vwin' = H(Vc'/Vc'.w) + J
+ * where:
+ * Vc' = SVc + KVc.w
+ * K = (T + (S-1)J) / H
+ *
+ * Overwrite prescale.translate with values for K:
+ */
+ for (i = 0; i < 2; i++) {
+ prescale.translate[i] = ((prescale.translate[i] +
+ (prescale.scale[i] - 1.0) * J[i]) / H[i]);
+ }
+
+ SVGA_DBG(DEBUG_VIEWPORT,
+ "clipspace %f,%f %fx%f\n",
+ prescale.translate[0],
+ prescale.translate[1],
+ prescale.scale[0],
+ prescale.scale[1]);
+ }
+
+out:
+ if (degenerate) {
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = 1;
+ rect.h = 1;
+ prescale.enabled = FALSE;
+ }
+
+ if (memcmp(&rect, &svga->state.hw_clear.viewport, sizeof(rect)) != 0) {
+ ret = SVGA3D_SetViewport(svga->swc, &rect);
+ if(ret != PIPE_OK)
+ return ret;
+
+ memcpy(&svga->state.hw_clear.viewport, &rect, sizeof(rect));
+ assert(sizeof(rect) == sizeof(svga->state.hw_clear.viewport));
+ }
+
+ if (svga->state.hw_clear.depthrange.zmin != range_min ||
+ svga->state.hw_clear.depthrange.zmax != range_max)
+ {
+ ret = SVGA3D_SetZRange(svga->swc, range_min, range_max );
+ if(ret != PIPE_OK)
+ return ret;
+
+ svga->state.hw_clear.depthrange.zmin = range_min;
+ svga->state.hw_clear.depthrange.zmax = range_max;
+ }
+
+ if (memcmp(&prescale, &svga->state.hw_clear.prescale, sizeof prescale) != 0) {
+ svga->dirty |= SVGA_NEW_PRESCALE;
+ svga->state.hw_clear.prescale = prescale;
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_hw_viewport =
+{
+ "hw viewport state",
+ ( SVGA_NEW_FRAME_BUFFER |
+ SVGA_NEW_VIEWPORT |
+ SVGA_NEW_RAST |
+ SVGA_NEW_REDUCED_PRIMITIVE ),
+ emit_viewport
+};
+
+
+/***********************************************************************
+ * Scissor state
+ */
+static int emit_scissor_rect( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct pipe_scissor_state *scissor = &svga->curr.scissor;
+ SVGA3dRect rect;
+
+ rect.x = scissor->minx;
+ rect.y = scissor->miny;
+ rect.w = scissor->maxx - scissor->minx; /* + 1 ?? */
+ rect.h = scissor->maxy - scissor->miny; /* + 1 ?? */
+
+ return SVGA3D_SetScissorRect(svga->swc, &rect);
+}
+
+
+struct svga_tracked_state svga_hw_scissor =
+{
+ "hw scissor state",
+ SVGA_NEW_SCISSOR,
+ emit_scissor_rect
+};
+
+
+/***********************************************************************
+ * Userclip state
+ */
+
+static int emit_clip_planes( struct svga_context *svga,
+ unsigned dirty )
+{
+ unsigned i;
+ enum pipe_error ret;
+
+ /* TODO: just emit directly from svga_set_clip_state()?
+ */
+ for (i = 0; i < svga->curr.clip.nr; i++) {
+ ret = SVGA3D_SetClipPlane( svga->swc,
+ i,
+ svga->curr.clip.ucp[i] );
+ if(ret != PIPE_OK)
+ return ret;
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_hw_clip_planes =
+{
+ "hw viewport state",
+ SVGA_NEW_CLIP,
+ emit_clip_planes
+};
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
new file mode 100644
index 0000000000..6ec38ed3e4
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -0,0 +1,282 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+#include "svga_tgsi.h"
+
+#include "svga_hw_reg.h"
+
+
+
+static INLINE int compare_fs_keys( const struct svga_fs_compile_key *a,
+ const struct svga_fs_compile_key *b )
+{
+ unsigned keysize = svga_fs_key_size( a );
+ return memcmp( a, b, keysize );
+}
+
+
+static struct svga_shader_result *search_fs_key( struct svga_fragment_shader *fs,
+ const struct svga_fs_compile_key *key )
+{
+ struct svga_shader_result *result = fs->base.results;
+
+ assert(key);
+
+ for ( ; result; result = result->next) {
+ if (compare_fs_keys( key, &result->key.fkey ) == 0)
+ return result;
+ }
+
+ return NULL;
+}
+
+
+static enum pipe_error compile_fs( struct svga_context *svga,
+ struct svga_fragment_shader *fs,
+ const struct svga_fs_compile_key *key,
+ struct svga_shader_result **out_result )
+{
+ struct svga_shader_result *result;
+ enum pipe_error ret;
+
+ result = svga_translate_fragment_program( fs, key );
+ if (result == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+
+ ret = SVGA3D_DefineShader(svga->swc,
+ svga->state.next_fs_id,
+ SVGA3D_SHADERTYPE_PS,
+ result->tokens,
+ result->nr_tokens * sizeof result->tokens[0]);
+ if (ret)
+ goto fail;
+
+ *out_result = result;
+ result->id = svga->state.next_fs_id++;
+ result->next = fs->base.results;
+ fs->base.results = result;
+ return PIPE_OK;
+
+fail:
+ if (result)
+ svga_destroy_shader_result( result );
+ return ret;
+}
+
+/* The blend workaround for simulating logicop xor behaviour requires
+ * that the incoming fragment color be white. This change achieves
+ * that by hooking up a hard-wired fragment shader that just emits
+ * color 1,1,1,1
+ *
+ * This is a slightly incomplete solution as it assumes that the
+ * actual bound shader has no other effects beyond generating a
+ * fragment color. In particular shaders containing TEXKIL and/or
+ * depth-write will not have the correct behaviour, nor will those
+ * expecting to use alphatest.
+ *
+ * These are avoidable issues, but they are not much worse than the
+ * unavoidable ones associated with this technique, so it's not clear
+ * how much effort should be expended trying to resolve them - the
+ * ultimate result will still not be correct in most cases.
+ *
+ * Shader below was generated with:
+ * SVGA_DEBUG=tgsi ./mesa/progs/fp/fp-tri white.txt
+ */
+static int emit_white_fs( struct svga_context *svga )
+{
+ int ret;
+
+ /* ps_3_0
+ * def c0, 1.000000, 0.000000, 0.000000, 1.000000
+ * mov oC0, c0.x
+ * end
+ */
+ static const unsigned white_tokens[] = {
+ 0xffff0300,
+ 0x05000051,
+ 0xa00f0000,
+ 0x3f800000,
+ 0x00000000,
+ 0x00000000,
+ 0x3f800000,
+ 0x02000001,
+ 0x800f0800,
+ 0xa0000000,
+ 0x0000ffff,
+ };
+
+ ret = SVGA3D_DefineShader(svga->swc,
+ svga->state.next_fs_id,
+ SVGA3D_SHADERTYPE_PS,
+ white_tokens,
+ sizeof(white_tokens));
+ if (ret)
+ return ret;
+
+ svga->state.white_fs_id = svga->state.next_fs_id++;
+ return 0;
+}
+
+
+/* SVGA_NEW_TEXTURE_BINDING
+ * SVGA_NEW_RAST
+ * SVGA_NEW_NEED_SWTNL
+ * SVGA_NEW_SAMPLER
+ */
+static int make_fs_key( const struct svga_context *svga,
+ struct svga_fs_compile_key *key )
+{
+ int i;
+ int idx = 0;
+
+ memset(key, 0, sizeof *key);
+
+ /* Only need fragment shader fixup for twoside lighting if doing
+ * hwtnl. Otherwise the draw module does the whole job for us.
+ *
+ * SVGA_NEW_SWTNL
+ */
+ if (!svga->state.sw.need_swtnl) {
+ /* SVGA_NEW_RAST
+ */
+ key->light_twoside = svga->curr.rast->templ.light_twoside;
+ key->front_cw = (svga->curr.rast->templ.front_winding ==
+ PIPE_WINDING_CW);
+ }
+
+
+ /* XXX: want to limit this to the textures that the shader actually
+ * refers to.
+ *
+ * SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER
+ */
+ for (i = 0; i < svga->curr.num_textures; i++) {
+ if (svga->curr.texture[i]) {
+ assert(svga->curr.sampler[i]);
+ key->tex[i].texture_target = svga->curr.texture[i]->target;
+ if (!svga->curr.sampler[i]->normalized_coords) {
+ key->tex[i].width_height_idx = idx++;
+ key->tex[i].unnormalized = TRUE;
+ ++key->num_unnormalized_coords;
+ }
+ }
+ }
+ key->num_textures = svga->curr.num_textures;
+
+ idx = 0;
+ for (i = 0; i < svga->curr.num_samplers; ++i) {
+ if (svga->curr.sampler[i]) {
+ key->tex[i].compare_mode = svga->curr.sampler[i]->compare_mode;
+ key->tex[i].compare_func = svga->curr.sampler[i]->compare_func;
+ }
+ }
+
+ return 0;
+}
+
+
+
+static int emit_hw_fs( struct svga_context *svga,
+ unsigned dirty )
+{
+ struct svga_shader_result *result = NULL;
+ unsigned id = SVGA3D_INVALID_ID;
+ int ret = 0;
+
+ /* SVGA_NEW_BLEND
+ */
+ if (svga->curr.blend->need_white_fragments) {
+ if (svga->state.white_fs_id == SVGA3D_INVALID_ID) {
+ ret = emit_white_fs( svga );
+ if (ret)
+ return ret;
+ }
+ id = svga->state.white_fs_id;
+ }
+ else {
+ struct svga_fragment_shader *fs = svga->curr.fs;
+ struct svga_fs_compile_key key;
+
+ /* SVGA_NEW_TEXTURE_BINDING
+ * SVGA_NEW_RAST
+ * SVGA_NEW_NEED_SWTNL
+ * SVGA_NEW_SAMPLER
+ */
+ ret = make_fs_key( svga, &key );
+ if (ret)
+ return ret;
+
+ result = search_fs_key( fs, &key );
+ if (!result) {
+ ret = compile_fs( svga, fs, &key, &result );
+ if (ret)
+ return ret;
+ }
+
+ assert (result);
+ id = result->id;
+ }
+
+ assert(id != SVGA3D_INVALID_ID);
+
+ if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT]) {
+ ret = SVGA3D_SetShader(svga->swc,
+ SVGA3D_SHADERTYPE_PS,
+ id );
+ if (ret)
+ return ret;
+
+ svga->dirty |= SVGA_NEW_FS_RESULT;
+ svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT] = id;
+ svga->state.hw_draw.fs = result;
+ }
+
+ return 0;
+}
+
+struct svga_tracked_state svga_hw_fs =
+{
+ "fragment shader (hwtnl)",
+ (SVGA_NEW_FS |
+ SVGA_NEW_TEXTURE_BINDING |
+ SVGA_NEW_NEED_SWTNL |
+ SVGA_NEW_RAST |
+ SVGA_NEW_SAMPLER |
+ SVGA_NEW_BLEND),
+ emit_hw_fs
+};
+
+
+
diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c
new file mode 100644
index 0000000000..00201b8091
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -0,0 +1,200 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_state.h"
+
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_debug.h"
+#include "svga_hw_reg.h"
+
+/***********************************************************************
+ */
+
+static INLINE SVGA3dDeclType
+svga_translate_vertex_format(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_R32_FLOAT: return SVGA3D_DECLTYPE_FLOAT1;
+ case PIPE_FORMAT_R32G32_FLOAT: return SVGA3D_DECLTYPE_FLOAT2;
+ case PIPE_FORMAT_R32G32B32_FLOAT: return SVGA3D_DECLTYPE_FLOAT3;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT: return SVGA3D_DECLTYPE_FLOAT4;
+ case PIPE_FORMAT_B8G8R8A8_UNORM: return SVGA3D_DECLTYPE_D3DCOLOR;
+ case PIPE_FORMAT_R8G8B8A8_USCALED: return SVGA3D_DECLTYPE_UBYTE4;
+ case PIPE_FORMAT_R16G16_SSCALED: return SVGA3D_DECLTYPE_SHORT2;
+ case PIPE_FORMAT_R16G16B16A16_SSCALED: return SVGA3D_DECLTYPE_SHORT4;
+ case PIPE_FORMAT_R8G8B8A8_UNORM: return SVGA3D_DECLTYPE_UBYTE4N;
+ case PIPE_FORMAT_R16G16_SNORM: return SVGA3D_DECLTYPE_SHORT2N;
+ case PIPE_FORMAT_R16G16B16A16_SNORM: return SVGA3D_DECLTYPE_SHORT4N;
+ case PIPE_FORMAT_R16G16_UNORM: return SVGA3D_DECLTYPE_USHORT2N;
+ case PIPE_FORMAT_R16G16B16A16_UNORM: return SVGA3D_DECLTYPE_USHORT4N;
+
+ /* These formats don't exist yet:
+ *
+ case PIPE_FORMAT_R10G10B10_USCALED: return SVGA3D_DECLTYPE_UDEC3;
+ case PIPE_FORMAT_R10G10B10_SNORM: return SVGA3D_DECLTYPE_DEC3N;
+ case PIPE_FORMAT_R16G16_FLOAT: return SVGA3D_DECLTYPE_FLOAT16_2;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT: return SVGA3D_DECLTYPE_FLOAT16_4;
+ */
+
+ default:
+ /* There are many formats without hardware support. This case
+ * will be hit regularly, meaning we'll need swvfetch.
+ */
+ return SVGA3D_DECLTYPE_MAX;
+ }
+}
+
+
+static int update_need_swvfetch( struct svga_context *svga,
+ unsigned dirty )
+{
+ unsigned i;
+ boolean need_swvfetch = FALSE;
+
+ for (i = 0; i < svga->curr.num_vertex_elements; i++) {
+ svga->state.sw.ve_format[i] = svga_translate_vertex_format(svga->curr.ve[i].src_format);
+ if (svga->state.sw.ve_format[i] == SVGA3D_DECLTYPE_MAX) {
+ need_swvfetch = TRUE;
+ break;
+ }
+ }
+
+ if (need_swvfetch != svga->state.sw.need_swvfetch) {
+ svga->state.sw.need_swvfetch = need_swvfetch;
+ svga->dirty |= SVGA_NEW_NEED_SWVFETCH;
+ }
+
+ return 0;
+}
+
+struct svga_tracked_state svga_update_need_swvfetch =
+{
+ "update need_swvfetch",
+ ( SVGA_NEW_VELEMENT ),
+ update_need_swvfetch
+};
+
+
+/***********************************************************************
+ */
+
+static int update_need_pipeline( struct svga_context *svga,
+ unsigned dirty )
+{
+
+ boolean need_pipeline = FALSE;
+
+ /* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
+ */
+ if (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim)) {
+ SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (%d) & prim (%x)\n",
+ __FUNCTION__,
+ svga->curr.rast->need_pipeline,
+ (1 << svga->curr.reduced_prim) );
+ need_pipeline = TRUE;
+ }
+
+ /* SVGA_NEW_EDGEFLAGS
+ */
+ if (svga->curr.rast->hw_unfilled != PIPE_POLYGON_MODE_FILL &&
+ svga->curr.reduced_prim == PIPE_PRIM_TRIANGLES &&
+ svga->curr.edgeflags != NULL) {
+ SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__);
+ need_pipeline = TRUE;
+ }
+
+ /* SVGA_NEW_CLIP
+ */
+ if (!svga->curr.rast->templ.bypass_vs_clip_and_viewport &&
+ svga->curr.clip.nr) {
+ SVGA_DBG(DEBUG_SWTNL, "%s: userclip\n", __FUNCTION__);
+ need_pipeline = TRUE;
+ }
+
+ if (need_pipeline != svga->state.sw.need_pipeline) {
+ svga->state.sw.need_pipeline = need_pipeline;
+ svga->dirty |= SVGA_NEW_NEED_PIPELINE;
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_update_need_pipeline =
+{
+ "need pipeline",
+ (SVGA_NEW_RAST |
+ SVGA_NEW_CLIP |
+ SVGA_NEW_REDUCED_PRIMITIVE),
+ update_need_pipeline
+};
+
+
+/***********************************************************************
+ */
+
+static int update_need_swtnl( struct svga_context *svga,
+ unsigned dirty )
+{
+ boolean need_swtnl;
+
+ if (svga->debug.no_swtnl) {
+ svga->state.sw.need_swvfetch = 0;
+ svga->state.sw.need_pipeline = 0;
+ }
+
+ need_swtnl = (svga->state.sw.need_swvfetch ||
+ svga->state.sw.need_pipeline);
+
+ if (svga->debug.force_swtnl) {
+ need_swtnl = 1;
+ }
+
+ if (need_swtnl != svga->state.sw.need_swtnl) {
+ SVGA_DBG(DEBUG_SWTNL|DEBUG_PERF,
+ "%s need_swvfetch: %s, need_pipeline %s\n",
+ __FUNCTION__,
+ svga->state.sw.need_swvfetch ? "true" : "false",
+ svga->state.sw.need_pipeline ? "true" : "false");
+
+ svga->state.sw.need_swtnl = need_swtnl;
+ svga->dirty |= SVGA_NEW_NEED_SWTNL;
+ svga->swtnl.new_vdecl = TRUE;
+ }
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_update_need_swtnl =
+{
+ "need swtnl",
+ (SVGA_NEW_NEED_PIPELINE |
+ SVGA_NEW_NEED_SWVFETCH),
+ update_need_swtnl
+};
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
new file mode 100644
index 0000000000..8b6803a285
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -0,0 +1,268 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+
+#include "svga_hw_reg.h"
+
+
+
+struct rs_queue {
+ unsigned rs_count;
+ SVGA3dRenderState rs[SVGA3D_RS_MAX];
+};
+
+
+#define EMIT_RS(svga, value, token, fail) \
+do { \
+ if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
+ svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
+ svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
+ } \
+} while (0)
+
+#define EMIT_RS_FLOAT(svga, fvalue, token, fail) \
+do { \
+ unsigned value = fui(fvalue); \
+ if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
+ svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
+ svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
+ } \
+} while (0)
+
+
+static INLINE void
+svga_queue_rs( struct rs_queue *q,
+ unsigned rss,
+ unsigned value )
+{
+ q->rs[q->rs_count].state = rss;
+ q->rs[q->rs_count].uintValue = value;
+ q->rs_count++;
+}
+
+
+/* Compare old and new render states and emit differences between them
+ * to hardware. Simplest implementation would be to emit the whole of
+ * the "to" state.
+ */
+static int emit_rss( struct svga_context *svga,
+ unsigned dirty )
+{
+ struct rs_queue queue;
+
+ queue.rs_count = 0;
+
+ if (dirty & SVGA_NEW_BLEND) {
+ const struct svga_blend_state *curr = svga->curr.blend;
+
+ EMIT_RS( svga, curr->rt[0].writemask, COLORWRITEENABLE, fail );
+ EMIT_RS( svga, curr->rt[0].blend_enable, BLENDENABLE, fail );
+
+ if (curr->rt[0].blend_enable) {
+ EMIT_RS( svga, curr->rt[0].srcblend, SRCBLEND, fail );
+ EMIT_RS( svga, curr->rt[0].dstblend, DSTBLEND, fail );
+ EMIT_RS( svga, curr->rt[0].blendeq, BLENDEQUATION, fail );
+
+ EMIT_RS( svga, curr->rt[0].separate_alpha_blend_enable,
+ SEPARATEALPHABLENDENABLE, fail );
+
+ if (curr->rt[0].separate_alpha_blend_enable) {
+ EMIT_RS( svga, curr->rt[0].srcblend_alpha, SRCBLENDALPHA, fail );
+ EMIT_RS( svga, curr->rt[0].dstblend_alpha, DSTBLENDALPHA, fail );
+ EMIT_RS( svga, curr->rt[0].blendeq_alpha, BLENDEQUATIONALPHA, fail );
+ }
+ }
+ }
+
+
+ if (dirty & (SVGA_NEW_DEPTH_STENCIL | SVGA_NEW_RAST)) {
+ const struct svga_depth_stencil_state *curr = svga->curr.depth;
+ const struct svga_rasterizer_state *rast = svga->curr.rast;
+
+ if (!curr->stencil[0].enabled)
+ {
+ /* Stencil disabled
+ */
+ EMIT_RS( svga, FALSE, STENCILENABLE, fail );
+ EMIT_RS( svga, FALSE, STENCILENABLE2SIDED, fail );
+ }
+ else if (curr->stencil[0].enabled && !curr->stencil[1].enabled)
+ {
+ /* Regular stencil
+ */
+ EMIT_RS( svga, TRUE, STENCILENABLE, fail );
+ EMIT_RS( svga, FALSE, STENCILENABLE2SIDED, fail );
+
+ EMIT_RS( svga, curr->stencil[0].func, STENCILFUNC, fail );
+ EMIT_RS( svga, curr->stencil[0].fail, STENCILFAIL, fail );
+ EMIT_RS( svga, curr->stencil[0].zfail, STENCILZFAIL, fail );
+ EMIT_RS( svga, curr->stencil[0].pass, STENCILPASS, fail );
+
+ EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail );
+ EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail );
+ EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail );
+ }
+ else
+ {
+ int cw, ccw;
+
+ /* Hardware frontwinding is always CW, so if ours is also CW,
+ * then our definition of front face agrees with hardware.
+ * Otherwise need to flip.
+ */
+ if (rast->templ.front_winding == PIPE_WINDING_CW) {
+ cw = 0;
+ ccw = 1;
+ }
+ else {
+ cw = 1;
+ ccw = 0;
+ }
+
+ /* Twoside stencil
+ */
+ EMIT_RS( svga, TRUE, STENCILENABLE, fail );
+ EMIT_RS( svga, TRUE, STENCILENABLE2SIDED, fail );
+
+ EMIT_RS( svga, curr->stencil[cw].func, STENCILFUNC, fail );
+ EMIT_RS( svga, curr->stencil[cw].fail, STENCILFAIL, fail );
+ EMIT_RS( svga, curr->stencil[cw].zfail, STENCILZFAIL, fail );
+ EMIT_RS( svga, curr->stencil[cw].pass, STENCILPASS, fail );
+
+ EMIT_RS( svga, curr->stencil[ccw].func, CCWSTENCILFUNC, fail );
+ EMIT_RS( svga, curr->stencil[ccw].fail, CCWSTENCILFAIL, fail );
+ EMIT_RS( svga, curr->stencil[ccw].zfail, CCWSTENCILZFAIL, fail );
+ EMIT_RS( svga, curr->stencil[ccw].pass, CCWSTENCILPASS, fail );
+
+ EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail );
+ EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail );
+ EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail );
+ }
+
+ EMIT_RS( svga, curr->zenable, ZENABLE, fail );
+ if (curr->zenable) {
+ EMIT_RS( svga, curr->zfunc, ZFUNC, fail );
+ EMIT_RS( svga, curr->zwriteenable, ZWRITEENABLE, fail );
+ }
+
+ EMIT_RS( svga, curr->alphatestenable, ALPHATESTENABLE, fail );
+ if (curr->alphatestenable) {
+ EMIT_RS( svga, curr->alphafunc, ALPHAFUNC, fail );
+ EMIT_RS_FLOAT( svga, curr->alpharef, ALPHAREF, fail );
+ }
+ }
+
+
+ if (dirty & SVGA_NEW_RAST)
+ {
+ const struct svga_rasterizer_state *curr = svga->curr.rast;
+
+ /* Shademode: still need to rearrange index list to move
+ * flat-shading PV first vertex.
+ */
+ EMIT_RS( svga, curr->shademode, SHADEMODE, fail );
+ EMIT_RS( svga, curr->cullmode, CULLMODE, fail );
+ EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail );
+ EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail );
+ EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail );
+ EMIT_RS( svga, curr->linepattern, LINEPATTERN, fail );
+ EMIT_RS_FLOAT( svga, curr->pointsize, POINTSIZE, fail );
+ EMIT_RS_FLOAT( svga, curr->pointsize_min, POINTSIZEMIN, fail );
+ EMIT_RS_FLOAT( svga, curr->pointsize_max, POINTSIZEMAX, fail );
+ }
+
+ if (dirty & (SVGA_NEW_RAST | SVGA_NEW_FRAME_BUFFER | SVGA_NEW_NEED_PIPELINE))
+ {
+ const struct svga_rasterizer_state *curr = svga->curr.rast;
+ float slope = 0.0;
+ float bias = 0.0;
+
+ /* Need to modify depth bias according to bound depthbuffer
+ * format. Don't do hardware depthbias while the software
+ * pipeline is active.
+ */
+ if (!svga->state.sw.need_pipeline &&
+ svga->curr.framebuffer.zsbuf)
+ {
+ slope = curr->slopescaledepthbias;
+ bias = svga->curr.depthscale * curr->depthbias;
+ }
+
+ EMIT_RS_FLOAT( svga, slope, SLOPESCALEDEPTHBIAS, fail );
+ EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
+ }
+
+
+ if (queue.rs_count) {
+ SVGA3dRenderState *rs;
+
+ if (SVGA3D_BeginSetRenderState( svga->swc,
+ &rs,
+ queue.rs_count ) != PIPE_OK)
+ goto fail;
+
+ memcpy( rs,
+ queue.rs,
+ queue.rs_count * sizeof queue.rs[0]);
+
+ SVGA_FIFOCommitAll( svga->swc );
+ }
+
+ /* Also blend color:
+ */
+
+ return 0;
+
+fail:
+ /* XXX: need to poison cached hardware state on failure to ensure
+ * dirty state gets re-emitted. Fix this by re-instating partial
+ * FIFOCommit command and only updating cached hw state once the
+ * initial allocation has succeeded.
+ */
+ memset(svga->state.hw_draw.rs, 0xcd, sizeof(svga->state.hw_draw.rs));
+
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+
+struct svga_tracked_state svga_hw_rss =
+{
+ "hw rss state",
+
+ (SVGA_NEW_BLEND |
+ SVGA_NEW_DEPTH_STENCIL |
+ SVGA_NEW_RAST |
+ SVGA_NEW_FRAME_BUFFER |
+ SVGA_NEW_NEED_PIPELINE),
+
+ emit_rss
+};
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
new file mode 100644
index 0000000000..b313794520
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -0,0 +1,279 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+
+#include "svga_screen_texture.h"
+#include "svga_winsys.h"
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+
+#include "svga_hw_reg.h"
+
+
+void svga_cleanup_tss_binding(struct svga_context *svga)
+{
+ int i;
+ unsigned count = MAX2( svga->curr.num_textures,
+ svga->state.hw_draw.num_views );
+
+ for (i = 0; i < count; i++) {
+ struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
+
+ svga_sampler_view_reference(&view->v, NULL);
+ pipe_texture_reference( &svga->curr.texture[i], NULL );
+ pipe_texture_reference( &view->texture, NULL );
+
+ view->dirty = 1;
+ }
+}
+
+
+static int
+update_tss_binding(struct svga_context *svga,
+ unsigned dirty )
+{
+ unsigned i;
+ unsigned count = MAX2( svga->curr.num_textures,
+ svga->state.hw_draw.num_views );
+ unsigned min_lod;
+ unsigned max_lod;
+
+
+ struct {
+ struct {
+ unsigned unit;
+ struct svga_hw_view_state *view;
+ } bind[PIPE_MAX_SAMPLERS];
+
+ unsigned bind_count;
+ } queue;
+
+ queue.bind_count = 0;
+
+ for (i = 0; i < count; i++) {
+ const struct svga_sampler_state *s = svga->curr.sampler[i];
+ struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
+
+ /* get min max lod */
+ if (svga->curr.texture[i]) {
+ min_lod = MAX2(s->view_min_lod, 0);
+ max_lod = MIN2(s->view_max_lod, svga->curr.texture[i]->last_level);
+ } else {
+ min_lod = 0;
+ max_lod = 0;
+ }
+
+ if (view->texture != svga->curr.texture[i] ||
+ view->min_lod != min_lod ||
+ view->max_lod != max_lod) {
+
+ svga_sampler_view_reference(&view->v, NULL);
+ pipe_texture_reference( &view->texture, svga->curr.texture[i] );
+
+ view->dirty = TRUE;
+ view->min_lod = min_lod;
+ view->max_lod = max_lod;
+
+ if (svga->curr.texture[i])
+ view->v = svga_get_tex_sampler_view(&svga->pipe,
+ svga->curr.texture[i],
+ min_lod,
+ max_lod);
+ }
+
+ if (view->dirty) {
+ queue.bind[queue.bind_count].unit = i;
+ queue.bind[queue.bind_count].view = view;
+ queue.bind_count++;
+ }
+ else if (view->v) {
+ svga_validate_sampler_view(svga, view->v);
+ }
+ }
+
+ svga->state.hw_draw.num_views = svga->curr.num_textures;
+
+ if (queue.bind_count) {
+ SVGA3dTextureState *ts;
+
+ if (SVGA3D_BeginSetTextureState( svga->swc,
+ &ts,
+ queue.bind_count ) != PIPE_OK)
+ goto fail;
+
+ for (i = 0; i < queue.bind_count; i++) {
+ ts[i].stage = queue.bind[i].unit;
+ ts[i].name = SVGA3D_TS_BIND_TEXTURE;
+
+ if (queue.bind[i].view->v) {
+ svga->swc->surface_relocation(svga->swc,
+ &ts[i].value,
+ queue.bind[i].view->v->handle,
+ PIPE_BUFFER_USAGE_GPU_READ);
+ }
+ else {
+ ts[i].value = SVGA3D_INVALID_ID;
+ }
+
+ queue.bind[i].view->dirty = FALSE;
+ }
+
+ SVGA_FIFOCommitAll( svga->swc );
+ }
+
+ return 0;
+
+fail:
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+
+struct svga_tracked_state svga_hw_tss_binding = {
+ "texture binding emit",
+ SVGA_NEW_TEXTURE_BINDING |
+ SVGA_NEW_SAMPLER,
+ update_tss_binding
+};
+
+
+/***********************************************************************
+ */
+
+struct ts_queue {
+ unsigned ts_count;
+ SVGA3dTextureState ts[PIPE_MAX_SAMPLERS*SVGA3D_TS_MAX];
+};
+
+
+#define EMIT_TS(svga, unit, val, token, fail) \
+do { \
+ if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
+ svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \
+ svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \
+ } \
+} while (0)
+
+#define EMIT_TS_FLOAT(svga, unit, fvalue, token, fail) \
+do { \
+ unsigned val = fui(fvalue); \
+ if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
+ svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \
+ svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \
+ } \
+} while (0)
+
+
+static INLINE void
+svga_queue_tss( struct ts_queue *q,
+ unsigned unit,
+ unsigned tss,
+ unsigned value )
+{
+ assert(q->ts_count < sizeof(q->ts)/sizeof(q->ts[0]));
+ q->ts[q->ts_count].stage = unit;
+ q->ts[q->ts_count].name = tss;
+ q->ts[q->ts_count].value = value;
+ q->ts_count++;
+}
+
+
+static int
+update_tss(struct svga_context *svga,
+ unsigned dirty )
+{
+ unsigned i;
+ struct ts_queue queue;
+
+ queue.ts_count = 0;
+ for (i = 0; i < svga->curr.num_samplers; i++) {
+ if (svga->curr.sampler[i]) {
+ const struct svga_sampler_state *curr = svga->curr.sampler[i];
+
+ EMIT_TS(svga, i, curr->mipfilter, MIPFILTER, fail);
+ EMIT_TS(svga, i, curr->min_lod, TEXTURE_MIPMAP_LEVEL, fail);
+ EMIT_TS(svga, i, curr->magfilter, MAGFILTER, fail);
+ EMIT_TS(svga, i, curr->minfilter, MINFILTER, fail);
+ EMIT_TS(svga, i, curr->aniso_level, TEXTURE_ANISOTROPIC_LEVEL, fail);
+ EMIT_TS_FLOAT(svga, i, curr->lod_bias, TEXTURE_LOD_BIAS, fail);
+ EMIT_TS(svga, i, curr->addressu, ADDRESSU, fail);
+ EMIT_TS(svga, i, curr->addressw, ADDRESSW, fail);
+ EMIT_TS(svga, i, curr->bordercolor, BORDERCOLOR, fail);
+ // TEXCOORDINDEX -- hopefully not needed
+
+ if (svga->curr.tex_flags.flag_1d & (1 << i)) {
+ debug_printf("wrap 1d tex %d\n", i);
+ EMIT_TS(svga, i, SVGA3D_TEX_ADDRESS_WRAP, ADDRESSV, fail);
+ }
+ else
+ EMIT_TS(svga, i, curr->addressv, ADDRESSV, fail);
+
+ if (svga->curr.tex_flags.flag_srgb & (1 << i))
+ EMIT_TS_FLOAT(svga, i, 2.2f, GAMMA, fail);
+ else
+ EMIT_TS_FLOAT(svga, i, 1.0f, GAMMA, fail);
+
+ }
+ }
+
+ if (queue.ts_count) {
+ SVGA3dTextureState *ts;
+
+ if (SVGA3D_BeginSetTextureState( svga->swc,
+ &ts,
+ queue.ts_count ) != PIPE_OK)
+ goto fail;
+
+ memcpy( ts,
+ queue.ts,
+ queue.ts_count * sizeof queue.ts[0]);
+
+ SVGA_FIFOCommitAll( svga->swc );
+ }
+
+ return 0;
+
+fail:
+ /* XXX: need to poison cached hardware state on failure to ensure
+ * dirty state gets re-emitted. Fix this by re-instating partial
+ * FIFOCommit command and only updating cached hw state once the
+ * initial allocation has succeeded.
+ */
+ memset(svga->state.hw_draw.ts, 0xcd, sizeof(svga->state.hw_draw.ts));
+
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+
+struct svga_tracked_state svga_hw_tss = {
+ "texture state emit",
+ (SVGA_NEW_SAMPLER |
+ SVGA_NEW_TEXTURE_FLAGS),
+ update_tss
+};
+
diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c
new file mode 100644
index 0000000000..c534308f50
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_vdecl.c
@@ -0,0 +1,182 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "util/u_upload_mgr.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_draw.h"
+#include "svga_tgsi.h"
+#include "svga_screen.h"
+#include "svga_screen_buffer.h"
+
+#include "svga_hw_reg.h"
+
+
+static int
+upload_user_buffers( struct svga_context *svga )
+{
+ enum pipe_error ret = PIPE_OK;
+ int i;
+ int nr;
+
+ if (0)
+ debug_printf("%s: %d\n", __FUNCTION__, svga->curr.num_vertex_buffers);
+
+ nr = svga->curr.num_vertex_buffers;
+
+ for (i = 0; i < nr; i++)
+ {
+ if (svga_buffer_is_user_buffer(svga->curr.vb[i].buffer))
+ {
+ struct pipe_buffer *upload_buffer = NULL;
+ unsigned offset = /*svga->curr.vb[i].buffer_offset*/ 0;
+ unsigned size = svga->curr.vb[i].buffer->size /*- offset*/;
+ unsigned upload_offset;
+
+ ret = u_upload_buffer( svga->upload_vb,
+ offset,
+ size,
+ svga->curr.vb[i].buffer,
+ &upload_offset,
+ &upload_buffer );
+ if (ret)
+ return ret;
+
+ if (0)
+ debug_printf("%s: %d: orig buf %p upl buf %p ofs %d sz %d\n",
+ __FUNCTION__,
+ i,
+ svga->curr.vb[i].buffer,
+ upload_buffer, upload_offset, size);
+
+ /* Make sure we release the old buffer and end up with the
+ * correct refcount on the uploaded buffer.
+ */
+ pipe_buffer_reference( &svga->curr.vb[i].buffer, NULL );
+ svga->curr.vb[i].buffer = upload_buffer;
+ svga->curr.vb[i].buffer_offset = upload_offset;
+ }
+ }
+
+ if (0)
+ debug_printf("%s: DONE\n", __FUNCTION__);
+
+ return ret;
+}
+
+
+/***********************************************************************
+ */
+
+
+static int emit_hw_vs_vdecl( struct svga_context *svga,
+ unsigned dirty )
+{
+ const struct pipe_vertex_element *ve = svga->curr.ve;
+ SVGA3dVertexDecl decl;
+ unsigned i;
+
+ assert(svga->curr.num_vertex_elements >=
+ svga->curr.vs->base.info.file_count[TGSI_FILE_INPUT]);
+
+ svga_hwtnl_reset_vdecl( svga->hwtnl,
+ svga->curr.num_vertex_elements );
+
+ for (i = 0; i < svga->curr.num_vertex_elements; i++) {
+ const struct pipe_vertex_buffer *vb = &svga->curr.vb[ve[i].vertex_buffer_index];
+ unsigned usage, index;
+
+
+ svga_generate_vdecl_semantics( i, &usage, &index );
+
+ /* SVGA_NEW_VELEMENT
+ */
+ decl.identity.type = svga->state.sw.ve_format[i];
+ decl.identity.method = SVGA3D_DECLMETHOD_DEFAULT;
+ decl.identity.usage = usage;
+ decl.identity.usageIndex = index;
+ decl.array.stride = vb->stride;
+ decl.array.offset = (vb->buffer_offset +
+ ve[i].src_offset);
+
+ svga_hwtnl_vdecl( svga->hwtnl,
+ i,
+ &decl,
+ vb->buffer );
+ }
+
+ return 0;
+}
+
+
+static int emit_hw_vdecl( struct svga_context *svga,
+ unsigned dirty )
+{
+ int ret = 0;
+
+ /* SVGA_NEW_NEED_SWTNL
+ */
+ if (svga->state.sw.need_swtnl)
+ return 0; /* Do not emit during swtnl */
+
+ /* If we get to here, we know that we're going to draw. Upload
+ * userbuffers now and try to combine multiple userbuffers from
+ * multiple draw calls into a single host buffer for performance.
+ */
+ if (svga->curr.any_user_vertex_buffers &&
+ SVGA_COMBINE_USERBUFFERS)
+ {
+ ret = upload_user_buffers( svga );
+ if (ret)
+ return ret;
+
+ svga->curr.any_user_vertex_buffers = FALSE;
+ }
+
+ return emit_hw_vs_vdecl( svga, dirty );
+}
+
+
+struct svga_tracked_state svga_hw_vdecl =
+{
+ "hw vertex decl state (hwtnl version)",
+ ( SVGA_NEW_NEED_SWTNL |
+ SVGA_NEW_VELEMENT |
+ SVGA_NEW_VBUFFER |
+ SVGA_NEW_RAST |
+ SVGA_NEW_FS |
+ SVGA_NEW_VS ),
+ emit_hw_vdecl
+};
+
+
+
+
+
+
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
new file mode 100644
index 0000000000..a947745732
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -0,0 +1,239 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "pipe/p_inlines.h"
+#include "pipe/p_defines.h"
+#include "util/u_math.h"
+#include "translate/translate.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_cmd.h"
+#include "svga_tgsi.h"
+
+#include "svga_hw_reg.h"
+
+/***********************************************************************
+ */
+
+
+static INLINE int compare_vs_keys( const struct svga_vs_compile_key *a,
+ const struct svga_vs_compile_key *b )
+{
+ unsigned keysize = svga_vs_key_size( a );
+ return memcmp( a, b, keysize );
+}
+
+
+static struct svga_shader_result *search_vs_key( struct svga_vertex_shader *vs,
+ const struct svga_vs_compile_key *key )
+{
+ struct svga_shader_result *result = vs->base.results;
+
+ assert(key);
+
+ for ( ; result; result = result->next) {
+ if (compare_vs_keys( key, &result->key.vkey ) == 0)
+ return result;
+ }
+
+ return NULL;
+}
+
+
+static enum pipe_error compile_vs( struct svga_context *svga,
+ struct svga_vertex_shader *vs,
+ const struct svga_vs_compile_key *key,
+ struct svga_shader_result **out_result )
+{
+ struct svga_shader_result *result;
+ enum pipe_error ret = PIPE_OK;
+
+ result = svga_translate_vertex_program( vs, key );
+ if (result == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+ ret = SVGA3D_DefineShader(svga->swc,
+ svga->state.next_vs_id,
+ SVGA3D_SHADERTYPE_VS,
+ result->tokens,
+ result->nr_tokens * sizeof result->tokens[0]);
+ if (ret)
+ goto fail;
+
+ *out_result = result;
+ result->id = svga->state.next_vs_id++;
+ result->next = vs->base.results;
+ vs->base.results = result;
+ return PIPE_OK;
+
+fail:
+ if (result)
+ svga_destroy_shader_result( result );
+ return ret;
+}
+
+/* SVGA_NEW_PRESCALE, SVGA_NEW_RAST, SVGA_NEW_ZERO_STRIDE
+ */
+static int make_vs_key( struct svga_context *svga,
+ struct svga_vs_compile_key *key )
+{
+ memset(key, 0, sizeof *key);
+ key->need_prescale = svga->state.hw_clear.prescale.enabled;
+ key->allow_psiz = svga->curr.rast->templ.point_size_per_vertex;
+ key->zero_stride_vertex_elements =
+ svga->curr.zero_stride_vertex_elements;
+ key->num_zero_stride_vertex_elements =
+ svga->curr.num_zero_stride_vertex_elements;
+ return 0;
+}
+
+
+
+static int emit_hw_vs( struct svga_context *svga,
+ unsigned dirty )
+{
+ struct svga_shader_result *result = NULL;
+ unsigned id = SVGA3D_INVALID_ID;
+ int ret = 0;
+
+ /* SVGA_NEW_NEED_SWTNL */
+ if (!svga->state.sw.need_swtnl) {
+ struct svga_vertex_shader *vs = svga->curr.vs;
+ struct svga_vs_compile_key key;
+
+ ret = make_vs_key( svga, &key );
+ if (ret)
+ return ret;
+
+ result = search_vs_key( vs, &key );
+ if (!result) {
+ ret = compile_vs( svga, vs, &key, &result );
+ if (ret)
+ return ret;
+ }
+
+ assert (result);
+ id = result->id;
+ }
+
+ if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX]) {
+ ret = SVGA3D_SetShader(svga->swc,
+ SVGA3D_SHADERTYPE_VS,
+ id );
+ if (ret)
+ return ret;
+
+ svga->dirty |= SVGA_NEW_VS_RESULT;
+ svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX] = id;
+ svga->state.hw_draw.vs = result;
+ }
+
+ return 0;
+}
+
+struct svga_tracked_state svga_hw_vs =
+{
+ "vertex shader (hwtnl)",
+ (SVGA_NEW_VS |
+ SVGA_NEW_PRESCALE |
+ SVGA_NEW_NEED_SWTNL |
+ SVGA_NEW_ZERO_STRIDE),
+ emit_hw_vs
+};
+
+
+/***********************************************************************
+ */
+static int update_zero_stride( struct svga_context *svga,
+ unsigned dirty )
+{
+ unsigned i;
+
+ svga->curr.zero_stride_vertex_elements = 0;
+ svga->curr.num_zero_stride_vertex_elements = 0;
+
+ for (i = 0; i < svga->curr.num_vertex_elements; i++) {
+ const struct pipe_vertex_element *vel = &svga->curr.ve[i];
+ const struct pipe_vertex_buffer *vbuffer = &svga->curr.vb[
+ vel->vertex_buffer_index];
+ if (vbuffer->stride == 0) {
+ unsigned const_idx =
+ svga->curr.num_zero_stride_vertex_elements;
+ struct translate *translate;
+ struct translate_key key;
+ void *mapped_buffer;
+
+ svga->curr.zero_stride_vertex_elements |= (1 << i);
+ ++svga->curr.num_zero_stride_vertex_elements;
+
+ key.output_stride = 4 * sizeof(float);
+ key.nr_elements = 1;
+ key.element[0].input_format = vel->src_format;
+ key.element[0].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ key.element[0].input_buffer = vel->vertex_buffer_index;
+ key.element[0].input_offset = vel->src_offset;
+ key.element[0].output_offset = const_idx * 4 * sizeof(float);
+
+ translate_key_sanitize(&key);
+ /* translate_generic_create is technically private but
+ * we don't want to code-generate, just want generic
+ * translation */
+ translate = translate_generic_create(&key);
+
+ assert(vel->src_offset == 0);
+
+ mapped_buffer = pipe_buffer_map_range(svga->pipe.screen,
+ vbuffer->buffer,
+ vel->src_offset,
+ pf_get_size(vel->src_format),
+ PIPE_BUFFER_USAGE_CPU_READ);
+ translate->set_buffer(translate, vel->vertex_buffer_index,
+ mapped_buffer,
+ vbuffer->stride);
+ translate->run(translate, 0, 1,
+ svga->curr.zero_stride_constants);
+
+ pipe_buffer_unmap(svga->pipe.screen,
+ vbuffer->buffer);
+ translate->release(translate);
+ }
+ }
+
+ if (svga->curr.num_zero_stride_vertex_elements)
+ svga->dirty |= SVGA_NEW_ZERO_STRIDE;
+
+ return 0;
+}
+
+struct svga_tracked_state svga_hw_update_zero_stride =
+{
+ "update zero_stride",
+ ( SVGA_NEW_VELEMENT |
+ SVGA_NEW_VBUFFER ),
+ update_zero_stride
+};
diff --git a/src/gallium/drivers/svga/svga_swtnl.h b/src/gallium/drivers/svga/svga_swtnl.h
new file mode 100644
index 0000000000..4882f26b17
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_swtnl.h
@@ -0,0 +1,52 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_SWTNL_H
+#define SVGA_SWTNL_H
+
+#include "pipe/p_compiler.h"
+
+struct svga_context;
+struct pipe_context;
+struct pipe_buffer;
+struct vbuf_render;
+
+
+boolean svga_init_swtnl( struct svga_context *svga );
+void svga_destroy_swtnl( struct svga_context *svga );
+
+
+enum pipe_error
+svga_swtnl_draw_range_elements(struct svga_context *svga,
+ struct pipe_buffer *indexBuffer,
+ unsigned indexSize,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim,
+ unsigned start,
+ unsigned count);
+
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c
new file mode 100644
index 0000000000..b4f757a47a
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_swtnl_backend.c
@@ -0,0 +1,349 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "draw/draw_vbuf.h"
+#include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
+
+#include "util/u_debug.h"
+#include "pipe/p_inlines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_simple_shaders.h"
+
+#include "svga_context.h"
+#include "svga_state.h"
+#include "svga_swtnl.h"
+
+#include "svga_types.h"
+#include "svga_reg.h"
+#include "svga3d_reg.h"
+#include "svga_draw.h"
+#include "svga_swtnl_private.h"
+
+
+static const struct vertex_info *
+svga_vbuf_render_get_vertex_info( struct vbuf_render *render )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+
+ svga_swtnl_update_vdecl(svga);
+
+ return &svga_render->vertex_info;
+}
+
+
+static boolean
+svga_vbuf_render_allocate_vertices( struct vbuf_render *render,
+ ushort vertex_size,
+ ushort nr_vertices )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+ struct pipe_screen *screen = svga->pipe.screen;
+ size_t size = (size_t)nr_vertices * (size_t)vertex_size;
+ boolean new_vbuf = FALSE;
+ boolean new_ibuf = FALSE;
+
+ if (svga_render->vertex_size != vertex_size)
+ svga->swtnl.new_vdecl = TRUE;
+ svga_render->vertex_size = (size_t)vertex_size;
+
+ if (svga->swtnl.new_vbuf)
+ new_ibuf = new_vbuf = TRUE;
+ svga->swtnl.new_vbuf = FALSE;
+
+ if (svga_render->vbuf_size < svga_render->vbuf_offset + svga_render->vbuf_used + size)
+ new_vbuf = TRUE;
+
+ if (new_vbuf)
+ pipe_buffer_reference(&svga_render->vbuf, NULL);
+ if (new_ibuf)
+ pipe_buffer_reference(&svga_render->ibuf, NULL);
+
+ if (!svga_render->vbuf) {
+ svga_render->vbuf_size = MAX2(size, svga_render->vbuf_alloc_size);
+ svga_render->vbuf = pipe_buffer_create(screen,
+ 0,
+ PIPE_BUFFER_USAGE_VERTEX,
+ svga_render->vbuf_size);
+ if(!svga_render->vbuf) {
+ svga_context_flush(svga, NULL);
+ svga_render->vbuf = pipe_buffer_create(screen,
+ 0,
+ PIPE_BUFFER_USAGE_VERTEX,
+ svga_render->vbuf_size);
+ assert(svga_render->vbuf);
+ }
+
+ svga->swtnl.new_vdecl = TRUE;
+ svga_render->vbuf_offset = 0;
+ } else {
+ svga_render->vbuf_offset += svga_render->vbuf_used;
+ }
+
+ svga_render->vbuf_used = 0;
+
+ if (svga->swtnl.new_vdecl)
+ svga_render->vdecl_offset = svga_render->vbuf_offset;
+
+ return TRUE;
+}
+
+static void *
+svga_vbuf_render_map_vertices( struct vbuf_render *render )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+ struct pipe_screen *screen = svga->pipe.screen;
+
+ char *ptr = (char*)pipe_buffer_map(screen,
+ svga_render->vbuf,
+ PIPE_BUFFER_USAGE_CPU_WRITE |
+ PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
+ return ptr + svga_render->vbuf_offset;
+}
+
+static void
+svga_vbuf_render_unmap_vertices( struct vbuf_render *render,
+ ushort min_index,
+ ushort max_index )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+ struct pipe_screen *screen = svga->pipe.screen;
+ unsigned offset, length;
+ size_t used = svga_render->vertex_size * ((size_t)max_index + 1);
+
+ offset = svga_render->vbuf_offset + svga_render->vertex_size * min_index;
+ length = svga_render->vertex_size * (max_index + 1 - min_index);
+ pipe_buffer_flush_mapped_range(screen, svga_render->vbuf, offset, length);
+ pipe_buffer_unmap(screen, svga_render->vbuf);
+ svga_render->min_index = min_index;
+ svga_render->max_index = max_index;
+ svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used);
+}
+
+static boolean
+svga_vbuf_render_set_primitive( struct vbuf_render *render,
+ unsigned prim )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ svga_render->prim = prim;
+
+ return TRUE;
+}
+
+static void
+svga_vbuf_sumbit_state( struct svga_vbuf_render *svga_render )
+{
+ struct svga_context *svga = svga_render->svga;
+ SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
+ enum pipe_error ret;
+ int i;
+
+ /* if the vdecl or vbuf hasn't changed do nothing */
+ if (!svga->swtnl.new_vdecl)
+ return;
+
+ memcpy(vdecl, svga_render->vdecl, sizeof(vdecl));
+
+ /* flush the hw state */
+ ret = svga_hwtnl_flush(svga->hwtnl);
+ if (ret) {
+ svga_context_flush(svga, NULL);
+ ret = svga_hwtnl_flush(svga->hwtnl);
+ /* if we hit this path we might become synced with hw */
+ svga->swtnl.new_vbuf = TRUE;
+ assert(ret == 0);
+ }
+
+ svga_hwtnl_reset_vdecl(svga->hwtnl, svga_render->vdecl_count);
+
+ for (i = 0; i < svga_render->vdecl_count; i++) {
+ vdecl[i].array.offset += svga_render->vdecl_offset;
+
+ svga_hwtnl_vdecl( svga->hwtnl,
+ i,
+ &vdecl[i],
+ svga_render->vbuf );
+ }
+
+ /* We have already taken care of flatshading, so let the hwtnl
+ * module use whatever is most convenient:
+ */
+ if (svga->state.sw.need_pipeline) {
+ svga_hwtnl_set_flatshade(svga->hwtnl, FALSE, FALSE);
+ svga_hwtnl_set_unfilled(svga->hwtnl, PIPE_POLYGON_MODE_FILL);
+ }
+ else {
+ svga_hwtnl_set_flatshade( svga->hwtnl,
+ svga->curr.rast->templ.flatshade,
+ svga->curr.rast->templ.flatshade_first );
+
+ svga_hwtnl_set_unfilled( svga->hwtnl,
+ svga->curr.rast->hw_unfilled );
+ }
+
+ svga->swtnl.new_vdecl = FALSE;
+}
+
+static void
+svga_vbuf_render_draw_arrays( struct vbuf_render *render,
+ unsigned start,
+ uint nr )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+ unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size;
+ enum pipe_error ret = 0;
+
+ svga_vbuf_sumbit_state(svga_render);
+
+ /* Need to call update_state() again as the draw module may have
+ * altered some of our state behind our backs. Testcase:
+ * redbook/polys.c
+ */
+ svga_update_state_retry( svga, SVGA_STATE_HW_DRAW );
+
+ ret = svga_hwtnl_draw_arrays(svga->hwtnl, svga_render->prim, start + bias, nr);
+ if (ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = svga_hwtnl_draw_arrays(svga->hwtnl, svga_render->prim, start + bias, nr);
+ svga->swtnl.new_vbuf = TRUE;
+ assert(ret == PIPE_OK);
+ }
+}
+
+
+static void
+svga_vbuf_render_draw( struct vbuf_render *render,
+ const ushort *indices,
+ uint nr_indices)
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+ struct svga_context *svga = svga_render->svga;
+ struct pipe_screen *screen = svga->pipe.screen;
+ unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size;
+ boolean ret;
+ size_t size = 2 * nr_indices;
+
+ assert(( svga_render->vbuf_offset - svga_render->vdecl_offset) % svga_render->vertex_size == 0);
+
+ if (svga_render->ibuf_size < svga_render->ibuf_offset + size)
+ pipe_buffer_reference(&svga_render->ibuf, NULL);
+
+ if (!svga_render->ibuf) {
+ svga_render->ibuf_size = MAX2(size, svga_render->ibuf_alloc_size);
+ svga_render->ibuf = pipe_buffer_create(screen,
+ 0,
+ PIPE_BUFFER_USAGE_VERTEX,
+ svga_render->ibuf_size);
+ svga_render->ibuf_offset = 0;
+ }
+
+ pipe_buffer_write(screen, svga_render->ibuf,
+ svga_render->ibuf_offset, 2 * nr_indices, indices);
+
+
+ /* off to hardware */
+ svga_vbuf_sumbit_state(svga_render);
+
+ /* Need to call update_state() again as the draw module may have
+ * altered some of our state behind our backs. Testcase:
+ * redbook/polys.c
+ */
+ svga_update_state_retry( svga, SVGA_STATE_HW_DRAW );
+
+ ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
+ svga_render->ibuf,
+ 2,
+ svga_render->min_index,
+ svga_render->max_index,
+ svga_render->prim,
+ svga_render->ibuf_offset / 2, nr_indices, bias);
+ if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
+ svga_render->ibuf,
+ 2,
+ svga_render->min_index,
+ svga_render->max_index,
+ svga_render->prim,
+ svga_render->ibuf_offset / 2, nr_indices, bias);
+ svga->swtnl.new_vbuf = TRUE;
+ assert(ret == PIPE_OK);
+ }
+
+ svga_render->ibuf_offset += size;
+}
+
+
+static void
+svga_vbuf_render_release_vertices( struct vbuf_render *render )
+{
+
+}
+
+
+static void
+svga_vbuf_render_destroy( struct vbuf_render *render )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
+
+ pipe_buffer_reference(&svga_render->vbuf, NULL);
+ pipe_buffer_reference(&svga_render->ibuf, NULL);
+ FREE(svga_render);
+}
+
+
+/**
+ * Create a new primitive render.
+ */
+struct vbuf_render *
+svga_vbuf_render_create( struct svga_context *svga )
+{
+ struct svga_vbuf_render *svga_render = CALLOC_STRUCT(svga_vbuf_render);
+
+ svga_render->svga = svga;
+ svga_render->ibuf_size = 0;
+ svga_render->vbuf_size = 0;
+ svga_render->ibuf_alloc_size = 4*1024;
+ svga_render->vbuf_alloc_size = 64*1024;
+ svga_render->base.max_vertex_buffer_bytes = 64*1024/10;
+ svga_render->base.max_indices = 65536;
+ svga_render->base.get_vertex_info = svga_vbuf_render_get_vertex_info;
+ svga_render->base.allocate_vertices = svga_vbuf_render_allocate_vertices;
+ svga_render->base.map_vertices = svga_vbuf_render_map_vertices;
+ svga_render->base.unmap_vertices = svga_vbuf_render_unmap_vertices;
+ svga_render->base.set_primitive = svga_vbuf_render_set_primitive;
+ svga_render->base.draw = svga_vbuf_render_draw;
+ svga_render->base.draw_arrays = svga_vbuf_render_draw_arrays;
+ svga_render->base.release_vertices = svga_vbuf_render_release_vertices;
+ svga_render->base.destroy = svga_vbuf_render_destroy;
+
+ return &svga_render->base;
+}
diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
new file mode 100644
index 0000000000..8b14c913f7
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -0,0 +1,170 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "draw/draw_context.h"
+#include "draw/draw_vbuf.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_state.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_swtnl.h"
+#include "svga_state.h"
+#include "svga_swtnl_private.h"
+
+
+
+enum pipe_error
+svga_swtnl_draw_range_elements(struct svga_context *svga,
+ struct pipe_buffer *indexBuffer,
+ unsigned indexSize,
+ unsigned min_index,
+ unsigned max_index,
+ unsigned prim, unsigned start, unsigned count)
+{
+ struct draw_context *draw = svga->swtnl.draw;
+ unsigned i;
+ const void *map;
+ enum pipe_error ret;
+
+ assert(!svga->dirty);
+ assert(svga->state.sw.need_swtnl);
+ assert(draw);
+
+ ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW);
+ if (ret) {
+ svga_context_flush(svga, NULL);
+ ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW);
+ svga->swtnl.new_vbuf = TRUE;
+ assert(ret == PIPE_OK);
+ }
+
+ /*
+ * Map vertex buffers
+ */
+ for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
+ map = pipe_buffer_map(svga->pipe.screen,
+ svga->curr.vb[i].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ draw_set_mapped_vertex_buffer(draw, i, map);
+ }
+
+ /* Map index buffer, if present */
+ if (indexBuffer) {
+ map = pipe_buffer_map(svga->pipe.screen, indexBuffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ draw_set_mapped_element_buffer_range(draw,
+ indexSize,
+ min_index,
+ max_index,
+ map);
+ }
+
+ if (svga->curr.cb[PIPE_SHADER_VERTEX]) {
+ map = pipe_buffer_map(svga->pipe.screen,
+ svga->curr.cb[PIPE_SHADER_VERTEX],
+ PIPE_BUFFER_USAGE_CPU_READ);
+ assert(map);
+ draw_set_mapped_constant_buffer(
+ draw,
+ map,
+ svga->curr.cb[PIPE_SHADER_VERTEX]->size);
+ }
+
+ draw_arrays(svga->swtnl.draw, prim, start, count);
+
+ draw_flush(svga->swtnl.draw);
+
+ /* Ensure the draw module didn't touch this */
+ assert(i == svga->curr.num_vertex_buffers);
+
+ /*
+ * unmap vertex/index buffers
+ */
+ for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
+ pipe_buffer_unmap(svga->pipe.screen, svga->curr.vb[i].buffer);
+ draw_set_mapped_vertex_buffer(draw, i, NULL);
+ }
+
+ if (indexBuffer) {
+ pipe_buffer_unmap(svga->pipe.screen, indexBuffer);
+ draw_set_mapped_element_buffer(draw, 0, NULL);
+ }
+
+ if (svga->curr.cb[PIPE_SHADER_VERTEX]) {
+ pipe_buffer_unmap(svga->pipe.screen,
+ svga->curr.cb[PIPE_SHADER_VERTEX]);
+ }
+
+ return ret;
+}
+
+
+
+
+boolean svga_init_swtnl( struct svga_context *svga )
+{
+ svga->swtnl.backend = svga_vbuf_render_create(svga);
+ if(!svga->swtnl.backend)
+ goto fail;
+
+ /*
+ * Create drawing context and plug our rendering stage into it.
+ */
+ svga->swtnl.draw = draw_create();
+ if (svga->swtnl.draw == NULL)
+ goto fail;
+
+
+ draw_set_rasterize_stage(svga->swtnl.draw,
+ draw_vbuf_stage( svga->swtnl.draw, svga->swtnl.backend ));
+
+ draw_set_render(svga->swtnl.draw, svga->swtnl.backend);
+
+ draw_install_aaline_stage(svga->swtnl.draw, &svga->pipe);
+ draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe);
+ draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe);
+
+ draw_set_driver_clipping(svga->swtnl.draw, debug_get_bool_option("SVGA_SWTNL_FSE", FALSE));
+
+ return TRUE;
+
+fail:
+ if (svga->swtnl.backend)
+ svga->swtnl.backend->destroy( svga->swtnl.backend );
+
+ if (svga->swtnl.draw)
+ draw_destroy( svga->swtnl.draw );
+
+ return FALSE;
+}
+
+
+void svga_destroy_swtnl( struct svga_context *svga )
+{
+ draw_destroy( svga->swtnl.draw );
+}
diff --git a/src/gallium/drivers/svga/svga_swtnl_private.h b/src/gallium/drivers/svga/svga_swtnl_private.h
new file mode 100644
index 0000000000..9bbb42910f
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_swtnl_private.h
@@ -0,0 +1,93 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_SWTNL_PRIVATE_H
+#define SVGA_SWTNL_PRIVATE_H
+
+#include "svga_swtnl.h"
+#include "draw/draw_vertex.h"
+
+#include "svga_types.h"
+#include "svga3d_reg.h"
+
+/**
+ * Primitive renderer for svga.
+ */
+struct svga_vbuf_render {
+ struct vbuf_render base;
+
+ struct svga_context *svga;
+ struct vertex_info vertex_info;
+
+ unsigned vertex_size;
+
+ unsigned prim;
+
+ struct pipe_buffer *vbuf;
+ struct pipe_buffer *ibuf;
+
+ /* current size of buffer */
+ size_t vbuf_size;
+ size_t ibuf_size;
+
+ /* size of that the buffer should be */
+ size_t vbuf_alloc_size;
+ size_t ibuf_alloc_size;
+
+ /* current write place */
+ size_t vbuf_offset;
+ size_t ibuf_offset;
+
+ /* currently used */
+ size_t vbuf_used;
+
+ SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
+ unsigned vdecl_offset;
+ unsigned vdecl_count;
+
+ ushort min_index;
+ ushort max_index;
+};
+
+/**
+ * Basically a cast wrapper.
+ */
+static INLINE struct svga_vbuf_render *
+svga_vbuf_render( struct vbuf_render *render )
+{
+ assert(render);
+ return (struct svga_vbuf_render *)render;
+}
+
+
+struct vbuf_render *
+svga_vbuf_render_create( struct svga_context *svga );
+
+
+int
+svga_swtnl_update_vdecl( struct svga_context *svga );
+
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c
new file mode 100644
index 0000000000..1616312113
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_swtnl_state.c
@@ -0,0 +1,242 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include "draw/draw_context.h"
+#include "draw/draw_vbuf.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_state.h"
+#include "util/u_memory.h"
+
+#include "svga_context.h"
+#include "svga_swtnl.h"
+#include "svga_state.h"
+
+#include "svga_swtnl_private.h"
+
+
+#define SVGA_POINT_ADJ_X -0.375
+#define SVGA_POINT_ADJ_Y -0.5
+
+#define SVGA_LINE_ADJ_X -0.5
+#define SVGA_LINE_ADJ_Y -0.5
+
+#define SVGA_TRIANGLE_ADJ_X -0.375
+#define SVGA_TRIANGLE_ADJ_Y -0.5
+
+
+static void set_draw_viewport( struct svga_context *svga )
+{
+ struct pipe_viewport_state vp = svga->curr.viewport;
+ float adjx = 0;
+ float adjy = 0;
+
+ switch (svga->curr.reduced_prim) {
+ case PIPE_PRIM_POINTS:
+ adjx = SVGA_POINT_ADJ_X;
+ adjy = SVGA_POINT_ADJ_Y;
+ break;
+ case PIPE_PRIM_LINES:
+ /* XXX: This is to compensate for the fact that wide lines are
+ * going to be drawn with triangles, but we're not catching all
+ * cases where that will happen.
+ */
+ if (svga->curr.rast->templ.line_width > 1.0)
+ {
+ adjx = SVGA_LINE_ADJ_X + 0.175;
+ adjy = SVGA_LINE_ADJ_Y - 0.175;
+ }
+ else {
+ adjx = SVGA_LINE_ADJ_X;
+ adjy = SVGA_LINE_ADJ_Y;
+ }
+ break;
+ case PIPE_PRIM_TRIANGLES:
+ adjx += SVGA_TRIANGLE_ADJ_X;
+ adjy += SVGA_TRIANGLE_ADJ_Y;
+ break;
+ }
+
+ vp.translate[0] += adjx;
+ vp.translate[1] += adjy;
+
+ draw_set_viewport_state(svga->swtnl.draw, &vp);
+}
+
+static int update_swtnl_draw( struct svga_context *svga,
+ unsigned dirty )
+{
+ draw_flush( svga->swtnl.draw );
+
+ if (dirty & SVGA_NEW_VS)
+ draw_bind_vertex_shader(svga->swtnl.draw,
+ svga->curr.vs->draw_shader);
+
+ if (dirty & SVGA_NEW_VBUFFER)
+ draw_set_vertex_buffers(svga->swtnl.draw,
+ svga->curr.num_vertex_buffers,
+ svga->curr.vb);
+
+ if (dirty & SVGA_NEW_VELEMENT)
+ draw_set_vertex_elements(svga->swtnl.draw,
+ svga->curr.num_vertex_elements,
+ svga->curr.ve );
+
+ if (dirty & SVGA_NEW_CLIP)
+ draw_set_clip_state(svga->swtnl.draw,
+ &svga->curr.clip);
+
+ if (dirty & (SVGA_NEW_VIEWPORT |
+ SVGA_NEW_REDUCED_PRIMITIVE |
+ SVGA_NEW_RAST))
+ set_draw_viewport( svga );
+
+ if (dirty & SVGA_NEW_RAST)
+ draw_set_rasterizer_state(svga->swtnl.draw,
+ &svga->curr.rast->templ);
+
+ if (dirty & SVGA_NEW_FRAME_BUFFER)
+ draw_set_mrd(svga->swtnl.draw,
+ svga->curr.depthscale);
+
+ if (dirty & SVGA_NEW_EDGEFLAGS)
+ draw_set_edgeflags( svga->swtnl.draw,
+ svga->curr.edgeflags );
+
+ return 0;
+}
+
+
+struct svga_tracked_state svga_update_swtnl_draw =
+{
+ "update draw module state",
+ (SVGA_NEW_VS |
+ SVGA_NEW_VBUFFER |
+ SVGA_NEW_VELEMENT |
+ SVGA_NEW_CLIP |
+ SVGA_NEW_VIEWPORT |
+ SVGA_NEW_RAST |
+ SVGA_NEW_FRAME_BUFFER |
+ SVGA_NEW_REDUCED_PRIMITIVE |
+ SVGA_NEW_EDGEFLAGS),
+ update_swtnl_draw
+};
+
+
+int svga_swtnl_update_vdecl( struct svga_context *svga )
+{
+ struct svga_vbuf_render *svga_render = svga_vbuf_render(svga->swtnl.backend);
+ struct draw_context *draw = svga->swtnl.draw;
+ struct vertex_info *vinfo = &svga_render->vertex_info;
+ SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
+ const enum interp_mode colorInterp =
+ svga->curr.rast->templ.flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
+ const struct svga_fragment_shader *fs = svga->curr.fs;
+ int offset = 0;
+ int nr_decls = 0;
+ int src, i;
+
+ memset(vinfo, 0, sizeof(*vinfo));
+ memset(vdecl, 0, sizeof(vdecl));
+
+ /* always add position */
+ src = draw_find_vs_output(draw, TGSI_SEMANTIC_POSITION, 0);
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, src);
+ vinfo->attrib[0].emit = EMIT_4F;
+ vdecl[0].array.offset = offset;
+ vdecl[0].identity.type = SVGA3D_DECLTYPE_FLOAT4;
+ vdecl[0].identity.usage = SVGA3D_DECLUSAGE_POSITIONT;
+ vdecl[0].identity.usageIndex = 0;
+ offset += 16;
+ nr_decls++;
+
+ for (i = 0; i < fs->base.info.num_inputs; i++) {
+ unsigned name = fs->base.info.input_semantic_name[i];
+ unsigned index = fs->base.info.input_semantic_index[i];
+ src = draw_find_vs_output(draw, name, index);
+ vdecl[nr_decls].array.offset = offset;
+ vdecl[nr_decls].identity.usageIndex = fs->base.info.input_semantic_index[i];
+
+ switch (name) {
+ case TGSI_SEMANTIC_COLOR:
+ draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
+ vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_COLOR;
+ vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4;
+ offset += 16;
+ nr_decls++;
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
+ vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4;
+ vdecl[nr_decls].identity.usageIndex += 1;
+ offset += 16;
+ nr_decls++;
+ break;
+ case TGSI_SEMANTIC_FOG:
+ draw_emit_vertex_attr(vinfo, EMIT_1F, INTERP_PERSPECTIVE, src);
+ vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT1;
+ assert(vdecl[nr_decls].identity.usageIndex == 0);
+ offset += 4;
+ nr_decls++;
+ break;
+ case TGSI_SEMANTIC_POSITION:
+ /* generated internally, not a vertex shader output */
+ break;
+ default:
+ assert(0);
+ }
+ }
+
+ draw_compute_vertex_size(vinfo);
+
+ svga_render->vdecl_count = nr_decls;
+ for (i = 0; i < svga_render->vdecl_count; i++)
+ vdecl[i].array.stride = offset;
+
+ if (memcmp(svga_render->vdecl, vdecl, sizeof(vdecl)) == 0)
+ return 0;
+
+ memcpy(svga_render->vdecl, vdecl, sizeof(vdecl));
+ svga->swtnl.new_vdecl = TRUE;
+
+ return 0;
+}
+
+
+static int update_swtnl_vdecl( struct svga_context *svga,
+ unsigned dirty )
+{
+ return svga_swtnl_update_vdecl( svga );
+}
+
+
+struct svga_tracked_state svga_update_swtnl_vdecl =
+{
+ "update draw module vdecl",
+ (SVGA_NEW_VS |
+ SVGA_NEW_FS),
+ update_swtnl_vdecl
+};
diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c
new file mode 100644
index 0000000000..44d0930bc0
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi.c
@@ -0,0 +1,266 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/p_defines.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_scan.h"
+#include "util/u_memory.h"
+
+#include "svgadump/st_shader_dump.h"
+
+#include "svga_context.h"
+#include "svga_tgsi.h"
+#include "svga_tgsi_emit.h"
+#include "svga_debug.h"
+
+#include "svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+
+/* Sinkhole used only in error conditions.
+ */
+static char err_buf[128];
+
+#if 0
+static void svga_destroy_shader_emitter( struct svga_shader_emitter *emit )
+{
+ if (emit->buf != err_buf)
+ FREE(emit->buf);
+}
+#endif
+
+
+static boolean svga_shader_expand( struct svga_shader_emitter *emit )
+{
+ char *new_buf;
+ unsigned newsize = emit->size * 2;
+
+ if(emit->buf != err_buf)
+ new_buf = REALLOC(emit->buf, emit->size, newsize);
+ else
+ new_buf = NULL;
+
+ if (new_buf == NULL) {
+ emit->ptr = err_buf;
+ emit->buf = err_buf;
+ emit->size = sizeof(err_buf);
+ return FALSE;
+ }
+
+ emit->size = newsize;
+ emit->ptr = new_buf + (emit->ptr - emit->buf);
+ emit->buf = new_buf;
+ return TRUE;
+}
+
+static INLINE boolean reserve( struct svga_shader_emitter *emit,
+ unsigned nr_dwords )
+{
+ if (emit->ptr - emit->buf + nr_dwords * sizeof(unsigned) >= emit->size) {
+ if (!svga_shader_expand( emit ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+boolean svga_shader_emit_dword( struct svga_shader_emitter *emit,
+ unsigned dword )
+{
+ if (!reserve(emit, 1))
+ return FALSE;
+
+ *(unsigned *)emit->ptr = dword;
+ emit->ptr += sizeof dword;
+ return TRUE;
+}
+
+boolean svga_shader_emit_dwords( struct svga_shader_emitter *emit,
+ const unsigned *dwords,
+ unsigned nr )
+{
+ if (!reserve(emit, nr))
+ return FALSE;
+
+ memcpy( emit->ptr, dwords, nr * sizeof *dwords );
+ emit->ptr += nr * sizeof *dwords;
+ return TRUE;
+}
+
+boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit,
+ unsigned opcode )
+{
+ SVGA3dShaderInstToken *here;
+
+ if (!reserve(emit, 1))
+ return FALSE;
+
+ here = (SVGA3dShaderInstToken *)emit->ptr;
+ here->value = opcode;
+
+ if (emit->insn_offset) {
+ SVGA3dShaderInstToken *prev = (SVGA3dShaderInstToken *)(emit->buf +
+ emit->insn_offset);
+ prev->size = (here - prev) - 1;
+ }
+
+ emit->insn_offset = emit->ptr - emit->buf;
+ emit->ptr += sizeof(unsigned);
+ return TRUE;
+}
+
+#define SVGA3D_PS_2X (SVGA3D_PS_20 | 1)
+#define SVGA3D_VS_2X (SVGA3D_VS_20 | 1)
+
+static boolean svga_shader_emit_header( struct svga_shader_emitter *emit )
+{
+ SVGA3dShaderVersion header;
+
+ memset( &header, 0, sizeof header );
+
+ switch (emit->unit) {
+ case PIPE_SHADER_FRAGMENT:
+ header.value = emit->use_sm30 ? SVGA3D_PS_30 : SVGA3D_PS_2X;
+ break;
+ case PIPE_SHADER_VERTEX:
+ header.value = emit->use_sm30 ? SVGA3D_VS_30 : SVGA3D_VS_2X;
+ break;
+ }
+
+ return svga_shader_emit_dword( emit, header.value );
+}
+
+
+
+
+
+/* Parse TGSI shader and translate to SVGA/DX9 serialized
+ * representation.
+ *
+ * In this function SVGA shader is emitted to an in-memory buffer that
+ * can be dynamically grown. Once we've finished and know how large
+ * it is, it will be copied to a hardware buffer for upload.
+ */
+static struct svga_shader_result *
+svga_tgsi_translate( const struct svga_shader *shader,
+ union svga_compile_key key,
+ unsigned unit )
+{
+ struct svga_shader_result *result = NULL;
+ struct svga_shader_emitter emit;
+ int ret = 0;
+
+ memset(&emit, 0, sizeof(emit));
+
+ emit.use_sm30 = shader->use_sm30;
+ emit.size = 1024;
+ emit.buf = MALLOC(emit.size);
+ if (emit.buf == NULL) {
+ ret = PIPE_ERROR_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+ emit.ptr = emit.buf;
+ emit.unit = unit;
+ emit.key = key;
+
+ tgsi_scan_shader( shader->tokens, &emit.info);
+
+ emit.imm_start = emit.info.file_max[TGSI_FILE_CONSTANT] + 1;
+
+ if (unit == PIPE_SHADER_FRAGMENT)
+ emit.imm_start += key.fkey.num_unnormalized_coords;
+
+ if (unit == PIPE_SHADER_VERTEX) {
+ emit.imm_start += key.vkey.need_prescale ? 2 : 0;
+ emit.imm_start += key.vkey.num_zero_stride_vertex_elements;
+ }
+
+ emit.nr_hw_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1);
+
+ emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1;
+ emit.in_main_func = TRUE;
+
+ if (!svga_shader_emit_header( &emit ))
+ goto fail;
+
+ if (!svga_shader_emit_instructions( &emit, shader->tokens ))
+ goto fail;
+
+ result = CALLOC_STRUCT(svga_shader_result);
+ if (result == NULL)
+ goto fail;
+
+ result->shader = shader;
+ result->tokens = (const unsigned *)emit.buf;
+ result->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned);
+ memcpy(&result->key, &key, sizeof key);
+
+ return result;
+
+fail:
+ FREE(result);
+ FREE(emit.buf);
+ return NULL;
+}
+
+
+
+
+struct svga_shader_result *
+svga_translate_fragment_program( const struct svga_fragment_shader *fs,
+ const struct svga_fs_compile_key *fkey )
+{
+ union svga_compile_key key;
+ memcpy(&key.fkey, fkey, sizeof *fkey);
+
+ return svga_tgsi_translate( &fs->base,
+ key,
+ PIPE_SHADER_FRAGMENT );
+}
+
+struct svga_shader_result *
+svga_translate_vertex_program( const struct svga_vertex_shader *vs,
+ const struct svga_vs_compile_key *vkey )
+{
+ union svga_compile_key key;
+ memcpy(&key.vkey, vkey, sizeof *vkey);
+
+ return svga_tgsi_translate( &vs->base,
+ key,
+ PIPE_SHADER_VERTEX );
+}
+
+
+void svga_destroy_shader_result( struct svga_shader_result *result )
+{
+ FREE((unsigned *)result->tokens);
+ FREE(result);
+}
+
diff --git a/src/gallium/drivers/svga/svga_tgsi.h b/src/gallium/drivers/svga/svga_tgsi.h
new file mode 100644
index 0000000000..896c90a89a
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi.h
@@ -0,0 +1,139 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_TGSI_H
+#define SVGA_TGSI_H
+
+#include "pipe/p_state.h"
+
+#include "svga_hw_reg.h"
+
+struct svga_fragment_shader;
+struct svga_vertex_shader;
+struct svga_shader;
+struct tgsi_shader_info;
+struct tgsi_token;
+
+
+struct svga_vs_compile_key
+{
+ ubyte need_prescale:1;
+ ubyte allow_psiz:1;
+ unsigned zero_stride_vertex_elements;
+ ubyte num_zero_stride_vertex_elements:6;
+};
+
+struct svga_fs_compile_key
+{
+ boolean light_twoside:1;
+ boolean front_cw:1;
+ ubyte num_textures;
+ ubyte num_unnormalized_coords;
+ struct {
+ ubyte compare_mode : 1;
+ ubyte compare_func : 3;
+ ubyte unnormalized : 1;
+
+ ubyte width_height_idx : 7;
+
+ ubyte texture_target;
+ } tex[PIPE_MAX_SAMPLERS];
+};
+
+union svga_compile_key {
+ struct svga_vs_compile_key vkey;
+ struct svga_fs_compile_key fkey;
+};
+
+struct svga_shader_result
+{
+ const struct svga_shader *shader;
+
+ /* Parameters used to generate this compilation result:
+ */
+ union svga_compile_key key;
+
+ /* Compiled shader tokens:
+ */
+ const unsigned *tokens;
+ unsigned nr_tokens;
+
+ /* SVGA Shader ID:
+ */
+ unsigned id;
+
+ /* Next compilation result:
+ */
+ struct svga_shader_result *next;
+};
+
+
+/* TGSI doesn't provide use with VS input semantics (they're actually
+ * pretty meaningless), so we just generate some plausible ones here.
+ * This is called both from within the TGSI translator and when
+ * building vdecls to ensure they match up.
+ *
+ * The real use of this information is matching vertex elements to
+ * fragment shader inputs in the case where vertex shader is disabled.
+ */
+static INLINE void svga_generate_vdecl_semantics( unsigned idx,
+ unsigned *usage,
+ unsigned *usage_index )
+{
+ if (idx == 0) {
+ *usage = SVGA3D_DECLUSAGE_POSITION;
+ *usage_index = 0;
+ }
+ else {
+ *usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ *usage_index = idx - 1;
+ }
+}
+
+
+
+static INLINE unsigned svga_vs_key_size( const struct svga_vs_compile_key *key )
+{
+ return sizeof *key;
+}
+
+static INLINE unsigned svga_fs_key_size( const struct svga_fs_compile_key *key )
+{
+ return (const char *)&key->tex[key->num_textures].texture_target -
+ (const char *)key;
+}
+
+struct svga_shader_result *
+svga_translate_fragment_program( const struct svga_fragment_shader *fs,
+ const struct svga_fs_compile_key *fkey );
+
+struct svga_shader_result *
+svga_translate_vertex_program( const struct svga_vertex_shader *fs,
+ const struct svga_vs_compile_key *vkey );
+
+
+void svga_destroy_shader_result( struct svga_shader_result *result );
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
new file mode 100644
index 0000000000..54457082a0
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
@@ -0,0 +1,280 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_parse.h"
+#include "util/u_memory.h"
+
+#include "svga_tgsi_emit.h"
+#include "svga_context.h"
+
+
+
+
+static boolean ps20_input( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ struct src_register reg;
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ switch (semantic.SemanticName) {
+ case TGSI_SEMANTIC_POSITION:
+ /* Special case:
+ */
+ reg = src_register( SVGA3DREG_MISCTYPE,
+ SVGA3DMISCREG_POSITION );
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ reg = src_register( SVGA3DREG_INPUT,
+ semantic.SemanticIndex );
+ break;
+ case TGSI_SEMANTIC_FOG:
+ assert(semantic.SemanticIndex == 0);
+ reg = src_register( SVGA3DREG_TEXTURE, 0 );
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ reg = src_register( SVGA3DREG_TEXTURE,
+ semantic.SemanticIndex + 1 );
+ break;
+ default:
+ assert(0);
+ return TRUE;
+ }
+
+ emit->input_map[idx] = reg;
+
+ dcl.dst = dst( reg );
+
+ dcl.usage = 0;
+ dcl.index = 0;
+
+ dcl.values[0] |= 1<<31;
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+
+static boolean ps20_output( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3dShaderDestToken reg;
+
+ switch (semantic.SemanticName) {
+ case TGSI_SEMANTIC_COLOR:
+ if (semantic.SemanticIndex < PIPE_MAX_COLOR_BUFS) {
+ unsigned cbuf = semantic.SemanticIndex;
+
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_col[cbuf] = emit->output_map[idx];
+ emit->true_col[cbuf] = dst_register( SVGA3DREG_COLOROUT,
+ semantic.SemanticIndex );
+ }
+ else {
+ assert(0);
+ reg = dst_register( SVGA3DREG_COLOROUT, 0 );
+ }
+ break;
+ case TGSI_SEMANTIC_POSITION:
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_pos = emit->output_map[idx];
+ emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT,
+ semantic.SemanticIndex );
+ break;
+ default:
+ assert(0);
+ reg = dst_register( SVGA3DREG_COLOROUT, 0 );
+ break;
+ }
+
+ return TRUE;
+}
+
+
+static boolean vs20_input( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx );
+ dcl.dst = dst_register( SVGA3DREG_INPUT, idx );
+
+ assert(dcl.dst.reserved0);
+
+ /* Mesa doesn't provide use with VS input semantics (they're
+ * actually pretty meaningless), so we just generate some plausible
+ * ones here. This has to match what we declare in the vdecl code
+ * in svga_pipe_vertex.c.
+ */
+ if (idx == 0) {
+ dcl.usage = SVGA3D_DECLUSAGE_POSITION;
+ dcl.index = 0;
+ }
+ else {
+ dcl.usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ dcl.index = idx - 1;
+ }
+
+ dcl.values[0] |= 1<<31;
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+
+static boolean vs20_output( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ /* Don't emit dcl instruction for vs20 inputs
+ */
+
+ /* Just build the register map table:
+ */
+ switch (semantic.SemanticName) {
+ case TGSI_SEMANTIC_POSITION:
+ assert(semantic.SemanticIndex == 0);
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_pos = emit->output_map[idx];
+ emit->true_pos = dst_register( SVGA3DREG_RASTOUT,
+ SVGA3DRASTOUT_POSITION);
+ break;
+ case TGSI_SEMANTIC_PSIZE:
+ assert(semantic.SemanticIndex == 0);
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_psiz = emit->output_map[idx];
+ emit->true_psiz = dst_register( SVGA3DREG_RASTOUT,
+ SVGA3DRASTOUT_PSIZE );
+ break;
+ case TGSI_SEMANTIC_FOG:
+ assert(semantic.SemanticIndex == 0);
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, 0 );
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ /* oD0 */
+ emit->output_map[idx] = dst_register( SVGA3DREG_ATTROUT,
+ semantic.SemanticIndex );
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT,
+ semantic.SemanticIndex + 1 );
+ break;
+ default:
+ assert(0);
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, 0 );
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static boolean ps20_sampler( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ dcl.dst = dst_register( SVGA3DREG_SAMPLER, idx );
+ dcl.type = svga_tgsi_sampler_type( emit, idx );
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+
+boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit,
+ const struct tgsi_full_declaration *decl )
+{
+ unsigned first = decl->DeclarationRange.First;
+ unsigned last = decl->DeclarationRange.Last;
+ unsigned semantic = 0;
+ unsigned semantic_idx = 0;
+ unsigned idx;
+
+ if (decl->Declaration.Semantic) {
+ semantic = decl->Semantic.SemanticName;
+ semantic_idx = decl->Semantic.SemanticIndex;
+ }
+
+ for( idx = first; idx <= last; idx++ ) {
+ boolean ok;
+
+ switch (decl->Declaration.File) {
+ case TGSI_FILE_SAMPLER:
+ assert (emit->unit == PIPE_SHADER_FRAGMENT);
+ ok = ps20_sampler( emit, decl->Semantic, idx );
+ break;
+
+ case TGSI_FILE_INPUT:
+ if (emit->unit == PIPE_SHADER_VERTEX)
+ ok = vs20_input( emit, decl->Semantic, idx );
+ else
+ ok = ps20_input( emit, decl->Semantic, idx );
+ break;
+
+ case TGSI_FILE_OUTPUT:
+ if (emit->unit == PIPE_SHADER_VERTEX)
+ ok = vs20_output( emit, decl->Semantic, idx );
+ else
+ ok = ps20_output( emit, decl->Semantic, idx );
+ break;
+
+ default:
+ /* don't need to declare other vars */
+ ok = TRUE;
+ }
+
+ if (!ok)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
new file mode 100644
index 0000000000..08e7dfb117
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -0,0 +1,385 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_parse.h"
+#include "util/u_memory.h"
+
+#include "svga_tgsi_emit.h"
+#include "svga_context.h"
+
+static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semantic,
+ unsigned *usage,
+ unsigned *idx )
+{
+ switch (semantic.SemanticName) {
+ case TGSI_SEMANTIC_POSITION:
+ *idx = semantic.SemanticIndex;
+ *usage = SVGA3D_DECLUSAGE_POSITION;
+ break;
+ case TGSI_SEMANTIC_COLOR:
+
+ *idx = semantic.SemanticIndex;
+ *usage = SVGA3D_DECLUSAGE_COLOR;
+ break;
+ case TGSI_SEMANTIC_BCOLOR:
+ *idx = semantic.SemanticIndex + 2; /* sharing with COLOR */
+ *usage = SVGA3D_DECLUSAGE_COLOR;
+ break;
+ case TGSI_SEMANTIC_FOG:
+ *idx = 0;
+ assert(semantic.SemanticIndex == 0);
+ *usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ break;
+ case TGSI_SEMANTIC_PSIZE:
+ *idx = semantic.SemanticIndex;
+ *usage = SVGA3D_DECLUSAGE_PSIZE;
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ *idx = semantic.SemanticIndex + 1; /* texcoord[0] is reserved for fog */
+ *usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ break;
+ case TGSI_SEMANTIC_NORMAL:
+ *idx = semantic.SemanticIndex;
+ *usage = SVGA3D_DECLUSAGE_NORMAL;
+ break;
+ default:
+ assert(0);
+ *usage = SVGA3D_DECLUSAGE_TEXCOORD;
+ *idx = 0;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static boolean emit_decl( struct svga_shader_emitter *emit,
+ SVGA3dShaderDestToken reg,
+ unsigned usage,
+ unsigned index )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ dcl.dst = reg;
+ dcl.usage = usage;
+ dcl.index = index;
+ dcl.values[0] |= 1<<31;
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+static boolean emit_vface_decl( struct svga_shader_emitter *emit )
+{
+ if (!emit->emitted_vface) {
+ SVGA3dShaderDestToken reg =
+ dst_register( SVGA3DREG_MISCTYPE,
+ SVGA3DMISCREG_FACE );
+
+ if (!emit_decl( emit, reg, 0, 0 ))
+ return FALSE;
+
+ emit->emitted_vface = TRUE;
+ }
+ return TRUE;
+}
+
+static boolean ps30_input( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ unsigned usage, index;
+ SVGA3dShaderDestToken reg;
+
+ if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) {
+ emit->input_map[idx] = src_register( SVGA3DREG_MISCTYPE,
+ SVGA3DMISCREG_POSITION );
+
+ emit->input_map[idx].base.swizzle = TRANSLATE_SWIZZLE( TGSI_SWIZZLE_X,
+ TGSI_SWIZZLE_Y,
+ TGSI_SWIZZLE_Y,
+ TGSI_SWIZZLE_Y );
+
+ reg = writemask( dst(emit->input_map[idx]),
+ TGSI_WRITEMASK_XY );
+
+ return emit_decl( emit, reg, 0, 0 );
+ }
+ else if (emit->key.fkey.light_twoside &&
+ (semantic.SemanticName == TGSI_SEMANTIC_COLOR)) {
+
+ if (!translate_vs_ps_semantic( semantic, &usage, &index ))
+ return FALSE;
+
+ emit->internal_color_idx[emit->internal_color_count] = idx;
+ emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count );
+ emit->ps30_input_count++;
+ emit->internal_color_count++;
+
+ reg = dst( emit->input_map[idx] );
+
+ if (!emit_decl( emit, reg, usage, index ))
+ return FALSE;
+
+ semantic.SemanticName = TGSI_SEMANTIC_BCOLOR;
+ if (!translate_vs_ps_semantic( semantic, &usage, &index ))
+ return FALSE;
+
+ reg = dst_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
+
+ if (!emit_decl( emit, reg, usage, index ))
+ return FALSE;
+
+ if (!emit_vface_decl( emit ))
+ return FALSE;
+
+ return TRUE;
+ }
+ else if (semantic.SemanticName == TGSI_SEMANTIC_FACE) {
+ if (!emit_vface_decl( emit ))
+ return FALSE;
+ emit->emit_frontface = TRUE;
+ emit->internal_frontface_idx = idx;
+ return TRUE;
+ }
+ else {
+
+ if (!translate_vs_ps_semantic( semantic, &usage, &index ))
+ return FALSE;
+
+ emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
+ reg = dst( emit->input_map[idx] );
+
+ return emit_decl( emit, reg, usage, index );
+ }
+
+}
+
+
+/* PS output registers are the same as 2.0
+ */
+static boolean ps30_output( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3dShaderDestToken reg;
+
+ switch (semantic.SemanticName) {
+ case TGSI_SEMANTIC_COLOR:
+ emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT,
+ semantic.SemanticIndex );
+ break;
+ case TGSI_SEMANTIC_POSITION:
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_pos = emit->output_map[idx];
+ emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT,
+ semantic.SemanticIndex );
+ break;
+ default:
+ assert(0);
+ reg = dst_register( SVGA3DREG_COLOROUT, 0 );
+ break;
+ }
+
+ return TRUE;
+}
+
+
+/* We still make up the input semantics the same as in 2.0
+ */
+static boolean vs30_input( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+ unsigned usage, index;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ if (emit->key.vkey.zero_stride_vertex_elements & (1 << idx)) {
+ unsigned i;
+ unsigned offset = 0;
+ unsigned start_idx = emit->info.file_max[TGSI_FILE_CONSTANT] + 1;
+ /* adjust for prescale constants */
+ start_idx += emit->key.vkey.need_prescale ? 2 : 0;
+ /* compute the offset from the start of zero stride constants */
+ for (i = 0; i < PIPE_MAX_ATTRIBS && i < idx; ++i) {
+ if (emit->key.vkey.zero_stride_vertex_elements & (1<input_map[idx] = src_register( SVGA3DREG_CONST,
+ start_idx + offset );
+ } else {
+ emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx );
+ dcl.dst = dst_register( SVGA3DREG_INPUT, idx );
+
+ assert(dcl.dst.reserved0);
+
+ svga_generate_vdecl_semantics( idx, &usage, &index );
+
+ dcl.usage = usage;
+ dcl.index = index;
+ dcl.values[0] |= 1<<31;
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+ }
+ return TRUE;
+}
+
+/* VS3.0 outputs have proper declarations and semantic info for
+ * matching against PS inputs.
+ */
+static boolean vs30_output( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+ unsigned usage, index;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ if (!translate_vs_ps_semantic( semantic, &usage, &index ))
+ return FALSE;
+
+ dcl.dst = dst_register( SVGA3DREG_OUTPUT, idx );
+ dcl.usage = usage;
+ dcl.index = index;
+ dcl.values[0] |= 1<<31;
+
+ if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) {
+ assert(idx == 0);
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_pos = emit->output_map[idx];
+ emit->true_pos = dcl.dst;
+ }
+ else if (semantic.SemanticName == TGSI_SEMANTIC_PSIZE) {
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_psiz = emit->output_map[idx];
+
+ /* This has the effect of not declaring psiz (below) and not
+ * emitting the final MOV to true_psiz in the postamble.
+ */
+ if (!emit->key.vkey.allow_psiz)
+ return TRUE;
+
+ emit->true_psiz = dcl.dst;
+ }
+ else {
+ emit->output_map[idx] = dcl.dst;
+ }
+
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+static boolean ps30_sampler( struct svga_shader_emitter *emit,
+ struct tgsi_declaration_semantic semantic,
+ unsigned idx )
+{
+ SVGA3DOpDclArgs dcl;
+ SVGA3dShaderInstToken opcode;
+
+ opcode = inst_token( SVGA3DOP_DCL );
+ dcl.values[0] = 0;
+ dcl.values[1] = 0;
+
+ dcl.dst = dst_register( SVGA3DREG_SAMPLER, idx );
+ dcl.type = svga_tgsi_sampler_type( emit, idx );
+ dcl.values[0] |= 1<<31;
+
+ return (emit_instruction(emit, opcode) &&
+ svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+}
+
+
+boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit,
+ const struct tgsi_full_declaration *decl )
+{
+ unsigned first = decl->DeclarationRange.First;
+ unsigned last = decl->DeclarationRange.Last;
+ unsigned semantic = 0;
+ unsigned semantic_idx = 0;
+ unsigned idx;
+
+ if (decl->Declaration.Semantic) {
+ semantic = decl->Semantic.SemanticName;
+ semantic_idx = decl->Semantic.SemanticIndex;
+ }
+
+ for( idx = first; idx <= last; idx++ ) {
+ boolean ok;
+
+ switch (decl->Declaration.File) {
+ case TGSI_FILE_SAMPLER:
+ assert (emit->unit == PIPE_SHADER_FRAGMENT);
+ ok = ps30_sampler( emit, decl->Semantic, idx );
+ break;
+
+ case TGSI_FILE_INPUT:
+ if (emit->unit == PIPE_SHADER_VERTEX)
+ ok = vs30_input( emit, decl->Semantic, idx );
+ else
+ ok = ps30_input( emit, decl->Semantic, idx );
+ break;
+
+ case TGSI_FILE_OUTPUT:
+ if (emit->unit == PIPE_SHADER_VERTEX)
+ ok = vs30_output( emit, decl->Semantic, idx );
+ else
+ ok = ps30_output( emit, decl->Semantic, idx );
+ break;
+
+ default:
+ /* don't need to declare other vars */
+ ok = TRUE;
+ }
+
+ if (!ok)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
new file mode 100644
index 0000000000..2557824293
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -0,0 +1,345 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_TGSI_EMIT_H
+#define SVGA_TGSI_EMIT_H
+
+#include "tgsi/tgsi_scan.h"
+#include "svga_hw_reg.h"
+#include "svga_tgsi.h"
+#include "svga3d_shaderdefs.h"
+
+struct src_register
+{
+ SVGA3dShaderSrcToken base;
+ SVGA3dShaderSrcToken indirect;
+};
+
+
+struct svga_arl_consts {
+ int number;
+ int idx;
+ int swizzle;
+ int arl_num;
+};
+
+/* Internal functions:
+ */
+
+struct svga_shader_emitter
+{
+ boolean use_sm30;
+
+ unsigned size;
+ char *buf;
+ char *ptr;
+
+ union svga_compile_key key;
+ struct tgsi_shader_info info;
+ int unit;
+
+ int imm_start;
+
+ int nr_hw_const;
+ int nr_hw_temp;
+
+ int insn_offset;
+
+ int internal_temp_count;
+ int internal_imm_count;
+
+ int internal_color_idx[2]; /* diffuse, specular */
+ int internal_color_count;
+
+ boolean emitted_vface;
+ boolean emit_frontface;
+ int internal_frontface_idx;
+
+ int ps30_input_count;
+
+ boolean in_main_func;
+
+ boolean created_zero_immediate;
+ int zero_immediate_idx;
+
+ boolean created_loop_const;
+ int loop_const_idx;
+
+ boolean created_sincos_consts;
+ int sincos_consts_idx;
+
+ unsigned label[32];
+ unsigned nr_labels;
+
+ struct src_register input_map[PIPE_MAX_ATTRIBS];
+ SVGA3dShaderDestToken output_map[PIPE_MAX_ATTRIBS];
+
+ struct src_register imm_0055;
+ SVGA3dShaderDestToken temp_pos;
+ SVGA3dShaderDestToken true_pos;
+
+ SVGA3dShaderDestToken temp_col[PIPE_MAX_COLOR_BUFS];
+ SVGA3dShaderDestToken true_col[PIPE_MAX_COLOR_BUFS];
+
+ SVGA3dShaderDestToken temp_psiz;
+ SVGA3dShaderDestToken true_psiz;
+
+ struct svga_arl_consts arl_consts[12];
+ int num_arl_consts;
+ int current_arl;
+};
+
+
+boolean svga_shader_emit_dword( struct svga_shader_emitter *emit,
+ unsigned dword );
+
+boolean svga_shader_emit_dwords( struct svga_shader_emitter *emit,
+ const unsigned *dwords,
+ unsigned nr );
+
+boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit,
+ unsigned opcode );
+
+boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
+ const struct tgsi_token *tokens );
+
+boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit,
+ const struct tgsi_full_declaration *decl );
+
+boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit,
+ const struct tgsi_full_declaration *decl );
+
+
+static INLINE boolean emit_dst( struct svga_shader_emitter *emit,
+ SVGA3dShaderDestToken dest )
+{
+ assert(dest.reserved0);
+ return svga_shader_emit_dword( emit, dest.value );
+}
+
+static INLINE boolean emit_src( struct svga_shader_emitter *emit,
+ const struct src_register src )
+{
+ if (src.base.relAddr) {
+ assert(src.base.reserved0);
+ assert(src.indirect.reserved0);
+ return (svga_shader_emit_dword( emit, src.base.value ) &&
+ svga_shader_emit_dword( emit, src.indirect.value ));
+ }
+ else {
+ assert(src.base.reserved0);
+ return svga_shader_emit_dword( emit, src.base.value );
+ }
+}
+
+
+static INLINE boolean emit_instruction( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken opcode )
+{
+ return svga_shader_emit_opcode( emit, opcode.value );
+}
+
+
+static INLINE boolean emit_op1( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0 )
+{
+ return (emit_instruction( emit, inst ) &&
+ emit_dst( emit, dest ) &&
+ emit_src( emit, src0 ));
+}
+
+static INLINE boolean emit_op2( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0,
+ struct src_register src1 )
+{
+ return (emit_instruction( emit, inst ) &&
+ emit_dst( emit, dest ) &&
+ emit_src( emit, src0 ) &&
+ emit_src( emit, src1 ));
+}
+
+static INLINE boolean emit_op3( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0,
+ struct src_register src1,
+ struct src_register src2 )
+{
+ return (emit_instruction( emit, inst ) &&
+ emit_dst( emit, dest ) &&
+ emit_src( emit, src0 ) &&
+ emit_src( emit, src1 ) &&
+ emit_src( emit, src2 ));
+}
+
+
+#define TRANSLATE_SWIZZLE(x,y,z,w) ((x) | ((y) << 2) | ((z) << 4) | ((w) << 6))
+#define SWIZZLE_XYZW \
+ TRANSLATE_SWIZZLE(TGSI_SWIZZLE_X,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_W)
+#define SWIZZLE_XXXX \
+ TRANSLATE_SWIZZLE(TGSI_SWIZZLE_X,TGSI_SWIZZLE_X,TGSI_SWIZZLE_X,TGSI_SWIZZLE_X)
+#define SWIZZLE_YYYY \
+ TRANSLATE_SWIZZLE(TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y)
+#define SWIZZLE_ZZZZ \
+ TRANSLATE_SWIZZLE(TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z)
+#define SWIZZLE_WWWW \
+ TRANSLATE_SWIZZLE(TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W)
+
+
+
+static INLINE SVGA3dShaderInstToken
+inst_token( unsigned opcode )
+{
+ SVGA3dShaderInstToken inst;
+
+ inst.value = 0;
+ inst.op = opcode;
+
+ return inst;
+}
+
+static INLINE SVGA3dShaderDestToken
+dst_register( unsigned file,
+ int number )
+{
+ SVGA3dShaderDestToken dest;
+
+ dest.value = 0;
+ dest.num = number;
+ dest.type_upper = file >> 3;
+ dest.relAddr = 0;
+ dest.reserved1 = 0;
+ dest.mask = 0xf;
+ dest.dstMod = 0;
+ dest.shfScale = 0;
+ dest.type_lower = file & 0x7;
+ dest.reserved0 = 1; /* is_reg */
+
+ return dest;
+}
+
+static INLINE SVGA3dShaderDestToken
+writemask( SVGA3dShaderDestToken dest,
+ unsigned mask )
+{
+ dest.mask &= mask;
+ return dest;
+}
+
+
+static INLINE SVGA3dShaderSrcToken
+src_token( unsigned file, int number )
+{
+ SVGA3dShaderSrcToken src;
+
+ src.value = 0;
+ src.num = number;
+ src.type_upper = file >> 3;
+ src.relAddr = 0;
+ src.reserved1 = 0;
+ src.swizzle = SWIZZLE_XYZW;
+ src.srcMod = 0;
+ src.type_lower = file & 0x7;
+ src.reserved0 = 1; /* is_reg */
+
+ return src;
+}
+
+
+static INLINE struct src_register
+absolute( struct src_register src )
+{
+ src.base.srcMod = SVGA3DSRCMOD_ABS;
+
+ return src;
+}
+
+
+static INLINE struct src_register
+negate( struct src_register src )
+{
+ switch (src.base.srcMod) {
+ case SVGA3DSRCMOD_ABS:
+ src.base.srcMod = SVGA3DSRCMOD_ABSNEG;
+ break;
+ case SVGA3DSRCMOD_ABSNEG:
+ src.base.srcMod = SVGA3DSRCMOD_ABS;
+ break;
+ case SVGA3DSRCMOD_NEG:
+ src.base.srcMod = SVGA3DSRCMOD_NONE;
+ break;
+ case SVGA3DSRCMOD_NONE:
+ src.base.srcMod = SVGA3DSRCMOD_NEG;
+ break;
+ }
+ return src;
+}
+
+
+static INLINE struct src_register
+src_register( unsigned file, int number )
+{
+ struct src_register src;
+
+ src.base = src_token( file, number );
+ src.indirect.value = 0;
+
+ return src;
+}
+
+static INLINE SVGA3dShaderDestToken dst( struct src_register src )
+{
+ return dst_register( SVGA3dShaderGetRegType( src.base.value ),
+ src.base.num );
+}
+
+static INLINE struct src_register src( SVGA3dShaderDestToken dst )
+{
+ return src_register( SVGA3dShaderGetRegType( dst.value ),
+ dst.num );
+}
+
+static INLINE ubyte svga_tgsi_sampler_type( struct svga_shader_emitter *emit,
+ int idx )
+{
+ switch (emit->key.fkey.tex[idx].texture_target) {
+ case PIPE_TEXTURE_1D:
+ return SVGA3DSAMP_2D;
+ case PIPE_TEXTURE_2D:
+ return SVGA3DSAMP_2D;
+ case PIPE_TEXTURE_3D:
+ return SVGA3DSAMP_VOLUME;
+ case PIPE_TEXTURE_CUBE:
+ return SVGA3DSAMP_CUBE;
+ }
+
+ return SVGA3DSAMP_UNKNOWN;
+}
+
+#endif
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
new file mode 100644
index 0000000000..ea409b7e16
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -0,0 +1,2716 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_parse.h"
+#include "util/u_memory.h"
+
+#include "svga_tgsi_emit.h"
+#include "svga_context.h"
+
+
+static boolean emit_vs_postamble( struct svga_shader_emitter *emit );
+static boolean emit_ps_postamble( struct svga_shader_emitter *emit );
+
+
+
+
+static unsigned
+translate_opcode(
+ uint opcode )
+{
+ switch (opcode) {
+ case TGSI_OPCODE_ABS: return SVGA3DOP_ABS;
+ case TGSI_OPCODE_ADD: return SVGA3DOP_ADD;
+ case TGSI_OPCODE_BREAKC: return SVGA3DOP_BREAKC;
+ case TGSI_OPCODE_DDX: return SVGA3DOP_DSX;
+ case TGSI_OPCODE_DDY: return SVGA3DOP_DSY;
+ case TGSI_OPCODE_DP2A: return SVGA3DOP_DP2ADD;
+ case TGSI_OPCODE_DP3: return SVGA3DOP_DP3;
+ case TGSI_OPCODE_DP4: return SVGA3DOP_DP4;
+ case TGSI_OPCODE_ENDFOR: return SVGA3DOP_ENDLOOP;
+ case TGSI_OPCODE_FRC: return SVGA3DOP_FRC;
+ case TGSI_OPCODE_BGNFOR: return SVGA3DOP_LOOP;
+ case TGSI_OPCODE_MAD: return SVGA3DOP_MAD;
+ case TGSI_OPCODE_MAX: return SVGA3DOP_MAX;
+ case TGSI_OPCODE_MIN: return SVGA3DOP_MIN;
+ case TGSI_OPCODE_MOV: return SVGA3DOP_MOV;
+ case TGSI_OPCODE_MUL: return SVGA3DOP_MUL;
+ case TGSI_OPCODE_NOP: return SVGA3DOP_NOP;
+ case TGSI_OPCODE_NRM4: return SVGA3DOP_NRM;
+ case TGSI_OPCODE_SSG: return SVGA3DOP_SGN;
+ default:
+ debug_printf("Unkown opcode %u\n", opcode);
+ assert( 0 );
+ return SVGA3DOP_LAST_INST;
+ }
+}
+
+
+static unsigned translate_file( unsigned file )
+{
+ switch (file) {
+ case TGSI_FILE_TEMPORARY: return SVGA3DREG_TEMP;
+ case TGSI_FILE_INPUT: return SVGA3DREG_INPUT;
+ case TGSI_FILE_OUTPUT: return SVGA3DREG_OUTPUT; /* VS3.0+ only */
+ case TGSI_FILE_IMMEDIATE: return SVGA3DREG_CONST;
+ case TGSI_FILE_CONSTANT: return SVGA3DREG_CONST;
+ case TGSI_FILE_SAMPLER: return SVGA3DREG_SAMPLER;
+ case TGSI_FILE_ADDRESS: return SVGA3DREG_ADDR;
+ default:
+ assert( 0 );
+ return SVGA3DREG_TEMP;
+ }
+}
+
+
+
+
+
+
+static SVGA3dShaderDestToken
+translate_dst_register( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn,
+ unsigned idx )
+{
+ const struct tgsi_full_dst_register *reg = &insn->FullDstRegisters[idx];
+ SVGA3dShaderDestToken dest;
+
+ switch (reg->DstRegister.File) {
+ case TGSI_FILE_OUTPUT:
+ /* Output registers encode semantic information in their name.
+ * Need to lookup a table built at decl time:
+ */
+ dest = emit->output_map[reg->DstRegister.Index];
+ break;
+
+ default:
+ dest = dst_register( translate_file( reg->DstRegister.File ),
+ reg->DstRegister.Index );
+ break;
+ }
+
+ dest.mask = reg->DstRegister.WriteMask;
+
+ if (insn->Instruction.Saturate)
+ dest.dstMod = SVGA3DDSTMOD_SATURATE;
+
+ return dest;
+}
+
+
+static struct src_register
+swizzle( struct src_register src,
+ int x,
+ int y,
+ int z,
+ int w )
+{
+ x = (src.base.swizzle >> (x * 2)) & 0x3;
+ y = (src.base.swizzle >> (y * 2)) & 0x3;
+ z = (src.base.swizzle >> (z * 2)) & 0x3;
+ w = (src.base.swizzle >> (w * 2)) & 0x3;
+
+ src.base.swizzle = TRANSLATE_SWIZZLE(x,y,z,w);
+
+ return src;
+}
+
+static struct src_register
+scalar( struct src_register src,
+ int comp )
+{
+ return swizzle( src, comp, comp, comp, comp );
+}
+
+static INLINE boolean
+svga_arl_needs_adjustment( const struct svga_shader_emitter *emit )
+{
+ int i;
+
+ for (i = 0; i < emit->num_arl_consts; ++i) {
+ if (emit->arl_consts[i].arl_num == emit->current_arl)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static INLINE int
+svga_arl_adjustment( const struct svga_shader_emitter *emit )
+{
+ int i;
+
+ for (i = 0; i < emit->num_arl_consts; ++i) {
+ if (emit->arl_consts[i].arl_num == emit->current_arl)
+ return emit->arl_consts[i].number;
+ }
+ return 0;
+}
+
+static struct src_register
+translate_src_register( const struct svga_shader_emitter *emit,
+ const struct tgsi_full_src_register *reg )
+{
+ struct src_register src;
+
+ switch (reg->SrcRegister.File) {
+ case TGSI_FILE_INPUT:
+ /* Input registers are referred to by their semantic name rather
+ * than by index. Use the mapping build up from the decls:
+ */
+ src = emit->input_map[reg->SrcRegister.Index];
+ break;
+
+ case TGSI_FILE_IMMEDIATE:
+ /* Immediates are appended after TGSI constants in the D3D
+ * constant buffer.
+ */
+ src = src_register( translate_file( reg->SrcRegister.File ),
+ reg->SrcRegister.Index +
+ emit->imm_start );
+ break;
+
+ default:
+ src = src_register( translate_file( reg->SrcRegister.File ),
+ reg->SrcRegister.Index );
+
+ break;
+ }
+
+ /* Indirect addressing (for coninstant buffer lookups only)
+ */
+ if (reg->SrcRegister.Indirect)
+ {
+ /* we shift the offset towards the minimum */
+ if (svga_arl_needs_adjustment( emit )) {
+ src.base.num -= svga_arl_adjustment( emit );
+ }
+ src.base.relAddr = 1;
+
+ /* Not really sure what should go in the second token:
+ */
+ src.indirect = src_token( SVGA3DREG_ADDR,
+ reg->SrcRegisterInd.Index );
+
+ src.indirect.swizzle = SWIZZLE_XXXX;
+ }
+
+ src = swizzle( src,
+ reg->SrcRegister.SwizzleX,
+ reg->SrcRegister.SwizzleY,
+ reg->SrcRegister.SwizzleZ,
+ reg->SrcRegister.SwizzleW );
+
+ /* src.mod isn't a bitfield, unfortunately:
+ * See tgsi_util_get_full_src_register_sign_mode for implementation details.
+ */
+ if (reg->SrcRegisterExtMod.Absolute) {
+ if (reg->SrcRegisterExtMod.Negate)
+ src.base.srcMod = SVGA3DSRCMOD_ABSNEG;
+ else
+ src.base.srcMod = SVGA3DSRCMOD_ABS;
+ }
+ else {
+ if (reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate)
+ src.base.srcMod = SVGA3DSRCMOD_NEG;
+ else
+ src.base.srcMod = SVGA3DSRCMOD_NONE;
+ }
+
+ return src;
+}
+
+
+/*
+ * Get a temporary register, return -1 if none available
+ */
+static INLINE SVGA3dShaderDestToken
+get_temp( struct svga_shader_emitter *emit )
+{
+ int i = emit->nr_hw_temp + emit->internal_temp_count++;
+
+ return dst_register( SVGA3DREG_TEMP, i );
+}
+
+/* Release a single temp. Currently only effective if it was the last
+ * allocated temp, otherwise release will be delayed until the next
+ * call to reset_temp_regs().
+ */
+static INLINE void
+release_temp( struct svga_shader_emitter *emit,
+ SVGA3dShaderDestToken temp )
+{
+ if (temp.num == emit->internal_temp_count - 1)
+ emit->internal_temp_count--;
+}
+
+static void reset_temp_regs( struct svga_shader_emitter *emit )
+{
+ emit->internal_temp_count = 0;
+}
+
+
+static boolean submit_op0( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest )
+{
+ return (emit_instruction( emit, inst ) &&
+ emit_dst( emit, dest ));
+}
+
+static boolean submit_op1( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0 )
+{
+ return emit_op1( emit, inst, dest, src0 );
+}
+
+
+/* SVGA shaders may not refer to >1 constant register in a single
+ * instruction. This function checks for that usage and inserts a
+ * move to temporary if detected.
+ *
+ * The same applies to input registers -- at most a single input
+ * register may be read by any instruction.
+ */
+static boolean submit_op2( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0,
+ struct src_register src1 )
+{
+ SVGA3dShaderDestToken temp;
+ SVGA3dShaderRegType type0, type1;
+ boolean need_temp = FALSE;
+
+ temp.value = 0;
+ type0 = SVGA3dShaderGetRegType( src0.base.value );
+ type1 = SVGA3dShaderGetRegType( src1.base.value );
+
+ if (type0 == SVGA3DREG_CONST &&
+ type1 == SVGA3DREG_CONST &&
+ src0.base.num != src1.base.num)
+ need_temp = TRUE;
+
+ if (type0 == SVGA3DREG_INPUT &&
+ type1 == SVGA3DREG_INPUT &&
+ src0.base.num != src1.base.num)
+ need_temp = TRUE;
+
+ if (need_temp)
+ {
+ temp = get_temp( emit );
+
+ if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp, src0 ))
+ return FALSE;
+
+ src0 = src( temp );
+ }
+
+ if (!emit_op2( emit, inst, dest, src0, src1 ))
+ return FALSE;
+
+ if (need_temp)
+ release_temp( emit, temp );
+
+ return TRUE;
+}
+
+
+/* SVGA shaders may not refer to >1 constant register in a single
+ * instruction. This function checks for that usage and inserts a
+ * move to temporary if detected.
+ */
+static boolean submit_op3( struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken inst,
+ SVGA3dShaderDestToken dest,
+ struct src_register src0,
+ struct src_register src1,
+ struct src_register src2 )
+{
+ SVGA3dShaderDestToken temp0;
+ SVGA3dShaderDestToken temp1;
+ boolean need_temp0 = FALSE;
+ boolean need_temp1 = FALSE;
+ SVGA3dShaderRegType type0, type1, type2;
+
+ temp0.value = 0;
+ temp1.value = 0;
+ type0 = SVGA3dShaderGetRegType( src0.base.value );
+ type1 = SVGA3dShaderGetRegType( src1.base.value );
+ type2 = SVGA3dShaderGetRegType( src2.base.value );
+
+ if (inst.op != SVGA3DOP_SINCOS) {
+ if (type0 == SVGA3DREG_CONST &&
+ ((type1 == SVGA3DREG_CONST && src0.base.num != src1.base.num) ||
+ (type2 == SVGA3DREG_CONST && src0.base.num != src2.base.num)))
+ need_temp0 = TRUE;
+
+ if (type1 == SVGA3DREG_CONST &&
+ (type2 == SVGA3DREG_CONST && src1.base.num != src2.base.num))
+ need_temp1 = TRUE;
+ }
+
+ if (type0 == SVGA3DREG_INPUT &&
+ ((type1 == SVGA3DREG_INPUT && src0.base.num != src1.base.num) ||
+ (type2 == SVGA3DREG_INPUT && src0.base.num != src2.base.num)))
+ need_temp0 = TRUE;
+
+ if (type1 == SVGA3DREG_INPUT &&
+ (type2 == SVGA3DREG_INPUT && src1.base.num != src2.base.num))
+ need_temp1 = TRUE;
+
+ if (need_temp0)
+ {
+ temp0 = get_temp( emit );
+
+ if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp0, src0 ))
+ return FALSE;
+
+ src0 = src( temp0 );
+ }
+
+ if (need_temp1)
+ {
+ temp1 = get_temp( emit );
+
+ if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp1, src1 ))
+ return FALSE;
+
+ src1 = src( temp1 );
+ }
+
+ if (!emit_op3( emit, inst, dest, src0, src1, src2 ))
+ return FALSE;
+
+ if (need_temp1)
+ release_temp( emit, temp1 );
+ if (need_temp0)
+ release_temp( emit, temp0 );
+ return TRUE;
+}
+
+
+static boolean emit_def_const( struct svga_shader_emitter *emit,
+ SVGA3dShaderConstType type,
+ unsigned idx,
+ float a,
+ float b,
+ float c,
+ float d )
+{
+ SVGA3DOpDefArgs def;
+ SVGA3dShaderInstToken opcode;
+
+ switch (type) {
+ case SVGA3D_CONST_TYPE_FLOAT:
+ opcode = inst_token( SVGA3DOP_DEF );
+ def.dst = dst_register( SVGA3DREG_CONST, idx );
+ def.constValues[0] = a;
+ def.constValues[1] = b;
+ def.constValues[2] = c;
+ def.constValues[3] = d;
+ break;
+ case SVGA3D_CONST_TYPE_INT:
+ opcode = inst_token( SVGA3DOP_DEFI );
+ def.dst = dst_register( SVGA3DREG_CONSTINT, idx );
+ def.constIValues[0] = (int)a;
+ def.constIValues[1] = (int)b;
+ def.constIValues[2] = (int)c;
+ def.constIValues[3] = (int)d;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ if (!emit_instruction(emit, opcode) ||
+ !svga_shader_emit_dwords( emit, def.values, Elements(def.values)))
+ return FALSE;
+
+ return TRUE;
+}
+
+static INLINE boolean
+create_zero_immediate( struct svga_shader_emitter *emit )
+{
+ unsigned idx = emit->nr_hw_const++;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
+ idx, 0, 0, 0, 1 ))
+ return FALSE;
+
+ emit->zero_immediate_idx = idx;
+ emit->created_zero_immediate = TRUE;
+
+ return TRUE;
+}
+
+static INLINE boolean
+create_loop_const( struct svga_shader_emitter *emit )
+{
+ unsigned idx = emit->nr_hw_const++;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_INT, idx,
+ 255, /* iteration count */
+ 0, /* initial value */
+ 1, /* step size */
+ 0 /* not used, must be 0 */))
+ return FALSE;
+
+ emit->loop_const_idx = idx;
+ emit->created_loop_const = TRUE;
+
+ return TRUE;
+}
+
+static INLINE boolean
+create_sincos_consts( struct svga_shader_emitter *emit )
+{
+ unsigned idx = emit->nr_hw_const++;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
+ -1.5500992e-006f,
+ -2.1701389e-005f,
+ 0.0026041667f,
+ 0.00026041668f ))
+ return FALSE;
+
+ emit->sincos_consts_idx = idx;
+ idx = emit->nr_hw_const++;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
+ -0.020833334f,
+ -0.12500000f,
+ 1.0f,
+ 0.50000000f ))
+ return FALSE;
+
+ emit->created_sincos_consts = TRUE;
+
+ return TRUE;
+}
+
+static INLINE boolean
+create_arl_consts( struct svga_shader_emitter *emit )
+{
+ int i;
+
+ for (i = 0; i < emit->num_arl_consts; i += 4) {
+ int j;
+ unsigned idx = emit->nr_hw_const++;
+ float vals[4];
+ for (j = 0; j < 4 && (j + i) < emit->num_arl_consts; ++j) {
+ vals[j] = emit->arl_consts[i + j].number;
+ emit->arl_consts[i + j].idx = idx;
+ switch (j) {
+ case 0:
+ emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_X;
+ break;
+ case 1:
+ emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_Y;
+ break;
+ case 2:
+ emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_Z;
+ break;
+ case 3:
+ emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_W;
+ break;
+ }
+ }
+ while (j < 4)
+ vals[j++] = 0;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
+ vals[0], vals[1],
+ vals[2], vals[3]))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static INLINE struct src_register
+get_vface( struct svga_shader_emitter *emit )
+{
+ assert(emit->emitted_vface);
+ return src_register(SVGA3DREG_MISCTYPE,
+ SVGA3DMISCREG_FACE);
+}
+
+/* returns {0, 0, 0, 1} immediate */
+static INLINE struct src_register
+get_zero_immediate( struct svga_shader_emitter *emit )
+{
+ assert(emit->created_zero_immediate);
+ assert(emit->zero_immediate_idx >= 0);
+ return src_register( SVGA3DREG_CONST,
+ emit->zero_immediate_idx );
+}
+
+/* returns the loop const */
+static INLINE struct src_register
+get_loop_const( struct svga_shader_emitter *emit )
+{
+ assert(emit->created_loop_const);
+ assert(emit->loop_const_idx >= 0);
+ return src_register( SVGA3DREG_CONSTINT,
+ emit->loop_const_idx );
+}
+
+/* returns a sincos const */
+static INLINE struct src_register
+get_sincos_const( struct svga_shader_emitter *emit,
+ unsigned index )
+{
+ assert(emit->created_sincos_consts);
+ assert(emit->sincos_consts_idx >= 0);
+ assert(index == 0 || index == 1);
+ return src_register( SVGA3DREG_CONST,
+ emit->sincos_consts_idx + index );
+}
+
+static INLINE struct src_register
+get_fake_arl_const( struct svga_shader_emitter *emit )
+{
+ struct src_register reg;
+ int idx = 0, swizzle = 0, i;
+
+ for (i = 0; i < emit->num_arl_consts; ++ i) {
+ if (emit->arl_consts[i].arl_num == emit->current_arl) {
+ idx = emit->arl_consts[i].idx;
+ swizzle = emit->arl_consts[i].swizzle;
+ }
+ }
+
+ reg = src_register( SVGA3DREG_CONST, idx );
+ return scalar(reg, swizzle);
+}
+
+static INLINE struct src_register
+get_tex_dimensions( struct svga_shader_emitter *emit, int sampler_num )
+{
+ int idx;
+ struct src_register reg;
+
+ /* the width/height indexes start right after constants */
+ idx = emit->key.fkey.tex[sampler_num].width_height_idx +
+ emit->info.file_max[TGSI_FILE_CONSTANT] + 1;
+
+ reg = src_register( SVGA3DREG_CONST, idx );
+ return reg;
+}
+
+static boolean emit_fake_arl(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 = get_fake_arl_const( emit );
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ SVGA3dShaderDestToken tmp = get_temp( emit );
+
+ if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), tmp, src0))
+ return FALSE;
+
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), tmp, src( tmp ),
+ src1))
+ return FALSE;
+
+ /* replicate the original swizzle */
+ src1 = src(tmp);
+ src1.base.swizzle = src0.base.swizzle;
+
+ return submit_op1( emit, inst_token( SVGA3DOP_MOVA ),
+ dst, src1 );
+}
+
+static boolean emit_if(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ const struct src_register src = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register zero = get_zero_immediate( emit );
+ SVGA3dShaderInstToken if_token = inst_token( SVGA3DOP_IFC );
+
+ if_token.control = SVGA3DOPCOMPC_NE;
+ zero = scalar(zero, TGSI_SWIZZLE_X);
+
+ return (emit_instruction( emit, if_token ) &&
+ emit_src( emit, src ) &&
+ emit_src( emit, zero ) );
+}
+
+static boolean emit_endif(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ return (emit_instruction( emit,
+ inst_token( SVGA3DOP_ENDIF )));
+}
+
+static boolean emit_else(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ return (emit_instruction( emit,
+ inst_token( SVGA3DOP_ELSE )));
+}
+
+/* Translate the following TGSI FLR instruction.
+ * FLR DST, SRC
+ * To the following SVGA3D instruction sequence.
+ * FRC TMP, SRC
+ * SUB DST, SRC, TMP
+ */
+static boolean emit_floor(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* FRC TMP, SRC */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ), temp, src0 ))
+ return FALSE;
+
+ /* SUB DST, SRC, TMP */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, src0,
+ negate( src( temp ) ) ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Translate the following TGSI CMP instruction.
+ * CMP DST, SRC0, SRC1, SRC2
+ * To the following SVGA3D instruction sequence.
+ * CMP DST, SRC0, SRC2, SRC1
+ */
+static boolean emit_cmp(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ const struct src_register src2 = translate_src_register(
+ emit, &insn->FullSrcRegisters[2] );
+
+ /* CMP DST, SRC0, SRC2, SRC1 */
+ return submit_op3( emit, inst_token( SVGA3DOP_CMP ), dst, src0, src2, src1);
+}
+
+
+
+/* Translate the following TGSI DIV instruction.
+ * DIV DST.xy, SRC0, SRC1
+ * To the following SVGA3D instruction sequence.
+ * RCP TMP.x, SRC1.xxxx
+ * RCP TMP.y, SRC1.yyyy
+ * MUL DST.xy, SRC0, TMP
+ */
+static boolean emit_div(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+ int i;
+
+ /* For each enabled element, perform a RCP instruction. Note that
+ * RCP is scalar in SVGA3D:
+ */
+ for (i = 0; i < 4; i++) {
+ unsigned channel = 1 << i;
+ if (dst.mask & channel) {
+ /* RCP TMP.?, SRC1.???? */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ),
+ writemask(temp, channel),
+ scalar(src1, i) ))
+ return FALSE;
+ }
+ }
+
+ /* Then multiply them out with a single mul:
+ *
+ * MUL DST, SRC0, TMP
+ */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), dst, src0,
+ src( temp ) ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Translate the following TGSI DP2 instruction.
+ * DP2 DST, SRC1, SRC2
+ * To the following SVGA3D instruction sequence.
+ * MUL TMP, SRC1, SRC2
+ * ADD DST, TMP.xxxx, TMP.yyyy
+ */
+static boolean emit_dp2(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+ struct src_register temp_src0, temp_src1;
+
+ /* MUL TMP, SRC1, SRC2 */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), temp, src0, src1 ))
+ return FALSE;
+
+ temp_src0 = scalar(src( temp ), TGSI_SWIZZLE_X);
+ temp_src1 = scalar(src( temp ), TGSI_SWIZZLE_Y);
+
+ /* ADD DST, TMP.xxxx, TMP.yyyy */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst,
+ temp_src0, temp_src1 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Translate the following TGSI DPH instruction.
+ * DPH DST, SRC1, SRC2
+ * To the following SVGA3D instruction sequence.
+ * DP3 TMP, SRC1, SRC2
+ * ADD DST, TMP, SRC2.wwww
+ */
+static boolean emit_dph(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* DP3 TMP, SRC1, SRC2 */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_DP3 ), temp, src0, src1 ))
+ return FALSE;
+
+ src1 = scalar(src1, TGSI_SWIZZLE_W);
+
+ /* ADD DST, TMP, SRC2.wwww */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst,
+ src( temp ), src1 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Translate the following TGSI DST instruction.
+ * NRM DST, SRC
+ * To the following SVGA3D instruction sequence.
+ * DP3 TMP, SRC, SRC
+ * RSQ TMP, TMP
+ * MUL DST, SRC, TMP
+ */
+static boolean emit_nrm(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* DP3 TMP, SRC, SRC */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_DP3 ), temp, src0, src0 ))
+ return FALSE;
+
+ /* RSQ TMP, TMP */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_RSQ ), temp, src( temp )))
+ return FALSE;
+
+ /* MUL DST, SRC, TMP */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), dst,
+ src0, src( temp )))
+ return FALSE;
+
+ return TRUE;
+
+}
+
+static boolean do_emit_sincos(struct svga_shader_emitter *emit,
+ SVGA3dShaderDestToken dst,
+ struct src_register src0)
+{
+ src0 = scalar(src0, TGSI_SWIZZLE_X);
+
+ if (emit->use_sm30) {
+ return submit_op1( emit, inst_token( SVGA3DOP_SINCOS ),
+ dst, src0 );
+ } else {
+ struct src_register const1 = get_sincos_const( emit, 0 );
+ struct src_register const2 = get_sincos_const( emit, 1 );
+
+ return submit_op3( emit, inst_token( SVGA3DOP_SINCOS ),
+ dst, src0, const1, const2 );
+ }
+}
+
+static boolean emit_sincos(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* SCS TMP SRC */
+ if (!do_emit_sincos(emit, writemask(temp, TGSI_WRITEMASK_XY), src0 ))
+ return FALSE;
+
+ /* MOV DST TMP */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src( temp ) ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * SCS TMP SRC
+ * MOV DST TMP.yyyy
+ */
+static boolean emit_sin(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* SCS TMP SRC */
+ if (!do_emit_sincos(emit, writemask(temp, TGSI_WRITEMASK_Y), src0))
+ return FALSE;
+
+ src0 = scalar(src( temp ), TGSI_SWIZZLE_Y);
+
+ /* MOV DST TMP.yyyy */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src0 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * SCS TMP SRC
+ * MOV DST TMP.xxxx
+ */
+static boolean emit_cos(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ /* SCS TMP SRC */
+ if (!do_emit_sincos( emit, writemask(temp, TGSI_WRITEMASK_X), src0 ))
+ return FALSE;
+
+ src0 = scalar(src( temp ), TGSI_SWIZZLE_X);
+
+ /* MOV DST TMP.xxxx */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src0 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*
+ * ADD DST SRC0, negate(SRC0)
+ */
+static boolean emit_sub(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+
+ src1 = negate(src1);
+
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst,
+ src0, src1 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+static boolean emit_kil(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst;
+ const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0];
+ struct src_register src0;
+
+ inst = inst_token( SVGA3DOP_TEXKILL );
+ src0 = translate_src_register( emit, reg );
+
+ if (reg->SrcRegisterExtMod.Absolute ||
+ reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate ||
+ reg->SrcRegister.Indirect ||
+ reg->SrcRegister.SwizzleX != 0 ||
+ reg->SrcRegister.SwizzleY != 1 ||
+ reg->SrcRegister.SwizzleZ != 2 ||
+ reg->SrcRegister.File != TGSI_FILE_TEMPORARY)
+ {
+ SVGA3dShaderDestToken temp = get_temp( emit );
+
+ submit_op1( emit, inst_token( SVGA3DOP_MOV ), temp, src0 );
+ src0 = src( temp );
+ }
+
+ return submit_op0( emit, inst, dst(src0) );
+}
+
+
+/* mesa state tracker always emits kilp as an unconditional
+ * kil */
+static boolean emit_kilp(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst;
+ SVGA3dShaderDestToken temp;
+ struct src_register one = get_zero_immediate( emit );
+
+ inst = inst_token( SVGA3DOP_TEXKILL );
+ one = scalar( one, TGSI_SWIZZLE_W );
+
+ /* texkill doesn't allow negation on the operand so lets move
+ * negation of {1} to a temp register */
+ temp = get_temp( emit );
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), temp,
+ negate( one ) ))
+ return FALSE;
+
+ return submit_op0( emit, inst, temp );
+}
+
+/* Implement conditionals by initializing destination reg to 'fail',
+ * then set predicate reg with UFOP_SETP, then move 'pass' to dest
+ * based on predicate reg.
+ *
+ * SETP src0, cmp, src1 -- do this first to avoid aliasing problems.
+ * MOV dst, fail
+ * MOV dst, pass, p0
+ */
+static boolean
+emit_conditional(struct svga_shader_emitter *emit,
+ unsigned compare_func,
+ SVGA3dShaderDestToken dst,
+ struct src_register src0,
+ struct src_register src1,
+ struct src_register pass,
+ struct src_register fail)
+{
+ SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 );
+ SVGA3dShaderInstToken setp_token, mov_token;
+ setp_token = inst_token( SVGA3DOP_SETP );
+
+ switch (compare_func) {
+ case PIPE_FUNC_NEVER:
+ return submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ dst, fail );
+ break;
+ case PIPE_FUNC_LESS:
+ setp_token.control = SVGA3DOPCOMP_LT;
+ break;
+ case PIPE_FUNC_EQUAL:
+ setp_token.control = SVGA3DOPCOMP_EQ;
+ break;
+ case PIPE_FUNC_LEQUAL:
+ setp_token.control = SVGA3DOPCOMP_LE;
+ break;
+ case PIPE_FUNC_GREATER:
+ setp_token.control = SVGA3DOPCOMP_GT;
+ break;
+ case PIPE_FUNC_NOTEQUAL:
+ setp_token.control = SVGA3DOPCOMPC_NE;
+ break;
+ case PIPE_FUNC_GEQUAL:
+ setp_token.control = SVGA3DOPCOMP_GE;
+ break;
+ case PIPE_FUNC_ALWAYS:
+ return submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ dst, pass );
+ break;
+ }
+
+ /* SETP src0, COMPOP, src1 */
+ if (!submit_op2( emit, setp_token, pred_reg,
+ src0, src1 ))
+ return FALSE;
+
+ mov_token = inst_token( SVGA3DOP_MOV );
+
+ /* MOV dst, fail */
+ if (!submit_op1( emit, mov_token, dst,
+ fail ))
+ return FALSE;
+
+ /* MOV dst, pass (predicated)
+ *
+ * Note that the predicate reg (and possible modifiers) is passed
+ * as the first source argument.
+ */
+ mov_token.predicated = 1;
+ if (!submit_op2( emit, mov_token, dst,
+ src( pred_reg ), pass ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+static boolean
+emit_select(struct svga_shader_emitter *emit,
+ unsigned compare_func,
+ SVGA3dShaderDestToken dst,
+ struct src_register src0,
+ struct src_register src1 )
+{
+ /* There are some SVGA instructions which implement some selects
+ * directly, but they are only available in the vertex shader.
+ */
+ if (emit->unit == PIPE_SHADER_VERTEX) {
+ switch (compare_func) {
+ case PIPE_FUNC_GEQUAL:
+ return submit_op2( emit, inst_token( SVGA3DOP_SGE ), dst, src0, src1 );
+ case PIPE_FUNC_LEQUAL:
+ return submit_op2( emit, inst_token( SVGA3DOP_SGE ), dst, src1, src0 );
+ case PIPE_FUNC_GREATER:
+ return submit_op2( emit, inst_token( SVGA3DOP_SLT ), dst, src1, src0 );
+ case PIPE_FUNC_LESS:
+ return submit_op2( emit, inst_token( SVGA3DOP_SLT ), dst, src0, src1 );
+ default:
+ break;
+ }
+ }
+
+
+ /* Otherwise, need to use the setp approach:
+ */
+ {
+ struct src_register one, zero;
+ /* zero immediate is 0,0,0,1 */
+ zero = get_zero_immediate( emit );
+ one = scalar( zero, TGSI_SWIZZLE_W );
+ zero = scalar( zero, TGSI_SWIZZLE_X );
+
+ return emit_conditional(
+ emit,
+ compare_func,
+ dst,
+ src0,
+ src1,
+ one, zero);
+ }
+}
+
+
+static boolean emit_select_op(struct svga_shader_emitter *emit,
+ unsigned compare,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+
+ return emit_select( emit, compare, dst, src0, src1 );
+}
+
+
+/* Translate texture instructions to SVGA3D representation.
+ */
+static boolean emit_tex2(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn,
+ SVGA3dShaderDestToken dst )
+{
+ SVGA3dShaderInstToken inst;
+ struct src_register src0;
+ struct src_register src1;
+
+ inst.value = 0;
+ inst.op = SVGA3DOP_TEX;
+
+ switch (insn->Instruction.Opcode) {
+ case TGSI_OPCODE_TEX:
+ break;
+ case TGSI_OPCODE_TXP:
+ inst.control = SVGA3DOPCONT_PROJECT;
+ break;
+ case TGSI_OPCODE_TXB:
+ inst.control = SVGA3DOPCONT_BIAS;
+ break;
+ default:
+ assert(0);
+ return FALSE;
+ }
+
+ src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] );
+
+ if (emit->key.fkey.tex[src1.base.num].unnormalized) {
+ struct src_register wh = get_tex_dimensions( emit, src1.base.num );
+ SVGA3dShaderDestToken tmp = get_temp( emit );
+
+ /* MUL tmp, SRC0, WH */
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
+ tmp, src0, wh ))
+ return FALSE;
+ src0 = src( tmp );
+ }
+
+ return submit_op2( emit, inst, dst, src0, src1 );
+}
+
+
+
+
+/* Translate texture instructions to SVGA3D representation.
+ */
+static boolean emit_tex3(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn,
+ SVGA3dShaderDestToken dst )
+{
+ SVGA3dShaderInstToken inst;
+ struct src_register src0;
+ struct src_register src1;
+ struct src_register src2;
+
+ inst.value = 0;
+
+ switch (insn->Instruction.Opcode) {
+ case TGSI_OPCODE_TXD:
+ inst.op = SVGA3DOP_TEXLDD;
+ break;
+ case TGSI_OPCODE_TXL:
+ inst.op = SVGA3DOP_TEXLDL;
+ break;
+ }
+
+ src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] );
+ src2 = translate_src_register( emit, &insn->FullSrcRegisters[2] );
+
+ return submit_op3( emit, inst, dst, src0, src1, src2 );
+}
+
+
+static boolean emit_tex(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderDestToken dst =
+ translate_dst_register( emit, insn, 0 );
+ struct src_register src0 =
+ translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 =
+ translate_src_register( emit, &insn->FullSrcRegisters[1] );
+
+ SVGA3dShaderDestToken tex_result;
+
+ /* check for shadow samplers */
+ boolean compare = (emit->key.fkey.tex[src1.base.num].compare_mode ==
+ PIPE_TEX_COMPARE_R_TO_TEXTURE);
+
+
+ /* If doing compare processing, need to put this value into a
+ * temporary so it can be used as a source later on.
+ */
+ if (compare ||
+ (!emit->use_sm30 && dst.mask != TGSI_WRITEMASK_XYZW) ) {
+ tex_result = get_temp( emit );
+ }
+ else {
+ tex_result = dst;
+ }
+
+ switch(insn->Instruction.Opcode) {
+ case TGSI_OPCODE_TEX:
+ case TGSI_OPCODE_TXB:
+ case TGSI_OPCODE_TXP:
+ if (!emit_tex2( emit, insn, tex_result ))
+ return FALSE;
+ break;
+ case TGSI_OPCODE_TXL:
+ case TGSI_OPCODE_TXD:
+ if (!emit_tex3( emit, insn, tex_result ))
+ return FALSE;
+ break;
+ default:
+ assert(0);
+ }
+
+
+ if (compare) {
+ SVGA3dShaderDestToken src0_zdivw = get_temp( emit );
+ struct src_register tex_src_x = scalar(src(tex_result), TGSI_SWIZZLE_Y);
+ struct src_register one =
+ scalar( get_zero_immediate( emit ), TGSI_SWIZZLE_W );
+
+ /* Divide texcoord R by Q */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ),
+ src0_zdivw,
+ scalar(src0, TGSI_SWIZZLE_W) ))
+ return FALSE;
+
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
+ src0_zdivw,
+ scalar(src0, TGSI_SWIZZLE_Z),
+ src(src0_zdivw) ))
+ return FALSE;
+
+ if (!emit_select(
+ emit,
+ emit->key.fkey.tex[src1.base.num].compare_func,
+ dst,
+ src(src0_zdivw),
+ tex_src_x))
+ return FALSE;
+
+ return submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask( dst, TGSI_WRITEMASK_W),
+ one );
+ }
+ else if (!emit->use_sm30 && dst.mask != TGSI_WRITEMASK_XYZW)
+ {
+ if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src(tex_result) ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static boolean emit_bgnloop2( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_LOOP );
+ struct src_register loop_reg = src_register( SVGA3DREG_LOOP, 0 );
+ struct src_register const_int = get_loop_const( emit );
+
+ return (emit_instruction( emit, inst ) &&
+ emit_src( emit, loop_reg ) &&
+ emit_src( emit, const_int ) );
+}
+
+static boolean emit_endloop2( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_ENDLOOP );
+ return emit_instruction( emit, inst );
+}
+
+static boolean emit_brk( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_BREAK );
+ return emit_instruction( emit, inst );
+}
+
+static boolean emit_scalar_op1( struct svga_shader_emitter *emit,
+ unsigned opcode,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst;
+ SVGA3dShaderDestToken dst;
+ struct src_register src;
+
+ inst = inst_token( opcode );
+ dst = translate_dst_register( emit, insn, 0 );
+ src = translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ src = scalar( src, TGSI_SWIZZLE_X );
+
+ return submit_op1( emit, inst, dst, src );
+}
+
+
+static boolean emit_simple_instruction(struct svga_shader_emitter *emit,
+ unsigned opcode,
+ const struct tgsi_full_instruction *insn )
+{
+ const struct tgsi_full_src_register *src = insn->FullSrcRegisters;
+ SVGA3dShaderInstToken inst;
+ SVGA3dShaderDestToken dst;
+
+ inst = inst_token( opcode );
+ dst = translate_dst_register( emit, insn, 0 );
+
+ switch (insn->Instruction.NumSrcRegs) {
+ case 0:
+ return submit_op0( emit, inst, dst );
+ case 1:
+ return submit_op1( emit, inst, dst,
+ translate_src_register( emit, &src[0] ));
+ case 2:
+ return submit_op2( emit, inst, dst,
+ translate_src_register( emit, &src[0] ),
+ translate_src_register( emit, &src[1] ) );
+ case 3:
+ return submit_op3( emit, inst, dst,
+ translate_src_register( emit, &src[0] ),
+ translate_src_register( emit, &src[1] ),
+ translate_src_register( emit, &src[2] ) );
+ default:
+ assert(0);
+ return FALSE;
+ }
+}
+
+static boolean emit_arl(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ ++emit->current_arl;
+ if (svga_arl_needs_adjustment( emit )) {
+ return emit_fake_arl( emit, insn );
+ } else {
+ /* no need to adjust, just emit straight arl */
+ return emit_simple_instruction(emit, SVGA3DOP_MOVA, insn);
+ }
+}
+
+static boolean alias_src_dst( struct src_register src,
+ SVGA3dShaderDestToken dst )
+{
+ if (src.base.num != dst.num)
+ return FALSE;
+
+ if (SVGA3dShaderGetRegType(dst.value) !=
+ SVGA3dShaderGetRegType(src.base.value))
+ return FALSE;
+
+ return TRUE;
+}
+
+static boolean emit_pow(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ boolean need_tmp = FALSE;
+
+ /* POW can only output to a temporary */
+ if (insn->FullDstRegisters[0].DstRegister.File != TGSI_FILE_TEMPORARY)
+ need_tmp = TRUE;
+
+ /* POW src1 must not be the same register as dst */
+ if (alias_src_dst( src1, dst ))
+ need_tmp = TRUE;
+
+ /* it's a scalar op */
+ src0 = scalar( src0, TGSI_SWIZZLE_X );
+ src1 = scalar( src1, TGSI_SWIZZLE_X );
+
+ if (need_tmp) {
+ SVGA3dShaderDestToken tmp = writemask(get_temp( emit ), TGSI_WRITEMASK_X );
+
+ if (!submit_op2(emit, inst_token( SVGA3DOP_POW ), tmp, src0, src1))
+ return FALSE;
+
+ return submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, scalar(src(tmp), 0) );
+ }
+ else {
+ return submit_op2(emit, inst_token( SVGA3DOP_POW ), dst, src0, src1);
+ }
+}
+
+static boolean emit_xpd(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ boolean need_dst_tmp = FALSE;
+
+ /* XPD can only output to a temporary */
+ if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP)
+ need_dst_tmp = TRUE;
+
+ /* The dst reg must not be the same as src0 or src1*/
+ if (alias_src_dst(src0, dst) ||
+ alias_src_dst(src1, dst))
+ need_dst_tmp = TRUE;
+
+ if (need_dst_tmp) {
+ SVGA3dShaderDestToken tmp = get_temp( emit );
+
+ /* Obey DX9 restrictions on mask:
+ */
+ tmp.mask = dst.mask & TGSI_WRITEMASK_XYZ;
+
+ if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), tmp, src0, src1))
+ return FALSE;
+
+ if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
+ return FALSE;
+ }
+ else {
+ if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), dst, src0, src1))
+ return FALSE;
+ }
+
+ /* Need to emit 1.0 to dst.w?
+ */
+ if (dst.mask & TGSI_WRITEMASK_W) {
+ struct src_register zero = get_zero_immediate( emit );
+
+ if (!submit_op1(emit,
+ inst_token( SVGA3DOP_MOV ),
+ writemask(dst, TGSI_WRITEMASK_W),
+ zero))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static boolean emit_lrp(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ SVGA3dShaderDestToken tmp;
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ const struct src_register src2 = translate_src_register(
+ emit, &insn->FullSrcRegisters[2] );
+ boolean need_dst_tmp = FALSE;
+
+ /* The dst reg must not be the same as src0 or src2 */
+ if (alias_src_dst(src0, dst) ||
+ alias_src_dst(src2, dst))
+ need_dst_tmp = TRUE;
+
+ if (need_dst_tmp) {
+ tmp = get_temp( emit );
+ tmp.mask = dst.mask;
+ }
+ else {
+ tmp = dst;
+ }
+
+ if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
+ return FALSE;
+
+ if (need_dst_tmp) {
+ if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static boolean emit_dst_insn(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ if (emit->unit == PIPE_SHADER_VERTEX) {
+ /* SVGA/DX9 has a DST instruction, but only for vertex shaders:
+ */
+ return emit_simple_instruction(emit, SVGA3DOP_DST, insn);
+ }
+ else {
+
+ /* result[0] = 1 * 1;
+ * result[1] = a[1] * b[1];
+ * result[2] = a[2] * 1;
+ * result[3] = 1 * b[3];
+ */
+
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ SVGA3dShaderDestToken tmp;
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ const struct src_register src1 = translate_src_register(
+ emit, &insn->FullSrcRegisters[1] );
+ struct src_register zero = get_zero_immediate( emit );
+ boolean need_tmp = FALSE;
+
+ if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
+ alias_src_dst(src0, dst) ||
+ alias_src_dst(src1, dst))
+ need_tmp = TRUE;
+
+ if (need_tmp) {
+ tmp = get_temp( emit );
+ }
+ else {
+ tmp = dst;
+ }
+
+ /* tmp.xw = 1.0
+ */
+ if (tmp.mask & TGSI_WRITEMASK_XW) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask(tmp, TGSI_WRITEMASK_XW ),
+ scalar( zero, 3 )))
+ return FALSE;
+ }
+
+ /* tmp.yz = src0
+ */
+ if (tmp.mask & TGSI_WRITEMASK_YZ) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask(tmp, TGSI_WRITEMASK_YZ ),
+ src0))
+ return FALSE;
+ }
+
+ /* tmp.yw = tmp * src1
+ */
+ if (tmp.mask & TGSI_WRITEMASK_YW) {
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
+ writemask(tmp, TGSI_WRITEMASK_YW ),
+ src(tmp),
+ src1))
+ return FALSE;
+ }
+
+ /* dst = tmp
+ */
+ if (need_tmp) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ dst,
+ src(tmp)))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+static boolean emit_exp(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 =
+ translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ struct src_register zero = get_zero_immediate( emit );
+ SVGA3dShaderDestToken fraction;
+
+ if (dst.mask & TGSI_WRITEMASK_Y)
+ fraction = dst;
+ else if (dst.mask & TGSI_WRITEMASK_X)
+ fraction = get_temp( emit );
+
+ /* If y is being written, fill it with src0 - floor(src0).
+ */
+ if (dst.mask & TGSI_WRITEMASK_XY) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ),
+ writemask( fraction, TGSI_WRITEMASK_Y ),
+ src0 ))
+ return FALSE;
+ }
+
+ /* If x is being written, fill it with 2 ^ floor(src0).
+ */
+ if (dst.mask & TGSI_WRITEMASK_X) {
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ),
+ writemask( dst, dst.mask & TGSI_WRITEMASK_X ),
+ src0,
+ scalar( negate( src( fraction ) ), TGSI_SWIZZLE_Y ) ) )
+ return FALSE;
+
+ if (!submit_op1( emit, inst_token( SVGA3DOP_EXP ),
+ writemask( dst, dst.mask & TGSI_WRITEMASK_X ),
+ scalar( src( dst ), TGSI_SWIZZLE_X ) ) )
+ return FALSE;
+
+ if (!(dst.mask & TGSI_WRITEMASK_Y))
+ release_temp( emit, fraction );
+ }
+
+ /* If z is being written, fill it with 2 ^ src0 (partial precision).
+ */
+ if (dst.mask & TGSI_WRITEMASK_Z) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_EXPP ),
+ writemask( dst, dst.mask & TGSI_WRITEMASK_Z ),
+ src0 ) )
+ return FALSE;
+ }
+
+ /* If w is being written, fill it with one.
+ */
+ if (dst.mask & TGSI_WRITEMASK_W) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask(dst, TGSI_WRITEMASK_W),
+ scalar( zero, TGSI_SWIZZLE_W ) ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static boolean emit_lit(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ if (emit->unit == PIPE_SHADER_VERTEX) {
+ /* SVGA/DX9 has a LIT instruction, but only for vertex shaders:
+ */
+ return emit_simple_instruction(emit, SVGA3DOP_LIT, insn);
+ }
+ else {
+
+ /* D3D vs. GL semantics can be fairly easily accomodated by
+ * variations on this sequence.
+ *
+ * GL:
+ * tmp.y = src.x
+ * tmp.z = pow(src.y,src.w)
+ * p0 = src0.xxxx > 0
+ * result = zero.wxxw
+ * (p0) result.yz = tmp
+ *
+ * D3D:
+ * tmp.y = src.x
+ * tmp.z = pow(src.y,src.w)
+ * p0 = src0.xxyy > 0
+ * result = zero.wxxw
+ * (p0) result.yz = tmp
+ *
+ * Will implement the GL version for now.
+ */
+
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ SVGA3dShaderDestToken tmp = get_temp( emit );
+ const struct src_register src0 = translate_src_register(
+ emit, &insn->FullSrcRegisters[0] );
+ struct src_register zero = get_zero_immediate( emit );
+
+ /* tmp = pow(src.y, src.w)
+ */
+ if (dst.mask & TGSI_WRITEMASK_Z) {
+ if (!submit_op2(emit, inst_token( SVGA3DOP_POW ),
+ tmp,
+ scalar(src0, 1),
+ scalar(src0, 3)))
+ return FALSE;
+ }
+
+ /* tmp.y = src.x
+ */
+ if (dst.mask & TGSI_WRITEMASK_Y) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask(tmp, TGSI_WRITEMASK_Y ),
+ scalar(src0, 0)))
+ return FALSE;
+ }
+
+ /* Can't quite do this with emit conditional due to the extra
+ * writemask on the predicated mov:
+ */
+ {
+ SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 );
+ SVGA3dShaderInstToken setp_token, mov_token;
+ struct src_register predsrc;
+
+ setp_token = inst_token( SVGA3DOP_SETP );
+ mov_token = inst_token( SVGA3DOP_MOV );
+
+ setp_token.control = SVGA3DOPCOMP_GT;
+
+ /* D3D vs GL semantics:
+ */
+ if (0)
+ predsrc = swizzle(src0, 0, 0, 1, 1); /* D3D */
+ else
+ predsrc = swizzle(src0, 0, 0, 0, 0); /* GL */
+
+ /* SETP src0.xxyy, GT, {0}.x */
+ if (!submit_op2( emit, setp_token, pred_reg,
+ predsrc,
+ swizzle(zero, 0, 0, 0, 0) ))
+ return FALSE;
+
+ /* MOV dst, fail */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst,
+ swizzle(zero, 3, 0, 0, 3 )))
+ return FALSE;
+
+ /* MOV dst.yz, tmp (predicated)
+ *
+ * Note that the predicate reg (and possible modifiers) is passed
+ * as the first source argument.
+ */
+ if (dst.mask & TGSI_WRITEMASK_YZ) {
+ mov_token.predicated = 1;
+ if (!submit_op2( emit, mov_token,
+ writemask(dst, TGSI_WRITEMASK_YZ),
+ src( pred_reg ), src( tmp ) ))
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+
+
+
+static boolean emit_ex2( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ SVGA3dShaderInstToken inst;
+ SVGA3dShaderDestToken dst;
+ struct src_register src0;
+
+ inst = inst_token( SVGA3DOP_EXP );
+ dst = translate_dst_register( emit, insn, 0 );
+ src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ src0 = scalar( src0, TGSI_SWIZZLE_X );
+
+ if (dst.mask != TGSI_WRITEMASK_XYZW) {
+ SVGA3dShaderDestToken tmp = get_temp( emit );
+
+ if (!submit_op1( emit, inst, tmp, src0 ))
+ return FALSE;
+
+ return submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ dst,
+ scalar( src( tmp ), TGSI_SWIZZLE_X ) );
+ }
+
+ return submit_op1( emit, inst, dst, src0 );
+}
+
+
+static boolean emit_log(struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn)
+{
+ SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 );
+ struct src_register src0 =
+ translate_src_register( emit, &insn->FullSrcRegisters[0] );
+ struct src_register zero = get_zero_immediate( emit );
+ SVGA3dShaderDestToken abs_tmp;
+ struct src_register abs_src0;
+ SVGA3dShaderDestToken log2_abs;
+
+ if (dst.mask & TGSI_WRITEMASK_Z)
+ log2_abs = dst;
+ else if (dst.mask & TGSI_WRITEMASK_XY)
+ log2_abs = get_temp( emit );
+
+ /* If z is being written, fill it with log2( abs( src0 ) ).
+ */
+ if (dst.mask & TGSI_WRITEMASK_XYZ) {
+ if (!src0.base.srcMod || src0.base.srcMod == SVGA3DSRCMOD_ABS)
+ abs_src0 = src0;
+ else {
+ abs_tmp = get_temp( emit );
+
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ abs_tmp,
+ src0 ) )
+ return FALSE;
+
+ abs_src0 = src( abs_tmp );
+ }
+
+ abs_src0 = absolute( scalar( abs_src0, TGSI_SWIZZLE_X ) );
+
+ if (!submit_op1( emit, inst_token( SVGA3DOP_LOG ),
+ writemask( log2_abs, TGSI_WRITEMASK_Z ),
+ abs_src0 ) )
+ return FALSE;
+ }
+
+ if (dst.mask & TGSI_WRITEMASK_XY) {
+ SVGA3dShaderDestToken floor_log2;
+
+ if (dst.mask & TGSI_WRITEMASK_X)
+ floor_log2 = dst;
+ else
+ floor_log2 = get_temp( emit );
+
+ /* If x is being written, fill it with floor( log2( abs( src0 ) ) ).
+ */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ),
+ writemask( floor_log2, TGSI_WRITEMASK_X ),
+ scalar( src( log2_abs ), TGSI_SWIZZLE_Z ) ) )
+ return FALSE;
+
+ if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ),
+ writemask( floor_log2, TGSI_WRITEMASK_X ),
+ scalar( src( log2_abs ), TGSI_SWIZZLE_Z ),
+ negate( src( floor_log2 ) ) ) )
+ return FALSE;
+
+ /* If y is being written, fill it with
+ * abs ( src0 ) / ( 2 ^ floor( log2( abs( src0 ) ) ) ).
+ */
+ if (dst.mask & TGSI_WRITEMASK_Y) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_EXP ),
+ writemask( dst, TGSI_WRITEMASK_Y ),
+ negate( scalar( src( floor_log2 ),
+ TGSI_SWIZZLE_X ) ) ) )
+ return FALSE;
+
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
+ writemask( dst, TGSI_WRITEMASK_Y ),
+ src( dst ),
+ abs_src0 ) )
+ return FALSE;
+ }
+
+ if (!(dst.mask & TGSI_WRITEMASK_X))
+ release_temp( emit, floor_log2 );
+
+ if (!(dst.mask & TGSI_WRITEMASK_Z))
+ release_temp( emit, log2_abs );
+ }
+
+ if (dst.mask & TGSI_WRITEMASK_XYZ && src0.base.srcMod &&
+ src0.base.srcMod != SVGA3DSRCMOD_ABS)
+ release_temp( emit, abs_tmp );
+
+ /* If w is being written, fill it with one.
+ */
+ if (dst.mask & TGSI_WRITEMASK_W) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ),
+ writemask(dst, TGSI_WRITEMASK_W),
+ scalar( zero, TGSI_SWIZZLE_W ) ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static boolean emit_bgnsub( struct svga_shader_emitter *emit,
+ unsigned position,
+ const struct tgsi_full_instruction *insn )
+{
+ unsigned i;
+
+ /* Note that we've finished the main function and are now emitting
+ * subroutines. This affects how we terminate the generated
+ * shader.
+ */
+ emit->in_main_func = FALSE;
+
+ for (i = 0; i < emit->nr_labels; i++) {
+ if (emit->label[i] == position) {
+ return (emit_instruction( emit, inst_token( SVGA3DOP_RET ) ) &&
+ emit_instruction( emit, inst_token( SVGA3DOP_LABEL ) ) &&
+ emit_src( emit, src_register( SVGA3DREG_LABEL, i )));
+ }
+ }
+
+ assert(0);
+ return TRUE;
+}
+
+static boolean emit_call( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn )
+{
+ unsigned position = insn->InstructionExtLabel.Label;
+ unsigned i;
+
+ for (i = 0; i < emit->nr_labels; i++) {
+ if (emit->label[i] == position)
+ break;
+ }
+
+ if (emit->nr_labels == Elements(emit->label))
+ return FALSE;
+
+ if (i == emit->nr_labels) {
+ emit->label[i] = position;
+ emit->nr_labels++;
+ }
+
+ return (emit_instruction( emit, inst_token( SVGA3DOP_CALL ) ) &&
+ emit_src( emit, src_register( SVGA3DREG_LABEL, i )));
+}
+
+
+static boolean emit_end( struct svga_shader_emitter *emit )
+{
+ if (emit->unit == PIPE_SHADER_VERTEX) {
+ return emit_vs_postamble( emit );
+ }
+ else {
+ return emit_ps_postamble( emit );
+ }
+}
+
+
+
+static boolean svga_emit_instruction( struct svga_shader_emitter *emit,
+ unsigned position,
+ const struct tgsi_full_instruction *insn )
+{
+ switch (insn->Instruction.Opcode) {
+
+ case TGSI_OPCODE_ARL:
+ return emit_arl( emit, insn );
+
+ case TGSI_OPCODE_TEX:
+ case TGSI_OPCODE_TXB:
+ case TGSI_OPCODE_TXP:
+ case TGSI_OPCODE_TXL:
+ case TGSI_OPCODE_TXD:
+ return emit_tex( emit, insn );
+
+ case TGSI_OPCODE_BGNSUB:
+ return emit_bgnsub( emit, position, insn );
+
+ case TGSI_OPCODE_ENDSUB:
+ return TRUE;
+
+ case TGSI_OPCODE_CAL:
+ return emit_call( emit, insn );
+
+ case TGSI_OPCODE_FLR:
+ case TGSI_OPCODE_TRUNC: /* should be TRUNC, not FLR */
+ return emit_floor( emit, insn );
+
+ case TGSI_OPCODE_CMP:
+ return emit_cmp( emit, insn );
+
+ case TGSI_OPCODE_DIV:
+ return emit_div( emit, insn );
+
+ case TGSI_OPCODE_DP2:
+ return emit_dp2( emit, insn );
+
+ case TGSI_OPCODE_DPH:
+ return emit_dph( emit, insn );
+
+ case TGSI_OPCODE_NRM:
+ return emit_nrm( emit, insn );
+
+ case TGSI_OPCODE_COS:
+ return emit_cos( emit, insn );
+
+ case TGSI_OPCODE_SIN:
+ return emit_sin( emit, insn );
+
+ case TGSI_OPCODE_SCS:
+ return emit_sincos( emit, insn );
+
+ case TGSI_OPCODE_END:
+ /* TGSI always finishes the main func with an END */
+ return emit_end( emit );
+
+ case TGSI_OPCODE_KIL:
+ return emit_kil( emit, insn );
+
+ /* Selection opcodes. The underlying language is fairly
+ * non-orthogonal about these.
+ */
+ case TGSI_OPCODE_SEQ:
+ return emit_select_op( emit, PIPE_FUNC_EQUAL, insn );
+
+ case TGSI_OPCODE_SNE:
+ return emit_select_op( emit, PIPE_FUNC_NOTEQUAL, insn );
+
+ case TGSI_OPCODE_SGT:
+ return emit_select_op( emit, PIPE_FUNC_GREATER, insn );
+
+ case TGSI_OPCODE_SGE:
+ return emit_select_op( emit, PIPE_FUNC_GEQUAL, insn );
+
+ case TGSI_OPCODE_SLT:
+ return emit_select_op( emit, PIPE_FUNC_LESS, insn );
+
+ case TGSI_OPCODE_SLE:
+ return emit_select_op( emit, PIPE_FUNC_LEQUAL, insn );
+
+ case TGSI_OPCODE_SUB:
+ return emit_sub( emit, insn );
+
+ case TGSI_OPCODE_POW:
+ return emit_pow( emit, insn );
+
+ case TGSI_OPCODE_EX2:
+ return emit_ex2( emit, insn );
+
+ case TGSI_OPCODE_EXP:
+ return emit_exp( emit, insn );
+
+ case TGSI_OPCODE_LOG:
+ return emit_log( emit, insn );
+
+ case TGSI_OPCODE_LG2:
+ return emit_scalar_op1( emit, SVGA3DOP_LOG, insn );
+
+ case TGSI_OPCODE_RSQ:
+ return emit_scalar_op1( emit, SVGA3DOP_RSQ, insn );
+
+ case TGSI_OPCODE_RCP:
+ return emit_scalar_op1( emit, SVGA3DOP_RCP, insn );
+
+ case TGSI_OPCODE_CONT:
+ case TGSI_OPCODE_RET:
+ /* This is a noop -- we tell mesa that we can't support RET
+ * within a function (early return), so this will always be
+ * followed by an ENDSUB.
+ */
+ return TRUE;
+
+ /* These aren't actually used by any of the frontends we care
+ * about:
+ */
+ case TGSI_OPCODE_CLAMP:
+ case TGSI_OPCODE_ROUND:
+ case TGSI_OPCODE_AND:
+ case TGSI_OPCODE_OR:
+ case TGSI_OPCODE_I2F:
+ case TGSI_OPCODE_NOT:
+ case TGSI_OPCODE_SHL:
+ case TGSI_OPCODE_SHR:
+ case TGSI_OPCODE_XOR:
+ return FALSE;
+
+ case TGSI_OPCODE_IF:
+ return emit_if( emit, insn );
+ case TGSI_OPCODE_ELSE:
+ return emit_else( emit, insn );
+ case TGSI_OPCODE_ENDIF:
+ return emit_endif( emit, insn );
+
+ case TGSI_OPCODE_BGNLOOP:
+ return emit_bgnloop2( emit, insn );
+ case TGSI_OPCODE_ENDLOOP:
+ return emit_endloop2( emit, insn );
+ case TGSI_OPCODE_BRK:
+ return emit_brk( emit, insn );
+
+ case TGSI_OPCODE_XPD:
+ return emit_xpd( emit, insn );
+
+ case TGSI_OPCODE_KILP:
+ return emit_kilp( emit, insn );
+
+ case TGSI_OPCODE_DST:
+ return emit_dst_insn( emit, insn );
+
+ case TGSI_OPCODE_LIT:
+ return emit_lit( emit, insn );
+
+ case TGSI_OPCODE_LRP:
+ return emit_lrp( emit, insn );
+
+ default: {
+ unsigned opcode = translate_opcode(insn->Instruction.Opcode);
+
+ if (opcode == SVGA3DOP_LAST_INST)
+ return FALSE;
+
+ if (!emit_simple_instruction( emit, opcode, insn ))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+static boolean svga_emit_immediate( struct svga_shader_emitter *emit,
+ struct tgsi_full_immediate *imm)
+{
+ static const float id[4] = {0,0,0,1};
+ float value[4];
+ unsigned i;
+
+ assert(1 <= imm->Immediate.NrTokens && imm->Immediate.NrTokens <= 5);
+ for (i = 0; i < imm->Immediate.NrTokens - 1; i++)
+ value[i] = imm->u[i].Float;
+
+ for ( ; i < 4; i++ )
+ value[i] = id[i];
+
+ return emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
+ emit->imm_start + emit->internal_imm_count++,
+ value[0], value[1], value[2], value[3]);
+}
+
+static boolean make_immediate( struct svga_shader_emitter *emit,
+ float a,
+ float b,
+ float c,
+ float d,
+ struct src_register *out )
+{
+ unsigned idx = emit->nr_hw_const++;
+
+ if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
+ idx, a, b, c, d ))
+ return FALSE;
+
+ *out = src_register( SVGA3DREG_CONST, idx );
+
+ return TRUE;
+}
+
+static boolean emit_vs_preamble( struct svga_shader_emitter *emit )
+{
+ if (!emit->key.vkey.need_prescale) {
+ if (!make_immediate( emit, 0, 0, .5, .5,
+ &emit->imm_0055))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static boolean emit_ps_preamble( struct svga_shader_emitter *emit )
+{
+ unsigned i;
+
+ /* For SM20, need to initialize the temporaries we're using to hold
+ * color outputs to some value. Shaders which don't set all of
+ * these values are likely to be rejected by the DX9 runtime.
+ */
+ if (!emit->use_sm30) {
+ struct src_register zero = get_zero_immediate( emit );
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) {
+
+ if (!submit_op1( emit,
+ inst_token(SVGA3DOP_MOV),
+ emit->temp_col[i],
+ zero ))
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static boolean emit_ps_postamble( struct svga_shader_emitter *emit )
+{
+ unsigned i;
+
+ /* PS oDepth is incredibly fragile and it's very hard to catch the
+ * types of usage that break it during shader emit. Easier just to
+ * redirect the main program to a temporary and then only touch
+ * oDepth with a hand-crafted MOV below.
+ */
+ if (SVGA3dShaderGetRegType(emit->true_pos.value) != 0) {
+
+ if (!submit_op1( emit,
+ inst_token(SVGA3DOP_MOV),
+ emit->true_pos,
+ scalar(src(emit->temp_pos), TGSI_SWIZZLE_Z) ))
+ return FALSE;
+ }
+
+ /* Similarly for SM20 color outputs... Luckily SM30 isn't so
+ * fragile.
+ */
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) {
+
+ if (!submit_op1( emit,
+ inst_token(SVGA3DOP_MOV),
+ emit->true_col[i],
+ src(emit->temp_col[i]) ))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static boolean emit_vs_postamble( struct svga_shader_emitter *emit )
+{
+ /* PSIZ output is incredibly fragile and it's very hard to catch
+ * the types of usage that break it during shader emit. Easier
+ * just to redirect the main program to a temporary and then only
+ * touch PSIZ with a hand-crafted MOV below.
+ */
+ if (SVGA3dShaderGetRegType(emit->true_psiz.value) != 0) {
+
+ if (!submit_op1( emit,
+ inst_token(SVGA3DOP_MOV),
+ emit->true_psiz,
+ scalar(src(emit->temp_psiz), TGSI_SWIZZLE_X) ))
+ return FALSE;
+ }
+
+ /* Need to perform various manipulations on vertex position to cope
+ * with the different GL and D3D clip spaces.
+ */
+ if (emit->key.vkey.need_prescale) {
+ SVGA3dShaderDestToken temp_pos = emit->temp_pos;
+ SVGA3dShaderDestToken pos = emit->true_pos;
+ unsigned offset = emit->info.file_max[TGSI_FILE_CONSTANT] + 1;
+ struct src_register prescale_scale = src_register( SVGA3DREG_CONST,
+ offset + 0 );
+ struct src_register prescale_trans = src_register( SVGA3DREG_CONST,
+ offset + 1 );
+
+ /* MUL temp_pos.xyz, temp_pos, prescale.scale
+ * MAD result.position, temp_pos.wwww, prescale.trans, temp_pos
+ * --> Note that prescale.trans.w == 0
+ */
+ if (!submit_op2( emit,
+ inst_token(SVGA3DOP_MUL),
+ writemask(temp_pos, TGSI_WRITEMASK_XYZ),
+ src(temp_pos),
+ prescale_scale ))
+ return FALSE;
+
+ if (!submit_op3( emit,
+ inst_token(SVGA3DOP_MAD),
+ pos,
+ swizzle(src(temp_pos), 3, 3, 3, 3),
+ prescale_trans,
+ src(temp_pos)))
+ return FALSE;
+ }
+ else {
+ SVGA3dShaderDestToken temp_pos = emit->temp_pos;
+ SVGA3dShaderDestToken pos = emit->true_pos;
+ struct src_register imm_0055 = emit->imm_0055;
+
+ /* Adjust GL clipping coordinate space to hardware (D3D-style):
+ *
+ * DP4 temp_pos.z, {0,0,.5,.5}, temp_pos
+ * MOV result.position, temp_pos
+ */
+ if (!submit_op2( emit,
+ inst_token(SVGA3DOP_DP4),
+ writemask(temp_pos, TGSI_WRITEMASK_Z),
+ imm_0055,
+ src(temp_pos) ))
+ return FALSE;
+
+ if (!submit_op1( emit,
+ inst_token(SVGA3DOP_MOV),
+ pos,
+ src(temp_pos) ))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ 0: IF VFACE :4
+ 1: COLOR = FrontColor;
+ 2: ELSE
+ 3: COLOR = BackColor;
+ 4: ENDIF
+ */
+static boolean emit_light_twoside( struct svga_shader_emitter *emit )
+{
+ struct src_register vface, zero;
+ struct src_register front[2];
+ struct src_register back[2];
+ SVGA3dShaderDestToken color[2];
+ int count = emit->internal_color_count;
+ int i;
+ SVGA3dShaderInstToken if_token;
+
+ if (count == 0)
+ return TRUE;
+
+ vface = get_vface( emit );
+ zero = get_zero_immediate( emit );
+
+ /* Can't use get_temp() to allocate the color reg as such
+ * temporaries will be reclaimed after each instruction by the call
+ * to reset_temp_regs().
+ */
+ for (i = 0; i < count; i++) {
+ color[i] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+
+ front[i] = emit->input_map[emit->internal_color_idx[i]];
+
+ /* Back is always the next input:
+ */
+ back[i] = front[i];
+ back[i].base.num = front[i].base.num + 1;
+
+ /* Reassign the input_map to the actual front-face color:
+ */
+ emit->input_map[emit->internal_color_idx[i]] = src(color[i]);
+ }
+
+ if_token = inst_token( SVGA3DOP_IFC );
+
+ if (emit->key.fkey.front_cw)
+ if_token.control = SVGA3DOPCOMP_GT;
+ else
+ if_token.control = SVGA3DOPCOMP_LT;
+
+ zero = scalar(zero, TGSI_SWIZZLE_X);
+
+ if (!(emit_instruction( emit, if_token ) &&
+ emit_src( emit, vface ) &&
+ emit_src( emit, zero ) ))
+ return FALSE;
+
+ for (i = 0; i < count; i++) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), color[i], front[i] ))
+ return FALSE;
+ }
+
+ if (!(emit_instruction( emit, inst_token( SVGA3DOP_ELSE))))
+ return FALSE;
+
+ for (i = 0; i < count; i++) {
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), color[i], back[i] ))
+ return FALSE;
+ }
+
+ if (!emit_instruction( emit, inst_token( SVGA3DOP_ENDIF ) ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ 0: SETP_GT TEMP, VFACE, 0
+ where TEMP is a fake frontface register
+ */
+static boolean emit_frontface( struct svga_shader_emitter *emit )
+{
+ struct src_register vface, zero;
+ SVGA3dShaderDestToken temp;
+ struct src_register pass, fail;
+
+ vface = get_vface( emit );
+ zero = get_zero_immediate( emit );
+
+ /* Can't use get_temp() to allocate the fake frontface reg as such
+ * temporaries will be reclaimed after each instruction by the call
+ * to reset_temp_regs().
+ */
+ temp = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+
+ if (emit->key.fkey.front_cw) {
+ pass = scalar( zero, TGSI_SWIZZLE_W );
+ fail = scalar( zero, TGSI_SWIZZLE_X );
+ } else {
+ pass = scalar( zero, TGSI_SWIZZLE_X );
+ fail = scalar( zero, TGSI_SWIZZLE_W );
+ }
+
+ if (!emit_conditional(emit, PIPE_FUNC_GREATER,
+ temp, vface, scalar( zero, TGSI_SWIZZLE_X ),
+ pass, fail))
+ return FALSE;
+
+ /* Reassign the input_map to the actual front-face color:
+ */
+ emit->input_map[emit->internal_frontface_idx] = src(temp);
+
+ return TRUE;
+}
+
+static INLINE boolean
+needs_to_create_zero( struct svga_shader_emitter *emit )
+{
+ int i;
+
+ if (emit->unit == PIPE_SHADER_FRAGMENT) {
+ if (!emit->use_sm30)
+ return TRUE;
+
+ if (emit->key.fkey.light_twoside)
+ return TRUE;
+
+ if (emit->emit_frontface)
+ return TRUE;
+
+ if (emit->info.opcode_count[TGSI_OPCODE_DST] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_LIT] >= 1)
+ return TRUE;
+ }
+
+ if (emit->info.opcode_count[TGSI_OPCODE_IF] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SGE] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SGT] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SLE] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SLT] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SNE] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SEQ] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_EXP] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_LOG] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_XPD] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_KILP] >= 1)
+ return TRUE;
+
+ for (i = 0; i < emit->key.fkey.num_textures; i++) {
+ if (emit->key.fkey.tex[i].compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static INLINE boolean
+needs_to_create_loop_const( struct svga_shader_emitter *emit )
+{
+ return (emit->info.opcode_count[TGSI_OPCODE_BGNLOOP] >= 1);
+}
+
+static INLINE boolean
+needs_to_create_sincos_consts( struct svga_shader_emitter *emit )
+{
+ return !emit->use_sm30 && (emit->info.opcode_count[TGSI_OPCODE_SIN] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_COS] >= 1 ||
+ emit->info.opcode_count[TGSI_OPCODE_SCS] >= 1);
+}
+
+static INLINE boolean
+needs_to_create_arl_consts( struct svga_shader_emitter *emit )
+{
+ return (emit->num_arl_consts > 0);
+}
+
+static INLINE boolean
+pre_parse_add_indirect( struct svga_shader_emitter *emit,
+ int num, int current_arl)
+{
+ int i;
+ assert(num < 0);
+
+ for (i = 0; i < emit->num_arl_consts; ++i) {
+ if (emit->arl_consts[i].arl_num == current_arl)
+ break;
+ }
+ /* new entry */
+ if (emit->num_arl_consts == i) {
+ ++emit->num_arl_consts;
+ }
+ emit->arl_consts[i].number = (emit->arl_consts[i].number > num) ?
+ num :
+ emit->arl_consts[i].number;
+ emit->arl_consts[i].arl_num = current_arl;
+ return TRUE;
+}
+
+static boolean
+pre_parse_instruction( struct svga_shader_emitter *emit,
+ const struct tgsi_full_instruction *insn,
+ int current_arl)
+{
+ if (insn->FullSrcRegisters[0].SrcRegister.Indirect &&
+ insn->FullSrcRegisters[0].SrcRegisterInd.File == TGSI_FILE_ADDRESS) {
+ const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0];
+ if (reg->SrcRegister.Index < 0) {
+ pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl);
+ }
+ }
+
+ if (insn->FullSrcRegisters[1].SrcRegister.Indirect &&
+ insn->FullSrcRegisters[1].SrcRegisterInd.File == TGSI_FILE_ADDRESS) {
+ const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[1];
+ if (reg->SrcRegister.Index < 0) {
+ pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl);
+ }
+ }
+
+ if (insn->FullSrcRegisters[2].SrcRegister.Indirect &&
+ insn->FullSrcRegisters[2].SrcRegisterInd.File == TGSI_FILE_ADDRESS) {
+ const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[2];
+ if (reg->SrcRegister.Index < 0) {
+ pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl);
+ }
+ }
+
+ return TRUE;
+}
+
+static boolean
+pre_parse_tokens( struct svga_shader_emitter *emit,
+ const struct tgsi_token *tokens )
+{
+ struct tgsi_parse_context parse;
+ int current_arl = 0;
+
+ tgsi_parse_init( &parse, tokens );
+
+ while (!tgsi_parse_end_of_tokens( &parse )) {
+ tgsi_parse_token( &parse );
+ switch (parse.FullToken.Token.Type) {
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ break;
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ if (parse.FullToken.FullInstruction.Instruction.Opcode ==
+ TGSI_OPCODE_ARL) {
+ ++current_arl;
+ }
+ if (!pre_parse_instruction( emit, &parse.FullToken.FullInstruction,
+ current_arl ))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+
+ }
+ return TRUE;
+}
+
+static boolean svga_shader_emit_helpers( struct svga_shader_emitter *emit )
+
+{
+ if (needs_to_create_zero( emit )) {
+ create_zero_immediate( emit );
+ }
+ if (needs_to_create_loop_const( emit )) {
+ create_loop_const( emit );
+ }
+ if (needs_to_create_sincos_consts( emit )) {
+ create_sincos_consts( emit );
+ }
+ if (needs_to_create_arl_consts( emit )) {
+ create_arl_consts( emit );
+ }
+
+ if (emit->unit == PIPE_SHADER_FRAGMENT) {
+ if (!emit_ps_preamble( emit ))
+ return FALSE;
+
+ if (emit->key.fkey.light_twoside) {
+ if (!emit_light_twoside( emit ))
+ return FALSE;
+ }
+ if (emit->emit_frontface) {
+ if (!emit_frontface( emit ))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
+ const struct tgsi_token *tokens )
+{
+ struct tgsi_parse_context parse;
+ boolean ret = TRUE;
+ boolean helpers_emitted = FALSE;
+ unsigned line_nr = 0;
+
+ tgsi_parse_init( &parse, tokens );
+ emit->internal_imm_count = 0;
+
+ if (emit->unit == PIPE_SHADER_VERTEX) {
+ ret = emit_vs_preamble( emit );
+ if (!ret)
+ goto done;
+ }
+
+ pre_parse_tokens(emit, tokens);
+
+ while (!tgsi_parse_end_of_tokens( &parse )) {
+ tgsi_parse_token( &parse );
+
+ switch (parse.FullToken.Token.Type) {
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ ret = svga_emit_immediate( emit, &parse.FullToken.FullImmediate );
+ if (!ret)
+ goto done;
+ break;
+
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ if (emit->use_sm30)
+ ret = svga_translate_decl_sm30( emit, &parse.FullToken.FullDeclaration );
+ else
+ ret = svga_translate_decl_sm20( emit, &parse.FullToken.FullDeclaration );
+ if (!ret)
+ goto done;
+ break;
+
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ if (!helpers_emitted) {
+ if (!svga_shader_emit_helpers( emit ))
+ goto done;
+ helpers_emitted = TRUE;
+ }
+ ret = svga_emit_instruction( emit,
+ line_nr++,
+ &parse.FullToken.FullInstruction );
+ if (!ret)
+ goto done;
+ break;
+ default:
+ break;
+ }
+
+ reset_temp_regs( emit );
+ }
+
+ /* Need to terminate the current subroutine. Note that the
+ * hardware doesn't tolerate shaders without sub-routines
+ * terminating with RET+END.
+ */
+ if (!emit->in_main_func) {
+ ret = emit_instruction( emit, inst_token( SVGA3DOP_RET ) );
+ if (!ret)
+ goto done;
+ }
+
+ /* Need to terminate the whole shader:
+ */
+ ret = emit_instruction( emit, inst_token( SVGA3DOP_END ) );
+ if (!ret)
+ goto done;
+
+done:
+ assert(ret);
+ tgsi_parse_free( &parse );
+ return ret;
+}
+
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
new file mode 100644
index 0000000000..59f299c185
--- /dev/null
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -0,0 +1,299 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * VMware SVGA specific winsys interface.
+ *
+ * @author Jose Fonseca
+ *
+ * Documentation taken from the VMware SVGA DDK.
+ */
+
+#ifndef SVGA_WINSYS_H_
+#define SVGA_WINSYS_H_
+
+
+#include "svga_types.h"
+#include "svga_reg.h"
+#include "svga3d_reg.h"
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
+
+
+struct svga_winsys_screen;
+struct svga_winsys_buffer;
+struct pipe_screen;
+struct pipe_context;
+struct pipe_fence_handle;
+struct pipe_texture;
+struct svga_region;
+
+
+#define SVGA_BUFFER_USAGE_PINNED (PIPE_BUFFER_USAGE_CUSTOM << 0)
+#define SVGA_BUFFER_USAGE_WRAPPED (PIPE_BUFFER_USAGE_CUSTOM << 1)
+
+
+/** Opaque surface handle */
+struct svga_winsys_surface;
+
+/** Opaque buffer handle */
+struct svga_winsys_handle;
+
+
+/**
+ * SVGA per-context winsys interface.
+ */
+struct svga_winsys_context
+{
+ void
+ (*destroy)(struct svga_winsys_context *swc);
+
+ void *
+ (*reserve)(struct svga_winsys_context *swc,
+ uint32_t nr_bytes, uint32_t nr_relocs );
+
+ /**
+ * Emit a relocation for a host surface.
+ *
+ * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE
+ *
+ * NOTE: Order of this call does matter. It should be the same order
+ * as relocations appear in the command buffer.
+ */
+ void
+ (*surface_relocation)(struct svga_winsys_context *swc,
+ uint32 *sid,
+ struct svga_winsys_surface *surface,
+ unsigned flags);
+
+ /**
+ * Emit a relocation for a guest memory region.
+ *
+ * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE
+ *
+ * NOTE: Order of this call does matter. It should be the same order
+ * as relocations appear in the command buffer.
+ */
+ void
+ (*region_relocation)(struct svga_winsys_context *swc,
+ struct SVGAGuestPtr *ptr,
+ struct svga_winsys_buffer *buffer,
+ uint32 offset,
+ unsigned flags);
+
+ void
+ (*commit)(struct svga_winsys_context *swc);
+
+ enum pipe_error
+ (*flush)(struct svga_winsys_context *swc,
+ struct pipe_fence_handle **pfence);
+
+ /**
+ * Context ID used to fill in the commands
+ *
+ * Context IDs are arbitrary small non-negative integers,
+ * global to the entire SVGA device.
+ */
+ uint32 cid;
+};
+
+
+/**
+ * SVGA per-screen winsys interface.
+ */
+struct svga_winsys_screen
+{
+ void
+ (*destroy)(struct svga_winsys_screen *sws);
+
+ boolean
+ (*get_cap)(struct svga_winsys_screen *sws,
+ SVGA3dDevCapIndex index,
+ SVGA3dDevCapResult *result);
+
+ /**
+ * Create a new context.
+ *
+ * Context objects encapsulate all render state, and shader
+ * objects are per-context.
+ *
+ * Surfaces are not per-context. The same surface can be shared
+ * between multiple contexts, and surface operations can occur
+ * without a context.
+ */
+ struct svga_winsys_context *
+ (*context_create)(struct svga_winsys_screen *sws);
+
+
+ /**
+ * This creates a "surface" object in the SVGA3D device,
+ * and returns the surface ID (sid). Surfaces are generic
+ * containers for host VRAM objects like textures, vertex
+ * buffers, and depth/stencil buffers.
+ *
+ * Surfaces are hierarchial:
+ *
+ * - Surface may have multiple faces (for cube maps)
+ *
+ * - Each face has a list of mipmap levels
+ *
+ * - Each mipmap image may have multiple volume
+ * slices, if the image is three dimensional.
+ *
+ * - Each slice is a 2D array of 'blocks'
+ *
+ * - Each block may be one or more pixels.
+ * (Usually 1, more for DXT or YUV formats.)
+ *
+ * Surfaces are generic host VRAM objects. The SVGA3D device
+ * may optimize surfaces according to the format they were
+ * created with, but this format does not limit the ways in
+ * which the surface may be used. For example, a depth surface
+ * can be used as a texture, or a floating point image may
+ * be used as a vertex buffer. Some surface usages may be
+ * lower performance, due to software emulation, but any
+ * usage should work with any surface.
+ */
+ struct svga_winsys_surface *
+ (*surface_create)(struct svga_winsys_screen *sws,
+ SVGA3dSurfaceFlags flags,
+ SVGA3dSurfaceFormat format,
+ SVGA3dSize size,
+ uint32 numFaces,
+ uint32 numMipLevels);
+
+ /**
+ * Whether this surface is sitting in a validate list
+ */
+ boolean
+ (*surface_is_flushed)(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surface);
+
+ /**
+ * Reference a SVGA3D surface object. This allows sharing of a
+ * surface between different objects.
+ */
+ void
+ (*surface_reference)(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface **pdst,
+ struct svga_winsys_surface *src);
+
+ /**
+ * Buffer management. Buffer attributes are mostly fixed over its lifetime.
+ *
+ * Remember that gallium gets to choose the interface it needs, and the
+ * window systems must then implement that interface (rather than the
+ * other way around...).
+ *
+ * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
+ * usage argument is only an optimization hint, not a guarantee, therefore
+ * proper behavior must be observed in all circumstances.
+ *
+ * alignment indicates the client's alignment requirements, eg for
+ * SSE instructions.
+ */
+ struct svga_winsys_buffer *
+ (*buffer_create)( struct svga_winsys_screen *sws,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size );
+
+ /**
+ * Map the entire data store of a buffer object into the client's address.
+ * flags is a bitmask of:
+ * - PIPE_BUFFER_USAGE_CPU_READ/WRITE
+ * - PIPE_BUFFER_USAGE_DONTBLOCK
+ * - PIPE_BUFFER_USAGE_UNSYNCHRONIZED
+ */
+ void *
+ (*buffer_map)( struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf,
+ unsigned usage );
+
+ void
+ (*buffer_unmap)( struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf );
+
+ void
+ (*buffer_destroy)( struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf );
+
+
+ /**
+ * Reference a fence object.
+ */
+ void
+ (*fence_reference)( struct svga_winsys_screen *sws,
+ struct pipe_fence_handle **pdst,
+ struct pipe_fence_handle *src );
+
+ /**
+ * Checks whether the fence has been signalled.
+ * \param flags driver-specific meaning
+ * \return zero on success.
+ */
+ int (*fence_signalled)( struct svga_winsys_screen *sws,
+ struct pipe_fence_handle *fence,
+ unsigned flag );
+
+ /**
+ * Wait for the fence to finish.
+ * \param flags driver-specific meaning
+ * \return zero on success.
+ */
+ int (*fence_finish)( struct svga_winsys_screen *sws,
+ struct pipe_fence_handle *fence,
+ unsigned flag );
+
+};
+
+
+struct pipe_context *
+svga_context_create(struct pipe_screen *screen);
+
+struct pipe_screen *
+svga_screen_create(struct svga_winsys_screen *sws);
+
+struct svga_winsys_screen *
+svga_winsys_screen(struct pipe_screen *screen);
+
+struct pipe_buffer *
+svga_screen_buffer_wrap_surface(struct pipe_screen *screen,
+ enum SVGA3dSurfaceFormat format,
+ struct svga_winsys_surface *srf);
+
+struct svga_winsys_surface *
+svga_screen_texture_get_winsys_surface(struct pipe_texture *texture);
+struct svga_winsys_surface *
+svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer);
+
+boolean
+svga_screen_buffer_from_texture(struct pipe_texture *texture,
+ struct pipe_buffer **buffer,
+ unsigned *stride);
+
+#endif /* SVGA_WINSYS_H_ */
diff --git a/src/gallium/drivers/svga/svgadump/st_shader.h b/src/gallium/drivers/svga/svgadump/st_shader.h
new file mode 100644
index 0000000000..2fc1796a90
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/st_shader.h
@@ -0,0 +1,214 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Definitions
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_H
+#define ST_SHADER_SVGA_H
+
+#include "pipe/p_compiler.h"
+
+struct sh_op
+{
+ unsigned opcode:16;
+ unsigned control:8;
+ unsigned length:4;
+ unsigned predicated:1;
+ unsigned unused:1;
+ unsigned coissue:1;
+ unsigned is_reg:1;
+};
+
+struct sh_reg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:14;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_reg_type( struct sh_reg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_cdata
+{
+ float xyzw[4];
+};
+
+struct sh_def
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ struct sh_cdata cdata;
+};
+
+struct sh_defb
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ uint data;
+};
+
+struct sh_idata
+{
+ int xyzw[4];
+};
+
+struct sh_defi
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ struct sh_idata idata;
+};
+
+#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN
+#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D
+#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE
+#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME
+
+struct ps_sampleinfo
+{
+ unsigned unused:27;
+ unsigned texture_type:4;
+ unsigned is_reg:1;
+};
+
+struct vs_semantic
+{
+ unsigned usage:5;
+ unsigned unused1:11;
+ unsigned usage_index:4;
+ unsigned unused2:12;
+};
+
+struct sh_dstreg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:2;
+ unsigned write_mask:4;
+ unsigned modifier:4;
+ unsigned shift_scale:4;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_dstreg_type( struct sh_dstreg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_dcl
+{
+ struct sh_op op;
+ union {
+ struct {
+ struct ps_sampleinfo sampleinfo;
+ } ps;
+ struct {
+ struct vs_semantic semantic;
+ } vs;
+ } u;
+ struct sh_dstreg reg;
+};
+
+
+struct sh_srcreg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:2;
+ unsigned swizzle_x:2;
+ unsigned swizzle_y:2;
+ unsigned swizzle_z:2;
+ unsigned swizzle_w:2;
+ unsigned modifier:4;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_srcreg_type( struct sh_srcreg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_dstop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+};
+
+struct sh_srcop
+{
+ struct sh_op op;
+ struct sh_srcreg src;
+};
+
+struct sh_src2op
+{
+ struct sh_op op;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+};
+
+struct sh_unaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src;
+};
+
+struct sh_binaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+};
+
+struct sh_trinaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+ struct sh_srcreg src2;
+};
+
+#endif /* ST_SHADER_SVGA_H */
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.c b/src/gallium/drivers/svga/svgadump/st_shader_dump.c
new file mode 100644
index 0000000000..d65cc93bfd
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/st_shader_dump.c
@@ -0,0 +1,649 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Dump Facilities
+ *
+ * @author Michal Krol
+ */
+
+#include "st_shader.h"
+#include "st_shader_dump.h"
+#include "st_shader_op.h"
+#include "util/u_debug.h"
+
+#include "../svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+struct dump_info
+{
+ SVGA3dShaderVersion version;
+ boolean is_ps;
+};
+
+static void dump_op( struct sh_op op, const char *mnemonic )
+{
+ assert( op.predicated == 0 );
+ assert( op.is_reg == 0 );
+
+ if (op.coissue)
+ debug_printf( "+" );
+ debug_printf( "%s", mnemonic );
+ switch (op.control) {
+ case 0:
+ break;
+ case SVGA3DOPCONT_PROJECT:
+ debug_printf( "p" );
+ break;
+ case SVGA3DOPCONT_BIAS:
+ debug_printf( "b" );
+ break;
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_comp_op( struct sh_op op, const char *mnemonic )
+{
+ assert( op.is_reg == 0 );
+
+ if (op.coissue)
+ debug_printf( "+" );
+ debug_printf( "%s", mnemonic );
+ switch (op.control) {
+ case SVGA3DOPCOMP_RESERVED0:
+ break;
+ case SVGA3DOPCOMP_GT:
+ debug_printf("_gt");
+ break;
+ case SVGA3DOPCOMP_EQ:
+ debug_printf("_eq");
+ break;
+ case SVGA3DOPCOMP_GE:
+ debug_printf("_ge");
+ break;
+ case SVGA3DOPCOMP_LT:
+ debug_printf("_lt");
+ break;
+ case SVGA3DOPCOMPC_NE:
+ debug_printf("_ne");
+ break;
+ case SVGA3DOPCOMP_LE:
+ debug_printf("_le");
+ break;
+ case SVGA3DOPCOMP_RESERVED1:
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di )
+{
+ assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 );
+ assert( reg.is_reg == 1 );
+
+ switch (sh_reg_type( reg )) {
+ case SVGA3DREG_TEMP:
+ debug_printf( "r%u", reg.number );
+ break;
+
+ case SVGA3DREG_INPUT:
+ debug_printf( "v%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONST:
+ if (reg.relative) {
+ if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP)
+ debug_printf( "c[aL+%u]", reg.number );
+ else
+ debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
+ }
+ else
+ debug_printf( "c%u", reg.number );
+ break;
+
+ case SVGA3DREG_ADDR: /* VS */
+ /* SVGA3DREG_TEXTURE */ /* PS */
+ if (di->is_ps)
+ debug_printf( "t%u", reg.number );
+ else
+ debug_printf( "a%u", reg.number );
+ break;
+
+ case SVGA3DREG_RASTOUT:
+ switch (reg.number) {
+ case 0 /*POSITION*/:
+ debug_printf( "oPos" );
+ break;
+ case 1 /*FOG*/:
+ debug_printf( "oFog" );
+ break;
+ case 2 /*POINT_SIZE*/:
+ debug_printf( "oPts" );
+ break;
+ default:
+ assert( 0 );
+ debug_printf( "???" );
+ }
+ break;
+
+ case SVGA3DREG_ATTROUT:
+ assert( reg.number < 2 );
+ debug_printf( "oD%u", reg.number );
+ break;
+
+ case SVGA3DREG_TEXCRDOUT:
+ /* SVGA3DREG_OUTPUT */
+ debug_printf( "oT%u", reg.number );
+ break;
+
+ case SVGA3DREG_COLOROUT:
+ debug_printf( "oC%u", reg.number );
+ break;
+
+ case SVGA3DREG_DEPTHOUT:
+ debug_printf( "oD%u", reg.number );
+ break;
+
+ case SVGA3DREG_SAMPLER:
+ debug_printf( "s%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONSTBOOL:
+ assert( !reg.relative );
+ debug_printf( "b%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONSTINT:
+ assert( !reg.relative );
+ debug_printf( "i%u", reg.number );
+ break;
+
+ case SVGA3DREG_LOOP:
+ assert( reg.number == 0 );
+ debug_printf( "aL" );
+ break;
+
+ case SVGA3DREG_MISCTYPE:
+ switch (reg.number) {
+ case SVGA3DMISCREG_POSITION:
+ debug_printf( "vPos" );
+ break;
+ case SVGA3DMISCREG_FACE:
+ debug_printf( "vFace" );
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ break;
+
+ case SVGA3DREG_LABEL:
+ debug_printf( "l%u", reg.number );
+ break;
+
+ case SVGA3DREG_PREDICATE:
+ debug_printf( "p%u", reg.number );
+ break;
+
+
+ default:
+ assert( 0 );
+ debug_printf( "???" );
+ }
+}
+
+static void dump_cdata( struct sh_cdata cdata )
+{
+ debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] );
+}
+
+static void dump_idata( struct sh_idata idata )
+{
+ debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] );
+}
+
+static void dump_bdata( boolean bdata )
+{
+ debug_printf( bdata ? "TRUE" : "FALSE" );
+}
+
+static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
+{
+ switch (sampleinfo.texture_type) {
+ case SVGA3DSAMP_2D:
+ debug_printf( "_2d" );
+ break;
+ case SVGA3DSAMP_CUBE:
+ debug_printf( "_cube" );
+ break;
+ case SVGA3DSAMP_VOLUME:
+ debug_printf( "_volume" );
+ break;
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_usageinfo( struct vs_semantic semantic )
+{
+ switch (semantic.usage) {
+ case SVGA3D_DECLUSAGE_POSITION:
+ debug_printf("_position" );
+ break;
+ case SVGA3D_DECLUSAGE_BLENDWEIGHT:
+ debug_printf("_blendweight" );
+ break;
+ case SVGA3D_DECLUSAGE_BLENDINDICES:
+ debug_printf("_blendindices" );
+ break;
+ case SVGA3D_DECLUSAGE_NORMAL:
+ debug_printf("_normal" );
+ break;
+ case SVGA3D_DECLUSAGE_PSIZE:
+ debug_printf("_psize" );
+ break;
+ case SVGA3D_DECLUSAGE_TEXCOORD:
+ debug_printf("_texcoord");
+ break;
+ case SVGA3D_DECLUSAGE_TANGENT:
+ debug_printf("_tangent" );
+ break;
+ case SVGA3D_DECLUSAGE_BINORMAL:
+ debug_printf("_binormal" );
+ break;
+ case SVGA3D_DECLUSAGE_TESSFACTOR:
+ debug_printf("_tessfactor" );
+ break;
+ case SVGA3D_DECLUSAGE_POSITIONT:
+ debug_printf("_positiont" );
+ break;
+ case SVGA3D_DECLUSAGE_COLOR:
+ debug_printf("_color" );
+ break;
+ case SVGA3D_DECLUSAGE_FOG:
+ debug_printf("_fog" );
+ break;
+ case SVGA3D_DECLUSAGE_DEPTH:
+ debug_printf("_depth" );
+ break;
+ case SVGA3D_DECLUSAGE_SAMPLE:
+ debug_printf("_sample");
+ break;
+ default:
+ assert( 0 );
+ return;
+ }
+
+ if (semantic.usage_index != 0) {
+ debug_printf("%d", semantic.usage_index );
+ }
+}
+
+static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
+{
+ union {
+ struct sh_reg reg;
+ struct sh_dstreg dstreg;
+ } u;
+
+ assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier );
+
+ if (dstreg.modifier & SVGA3DDSTMOD_SATURATE)
+ debug_printf( "_sat" );
+ if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION)
+ debug_printf( "_pp" );
+ switch (dstreg.shift_scale) {
+ case 0:
+ break;
+ case 1:
+ debug_printf( "_x2" );
+ break;
+ case 2:
+ debug_printf( "_x4" );
+ break;
+ case 3:
+ debug_printf( "_x8" );
+ break;
+ case 13:
+ debug_printf( "_d8" );
+ break;
+ case 14:
+ debug_printf( "_d4" );
+ break;
+ case 15:
+ debug_printf( "_d2" );
+ break;
+ default:
+ assert( 0 );
+ }
+ debug_printf( " " );
+
+ u.dstreg = dstreg;
+ dump_reg( u.reg, NULL, di );
+ if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) {
+ debug_printf( "." );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_0)
+ debug_printf( "x" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_1)
+ debug_printf( "y" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_2)
+ debug_printf( "z" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_3)
+ debug_printf( "w" );
+ }
+}
+
+static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di )
+{
+ union {
+ struct sh_reg reg;
+ struct sh_srcreg srcreg;
+ } u;
+
+ switch (srcreg.modifier) {
+ case SVGA3DSRCMOD_NEG:
+ case SVGA3DSRCMOD_BIASNEG:
+ case SVGA3DSRCMOD_SIGNNEG:
+ case SVGA3DSRCMOD_X2NEG:
+ debug_printf( "-" );
+ break;
+ case SVGA3DSRCMOD_ABS:
+ debug_printf( "|" );
+ break;
+ case SVGA3DSRCMOD_ABSNEG:
+ debug_printf( "-|" );
+ break;
+ case SVGA3DSRCMOD_COMP:
+ debug_printf( "1-" );
+ break;
+ case SVGA3DSRCMOD_NOT:
+ debug_printf( "!" );
+ }
+
+ u.srcreg = srcreg;
+ dump_reg( u.reg, indreg, di );
+ switch (srcreg.modifier) {
+ case SVGA3DSRCMOD_NONE:
+ case SVGA3DSRCMOD_NEG:
+ case SVGA3DSRCMOD_COMP:
+ case SVGA3DSRCMOD_NOT:
+ break;
+ case SVGA3DSRCMOD_ABS:
+ case SVGA3DSRCMOD_ABSNEG:
+ debug_printf( "|" );
+ break;
+ case SVGA3DSRCMOD_BIAS:
+ case SVGA3DSRCMOD_BIASNEG:
+ debug_printf( "_bias" );
+ break;
+ case SVGA3DSRCMOD_SIGN:
+ case SVGA3DSRCMOD_SIGNNEG:
+ debug_printf( "_bx2" );
+ break;
+ case SVGA3DSRCMOD_X2:
+ case SVGA3DSRCMOD_X2NEG:
+ debug_printf( "_x2" );
+ break;
+ case SVGA3DSRCMOD_DZ:
+ debug_printf( "_dz" );
+ break;
+ case SVGA3DSRCMOD_DW:
+ debug_printf( "_dw" );
+ break;
+ default:
+ assert( 0 );
+ }
+ if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) {
+ debug_printf( "." );
+ if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) {
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ }
+ else {
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_y] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_z] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_w] );
+ }
+ }
+}
+
+void
+sh_svga_dump(
+ const unsigned *assem,
+ unsigned dwords,
+ unsigned do_binary )
+{
+ const unsigned *start = assem;
+ boolean finished = FALSE;
+ struct dump_info di;
+ unsigned i;
+
+ if (do_binary) {
+ for (i = 0; i < dwords; i++)
+ debug_printf(" 0x%08x,\n", assem[i]);
+
+ debug_printf("\n\n");
+ }
+
+ di.version.value = *assem++;
+ di.is_ps = (di.version.type == SVGA3D_PS_TYPE);
+
+ debug_printf(
+ "%s_%u_%u\n",
+ di.is_ps ? "ps" : "vs",
+ di.version.major,
+ di.version.minor );
+
+ while (!finished) {
+ struct sh_op op = *(struct sh_op *) assem;
+
+ if (assem - start >= dwords) {
+ debug_printf("... ran off end of buffer\n");
+ assert(0);
+ return;
+ }
+
+ switch (op.opcode) {
+ case SVGA3DOP_DCL:
+ {
+ struct sh_dcl dcl = *(struct sh_dcl *) assem;
+
+ debug_printf( "dcl" );
+ if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER)
+ dump_sampleinfo( dcl.u.ps.sampleinfo );
+ else if (di.is_ps) {
+ if (di.version.major == 3 &&
+ sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE)
+ dump_usageinfo( dcl.u.vs.semantic );
+ }
+ else
+ dump_usageinfo( dcl.u.vs.semantic );
+ dump_dstreg( dcl.reg, &di );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_dcl ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_DEFB:
+ {
+ struct sh_defb defb = *(struct sh_defb *) assem;
+
+ debug_printf( "defb " );
+ dump_reg( defb.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_bdata( defb.data );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_defb ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_DEFI:
+ {
+ struct sh_defi defi = *(struct sh_defi *) assem;
+
+ debug_printf( "defi " );
+ dump_reg( defi.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_idata( defi.idata );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_defi ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_TEXCOORD:
+ assert( di.is_ps );
+ dump_op( op, "texcoord" );
+ if (0) {
+ struct sh_dstop dstop = *(struct sh_dstop *) assem;
+ dump_dstreg( dstop.dst, &di );
+ assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
+ }
+ else {
+ struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
+ dump_dstreg( unaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( unaryop.src, NULL, &di );
+ assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ }
+ debug_printf( "\n" );
+ break;
+
+ case SVGA3DOP_TEX:
+ assert( di.is_ps );
+ if (0) {
+ dump_op( op, "tex" );
+ if (0) {
+ struct sh_dstop dstop = *(struct sh_dstop *) assem;
+
+ dump_dstreg( dstop.dst, &di );
+ assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
+ }
+ else {
+ struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
+
+ dump_dstreg( unaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( unaryop.src, NULL, &di );
+ assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ }
+ }
+ else {
+ struct sh_binaryop binaryop = *(struct sh_binaryop *) assem;
+
+ dump_op( op, "texld" );
+ dump_dstreg( binaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( binaryop.src0, NULL, &di );
+ debug_printf( ", " );
+ dump_srcreg( binaryop.src1, NULL, &di );
+ assem += sizeof( struct sh_binaryop ) / sizeof( unsigned );
+ }
+ debug_printf( "\n" );
+ break;
+
+ case SVGA3DOP_DEF:
+ {
+ struct sh_def def = *(struct sh_def *) assem;
+
+ debug_printf( "def " );
+ dump_reg( def.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_cdata( def.cdata );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_def ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_PHASE:
+ debug_printf( "phase\n" );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+ break;
+
+ case SVGA3DOP_COMMENT:
+ assert( 0 );
+ break;
+
+ case SVGA3DOP_RET:
+ debug_printf( "ret\n" );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+ break;
+
+ case SVGA3DOP_END:
+ debug_printf( "end\n" );
+ finished = TRUE;
+ break;
+
+ default:
+ {
+ const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode );
+ uint i;
+ uint num_src = info->num_src + op.predicated;
+ boolean not_first_arg = FALSE;
+
+ assert( info->num_dst <= 1 );
+
+ if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3)
+ num_src += 2;
+
+ dump_comp_op( op, info->mnemonic );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+
+ if (info->num_dst > 0) {
+ struct sh_dstreg dstreg = *(struct sh_dstreg *) assem;
+
+ dump_dstreg( dstreg, &di );
+ assem += sizeof( struct sh_dstreg ) / sizeof( unsigned );
+ not_first_arg = TRUE;
+ }
+
+ for (i = 0; i < num_src; i++) {
+ struct sh_srcreg srcreg;
+ struct sh_srcreg indreg;
+
+ srcreg = *(struct sh_srcreg *) assem;
+ assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
+ if (srcreg.relative && !di.is_ps && di.version.major >= 2) {
+ indreg = *(struct sh_srcreg *) assem;
+ assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
+ }
+
+ if (not_first_arg)
+ debug_printf( ", " );
+ else
+ debug_printf( " " );
+ dump_srcreg( srcreg, &indreg, &di );
+ not_first_arg = TRUE;
+ }
+
+ debug_printf( "\n" );
+ }
+ }
+ }
+}
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.h b/src/gallium/drivers/svga/svgadump/st_shader_dump.h
new file mode 100644
index 0000000000..af5549cdba
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/st_shader_dump.h
@@ -0,0 +1,42 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Dump Facilities
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_DUMP_H
+#define ST_SHADER_SVGA_DUMP_H
+
+void
+sh_svga_dump(
+ const unsigned *assem,
+ unsigned dwords,
+ unsigned do_binary );
+
+#endif /* ST_SHADER_SVGA_DUMP_H */
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.c b/src/gallium/drivers/svga/svgadump/st_shader_op.c
new file mode 100644
index 0000000000..2c05382ab9
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/st_shader_op.c
@@ -0,0 +1,168 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Opcode Info
+ *
+ * @author Michal Krol
+ */
+
+#include "util/u_debug.h"
+#include "st_shader_op.h"
+
+#include "../svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+#define SVGA3DOP_INVALID SVGA3DOP_END
+#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST
+
+static struct sh_opcode_info opcode_info[] =
+{
+ { "nop", 0, 0, SVGA3DOP_NOP },
+ { "mov", 1, 1, SVGA3DOP_MOV, },
+ { "add", 1, 2, SVGA3DOP_ADD, },
+ { "sub", 1, 2, SVGA3DOP_SUB, },
+ { "mad", 1, 3, SVGA3DOP_MAD, },
+ { "mul", 1, 2, SVGA3DOP_MUL, },
+ { "rcp", 1, 1, SVGA3DOP_RCP, },
+ { "rsq", 1, 1, SVGA3DOP_RSQ, },
+ { "dp3", 1, 2, SVGA3DOP_DP3, },
+ { "dp4", 1, 2, SVGA3DOP_DP4, },
+ { "min", 1, 2, SVGA3DOP_MIN, },
+ { "max", 1, 2, SVGA3DOP_MAX, },
+ { "slt", 1, 2, SVGA3DOP_SLT, },
+ { "sge", 1, 2, SVGA3DOP_SGE, },
+ { "exp", 1, 1, SVGA3DOP_EXP, },
+ { "log", 1, 1, SVGA3DOP_LOG, },
+ { "lit", 1, 1, SVGA3DOP_LIT, },
+ { "dst", 1, 2, SVGA3DOP_DST, },
+ { "lrp", 1, 3, SVGA3DOP_LRP, },
+ { "frc", 1, 1, SVGA3DOP_FRC, },
+ { "m4x4", 1, 2, SVGA3DOP_M4x4, },
+ { "m4x3", 1, 2, SVGA3DOP_M4x3, },
+ { "m3x4", 1, 2, SVGA3DOP_M3x4, },
+ { "m3x3", 1, 2, SVGA3DOP_M3x3, },
+ { "m3x2", 1, 2, SVGA3DOP_M3x2, },
+ { "call", 0, 1, SVGA3DOP_CALL, },
+ { "callnz", 0, 2, SVGA3DOP_CALLNZ, },
+ { "loop", 0, 2, SVGA3DOP_LOOP, },
+ { "ret", 0, 0, SVGA3DOP_RET, },
+ { "endloop", 0, 0, SVGA3DOP_ENDLOOP, },
+ { "label", 0, 1, SVGA3DOP_LABEL, },
+ { "dcl", 0, 0, SVGA3DOP_DCL, },
+ { "pow", 1, 2, SVGA3DOP_POW, },
+ { "crs", 1, 2, SVGA3DOP_CRS, },
+ { "sgn", 1, 3, SVGA3DOP_SGN, },
+ { "abs", 1, 1, SVGA3DOP_ABS, },
+ { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */
+ { "sincos", 1, 1, SVGA3DOP_SINCOS, },
+ { "rep", 0, 1, SVGA3DOP_REP, },
+ { "endrep", 0, 0, SVGA3DOP_ENDREP, },
+ { "if", 0, 1, SVGA3DOP_IF, },
+ { "ifc", 0, 2, SVGA3DOP_IFC, },
+ { "else", 0, 0, SVGA3DOP_ELSE, },
+ { "endif", 0, 0, SVGA3DOP_ENDIF, },
+ { "break", 0, 0, SVGA3DOP_BREAK, },
+ { "breakc", 0, 0, SVGA3DOP_BREAKC, },
+ { "mova", 1, 1, SVGA3DOP_MOVA, },
+ { "defb", 0, 0, SVGA3DOP_DEFB, },
+ { "defi", 0, 0, SVGA3DOP_DEFI, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, },
+ { "texkill", 1, 0, SVGA3DOP_TEXKILL, },
+ { "tex", 0, 0, SVGA3DOP_TEX, },
+ { "texbem", 1, 1, SVGA3DOP_TEXBEM, },
+ { "texbeml", 1, 1, SVGA3DOP_TEXBEML, },
+ { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, },
+ { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, },
+ { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, },
+ { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, },
+ { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, },
+ { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, },
+ { "reserved0", 0, 0, SVGA3DOP_RESERVED0, },
+ { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, },
+ { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,},
+ { "expp", 1, 1, SVGA3DOP_EXPP, },
+ { "logp", 1, 1, SVGA3DOP_LOGP, },
+ { "cnd", 1, 3, SVGA3DOP_CND, },
+ { "def", 0, 0, SVGA3DOP_DEF, },
+ { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, },
+ { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, },
+ { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,},
+ { "texdp3", 1, 1, SVGA3DOP_TEXDP3, },
+ { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, },
+ { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, },
+ { "cmp", 1, 3, SVGA3DOP_CMP, },
+ { "bem", 1, 2, SVGA3DOP_BEM, },
+ { "dp2add", 1, 3, SVGA3DOP_DP2ADD, },
+ { "dsx", 1, 1, SVGA3DOP_INVALID, },
+ { "dsy", 1, 1, SVGA3DOP_INVALID, },
+ { "texldd", 1, 1, SVGA3DOP_INVALID, },
+ { "setp", 1, 2, SVGA3DOP_SETP, },
+ { "texldl", 1, 1, SVGA3DOP_INVALID, },
+ { "breakp", 1, 1, SVGA3DOP_INVALID, },
+};
+
+const struct sh_opcode_info *sh_svga_opcode_info( uint op )
+{
+ struct sh_opcode_info *info;
+
+ if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) {
+ /* The opcode is either PHASE, COMMENT, END or out of range.
+ */
+ assert( 0 );
+ return NULL;
+ }
+
+ info = &opcode_info[op];
+
+ if (info->svga_opcode == SVGA3DOP_INVALID) {
+ /* No valid information. Please provide number of dst/src registers.
+ */
+ assert( 0 );
+ return NULL;
+ }
+
+ /* Sanity check.
+ */
+ assert( op == info->svga_opcode );
+
+ return info;
+}
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.h b/src/gallium/drivers/svga/svgadump/st_shader_op.h
new file mode 100644
index 0000000000..01d39dca84
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/st_shader_op.h
@@ -0,0 +1,46 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Opcode Info
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_OP_H
+#define ST_SHADER_SVGA_OP_H
+
+struct sh_opcode_info
+{
+ const char *mnemonic;
+ unsigned num_dst:8;
+ unsigned num_src:8;
+ unsigned svga_opcode:16;
+};
+
+const struct sh_opcode_info *sh_svga_opcode_info( unsigned op );
+
+#endif /* ST_SHADER_SVGA_OP_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c
new file mode 100644
index 0000000000..180dde8dc1
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.c
@@ -0,0 +1,1736 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * Dump SVGA commands.
+ *
+ * Generated automatically from svga3d_reg.h by svga_dump.py.
+ */
+
+#include "svga_types.h"
+#include "st_shader_dump.h"
+#include "svga3d_reg.h"
+
+#include "util/u_debug.h"
+#include "svga_dump.h"
+
+static void
+dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd)
+{
+ switch((*cmd).identity.type) {
+ case SVGA3D_DECLTYPE_FLOAT1:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n");
+ break;
+ case SVGA3D_DECLTYPE_FLOAT2:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n");
+ break;
+ case SVGA3D_DECLTYPE_FLOAT3:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n");
+ break;
+ case SVGA3D_DECLTYPE_FLOAT4:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n");
+ break;
+ case SVGA3D_DECLTYPE_D3DCOLOR:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n");
+ break;
+ case SVGA3D_DECLTYPE_UBYTE4:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n");
+ break;
+ case SVGA3D_DECLTYPE_SHORT2:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n");
+ break;
+ case SVGA3D_DECLTYPE_SHORT4:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n");
+ break;
+ case SVGA3D_DECLTYPE_UBYTE4N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n");
+ break;
+ case SVGA3D_DECLTYPE_SHORT2N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n");
+ break;
+ case SVGA3D_DECLTYPE_SHORT4N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n");
+ break;
+ case SVGA3D_DECLTYPE_USHORT2N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n");
+ break;
+ case SVGA3D_DECLTYPE_USHORT4N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n");
+ break;
+ case SVGA3D_DECLTYPE_UDEC3:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n");
+ break;
+ case SVGA3D_DECLTYPE_DEC3N:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n");
+ break;
+ case SVGA3D_DECLTYPE_FLOAT16_2:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n");
+ break;
+ case SVGA3D_DECLTYPE_FLOAT16_4:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n");
+ break;
+ case SVGA3D_DECLTYPE_MAX:
+ debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type);
+ break;
+ }
+ switch((*cmd).identity.method) {
+ case SVGA3D_DECLMETHOD_DEFAULT:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n");
+ break;
+ case SVGA3D_DECLMETHOD_PARTIALU:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n");
+ break;
+ case SVGA3D_DECLMETHOD_PARTIALV:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n");
+ break;
+ case SVGA3D_DECLMETHOD_CROSSUV:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n");
+ break;
+ case SVGA3D_DECLMETHOD_UV:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n");
+ break;
+ case SVGA3D_DECLMETHOD_LOOKUP:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n");
+ break;
+ case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
+ debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n");
+ break;
+ default:
+ debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method);
+ break;
+ }
+ switch((*cmd).identity.usage) {
+ case SVGA3D_DECLUSAGE_POSITION:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n");
+ break;
+ case SVGA3D_DECLUSAGE_BLENDWEIGHT:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n");
+ break;
+ case SVGA3D_DECLUSAGE_BLENDINDICES:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n");
+ break;
+ case SVGA3D_DECLUSAGE_NORMAL:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n");
+ break;
+ case SVGA3D_DECLUSAGE_PSIZE:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n");
+ break;
+ case SVGA3D_DECLUSAGE_TEXCOORD:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n");
+ break;
+ case SVGA3D_DECLUSAGE_TANGENT:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n");
+ break;
+ case SVGA3D_DECLUSAGE_BINORMAL:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n");
+ break;
+ case SVGA3D_DECLUSAGE_TESSFACTOR:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n");
+ break;
+ case SVGA3D_DECLUSAGE_POSITIONT:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n");
+ break;
+ case SVGA3D_DECLUSAGE_COLOR:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n");
+ break;
+ case SVGA3D_DECLUSAGE_FOG:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n");
+ break;
+ case SVGA3D_DECLUSAGE_DEPTH:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n");
+ break;
+ case SVGA3D_DECLUSAGE_SAMPLE:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n");
+ break;
+ case SVGA3D_DECLUSAGE_MAX:
+ debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage);
+ break;
+ }
+ debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex);
+ debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId);
+ debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset);
+ debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride);
+ debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first);
+ debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last);
+}
+
+static void
+dump_SVGA3dTextureState(const SVGA3dTextureState *cmd)
+{
+ debug_printf("\t\t.stage = %u\n", (*cmd).stage);
+ switch((*cmd).name) {
+ case SVGA3D_TS_INVALID:
+ debug_printf("\t\t.name = SVGA3D_TS_INVALID\n");
+ break;
+ case SVGA3D_TS_BIND_TEXTURE:
+ debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n");
+ break;
+ case SVGA3D_TS_COLOROP:
+ debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n");
+ break;
+ case SVGA3D_TS_COLORARG1:
+ debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n");
+ break;
+ case SVGA3D_TS_COLORARG2:
+ debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n");
+ break;
+ case SVGA3D_TS_ALPHAOP:
+ debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n");
+ break;
+ case SVGA3D_TS_ALPHAARG1:
+ debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n");
+ break;
+ case SVGA3D_TS_ALPHAARG2:
+ debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n");
+ break;
+ case SVGA3D_TS_ADDRESSU:
+ debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n");
+ break;
+ case SVGA3D_TS_ADDRESSV:
+ debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n");
+ break;
+ case SVGA3D_TS_MIPFILTER:
+ debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n");
+ break;
+ case SVGA3D_TS_MAGFILTER:
+ debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n");
+ break;
+ case SVGA3D_TS_MINFILTER:
+ debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n");
+ break;
+ case SVGA3D_TS_BORDERCOLOR:
+ debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n");
+ break;
+ case SVGA3D_TS_TEXCOORDINDEX:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n");
+ break;
+ case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n");
+ break;
+ case SVGA3D_TS_TEXCOORDGEN:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n");
+ break;
+ case SVGA3D_TS_BUMPENVMAT00:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n");
+ break;
+ case SVGA3D_TS_BUMPENVMAT01:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n");
+ break;
+ case SVGA3D_TS_BUMPENVMAT10:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n");
+ break;
+ case SVGA3D_TS_BUMPENVMAT11:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n");
+ break;
+ case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n");
+ break;
+ case SVGA3D_TS_TEXTURE_LOD_BIAS:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n");
+ break;
+ case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
+ debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n");
+ break;
+ case SVGA3D_TS_ADDRESSW:
+ debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n");
+ break;
+ case SVGA3D_TS_GAMMA:
+ debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n");
+ break;
+ case SVGA3D_TS_BUMPENVLSCALE:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n");
+ break;
+ case SVGA3D_TS_BUMPENVLOFFSET:
+ debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n");
+ break;
+ case SVGA3D_TS_COLORARG0:
+ debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n");
+ break;
+ case SVGA3D_TS_ALPHAARG0:
+ debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n");
+ break;
+ case SVGA3D_TS_MAX:
+ debug_printf("\t\t.name = SVGA3D_TS_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.name = %i\n", (*cmd).name);
+ break;
+ }
+ debug_printf("\t\t.value = %u\n", (*cmd).value);
+ debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
+}
+
+static void
+dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd)
+{
+ debug_printf("\t\t.x = %u\n", (*cmd).x);
+ debug_printf("\t\t.y = %u\n", (*cmd).y);
+ debug_printf("\t\t.z = %u\n", (*cmd).z);
+ debug_printf("\t\t.w = %u\n", (*cmd).w);
+ debug_printf("\t\t.h = %u\n", (*cmd).h);
+ debug_printf("\t\t.d = %u\n", (*cmd).d);
+ debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
+ debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
+ debug_printf("\t\t.srcz = %u\n", (*cmd).srcz);
+}
+
+static void
+dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.index = %u\n", (*cmd).index);
+ debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]);
+ debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]);
+ debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]);
+ debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]);
+}
+
+static void
+dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_QUERYTYPE_OCCLUSION:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ break;
+ case SVGA3D_QUERYTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+ debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
+ debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
+}
+
+static void
+dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_RT_DEPTH:
+ debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n");
+ break;
+ case SVGA3D_RT_STENCIL:
+ debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n");
+ break;
+ default:
+ debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0);
+ break;
+ }
+ debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid);
+ debug_printf("\t\t.target.face = %u\n", (*cmd).target.face);
+ debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap);
+}
+
+static void
+dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+}
+
+static void
+dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd)
+{
+ debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
+ debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
+ debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
+ debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
+ debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
+ debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
+}
+
+static void
+dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).face) {
+ case SVGA3D_FACE_INVALID:
+ debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n");
+ break;
+ case SVGA3D_FACE_NONE:
+ debug_printf("\t\t.face = SVGA3D_FACE_NONE\n");
+ break;
+ case SVGA3D_FACE_FRONT:
+ debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n");
+ break;
+ case SVGA3D_FACE_BACK:
+ debug_printf("\t\t.face = SVGA3D_FACE_BACK\n");
+ break;
+ case SVGA3D_FACE_FRONT_BACK:
+ debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n");
+ break;
+ case SVGA3D_FACE_MAX:
+ debug_printf("\t\t.face = SVGA3D_FACE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.face = %i\n", (*cmd).face);
+ break;
+ }
+ debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]);
+ debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]);
+ debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]);
+ debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]);
+ debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]);
+ debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]);
+ debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]);
+ debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]);
+ debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]);
+ debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]);
+ debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]);
+ debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]);
+ debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]);
+ debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]);
+ debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]);
+ debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]);
+ debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess);
+}
+
+static void
+dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.index = %u\n", (*cmd).index);
+ switch((*cmd).data.type) {
+ case SVGA3D_LIGHTTYPE_INVALID:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n");
+ break;
+ case SVGA3D_LIGHTTYPE_POINT:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n");
+ break;
+ case SVGA3D_LIGHTTYPE_SPOT1:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n");
+ break;
+ case SVGA3D_LIGHTTYPE_SPOT2:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n");
+ break;
+ case SVGA3D_LIGHTTYPE_DIRECTIONAL:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n");
+ break;
+ case SVGA3D_LIGHTTYPE_MAX:
+ debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.data.type = %i\n", (*cmd).data.type);
+ break;
+ }
+ debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace);
+ debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]);
+ debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]);
+ debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]);
+ debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]);
+ debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]);
+ debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]);
+ debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]);
+ debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]);
+ debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]);
+ debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]);
+ debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]);
+ debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]);
+ debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]);
+ debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]);
+ debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]);
+ debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]);
+ debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]);
+ debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]);
+ debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]);
+ debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]);
+ debug_printf("\t\t.data.range = %f\n", (*cmd).data.range);
+ debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff);
+ debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0);
+ debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1);
+ debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2);
+ debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta);
+ debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi);
+}
+
+static void
+dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
+ debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
+ debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
+ debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
+}
+
+static void
+dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x);
+ debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y);
+ debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w);
+ debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h);
+}
+
+static void
+dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd)
+{
+ debug_printf("\t\t.x = %u\n", (*cmd).x);
+ debug_printf("\t\t.y = %u\n", (*cmd).y);
+ debug_printf("\t\t.w = %u\n", (*cmd).w);
+ debug_printf("\t\t.h = %u\n", (*cmd).h);
+ debug_printf("\t\t.srcx = %u\n", (*cmd).srcx);
+ debug_printf("\t\t.srcy = %u\n", (*cmd).srcy);
+}
+
+static void
+dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_SHADERTYPE_COMPILED_DX8:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ break;
+ case SVGA3D_SHADERTYPE_VS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ break;
+ case SVGA3D_SHADERTYPE_PS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ break;
+ case SVGA3D_SHADERTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+ debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+}
+
+static void
+dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_QUERYTYPE_OCCLUSION:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ break;
+ case SVGA3D_QUERYTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+ debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId);
+ debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset);
+}
+
+static void
+dump_SVGA3dSize(const SVGA3dSize *cmd)
+{
+ debug_printf("\t\t.width = %u\n", (*cmd).width);
+ debug_printf("\t\t.height = %u\n", (*cmd).height);
+ debug_printf("\t\t.depth = %u\n", (*cmd).depth);
+}
+
+static void
+dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd)
+{
+ debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+}
+
+static void
+dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+}
+
+static void
+dump_SVGA3dRect(const SVGA3dRect *cmd)
+{
+ debug_printf("\t\t.x = %u\n", (*cmd).x);
+ debug_printf("\t\t.y = %u\n", (*cmd).y);
+ debug_printf("\t\t.w = %u\n", (*cmd).w);
+ debug_printf("\t\t.h = %u\n", (*cmd).h);
+}
+
+static void
+dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_QUERYTYPE_OCCLUSION:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n");
+ break;
+ case SVGA3D_QUERYTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dRenderState(const SVGA3dRenderState *cmd)
+{
+ switch((*cmd).state) {
+ case SVGA3D_RS_INVALID:
+ debug_printf("\t\t.state = SVGA3D_RS_INVALID\n");
+ break;
+ case SVGA3D_RS_ZENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n");
+ break;
+ case SVGA3D_RS_ZWRITEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n");
+ break;
+ case SVGA3D_RS_ALPHATESTENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n");
+ break;
+ case SVGA3D_RS_DITHERENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n");
+ break;
+ case SVGA3D_RS_BLENDENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n");
+ break;
+ case SVGA3D_RS_FOGENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n");
+ break;
+ case SVGA3D_RS_SPECULARENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n");
+ break;
+ case SVGA3D_RS_STENCILENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n");
+ break;
+ case SVGA3D_RS_LIGHTINGENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n");
+ break;
+ case SVGA3D_RS_NORMALIZENORMALS:
+ debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n");
+ break;
+ case SVGA3D_RS_POINTSPRITEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n");
+ break;
+ case SVGA3D_RS_POINTSCALEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n");
+ break;
+ case SVGA3D_RS_STENCILREF:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n");
+ break;
+ case SVGA3D_RS_STENCILMASK:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n");
+ break;
+ case SVGA3D_RS_STENCILWRITEMASK:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n");
+ break;
+ case SVGA3D_RS_FOGSTART:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n");
+ break;
+ case SVGA3D_RS_FOGEND:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n");
+ break;
+ case SVGA3D_RS_FOGDENSITY:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n");
+ break;
+ case SVGA3D_RS_POINTSIZE:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n");
+ break;
+ case SVGA3D_RS_POINTSIZEMIN:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n");
+ break;
+ case SVGA3D_RS_POINTSIZEMAX:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n");
+ break;
+ case SVGA3D_RS_POINTSCALE_A:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n");
+ break;
+ case SVGA3D_RS_POINTSCALE_B:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n");
+ break;
+ case SVGA3D_RS_POINTSCALE_C:
+ debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n");
+ break;
+ case SVGA3D_RS_FOGCOLOR:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n");
+ break;
+ case SVGA3D_RS_AMBIENT:
+ debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n");
+ break;
+ case SVGA3D_RS_CLIPPLANEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n");
+ break;
+ case SVGA3D_RS_FOGMODE:
+ debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n");
+ break;
+ case SVGA3D_RS_FILLMODE:
+ debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n");
+ break;
+ case SVGA3D_RS_SHADEMODE:
+ debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n");
+ break;
+ case SVGA3D_RS_LINEPATTERN:
+ debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n");
+ break;
+ case SVGA3D_RS_SRCBLEND:
+ debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n");
+ break;
+ case SVGA3D_RS_DSTBLEND:
+ debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n");
+ break;
+ case SVGA3D_RS_BLENDEQUATION:
+ debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n");
+ break;
+ case SVGA3D_RS_CULLMODE:
+ debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n");
+ break;
+ case SVGA3D_RS_ZFUNC:
+ debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n");
+ break;
+ case SVGA3D_RS_ALPHAFUNC:
+ debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n");
+ break;
+ case SVGA3D_RS_STENCILFUNC:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n");
+ break;
+ case SVGA3D_RS_STENCILFAIL:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n");
+ break;
+ case SVGA3D_RS_STENCILZFAIL:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n");
+ break;
+ case SVGA3D_RS_STENCILPASS:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n");
+ break;
+ case SVGA3D_RS_ALPHAREF:
+ debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n");
+ break;
+ case SVGA3D_RS_FRONTWINDING:
+ debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n");
+ break;
+ case SVGA3D_RS_COORDINATETYPE:
+ debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n");
+ break;
+ case SVGA3D_RS_ZBIAS:
+ debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n");
+ break;
+ case SVGA3D_RS_RANGEFOGENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n");
+ break;
+ case SVGA3D_RS_COLORWRITEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n");
+ break;
+ case SVGA3D_RS_VERTEXMATERIALENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n");
+ break;
+ case SVGA3D_RS_DIFFUSEMATERIALSOURCE:
+ debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n");
+ break;
+ case SVGA3D_RS_SPECULARMATERIALSOURCE:
+ debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n");
+ break;
+ case SVGA3D_RS_AMBIENTMATERIALSOURCE:
+ debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n");
+ break;
+ case SVGA3D_RS_EMISSIVEMATERIALSOURCE:
+ debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n");
+ break;
+ case SVGA3D_RS_TEXTUREFACTOR:
+ debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n");
+ break;
+ case SVGA3D_RS_LOCALVIEWER:
+ debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n");
+ break;
+ case SVGA3D_RS_SCISSORTESTENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n");
+ break;
+ case SVGA3D_RS_BLENDCOLOR:
+ debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n");
+ break;
+ case SVGA3D_RS_STENCILENABLE2SIDED:
+ debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n");
+ break;
+ case SVGA3D_RS_CCWSTENCILFUNC:
+ debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n");
+ break;
+ case SVGA3D_RS_CCWSTENCILFAIL:
+ debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n");
+ break;
+ case SVGA3D_RS_CCWSTENCILZFAIL:
+ debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n");
+ break;
+ case SVGA3D_RS_CCWSTENCILPASS:
+ debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n");
+ break;
+ case SVGA3D_RS_VERTEXBLEND:
+ debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n");
+ break;
+ case SVGA3D_RS_SLOPESCALEDEPTHBIAS:
+ debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n");
+ break;
+ case SVGA3D_RS_DEPTHBIAS:
+ debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n");
+ break;
+ case SVGA3D_RS_OUTPUTGAMMA:
+ debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n");
+ break;
+ case SVGA3D_RS_ZVISIBLE:
+ debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n");
+ break;
+ case SVGA3D_RS_LASTPIXEL:
+ debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n");
+ break;
+ case SVGA3D_RS_CLIPPING:
+ debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n");
+ break;
+ case SVGA3D_RS_WRAP0:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n");
+ break;
+ case SVGA3D_RS_WRAP1:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n");
+ break;
+ case SVGA3D_RS_WRAP2:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n");
+ break;
+ case SVGA3D_RS_WRAP3:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n");
+ break;
+ case SVGA3D_RS_WRAP4:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n");
+ break;
+ case SVGA3D_RS_WRAP5:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n");
+ break;
+ case SVGA3D_RS_WRAP6:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n");
+ break;
+ case SVGA3D_RS_WRAP7:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n");
+ break;
+ case SVGA3D_RS_WRAP8:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n");
+ break;
+ case SVGA3D_RS_WRAP9:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n");
+ break;
+ case SVGA3D_RS_WRAP10:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n");
+ break;
+ case SVGA3D_RS_WRAP11:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n");
+ break;
+ case SVGA3D_RS_WRAP12:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n");
+ break;
+ case SVGA3D_RS_WRAP13:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n");
+ break;
+ case SVGA3D_RS_WRAP14:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n");
+ break;
+ case SVGA3D_RS_WRAP15:
+ debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n");
+ break;
+ case SVGA3D_RS_MULTISAMPLEANTIALIAS:
+ debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n");
+ break;
+ case SVGA3D_RS_MULTISAMPLEMASK:
+ debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n");
+ break;
+ case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n");
+ break;
+ case SVGA3D_RS_TWEENFACTOR:
+ debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n");
+ break;
+ case SVGA3D_RS_ANTIALIASEDLINEENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n");
+ break;
+ case SVGA3D_RS_COLORWRITEENABLE1:
+ debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n");
+ break;
+ case SVGA3D_RS_COLORWRITEENABLE2:
+ debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n");
+ break;
+ case SVGA3D_RS_COLORWRITEENABLE3:
+ debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n");
+ break;
+ case SVGA3D_RS_SEPARATEALPHABLENDENABLE:
+ debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n");
+ break;
+ case SVGA3D_RS_SRCBLENDALPHA:
+ debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n");
+ break;
+ case SVGA3D_RS_DSTBLENDALPHA:
+ debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n");
+ break;
+ case SVGA3D_RS_BLENDEQUATIONALPHA:
+ debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n");
+ break;
+ case SVGA3D_RS_MAX:
+ debug_printf("\t\t.state = SVGA3D_RS_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.state = %i\n", (*cmd).state);
+ break;
+ }
+ debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue);
+ debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue);
+}
+
+static void
+dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd)
+{
+ debug_printf("\t\t.value = %u\n", (*cmd).value);
+ debug_printf("\t\t.count = %u\n", (*cmd).count);
+ debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData);
+ debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData);
+}
+
+static void
+dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+ switch((*cmd).type) {
+ case SVGA3D_SHADERTYPE_COMPILED_DX8:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ break;
+ case SVGA3D_SHADERTYPE_VS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ break;
+ case SVGA3D_SHADERTYPE_PS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ break;
+ case SVGA3D_SHADERTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.reg = %u\n", (*cmd).reg);
+ switch((*cmd).type) {
+ case SVGA3D_SHADERTYPE_COMPILED_DX8:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ break;
+ case SVGA3D_SHADERTYPE_VS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ break;
+ case SVGA3D_SHADERTYPE_PS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ break;
+ case SVGA3D_SHADERTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+ switch((*cmd).ctype) {
+ case SVGA3D_CONST_TYPE_FLOAT:
+ debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n");
+ debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]);
+ debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]);
+ debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]);
+ debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]);
+ break;
+ case SVGA3D_CONST_TYPE_INT:
+ debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n");
+ debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ break;
+ case SVGA3D_CONST_TYPE_BOOL:
+ debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n");
+ debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ break;
+ default:
+ debug_printf("\t\t.ctype = %i\n", (*cmd).ctype);
+ debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]);
+ debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]);
+ debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]);
+ debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min);
+ debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max);
+}
+
+static void
+dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls);
+ debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges);
+}
+
+static void
+dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.index = %u\n", (*cmd).index);
+ debug_printf("\t\t.enabled = %u\n", (*cmd).enabled);
+}
+
+static void
+dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd)
+{
+ switch((*cmd).primType) {
+ case SVGA3D_PRIMITIVE_INVALID:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n");
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLELIST:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n");
+ break;
+ case SVGA3D_PRIMITIVE_POINTLIST:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n");
+ break;
+ case SVGA3D_PRIMITIVE_LINELIST:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n");
+ break;
+ case SVGA3D_PRIMITIVE_LINESTRIP:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n");
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n");
+ break;
+ case SVGA3D_PRIMITIVE_TRIANGLEFAN:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n");
+ break;
+ case SVGA3D_PRIMITIVE_MAX:
+ debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.primType = %i\n", (*cmd).primType);
+ break;
+ }
+ debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount);
+ debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId);
+ debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset);
+ debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride);
+ debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth);
+ debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias);
+}
+
+static void
+dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd)
+{
+ debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+}
+
+static void
+dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+}
+
+static void
+dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd)
+{
+ debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid);
+ debug_printf("\t\t.src.face = %u\n", (*cmd).src.face);
+ debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap);
+ debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid);
+ debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face);
+ debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap);
+ debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x);
+ debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y);
+ debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z);
+ debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w);
+ debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h);
+ debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d);
+ debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x);
+ debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y);
+ debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z);
+ debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w);
+ debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h);
+ debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d);
+ switch((*cmd).mode) {
+ case SVGA3D_STRETCH_BLT_POINT:
+ debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n");
+ break;
+ case SVGA3D_STRETCH_BLT_LINEAR:
+ debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n");
+ break;
+ case SVGA3D_STRETCH_BLT_MAX:
+ debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.mode = %i\n", (*cmd).mode);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd)
+{
+ debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId);
+ debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset);
+ debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch);
+ debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid);
+ debug_printf("\t\t.host.face = %u\n", (*cmd).host.face);
+ debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap);
+ switch((*cmd).transfer) {
+ case SVGA3D_WRITE_HOST_VRAM:
+ debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n");
+ break;
+ case SVGA3D_READ_HOST_VRAM:
+ debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n");
+ break;
+ default:
+ debug_printf("\t\t.transfer = %i\n", (*cmd).transfer);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd)
+{
+ debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize);
+ debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset);
+ debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard);
+ debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized);
+}
+
+static void
+dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).type) {
+ case SVGA3D_TRANSFORM_INVALID:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n");
+ break;
+ case SVGA3D_TRANSFORM_WORLD:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n");
+ break;
+ case SVGA3D_TRANSFORM_VIEW:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n");
+ break;
+ case SVGA3D_TRANSFORM_PROJECTION:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE0:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE1:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE2:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE3:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE4:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE5:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE6:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n");
+ break;
+ case SVGA3D_TRANSFORM_TEXTURE7:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n");
+ break;
+ case SVGA3D_TRANSFORM_WORLD1:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n");
+ break;
+ case SVGA3D_TRANSFORM_WORLD2:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n");
+ break;
+ case SVGA3D_TRANSFORM_WORLD3:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n");
+ break;
+ case SVGA3D_TRANSFORM_MAX:
+ debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+ debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]);
+ debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]);
+ debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]);
+ debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]);
+ debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]);
+ debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]);
+ debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]);
+ debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]);
+ debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]);
+ debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]);
+ debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]);
+ debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]);
+ debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]);
+ debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]);
+ debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]);
+ debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]);
+}
+
+static void
+dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ debug_printf("\t\t.shid = %u\n", (*cmd).shid);
+ switch((*cmd).type) {
+ case SVGA3D_SHADERTYPE_COMPILED_DX8:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n");
+ break;
+ case SVGA3D_SHADERTYPE_VS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n");
+ break;
+ case SVGA3D_SHADERTYPE_PS:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n");
+ break;
+ case SVGA3D_SHADERTYPE_MAX:
+ debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.type = %i\n", (*cmd).type);
+ break;
+ }
+}
+
+static void
+dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+}
+
+static void
+dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd)
+{
+ debug_printf("\t\t.cid = %u\n", (*cmd).cid);
+ switch((*cmd).clearFlag) {
+ case SVGA3D_CLEAR_COLOR:
+ debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n");
+ break;
+ case SVGA3D_CLEAR_DEPTH:
+ debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n");
+ break;
+ case SVGA3D_CLEAR_STENCIL:
+ debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n");
+ break;
+ default:
+ debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag);
+ break;
+ }
+ debug_printf("\t\t.color = %u\n", (*cmd).color);
+ debug_printf("\t\t.depth = %f\n", (*cmd).depth);
+ debug_printf("\t\t.stencil = %u\n", (*cmd).stencil);
+}
+
+static void
+dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd)
+{
+ debug_printf("\t\t.sid = %u\n", (*cmd).sid);
+ switch((*cmd).surfaceFlags) {
+ case SVGA3D_SURFACE_CUBEMAP:
+ debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n");
+ break;
+ case SVGA3D_SURFACE_HINT_STATIC:
+ debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n");
+ break;
+ case SVGA3D_SURFACE_HINT_DYNAMIC:
+ debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n");
+ break;
+ case SVGA3D_SURFACE_HINT_INDEXBUFFER:
+ debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n");
+ break;
+ case SVGA3D_SURFACE_HINT_VERTEXBUFFER:
+ debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n");
+ break;
+ default:
+ debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags);
+ break;
+ }
+ switch((*cmd).format) {
+ case SVGA3D_FORMAT_INVALID:
+ debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n");
+ break;
+ case SVGA3D_X8R8G8B8:
+ debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n");
+ break;
+ case SVGA3D_A8R8G8B8:
+ debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n");
+ break;
+ case SVGA3D_R5G6B5:
+ debug_printf("\t\t.format = SVGA3D_R5G6B5\n");
+ break;
+ case SVGA3D_X1R5G5B5:
+ debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n");
+ break;
+ case SVGA3D_A1R5G5B5:
+ debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n");
+ break;
+ case SVGA3D_A4R4G4B4:
+ debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n");
+ break;
+ case SVGA3D_Z_D32:
+ debug_printf("\t\t.format = SVGA3D_Z_D32\n");
+ break;
+ case SVGA3D_Z_D16:
+ debug_printf("\t\t.format = SVGA3D_Z_D16\n");
+ break;
+ case SVGA3D_Z_D24S8:
+ debug_printf("\t\t.format = SVGA3D_Z_D24S8\n");
+ break;
+ case SVGA3D_Z_D15S1:
+ debug_printf("\t\t.format = SVGA3D_Z_D15S1\n");
+ break;
+ case SVGA3D_LUMINANCE8:
+ debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n");
+ break;
+ case SVGA3D_LUMINANCE4_ALPHA4:
+ debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n");
+ break;
+ case SVGA3D_LUMINANCE16:
+ debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n");
+ break;
+ case SVGA3D_LUMINANCE8_ALPHA8:
+ debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n");
+ break;
+ case SVGA3D_DXT1:
+ debug_printf("\t\t.format = SVGA3D_DXT1\n");
+ break;
+ case SVGA3D_DXT2:
+ debug_printf("\t\t.format = SVGA3D_DXT2\n");
+ break;
+ case SVGA3D_DXT3:
+ debug_printf("\t\t.format = SVGA3D_DXT3\n");
+ break;
+ case SVGA3D_DXT4:
+ debug_printf("\t\t.format = SVGA3D_DXT4\n");
+ break;
+ case SVGA3D_DXT5:
+ debug_printf("\t\t.format = SVGA3D_DXT5\n");
+ break;
+ case SVGA3D_BUMPU8V8:
+ debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n");
+ break;
+ case SVGA3D_BUMPL6V5U5:
+ debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n");
+ break;
+ case SVGA3D_BUMPX8L8V8U8:
+ debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n");
+ break;
+ case SVGA3D_BUMPL8V8U8:
+ debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n");
+ break;
+ case SVGA3D_ARGB_S10E5:
+ debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n");
+ break;
+ case SVGA3D_ARGB_S23E8:
+ debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n");
+ break;
+ case SVGA3D_A2R10G10B10:
+ debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n");
+ break;
+ case SVGA3D_V8U8:
+ debug_printf("\t\t.format = SVGA3D_V8U8\n");
+ break;
+ case SVGA3D_Q8W8V8U8:
+ debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n");
+ break;
+ case SVGA3D_CxV8U8:
+ debug_printf("\t\t.format = SVGA3D_CxV8U8\n");
+ break;
+ case SVGA3D_X8L8V8U8:
+ debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n");
+ break;
+ case SVGA3D_A2W10V10U10:
+ debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n");
+ break;
+ case SVGA3D_ALPHA8:
+ debug_printf("\t\t.format = SVGA3D_ALPHA8\n");
+ break;
+ case SVGA3D_R_S10E5:
+ debug_printf("\t\t.format = SVGA3D_R_S10E5\n");
+ break;
+ case SVGA3D_R_S23E8:
+ debug_printf("\t\t.format = SVGA3D_R_S23E8\n");
+ break;
+ case SVGA3D_RG_S10E5:
+ debug_printf("\t\t.format = SVGA3D_RG_S10E5\n");
+ break;
+ case SVGA3D_RG_S23E8:
+ debug_printf("\t\t.format = SVGA3D_RG_S23E8\n");
+ break;
+ case SVGA3D_BUFFER:
+ debug_printf("\t\t.format = SVGA3D_BUFFER\n");
+ break;
+ case SVGA3D_Z_D24X8:
+ debug_printf("\t\t.format = SVGA3D_Z_D24X8\n");
+ break;
+ case SVGA3D_FORMAT_MAX:
+ debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n");
+ break;
+ default:
+ debug_printf("\t\t.format = %i\n", (*cmd).format);
+ break;
+ }
+ debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels);
+ debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels);
+ debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels);
+ debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels);
+ debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels);
+ debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels);
+}
+
+
+void
+svga_dump_commands(const void *commands, uint32_t size)
+{
+ const uint8_t *next = commands;
+ const uint8_t *last = next + size;
+
+ assert(size % sizeof(uint32_t) == 0);
+
+ while(next < last) {
+ const uint32_t cmd_id = *(const uint32_t *)next;
+
+ if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
+ const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
+ const uint8_t *body = (const uint8_t *)&header[1];
+
+ next = (const uint8_t *)body + header->size;
+ if(next > last)
+ break;
+
+ switch(cmd_id) {
+ case SVGA_3D_CMD_SURFACE_DEFINE:
+ debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n");
+ {
+ const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body;
+ dump_SVGA3dCmdDefineSurface(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dSize) <= next) {
+ dump_SVGA3dSize((const SVGA3dSize *)body);
+ body += sizeof(SVGA3dSize);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SURFACE_DESTROY:
+ debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n");
+ {
+ const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body;
+ dump_SVGA3dCmdDestroySurface(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SURFACE_COPY:
+ debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n");
+ {
+ const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body;
+ dump_SVGA3dCmdSurfaceCopy(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dCopyBox) <= next) {
+ dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body);
+ body += sizeof(SVGA3dCopyBox);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SURFACE_STRETCHBLT:
+ debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n");
+ {
+ const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body;
+ dump_SVGA3dCmdSurfaceStretchBlt(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SURFACE_DMA:
+ debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n");
+ {
+ const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body;
+ dump_SVGA3dCmdSurfaceDMA(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dCopyBox) <= next) {
+ dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body);
+ body += sizeof(SVGA3dCopyBox);
+ }
+ while(body + sizeof(SVGA3dCmdSurfaceDMASuffix) <= next) {
+ dump_SVGA3dCmdSurfaceDMASuffix((const SVGA3dCmdSurfaceDMASuffix *)body);
+ body += sizeof(SVGA3dCmdSurfaceDMASuffix);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_CONTEXT_DEFINE:
+ debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n");
+ {
+ const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body;
+ dump_SVGA3dCmdDefineContext(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_CONTEXT_DESTROY:
+ debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n");
+ {
+ const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body;
+ dump_SVGA3dCmdDestroyContext(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETTRANSFORM:
+ debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n");
+ {
+ const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body;
+ dump_SVGA3dCmdSetTransform(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETZRANGE:
+ debug_printf("\tSVGA_3D_CMD_SETZRANGE\n");
+ {
+ const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body;
+ dump_SVGA3dCmdSetZRange(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETRENDERSTATE:
+ debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n");
+ {
+ const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body;
+ dump_SVGA3dCmdSetRenderState(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dRenderState) <= next) {
+ dump_SVGA3dRenderState((const SVGA3dRenderState *)body);
+ body += sizeof(SVGA3dRenderState);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SETRENDERTARGET:
+ debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n");
+ {
+ const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body;
+ dump_SVGA3dCmdSetRenderTarget(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETTEXTURESTATE:
+ debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n");
+ {
+ const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body;
+ dump_SVGA3dCmdSetTextureState(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dTextureState) <= next) {
+ dump_SVGA3dTextureState((const SVGA3dTextureState *)body);
+ body += sizeof(SVGA3dTextureState);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SETMATERIAL:
+ debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n");
+ {
+ const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body;
+ dump_SVGA3dCmdSetMaterial(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETLIGHTDATA:
+ debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n");
+ {
+ const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body;
+ dump_SVGA3dCmdSetLightData(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETLIGHTENABLED:
+ debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n");
+ {
+ const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body;
+ dump_SVGA3dCmdSetLightEnabled(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETVIEWPORT:
+ debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n");
+ {
+ const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body;
+ dump_SVGA3dCmdSetViewport(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SETCLIPPLANE:
+ debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n");
+ {
+ const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body;
+ dump_SVGA3dCmdSetClipPlane(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_CLEAR:
+ debug_printf("\tSVGA_3D_CMD_CLEAR\n");
+ {
+ const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body;
+ dump_SVGA3dCmdClear(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dRect) <= next) {
+ dump_SVGA3dRect((const SVGA3dRect *)body);
+ body += sizeof(SVGA3dRect);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_PRESENT:
+ debug_printf("\tSVGA_3D_CMD_PRESENT\n");
+ {
+ const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body;
+ dump_SVGA3dCmdPresent(cmd);
+ body = (const uint8_t *)&cmd[1];
+ while(body + sizeof(SVGA3dCopyRect) <= next) {
+ dump_SVGA3dCopyRect((const SVGA3dCopyRect *)body);
+ body += sizeof(SVGA3dCopyRect);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SHADER_DEFINE:
+ debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n");
+ {
+ const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body;
+ dump_SVGA3dCmdDefineShader(cmd);
+ body = (const uint8_t *)&cmd[1];
+ sh_svga_dump((const uint32_t *)body,
+ (unsigned)(next - body)/sizeof(uint32_t),
+ FALSE );
+ body = next;
+ }
+ break;
+ case SVGA_3D_CMD_SHADER_DESTROY:
+ debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n");
+ {
+ const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body;
+ dump_SVGA3dCmdDestroyShader(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SET_SHADER:
+ debug_printf("\tSVGA_3D_CMD_SET_SHADER\n");
+ {
+ const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body;
+ dump_SVGA3dCmdSetShader(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_SET_SHADER_CONST:
+ debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n");
+ {
+ const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body;
+ dump_SVGA3dCmdSetShaderConst(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_DRAW_PRIMITIVES:
+ debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n");
+ {
+ const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body;
+ unsigned i, j;
+ dump_SVGA3dCmdDrawPrimitives(cmd);
+ body = (const uint8_t *)&cmd[1];
+ for(i = 0; i < cmd->numVertexDecls; ++i) {
+ dump_SVGA3dVertexDecl((const SVGA3dVertexDecl *)body);
+ body += sizeof(SVGA3dVertexDecl);
+ }
+ for(j = 0; j < cmd->numRanges; ++j) {
+ dump_SVGA3dPrimitiveRange((const SVGA3dPrimitiveRange *)body);
+ body += sizeof(SVGA3dPrimitiveRange);
+ }
+ while(body + sizeof(SVGA3dVertexDivisor) <= next) {
+ dump_SVGA3dVertexDivisor((const SVGA3dVertexDivisor *)body);
+ body += sizeof(SVGA3dVertexDivisor);
+ }
+ }
+ break;
+ case SVGA_3D_CMD_SETSCISSORRECT:
+ debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n");
+ {
+ const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body;
+ dump_SVGA3dCmdSetScissorRect(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_BEGIN_QUERY:
+ debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n");
+ {
+ const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body;
+ dump_SVGA3dCmdBeginQuery(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_END_QUERY:
+ debug_printf("\tSVGA_3D_CMD_END_QUERY\n");
+ {
+ const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body;
+ dump_SVGA3dCmdEndQuery(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ case SVGA_3D_CMD_WAIT_FOR_QUERY:
+ debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n");
+ {
+ const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body;
+ dump_SVGA3dCmdWaitForQuery(cmd);
+ body = (const uint8_t *)&cmd[1];
+ }
+ break;
+ default:
+ debug_printf("\t0x%08x\n", cmd_id);
+ break;
+ }
+
+ while(body + sizeof(uint32_t) <= next) {
+ debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
+ body += sizeof(uint32_t);
+ }
+ while(body + sizeof(uint32_t) <= next)
+ debug_printf("\t\t0x%02x\n", *body++);
+ }
+ else if(cmd_id == SVGA_CMD_FENCE) {
+ debug_printf("\tSVGA_CMD_FENCE\n");
+ debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
+ next += 2*sizeof(uint32_t);
+ }
+ else {
+ debug_printf("\t0x%08x\n", cmd_id);
+ next += sizeof(uint32_t);
+ }
+ }
+}
+
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.h b/src/gallium/drivers/svga/svgadump/svga_dump.h
new file mode 100644
index 0000000000..69a8702087
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.h
@@ -0,0 +1,34 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#ifndef SVGA_DUMP_H_
+#define SVGA_DUMP_H_
+
+#include "pipe/p_compiler.h"
+
+void
+svga_dump_commands(const void *commands, uint32_t size);
+
+#endif /* SVGA_DUMP_H_ */
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py
new file mode 100755
index 0000000000..3cb29c395b
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.py
@@ -0,0 +1,329 @@
+#!/usr/bin/env python
+'''
+Generates dumper for the SVGA 3D command stream using pygccxml.
+
+Jose Fonseca
+'''
+
+copyright = '''
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+ '''
+
+import os
+import sys
+
+from pygccxml import parser
+from pygccxml import declarations
+
+from pygccxml.declarations import algorithm
+from pygccxml.declarations import decl_visitor
+from pygccxml.declarations import type_traits
+from pygccxml.declarations import type_visitor
+
+
+enums = True
+
+
+class decl_dumper_t(decl_visitor.decl_visitor_t):
+
+ def __init__(self, instance = '', decl = None):
+ decl_visitor.decl_visitor_t.__init__(self)
+ self._instance = instance
+ self.decl = decl
+
+ def clone(self):
+ return decl_dumper_t(self._instance, self.decl)
+
+ def visit_class(self):
+ class_ = self.decl
+ assert self.decl.class_type in ('struct', 'union')
+
+ for variable in class_.variables():
+ if variable.name != '':
+ #print 'variable = %r' % variable.name
+ dump_type(self._instance + '.' + variable.name, variable.type)
+
+ def visit_enumeration(self):
+ if enums:
+ print ' switch(%s) {' % ("(*cmd)" + self._instance,)
+ for name, value in self.decl.values:
+ print ' case %s:' % (name,)
+ print ' debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name)
+ print ' break;'
+ print ' default:'
+ print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
+ print ' break;'
+ print ' }'
+ else:
+ print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance)
+
+
+def dump_decl(instance, decl):
+ dumper = decl_dumper_t(instance, decl)
+ algorithm.apply_visitor(dumper, decl)
+
+
+class type_dumper_t(type_visitor.type_visitor_t):
+
+ def __init__(self, instance, type_):
+ type_visitor.type_visitor_t.__init__(self)
+ self.instance = instance
+ self.type = type_
+
+ def clone(self):
+ return type_dumper_t(self.instance, self.type)
+
+ def visit_char(self):
+ self.print_instance('%i')
+
+ def visit_unsigned_char(self):
+ self.print_instance('%u')
+
+ def visit_signed_char(self):
+ self.print_instance('%i')
+
+ def visit_wchar(self):
+ self.print_instance('%i')
+
+ def visit_short_int(self):
+ self.print_instance('%i')
+
+ def visit_short_unsigned_int(self):
+ self.print_instance('%u')
+
+ def visit_bool(self):
+ self.print_instance('%i')
+
+ def visit_int(self):
+ self.print_instance('%i')
+
+ def visit_unsigned_int(self):
+ self.print_instance('%u')
+
+ def visit_long_int(self):
+ self.print_instance('%li')
+
+ def visit_long_unsigned_int(self):
+ self.print_instance('%lu')
+
+ def visit_long_long_int(self):
+ self.print_instance('%lli')
+
+ def visit_long_long_unsigned_int(self):
+ self.print_instance('%llu')
+
+ def visit_float(self):
+ self.print_instance('%f')
+
+ def visit_double(self):
+ self.print_instance('%f')
+
+ def visit_array(self):
+ for i in range(type_traits.array_size(self.type)):
+ dump_type(self.instance + '[%i]' % i, type_traits.base_type(self.type))
+
+ def visit_pointer(self):
+ self.print_instance('%p')
+
+ def visit_declarated(self):
+ #print 'decl = %r' % self.type.decl_string
+ decl = type_traits.remove_declarated(self.type)
+ dump_decl(self.instance, decl)
+
+ def print_instance(self, format):
+ print ' debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance)
+
+
+def dump_type(instance, type_):
+ type_ = type_traits.remove_alias(type_)
+ visitor = type_dumper_t(instance, type_)
+ algorithm.apply_visitor(visitor, type_)
+
+
+def dump_struct(decls, class_):
+ print 'static void'
+ print 'dump_%s(const %s *cmd)' % (class_.name, class_.name)
+ print '{'
+ dump_decl('', class_)
+ print '}'
+ print ''
+
+
+cmds = [
+ ('SVGA_3D_CMD_SURFACE_DEFINE', 'SVGA3dCmdDefineSurface', (), 'SVGA3dSize'),
+ ('SVGA_3D_CMD_SURFACE_DESTROY', 'SVGA3dCmdDestroySurface', (), None),
+ ('SVGA_3D_CMD_SURFACE_COPY', 'SVGA3dCmdSurfaceCopy', (), 'SVGA3dCopyBox'),
+ ('SVGA_3D_CMD_SURFACE_STRETCHBLT', 'SVGA3dCmdSurfaceStretchBlt', (), None),
+ ('SVGA_3D_CMD_SURFACE_DMA', 'SVGA3dCmdSurfaceDMA', (), 'SVGA3dCopyBox'),
+ ('SVGA_3D_CMD_CONTEXT_DEFINE', 'SVGA3dCmdDefineContext', (), None),
+ ('SVGA_3D_CMD_CONTEXT_DESTROY', 'SVGA3dCmdDestroyContext', (), None),
+ ('SVGA_3D_CMD_SETTRANSFORM', 'SVGA3dCmdSetTransform', (), None),
+ ('SVGA_3D_CMD_SETZRANGE', 'SVGA3dCmdSetZRange', (), None),
+ ('SVGA_3D_CMD_SETRENDERSTATE', 'SVGA3dCmdSetRenderState', (), 'SVGA3dRenderState'),
+ ('SVGA_3D_CMD_SETRENDERTARGET', 'SVGA3dCmdSetRenderTarget', (), None),
+ ('SVGA_3D_CMD_SETTEXTURESTATE', 'SVGA3dCmdSetTextureState', (), 'SVGA3dTextureState'),
+ ('SVGA_3D_CMD_SETMATERIAL', 'SVGA3dCmdSetMaterial', (), None),
+ ('SVGA_3D_CMD_SETLIGHTDATA', 'SVGA3dCmdSetLightData', (), None),
+ ('SVGA_3D_CMD_SETLIGHTENABLED', 'SVGA3dCmdSetLightEnabled', (), None),
+ ('SVGA_3D_CMD_SETVIEWPORT', 'SVGA3dCmdSetViewport', (), None),
+ ('SVGA_3D_CMD_SETCLIPPLANE', 'SVGA3dCmdSetClipPlane', (), None),
+ ('SVGA_3D_CMD_CLEAR', 'SVGA3dCmdClear', (), 'SVGA3dRect'),
+ ('SVGA_3D_CMD_PRESENT', 'SVGA3dCmdPresent', (), 'SVGA3dCopyRect'),
+ ('SVGA_3D_CMD_SHADER_DEFINE', 'SVGA3dCmdDefineShader', (), None),
+ ('SVGA_3D_CMD_SHADER_DESTROY', 'SVGA3dCmdDestroyShader', (), None),
+ ('SVGA_3D_CMD_SET_SHADER', 'SVGA3dCmdSetShader', (), None),
+ ('SVGA_3D_CMD_SET_SHADER_CONST', 'SVGA3dCmdSetShaderConst', (), None),
+ ('SVGA_3D_CMD_DRAW_PRIMITIVES', 'SVGA3dCmdDrawPrimitives', (('SVGA3dVertexDecl', 'numVertexDecls'), ('SVGA3dPrimitiveRange', 'numRanges')), 'SVGA3dVertexDivisor'),
+ ('SVGA_3D_CMD_SETSCISSORRECT', 'SVGA3dCmdSetScissorRect', (), None),
+ ('SVGA_3D_CMD_BEGIN_QUERY', 'SVGA3dCmdBeginQuery', (), None),
+ ('SVGA_3D_CMD_END_QUERY', 'SVGA3dCmdEndQuery', (), None),
+ ('SVGA_3D_CMD_WAIT_FOR_QUERY', 'SVGA3dCmdWaitForQuery', (), None),
+ #('SVGA_3D_CMD_PRESENT_READBACK', None, (), None),
+]
+
+def dump_cmds():
+ print r'''
+void
+svga_dump_commands(const void *commands, uint32_t size)
+{
+ const uint8_t *next = commands;
+ const uint8_t *last = next + size;
+
+ assert(size % sizeof(uint32_t) == 0);
+
+ while(next < last) {
+ const uint32_t cmd_id = *(const uint32_t *)next;
+
+ if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
+ const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
+ const uint8_t *body = (const uint8_t *)&header[1];
+
+ next = (const uint8_t *)body + header->size;
+ if(next > last)
+ break;
+'''
+
+ print ' switch(cmd_id) {'
+ indexes = 'ijklmn'
+ for id, header, body, footer in cmds:
+ print ' case %s:' % id
+ print ' debug_printf("\\t%s\\n");' % id
+ print ' {'
+ print ' const %s *cmd = (const %s *)body;' % (header, header)
+ if len(body):
+ print ' unsigned ' + ', '.join(indexes[:len(body)]) + ';'
+ print ' dump_%s(cmd);' % header
+ print ' body = (const uint8_t *)&cmd[1];'
+ for i in range(len(body)):
+ struct, count = body[i]
+ idx = indexes[i]
+ print ' for(%s = 0; %s < cmd->%s; ++%s) {' % (idx, idx, count, idx)
+ print ' dump_%s((const %s *)body);' % (struct, struct)
+ print ' body += sizeof(%s);' % struct
+ print ' }'
+ if footer is not None:
+ print ' while(body + sizeof(%s) <= next) {' % footer
+ print ' dump_%s((const %s *)body);' % (footer, footer)
+ print ' body += sizeof(%s);' % footer
+ print ' }'
+ if id == 'SVGA_3D_CMD_SHADER_DEFINE':
+ print ' sh_svga_dump((const uint32_t *)body, (unsigned)(next - body)/sizeof(uint32_t));'
+ print ' body = next;'
+ print ' }'
+ print ' break;'
+ print ' default:'
+ print ' debug_printf("\\t0x%08x\\n", cmd_id);'
+ print ' break;'
+ print ' }'
+
+ print r'''
+ while(body + sizeof(uint32_t) <= next) {
+ debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
+ body += sizeof(uint32_t);
+ }
+ while(body + sizeof(uint32_t) <= next)
+ debug_printf("\t\t0x%02x\n", *body++);
+ }
+ else if(cmd_id == SVGA_CMD_FENCE) {
+ debug_printf("\tSVGA_CMD_FENCE\n");
+ debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]);
+ next += 2*sizeof(uint32_t);
+ }
+ else {
+ debug_printf("\t0x%08x\n", cmd_id);
+ next += sizeof(uint32_t);
+ }
+ }
+}
+'''
+
+def main():
+ print copyright.strip()
+ print
+ print '/**'
+ print ' * @file'
+ print ' * Dump SVGA commands.'
+ print ' *'
+ print ' * Generated automatically from svga3d_reg.h by svga_dump.py.'
+ print ' */'
+ print
+ print '#include "svga_types.h"'
+ print '#include "shader_dump/st_shader_dump.h"'
+ print '#include "svga3d_reg.h"'
+ print
+ print '#include "pipe/p_debug.h"'
+ print '#include "svga_dump.h"'
+ print
+
+ config = parser.config_t(
+ include_paths = ['include'],
+ compiler = 'gcc',
+ )
+
+ headers = [
+ 'include/svga_types.h',
+ 'include/svga3d_reg.h',
+ ]
+
+ decls = parser.parse(headers, config, parser.COMPILATION_MODE.ALL_AT_ONCE)
+ global_ns = declarations.get_global_namespace(decls)
+
+ names = set()
+ for id, header, body, footer in cmds:
+ names.add(header)
+ for struct, count in body:
+ names.add(struct)
+ if footer is not None:
+ names.add(footer)
+
+ for class_ in global_ns.classes(lambda decl: decl.name in names):
+ dump_struct(decls, class_)
+
+ dump_cmds()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/src/gallium/winsys/drm/vmware/Makefile b/src/gallium/winsys/drm/vmware/Makefile
new file mode 100644
index 0000000000..2ae6dead5c
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/Makefile
@@ -0,0 +1,12 @@
+# src/gallium/winsys/drm/vmware/Makefile
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
+
+default install clean:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) $@) || exit 1; \
+ fi \
+ done
diff --git a/src/gallium/winsys/drm/vmware/SConscript b/src/gallium/winsys/drm/vmware/SConscript
new file mode 100644
index 0000000000..06e6d5be9c
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/SConscript
@@ -0,0 +1,11 @@
+Import('*')
+
+SConscript(['core/SConscript',])
+
+if 'mesa' in env['statetrackers']:
+
+ SConscript(['dri/SConscript'])
+
+if 'xorg' in env['statetrackers']:
+
+ SConscript(['xorg/SConscript'])
diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile
new file mode 100644
index 0000000000..755dc45935
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/Makefile
@@ -0,0 +1,47 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = svgadrm
+
+C_SOURCES = \
+ vmw_buffer.c \
+ vmw_context.c \
+ vmw_fence.c \
+ vmw_screen.c \
+ vmw_screen_dri.c \
+ vmw_screen_ioctl.c \
+ vmw_screen_pools.c \
+ vmw_screen_svga.c \
+ vmw_surface.c
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/src/gallium/drivers/svga \
+ -I$(TOP)/src/gallium/drivers/svga/include \
+ -I$(GALLIUM)/src/mesa/drivers/dri/common \
+ -I$(GALLIUM)/include \
+ -I$(GALLIUM)/include/GL/internal \
+ -I$(GALLIUM)/src/mesa \
+ -I$(GALLIUM)/src/mesa/main \
+ -I$(GALLIUM)/src/mesa/glapi \
+ -I$(GALLIUM)/src/egl/main \
+ -I$(GALLIUM)/src/egl/drivers/dri \
+ $(shell pkg-config libdrm --cflags-only-I)
+
+LIBRARY_DEFINES = \
+ -DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \
+ $(shell pkg-config libdrm --cflags-only-other)
+
+CC = gcc -fvisibility=hidden -msse -msse2
+
+# Set the gnu99 standard to enable anonymous structs in vmware headers.
+#
+CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \
+ $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
+
+include ../../../../Makefile.template
+
+
+symlinks:
+
+
+include depend
diff --git a/src/gallium/winsys/drm/vmware/core/SConscript b/src/gallium/winsys/drm/vmware/core/SConscript
new file mode 100644
index 0000000000..1875b659ac
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/SConscript
@@ -0,0 +1,39 @@
+Import('*')
+
+env = env.Clone()
+
+if env['gcc']:
+ env.Append(CCFLAGS = ['-fvisibility=hidden', '-Werror'])
+ env.Append(CPPDEFINES = [
+ 'HAVE_STDINT_H',
+ 'HAVE_SYS_TYPES_H',
+ '-D_FILE_OFFSET_BITS=64',
+ ])
+
+env.Prepend(CPPPATH = [
+ 'include',
+ '#/src/gallium/drivers/svga',
+ '#/src/gallium/drivers/svga/include',
+])
+
+env.Append(CPPDEFINES = [
+])
+
+sources = [
+ 'vmw_buffer.c',
+ 'vmw_context.c',
+ 'vmw_fence.c',
+ 'vmw_screen.c',
+ 'vmw_screen_dri.c',
+ 'vmw_screen_ioctl.c',
+ 'vmw_screen_pools.c',
+ 'vmw_screen_svga.c',
+ 'vmw_surface.c',
+]
+
+svgadrm = env.ConvenienceLibrary(
+ target = 'svgadrm',
+ source = sources,
+)
+
+Export('svgadrm')
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.c b/src/gallium/winsys/drm/vmware/core/vmw_buffer.c
new file mode 100644
index 0000000000..b812fb59d3
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_buffer.c
@@ -0,0 +1,274 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA buffer manager for Guest Memory Regions (GMRs).
+ *
+ * GMRs are used for pixel and vertex data upload/download to/from the virtual
+ * SVGA hardware. There is a limited number of GMRs available, and
+ * creating/destroying them is also a slow operation so we must suballocate
+ * them.
+ *
+ * This file implements a pipebuffer library's buffer manager, so that we can
+ * use pipepbuffer's suballocation, fencing, and debugging facilities with GMRs.
+ *
+ * @author Jose Fonseca
+ */
+
+
+#include "svga_cmd.h"
+
+#include "pipe/p_inlines.h"
+#include "util/u_memory.h"
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_bufmgr.h"
+
+#include "svga_winsys.h"
+
+#include "vmw_screen.h"
+#include "vmw_buffer.h"
+
+
+struct vmw_gmr_bufmgr;
+
+
+struct vmw_gmr_buffer
+{
+ struct pb_buffer base;
+
+ struct vmw_gmr_bufmgr *mgr;
+
+ struct vmw_region *region;
+ void *map;
+
+#ifdef DEBUG
+ struct pipe_fence_handle *last_fence;
+#endif
+};
+
+
+extern const struct pb_vtbl vmw_gmr_buffer_vtbl;
+
+
+static INLINE struct vmw_gmr_buffer *
+vmw_gmr_buffer(struct pb_buffer *buf)
+{
+ assert(buf);
+ assert(buf->vtbl == &vmw_gmr_buffer_vtbl);
+ return (struct vmw_gmr_buffer *)buf;
+}
+
+
+struct vmw_gmr_bufmgr
+{
+ struct pb_manager base;
+
+ struct vmw_winsys_screen *vws;
+};
+
+
+static INLINE struct vmw_gmr_bufmgr *
+vmw_gmr_bufmgr(struct pb_manager *mgr)
+{
+ assert(mgr);
+ return (struct vmw_gmr_bufmgr *)mgr;
+}
+
+
+static void
+vmw_gmr_buffer_destroy(struct pb_buffer *_buf)
+{
+ struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf);
+
+#ifdef DEBUG
+ if(buf->last_fence) {
+ struct svga_winsys_screen *sws = &buf->mgr->vws->base;
+ assert(sws->fence_signalled(sws, buf->last_fence, 0) == 0);
+ }
+#endif
+
+ vmw_ioctl_region_unmap(buf->region);
+
+ vmw_ioctl_region_destroy(buf->region);
+
+ FREE(buf);
+}
+
+
+static void *
+vmw_gmr_buffer_map(struct pb_buffer *_buf,
+ unsigned flags)
+{
+ struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf);
+ return buf->map;
+}
+
+
+static void
+vmw_gmr_buffer_unmap(struct pb_buffer *_buf)
+{
+ /* Do nothing */
+ (void)_buf;
+}
+
+
+static void
+vmw_gmr_buffer_get_base_buffer(struct pb_buffer *buf,
+ struct pb_buffer **base_buf,
+ unsigned *offset)
+{
+ *base_buf = buf;
+ *offset = 0;
+}
+
+
+static enum pipe_error
+vmw_gmr_buffer_validate( struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags )
+{
+ /* Always pinned */
+ return PIPE_OK;
+}
+
+
+static void
+vmw_gmr_buffer_fence( struct pb_buffer *_buf,
+ struct pipe_fence_handle *fence )
+{
+ /* We don't need to do anything, as the pipebuffer library
+ * will take care of delaying the destruction of fenced buffers */
+#ifdef DEBUG
+ struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf);
+ if(fence)
+ buf->last_fence = fence;
+#endif
+}
+
+
+const struct pb_vtbl vmw_gmr_buffer_vtbl = {
+ vmw_gmr_buffer_destroy,
+ vmw_gmr_buffer_map,
+ vmw_gmr_buffer_unmap,
+ vmw_gmr_buffer_validate,
+ vmw_gmr_buffer_fence,
+ vmw_gmr_buffer_get_base_buffer
+};
+
+
+static struct pb_buffer *
+vmw_gmr_bufmgr_create_buffer(struct pb_manager *_mgr,
+ pb_size size,
+ const struct pb_desc *desc)
+{
+ struct vmw_gmr_bufmgr *mgr = vmw_gmr_bufmgr(_mgr);
+ struct vmw_winsys_screen *vws = mgr->vws;
+ struct vmw_gmr_buffer *buf;
+
+ buf = CALLOC_STRUCT(vmw_gmr_buffer);
+ if(!buf)
+ goto error1;
+
+ pipe_reference_init(&buf->base.base.reference, 1);
+ buf->base.base.alignment = desc->alignment;
+ buf->base.base.usage = desc->usage;
+ buf->base.base.size = size;
+ buf->base.vtbl = &vmw_gmr_buffer_vtbl;
+ buf->mgr = mgr;
+
+ buf->region = vmw_ioctl_region_create(vws, size);
+ if(!buf->region)
+ goto error2;
+
+ buf->map = vmw_ioctl_region_map(buf->region);
+ if(!buf->map)
+ goto error3;
+
+ return &buf->base;
+
+error3:
+ vmw_ioctl_region_destroy(buf->region);
+error2:
+ FREE(buf);
+error1:
+ return NULL;
+}
+
+
+static void
+vmw_gmr_bufmgr_flush(struct pb_manager *mgr)
+{
+ /* No-op */
+}
+
+
+static void
+vmw_gmr_bufmgr_destroy(struct pb_manager *_mgr)
+{
+ struct vmw_gmr_bufmgr *mgr = vmw_gmr_bufmgr(_mgr);
+ FREE(mgr);
+}
+
+
+struct pb_manager *
+vmw_gmr_bufmgr_create(struct vmw_winsys_screen *vws)
+{
+ struct vmw_gmr_bufmgr *mgr;
+
+ mgr = CALLOC_STRUCT(vmw_gmr_bufmgr);
+ if(!mgr)
+ return NULL;
+
+ mgr->base.destroy = vmw_gmr_bufmgr_destroy;
+ mgr->base.create_buffer = vmw_gmr_bufmgr_create_buffer;
+ mgr->base.flush = vmw_gmr_bufmgr_flush;
+
+ mgr->vws = vws;
+
+ return &mgr->base;
+}
+
+
+boolean
+vmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf,
+ struct SVGAGuestPtr *ptr)
+{
+ struct pb_buffer *base_buf;
+ unsigned offset = 0;
+ struct vmw_gmr_buffer *gmr_buf;
+
+ pb_get_base_buffer( buf, &base_buf, &offset );
+
+ gmr_buf = vmw_gmr_buffer(base_buf);
+ if(!gmr_buf)
+ return FALSE;
+
+ *ptr = vmw_ioctl_region_ptr(gmr_buf->region);
+
+ ptr->offset += offset;
+
+ return TRUE;
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.h b/src/gallium/winsys/drm/vmware/core/vmw_buffer.h
new file mode 100644
index 0000000000..634bdcabd2
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_buffer.h
@@ -0,0 +1,65 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef VMW_BUFFER_H_
+#define VMW_BUFFER_H_
+
+
+#include "pipe/p_compiler.h"
+
+struct SVGAGuestPtr;
+struct pb_buffer;
+struct pb_manager;
+struct svga_winsys_buffer;
+struct svga_winsys_surface;
+struct vmw_winsys_screen;
+
+
+static INLINE struct pb_buffer *
+vmw_pb_buffer(struct svga_winsys_buffer *buffer)
+{
+ assert(buffer);
+ return (struct pb_buffer *)buffer;
+}
+
+
+static INLINE struct svga_winsys_buffer *
+vmw_svga_winsys_buffer(struct pb_buffer *buffer)
+{
+ assert(buffer);
+ return (struct svga_winsys_buffer *)buffer;
+}
+
+
+struct pb_manager *
+vmw_gmr_bufmgr_create(struct vmw_winsys_screen *vws);
+
+boolean
+vmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf,
+ struct SVGAGuestPtr *ptr);
+
+
+#endif /* VMW_BUFFER_H_ */
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.c b/src/gallium/winsys/drm/vmware/core/vmw_context.c
new file mode 100644
index 0000000000..b6997588de
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_context.c
@@ -0,0 +1,297 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "svga_cmd.h"
+
+#include "util/u_debug.h"
+#include "util/u_memory.h"
+#include "util/u_debug_stack.h"
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_validate.h"
+
+#include "svga_winsys.h"
+#include "vmw_context.h"
+#include "vmw_screen.h"
+#include "vmw_buffer.h"
+#include "vmw_surface.h"
+#include "vmw_fence.h"
+
+#define VMW_COMMAND_SIZE (64*1024)
+#define VMW_SURFACE_RELOCS (1024)
+
+#define VMW_MUST_FLUSH_STACK 8
+
+struct vmw_svga_winsys_context
+{
+ struct svga_winsys_context base;
+
+ struct vmw_winsys_screen *vws;
+
+#ifdef DEBUG
+ boolean must_flush;
+ struct debug_stack_frame must_flush_stack[VMW_MUST_FLUSH_STACK];
+#endif
+
+ struct {
+ uint8_t buffer[VMW_COMMAND_SIZE];
+ uint32_t size;
+ uint32_t used;
+ uint32_t reserved;
+ } command;
+
+ struct {
+ struct vmw_svga_winsys_surface *handles[VMW_SURFACE_RELOCS];
+ uint32_t size;
+ uint32_t used;
+ uint32_t staged;
+ uint32_t reserved;
+ } surface;
+
+ struct pb_validate *validate;
+
+ uint32_t last_fence;
+};
+
+
+static INLINE struct vmw_svga_winsys_context *
+vmw_svga_winsys_context(struct svga_winsys_context *swc)
+{
+ assert(swc);
+ return (struct vmw_svga_winsys_context *)swc;
+}
+
+
+static enum pipe_error
+vmw_swc_flush(struct svga_winsys_context *swc,
+ struct pipe_fence_handle **pfence)
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+ struct pipe_fence_handle *fence = NULL;
+ unsigned i;
+ enum pipe_error ret;
+
+ ret = pb_validate_validate(vswc->validate);
+ assert(ret == PIPE_OK);
+ if(ret == PIPE_OK) {
+
+ if (vswc->command.used)
+ vmw_ioctl_command(vswc->vws,
+ vswc->command.buffer,
+ vswc->command.used,
+ &vswc->last_fence);
+
+ fence = vmw_pipe_fence(vswc->last_fence);
+
+ pb_validate_fence(vswc->validate, fence);
+ }
+
+ vswc->command.used = 0;
+ vswc->command.reserved = 0;
+
+ for(i = 0; i < vswc->surface.used + vswc->surface.staged; ++i) {
+ struct vmw_svga_winsys_surface *vsurf =
+ vswc->surface.handles[i];
+ p_atomic_dec(&vsurf->validated);
+ vmw_svga_winsys_surface_reference(&vswc->surface.handles[i], NULL);
+ }
+
+ vswc->surface.used = 0;
+ vswc->surface.reserved = 0;
+
+#ifdef DEBUG
+ vswc->must_flush = FALSE;
+#endif
+
+ if(pfence)
+ *pfence = fence;
+
+ return ret;
+}
+
+
+static void *
+vmw_swc_reserve(struct svga_winsys_context *swc,
+ uint32_t nr_bytes, uint32_t nr_relocs )
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+
+#ifdef DEBUG
+ /* Check if somebody forgot to check the previous failure */
+ if(vswc->must_flush) {
+ debug_printf("Forgot to flush:\n");
+ debug_backtrace_dump(vswc->must_flush_stack, VMW_MUST_FLUSH_STACK);
+ assert(!vswc->must_flush);
+ }
+#endif
+
+ assert(nr_bytes <= vswc->command.size);
+ if(nr_bytes > vswc->command.size)
+ return NULL;
+
+ if(vswc->command.used + nr_bytes > vswc->command.size ||
+ vswc->surface.used + nr_relocs > vswc->surface.size) {
+#ifdef DEBUG
+ vswc->must_flush = TRUE;
+ debug_backtrace_capture(vswc->must_flush_stack, 1,
+ VMW_MUST_FLUSH_STACK);
+#endif
+ return NULL;
+ }
+
+ assert(vswc->command.used + nr_bytes <= vswc->command.size);
+ assert(vswc->surface.used + nr_relocs <= vswc->surface.size);
+
+ vswc->command.reserved = nr_bytes;
+ vswc->surface.reserved = nr_relocs;
+ vswc->surface.staged = 0;
+
+ return vswc->command.buffer + vswc->command.used;
+}
+
+
+static void
+vmw_swc_surface_relocation(struct svga_winsys_context *swc,
+ uint32 *where,
+ struct svga_winsys_surface *surface,
+ unsigned flags)
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+ struct vmw_svga_winsys_surface *vsurf;
+
+ if(!surface) {
+ *where = SVGA3D_INVALID_ID;
+ return;
+ }
+
+ assert(vswc->surface.staged < vswc->surface.reserved);
+
+ vsurf = vmw_svga_winsys_surface(surface);
+
+ *where = vsurf->sid;
+
+ vmw_svga_winsys_surface_reference(&vswc->surface.handles[vswc->surface.used + vswc->surface.staged], vsurf);
+ p_atomic_inc(&vsurf->validated);
+ ++vswc->surface.staged;
+}
+
+
+static void
+vmw_swc_region_relocation(struct svga_winsys_context *swc,
+ struct SVGAGuestPtr *where,
+ struct svga_winsys_buffer *buffer,
+ uint32 offset,
+ unsigned flags)
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+ struct SVGAGuestPtr ptr;
+ struct pb_buffer *buf = vmw_pb_buffer(buffer);
+ enum pipe_error ret;
+
+ if(!vmw_gmr_bufmgr_region_ptr(buf, &ptr))
+ assert(0);
+
+ ptr.offset += offset;
+
+ *where = ptr;
+
+ ret = pb_validate_add_buffer(vswc->validate, buf, flags);
+ /* TODO: Update pipebuffer to reserve buffers and not fail here */
+ assert(ret == PIPE_OK);
+}
+
+
+static void
+vmw_swc_commit(struct svga_winsys_context *swc)
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+
+ assert(vswc->command.reserved);
+ assert(vswc->command.used + vswc->command.reserved <= vswc->command.size);
+ vswc->command.used += vswc->command.reserved;
+ vswc->command.reserved = 0;
+
+ assert(vswc->surface.staged <= vswc->surface.reserved);
+ assert(vswc->surface.used + vswc->surface.staged <= vswc->surface.size);
+ vswc->surface.used += vswc->surface.staged;
+ vswc->surface.staged = 0;
+ vswc->surface.reserved = 0;
+}
+
+
+static void
+vmw_swc_destroy(struct svga_winsys_context *swc)
+{
+ struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
+ unsigned i;
+ for(i = 0; i < vswc->surface.used; ++i) {
+ p_atomic_dec(&vswc->surface.handles[i]->validated);
+ vmw_svga_winsys_surface_reference(&vswc->surface.handles[i], NULL);
+ }
+ pb_validate_destroy(vswc->validate);
+ vmw_ioctl_context_destroy(vswc->vws, swc->cid);
+ FREE(vswc);
+}
+
+
+struct svga_winsys_context *
+vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ struct vmw_svga_winsys_context *vswc;
+
+ vswc = CALLOC_STRUCT(vmw_svga_winsys_context);
+ if(!vswc)
+ return NULL;
+
+ vswc->base.destroy = vmw_swc_destroy;
+ vswc->base.reserve = vmw_swc_reserve;
+ vswc->base.surface_relocation = vmw_swc_surface_relocation;
+ vswc->base.region_relocation = vmw_swc_region_relocation;
+ vswc->base.commit = vmw_swc_commit;
+ vswc->base.flush = vmw_swc_flush;
+
+ vswc->base.cid = vmw_ioctl_context_create(vws);
+
+ vswc->vws = vws;
+
+ vswc->command.size = VMW_COMMAND_SIZE;
+ vswc->surface.size = VMW_SURFACE_RELOCS;
+
+ vswc->validate = pb_validate_create();
+ if(!vswc->validate) {
+ FREE(vswc);
+ return NULL;
+ }
+
+ return &vswc->base;
+}
+
+
+struct pipe_context *
+vmw_svga_context_create(struct pipe_screen *screen)
+{
+ return svga_context_create(screen);
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.h b/src/gallium/winsys/drm/vmware/core/vmw_context.h
new file mode 100644
index 0000000000..305ce9b5be
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_context.h
@@ -0,0 +1,59 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @author Jose Fonseca
+ */
+
+
+#ifndef VMW_CONTEXT_H_
+#define VMW_CONTEXT_H_
+
+#include "pipe/p_compiler.h"
+
+struct svga_winsys_screen;
+struct svga_winsys_context;
+struct pipe_context;
+struct pipe_screen;
+
+#define VMW_DEBUG 0
+
+#if VMW_DEBUG
+#define vmw_printf debug_printf
+#define VMW_FUNC debug_printf("%s\n", __FUNCTION__)
+#else
+#define VMW_FUNC
+#define vmw_printf(...)
+#endif
+
+
+struct svga_winsys_context *
+vmw_svga_winsys_context_create(struct svga_winsys_screen *sws);
+
+struct pipe_context *
+vmw_svga_context_create(struct pipe_screen *screen);
+
+
+#endif /* VMW_CONTEXT_H_ */
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.c b/src/gallium/winsys/drm/vmware/core/vmw_fence.c
new file mode 100644
index 0000000000..873dd51166
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_fence.c
@@ -0,0 +1,108 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "util/u_memory.h"
+#include "pipebuffer/pb_buffer_fenced.h"
+
+#include "vmw_screen.h"
+#include "vmw_fence.h"
+
+
+
+struct vmw_fence_ops
+{
+ struct pb_fence_ops base;
+
+ struct vmw_winsys_screen *vws;
+};
+
+
+static INLINE struct vmw_fence_ops *
+vmw_fence_ops(struct pb_fence_ops *ops)
+{
+ assert(ops);
+ return (struct vmw_fence_ops *)ops;
+}
+
+
+static void
+vmw_fence_ops_fence_reference(struct pb_fence_ops *ops,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence)
+{
+ *ptr = fence;
+}
+
+
+static int
+vmw_fence_ops_fence_signalled(struct pb_fence_ops *ops,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws;
+ (void)flag;
+ return vmw_ioctl_fence_signalled(vws, vmw_fence(fence));
+}
+
+
+static int
+vmw_fence_ops_fence_finish(struct pb_fence_ops *ops,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws;
+ (void)flag;
+ return vmw_ioctl_fence_finish(vws, vmw_fence(fence));
+}
+
+
+static void
+vmw_fence_ops_destroy(struct pb_fence_ops *ops)
+{
+ FREE(ops);
+}
+
+
+struct pb_fence_ops *
+vmw_fence_ops_create(struct vmw_winsys_screen *vws)
+{
+ struct vmw_fence_ops *ops;
+
+ ops = CALLOC_STRUCT(vmw_fence_ops);
+ if(!ops)
+ return NULL;
+
+ ops->base.destroy = &vmw_fence_ops_destroy;
+ ops->base.fence_reference = &vmw_fence_ops_fence_reference;
+ ops->base.fence_signalled = &vmw_fence_ops_fence_signalled;
+ ops->base.fence_finish = &vmw_fence_ops_fence_finish;
+
+ ops->vws = vws;
+
+ return &ops->base;
+}
+
+
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.h b/src/gallium/winsys/drm/vmware/core/vmw_fence.h
new file mode 100644
index 0000000000..5357b4f61d
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_fence.h
@@ -0,0 +1,59 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef VMW_FENCE_H_
+#define VMW_FENCE_H_
+
+
+#include "pipe/p_compiler.h"
+
+
+struct pipe_fence_handle;
+struct pb_fence_ops;
+struct vmw_winsys_screen;
+
+
+/** Cast from a pipe_fence_handle pointer into a SVGA fence */
+static INLINE uint32_t
+vmw_fence( struct pipe_fence_handle *fence )
+{
+ return (uint32_t)(uintptr_t)fence;
+}
+
+
+/** Cast from a SVGA fence number to pipe_fence_handle pointer */
+static INLINE struct pipe_fence_handle *
+vmw_pipe_fence( uint32_t fence )
+{
+ return (struct pipe_fence_handle *)(uintptr_t)fence;
+}
+
+
+struct pb_fence_ops *
+vmw_fence_ops_create(struct vmw_winsys_screen *vws);
+
+
+#endif /* VMW_FENCE_H_ */
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.c b/src/gallium/winsys/drm/vmware/core/vmw_screen.c
new file mode 100644
index 0000000000..911eec5e25
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen.c
@@ -0,0 +1,74 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "vmw_screen.h"
+
+#include "vmw_context.h"
+
+#include "util/u_memory.h"
+#include "pipe/p_compiler.h"
+
+
+/* Called from vmw_drm_create_screen(), creates and initializes the
+ * vmw_winsys_screen structure, which is the main entity in this
+ * module.
+ */
+struct vmw_winsys_screen *
+vmw_winsys_create( int fd )
+{
+ struct vmw_winsys_screen *vws = CALLOC_STRUCT(vmw_winsys_screen);
+ if (!vws)
+ goto out_no_vws;
+
+ vws->ioctl.drm_fd = fd;
+
+ if (!vmw_ioctl_init(vws))
+ goto out_no_ioctl;
+
+ if(!vmw_pools_init(vws))
+ goto out_no_pools;
+
+ if (!vmw_winsys_screen_init_svga(vws))
+ goto out_no_svga;
+
+ return vws;
+out_no_svga:
+ vmw_pools_cleanup(vws);
+out_no_pools:
+ vmw_ioctl_cleanup(vws);
+out_no_ioctl:
+ FREE(vws);
+out_no_vws:
+ return NULL;
+}
+
+void
+vmw_winsys_destroy(struct vmw_winsys_screen *vws)
+{
+ vmw_pools_cleanup(vws);
+ vmw_ioctl_cleanup(vws);
+ FREE(vws);
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.h b/src/gallium/winsys/drm/vmware/core/vmw_screen.h
new file mode 100644
index 0000000000..a875107370
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen.h
@@ -0,0 +1,134 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * Common definitions for the VMware SVGA winsys.
+ *
+ * @author Jose Fonseca
+ */
+
+
+#ifndef VMW_SCREEN_H_
+#define VMW_SCREEN_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+#include "svga_winsys.h"
+
+struct pb_manager;
+struct vmw_region;
+
+
+struct vmw_winsys_screen
+{
+ struct svga_winsys_screen base;
+
+ struct {
+ volatile uint32_t *fifo_map;
+ uint64_t last_fence;
+ int drm_fd;
+ } ioctl;
+
+ struct {
+ struct pb_manager *gmr;
+ struct pb_manager *gmr_mm;
+ struct pb_manager *gmr_fenced;
+ } pools;
+};
+
+
+static INLINE struct vmw_winsys_screen *
+vmw_winsys_screen(struct svga_winsys_screen *base)
+{
+ return (struct vmw_winsys_screen *)base;
+}
+
+/* */
+uint32
+vmw_ioctl_context_create(struct vmw_winsys_screen *vws);
+
+void
+vmw_ioctl_context_destroy(struct vmw_winsys_screen *vws,
+ uint32 cid);
+
+uint32
+vmw_ioctl_surface_create(struct vmw_winsys_screen *vws,
+ SVGA3dSurfaceFlags flags,
+ SVGA3dSurfaceFormat format,
+ SVGA3dSize size,
+ uint32 numFaces,
+ uint32 numMipLevels);
+
+void
+vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws,
+ uint32 sid);
+
+void
+vmw_ioctl_command(struct vmw_winsys_screen *vws,
+ void *commands,
+ uint32_t size,
+ uint32_t *fence);
+
+struct vmw_region *
+vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size);
+
+void
+vmw_ioctl_region_destroy(struct vmw_region *region);
+
+struct SVGAGuestPtr
+vmw_ioctl_region_ptr(struct vmw_region *region);
+
+void *
+vmw_ioctl_region_map(struct vmw_region *region);
+void
+vmw_ioctl_region_unmap(struct vmw_region *region);
+
+
+int
+vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws,
+ uint32_t fence);
+
+int
+vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws,
+ uint32_t fence);
+
+
+/* Initialize parts of vmw_winsys_screen at startup:
+ */
+boolean vmw_ioctl_init(struct vmw_winsys_screen *vws);
+boolean vmw_pools_init(struct vmw_winsys_screen *vws);
+boolean vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws);
+
+void vmw_ioctl_cleanup(struct vmw_winsys_screen *vws);
+void vmw_pools_cleanup(struct vmw_winsys_screen *vws);
+
+struct vmw_winsys_screen *vmw_winsys_create(int fd);
+void vmw_winsys_destroy(struct vmw_winsys_screen *sws);
+
+
+#endif /* VMW_SCREEN_H_ */
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
new file mode 100644
index 0000000000..5995eee34b
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
@@ -0,0 +1,371 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_inlines.h"
+#include "util/u_memory.h"
+#include "vmw_screen.h"
+
+#include "trace/tr_drm.h"
+
+#include "vmw_screen.h"
+#include "vmw_surface.h"
+#include "vmw_fence.h"
+#include "vmw_context.h"
+
+#include
+#include
+#include
+#include
+
+#include
+
+static struct dri1_api dri1_api_hooks;
+static struct dri1_api_version ddx_required = { 0, 1, 0 };
+static struct dri1_api_version ddx_compat = { 0, 0, 0 };
+static struct dri1_api_version dri_required = { 4, 0, 0 };
+static struct dri1_api_version dri_compat = { 4, 0, 0 };
+static struct dri1_api_version drm_required = { 0, 1, 0 };
+static struct dri1_api_version drm_compat = { 0, 0, 0 };
+
+static boolean
+vmw_dri1_check_version(const struct dri1_api_version *cur,
+ const struct dri1_api_version *required,
+ const struct dri1_api_version *compat,
+ const char component[])
+{
+ if (cur->major > required->major && cur->major <= compat->major)
+ return TRUE;
+ if (cur->major == required->major && cur->minor >= required->minor)
+ return TRUE;
+
+ fprintf(stderr, "%s version failure.\n", component);
+ fprintf(stderr, "%s version is %d.%d.%d and this driver can only work\n"
+ "with versions %d.%d.x through %d.x.x.\n",
+ component,
+ cur->major,
+ cur->minor,
+ cur->patch_level, required->major, required->minor, compat->major);
+ return FALSE;
+}
+
+/* This is actually the entrypoint to the entire driver, called by the
+ * libGL (or EGL, or ...) code via the drm_api_hooks table at the
+ * bottom of the file.
+ */
+static struct pipe_screen *
+vmw_drm_create_screen(struct drm_api *drm_api,
+ int fd,
+ struct drm_create_screen_arg *arg)
+{
+ struct vmw_winsys_screen *vws;
+ struct pipe_screen *screen;
+ struct dri1_create_screen_arg *dri1;
+
+ if (arg != NULL) {
+ switch (arg->mode) {
+ case DRM_CREATE_NORMAL:
+ break;
+ case DRM_CREATE_DRI1:
+ dri1 = (struct dri1_create_screen_arg *)arg;
+ if (!vmw_dri1_check_version(&dri1->ddx_version, &ddx_required,
+ &ddx_compat, "ddx - driver api"))
+ return NULL;
+ if (!vmw_dri1_check_version(&dri1->dri_version, &dri_required,
+ &dri_compat, "dri info"))
+ return NULL;
+ if (!vmw_dri1_check_version(&dri1->drm_version, &drm_required,
+ &drm_compat, "vmwgfx drm driver"))
+ return NULL;
+ dri1->api = &dri1_api_hooks;
+ break;
+ default:
+ return NULL;
+ }
+ }
+
+ vws = vmw_winsys_create( fd );
+ if (!vws)
+ goto out_no_vws;
+
+ screen = svga_screen_create( &vws->base );
+ if (!screen)
+ goto out_no_screen;
+
+ return screen;
+
+ /* Failure cases:
+ */
+out_no_screen:
+ vmw_winsys_destroy( vws );
+
+out_no_vws:
+ return NULL;
+}
+
+static INLINE boolean
+vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst,
+ int dst_x,
+ int dst_y,
+ const struct drm_clip_rect *src,
+ const struct drm_clip_rect *bbox)
+{
+ int xy1;
+ int xy2;
+
+ xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
+ (int)bbox->x1 + dst_x;
+ xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
+ (int)bbox->x2 + dst_x;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->x1 = xy1;
+ dst->x2 = xy2;
+
+ xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
+ (int)bbox->y1 + dst_y;
+ xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
+ (int)bbox->y2 + dst_y;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->y1 = xy1;
+ dst->y2 = xy2;
+ return TRUE;
+}
+
+/**
+ * No fancy get-surface-from-sarea stuff here.
+ * Just use the present blit.
+ */
+
+static void
+vmw_dri1_present_locked(struct pipe_context *locked_pipe,
+ struct pipe_surface *surf,
+ const struct drm_clip_rect *rect,
+ unsigned int num_clip,
+ int x_draw, int y_draw,
+ const struct drm_clip_rect *bbox,
+ struct pipe_fence_handle **p_fence)
+{
+ struct svga_winsys_surface *srf =
+ svga_screen_texture_get_winsys_surface(surf->texture);
+ struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf);
+ struct vmw_winsys_screen *vws =
+ vmw_winsys_screen(svga_winsys_screen(locked_pipe->screen));
+ struct drm_clip_rect clip;
+ int i;
+ struct
+ {
+ SVGA3dCmdHeader header;
+ SVGA3dCmdPresent body;
+ SVGA3dCopyRect rect;
+ } cmd;
+ boolean visible = FALSE;
+ uint32_t fence_seq = 0;
+
+ VMW_FUNC;
+ cmd.header.id = SVGA_3D_CMD_PRESENT;
+ cmd.header.size = sizeof cmd.body + sizeof cmd.rect;
+ cmd.body.sid = vsrf->sid;
+
+ for (i = 0; i < num_clip; ++i) {
+ if (!vmw_dri1_intersect_src_bbox(&clip, x_draw, y_draw, rect++, bbox))
+ continue;
+
+ cmd.rect.x = clip.x1;
+ cmd.rect.y = clip.y1;
+ cmd.rect.w = clip.x2 - clip.x1;
+ cmd.rect.h = clip.y2 - clip.y1;
+ cmd.rect.srcx = (int)clip.x1 - x_draw;
+ cmd.rect.srcy = (int)clip.y1 - y_draw;
+
+ vmw_printf("%s: Clip %d x %d y %d w %d h %d srcx %d srcy %d\n",
+ __FUNCTION__,
+ i,
+ cmd.rect.x,
+ cmd.rect.y,
+ cmd.rect.w, cmd.rect.h, cmd.rect.srcx, cmd.rect.srcy);
+
+ vmw_ioctl_command(vws, &cmd, sizeof cmd.header + cmd.header.size,
+ &fence_seq);
+ visible = TRUE;
+ }
+
+ *p_fence = (visible) ? vmw_pipe_fence(fence_seq) : NULL;
+ vmw_svga_winsys_surface_reference(&vsrf, NULL);
+}
+
+/**
+ * FIXME: We'd probably want to cache these buffers in the
+ * screen, based on handle.
+ */
+
+static struct pipe_buffer *
+vmw_drm_buffer_from_handle(struct drm_api *drm_api,
+ struct pipe_screen *screen,
+ const char *name,
+ unsigned handle)
+{
+ struct vmw_svga_winsys_surface *vsrf;
+ struct svga_winsys_surface *ssrf;
+ struct vmw_winsys_screen *vws =
+ vmw_winsys_screen(svga_winsys_screen(screen));
+ struct pipe_buffer *buf;
+ union drm_vmw_surface_reference_arg arg;
+ struct drm_vmw_surface_arg *req = &arg.req;
+ struct drm_vmw_surface_create_req *rep = &arg.rep;
+ int ret;
+ int i;
+
+ /**
+ * The vmware device specific handle is the hardware SID.
+ * FIXME: We probably want to move this to the ioctl implementations.
+ */
+
+ memset(&arg, 0, sizeof(arg));
+ req->sid = handle;
+
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_REF_SURFACE,
+ &arg, sizeof(arg));
+
+ if (ret) {
+ fprintf(stderr, "Failed referencing shared surface. SID %d.\n"
+ "Error %d (%s).\n",
+ handle, ret, strerror(-ret));
+ return NULL;
+ }
+
+ if (rep->mip_levels[0] != 1) {
+ fprintf(stderr, "Incorrect number of mipmap levels on shared surface."
+ " SID %d, levels %d\n",
+ handle, rep->mip_levels[0]);
+ goto out_mip;
+ }
+
+ for (i=1; i < DRM_VMW_MAX_SURFACE_FACES; ++i) {
+ if (rep->mip_levels[i] != 0) {
+ fprintf(stderr, "Incorrect number of faces levels on shared surface."
+ " SID %d, face %d present.\n",
+ handle, i);
+ goto out_mip;
+ }
+ }
+
+ vsrf = CALLOC_STRUCT(vmw_svga_winsys_surface);
+ if (!vsrf)
+ goto out_mip;
+
+ pipe_reference_init(&vsrf->refcnt, 1);
+ p_atomic_set(&vsrf->validated, 0);
+ vsrf->sid = handle;
+ ssrf = svga_winsys_surface(vsrf);
+ buf = svga_screen_buffer_wrap_surface(screen, rep->format, ssrf);
+ if (!buf)
+ vmw_svga_winsys_surface_reference(&vsrf, NULL);
+
+ return buf;
+ out_mip:
+ vmw_ioctl_surface_destroy(vws, handle);
+ return NULL;
+}
+
+static struct pipe_texture *
+vmw_drm_texture_from_handle(struct drm_api *drm_api,
+ struct pipe_screen *screen,
+ struct pipe_texture *templat,
+ const char *name,
+ unsigned stride,
+ unsigned handle)
+{
+ struct pipe_buffer *buffer;
+ buffer = vmw_drm_buffer_from_handle(drm_api, screen, name, handle);
+
+ if (!buffer)
+ return NULL;
+
+ return screen->texture_blanket(screen, templat, &stride, buffer);
+}
+
+static boolean
+vmw_drm_handle_from_buffer(struct drm_api *drm_api,
+ struct pipe_screen *screen,
+ struct pipe_buffer *buffer,
+ unsigned *handle)
+{
+ struct svga_winsys_surface *surface =
+ svga_screen_buffer_get_winsys_surface(buffer);
+ struct vmw_svga_winsys_surface *vsrf;
+
+ if (!surface)
+ return FALSE;
+
+ vsrf = vmw_svga_winsys_surface(surface);
+ *handle = vsrf->sid;
+ vmw_svga_winsys_surface_reference(&vsrf, NULL);
+ return TRUE;
+}
+
+static boolean
+vmw_drm_handle_from_texture(struct drm_api *drm_api,
+ struct pipe_screen *screen,
+ struct pipe_texture *texture,
+ unsigned *stride,
+ unsigned *handle)
+{
+ struct pipe_buffer *buffer;
+
+ if (!svga_screen_buffer_from_texture(texture, &buffer, stride))
+ return FALSE;
+
+ return vmw_drm_handle_from_buffer(drm_api, screen, buffer, handle);
+}
+
+static struct pipe_context*
+vmw_drm_create_context(struct drm_api *drm_api,
+ struct pipe_screen *screen)
+{
+ return vmw_svga_context_create(screen);
+}
+
+static struct dri1_api dri1_api_hooks = {
+ .front_srf_locked = NULL,
+ .present_locked = vmw_dri1_present_locked
+};
+
+static struct drm_api vmw_drm_api_hooks = {
+ .create_screen = vmw_drm_create_screen,
+ .create_context = vmw_drm_create_context,
+ .texture_from_shared_handle = vmw_drm_texture_from_handle,
+ .shared_handle_from_texture = vmw_drm_handle_from_texture,
+ .local_handle_from_texture = vmw_drm_handle_from_texture,
+};
+
+struct drm_api* drm_api_create()
+{
+ return trace_drm_create(&vmw_drm_api_hooks);
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
new file mode 100644
index 0000000000..b3515732a2
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
@@ -0,0 +1,503 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ *
+ * Wrappers for DRM ioctl functionlaity used by the rest of the vmw
+ * drm winsys.
+ *
+ * Based on svgaicd_escape.c
+ */
+
+
+#include "svga_cmd.h"
+#include "util/u_memory.h"
+#include "util/u_math.h"
+#include "svgadump/svga_dump.h"
+#include "vmw_screen.h"
+#include "vmw_context.h"
+#include "xf86drm.h"
+#include "vmwgfx_drm.h"
+
+#include
+#include
+#include
+
+struct vmw_region
+{
+ SVGAGuestPtr ptr;
+ uint32_t handle;
+ uint64_t map_handle;
+ void *data;
+ uint32_t map_count;
+ int drm_fd;
+ uint32_t size;
+};
+
+static void
+vmw_check_last_cmd(struct vmw_winsys_screen *vws)
+{
+ static uint32_t buffer[16384];
+ struct drm_vmw_fifo_debug_arg arg;
+ int ret;
+
+ return;
+ memset(&arg, 0, sizeof(arg));
+ arg.debug_buffer = (unsigned long)buffer;
+ arg.debug_buffer_size = 65536;
+
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_FIFO_DEBUG,
+ &arg, sizeof(arg));
+
+ if (ret) {
+ debug_printf("%s Ioctl error: \"%s\".\n", __FUNCTION__, strerror(-ret));
+ return;
+ }
+
+ if (arg.did_not_fit) {
+ debug_printf("%s Command did not fit completely.\n", __FUNCTION__);
+ }
+
+ svga_dump_commands(buffer, arg.used_size);
+}
+
+static void
+vmw_ioctl_fifo_unmap(struct vmw_winsys_screen *vws, void *mapping)
+{
+ VMW_FUNC;
+ (void)munmap(mapping, getpagesize());
+}
+
+
+static void *
+vmw_ioctl_fifo_map(struct vmw_winsys_screen *vws,
+ uint32_t fifo_offset )
+{
+ void *map;
+
+ VMW_FUNC;
+
+ map = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED,
+ vws->ioctl.drm_fd, fifo_offset);
+
+ if (map == MAP_FAILED) {
+ debug_printf("Map failed %s\n", strerror(errno));
+ return NULL;
+ }
+
+ vmw_printf("Fifo (min) is 0x%08x\n", ((uint32_t *) map)[SVGA_FIFO_MIN]);
+
+ return map;
+}
+
+uint32
+vmw_ioctl_context_create(struct vmw_winsys_screen *vws)
+{
+ struct drm_vmw_context_arg c_arg;
+ int ret;
+
+ VMW_FUNC;
+
+ ret = drmCommandRead(vws->ioctl.drm_fd, DRM_VMW_CREATE_CONTEXT,
+ &c_arg, sizeof(c_arg));
+
+ if (ret)
+ return -1;
+
+ vmw_check_last_cmd(vws);
+ vmw_printf("Context id is %d\n", c_arg.cid);
+
+ return c_arg.cid;
+}
+
+void
+vmw_ioctl_context_destroy(struct vmw_winsys_screen *vws, uint32 cid)
+{
+ struct drm_vmw_context_arg c_arg;
+
+ VMW_FUNC;
+
+ memset(&c_arg, 0, sizeof(c_arg));
+ c_arg.cid = cid;
+
+ (void)drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_UNREF_CONTEXT,
+ &c_arg, sizeof(c_arg));
+
+ vmw_check_last_cmd(vws);
+}
+
+uint32
+vmw_ioctl_surface_create(struct vmw_winsys_screen *vws,
+ SVGA3dSurfaceFlags flags,
+ SVGA3dSurfaceFormat format,
+ SVGA3dSize size,
+ uint32_t numFaces, uint32_t numMipLevels)
+{
+ union drm_vmw_surface_create_arg s_arg;
+ struct drm_vmw_surface_create_req *req = &s_arg.req;
+ struct drm_vmw_surface_arg *rep = &s_arg.rep;
+ struct drm_vmw_size sizes[DRM_VMW_MAX_SURFACE_FACES*
+ DRM_VMW_MAX_MIP_LEVELS];
+ struct drm_vmw_size *cur_size;
+ uint32_t iFace;
+ uint32_t iMipLevel;
+ int ret;
+
+ vmw_printf("%s flags %d format %d\n", __FUNCTION__, flags, format);
+
+ memset(&s_arg, 0, sizeof(s_arg));
+ req->flags = (uint32_t) flags;
+ req->format = (uint32_t) format;
+ req->shareable = 1;
+
+ assert(numFaces * numMipLevels < DRM_VMW_MAX_SURFACE_FACES*
+ DRM_VMW_MAX_MIP_LEVELS);
+ cur_size = sizes;
+ for (iFace = 0; iFace < numFaces; ++iFace) {
+ SVGA3dSize mipSize = size;
+
+ req->mip_levels[iFace] = numMipLevels;
+ for (iMipLevel = 0; iMipLevel < numMipLevels; ++iMipLevel) {
+ cur_size->width = mipSize.width;
+ cur_size->height = mipSize.height;
+ cur_size->depth = mipSize.depth;
+ mipSize.width = MAX2(mipSize.width >> 1, 1);
+ mipSize.height = MAX2(mipSize.height >> 1, 1);
+ mipSize.depth = MAX2(mipSize.depth >> 1, 1);
+ cur_size++;
+ }
+ }
+ for (iFace = numFaces; iFace < SVGA3D_MAX_SURFACE_FACES; ++iFace) {
+ req->mip_levels[iFace] = 0;
+ }
+
+ req->size_addr = (unsigned long)&sizes;
+
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_CREATE_SURFACE,
+ &s_arg, sizeof(s_arg));
+
+ if (ret)
+ return -1;
+
+ vmw_printf("Surface id is %d\n", rep->sid);
+ vmw_check_last_cmd(vws);
+
+ return rep->sid;
+}
+
+void
+vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, uint32 sid)
+{
+ struct drm_vmw_surface_arg s_arg;
+
+ VMW_FUNC;
+
+ memset(&s_arg, 0, sizeof(s_arg));
+ s_arg.sid = sid;
+
+ (void)drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_UNREF_SURFACE,
+ &s_arg, sizeof(s_arg));
+ vmw_check_last_cmd(vws);
+
+}
+
+void
+vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size,
+ uint32_t * pfence)
+{
+ struct drm_vmw_execbuf_arg arg;
+ struct drm_vmw_fence_rep rep;
+ int ret;
+
+#ifdef DEBUG
+ {
+ static boolean firsttime = TRUE;
+ static boolean debug = FALSE;
+ static boolean skip = FALSE;
+ if (firsttime) {
+ debug = debug_get_bool_option("SVGA_DUMP_CMD", FALSE);
+ skip = debug_get_bool_option("SVGA_SKIP_CMD", FALSE);
+ }
+ if (debug) {
+ VMW_FUNC;
+ svga_dump_commands(commands, size);
+ }
+ firsttime = FALSE;
+ if (skip) {
+ size = 0;
+ }
+ }
+#endif
+
+ memset(&arg, 0, sizeof(arg));
+ memset(&rep, 0, sizeof(rep));
+
+ rep.error = -EFAULT;
+ arg.fence_rep = (unsigned long)&rep;
+ arg.commands = (unsigned long)commands;
+ arg.command_size = size;
+
+ do {
+ ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg));
+ } while(ret == -ERESTART);
+ if (ret) {
+ debug_printf("%s error %s.\n", __FUNCTION__, strerror(-ret));
+ }
+ if (rep.error) {
+
+ /*
+ * Kernel has synced and put the last fence sequence in the FIFO
+ * register.
+ */
+
+ if (rep.error == -EFAULT)
+ rep.fence_seq = vws->ioctl.fifo_map[SVGA_FIFO_FENCE];
+
+ debug_printf("%s Fence error %s.\n", __FUNCTION__,
+ strerror(-rep.error));
+ }
+
+ vws->ioctl.last_fence = rep.fence_seq;
+
+ if (pfence)
+ *pfence = rep.fence_seq;
+ vmw_check_last_cmd(vws);
+
+}
+
+
+struct vmw_region *
+vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size)
+{
+ struct vmw_region *region;
+ union drm_vmw_alloc_dmabuf_arg arg;
+ struct drm_vmw_alloc_dmabuf_req *req = &arg.req;
+ struct drm_vmw_dmabuf_rep *rep = &arg.rep;
+ int ret;
+
+ vmw_printf("%s: size = %u\n", __FUNCTION__, size);
+
+ region = CALLOC_STRUCT(vmw_region);
+ if (!region)
+ goto out_err1;
+
+ memset(&arg, 0, sizeof(arg));
+ req->size = size;
+ do {
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_ALLOC_DMABUF, &arg,
+ sizeof(arg));
+ } while (ret == -ERESTART);
+
+ if (ret) {
+ debug_printf("IOCTL failed %d: %s\n", ret, strerror(-ret));
+ goto out_err1;
+ }
+
+ region->ptr.gmrId = rep->cur_gmr_id;
+ region->ptr.offset = rep->cur_gmr_offset;
+ region->data = NULL;
+ region->handle = rep->handle;
+ region->map_handle = rep->map_handle;
+ region->map_count = 0;
+ region->size = size;
+ region->drm_fd = vws->ioctl.drm_fd;
+
+ vmw_printf(" gmrId = %u, offset = %u\n",
+ region->ptr.gmrId, region->ptr.offset);
+
+ return region;
+
+ out_err1:
+ return NULL;
+}
+
+void
+vmw_ioctl_region_destroy(struct vmw_region *region)
+{
+ struct drm_vmw_unref_dmabuf_arg arg;
+
+ vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__,
+ region->ptr.gmrId, region->ptr.offset);
+
+ if (region->data) {
+ munmap(region->data, region->size);
+ region->data = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = region->handle;
+ drmCommandWrite(region->drm_fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));
+
+ FREE(region);
+}
+
+SVGAGuestPtr
+vmw_ioctl_region_ptr(struct vmw_region *region)
+{
+ return region->ptr;
+}
+
+void *
+vmw_ioctl_region_map(struct vmw_region *region)
+{
+ void *map;
+
+ vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__,
+ region->ptr.gmrId, region->ptr.offset);
+
+ if (region->data == NULL) {
+ map = mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ region->drm_fd, region->map_handle);
+ if (map == MAP_FAILED) {
+ debug_printf("%s: Map failed.\n", __FUNCTION__);
+ return NULL;
+ }
+
+ region->data = map;
+ }
+
+ ++region->map_count;
+
+ return region->data;
+}
+
+void
+vmw_ioctl_region_unmap(struct vmw_region *region)
+{
+ vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__,
+ region->ptr.gmrId, region->ptr.offset);
+ --region->map_count;
+}
+
+
+int
+vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws,
+ uint32_t fence)
+{
+ uint32_t expected;
+ uint32_t current;
+
+ assert(fence);
+ if(!fence)
+ return 0;
+
+ expected = fence;
+ current = vws->ioctl.fifo_map[SVGA_FIFO_FENCE];
+
+ if ((int32)(current - expected) >= 0)
+ return 0; /* fence passed */
+ else
+ return -1;
+}
+
+
+static void
+vmw_ioctl_sync(struct vmw_winsys_screen *vws,
+ uint32_t fence)
+{
+ uint32_t cur_fence;
+ struct drm_vmw_fence_wait_arg arg;
+ int ret;
+
+ vmw_printf("%s: fence = %lu\n", __FUNCTION__,
+ (unsigned long)fence);
+
+ cur_fence = vws->ioctl.fifo_map[SVGA_FIFO_FENCE];
+ vmw_printf("%s: Fence id read is 0x%08x\n", __FUNCTION__,
+ (unsigned int)cur_fence);
+
+ if ((cur_fence - fence) < (1 << 24))
+ return;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.sequence = fence;
+
+ do {
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_FENCE_WAIT, &arg,
+ sizeof(arg));
+ } while (ret == -ERESTART);
+}
+
+
+int
+vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws,
+ uint32_t fence)
+{
+ assert(fence);
+
+ if(fence) {
+ if(vmw_ioctl_fence_signalled(vws, fence) != 0) {
+ vmw_ioctl_sync(vws, fence);
+ }
+ }
+
+ return 0;
+}
+
+
+boolean
+vmw_ioctl_init(struct vmw_winsys_screen *vws)
+{
+ struct drm_vmw_getparam_arg gp_arg;
+ int ret;
+
+ VMW_FUNC;
+
+ memset(&gp_arg, 0, sizeof(gp_arg));
+ gp_arg.param = DRM_VMW_PARAM_FIFO_OFFSET;
+ ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
+ &gp_arg, sizeof(gp_arg));
+
+ if (ret) {
+ debug_printf("GET_PARAM on %d returned %d: %s\n",
+ vws->ioctl.drm_fd, ret, strerror(-ret));
+ goto out_err1;
+ }
+
+ vmw_printf("Offset to map is 0x%08llx\n",
+ (unsigned long long)gp_arg.value);
+
+ vws->ioctl.fifo_map = vmw_ioctl_fifo_map(vws, gp_arg.value);
+ if (vws->ioctl.fifo_map == NULL)
+ goto out_err1;
+
+ vmw_printf("%s OK\n", __FUNCTION__);
+ return TRUE;
+
+ out_err1:
+ debug_printf("%s Failed\n", __FUNCTION__);
+ return FALSE;
+}
+
+
+
+void
+vmw_ioctl_cleanup(struct vmw_winsys_screen *vws)
+{
+ VMW_FUNC;
+
+ vmw_ioctl_fifo_unmap(vws, (void *)vws->ioctl.fifo_map);
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
new file mode 100644
index 0000000000..b1c24b0cb6
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
@@ -0,0 +1,79 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "vmw_screen.h"
+
+#include "vmw_buffer.h"
+#include "vmw_fence.h"
+
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_bufmgr.h"
+
+void
+vmw_pools_cleanup(struct vmw_winsys_screen *vws)
+{
+ if(vws->pools.gmr_fenced)
+ vws->pools.gmr_fenced->destroy(vws->pools.gmr_fenced);
+
+ /* gmr_mm pool is already destroyed above */
+
+ if(vws->pools.gmr)
+ vws->pools.gmr->destroy(vws->pools.gmr);
+}
+
+
+boolean
+vmw_pools_init(struct vmw_winsys_screen *vws)
+{
+ vws->pools.gmr = vmw_gmr_bufmgr_create(vws);
+ if(!vws->pools.gmr)
+ goto error;
+
+ vws->pools.gmr_mm = mm_bufmgr_create(vws->pools.gmr,
+ 16*1024*1024,
+ 12 /* 4096 alignment */);
+ if(!vws->pools.gmr_mm)
+ goto error;
+
+ vws->pools.gmr_fenced = fenced_bufmgr_create(
+ vws->pools.gmr_mm,
+ vmw_fence_ops_create(vws));
+
+#ifdef DEBUG
+ vws->pools.gmr_fenced = pb_debug_manager_create(vws->pools.gmr_fenced,
+ 4096,
+ 4096);
+#endif
+ if(!vws->pools.gmr_fenced)
+ goto error;
+
+ return TRUE;
+
+error:
+ vmw_pools_cleanup(vws);
+ return FALSE;
+}
+
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c
new file mode 100644
index 0000000000..d7d008859b
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c
@@ -0,0 +1,295 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * This file implements the SVGA interface into this winsys, defined
+ * in drivers/svga/svga_winsys.h.
+ *
+ * @author Keith Whitwell
+ * @author Jose Fonseca
+ */
+
+
+#include "svga_cmd.h"
+#include "svga3d_caps.h"
+
+#include "pipe/p_inlines.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_bufmgr.h"
+#include "svga_winsys.h"
+#include "vmw_context.h"
+#include "vmw_screen.h"
+#include "vmw_surface.h"
+#include "vmw_buffer.h"
+#include "vmw_fence.h"
+
+
+static struct svga_winsys_buffer *
+vmw_svga_winsys_buffer_create(struct svga_winsys_screen *sws,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ struct pb_desc desc;
+ struct pb_manager *provider;
+ struct pb_buffer *buffer;
+
+ memset(&desc, 0, sizeof desc);
+ desc.alignment = alignment;
+ desc.usage = usage;
+
+ provider = vws->pools.gmr_fenced;
+
+ assert(provider);
+ buffer = provider->create_buffer(provider, size, &desc);
+ if(!buffer)
+ return NULL;
+
+ return vmw_svga_winsys_buffer(buffer);
+}
+
+
+static void *
+vmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf,
+ unsigned flags)
+{
+ (void)sws;
+ return pb_map(vmw_pb_buffer(buf), flags);
+}
+
+
+static void
+vmw_svga_winsys_buffer_unmap(struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf)
+{
+ (void)sws;
+ pb_unmap(vmw_pb_buffer(buf));
+}
+
+
+static void
+vmw_svga_winsys_buffer_destroy(struct svga_winsys_screen *sws,
+ struct svga_winsys_buffer *buf)
+{
+ struct pb_buffer *pbuf = vmw_pb_buffer(buf);
+ (void)sws;
+ pb_reference(&pbuf, NULL);
+}
+
+
+static void
+vmw_svga_winsys_fence_reference(struct svga_winsys_screen *sws,
+ struct pipe_fence_handle **pdst,
+ struct pipe_fence_handle *src)
+{
+ (void)sws;
+ *pdst = src;
+}
+
+
+static int
+vmw_svga_winsys_fence_signalled(struct svga_winsys_screen *sws,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ (void)flag;
+ return vmw_ioctl_fence_signalled(vws, vmw_fence(fence));
+}
+
+
+static int
+vmw_svga_winsys_fence_finish(struct svga_winsys_screen *sws,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ (void)flag;
+ return vmw_ioctl_fence_finish(vws, vmw_fence(fence));
+}
+
+
+
+static struct svga_winsys_surface *
+vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws,
+ SVGA3dSurfaceFlags flags,
+ SVGA3dSurfaceFormat format,
+ SVGA3dSize size,
+ uint32 numFaces,
+ uint32 numMipLevels)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ struct vmw_svga_winsys_surface *surface;
+
+ surface = CALLOC_STRUCT(vmw_svga_winsys_surface);
+ if(!surface)
+ goto no_surface;
+
+ pipe_reference_init(&surface->refcnt, 1);
+ p_atomic_set(&surface->validated, 0);
+ surface->screen = vws;
+ surface->sid = vmw_ioctl_surface_create(vws,
+ flags, format, size,
+ numFaces, numMipLevels);
+ if(surface->sid == SVGA3D_INVALID_ID)
+ goto no_sid;
+
+ return svga_winsys_surface(surface);
+
+no_sid:
+ FREE(surface);
+no_surface:
+ return NULL;
+}
+
+
+static boolean
+vmw_svga_winsys_surface_is_flushed(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surface)
+{
+ struct vmw_svga_winsys_surface *vsurf = vmw_svga_winsys_surface(surface);
+ return (p_atomic_read(&vsurf->validated) == 0);
+}
+
+
+static void
+vmw_svga_winsys_surface_ref(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface **pDst,
+ struct svga_winsys_surface *src)
+{
+ struct vmw_svga_winsys_surface *d_vsurf = vmw_svga_winsys_surface(*pDst);
+ struct vmw_svga_winsys_surface *s_vsurf = vmw_svga_winsys_surface(src);
+
+ vmw_svga_winsys_surface_reference(&d_vsurf, s_vsurf);
+ *pDst = svga_winsys_surface(d_vsurf);
+}
+
+
+static void
+vmw_svga_winsys_destroy(struct svga_winsys_screen *sws)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+
+ vmw_winsys_destroy(vws);
+}
+
+
+static boolean
+vmw_svga_winsys_get_cap(struct svga_winsys_screen *sws,
+ SVGA3dDevCapIndex index,
+ SVGA3dDevCapResult *result)
+{
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
+ const uint32 *capsBlock;
+ const SVGA3dCapsRecord *capsRecord = NULL;
+ uint32 offset;
+ const SVGA3dCapPair *capArray;
+ int numCaps, first, last;
+
+ if(!vws->ioctl.fifo_map)
+ return FALSE;
+
+ if(vws->ioctl.fifo_map[SVGA_FIFO_3D_HWVERSION] < SVGA3D_HWVERSION_WS6_B1)
+ return FALSE;
+
+ /*
+ * Search linearly through the caps block records for the specified type.
+ */
+ capsBlock = (const uint32 *)&vws->ioctl.fifo_map[SVGA_FIFO_3D_CAPS];
+ for (offset = 0; capsBlock[offset] != 0; offset += capsBlock[offset]) {
+ const SVGA3dCapsRecord *record;
+ assert(offset < SVGA_FIFO_3D_CAPS_SIZE);
+ record = (const SVGA3dCapsRecord *) (capsBlock + offset);
+ if ((record->header.type >= SVGA3DCAPS_RECORD_DEVCAPS_MIN) &&
+ (record->header.type <= SVGA3DCAPS_RECORD_DEVCAPS_MAX) &&
+ (!capsRecord || (record->header.type > capsRecord->header.type))) {
+ capsRecord = record;
+ }
+ }
+
+ if(!capsRecord)
+ return FALSE;
+
+ /*
+ * Calculate the number of caps from the size of the record.
+ */
+ capArray = (const SVGA3dCapPair *) capsRecord->data;
+ numCaps = (int) ((capsRecord->header.length * sizeof(uint32) -
+ sizeof capsRecord->header) / (2 * sizeof(uint32)));
+
+ /*
+ * Binary-search for the cap with the specified index.
+ */
+ for (first = 0, last = numCaps - 1; first <= last; ) {
+ int mid = (first + last) / 2;
+
+ if ((SVGA3dDevCapIndex) capArray[mid][0] == index) {
+ /*
+ * Found it.
+ */
+ result->u = capArray[mid][1];
+ return TRUE;
+ }
+
+ /*
+ * Divide and conquer.
+ */
+ if ((SVGA3dDevCapIndex) capArray[mid][0] > index) {
+ last = mid - 1;
+ } else {
+ first = mid + 1;
+ }
+ }
+
+ return FALSE;
+}
+
+
+boolean
+vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
+{
+ vws->base.destroy = vmw_svga_winsys_destroy;
+ vws->base.get_cap = vmw_svga_winsys_get_cap;
+ vws->base.context_create = vmw_svga_winsys_context_create;
+ vws->base.surface_create = vmw_svga_winsys_surface_create;
+ vws->base.surface_is_flushed = vmw_svga_winsys_surface_is_flushed;
+ vws->base.surface_reference = vmw_svga_winsys_surface_ref;
+ vws->base.buffer_create = vmw_svga_winsys_buffer_create;
+ vws->base.buffer_map = vmw_svga_winsys_buffer_map;
+ vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap;
+ vws->base.buffer_destroy = vmw_svga_winsys_buffer_destroy;
+ vws->base.fence_reference = vmw_svga_winsys_fence_reference;
+ vws->base.fence_signalled = vmw_svga_winsys_fence_signalled;
+ vws->base.fence_finish = vmw_svga_winsys_fence_finish;
+
+ return TRUE;
+}
+
+
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c
new file mode 100644
index 0000000000..9ec4bf9272
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c
@@ -0,0 +1,59 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "svga_cmd.h"
+#include "util/u_debug.h"
+#include "util/u_memory.h"
+
+#include "vmw_surface.h"
+#include "vmw_screen.h"
+
+void
+vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
+ struct vmw_svga_winsys_surface *src)
+{
+ struct pipe_reference *src_ref;
+ struct pipe_reference *dst_ref;
+ struct vmw_svga_winsys_surface *dst = *pdst;
+
+ if(*pdst == src || pdst == NULL)
+ return;
+
+ src_ref = src ? &src->refcnt : NULL;
+ dst_ref = dst ? &dst->refcnt : NULL;
+
+ if (pipe_reference(&dst_ref, src_ref)) {
+ vmw_ioctl_surface_destroy(dst->screen, dst->sid);
+#ifdef DEBUG
+ /* to detect dangling pointers */
+ assert(p_atomic_read(&dst->validated) == 0);
+ dst->sid = SVGA3D_INVALID_ID;
+#endif
+ FREE(dst);
+ }
+
+ *pdst = src;
+}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.h b/src/gallium/winsys/drm/vmware/core/vmw_surface.h
new file mode 100644
index 0000000000..340cc1532e
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.h
@@ -0,0 +1,79 @@
+/**********************************************************
+ * Copyright 2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * Surfaces for VMware SVGA winsys.
+ *
+ * @author Jose Fonseca
+ */
+
+
+#ifndef VMW_SURFACE_H_
+#define VMW_SURFACE_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_atomic.h"
+#include "pipe/p_refcnt.h"
+
+#define VMW_MAX_PRESENTS 3
+
+
+
+struct vmw_svga_winsys_surface
+{
+ struct pipe_atomic validated;
+ struct pipe_reference refcnt;
+
+ struct vmw_winsys_screen *screen;
+ uint32_t sid;
+
+ /* FIXME: make this thread safe */
+ unsigned next_present_no;
+ uint32_t present_fences[VMW_MAX_PRESENTS];
+};
+
+
+static INLINE struct svga_winsys_surface *
+svga_winsys_surface(struct vmw_svga_winsys_surface *surf)
+{
+ assert(!surf || surf->sid != SVGA3D_INVALID_ID);
+ return (struct svga_winsys_surface *)surf;
+}
+
+
+static INLINE struct vmw_svga_winsys_surface *
+vmw_svga_winsys_surface(struct svga_winsys_surface *surf)
+{
+ return (struct vmw_svga_winsys_surface *)surf;
+}
+
+
+void
+vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
+ struct vmw_svga_winsys_surface *src);
+
+#endif /* VMW_SURFACE_H_ */
diff --git a/src/gallium/winsys/drm/vmware/dri/Makefile b/src/gallium/winsys/drm/vmware/dri/Makefile
new file mode 100644
index 0000000000..8a39e23da6
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/dri/Makefile
@@ -0,0 +1,18 @@
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = vmwgfx_dri.so
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
+ $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/svga/libsvga.a
+
+C_SOURCES = \
+ $(COMMON_GALLIUM_SOURCES)
+
+include ../../Makefile.template
+
+symlinks:
diff --git a/src/gallium/winsys/drm/vmware/dri/SConscript b/src/gallium/winsys/drm/vmware/dri/SConscript
new file mode 100644
index 0000000000..adf2bf16d1
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/dri/SConscript
@@ -0,0 +1,63 @@
+import os
+import os.path
+
+Import('*')
+
+if env['platform'] == 'linux':
+
+ if env['dri']:
+ env = env.Clone()
+
+ sources = [
+ '#/src/mesa/drivers/dri/common/utils.c',
+ '#/src/mesa/drivers/dri/common/vblank.c',
+ '#/src/mesa/drivers/dri/common/dri_util.c',
+ '#/src/mesa/drivers/dri/common/xmlconfig.c',
+ ]
+
+
+ env.ParseConfig('pkg-config --cflags --libs libdrm')
+
+ env.Prepend(CPPPATH = [
+ '#/src/mesa/state_tracker',
+ '#/src/mesa/drivers/dri/common',
+ '#/src/mesa/main',
+ '#/src/mesa/glapi',
+ '#/src/mesa',
+ '#/include',
+ '#/src/gallium/drivers/svga',
+ '#/src/gallium/drivers/svga/include',
+ ])
+
+ env.Append(CPPDEFINES = [
+ 'HAVE_STDINT_H',
+ 'HAVE_SYS_TYPES_H',
+ ])
+
+ env.Append(CFLAGS = [
+ '-Werror',
+ '-std=gnu99',
+ '-D_FILE_OFFSET_BITS=64',
+ ])
+
+ env.Prepend(LIBPATH = [
+ ])
+
+ env.Prepend(LIBS = [
+ trace,
+ st_dri,
+ svgadrm,
+ svga,
+ mesa,
+ auxiliaries,
+ ])
+
+ # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
+ env.LoadableModule(
+ target ='vmwgfx_dri.so',
+ source = sources,
+ LIBS = env['LIBS'],
+ SHLIBPREFIX = '',
+ )
+
+
diff --git a/src/gallium/winsys/drm/vmware/egl/Makefile b/src/gallium/winsys/drm/vmware/egl/Makefile
new file mode 100644
index 0000000000..8e2980c318
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/egl/Makefile
@@ -0,0 +1,18 @@
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = EGL_svga.so
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
+ $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/svga/libsvga.a
+
+C_SOURCES = \
+ $(COMMON_GALLIUM_SOURCES)
+
+include ../../Makefile.template
+
+symlinks:
diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile
new file mode 100644
index 0000000000..e152263256
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/xorg/Makefile
@@ -0,0 +1,54 @@
+TARGET = vmwgfx_drv.so
+CFILES = $(wildcard ./*.c)
+OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
+TOP = ../../../../../..
+
+include $(TOP)/configs/current
+
+INCLUDES = \
+ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
+ -I../gem \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium
+
+LIBS = \
+ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
+ $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/svga/libsvga.a \
+ $(GALLIUM_AUXILIARIES)
+
+DRIVER_DEFINES = \
+ -DHAVE_CONFIG_H
+
+
+#############################################
+
+
+
+all default: $(TARGET)
+
+$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS)
+ $(TOP)/bin/mklib -noprefix -o $@ \
+ $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel
+
+clean:
+ rm -rf $(OBJECTS) $(TARGET)
+
+install:
+ $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+ $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
+
+
+##############################################
+
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) $(DRIVER_DEFINES) $< -o $@
+
+
+##############################################
+
+.PHONY = all clean install
diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/winsys/drm/vmware/xorg/SConscript
new file mode 100644
index 0000000000..41a489774c
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/xorg/SConscript
@@ -0,0 +1,55 @@
+import os.path
+
+Import('*')
+
+if env['platform'] == 'linux':
+
+ env = env.Clone()
+
+ env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
+
+ env.Prepend(CPPPATH = [
+ '#/include',
+ '#/src/gallium',
+ '#/src/mesa',
+ '#/src/gallium/drivers/svga',
+ '#/src/gallium/drivers/svga/include',
+ ])
+
+ env.Append(CPPDEFINES = [
+ ])
+
+ if env['gcc']:
+ env.Append(CPPDEFINES = [
+ 'HAVE_STDINT_H',
+ 'HAVE_SYS_TYPES_H',
+ ])
+ env.Append(CFLAGS = ['-Werror'])
+
+ env.Append(CFLAGS = [
+ '-std=gnu99',
+ '-D_FILE_OFFSET_BITS=64',
+ ])
+
+ env.Prepend(LIBPATH = [
+ ])
+
+ env.Prepend(LIBS = [
+ trace,
+ st_xorg,
+ svgadrm,
+ svga,
+ auxiliaries,
+ ])
+
+ sources = [
+ 'vmw_xorg.c',
+ ]
+
+ # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
+ env.LoadableModule(
+ target ='vmwgfx_drv.so',
+ source = sources,
+ LIBS = env['LIBS'],
+ SHLIBPREFIX = '',
+ )
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
new file mode 100644
index 0000000000..3acc110ae7
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
@@ -0,0 +1,150 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * Glue file for Xorg State Tracker.
+ *
+ * @author Alan Hourihane
+ * @author Jakob Bornecrantz
+ */
+
+#include "state_trackers/xorg/xorg_winsys.h"
+
+static void vmw_xorg_identify(int flags);
+static Bool vmw_xorg_pci_probe(DriverPtr driver,
+ int entity_num,
+ struct pci_device *device,
+ intptr_t match_data);
+
+static const struct pci_id_match vmw_xorg_device_match[] = {
+ {0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0},
+};
+
+static SymTabRec vmw_xorg_chipsets[] = {
+ {PCI_MATCH_ANY, "VMware SVGA Device"},
+ {-1, NULL}
+};
+
+static PciChipsets vmw_xorg_pci_devices[] = {
+ {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
+ {-1, -1, NULL}
+};
+
+static XF86ModuleVersionInfo vmw_xorg_version = {
+ "vmwgfx",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 0, 1, 0, /* major, minor, patch */
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+/*
+ * Xorg driver exported structures
+ */
+
+_X_EXPORT DriverRec vmwgfx = {
+ 1,
+ "vmwgfx",
+ vmw_xorg_identify,
+ NULL,
+ xorg_tracker_available_options,
+ NULL,
+ 0,
+ NULL,
+ vmw_xorg_device_match,
+ vmw_xorg_pci_probe
+};
+
+static MODULESETUPPROTO(vmw_xorg_setup);
+
+_X_EXPORT XF86ModuleData vmwgfxModuleData = {
+ &vmw_xorg_version,
+ vmw_xorg_setup,
+ NULL
+};
+
+/*
+ * Xorg driver functions
+ */
+
+static pointer
+vmw_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = 0;
+
+ /* This module should be loaded only once, but check to be sure.
+ */
+ if (!setupDone) {
+ setupDone = 1;
+ xf86AddDriver(&vmwgfx, module, HaveDriverFuncs);
+
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (pointer) 1;
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+
+static void
+vmw_xorg_identify(int flags)
+{
+ xf86PrintChipsets("vmwgfx", "Driver for VMware SVGA device",
+ vmw_xorg_chipsets);
+}
+
+static Bool
+vmw_xorg_pci_probe(DriverPtr driver,
+ int entity_num, struct pci_device *device, intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ EntityInfoPtr entity;
+
+ scrn = xf86ConfigPciEntity(scrn, 0, entity_num, vmw_xorg_pci_devices,
+ NULL, NULL, NULL, NULL, NULL);
+ if (scrn != NULL) {
+ scrn->driverVersion = 1;
+ scrn->driverName = "vmwgfx";
+ scrn->name = "vmwgfx";
+ scrn->Probe = NULL;
+
+ entity = xf86GetEntityInfo(entity_num);
+
+ /* Use all the functions from the xorg tracker */
+ xorg_tracker_set_functions(scrn);
+ }
+ return scrn != NULL;
+}
--
cgit v1.2.3
From f7109aaf6c6020da89a0683cf5548181f2db36fb Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 17 Nov 2009 02:56:04 +0100
Subject: svga: Add vmwgfx_drm.h file from vmwgfx kernel driver
Add the vmwgfx_drm.h header for now, this allows the svga driver
to be enabled by default without forcing people to install the
vmwgfx_drm.h header on their system.
To be removed once vmwgfx_drm.h is in libdrm.
---
src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h | 442 ++++++++++++++++++++++++
1 file changed, 442 insertions(+)
create mode 100644 src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h
new file mode 100644
index 0000000000..6705dd4289
--- /dev/null
+++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h
@@ -0,0 +1,442 @@
+/**************************************************************************
+ *
+ * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
+ * 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
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _VMWGFX_DRM_H_
+#define _VMWGFX_DRM_H_
+
+#define DRM_VMW_MAX_SURFACE_FACES 6
+#define DRM_VMW_MAX_MIP_LEVELS 24
+
+#define DRM_VMW_EXT_NAME_LEN 128
+
+#define DRM_VMW_GET_PARAM 1
+#define DRM_VMW_EXTENSION 2
+#define DRM_VMW_CREATE_CONTEXT 3
+#define DRM_VMW_UNREF_CONTEXT 4
+#define DRM_VMW_CREATE_SURFACE 5
+#define DRM_VMW_UNREF_SURFACE 6
+#define DRM_VMW_REF_SURFACE 7
+#define DRM_VMW_EXECBUF 8
+#define DRM_VMW_ALLOC_DMABUF 9
+#define DRM_VMW_UNREF_DMABUF 10
+#define DRM_VMW_FIFO_DEBUG 11
+#define DRM_VMW_FENCE_WAIT 12
+
+
+/*************************************************************************/
+/**
+ * DRM_VMW_GET_PARAM - get device information.
+ *
+ * Currently we support only one parameter:
+ *
+ * DRM_VMW_PARAM_FIFO_OFFSET:
+ * Offset to use to map the first page of the FIFO read-only.
+ * The fifo is mapped using the mmap() system call on the drm device.
+ */
+
+#define DRM_VMW_PARAM_FIFO_OFFSET 0
+
+/**
+ * struct drm_vmw_getparam_arg
+ *
+ * @value: Returned value. //Out
+ * @param: Parameter to query. //In.
+ *
+ * Argument to the DRM_VMW_GET_PARAM Ioctl.
+ */
+
+struct drm_vmw_getparam_arg {
+ uint64_t value;
+ uint32_t param;
+ uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_EXTENSION - Query device extensions.
+ */
+
+/**
+ * struct drm_vmw_extension_rep
+ *
+ * @exists: The queried extension exists.
+ * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension.
+ * @driver_sarea_offset: Offset to any space in the DRI SAREA
+ * used by the extension.
+ * @major: Major version number of the extension.
+ * @minor: Minor version number of the extension.
+ * @pl: Patch level version number of the extension.
+ *
+ * Output argument to the DRM_VMW_EXTENSION Ioctl.
+ */
+
+struct drm_vmw_extension_rep {
+ int32_t exists;
+ uint32_t driver_ioctl_offset;
+ uint32_t driver_sarea_offset;
+ uint32_t major;
+ uint32_t minor;
+ uint32_t pl;
+ uint32_t pad64;
+};
+
+/**
+ * union drm_vmw_extension_arg
+ *
+ * @extension - Ascii name of the extension to be queried. //In
+ * @rep - Reply as defined above. //Out
+ *
+ * Argument to the DRM_VMW_EXTENSION Ioctl.
+ */
+
+union drm_vmw_extension_arg {
+ char extension[DRM_VMW_EXT_NAME_LEN];
+ struct drm_vmw_extension_rep rep;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CREATE_CONTEXT - Create a host context.
+ *
+ * Allocates a device unique context id, and queues a create context command
+ * for the host. Does not wait for host completion.
+ */
+
+/**
+ * struct drm_vmw_context_arg
+ *
+ * @cid: Device unique context ID.
+ *
+ * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
+ * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
+ */
+
+struct drm_vmw_context_arg {
+ int32_t cid;
+ uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_CONTEXT - Create a host context.
+ *
+ * Frees a global context id, and queues a destroy host command for the host.
+ * Does not wait for host completion. The context ID can be used directly
+ * in the command stream and shows up as the same context ID on the host.
+ */
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CREATE_SURFACE - Create a host suface.
+ *
+ * Allocates a device unique surface id, and queues a create surface command
+ * for the host. Does not wait for host completion. The surface ID can be
+ * used directly in the command stream and shows up as the same surface
+ * ID on the host.
+ */
+
+/**
+ * struct drm_wmv_surface_create_req
+ *
+ * @flags: Surface flags as understood by the host.
+ * @format: Surface format as understood by the host.
+ * @mip_levels: Number of mip levels for each face.
+ * An unused face should have 0 encoded.
+ * @size_addr: Address of a user-space array of sruct drm_vmw_size
+ * cast to an uint64_t for 32-64 bit compatibility.
+ * The size of the array should equal the total number of mipmap levels.
+ * @shareable: Boolean whether other clients (as identified by file descriptors)
+ * may reference this surface.
+ *
+ * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
+ * Output data from the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+struct drm_vmw_surface_create_req {
+ uint32_t flags;
+ uint32_t format;
+ uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
+ uint64_t size_addr;
+ int32_t shareable;
+ uint32_t pad64;
+};
+
+/**
+ * struct drm_wmv_surface_arg
+ *
+ * @sid: Surface id of created surface or surface to destroy or reference.
+ *
+ * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
+ * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
+ * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+struct drm_vmw_surface_arg {
+ int32_t sid;
+ uint32_t pad64;
+};
+
+/**
+ * struct drm_vmw_size ioctl.
+ *
+ * @width - mip level width
+ * @height - mip level height
+ * @depth - mip level depth
+ *
+ * Description of a mip level.
+ * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
+ */
+
+struct drm_vmw_size {
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
+ uint32_t pad64;
+};
+
+/**
+ * union drm_vmw_surface_create_arg
+ *
+ * @rep: Output data as described above.
+ * @req: Input data as described above.
+ *
+ * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
+ */
+
+union drm_vmw_surface_create_arg {
+ struct drm_vmw_surface_arg rep;
+ struct drm_vmw_surface_create_req req;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_REF_SURFACE - Reference a host surface.
+ *
+ * Puts a reference on a host surface with a give sid, as previously
+ * returned by the DRM_VMW_CREATE_SURFACE ioctl.
+ * A reference will make sure the surface isn't destroyed while we hold
+ * it and will allow the calling client to use the surface ID in the command
+ * stream.
+ *
+ * On successful return, the Ioctl returns the surface information given
+ * in the DRM_VMW_CREATE_SURFACE ioctl.
+ */
+
+/**
+ * union drm_vmw_surface_reference_arg
+ *
+ * @rep: Output data as described above.
+ * @req: Input data as described above.
+ *
+ * Argument to the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+union drm_vmw_surface_reference_arg {
+ struct drm_vmw_surface_create_req rep;
+ struct drm_vmw_surface_arg req;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
+ *
+ * Clear a reference previously put on a host surface.
+ * When all references are gone, including the one implicitly placed
+ * on creation,
+ * a destroy surface command will be queued for the host.
+ * Does not wait for completion.
+ */
+
+/*************************************************************************/
+/**
+ * DRM_VMW_EXECBUF
+ *
+ * Submit a command buffer for execution on the host, and return a
+ * fence sequence that when signaled, indicates that the command buffer has
+ * executed.
+ */
+
+/**
+ * struct drm_vmw_execbuf_arg
+ *
+ * @commands: User-space address of a command buffer cast to an uint64_t.
+ * @command-size: Size in bytes of the command buffer.
+ * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
+ * uint64_t.
+ *
+ * Argument to the DRM_VMW_EXECBUF Ioctl.
+ */
+
+struct drm_vmw_execbuf_arg {
+ uint64_t commands;
+ uint32_t command_size;
+ uint32_t pad64;
+ uint64_t fence_rep;
+};
+
+/**
+ * struct drm_vmw_fence_rep
+ *
+ * @fence_seq: Fence sequence associated with a command submission.
+ * @error: This member should've been set to -EFAULT on submission.
+ * The following actions should be take on completion:
+ * error == -EFAULT: Fence communication failed. The host is synchronized.
+ * Use the last fence id read from the FIFO fence register.
+ * error != 0 && error != -EFAULT:
+ * Fence submission failed. The host is synchronized. Use the fence_seq member.
+ * error == 0: All is OK, The host may not be synchronized.
+ * Use the fence_seq member.
+ *
+ * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
+ */
+
+struct drm_vmw_fence_rep {
+ uint64_t fence_seq;
+ int32_t error;
+ uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_ALLOC_DMABUF
+ *
+ * Allocate a DMA buffer that is visible also to the host.
+ * NOTE: The buffer is
+ * identified by a handle and an offset, which are private to the guest, but
+ * useable in the command stream. The guest kernel may translate these
+ * and patch up the command stream accordingly. In the future, the offset may
+ * be zero at all times, or it may disappear from the interface before it is
+ * fixed.
+ *
+ * The DMA buffer may stay user-space mapped in the guest at all times,
+ * and is thus suitable for sub-allocation.
+ *
+ * DMA buffers are mapped using the mmap() syscall on the drm device.
+ */
+
+/**
+ * struct drm_vmw_alloc_dmabuf_req
+ *
+ * @size: Required minimum size of the buffer.
+ *
+ * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+struct drm_vmw_alloc_dmabuf_req {
+ uint32_t size;
+ uint32_t pad64;
+};
+
+/**
+ * struct drm_vmw_dmabuf_rep
+ *
+ * @map_handle: Offset to use in the mmap() call used to map the buffer.
+ * @handle: Handle unique to this buffer. Used for unreferencing.
+ * @cur_gmr_id: GMR id to use in the command stream when this buffer is
+ * referenced. See not above.
+ * @cur_gmr_offset: Offset to use in the command stream when this buffer is
+ * referenced. See note above.
+ *
+ * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+struct drm_vmw_dmabuf_rep {
+ uint64_t map_handle;
+ uint32_t handle;
+ uint32_t cur_gmr_id;
+ uint32_t cur_gmr_offset;
+ uint32_t pad64;
+};
+
+/**
+ * union drm_vmw_dmabuf_arg
+ *
+ * @req: Input data as described above.
+ * @rep: Output data as described above.
+ *
+ * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+union drm_vmw_alloc_dmabuf_arg {
+ struct drm_vmw_alloc_dmabuf_req req;
+ struct drm_vmw_dmabuf_rep rep;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
+ *
+ */
+
+/**
+ * struct drm_vmw_unref_dmabuf_arg
+ *
+ * @handle: Handle indicating what buffer to free. Obtained from the
+ * DRM_VMW_ALLOC_DMABUF Ioctl.
+ *
+ * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
+ */
+
+struct drm_vmw_unref_dmabuf_arg {
+ uint32_t handle;
+ uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_FIFO_DEBUG - Get last FIFO submission.
+ *
+ * This IOCTL copies the last FIFO submission directly out of the FIFO buffer.
+ */
+
+/**
+ * struct drm_vmw_fifo_debug_arg
+ *
+ * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In
+ * @debug_buffer_size: Size in bytes of debug buffer //In
+ * @used_size: Number of bytes copied to the buffer // Out
+ * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out
+ *
+ * Argument to the DRM_VMW_FIFO_DEBUG Ioctl.
+ */
+
+struct drm_vmw_fifo_debug_arg {
+ uint64_t debug_buffer;
+ uint32_t debug_buffer_size;
+ uint32_t used_size;
+ int32_t did_not_fit;
+ uint32_t pad64;
+};
+
+struct drm_vmw_fence_wait_arg {
+ uint64_t sequence;
+ uint64_t kernel_cookie;
+ int32_t cookie_valid;
+ int32_t pad64;
+};
+
+#endif
--
cgit v1.2.3
From 60769b232c8eedddc24f25ab91f35bcb6973dded Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Thu, 12 Nov 2009 01:28:26 +0100
Subject: svga: Build svga driver
---
SConstruct | 8 ++++----
configs/default | 2 +-
configs/linux-dri | 2 +-
configure.ac | 13 +++++++++++++
src/gallium/winsys/drm/SConscript | 5 +++++
5 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/SConstruct b/SConstruct
index d53f4401e5..f43c10cecb 100644
--- a/SConstruct
+++ b/SConstruct
@@ -32,10 +32,10 @@ import common
default_statetrackers = 'mesa'
if common.default_platform in ('linux', 'freebsd', 'darwin'):
- default_drivers = 'softpipe,failover,i915,trace,identity,llvmpipe'
+ default_drivers = 'softpipe,failover,svga,i915,trace,identity,llvmpipe'
default_winsys = 'xlib'
elif common.default_platform in ('winddk',):
- default_drivers = 'softpipe,i915,trace,identity'
+ default_drivers = 'softpipe,svga,i915,trace,identity'
default_winsys = 'all'
else:
default_drivers = 'all'
@@ -46,9 +46,9 @@ common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
['mesa', 'python', 'xorg']))
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
- ['softpipe', 'failover', 'i915', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
+ ['softpipe', 'failover', 'svga', 'i915', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
- ['xlib', 'intel', 'gdi', 'radeon']))
+ ['xlib', 'vmware', 'intel', 'gdi', 'radeon']))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
diff --git a/configs/default b/configs/default
index c3bb47e70d..9af816cf9b 100644
--- a/configs/default
+++ b/configs/default
@@ -96,7 +96,7 @@ EGL_DRIVERS_DIRS = demo
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices vl
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
-GALLIUM_DRIVERS_DIRS = softpipe i915 failover trace identity
+GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = xlib egl_xlib
GALLIUM_WINSYS_DRM_DIRS =
diff --git a/configs/linux-dri b/configs/linux-dri
index 6c3c0ab921..0802543347 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -60,7 +60,7 @@ EGL_DRIVERS_DIRS = demo glx
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
GALLIUM_WINSYS_DIRS = drm
-GALLIUM_WINSYS_DRM_DIRS = intel
+GALLIUM_WINSYS_DRM_DIRS = vmware intel
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
diff --git a/configure.ac b/configure.ac
index cc588d5fab..f9476a46dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1189,6 +1189,19 @@ AC_ARG_WITH([max-height],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
+dnl
+dnl Gallium SVGA configuration
+dnl
+AC_ARG_ENABLE([gallium-svga],
+ [AS_HELP_STRING([--disable-gallium-svga],
+ [build gallium SVGA @<:@default=enabled@:>@])],
+ [enable_gallium_svga="$enableval"],
+ [enable_gallium_svga=yes])
+if test "x$enable_gallium_svga" = xyes; then
+ GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
+fi
+
dnl
dnl Gallium Intel configuration
dnl
diff --git a/src/gallium/winsys/drm/SConscript b/src/gallium/winsys/drm/SConscript
index a9e9f2682a..9f7b383d2d 100644
--- a/src/gallium/winsys/drm/SConscript
+++ b/src/gallium/winsys/drm/SConscript
@@ -48,6 +48,11 @@ if env['dri']:
# $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
# $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
+ if 'vmware' in env['winsys']:
+ SConscript([
+ 'vmware/SConscript',
+ ])
+
if 'intel' in env['winsys']:
SConscript([
'intel/SConscript',
--
cgit v1.2.3
From 0e790ac35327a0b53a4a595a6429135317302269 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 16 Nov 2009 18:22:26 -0800
Subject: progs/util: Fix memory leak if LoadYUVImage fails.
---
progs/util/readtex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 8e923b6eb4..134eb79100 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -438,6 +438,7 @@ GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height )
fprintf(stderr,
"Error in LoadYUVImage %d-component images not implemented\n",
image->components );
+ FreeImage(image);
return NULL;
}
--
cgit v1.2.3
From e015a4c29bf61077a50780cc99381510671b20ec Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Tue, 17 Nov 2009 16:06:26 +1000
Subject: radeon: rn50's have no 3D engine so don't try and init 3D driver.
---
src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 7a124a8be6..2bcceb16d6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -390,12 +390,14 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
screen->device_id = device_id;
screen->chip_flags = 0;
switch ( device_id ) {
+ case PCI_CHIP_RN50_515E:
+ case PCI_CHIP_RN50_5969:
+ return -1;
+
case PCI_CHIP_RADEON_LY:
case PCI_CHIP_RADEON_LZ:
case PCI_CHIP_RADEON_QY:
case PCI_CHIP_RADEON_QZ:
- case PCI_CHIP_RN50_515E:
- case PCI_CHIP_RN50_5969:
screen->chip_family = CHIP_FAMILY_RV100;
break;
--
cgit v1.2.3
From 2d0c2952566810ef1b277b49b064f4874a973112 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 08:05:22 +0100
Subject: Add MESA_FORMAT_XRGB8888_REV.
---
src/mesa/main/formats.c | 9 +++++++++
src/mesa/main/formats.h | 1 +
src/mesa/main/texfetch.c | 7 +++++++
src/mesa/main/texfetch_tmp.h | 24 ++++++++++++++++++++++++
src/mesa/main/texstore.c | 11 ++++++++---
5 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 7d64c462b1..329b795074 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -132,6 +132,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 4 /* BlockWidth/Height,Bytes */
},
+ {
+ MESA_FORMAT_XRGB8888_REV, /* Name */
+ "MESA_FORMAT_XRGB8888_REV", /* StrName */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED, /* DataType */
+ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
+ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
+ 1, 1, 4 /* BlockWidth/Height,Bytes */
+ },
{
MESA_FORMAT_RGB888, /* Name */
"MESA_FORMAT_RGB888", /* StrName */
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index d3ac436b1b..eba28a69be 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -55,6 +55,7 @@ typedef enum
MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+ MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index c431d3a1db..f4f2be48c3 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -375,6 +375,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
fetch_texel_3d_f_xrgb8888,
store_texel_xrgb8888
},
+ {
+ MESA_FORMAT_XRGB8888_REV,
+ fetch_texel_1d_f_xrgb8888_rev,
+ fetch_texel_2d_f_xrgb8888_rev,
+ fetch_texel_3d_f_xrgb8888_rev,
+ store_texel_xrgb8888_rev,
+ },
{
MESA_FORMAT_RGB888,
fetch_texel_1d_f_rgb888,
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
index 093e0abc49..6fac7ba1e1 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -559,6 +559,30 @@ static void store_texel_xrgb8888(struct gl_texture_image *texImage,
#endif
+/* MESA_FORMAT_XRGB8888_REV **************************************************/
+
+/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[ACOMP] = 1.0f;
+}
+
+#if DIM == 3
+static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], 0xff);
+}
+#endif
+
+
/* MESA_FORMAT_RGB888 ********************************************************/
/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 7cf3287713..abb4ed2663 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1410,7 +1410,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
ASSERT(dstFormat == MESA_FORMAT_ARGB8888 ||
dstFormat == MESA_FORMAT_ARGB8888_REV ||
- dstFormat == MESA_FORMAT_XRGB8888);
+ dstFormat == MESA_FORMAT_XRGB8888 ||
+ dstFormat == MESA_FORMAT_XRGB8888_REV );
ASSERT(texelBytes == 4);
if (!ctx->_ImageTransferState &&
@@ -1431,7 +1432,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_ARGB8888_REV &&
+ (dstFormat == MESA_FORMAT_ARGB8888_REV ||
+ dstFormat == MESA_FORMAT_XRGB8888_REV) &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
@@ -1524,7 +1526,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
*/
if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
(littleEndian && dstFormat == MESA_FORMAT_XRGB8888) ||
- (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) {
+ (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV)) {
dstmap[3] = 3; /* alpha */
dstmap[2] = 0; /* red */
dstmap[1] = 1; /* green */
@@ -1533,6 +1536,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
else {
assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
(!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
+ (littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV) ||
(!littleEndian && dstFormat == MESA_FORMAT_XRGB8888));
dstmap[3] = 2;
dstmap[2] = 1;
@@ -3133,6 +3137,7 @@ texstore_funcs[MESA_FORMAT_COUNT] =
{ MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 },
{ MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 },
{ MESA_FORMAT_XRGB8888, _mesa_texstore_argb8888 },
+ { MESA_FORMAT_XRGB8888_REV, _mesa_texstore_argb8888 },
{ MESA_FORMAT_RGB888, _mesa_texstore_rgb888 },
{ MESA_FORMAT_BGR888, _mesa_texstore_bgr888 },
{ MESA_FORMAT_RGB565, _mesa_texstore_rgb565 },
--
cgit v1.2.3
From f2651264d385fb31f89859fc1287ca0e41835cf4 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 08:05:22 +0100
Subject: radeon: FBO fixes for big endian.
---
src/mesa/drivers/dri/r300/r300_cmdbuf.c | 15 +++++++++++++
src/mesa/drivers/dri/radeon/radeon_fbo.c | 34 ++++++++++++++++++++++-------
src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++---
3 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 1e2a54f634..c7996eb76a 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -281,12 +281,27 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
cbpitch |= R300_COLOR_FORMAT_ARGB8888;
else switch (rrb->base.Format) {
case MESA_FORMAT_RGB565:
+ assert(_mesa_little_endian());
+ cbpitch |= R300_COLOR_FORMAT_RGB565;
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_RGB565;
break;
case MESA_FORMAT_ARGB4444:
+ assert(_mesa_little_endian());
+ cbpitch |= R300_COLOR_FORMAT_ARGB4444;
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB4444;
break;
case MESA_FORMAT_ARGB1555:
+ assert(_mesa_little_endian());
+ cbpitch |= R300_COLOR_FORMAT_ARGB1555;
+ break;
+ case MESA_FORMAT_ARGB1555_REV:
+ assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB1555;
break;
default:
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index bf69cd9337..7ec641ff18 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -90,7 +90,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
- rb->Format = MESA_FORMAT_RGB565;
+ rb->Format = _dri_texformat_rgb565;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 2;
break;
@@ -99,7 +99,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- rb->Format = MESA_FORMAT_ARGB8888;
+ rb->Format = _dri_texformat_argb8888;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
@@ -111,7 +111,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- rb->Format = MESA_FORMAT_ARGB8888;
+ rb->Format = _dri_texformat_argb8888;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
@@ -261,14 +261,32 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv)
switch (format) {
case MESA_FORMAT_RGB565:
+ assert(_mesa_little_endian());
+ rrb->base.DataType = GL_UNSIGNED_BYTE;
+ rrb->base._BaseFormat = GL_RGB;
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ assert(!_mesa_little_endian());
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGB;
break;
case MESA_FORMAT_XRGB8888:
+ assert(_mesa_little_endian());
+ rrb->base.DataType = GL_UNSIGNED_BYTE;
+ rrb->base._BaseFormat = GL_RGB;
+ break;
+ case MESA_FORMAT_XRGB8888_REV:
+ assert(!_mesa_little_endian());
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGB;
break;
case MESA_FORMAT_ARGB8888:
+ assert(_mesa_little_endian());
+ rrb->base.DataType = GL_UNSIGNED_BYTE;
+ rrb->base._BaseFormat = GL_RGBA;
+ break;
+ case MESA_FORMAT_ARGB8888_REV:
+ assert(!_mesa_little_endian());
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGBA;
break;
@@ -359,21 +377,21 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
gl_format texFormat;
restart:
- if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
+ if (texImage->TexFormat == _dri_texformat_argb8888) {
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGBA8 texture OK\n");
}
- else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
+ else if (texImage->TexFormat == _dri_texformat_rgb565) {
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGB5 texture OK\n");
}
- else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
+ else if (texImage->TexFormat == _dri_texformat_argb1555) {
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB1555 texture OK\n");
}
- else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
+ else if (texImage->TexFormat == _dri_texformat_argb4444) {
rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to ARGB1555 texture OK\n");
+ DBG("Render to ARGB4444 texture OK\n");
}
else if (texImage->TexFormat == MESA_FORMAT_Z16) {
rrb->base.DataType = GL_UNSIGNED_SHORT;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 2bcceb16d6..be2d8365ef 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -1484,11 +1484,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
_mesa_initialize_framebuffer(&rfb->base, mesaVis);
if (mesaVis->redBits == 5)
- rgbFormat = MESA_FORMAT_RGB565;
+ rgbFormat = _mesa_little_endian() ? MESA_FORMAT_RGB565 : MESA_FORMAT_RGB565_REV;
else if (mesaVis->alphaBits == 0)
- rgbFormat = MESA_FORMAT_XRGB8888;
+ rgbFormat = _mesa_little_endian() ? MESA_FORMAT_XRGB8888 : MESA_FORMAT_XRGB8888_REV;
else
- rgbFormat = MESA_FORMAT_ARGB8888;
+ rgbFormat = _mesa_little_endian() ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB8888_REV;
/* front color renderbuffer */
rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
--
cgit v1.2.3
From 22627654256ee09bfd659624568865a79eb725b6 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 08:05:23 +0100
Subject: radeon: Fix software fallbacks with KMS on big endian.
---
src/mesa/drivers/dri/common/spantmp2.h | 152 ++++++++++++++++++++++++++++++
src/mesa/drivers/dri/radeon/radeon_span.c | 63 +++++++++++++
2 files changed, 215 insertions(+)
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index 89c815722f..dd5e29f8ce 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -82,6 +82,71 @@
rgba[3] = 0xff; \
} while (0)
+#elif (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5_REV)
+
+/**
+ ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_565_REV( color[0], color[1], color[2] )
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_565_REV( r, g, b ))
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = bswap_16(GET_VALUE(_x, _y)); \
+ rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
+ rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
+ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
+ rgba[3] = 0xff; \
+ } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_4444_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_4444_REV(a, r, g, b)) \
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = GET_VALUE(_x, _y); \
+ rgba[0] = ((p >> 0) & 0xf) * 0x11; \
+ rgba[1] = ((p >> 12) & 0xf) * 0x11; \
+ rgba[2] = ((p >> 4) & 0xf) * 0x11; \
+ rgba[3] = ((p >> 8) & 0xf) * 0x11; \
+ } while (0)
+
+
#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV)
/**
@@ -147,6 +212,38 @@
rgba[3] = ((p >> 15) & 0x1) * 0xff; \
} while (0)
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_1555_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_1555_REV(a, r, g, b)) \
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = bswap_16(GET_VALUE(_x, _y)); \
+ rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \
+ rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \
+ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
+ rgba[3] = ((p >> 15) & 0x1) * 0xff; \
+ } while (0)
+
#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
/**
@@ -202,6 +299,61 @@
} while (0)
# endif
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_8888(color[2], color[1], color[0], color[3])
+
+# define WRITE_RGBA(_x, _y, r, g, b, a) \
+ PUT_VALUE(_x, _y, ((r << 8) | \
+ (g << 16) | \
+ (b << 24) | \
+ (a << 0)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+# define READ_RGBA(rgba, _x, _y) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ __asm__ __volatile__( "rorl $8, %0" \
+ : "=r" (p) : "0" (p) ); \
+ ((GLuint *)rgba)[0] = p; \
+ } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+ /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+ * rotlwi instruction. It also produces good code on SPARC.
+ */
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = CPU_TO_LE32(GET_VALUE(_x, _y)); \
+ GLuint t = p; \
+ *((uint32_t *) rgba) = (t >> 24) | (p << 8); \
+ } while (0)
+# else
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ rgba[0] = (p >> 8) & 0xff; \
+ rgba[1] = (p >> 16) & 0xff; \
+ rgba[2] = (p >> 24) & 0xff; \
+ rgba[3] = (p >> 0) & 0xff; \
+ } while (0)
+# endif
+
#else
#error SPANTMP_PIXEL_FMT must be set to a valid value!
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 2bc7d31254..30a8762586 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -41,6 +41,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "main/glheader.h"
+#include "main/texformat.h"
#include "swrast/swrast.h"
#include "radeon_common.h"
@@ -400,6 +401,18 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#endif
#include "spantmp2.h"
+#define SPANTMP_PIXEL_FMT GL_RGB
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5_REV
+
+#define TAG(x) radeon##x##_RGB565_REV
+#define TAG2(x,y) radeon##x##_RGB565_REV##y
+#if defined(RADEON_R600)
+#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off)
+#else
+#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
+#endif
+#include "spantmp2.h"
+
/* 16 bit, ARGB1555 color spanline and pixel functions
*/
#define SPANTMP_PIXEL_FMT GL_BGRA
@@ -414,6 +427,14 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#endif
#include "spantmp2.h"
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5
+
+#define TAG(x) radeon##x##_ARGB1555_REV
+#define TAG2(x,y) radeon##x##_ARGB1555_REV##y
+#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
+#include "spantmp2.h"
+
/* 16 bit, RGBA4 color spanline and pixel functions
*/
#define SPANTMP_PIXEL_FMT GL_BGRA
@@ -428,6 +449,14 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#endif
#include "spantmp2.h"
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4
+
+#define TAG(x) radeon##x##_ARGB4444_REV
+#define TAG2(x,y) radeon##x##_ARGB4444_REV##y
+#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
+#include "spantmp2.h"
+
/* 32 bit, xRGB8888 color spanline and pixel functions
*/
#define SPANTMP_PIXEL_FMT GL_BGRA
@@ -472,6 +501,30 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#endif
#include "spantmp2.h"
+/* 32 bit, BGRx8888 color spanline and pixel functions
+ */
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8
+
+#define TAG(x) radeon##x##_BGRx8888
+#define TAG2(x,y) radeon##x##_BGRx8888##y
+#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff))
+#define PUT_VALUE(_x, _y, d) { \
+ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
+ *_ptr = d; \
+} while (0)
+#include "spantmp2.h"
+
+/* 32 bit, BGRA8888 color spanline and pixel functions
+ */
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8
+
+#define TAG(x) radeon##x##_BGRA8888
+#define TAG2(x,y) radeon##x##_BGRA8888##y
+#define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off)
+#include "spantmp2.h"
+
/* ================================================================
* Depth buffer
*/
@@ -848,14 +901,24 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb)
{
if (rrb->base.Format == MESA_FORMAT_RGB565) {
radeonInitPointers_RGB565(&rrb->base);
+ } else if (rrb->base.Format == MESA_FORMAT_RGB565_REV) {
+ radeonInitPointers_RGB565_REV(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_XRGB8888) {
radeonInitPointers_xRGB8888(&rrb->base);
+ } else if (rrb->base.Format == MESA_FORMAT_XRGB8888_REV) {
+ radeonInitPointers_BGRx8888(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_ARGB8888) {
radeonInitPointers_ARGB8888(&rrb->base);
+ } else if (rrb->base.Format == MESA_FORMAT_ARGB8888_REV) {
+ radeonInitPointers_BGRA8888(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_ARGB4444) {
radeonInitPointers_ARGB4444(&rrb->base);
+ } else if (rrb->base.Format == MESA_FORMAT_ARGB4444_REV) {
+ radeonInitPointers_ARGB4444_REV(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_ARGB1555) {
radeonInitPointers_ARGB1555(&rrb->base);
+ } else if (rrb->base.Format == MESA_FORMAT_ARGB1555_REV) {
+ radeonInitPointers_ARGB1555_REV(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_Z16) {
radeonInitDepthPointers_z16(&rrb->base);
} else if (rrb->base.Format == MESA_FORMAT_X8_Z24) {
--
cgit v1.2.3
From 592ce48ce9eecfdd74f59e52c8d51bdb62059e3d Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 08:05:24 +0100
Subject: radeon: Fix occlusion queries on big endian.
---
src/mesa/drivers/dri/radeon/radeon_queryobj.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index 6539c36268..452d0446f9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -49,6 +49,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = (struct radeon_query_object *)q;
+ uint32_t *result;
int i;
radeon_print(RADEON_STATE, RADEON_VERBOSE,
@@ -56,6 +57,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
__FUNCTION__, query->Base.Id, (int) query->Base.Result);
radeon_bo_map(query->bo, GL_FALSE);
+ result = query->bo->ptr;
query->Base.Result = 0;
if (IS_R600_CLASS(radeon->radeonScreen)) {
@@ -66,10 +68,11 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
* hw writes zpass end counts to qwords 1, 3, 5, 7.
* then we substract. MSB is the valid bit.
*/
- uint64_t *result = query->bo->ptr;
- for (i = 0; i < 8; i += 2) {
- uint64_t start = result[i];
- uint64_t end = result[i + 1];
+ for (i = 0; i < 16; i += 4) {
+ uint64_t start = (uint64_t)LE32_TO_CPU(result[i]) |
+ (uint64_t)LE32_TO_CPU(result[i + 1]) << 32;
+ uint64_t end = (uint64_t)LE32_TO_CPU(result[i + 2]) |
+ (uint64_t)LE32_TO_CPU(result[i + 3]) << 32;
if ((start & 0x8000000000000000) && (end & 0x8000000000000000)) {
uint64_t query_count = end - start;
query->Base.Result += query_count;
@@ -79,10 +82,9 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
"%d start: %lx, end: %lx %ld\n", i, start, end, end - start);
}
} else {
- uint32_t *result = query->bo->ptr;
for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) {
- query->Base.Result += result[i];
- radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, result[i]);
+ query->Base.Result += LE32_TO_CPU(result[i]);
+ radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, LE32_TO_CPU(result[i]));
}
}
--
cgit v1.2.3
From 081bf9563fca3f64aed8676f20d17af3eb115016 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 08:05:24 +0100
Subject: radeon: Depth/stencil span code fixes for big endian.
Fixes e.g. text in progs/demos/arbocclude.
---
src/mesa/drivers/dri/radeon/radeon_span.c | 48 +++++++++++++++----------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 30a8762586..390d522856 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -579,10 +579,10 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0x000000ff; \
tmp |= ((d << 8) & 0xffffff00); \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#elif defined(RADEON_R600)
#define WRITE_DEPTH( _x, _y, d ) \
@@ -597,26 +597,26 @@ do { \
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0xff000000; \
tmp |= ((d) & 0x00ffffff); \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#else
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0xff000000; \
tmp |= ((d) & 0x00ffffff); \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#endif
#if defined(RADEON_R300)
#define READ_DEPTH( d, _x, _y ) \
do { \
- d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0xffffff00) >> 8; \
+ d = (LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0xffffff00) >> 8; \
}while(0)
#elif defined(RADEON_R600)
#define READ_DEPTH( d, _x, _y ) \
@@ -626,11 +626,11 @@ do { \
#elif defined(RADEON_R200)
#define READ_DEPTH( d, _x, _y ) \
do { \
- d = *(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off)) & 0x00ffffff; \
+ d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; \
}while(0)
#else
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0x00ffffff;
+ d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff;
#endif
#define TAG(x) radeon##x##_z24
@@ -648,7 +648,7 @@ do { \
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- *_ptr = d; \
+ *_ptr = CPU_TO_LE32(d); \
} while (0)
#elif defined(RADEON_R600)
#define WRITE_DEPTH( _x, _y, d ) \
@@ -668,20 +668,20 @@ do { \
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \
- *_ptr = d; \
+ *_ptr = CPU_TO_LE32(d); \
} while (0)
#else
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- *_ptr = d; \
+ *_ptr = CPU_TO_LE32(d); \
} while (0)
#endif
#if defined(RADEON_R300)
#define READ_DEPTH( d, _x, _y ) \
do { \
- d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
+ d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
}while(0)
#elif defined(RADEON_R600)
#define READ_DEPTH( d, _x, _y ) \
@@ -692,11 +692,11 @@ do { \
#elif defined(RADEON_R200)
#define READ_DEPTH( d, _x, _y ) \
do { \
- d = *(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off)); \
+ d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))); \
}while(0)
#else
#define READ_DEPTH( d, _x, _y ) do { \
- d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off )); \
+ d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
} while (0)
#endif
@@ -713,10 +713,10 @@ do { \
#define WRITE_STENCIL( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0xffffff00; \
tmp |= (d) & 0xff; \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#elif defined(RADEON_R600)
#define WRITE_STENCIL( _x, _y, d ) \
@@ -731,19 +731,19 @@ do { \
#define WRITE_STENCIL( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte(rrb, _x + x_off, _y + y_off); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0x00ffffff; \
tmp |= (((d) & 0xff) << 24); \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#else
#define WRITE_STENCIL( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
tmp &= 0x00ffffff; \
tmp |= (((d) & 0xff) << 24); \
- *_ptr = tmp; \
+ *_ptr = CPU_TO_LE32(tmp); \
} while (0)
#endif
@@ -751,7 +751,7 @@ do { \
#define READ_STENCIL( d, _x, _y ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
d = tmp & 0x000000ff; \
} while (0)
#elif defined(RADEON_R600)
@@ -765,14 +765,14 @@ do { \
#define READ_STENCIL( d, _x, _y ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
d = (tmp & 0xff000000) >> 24; \
} while (0)
#else
#define READ_STENCIL( d, _x, _y ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = *_ptr; \
+ GLuint tmp = LE32_TO_CPU(*_ptr); \
d = (tmp & 0xff000000) >> 24; \
} while (0)
#endif
--
cgit v1.2.3
From 28b8e4bcd76cc072b062e4c8575327c05ecb9a55 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 08:29:36 -0800
Subject: progs/util: Fix memory if LoadRGBMipmaps2 fails.
---
progs/util/readtex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 134eb79100..4e22bed81a 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -305,6 +305,7 @@ GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target,
fprintf(stderr,
"Error in LoadRGBMipmaps %d-component images not implemented\n",
image->components );
+ FreeImage(image);
return GL_FALSE;
}
--
cgit v1.2.3
From 29f3e7e1d1e8cdff3596b88990ed84d7eeff6f80 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 18:47:24 +0100
Subject: r600: Attempt to fix span breakage introduced by big endian fixes.
Only compile tested; I happened to notice people on IRC reporting
.../r600_dri.so: undefined symbol: radeon_ptr_2byte_8x2
---
src/mesa/drivers/dri/radeon/radeon_span.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 390d522856..459ad4b34a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -432,7 +432,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB1555_REV
#define TAG2(x,y) radeon##x##_ARGB1555_REV##y
+#if defined(RADEON_R600)
+#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off)
+#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
+#endif
#include "spantmp2.h"
/* 16 bit, RGBA4 color spanline and pixel functions
@@ -454,7 +458,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB4444_REV
#define TAG2(x,y) radeon##x##_ARGB4444_REV##y
+#if defined(RADEON_R600)
+#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off)
+#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
+#endif
#include "spantmp2.h"
/* 32 bit, xRGB8888 color spanline and pixel functions
--
cgit v1.2.3
From 0e783c7d03128aade3ca50b28a56e254fef6b6ab Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 09:53:19 -0800
Subject: progs/glsl: Fix memory leak in deriv.c.
---
progs/glsl/deriv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/glsl/deriv.c b/progs/glsl/deriv.c
index 265a515715..30f2b75fef 100644
--- a/progs/glsl/deriv.c
+++ b/progs/glsl/deriv.c
@@ -140,6 +140,7 @@ MakeSphere(void)
glNewList(SphereList, GL_COMPILE);
gluSphere(obj, 2.0f, 30, 15);
glEndList();
+ gluDeleteQuadric(obj);
}
--
cgit v1.2.3
From 33e93f42770e344edf1cd693a6c8115acd505a08 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 19:02:03 +0100
Subject: r600: More span breakage fixes.
At least now the compiler doesn't complain about implicitly declared functions
anymore...
---
src/mesa/drivers/dri/radeon/radeon_span.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 459ad4b34a..b3986ef64d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -516,11 +516,19 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_BGRx8888
#define TAG2(x,y) radeon##x##_BGRx8888##y
+#if defined(RADEON_R600)
+#define GET_VALUE(_x, _y) ((*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)) | 0x000000ff))
+#define PUT_VALUE(_x, _y, d) { \
+ GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
+ *_ptr = d; \
+} while (0)
+#else
#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff))
#define PUT_VALUE(_x, _y, d) { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
*_ptr = d; \
} while (0)
+#endif
#include "spantmp2.h"
/* 32 bit, BGRA8888 color spanline and pixel functions
@@ -530,7 +538,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_BGRA8888
#define TAG2(x,y) radeon##x##_BGRA8888##y
+#if defined(RADEON_R600)
+#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off)
+#else
#define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off)
+#endif
#include "spantmp2.h"
/* ================================================================
--
cgit v1.2.3
From 041cd0e110d41b543a0fe9cc484ae8373642912b Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 10:11:50 -0800
Subject: progs/util: Fix memory leak if LoadRGBImage fails.
---
progs/util/readtex.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 4e22bed81a..ec27e20d68 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -357,6 +357,7 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
fprintf(stderr,
"Error in LoadRGBImage %d-component images not implemented\n",
image->components );
+ FreeImage(image);
return NULL;
}
@@ -365,8 +366,10 @@ GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
bytes = image->sizeX * image->sizeY * image->components;
buffer = (GLubyte *) malloc(bytes);
- if (!buffer)
+ if (!buffer) {
+ FreeImage(image);
return NULL;
+ }
memcpy( (void *) buffer, (void *) image->data, bytes );
--
cgit v1.2.3
From cf65d81cf1eb031384f7e8bfe849ce59c458f27e Mon Sep 17 00:00:00 2001
From: Dan Nicholson
Date: Mon, 9 Nov 2009 05:51:23 -0800
Subject: dri: Ensure subdirs have finished before linking driver
Recursive make is hard. If there are subdirectories in the DRI drivers,
it's pretty certain we want to finish building in them before linking
the driver. Add a new target to serialize the rules.
Signed-off-by: Dan Nicholson
---
src/mesa/drivers/dri/Makefile.template | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template
index 1ce9315530..39d25ce3f4 100644
--- a/src/mesa/drivers/dri/Makefile.template
+++ b/src/mesa/drivers/dri/Makefile.template
@@ -60,9 +60,13 @@ SHARED_INCLUDES = \
##### TARGETS #####
-default: symlinks subdirs depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+default: subdirs lib
+.PHONY: lib
+lib: symlinks subdirs depend
+ @$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \
$(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
--
cgit v1.2.3
From 63bc736f90e044bdd681d56300e8342582c5a93a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 11:23:03 -0700
Subject: docs: list the new VMware SVGA Gallium driver in release notes
---
docs/relnotes-7.7.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/relnotes-7.7.html b/docs/relnotes-7.7.html
index 7ab278bd08..8c8f763b6f 100644
--- a/docs/relnotes-7.7.html
+++ b/docs/relnotes-7.7.html
@@ -34,6 +34,9 @@ tbd
New features
+VMware "SVGA" Gallium driver. This is a Gallium3D driver which targets the
+ VMware virtual graphics device. It allows Linux OpenGL guest applications
+ to utilize the 3D graphics hardware of the host operating system.
GL_ARB_draw_elements_base_vertex (supported in Intel i965 and software drivers)
GL_ARB_depth_clamp (supported in Intel i965 DRI and software drivers)
GL_NV_depth_clamp (supported in Intel i965 DRI and software drivers)
--
cgit v1.2.3
From 52be96b7feb23d9d502c74c4de52dadfb546dc82 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Tue, 17 Nov 2009 19:41:29 +0100
Subject: Remove unconditional use of glibc specific bswap_16() macro.
Fixes unresolved symbol bswap_16 on non-glibc or little endian glibc platforms.
---
src/mesa/drivers/dri/common/spantmp2.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index dd5e29f8ce..95f97414a9 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -107,7 +107,8 @@
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = bswap_16(GET_VALUE(_x, _y)); \
+ GLushort p = GET_VALUE(_x, _y); \
+ p = p << 8 | p >> 8; \
rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
@@ -237,7 +238,8 @@
#define READ_RGBA( rgba, _x, _y ) \
do { \
- GLushort p = bswap_16(GET_VALUE(_x, _y)); \
+ GLushort p = GET_VALUE(_x, _y); \
+ p = p << 8 | p >> 8; \
rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \
rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
--
cgit v1.2.3
From 49289f1d25d42a6b3eb5da5f85b2dd6a14cda8e7 Mon Sep 17 00:00:00 2001
From: Patrice Mandin
Date: Tue, 17 Nov 2009 19:49:56 +0100
Subject: nouveau: nv30: Add missing include to fix warning
---
src/gallium/drivers/nv30/nv30_fragprog.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c
index cc0385426c..0ce702d6f8 100644
--- a/src/gallium/drivers/nv30/nv30_fragprog.c
+++ b/src/gallium/drivers/nv30/nv30_fragprog.c
@@ -4,6 +4,7 @@
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
@@ -131,7 +132,7 @@ emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src)
sizeof(uint32_t) * 4);
}
- sr |= (NV30_FP_REG_TYPE_CONST << NV30_FP_REG_TYPE_SHIFT);
+ sr |= (NV30_FP_REG_TYPE_CONST << NV30_FP_REG_TYPE_SHIFT);
break;
case NV30SR_NONE:
sr |= (NV30_FP_REG_TYPE_INPUT << NV30_FP_REG_TYPE_SHIFT);
@@ -666,7 +667,7 @@ nv30_fragprog_prepare(struct nv30_fpc *fpc)
{
struct tgsi_full_immediate *imm;
float vals[4];
-
+
imm = &p.FullToken.FullImmediate;
assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
assert(fpc->nr_imm < MAX_IMM);
@@ -754,7 +755,7 @@ nv30_fragprog_translate(struct nv30_context *nv30,
fp->insn[fpc->inst_offset + 1] = 0x00000000;
fp->insn[fpc->inst_offset + 2] = 0x00000000;
fp->insn[fpc->inst_offset + 3] = 0x00000000;
-
+
fp->translated = TRUE;
fp->on_hw = FALSE;
out_err:
@@ -838,7 +839,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
update_constants:
if (fp->nr_consts) {
float *map;
-
+
map = pipe_buffer_map(pscreen, constbuf,
PIPE_BUFFER_USAGE_CPU_READ);
for (i = 0; i < fp->nr_consts; i++) {
--
cgit v1.2.3
From b353106467d386b48877d6ae1048cca3feaf99ff Mon Sep 17 00:00:00 2001
From: Patrice Mandin
Date: Tue, 17 Nov 2009 19:50:37 +0100
Subject: nouveau: nv30: Check for NULL front (happens with DRI2)
---
src/gallium/drivers/nv30/nv30_screen.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 221ae1b5f8..7cd36902eb 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -116,7 +116,10 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_Z24X8_UNORM:
return TRUE;
case PIPE_FORMAT_Z16_UNORM:
- return (front->format == PIPE_FORMAT_R5G6B5_UNORM);
+ if (front) {
+ return (front->format == PIPE_FORMAT_R5G6B5_UNORM);
+ }
+ return TRUE;
default:
break;
}
--
cgit v1.2.3
From 786d539511eb3c5a4101b11b7f8e90d60123ac46 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 11:04:24 -0800
Subject: progs/util: Fix memory leak if malloc fails in tkRGBImageLoad.
---
progs/util/readtex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index ec27e20d68..c57b66bd9d 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -250,6 +250,7 @@ static TK_RGBImageRec *tkRGBImageLoad(const char *fileName)
final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec));
if (final == NULL) {
fprintf(stderr, "Out of memory!\n");
+ RawImageClose(raw);
return NULL;
}
final->sizeX = raw->sizeX;
--
cgit v1.2.3
From b8dcb79c53796f37234bd2b0f5e2845f817fc218 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 11:37:48 -0800
Subject: progs/glsl: Change tangentAttrib from GLuint to GLint in bump.c.
tangentAtrrib is assigned the result of glGetAttribLocation.
The assertion 'assert(tangentAtrrib >= 0)' would be a no-op if
tangentAttrib is a GLuint.
---
progs/glsl/bump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c
index 87669aec73..50a0900f1c 100644
--- a/progs/glsl/bump.c
+++ b/progs/glsl/bump.c
@@ -36,7 +36,7 @@ static GLint win = 0;
static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f;
-static GLuint tangentAttrib;
+static GLint tangentAttrib;
static GLboolean Anim = GL_FALSE;
--
cgit v1.2.3
From 6418ce7df6e9f12cb1ad4ae39580e175a20a02fb Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 12:47:12 -0700
Subject: mesa: move -ansi -pedantic to CFLAGS
---
configs/linux-debug | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configs/linux-debug b/configs/linux-debug
index bc6d2336fc..8b0b3126db 100644
--- a/configs/linux-debug
+++ b/configs/linux-debug
@@ -4,5 +4,6 @@ include $(TOP)/configs/linux
CONFIG_NAME = linux-debug
-OPT_FLAGS = -g -ansi -pedantic
+OPT_FLAGS = -g
+CFLAGS += -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH
--
cgit v1.2.3
From 11905da8836822f7dd60c84b5eefc72e46c94b50 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 12:00:22 -0800
Subject: progs/util: Fix memory leak if fread returns 0 in CompileShaderFile.
---
progs/util/shaderutil.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index af50d64f51..aebf23a78c 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -95,6 +95,7 @@ CompileShaderFile(GLenum shaderType, const char *filename)
shader = CompileShaderText(shaderType, buffer);
}
else {
+ fclose(f);
free(buffer);
return 0;
}
--
cgit v1.2.3
From d888bbc45a84946cafb4f4d2c89681a580cd89bc Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 13:39:13 -0700
Subject: progs/xdemos: added -lX11 -lpthread for GNU gold linker
---
progs/xdemos/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index 53e1c54ef3..77f667978c 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -8,6 +8,9 @@ INCDIR = $(TOP)/include
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+# Add X11 and pthread libs to satisfy GNU gold.
+APP_LIB_DEPS += -lX11 -lpthread
+
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS)
PROGS = \
--
cgit v1.2.3
From aef769207d3e554db8cc452d6ea3f678e5549cfb Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Tue, 17 Nov 2009 21:27:31 +0100
Subject: r300: fix reads and writes for MESA_FORMAT_S8Z24 buffer
Regression was introduced by texformat-rework branch merge.
---
src/mesa/drivers/dri/radeon/radeon_span.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index b3986ef64d..37904dc8dc 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -668,7 +668,7 @@ do { \
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32(d); \
+ *_ptr = CPU_TO_LE32((((d) & 0xff000000) >> 24) | (((d) & 0x00ffffff) << 8)); \
} while (0)
#elif defined(RADEON_R600)
#define WRITE_DEPTH( _x, _y, d ) \
@@ -701,7 +701,8 @@ do { \
#if defined(RADEON_R300)
#define READ_DEPTH( d, _x, _y ) \
do { \
- d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
+ GLuint tmp = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
+ d = LE32_TO_CPU(((tmp & 0x000000ff) << 24) | ((tmp & 0xffffff00) >> 8)); \
}while(0)
#elif defined(RADEON_R600)
#define READ_DEPTH( d, _x, _y ) \
--
cgit v1.2.3
From 8c5a108dc321c4760e6d70b1104493b5bd54e6de Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 17 Nov 2009 09:07:15 +0100
Subject: svga: Remove -Werror for now as GCC 4.4.x raises a bunch of warnings
---
src/gallium/drivers/svga/Makefile | 2 +-
src/gallium/drivers/svga/SConscript | 3 ---
src/gallium/winsys/drm/vmware/core/SConscript | 2 +-
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile
index 05ab4ab9b3..fe1d6d7384 100644
--- a/src/gallium/drivers/svga/Makefile
+++ b/src/gallium/drivers/svga/Makefile
@@ -57,7 +57,7 @@ CC = gcc -fvisibility=hidden -msse -msse2
# Set the gnu99 standard to enable anonymous structs in vmware headers.
#
-CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \
+CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
include ../../Makefile.template
diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript
index 0fa745c9b8..ff9645fc03 100644
--- a/src/gallium/drivers/svga/SConscript
+++ b/src/gallium/drivers/svga/SConscript
@@ -10,9 +10,6 @@ if env['gcc']:
'HAVE_STDINT_H',
'HAVE_SYS_TYPES_H',
])
- if env['platform'] not in ['windows']:
- # The Windows headers cause many gcc warnings
- env.Append(CCFLAGS = ['-Werror'])
env.Prepend(CPPPATH = [
'include',
diff --git a/src/gallium/winsys/drm/vmware/core/SConscript b/src/gallium/winsys/drm/vmware/core/SConscript
index 1875b659ac..edaf9458be 100644
--- a/src/gallium/winsys/drm/vmware/core/SConscript
+++ b/src/gallium/winsys/drm/vmware/core/SConscript
@@ -3,7 +3,7 @@ Import('*')
env = env.Clone()
if env['gcc']:
- env.Append(CCFLAGS = ['-fvisibility=hidden', '-Werror'])
+ env.Append(CCFLAGS = ['-fvisibility=hidden'])
env.Append(CPPDEFINES = [
'HAVE_STDINT_H',
'HAVE_SYS_TYPES_H',
--
cgit v1.2.3
From d9508e8df9da4aa13bc223194c406081738bac91 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 13:49:31 -0800
Subject: progs/util: Fix memory leak if fopen fails in RawImageOpen.
---
progs/util/readtex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index c57b66bd9d..3922998fd5 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -109,6 +109,7 @@ static rawImageRec *RawImageOpen(const char *fileName)
raw->file = fopen(baseName + 1, "rb");
if(raw->file == NULL) {
perror(fileName);
+ free(raw);
return NULL;
}
}
--
cgit v1.2.3
From 46492f11f6f771e12ab2d13f9d7e9eb9e032c2dc Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Tue, 17 Nov 2009 12:04:17 +0100
Subject: svga: More -Werror removal
---
src/gallium/winsys/drm/vmware/core/Makefile | 2 +-
src/gallium/winsys/drm/vmware/dri/SConscript | 1 -
src/gallium/winsys/drm/vmware/xorg/SConscript | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile
index 755dc45935..ff8f01b322 100644
--- a/src/gallium/winsys/drm/vmware/core/Makefile
+++ b/src/gallium/winsys/drm/vmware/core/Makefile
@@ -35,7 +35,7 @@ CC = gcc -fvisibility=hidden -msse -msse2
# Set the gnu99 standard to enable anonymous structs in vmware headers.
#
-CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \
+CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/vmware/dri/SConscript b/src/gallium/winsys/drm/vmware/dri/SConscript
index adf2bf16d1..1019f577a5 100644
--- a/src/gallium/winsys/drm/vmware/dri/SConscript
+++ b/src/gallium/winsys/drm/vmware/dri/SConscript
@@ -35,7 +35,6 @@ if env['platform'] == 'linux':
])
env.Append(CFLAGS = [
- '-Werror',
'-std=gnu99',
'-D_FILE_OFFSET_BITS=64',
])
diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/winsys/drm/vmware/xorg/SConscript
index 41a489774c..ff7b2ed34e 100644
--- a/src/gallium/winsys/drm/vmware/xorg/SConscript
+++ b/src/gallium/winsys/drm/vmware/xorg/SConscript
@@ -24,7 +24,6 @@ if env['platform'] == 'linux':
'HAVE_STDINT_H',
'HAVE_SYS_TYPES_H',
])
- env.Append(CFLAGS = ['-Werror'])
env.Append(CFLAGS = [
'-std=gnu99',
--
cgit v1.2.3
From 93eb2ab8c395f81e40fa298d78805bb2c777f891 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Tue, 17 Nov 2009 19:46:37 +0100
Subject: radeon: align for mipmap tree changes
---
src/mesa/drivers/dri/radeon/radeon_state_init.c | 4 ++--
src/mesa/drivers/dri/radeon/radeon_tex.c | 18 +++---------------
src/mesa/drivers/dri/radeon/radeon_texstate.c | 22 +++++++++-------------
3 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c
index 2d19220d8a..dd82888254 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state_init.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c
@@ -645,11 +645,11 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
OUT_BATCH(CP_PACKET0(RADEON_PP_TXOFFSET_0 + (24 * i), 0));
if (t->mt && !t->image_override) {
if ((ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) {
- lvl = &t->mt->levels[0];
+ lvl = &t->mt->levels[t->minLod];
OUT_BATCH_RELOC(lvl->faces[5].offset, t->mt->bo, lvl->faces[5].offset,
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
} else {
- OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0,
+ OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t),
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
}
} else {
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index 60981aada2..749ab75f20 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -348,17 +348,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
-
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- t->validated = GL_FALSE;
- }
+ t->validated = GL_FALSE;
break;
default:
@@ -388,10 +378,8 @@ static void radeonDeleteTexture( GLcontext *ctx,
}
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- }
+ radeon_miptree_unreference(&t->mt);
+
/* Free mipmap images and the texture object itself */
_mesa_delete_texture_object(ctx, texObj);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 429977a8bc..4d9eb73d20 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -699,14 +699,10 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
radeon_bo_unref(rImage->bo);
rImage->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = NULL;
- }
- if (rImage->mt) {
- radeon_miptree_unreference(rImage->mt);
- rImage->mt = NULL;
- }
+
+ radeon_miptree_unreference(&t->mt);
+ radeon_miptree_unreference(&rImage->mt);
+
_mesa_init_teximage_fields(radeon->glCtx, target, texImage,
rb->base.Width, rb->base.Height, 1, 0, rb->cpp);
texImage->RowStride = rb->pitch / rb->cpp;
@@ -1021,7 +1017,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int
return GL_TRUE;
}
- firstImage = t->base.Image[0][t->mt->firstLevel];
+ firstImage = t->base.Image[0][t->minLod];
if (firstImage->Border > 0) {
fprintf(stderr, "%s: border\n", __FUNCTION__);
@@ -1049,9 +1045,9 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int
return GL_FALSE;
}
}
-
+
t->pp_txfilter &= ~RADEON_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (t->mt->lastLevel - t->mt->firstLevel) << RADEON_MAX_MIP_LEVEL_SHIFT;
+ t->pp_txfilter |= (t->maxLod - t->minLod) << RADEON_MAX_MIP_LEVEL_SHIFT;
t->pp_txformat &= ~(RADEON_TXFORMAT_WIDTH_MASK |
RADEON_TXFORMAT_HEIGHT_MASK |
@@ -1060,9 +1056,9 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int
RADEON_TXFORMAT_F5_HEIGHT_MASK);
t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) |
(log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT));
-
+
t->tile_bits = 0;
-
+
if (t->base.Target == GL_TEXTURE_CUBE_MAP) {
ASSERT(log2Width == log2Height);
t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_F5_WIDTH_SHIFT) |
--
cgit v1.2.3
From afe84fa698eae3e035e967589f0a8d55f6a83698 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Tue, 17 Nov 2009 19:46:59 +0100
Subject: r200: align for mipmap tree changes
---
src/mesa/drivers/dri/r200/r200_state_init.c | 2 +-
src/mesa/drivers/dri/r200/r200_tex.c | 21 +++++----------------
src/mesa/drivers/dri/r200/r200_texstate.c | 21 ++++++++-------------
3 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 68bfeea701..e53fd72290 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -640,7 +640,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom)
OUT_BATCH_TABLE(atom->cmd, 10);
if (t && t->mt && !t->image_override) {
- OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0,
+ OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t),
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
} else if (!t) {
/* workaround for old CS mechanism */
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 5a21a8b9c5..a417721553 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -385,16 +385,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- t->validated = GL_FALSE;
- }
+ t->validated = GL_FALSE;
break;
default:
@@ -413,7 +404,7 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
(void *)texObj,
_mesa_lookup_enum_by_nr(texObj->Target));
}
-
+
if (rmesa) {
int i;
radeon_firevertices(&rmesa->radeon);
@@ -425,11 +416,9 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
}
}
}
-
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- }
+
+ radeon_miptree_unreference(&t->mt);
+
_mesa_delete_texture_object(ctx, texObj);
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 7d0afa1add..7782404a79 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -824,14 +824,10 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
radeon_bo_unref(rImage->bo);
rImage->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = NULL;
- }
- if (rImage->mt) {
- radeon_miptree_unreference(rImage->mt);
- rImage->mt = NULL;
- }
+
+ radeon_miptree_unreference(&t->mt);
+ radeon_miptree_unreference(&rImage->mt);
+
_mesa_init_teximage_fields(radeon->glCtx, target, texImage,
rb->base.Width, rb->base.Height, 1, 0, rb->cpp);
texImage->RowStride = rb->pitch / rb->cpp;
@@ -1423,10 +1419,9 @@ void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d )
*/
static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t)
{
- int firstlevel = t->mt ? t->mt->firstLevel : 0;
- const struct gl_texture_image *firstImage = t->base.Image[0][firstlevel];
+ const struct gl_texture_image *firstImage = t->base.Image[0][t->minLod];
GLint log2Width, log2Height, log2Depth, texelBytes;
-
+
if ( t->bo ) {
return;
}
@@ -1454,9 +1449,9 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t)
return;
}
}
-
+
t->pp_txfilter &= ~R200_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (t->mt->lastLevel - t->mt->firstLevel) << R200_MAX_MIP_LEVEL_SHIFT;
+ t->pp_txfilter |= (t->maxLod - t->minLod) << R200_MAX_MIP_LEVEL_SHIFT;
t->pp_txformat &= ~(R200_TXFORMAT_WIDTH_MASK |
R200_TXFORMAT_HEIGHT_MASK |
--
cgit v1.2.3
From 47b5f584a68ceab7c9c1d5279efbc9fe30ff2fcc Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 14:10:35 -0800
Subject: progs/redbook: Fix memory leak in quadric.c.
---
progs/redbook/quadric.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/redbook/quadric.c b/progs/redbook/quadric.c
index 4e46c85f82..7e99098304 100644
--- a/progs/redbook/quadric.c
+++ b/progs/redbook/quadric.c
@@ -116,6 +116,8 @@ void init(void)
glNewList(startList+3, GL_COMPILE);
gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0);
glEndList();
+
+ gluDeleteQuadric(qobj);
}
void display(void)
--
cgit v1.2.3
From e8eec9385497053a4172deeff9c0ff2726a10f3b Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 14:22:35 -0800
Subject: progs/slang: Fix potential null pointer dereference in cltest.c.
---
progs/slang/cltest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/slang/cltest.c b/progs/slang/cltest.c
index 2753f59f85..dfff6cb226 100644
--- a/progs/slang/cltest.c
+++ b/progs/slang/cltest.c
@@ -237,7 +237,7 @@ void RenderScene (void)
if (p != NULL)
p++;
}
- if (*p != '\0')
+ if (p && *p != '\0')
printf ("*** %s\n", "I/O error");
nextprogram = program->next;
--
cgit v1.2.3
From e36751ec81736a8466b1a6a722c1b2cf578d713b Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:05:24 -0700
Subject: mesa: remove a bit of old code
---
src/mesa/main/buffers.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 7f77c5d772..7c31a46ab9 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -383,7 +383,6 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
if (n == 1) {
GLuint count = 0, destMask0 = destMask[0];
/* init to -1 to help catch errors */
- //fb->_ColorDrawBufferIndexes[0] = -1;
while (destMask0) {
GLint bufIndex = _mesa_ffs(destMask0) - 1;
if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
--
cgit v1.2.3
From 0422053eca12b4fb912e0229c96a9d12453e31c4 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:05:59 -0700
Subject: mesa: remove trailing comment to silence warning
---
src/mesa/main/formats.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index eba28a69be..0eeeb8b2ba 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -140,7 +140,7 @@ typedef enum
MESA_FORMAT_SIGNED_RGBA_16,
/*@}*/
- MESA_FORMAT_COUNT,
+ MESA_FORMAT_COUNT
} gl_format;
--
cgit v1.2.3
From 1888a7276538a3adfe268e235e56b9931d608243 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:13:12 -0700
Subject: progs/demos: silence warnings
---
progs/demos/morph3d.c | 3 ++-
progs/demos/textures.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c
index 6aca8270ff..01a06aba0f 100644
--- a/progs/demos/morph3d.c
+++ b/progs/demos/morph3d.c
@@ -887,5 +887,6 @@ int main(int argc, char **argv)
glutIdleFunc( idle_ );
glutDisplayFunc( draw );
glutMainLoop();
-
+
+ return 0;
}
diff --git a/progs/demos/textures.c b/progs/demos/textures.c
index b7bf135d21..d94154a200 100644
--- a/progs/demos/textures.c
+++ b/progs/demos/textures.c
@@ -57,7 +57,7 @@ Idle(void)
{
Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02;
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04;
- //Zrot += 2.0;
+ /*Zrot += 2.0;*/
glutPostRedisplay();
}
--
cgit v1.2.3
From b08f44754762c50456c2cb9d2106e1b6db43ff01 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:14:09 -0700
Subject: progs/glsl: change //-style comments
---
progs/glsl/shtest.c | 2 +-
progs/glsl/texaaline.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index 628a7dd5b9..9d76e018e3 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -627,7 +627,7 @@ Init(void)
NumAttribs = GetAttribs(Program, Attribs);
PrintAttribs(Attribs);
- //assert(glGetError() == 0);
+ /*assert(glGetError() == 0);*/
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);
diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c
index 2e4f932ad6..4ad5a761c6 100644
--- a/progs/glsl/texaaline.c
+++ b/progs/glsl/texaaline.c
@@ -310,8 +310,10 @@ MakeMipmap(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
- ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
+ /*
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
+ */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#undef SZ
--
cgit v1.2.3
From fc3c5ffcc83904b41ec8bde4006c5d5a66a0aac3 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:14:20 -0700
Subject: progs/xdemos: change //-style comments
---
progs/xdemos/corender.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c
index f2b8145e52..ca8ee1eed3 100644
--- a/progs/xdemos/corender.c
+++ b/progs/xdemos/corender.c
@@ -186,7 +186,7 @@ redraw(Display *dpy)
* Without this glClear(), depth buffer for the second process
* is pretty much broken.
*/
- //glClear(GL_DEPTH_BUFFER_BIT);
+ /*glClear(GL_DEPTH_BUFFER_BIT);*/
glPushMatrix();
glTranslatef(1, 0, 0);
--
cgit v1.2.3
From 845ddbc9aa62d1c9142822608370d96b2d68cec0 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:14:54 -0700
Subject: i915g: remove trailing commas in enum lists to silence warnings
---
src/gallium/drivers/i915/intel_winsys.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h
index 2c8dc63f3f..c6bf6e6f7f 100644
--- a/src/gallium/drivers/i915/intel_winsys.h
+++ b/src/gallium/drivers/i915/intel_winsys.h
@@ -42,21 +42,21 @@ enum intel_buffer_usage
INTEL_USAGE_2D_TARGET = 0x04,
INTEL_USAGE_2D_SOURCE = 0x08,
/* use on vertex */
- INTEL_USAGE_VERTEX = 0x10,
+ INTEL_USAGE_VERTEX = 0x10
};
enum intel_buffer_type
{
INTEL_NEW_TEXTURE,
INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */
- INTEL_NEW_VERTEX,
+ INTEL_NEW_VERTEX
};
enum intel_buffer_tile
{
INTEL_TILE_NONE,
INTEL_TILE_X,
- INTEL_TILE_Y,
+ INTEL_TILE_Y
};
struct intel_batchbuffer {
--
cgit v1.2.3
From c4c11eb456b773480d37ac34f98b9b44ae7c514a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:15:21 -0700
Subject: gallium/util: replace //-style comments
---
src/gallium/auxiliary/util/u_cpu_detect.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c
index facbe69173..a08241971c 100644
--- a/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -80,7 +80,7 @@ static int has_cpuid(void);
#if defined(PIPE_ARCH_X86)
/* The sigill handlers */
-#if defined(PIPE_OS_LINUX) //&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)
+#if defined(PIPE_OS_LINUX) /*&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)*/
static void
sigill_handler_sse(int signal, struct sigcontext sc)
{
@@ -240,7 +240,7 @@ check_os_katmai_support(void)
__asm __volatile ("xorps %xmm0, %xmm0");
#elif defined(PIPE_CC_MSVC)
__asm {
- xorps xmm0, xmm0 // executing SSE instruction
+ xorps xmm0, xmm0 /* executing SSE instruction */
}
#else
#error Unsupported compiler
@@ -283,7 +283,7 @@ check_os_katmai_support(void)
* and therefore to be safe I'm going to leave this test in here.
*/
if (util_cpu_caps.has_sse) {
- // test_os_katmai_exception_support();
+ /* test_os_katmai_exception_support(); */
}
/* Restore the original signal handlers.
--
cgit v1.2.3
From 7e3955d8e80c364d9b4c9eee1ec9758ff3ab8a1d Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:15:29 -0700
Subject: i915g: replace //-style comments
---
src/gallium/drivers/i915/i915_state.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 7d48e6e84d..71f00bc346 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -58,8 +58,10 @@ translate_wrap_mode(unsigned wrap)
return TEXCOORDMODE_CLAMP_EDGE;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return TEXCOORDMODE_CLAMP_BORDER;
-// case PIPE_TEX_WRAP_MIRRORED_REPEAT:
-// return TEXCOORDMODE_MIRROR;
+/*
+ case PIPE_TEX_WRAP_MIRRORED_REPEAT:
+ return TEXCOORDMODE_MIRROR;
+*/
default:
return TEXCOORDMODE_WRAP;
}
--
cgit v1.2.3
From bc8fb028c6c9e7c9bd4f6aaf094a606c447e3711 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:15:56 -0700
Subject: mesa: fix incorrect type in store_texel_al1616()
---
src/mesa/main/texfetch_tmp.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
index 6fac7ba1e1..1f0d436236 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -876,7 +876,7 @@ static void store_texel_al1616(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *rgba = (const GLushort *) texel;
- GLuint *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
*dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]);
}
#endif
--
cgit v1.2.3
From 133501bef2933395f14b2ebdfeda84279be93c60 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:16:16 -0700
Subject: mesa: fix assorted compiler warnings
---
src/mesa/shader/program_parser.h | 2 +-
src/mesa/shader/slang/slang_codegen.c | 2 +-
src/mesa/state_tracker/st_atom.c | 8 ++++----
src/mesa/state_tracker/st_cb_bitmap.c | 2 +-
src/mesa/state_tracker/st_program.c | 4 ++--
src/mesa/vbo/vbo_exec_array.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h
index bce6041381..c170948f73 100644
--- a/src/mesa/shader/program_parser.h
+++ b/src/mesa/shader/program_parser.h
@@ -35,7 +35,7 @@ enum asm_type {
at_attrib,
at_param,
at_temp,
- at_output,
+ at_output
};
struct asm_symbol {
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 344dfdc680..ee5a50ca82 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -925,7 +925,7 @@ gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper)
slang_operation_copy(rhs, &oper->children[0]);
}
- ///blockOper->locals->outer_scope = oper->locals->outer_scope;
+ /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/
/*slang_print_tree(blockOper, 0);*/
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index ca15ce1b47..0e89a624c4 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -137,7 +137,7 @@ void st_validate_state( struct st_context *st )
if (state->st == 0)
return;
-// _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);
+ /*_mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
if (1) {
/* Debug version which enforces various sanity checks on the
@@ -152,7 +152,7 @@ void st_validate_state( struct st_context *st )
const struct st_tracked_state *atom = atoms[i];
struct st_state_flags generated;
-// _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);
+ /*_mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
if (!(atom->dirty.mesa || atom->dirty.st) ||
!atom->update) {
@@ -162,7 +162,7 @@ void st_validate_state( struct st_context *st )
if (check_state(state, &atom->dirty)) {
atoms[i]->update( st );
-// _mesa_printf("after: %x\n", atom->dirty.mesa);
+ /*_mesa_printf("after: %x\n", atom->dirty.mesa);*/
}
accumulate_state(&examined, &atom->dirty);
@@ -175,7 +175,7 @@ void st_validate_state( struct st_context *st )
assert(!check_state(&examined, &generated));
prev = *state;
}
-// _mesa_printf("\n");
+ /*_mesa_printf("\n");*/
}
else {
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index a22fa68299..1960d171bf 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -526,7 +526,7 @@ reset_cache(struct st_context *st)
struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
- //memset(cache->buffer, 0xff, sizeof(cache->buffer));
+ /*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/
cache->empty = GL_TRUE;
cache->xmin = 1000000;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index a9be80ce8f..6d02722c13 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -80,7 +80,7 @@ st_translate_vertex_program(struct st_context *st,
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
-// memset(&vs, 0, sizeof(vs));
+ /*memset(&vs, 0, sizeof(vs));*/
memset(input_flags, 0, sizeof(input_flags));
memset(output_flags, 0, sizeof(output_flags));
@@ -386,7 +386,7 @@ st_translate_fragment_program(struct st_context *st,
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
-// memset(&fs, 0, sizeof(fs));
+ /*memset(&fs, 0, sizeof(fs));*/
memset(input_flags, 0, sizeof(input_flags));
memset(output_flags, 0, sizeof(output_flags));
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index fd70b57b72..6de8f059b7 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -146,7 +146,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array,
array->Ptr, array->BufferObj->Name);
f[k] = 1.0; /* XXX replace the bad value! */
}
- //assert(!IS_INF_OR_NAN(f[k]));
+ /*assert(!IS_INF_OR_NAN(f[k]));*/
}
}
break;
--
cgit v1.2.3
From a54033bedb1d3ac7f7a0c1365c25c638e58de566 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:18:29 -0700
Subject: mesa: remove old comment
---
src/mesa/main/buffers.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 7c31a46ab9..97f0659758 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -382,7 +382,6 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
*/
if (n == 1) {
GLuint count = 0, destMask0 = destMask[0];
- /* init to -1 to help catch errors */
while (destMask0) {
GLint bufIndex = _mesa_ffs(destMask0) - 1;
if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
--
cgit v1.2.3
From 773de83d3c942186f7e8ab87b5a0180d9a2d9f58 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 15:24:40 -0800
Subject: progs/tests: Fix memory leak in arbgpuprog.c.
---
progs/tests/arbgpuprog.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/progs/tests/arbgpuprog.c b/progs/tests/arbgpuprog.c
index 23aa899d96..6098dca787 100644
--- a/progs/tests/arbgpuprog.c
+++ b/progs/tests/arbgpuprog.c
@@ -134,6 +134,8 @@ static void Init( const char *vertProgFile,
}
len = fread(buf, 1, 10*1000,f);
+ fclose(f);
+
glProgramStringARB_func(GL_VERTEX_PROGRAM_ARB,
GL_PROGRAM_FORMAT_ASCII_ARB,
len,
@@ -170,6 +172,8 @@ static void Init( const char *vertProgFile,
}
len = fread(buf, 1, 10*1000,f);
+ fclose(f);
+
glProgramStringARB_func(GL_FRAGMENT_PROGRAM_ARB,
GL_PROGRAM_FORMAT_ASCII_ARB,
len,
--
cgit v1.2.3
From 4440d8adb6f94c9a5c4bc1a913433d88a9ef5324 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 16:32:05 -0700
Subject: docs: libGL documentation, from the xorg-docs tree
This is pretty old and needs some updating but might be useful or
interesting to some people.
---
docs/libGL.txt | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 197 insertions(+)
create mode 100644 docs/libGL.txt
diff --git a/docs/libGL.txt b/docs/libGL.txt
new file mode 100644
index 0000000000..cb98840437
--- /dev/null
+++ b/docs/libGL.txt
@@ -0,0 +1,197 @@
+
+
+
+Introduction
+------------
+
+This document describes the implementation of the XFree86 4.0 libGL.so
+library defined by the Linux/OpenGL Base specification found at
+http://reality.sgi.com/opengl/linux/linuxbase.html.
+
+The documentation is divided into two sections:
+ User's Guide
+ Driver Developer's Guide
+
+Author: Brian Paul (brian@precisioninsight.com)
+Date: February 2000
+
+
+
+User's Guide
+------------
+
+Using libGL.so
+
+The libGL.so library defines the gl- and glX-prefixed functions needed to
+run OpenGL programs. OpenGL client applications should link with the
+-lGL option to use it.
+
+libGL.so serves two primary functions: GLX protocol generation for indirect
+rendering and loading/management of hardware drivers for direct rendering.
+
+When libGL.so initializes itself it uses the DRI to determine the
+appropriate hardware driver for each screen on the local X display.
+The hardware drivers are expected to be in the /usr/X11R6/lib/modules/dri/
+directory. Drivers are named with the convention _dri.so where
+ is a driver such as "tdfx", "i810", "gamma", etc.
+
+The LIBGL_DRIVERS_DIR environment variable may be used to specify a
+different DRI modules directory, overriding /usr/X11R6/lib/modules/dri/.
+This environment variable is ignored in setuid programs for security
+reasons.
+
+When libGL.so is unable to locate appropriate hardware drivers it will
+fall back to using indirect GLX rendering.
+
+To aid in solving problems, libGL.so will print diagnostic messages to
+stderr if the LIBGL_DEBUG environment variable is defined.
+
+libGL.so is thread safe. The overhead of thread safety for common,
+single-thread clients is negligible. However, the overhead of thread
+safety for multi-threaded clients is significant. Each GL API call
+requires two calls to pthread_get_specific() which can noticably
+impact performance. Warning: libGL.so is thread safe but individual
+DRI drivers may not be. Please consult the documentation for a driver
+to learn if it is thread safe.
+
+
+
+Indirect Rendering
+
+You can force indirect rendering mode by setting the LIBGL_ALWAYS_INDIRECT
+environment variable. Hardware acceleration will not be used.
+
+
+
+libGL.so Extensibility
+
+libGL.so is designed to be extended without upgrading. That is,
+drivers may install new OpenGL extension functions into libGL.so
+without requiring libGL.so to be replaced. Clients of libGL.so should
+use the glXGetProcAddressEXT() function to obtain the address of
+functions by name. For more details of GLX_ARB_get_proc_address see
+http://oss.sgi.com/projects/ogl-sample/registry/ARB/get_proc_address.spec
+
+libGL.so is also designed with flexibility such that it may be used
+with many generations of hardware drivers to come.
+
+
+
+
+Driver Developer's Guide
+------------------------
+
+This section describes the requirements to make an XFree86 4.0
+libGL.so-compatible hardware driver. It is not intended for end
+users of libGL.so.
+
+
+XFree86 source files
+
+libGL.so is built inside XFree86 with sources found in xc/lib/GL/.
+Specifically, libGL.so is built from:
+
+ xc/lib/GL/glx/*.c
+ xc/lib/dri/XF86dri.c
+ xc/lib/dri/dri_glx.c
+ xc/lib/GL/mesa/src/glapi.c
+ xc/lib/GL/mesa/src/glapitemp.h
+ xc/lib/GL/mesa/src/glapitable.h
+ xc/lib/GL/mesa/src/glapioffsets.h
+ xc/lib/GL/mesa/src/glapinoop.c
+ xc/lib/GL/mesa/src/glheader.h
+ xc/lib/GL/mesa/src/glthread.c
+ xc/lib/GL/mesa/src/glthread.h
+ xc/lib/GL/mesa/src/X86/glapi_x86.S
+ xc/lib/GL/mesa/src/X86/assyntax.h
+
+Understand that the mesa/src/gl*.[ch] files are not tied to Mesa. They
+have no dependencies on the rest of Mesa and are designed to be reusable
+in a number of projects.
+
+The glapi_x86.X and assyntax.h files implement x86-optimized dispatch
+of GL functions. They are not required; C-based dispatch can be used
+instead, with a slight performance penalty.
+
+
+
+Driver loading and binding
+
+When libGL.so initializes itself (via the __glXInitialize function) a
+call is made to driCreateDisplay(). This function uses DRI facilities
+to determine the driver file appropriate for each screen on the local
+display. Each screen's driver is then opened with dlopen() and asked
+for its __driCreateScreen() function. The pointers to the __driCreateScreen()
+functions are kept in an array, indexed by screen number, in the
+__DRIdisplayRec struct.
+
+When a driver's __driCreateScreen() function is called, it must initialize
+a __DRIscreenRec struct. This struct acts as the root of a tree of
+function pointers which are called to create and destroy contexts and
+drawables and perform all the operations needed by the GLX interface.
+See the xc/lib/GL/glx/glxclient.h file for details.
+
+
+
+Dynamic Extension Function Registration
+
+In order to provide forward compatibility with future drivers, libGL.so
+allows drivers to register new OpenGL extension functions which weren't
+known when libGL.so was built.
+
+The register_extensions() function in xc/lib/GL/dri/dri_glx.c is called
+as soon as libGL.so is loaded. This is done with gcc's constructor
+attribute. This mechanism will likely have to be changed for other compilers.
+
+register_extensions() loops over all local displays and screens, determines
+the DRI driver for each, and calls the driver's __driRegisterExtensions()
+function, if present.
+
+The __driRegisterExtensions() function can add new entrypoints to libGL
+by calling:
+
+ GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset)
+
+The parameters are the name of the function (such as "glFoobarEXT") and the
+offset of the dispatch slot in the API dispatch table. The return value
+indicates success (GL_TRUE) or failure (GL_FALSE).
+
+_glapi_add_entrypoint() will synthesize entrypoint code in assembly
+language. Assembly languages is required since parameter passing
+can't be handled correctly using a C-based solution.
+
+The address of the new entrypoint is obtained by calling the
+glXGetProcAddressARB() function.
+
+The dispatch offset number MUST be a number allocated by SGI in the same
+manner in which new GL_* constants are allocated. Using an arbitrary
+offset number will result in many problems.
+
+
+
+Dispatch Management
+
+When a GL context is made current, the driver must install its dispatch
+table as the current dispatch table. This is done by calling
+
+ void _glapi_set_dispatch(struct _glapi_table *dispatch);
+
+This will install the named dispatch table for the calling thread.
+The current dispatch table for a thread can be obtained by calling
+
+ struct _glapi_table *_glapi_get_dispatch(void);
+
+For higher performance in the common single-thread case, the global
+variable _glapi_Dispatch will point to the current dispatch table.
+This variable will be NULL when in multi-thread mode.
+
+
+
+Context Management
+
+libGL.so uses the XFree86 xthreads package to manage a thread-specific
+current context pointer. See __glXGet/SetCurrentContext() in glext.c
+
+Drivers may use the _glapi_set/get_context() functions to maintain
+a private thread-specific context pointer.
+
--
cgit v1.2.3
From c185ff96c98b397d494eec5125c668df4db45cf3 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 14:44:43 -0800
Subject: ARB_fbo: Remove _EXT from enum names
---
src/mesa/glapi/ARB_framebuffer_object.xml | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml
index b700e7e77d..7fc0f439b1 100644
--- a/src/mesa/glapi/ARB_framebuffer_object.xml
+++ b/src/mesa/glapi/ARB_framebuffer_object.xml
@@ -12,10 +12,10 @@
-
-
-
-
+
+
+
+
@@ -98,28 +98,28 @@
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
--
cgit v1.2.3
From 30f09573ed4b3b2a5460143b366aa9fb8b91e6a4 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 14:51:29 -0800
Subject: ARB_fbo: Add missing protocol "Get" information
---
src/mesa/glapi/ARB_framebuffer_object.xml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml
index 7fc0f439b1..89c23938fb 100644
--- a/src/mesa/glapi/ARB_framebuffer_object.xml
+++ b/src/mesa/glapi/ARB_framebuffer_object.xml
@@ -93,7 +93,9 @@
-
+
+
+
@@ -131,7 +133,10 @@
-
+
+
+
+
--
cgit v1.2.3
From 92b38bc3050d8f1ee8c64ff976584ec3c0b77f0c Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:01:25 -0800
Subject: EXT_fbo_blit: Add missing GLX protocol render opcode
---
src/mesa/glapi/gl_API.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index da4be14707..2834c5bf51 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -12260,6 +12260,7 @@
+
--
cgit v1.2.3
From b244b702b3a7bed08250e20b54192ea73892b552 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:08:49 -0800
Subject: EXT_pds: Add GL_EXT_packed_depth_stencil
---
src/mesa/glapi/EXT_packed_depth_stencil.xml | 18 ++++++++++++++++++
src/mesa/glapi/gl_API.xml | 2 ++
2 files changed, 20 insertions(+)
create mode 100644 src/mesa/glapi/EXT_packed_depth_stencil.xml
diff --git a/src/mesa/glapi/EXT_packed_depth_stencil.xml b/src/mesa/glapi/EXT_packed_depth_stencil.xml
new file mode 100644
index 0000000000..5be810302f
--- /dev/null
+++ b/src/mesa/glapi/EXT_packed_depth_stencil.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index 2834c5bf51..7180334bdb 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -12238,6 +12238,8 @@
+
+
--
cgit v1.2.3
From daad31d52732b5a954360a0baacdeff89d3c153a Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:09:44 -0800
Subject: EXT_pds: Alias GL_NV_packed_depth_stencil to
GL_EXT_packed_depth_stencil
GL_EXT_packed_depth_stencil is a functional superset of
GL_NV_packed_depth_stencil. If a driver enables EXT_pds, make NV_pds
available as well.
---
src/mesa/main/extensions.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 54cf37c5f4..96f3511273 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -169,6 +169,7 @@ static const struct {
{ OFF, "GL_NV_fragment_program", F(NV_fragment_program) },
{ OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) },
{ ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) },
+ { OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) },
{ OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
{ OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) },
{ OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
--
cgit v1.2.3
From afab8d9958a4deedca16fb9856bc7f372c21debd Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:15:35 -0800
Subject: ARB_fbo: Add GL_EXT_framebuffer_multisample
Add GL_EXT_framebuffer_multisample. Make
glRenderbufferStorageMultisampleEXT in GL_EXT_framebuffer_object alias
glRenderbufferStorageMultisample. Also add the missing GLX render
opcode to glRenderbufferStorageMultisample.
Since this extension is layered on GL_EXT_framebuffer_object, I put it
in EXT_framebuffer_object.xml.
---
src/mesa/glapi/ARB_framebuffer_object.xml | 1 +
src/mesa/glapi/EXT_framebuffer_object.xml | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml
index 89c23938fb..e6bdcd6e50 100644
--- a/src/mesa/glapi/ARB_framebuffer_object.xml
+++ b/src/mesa/glapi/ARB_framebuffer_object.xml
@@ -173,6 +173,7 @@
+
diff --git a/src/mesa/glapi/EXT_framebuffer_object.xml b/src/mesa/glapi/EXT_framebuffer_object.xml
index 5559b48b11..8c5b1c3a1e 100644
--- a/src/mesa/glapi/EXT_framebuffer_object.xml
+++ b/src/mesa/glapi/EXT_framebuffer_object.xml
@@ -192,4 +192,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.2.3
From 50b05e7c1f64437a12afb56e38bb588b8b85bd5e Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:18:22 -0800
Subject: ARB_fbo: Move EXT_fb_blit to EXT_framebuffer_object.xml
This extension is layered on GL_EXT_framebuffer_object, so it should
live in the same XML file.
---
src/mesa/glapi/EXT_framebuffer_object.xml | 24 ++++++++++++++++++++++++
src/mesa/glapi/gl_API.xml | 24 ------------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/mesa/glapi/EXT_framebuffer_object.xml b/src/mesa/glapi/EXT_framebuffer_object.xml
index 8c5b1c3a1e..4f418f7b64 100644
--- a/src/mesa/glapi/EXT_framebuffer_object.xml
+++ b/src/mesa/glapi/EXT_framebuffer_object.xml
@@ -192,6 +192,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index 7180334bdb..34c7746e1b 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -12242,30 +12242,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--
cgit v1.2.3
From 7fd44005ae67d598c0070bb6ad82a26bc0944284 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Thu, 12 Nov 2009 11:50:28 -0800
Subject: ARB_fbo: Regenerate files from previous commits.
---
src/glx/x11/indirect.c | 46 +
src/glx/x11/indirect.h | 2 +
src/glx/x11/indirect_init.c | 8 +
src/mesa/glapi/glapitemp.h | 6 +
src/mesa/glapi/glprocs.h | 198 +-
src/mesa/main/enums.c | 5282 ++++++++++++++++++++--------------------
src/mesa/main/remap_helper.h | 2292 ++++++++---------
src/mesa/sparc/glapi_sparc.S | 1 +
src/mesa/x86-64/glapi_x86-64.S | 1 +
src/mesa/x86/glapi_x86.S | 1 +
10 files changed, 3975 insertions(+), 3862 deletions(-)
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index e0cafd43bc..3ca71f56ff 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -8604,6 +8604,26 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
}
}
+#define X_GLrop_RenderbufferStorageMultisample 4331
+void
+__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
+ GLenum internalformat,
+ GLsizei width, GLsizei height)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 24;
+ emit_header(gc->pc, X_GLrop_RenderbufferStorageMultisample, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&samples), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&width), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&height), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
#define X_GLrop_SampleMaskSGIS 2048
void
__indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
@@ -10597,6 +10617,32 @@ __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
}
}
+#define X_GLrop_BlitFramebufferEXT 4330
+void
+__indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1,
+ GLint srcY1, GLint dstX0, GLint dstY0,
+ GLint dstX1, GLint dstY1, GLbitfield mask,
+ GLenum filter)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 44;
+ emit_header(gc->pc, X_GLrop_BlitFramebufferEXT, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&srcX0), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&srcY0), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&srcX1), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&srcY1), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&dstX0), 4);
+ (void) memcpy((void *) (gc->pc + 24), (void *) (&dstY0), 4);
+ (void) memcpy((void *) (gc->pc + 28), (void *) (&dstX1), 4);
+ (void) memcpy((void *) (gc->pc + 32), (void *) (&dstY1), 4);
+ (void) memcpy((void *) (gc->pc + 36), (void *) (&mask), 4);
+ (void) memcpy((void *) (gc->pc + 40), (void *) (&filter), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
# undef FASTCALL
# undef NOINLINE
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index 0719a1b302..4a1b81ca6e 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -572,6 +572,7 @@ extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GL
extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params);
extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id);
extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs);
+extern HIDDEN void __indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
extern HIDDEN void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert);
extern HIDDEN void __indirect_glSamplePatternSGIS(GLenum pattern);
extern HIDDEN void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
@@ -710,6 +711,7 @@ extern HIDDEN void __indirect_glGetRenderbufferParameterivEXT(GLenum target, GLe
extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer);
extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer);
extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
# undef HIDDEN
# undef FASTCALL
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
index 852fe712c6..aa9a6bb2b0 100644
--- a/src/glx/x11/indirect_init.c
+++ b/src/glx/x11/indirect_init.c
@@ -588,6 +588,10 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB;
+ /* 45. GL_ARB_framebuffer_object */
+
+ glAPI->RenderbufferStorageMultisample = __indirect_glRenderbufferStorageMultisample;
+
/* 25. GL_SGIS_multisample */
glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS;
@@ -768,6 +772,10 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->IsRenderbufferEXT = __indirect_glIsRenderbufferEXT;
glAPI->RenderbufferStorageEXT = __indirect_glRenderbufferStorageEXT;
+ /* 316. GL_EXT_framebuffer_blit */
+
+ glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT;
+
return glAPI;
}
diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h
index d9a3690f2a..319a4ab55b 100644
--- a/src/mesa/glapi/glapitemp.h
+++ b/src/mesa/glapi/glapitemp.h
@@ -4011,6 +4011,11 @@ KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisample)(GLenum target, GLsiz
DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisample(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height));
}
+KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisampleEXT(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height));
+}
+
KEYWORD1 void KEYWORD2 NAME(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length)
{
DISPATCH(FlushMappedBufferRange, (target, offset, length), (F, "glFlushMappedBufferRange(0x%x, %d, %d);\n", target, offset, length));
@@ -6837,6 +6842,7 @@ static _glapi_proc UNUSED_TABLE_NAME[] = {
TABLE_ENTRY(GetAttribLocation),
TABLE_ENTRY(DrawBuffers),
TABLE_ENTRY(DrawBuffersATI),
+ TABLE_ENTRY(RenderbufferStorageMultisampleEXT),
TABLE_ENTRY(PointParameterf),
TABLE_ENTRY(PointParameterfARB),
TABLE_ENTRY(PointParameterfv),
diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h
index c29f8b57be..1ad7e84337 100644
--- a/src/mesa/glapi/glprocs.h
+++ b/src/mesa/glapi/glprocs.h
@@ -1050,6 +1050,7 @@ static const char gl_string_table[] =
"glGetAttribLocation\0"
"glDrawBuffers\0"
"glDrawBuffersATI\0"
+ "glRenderbufferStorageMultisampleEXT\0"
"glSampleMaskEXT\0"
"glSamplePatternEXT\0"
"glPointParameterf\0"
@@ -2257,104 +2258,105 @@ static const glprocs_table_t static_functions[] = {
NAME_FUNC_OFFSET(17904, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB),
NAME_FUNC_OFFSET(17924, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
NAME_FUNC_OFFSET(17938, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
- NAME_FUNC_OFFSET(17955, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS),
- NAME_FUNC_OFFSET(17971, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS),
- NAME_FUNC_OFFSET(17990, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18008, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18029, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18051, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18070, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18092, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18115, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
- NAME_FUNC_OFFSET(18134, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
- NAME_FUNC_OFFSET(18154, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
- NAME_FUNC_OFFSET(18173, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
- NAME_FUNC_OFFSET(18193, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
- NAME_FUNC_OFFSET(18212, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
- NAME_FUNC_OFFSET(18232, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
- NAME_FUNC_OFFSET(18251, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
- NAME_FUNC_OFFSET(18271, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
- NAME_FUNC_OFFSET(18290, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
- NAME_FUNC_OFFSET(18310, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
- NAME_FUNC_OFFSET(18330, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
- NAME_FUNC_OFFSET(18351, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
- NAME_FUNC_OFFSET(18371, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
- NAME_FUNC_OFFSET(18392, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
- NAME_FUNC_OFFSET(18412, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
- NAME_FUNC_OFFSET(18433, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
- NAME_FUNC_OFFSET(18457, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
- NAME_FUNC_OFFSET(18475, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
- NAME_FUNC_OFFSET(18495, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
- NAME_FUNC_OFFSET(18513, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
- NAME_FUNC_OFFSET(18525, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
- NAME_FUNC_OFFSET(18538, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
- NAME_FUNC_OFFSET(18550, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
- NAME_FUNC_OFFSET(18563, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
- NAME_FUNC_OFFSET(18583, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
- NAME_FUNC_OFFSET(18607, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
- NAME_FUNC_OFFSET(18621, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
- NAME_FUNC_OFFSET(18638, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
- NAME_FUNC_OFFSET(18653, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
- NAME_FUNC_OFFSET(18671, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
- NAME_FUNC_OFFSET(18685, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
- NAME_FUNC_OFFSET(18702, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
- NAME_FUNC_OFFSET(18717, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
- NAME_FUNC_OFFSET(18735, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
- NAME_FUNC_OFFSET(18749, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
- NAME_FUNC_OFFSET(18766, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
- NAME_FUNC_OFFSET(18781, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
- NAME_FUNC_OFFSET(18799, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
- NAME_FUNC_OFFSET(18813, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
- NAME_FUNC_OFFSET(18830, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
- NAME_FUNC_OFFSET(18845, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
- NAME_FUNC_OFFSET(18863, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
- NAME_FUNC_OFFSET(18877, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
- NAME_FUNC_OFFSET(18894, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
- NAME_FUNC_OFFSET(18909, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
- NAME_FUNC_OFFSET(18927, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
- NAME_FUNC_OFFSET(18941, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
- NAME_FUNC_OFFSET(18958, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
- NAME_FUNC_OFFSET(18973, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
- NAME_FUNC_OFFSET(18991, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
- NAME_FUNC_OFFSET(19005, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
- NAME_FUNC_OFFSET(19022, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
- NAME_FUNC_OFFSET(19037, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
- NAME_FUNC_OFFSET(19055, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
- NAME_FUNC_OFFSET(19069, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
- NAME_FUNC_OFFSET(19086, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
- NAME_FUNC_OFFSET(19101, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
- NAME_FUNC_OFFSET(19119, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
- NAME_FUNC_OFFSET(19136, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
- NAME_FUNC_OFFSET(19156, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
- NAME_FUNC_OFFSET(19173, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
- NAME_FUNC_OFFSET(19199, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
- NAME_FUNC_OFFSET(19228, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
- NAME_FUNC_OFFSET(19243, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
- NAME_FUNC_OFFSET(19261, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
- NAME_FUNC_OFFSET(19280, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE),
- NAME_FUNC_OFFSET(19301, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE),
- NAME_FUNC_OFFSET(19317, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
- NAME_FUNC_OFFSET(19341, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
- NAME_FUNC_OFFSET(19368, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
- NAME_FUNC_OFFSET(19386, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
- NAME_FUNC_OFFSET(19405, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
- NAME_FUNC_OFFSET(19430, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
- NAME_FUNC_OFFSET(19451, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
- NAME_FUNC_OFFSET(19473, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
- NAME_FUNC_OFFSET(19499, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
- NAME_FUNC_OFFSET(19522, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
- NAME_FUNC_OFFSET(19545, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
- NAME_FUNC_OFFSET(19568, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
- NAME_FUNC_OFFSET(19586, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
- NAME_FUNC_OFFSET(19605, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
- NAME_FUNC_OFFSET(19622, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
- NAME_FUNC_OFFSET(19660, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
- NAME_FUNC_OFFSET(19689, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
- NAME_FUNC_OFFSET(19705, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
- NAME_FUNC_OFFSET(19722, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
- NAME_FUNC_OFFSET(19744, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT),
- NAME_FUNC_OFFSET(19762, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
- NAME_FUNC_OFFSET(19788, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
+ NAME_FUNC_OFFSET(17955, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample),
+ NAME_FUNC_OFFSET(17991, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS),
+ NAME_FUNC_OFFSET(18007, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS),
+ NAME_FUNC_OFFSET(18026, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18044, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18065, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18087, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18106, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18128, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18151, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
+ NAME_FUNC_OFFSET(18170, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
+ NAME_FUNC_OFFSET(18190, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
+ NAME_FUNC_OFFSET(18209, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
+ NAME_FUNC_OFFSET(18229, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
+ NAME_FUNC_OFFSET(18248, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
+ NAME_FUNC_OFFSET(18268, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
+ NAME_FUNC_OFFSET(18287, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
+ NAME_FUNC_OFFSET(18307, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
+ NAME_FUNC_OFFSET(18326, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
+ NAME_FUNC_OFFSET(18346, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
+ NAME_FUNC_OFFSET(18366, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
+ NAME_FUNC_OFFSET(18387, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
+ NAME_FUNC_OFFSET(18407, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
+ NAME_FUNC_OFFSET(18428, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
+ NAME_FUNC_OFFSET(18448, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
+ NAME_FUNC_OFFSET(18469, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
+ NAME_FUNC_OFFSET(18493, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
+ NAME_FUNC_OFFSET(18511, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
+ NAME_FUNC_OFFSET(18531, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
+ NAME_FUNC_OFFSET(18549, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
+ NAME_FUNC_OFFSET(18561, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
+ NAME_FUNC_OFFSET(18574, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
+ NAME_FUNC_OFFSET(18586, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
+ NAME_FUNC_OFFSET(18599, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+ NAME_FUNC_OFFSET(18619, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+ NAME_FUNC_OFFSET(18643, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+ NAME_FUNC_OFFSET(18657, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+ NAME_FUNC_OFFSET(18674, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+ NAME_FUNC_OFFSET(18689, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+ NAME_FUNC_OFFSET(18707, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+ NAME_FUNC_OFFSET(18721, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+ NAME_FUNC_OFFSET(18738, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+ NAME_FUNC_OFFSET(18753, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+ NAME_FUNC_OFFSET(18771, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+ NAME_FUNC_OFFSET(18785, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+ NAME_FUNC_OFFSET(18802, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+ NAME_FUNC_OFFSET(18817, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+ NAME_FUNC_OFFSET(18835, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+ NAME_FUNC_OFFSET(18849, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+ NAME_FUNC_OFFSET(18866, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+ NAME_FUNC_OFFSET(18881, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+ NAME_FUNC_OFFSET(18899, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+ NAME_FUNC_OFFSET(18913, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+ NAME_FUNC_OFFSET(18930, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+ NAME_FUNC_OFFSET(18945, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+ NAME_FUNC_OFFSET(18963, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+ NAME_FUNC_OFFSET(18977, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+ NAME_FUNC_OFFSET(18994, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+ NAME_FUNC_OFFSET(19009, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+ NAME_FUNC_OFFSET(19027, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+ NAME_FUNC_OFFSET(19041, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+ NAME_FUNC_OFFSET(19058, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+ NAME_FUNC_OFFSET(19073, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+ NAME_FUNC_OFFSET(19091, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+ NAME_FUNC_OFFSET(19105, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+ NAME_FUNC_OFFSET(19122, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+ NAME_FUNC_OFFSET(19137, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+ NAME_FUNC_OFFSET(19155, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
+ NAME_FUNC_OFFSET(19172, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
+ NAME_FUNC_OFFSET(19192, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
+ NAME_FUNC_OFFSET(19209, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+ NAME_FUNC_OFFSET(19235, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+ NAME_FUNC_OFFSET(19264, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
+ NAME_FUNC_OFFSET(19279, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
+ NAME_FUNC_OFFSET(19297, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
+ NAME_FUNC_OFFSET(19316, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE),
+ NAME_FUNC_OFFSET(19337, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE),
+ NAME_FUNC_OFFSET(19353, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
+ NAME_FUNC_OFFSET(19377, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
+ NAME_FUNC_OFFSET(19404, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
+ NAME_FUNC_OFFSET(19422, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
+ NAME_FUNC_OFFSET(19441, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
+ NAME_FUNC_OFFSET(19466, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
+ NAME_FUNC_OFFSET(19487, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
+ NAME_FUNC_OFFSET(19509, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
+ NAME_FUNC_OFFSET(19535, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
+ NAME_FUNC_OFFSET(19558, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
+ NAME_FUNC_OFFSET(19581, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
+ NAME_FUNC_OFFSET(19604, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
+ NAME_FUNC_OFFSET(19622, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
+ NAME_FUNC_OFFSET(19641, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
+ NAME_FUNC_OFFSET(19658, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
+ NAME_FUNC_OFFSET(19696, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
+ NAME_FUNC_OFFSET(19725, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
+ NAME_FUNC_OFFSET(19741, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
+ NAME_FUNC_OFFSET(19758, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
+ NAME_FUNC_OFFSET(19780, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT),
+ NAME_FUNC_OFFSET(19798, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
+ NAME_FUNC_OFFSET(19824, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
};
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index 606d50c59a..f9f4bc7853 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -384,6 +384,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_DELETE_STATUS\0"
"GL_DEPTH\0"
"GL_DEPTH24_STENCIL8\0"
+ "GL_DEPTH24_STENCIL8_EXT\0"
"GL_DEPTH_ATTACHMENT\0"
"GL_DEPTH_ATTACHMENT_EXT\0"
"GL_DEPTH_BIAS\0"
@@ -409,6 +410,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_DEPTH_SCALE\0"
"GL_DEPTH_STENCIL\0"
"GL_DEPTH_STENCIL_ATTACHMENT\0"
+ "GL_DEPTH_STENCIL_EXT\0"
"GL_DEPTH_STENCIL_NV\0"
"GL_DEPTH_STENCIL_TO_BGRA_NV\0"
"GL_DEPTH_STENCIL_TO_RGBA_NV\0"
@@ -478,6 +480,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_DRAW_BUFFER9_ARB\0"
"GL_DRAW_BUFFER9_ATI\0"
"GL_DRAW_FRAMEBUFFER\0"
+ "GL_DRAW_FRAMEBUFFER_BINDING\0"
"GL_DRAW_FRAMEBUFFER_BINDING_EXT\0"
"GL_DRAW_FRAMEBUFFER_EXT\0"
"GL_DRAW_PIXEL_TOKEN\0"
@@ -593,6 +596,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0"
"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0"
"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0"
+ "GL_FRAMEBUFFER_BINDING\0"
"GL_FRAMEBUFFER_BINDING_EXT\0"
"GL_FRAMEBUFFER_COMPLETE\0"
"GL_FRAMEBUFFER_COMPLETE_EXT\0"
@@ -601,12 +605,15 @@ LONGSTRING static const char enum_string_table[] =
"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0"
"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0"
"GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0"
+ "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0"
"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0"
"GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0"
"GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0"
"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0"
"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0"
"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0"
+ "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0"
+ "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0"
"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0"
"GL_FRAMEBUFFER_STATUS_ERROR_EXT\0"
"GL_FRAMEBUFFER_UNDEFINED\0"
@@ -892,6 +899,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_MAX_CLIPMAP_DEPTH_SGIX\0"
"GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0"
"GL_MAX_CLIP_PLANES\0"
+ "GL_MAX_COLOR_ATTACHMENTS\0"
"GL_MAX_COLOR_ATTACHMENTS_EXT\0"
"GL_MAX_COLOR_MATRIX_STACK_DEPTH\0"
"GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0"
@@ -947,8 +955,10 @@ LONGSTRING static const char enum_string_table[] =
"GL_MAX_PROJECTION_STACK_DEPTH\0"
"GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0"
"GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0"
+ "GL_MAX_RENDERBUFFER_SIZE\0"
"GL_MAX_RENDERBUFFER_SIZE_EXT\0"
"GL_MAX_SAMPLES\0"
+ "GL_MAX_SAMPLES_EXT\0"
"GL_MAX_SERVER_WAIT_TIMEOUT\0"
"GL_MAX_SHININESS_NV\0"
"GL_MAX_SPOT_EXPONENT_NV\0"
@@ -1327,6 +1337,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_RASTER_POSITION_UNCLIPPED_IBM\0"
"GL_READ_BUFFER\0"
"GL_READ_FRAMEBUFFER\0"
+ "GL_READ_FRAMEBUFFER_BINDING\0"
"GL_READ_FRAMEBUFFER_BINDING_EXT\0"
"GL_READ_FRAMEBUFFER_EXT\0"
"GL_READ_ONLY\0"
@@ -1345,6 +1356,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_RENDER\0"
"GL_RENDERBUFFER\0"
"GL_RENDERBUFFER_ALPHA_SIZE\0"
+ "GL_RENDERBUFFER_BINDING\0"
"GL_RENDERBUFFER_BINDING_EXT\0"
"GL_RENDERBUFFER_BLUE_SIZE\0"
"GL_RENDERBUFFER_DEPTH_SIZE\0"
@@ -1356,6 +1368,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0"
"GL_RENDERBUFFER_RED_SIZE\0"
"GL_RENDERBUFFER_SAMPLES\0"
+ "GL_RENDERBUFFER_SAMPLES_EXT\0"
"GL_RENDERBUFFER_STENCIL_SIZE\0"
"GL_RENDERBUFFER_WIDTH\0"
"GL_RENDERBUFFER_WIDTH_EXT\0"
@@ -1541,9 +1554,13 @@ LONGSTRING static const char enum_string_table[] =
"GL_STENCIL_FAIL\0"
"GL_STENCIL_FUNC\0"
"GL_STENCIL_INDEX\0"
+ "GL_STENCIL_INDEX1\0"
+ "GL_STENCIL_INDEX16\0"
"GL_STENCIL_INDEX16_EXT\0"
"GL_STENCIL_INDEX1_EXT\0"
+ "GL_STENCIL_INDEX4\0"
"GL_STENCIL_INDEX4_EXT\0"
+ "GL_STENCIL_INDEX8\0"
"GL_STENCIL_INDEX8_EXT\0"
"GL_STENCIL_INDEX_EXT\0"
"GL_STENCIL_PASS_DEPTH_FAIL\0"
@@ -1761,6 +1778,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_TEXTURE_RESIDENT\0"
"GL_TEXTURE_STACK_DEPTH\0"
"GL_TEXTURE_STENCIL_SIZE\0"
+ "GL_TEXTURE_STENCIL_SIZE_EXT\0"
"GL_TEXTURE_STORAGE_HINT_APPLE\0"
"GL_TEXTURE_TOO_LARGE_EXT\0"
"GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0"
@@ -1804,6 +1822,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_UNSIGNED_INT\0"
"GL_UNSIGNED_INT_10_10_10_2\0"
"GL_UNSIGNED_INT_24_8\0"
+ "GL_UNSIGNED_INT_24_8_EXT\0"
"GL_UNSIGNED_INT_24_8_NV\0"
"GL_UNSIGNED_INT_2_10_10_10_REV\0"
"GL_UNSIGNED_INT_8_8_8_8\0"
@@ -1900,7 +1919,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_ZOOM_Y\0"
;
-static const enum_elt all_enums[1862] =
+static const enum_elt all_enums[1881] =
{
{ 0, 0x00000600 }, /* GL_2D */
{ 6, 0x00001407 }, /* GL_2_BYTES */
@@ -2250,1600 +2269,1619 @@ static const enum_elt all_enums[1862] =
{ 7144, 0x00008B80 }, /* GL_DELETE_STATUS */
{ 7161, 0x00001801 }, /* GL_DEPTH */
{ 7170, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
- { 7190, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
- { 7210, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
- { 7234, 0x00000D1F }, /* GL_DEPTH_BIAS */
- { 7248, 0x00000D56 }, /* GL_DEPTH_BITS */
- { 7262, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
- { 7282, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
- { 7307, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
- { 7327, 0x0000864F }, /* GL_DEPTH_CLAMP */
- { 7342, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
- { 7360, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
- { 7381, 0x00001902 }, /* GL_DEPTH_COMPONENT */
- { 7400, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
- { 7421, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
- { 7446, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
- { 7472, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
- { 7493, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
- { 7518, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
- { 7544, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
- { 7565, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
- { 7590, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
- { 7616, 0x00000B74 }, /* GL_DEPTH_FUNC */
- { 7630, 0x00000B70 }, /* GL_DEPTH_RANGE */
- { 7645, 0x00000D1E }, /* GL_DEPTH_SCALE */
- { 7660, 0x000084F9 }, /* GL_DEPTH_STENCIL */
- { 7677, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
- { 7705, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
- { 7725, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- { 7753, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
- { 7781, 0x00000B71 }, /* GL_DEPTH_TEST */
- { 7795, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
- { 7817, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
- { 7843, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
- { 7862, 0x00001201 }, /* GL_DIFFUSE */
- { 7873, 0x00000BD0 }, /* GL_DITHER */
- { 7883, 0x00000A02 }, /* GL_DOMAIN */
- { 7893, 0x00001100 }, /* GL_DONT_CARE */
- { 7906, 0x000086AE }, /* GL_DOT3_RGB */
- { 7918, 0x000086AF }, /* GL_DOT3_RGBA */
- { 7931, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
- { 7948, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
- { 7965, 0x000086AE }, /* GL_DOT3_RGB_ARB */
- { 7981, 0x00008740 }, /* GL_DOT3_RGB_EXT */
- { 7997, 0x0000140A }, /* GL_DOUBLE */
- { 8007, 0x00000C32 }, /* GL_DOUBLEBUFFER */
- { 8023, 0x00000C01 }, /* GL_DRAW_BUFFER */
- { 8038, 0x00008825 }, /* GL_DRAW_BUFFER0 */
- { 8054, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
- { 8074, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
- { 8094, 0x00008826 }, /* GL_DRAW_BUFFER1 */
- { 8110, 0x0000882F }, /* GL_DRAW_BUFFER10 */
- { 8127, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
- { 8148, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
- { 8169, 0x00008830 }, /* GL_DRAW_BUFFER11 */
- { 8186, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
- { 8207, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
- { 8228, 0x00008831 }, /* GL_DRAW_BUFFER12 */
- { 8245, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
- { 8266, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
- { 8287, 0x00008832 }, /* GL_DRAW_BUFFER13 */
- { 8304, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
- { 8325, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
- { 8346, 0x00008833 }, /* GL_DRAW_BUFFER14 */
- { 8363, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
- { 8384, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
- { 8405, 0x00008834 }, /* GL_DRAW_BUFFER15 */
- { 8422, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
- { 8443, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
- { 8464, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
- { 8484, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
- { 8504, 0x00008827 }, /* GL_DRAW_BUFFER2 */
- { 8520, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
- { 8540, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
- { 8560, 0x00008828 }, /* GL_DRAW_BUFFER3 */
- { 8576, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
- { 8596, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
- { 8616, 0x00008829 }, /* GL_DRAW_BUFFER4 */
- { 8632, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
- { 8652, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
- { 8672, 0x0000882A }, /* GL_DRAW_BUFFER5 */
- { 8688, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
- { 8708, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
- { 8728, 0x0000882B }, /* GL_DRAW_BUFFER6 */
- { 8744, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
- { 8764, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
- { 8784, 0x0000882C }, /* GL_DRAW_BUFFER7 */
- { 8800, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
- { 8820, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
- { 8840, 0x0000882D }, /* GL_DRAW_BUFFER8 */
- { 8856, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
- { 8876, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
- { 8896, 0x0000882E }, /* GL_DRAW_BUFFER9 */
- { 8912, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
- { 8932, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
- { 8952, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
- { 8972, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
- { 9004, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
- { 9028, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
- { 9048, 0x00000304 }, /* GL_DST_ALPHA */
- { 9061, 0x00000306 }, /* GL_DST_COLOR */
- { 9074, 0x0000877A }, /* GL_DU8DV8_ATI */
- { 9088, 0x00008779 }, /* GL_DUDV_ATI */
- { 9100, 0x000088EA }, /* GL_DYNAMIC_COPY */
- { 9116, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
- { 9136, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
- { 9152, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
- { 9172, 0x000088E9 }, /* GL_DYNAMIC_READ */
- { 9188, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
- { 9208, 0x00000B43 }, /* GL_EDGE_FLAG */
- { 9221, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
- { 9240, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- { 9274, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
- { 9312, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
- { 9339, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- { 9365, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
- { 9389, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- { 9421, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
- { 9457, 0x00001600 }, /* GL_EMISSION */
- { 9469, 0x00002000 }, /* GL_ENABLE_BIT */
- { 9483, 0x00000202 }, /* GL_EQUAL */
- { 9492, 0x00001509 }, /* GL_EQUIV */
- { 9501, 0x00010000 }, /* GL_EVAL_BIT */
- { 9513, 0x00000800 }, /* GL_EXP */
- { 9520, 0x00000801 }, /* GL_EXP2 */
- { 9528, 0x00001F03 }, /* GL_EXTENSIONS */
- { 9542, 0x00002400 }, /* GL_EYE_LINEAR */
- { 9556, 0x00002502 }, /* GL_EYE_PLANE */
- { 9569, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
- { 9594, 0x0000855B }, /* GL_EYE_RADIAL_NV */
- { 9611, 0x00000000 }, /* GL_FALSE */
- { 9620, 0x00001101 }, /* GL_FASTEST */
- { 9631, 0x00001C01 }, /* GL_FEEDBACK */
- { 9643, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
- { 9670, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
- { 9694, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
- { 9718, 0x00001B02 }, /* GL_FILL */
- { 9726, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
- { 9753, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
- { 9784, 0x00001D00 }, /* GL_FLAT */
- { 9792, 0x00001406 }, /* GL_FLOAT */
- { 9801, 0x00008B5A }, /* GL_FLOAT_MAT2 */
- { 9815, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
- { 9833, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
- { 9849, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
- { 9865, 0x00008B5B }, /* GL_FLOAT_MAT3 */
- { 9879, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
- { 9897, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
- { 9913, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
- { 9929, 0x00008B5C }, /* GL_FLOAT_MAT4 */
- { 9943, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
- { 9961, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
- { 9977, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
- { 9993, 0x00008B50 }, /* GL_FLOAT_VEC2 */
- { 10007, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
- { 10025, 0x00008B51 }, /* GL_FLOAT_VEC3 */
- { 10039, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
- { 10057, 0x00008B52 }, /* GL_FLOAT_VEC4 */
- { 10071, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
- { 10089, 0x00000B60 }, /* GL_FOG */
- { 10096, 0x00000080 }, /* GL_FOG_BIT */
- { 10107, 0x00000B66 }, /* GL_FOG_COLOR */
- { 10120, 0x00008451 }, /* GL_FOG_COORD */
- { 10133, 0x00008451 }, /* GL_FOG_COORDINATE */
- { 10151, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
- { 10175, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- { 10214, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
- { 10257, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
- { 10289, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
- { 10320, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
- { 10349, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
- { 10374, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
- { 10393, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
- { 10427, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
- { 10454, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
- { 10480, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
- { 10504, 0x00008450 }, /* GL_FOG_COORD_SRC */
- { 10521, 0x00000B62 }, /* GL_FOG_DENSITY */
- { 10536, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
- { 10560, 0x00000B64 }, /* GL_FOG_END */
- { 10571, 0x00000C54 }, /* GL_FOG_HINT */
- { 10583, 0x00000B61 }, /* GL_FOG_INDEX */
- { 10596, 0x00000B65 }, /* GL_FOG_MODE */
- { 10608, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
- { 10627, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
- { 10652, 0x00000B63 }, /* GL_FOG_START */
- { 10665, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
- { 10683, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
- { 10707, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
- { 10726, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
- { 10749, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- { 10784, 0x00008D40 }, /* GL_FRAMEBUFFER */
- { 10799, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
- { 10836, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
- { 10872, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
- { 10913, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
- { 10954, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
- { 10991, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
- { 11028, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
- { 11066, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
- { 11108, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
- { 11146, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
- { 11188, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
- { 11223, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
- { 11262, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
- { 11311, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
- { 11359, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
- { 11411, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
- { 11451, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
- { 11495, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
- { 11535, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
- { 11579, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
- { 11606, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
- { 11630, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
- { 11658, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
- { 11681, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
- { 11700, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
- { 11737, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
- { 11778, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
- { 11819, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
- { 11861, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
- { 11912, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
- { 11950, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
- { 11995, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
- { 12044, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- { 12082, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
- { 12124, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- { 12156, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
- { 12181, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
- { 12208, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
- { 12239, 0x00000404 }, /* GL_FRONT */
- { 12248, 0x00000408 }, /* GL_FRONT_AND_BACK */
- { 12266, 0x00000B46 }, /* GL_FRONT_FACE */
- { 12280, 0x00000400 }, /* GL_FRONT_LEFT */
- { 12294, 0x00000401 }, /* GL_FRONT_RIGHT */
- { 12309, 0x00008006 }, /* GL_FUNC_ADD */
- { 12321, 0x00008006 }, /* GL_FUNC_ADD_EXT */
- { 12337, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
- { 12362, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
- { 12391, 0x0000800A }, /* GL_FUNC_SUBTRACT */
- { 12408, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
- { 12429, 0x00008191 }, /* GL_GENERATE_MIPMAP */
- { 12448, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
- { 12472, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
- { 12501, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
- { 12525, 0x00000206 }, /* GL_GEQUAL */
- { 12535, 0x00000204 }, /* GL_GREATER */
- { 12546, 0x00001904 }, /* GL_GREEN */
- { 12555, 0x00000D19 }, /* GL_GREEN_BIAS */
- { 12569, 0x00000D53 }, /* GL_GREEN_BITS */
- { 12583, 0x00000D18 }, /* GL_GREEN_SCALE */
- { 12598, 0x00008000 }, /* GL_HINT_BIT */
- { 12610, 0x00008024 }, /* GL_HISTOGRAM */
- { 12623, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
- { 12647, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
- { 12675, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
- { 12698, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
- { 12725, 0x00008024 }, /* GL_HISTOGRAM_EXT */
- { 12742, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
- { 12762, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
- { 12786, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
- { 12810, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
- { 12838, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- { 12866, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
- { 12898, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
- { 12920, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
- { 12946, 0x0000802D }, /* GL_HISTOGRAM_SINK */
- { 12964, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
- { 12986, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
- { 13005, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
- { 13028, 0x0000862A }, /* GL_IDENTITY_NV */
- { 13043, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
- { 13063, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- { 13103, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- { 13141, 0x00001E02 }, /* GL_INCR */
- { 13149, 0x00008507 }, /* GL_INCR_WRAP */
- { 13162, 0x00008507 }, /* GL_INCR_WRAP_EXT */
- { 13179, 0x00008222 }, /* GL_INDEX */
- { 13188, 0x00008077 }, /* GL_INDEX_ARRAY */
- { 13203, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- { 13233, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
- { 13267, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
- { 13290, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
- { 13312, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
- { 13332, 0x00000D51 }, /* GL_INDEX_BITS */
- { 13346, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
- { 13367, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
- { 13385, 0x00000C30 }, /* GL_INDEX_MODE */
- { 13399, 0x00000D13 }, /* GL_INDEX_OFFSET */
- { 13415, 0x00000D12 }, /* GL_INDEX_SHIFT */
- { 13430, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
- { 13449, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
- { 13468, 0x00001404 }, /* GL_INT */
- { 13475, 0x00008049 }, /* GL_INTENSITY */
- { 13488, 0x0000804C }, /* GL_INTENSITY12 */
- { 13503, 0x0000804C }, /* GL_INTENSITY12_EXT */
- { 13522, 0x0000804D }, /* GL_INTENSITY16 */
- { 13537, 0x0000804D }, /* GL_INTENSITY16_EXT */
- { 13556, 0x0000804A }, /* GL_INTENSITY4 */
- { 13570, 0x0000804A }, /* GL_INTENSITY4_EXT */
- { 13588, 0x0000804B }, /* GL_INTENSITY8 */
- { 13602, 0x0000804B }, /* GL_INTENSITY8_EXT */
- { 13620, 0x00008049 }, /* GL_INTENSITY_EXT */
- { 13637, 0x00008575 }, /* GL_INTERPOLATE */
- { 13652, 0x00008575 }, /* GL_INTERPOLATE_ARB */
- { 13671, 0x00008575 }, /* GL_INTERPOLATE_EXT */
- { 13690, 0x00008B53 }, /* GL_INT_VEC2 */
- { 13702, 0x00008B53 }, /* GL_INT_VEC2_ARB */
- { 13718, 0x00008B54 }, /* GL_INT_VEC3 */
- { 13730, 0x00008B54 }, /* GL_INT_VEC3_ARB */
- { 13746, 0x00008B55 }, /* GL_INT_VEC4 */
- { 13758, 0x00008B55 }, /* GL_INT_VEC4_ARB */
- { 13774, 0x00000500 }, /* GL_INVALID_ENUM */
- { 13790, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
- { 13823, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
- { 13860, 0x00000502 }, /* GL_INVALID_OPERATION */
- { 13881, 0x00000501 }, /* GL_INVALID_VALUE */
- { 13898, 0x0000862B }, /* GL_INVERSE_NV */
- { 13912, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
- { 13936, 0x0000150A }, /* GL_INVERT */
- { 13946, 0x00001E00 }, /* GL_KEEP */
- { 13954, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
- { 13980, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
- { 14010, 0x00000406 }, /* GL_LEFT */
- { 14018, 0x00000203 }, /* GL_LEQUAL */
- { 14028, 0x00000201 }, /* GL_LESS */
- { 14036, 0x00004000 }, /* GL_LIGHT0 */
- { 14046, 0x00004001 }, /* GL_LIGHT1 */
- { 14056, 0x00004002 }, /* GL_LIGHT2 */
- { 14066, 0x00004003 }, /* GL_LIGHT3 */
- { 14076, 0x00004004 }, /* GL_LIGHT4 */
- { 14086, 0x00004005 }, /* GL_LIGHT5 */
- { 14096, 0x00004006 }, /* GL_LIGHT6 */
- { 14106, 0x00004007 }, /* GL_LIGHT7 */
- { 14116, 0x00000B50 }, /* GL_LIGHTING */
- { 14128, 0x00000040 }, /* GL_LIGHTING_BIT */
- { 14144, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
- { 14167, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- { 14196, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
- { 14229, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- { 14257, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
- { 14281, 0x00001B01 }, /* GL_LINE */
- { 14289, 0x00002601 }, /* GL_LINEAR */
- { 14299, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
- { 14321, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- { 14351, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- { 14382, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
- { 14406, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
- { 14431, 0x00000001 }, /* GL_LINES */
- { 14440, 0x00000004 }, /* GL_LINE_BIT */
- { 14452, 0x00000002 }, /* GL_LINE_LOOP */
- { 14465, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
- { 14485, 0x00000B20 }, /* GL_LINE_SMOOTH */
- { 14500, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
- { 14520, 0x00000B24 }, /* GL_LINE_STIPPLE */
- { 14536, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
- { 14560, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
- { 14583, 0x00000003 }, /* GL_LINE_STRIP */
- { 14597, 0x00000702 }, /* GL_LINE_TOKEN */
- { 14611, 0x00000B21 }, /* GL_LINE_WIDTH */
- { 14625, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
- { 14651, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
- { 14671, 0x00008B82 }, /* GL_LINK_STATUS */
- { 14686, 0x00000B32 }, /* GL_LIST_BASE */
- { 14699, 0x00020000 }, /* GL_LIST_BIT */
- { 14711, 0x00000B33 }, /* GL_LIST_INDEX */
- { 14725, 0x00000B30 }, /* GL_LIST_MODE */
- { 14738, 0x00000101 }, /* GL_LOAD */
- { 14746, 0x00000BF1 }, /* GL_LOGIC_OP */
- { 14758, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
- { 14775, 0x00008CA1 }, /* GL_LOWER_LEFT */
- { 14789, 0x00001909 }, /* GL_LUMINANCE */
- { 14802, 0x00008041 }, /* GL_LUMINANCE12 */
- { 14817, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
- { 14840, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
- { 14867, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
- { 14889, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
- { 14915, 0x00008041 }, /* GL_LUMINANCE12_EXT */
- { 14934, 0x00008042 }, /* GL_LUMINANCE16 */
- { 14949, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
- { 14972, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
- { 14999, 0x00008042 }, /* GL_LUMINANCE16_EXT */
- { 15018, 0x0000803F }, /* GL_LUMINANCE4 */
- { 15032, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
- { 15053, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
- { 15078, 0x0000803F }, /* GL_LUMINANCE4_EXT */
- { 15096, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
- { 15117, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
- { 15142, 0x00008040 }, /* GL_LUMINANCE8 */
- { 15156, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
- { 15177, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
- { 15202, 0x00008040 }, /* GL_LUMINANCE8_EXT */
- { 15220, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
- { 15239, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
- { 15255, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
- { 15275, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
- { 15297, 0x00000D91 }, /* GL_MAP1_INDEX */
- { 15311, 0x00000D92 }, /* GL_MAP1_NORMAL */
- { 15326, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
- { 15350, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
- { 15374, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
- { 15398, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
- { 15422, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
- { 15439, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
- { 15456, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- { 15484, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- { 15513, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- { 15542, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- { 15571, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- { 15600, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- { 15629, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- { 15658, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- { 15686, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- { 15714, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- { 15742, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- { 15770, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- { 15798, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- { 15826, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- { 15854, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- { 15882, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- { 15910, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
- { 15926, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
- { 15946, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
- { 15968, 0x00000DB1 }, /* GL_MAP2_INDEX */
- { 15982, 0x00000DB2 }, /* GL_MAP2_NORMAL */
- { 15997, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
- { 16021, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
- { 16045, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
- { 16069, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
- { 16093, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
- { 16110, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
- { 16127, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- { 16155, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- { 16184, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- { 16213, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- { 16242, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- { 16271, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- { 16300, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- { 16329, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- { 16357, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- { 16385, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- { 16413, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- { 16441, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- { 16469, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- { 16497, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
- { 16525, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- { 16553, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- { 16581, 0x00000D10 }, /* GL_MAP_COLOR */
- { 16594, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
- { 16620, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
- { 16649, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
- { 16677, 0x00000001 }, /* GL_MAP_READ_BIT */
- { 16693, 0x00000D11 }, /* GL_MAP_STENCIL */
- { 16708, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
- { 16734, 0x00000002 }, /* GL_MAP_WRITE_BIT */
- { 16751, 0x000088C0 }, /* GL_MATRIX0_ARB */
- { 16766, 0x00008630 }, /* GL_MATRIX0_NV */
- { 16780, 0x000088CA }, /* GL_MATRIX10_ARB */
- { 16796, 0x000088CB }, /* GL_MATRIX11_ARB */
- { 16812, 0x000088CC }, /* GL_MATRIX12_ARB */
- { 16828, 0x000088CD }, /* GL_MATRIX13_ARB */
- { 16844, 0x000088CE }, /* GL_MATRIX14_ARB */
- { 16860, 0x000088CF }, /* GL_MATRIX15_ARB */
- { 16876, 0x000088D0 }, /* GL_MATRIX16_ARB */
- { 16892, 0x000088D1 }, /* GL_MATRIX17_ARB */
- { 16908, 0x000088D2 }, /* GL_MATRIX18_ARB */
- { 16924, 0x000088D3 }, /* GL_MATRIX19_ARB */
- { 16940, 0x000088C1 }, /* GL_MATRIX1_ARB */
- { 16955, 0x00008631 }, /* GL_MATRIX1_NV */
- { 16969, 0x000088D4 }, /* GL_MATRIX20_ARB */
- { 16985, 0x000088D5 }, /* GL_MATRIX21_ARB */
- { 17001, 0x000088D6 }, /* GL_MATRIX22_ARB */
- { 17017, 0x000088D7 }, /* GL_MATRIX23_ARB */
- { 17033, 0x000088D8 }, /* GL_MATRIX24_ARB */
- { 17049, 0x000088D9 }, /* GL_MATRIX25_ARB */
- { 17065, 0x000088DA }, /* GL_MATRIX26_ARB */
- { 17081, 0x000088DB }, /* GL_MATRIX27_ARB */
- { 17097, 0x000088DC }, /* GL_MATRIX28_ARB */
- { 17113, 0x000088DD }, /* GL_MATRIX29_ARB */
- { 17129, 0x000088C2 }, /* GL_MATRIX2_ARB */
- { 17144, 0x00008632 }, /* GL_MATRIX2_NV */
- { 17158, 0x000088DE }, /* GL_MATRIX30_ARB */
- { 17174, 0x000088DF }, /* GL_MATRIX31_ARB */
- { 17190, 0x000088C3 }, /* GL_MATRIX3_ARB */
- { 17205, 0x00008633 }, /* GL_MATRIX3_NV */
- { 17219, 0x000088C4 }, /* GL_MATRIX4_ARB */
- { 17234, 0x00008634 }, /* GL_MATRIX4_NV */
- { 17248, 0x000088C5 }, /* GL_MATRIX5_ARB */
- { 17263, 0x00008635 }, /* GL_MATRIX5_NV */
- { 17277, 0x000088C6 }, /* GL_MATRIX6_ARB */
- { 17292, 0x00008636 }, /* GL_MATRIX6_NV */
- { 17306, 0x000088C7 }, /* GL_MATRIX7_ARB */
- { 17321, 0x00008637 }, /* GL_MATRIX7_NV */
- { 17335, 0x000088C8 }, /* GL_MATRIX8_ARB */
- { 17350, 0x000088C9 }, /* GL_MATRIX9_ARB */
- { 17365, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
- { 17391, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- { 17425, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- { 17456, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- { 17489, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- { 17520, 0x00000BA0 }, /* GL_MATRIX_MODE */
- { 17535, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
- { 17557, 0x00008008 }, /* GL_MAX */
- { 17564, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
- { 17587, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- { 17619, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
- { 17645, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- { 17678, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- { 17704, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 17738, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
- { 17757, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
- { 17786, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- { 17818, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
- { 17854, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- { 17890, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
- { 17930, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
- { 17956, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
- { 17986, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
- { 18011, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
- { 18040, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- { 18069, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
- { 18102, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
- { 18122, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
- { 18146, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
- { 18170, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
- { 18194, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
- { 18219, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
- { 18237, 0x00008008 }, /* GL_MAX_EXT */
- { 18248, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- { 18283, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
- { 18322, 0x00000D31 }, /* GL_MAX_LIGHTS */
- { 18336, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
- { 18356, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- { 18394, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- { 18423, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
- { 18447, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
- { 18475, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
- { 18498, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 18535, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 18571, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- { 18598, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- { 18627, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- { 18661, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
- { 18697, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- { 18724, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- { 18756, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- { 18792, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- { 18821, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- { 18850, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
- { 18878, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- { 18916, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 18960, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 19003, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 19037, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 19076, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 19113, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 19151, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 19194, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 19237, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- { 19267, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- { 19298, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 19334, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 19370, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
- { 19400, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
- { 19434, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
- { 19467, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
- { 19496, 0x00008D57 }, /* GL_MAX_SAMPLES */
- { 19511, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- { 19538, 0x00008504 }, /* GL_MAX_SHININESS_NV */
- { 19558, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
- { 19582, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
- { 19604, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
- { 19630, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- { 19657, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
- { 19688, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
- { 19712, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- { 19746, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
- { 19766, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
- { 19793, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
- { 19814, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
- { 19839, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
- { 19864, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
- { 19899, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
- { 19921, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
- { 19947, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
- { 19969, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
- { 19995, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- { 20029, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
- { 20067, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- { 20100, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
- { 20137, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
- { 20161, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
- { 20182, 0x00008007 }, /* GL_MIN */
- { 20189, 0x0000802E }, /* GL_MINMAX */
- { 20199, 0x0000802E }, /* GL_MINMAX_EXT */
- { 20213, 0x0000802F }, /* GL_MINMAX_FORMAT */
- { 20230, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
- { 20251, 0x00008030 }, /* GL_MINMAX_SINK */
- { 20266, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
- { 20285, 0x00008007 }, /* GL_MIN_EXT */
- { 20296, 0x00008370 }, /* GL_MIRRORED_REPEAT */
- { 20315, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
- { 20338, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
- { 20361, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
- { 20381, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
- { 20401, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- { 20431, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
- { 20459, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- { 20487, 0x00001700 }, /* GL_MODELVIEW */
- { 20500, 0x00001700 }, /* GL_MODELVIEW0_ARB */
- { 20518, 0x0000872A }, /* GL_MODELVIEW10_ARB */
- { 20537, 0x0000872B }, /* GL_MODELVIEW11_ARB */
- { 20556, 0x0000872C }, /* GL_MODELVIEW12_ARB */
- { 20575, 0x0000872D }, /* GL_MODELVIEW13_ARB */
- { 20594, 0x0000872E }, /* GL_MODELVIEW14_ARB */
- { 20613, 0x0000872F }, /* GL_MODELVIEW15_ARB */
- { 20632, 0x00008730 }, /* GL_MODELVIEW16_ARB */
- { 20651, 0x00008731 }, /* GL_MODELVIEW17_ARB */
- { 20670, 0x00008732 }, /* GL_MODELVIEW18_ARB */
- { 20689, 0x00008733 }, /* GL_MODELVIEW19_ARB */
- { 20708, 0x0000850A }, /* GL_MODELVIEW1_ARB */
- { 20726, 0x00008734 }, /* GL_MODELVIEW20_ARB */
- { 20745, 0x00008735 }, /* GL_MODELVIEW21_ARB */
- { 20764, 0x00008736 }, /* GL_MODELVIEW22_ARB */
- { 20783, 0x00008737 }, /* GL_MODELVIEW23_ARB */
- { 20802, 0x00008738 }, /* GL_MODELVIEW24_ARB */
- { 20821, 0x00008739 }, /* GL_MODELVIEW25_ARB */
- { 20840, 0x0000873A }, /* GL_MODELVIEW26_ARB */
- { 20859, 0x0000873B }, /* GL_MODELVIEW27_ARB */
- { 20878, 0x0000873C }, /* GL_MODELVIEW28_ARB */
- { 20897, 0x0000873D }, /* GL_MODELVIEW29_ARB */
- { 20916, 0x00008722 }, /* GL_MODELVIEW2_ARB */
- { 20934, 0x0000873E }, /* GL_MODELVIEW30_ARB */
- { 20953, 0x0000873F }, /* GL_MODELVIEW31_ARB */
- { 20972, 0x00008723 }, /* GL_MODELVIEW3_ARB */
- { 20990, 0x00008724 }, /* GL_MODELVIEW4_ARB */
- { 21008, 0x00008725 }, /* GL_MODELVIEW5_ARB */
- { 21026, 0x00008726 }, /* GL_MODELVIEW6_ARB */
- { 21044, 0x00008727 }, /* GL_MODELVIEW7_ARB */
- { 21062, 0x00008728 }, /* GL_MODELVIEW8_ARB */
- { 21080, 0x00008729 }, /* GL_MODELVIEW9_ARB */
- { 21098, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
- { 21118, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
- { 21145, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
- { 21170, 0x00002100 }, /* GL_MODULATE */
- { 21182, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
- { 21202, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
- { 21229, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
- { 21254, 0x00000103 }, /* GL_MULT */
- { 21262, 0x0000809D }, /* GL_MULTISAMPLE */
- { 21277, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
- { 21297, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
- { 21316, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
- { 21335, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
- { 21359, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
- { 21382, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- { 21412, 0x00002A25 }, /* GL_N3F_V3F */
- { 21423, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
- { 21443, 0x0000150E }, /* GL_NAND */
- { 21451, 0x00002600 }, /* GL_NEAREST */
- { 21462, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- { 21493, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- { 21525, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
- { 21550, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
- { 21576, 0x00000200 }, /* GL_NEVER */
- { 21585, 0x00001102 }, /* GL_NICEST */
- { 21595, 0x00000000 }, /* GL_NONE */
- { 21603, 0x00001505 }, /* GL_NOOP */
- { 21611, 0x00001508 }, /* GL_NOR */
- { 21618, 0x00000BA1 }, /* GL_NORMALIZE */
- { 21631, 0x00008075 }, /* GL_NORMAL_ARRAY */
- { 21647, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
- { 21678, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
- { 21713, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
- { 21737, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
- { 21760, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
- { 21781, 0x00008511 }, /* GL_NORMAL_MAP */
- { 21795, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
- { 21813, 0x00008511 }, /* GL_NORMAL_MAP_NV */
- { 21830, 0x00000205 }, /* GL_NOTEQUAL */
- { 21842, 0x00000000 }, /* GL_NO_ERROR */
- { 21854, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
- { 21888, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
- { 21926, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
- { 21958, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
- { 22000, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
- { 22030, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
- { 22070, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
- { 22101, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
- { 22130, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
- { 22158, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
- { 22188, 0x00002401 }, /* GL_OBJECT_LINEAR */
- { 22205, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
- { 22231, 0x00002501 }, /* GL_OBJECT_PLANE */
- { 22247, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
- { 22282, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
- { 22304, 0x00009112 }, /* GL_OBJECT_TYPE */
- { 22319, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
- { 22338, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
- { 22368, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
- { 22389, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
- { 22417, 0x00000001 }, /* GL_ONE */
- { 22424, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
- { 22452, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
- { 22484, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
- { 22512, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
- { 22544, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
- { 22567, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
- { 22590, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
- { 22613, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
- { 22636, 0x00008598 }, /* GL_OPERAND0_ALPHA */
- { 22654, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
- { 22676, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
- { 22698, 0x00008590 }, /* GL_OPERAND0_RGB */
- { 22714, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
- { 22734, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
- { 22754, 0x00008599 }, /* GL_OPERAND1_ALPHA */
- { 22772, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
- { 22794, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
- { 22816, 0x00008591 }, /* GL_OPERAND1_RGB */
- { 22832, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
- { 22852, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
- { 22872, 0x0000859A }, /* GL_OPERAND2_ALPHA */
- { 22890, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
- { 22912, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
- { 22934, 0x00008592 }, /* GL_OPERAND2_RGB */
- { 22950, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
- { 22970, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
- { 22990, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
- { 23011, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
- { 23030, 0x00001507 }, /* GL_OR */
- { 23036, 0x00000A01 }, /* GL_ORDER */
- { 23045, 0x0000150D }, /* GL_OR_INVERTED */
- { 23060, 0x0000150B }, /* GL_OR_REVERSE */
- { 23074, 0x00000505 }, /* GL_OUT_OF_MEMORY */
- { 23091, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
- { 23109, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
- { 23130, 0x00008758 }, /* GL_PACK_INVERT_MESA */
- { 23150, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
- { 23168, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
- { 23187, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
- { 23207, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
- { 23227, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
- { 23245, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
- { 23264, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
- { 23289, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
- { 23313, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
- { 23334, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
- { 23356, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
- { 23378, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
- { 23403, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
- { 23427, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
- { 23448, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
- { 23470, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
- { 23492, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
- { 23514, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
- { 23545, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
- { 23565, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- { 23590, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
- { 23610, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- { 23635, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
- { 23655, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- { 23680, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
- { 23700, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- { 23725, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
- { 23745, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- { 23770, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
- { 23790, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- { 23815, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
- { 23835, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- { 23860, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
- { 23880, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- { 23905, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
- { 23925, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- { 23950, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
- { 23970, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- { 23995, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
- { 24013, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
- { 24034, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
- { 24063, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
- { 24096, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
- { 24121, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
- { 24144, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
- { 24175, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
- { 24210, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
- { 24237, 0x00001B00 }, /* GL_POINT */
- { 24246, 0x00000000 }, /* GL_POINTS */
- { 24256, 0x00000002 }, /* GL_POINT_BIT */
- { 24269, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
- { 24299, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
- { 24333, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
- { 24367, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
- { 24402, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
- { 24431, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
- { 24464, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
- { 24497, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
- { 24531, 0x00000B11 }, /* GL_POINT_SIZE */
- { 24545, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
- { 24571, 0x00008127 }, /* GL_POINT_SIZE_MAX */
- { 24589, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
- { 24611, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
- { 24633, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
- { 24656, 0x00008126 }, /* GL_POINT_SIZE_MIN */
- { 24674, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
- { 24696, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
- { 24718, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
- { 24741, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
- { 24761, 0x00000B10 }, /* GL_POINT_SMOOTH */
- { 24777, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
- { 24798, 0x00008861 }, /* GL_POINT_SPRITE */
- { 24814, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
- { 24834, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
- { 24863, 0x00008861 }, /* GL_POINT_SPRITE_NV */
- { 24882, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
- { 24908, 0x00000701 }, /* GL_POINT_TOKEN */
- { 24923, 0x00000009 }, /* GL_POLYGON */
- { 24934, 0x00000008 }, /* GL_POLYGON_BIT */
- { 24949, 0x00000B40 }, /* GL_POLYGON_MODE */
- { 24965, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
- { 24988, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
- { 25013, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
- { 25036, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
- { 25059, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
- { 25083, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
- { 25107, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
- { 25125, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
- { 25148, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
- { 25167, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
- { 25190, 0x00000703 }, /* GL_POLYGON_TOKEN */
- { 25207, 0x00001203 }, /* GL_POSITION */
- { 25219, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- { 25251, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
- { 25287, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- { 25320, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
- { 25357, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- { 25388, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
- { 25423, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- { 25455, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
- { 25491, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- { 25524, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- { 25556, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
- { 25592, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- { 25625, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
- { 25662, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- { 25692, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
- { 25726, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- { 25757, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
- { 25792, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- { 25823, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
- { 25858, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- { 25890, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
- { 25926, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- { 25956, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
- { 25990, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- { 26021, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
- { 26056, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- { 26088, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- { 26119, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
- { 26154, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- { 26186, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
- { 26222, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
- { 26251, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
- { 26284, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
- { 26314, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
- { 26348, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- { 26387, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- { 26420, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- { 26460, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- { 26494, 0x00008578 }, /* GL_PREVIOUS */
- { 26506, 0x00008578 }, /* GL_PREVIOUS_ARB */
- { 26522, 0x00008578 }, /* GL_PREVIOUS_EXT */
- { 26538, 0x00008577 }, /* GL_PRIMARY_COLOR */
- { 26555, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
- { 26576, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
- { 26597, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 26630, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 26662, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
- { 26685, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
- { 26708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
- { 26738, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
- { 26767, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
- { 26795, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
- { 26817, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- { 26845, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- { 26873, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
- { 26895, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
- { 26916, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 26956, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 26995, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 27025, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 27060, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 27093, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 27127, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 27166, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 27205, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
- { 27227, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
- { 27253, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
- { 27277, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
- { 27300, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
- { 27322, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
- { 27343, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
- { 27364, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
- { 27391, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 27423, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 27455, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- { 27490, 0x00001701 }, /* GL_PROJECTION */
- { 27504, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
- { 27525, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
- { 27551, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
- { 27571, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
- { 27595, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
- { 27616, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
- { 27635, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
- { 27658, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
- { 27697, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- { 27735, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
- { 27755, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- { 27785, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
- { 27809, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
- { 27829, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- { 27859, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
- { 27883, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
- { 27903, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- { 27936, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
- { 27962, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
- { 27992, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- { 28023, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
- { 28053, 0x00002003 }, /* GL_Q */
- { 28058, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
- { 28083, 0x00000007 }, /* GL_QUADS */
- { 28092, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- { 28136, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
- { 28184, 0x00008614 }, /* GL_QUAD_MESH_SUN */
- { 28201, 0x00000008 }, /* GL_QUAD_STRIP */
- { 28215, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
- { 28237, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
- { 28263, 0x00008866 }, /* GL_QUERY_RESULT */
- { 28279, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
- { 28299, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
- { 28325, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
- { 28355, 0x00002002 }, /* GL_R */
- { 28360, 0x00002A10 }, /* GL_R3_G3_B2 */
- { 28372, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- { 28405, 0x00000C02 }, /* GL_READ_BUFFER */
- { 28420, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
- { 28440, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
- { 28472, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
- { 28496, 0x000088B8 }, /* GL_READ_ONLY */
- { 28509, 0x000088B8 }, /* GL_READ_ONLY_ARB */
- { 28526, 0x000088BA }, /* GL_READ_WRITE */
- { 28540, 0x000088BA }, /* GL_READ_WRITE_ARB */
- { 28558, 0x00001903 }, /* GL_RED */
- { 28565, 0x00008016 }, /* GL_REDUCE */
- { 28575, 0x00008016 }, /* GL_REDUCE_EXT */
- { 28589, 0x00000D15 }, /* GL_RED_BIAS */
- { 28601, 0x00000D52 }, /* GL_RED_BITS */
- { 28613, 0x00000D14 }, /* GL_RED_SCALE */
- { 28626, 0x00008512 }, /* GL_REFLECTION_MAP */
- { 28644, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
- { 28666, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
- { 28687, 0x00001C00 }, /* GL_RENDER */
- { 28697, 0x00008D41 }, /* GL_RENDERBUFFER */
- { 28713, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
- { 28740, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
- { 28768, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
- { 28794, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
- { 28821, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
- { 28841, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
- { 28868, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
- { 28891, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
- { 28918, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- { 28950, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
- { 28986, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
- { 29011, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
- { 29035, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
- { 29064, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
- { 29086, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
- { 29112, 0x00001F01 }, /* GL_RENDERER */
- { 29124, 0x00000C40 }, /* GL_RENDER_MODE */
- { 29139, 0x00002901 }, /* GL_REPEAT */
- { 29149, 0x00001E01 }, /* GL_REPLACE */
- { 29160, 0x00008062 }, /* GL_REPLACE_EXT */
- { 29175, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
- { 29198, 0x0000803A }, /* GL_RESCALE_NORMAL */
- { 29216, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
- { 29238, 0x00000102 }, /* GL_RETURN */
- { 29248, 0x00001907 }, /* GL_RGB */
- { 29255, 0x00008052 }, /* GL_RGB10 */
- { 29264, 0x00008059 }, /* GL_RGB10_A2 */
- { 29276, 0x00008059 }, /* GL_RGB10_A2_EXT */
- { 29292, 0x00008052 }, /* GL_RGB10_EXT */
- { 29305, 0x00008053 }, /* GL_RGB12 */
- { 29314, 0x00008053 }, /* GL_RGB12_EXT */
- { 29327, 0x00008054 }, /* GL_RGB16 */
- { 29336, 0x00008054 }, /* GL_RGB16_EXT */
- { 29349, 0x0000804E }, /* GL_RGB2_EXT */
- { 29361, 0x0000804F }, /* GL_RGB4 */
- { 29369, 0x0000804F }, /* GL_RGB4_EXT */
- { 29381, 0x000083A1 }, /* GL_RGB4_S3TC */
- { 29394, 0x00008050 }, /* GL_RGB5 */
- { 29402, 0x00008057 }, /* GL_RGB5_A1 */
- { 29413, 0x00008057 }, /* GL_RGB5_A1_EXT */
- { 29428, 0x00008050 }, /* GL_RGB5_EXT */
- { 29440, 0x00008051 }, /* GL_RGB8 */
- { 29448, 0x00008051 }, /* GL_RGB8_EXT */
- { 29460, 0x00001908 }, /* GL_RGBA */
- { 29468, 0x0000805A }, /* GL_RGBA12 */
- { 29478, 0x0000805A }, /* GL_RGBA12_EXT */
- { 29492, 0x0000805B }, /* GL_RGBA16 */
- { 29502, 0x0000805B }, /* GL_RGBA16_EXT */
- { 29516, 0x00008055 }, /* GL_RGBA2 */
- { 29525, 0x00008055 }, /* GL_RGBA2_EXT */
- { 29538, 0x00008056 }, /* GL_RGBA4 */
- { 29547, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
- { 29566, 0x00008056 }, /* GL_RGBA4_EXT */
- { 29579, 0x000083A3 }, /* GL_RGBA4_S3TC */
- { 29593, 0x00008058 }, /* GL_RGBA8 */
- { 29602, 0x00008058 }, /* GL_RGBA8_EXT */
- { 29615, 0x00008F97 }, /* GL_RGBA8_SNORM */
- { 29630, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
- { 29648, 0x00000C31 }, /* GL_RGBA_MODE */
- { 29661, 0x000083A2 }, /* GL_RGBA_S3TC */
- { 29674, 0x00008F93 }, /* GL_RGBA_SNORM */
- { 29688, 0x000083A0 }, /* GL_RGB_S3TC */
- { 29700, 0x00008573 }, /* GL_RGB_SCALE */
- { 29713, 0x00008573 }, /* GL_RGB_SCALE_ARB */
- { 29730, 0x00008573 }, /* GL_RGB_SCALE_EXT */
- { 29747, 0x00000407 }, /* GL_RIGHT */
- { 29756, 0x00002000 }, /* GL_S */
- { 29761, 0x00008B5D }, /* GL_SAMPLER_1D */
- { 29775, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
- { 29796, 0x00008B5E }, /* GL_SAMPLER_2D */
- { 29810, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
- { 29831, 0x00008B5F }, /* GL_SAMPLER_3D */
- { 29845, 0x00008B60 }, /* GL_SAMPLER_CUBE */
- { 29861, 0x000080A9 }, /* GL_SAMPLES */
- { 29872, 0x000086B4 }, /* GL_SAMPLES_3DFX */
- { 29888, 0x000080A9 }, /* GL_SAMPLES_ARB */
- { 29903, 0x00008914 }, /* GL_SAMPLES_PASSED */
- { 29921, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
- { 29943, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- { 29971, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
- { 30003, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
- { 30026, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
- { 30053, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
- { 30071, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
- { 30094, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
- { 30116, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
- { 30135, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
- { 30158, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
- { 30184, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
- { 30214, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
- { 30239, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
- { 30268, 0x00080000 }, /* GL_SCISSOR_BIT */
- { 30283, 0x00000C10 }, /* GL_SCISSOR_BOX */
- { 30298, 0x00000C11 }, /* GL_SCISSOR_TEST */
- { 30314, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
- { 30339, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- { 30379, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
- { 30423, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- { 30456, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- { 30486, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- { 30518, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- { 30548, 0x00001C02 }, /* GL_SELECT */
- { 30558, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
- { 30586, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
- { 30611, 0x00008012 }, /* GL_SEPARABLE_2D */
- { 30627, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
- { 30654, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
- { 30685, 0x0000150F }, /* GL_SET */
- { 30692, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
- { 30713, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
- { 30737, 0x00008B4F }, /* GL_SHADER_TYPE */
- { 30752, 0x00000B54 }, /* GL_SHADE_MODEL */
- { 30767, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
- { 30795, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
- { 30818, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- { 30848, 0x00001601 }, /* GL_SHININESS */
- { 30861, 0x00001402 }, /* GL_SHORT */
- { 30870, 0x00009119 }, /* GL_SIGNALED */
- { 30882, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
- { 30903, 0x000081F9 }, /* GL_SINGLE_COLOR */
- { 30919, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
- { 30939, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
- { 30958, 0x00008C46 }, /* GL_SLUMINANCE */
- { 30972, 0x00008C47 }, /* GL_SLUMINANCE8 */
- { 30987, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
- { 31009, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
- { 31029, 0x00001D01 }, /* GL_SMOOTH */
- { 31039, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
- { 31072, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
- { 31099, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
- { 31132, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
- { 31159, 0x00008588 }, /* GL_SOURCE0_ALPHA */
- { 31176, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
- { 31197, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
- { 31218, 0x00008580 }, /* GL_SOURCE0_RGB */
- { 31233, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
- { 31252, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
- { 31271, 0x00008589 }, /* GL_SOURCE1_ALPHA */
- { 31288, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
- { 31309, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
- { 31330, 0x00008581 }, /* GL_SOURCE1_RGB */
- { 31345, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
- { 31364, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
- { 31383, 0x0000858A }, /* GL_SOURCE2_ALPHA */
- { 31400, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
- { 31421, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
- { 31442, 0x00008582 }, /* GL_SOURCE2_RGB */
- { 31457, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
- { 31476, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
- { 31495, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
- { 31515, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
- { 31533, 0x00001202 }, /* GL_SPECULAR */
- { 31545, 0x00002402 }, /* GL_SPHERE_MAP */
- { 31559, 0x00001206 }, /* GL_SPOT_CUTOFF */
- { 31574, 0x00001204 }, /* GL_SPOT_DIRECTION */
- { 31592, 0x00001205 }, /* GL_SPOT_EXPONENT */
- { 31609, 0x00008588 }, /* GL_SRC0_ALPHA */
- { 31623, 0x00008580 }, /* GL_SRC0_RGB */
- { 31635, 0x00008589 }, /* GL_SRC1_ALPHA */
- { 31649, 0x00008581 }, /* GL_SRC1_RGB */
- { 31661, 0x0000858A }, /* GL_SRC2_ALPHA */
- { 31675, 0x00008582 }, /* GL_SRC2_RGB */
- { 31687, 0x00000302 }, /* GL_SRC_ALPHA */
- { 31700, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
- { 31722, 0x00000300 }, /* GL_SRC_COLOR */
- { 31735, 0x00008C40 }, /* GL_SRGB */
- { 31743, 0x00008C41 }, /* GL_SRGB8 */
- { 31752, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
- { 31768, 0x00008C42 }, /* GL_SRGB_ALPHA */
- { 31782, 0x00000503 }, /* GL_STACK_OVERFLOW */
- { 31800, 0x00000504 }, /* GL_STACK_UNDERFLOW */
- { 31819, 0x000088E6 }, /* GL_STATIC_COPY */
- { 31834, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
- { 31853, 0x000088E4 }, /* GL_STATIC_DRAW */
- { 31868, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
- { 31887, 0x000088E5 }, /* GL_STATIC_READ */
- { 31902, 0x000088E5 }, /* GL_STATIC_READ_ARB */
- { 31921, 0x00001802 }, /* GL_STENCIL */
- { 31932, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
- { 31954, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
- { 31980, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
- { 32001, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
- { 32026, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
- { 32047, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
- { 32072, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- { 32104, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
- { 32140, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- { 32172, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
- { 32208, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
- { 32228, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
- { 32255, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
- { 32281, 0x00000D57 }, /* GL_STENCIL_BITS */
- { 32297, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
- { 32319, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
- { 32342, 0x00000B94 }, /* GL_STENCIL_FAIL */
- { 32358, 0x00000B92 }, /* GL_STENCIL_FUNC */
- { 32374, 0x00001901 }, /* GL_STENCIL_INDEX */
- { 32391, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
- { 32414, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
- { 32436, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
- { 32458, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
- { 32480, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
- { 32501, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
- { 32528, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
- { 32555, 0x00000B97 }, /* GL_STENCIL_REF */
- { 32570, 0x00000B90 }, /* GL_STENCIL_TEST */
- { 32586, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
- { 32615, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
- { 32637, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
- { 32658, 0x00000C33 }, /* GL_STEREO */
- { 32668, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
- { 32692, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
- { 32717, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
- { 32741, 0x000088E2 }, /* GL_STREAM_COPY */
- { 32756, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
- { 32775, 0x000088E0 }, /* GL_STREAM_DRAW */
- { 32790, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
- { 32809, 0x000088E1 }, /* GL_STREAM_READ */
- { 32824, 0x000088E1 }, /* GL_STREAM_READ_ARB */
- { 32843, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
- { 32860, 0x000084E7 }, /* GL_SUBTRACT */
- { 32872, 0x000084E7 }, /* GL_SUBTRACT_ARB */
- { 32888, 0x00009113 }, /* GL_SYNC_CONDITION */
- { 32906, 0x00009116 }, /* GL_SYNC_FENCE */
- { 32920, 0x00009115 }, /* GL_SYNC_FLAGS */
- { 32934, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
- { 32961, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- { 32991, 0x00009114 }, /* GL_SYNC_STATUS */
- { 33006, 0x00002001 }, /* GL_T */
- { 33011, 0x00002A2A }, /* GL_T2F_C3F_V3F */
- { 33026, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
- { 33045, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
- { 33061, 0x00002A2B }, /* GL_T2F_N3F_V3F */
- { 33076, 0x00002A27 }, /* GL_T2F_V3F */
- { 33087, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
- { 33106, 0x00002A28 }, /* GL_T4F_V4F */
- { 33117, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
- { 33140, 0x00001702 }, /* GL_TEXTURE */
- { 33151, 0x000084C0 }, /* GL_TEXTURE0 */
- { 33163, 0x000084C0 }, /* GL_TEXTURE0_ARB */
- { 33179, 0x000084C1 }, /* GL_TEXTURE1 */
- { 33191, 0x000084CA }, /* GL_TEXTURE10 */
- { 33204, 0x000084CA }, /* GL_TEXTURE10_ARB */
- { 33221, 0x000084CB }, /* GL_TEXTURE11 */
- { 33234, 0x000084CB }, /* GL_TEXTURE11_ARB */
- { 33251, 0x000084CC }, /* GL_TEXTURE12 */
- { 33264, 0x000084CC }, /* GL_TEXTURE12_ARB */
- { 33281, 0x000084CD }, /* GL_TEXTURE13 */
- { 33294, 0x000084CD }, /* GL_TEXTURE13_ARB */
- { 33311, 0x000084CE }, /* GL_TEXTURE14 */
- { 33324, 0x000084CE }, /* GL_TEXTURE14_ARB */
- { 33341, 0x000084CF }, /* GL_TEXTURE15 */
- { 33354, 0x000084CF }, /* GL_TEXTURE15_ARB */
- { 33371, 0x000084D0 }, /* GL_TEXTURE16 */
- { 33384, 0x000084D0 }, /* GL_TEXTURE16_ARB */
- { 33401, 0x000084D1 }, /* GL_TEXTURE17 */
- { 33414, 0x000084D1 }, /* GL_TEXTURE17_ARB */
- { 33431, 0x000084D2 }, /* GL_TEXTURE18 */
- { 33444, 0x000084D2 }, /* GL_TEXTURE18_ARB */
- { 33461, 0x000084D3 }, /* GL_TEXTURE19 */
- { 33474, 0x000084D3 }, /* GL_TEXTURE19_ARB */
- { 33491, 0x000084C1 }, /* GL_TEXTURE1_ARB */
- { 33507, 0x000084C2 }, /* GL_TEXTURE2 */
- { 33519, 0x000084D4 }, /* GL_TEXTURE20 */
- { 33532, 0x000084D4 }, /* GL_TEXTURE20_ARB */
- { 33549, 0x000084D5 }, /* GL_TEXTURE21 */
- { 33562, 0x000084D5 }, /* GL_TEXTURE21_ARB */
- { 33579, 0x000084D6 }, /* GL_TEXTURE22 */
- { 33592, 0x000084D6 }, /* GL_TEXTURE22_ARB */
- { 33609, 0x000084D7 }, /* GL_TEXTURE23 */
- { 33622, 0x000084D7 }, /* GL_TEXTURE23_ARB */
- { 33639, 0x000084D8 }, /* GL_TEXTURE24 */
- { 33652, 0x000084D8 }, /* GL_TEXTURE24_ARB */
- { 33669, 0x000084D9 }, /* GL_TEXTURE25 */
- { 33682, 0x000084D9 }, /* GL_TEXTURE25_ARB */
- { 33699, 0x000084DA }, /* GL_TEXTURE26 */
- { 33712, 0x000084DA }, /* GL_TEXTURE26_ARB */
- { 33729, 0x000084DB }, /* GL_TEXTURE27 */
- { 33742, 0x000084DB }, /* GL_TEXTURE27_ARB */
- { 33759, 0x000084DC }, /* GL_TEXTURE28 */
- { 33772, 0x000084DC }, /* GL_TEXTURE28_ARB */
- { 33789, 0x000084DD }, /* GL_TEXTURE29 */
- { 33802, 0x000084DD }, /* GL_TEXTURE29_ARB */
- { 33819, 0x000084C2 }, /* GL_TEXTURE2_ARB */
- { 33835, 0x000084C3 }, /* GL_TEXTURE3 */
- { 33847, 0x000084DE }, /* GL_TEXTURE30 */
- { 33860, 0x000084DE }, /* GL_TEXTURE30_ARB */
- { 33877, 0x000084DF }, /* GL_TEXTURE31 */
- { 33890, 0x000084DF }, /* GL_TEXTURE31_ARB */
- { 33907, 0x000084C3 }, /* GL_TEXTURE3_ARB */
- { 33923, 0x000084C4 }, /* GL_TEXTURE4 */
- { 33935, 0x000084C4 }, /* GL_TEXTURE4_ARB */
- { 33951, 0x000084C5 }, /* GL_TEXTURE5 */
- { 33963, 0x000084C5 }, /* GL_TEXTURE5_ARB */
- { 33979, 0x000084C6 }, /* GL_TEXTURE6 */
- { 33991, 0x000084C6 }, /* GL_TEXTURE6_ARB */
- { 34007, 0x000084C7 }, /* GL_TEXTURE7 */
- { 34019, 0x000084C7 }, /* GL_TEXTURE7_ARB */
- { 34035, 0x000084C8 }, /* GL_TEXTURE8 */
- { 34047, 0x000084C8 }, /* GL_TEXTURE8_ARB */
- { 34063, 0x000084C9 }, /* GL_TEXTURE9 */
- { 34075, 0x000084C9 }, /* GL_TEXTURE9_ARB */
- { 34091, 0x00000DE0 }, /* GL_TEXTURE_1D */
- { 34105, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
- { 34129, 0x00000DE1 }, /* GL_TEXTURE_2D */
- { 34143, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
- { 34167, 0x0000806F }, /* GL_TEXTURE_3D */
- { 34181, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
- { 34203, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
- { 34229, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
- { 34251, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
- { 34273, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- { 34305, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
- { 34327, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- { 34359, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
- { 34381, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
- { 34409, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
- { 34441, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- { 34474, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
- { 34506, 0x00040000 }, /* GL_TEXTURE_BIT */
- { 34521, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
- { 34542, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
- { 34567, 0x00001005 }, /* GL_TEXTURE_BORDER */
- { 34585, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
- { 34609, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- { 34640, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- { 34670, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- { 34700, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- { 34735, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- { 34766, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 34804, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
- { 34831, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- { 34863, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- { 34897, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
- { 34921, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
- { 34949, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
- { 34973, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
- { 35001, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- { 35034, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
- { 35058, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
- { 35080, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
- { 35102, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
- { 35128, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
- { 35162, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- { 35195, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
- { 35232, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
- { 35260, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
- { 35292, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
- { 35315, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- { 35353, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
- { 35395, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- { 35426, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- { 35454, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- { 35484, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- { 35512, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
- { 35532, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
- { 35556, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- { 35587, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
- { 35622, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- { 35653, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
- { 35688, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- { 35719, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
- { 35754, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- { 35785, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
- { 35820, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- { 35851, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
- { 35886, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- { 35917, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
- { 35952, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- { 35981, 0x00008071 }, /* GL_TEXTURE_DEPTH */
- { 35998, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
- { 36020, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
- { 36046, 0x00002300 }, /* GL_TEXTURE_ENV */
- { 36061, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
- { 36082, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
- { 36102, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
- { 36128, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
- { 36148, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
- { 36165, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
- { 36182, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
- { 36199, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
- { 36216, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
- { 36241, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
- { 36263, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
- { 36289, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
- { 36307, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
- { 36333, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
- { 36359, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
- { 36389, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
- { 36416, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
- { 36441, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
- { 36461, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
- { 36485, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- { 36512, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- { 36539, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- { 36566, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
- { 36592, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
- { 36622, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
- { 36644, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
- { 36662, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- { 36692, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- { 36720, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- { 36748, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- { 36776, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
- { 36797, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
- { 36816, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
- { 36838, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
- { 36857, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
- { 36877, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- { 36907, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- { 36938, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
- { 36963, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
- { 36987, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
- { 37007, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
- { 37031, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
- { 37051, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
- { 37074, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
- { 37098, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- { 37128, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
- { 37153, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- { 37187, 0x00001000 }, /* GL_TEXTURE_WIDTH */
- { 37204, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
- { 37222, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
- { 37240, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
- { 37258, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
- { 37277, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */
- { 37296, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
- { 37316, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
- { 37335, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- { 37364, 0x00001000 }, /* GL_TRANSFORM_BIT */
- { 37381, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
- { 37407, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
- { 37437, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- { 37469, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- { 37499, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
- { 37533, 0x0000862C }, /* GL_TRANSPOSE_NV */
- { 37549, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- { 37580, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
- { 37615, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- { 37643, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
- { 37675, 0x00000004 }, /* GL_TRIANGLES */
- { 37688, 0x00000006 }, /* GL_TRIANGLE_FAN */
- { 37704, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
- { 37725, 0x00000005 }, /* GL_TRIANGLE_STRIP */
- { 37743, 0x00000001 }, /* GL_TRUE */
- { 37751, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
- { 37771, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
- { 37794, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
- { 37814, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
- { 37835, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
- { 37857, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
- { 37879, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
- { 37899, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
- { 37920, 0x00009118 }, /* GL_UNSIGNALED */
- { 37934, 0x00001401 }, /* GL_UNSIGNED_BYTE */
- { 37951, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- { 37978, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
- { 38001, 0x00001405 }, /* GL_UNSIGNED_INT */
- { 38017, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
- { 38044, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
- { 38065, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
- { 38089, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- { 38120, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
- { 38144, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- { 38172, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
- { 38195, 0x00001403 }, /* GL_UNSIGNED_SHORT */
- { 38213, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- { 38243, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- { 38269, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- { 38299, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- { 38325, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
- { 38349, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- { 38377, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- { 38405, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
- { 38432, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- { 38464, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
- { 38495, 0x00008CA2 }, /* GL_UPPER_LEFT */
- { 38509, 0x00002A20 }, /* GL_V2F */
- { 38516, 0x00002A21 }, /* GL_V3F */
- { 38523, 0x00008B83 }, /* GL_VALIDATE_STATUS */
- { 38542, 0x00001F00 }, /* GL_VENDOR */
- { 38552, 0x00001F02 }, /* GL_VERSION */
- { 38563, 0x00008074 }, /* GL_VERTEX_ARRAY */
- { 38579, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
- { 38603, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
- { 38633, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- { 38664, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
- { 38699, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
- { 38723, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
- { 38744, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
- { 38767, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
- { 38788, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- { 38815, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- { 38843, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- { 38871, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- { 38899, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- { 38927, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- { 38955, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- { 38983, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- { 39010, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- { 39037, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- { 39064, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- { 39091, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- { 39118, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- { 39145, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- { 39172, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- { 39199, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- { 39226, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- { 39264, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
- { 39306, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- { 39337, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
- { 39372, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- { 39406, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
- { 39444, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- { 39475, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
- { 39510, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- { 39538, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
- { 39570, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- { 39600, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
- { 39634, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
- { 39662, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
- { 39694, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
- { 39714, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
- { 39736, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
- { 39765, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
- { 39786, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- { 39815, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
- { 39848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
- { 39880, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- { 39907, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
- { 39938, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
- { 39968, 0x00008B31 }, /* GL_VERTEX_SHADER */
- { 39985, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
- { 40006, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
- { 40033, 0x00000BA2 }, /* GL_VIEWPORT */
- { 40045, 0x00000800 }, /* GL_VIEWPORT_BIT */
- { 40061, 0x0000911D }, /* GL_WAIT_FAILED */
- { 40076, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
- { 40096, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- { 40127, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
- { 40162, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- { 40190, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- { 40215, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- { 40242, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- { 40267, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
- { 40291, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
- { 40310, 0x000088B9 }, /* GL_WRITE_ONLY */
- { 40324, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
- { 40342, 0x00001506 }, /* GL_XOR */
- { 40349, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
- { 40368, 0x00008757 }, /* GL_YCBCR_MESA */
- { 40382, 0x00000000 }, /* GL_ZERO */
- { 40390, 0x00000D16 }, /* GL_ZOOM_X */
- { 40400, 0x00000D17 }, /* GL_ZOOM_Y */
+ { 7190, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */
+ { 7214, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
+ { 7234, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
+ { 7258, 0x00000D1F }, /* GL_DEPTH_BIAS */
+ { 7272, 0x00000D56 }, /* GL_DEPTH_BITS */
+ { 7286, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
+ { 7306, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
+ { 7331, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
+ { 7351, 0x0000864F }, /* GL_DEPTH_CLAMP */
+ { 7366, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
+ { 7384, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
+ { 7405, 0x00001902 }, /* GL_DEPTH_COMPONENT */
+ { 7424, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
+ { 7445, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
+ { 7470, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
+ { 7496, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
+ { 7517, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
+ { 7542, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
+ { 7568, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
+ { 7589, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
+ { 7614, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
+ { 7640, 0x00000B74 }, /* GL_DEPTH_FUNC */
+ { 7654, 0x00000B70 }, /* GL_DEPTH_RANGE */
+ { 7669, 0x00000D1E }, /* GL_DEPTH_SCALE */
+ { 7684, 0x000084F9 }, /* GL_DEPTH_STENCIL */
+ { 7701, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
+ { 7729, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */
+ { 7750, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
+ { 7770, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+ { 7798, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+ { 7826, 0x00000B71 }, /* GL_DEPTH_TEST */
+ { 7840, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
+ { 7862, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
+ { 7888, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
+ { 7907, 0x00001201 }, /* GL_DIFFUSE */
+ { 7918, 0x00000BD0 }, /* GL_DITHER */
+ { 7928, 0x00000A02 }, /* GL_DOMAIN */
+ { 7938, 0x00001100 }, /* GL_DONT_CARE */
+ { 7951, 0x000086AE }, /* GL_DOT3_RGB */
+ { 7963, 0x000086AF }, /* GL_DOT3_RGBA */
+ { 7976, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
+ { 7993, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
+ { 8010, 0x000086AE }, /* GL_DOT3_RGB_ARB */
+ { 8026, 0x00008740 }, /* GL_DOT3_RGB_EXT */
+ { 8042, 0x0000140A }, /* GL_DOUBLE */
+ { 8052, 0x00000C32 }, /* GL_DOUBLEBUFFER */
+ { 8068, 0x00000C01 }, /* GL_DRAW_BUFFER */
+ { 8083, 0x00008825 }, /* GL_DRAW_BUFFER0 */
+ { 8099, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
+ { 8119, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
+ { 8139, 0x00008826 }, /* GL_DRAW_BUFFER1 */
+ { 8155, 0x0000882F }, /* GL_DRAW_BUFFER10 */
+ { 8172, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
+ { 8193, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
+ { 8214, 0x00008830 }, /* GL_DRAW_BUFFER11 */
+ { 8231, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
+ { 8252, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
+ { 8273, 0x00008831 }, /* GL_DRAW_BUFFER12 */
+ { 8290, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
+ { 8311, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
+ { 8332, 0x00008832 }, /* GL_DRAW_BUFFER13 */
+ { 8349, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
+ { 8370, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
+ { 8391, 0x00008833 }, /* GL_DRAW_BUFFER14 */
+ { 8408, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
+ { 8429, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
+ { 8450, 0x00008834 }, /* GL_DRAW_BUFFER15 */
+ { 8467, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
+ { 8488, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
+ { 8509, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
+ { 8529, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
+ { 8549, 0x00008827 }, /* GL_DRAW_BUFFER2 */
+ { 8565, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
+ { 8585, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
+ { 8605, 0x00008828 }, /* GL_DRAW_BUFFER3 */
+ { 8621, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
+ { 8641, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
+ { 8661, 0x00008829 }, /* GL_DRAW_BUFFER4 */
+ { 8677, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
+ { 8697, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
+ { 8717, 0x0000882A }, /* GL_DRAW_BUFFER5 */
+ { 8733, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
+ { 8753, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
+ { 8773, 0x0000882B }, /* GL_DRAW_BUFFER6 */
+ { 8789, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
+ { 8809, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
+ { 8829, 0x0000882C }, /* GL_DRAW_BUFFER7 */
+ { 8845, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
+ { 8865, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
+ { 8885, 0x0000882D }, /* GL_DRAW_BUFFER8 */
+ { 8901, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
+ { 8921, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
+ { 8941, 0x0000882E }, /* GL_DRAW_BUFFER9 */
+ { 8957, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
+ { 8977, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
+ { 8997, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
+ { 9017, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */
+ { 9045, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+ { 9077, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
+ { 9101, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
+ { 9121, 0x00000304 }, /* GL_DST_ALPHA */
+ { 9134, 0x00000306 }, /* GL_DST_COLOR */
+ { 9147, 0x0000877A }, /* GL_DU8DV8_ATI */
+ { 9161, 0x00008779 }, /* GL_DUDV_ATI */
+ { 9173, 0x000088EA }, /* GL_DYNAMIC_COPY */
+ { 9189, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
+ { 9209, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
+ { 9225, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
+ { 9245, 0x000088E9 }, /* GL_DYNAMIC_READ */
+ { 9261, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
+ { 9281, 0x00000B43 }, /* GL_EDGE_FLAG */
+ { 9294, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
+ { 9313, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+ { 9347, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
+ { 9385, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
+ { 9412, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+ { 9438, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
+ { 9462, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+ { 9494, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
+ { 9530, 0x00001600 }, /* GL_EMISSION */
+ { 9542, 0x00002000 }, /* GL_ENABLE_BIT */
+ { 9556, 0x00000202 }, /* GL_EQUAL */
+ { 9565, 0x00001509 }, /* GL_EQUIV */
+ { 9574, 0x00010000 }, /* GL_EVAL_BIT */
+ { 9586, 0x00000800 }, /* GL_EXP */
+ { 9593, 0x00000801 }, /* GL_EXP2 */
+ { 9601, 0x00001F03 }, /* GL_EXTENSIONS */
+ { 9615, 0x00002400 }, /* GL_EYE_LINEAR */
+ { 9629, 0x00002502 }, /* GL_EYE_PLANE */
+ { 9642, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
+ { 9667, 0x0000855B }, /* GL_EYE_RADIAL_NV */
+ { 9684, 0x00000000 }, /* GL_FALSE */
+ { 9693, 0x00001101 }, /* GL_FASTEST */
+ { 9704, 0x00001C01 }, /* GL_FEEDBACK */
+ { 9716, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
+ { 9743, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
+ { 9767, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
+ { 9791, 0x00001B02 }, /* GL_FILL */
+ { 9799, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
+ { 9826, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
+ { 9857, 0x00001D00 }, /* GL_FLAT */
+ { 9865, 0x00001406 }, /* GL_FLOAT */
+ { 9874, 0x00008B5A }, /* GL_FLOAT_MAT2 */
+ { 9888, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
+ { 9906, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
+ { 9922, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
+ { 9938, 0x00008B5B }, /* GL_FLOAT_MAT3 */
+ { 9952, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
+ { 9970, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
+ { 9986, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
+ { 10002, 0x00008B5C }, /* GL_FLOAT_MAT4 */
+ { 10016, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
+ { 10034, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
+ { 10050, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
+ { 10066, 0x00008B50 }, /* GL_FLOAT_VEC2 */
+ { 10080, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
+ { 10098, 0x00008B51 }, /* GL_FLOAT_VEC3 */
+ { 10112, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
+ { 10130, 0x00008B52 }, /* GL_FLOAT_VEC4 */
+ { 10144, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
+ { 10162, 0x00000B60 }, /* GL_FOG */
+ { 10169, 0x00000080 }, /* GL_FOG_BIT */
+ { 10180, 0x00000B66 }, /* GL_FOG_COLOR */
+ { 10193, 0x00008451 }, /* GL_FOG_COORD */
+ { 10206, 0x00008451 }, /* GL_FOG_COORDINATE */
+ { 10224, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
+ { 10248, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+ { 10287, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
+ { 10330, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+ { 10362, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+ { 10393, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+ { 10422, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
+ { 10447, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
+ { 10466, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
+ { 10500, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
+ { 10527, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
+ { 10553, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
+ { 10577, 0x00008450 }, /* GL_FOG_COORD_SRC */
+ { 10594, 0x00000B62 }, /* GL_FOG_DENSITY */
+ { 10609, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
+ { 10633, 0x00000B64 }, /* GL_FOG_END */
+ { 10644, 0x00000C54 }, /* GL_FOG_HINT */
+ { 10656, 0x00000B61 }, /* GL_FOG_INDEX */
+ { 10669, 0x00000B65 }, /* GL_FOG_MODE */
+ { 10681, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
+ { 10700, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
+ { 10725, 0x00000B63 }, /* GL_FOG_START */
+ { 10738, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
+ { 10756, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
+ { 10780, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
+ { 10799, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
+ { 10822, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+ { 10857, 0x00008D40 }, /* GL_FRAMEBUFFER */
+ { 10872, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+ { 10909, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+ { 10945, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+ { 10986, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+ { 11027, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+ { 11064, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+ { 11101, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+ { 11139, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
+ { 11181, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+ { 11219, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
+ { 11261, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+ { 11296, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+ { 11335, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
+ { 11384, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+ { 11432, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
+ { 11484, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+ { 11524, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+ { 11568, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+ { 11608, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
+ { 11652, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */
+ { 11675, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
+ { 11702, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
+ { 11726, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
+ { 11754, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
+ { 11777, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
+ { 11796, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+ { 11833, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
+ { 11874, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+ { 11915, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+ { 11953, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+ { 11995, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+ { 12046, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+ { 12084, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+ { 12129, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
+ { 12178, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+ { 12216, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */
+ { 12258, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+ { 12296, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+ { 12338, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+ { 12370, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
+ { 12395, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
+ { 12422, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
+ { 12453, 0x00000404 }, /* GL_FRONT */
+ { 12462, 0x00000408 }, /* GL_FRONT_AND_BACK */
+ { 12480, 0x00000B46 }, /* GL_FRONT_FACE */
+ { 12494, 0x00000400 }, /* GL_FRONT_LEFT */
+ { 12508, 0x00000401 }, /* GL_FRONT_RIGHT */
+ { 12523, 0x00008006 }, /* GL_FUNC_ADD */
+ { 12535, 0x00008006 }, /* GL_FUNC_ADD_EXT */
+ { 12551, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
+ { 12576, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
+ { 12605, 0x0000800A }, /* GL_FUNC_SUBTRACT */
+ { 12622, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
+ { 12643, 0x00008191 }, /* GL_GENERATE_MIPMAP */
+ { 12662, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
+ { 12686, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
+ { 12715, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
+ { 12739, 0x00000206 }, /* GL_GEQUAL */
+ { 12749, 0x00000204 }, /* GL_GREATER */
+ { 12760, 0x00001904 }, /* GL_GREEN */
+ { 12769, 0x00000D19 }, /* GL_GREEN_BIAS */
+ { 12783, 0x00000D53 }, /* GL_GREEN_BITS */
+ { 12797, 0x00000D18 }, /* GL_GREEN_SCALE */
+ { 12812, 0x00008000 }, /* GL_HINT_BIT */
+ { 12824, 0x00008024 }, /* GL_HISTOGRAM */
+ { 12837, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+ { 12861, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+ { 12889, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+ { 12912, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+ { 12939, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+ { 12956, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+ { 12976, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+ { 13000, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+ { 13024, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+ { 13052, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+ { 13080, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+ { 13112, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+ { 13134, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+ { 13160, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+ { 13178, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+ { 13200, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+ { 13219, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+ { 13242, 0x0000862A }, /* GL_IDENTITY_NV */
+ { 13257, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+ { 13277, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+ { 13317, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+ { 13355, 0x00001E02 }, /* GL_INCR */
+ { 13363, 0x00008507 }, /* GL_INCR_WRAP */
+ { 13376, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+ { 13393, 0x00008222 }, /* GL_INDEX */
+ { 13402, 0x00008077 }, /* GL_INDEX_ARRAY */
+ { 13417, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+ { 13447, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+ { 13481, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+ { 13504, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+ { 13526, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+ { 13546, 0x00000D51 }, /* GL_INDEX_BITS */
+ { 13560, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+ { 13581, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+ { 13599, 0x00000C30 }, /* GL_INDEX_MODE */
+ { 13613, 0x00000D13 }, /* GL_INDEX_OFFSET */
+ { 13629, 0x00000D12 }, /* GL_INDEX_SHIFT */
+ { 13644, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+ { 13663, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+ { 13682, 0x00001404 }, /* GL_INT */
+ { 13689, 0x00008049 }, /* GL_INTENSITY */
+ { 13702, 0x0000804C }, /* GL_INTENSITY12 */
+ { 13717, 0x0000804C }, /* GL_INTENSITY12_EXT */
+ { 13736, 0x0000804D }, /* GL_INTENSITY16 */
+ { 13751, 0x0000804D }, /* GL_INTENSITY16_EXT */
+ { 13770, 0x0000804A }, /* GL_INTENSITY4 */
+ { 13784, 0x0000804A }, /* GL_INTENSITY4_EXT */
+ { 13802, 0x0000804B }, /* GL_INTENSITY8 */
+ { 13816, 0x0000804B }, /* GL_INTENSITY8_EXT */
+ { 13834, 0x00008049 }, /* GL_INTENSITY_EXT */
+ { 13851, 0x00008575 }, /* GL_INTERPOLATE */
+ { 13866, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+ { 13885, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+ { 13904, 0x00008B53 }, /* GL_INT_VEC2 */
+ { 13916, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+ { 13932, 0x00008B54 }, /* GL_INT_VEC3 */
+ { 13944, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+ { 13960, 0x00008B55 }, /* GL_INT_VEC4 */
+ { 13972, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+ { 13988, 0x00000500 }, /* GL_INVALID_ENUM */
+ { 14004, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ { 14037, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+ { 14074, 0x00000502 }, /* GL_INVALID_OPERATION */
+ { 14095, 0x00000501 }, /* GL_INVALID_VALUE */
+ { 14112, 0x0000862B }, /* GL_INVERSE_NV */
+ { 14126, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+ { 14150, 0x0000150A }, /* GL_INVERT */
+ { 14160, 0x00001E00 }, /* GL_KEEP */
+ { 14168, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
+ { 14194, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
+ { 14224, 0x00000406 }, /* GL_LEFT */
+ { 14232, 0x00000203 }, /* GL_LEQUAL */
+ { 14242, 0x00000201 }, /* GL_LESS */
+ { 14250, 0x00004000 }, /* GL_LIGHT0 */
+ { 14260, 0x00004001 }, /* GL_LIGHT1 */
+ { 14270, 0x00004002 }, /* GL_LIGHT2 */
+ { 14280, 0x00004003 }, /* GL_LIGHT3 */
+ { 14290, 0x00004004 }, /* GL_LIGHT4 */
+ { 14300, 0x00004005 }, /* GL_LIGHT5 */
+ { 14310, 0x00004006 }, /* GL_LIGHT6 */
+ { 14320, 0x00004007 }, /* GL_LIGHT7 */
+ { 14330, 0x00000B50 }, /* GL_LIGHTING */
+ { 14342, 0x00000040 }, /* GL_LIGHTING_BIT */
+ { 14358, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+ { 14381, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ { 14410, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+ { 14443, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ { 14471, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+ { 14495, 0x00001B01 }, /* GL_LINE */
+ { 14503, 0x00002601 }, /* GL_LINEAR */
+ { 14513, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+ { 14535, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ { 14565, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ { 14596, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+ { 14620, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+ { 14645, 0x00000001 }, /* GL_LINES */
+ { 14654, 0x00000004 }, /* GL_LINE_BIT */
+ { 14666, 0x00000002 }, /* GL_LINE_LOOP */
+ { 14679, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+ { 14699, 0x00000B20 }, /* GL_LINE_SMOOTH */
+ { 14714, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+ { 14734, 0x00000B24 }, /* GL_LINE_STIPPLE */
+ { 14750, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+ { 14774, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+ { 14797, 0x00000003 }, /* GL_LINE_STRIP */
+ { 14811, 0x00000702 }, /* GL_LINE_TOKEN */
+ { 14825, 0x00000B21 }, /* GL_LINE_WIDTH */
+ { 14839, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+ { 14865, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+ { 14885, 0x00008B82 }, /* GL_LINK_STATUS */
+ { 14900, 0x00000B32 }, /* GL_LIST_BASE */
+ { 14913, 0x00020000 }, /* GL_LIST_BIT */
+ { 14925, 0x00000B33 }, /* GL_LIST_INDEX */
+ { 14939, 0x00000B30 }, /* GL_LIST_MODE */
+ { 14952, 0x00000101 }, /* GL_LOAD */
+ { 14960, 0x00000BF1 }, /* GL_LOGIC_OP */
+ { 14972, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+ { 14989, 0x00008CA1 }, /* GL_LOWER_LEFT */
+ { 15003, 0x00001909 }, /* GL_LUMINANCE */
+ { 15016, 0x00008041 }, /* GL_LUMINANCE12 */
+ { 15031, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+ { 15054, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+ { 15081, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+ { 15103, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+ { 15129, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+ { 15148, 0x00008042 }, /* GL_LUMINANCE16 */
+ { 15163, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+ { 15186, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+ { 15213, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+ { 15232, 0x0000803F }, /* GL_LUMINANCE4 */
+ { 15246, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+ { 15267, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+ { 15292, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+ { 15310, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+ { 15331, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+ { 15356, 0x00008040 }, /* GL_LUMINANCE8 */
+ { 15370, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+ { 15391, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+ { 15416, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+ { 15434, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+ { 15453, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+ { 15469, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+ { 15489, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+ { 15511, 0x00000D91 }, /* GL_MAP1_INDEX */
+ { 15525, 0x00000D92 }, /* GL_MAP1_NORMAL */
+ { 15540, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+ { 15564, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+ { 15588, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+ { 15612, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+ { 15636, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+ { 15653, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+ { 15670, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ { 15698, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ { 15727, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ { 15756, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ { 15785, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ { 15814, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ { 15843, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ { 15872, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ { 15900, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ { 15928, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ { 15956, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ { 15984, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ { 16012, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ { 16040, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ { 16068, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ { 16096, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ { 16124, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+ { 16140, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+ { 16160, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+ { 16182, 0x00000DB1 }, /* GL_MAP2_INDEX */
+ { 16196, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+ { 16211, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+ { 16235, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+ { 16259, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+ { 16283, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+ { 16307, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+ { 16324, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+ { 16341, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ { 16369, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ { 16398, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ { 16427, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ { 16456, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ { 16485, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ { 16514, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ { 16543, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ { 16571, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ { 16599, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ { 16627, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ { 16655, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ { 16683, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ { 16711, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+ { 16739, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ { 16767, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ { 16795, 0x00000D10 }, /* GL_MAP_COLOR */
+ { 16808, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
+ { 16834, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
+ { 16863, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
+ { 16891, 0x00000001 }, /* GL_MAP_READ_BIT */
+ { 16907, 0x00000D11 }, /* GL_MAP_STENCIL */
+ { 16922, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
+ { 16948, 0x00000002 }, /* GL_MAP_WRITE_BIT */
+ { 16965, 0x000088C0 }, /* GL_MATRIX0_ARB */
+ { 16980, 0x00008630 }, /* GL_MATRIX0_NV */
+ { 16994, 0x000088CA }, /* GL_MATRIX10_ARB */
+ { 17010, 0x000088CB }, /* GL_MATRIX11_ARB */
+ { 17026, 0x000088CC }, /* GL_MATRIX12_ARB */
+ { 17042, 0x000088CD }, /* GL_MATRIX13_ARB */
+ { 17058, 0x000088CE }, /* GL_MATRIX14_ARB */
+ { 17074, 0x000088CF }, /* GL_MATRIX15_ARB */
+ { 17090, 0x000088D0 }, /* GL_MATRIX16_ARB */
+ { 17106, 0x000088D1 }, /* GL_MATRIX17_ARB */
+ { 17122, 0x000088D2 }, /* GL_MATRIX18_ARB */
+ { 17138, 0x000088D3 }, /* GL_MATRIX19_ARB */
+ { 17154, 0x000088C1 }, /* GL_MATRIX1_ARB */
+ { 17169, 0x00008631 }, /* GL_MATRIX1_NV */
+ { 17183, 0x000088D4 }, /* GL_MATRIX20_ARB */
+ { 17199, 0x000088D5 }, /* GL_MATRIX21_ARB */
+ { 17215, 0x000088D6 }, /* GL_MATRIX22_ARB */
+ { 17231, 0x000088D7 }, /* GL_MATRIX23_ARB */
+ { 17247, 0x000088D8 }, /* GL_MATRIX24_ARB */
+ { 17263, 0x000088D9 }, /* GL_MATRIX25_ARB */
+ { 17279, 0x000088DA }, /* GL_MATRIX26_ARB */
+ { 17295, 0x000088DB }, /* GL_MATRIX27_ARB */
+ { 17311, 0x000088DC }, /* GL_MATRIX28_ARB */
+ { 17327, 0x000088DD }, /* GL_MATRIX29_ARB */
+ { 17343, 0x000088C2 }, /* GL_MATRIX2_ARB */
+ { 17358, 0x00008632 }, /* GL_MATRIX2_NV */
+ { 17372, 0x000088DE }, /* GL_MATRIX30_ARB */
+ { 17388, 0x000088DF }, /* GL_MATRIX31_ARB */
+ { 17404, 0x000088C3 }, /* GL_MATRIX3_ARB */
+ { 17419, 0x00008633 }, /* GL_MATRIX3_NV */
+ { 17433, 0x000088C4 }, /* GL_MATRIX4_ARB */
+ { 17448, 0x00008634 }, /* GL_MATRIX4_NV */
+ { 17462, 0x000088C5 }, /* GL_MATRIX5_ARB */
+ { 17477, 0x00008635 }, /* GL_MATRIX5_NV */
+ { 17491, 0x000088C6 }, /* GL_MATRIX6_ARB */
+ { 17506, 0x00008636 }, /* GL_MATRIX6_NV */
+ { 17520, 0x000088C7 }, /* GL_MATRIX7_ARB */
+ { 17535, 0x00008637 }, /* GL_MATRIX7_NV */
+ { 17549, 0x000088C8 }, /* GL_MATRIX8_ARB */
+ { 17564, 0x000088C9 }, /* GL_MATRIX9_ARB */
+ { 17579, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ { 17605, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ { 17639, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ { 17670, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ { 17703, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ { 17734, 0x00000BA0 }, /* GL_MATRIX_MODE */
+ { 17749, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+ { 17771, 0x00008008 }, /* GL_MAX */
+ { 17778, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+ { 17801, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ { 17833, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ { 17859, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ { 17892, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ { 17918, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 17952, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+ { 17971, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
+ { 17996, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+ { 18025, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ { 18057, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+ { 18093, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ { 18129, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+ { 18169, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+ { 18195, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+ { 18225, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+ { 18250, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+ { 18279, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ { 18308, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+ { 18341, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+ { 18361, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+ { 18385, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+ { 18409, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+ { 18433, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+ { 18458, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+ { 18476, 0x00008008 }, /* GL_MAX_EXT */
+ { 18487, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ { 18522, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+ { 18561, 0x00000D31 }, /* GL_MAX_LIGHTS */
+ { 18575, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+ { 18595, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ { 18633, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ { 18662, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+ { 18686, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+ { 18714, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+ { 18737, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 18774, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 18810, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ { 18837, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ { 18866, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ { 18900, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+ { 18936, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ { 18963, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ { 18995, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ { 19031, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ { 19060, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ { 19089, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ { 19117, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ { 19155, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 19199, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 19242, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 19276, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 19315, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 19352, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 19390, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 19433, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 19476, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ { 19506, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ { 19537, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 19573, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 19609, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ { 19639, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ { 19673, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+ { 19706, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
+ { 19731, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+ { 19760, 0x00008D57 }, /* GL_MAX_SAMPLES */
+ { 19775, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
+ { 19794, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ { 19821, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+ { 19841, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+ { 19865, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+ { 19887, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+ { 19913, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ { 19940, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+ { 19971, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+ { 19995, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 20029, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+ { 20049, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ { 20076, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+ { 20097, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+ { 20122, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+ { 20147, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+ { 20182, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+ { 20204, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+ { 20230, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+ { 20252, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+ { 20278, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ { 20312, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+ { 20350, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ { 20383, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+ { 20420, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+ { 20444, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+ { 20465, 0x00008007 }, /* GL_MIN */
+ { 20472, 0x0000802E }, /* GL_MINMAX */
+ { 20482, 0x0000802E }, /* GL_MINMAX_EXT */
+ { 20496, 0x0000802F }, /* GL_MINMAX_FORMAT */
+ { 20513, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+ { 20534, 0x00008030 }, /* GL_MINMAX_SINK */
+ { 20549, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+ { 20568, 0x00008007 }, /* GL_MIN_EXT */
+ { 20579, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+ { 20598, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+ { 20621, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+ { 20644, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+ { 20664, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+ { 20684, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ { 20714, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+ { 20742, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ { 20770, 0x00001700 }, /* GL_MODELVIEW */
+ { 20783, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+ { 20801, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+ { 20820, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+ { 20839, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+ { 20858, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+ { 20877, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+ { 20896, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+ { 20915, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+ { 20934, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+ { 20953, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+ { 20972, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+ { 20991, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+ { 21009, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+ { 21028, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+ { 21047, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+ { 21066, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+ { 21085, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+ { 21104, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+ { 21123, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+ { 21142, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+ { 21161, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+ { 21180, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+ { 21199, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+ { 21217, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+ { 21236, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+ { 21255, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+ { 21273, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+ { 21291, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+ { 21309, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+ { 21327, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+ { 21345, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+ { 21363, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+ { 21381, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+ { 21401, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+ { 21428, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+ { 21453, 0x00002100 }, /* GL_MODULATE */
+ { 21465, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+ { 21485, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+ { 21512, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+ { 21537, 0x00000103 }, /* GL_MULT */
+ { 21545, 0x0000809D }, /* GL_MULTISAMPLE */
+ { 21560, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+ { 21580, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+ { 21599, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+ { 21618, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+ { 21642, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+ { 21665, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ { 21695, 0x00002A25 }, /* GL_N3F_V3F */
+ { 21706, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+ { 21726, 0x0000150E }, /* GL_NAND */
+ { 21734, 0x00002600 }, /* GL_NEAREST */
+ { 21745, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ { 21776, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ { 21808, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+ { 21833, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+ { 21859, 0x00000200 }, /* GL_NEVER */
+ { 21868, 0x00001102 }, /* GL_NICEST */
+ { 21878, 0x00000000 }, /* GL_NONE */
+ { 21886, 0x00001505 }, /* GL_NOOP */
+ { 21894, 0x00001508 }, /* GL_NOR */
+ { 21901, 0x00000BA1 }, /* GL_NORMALIZE */
+ { 21914, 0x00008075 }, /* GL_NORMAL_ARRAY */
+ { 21930, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ { 21961, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+ { 21996, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+ { 22020, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+ { 22043, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+ { 22064, 0x00008511 }, /* GL_NORMAL_MAP */
+ { 22078, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+ { 22096, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+ { 22113, 0x00000205 }, /* GL_NOTEQUAL */
+ { 22125, 0x00000000 }, /* GL_NO_ERROR */
+ { 22137, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ { 22171, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+ { 22209, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+ { 22241, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+ { 22283, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+ { 22313, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+ { 22353, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+ { 22384, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+ { 22413, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+ { 22441, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+ { 22471, 0x00002401 }, /* GL_OBJECT_LINEAR */
+ { 22488, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+ { 22514, 0x00002501 }, /* GL_OBJECT_PLANE */
+ { 22530, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+ { 22565, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+ { 22587, 0x00009112 }, /* GL_OBJECT_TYPE */
+ { 22602, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+ { 22621, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+ { 22651, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+ { 22672, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+ { 22700, 0x00000001 }, /* GL_ONE */
+ { 22707, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ { 22735, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+ { 22767, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ { 22795, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+ { 22827, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+ { 22850, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+ { 22873, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+ { 22896, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+ { 22919, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+ { 22937, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+ { 22959, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+ { 22981, 0x00008590 }, /* GL_OPERAND0_RGB */
+ { 22997, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+ { 23017, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+ { 23037, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+ { 23055, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+ { 23077, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+ { 23099, 0x00008591 }, /* GL_OPERAND1_RGB */
+ { 23115, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+ { 23135, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+ { 23155, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+ { 23173, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+ { 23195, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+ { 23217, 0x00008592 }, /* GL_OPERAND2_RGB */
+ { 23233, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+ { 23253, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+ { 23273, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+ { 23294, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+ { 23313, 0x00001507 }, /* GL_OR */
+ { 23319, 0x00000A01 }, /* GL_ORDER */
+ { 23328, 0x0000150D }, /* GL_OR_INVERTED */
+ { 23343, 0x0000150B }, /* GL_OR_REVERSE */
+ { 23357, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+ { 23374, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+ { 23392, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+ { 23413, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+ { 23433, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+ { 23451, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+ { 23470, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+ { 23490, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+ { 23510, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+ { 23528, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+ { 23547, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+ { 23572, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+ { 23596, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+ { 23617, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+ { 23639, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+ { 23661, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+ { 23686, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+ { 23710, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+ { 23731, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+ { 23753, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+ { 23775, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+ { 23797, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ { 23828, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+ { 23848, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ { 23873, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+ { 23893, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ { 23918, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+ { 23938, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ { 23963, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+ { 23983, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ { 24008, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+ { 24028, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ { 24053, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+ { 24073, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ { 24098, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+ { 24118, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ { 24143, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+ { 24163, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ { 24188, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+ { 24208, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ { 24233, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+ { 24253, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ { 24278, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+ { 24296, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+ { 24317, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ { 24346, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+ { 24379, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+ { 24404, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+ { 24427, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ { 24458, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+ { 24493, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+ { 24520, 0x00001B00 }, /* GL_POINT */
+ { 24529, 0x00000000 }, /* GL_POINTS */
+ { 24539, 0x00000002 }, /* GL_POINT_BIT */
+ { 24552, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+ { 24582, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+ { 24616, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+ { 24650, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+ { 24685, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ { 24714, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+ { 24747, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+ { 24780, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+ { 24814, 0x00000B11 }, /* GL_POINT_SIZE */
+ { 24828, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+ { 24854, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+ { 24872, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+ { 24894, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+ { 24916, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+ { 24939, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+ { 24957, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+ { 24979, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+ { 25001, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+ { 25024, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+ { 25044, 0x00000B10 }, /* GL_POINT_SMOOTH */
+ { 25060, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+ { 25081, 0x00008861 }, /* GL_POINT_SPRITE */
+ { 25097, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+ { 25117, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ { 25146, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+ { 25165, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+ { 25191, 0x00000701 }, /* GL_POINT_TOKEN */
+ { 25206, 0x00000009 }, /* GL_POLYGON */
+ { 25217, 0x00000008 }, /* GL_POLYGON_BIT */
+ { 25232, 0x00000B40 }, /* GL_POLYGON_MODE */
+ { 25248, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+ { 25271, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+ { 25296, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+ { 25319, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+ { 25342, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+ { 25366, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+ { 25390, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+ { 25408, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+ { 25431, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+ { 25450, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+ { 25473, 0x00000703 }, /* GL_POLYGON_TOKEN */
+ { 25490, 0x00001203 }, /* GL_POSITION */
+ { 25502, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ { 25534, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+ { 25570, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ { 25603, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+ { 25640, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ { 25671, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+ { 25706, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ { 25738, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+ { 25774, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 25807, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ { 25839, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+ { 25875, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ { 25908, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+ { 25945, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ { 25975, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+ { 26009, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ { 26040, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+ { 26075, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ { 26106, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+ { 26141, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ { 26173, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+ { 26209, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ { 26239, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+ { 26273, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ { 26304, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+ { 26339, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ { 26371, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ { 26402, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+ { 26437, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ { 26469, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+ { 26505, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+ { 26534, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+ { 26567, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+ { 26597, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+ { 26631, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ { 26670, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ { 26703, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ { 26743, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ { 26777, 0x00008578 }, /* GL_PREVIOUS */
+ { 26789, 0x00008578 }, /* GL_PREVIOUS_ARB */
+ { 26805, 0x00008578 }, /* GL_PREVIOUS_EXT */
+ { 26821, 0x00008577 }, /* GL_PRIMARY_COLOR */
+ { 26838, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+ { 26859, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+ { 26880, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 26913, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 26945, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+ { 26968, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+ { 26991, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ { 27021, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+ { 27050, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+ { 27078, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+ { 27100, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ { 27128, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ { 27156, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+ { 27178, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+ { 27199, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 27239, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 27278, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 27308, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 27343, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 27376, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 27410, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 27449, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 27488, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+ { 27510, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+ { 27536, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+ { 27560, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+ { 27583, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+ { 27605, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+ { 27626, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+ { 27647, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+ { 27674, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 27706, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 27738, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ { 27773, 0x00001701 }, /* GL_PROJECTION */
+ { 27787, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+ { 27808, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+ { 27834, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
+ { 27854, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
+ { 27878, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+ { 27899, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+ { 27918, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+ { 27941, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 27980, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ { 28018, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+ { 28038, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ { 28068, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+ { 28092, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+ { 28112, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ { 28142, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+ { 28166, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+ { 28186, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ { 28219, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ { 28245, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+ { 28275, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ { 28306, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+ { 28336, 0x00002003 }, /* GL_Q */
+ { 28341, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+ { 28366, 0x00000007 }, /* GL_QUADS */
+ { 28375, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ { 28419, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
+ { 28467, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+ { 28484, 0x00000008 }, /* GL_QUAD_STRIP */
+ { 28498, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+ { 28520, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+ { 28546, 0x00008866 }, /* GL_QUERY_RESULT */
+ { 28562, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+ { 28582, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+ { 28608, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+ { 28638, 0x00002002 }, /* GL_R */
+ { 28643, 0x00002A10 }, /* GL_R3_G3_B2 */
+ { 28655, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ { 28688, 0x00000C02 }, /* GL_READ_BUFFER */
+ { 28703, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+ { 28723, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
+ { 28751, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+ { 28783, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+ { 28807, 0x000088B8 }, /* GL_READ_ONLY */
+ { 28820, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+ { 28837, 0x000088BA }, /* GL_READ_WRITE */
+ { 28851, 0x000088BA }, /* GL_READ_WRITE_ARB */
+ { 28869, 0x00001903 }, /* GL_RED */
+ { 28876, 0x00008016 }, /* GL_REDUCE */
+ { 28886, 0x00008016 }, /* GL_REDUCE_EXT */
+ { 28900, 0x00000D15 }, /* GL_RED_BIAS */
+ { 28912, 0x00000D52 }, /* GL_RED_BITS */
+ { 28924, 0x00000D14 }, /* GL_RED_SCALE */
+ { 28937, 0x00008512 }, /* GL_REFLECTION_MAP */
+ { 28955, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+ { 28977, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+ { 28998, 0x00001C00 }, /* GL_RENDER */
+ { 29008, 0x00008D41 }, /* GL_RENDERBUFFER */
+ { 29024, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ { 29051, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
+ { 29075, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+ { 29103, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+ { 29129, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ { 29156, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+ { 29176, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+ { 29203, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+ { 29226, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+ { 29253, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ { 29285, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+ { 29321, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+ { 29346, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+ { 29370, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
+ { 29398, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ { 29427, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+ { 29449, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+ { 29475, 0x00001F01 }, /* GL_RENDERER */
+ { 29487, 0x00000C40 }, /* GL_RENDER_MODE */
+ { 29502, 0x00002901 }, /* GL_REPEAT */
+ { 29512, 0x00001E01 }, /* GL_REPLACE */
+ { 29523, 0x00008062 }, /* GL_REPLACE_EXT */
+ { 29538, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+ { 29561, 0x0000803A }, /* GL_RESCALE_NORMAL */
+ { 29579, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+ { 29601, 0x00000102 }, /* GL_RETURN */
+ { 29611, 0x00001907 }, /* GL_RGB */
+ { 29618, 0x00008052 }, /* GL_RGB10 */
+ { 29627, 0x00008059 }, /* GL_RGB10_A2 */
+ { 29639, 0x00008059 }, /* GL_RGB10_A2_EXT */
+ { 29655, 0x00008052 }, /* GL_RGB10_EXT */
+ { 29668, 0x00008053 }, /* GL_RGB12 */
+ { 29677, 0x00008053 }, /* GL_RGB12_EXT */
+ { 29690, 0x00008054 }, /* GL_RGB16 */
+ { 29699, 0x00008054 }, /* GL_RGB16_EXT */
+ { 29712, 0x0000804E }, /* GL_RGB2_EXT */
+ { 29724, 0x0000804F }, /* GL_RGB4 */
+ { 29732, 0x0000804F }, /* GL_RGB4_EXT */
+ { 29744, 0x000083A1 }, /* GL_RGB4_S3TC */
+ { 29757, 0x00008050 }, /* GL_RGB5 */
+ { 29765, 0x00008057 }, /* GL_RGB5_A1 */
+ { 29776, 0x00008057 }, /* GL_RGB5_A1_EXT */
+ { 29791, 0x00008050 }, /* GL_RGB5_EXT */
+ { 29803, 0x00008051 }, /* GL_RGB8 */
+ { 29811, 0x00008051 }, /* GL_RGB8_EXT */
+ { 29823, 0x00001908 }, /* GL_RGBA */
+ { 29831, 0x0000805A }, /* GL_RGBA12 */
+ { 29841, 0x0000805A }, /* GL_RGBA12_EXT */
+ { 29855, 0x0000805B }, /* GL_RGBA16 */
+ { 29865, 0x0000805B }, /* GL_RGBA16_EXT */
+ { 29879, 0x00008055 }, /* GL_RGBA2 */
+ { 29888, 0x00008055 }, /* GL_RGBA2_EXT */
+ { 29901, 0x00008056 }, /* GL_RGBA4 */
+ { 29910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+ { 29929, 0x00008056 }, /* GL_RGBA4_EXT */
+ { 29942, 0x000083A3 }, /* GL_RGBA4_S3TC */
+ { 29956, 0x00008058 }, /* GL_RGBA8 */
+ { 29965, 0x00008058 }, /* GL_RGBA8_EXT */
+ { 29978, 0x00008F97 }, /* GL_RGBA8_SNORM */
+ { 29993, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+ { 30011, 0x00000C31 }, /* GL_RGBA_MODE */
+ { 30024, 0x000083A2 }, /* GL_RGBA_S3TC */
+ { 30037, 0x00008F93 }, /* GL_RGBA_SNORM */
+ { 30051, 0x000083A0 }, /* GL_RGB_S3TC */
+ { 30063, 0x00008573 }, /* GL_RGB_SCALE */
+ { 30076, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+ { 30093, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+ { 30110, 0x00000407 }, /* GL_RIGHT */
+ { 30119, 0x00002000 }, /* GL_S */
+ { 30124, 0x00008B5D }, /* GL_SAMPLER_1D */
+ { 30138, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+ { 30159, 0x00008B5E }, /* GL_SAMPLER_2D */
+ { 30173, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+ { 30194, 0x00008B5F }, /* GL_SAMPLER_3D */
+ { 30208, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+ { 30224, 0x000080A9 }, /* GL_SAMPLES */
+ { 30235, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+ { 30251, 0x000080A9 }, /* GL_SAMPLES_ARB */
+ { 30266, 0x00008914 }, /* GL_SAMPLES_PASSED */
+ { 30284, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+ { 30306, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ { 30334, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+ { 30366, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+ { 30389, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+ { 30416, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+ { 30434, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+ { 30457, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+ { 30479, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+ { 30498, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+ { 30521, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+ { 30547, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+ { 30577, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+ { 30602, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+ { 30631, 0x00080000 }, /* GL_SCISSOR_BIT */
+ { 30646, 0x00000C10 }, /* GL_SCISSOR_BOX */
+ { 30661, 0x00000C11 }, /* GL_SCISSOR_TEST */
+ { 30677, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+ { 30702, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ { 30742, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+ { 30786, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ { 30819, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ { 30849, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ { 30881, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ { 30911, 0x00001C02 }, /* GL_SELECT */
+ { 30921, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+ { 30949, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+ { 30974, 0x00008012 }, /* GL_SEPARABLE_2D */
+ { 30990, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+ { 31017, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+ { 31048, 0x0000150F }, /* GL_SET */
+ { 31055, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+ { 31076, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+ { 31100, 0x00008B4F }, /* GL_SHADER_TYPE */
+ { 31115, 0x00000B54 }, /* GL_SHADE_MODEL */
+ { 31130, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+ { 31158, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+ { 31181, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ { 31211, 0x00001601 }, /* GL_SHININESS */
+ { 31224, 0x00001402 }, /* GL_SHORT */
+ { 31233, 0x00009119 }, /* GL_SIGNALED */
+ { 31245, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+ { 31266, 0x000081F9 }, /* GL_SINGLE_COLOR */
+ { 31282, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+ { 31302, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+ { 31321, 0x00008C46 }, /* GL_SLUMINANCE */
+ { 31335, 0x00008C47 }, /* GL_SLUMINANCE8 */
+ { 31350, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+ { 31372, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+ { 31392, 0x00001D01 }, /* GL_SMOOTH */
+ { 31402, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+ { 31435, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+ { 31462, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+ { 31495, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+ { 31522, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+ { 31539, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+ { 31560, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+ { 31581, 0x00008580 }, /* GL_SOURCE0_RGB */
+ { 31596, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+ { 31615, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+ { 31634, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+ { 31651, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+ { 31672, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+ { 31693, 0x00008581 }, /* GL_SOURCE1_RGB */
+ { 31708, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+ { 31727, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+ { 31746, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+ { 31763, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+ { 31784, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+ { 31805, 0x00008582 }, /* GL_SOURCE2_RGB */
+ { 31820, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+ { 31839, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+ { 31858, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+ { 31878, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+ { 31896, 0x00001202 }, /* GL_SPECULAR */
+ { 31908, 0x00002402 }, /* GL_SPHERE_MAP */
+ { 31922, 0x00001206 }, /* GL_SPOT_CUTOFF */
+ { 31937, 0x00001204 }, /* GL_SPOT_DIRECTION */
+ { 31955, 0x00001205 }, /* GL_SPOT_EXPONENT */
+ { 31972, 0x00008588 }, /* GL_SRC0_ALPHA */
+ { 31986, 0x00008580 }, /* GL_SRC0_RGB */
+ { 31998, 0x00008589 }, /* GL_SRC1_ALPHA */
+ { 32012, 0x00008581 }, /* GL_SRC1_RGB */
+ { 32024, 0x0000858A }, /* GL_SRC2_ALPHA */
+ { 32038, 0x00008582 }, /* GL_SRC2_RGB */
+ { 32050, 0x00000302 }, /* GL_SRC_ALPHA */
+ { 32063, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+ { 32085, 0x00000300 }, /* GL_SRC_COLOR */
+ { 32098, 0x00008C40 }, /* GL_SRGB */
+ { 32106, 0x00008C41 }, /* GL_SRGB8 */
+ { 32115, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+ { 32131, 0x00008C42 }, /* GL_SRGB_ALPHA */
+ { 32145, 0x00000503 }, /* GL_STACK_OVERFLOW */
+ { 32163, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+ { 32182, 0x000088E6 }, /* GL_STATIC_COPY */
+ { 32197, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+ { 32216, 0x000088E4 }, /* GL_STATIC_DRAW */
+ { 32231, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+ { 32250, 0x000088E5 }, /* GL_STATIC_READ */
+ { 32265, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+ { 32284, 0x00001802 }, /* GL_STENCIL */
+ { 32295, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+ { 32317, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+ { 32343, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+ { 32364, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+ { 32389, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+ { 32410, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+ { 32435, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ { 32467, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+ { 32503, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ { 32535, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+ { 32571, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+ { 32591, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+ { 32618, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+ { 32644, 0x00000D57 }, /* GL_STENCIL_BITS */
+ { 32660, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+ { 32682, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+ { 32705, 0x00000B94 }, /* GL_STENCIL_FAIL */
+ { 32721, 0x00000B92 }, /* GL_STENCIL_FUNC */
+ { 32737, 0x00001901 }, /* GL_STENCIL_INDEX */
+ { 32754, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
+ { 32772, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
+ { 32791, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+ { 32814, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+ { 32836, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
+ { 32854, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+ { 32876, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
+ { 32894, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+ { 32916, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+ { 32937, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ { 32964, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+ { 32991, 0x00000B97 }, /* GL_STENCIL_REF */
+ { 33006, 0x00000B90 }, /* GL_STENCIL_TEST */
+ { 33022, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ { 33051, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+ { 33073, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+ { 33094, 0x00000C33 }, /* GL_STEREO */
+ { 33104, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
+ { 33128, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
+ { 33153, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
+ { 33177, 0x000088E2 }, /* GL_STREAM_COPY */
+ { 33192, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+ { 33211, 0x000088E0 }, /* GL_STREAM_DRAW */
+ { 33226, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+ { 33245, 0x000088E1 }, /* GL_STREAM_READ */
+ { 33260, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+ { 33279, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+ { 33296, 0x000084E7 }, /* GL_SUBTRACT */
+ { 33308, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+ { 33324, 0x00009113 }, /* GL_SYNC_CONDITION */
+ { 33342, 0x00009116 }, /* GL_SYNC_FENCE */
+ { 33356, 0x00009115 }, /* GL_SYNC_FLAGS */
+ { 33370, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
+ { 33397, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ { 33427, 0x00009114 }, /* GL_SYNC_STATUS */
+ { 33442, 0x00002001 }, /* GL_T */
+ { 33447, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+ { 33462, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+ { 33481, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+ { 33497, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+ { 33512, 0x00002A27 }, /* GL_T2F_V3F */
+ { 33523, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+ { 33542, 0x00002A28 }, /* GL_T4F_V4F */
+ { 33553, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+ { 33576, 0x00001702 }, /* GL_TEXTURE */
+ { 33587, 0x000084C0 }, /* GL_TEXTURE0 */
+ { 33599, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+ { 33615, 0x000084C1 }, /* GL_TEXTURE1 */
+ { 33627, 0x000084CA }, /* GL_TEXTURE10 */
+ { 33640, 0x000084CA }, /* GL_TEXTURE10_ARB */
+ { 33657, 0x000084CB }, /* GL_TEXTURE11 */
+ { 33670, 0x000084CB }, /* GL_TEXTURE11_ARB */
+ { 33687, 0x000084CC }, /* GL_TEXTURE12 */
+ { 33700, 0x000084CC }, /* GL_TEXTURE12_ARB */
+ { 33717, 0x000084CD }, /* GL_TEXTURE13 */
+ { 33730, 0x000084CD }, /* GL_TEXTURE13_ARB */
+ { 33747, 0x000084CE }, /* GL_TEXTURE14 */
+ { 33760, 0x000084CE }, /* GL_TEXTURE14_ARB */
+ { 33777, 0x000084CF }, /* GL_TEXTURE15 */
+ { 33790, 0x000084CF }, /* GL_TEXTURE15_ARB */
+ { 33807, 0x000084D0 }, /* GL_TEXTURE16 */
+ { 33820, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+ { 33837, 0x000084D1 }, /* GL_TEXTURE17 */
+ { 33850, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+ { 33867, 0x000084D2 }, /* GL_TEXTURE18 */
+ { 33880, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+ { 33897, 0x000084D3 }, /* GL_TEXTURE19 */
+ { 33910, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+ { 33927, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+ { 33943, 0x000084C2 }, /* GL_TEXTURE2 */
+ { 33955, 0x000084D4 }, /* GL_TEXTURE20 */
+ { 33968, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+ { 33985, 0x000084D5 }, /* GL_TEXTURE21 */
+ { 33998, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+ { 34015, 0x000084D6 }, /* GL_TEXTURE22 */
+ { 34028, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+ { 34045, 0x000084D7 }, /* GL_TEXTURE23 */
+ { 34058, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+ { 34075, 0x000084D8 }, /* GL_TEXTURE24 */
+ { 34088, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+ { 34105, 0x000084D9 }, /* GL_TEXTURE25 */
+ { 34118, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+ { 34135, 0x000084DA }, /* GL_TEXTURE26 */
+ { 34148, 0x000084DA }, /* GL_TEXTURE26_ARB */
+ { 34165, 0x000084DB }, /* GL_TEXTURE27 */
+ { 34178, 0x000084DB }, /* GL_TEXTURE27_ARB */
+ { 34195, 0x000084DC }, /* GL_TEXTURE28 */
+ { 34208, 0x000084DC }, /* GL_TEXTURE28_ARB */
+ { 34225, 0x000084DD }, /* GL_TEXTURE29 */
+ { 34238, 0x000084DD }, /* GL_TEXTURE29_ARB */
+ { 34255, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+ { 34271, 0x000084C3 }, /* GL_TEXTURE3 */
+ { 34283, 0x000084DE }, /* GL_TEXTURE30 */
+ { 34296, 0x000084DE }, /* GL_TEXTURE30_ARB */
+ { 34313, 0x000084DF }, /* GL_TEXTURE31 */
+ { 34326, 0x000084DF }, /* GL_TEXTURE31_ARB */
+ { 34343, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+ { 34359, 0x000084C4 }, /* GL_TEXTURE4 */
+ { 34371, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+ { 34387, 0x000084C5 }, /* GL_TEXTURE5 */
+ { 34399, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+ { 34415, 0x000084C6 }, /* GL_TEXTURE6 */
+ { 34427, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+ { 34443, 0x000084C7 }, /* GL_TEXTURE7 */
+ { 34455, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+ { 34471, 0x000084C8 }, /* GL_TEXTURE8 */
+ { 34483, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+ { 34499, 0x000084C9 }, /* GL_TEXTURE9 */
+ { 34511, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+ { 34527, 0x00000DE0 }, /* GL_TEXTURE_1D */
+ { 34541, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+ { 34565, 0x00000DE1 }, /* GL_TEXTURE_2D */
+ { 34579, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+ { 34603, 0x0000806F }, /* GL_TEXTURE_3D */
+ { 34617, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+ { 34639, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+ { 34665, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+ { 34687, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+ { 34709, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ { 34741, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+ { 34763, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ { 34795, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+ { 34817, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ { 34845, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+ { 34877, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ { 34910, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+ { 34942, 0x00040000 }, /* GL_TEXTURE_BIT */
+ { 34957, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+ { 34978, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+ { 35003, 0x00001005 }, /* GL_TEXTURE_BORDER */
+ { 35021, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+ { 35045, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ { 35076, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ { 35106, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ { 35136, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ { 35171, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ { 35202, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 35240, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ { 35267, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ { 35299, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ { 35333, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+ { 35357, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+ { 35385, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+ { 35409, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+ { 35437, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ { 35470, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+ { 35494, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+ { 35516, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+ { 35538, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+ { 35564, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+ { 35598, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ { 35631, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+ { 35668, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+ { 35696, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+ { 35728, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+ { 35751, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ { 35789, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+ { 35831, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ { 35862, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ { 35890, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ { 35920, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ { 35948, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+ { 35968, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+ { 35992, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ { 36023, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+ { 36058, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ { 36089, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+ { 36124, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ { 36155, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+ { 36190, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ { 36221, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+ { 36256, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ { 36287, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+ { 36322, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ { 36353, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+ { 36388, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ { 36417, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+ { 36434, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+ { 36456, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+ { 36482, 0x00002300 }, /* GL_TEXTURE_ENV */
+ { 36497, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+ { 36518, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+ { 36538, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+ { 36564, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+ { 36584, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+ { 36601, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+ { 36618, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+ { 36635, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+ { 36652, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ { 36677, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+ { 36699, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+ { 36725, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+ { 36743, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ { 36769, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+ { 36795, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+ { 36825, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+ { 36852, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ { 36877, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+ { 36897, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+ { 36921, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ { 36948, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ { 36975, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ { 37002, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+ { 37028, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+ { 37058, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+ { 37080, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+ { 37098, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 37128, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ { 37156, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ { 37184, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ { 37212, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+ { 37233, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+ { 37252, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+ { 37274, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+ { 37293, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+ { 37313, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ { 37343, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ { 37374, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+ { 37399, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+ { 37423, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+ { 37443, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+ { 37467, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+ { 37487, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+ { 37510, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+ { 37534, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
+ { 37562, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ { 37592, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+ { 37617, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ { 37651, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+ { 37668, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+ { 37686, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+ { 37704, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+ { 37722, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
+ { 37741, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */
+ { 37760, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+ { 37780, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+ { 37799, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ { 37828, 0x00001000 }, /* GL_TRANSFORM_BIT */
+ { 37845, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+ { 37871, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+ { 37901, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ { 37933, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ { 37963, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+ { 37997, 0x0000862C }, /* GL_TRANSPOSE_NV */
+ { 38013, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ { 38044, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+ { 38079, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ { 38107, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+ { 38139, 0x00000004 }, /* GL_TRIANGLES */
+ { 38152, 0x00000006 }, /* GL_TRIANGLE_FAN */
+ { 38168, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+ { 38189, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+ { 38207, 0x00000001 }, /* GL_TRUE */
+ { 38215, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+ { 38235, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+ { 38258, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+ { 38278, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+ { 38299, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+ { 38321, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+ { 38343, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+ { 38363, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+ { 38384, 0x00009118 }, /* GL_UNSIGNALED */
+ { 38398, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+ { 38415, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ { 38442, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+ { 38465, 0x00001405 }, /* GL_UNSIGNED_INT */
+ { 38481, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+ { 38508, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+ { 38529, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
+ { 38554, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+ { 38578, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ { 38609, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+ { 38633, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ { 38661, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+ { 38684, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+ { 38702, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ { 38732, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ { 38758, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ { 38788, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ { 38814, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+ { 38838, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ { 38866, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ { 38894, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+ { 38921, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ { 38953, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+ { 38984, 0x00008CA2 }, /* GL_UPPER_LEFT */
+ { 38998, 0x00002A20 }, /* GL_V2F */
+ { 39005, 0x00002A21 }, /* GL_V3F */
+ { 39012, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+ { 39031, 0x00001F00 }, /* GL_VENDOR */
+ { 39041, 0x00001F02 }, /* GL_VERSION */
+ { 39052, 0x00008074 }, /* GL_VERTEX_ARRAY */
+ { 39068, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
+ { 39092, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+ { 39122, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ { 39153, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+ { 39188, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+ { 39212, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+ { 39233, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+ { 39256, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+ { 39277, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ { 39304, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ { 39332, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ { 39360, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ { 39388, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ { 39416, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ { 39444, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ { 39472, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ { 39499, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ { 39526, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ { 39553, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ { 39580, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ { 39607, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ { 39634, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ { 39661, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ { 39688, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ { 39715, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ { 39753, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+ { 39795, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ { 39826, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+ { 39861, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ { 39895, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+ { 39933, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ { 39964, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+ { 39999, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ { 40027, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+ { 40059, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ { 40089, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+ { 40123, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ { 40151, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+ { 40183, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+ { 40203, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+ { 40225, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ { 40254, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+ { 40275, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ { 40304, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+ { 40337, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+ { 40369, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ { 40396, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+ { 40427, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+ { 40457, 0x00008B31 }, /* GL_VERTEX_SHADER */
+ { 40474, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+ { 40495, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+ { 40522, 0x00000BA2 }, /* GL_VIEWPORT */
+ { 40534, 0x00000800 }, /* GL_VIEWPORT_BIT */
+ { 40550, 0x0000911D }, /* GL_WAIT_FAILED */
+ { 40565, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+ { 40585, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ { 40616, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+ { 40651, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ { 40679, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ { 40704, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ { 40731, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ { 40756, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+ { 40780, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+ { 40799, 0x000088B9 }, /* GL_WRITE_ONLY */
+ { 40813, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+ { 40831, 0x00001506 }, /* GL_XOR */
+ { 40838, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+ { 40857, 0x00008757 }, /* GL_YCBCR_MESA */
+ { 40871, 0x00000000 }, /* GL_ZERO */
+ { 40879, 0x00000D16 }, /* GL_ZOOM_X */
+ { 40889, 0x00000D17 }, /* GL_ZOOM_Y */
};
static const unsigned reduced_enums[1347] =
{
- 476, /* GL_FALSE */
- 694, /* GL_LINES */
- 696, /* GL_LINE_LOOP */
- 703, /* GL_LINE_STRIP */
- 1748, /* GL_TRIANGLES */
- 1751, /* GL_TRIANGLE_STRIP */
- 1749, /* GL_TRIANGLE_FAN */
- 1275, /* GL_QUADS */
- 1279, /* GL_QUAD_STRIP */
- 1161, /* GL_POLYGON */
- 1173, /* GL_POLYGON_STIPPLE_BIT */
- 1122, /* GL_PIXEL_MODE_BIT */
- 681, /* GL_LIGHTING_BIT */
- 506, /* GL_FOG_BIT */
+ 479, /* GL_FALSE */
+ 701, /* GL_LINES */
+ 703, /* GL_LINE_LOOP */
+ 710, /* GL_LINE_STRIP */
+ 1766, /* GL_TRIANGLES */
+ 1769, /* GL_TRIANGLE_STRIP */
+ 1767, /* GL_TRIANGLE_FAN */
+ 1285, /* GL_QUADS */
+ 1289, /* GL_QUAD_STRIP */
+ 1171, /* GL_POLYGON */
+ 1183, /* GL_POLYGON_STIPPLE_BIT */
+ 1132, /* GL_PIXEL_MODE_BIT */
+ 688, /* GL_LIGHTING_BIT */
+ 509, /* GL_FOG_BIT */
8, /* GL_ACCUM */
- 713, /* GL_LOAD */
- 1331, /* GL_RETURN */
- 994, /* GL_MULT */
+ 720, /* GL_LOAD */
+ 1344, /* GL_RETURN */
+ 1004, /* GL_MULT */
23, /* GL_ADD */
- 1010, /* GL_NEVER */
- 671, /* GL_LESS */
- 466, /* GL_EQUAL */
- 670, /* GL_LEQUAL */
- 592, /* GL_GREATER */
- 1025, /* GL_NOTEQUAL */
- 591, /* GL_GEQUAL */
+ 1020, /* GL_NEVER */
+ 678, /* GL_LESS */
+ 469, /* GL_EQUAL */
+ 677, /* GL_LEQUAL */
+ 599, /* GL_GREATER */
+ 1035, /* GL_NOTEQUAL */
+ 598, /* GL_GEQUAL */
47, /* GL_ALWAYS */
- 1472, /* GL_SRC_COLOR */
- 1055, /* GL_ONE_MINUS_SRC_COLOR */
- 1470, /* GL_SRC_ALPHA */
- 1054, /* GL_ONE_MINUS_SRC_ALPHA */
- 445, /* GL_DST_ALPHA */
- 1052, /* GL_ONE_MINUS_DST_ALPHA */
- 446, /* GL_DST_COLOR */
- 1053, /* GL_ONE_MINUS_DST_COLOR */
- 1471, /* GL_SRC_ALPHA_SATURATE */
- 579, /* GL_FRONT_LEFT */
- 580, /* GL_FRONT_RIGHT */
+ 1485, /* GL_SRC_COLOR */
+ 1065, /* GL_ONE_MINUS_SRC_COLOR */
+ 1483, /* GL_SRC_ALPHA */
+ 1064, /* GL_ONE_MINUS_SRC_ALPHA */
+ 448, /* GL_DST_ALPHA */
+ 1062, /* GL_ONE_MINUS_DST_ALPHA */
+ 449, /* GL_DST_COLOR */
+ 1063, /* GL_ONE_MINUS_DST_COLOR */
+ 1484, /* GL_SRC_ALPHA_SATURATE */
+ 586, /* GL_FRONT_LEFT */
+ 587, /* GL_FRONT_RIGHT */
69, /* GL_BACK_LEFT */
70, /* GL_BACK_RIGHT */
- 576, /* GL_FRONT */
+ 583, /* GL_FRONT */
68, /* GL_BACK */
- 669, /* GL_LEFT */
- 1373, /* GL_RIGHT */
- 577, /* GL_FRONT_AND_BACK */
+ 676, /* GL_LEFT */
+ 1386, /* GL_RIGHT */
+ 584, /* GL_FRONT_AND_BACK */
63, /* GL_AUX0 */
64, /* GL_AUX1 */
65, /* GL_AUX2 */
66, /* GL_AUX3 */
- 658, /* GL_INVALID_ENUM */
- 662, /* GL_INVALID_VALUE */
- 661, /* GL_INVALID_OPERATION */
- 1477, /* GL_STACK_OVERFLOW */
- 1478, /* GL_STACK_UNDERFLOW */
- 1080, /* GL_OUT_OF_MEMORY */
- 659, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ 665, /* GL_INVALID_ENUM */
+ 669, /* GL_INVALID_VALUE */
+ 668, /* GL_INVALID_OPERATION */
+ 1490, /* GL_STACK_OVERFLOW */
+ 1491, /* GL_STACK_UNDERFLOW */
+ 1090, /* GL_OUT_OF_MEMORY */
+ 666, /* GL_INVALID_FRAMEBUFFER_OPERATION */
0, /* GL_2D */
2, /* GL_3D */
3, /* GL_3D_COLOR */
4, /* GL_3D_COLOR_TEXTURE */
6, /* GL_4D_COLOR_TEXTURE */
- 1100, /* GL_PASS_THROUGH_TOKEN */
- 1160, /* GL_POINT_TOKEN */
- 704, /* GL_LINE_TOKEN */
- 1174, /* GL_POLYGON_TOKEN */
+ 1110, /* GL_PASS_THROUGH_TOKEN */
+ 1170, /* GL_POINT_TOKEN */
+ 711, /* GL_LINE_TOKEN */
+ 1184, /* GL_POLYGON_TOKEN */
74, /* GL_BITMAP_TOKEN */
- 444, /* GL_DRAW_PIXEL_TOKEN */
+ 447, /* GL_DRAW_PIXEL_TOKEN */
301, /* GL_COPY_PIXEL_TOKEN */
- 697, /* GL_LINE_RESET_TOKEN */
- 469, /* GL_EXP */
- 470, /* GL_EXP2 */
+ 704, /* GL_LINE_RESET_TOKEN */
+ 472, /* GL_EXP */
+ 473, /* GL_EXP2 */
337, /* GL_CW */
125, /* GL_CCW */
146, /* GL_COEFF */
- 1077, /* GL_ORDER */
- 382, /* GL_DOMAIN */
+ 1087, /* GL_ORDER */
+ 384, /* GL_DOMAIN */
311, /* GL_CURRENT_COLOR */
314, /* GL_CURRENT_INDEX */
320, /* GL_CURRENT_NORMAL */
@@ -3854,519 +3892,519 @@ static const unsigned reduced_enums[1347] =
328, /* GL_CURRENT_RASTER_POSITION */
329, /* GL_CURRENT_RASTER_POSITION_VALID */
326, /* GL_CURRENT_RASTER_DISTANCE */
- 1153, /* GL_POINT_SMOOTH */
- 1142, /* GL_POINT_SIZE */
- 1152, /* GL_POINT_SIZE_RANGE */
- 1143, /* GL_POINT_SIZE_GRANULARITY */
- 698, /* GL_LINE_SMOOTH */
- 705, /* GL_LINE_WIDTH */
- 707, /* GL_LINE_WIDTH_RANGE */
- 706, /* GL_LINE_WIDTH_GRANULARITY */
- 700, /* GL_LINE_STIPPLE */
- 701, /* GL_LINE_STIPPLE_PATTERN */
- 702, /* GL_LINE_STIPPLE_REPEAT */
- 712, /* GL_LIST_MODE */
- 877, /* GL_MAX_LIST_NESTING */
- 709, /* GL_LIST_BASE */
- 711, /* GL_LIST_INDEX */
- 1163, /* GL_POLYGON_MODE */
- 1170, /* GL_POLYGON_SMOOTH */
- 1172, /* GL_POLYGON_STIPPLE */
- 455, /* GL_EDGE_FLAG */
+ 1163, /* GL_POINT_SMOOTH */
+ 1152, /* GL_POINT_SIZE */
+ 1162, /* GL_POINT_SIZE_RANGE */
+ 1153, /* GL_POINT_SIZE_GRANULARITY */
+ 705, /* GL_LINE_SMOOTH */
+ 712, /* GL_LINE_WIDTH */
+ 714, /* GL_LINE_WIDTH_RANGE */
+ 713, /* GL_LINE_WIDTH_GRANULARITY */
+ 707, /* GL_LINE_STIPPLE */
+ 708, /* GL_LINE_STIPPLE_PATTERN */
+ 709, /* GL_LINE_STIPPLE_REPEAT */
+ 719, /* GL_LIST_MODE */
+ 885, /* GL_MAX_LIST_NESTING */
+ 716, /* GL_LIST_BASE */
+ 718, /* GL_LIST_INDEX */
+ 1173, /* GL_POLYGON_MODE */
+ 1180, /* GL_POLYGON_SMOOTH */
+ 1182, /* GL_POLYGON_STIPPLE */
+ 458, /* GL_EDGE_FLAG */
304, /* GL_CULL_FACE */
305, /* GL_CULL_FACE_MODE */
- 578, /* GL_FRONT_FACE */
- 680, /* GL_LIGHTING */
- 685, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- 686, /* GL_LIGHT_MODEL_TWO_SIDE */
- 682, /* GL_LIGHT_MODEL_AMBIENT */
- 1419, /* GL_SHADE_MODEL */
+ 585, /* GL_FRONT_FACE */
+ 687, /* GL_LIGHTING */
+ 692, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ 693, /* GL_LIGHT_MODEL_TWO_SIDE */
+ 689, /* GL_LIGHT_MODEL_AMBIENT */
+ 1432, /* GL_SHADE_MODEL */
193, /* GL_COLOR_MATERIAL_FACE */
194, /* GL_COLOR_MATERIAL_PARAMETER */
192, /* GL_COLOR_MATERIAL */
- 505, /* GL_FOG */
- 527, /* GL_FOG_INDEX */
- 523, /* GL_FOG_DENSITY */
- 531, /* GL_FOG_START */
- 525, /* GL_FOG_END */
- 528, /* GL_FOG_MODE */
- 507, /* GL_FOG_COLOR */
- 369, /* GL_DEPTH_RANGE */
- 376, /* GL_DEPTH_TEST */
- 379, /* GL_DEPTH_WRITEMASK */
- 357, /* GL_DEPTH_CLEAR_VALUE */
- 368, /* GL_DEPTH_FUNC */
+ 508, /* GL_FOG */
+ 530, /* GL_FOG_INDEX */
+ 526, /* GL_FOG_DENSITY */
+ 534, /* GL_FOG_START */
+ 528, /* GL_FOG_END */
+ 531, /* GL_FOG_MODE */
+ 510, /* GL_FOG_COLOR */
+ 370, /* GL_DEPTH_RANGE */
+ 378, /* GL_DEPTH_TEST */
+ 381, /* GL_DEPTH_WRITEMASK */
+ 358, /* GL_DEPTH_CLEAR_VALUE */
+ 369, /* GL_DEPTH_FUNC */
12, /* GL_ACCUM_CLEAR_VALUE */
- 1513, /* GL_STENCIL_TEST */
- 1501, /* GL_STENCIL_CLEAR_VALUE */
- 1503, /* GL_STENCIL_FUNC */
- 1515, /* GL_STENCIL_VALUE_MASK */
- 1502, /* GL_STENCIL_FAIL */
- 1510, /* GL_STENCIL_PASS_DEPTH_FAIL */
- 1511, /* GL_STENCIL_PASS_DEPTH_PASS */
- 1512, /* GL_STENCIL_REF */
- 1516, /* GL_STENCIL_WRITEMASK */
- 846, /* GL_MATRIX_MODE */
- 1015, /* GL_NORMALIZE */
- 1842, /* GL_VIEWPORT */
- 989, /* GL_MODELVIEW_STACK_DEPTH */
- 1253, /* GL_PROJECTION_STACK_DEPTH */
- 1723, /* GL_TEXTURE_STACK_DEPTH */
- 987, /* GL_MODELVIEW_MATRIX */
- 1252, /* GL_PROJECTION_MATRIX */
- 1706, /* GL_TEXTURE_MATRIX */
+ 1530, /* GL_STENCIL_TEST */
+ 1514, /* GL_STENCIL_CLEAR_VALUE */
+ 1516, /* GL_STENCIL_FUNC */
+ 1532, /* GL_STENCIL_VALUE_MASK */
+ 1515, /* GL_STENCIL_FAIL */
+ 1527, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ 1528, /* GL_STENCIL_PASS_DEPTH_PASS */
+ 1529, /* GL_STENCIL_REF */
+ 1533, /* GL_STENCIL_WRITEMASK */
+ 853, /* GL_MATRIX_MODE */
+ 1025, /* GL_NORMALIZE */
+ 1861, /* GL_VIEWPORT */
+ 999, /* GL_MODELVIEW_STACK_DEPTH */
+ 1263, /* GL_PROJECTION_STACK_DEPTH */
+ 1740, /* GL_TEXTURE_STACK_DEPTH */
+ 997, /* GL_MODELVIEW_MATRIX */
+ 1262, /* GL_PROJECTION_MATRIX */
+ 1723, /* GL_TEXTURE_MATRIX */
61, /* GL_ATTRIB_STACK_DEPTH */
136, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
43, /* GL_ALPHA_TEST */
44, /* GL_ALPHA_TEST_FUNC */
45, /* GL_ALPHA_TEST_REF */
- 381, /* GL_DITHER */
+ 383, /* GL_DITHER */
78, /* GL_BLEND_DST */
87, /* GL_BLEND_SRC */
75, /* GL_BLEND */
- 715, /* GL_LOGIC_OP_MODE */
- 632, /* GL_INDEX_LOGIC_OP */
+ 722, /* GL_LOGIC_OP_MODE */
+ 639, /* GL_INDEX_LOGIC_OP */
191, /* GL_COLOR_LOGIC_OP */
67, /* GL_AUX_BUFFERS */
- 392, /* GL_DRAW_BUFFER */
- 1289, /* GL_READ_BUFFER */
- 1400, /* GL_SCISSOR_BOX */
- 1401, /* GL_SCISSOR_TEST */
- 631, /* GL_INDEX_CLEAR_VALUE */
- 636, /* GL_INDEX_WRITEMASK */
+ 394, /* GL_DRAW_BUFFER */
+ 1299, /* GL_READ_BUFFER */
+ 1413, /* GL_SCISSOR_BOX */
+ 1414, /* GL_SCISSOR_TEST */
+ 638, /* GL_INDEX_CLEAR_VALUE */
+ 643, /* GL_INDEX_WRITEMASK */
188, /* GL_COLOR_CLEAR_VALUE */
230, /* GL_COLOR_WRITEMASK */
- 633, /* GL_INDEX_MODE */
- 1366, /* GL_RGBA_MODE */
- 391, /* GL_DOUBLEBUFFER */
- 1517, /* GL_STEREO */
- 1324, /* GL_RENDER_MODE */
- 1101, /* GL_PERSPECTIVE_CORRECTION_HINT */
- 1154, /* GL_POINT_SMOOTH_HINT */
- 699, /* GL_LINE_SMOOTH_HINT */
- 1171, /* GL_POLYGON_SMOOTH_HINT */
- 526, /* GL_FOG_HINT */
- 1687, /* GL_TEXTURE_GEN_S */
- 1688, /* GL_TEXTURE_GEN_T */
- 1686, /* GL_TEXTURE_GEN_R */
- 1685, /* GL_TEXTURE_GEN_Q */
- 1114, /* GL_PIXEL_MAP_I_TO_I */
- 1120, /* GL_PIXEL_MAP_S_TO_S */
- 1116, /* GL_PIXEL_MAP_I_TO_R */
- 1112, /* GL_PIXEL_MAP_I_TO_G */
- 1110, /* GL_PIXEL_MAP_I_TO_B */
- 1108, /* GL_PIXEL_MAP_I_TO_A */
- 1118, /* GL_PIXEL_MAP_R_TO_R */
- 1106, /* GL_PIXEL_MAP_G_TO_G */
- 1104, /* GL_PIXEL_MAP_B_TO_B */
- 1102, /* GL_PIXEL_MAP_A_TO_A */
- 1115, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- 1121, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- 1117, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- 1113, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- 1111, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- 1109, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- 1119, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- 1107, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- 1105, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- 1103, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- 1760, /* GL_UNPACK_SWAP_BYTES */
- 1755, /* GL_UNPACK_LSB_FIRST */
- 1756, /* GL_UNPACK_ROW_LENGTH */
- 1759, /* GL_UNPACK_SKIP_ROWS */
- 1758, /* GL_UNPACK_SKIP_PIXELS */
- 1753, /* GL_UNPACK_ALIGNMENT */
- 1089, /* GL_PACK_SWAP_BYTES */
- 1084, /* GL_PACK_LSB_FIRST */
- 1085, /* GL_PACK_ROW_LENGTH */
- 1088, /* GL_PACK_SKIP_ROWS */
- 1087, /* GL_PACK_SKIP_PIXELS */
- 1081, /* GL_PACK_ALIGNMENT */
- 793, /* GL_MAP_COLOR */
- 798, /* GL_MAP_STENCIL */
- 635, /* GL_INDEX_SHIFT */
- 634, /* GL_INDEX_OFFSET */
- 1302, /* GL_RED_SCALE */
- 1300, /* GL_RED_BIAS */
- 1860, /* GL_ZOOM_X */
- 1861, /* GL_ZOOM_Y */
- 596, /* GL_GREEN_SCALE */
- 594, /* GL_GREEN_BIAS */
+ 640, /* GL_INDEX_MODE */
+ 1379, /* GL_RGBA_MODE */
+ 393, /* GL_DOUBLEBUFFER */
+ 1534, /* GL_STEREO */
+ 1337, /* GL_RENDER_MODE */
+ 1111, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ 1164, /* GL_POINT_SMOOTH_HINT */
+ 706, /* GL_LINE_SMOOTH_HINT */
+ 1181, /* GL_POLYGON_SMOOTH_HINT */
+ 529, /* GL_FOG_HINT */
+ 1704, /* GL_TEXTURE_GEN_S */
+ 1705, /* GL_TEXTURE_GEN_T */
+ 1703, /* GL_TEXTURE_GEN_R */
+ 1702, /* GL_TEXTURE_GEN_Q */
+ 1124, /* GL_PIXEL_MAP_I_TO_I */
+ 1130, /* GL_PIXEL_MAP_S_TO_S */
+ 1126, /* GL_PIXEL_MAP_I_TO_R */
+ 1122, /* GL_PIXEL_MAP_I_TO_G */
+ 1120, /* GL_PIXEL_MAP_I_TO_B */
+ 1118, /* GL_PIXEL_MAP_I_TO_A */
+ 1128, /* GL_PIXEL_MAP_R_TO_R */
+ 1116, /* GL_PIXEL_MAP_G_TO_G */
+ 1114, /* GL_PIXEL_MAP_B_TO_B */
+ 1112, /* GL_PIXEL_MAP_A_TO_A */
+ 1125, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ 1131, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ 1127, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ 1123, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ 1121, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ 1119, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ 1129, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ 1117, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ 1115, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ 1113, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ 1778, /* GL_UNPACK_SWAP_BYTES */
+ 1773, /* GL_UNPACK_LSB_FIRST */
+ 1774, /* GL_UNPACK_ROW_LENGTH */
+ 1777, /* GL_UNPACK_SKIP_ROWS */
+ 1776, /* GL_UNPACK_SKIP_PIXELS */
+ 1771, /* GL_UNPACK_ALIGNMENT */
+ 1099, /* GL_PACK_SWAP_BYTES */
+ 1094, /* GL_PACK_LSB_FIRST */
+ 1095, /* GL_PACK_ROW_LENGTH */
+ 1098, /* GL_PACK_SKIP_ROWS */
+ 1097, /* GL_PACK_SKIP_PIXELS */
+ 1091, /* GL_PACK_ALIGNMENT */
+ 800, /* GL_MAP_COLOR */
+ 805, /* GL_MAP_STENCIL */
+ 642, /* GL_INDEX_SHIFT */
+ 641, /* GL_INDEX_OFFSET */
+ 1313, /* GL_RED_SCALE */
+ 1311, /* GL_RED_BIAS */
+ 1879, /* GL_ZOOM_X */
+ 1880, /* GL_ZOOM_Y */
+ 603, /* GL_GREEN_SCALE */
+ 601, /* GL_GREEN_BIAS */
93, /* GL_BLUE_SCALE */
91, /* GL_BLUE_BIAS */
42, /* GL_ALPHA_SCALE */
40, /* GL_ALPHA_BIAS */
- 370, /* GL_DEPTH_SCALE */
- 350, /* GL_DEPTH_BIAS */
- 872, /* GL_MAX_EVAL_ORDER */
- 876, /* GL_MAX_LIGHTS */
- 855, /* GL_MAX_CLIP_PLANES */
- 922, /* GL_MAX_TEXTURE_SIZE */
- 882, /* GL_MAX_PIXEL_MAP_TABLE */
- 851, /* GL_MAX_ATTRIB_STACK_DEPTH */
- 879, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- 880, /* GL_MAX_NAME_STACK_DEPTH */
- 908, /* GL_MAX_PROJECTION_STACK_DEPTH */
- 923, /* GL_MAX_TEXTURE_STACK_DEPTH */
- 937, /* GL_MAX_VIEWPORT_DIMS */
- 852, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- 1527, /* GL_SUBPIXEL_BITS */
- 630, /* GL_INDEX_BITS */
- 1301, /* GL_RED_BITS */
- 595, /* GL_GREEN_BITS */
+ 371, /* GL_DEPTH_SCALE */
+ 351, /* GL_DEPTH_BIAS */
+ 880, /* GL_MAX_EVAL_ORDER */
+ 884, /* GL_MAX_LIGHTS */
+ 862, /* GL_MAX_CLIP_PLANES */
+ 932, /* GL_MAX_TEXTURE_SIZE */
+ 890, /* GL_MAX_PIXEL_MAP_TABLE */
+ 858, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ 887, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ 888, /* GL_MAX_NAME_STACK_DEPTH */
+ 916, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ 933, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ 947, /* GL_MAX_VIEWPORT_DIMS */
+ 859, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ 1544, /* GL_SUBPIXEL_BITS */
+ 637, /* GL_INDEX_BITS */
+ 1312, /* GL_RED_BITS */
+ 602, /* GL_GREEN_BITS */
92, /* GL_BLUE_BITS */
41, /* GL_ALPHA_BITS */
- 351, /* GL_DEPTH_BITS */
- 1499, /* GL_STENCIL_BITS */
+ 352, /* GL_DEPTH_BITS */
+ 1512, /* GL_STENCIL_BITS */
14, /* GL_ACCUM_RED_BITS */
13, /* GL_ACCUM_GREEN_BITS */
10, /* GL_ACCUM_BLUE_BITS */
9, /* GL_ACCUM_ALPHA_BITS */
- 1003, /* GL_NAME_STACK_DEPTH */
+ 1013, /* GL_NAME_STACK_DEPTH */
62, /* GL_AUTO_NORMAL */
- 739, /* GL_MAP1_COLOR_4 */
- 742, /* GL_MAP1_INDEX */
- 743, /* GL_MAP1_NORMAL */
- 744, /* GL_MAP1_TEXTURE_COORD_1 */
- 745, /* GL_MAP1_TEXTURE_COORD_2 */
- 746, /* GL_MAP1_TEXTURE_COORD_3 */
- 747, /* GL_MAP1_TEXTURE_COORD_4 */
- 748, /* GL_MAP1_VERTEX_3 */
- 749, /* GL_MAP1_VERTEX_4 */
- 766, /* GL_MAP2_COLOR_4 */
- 769, /* GL_MAP2_INDEX */
- 770, /* GL_MAP2_NORMAL */
- 771, /* GL_MAP2_TEXTURE_COORD_1 */
- 772, /* GL_MAP2_TEXTURE_COORD_2 */
- 773, /* GL_MAP2_TEXTURE_COORD_3 */
- 774, /* GL_MAP2_TEXTURE_COORD_4 */
- 775, /* GL_MAP2_VERTEX_3 */
- 776, /* GL_MAP2_VERTEX_4 */
- 740, /* GL_MAP1_GRID_DOMAIN */
- 741, /* GL_MAP1_GRID_SEGMENTS */
- 767, /* GL_MAP2_GRID_DOMAIN */
- 768, /* GL_MAP2_GRID_SEGMENTS */
- 1610, /* GL_TEXTURE_1D */
- 1612, /* GL_TEXTURE_2D */
- 479, /* GL_FEEDBACK_BUFFER_POINTER */
- 480, /* GL_FEEDBACK_BUFFER_SIZE */
- 481, /* GL_FEEDBACK_BUFFER_TYPE */
- 1410, /* GL_SELECTION_BUFFER_POINTER */
- 1411, /* GL_SELECTION_BUFFER_SIZE */
- 1728, /* GL_TEXTURE_WIDTH */
- 1692, /* GL_TEXTURE_HEIGHT */
- 1647, /* GL_TEXTURE_COMPONENTS */
- 1631, /* GL_TEXTURE_BORDER_COLOR */
- 1630, /* GL_TEXTURE_BORDER */
- 383, /* GL_DONT_CARE */
- 477, /* GL_FASTEST */
- 1011, /* GL_NICEST */
+ 746, /* GL_MAP1_COLOR_4 */
+ 749, /* GL_MAP1_INDEX */
+ 750, /* GL_MAP1_NORMAL */
+ 751, /* GL_MAP1_TEXTURE_COORD_1 */
+ 752, /* GL_MAP1_TEXTURE_COORD_2 */
+ 753, /* GL_MAP1_TEXTURE_COORD_3 */
+ 754, /* GL_MAP1_TEXTURE_COORD_4 */
+ 755, /* GL_MAP1_VERTEX_3 */
+ 756, /* GL_MAP1_VERTEX_4 */
+ 773, /* GL_MAP2_COLOR_4 */
+ 776, /* GL_MAP2_INDEX */
+ 777, /* GL_MAP2_NORMAL */
+ 778, /* GL_MAP2_TEXTURE_COORD_1 */
+ 779, /* GL_MAP2_TEXTURE_COORD_2 */
+ 780, /* GL_MAP2_TEXTURE_COORD_3 */
+ 781, /* GL_MAP2_TEXTURE_COORD_4 */
+ 782, /* GL_MAP2_VERTEX_3 */
+ 783, /* GL_MAP2_VERTEX_4 */
+ 747, /* GL_MAP1_GRID_DOMAIN */
+ 748, /* GL_MAP1_GRID_SEGMENTS */
+ 774, /* GL_MAP2_GRID_DOMAIN */
+ 775, /* GL_MAP2_GRID_SEGMENTS */
+ 1627, /* GL_TEXTURE_1D */
+ 1629, /* GL_TEXTURE_2D */
+ 482, /* GL_FEEDBACK_BUFFER_POINTER */
+ 483, /* GL_FEEDBACK_BUFFER_SIZE */
+ 484, /* GL_FEEDBACK_BUFFER_TYPE */
+ 1423, /* GL_SELECTION_BUFFER_POINTER */
+ 1424, /* GL_SELECTION_BUFFER_SIZE */
+ 1746, /* GL_TEXTURE_WIDTH */
+ 1709, /* GL_TEXTURE_HEIGHT */
+ 1664, /* GL_TEXTURE_COMPONENTS */
+ 1648, /* GL_TEXTURE_BORDER_COLOR */
+ 1647, /* GL_TEXTURE_BORDER */
+ 385, /* GL_DONT_CARE */
+ 480, /* GL_FASTEST */
+ 1021, /* GL_NICEST */
48, /* GL_AMBIENT */
- 380, /* GL_DIFFUSE */
- 1459, /* GL_SPECULAR */
- 1175, /* GL_POSITION */
- 1462, /* GL_SPOT_DIRECTION */
- 1463, /* GL_SPOT_EXPONENT */
- 1461, /* GL_SPOT_CUTOFF */
+ 382, /* GL_DIFFUSE */
+ 1472, /* GL_SPECULAR */
+ 1185, /* GL_POSITION */
+ 1475, /* GL_SPOT_DIRECTION */
+ 1476, /* GL_SPOT_EXPONENT */
+ 1474, /* GL_SPOT_CUTOFF */
275, /* GL_CONSTANT_ATTENUATION */
- 689, /* GL_LINEAR_ATTENUATION */
- 1274, /* GL_QUADRATIC_ATTENUATION */
+ 696, /* GL_LINEAR_ATTENUATION */
+ 1284, /* GL_QUADRATIC_ATTENUATION */
244, /* GL_COMPILE */
245, /* GL_COMPILE_AND_EXECUTE */
120, /* GL_BYTE */
- 1762, /* GL_UNSIGNED_BYTE */
- 1424, /* GL_SHORT */
- 1773, /* GL_UNSIGNED_SHORT */
- 638, /* GL_INT */
- 1765, /* GL_UNSIGNED_INT */
- 486, /* GL_FLOAT */
+ 1780, /* GL_UNSIGNED_BYTE */
+ 1437, /* GL_SHORT */
+ 1792, /* GL_UNSIGNED_SHORT */
+ 645, /* GL_INT */
+ 1783, /* GL_UNSIGNED_INT */
+ 489, /* GL_FLOAT */
1, /* GL_2_BYTES */
5, /* GL_3_BYTES */
7, /* GL_4_BYTES */
- 390, /* GL_DOUBLE */
+ 392, /* GL_DOUBLE */
132, /* GL_CLEAR */
50, /* GL_AND */
52, /* GL_AND_REVERSE */
299, /* GL_COPY */
51, /* GL_AND_INVERTED */
- 1013, /* GL_NOOP */
- 1856, /* GL_XOR */
- 1076, /* GL_OR */
- 1014, /* GL_NOR */
- 467, /* GL_EQUIV */
- 665, /* GL_INVERT */
- 1079, /* GL_OR_REVERSE */
+ 1023, /* GL_NOOP */
+ 1875, /* GL_XOR */
+ 1086, /* GL_OR */
+ 1024, /* GL_NOR */
+ 470, /* GL_EQUIV */
+ 672, /* GL_INVERT */
+ 1089, /* GL_OR_REVERSE */
300, /* GL_COPY_INVERTED */
- 1078, /* GL_OR_INVERTED */
- 1004, /* GL_NAND */
- 1415, /* GL_SET */
- 464, /* GL_EMISSION */
- 1423, /* GL_SHININESS */
+ 1088, /* GL_OR_INVERTED */
+ 1014, /* GL_NAND */
+ 1428, /* GL_SET */
+ 467, /* GL_EMISSION */
+ 1436, /* GL_SHININESS */
49, /* GL_AMBIENT_AND_DIFFUSE */
190, /* GL_COLOR_INDEXES */
- 954, /* GL_MODELVIEW */
- 1251, /* GL_PROJECTION */
- 1545, /* GL_TEXTURE */
+ 964, /* GL_MODELVIEW */
+ 1261, /* GL_PROJECTION */
+ 1562, /* GL_TEXTURE */
147, /* GL_COLOR */
346, /* GL_DEPTH */
- 1485, /* GL_STENCIL */
+ 1498, /* GL_STENCIL */
189, /* GL_COLOR_INDEX */
- 1504, /* GL_STENCIL_INDEX */
- 358, /* GL_DEPTH_COMPONENT */
- 1297, /* GL_RED */
- 593, /* GL_GREEN */
+ 1517, /* GL_STENCIL_INDEX */
+ 359, /* GL_DEPTH_COMPONENT */
+ 1308, /* GL_RED */
+ 600, /* GL_GREEN */
90, /* GL_BLUE */
31, /* GL_ALPHA */
- 1332, /* GL_RGB */
- 1351, /* GL_RGBA */
- 717, /* GL_LUMINANCE */
- 738, /* GL_LUMINANCE_ALPHA */
+ 1345, /* GL_RGB */
+ 1364, /* GL_RGBA */
+ 724, /* GL_LUMINANCE */
+ 745, /* GL_LUMINANCE_ALPHA */
73, /* GL_BITMAP */
- 1131, /* GL_POINT */
- 687, /* GL_LINE */
- 482, /* GL_FILL */
- 1306, /* GL_RENDER */
- 478, /* GL_FEEDBACK */
- 1409, /* GL_SELECT */
- 485, /* GL_FLAT */
- 1434, /* GL_SMOOTH */
- 666, /* GL_KEEP */
- 1326, /* GL_REPLACE */
- 620, /* GL_INCR */
+ 1141, /* GL_POINT */
+ 694, /* GL_LINE */
+ 485, /* GL_FILL */
+ 1317, /* GL_RENDER */
+ 481, /* GL_FEEDBACK */
+ 1422, /* GL_SELECT */
+ 488, /* GL_FLAT */
+ 1447, /* GL_SMOOTH */
+ 673, /* GL_KEEP */
+ 1339, /* GL_REPLACE */
+ 627, /* GL_INCR */
342, /* GL_DECR */
- 1788, /* GL_VENDOR */
- 1323, /* GL_RENDERER */
- 1789, /* GL_VERSION */
- 471, /* GL_EXTENSIONS */
- 1374, /* GL_S */
- 1536, /* GL_T */
- 1286, /* GL_R */
- 1273, /* GL_Q */
- 990, /* GL_MODULATE */
+ 1807, /* GL_VENDOR */
+ 1336, /* GL_RENDERER */
+ 1808, /* GL_VERSION */
+ 474, /* GL_EXTENSIONS */
+ 1387, /* GL_S */
+ 1553, /* GL_T */
+ 1296, /* GL_R */
+ 1283, /* GL_Q */
+ 1000, /* GL_MODULATE */
341, /* GL_DECAL */
- 1682, /* GL_TEXTURE_ENV_MODE */
- 1681, /* GL_TEXTURE_ENV_COLOR */
- 1680, /* GL_TEXTURE_ENV */
- 472, /* GL_EYE_LINEAR */
- 1037, /* GL_OBJECT_LINEAR */
- 1460, /* GL_SPHERE_MAP */
- 1684, /* GL_TEXTURE_GEN_MODE */
- 1039, /* GL_OBJECT_PLANE */
- 473, /* GL_EYE_PLANE */
- 1005, /* GL_NEAREST */
- 688, /* GL_LINEAR */
- 1009, /* GL_NEAREST_MIPMAP_NEAREST */
- 693, /* GL_LINEAR_MIPMAP_NEAREST */
- 1008, /* GL_NEAREST_MIPMAP_LINEAR */
- 692, /* GL_LINEAR_MIPMAP_LINEAR */
- 1705, /* GL_TEXTURE_MAG_FILTER */
- 1713, /* GL_TEXTURE_MIN_FILTER */
- 1730, /* GL_TEXTURE_WRAP_S */
- 1731, /* GL_TEXTURE_WRAP_T */
+ 1699, /* GL_TEXTURE_ENV_MODE */
+ 1698, /* GL_TEXTURE_ENV_COLOR */
+ 1697, /* GL_TEXTURE_ENV */
+ 475, /* GL_EYE_LINEAR */
+ 1047, /* GL_OBJECT_LINEAR */
+ 1473, /* GL_SPHERE_MAP */
+ 1701, /* GL_TEXTURE_GEN_MODE */
+ 1049, /* GL_OBJECT_PLANE */
+ 476, /* GL_EYE_PLANE */
+ 1015, /* GL_NEAREST */
+ 695, /* GL_LINEAR */
+ 1019, /* GL_NEAREST_MIPMAP_NEAREST */
+ 700, /* GL_LINEAR_MIPMAP_NEAREST */
+ 1018, /* GL_NEAREST_MIPMAP_LINEAR */
+ 699, /* GL_LINEAR_MIPMAP_LINEAR */
+ 1722, /* GL_TEXTURE_MAG_FILTER */
+ 1730, /* GL_TEXTURE_MIN_FILTER */
+ 1748, /* GL_TEXTURE_WRAP_S */
+ 1749, /* GL_TEXTURE_WRAP_T */
126, /* GL_CLAMP */
- 1325, /* GL_REPEAT */
- 1169, /* GL_POLYGON_OFFSET_UNITS */
- 1168, /* GL_POLYGON_OFFSET_POINT */
- 1167, /* GL_POLYGON_OFFSET_LINE */
- 1287, /* GL_R3_G3_B2 */
- 1785, /* GL_V2F */
- 1786, /* GL_V3F */
+ 1338, /* GL_REPEAT */
+ 1179, /* GL_POLYGON_OFFSET_UNITS */
+ 1178, /* GL_POLYGON_OFFSET_POINT */
+ 1177, /* GL_POLYGON_OFFSET_LINE */
+ 1297, /* GL_R3_G3_B2 */
+ 1804, /* GL_V2F */
+ 1805, /* GL_V3F */
123, /* GL_C4UB_V2F */
124, /* GL_C4UB_V3F */
121, /* GL_C3F_V3F */
- 1002, /* GL_N3F_V3F */
+ 1012, /* GL_N3F_V3F */
122, /* GL_C4F_N3F_V3F */
- 1541, /* GL_T2F_V3F */
- 1543, /* GL_T4F_V4F */
- 1539, /* GL_T2F_C4UB_V3F */
- 1537, /* GL_T2F_C3F_V3F */
- 1540, /* GL_T2F_N3F_V3F */
- 1538, /* GL_T2F_C4F_N3F_V3F */
- 1542, /* GL_T4F_C4F_N3F_V4F */
+ 1558, /* GL_T2F_V3F */
+ 1560, /* GL_T4F_V4F */
+ 1556, /* GL_T2F_C4UB_V3F */
+ 1554, /* GL_T2F_C3F_V3F */
+ 1557, /* GL_T2F_N3F_V3F */
+ 1555, /* GL_T2F_C4F_N3F_V3F */
+ 1559, /* GL_T4F_C4F_N3F_V4F */
139, /* GL_CLIP_PLANE0 */
140, /* GL_CLIP_PLANE1 */
141, /* GL_CLIP_PLANE2 */
142, /* GL_CLIP_PLANE3 */
143, /* GL_CLIP_PLANE4 */
144, /* GL_CLIP_PLANE5 */
- 672, /* GL_LIGHT0 */
- 673, /* GL_LIGHT1 */
- 674, /* GL_LIGHT2 */
- 675, /* GL_LIGHT3 */
- 676, /* GL_LIGHT4 */
- 677, /* GL_LIGHT5 */
- 678, /* GL_LIGHT6 */
- 679, /* GL_LIGHT7 */
- 597, /* GL_HINT_BIT */
+ 679, /* GL_LIGHT0 */
+ 680, /* GL_LIGHT1 */
+ 681, /* GL_LIGHT2 */
+ 682, /* GL_LIGHT3 */
+ 683, /* GL_LIGHT4 */
+ 684, /* GL_LIGHT5 */
+ 685, /* GL_LIGHT6 */
+ 686, /* GL_LIGHT7 */
+ 604, /* GL_HINT_BIT */
277, /* GL_CONSTANT_COLOR */
- 1050, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ 1060, /* GL_ONE_MINUS_CONSTANT_COLOR */
272, /* GL_CONSTANT_ALPHA */
- 1048, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ 1058, /* GL_ONE_MINUS_CONSTANT_ALPHA */
76, /* GL_BLEND_COLOR */
- 581, /* GL_FUNC_ADD */
- 938, /* GL_MIN */
- 848, /* GL_MAX */
+ 588, /* GL_FUNC_ADD */
+ 948, /* GL_MIN */
+ 855, /* GL_MAX */
81, /* GL_BLEND_EQUATION */
- 585, /* GL_FUNC_SUBTRACT */
- 583, /* GL_FUNC_REVERSE_SUBTRACT */
+ 592, /* GL_FUNC_SUBTRACT */
+ 590, /* GL_FUNC_REVERSE_SUBTRACT */
280, /* GL_CONVOLUTION_1D */
281, /* GL_CONVOLUTION_2D */
- 1412, /* GL_SEPARABLE_2D */
+ 1425, /* GL_SEPARABLE_2D */
284, /* GL_CONVOLUTION_BORDER_MODE */
288, /* GL_CONVOLUTION_FILTER_SCALE */
286, /* GL_CONVOLUTION_FILTER_BIAS */
- 1298, /* GL_REDUCE */
+ 1309, /* GL_REDUCE */
290, /* GL_CONVOLUTION_FORMAT */
294, /* GL_CONVOLUTION_WIDTH */
292, /* GL_CONVOLUTION_HEIGHT */
- 863, /* GL_MAX_CONVOLUTION_WIDTH */
- 861, /* GL_MAX_CONVOLUTION_HEIGHT */
- 1208, /* GL_POST_CONVOLUTION_RED_SCALE */
- 1204, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- 1199, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- 1195, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- 1206, /* GL_POST_CONVOLUTION_RED_BIAS */
- 1202, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- 1197, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- 1193, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- 598, /* GL_HISTOGRAM */
- 1257, /* GL_PROXY_HISTOGRAM */
- 614, /* GL_HISTOGRAM_WIDTH */
- 604, /* GL_HISTOGRAM_FORMAT */
- 610, /* GL_HISTOGRAM_RED_SIZE */
- 606, /* GL_HISTOGRAM_GREEN_SIZE */
- 601, /* GL_HISTOGRAM_BLUE_SIZE */
- 599, /* GL_HISTOGRAM_ALPHA_SIZE */
- 608, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- 612, /* GL_HISTOGRAM_SINK */
- 939, /* GL_MINMAX */
- 941, /* GL_MINMAX_FORMAT */
- 943, /* GL_MINMAX_SINK */
- 1544, /* GL_TABLE_TOO_LARGE_EXT */
- 1764, /* GL_UNSIGNED_BYTE_3_3_2 */
- 1775, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- 1777, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- 1770, /* GL_UNSIGNED_INT_8_8_8_8 */
- 1766, /* GL_UNSIGNED_INT_10_10_10_2 */
- 1166, /* GL_POLYGON_OFFSET_FILL */
- 1165, /* GL_POLYGON_OFFSET_FACTOR */
- 1164, /* GL_POLYGON_OFFSET_BIAS */
- 1329, /* GL_RESCALE_NORMAL */
+ 871, /* GL_MAX_CONVOLUTION_WIDTH */
+ 869, /* GL_MAX_CONVOLUTION_HEIGHT */
+ 1218, /* GL_POST_CONVOLUTION_RED_SCALE */
+ 1214, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ 1209, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ 1205, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ 1216, /* GL_POST_CONVOLUTION_RED_BIAS */
+ 1212, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ 1207, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ 1203, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ 605, /* GL_HISTOGRAM */
+ 1267, /* GL_PROXY_HISTOGRAM */
+ 621, /* GL_HISTOGRAM_WIDTH */
+ 611, /* GL_HISTOGRAM_FORMAT */
+ 617, /* GL_HISTOGRAM_RED_SIZE */
+ 613, /* GL_HISTOGRAM_GREEN_SIZE */
+ 608, /* GL_HISTOGRAM_BLUE_SIZE */
+ 606, /* GL_HISTOGRAM_ALPHA_SIZE */
+ 615, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+ 619, /* GL_HISTOGRAM_SINK */
+ 949, /* GL_MINMAX */
+ 951, /* GL_MINMAX_FORMAT */
+ 953, /* GL_MINMAX_SINK */
+ 1561, /* GL_TABLE_TOO_LARGE_EXT */
+ 1782, /* GL_UNSIGNED_BYTE_3_3_2 */
+ 1794, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ 1796, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ 1789, /* GL_UNSIGNED_INT_8_8_8_8 */
+ 1784, /* GL_UNSIGNED_INT_10_10_10_2 */
+ 1176, /* GL_POLYGON_OFFSET_FILL */
+ 1175, /* GL_POLYGON_OFFSET_FACTOR */
+ 1174, /* GL_POLYGON_OFFSET_BIAS */
+ 1342, /* GL_RESCALE_NORMAL */
36, /* GL_ALPHA4 */
38, /* GL_ALPHA8 */
32, /* GL_ALPHA12 */
34, /* GL_ALPHA16 */
- 728, /* GL_LUMINANCE4 */
- 734, /* GL_LUMINANCE8 */
- 718, /* GL_LUMINANCE12 */
- 724, /* GL_LUMINANCE16 */
- 729, /* GL_LUMINANCE4_ALPHA4 */
- 732, /* GL_LUMINANCE6_ALPHA2 */
- 735, /* GL_LUMINANCE8_ALPHA8 */
- 721, /* GL_LUMINANCE12_ALPHA4 */
- 719, /* GL_LUMINANCE12_ALPHA12 */
- 725, /* GL_LUMINANCE16_ALPHA16 */
- 639, /* GL_INTENSITY */
- 644, /* GL_INTENSITY4 */
- 646, /* GL_INTENSITY8 */
- 640, /* GL_INTENSITY12 */
- 642, /* GL_INTENSITY16 */
- 1341, /* GL_RGB2_EXT */
- 1342, /* GL_RGB4 */
- 1345, /* GL_RGB5 */
- 1349, /* GL_RGB8 */
- 1333, /* GL_RGB10 */
- 1337, /* GL_RGB12 */
- 1339, /* GL_RGB16 */
- 1356, /* GL_RGBA2 */
- 1358, /* GL_RGBA4 */
- 1346, /* GL_RGB5_A1 */
- 1362, /* GL_RGBA8 */
- 1334, /* GL_RGB10_A2 */
- 1352, /* GL_RGBA12 */
- 1354, /* GL_RGBA16 */
- 1720, /* GL_TEXTURE_RED_SIZE */
- 1690, /* GL_TEXTURE_GREEN_SIZE */
- 1628, /* GL_TEXTURE_BLUE_SIZE */
- 1615, /* GL_TEXTURE_ALPHA_SIZE */
- 1703, /* GL_TEXTURE_LUMINANCE_SIZE */
- 1694, /* GL_TEXTURE_INTENSITY_SIZE */
- 1327, /* GL_REPLACE_EXT */
- 1261, /* GL_PROXY_TEXTURE_1D */
- 1264, /* GL_PROXY_TEXTURE_2D */
- 1726, /* GL_TEXTURE_TOO_LARGE_EXT */
- 1715, /* GL_TEXTURE_PRIORITY */
- 1722, /* GL_TEXTURE_RESIDENT */
- 1618, /* GL_TEXTURE_BINDING_1D */
- 1620, /* GL_TEXTURE_BINDING_2D */
- 1622, /* GL_TEXTURE_BINDING_3D */
- 1086, /* GL_PACK_SKIP_IMAGES */
- 1082, /* GL_PACK_IMAGE_HEIGHT */
- 1757, /* GL_UNPACK_SKIP_IMAGES */
- 1754, /* GL_UNPACK_IMAGE_HEIGHT */
- 1614, /* GL_TEXTURE_3D */
- 1267, /* GL_PROXY_TEXTURE_3D */
- 1677, /* GL_TEXTURE_DEPTH */
- 1729, /* GL_TEXTURE_WRAP_R */
- 849, /* GL_MAX_3D_TEXTURE_SIZE */
- 1790, /* GL_VERTEX_ARRAY */
- 1016, /* GL_NORMAL_ARRAY */
+ 735, /* GL_LUMINANCE4 */
+ 741, /* GL_LUMINANCE8 */
+ 725, /* GL_LUMINANCE12 */
+ 731, /* GL_LUMINANCE16 */
+ 736, /* GL_LUMINANCE4_ALPHA4 */
+ 739, /* GL_LUMINANCE6_ALPHA2 */
+ 742, /* GL_LUMINANCE8_ALPHA8 */
+ 728, /* GL_LUMINANCE12_ALPHA4 */
+ 726, /* GL_LUMINANCE12_ALPHA12 */
+ 732, /* GL_LUMINANCE16_ALPHA16 */
+ 646, /* GL_INTENSITY */
+ 651, /* GL_INTENSITY4 */
+ 653, /* GL_INTENSITY8 */
+ 647, /* GL_INTENSITY12 */
+ 649, /* GL_INTENSITY16 */
+ 1354, /* GL_RGB2_EXT */
+ 1355, /* GL_RGB4 */
+ 1358, /* GL_RGB5 */
+ 1362, /* GL_RGB8 */
+ 1346, /* GL_RGB10 */
+ 1350, /* GL_RGB12 */
+ 1352, /* GL_RGB16 */
+ 1369, /* GL_RGBA2 */
+ 1371, /* GL_RGBA4 */
+ 1359, /* GL_RGB5_A1 */
+ 1375, /* GL_RGBA8 */
+ 1347, /* GL_RGB10_A2 */
+ 1365, /* GL_RGBA12 */
+ 1367, /* GL_RGBA16 */
+ 1737, /* GL_TEXTURE_RED_SIZE */
+ 1707, /* GL_TEXTURE_GREEN_SIZE */
+ 1645, /* GL_TEXTURE_BLUE_SIZE */
+ 1632, /* GL_TEXTURE_ALPHA_SIZE */
+ 1720, /* GL_TEXTURE_LUMINANCE_SIZE */
+ 1711, /* GL_TEXTURE_INTENSITY_SIZE */
+ 1340, /* GL_REPLACE_EXT */
+ 1271, /* GL_PROXY_TEXTURE_1D */
+ 1274, /* GL_PROXY_TEXTURE_2D */
+ 1744, /* GL_TEXTURE_TOO_LARGE_EXT */
+ 1732, /* GL_TEXTURE_PRIORITY */
+ 1739, /* GL_TEXTURE_RESIDENT */
+ 1635, /* GL_TEXTURE_BINDING_1D */
+ 1637, /* GL_TEXTURE_BINDING_2D */
+ 1639, /* GL_TEXTURE_BINDING_3D */
+ 1096, /* GL_PACK_SKIP_IMAGES */
+ 1092, /* GL_PACK_IMAGE_HEIGHT */
+ 1775, /* GL_UNPACK_SKIP_IMAGES */
+ 1772, /* GL_UNPACK_IMAGE_HEIGHT */
+ 1631, /* GL_TEXTURE_3D */
+ 1277, /* GL_PROXY_TEXTURE_3D */
+ 1694, /* GL_TEXTURE_DEPTH */
+ 1747, /* GL_TEXTURE_WRAP_R */
+ 856, /* GL_MAX_3D_TEXTURE_SIZE */
+ 1809, /* GL_VERTEX_ARRAY */
+ 1026, /* GL_NORMAL_ARRAY */
148, /* GL_COLOR_ARRAY */
- 624, /* GL_INDEX_ARRAY */
- 1655, /* GL_TEXTURE_COORD_ARRAY */
- 456, /* GL_EDGE_FLAG_ARRAY */
- 1796, /* GL_VERTEX_ARRAY_SIZE */
- 1798, /* GL_VERTEX_ARRAY_TYPE */
- 1797, /* GL_VERTEX_ARRAY_STRIDE */
- 1021, /* GL_NORMAL_ARRAY_TYPE */
- 1020, /* GL_NORMAL_ARRAY_STRIDE */
+ 631, /* GL_INDEX_ARRAY */
+ 1672, /* GL_TEXTURE_COORD_ARRAY */
+ 459, /* GL_EDGE_FLAG_ARRAY */
+ 1815, /* GL_VERTEX_ARRAY_SIZE */
+ 1817, /* GL_VERTEX_ARRAY_TYPE */
+ 1816, /* GL_VERTEX_ARRAY_STRIDE */
+ 1031, /* GL_NORMAL_ARRAY_TYPE */
+ 1030, /* GL_NORMAL_ARRAY_STRIDE */
152, /* GL_COLOR_ARRAY_SIZE */
154, /* GL_COLOR_ARRAY_TYPE */
153, /* GL_COLOR_ARRAY_STRIDE */
- 629, /* GL_INDEX_ARRAY_TYPE */
- 628, /* GL_INDEX_ARRAY_STRIDE */
- 1659, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- 1661, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- 1660, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- 460, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- 1795, /* GL_VERTEX_ARRAY_POINTER */
- 1019, /* GL_NORMAL_ARRAY_POINTER */
+ 636, /* GL_INDEX_ARRAY_TYPE */
+ 635, /* GL_INDEX_ARRAY_STRIDE */
+ 1676, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ 1678, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ 1677, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ 463, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+ 1814, /* GL_VERTEX_ARRAY_POINTER */
+ 1029, /* GL_NORMAL_ARRAY_POINTER */
151, /* GL_COLOR_ARRAY_POINTER */
- 627, /* GL_INDEX_ARRAY_POINTER */
- 1658, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- 459, /* GL_EDGE_FLAG_ARRAY_POINTER */
- 995, /* GL_MULTISAMPLE */
- 1386, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- 1388, /* GL_SAMPLE_ALPHA_TO_ONE */
- 1393, /* GL_SAMPLE_COVERAGE */
- 1390, /* GL_SAMPLE_BUFFERS */
- 1381, /* GL_SAMPLES */
- 1397, /* GL_SAMPLE_COVERAGE_VALUE */
- 1395, /* GL_SAMPLE_COVERAGE_INVERT */
+ 634, /* GL_INDEX_ARRAY_POINTER */
+ 1675, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ 462, /* GL_EDGE_FLAG_ARRAY_POINTER */
+ 1005, /* GL_MULTISAMPLE */
+ 1399, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ 1401, /* GL_SAMPLE_ALPHA_TO_ONE */
+ 1406, /* GL_SAMPLE_COVERAGE */
+ 1403, /* GL_SAMPLE_BUFFERS */
+ 1394, /* GL_SAMPLES */
+ 1410, /* GL_SAMPLE_COVERAGE_VALUE */
+ 1408, /* GL_SAMPLE_COVERAGE_INVERT */
195, /* GL_COLOR_MATRIX */
197, /* GL_COLOR_MATRIX_STACK_DEPTH */
- 857, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- 1191, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- 1187, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- 1182, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- 1178, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- 1189, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- 1185, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- 1180, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- 1176, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- 1638, /* GL_TEXTURE_COLOR_TABLE_SGI */
- 1268, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- 1640, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ 865, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ 1201, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ 1197, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ 1192, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ 1188, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ 1199, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ 1195, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ 1190, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ 1186, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ 1655, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ 1278, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ 1657, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
80, /* GL_BLEND_DST_RGB */
89, /* GL_BLEND_SRC_RGB */
79, /* GL_BLEND_DST_ALPHA */
88, /* GL_BLEND_SRC_ALPHA */
201, /* GL_COLOR_TABLE */
- 1201, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- 1184, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- 1256, /* GL_PROXY_COLOR_TABLE */
- 1260, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- 1259, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1211, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ 1194, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1266, /* GL_PROXY_COLOR_TABLE */
+ 1270, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ 1269, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
225, /* GL_COLOR_TABLE_SCALE */
205, /* GL_COLOR_TABLE_BIAS */
210, /* GL_COLOR_TABLE_FORMAT */
@@ -4379,380 +4417,380 @@ static const unsigned reduced_enums[1347] =
216, /* GL_COLOR_TABLE_INTENSITY_SIZE */
71, /* GL_BGR */
72, /* GL_BGRA */
- 871, /* GL_MAX_ELEMENTS_VERTICES */
- 870, /* GL_MAX_ELEMENTS_INDICES */
- 1693, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ 879, /* GL_MAX_ELEMENTS_VERTICES */
+ 878, /* GL_MAX_ELEMENTS_INDICES */
+ 1710, /* GL_TEXTURE_INDEX_SIZE_EXT */
145, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
- 1148, /* GL_POINT_SIZE_MIN */
- 1144, /* GL_POINT_SIZE_MAX */
- 1138, /* GL_POINT_FADE_THRESHOLD_SIZE */
- 1134, /* GL_POINT_DISTANCE_ATTENUATION */
+ 1158, /* GL_POINT_SIZE_MIN */
+ 1154, /* GL_POINT_SIZE_MAX */
+ 1148, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ 1144, /* GL_POINT_DISTANCE_ATTENUATION */
127, /* GL_CLAMP_TO_BORDER */
130, /* GL_CLAMP_TO_EDGE */
- 1714, /* GL_TEXTURE_MIN_LOD */
- 1712, /* GL_TEXTURE_MAX_LOD */
- 1617, /* GL_TEXTURE_BASE_LEVEL */
- 1711, /* GL_TEXTURE_MAX_LEVEL */
- 617, /* GL_IGNORE_BORDER_HP */
+ 1731, /* GL_TEXTURE_MIN_LOD */
+ 1729, /* GL_TEXTURE_MAX_LOD */
+ 1634, /* GL_TEXTURE_BASE_LEVEL */
+ 1728, /* GL_TEXTURE_MAX_LEVEL */
+ 624, /* GL_IGNORE_BORDER_HP */
276, /* GL_CONSTANT_BORDER_HP */
- 1328, /* GL_REPLICATE_BORDER_HP */
+ 1341, /* GL_REPLICATE_BORDER_HP */
282, /* GL_CONVOLUTION_BORDER_COLOR */
- 1045, /* GL_OCCLUSION_TEST_HP */
- 1046, /* GL_OCCLUSION_TEST_RESULT_HP */
- 690, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- 1632, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- 1634, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- 1636, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- 1637, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1635, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- 1633, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- 853, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- 854, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1211, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- 1213, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- 1210, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- 1212, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- 1701, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- 1702, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- 1700, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- 587, /* GL_GENERATE_MIPMAP */
- 588, /* GL_GENERATE_MIPMAP_HINT */
- 529, /* GL_FOG_OFFSET_SGIX */
- 530, /* GL_FOG_OFFSET_VALUE_SGIX */
- 1646, /* GL_TEXTURE_COMPARE_SGIX */
- 1645, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- 1697, /* GL_TEXTURE_LEQUAL_R_SGIX */
- 1689, /* GL_TEXTURE_GEQUAL_R_SGIX */
- 359, /* GL_DEPTH_COMPONENT16 */
- 362, /* GL_DEPTH_COMPONENT24 */
- 365, /* GL_DEPTH_COMPONENT32 */
+ 1055, /* GL_OCCLUSION_TEST_HP */
+ 1056, /* GL_OCCLUSION_TEST_RESULT_HP */
+ 697, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ 1649, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ 1651, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ 1653, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ 1654, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1652, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ 1650, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ 860, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ 861, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1221, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ 1223, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ 1220, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ 1222, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ 1718, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ 1719, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ 1717, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ 594, /* GL_GENERATE_MIPMAP */
+ 595, /* GL_GENERATE_MIPMAP_HINT */
+ 532, /* GL_FOG_OFFSET_SGIX */
+ 533, /* GL_FOG_OFFSET_VALUE_SGIX */
+ 1663, /* GL_TEXTURE_COMPARE_SGIX */
+ 1662, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ 1714, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ 1706, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ 360, /* GL_DEPTH_COMPONENT16 */
+ 363, /* GL_DEPTH_COMPONENT24 */
+ 366, /* GL_DEPTH_COMPONENT32 */
306, /* GL_CULL_VERTEX_EXT */
308, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
307, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
- 1853, /* GL_WRAP_BORDER_SUN */
- 1639, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- 683, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- 1427, /* GL_SINGLE_COLOR */
- 1413, /* GL_SEPARATE_SPECULAR_COLOR */
- 1422, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- 540, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
- 541, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
- 548, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
- 543, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
- 539, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
- 538, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
- 542, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
- 549, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
- 560, /* GL_FRAMEBUFFER_DEFAULT */
- 573, /* GL_FRAMEBUFFER_UNDEFINED */
- 372, /* GL_DEPTH_STENCIL_ATTACHMENT */
- 623, /* GL_INDEX */
- 1763, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- 1778, /* GL_UNSIGNED_SHORT_5_6_5 */
- 1779, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- 1776, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- 1774, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- 1771, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- 1769, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- 1709, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- 1710, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- 1708, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- 946, /* GL_MIRRORED_REPEAT */
- 1369, /* GL_RGB_S3TC */
- 1344, /* GL_RGB4_S3TC */
- 1367, /* GL_RGBA_S3TC */
- 1361, /* GL_RGBA4_S3TC */
- 1365, /* GL_RGBA_DXT5_S3TC */
- 1359, /* GL_RGBA4_DXT5_S3TC */
+ 1872, /* GL_WRAP_BORDER_SUN */
+ 1656, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ 690, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ 1440, /* GL_SINGLE_COLOR */
+ 1426, /* GL_SEPARATE_SPECULAR_COLOR */
+ 1435, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ 543, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+ 544, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+ 551, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+ 546, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+ 542, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+ 541, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+ 545, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+ 552, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+ 564, /* GL_FRAMEBUFFER_DEFAULT */
+ 580, /* GL_FRAMEBUFFER_UNDEFINED */
+ 373, /* GL_DEPTH_STENCIL_ATTACHMENT */
+ 630, /* GL_INDEX */
+ 1781, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ 1797, /* GL_UNSIGNED_SHORT_5_6_5 */
+ 1798, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ 1795, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ 1793, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ 1790, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ 1788, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ 1726, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ 1727, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ 1725, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ 956, /* GL_MIRRORED_REPEAT */
+ 1382, /* GL_RGB_S3TC */
+ 1357, /* GL_RGB4_S3TC */
+ 1380, /* GL_RGBA_S3TC */
+ 1374, /* GL_RGBA4_S3TC */
+ 1378, /* GL_RGBA_DXT5_S3TC */
+ 1372, /* GL_RGBA4_DXT5_S3TC */
264, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
259, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
260, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
261, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
- 1007, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- 1006, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- 691, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- 516, /* GL_FOG_COORDINATE_SOURCE */
- 508, /* GL_FOG_COORD */
- 532, /* GL_FRAGMENT_DEPTH */
+ 1017, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ 1016, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ 698, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ 519, /* GL_FOG_COORDINATE_SOURCE */
+ 511, /* GL_FOG_COORD */
+ 535, /* GL_FRAGMENT_DEPTH */
312, /* GL_CURRENT_FOG_COORD */
- 515, /* GL_FOG_COORDINATE_ARRAY_TYPE */
- 514, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
- 513, /* GL_FOG_COORDINATE_ARRAY_POINTER */
- 510, /* GL_FOG_COORDINATE_ARRAY */
+ 518, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+ 517, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+ 516, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+ 513, /* GL_FOG_COORDINATE_ARRAY */
199, /* GL_COLOR_SUM */
332, /* GL_CURRENT_SECONDARY_COLOR */
- 1406, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- 1408, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- 1407, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- 1405, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- 1402, /* GL_SECONDARY_COLOR_ARRAY */
+ 1419, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ 1421, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ 1420, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ 1418, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ 1415, /* GL_SECONDARY_COLOR_ARRAY */
330, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
28, /* GL_ALIASED_POINT_SIZE_RANGE */
27, /* GL_ALIASED_LINE_WIDTH_RANGE */
- 1546, /* GL_TEXTURE0 */
- 1548, /* GL_TEXTURE1 */
- 1570, /* GL_TEXTURE2 */
- 1592, /* GL_TEXTURE3 */
- 1598, /* GL_TEXTURE4 */
- 1600, /* GL_TEXTURE5 */
- 1602, /* GL_TEXTURE6 */
- 1604, /* GL_TEXTURE7 */
- 1606, /* GL_TEXTURE8 */
- 1608, /* GL_TEXTURE9 */
- 1549, /* GL_TEXTURE10 */
- 1551, /* GL_TEXTURE11 */
- 1553, /* GL_TEXTURE12 */
- 1555, /* GL_TEXTURE13 */
- 1557, /* GL_TEXTURE14 */
- 1559, /* GL_TEXTURE15 */
- 1561, /* GL_TEXTURE16 */
- 1563, /* GL_TEXTURE17 */
- 1565, /* GL_TEXTURE18 */
- 1567, /* GL_TEXTURE19 */
- 1571, /* GL_TEXTURE20 */
- 1573, /* GL_TEXTURE21 */
- 1575, /* GL_TEXTURE22 */
- 1577, /* GL_TEXTURE23 */
- 1579, /* GL_TEXTURE24 */
- 1581, /* GL_TEXTURE25 */
- 1583, /* GL_TEXTURE26 */
- 1585, /* GL_TEXTURE27 */
- 1587, /* GL_TEXTURE28 */
- 1589, /* GL_TEXTURE29 */
- 1593, /* GL_TEXTURE30 */
- 1595, /* GL_TEXTURE31 */
+ 1563, /* GL_TEXTURE0 */
+ 1565, /* GL_TEXTURE1 */
+ 1587, /* GL_TEXTURE2 */
+ 1609, /* GL_TEXTURE3 */
+ 1615, /* GL_TEXTURE4 */
+ 1617, /* GL_TEXTURE5 */
+ 1619, /* GL_TEXTURE6 */
+ 1621, /* GL_TEXTURE7 */
+ 1623, /* GL_TEXTURE8 */
+ 1625, /* GL_TEXTURE9 */
+ 1566, /* GL_TEXTURE10 */
+ 1568, /* GL_TEXTURE11 */
+ 1570, /* GL_TEXTURE12 */
+ 1572, /* GL_TEXTURE13 */
+ 1574, /* GL_TEXTURE14 */
+ 1576, /* GL_TEXTURE15 */
+ 1578, /* GL_TEXTURE16 */
+ 1580, /* GL_TEXTURE17 */
+ 1582, /* GL_TEXTURE18 */
+ 1584, /* GL_TEXTURE19 */
+ 1588, /* GL_TEXTURE20 */
+ 1590, /* GL_TEXTURE21 */
+ 1592, /* GL_TEXTURE22 */
+ 1594, /* GL_TEXTURE23 */
+ 1596, /* GL_TEXTURE24 */
+ 1598, /* GL_TEXTURE25 */
+ 1600, /* GL_TEXTURE26 */
+ 1602, /* GL_TEXTURE27 */
+ 1604, /* GL_TEXTURE28 */
+ 1606, /* GL_TEXTURE29 */
+ 1610, /* GL_TEXTURE30 */
+ 1612, /* GL_TEXTURE31 */
18, /* GL_ACTIVE_TEXTURE */
133, /* GL_CLIENT_ACTIVE_TEXTURE */
- 924, /* GL_MAX_TEXTURE_UNITS */
- 1741, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- 1744, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- 1746, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- 1738, /* GL_TRANSPOSE_COLOR_MATRIX */
- 1528, /* GL_SUBTRACT */
- 911, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+ 934, /* GL_MAX_TEXTURE_UNITS */
+ 1759, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ 1762, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ 1764, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ 1756, /* GL_TRANSPOSE_COLOR_MATRIX */
+ 1545, /* GL_SUBTRACT */
+ 919, /* GL_MAX_RENDERBUFFER_SIZE */
247, /* GL_COMPRESSED_ALPHA */
251, /* GL_COMPRESSED_LUMINANCE */
252, /* GL_COMPRESSED_LUMINANCE_ALPHA */
249, /* GL_COMPRESSED_INTENSITY */
255, /* GL_COMPRESSED_RGB */
256, /* GL_COMPRESSED_RGBA */
- 1653, /* GL_TEXTURE_COMPRESSION_HINT */
- 1718, /* GL_TEXTURE_RECTANGLE_ARB */
- 1625, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- 1271, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- 909, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
- 371, /* GL_DEPTH_STENCIL */
- 1767, /* GL_UNSIGNED_INT_24_8 */
- 920, /* GL_MAX_TEXTURE_LOD_BIAS */
- 1707, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- 921, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- 1683, /* GL_TEXTURE_FILTER_CONTROL */
- 1698, /* GL_TEXTURE_LOD_BIAS */
+ 1670, /* GL_TEXTURE_COMPRESSION_HINT */
+ 1735, /* GL_TEXTURE_RECTANGLE_ARB */
+ 1642, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ 1281, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ 917, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ 372, /* GL_DEPTH_STENCIL */
+ 1785, /* GL_UNSIGNED_INT_24_8 */
+ 930, /* GL_MAX_TEXTURE_LOD_BIAS */
+ 1724, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ 931, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ 1700, /* GL_TEXTURE_FILTER_CONTROL */
+ 1715, /* GL_TEXTURE_LOD_BIAS */
232, /* GL_COMBINE4 */
- 914, /* GL_MAX_SHININESS_NV */
- 915, /* GL_MAX_SPOT_EXPONENT_NV */
- 621, /* GL_INCR_WRAP */
+ 924, /* GL_MAX_SHININESS_NV */
+ 925, /* GL_MAX_SPOT_EXPONENT_NV */
+ 628, /* GL_INCR_WRAP */
343, /* GL_DECR_WRAP */
- 966, /* GL_MODELVIEW1_ARB */
- 1022, /* GL_NORMAL_MAP */
- 1303, /* GL_REFLECTION_MAP */
- 1662, /* GL_TEXTURE_CUBE_MAP */
- 1623, /* GL_TEXTURE_BINDING_CUBE_MAP */
- 1670, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- 1664, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- 1672, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- 1666, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- 1674, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- 1668, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- 1269, /* GL_PROXY_TEXTURE_CUBE_MAP */
- 865, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- 1001, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- 524, /* GL_FOG_DISTANCE_MODE_NV */
- 475, /* GL_EYE_RADIAL_NV */
- 474, /* GL_EYE_PLANE_ABSOLUTE_NV */
+ 976, /* GL_MODELVIEW1_ARB */
+ 1032, /* GL_NORMAL_MAP */
+ 1314, /* GL_REFLECTION_MAP */
+ 1679, /* GL_TEXTURE_CUBE_MAP */
+ 1640, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ 1687, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ 1681, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ 1689, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ 1683, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ 1691, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ 1685, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ 1279, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ 873, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ 1011, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ 527, /* GL_FOG_DISTANCE_MODE_NV */
+ 478, /* GL_EYE_RADIAL_NV */
+ 477, /* GL_EYE_PLANE_ABSOLUTE_NV */
231, /* GL_COMBINE */
238, /* GL_COMBINE_RGB */
233, /* GL_COMBINE_ALPHA */
- 1370, /* GL_RGB_SCALE */
+ 1383, /* GL_RGB_SCALE */
24, /* GL_ADD_SIGNED */
- 649, /* GL_INTERPOLATE */
+ 656, /* GL_INTERPOLATE */
271, /* GL_CONSTANT */
- 1217, /* GL_PRIMARY_COLOR */
- 1214, /* GL_PREVIOUS */
- 1442, /* GL_SOURCE0_RGB */
- 1448, /* GL_SOURCE1_RGB */
- 1454, /* GL_SOURCE2_RGB */
- 1458, /* GL_SOURCE3_RGB_NV */
- 1439, /* GL_SOURCE0_ALPHA */
- 1445, /* GL_SOURCE1_ALPHA */
- 1451, /* GL_SOURCE2_ALPHA */
- 1457, /* GL_SOURCE3_ALPHA_NV */
- 1059, /* GL_OPERAND0_RGB */
- 1065, /* GL_OPERAND1_RGB */
- 1071, /* GL_OPERAND2_RGB */
- 1075, /* GL_OPERAND3_RGB_NV */
- 1056, /* GL_OPERAND0_ALPHA */
- 1062, /* GL_OPERAND1_ALPHA */
- 1068, /* GL_OPERAND2_ALPHA */
- 1074, /* GL_OPERAND3_ALPHA_NV */
- 1791, /* GL_VERTEX_ARRAY_BINDING */
- 1716, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- 1717, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- 1857, /* GL_YCBCR_422_APPLE */
- 1780, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- 1782, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- 1725, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- 1519, /* GL_STORAGE_PRIVATE_APPLE */
- 1518, /* GL_STORAGE_CACHED_APPLE */
- 1520, /* GL_STORAGE_SHARED_APPLE */
- 1429, /* GL_SLICE_ACCUM_SUN */
- 1278, /* GL_QUAD_MESH_SUN */
- 1750, /* GL_TRIANGLE_MESH_SUN */
- 1830, /* GL_VERTEX_PROGRAM_ARB */
- 1841, /* GL_VERTEX_STATE_PROGRAM_NV */
- 1817, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- 1823, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- 1825, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- 1827, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ 1227, /* GL_PRIMARY_COLOR */
+ 1224, /* GL_PREVIOUS */
+ 1455, /* GL_SOURCE0_RGB */
+ 1461, /* GL_SOURCE1_RGB */
+ 1467, /* GL_SOURCE2_RGB */
+ 1471, /* GL_SOURCE3_RGB_NV */
+ 1452, /* GL_SOURCE0_ALPHA */
+ 1458, /* GL_SOURCE1_ALPHA */
+ 1464, /* GL_SOURCE2_ALPHA */
+ 1470, /* GL_SOURCE3_ALPHA_NV */
+ 1069, /* GL_OPERAND0_RGB */
+ 1075, /* GL_OPERAND1_RGB */
+ 1081, /* GL_OPERAND2_RGB */
+ 1085, /* GL_OPERAND3_RGB_NV */
+ 1066, /* GL_OPERAND0_ALPHA */
+ 1072, /* GL_OPERAND1_ALPHA */
+ 1078, /* GL_OPERAND2_ALPHA */
+ 1084, /* GL_OPERAND3_ALPHA_NV */
+ 1810, /* GL_VERTEX_ARRAY_BINDING */
+ 1733, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ 1734, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ 1876, /* GL_YCBCR_422_APPLE */
+ 1799, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ 1801, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ 1743, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ 1536, /* GL_STORAGE_PRIVATE_APPLE */
+ 1535, /* GL_STORAGE_CACHED_APPLE */
+ 1537, /* GL_STORAGE_SHARED_APPLE */
+ 1442, /* GL_SLICE_ACCUM_SUN */
+ 1288, /* GL_QUAD_MESH_SUN */
+ 1768, /* GL_TRIANGLE_MESH_SUN */
+ 1849, /* GL_VERTEX_PROGRAM_ARB */
+ 1860, /* GL_VERTEX_STATE_PROGRAM_NV */
+ 1836, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ 1842, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ 1844, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ 1846, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
334, /* GL_CURRENT_VERTEX_ATTRIB */
- 1230, /* GL_PROGRAM_LENGTH_ARB */
- 1244, /* GL_PROGRAM_STRING_ARB */
- 988, /* GL_MODELVIEW_PROJECTION_NV */
- 616, /* GL_IDENTITY_NV */
- 663, /* GL_INVERSE_NV */
- 1743, /* GL_TRANSPOSE_NV */
- 664, /* GL_INVERSE_TRANSPOSE_NV */
- 895, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- 894, /* GL_MAX_PROGRAM_MATRICES_ARB */
- 802, /* GL_MATRIX0_NV */
- 814, /* GL_MATRIX1_NV */
- 826, /* GL_MATRIX2_NV */
- 830, /* GL_MATRIX3_NV */
- 832, /* GL_MATRIX4_NV */
- 834, /* GL_MATRIX5_NV */
- 836, /* GL_MATRIX6_NV */
- 838, /* GL_MATRIX7_NV */
+ 1240, /* GL_PROGRAM_LENGTH_ARB */
+ 1254, /* GL_PROGRAM_STRING_ARB */
+ 998, /* GL_MODELVIEW_PROJECTION_NV */
+ 623, /* GL_IDENTITY_NV */
+ 670, /* GL_INVERSE_NV */
+ 1761, /* GL_TRANSPOSE_NV */
+ 671, /* GL_INVERSE_TRANSPOSE_NV */
+ 903, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ 902, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ 809, /* GL_MATRIX0_NV */
+ 821, /* GL_MATRIX1_NV */
+ 833, /* GL_MATRIX2_NV */
+ 837, /* GL_MATRIX3_NV */
+ 839, /* GL_MATRIX4_NV */
+ 841, /* GL_MATRIX5_NV */
+ 843, /* GL_MATRIX6_NV */
+ 845, /* GL_MATRIX7_NV */
318, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
315, /* GL_CURRENT_MATRIX_ARB */
- 1833, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- 1836, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- 1242, /* GL_PROGRAM_PARAMETER_NV */
- 1821, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- 1246, /* GL_PROGRAM_TARGET_NV */
- 1243, /* GL_PROGRAM_RESIDENT_NV */
- 1735, /* GL_TRACK_MATRIX_NV */
- 1736, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- 1831, /* GL_VERTEX_PROGRAM_BINDING_NV */
- 1224, /* GL_PROGRAM_ERROR_POSITION_ARB */
- 355, /* GL_DEPTH_CLAMP */
- 1799, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- 1806, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- 1807, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- 1808, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- 1809, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- 1810, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- 1811, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- 1812, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- 1813, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- 1814, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- 1800, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- 1801, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- 1802, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- 1803, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- 1804, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- 1805, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- 750, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- 757, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- 758, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- 759, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- 760, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- 761, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- 762, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- 763, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- 764, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- 765, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- 751, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- 752, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- 753, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- 754, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- 755, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- 756, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- 777, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- 784, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- 785, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- 786, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- 787, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- 788, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- 789, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- 1223, /* GL_PROGRAM_BINDING_ARB */
- 791, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- 792, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- 778, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- 779, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- 780, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- 781, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- 782, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- 783, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- 1651, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- 1648, /* GL_TEXTURE_COMPRESSED */
- 1027, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ 1852, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ 1855, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ 1252, /* GL_PROGRAM_PARAMETER_NV */
+ 1840, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ 1256, /* GL_PROGRAM_TARGET_NV */
+ 1253, /* GL_PROGRAM_RESIDENT_NV */
+ 1753, /* GL_TRACK_MATRIX_NV */
+ 1754, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ 1850, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ 1234, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ 356, /* GL_DEPTH_CLAMP */
+ 1818, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ 1825, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ 1826, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ 1827, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ 1828, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ 1829, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ 1830, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ 1831, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ 1832, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ 1833, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ 1819, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ 1820, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ 1821, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ 1822, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ 1823, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ 1824, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ 757, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ 764, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ 765, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ 766, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ 767, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ 768, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ 769, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ 770, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ 771, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ 772, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ 758, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ 759, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ 760, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ 761, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ 762, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ 763, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ 784, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ 791, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ 792, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ 793, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ 794, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ 795, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ 796, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ 1233, /* GL_PROGRAM_BINDING_ARB */
+ 798, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ 799, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ 785, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ 786, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ 787, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ 788, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ 789, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ 790, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ 1668, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ 1665, /* GL_TEXTURE_COMPRESSED */
+ 1037, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
269, /* GL_COMPRESSED_TEXTURE_FORMATS */
- 936, /* GL_MAX_VERTEX_UNITS_ARB */
+ 946, /* GL_MAX_VERTEX_UNITS_ARB */
22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
- 1852, /* GL_WEIGHT_SUM_UNITY_ARB */
- 1829, /* GL_VERTEX_BLEND_ARB */
+ 1871, /* GL_WEIGHT_SUM_UNITY_ARB */
+ 1848, /* GL_VERTEX_BLEND_ARB */
336, /* GL_CURRENT_WEIGHT_ARB */
- 1851, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- 1850, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- 1849, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- 1848, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- 1845, /* GL_WEIGHT_ARRAY_ARB */
- 384, /* GL_DOT3_RGB */
- 385, /* GL_DOT3_RGBA */
+ 1870, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ 1869, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ 1868, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ 1867, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ 1864, /* GL_WEIGHT_ARRAY_ARB */
+ 386, /* GL_DOT3_RGB */
+ 387, /* GL_DOT3_RGBA */
263, /* GL_COMPRESSED_RGB_FXT1_3DFX */
258, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
- 996, /* GL_MULTISAMPLE_3DFX */
- 1391, /* GL_SAMPLE_BUFFERS_3DFX */
- 1382, /* GL_SAMPLES_3DFX */
- 977, /* GL_MODELVIEW2_ARB */
- 980, /* GL_MODELVIEW3_ARB */
- 981, /* GL_MODELVIEW4_ARB */
- 982, /* GL_MODELVIEW5_ARB */
- 983, /* GL_MODELVIEW6_ARB */
- 984, /* GL_MODELVIEW7_ARB */
- 985, /* GL_MODELVIEW8_ARB */
- 986, /* GL_MODELVIEW9_ARB */
- 956, /* GL_MODELVIEW10_ARB */
- 957, /* GL_MODELVIEW11_ARB */
- 958, /* GL_MODELVIEW12_ARB */
- 959, /* GL_MODELVIEW13_ARB */
- 960, /* GL_MODELVIEW14_ARB */
- 961, /* GL_MODELVIEW15_ARB */
- 962, /* GL_MODELVIEW16_ARB */
- 963, /* GL_MODELVIEW17_ARB */
- 964, /* GL_MODELVIEW18_ARB */
- 965, /* GL_MODELVIEW19_ARB */
- 967, /* GL_MODELVIEW20_ARB */
- 968, /* GL_MODELVIEW21_ARB */
- 969, /* GL_MODELVIEW22_ARB */
- 970, /* GL_MODELVIEW23_ARB */
- 971, /* GL_MODELVIEW24_ARB */
- 972, /* GL_MODELVIEW25_ARB */
- 973, /* GL_MODELVIEW26_ARB */
- 974, /* GL_MODELVIEW27_ARB */
- 975, /* GL_MODELVIEW28_ARB */
- 976, /* GL_MODELVIEW29_ARB */
- 978, /* GL_MODELVIEW30_ARB */
- 979, /* GL_MODELVIEW31_ARB */
- 389, /* GL_DOT3_RGB_EXT */
- 387, /* GL_DOT3_RGBA_EXT */
- 950, /* GL_MIRROR_CLAMP_EXT */
- 953, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- 991, /* GL_MODULATE_ADD_ATI */
- 992, /* GL_MODULATE_SIGNED_ADD_ATI */
- 993, /* GL_MODULATE_SUBTRACT_ATI */
- 1858, /* GL_YCBCR_MESA */
- 1083, /* GL_PACK_INVERT_MESA */
+ 1006, /* GL_MULTISAMPLE_3DFX */
+ 1404, /* GL_SAMPLE_BUFFERS_3DFX */
+ 1395, /* GL_SAMPLES_3DFX */
+ 987, /* GL_MODELVIEW2_ARB */
+ 990, /* GL_MODELVIEW3_ARB */
+ 991, /* GL_MODELVIEW4_ARB */
+ 992, /* GL_MODELVIEW5_ARB */
+ 993, /* GL_MODELVIEW6_ARB */
+ 994, /* GL_MODELVIEW7_ARB */
+ 995, /* GL_MODELVIEW8_ARB */
+ 996, /* GL_MODELVIEW9_ARB */
+ 966, /* GL_MODELVIEW10_ARB */
+ 967, /* GL_MODELVIEW11_ARB */
+ 968, /* GL_MODELVIEW12_ARB */
+ 969, /* GL_MODELVIEW13_ARB */
+ 970, /* GL_MODELVIEW14_ARB */
+ 971, /* GL_MODELVIEW15_ARB */
+ 972, /* GL_MODELVIEW16_ARB */
+ 973, /* GL_MODELVIEW17_ARB */
+ 974, /* GL_MODELVIEW18_ARB */
+ 975, /* GL_MODELVIEW19_ARB */
+ 977, /* GL_MODELVIEW20_ARB */
+ 978, /* GL_MODELVIEW21_ARB */
+ 979, /* GL_MODELVIEW22_ARB */
+ 980, /* GL_MODELVIEW23_ARB */
+ 981, /* GL_MODELVIEW24_ARB */
+ 982, /* GL_MODELVIEW25_ARB */
+ 983, /* GL_MODELVIEW26_ARB */
+ 984, /* GL_MODELVIEW27_ARB */
+ 985, /* GL_MODELVIEW28_ARB */
+ 986, /* GL_MODELVIEW29_ARB */
+ 988, /* GL_MODELVIEW30_ARB */
+ 989, /* GL_MODELVIEW31_ARB */
+ 391, /* GL_DOT3_RGB_EXT */
+ 389, /* GL_DOT3_RGBA_EXT */
+ 960, /* GL_MIRROR_CLAMP_EXT */
+ 963, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ 1001, /* GL_MODULATE_ADD_ATI */
+ 1002, /* GL_MODULATE_SIGNED_ADD_ATI */
+ 1003, /* GL_MODULATE_SUBTRACT_ATI */
+ 1877, /* GL_YCBCR_MESA */
+ 1093, /* GL_PACK_INVERT_MESA */
339, /* GL_DEBUG_OBJECT_MESA */
340, /* GL_DEBUG_PRINT_MESA */
338, /* GL_DEBUG_ASSERT_MESA */
@@ -4762,292 +4800,292 @@ static const unsigned reduced_enums[1347] =
117, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
115, /* GL_BUMP_NUM_TEX_UNITS_ATI */
119, /* GL_BUMP_TEX_UNITS_ATI */
- 448, /* GL_DUDV_ATI */
- 447, /* GL_DU8DV8_ATI */
+ 451, /* GL_DUDV_ATI */
+ 450, /* GL_DU8DV8_ATI */
114, /* GL_BUMP_ENVMAP_ATI */
118, /* GL_BUMP_TARGET_ATI */
- 1490, /* GL_STENCIL_BACK_FUNC */
- 1488, /* GL_STENCIL_BACK_FAIL */
- 1492, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- 1494, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- 533, /* GL_FRAGMENT_PROGRAM_ARB */
- 1221, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 1249, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 1248, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- 1233, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 1239, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 1238, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 884, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 907, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 906, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- 897, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 903, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 902, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 867, /* GL_MAX_DRAW_BUFFERS */
- 393, /* GL_DRAW_BUFFER0 */
- 396, /* GL_DRAW_BUFFER1 */
- 417, /* GL_DRAW_BUFFER2 */
- 420, /* GL_DRAW_BUFFER3 */
- 423, /* GL_DRAW_BUFFER4 */
- 426, /* GL_DRAW_BUFFER5 */
- 429, /* GL_DRAW_BUFFER6 */
- 432, /* GL_DRAW_BUFFER7 */
- 435, /* GL_DRAW_BUFFER8 */
- 438, /* GL_DRAW_BUFFER9 */
- 397, /* GL_DRAW_BUFFER10 */
- 400, /* GL_DRAW_BUFFER11 */
- 403, /* GL_DRAW_BUFFER12 */
- 406, /* GL_DRAW_BUFFER13 */
- 409, /* GL_DRAW_BUFFER14 */
- 412, /* GL_DRAW_BUFFER15 */
+ 1503, /* GL_STENCIL_BACK_FUNC */
+ 1501, /* GL_STENCIL_BACK_FAIL */
+ 1505, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ 1507, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ 536, /* GL_FRAGMENT_PROGRAM_ARB */
+ 1231, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 1259, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 1258, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 1243, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 1249, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 1248, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 892, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 915, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 914, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 905, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 911, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 910, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 875, /* GL_MAX_DRAW_BUFFERS */
+ 395, /* GL_DRAW_BUFFER0 */
+ 398, /* GL_DRAW_BUFFER1 */
+ 419, /* GL_DRAW_BUFFER2 */
+ 422, /* GL_DRAW_BUFFER3 */
+ 425, /* GL_DRAW_BUFFER4 */
+ 428, /* GL_DRAW_BUFFER5 */
+ 431, /* GL_DRAW_BUFFER6 */
+ 434, /* GL_DRAW_BUFFER7 */
+ 437, /* GL_DRAW_BUFFER8 */
+ 440, /* GL_DRAW_BUFFER9 */
+ 399, /* GL_DRAW_BUFFER10 */
+ 402, /* GL_DRAW_BUFFER11 */
+ 405, /* GL_DRAW_BUFFER12 */
+ 408, /* GL_DRAW_BUFFER13 */
+ 411, /* GL_DRAW_BUFFER14 */
+ 414, /* GL_DRAW_BUFFER15 */
82, /* GL_BLEND_EQUATION_ALPHA */
- 847, /* GL_MATRIX_PALETTE_ARB */
- 878, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- 881, /* GL_MAX_PALETTE_MATRICES_ARB */
+ 854, /* GL_MATRIX_PALETTE_ARB */
+ 886, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ 889, /* GL_MAX_PALETTE_MATRICES_ARB */
321, /* GL_CURRENT_PALETTE_MATRIX_ARB */
- 841, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ 848, /* GL_MATRIX_INDEX_ARRAY_ARB */
316, /* GL_CURRENT_MATRIX_INDEX_ARB */
- 843, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- 845, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- 844, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- 842, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- 1678, /* GL_TEXTURE_DEPTH_SIZE */
- 377, /* GL_DEPTH_TEXTURE_MODE */
- 1643, /* GL_TEXTURE_COMPARE_MODE */
- 1641, /* GL_TEXTURE_COMPARE_FUNC */
+ 850, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ 852, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ 851, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ 849, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ 1695, /* GL_TEXTURE_DEPTH_SIZE */
+ 379, /* GL_DEPTH_TEXTURE_MODE */
+ 1660, /* GL_TEXTURE_COMPARE_MODE */
+ 1658, /* GL_TEXTURE_COMPARE_FUNC */
242, /* GL_COMPARE_R_TO_TEXTURE */
- 1155, /* GL_POINT_SPRITE */
+ 1165, /* GL_POINT_SPRITE */
296, /* GL_COORD_REPLACE */
- 1159, /* GL_POINT_SPRITE_R_MODE_NV */
- 1280, /* GL_QUERY_COUNTER_BITS */
+ 1169, /* GL_POINT_SPRITE_R_MODE_NV */
+ 1290, /* GL_QUERY_COUNTER_BITS */
323, /* GL_CURRENT_QUERY */
- 1282, /* GL_QUERY_RESULT */
- 1284, /* GL_QUERY_RESULT_AVAILABLE */
- 930, /* GL_MAX_VERTEX_ATTRIBS */
- 1819, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- 375, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
- 374, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- 916, /* GL_MAX_TEXTURE_COORDS */
- 918, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- 1226, /* GL_PROGRAM_ERROR_STRING_ARB */
- 1228, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- 1227, /* GL_PROGRAM_FORMAT_ARB */
- 1727, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- 353, /* GL_DEPTH_BOUNDS_TEST_EXT */
- 352, /* GL_DEPTH_BOUNDS_EXT */
+ 1292, /* GL_QUERY_RESULT */
+ 1294, /* GL_QUERY_RESULT_AVAILABLE */
+ 940, /* GL_MAX_VERTEX_ATTRIBS */
+ 1838, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ 377, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+ 376, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+ 926, /* GL_MAX_TEXTURE_COORDS */
+ 928, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ 1236, /* GL_PROGRAM_ERROR_STRING_ARB */
+ 1238, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ 1237, /* GL_PROGRAM_FORMAT_ARB */
+ 1745, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ 354, /* GL_DEPTH_BOUNDS_TEST_EXT */
+ 353, /* GL_DEPTH_BOUNDS_EXT */
53, /* GL_ARRAY_BUFFER */
- 461, /* GL_ELEMENT_ARRAY_BUFFER */
+ 464, /* GL_ELEMENT_ARRAY_BUFFER */
54, /* GL_ARRAY_BUFFER_BINDING */
- 462, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- 1793, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- 1017, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ 465, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+ 1812, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ 1027, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
149, /* GL_COLOR_ARRAY_BUFFER_BINDING */
- 625, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- 1656, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- 457, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- 1403, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- 511, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- 1846, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- 1815, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- 1229, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- 890, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- 1235, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 899, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 1247, /* GL_PROGRAM_TEMPORARIES_ARB */
- 905, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- 1237, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 901, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 1241, /* GL_PROGRAM_PARAMETERS_ARB */
- 904, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- 1236, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- 900, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- 1222, /* GL_PROGRAM_ATTRIBS_ARB */
- 885, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- 1234, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- 898, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- 1220, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- 883, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- 1232, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 896, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 891, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- 887, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- 1250, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- 1740, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- 1293, /* GL_READ_ONLY */
- 1854, /* GL_WRITE_ONLY */
- 1295, /* GL_READ_WRITE */
+ 632, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+ 1673, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ 460, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+ 1416, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ 514, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+ 1865, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ 1834, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ 1239, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ 898, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ 1245, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 907, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 1257, /* GL_PROGRAM_TEMPORARIES_ARB */
+ 913, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ 1247, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 909, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 1251, /* GL_PROGRAM_PARAMETERS_ARB */
+ 912, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ 1246, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 908, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 1232, /* GL_PROGRAM_ATTRIBS_ARB */
+ 893, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ 1244, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 906, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 1230, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 891, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 1242, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 904, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 899, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ 895, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ 1260, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ 1758, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ 1304, /* GL_READ_ONLY */
+ 1873, /* GL_WRITE_ONLY */
+ 1306, /* GL_READ_WRITE */
102, /* GL_BUFFER_ACCESS */
105, /* GL_BUFFER_MAPPED */
107, /* GL_BUFFER_MAP_POINTER */
- 1734, /* GL_TIME_ELAPSED_EXT */
- 801, /* GL_MATRIX0_ARB */
- 813, /* GL_MATRIX1_ARB */
- 825, /* GL_MATRIX2_ARB */
- 829, /* GL_MATRIX3_ARB */
- 831, /* GL_MATRIX4_ARB */
- 833, /* GL_MATRIX5_ARB */
- 835, /* GL_MATRIX6_ARB */
- 837, /* GL_MATRIX7_ARB */
- 839, /* GL_MATRIX8_ARB */
- 840, /* GL_MATRIX9_ARB */
- 803, /* GL_MATRIX10_ARB */
- 804, /* GL_MATRIX11_ARB */
- 805, /* GL_MATRIX12_ARB */
- 806, /* GL_MATRIX13_ARB */
- 807, /* GL_MATRIX14_ARB */
- 808, /* GL_MATRIX15_ARB */
- 809, /* GL_MATRIX16_ARB */
- 810, /* GL_MATRIX17_ARB */
- 811, /* GL_MATRIX18_ARB */
- 812, /* GL_MATRIX19_ARB */
- 815, /* GL_MATRIX20_ARB */
- 816, /* GL_MATRIX21_ARB */
- 817, /* GL_MATRIX22_ARB */
- 818, /* GL_MATRIX23_ARB */
- 819, /* GL_MATRIX24_ARB */
- 820, /* GL_MATRIX25_ARB */
- 821, /* GL_MATRIX26_ARB */
- 822, /* GL_MATRIX27_ARB */
- 823, /* GL_MATRIX28_ARB */
- 824, /* GL_MATRIX29_ARB */
- 827, /* GL_MATRIX30_ARB */
- 828, /* GL_MATRIX31_ARB */
- 1523, /* GL_STREAM_DRAW */
- 1525, /* GL_STREAM_READ */
- 1521, /* GL_STREAM_COPY */
- 1481, /* GL_STATIC_DRAW */
- 1483, /* GL_STATIC_READ */
- 1479, /* GL_STATIC_COPY */
- 451, /* GL_DYNAMIC_DRAW */
- 453, /* GL_DYNAMIC_READ */
- 449, /* GL_DYNAMIC_COPY */
- 1123, /* GL_PIXEL_PACK_BUFFER */
- 1127, /* GL_PIXEL_UNPACK_BUFFER */
- 1124, /* GL_PIXEL_PACK_BUFFER_BINDING */
- 1128, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ 1752, /* GL_TIME_ELAPSED_EXT */
+ 808, /* GL_MATRIX0_ARB */
+ 820, /* GL_MATRIX1_ARB */
+ 832, /* GL_MATRIX2_ARB */
+ 836, /* GL_MATRIX3_ARB */
+ 838, /* GL_MATRIX4_ARB */
+ 840, /* GL_MATRIX5_ARB */
+ 842, /* GL_MATRIX6_ARB */
+ 844, /* GL_MATRIX7_ARB */
+ 846, /* GL_MATRIX8_ARB */
+ 847, /* GL_MATRIX9_ARB */
+ 810, /* GL_MATRIX10_ARB */
+ 811, /* GL_MATRIX11_ARB */
+ 812, /* GL_MATRIX12_ARB */
+ 813, /* GL_MATRIX13_ARB */
+ 814, /* GL_MATRIX14_ARB */
+ 815, /* GL_MATRIX15_ARB */
+ 816, /* GL_MATRIX16_ARB */
+ 817, /* GL_MATRIX17_ARB */
+ 818, /* GL_MATRIX18_ARB */
+ 819, /* GL_MATRIX19_ARB */
+ 822, /* GL_MATRIX20_ARB */
+ 823, /* GL_MATRIX21_ARB */
+ 824, /* GL_MATRIX22_ARB */
+ 825, /* GL_MATRIX23_ARB */
+ 826, /* GL_MATRIX24_ARB */
+ 827, /* GL_MATRIX25_ARB */
+ 828, /* GL_MATRIX26_ARB */
+ 829, /* GL_MATRIX27_ARB */
+ 830, /* GL_MATRIX28_ARB */
+ 831, /* GL_MATRIX29_ARB */
+ 834, /* GL_MATRIX30_ARB */
+ 835, /* GL_MATRIX31_ARB */
+ 1540, /* GL_STREAM_DRAW */
+ 1542, /* GL_STREAM_READ */
+ 1538, /* GL_STREAM_COPY */
+ 1494, /* GL_STATIC_DRAW */
+ 1496, /* GL_STATIC_READ */
+ 1492, /* GL_STATIC_COPY */
+ 454, /* GL_DYNAMIC_DRAW */
+ 456, /* GL_DYNAMIC_READ */
+ 452, /* GL_DYNAMIC_COPY */
+ 1133, /* GL_PIXEL_PACK_BUFFER */
+ 1137, /* GL_PIXEL_UNPACK_BUFFER */
+ 1134, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ 1138, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
347, /* GL_DEPTH24_STENCIL8 */
- 1724, /* GL_TEXTURE_STENCIL_SIZE */
- 1676, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- 886, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- 889, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- 893, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- 892, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- 850, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- 1514, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ 1741, /* GL_TEXTURE_STENCIL_SIZE */
+ 1693, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ 894, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ 897, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ 901, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ 900, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ 857, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ 1531, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
17, /* GL_ACTIVE_STENCIL_FACE_EXT */
- 951, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- 1384, /* GL_SAMPLES_PASSED */
+ 961, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ 1397, /* GL_SAMPLES_PASSED */
109, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
- 534, /* GL_FRAGMENT_SHADER */
- 1839, /* GL_VERTEX_SHADER */
- 1240, /* GL_PROGRAM_OBJECT_ARB */
- 1416, /* GL_SHADER_OBJECT_ARB */
- 874, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- 934, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- 928, /* GL_MAX_VARYING_FLOATS */
- 932, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- 859, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- 1043, /* GL_OBJECT_TYPE_ARB */
- 1418, /* GL_SHADER_TYPE */
- 499, /* GL_FLOAT_VEC2 */
- 501, /* GL_FLOAT_VEC3 */
- 503, /* GL_FLOAT_VEC4 */
- 652, /* GL_INT_VEC2 */
- 654, /* GL_INT_VEC3 */
- 656, /* GL_INT_VEC4 */
+ 537, /* GL_FRAGMENT_SHADER */
+ 1858, /* GL_VERTEX_SHADER */
+ 1250, /* GL_PROGRAM_OBJECT_ARB */
+ 1429, /* GL_SHADER_OBJECT_ARB */
+ 882, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ 944, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ 938, /* GL_MAX_VARYING_FLOATS */
+ 942, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ 867, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ 1053, /* GL_OBJECT_TYPE_ARB */
+ 1431, /* GL_SHADER_TYPE */
+ 502, /* GL_FLOAT_VEC2 */
+ 504, /* GL_FLOAT_VEC3 */
+ 506, /* GL_FLOAT_VEC4 */
+ 659, /* GL_INT_VEC2 */
+ 661, /* GL_INT_VEC3 */
+ 663, /* GL_INT_VEC4 */
94, /* GL_BOOL */
96, /* GL_BOOL_VEC2 */
98, /* GL_BOOL_VEC3 */
100, /* GL_BOOL_VEC4 */
- 487, /* GL_FLOAT_MAT2 */
- 491, /* GL_FLOAT_MAT3 */
- 495, /* GL_FLOAT_MAT4 */
- 1375, /* GL_SAMPLER_1D */
- 1377, /* GL_SAMPLER_2D */
- 1379, /* GL_SAMPLER_3D */
- 1380, /* GL_SAMPLER_CUBE */
- 1376, /* GL_SAMPLER_1D_SHADOW */
- 1378, /* GL_SAMPLER_2D_SHADOW */
- 489, /* GL_FLOAT_MAT2x3 */
- 490, /* GL_FLOAT_MAT2x4 */
- 493, /* GL_FLOAT_MAT3x2 */
- 494, /* GL_FLOAT_MAT3x4 */
- 497, /* GL_FLOAT_MAT4x2 */
- 498, /* GL_FLOAT_MAT4x3 */
+ 490, /* GL_FLOAT_MAT2 */
+ 494, /* GL_FLOAT_MAT3 */
+ 498, /* GL_FLOAT_MAT4 */
+ 1388, /* GL_SAMPLER_1D */
+ 1390, /* GL_SAMPLER_2D */
+ 1392, /* GL_SAMPLER_3D */
+ 1393, /* GL_SAMPLER_CUBE */
+ 1389, /* GL_SAMPLER_1D_SHADOW */
+ 1391, /* GL_SAMPLER_2D_SHADOW */
+ 492, /* GL_FLOAT_MAT2x3 */
+ 493, /* GL_FLOAT_MAT2x4 */
+ 496, /* GL_FLOAT_MAT3x2 */
+ 497, /* GL_FLOAT_MAT3x4 */
+ 500, /* GL_FLOAT_MAT4x2 */
+ 501, /* GL_FLOAT_MAT4x3 */
345, /* GL_DELETE_STATUS */
246, /* GL_COMPILE_STATUS */
- 708, /* GL_LINK_STATUS */
- 1787, /* GL_VALIDATE_STATUS */
- 637, /* GL_INFO_LOG_LENGTH */
+ 715, /* GL_LINK_STATUS */
+ 1806, /* GL_VALIDATE_STATUS */
+ 644, /* GL_INFO_LOG_LENGTH */
56, /* GL_ATTACHED_SHADERS */
20, /* GL_ACTIVE_UNIFORMS */
21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
- 1417, /* GL_SHADER_SOURCE_LENGTH */
+ 1430, /* GL_SHADER_SOURCE_LENGTH */
15, /* GL_ACTIVE_ATTRIBUTES */
16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
- 536, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- 1420, /* GL_SHADING_LANGUAGE_VERSION */
+ 539, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+ 1433, /* GL_SHADING_LANGUAGE_VERSION */
322, /* GL_CURRENT_PROGRAM */
- 1092, /* GL_PALETTE4_RGB8_OES */
- 1094, /* GL_PALETTE4_RGBA8_OES */
- 1090, /* GL_PALETTE4_R5_G6_B5_OES */
- 1093, /* GL_PALETTE4_RGBA4_OES */
- 1091, /* GL_PALETTE4_RGB5_A1_OES */
- 1097, /* GL_PALETTE8_RGB8_OES */
- 1099, /* GL_PALETTE8_RGBA8_OES */
- 1095, /* GL_PALETTE8_R5_G6_B5_OES */
- 1098, /* GL_PALETTE8_RGBA4_OES */
- 1096, /* GL_PALETTE8_RGB5_A1_OES */
- 619, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- 618, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- 1772, /* GL_UNSIGNED_NORMALIZED */
- 1611, /* GL_TEXTURE_1D_ARRAY_EXT */
- 1262, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- 1613, /* GL_TEXTURE_2D_ARRAY_EXT */
- 1265, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- 1619, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- 1621, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- 1473, /* GL_SRGB */
- 1474, /* GL_SRGB8 */
- 1476, /* GL_SRGB_ALPHA */
- 1475, /* GL_SRGB8_ALPHA8 */
- 1433, /* GL_SLUMINANCE_ALPHA */
- 1432, /* GL_SLUMINANCE8_ALPHA8 */
- 1430, /* GL_SLUMINANCE */
- 1431, /* GL_SLUMINANCE8 */
+ 1102, /* GL_PALETTE4_RGB8_OES */
+ 1104, /* GL_PALETTE4_RGBA8_OES */
+ 1100, /* GL_PALETTE4_R5_G6_B5_OES */
+ 1103, /* GL_PALETTE4_RGBA4_OES */
+ 1101, /* GL_PALETTE4_RGB5_A1_OES */
+ 1107, /* GL_PALETTE8_RGB8_OES */
+ 1109, /* GL_PALETTE8_RGBA8_OES */
+ 1105, /* GL_PALETTE8_R5_G6_B5_OES */
+ 1108, /* GL_PALETTE8_RGBA4_OES */
+ 1106, /* GL_PALETTE8_RGB5_A1_OES */
+ 626, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+ 625, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+ 1791, /* GL_UNSIGNED_NORMALIZED */
+ 1628, /* GL_TEXTURE_1D_ARRAY_EXT */
+ 1272, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ 1630, /* GL_TEXTURE_2D_ARRAY_EXT */
+ 1275, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ 1636, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ 1638, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ 1486, /* GL_SRGB */
+ 1487, /* GL_SRGB8 */
+ 1489, /* GL_SRGB_ALPHA */
+ 1488, /* GL_SRGB8_ALPHA8 */
+ 1446, /* GL_SLUMINANCE_ALPHA */
+ 1445, /* GL_SLUMINANCE8_ALPHA8 */
+ 1443, /* GL_SLUMINANCE */
+ 1444, /* GL_SLUMINANCE8 */
267, /* GL_COMPRESSED_SRGB */
268, /* GL_COMPRESSED_SRGB_ALPHA */
265, /* GL_COMPRESSED_SLUMINANCE */
266, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
- 1157, /* GL_POINT_SPRITE_COORD_ORIGIN */
- 716, /* GL_LOWER_LEFT */
- 1784, /* GL_UPPER_LEFT */
- 1496, /* GL_STENCIL_BACK_REF */
- 1497, /* GL_STENCIL_BACK_VALUE_MASK */
- 1498, /* GL_STENCIL_BACK_WRITEMASK */
- 442, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
- 1309, /* GL_RENDERBUFFER_BINDING_EXT */
- 1290, /* GL_READ_FRAMEBUFFER */
- 441, /* GL_DRAW_FRAMEBUFFER */
- 1291, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
- 1319, /* GL_RENDERBUFFER_SAMPLES */
- 546, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
- 544, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
- 555, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
- 551, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
- 553, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
- 558, /* GL_FRAMEBUFFER_COMPLETE */
- 562, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
- 568, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
- 566, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
- 564, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
- 567, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
- 565, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
- 571, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
- 574, /* GL_FRAMEBUFFER_UNSUPPORTED */
- 572, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- 856, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+ 1167, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ 723, /* GL_LOWER_LEFT */
+ 1803, /* GL_UPPER_LEFT */
+ 1509, /* GL_STENCIL_BACK_REF */
+ 1510, /* GL_STENCIL_BACK_VALUE_MASK */
+ 1511, /* GL_STENCIL_BACK_WRITEMASK */
+ 444, /* GL_DRAW_FRAMEBUFFER_BINDING */
+ 1320, /* GL_RENDERBUFFER_BINDING */
+ 1300, /* GL_READ_FRAMEBUFFER */
+ 443, /* GL_DRAW_FRAMEBUFFER */
+ 1301, /* GL_READ_FRAMEBUFFER_BINDING */
+ 1331, /* GL_RENDERBUFFER_SAMPLES */
+ 549, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+ 547, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+ 558, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+ 554, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+ 556, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+ 562, /* GL_FRAMEBUFFER_COMPLETE */
+ 566, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+ 573, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+ 571, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+ 568, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+ 572, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+ 569, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+ 577, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+ 581, /* GL_FRAMEBUFFER_UNSUPPORTED */
+ 579, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+ 863, /* GL_MAX_COLOR_ATTACHMENTS */
155, /* GL_COLOR_ATTACHMENT0 */
157, /* GL_COLOR_ATTACHMENT1 */
171, /* GL_COLOR_ATTACHMENT2 */
@@ -5064,57 +5102,57 @@ static const unsigned reduced_enums[1347] =
164, /* GL_COLOR_ATTACHMENT13 */
166, /* GL_COLOR_ATTACHMENT14 */
168, /* GL_COLOR_ATTACHMENT15 */
- 348, /* GL_DEPTH_ATTACHMENT */
- 1486, /* GL_STENCIL_ATTACHMENT */
- 537, /* GL_FRAMEBUFFER */
- 1307, /* GL_RENDERBUFFER */
- 1321, /* GL_RENDERBUFFER_WIDTH */
- 1314, /* GL_RENDERBUFFER_HEIGHT */
- 1316, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- 1509, /* GL_STENCIL_INDEX_EXT */
- 1506, /* GL_STENCIL_INDEX1_EXT */
- 1507, /* GL_STENCIL_INDEX4_EXT */
- 1508, /* GL_STENCIL_INDEX8_EXT */
- 1505, /* GL_STENCIL_INDEX16_EXT */
- 1318, /* GL_RENDERBUFFER_RED_SIZE */
- 1313, /* GL_RENDERBUFFER_GREEN_SIZE */
- 1310, /* GL_RENDERBUFFER_BLUE_SIZE */
- 1308, /* GL_RENDERBUFFER_ALPHA_SIZE */
- 1311, /* GL_RENDERBUFFER_DEPTH_SIZE */
- 1320, /* GL_RENDERBUFFER_STENCIL_SIZE */
- 570, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- 912, /* GL_MAX_SAMPLES */
- 1276, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- 483, /* GL_FIRST_VERTEX_CONVENTION */
- 667, /* GL_LAST_VERTEX_CONVENTION */
- 1254, /* GL_PROVOKING_VERTEX */
+ 349, /* GL_DEPTH_ATTACHMENT */
+ 1499, /* GL_STENCIL_ATTACHMENT */
+ 540, /* GL_FRAMEBUFFER */
+ 1318, /* GL_RENDERBUFFER */
+ 1334, /* GL_RENDERBUFFER_WIDTH */
+ 1326, /* GL_RENDERBUFFER_HEIGHT */
+ 1328, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ 1526, /* GL_STENCIL_INDEX_EXT */
+ 1518, /* GL_STENCIL_INDEX1 */
+ 1522, /* GL_STENCIL_INDEX4 */
+ 1524, /* GL_STENCIL_INDEX8 */
+ 1519, /* GL_STENCIL_INDEX16 */
+ 1330, /* GL_RENDERBUFFER_RED_SIZE */
+ 1325, /* GL_RENDERBUFFER_GREEN_SIZE */
+ 1322, /* GL_RENDERBUFFER_BLUE_SIZE */
+ 1319, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ 1323, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ 1333, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ 575, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+ 921, /* GL_MAX_SAMPLES */
+ 1286, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ 486, /* GL_FIRST_VERTEX_CONVENTION */
+ 674, /* GL_LAST_VERTEX_CONVENTION */
+ 1264, /* GL_PROVOKING_VERTEX */
302, /* GL_COPY_READ_BUFFER */
303, /* GL_COPY_WRITE_BUFFER */
- 1368, /* GL_RGBA_SNORM */
- 1364, /* GL_RGBA8_SNORM */
- 1426, /* GL_SIGNED_NORMALIZED */
- 913, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- 1042, /* GL_OBJECT_TYPE */
- 1530, /* GL_SYNC_CONDITION */
- 1535, /* GL_SYNC_STATUS */
- 1532, /* GL_SYNC_FLAGS */
- 1531, /* GL_SYNC_FENCE */
- 1534, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- 1761, /* GL_UNSIGNALED */
- 1425, /* GL_SIGNALED */
+ 1381, /* GL_RGBA_SNORM */
+ 1377, /* GL_RGBA8_SNORM */
+ 1439, /* GL_SIGNED_NORMALIZED */
+ 923, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ 1052, /* GL_OBJECT_TYPE */
+ 1547, /* GL_SYNC_CONDITION */
+ 1552, /* GL_SYNC_STATUS */
+ 1549, /* GL_SYNC_FLAGS */
+ 1548, /* GL_SYNC_FENCE */
+ 1551, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ 1779, /* GL_UNSIGNALED */
+ 1438, /* GL_SIGNALED */
46, /* GL_ALREADY_SIGNALED */
- 1732, /* GL_TIMEOUT_EXPIRED */
+ 1750, /* GL_TIMEOUT_EXPIRED */
270, /* GL_CONDITION_SATISFIED */
- 1844, /* GL_WAIT_FAILED */
- 468, /* GL_EVAL_BIT */
- 1288, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- 710, /* GL_LIST_BIT */
- 1627, /* GL_TEXTURE_BIT */
- 1399, /* GL_SCISSOR_BIT */
+ 1863, /* GL_WAIT_FAILED */
+ 471, /* GL_EVAL_BIT */
+ 1298, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ 717, /* GL_LIST_BIT */
+ 1644, /* GL_TEXTURE_BIT */
+ 1412, /* GL_SCISSOR_BIT */
29, /* GL_ALL_ATTRIB_BITS */
- 998, /* GL_MULTISAMPLE_BIT */
+ 1008, /* GL_MULTISAMPLE_BIT */
30, /* GL_ALL_CLIENT_ATTRIB_BITS */
- 1733, /* GL_TIMEOUT_IGNORED */
+ 1751, /* GL_TIMEOUT_IGNORED */
};
typedef int (*cfunc)(const void *, const void *);
diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h
index 3886f41862..c80a524b4f 100644
--- a/src/mesa/main/remap_helper.h
+++ b/src/mesa/main/remap_helper.h
@@ -1584,2742 +1584,2743 @@ static const char _mesa_function_pool[] =
"ip\0"
"glDeleteFencesNV\0"
"\0"
- /* _mesa_function_pool[10713]: DepthMask (offset 211) */
+ /* _mesa_function_pool[10713]: DeformationMap3dSGIX (dynamic) */
+ "iddiiddiiddiip\0"
+ "glDeformationMap3dSGIX\0"
+ "\0"
+ /* _mesa_function_pool[10752]: DepthMask (offset 211) */
"i\0"
"glDepthMask\0"
"\0"
- /* _mesa_function_pool[10728]: IsShader (will be remapped) */
+ /* _mesa_function_pool[10767]: IsShader (will be remapped) */
"i\0"
"glIsShader\0"
"\0"
- /* _mesa_function_pool[10742]: Indexf (offset 46) */
+ /* _mesa_function_pool[10781]: Indexf (offset 46) */
"f\0"
"glIndexf\0"
"\0"
- /* _mesa_function_pool[10754]: GetImageTransformParameterivHP (dynamic) */
+ /* _mesa_function_pool[10793]: GetImageTransformParameterivHP (dynamic) */
"iip\0"
"glGetImageTransformParameterivHP\0"
"\0"
- /* _mesa_function_pool[10792]: Indexd (offset 44) */
+ /* _mesa_function_pool[10831]: Indexd (offset 44) */
"d\0"
"glIndexd\0"
"\0"
- /* _mesa_function_pool[10804]: GetMaterialiv (offset 270) */
+ /* _mesa_function_pool[10843]: GetMaterialiv (offset 270) */
"iip\0"
"glGetMaterialiv\0"
"\0"
- /* _mesa_function_pool[10825]: StencilOp (offset 244) */
+ /* _mesa_function_pool[10864]: StencilOp (offset 244) */
"iii\0"
"glStencilOp\0"
"\0"
- /* _mesa_function_pool[10842]: WindowPos4ivMESA (will be remapped) */
+ /* _mesa_function_pool[10881]: WindowPos4ivMESA (will be remapped) */
"p\0"
"glWindowPos4ivMESA\0"
"\0"
- /* _mesa_function_pool[10864]: MultiTexCoord3svARB (offset 399) */
+ /* _mesa_function_pool[10903]: MultiTexCoord3svARB (offset 399) */
"ip\0"
"glMultiTexCoord3sv\0"
"glMultiTexCoord3svARB\0"
"\0"
- /* _mesa_function_pool[10909]: TexEnvfv (offset 185) */
+ /* _mesa_function_pool[10948]: TexEnvfv (offset 185) */
"iip\0"
"glTexEnvfv\0"
"\0"
- /* _mesa_function_pool[10925]: MultiTexCoord4iARB (offset 404) */
+ /* _mesa_function_pool[10964]: MultiTexCoord4iARB (offset 404) */
"iiiii\0"
"glMultiTexCoord4i\0"
"glMultiTexCoord4iARB\0"
"\0"
- /* _mesa_function_pool[10971]: Indexs (offset 50) */
+ /* _mesa_function_pool[11010]: Indexs (offset 50) */
"i\0"
"glIndexs\0"
"\0"
- /* _mesa_function_pool[10983]: Binormal3ivEXT (dynamic) */
+ /* _mesa_function_pool[11022]: Binormal3ivEXT (dynamic) */
"p\0"
"glBinormal3ivEXT\0"
"\0"
- /* _mesa_function_pool[11003]: ResizeBuffersMESA (will be remapped) */
+ /* _mesa_function_pool[11042]: ResizeBuffersMESA (will be remapped) */
"\0"
"glResizeBuffersMESA\0"
"\0"
- /* _mesa_function_pool[11025]: GetUniformivARB (will be remapped) */
+ /* _mesa_function_pool[11064]: GetUniformivARB (will be remapped) */
"iip\0"
"glGetUniformiv\0"
"glGetUniformivARB\0"
"\0"
- /* _mesa_function_pool[11063]: PixelTexGenParameteriSGIS (will be remapped) */
+ /* _mesa_function_pool[11102]: PixelTexGenParameteriSGIS (will be remapped) */
"ii\0"
"glPixelTexGenParameteriSGIS\0"
"\0"
- /* _mesa_function_pool[11095]: VertexPointervINTEL (dynamic) */
+ /* _mesa_function_pool[11134]: VertexPointervINTEL (dynamic) */
"iip\0"
"glVertexPointervINTEL\0"
"\0"
- /* _mesa_function_pool[11122]: Vertex2i (offset 130) */
+ /* _mesa_function_pool[11161]: Vertex2i (offset 130) */
"ii\0"
"glVertex2i\0"
"\0"
- /* _mesa_function_pool[11137]: LoadMatrixf (offset 291) */
+ /* _mesa_function_pool[11176]: LoadMatrixf (offset 291) */
"p\0"
"glLoadMatrixf\0"
"\0"
- /* _mesa_function_pool[11154]: Vertex2f (offset 128) */
+ /* _mesa_function_pool[11193]: Vertex2f (offset 128) */
"ff\0"
"glVertex2f\0"
"\0"
- /* _mesa_function_pool[11169]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[11208]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[11222]: Color4bv (offset 26) */
+ /* _mesa_function_pool[11261]: Color4bv (offset 26) */
"p\0"
"glColor4bv\0"
"\0"
- /* _mesa_function_pool[11236]: VertexPointer (offset 321) */
+ /* _mesa_function_pool[11275]: VertexPointer (offset 321) */
"iiip\0"
"glVertexPointer\0"
"\0"
- /* _mesa_function_pool[11258]: SecondaryColor3uiEXT (will be remapped) */
+ /* _mesa_function_pool[11297]: SecondaryColor3uiEXT (will be remapped) */
"iii\0"
"glSecondaryColor3ui\0"
"glSecondaryColor3uiEXT\0"
"\0"
- /* _mesa_function_pool[11306]: StartInstrumentsSGIX (dynamic) */
+ /* _mesa_function_pool[11345]: StartInstrumentsSGIX (dynamic) */
"\0"
"glStartInstrumentsSGIX\0"
"\0"
- /* _mesa_function_pool[11331]: SecondaryColor3usvEXT (will be remapped) */
+ /* _mesa_function_pool[11370]: SecondaryColor3usvEXT (will be remapped) */
"p\0"
"glSecondaryColor3usv\0"
"glSecondaryColor3usvEXT\0"
"\0"
- /* _mesa_function_pool[11379]: VertexAttrib2fvNV (will be remapped) */
+ /* _mesa_function_pool[11418]: VertexAttrib2fvNV (will be remapped) */
"ip\0"
"glVertexAttrib2fvNV\0"
"\0"
- /* _mesa_function_pool[11403]: ProgramLocalParameter4dvARB (will be remapped) */
+ /* _mesa_function_pool[11442]: ProgramLocalParameter4dvARB (will be remapped) */
"iip\0"
"glProgramLocalParameter4dvARB\0"
"\0"
- /* _mesa_function_pool[11438]: DeleteLists (offset 4) */
+ /* _mesa_function_pool[11477]: DeleteLists (offset 4) */
"ii\0"
"glDeleteLists\0"
"\0"
- /* _mesa_function_pool[11456]: LogicOp (offset 242) */
+ /* _mesa_function_pool[11495]: LogicOp (offset 242) */
"i\0"
"glLogicOp\0"
"\0"
- /* _mesa_function_pool[11469]: MatrixIndexuivARB (dynamic) */
+ /* _mesa_function_pool[11508]: MatrixIndexuivARB (dynamic) */
"ip\0"
"glMatrixIndexuivARB\0"
"\0"
- /* _mesa_function_pool[11493]: Vertex2s (offset 132) */
+ /* _mesa_function_pool[11532]: Vertex2s (offset 132) */
"ii\0"
"glVertex2s\0"
"\0"
- /* _mesa_function_pool[11508]: RenderbufferStorageMultisample (will be remapped) */
+ /* _mesa_function_pool[11547]: RenderbufferStorageMultisample (will be remapped) */
"iiiii\0"
"glRenderbufferStorageMultisample\0"
+ "glRenderbufferStorageMultisampleEXT\0"
"\0"
- /* _mesa_function_pool[11548]: TexCoord4fv (offset 121) */
+ /* _mesa_function_pool[11623]: TexCoord4fv (offset 121) */
"p\0"
"glTexCoord4fv\0"
"\0"
- /* _mesa_function_pool[11565]: Tangent3sEXT (dynamic) */
+ /* _mesa_function_pool[11640]: Tangent3sEXT (dynamic) */
"iii\0"
"glTangent3sEXT\0"
"\0"
- /* _mesa_function_pool[11585]: GlobalAlphaFactorfSUN (dynamic) */
+ /* _mesa_function_pool[11660]: GlobalAlphaFactorfSUN (dynamic) */
"f\0"
"glGlobalAlphaFactorfSUN\0"
"\0"
- /* _mesa_function_pool[11612]: MultiTexCoord3iARB (offset 396) */
+ /* _mesa_function_pool[11687]: MultiTexCoord3iARB (offset 396) */
"iiii\0"
"glMultiTexCoord3i\0"
"glMultiTexCoord3iARB\0"
"\0"
- /* _mesa_function_pool[11657]: IsProgram (will be remapped) */
+ /* _mesa_function_pool[11732]: IsProgram (will be remapped) */
"i\0"
"glIsProgram\0"
"\0"
- /* _mesa_function_pool[11672]: TexCoordPointerListIBM (dynamic) */
+ /* _mesa_function_pool[11747]: TexCoordPointerListIBM (dynamic) */
"iiipi\0"
"glTexCoordPointerListIBM\0"
"\0"
- /* _mesa_function_pool[11704]: GlobalAlphaFactorusSUN (dynamic) */
+ /* _mesa_function_pool[11779]: GlobalAlphaFactorusSUN (dynamic) */
"i\0"
"glGlobalAlphaFactorusSUN\0"
"\0"
- /* _mesa_function_pool[11732]: VertexAttrib2dvNV (will be remapped) */
+ /* _mesa_function_pool[11807]: VertexAttrib2dvNV (will be remapped) */
"ip\0"
"glVertexAttrib2dvNV\0"
"\0"
- /* _mesa_function_pool[11756]: FramebufferRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[11831]: FramebufferRenderbufferEXT (will be remapped) */
"iiii\0"
"glFramebufferRenderbuffer\0"
"glFramebufferRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[11817]: VertexAttrib1dvNV (will be remapped) */
+ /* _mesa_function_pool[11892]: VertexAttrib1dvNV (will be remapped) */
"ip\0"
"glVertexAttrib1dvNV\0"
"\0"
- /* _mesa_function_pool[11841]: GenTextures (offset 328) */
+ /* _mesa_function_pool[11916]: GenTextures (offset 328) */
"ip\0"
"glGenTextures\0"
"glGenTexturesEXT\0"
"\0"
- /* _mesa_function_pool[11876]: SetFenceNV (will be remapped) */
+ /* _mesa_function_pool[11951]: SetFenceNV (will be remapped) */
"ii\0"
"glSetFenceNV\0"
"\0"
- /* _mesa_function_pool[11893]: FramebufferTexture1DEXT (will be remapped) */
+ /* _mesa_function_pool[11968]: FramebufferTexture1DEXT (will be remapped) */
"iiiii\0"
"glFramebufferTexture1D\0"
"glFramebufferTexture1DEXT\0"
"\0"
- /* _mesa_function_pool[11949]: GetCombinerOutputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[12024]: GetCombinerOutputParameterivNV (will be remapped) */
"iiip\0"
"glGetCombinerOutputParameterivNV\0"
"\0"
- /* _mesa_function_pool[11988]: MultiModeDrawArraysIBM (will be remapped) */
- "pppii\0"
- "glMultiModeDrawArraysIBM\0"
- "\0"
- /* _mesa_function_pool[12020]: PixelTexGenParameterivSGIS (will be remapped) */
+ /* _mesa_function_pool[12063]: PixelTexGenParameterivSGIS (will be remapped) */
"ip\0"
"glPixelTexGenParameterivSGIS\0"
"\0"
- /* _mesa_function_pool[12053]: TextureNormalEXT (dynamic) */
+ /* _mesa_function_pool[12096]: TextureNormalEXT (dynamic) */
"i\0"
"glTextureNormalEXT\0"
"\0"
- /* _mesa_function_pool[12075]: IndexPointerListIBM (dynamic) */
+ /* _mesa_function_pool[12118]: IndexPointerListIBM (dynamic) */
"iipi\0"
"glIndexPointerListIBM\0"
"\0"
- /* _mesa_function_pool[12103]: WeightfvARB (dynamic) */
+ /* _mesa_function_pool[12146]: WeightfvARB (dynamic) */
"ip\0"
"glWeightfvARB\0"
"\0"
- /* _mesa_function_pool[12121]: RasterPos2sv (offset 69) */
+ /* _mesa_function_pool[12164]: RasterPos2sv (offset 69) */
"p\0"
"glRasterPos2sv\0"
"\0"
- /* _mesa_function_pool[12139]: Color4ubv (offset 36) */
+ /* _mesa_function_pool[12182]: Color4ubv (offset 36) */
"p\0"
"glColor4ubv\0"
"\0"
- /* _mesa_function_pool[12154]: DrawBuffer (offset 202) */
+ /* _mesa_function_pool[12197]: DrawBuffer (offset 202) */
"i\0"
"glDrawBuffer\0"
"\0"
- /* _mesa_function_pool[12170]: TexCoord2fv (offset 105) */
+ /* _mesa_function_pool[12213]: TexCoord2fv (offset 105) */
"p\0"
"glTexCoord2fv\0"
"\0"
- /* _mesa_function_pool[12187]: WindowPos4fMESA (will be remapped) */
+ /* _mesa_function_pool[12230]: WindowPos4fMESA (will be remapped) */
"ffff\0"
"glWindowPos4fMESA\0"
"\0"
- /* _mesa_function_pool[12211]: TexCoord1sv (offset 101) */
+ /* _mesa_function_pool[12254]: TexCoord1sv (offset 101) */
"p\0"
"glTexCoord1sv\0"
"\0"
- /* _mesa_function_pool[12228]: WindowPos3dvMESA (will be remapped) */
+ /* _mesa_function_pool[12271]: WindowPos3dvMESA (will be remapped) */
"p\0"
"glWindowPos3dv\0"
"glWindowPos3dvARB\0"
"glWindowPos3dvMESA\0"
"\0"
- /* _mesa_function_pool[12283]: DepthFunc (offset 245) */
+ /* _mesa_function_pool[12326]: DepthFunc (offset 245) */
"i\0"
"glDepthFunc\0"
"\0"
- /* _mesa_function_pool[12298]: PixelMapusv (offset 253) */
+ /* _mesa_function_pool[12341]: PixelMapusv (offset 253) */
"iip\0"
"glPixelMapusv\0"
"\0"
- /* _mesa_function_pool[12317]: GetQueryObjecti64vEXT (will be remapped) */
+ /* _mesa_function_pool[12360]: GetQueryObjecti64vEXT (will be remapped) */
"iip\0"
"glGetQueryObjecti64vEXT\0"
"\0"
- /* _mesa_function_pool[12346]: MultiTexCoord1dARB (offset 376) */
+ /* _mesa_function_pool[12389]: MultiTexCoord1dARB (offset 376) */
"id\0"
"glMultiTexCoord1d\0"
"glMultiTexCoord1dARB\0"
"\0"
- /* _mesa_function_pool[12389]: PointParameterivNV (will be remapped) */
+ /* _mesa_function_pool[12432]: PointParameterivNV (will be remapped) */
"ip\0"
"glPointParameteriv\0"
"glPointParameterivNV\0"
"\0"
- /* _mesa_function_pool[12433]: BlendFunc (offset 241) */
+ /* _mesa_function_pool[12476]: BlendFunc (offset 241) */
"ii\0"
"glBlendFunc\0"
"\0"
- /* _mesa_function_pool[12449]: Uniform2fvARB (will be remapped) */
+ /* _mesa_function_pool[12492]: Uniform2fvARB (will be remapped) */
"iip\0"
"glUniform2fv\0"
"glUniform2fvARB\0"
"\0"
- /* _mesa_function_pool[12483]: BufferParameteriAPPLE (will be remapped) */
+ /* _mesa_function_pool[12526]: BufferParameteriAPPLE (will be remapped) */
"iii\0"
"glBufferParameteriAPPLE\0"
"\0"
- /* _mesa_function_pool[12512]: MultiTexCoord3dvARB (offset 393) */
+ /* _mesa_function_pool[12555]: MultiTexCoord3dvARB (offset 393) */
"ip\0"
"glMultiTexCoord3dv\0"
"glMultiTexCoord3dvARB\0"
"\0"
- /* _mesa_function_pool[12557]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[12600]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[12613]: DeleteObjectARB (will be remapped) */
+ /* _mesa_function_pool[12656]: DeleteObjectARB (will be remapped) */
"i\0"
"glDeleteObjectARB\0"
"\0"
- /* _mesa_function_pool[12634]: MatrixIndexPointerARB (dynamic) */
+ /* _mesa_function_pool[12677]: MatrixIndexPointerARB (dynamic) */
"iiip\0"
"glMatrixIndexPointerARB\0"
"\0"
- /* _mesa_function_pool[12664]: ProgramNamedParameter4dvNV (will be remapped) */
+ /* _mesa_function_pool[12707]: ProgramNamedParameter4dvNV (will be remapped) */
"iipp\0"
"glProgramNamedParameter4dvNV\0"
"\0"
- /* _mesa_function_pool[12699]: Tangent3fvEXT (dynamic) */
+ /* _mesa_function_pool[12742]: Tangent3fvEXT (dynamic) */
"p\0"
"glTangent3fvEXT\0"
"\0"
- /* _mesa_function_pool[12718]: Flush (offset 217) */
+ /* _mesa_function_pool[12761]: Flush (offset 217) */
"\0"
"glFlush\0"
"\0"
- /* _mesa_function_pool[12728]: Color4uiv (offset 38) */
+ /* _mesa_function_pool[12771]: Color4uiv (offset 38) */
"p\0"
"glColor4uiv\0"
"\0"
- /* _mesa_function_pool[12743]: GenVertexArrays (will be remapped) */
+ /* _mesa_function_pool[12786]: GenVertexArrays (will be remapped) */
"ip\0"
"glGenVertexArrays\0"
"\0"
- /* _mesa_function_pool[12765]: RasterPos3sv (offset 77) */
+ /* _mesa_function_pool[12808]: RasterPos3sv (offset 77) */
"p\0"
"glRasterPos3sv\0"
"\0"
- /* _mesa_function_pool[12783]: BindFramebufferEXT (will be remapped) */
+ /* _mesa_function_pool[12826]: BindFramebufferEXT (will be remapped) */
"ii\0"
"glBindFramebuffer\0"
"glBindFramebufferEXT\0"
"\0"
- /* _mesa_function_pool[12826]: ReferencePlaneSGIX (dynamic) */
+ /* _mesa_function_pool[12869]: ReferencePlaneSGIX (dynamic) */
"p\0"
"glReferencePlaneSGIX\0"
"\0"
- /* _mesa_function_pool[12850]: PushAttrib (offset 219) */
+ /* _mesa_function_pool[12893]: PushAttrib (offset 219) */
"i\0"
"glPushAttrib\0"
"\0"
- /* _mesa_function_pool[12866]: RasterPos2i (offset 66) */
+ /* _mesa_function_pool[12909]: RasterPos2i (offset 66) */
"ii\0"
"glRasterPos2i\0"
"\0"
- /* _mesa_function_pool[12884]: ValidateProgramARB (will be remapped) */
+ /* _mesa_function_pool[12927]: ValidateProgramARB (will be remapped) */
"i\0"
"glValidateProgram\0"
"glValidateProgramARB\0"
"\0"
- /* _mesa_function_pool[12926]: TexParameteriv (offset 181) */
+ /* _mesa_function_pool[12969]: TexParameteriv (offset 181) */
"iip\0"
"glTexParameteriv\0"
"\0"
- /* _mesa_function_pool[12948]: UnlockArraysEXT (will be remapped) */
+ /* _mesa_function_pool[12991]: UnlockArraysEXT (will be remapped) */
"\0"
"glUnlockArraysEXT\0"
"\0"
- /* _mesa_function_pool[12968]: TexCoord2fColor3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[13011]: TexCoord2fColor3fVertex3fSUN (dynamic) */
"ffffffff\0"
"glTexCoord2fColor3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[13009]: WindowPos3fvMESA (will be remapped) */
+ /* _mesa_function_pool[13052]: WindowPos3fvMESA (will be remapped) */
"p\0"
"glWindowPos3fv\0"
"glWindowPos3fvARB\0"
"glWindowPos3fvMESA\0"
"\0"
- /* _mesa_function_pool[13064]: RasterPos2f (offset 64) */
+ /* _mesa_function_pool[13107]: RasterPos2f (offset 64) */
"ff\0"
"glRasterPos2f\0"
"\0"
- /* _mesa_function_pool[13082]: VertexAttrib1svNV (will be remapped) */
+ /* _mesa_function_pool[13125]: VertexAttrib1svNV (will be remapped) */
"ip\0"
"glVertexAttrib1svNV\0"
"\0"
- /* _mesa_function_pool[13106]: RasterPos2d (offset 62) */
+ /* _mesa_function_pool[13149]: RasterPos2d (offset 62) */
"dd\0"
"glRasterPos2d\0"
"\0"
- /* _mesa_function_pool[13124]: RasterPos3fv (offset 73) */
+ /* _mesa_function_pool[13167]: RasterPos3fv (offset 73) */
"p\0"
"glRasterPos3fv\0"
"\0"
- /* _mesa_function_pool[13142]: CopyTexSubImage3D (offset 373) */
+ /* _mesa_function_pool[13185]: CopyTexSubImage3D (offset 373) */
"iiiiiiiii\0"
"glCopyTexSubImage3D\0"
"glCopyTexSubImage3DEXT\0"
"\0"
- /* _mesa_function_pool[13196]: VertexAttrib2dARB (will be remapped) */
+ /* _mesa_function_pool[13239]: VertexAttrib2dARB (will be remapped) */
"idd\0"
"glVertexAttrib2d\0"
"glVertexAttrib2dARB\0"
"\0"
- /* _mesa_function_pool[13238]: Color4ub (offset 35) */
+ /* _mesa_function_pool[13281]: Color4ub (offset 35) */
"iiii\0"
"glColor4ub\0"
"\0"
- /* _mesa_function_pool[13255]: GetInteger64v (will be remapped) */
+ /* _mesa_function_pool[13298]: GetInteger64v (will be remapped) */
"ip\0"
"glGetInteger64v\0"
"\0"
- /* _mesa_function_pool[13275]: TextureColorMaskSGIS (dynamic) */
+ /* _mesa_function_pool[13318]: TextureColorMaskSGIS (dynamic) */
"iiii\0"
"glTextureColorMaskSGIS\0"
"\0"
- /* _mesa_function_pool[13304]: RasterPos2s (offset 68) */
+ /* _mesa_function_pool[13347]: RasterPos2s (offset 68) */
"ii\0"
"glRasterPos2s\0"
"\0"
- /* _mesa_function_pool[13322]: GetColorTable (offset 343) */
+ /* _mesa_function_pool[13365]: GetColorTable (offset 343) */
"iiip\0"
"glGetColorTable\0"
"glGetColorTableSGI\0"
"glGetColorTableEXT\0"
"\0"
- /* _mesa_function_pool[13382]: SelectBuffer (offset 195) */
+ /* _mesa_function_pool[13425]: SelectBuffer (offset 195) */
"ip\0"
"glSelectBuffer\0"
"\0"
- /* _mesa_function_pool[13401]: Indexiv (offset 49) */
+ /* _mesa_function_pool[13444]: Indexiv (offset 49) */
"p\0"
"glIndexiv\0"
"\0"
- /* _mesa_function_pool[13414]: TexCoord3i (offset 114) */
+ /* _mesa_function_pool[13457]: TexCoord3i (offset 114) */
"iii\0"
"glTexCoord3i\0"
"\0"
- /* _mesa_function_pool[13432]: CopyColorTable (offset 342) */
+ /* _mesa_function_pool[13475]: CopyColorTable (offset 342) */
"iiiii\0"
"glCopyColorTable\0"
"glCopyColorTableSGI\0"
"\0"
- /* _mesa_function_pool[13476]: GetHistogramParameterfv (offset 362) */
+ /* _mesa_function_pool[13519]: GetHistogramParameterfv (offset 362) */
"iip\0"
"glGetHistogramParameterfv\0"
"glGetHistogramParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[13536]: Frustum (offset 289) */
+ /* _mesa_function_pool[13579]: Frustum (offset 289) */
"dddddd\0"
"glFrustum\0"
"\0"
- /* _mesa_function_pool[13554]: GetString (offset 275) */
+ /* _mesa_function_pool[13597]: GetString (offset 275) */
"i\0"
"glGetString\0"
"\0"
- /* _mesa_function_pool[13569]: ColorPointervINTEL (dynamic) */
+ /* _mesa_function_pool[13612]: ColorPointervINTEL (dynamic) */
"iip\0"
"glColorPointervINTEL\0"
"\0"
- /* _mesa_function_pool[13595]: TexEnvf (offset 184) */
+ /* _mesa_function_pool[13638]: TexEnvf (offset 184) */
"iif\0"
"glTexEnvf\0"
"\0"
- /* _mesa_function_pool[13610]: TexCoord3d (offset 110) */
+ /* _mesa_function_pool[13653]: TexCoord3d (offset 110) */
"ddd\0"
"glTexCoord3d\0"
"\0"
- /* _mesa_function_pool[13628]: AlphaFragmentOp1ATI (will be remapped) */
+ /* _mesa_function_pool[13671]: AlphaFragmentOp1ATI (will be remapped) */
"iiiiii\0"
"glAlphaFragmentOp1ATI\0"
"\0"
- /* _mesa_function_pool[13658]: TexCoord3f (offset 112) */
+ /* _mesa_function_pool[13701]: TexCoord3f (offset 112) */
"fff\0"
"glTexCoord3f\0"
"\0"
- /* _mesa_function_pool[13676]: MultiTexCoord3ivARB (offset 397) */
+ /* _mesa_function_pool[13719]: MultiTexCoord3ivARB (offset 397) */
"ip\0"
"glMultiTexCoord3iv\0"
"glMultiTexCoord3ivARB\0"
"\0"
- /* _mesa_function_pool[13721]: MultiTexCoord2sARB (offset 390) */
+ /* _mesa_function_pool[13764]: MultiTexCoord2sARB (offset 390) */
"iii\0"
"glMultiTexCoord2s\0"
"glMultiTexCoord2sARB\0"
"\0"
- /* _mesa_function_pool[13765]: VertexAttrib1dvARB (will be remapped) */
+ /* _mesa_function_pool[13808]: VertexAttrib1dvARB (will be remapped) */
"ip\0"
"glVertexAttrib1dv\0"
"glVertexAttrib1dvARB\0"
"\0"
- /* _mesa_function_pool[13808]: DeleteTextures (offset 327) */
+ /* _mesa_function_pool[13851]: DeleteTextures (offset 327) */
"ip\0"
"glDeleteTextures\0"
"glDeleteTexturesEXT\0"
"\0"
- /* _mesa_function_pool[13849]: TexCoordPointerEXT (will be remapped) */
+ /* _mesa_function_pool[13892]: TexCoordPointerEXT (will be remapped) */
"iiiip\0"
"glTexCoordPointerEXT\0"
"\0"
- /* _mesa_function_pool[13877]: TexSubImage4DSGIS (dynamic) */
+ /* _mesa_function_pool[13920]: TexSubImage4DSGIS (dynamic) */
"iiiiiiiiiiiip\0"
"glTexSubImage4DSGIS\0"
"\0"
- /* _mesa_function_pool[13912]: TexCoord3s (offset 116) */
+ /* _mesa_function_pool[13955]: TexCoord3s (offset 116) */
"iii\0"
"glTexCoord3s\0"
"\0"
- /* _mesa_function_pool[13930]: GetTexLevelParameteriv (offset 285) */
+ /* _mesa_function_pool[13973]: GetTexLevelParameteriv (offset 285) */
"iiip\0"
"glGetTexLevelParameteriv\0"
"\0"
- /* _mesa_function_pool[13961]: CombinerStageParameterfvNV (dynamic) */
+ /* _mesa_function_pool[14004]: CombinerStageParameterfvNV (dynamic) */
"iip\0"
"glCombinerStageParameterfvNV\0"
"\0"
- /* _mesa_function_pool[13995]: StopInstrumentsSGIX (dynamic) */
+ /* _mesa_function_pool[14038]: StopInstrumentsSGIX (dynamic) */
"i\0"
"glStopInstrumentsSGIX\0"
"\0"
- /* _mesa_function_pool[14020]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
+ /* _mesa_function_pool[14063]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
"fffffffffffffff\0"
"glTexCoord4fColor4fNormal3fVertex4fSUN\0"
"\0"
- /* _mesa_function_pool[14076]: ClearAccum (offset 204) */
+ /* _mesa_function_pool[14119]: ClearAccum (offset 204) */
"ffff\0"
"glClearAccum\0"
"\0"
- /* _mesa_function_pool[14095]: DeformSGIX (dynamic) */
+ /* _mesa_function_pool[14138]: DeformSGIX (dynamic) */
"i\0"
"glDeformSGIX\0"
"\0"
- /* _mesa_function_pool[14111]: GetVertexAttribfvARB (will be remapped) */
+ /* _mesa_function_pool[14154]: GetVertexAttribfvARB (will be remapped) */
"iip\0"
"glGetVertexAttribfv\0"
"glGetVertexAttribfvARB\0"
"\0"
- /* _mesa_function_pool[14159]: SecondaryColor3ivEXT (will be remapped) */
+ /* _mesa_function_pool[14202]: SecondaryColor3ivEXT (will be remapped) */
"p\0"
"glSecondaryColor3iv\0"
"glSecondaryColor3ivEXT\0"
"\0"
- /* _mesa_function_pool[14205]: TexCoord4iv (offset 123) */
+ /* _mesa_function_pool[14248]: TexCoord4iv (offset 123) */
"p\0"
"glTexCoord4iv\0"
"\0"
- /* _mesa_function_pool[14222]: UniformMatrix4x2fv (will be remapped) */
+ /* _mesa_function_pool[14265]: UniformMatrix4x2fv (will be remapped) */
"iiip\0"
"glUniformMatrix4x2fv\0"
"\0"
- /* _mesa_function_pool[14249]: GetDetailTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14292]: GetDetailTexFuncSGIS (dynamic) */
"ip\0"
"glGetDetailTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14276]: GetCombinerStageParameterfvNV (dynamic) */
+ /* _mesa_function_pool[14319]: GetCombinerStageParameterfvNV (dynamic) */
"iip\0"
"glGetCombinerStageParameterfvNV\0"
"\0"
- /* _mesa_function_pool[14313]: PolygonOffset (offset 319) */
+ /* _mesa_function_pool[14356]: PolygonOffset (offset 319) */
"ff\0"
"glPolygonOffset\0"
"\0"
- /* _mesa_function_pool[14333]: BindVertexArray (will be remapped) */
+ /* _mesa_function_pool[14376]: BindVertexArray (will be remapped) */
"i\0"
"glBindVertexArray\0"
"\0"
- /* _mesa_function_pool[14354]: Color4ubVertex2fvSUN (dynamic) */
+ /* _mesa_function_pool[14397]: Color4ubVertex2fvSUN (dynamic) */
"pp\0"
"glColor4ubVertex2fvSUN\0"
"\0"
- /* _mesa_function_pool[14381]: Rectd (offset 86) */
+ /* _mesa_function_pool[14424]: Rectd (offset 86) */
"dddd\0"
"glRectd\0"
"\0"
- /* _mesa_function_pool[14395]: TexFilterFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14438]: TexFilterFuncSGIS (dynamic) */
"iiip\0"
"glTexFilterFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14421]: SampleMaskSGIS (will be remapped) */
+ /* _mesa_function_pool[14464]: SampleMaskSGIS (will be remapped) */
"fi\0"
"glSampleMaskSGIS\0"
"glSampleMaskEXT\0"
"\0"
- /* _mesa_function_pool[14458]: GetAttribLocationARB (will be remapped) */
+ /* _mesa_function_pool[14501]: GetAttribLocationARB (will be remapped) */
"ip\0"
"glGetAttribLocation\0"
"glGetAttribLocationARB\0"
"\0"
- /* _mesa_function_pool[14505]: RasterPos3i (offset 74) */
+ /* _mesa_function_pool[14548]: RasterPos3i (offset 74) */
"iii\0"
"glRasterPos3i\0"
"\0"
- /* _mesa_function_pool[14524]: VertexAttrib4ubvARB (will be remapped) */
+ /* _mesa_function_pool[14567]: VertexAttrib4ubvARB (will be remapped) */
"ip\0"
"glVertexAttrib4ubv\0"
"glVertexAttrib4ubvARB\0"
"\0"
- /* _mesa_function_pool[14569]: DetailTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14612]: DetailTexFuncSGIS (dynamic) */
"iip\0"
"glDetailTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14594]: Normal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[14637]: Normal3fVertex3fSUN (dynamic) */
"ffffff\0"
"glNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[14624]: CopyTexImage2D (offset 324) */
+ /* _mesa_function_pool[14667]: CopyTexImage2D (offset 324) */
"iiiiiiii\0"
"glCopyTexImage2D\0"
"glCopyTexImage2DEXT\0"
"\0"
- /* _mesa_function_pool[14671]: GetBufferPointervARB (will be remapped) */
+ /* _mesa_function_pool[14714]: GetBufferPointervARB (will be remapped) */
"iip\0"
"glGetBufferPointerv\0"
"glGetBufferPointervARB\0"
"\0"
- /* _mesa_function_pool[14719]: ProgramEnvParameter4fARB (will be remapped) */
+ /* _mesa_function_pool[14762]: ProgramEnvParameter4fARB (will be remapped) */
"iiffff\0"
"glProgramEnvParameter4fARB\0"
"glProgramParameter4fNV\0"
"\0"
- /* _mesa_function_pool[14777]: Uniform3ivARB (will be remapped) */
+ /* _mesa_function_pool[14820]: Uniform3ivARB (will be remapped) */
"iip\0"
"glUniform3iv\0"
"glUniform3ivARB\0"
"\0"
- /* _mesa_function_pool[14811]: Lightfv (offset 160) */
+ /* _mesa_function_pool[14854]: Lightfv (offset 160) */
"iip\0"
"glLightfv\0"
"\0"
- /* _mesa_function_pool[14826]: ClearDepth (offset 208) */
+ /* _mesa_function_pool[14869]: ClearDepth (offset 208) */
"d\0"
"glClearDepth\0"
"\0"
- /* _mesa_function_pool[14842]: GetFenceivNV (will be remapped) */
+ /* _mesa_function_pool[14885]: GetFenceivNV (will be remapped) */
"iip\0"
"glGetFenceivNV\0"
"\0"
- /* _mesa_function_pool[14862]: WindowPos4dvMESA (will be remapped) */
+ /* _mesa_function_pool[14905]: WindowPos4dvMESA (will be remapped) */
"p\0"
"glWindowPos4dvMESA\0"
"\0"
- /* _mesa_function_pool[14884]: ColorSubTable (offset 346) */
+ /* _mesa_function_pool[14927]: ColorSubTable (offset 346) */
"iiiiip\0"
"glColorSubTable\0"
"glColorSubTableEXT\0"
"\0"
- /* _mesa_function_pool[14927]: Color4fv (offset 30) */
+ /* _mesa_function_pool[14970]: Color4fv (offset 30) */
"p\0"
"glColor4fv\0"
"\0"
- /* _mesa_function_pool[14941]: MultiTexCoord4ivARB (offset 405) */
+ /* _mesa_function_pool[14984]: MultiTexCoord4ivARB (offset 405) */
"ip\0"
"glMultiTexCoord4iv\0"
"glMultiTexCoord4ivARB\0"
"\0"
- /* _mesa_function_pool[14986]: ProgramLocalParameters4fvEXT (will be remapped) */
+ /* _mesa_function_pool[15029]: ProgramLocalParameters4fvEXT (will be remapped) */
"iiip\0"
"glProgramLocalParameters4fvEXT\0"
"\0"
- /* _mesa_function_pool[15023]: ColorPointer (offset 308) */
+ /* _mesa_function_pool[15066]: ColorPointer (offset 308) */
"iiip\0"
"glColorPointer\0"
"\0"
- /* _mesa_function_pool[15044]: Rects (offset 92) */
+ /* _mesa_function_pool[15087]: Rects (offset 92) */
"iiii\0"
"glRects\0"
"\0"
- /* _mesa_function_pool[15058]: GetMapAttribParameterfvNV (dynamic) */
+ /* _mesa_function_pool[15101]: GetMapAttribParameterfvNV (dynamic) */
"iiip\0"
"glGetMapAttribParameterfvNV\0"
"\0"
- /* _mesa_function_pool[15092]: Lightiv (offset 162) */
+ /* _mesa_function_pool[15135]: Lightiv (offset 162) */
"iip\0"
"glLightiv\0"
"\0"
- /* _mesa_function_pool[15107]: VertexAttrib4sARB (will be remapped) */
+ /* _mesa_function_pool[15150]: VertexAttrib4sARB (will be remapped) */
"iiiii\0"
"glVertexAttrib4s\0"
"glVertexAttrib4sARB\0"
"\0"
- /* _mesa_function_pool[15151]: GetQueryObjectuivARB (will be remapped) */
+ /* _mesa_function_pool[15194]: GetQueryObjectuivARB (will be remapped) */
"iip\0"
"glGetQueryObjectuiv\0"
"glGetQueryObjectuivARB\0"
"\0"
- /* _mesa_function_pool[15199]: GetTexParameteriv (offset 283) */
+ /* _mesa_function_pool[15242]: GetTexParameteriv (offset 283) */
"iip\0"
"glGetTexParameteriv\0"
"\0"
- /* _mesa_function_pool[15224]: MapParameterivNV (dynamic) */
+ /* _mesa_function_pool[15267]: MapParameterivNV (dynamic) */
"iip\0"
"glMapParameterivNV\0"
"\0"
- /* _mesa_function_pool[15248]: GenRenderbuffersEXT (will be remapped) */
+ /* _mesa_function_pool[15291]: GenRenderbuffersEXT (will be remapped) */
"ip\0"
"glGenRenderbuffers\0"
"glGenRenderbuffersEXT\0"
"\0"
- /* _mesa_function_pool[15293]: VertexAttrib2dvARB (will be remapped) */
+ /* _mesa_function_pool[15336]: VertexAttrib2dvARB (will be remapped) */
"ip\0"
"glVertexAttrib2dv\0"
"glVertexAttrib2dvARB\0"
"\0"
- /* _mesa_function_pool[15336]: EdgeFlagPointerEXT (will be remapped) */
+ /* _mesa_function_pool[15379]: EdgeFlagPointerEXT (will be remapped) */
"iip\0"
"glEdgeFlagPointerEXT\0"
"\0"
- /* _mesa_function_pool[15362]: VertexAttribs2svNV (will be remapped) */
+ /* _mesa_function_pool[15405]: VertexAttribs2svNV (will be remapped) */
"iip\0"
"glVertexAttribs2svNV\0"
"\0"
- /* _mesa_function_pool[15388]: WeightbvARB (dynamic) */
+ /* _mesa_function_pool[15431]: WeightbvARB (dynamic) */
"ip\0"
"glWeightbvARB\0"
"\0"
- /* _mesa_function_pool[15406]: VertexAttrib2fvARB (will be remapped) */
+ /* _mesa_function_pool[15449]: VertexAttrib2fvARB (will be remapped) */
"ip\0"
"glVertexAttrib2fv\0"
"glVertexAttrib2fvARB\0"
"\0"
- /* _mesa_function_pool[15449]: GetBufferParameterivARB (will be remapped) */
+ /* _mesa_function_pool[15492]: GetBufferParameterivARB (will be remapped) */
"iip\0"
"glGetBufferParameteriv\0"
"glGetBufferParameterivARB\0"
"\0"
- /* _mesa_function_pool[15503]: Rectdv (offset 87) */
+ /* _mesa_function_pool[15546]: Rectdv (offset 87) */
"pp\0"
"glRectdv\0"
"\0"
- /* _mesa_function_pool[15516]: ListParameteriSGIX (dynamic) */
+ /* _mesa_function_pool[15559]: ListParameteriSGIX (dynamic) */
"iii\0"
"glListParameteriSGIX\0"
"\0"
- /* _mesa_function_pool[15542]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[15585]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
"iffffffffff\0"
"glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[15601]: InstrumentsBufferSGIX (dynamic) */
+ /* _mesa_function_pool[15644]: InstrumentsBufferSGIX (dynamic) */
"ip\0"
"glInstrumentsBufferSGIX\0"
"\0"
- /* _mesa_function_pool[15629]: VertexAttrib4NivARB (will be remapped) */
+ /* _mesa_function_pool[15672]: VertexAttrib4NivARB (will be remapped) */
"ip\0"
"glVertexAttrib4Niv\0"
"glVertexAttrib4NivARB\0"
"\0"
- /* _mesa_function_pool[15674]: GetAttachedShaders (will be remapped) */
+ /* _mesa_function_pool[15717]: GetAttachedShaders (will be remapped) */
"iipp\0"
"glGetAttachedShaders\0"
"\0"
- /* _mesa_function_pool[15701]: GenVertexArraysAPPLE (will be remapped) */
+ /* _mesa_function_pool[15744]: GenVertexArraysAPPLE (will be remapped) */
"ip\0"
"glGenVertexArraysAPPLE\0"
"\0"
- /* _mesa_function_pool[15728]: Materialiv (offset 172) */
+ /* _mesa_function_pool[15771]: Materialiv (offset 172) */
"iip\0"
"glMaterialiv\0"
"\0"
- /* _mesa_function_pool[15746]: PushClientAttrib (offset 335) */
+ /* _mesa_function_pool[15789]: PushClientAttrib (offset 335) */
"i\0"
"glPushClientAttrib\0"
"\0"
- /* _mesa_function_pool[15768]: ProgramEnvParameters4fvEXT (will be remapped) */
+ /* _mesa_function_pool[15811]: ProgramEnvParameters4fvEXT (will be remapped) */
"iiip\0"
"glProgramEnvParameters4fvEXT\0"
"\0"
- /* _mesa_function_pool[15803]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[15846]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[15849]: WindowPos2iMESA (will be remapped) */
+ /* _mesa_function_pool[15892]: WindowPos2iMESA (will be remapped) */
"ii\0"
"glWindowPos2i\0"
"glWindowPos2iARB\0"
"glWindowPos2iMESA\0"
"\0"
- /* _mesa_function_pool[15902]: SecondaryColor3fvEXT (will be remapped) */
+ /* _mesa_function_pool[15945]: SecondaryColor3fvEXT (will be remapped) */
"p\0"
"glSecondaryColor3fv\0"
"glSecondaryColor3fvEXT\0"
"\0"
- /* _mesa_function_pool[15948]: PolygonMode (offset 174) */
+ /* _mesa_function_pool[15991]: PolygonMode (offset 174) */
"ii\0"
"glPolygonMode\0"
"\0"
- /* _mesa_function_pool[15966]: CompressedTexSubImage1DARB (will be remapped) */
+ /* _mesa_function_pool[16009]: CompressedTexSubImage1DARB (will be remapped) */
"iiiiiip\0"
"glCompressedTexSubImage1D\0"
"glCompressedTexSubImage1DARB\0"
"\0"
- /* _mesa_function_pool[16030]: GetVertexAttribivNV (will be remapped) */
+ /* _mesa_function_pool[16073]: GetVertexAttribivNV (will be remapped) */
"iip\0"
"glGetVertexAttribivNV\0"
"\0"
- /* _mesa_function_pool[16057]: GetProgramStringARB (will be remapped) */
+ /* _mesa_function_pool[16100]: GetProgramStringARB (will be remapped) */
"iip\0"
"glGetProgramStringARB\0"
"\0"
- /* _mesa_function_pool[16084]: TexBumpParameterfvATI (will be remapped) */
+ /* _mesa_function_pool[16127]: TexBumpParameterfvATI (will be remapped) */
"ip\0"
"glTexBumpParameterfvATI\0"
"\0"
- /* _mesa_function_pool[16112]: CompileShaderARB (will be remapped) */
+ /* _mesa_function_pool[16155]: CompileShaderARB (will be remapped) */
"i\0"
"glCompileShader\0"
"glCompileShaderARB\0"
"\0"
- /* _mesa_function_pool[16150]: DeleteShader (will be remapped) */
+ /* _mesa_function_pool[16193]: DeleteShader (will be remapped) */
"i\0"
"glDeleteShader\0"
"\0"
- /* _mesa_function_pool[16168]: DisableClientState (offset 309) */
+ /* _mesa_function_pool[16211]: DisableClientState (offset 309) */
"i\0"
"glDisableClientState\0"
"\0"
- /* _mesa_function_pool[16192]: TexGeni (offset 192) */
+ /* _mesa_function_pool[16235]: TexGeni (offset 192) */
"iii\0"
"glTexGeni\0"
"\0"
- /* _mesa_function_pool[16207]: TexGenf (offset 190) */
+ /* _mesa_function_pool[16250]: TexGenf (offset 190) */
"iif\0"
"glTexGenf\0"
"\0"
- /* _mesa_function_pool[16222]: Uniform3fARB (will be remapped) */
+ /* _mesa_function_pool[16265]: Uniform3fARB (will be remapped) */
"ifff\0"
"glUniform3f\0"
"glUniform3fARB\0"
"\0"
- /* _mesa_function_pool[16255]: TexGend (offset 188) */
+ /* _mesa_function_pool[16298]: TexGend (offset 188) */
"iid\0"
"glTexGend\0"
"\0"
- /* _mesa_function_pool[16270]: ListParameterfvSGIX (dynamic) */
+ /* _mesa_function_pool[16313]: ListParameterfvSGIX (dynamic) */
"iip\0"
"glListParameterfvSGIX\0"
"\0"
- /* _mesa_function_pool[16297]: GetPolygonStipple (offset 274) */
+ /* _mesa_function_pool[16340]: GetPolygonStipple (offset 274) */
"p\0"
"glGetPolygonStipple\0"
"\0"
- /* _mesa_function_pool[16320]: Tangent3dvEXT (dynamic) */
+ /* _mesa_function_pool[16363]: Tangent3dvEXT (dynamic) */
"p\0"
"glTangent3dvEXT\0"
"\0"
- /* _mesa_function_pool[16339]: GetVertexAttribfvNV (will be remapped) */
+ /* _mesa_function_pool[16382]: GetVertexAttribfvNV (will be remapped) */
"iip\0"
"glGetVertexAttribfvNV\0"
"\0"
- /* _mesa_function_pool[16366]: WindowPos3sMESA (will be remapped) */
+ /* _mesa_function_pool[16409]: WindowPos3sMESA (will be remapped) */
"iii\0"
"glWindowPos3s\0"
"glWindowPos3sARB\0"
"glWindowPos3sMESA\0"
"\0"
- /* _mesa_function_pool[16420]: VertexAttrib2svNV (will be remapped) */
+ /* _mesa_function_pool[16463]: VertexAttrib2svNV (will be remapped) */
"ip\0"
"glVertexAttrib2svNV\0"
"\0"
- /* _mesa_function_pool[16444]: VertexAttribs1fvNV (will be remapped) */
+ /* _mesa_function_pool[16487]: VertexAttribs1fvNV (will be remapped) */
"iip\0"
"glVertexAttribs1fvNV\0"
"\0"
- /* _mesa_function_pool[16470]: TexCoord2fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[16513]: TexCoord2fVertex3fvSUN (dynamic) */
"pp\0"
"glTexCoord2fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[16499]: WindowPos4sMESA (will be remapped) */
+ /* _mesa_function_pool[16542]: WindowPos4sMESA (will be remapped) */
"iiii\0"
"glWindowPos4sMESA\0"
"\0"
- /* _mesa_function_pool[16523]: VertexAttrib4NuivARB (will be remapped) */
+ /* _mesa_function_pool[16566]: VertexAttrib4NuivARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nuiv\0"
"glVertexAttrib4NuivARB\0"
"\0"
- /* _mesa_function_pool[16570]: ClientActiveTextureARB (offset 375) */
+ /* _mesa_function_pool[16613]: ClientActiveTextureARB (offset 375) */
"i\0"
"glClientActiveTexture\0"
"glClientActiveTextureARB\0"
"\0"
- /* _mesa_function_pool[16620]: PixelTexGenSGIX (will be remapped) */
+ /* _mesa_function_pool[16663]: PixelTexGenSGIX (will be remapped) */
"i\0"
"glPixelTexGenSGIX\0"
"\0"
- /* _mesa_function_pool[16641]: ReplacementCodeusvSUN (dynamic) */
+ /* _mesa_function_pool[16684]: ReplacementCodeusvSUN (dynamic) */
"p\0"
"glReplacementCodeusvSUN\0"
"\0"
- /* _mesa_function_pool[16668]: Uniform4fARB (will be remapped) */
+ /* _mesa_function_pool[16711]: Uniform4fARB (will be remapped) */
"iffff\0"
"glUniform4f\0"
"glUniform4fARB\0"
"\0"
- /* _mesa_function_pool[16702]: Color4sv (offset 34) */
+ /* _mesa_function_pool[16745]: Color4sv (offset 34) */
"p\0"
"glColor4sv\0"
"\0"
- /* _mesa_function_pool[16716]: FlushMappedBufferRange (will be remapped) */
+ /* _mesa_function_pool[16759]: FlushMappedBufferRange (will be remapped) */
"iii\0"
"glFlushMappedBufferRange\0"
"\0"
- /* _mesa_function_pool[16746]: IsProgramNV (will be remapped) */
+ /* _mesa_function_pool[16789]: IsProgramNV (will be remapped) */
"i\0"
"glIsProgramARB\0"
"glIsProgramNV\0"
"\0"
- /* _mesa_function_pool[16778]: FlushMappedBufferRangeAPPLE (will be remapped) */
+ /* _mesa_function_pool[16821]: FlushMappedBufferRangeAPPLE (will be remapped) */
"iii\0"
"glFlushMappedBufferRangeAPPLE\0"
"\0"
- /* _mesa_function_pool[16813]: PixelZoom (offset 246) */
+ /* _mesa_function_pool[16856]: PixelZoom (offset 246) */
"ff\0"
"glPixelZoom\0"
"\0"
- /* _mesa_function_pool[16829]: ReplacementCodePointerSUN (dynamic) */
+ /* _mesa_function_pool[16872]: ReplacementCodePointerSUN (dynamic) */
"iip\0"
"glReplacementCodePointerSUN\0"
"\0"
- /* _mesa_function_pool[16862]: ProgramEnvParameter4dARB (will be remapped) */
+ /* _mesa_function_pool[16905]: ProgramEnvParameter4dARB (will be remapped) */
"iidddd\0"
"glProgramEnvParameter4dARB\0"
"glProgramParameter4dNV\0"
"\0"
- /* _mesa_function_pool[16920]: ColorTableParameterfv (offset 340) */
+ /* _mesa_function_pool[16963]: ColorTableParameterfv (offset 340) */
"iip\0"
"glColorTableParameterfv\0"
"glColorTableParameterfvSGI\0"
"\0"
- /* _mesa_function_pool[16976]: FragmentLightModelfSGIX (dynamic) */
+ /* _mesa_function_pool[17019]: FragmentLightModelfSGIX (dynamic) */
"if\0"
"glFragmentLightModelfSGIX\0"
"\0"
- /* _mesa_function_pool[17006]: Binormal3bvEXT (dynamic) */
+ /* _mesa_function_pool[17049]: Binormal3bvEXT (dynamic) */
"p\0"
"glBinormal3bvEXT\0"
"\0"
- /* _mesa_function_pool[17026]: PixelMapuiv (offset 252) */
+ /* _mesa_function_pool[17069]: PixelMapuiv (offset 252) */
"iip\0"
"glPixelMapuiv\0"
"\0"
- /* _mesa_function_pool[17045]: Color3dv (offset 12) */
+ /* _mesa_function_pool[17088]: Color3dv (offset 12) */
"p\0"
"glColor3dv\0"
"\0"
- /* _mesa_function_pool[17059]: IsTexture (offset 330) */
+ /* _mesa_function_pool[17102]: IsTexture (offset 330) */
"i\0"
"glIsTexture\0"
"glIsTextureEXT\0"
"\0"
- /* _mesa_function_pool[17089]: VertexWeightfvEXT (dynamic) */
+ /* _mesa_function_pool[17132]: VertexWeightfvEXT (dynamic) */
"p\0"
"glVertexWeightfvEXT\0"
"\0"
- /* _mesa_function_pool[17112]: VertexAttrib1dARB (will be remapped) */
+ /* _mesa_function_pool[17155]: VertexAttrib1dARB (will be remapped) */
"id\0"
"glVertexAttrib1d\0"
"glVertexAttrib1dARB\0"
"\0"
- /* _mesa_function_pool[17153]: ImageTransformParameterivHP (dynamic) */
+ /* _mesa_function_pool[17196]: ImageTransformParameterivHP (dynamic) */
"iip\0"
"glImageTransformParameterivHP\0"
"\0"
- /* _mesa_function_pool[17188]: TexCoord4i (offset 122) */
+ /* _mesa_function_pool[17231]: TexCoord4i (offset 122) */
"iiii\0"
"glTexCoord4i\0"
"\0"
- /* _mesa_function_pool[17207]: DeleteQueriesARB (will be remapped) */
+ /* _mesa_function_pool[17250]: DeleteQueriesARB (will be remapped) */
"ip\0"
"glDeleteQueries\0"
"glDeleteQueriesARB\0"
"\0"
- /* _mesa_function_pool[17246]: Color4ubVertex2fSUN (dynamic) */
+ /* _mesa_function_pool[17289]: Color4ubVertex2fSUN (dynamic) */
"iiiiff\0"
"glColor4ubVertex2fSUN\0"
"\0"
- /* _mesa_function_pool[17276]: FragmentColorMaterialSGIX (dynamic) */
+ /* _mesa_function_pool[17319]: FragmentColorMaterialSGIX (dynamic) */
"ii\0"
"glFragmentColorMaterialSGIX\0"
"\0"
- /* _mesa_function_pool[17308]: CurrentPaletteMatrixARB (dynamic) */
+ /* _mesa_function_pool[17351]: CurrentPaletteMatrixARB (dynamic) */
"i\0"
"glCurrentPaletteMatrixARB\0"
"\0"
- /* _mesa_function_pool[17337]: GetMapdv (offset 266) */
+ /* _mesa_function_pool[17380]: GetMapdv (offset 266) */
"iip\0"
"glGetMapdv\0"
"\0"
- /* _mesa_function_pool[17353]: SamplePatternSGIS (will be remapped) */
+ /* _mesa_function_pool[17396]: SamplePatternSGIS (will be remapped) */
"i\0"
"glSamplePatternSGIS\0"
"glSamplePatternEXT\0"
"\0"
- /* _mesa_function_pool[17395]: PixelStoref (offset 249) */
+ /* _mesa_function_pool[17438]: PixelStoref (offset 249) */
"if\0"
"glPixelStoref\0"
"\0"
- /* _mesa_function_pool[17413]: IsQueryARB (will be remapped) */
+ /* _mesa_function_pool[17456]: IsQueryARB (will be remapped) */
"i\0"
"glIsQuery\0"
"glIsQueryARB\0"
"\0"
- /* _mesa_function_pool[17439]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[17482]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
"iiiiifff\0"
"glReplacementCodeuiColor4ubVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[17488]: PixelStorei (offset 250) */
+ /* _mesa_function_pool[17531]: PixelStorei (offset 250) */
"ii\0"
"glPixelStorei\0"
"\0"
- /* _mesa_function_pool[17506]: VertexAttrib4usvARB (will be remapped) */
+ /* _mesa_function_pool[17549]: VertexAttrib4usvARB (will be remapped) */
"ip\0"
"glVertexAttrib4usv\0"
"glVertexAttrib4usvARB\0"
"\0"
- /* _mesa_function_pool[17551]: LinkProgramARB (will be remapped) */
+ /* _mesa_function_pool[17594]: LinkProgramARB (will be remapped) */
"i\0"
"glLinkProgram\0"
"glLinkProgramARB\0"
"\0"
- /* _mesa_function_pool[17585]: VertexAttrib2fNV (will be remapped) */
+ /* _mesa_function_pool[17628]: VertexAttrib2fNV (will be remapped) */
"iff\0"
"glVertexAttrib2fNV\0"
"\0"
- /* _mesa_function_pool[17609]: ShaderSourceARB (will be remapped) */
+ /* _mesa_function_pool[17652]: ShaderSourceARB (will be remapped) */
"iipp\0"
"glShaderSource\0"
"glShaderSourceARB\0"
"\0"
- /* _mesa_function_pool[17648]: FragmentMaterialiSGIX (dynamic) */
+ /* _mesa_function_pool[17691]: FragmentMaterialiSGIX (dynamic) */
"iii\0"
"glFragmentMaterialiSGIX\0"
"\0"
- /* _mesa_function_pool[17677]: EvalCoord2dv (offset 233) */
+ /* _mesa_function_pool[17720]: EvalCoord2dv (offset 233) */
"p\0"
"glEvalCoord2dv\0"
"\0"
- /* _mesa_function_pool[17695]: VertexAttrib3svARB (will be remapped) */
+ /* _mesa_function_pool[17738]: VertexAttrib3svARB (will be remapped) */
"ip\0"
"glVertexAttrib3sv\0"
"glVertexAttrib3svARB\0"
"\0"
- /* _mesa_function_pool[17738]: ColorMaterial (offset 151) */
+ /* _mesa_function_pool[17781]: ColorMaterial (offset 151) */
"ii\0"
"glColorMaterial\0"
"\0"
- /* _mesa_function_pool[17758]: CompressedTexSubImage3DARB (will be remapped) */
+ /* _mesa_function_pool[17801]: CompressedTexSubImage3DARB (will be remapped) */
"iiiiiiiiiip\0"
"glCompressedTexSubImage3D\0"
"glCompressedTexSubImage3DARB\0"
"\0"
- /* _mesa_function_pool[17826]: WindowPos2ivMESA (will be remapped) */
+ /* _mesa_function_pool[17869]: WindowPos2ivMESA (will be remapped) */
"p\0"
"glWindowPos2iv\0"
"glWindowPos2ivARB\0"
"glWindowPos2ivMESA\0"
"\0"
- /* _mesa_function_pool[17881]: IsFramebufferEXT (will be remapped) */
+ /* _mesa_function_pool[17924]: IsFramebufferEXT (will be remapped) */
"i\0"
"glIsFramebuffer\0"
"glIsFramebufferEXT\0"
"\0"
- /* _mesa_function_pool[17919]: Uniform4ivARB (will be remapped) */
+ /* _mesa_function_pool[17962]: Uniform4ivARB (will be remapped) */
"iip\0"
"glUniform4iv\0"
"glUniform4ivARB\0"
"\0"
- /* _mesa_function_pool[17953]: GetVertexAttribdvARB (will be remapped) */
+ /* _mesa_function_pool[17996]: GetVertexAttribdvARB (will be remapped) */
"iip\0"
"glGetVertexAttribdv\0"
"glGetVertexAttribdvARB\0"
"\0"
- /* _mesa_function_pool[18001]: TexBumpParameterivATI (will be remapped) */
+ /* _mesa_function_pool[18044]: TexBumpParameterivATI (will be remapped) */
"ip\0"
"glTexBumpParameterivATI\0"
"\0"
- /* _mesa_function_pool[18029]: GetSeparableFilter (offset 359) */
+ /* _mesa_function_pool[18072]: GetSeparableFilter (offset 359) */
"iiippp\0"
"glGetSeparableFilter\0"
"glGetSeparableFilterEXT\0"
"\0"
- /* _mesa_function_pool[18082]: Binormal3dEXT (dynamic) */
+ /* _mesa_function_pool[18125]: Binormal3dEXT (dynamic) */
"ddd\0"
"glBinormal3dEXT\0"
"\0"
- /* _mesa_function_pool[18103]: SpriteParameteriSGIX (dynamic) */
+ /* _mesa_function_pool[18146]: SpriteParameteriSGIX (dynamic) */
"ii\0"
"glSpriteParameteriSGIX\0"
"\0"
- /* _mesa_function_pool[18130]: RequestResidentProgramsNV (will be remapped) */
+ /* _mesa_function_pool[18173]: RequestResidentProgramsNV (will be remapped) */
"ip\0"
"glRequestResidentProgramsNV\0"
"\0"
- /* _mesa_function_pool[18162]: TagSampleBufferSGIX (dynamic) */
+ /* _mesa_function_pool[18205]: TagSampleBufferSGIX (dynamic) */
"\0"
"glTagSampleBufferSGIX\0"
"\0"
- /* _mesa_function_pool[18186]: ReplacementCodeusSUN (dynamic) */
+ /* _mesa_function_pool[18229]: ReplacementCodeusSUN (dynamic) */
"i\0"
"glReplacementCodeusSUN\0"
"\0"
- /* _mesa_function_pool[18212]: FeedbackBuffer (offset 194) */
+ /* _mesa_function_pool[18255]: FeedbackBuffer (offset 194) */
"iip\0"
"glFeedbackBuffer\0"
"\0"
- /* _mesa_function_pool[18234]: RasterPos2iv (offset 67) */
+ /* _mesa_function_pool[18277]: RasterPos2iv (offset 67) */
"p\0"
"glRasterPos2iv\0"
"\0"
- /* _mesa_function_pool[18252]: TexImage1D (offset 182) */
+ /* _mesa_function_pool[18295]: TexImage1D (offset 182) */
"iiiiiiip\0"
"glTexImage1D\0"
"\0"
- /* _mesa_function_pool[18275]: ListParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[18318]: ListParameterivSGIX (dynamic) */
"iip\0"
"glListParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[18302]: MultiDrawElementsEXT (will be remapped) */
+ /* _mesa_function_pool[18345]: MultiDrawElementsEXT (will be remapped) */
"ipipi\0"
"glMultiDrawElements\0"
"glMultiDrawElementsEXT\0"
"\0"
- /* _mesa_function_pool[18352]: Color3s (offset 17) */
+ /* _mesa_function_pool[18395]: Color3s (offset 17) */
"iii\0"
"glColor3s\0"
"\0"
- /* _mesa_function_pool[18367]: Uniform1ivARB (will be remapped) */
+ /* _mesa_function_pool[18410]: Uniform1ivARB (will be remapped) */
"iip\0"
"glUniform1iv\0"
"glUniform1ivARB\0"
"\0"
- /* _mesa_function_pool[18401]: WindowPos2sMESA (will be remapped) */
+ /* _mesa_function_pool[18444]: WindowPos2sMESA (will be remapped) */
"ii\0"
"glWindowPos2s\0"
"glWindowPos2sARB\0"
"glWindowPos2sMESA\0"
"\0"
- /* _mesa_function_pool[18454]: WeightusvARB (dynamic) */
+ /* _mesa_function_pool[18497]: WeightusvARB (dynamic) */
"ip\0"
"glWeightusvARB\0"
"\0"
- /* _mesa_function_pool[18473]: TexCoordPointer (offset 320) */
+ /* _mesa_function_pool[18516]: TexCoordPointer (offset 320) */
"iiip\0"
"glTexCoordPointer\0"
"\0"
- /* _mesa_function_pool[18497]: FogCoordPointerEXT (will be remapped) */
+ /* _mesa_function_pool[18540]: FogCoordPointerEXT (will be remapped) */
"iip\0"
"glFogCoordPointer\0"
"glFogCoordPointerEXT\0"
"\0"
- /* _mesa_function_pool[18541]: IndexMaterialEXT (dynamic) */
+ /* _mesa_function_pool[18584]: IndexMaterialEXT (dynamic) */
"ii\0"
"glIndexMaterialEXT\0"
"\0"
- /* _mesa_function_pool[18564]: Color3i (offset 15) */
+ /* _mesa_function_pool[18607]: Color3i (offset 15) */
"iii\0"
"glColor3i\0"
"\0"
- /* _mesa_function_pool[18579]: FrontFace (offset 157) */
+ /* _mesa_function_pool[18622]: FrontFace (offset 157) */
"i\0"
"glFrontFace\0"
"\0"
- /* _mesa_function_pool[18594]: EvalCoord2d (offset 232) */
+ /* _mesa_function_pool[18637]: EvalCoord2d (offset 232) */
"dd\0"
"glEvalCoord2d\0"
"\0"
- /* _mesa_function_pool[18612]: SecondaryColor3ubvEXT (will be remapped) */
+ /* _mesa_function_pool[18655]: SecondaryColor3ubvEXT (will be remapped) */
"p\0"
"glSecondaryColor3ubv\0"
"glSecondaryColor3ubvEXT\0"
"\0"
- /* _mesa_function_pool[18660]: EvalCoord2f (offset 234) */
+ /* _mesa_function_pool[18703]: EvalCoord2f (offset 234) */
"ff\0"
"glEvalCoord2f\0"
"\0"
- /* _mesa_function_pool[18678]: VertexAttrib4dvARB (will be remapped) */
+ /* _mesa_function_pool[18721]: VertexAttrib4dvARB (will be remapped) */
"ip\0"
"glVertexAttrib4dv\0"
"glVertexAttrib4dvARB\0"
"\0"
- /* _mesa_function_pool[18721]: BindAttribLocationARB (will be remapped) */
+ /* _mesa_function_pool[18764]: BindAttribLocationARB (will be remapped) */
"iip\0"
"glBindAttribLocation\0"
"glBindAttribLocationARB\0"
"\0"
- /* _mesa_function_pool[18771]: Color3b (offset 9) */
+ /* _mesa_function_pool[18814]: Color3b (offset 9) */
"iii\0"
"glColor3b\0"
"\0"
- /* _mesa_function_pool[18786]: MultiTexCoord2dARB (offset 384) */
+ /* _mesa_function_pool[18829]: MultiTexCoord2dARB (offset 384) */
"idd\0"
"glMultiTexCoord2d\0"
"glMultiTexCoord2dARB\0"
"\0"
- /* _mesa_function_pool[18830]: ExecuteProgramNV (will be remapped) */
+ /* _mesa_function_pool[18873]: ExecuteProgramNV (will be remapped) */
"iip\0"
"glExecuteProgramNV\0"
"\0"
- /* _mesa_function_pool[18854]: Color3f (offset 13) */
+ /* _mesa_function_pool[18897]: Color3f (offset 13) */
"fff\0"
"glColor3f\0"
"\0"
- /* _mesa_function_pool[18869]: LightEnviSGIX (dynamic) */
+ /* _mesa_function_pool[18912]: LightEnviSGIX (dynamic) */
"ii\0"
"glLightEnviSGIX\0"
"\0"
- /* _mesa_function_pool[18889]: Color3d (offset 11) */
+ /* _mesa_function_pool[18932]: Color3d (offset 11) */
"ddd\0"
"glColor3d\0"
"\0"
- /* _mesa_function_pool[18904]: Normal3dv (offset 55) */
+ /* _mesa_function_pool[18947]: Normal3dv (offset 55) */
"p\0"
"glNormal3dv\0"
"\0"
- /* _mesa_function_pool[18919]: Lightf (offset 159) */
+ /* _mesa_function_pool[18962]: Lightf (offset 159) */
"iif\0"
"glLightf\0"
"\0"
- /* _mesa_function_pool[18933]: ReplacementCodeuiSUN (dynamic) */
+ /* _mesa_function_pool[18976]: ReplacementCodeuiSUN (dynamic) */
"i\0"
"glReplacementCodeuiSUN\0"
"\0"
- /* _mesa_function_pool[18959]: MatrixMode (offset 293) */
+ /* _mesa_function_pool[19002]: MatrixMode (offset 293) */
"i\0"
"glMatrixMode\0"
"\0"
- /* _mesa_function_pool[18975]: GetPixelMapusv (offset 273) */
+ /* _mesa_function_pool[19018]: GetPixelMapusv (offset 273) */
"ip\0"
"glGetPixelMapusv\0"
"\0"
- /* _mesa_function_pool[18996]: Lighti (offset 161) */
+ /* _mesa_function_pool[19039]: Lighti (offset 161) */
"iii\0"
"glLighti\0"
"\0"
- /* _mesa_function_pool[19010]: VertexAttribPointerNV (will be remapped) */
+ /* _mesa_function_pool[19053]: VertexAttribPointerNV (will be remapped) */
"iiiip\0"
"glVertexAttribPointerNV\0"
"\0"
- /* _mesa_function_pool[19041]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
+ /* _mesa_function_pool[19084]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
"iiip\0"
"glGetFramebufferAttachmentParameteriv\0"
"glGetFramebufferAttachmentParameterivEXT\0"
"\0"
- /* _mesa_function_pool[19126]: PixelTransformParameterfEXT (dynamic) */
+ /* _mesa_function_pool[19169]: PixelTransformParameterfEXT (dynamic) */
"iif\0"
"glPixelTransformParameterfEXT\0"
"\0"
- /* _mesa_function_pool[19161]: MultiTexCoord4dvARB (offset 401) */
+ /* _mesa_function_pool[19204]: MultiTexCoord4dvARB (offset 401) */
"ip\0"
"glMultiTexCoord4dv\0"
"glMultiTexCoord4dvARB\0"
"\0"
- /* _mesa_function_pool[19206]: PixelTransformParameteriEXT (dynamic) */
+ /* _mesa_function_pool[19249]: PixelTransformParameteriEXT (dynamic) */
"iii\0"
"glPixelTransformParameteriEXT\0"
"\0"
- /* _mesa_function_pool[19241]: GetDoublev (offset 260) */
+ /* _mesa_function_pool[19284]: GetDoublev (offset 260) */
"ip\0"
"glGetDoublev\0"
"\0"
- /* _mesa_function_pool[19258]: MultMatrixd (offset 295) */
+ /* _mesa_function_pool[19301]: MultMatrixd (offset 295) */
"p\0"
"glMultMatrixd\0"
"\0"
- /* _mesa_function_pool[19275]: MultMatrixf (offset 294) */
+ /* _mesa_function_pool[19318]: MultMatrixf (offset 294) */
"p\0"
"glMultMatrixf\0"
"\0"
- /* _mesa_function_pool[19292]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[19335]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
"ffiiiifff\0"
"glTexCoord2fColor4ubVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[19335]: Uniform1iARB (will be remapped) */
+ /* _mesa_function_pool[19378]: Uniform1iARB (will be remapped) */
"ii\0"
"glUniform1i\0"
"glUniform1iARB\0"
"\0"
- /* _mesa_function_pool[19366]: VertexAttribPointerARB (will be remapped) */
+ /* _mesa_function_pool[19409]: VertexAttribPointerARB (will be remapped) */
"iiiiip\0"
"glVertexAttribPointer\0"
"glVertexAttribPointerARB\0"
"\0"
- /* _mesa_function_pool[19421]: SharpenTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[19464]: SharpenTexFuncSGIS (dynamic) */
"iip\0"
"glSharpenTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[19447]: MultiTexCoord4fvARB (offset 403) */
+ /* _mesa_function_pool[19490]: MultiTexCoord4fvARB (offset 403) */
"ip\0"
"glMultiTexCoord4fv\0"
"glMultiTexCoord4fvARB\0"
"\0"
- /* _mesa_function_pool[19492]: UniformMatrix2x3fv (will be remapped) */
+ /* _mesa_function_pool[19535]: UniformMatrix2x3fv (will be remapped) */
"iiip\0"
"glUniformMatrix2x3fv\0"
"\0"
- /* _mesa_function_pool[19519]: TrackMatrixNV (will be remapped) */
+ /* _mesa_function_pool[19562]: TrackMatrixNV (will be remapped) */
"iiii\0"
"glTrackMatrixNV\0"
"\0"
- /* _mesa_function_pool[19541]: CombinerParameteriNV (will be remapped) */
+ /* _mesa_function_pool[19584]: CombinerParameteriNV (will be remapped) */
"ii\0"
"glCombinerParameteriNV\0"
"\0"
- /* _mesa_function_pool[19568]: DeleteAsyncMarkersSGIX (dynamic) */
+ /* _mesa_function_pool[19611]: DeleteAsyncMarkersSGIX (dynamic) */
"ii\0"
"glDeleteAsyncMarkersSGIX\0"
"\0"
- /* _mesa_function_pool[19597]: IsAsyncMarkerSGIX (dynamic) */
+ /* _mesa_function_pool[19640]: IsAsyncMarkerSGIX (dynamic) */
"i\0"
"glIsAsyncMarkerSGIX\0"
"\0"
- /* _mesa_function_pool[19620]: FrameZoomSGIX (dynamic) */
+ /* _mesa_function_pool[19663]: FrameZoomSGIX (dynamic) */
"i\0"
"glFrameZoomSGIX\0"
"\0"
- /* _mesa_function_pool[19639]: Normal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[19682]: Normal3fVertex3fvSUN (dynamic) */
"pp\0"
"glNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[19666]: RasterPos4sv (offset 85) */
+ /* _mesa_function_pool[19709]: RasterPos4sv (offset 85) */
"p\0"
"glRasterPos4sv\0"
"\0"
- /* _mesa_function_pool[19684]: VertexAttrib4NsvARB (will be remapped) */
+ /* _mesa_function_pool[19727]: VertexAttrib4NsvARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nsv\0"
"glVertexAttrib4NsvARB\0"
"\0"
- /* _mesa_function_pool[19729]: VertexAttrib3fvARB (will be remapped) */
+ /* _mesa_function_pool[19772]: VertexAttrib3fvARB (will be remapped) */
"ip\0"
"glVertexAttrib3fv\0"
"glVertexAttrib3fvARB\0"
"\0"
- /* _mesa_function_pool[19772]: ClearColor (offset 206) */
+ /* _mesa_function_pool[19815]: ClearColor (offset 206) */
"ffff\0"
"glClearColor\0"
"\0"
- /* _mesa_function_pool[19791]: GetSynciv (will be remapped) */
+ /* _mesa_function_pool[19834]: GetSynciv (will be remapped) */
"iiipp\0"
"glGetSynciv\0"
"\0"
- /* _mesa_function_pool[19810]: DeleteFramebuffersEXT (will be remapped) */
+ /* _mesa_function_pool[19853]: DeleteFramebuffersEXT (will be remapped) */
"ip\0"
"glDeleteFramebuffers\0"
"glDeleteFramebuffersEXT\0"
"\0"
- /* _mesa_function_pool[19859]: GlobalAlphaFactorsSUN (dynamic) */
+ /* _mesa_function_pool[19902]: GlobalAlphaFactorsSUN (dynamic) */
"i\0"
"glGlobalAlphaFactorsSUN\0"
"\0"
- /* _mesa_function_pool[19886]: TexEnviv (offset 187) */
+ /* _mesa_function_pool[19929]: TexEnviv (offset 187) */
"iip\0"
"glTexEnviv\0"
"\0"
- /* _mesa_function_pool[19902]: TexSubImage3D (offset 372) */
+ /* _mesa_function_pool[19945]: TexSubImage3D (offset 372) */
"iiiiiiiiiip\0"
"glTexSubImage3D\0"
"glTexSubImage3DEXT\0"
"\0"
- /* _mesa_function_pool[19950]: Tangent3fEXT (dynamic) */
+ /* _mesa_function_pool[19993]: Tangent3fEXT (dynamic) */
"fff\0"
"glTangent3fEXT\0"
"\0"
- /* _mesa_function_pool[19970]: SecondaryColor3uivEXT (will be remapped) */
+ /* _mesa_function_pool[20013]: SecondaryColor3uivEXT (will be remapped) */
"p\0"
"glSecondaryColor3uiv\0"
"glSecondaryColor3uivEXT\0"
"\0"
- /* _mesa_function_pool[20018]: MatrixIndexubvARB (dynamic) */
+ /* _mesa_function_pool[20061]: MatrixIndexubvARB (dynamic) */
"ip\0"
"glMatrixIndexubvARB\0"
"\0"
- /* _mesa_function_pool[20042]: Color4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[20085]: Color4fNormal3fVertex3fSUN (dynamic) */
"ffffffffff\0"
"glColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[20083]: PixelTexGenParameterfSGIS (will be remapped) */
+ /* _mesa_function_pool[20126]: PixelTexGenParameterfSGIS (will be remapped) */
"if\0"
"glPixelTexGenParameterfSGIS\0"
"\0"
- /* _mesa_function_pool[20115]: CreateShader (will be remapped) */
+ /* _mesa_function_pool[20158]: CreateShader (will be remapped) */
"i\0"
"glCreateShader\0"
"\0"
- /* _mesa_function_pool[20133]: GetColorTableParameterfv (offset 344) */
+ /* _mesa_function_pool[20176]: GetColorTableParameterfv (offset 344) */
"iip\0"
"glGetColorTableParameterfv\0"
"glGetColorTableParameterfvSGI\0"
"glGetColorTableParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[20225]: FragmentLightModelfvSGIX (dynamic) */
+ /* _mesa_function_pool[20268]: FragmentLightModelfvSGIX (dynamic) */
"ip\0"
"glFragmentLightModelfvSGIX\0"
"\0"
- /* _mesa_function_pool[20256]: Bitmap (offset 8) */
+ /* _mesa_function_pool[20299]: Bitmap (offset 8) */
"iiffffp\0"
"glBitmap\0"
"\0"
- /* _mesa_function_pool[20274]: MultiTexCoord3fARB (offset 394) */
+ /* _mesa_function_pool[20317]: MultiTexCoord3fARB (offset 394) */
"ifff\0"
"glMultiTexCoord3f\0"
"glMultiTexCoord3fARB\0"
"\0"
- /* _mesa_function_pool[20319]: GetTexLevelParameterfv (offset 284) */
+ /* _mesa_function_pool[20362]: GetTexLevelParameterfv (offset 284) */
"iiip\0"
"glGetTexLevelParameterfv\0"
"\0"
- /* _mesa_function_pool[20350]: GetPixelTexGenParameterfvSGIS (will be remapped) */
+ /* _mesa_function_pool[20393]: GetPixelTexGenParameterfvSGIS (will be remapped) */
"ip\0"
"glGetPixelTexGenParameterfvSGIS\0"
"\0"
- /* _mesa_function_pool[20386]: GenFramebuffersEXT (will be remapped) */
+ /* _mesa_function_pool[20429]: GenFramebuffersEXT (will be remapped) */
"ip\0"
"glGenFramebuffers\0"
"glGenFramebuffersEXT\0"
"\0"
- /* _mesa_function_pool[20429]: GetProgramParameterdvNV (will be remapped) */
+ /* _mesa_function_pool[20472]: GetProgramParameterdvNV (will be remapped) */
"iiip\0"
"glGetProgramParameterdvNV\0"
"\0"
- /* _mesa_function_pool[20461]: Vertex2sv (offset 133) */
+ /* _mesa_function_pool[20504]: Vertex2sv (offset 133) */
"p\0"
"glVertex2sv\0"
"\0"
- /* _mesa_function_pool[20476]: GetIntegerv (offset 263) */
+ /* _mesa_function_pool[20519]: GetIntegerv (offset 263) */
"ip\0"
"glGetIntegerv\0"
"\0"
- /* _mesa_function_pool[20494]: IsVertexArrayAPPLE (will be remapped) */
+ /* _mesa_function_pool[20537]: IsVertexArrayAPPLE (will be remapped) */
"i\0"
"glIsVertexArray\0"
"glIsVertexArrayAPPLE\0"
"\0"
- /* _mesa_function_pool[20534]: FragmentLightfvSGIX (dynamic) */
+ /* _mesa_function_pool[20577]: FragmentLightfvSGIX (dynamic) */
"iip\0"
"glFragmentLightfvSGIX\0"
"\0"
- /* _mesa_function_pool[20561]: DetachShader (will be remapped) */
+ /* _mesa_function_pool[20604]: DetachShader (will be remapped) */
"ii\0"
"glDetachShader\0"
"\0"
- /* _mesa_function_pool[20580]: VertexAttrib4NubARB (will be remapped) */
+ /* _mesa_function_pool[20623]: VertexAttrib4NubARB (will be remapped) */
"iiiii\0"
"glVertexAttrib4Nub\0"
"glVertexAttrib4NubARB\0"
"\0"
- /* _mesa_function_pool[20628]: GetProgramEnvParameterfvARB (will be remapped) */
+ /* _mesa_function_pool[20671]: GetProgramEnvParameterfvARB (will be remapped) */
"iip\0"
"glGetProgramEnvParameterfvARB\0"
"\0"
- /* _mesa_function_pool[20663]: GetTrackMatrixivNV (will be remapped) */
+ /* _mesa_function_pool[20706]: GetTrackMatrixivNV (will be remapped) */
"iiip\0"
"glGetTrackMatrixivNV\0"
"\0"
- /* _mesa_function_pool[20690]: VertexAttrib3svNV (will be remapped) */
+ /* _mesa_function_pool[20733]: VertexAttrib3svNV (will be remapped) */
"ip\0"
"glVertexAttrib3svNV\0"
"\0"
- /* _mesa_function_pool[20714]: Uniform4fvARB (will be remapped) */
+ /* _mesa_function_pool[20757]: Uniform4fvARB (will be remapped) */
"iip\0"
"glUniform4fv\0"
"glUniform4fvARB\0"
"\0"
- /* _mesa_function_pool[20748]: MultTransposeMatrixfARB (will be remapped) */
+ /* _mesa_function_pool[20791]: MultTransposeMatrixfARB (will be remapped) */
"p\0"
"glMultTransposeMatrixf\0"
"glMultTransposeMatrixfARB\0"
"\0"
- /* _mesa_function_pool[20800]: GetTexEnviv (offset 277) */
+ /* _mesa_function_pool[20843]: GetTexEnviv (offset 277) */
"iip\0"
"glGetTexEnviv\0"
"\0"
- /* _mesa_function_pool[20819]: ColorFragmentOp1ATI (will be remapped) */
+ /* _mesa_function_pool[20862]: ColorFragmentOp1ATI (will be remapped) */
"iiiiiii\0"
"glColorFragmentOp1ATI\0"
"\0"
- /* _mesa_function_pool[20850]: GetUniformfvARB (will be remapped) */
+ /* _mesa_function_pool[20893]: GetUniformfvARB (will be remapped) */
"iip\0"
"glGetUniformfv\0"
"glGetUniformfvARB\0"
"\0"
- /* _mesa_function_pool[20888]: PopClientAttrib (offset 334) */
+ /* _mesa_function_pool[20931]: PopClientAttrib (offset 334) */
"\0"
"glPopClientAttrib\0"
"\0"
- /* _mesa_function_pool[20908]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[20951]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
"iffffffffffff\0"
"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[20979]: DetachObjectARB (will be remapped) */
+ /* _mesa_function_pool[21022]: DetachObjectARB (will be remapped) */
"ii\0"
"glDetachObjectARB\0"
"\0"
- /* _mesa_function_pool[21001]: VertexBlendARB (dynamic) */
+ /* _mesa_function_pool[21044]: VertexBlendARB (dynamic) */
"i\0"
"glVertexBlendARB\0"
"\0"
- /* _mesa_function_pool[21021]: WindowPos3iMESA (will be remapped) */
+ /* _mesa_function_pool[21064]: WindowPos3iMESA (will be remapped) */
"iii\0"
"glWindowPos3i\0"
"glWindowPos3iARB\0"
"glWindowPos3iMESA\0"
"\0"
- /* _mesa_function_pool[21075]: SeparableFilter2D (offset 360) */
+ /* _mesa_function_pool[21118]: SeparableFilter2D (offset 360) */
"iiiiiipp\0"
"glSeparableFilter2D\0"
"glSeparableFilter2DEXT\0"
"\0"
- /* _mesa_function_pool[21128]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[21171]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
"ppp\0"
"glReplacementCodeuiColor4ubVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[21173]: Map1d (offset 220) */
+ /* _mesa_function_pool[21216]: Map1d (offset 220) */
"iddiip\0"
"glMap1d\0"
"\0"
- /* _mesa_function_pool[21189]: Map1f (offset 221) */
+ /* _mesa_function_pool[21232]: Map1f (offset 221) */
"iffiip\0"
"glMap1f\0"
"\0"
- /* _mesa_function_pool[21205]: CompressedTexImage2DARB (will be remapped) */
+ /* _mesa_function_pool[21248]: CompressedTexImage2DARB (will be remapped) */
"iiiiiiip\0"
"glCompressedTexImage2D\0"
"glCompressedTexImage2DARB\0"
"\0"
- /* _mesa_function_pool[21264]: ArrayElement (offset 306) */
+ /* _mesa_function_pool[21307]: ArrayElement (offset 306) */
"i\0"
"glArrayElement\0"
"glArrayElementEXT\0"
"\0"
- /* _mesa_function_pool[21300]: TexImage2D (offset 183) */
+ /* _mesa_function_pool[21343]: TexImage2D (offset 183) */
"iiiiiiiip\0"
"glTexImage2D\0"
"\0"
- /* _mesa_function_pool[21324]: DepthBoundsEXT (will be remapped) */
+ /* _mesa_function_pool[21367]: DepthBoundsEXT (will be remapped) */
"dd\0"
"glDepthBoundsEXT\0"
"\0"
- /* _mesa_function_pool[21345]: ProgramParameters4fvNV (will be remapped) */
+ /* _mesa_function_pool[21388]: ProgramParameters4fvNV (will be remapped) */
"iiip\0"
"glProgramParameters4fvNV\0"
"\0"
- /* _mesa_function_pool[21376]: DeformationMap3fSGIX (dynamic) */
+ /* _mesa_function_pool[21419]: DeformationMap3fSGIX (dynamic) */
"iffiiffiiffiip\0"
"glDeformationMap3fSGIX\0"
"\0"
- /* _mesa_function_pool[21415]: GetProgramivNV (will be remapped) */
+ /* _mesa_function_pool[21458]: GetProgramivNV (will be remapped) */
"iip\0"
"glGetProgramivNV\0"
"\0"
- /* _mesa_function_pool[21437]: GetMinmaxParameteriv (offset 366) */
+ /* _mesa_function_pool[21480]: GetMinmaxParameteriv (offset 366) */
"iip\0"
"glGetMinmaxParameteriv\0"
"glGetMinmaxParameterivEXT\0"
"\0"
- /* _mesa_function_pool[21491]: PixelTransferf (offset 247) */
+ /* _mesa_function_pool[21534]: PixelTransferf (offset 247) */
"if\0"
"glPixelTransferf\0"
"\0"
- /* _mesa_function_pool[21512]: CopyTexImage1D (offset 323) */
+ /* _mesa_function_pool[21555]: CopyTexImage1D (offset 323) */
"iiiiiii\0"
"glCopyTexImage1D\0"
"glCopyTexImage1DEXT\0"
"\0"
- /* _mesa_function_pool[21558]: PushMatrix (offset 298) */
+ /* _mesa_function_pool[21601]: PushMatrix (offset 298) */
"\0"
"glPushMatrix\0"
"\0"
- /* _mesa_function_pool[21573]: Fogiv (offset 156) */
+ /* _mesa_function_pool[21616]: Fogiv (offset 156) */
"ip\0"
"glFogiv\0"
"\0"
- /* _mesa_function_pool[21585]: TexCoord1dv (offset 95) */
+ /* _mesa_function_pool[21628]: TexCoord1dv (offset 95) */
"p\0"
"glTexCoord1dv\0"
"\0"
- /* _mesa_function_pool[21602]: AlphaFragmentOp3ATI (will be remapped) */
+ /* _mesa_function_pool[21645]: AlphaFragmentOp3ATI (will be remapped) */
"iiiiiiiiiiii\0"
"glAlphaFragmentOp3ATI\0"
"\0"
- /* _mesa_function_pool[21638]: PixelTransferi (offset 248) */
+ /* _mesa_function_pool[21681]: PixelTransferi (offset 248) */
"ii\0"
"glPixelTransferi\0"
"\0"
- /* _mesa_function_pool[21659]: GetVertexAttribdvNV (will be remapped) */
+ /* _mesa_function_pool[21702]: GetVertexAttribdvNV (will be remapped) */
"iip\0"
"glGetVertexAttribdvNV\0"
"\0"
- /* _mesa_function_pool[21686]: VertexAttrib3fvNV (will be remapped) */
+ /* _mesa_function_pool[21729]: VertexAttrib3fvNV (will be remapped) */
"ip\0"
"glVertexAttrib3fvNV\0"
"\0"
- /* _mesa_function_pool[21710]: Rotatef (offset 300) */
+ /* _mesa_function_pool[21753]: Rotatef (offset 300) */
"ffff\0"
"glRotatef\0"
"\0"
- /* _mesa_function_pool[21726]: GetFinalCombinerInputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[21769]: GetFinalCombinerInputParameterivNV (will be remapped) */
"iip\0"
"glGetFinalCombinerInputParameterivNV\0"
"\0"
- /* _mesa_function_pool[21768]: Vertex3i (offset 138) */
+ /* _mesa_function_pool[21811]: Vertex3i (offset 138) */
"iii\0"
"glVertex3i\0"
"\0"
- /* _mesa_function_pool[21784]: Vertex3f (offset 136) */
+ /* _mesa_function_pool[21827]: Vertex3f (offset 136) */
"fff\0"
"glVertex3f\0"
"\0"
- /* _mesa_function_pool[21800]: Clear (offset 203) */
+ /* _mesa_function_pool[21843]: Clear (offset 203) */
"i\0"
"glClear\0"
"\0"
- /* _mesa_function_pool[21811]: Vertex3d (offset 134) */
+ /* _mesa_function_pool[21854]: Vertex3d (offset 134) */
"ddd\0"
"glVertex3d\0"
"\0"
- /* _mesa_function_pool[21827]: GetMapParameterivNV (dynamic) */
+ /* _mesa_function_pool[21870]: GetMapParameterivNV (dynamic) */
"iip\0"
"glGetMapParameterivNV\0"
"\0"
- /* _mesa_function_pool[21854]: Uniform4iARB (will be remapped) */
+ /* _mesa_function_pool[21897]: Uniform4iARB (will be remapped) */
"iiiii\0"
"glUniform4i\0"
"glUniform4iARB\0"
"\0"
- /* _mesa_function_pool[21888]: ReadBuffer (offset 254) */
+ /* _mesa_function_pool[21931]: ReadBuffer (offset 254) */
"i\0"
"glReadBuffer\0"
"\0"
- /* _mesa_function_pool[21904]: ConvolutionParameteri (offset 352) */
+ /* _mesa_function_pool[21947]: ConvolutionParameteri (offset 352) */
"iii\0"
"glConvolutionParameteri\0"
"glConvolutionParameteriEXT\0"
"\0"
- /* _mesa_function_pool[21960]: Ortho (offset 296) */
+ /* _mesa_function_pool[22003]: Ortho (offset 296) */
"dddddd\0"
"glOrtho\0"
"\0"
- /* _mesa_function_pool[21976]: Binormal3sEXT (dynamic) */
+ /* _mesa_function_pool[22019]: Binormal3sEXT (dynamic) */
"iii\0"
"glBinormal3sEXT\0"
"\0"
- /* _mesa_function_pool[21997]: ListBase (offset 6) */
+ /* _mesa_function_pool[22040]: ListBase (offset 6) */
"i\0"
"glListBase\0"
"\0"
- /* _mesa_function_pool[22011]: Vertex3s (offset 140) */
+ /* _mesa_function_pool[22054]: Vertex3s (offset 140) */
"iii\0"
"glVertex3s\0"
"\0"
- /* _mesa_function_pool[22027]: ConvolutionParameterf (offset 350) */
+ /* _mesa_function_pool[22070]: ConvolutionParameterf (offset 350) */
"iif\0"
"glConvolutionParameterf\0"
"glConvolutionParameterfEXT\0"
"\0"
- /* _mesa_function_pool[22083]: GetColorTableParameteriv (offset 345) */
+ /* _mesa_function_pool[22126]: GetColorTableParameteriv (offset 345) */
"iip\0"
"glGetColorTableParameteriv\0"
"glGetColorTableParameterivSGI\0"
"glGetColorTableParameterivEXT\0"
"\0"
- /* _mesa_function_pool[22175]: ProgramEnvParameter4dvARB (will be remapped) */
+ /* _mesa_function_pool[22218]: ProgramEnvParameter4dvARB (will be remapped) */
"iip\0"
"glProgramEnvParameter4dvARB\0"
"glProgramParameter4dvNV\0"
"\0"
- /* _mesa_function_pool[22232]: ShadeModel (offset 177) */
+ /* _mesa_function_pool[22275]: ShadeModel (offset 177) */
"i\0"
"glShadeModel\0"
"\0"
- /* _mesa_function_pool[22248]: VertexAttribs2fvNV (will be remapped) */
+ /* _mesa_function_pool[22291]: VertexAttribs2fvNV (will be remapped) */
"iip\0"
"glVertexAttribs2fvNV\0"
"\0"
- /* _mesa_function_pool[22274]: Rectiv (offset 91) */
+ /* _mesa_function_pool[22317]: Rectiv (offset 91) */
"pp\0"
"glRectiv\0"
"\0"
- /* _mesa_function_pool[22287]: UseProgramObjectARB (will be remapped) */
+ /* _mesa_function_pool[22330]: UseProgramObjectARB (will be remapped) */
"i\0"
"glUseProgram\0"
"glUseProgramObjectARB\0"
"\0"
- /* _mesa_function_pool[22325]: GetMapParameterfvNV (dynamic) */
+ /* _mesa_function_pool[22368]: GetMapParameterfvNV (dynamic) */
"iip\0"
"glGetMapParameterfvNV\0"
"\0"
- /* _mesa_function_pool[22352]: PassTexCoordATI (will be remapped) */
+ /* _mesa_function_pool[22395]: PassTexCoordATI (will be remapped) */
"iii\0"
"glPassTexCoordATI\0"
"\0"
- /* _mesa_function_pool[22375]: DeleteProgram (will be remapped) */
+ /* _mesa_function_pool[22418]: DeleteProgram (will be remapped) */
"i\0"
"glDeleteProgram\0"
"\0"
- /* _mesa_function_pool[22394]: Tangent3ivEXT (dynamic) */
+ /* _mesa_function_pool[22437]: Tangent3ivEXT (dynamic) */
"p\0"
"glTangent3ivEXT\0"
"\0"
- /* _mesa_function_pool[22413]: Tangent3dEXT (dynamic) */
+ /* _mesa_function_pool[22456]: Tangent3dEXT (dynamic) */
"ddd\0"
"glTangent3dEXT\0"
"\0"
- /* _mesa_function_pool[22433]: SecondaryColor3dvEXT (will be remapped) */
+ /* _mesa_function_pool[22476]: SecondaryColor3dvEXT (will be remapped) */
"p\0"
"glSecondaryColor3dv\0"
"glSecondaryColor3dvEXT\0"
"\0"
- /* _mesa_function_pool[22479]: Vertex2fv (offset 129) */
+ /* _mesa_function_pool[22522]: Vertex2fv (offset 129) */
"p\0"
"glVertex2fv\0"
"\0"
- /* _mesa_function_pool[22494]: MultiDrawArraysEXT (will be remapped) */
+ /* _mesa_function_pool[22537]: MultiDrawArraysEXT (will be remapped) */
"ippi\0"
"glMultiDrawArrays\0"
"glMultiDrawArraysEXT\0"
"\0"
- /* _mesa_function_pool[22539]: BindRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[22582]: BindRenderbufferEXT (will be remapped) */
"ii\0"
"glBindRenderbuffer\0"
"glBindRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[22584]: MultiTexCoord4dARB (offset 400) */
+ /* _mesa_function_pool[22627]: MultiTexCoord4dARB (offset 400) */
"idddd\0"
"glMultiTexCoord4d\0"
"glMultiTexCoord4dARB\0"
"\0"
- /* _mesa_function_pool[22630]: Vertex3sv (offset 141) */
+ /* _mesa_function_pool[22673]: Vertex3sv (offset 141) */
"p\0"
"glVertex3sv\0"
"\0"
- /* _mesa_function_pool[22645]: SecondaryColor3usEXT (will be remapped) */
+ /* _mesa_function_pool[22688]: SecondaryColor3usEXT (will be remapped) */
"iii\0"
"glSecondaryColor3us\0"
"glSecondaryColor3usEXT\0"
"\0"
- /* _mesa_function_pool[22693]: ProgramLocalParameter4fvARB (will be remapped) */
+ /* _mesa_function_pool[22736]: ProgramLocalParameter4fvARB (will be remapped) */
"iip\0"
"glProgramLocalParameter4fvARB\0"
"\0"
- /* _mesa_function_pool[22728]: DeleteProgramsNV (will be remapped) */
+ /* _mesa_function_pool[22771]: DeleteProgramsNV (will be remapped) */
"ip\0"
"glDeleteProgramsARB\0"
"glDeleteProgramsNV\0"
"\0"
- /* _mesa_function_pool[22771]: EvalMesh1 (offset 236) */
+ /* _mesa_function_pool[22814]: EvalMesh1 (offset 236) */
"iii\0"
"glEvalMesh1\0"
"\0"
- /* _mesa_function_pool[22788]: MultiTexCoord1sARB (offset 382) */
+ /* _mesa_function_pool[22831]: MultiTexCoord1sARB (offset 382) */
"ii\0"
"glMultiTexCoord1s\0"
"glMultiTexCoord1sARB\0"
"\0"
- /* _mesa_function_pool[22831]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[22874]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
"iffffff\0"
"glReplacementCodeuiColor3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[22878]: GetVertexAttribPointervNV (will be remapped) */
+ /* _mesa_function_pool[22921]: GetVertexAttribPointervNV (will be remapped) */
"iip\0"
"glGetVertexAttribPointerv\0"
"glGetVertexAttribPointervARB\0"
"glGetVertexAttribPointervNV\0"
"\0"
- /* _mesa_function_pool[22966]: MultiTexCoord1dvARB (offset 377) */
+ /* _mesa_function_pool[23009]: MultiTexCoord1dvARB (offset 377) */
"ip\0"
"glMultiTexCoord1dv\0"
"glMultiTexCoord1dvARB\0"
"\0"
- /* _mesa_function_pool[23011]: Uniform2iARB (will be remapped) */
+ /* _mesa_function_pool[23054]: Uniform2iARB (will be remapped) */
"iii\0"
"glUniform2i\0"
"glUniform2iARB\0"
"\0"
- /* _mesa_function_pool[23043]: Vertex2iv (offset 131) */
+ /* _mesa_function_pool[23086]: Vertex2iv (offset 131) */
"p\0"
"glVertex2iv\0"
"\0"
- /* _mesa_function_pool[23058]: GetProgramStringNV (will be remapped) */
+ /* _mesa_function_pool[23101]: GetProgramStringNV (will be remapped) */
"iip\0"
"glGetProgramStringNV\0"
"\0"
- /* _mesa_function_pool[23084]: ColorPointerEXT (will be remapped) */
+ /* _mesa_function_pool[23127]: ColorPointerEXT (will be remapped) */
"iiiip\0"
"glColorPointerEXT\0"
"\0"
- /* _mesa_function_pool[23109]: LineWidth (offset 168) */
+ /* _mesa_function_pool[23152]: LineWidth (offset 168) */
"f\0"
"glLineWidth\0"
"\0"
- /* _mesa_function_pool[23124]: MapBufferARB (will be remapped) */
+ /* _mesa_function_pool[23167]: MapBufferARB (will be remapped) */
"ii\0"
"glMapBuffer\0"
"glMapBufferARB\0"
"\0"
- /* _mesa_function_pool[23155]: MultiDrawElementsBaseVertex (will be remapped) */
+ /* _mesa_function_pool[23198]: MultiDrawElementsBaseVertex (will be remapped) */
"ipipip\0"
"glMultiDrawElementsBaseVertex\0"
"\0"
- /* _mesa_function_pool[23193]: Binormal3svEXT (dynamic) */
+ /* _mesa_function_pool[23236]: Binormal3svEXT (dynamic) */
"p\0"
"glBinormal3svEXT\0"
"\0"
- /* _mesa_function_pool[23213]: ApplyTextureEXT (dynamic) */
+ /* _mesa_function_pool[23256]: ApplyTextureEXT (dynamic) */
"i\0"
"glApplyTextureEXT\0"
"\0"
- /* _mesa_function_pool[23234]: TexGendv (offset 189) */
+ /* _mesa_function_pool[23277]: TexGendv (offset 189) */
"iip\0"
"glTexGendv\0"
"\0"
- /* _mesa_function_pool[23250]: TextureMaterialEXT (dynamic) */
+ /* _mesa_function_pool[23293]: TextureMaterialEXT (dynamic) */
"ii\0"
"glTextureMaterialEXT\0"
"\0"
- /* _mesa_function_pool[23275]: TextureLightEXT (dynamic) */
+ /* _mesa_function_pool[23318]: TextureLightEXT (dynamic) */
"i\0"
"glTextureLightEXT\0"
"\0"
- /* _mesa_function_pool[23296]: ResetMinmax (offset 370) */
+ /* _mesa_function_pool[23339]: ResetMinmax (offset 370) */
"i\0"
"glResetMinmax\0"
"glResetMinmaxEXT\0"
"\0"
- /* _mesa_function_pool[23330]: SpriteParameterfSGIX (dynamic) */
+ /* _mesa_function_pool[23373]: SpriteParameterfSGIX (dynamic) */
"if\0"
"glSpriteParameterfSGIX\0"
"\0"
- /* _mesa_function_pool[23357]: EnableClientState (offset 313) */
+ /* _mesa_function_pool[23400]: EnableClientState (offset 313) */
"i\0"
"glEnableClientState\0"
"\0"
- /* _mesa_function_pool[23380]: VertexAttrib4sNV (will be remapped) */
+ /* _mesa_function_pool[23423]: VertexAttrib4sNV (will be remapped) */
"iiiii\0"
"glVertexAttrib4sNV\0"
"\0"
- /* _mesa_function_pool[23406]: GetConvolutionParameterfv (offset 357) */
+ /* _mesa_function_pool[23449]: GetConvolutionParameterfv (offset 357) */
"iip\0"
"glGetConvolutionParameterfv\0"
"glGetConvolutionParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[23470]: VertexAttribs4dvNV (will be remapped) */
+ /* _mesa_function_pool[23513]: VertexAttribs4dvNV (will be remapped) */
"iip\0"
"glVertexAttribs4dvNV\0"
"\0"
- /* _mesa_function_pool[23496]: VertexAttrib4dARB (will be remapped) */
+ /* _mesa_function_pool[23539]: MultiModeDrawArraysIBM (will be remapped) */
+ "pppii\0"
+ "glMultiModeDrawArraysIBM\0"
+ "\0"
+ /* _mesa_function_pool[23571]: VertexAttrib4dARB (will be remapped) */
"idddd\0"
"glVertexAttrib4d\0"
"glVertexAttrib4dARB\0"
"\0"
- /* _mesa_function_pool[23540]: GetTexBumpParameterfvATI (will be remapped) */
+ /* _mesa_function_pool[23615]: GetTexBumpParameterfvATI (will be remapped) */
"ip\0"
"glGetTexBumpParameterfvATI\0"
"\0"
- /* _mesa_function_pool[23571]: ProgramNamedParameter4dNV (will be remapped) */
+ /* _mesa_function_pool[23646]: ProgramNamedParameter4dNV (will be remapped) */
"iipdddd\0"
"glProgramNamedParameter4dNV\0"
"\0"
- /* _mesa_function_pool[23608]: GetMaterialfv (offset 269) */
+ /* _mesa_function_pool[23683]: GetMaterialfv (offset 269) */
"iip\0"
"glGetMaterialfv\0"
"\0"
- /* _mesa_function_pool[23629]: VertexWeightfEXT (dynamic) */
+ /* _mesa_function_pool[23704]: VertexWeightfEXT (dynamic) */
"f\0"
"glVertexWeightfEXT\0"
"\0"
- /* _mesa_function_pool[23651]: Binormal3fEXT (dynamic) */
+ /* _mesa_function_pool[23726]: Binormal3fEXT (dynamic) */
"fff\0"
"glBinormal3fEXT\0"
"\0"
- /* _mesa_function_pool[23672]: CallList (offset 2) */
+ /* _mesa_function_pool[23747]: CallList (offset 2) */
"i\0"
"glCallList\0"
"\0"
- /* _mesa_function_pool[23686]: Materialfv (offset 170) */
+ /* _mesa_function_pool[23761]: Materialfv (offset 170) */
"iip\0"
"glMaterialfv\0"
"\0"
- /* _mesa_function_pool[23704]: TexCoord3fv (offset 113) */
+ /* _mesa_function_pool[23779]: TexCoord3fv (offset 113) */
"p\0"
"glTexCoord3fv\0"
"\0"
- /* _mesa_function_pool[23721]: FogCoordfvEXT (will be remapped) */
+ /* _mesa_function_pool[23796]: FogCoordfvEXT (will be remapped) */
"p\0"
"glFogCoordfv\0"
"glFogCoordfvEXT\0"
"\0"
- /* _mesa_function_pool[23753]: MultiTexCoord1ivARB (offset 381) */
+ /* _mesa_function_pool[23828]: MultiTexCoord1ivARB (offset 381) */
"ip\0"
"glMultiTexCoord1iv\0"
"glMultiTexCoord1ivARB\0"
"\0"
- /* _mesa_function_pool[23798]: SecondaryColor3ubEXT (will be remapped) */
+ /* _mesa_function_pool[23873]: SecondaryColor3ubEXT (will be remapped) */
"iii\0"
"glSecondaryColor3ub\0"
"glSecondaryColor3ubEXT\0"
"\0"
- /* _mesa_function_pool[23846]: MultiTexCoord2ivARB (offset 389) */
+ /* _mesa_function_pool[23921]: MultiTexCoord2ivARB (offset 389) */
"ip\0"
"glMultiTexCoord2iv\0"
"glMultiTexCoord2ivARB\0"
"\0"
- /* _mesa_function_pool[23891]: FogFuncSGIS (dynamic) */
+ /* _mesa_function_pool[23966]: FogFuncSGIS (dynamic) */
"ip\0"
"glFogFuncSGIS\0"
"\0"
- /* _mesa_function_pool[23909]: CopyTexSubImage2D (offset 326) */
+ /* _mesa_function_pool[23984]: CopyTexSubImage2D (offset 326) */
"iiiiiiii\0"
"glCopyTexSubImage2D\0"
"glCopyTexSubImage2DEXT\0"
"\0"
- /* _mesa_function_pool[23962]: GetObjectParameterivARB (will be remapped) */
+ /* _mesa_function_pool[24037]: GetObjectParameterivARB (will be remapped) */
"iip\0"
"glGetObjectParameterivARB\0"
"\0"
- /* _mesa_function_pool[23993]: Color3iv (offset 16) */
+ /* _mesa_function_pool[24068]: Color3iv (offset 16) */
"p\0"
"glColor3iv\0"
"\0"
- /* _mesa_function_pool[24007]: TexCoord4fVertex4fSUN (dynamic) */
+ /* _mesa_function_pool[24082]: TexCoord4fVertex4fSUN (dynamic) */
"ffffffff\0"
"glTexCoord4fVertex4fSUN\0"
"\0"
- /* _mesa_function_pool[24041]: DrawElements (offset 311) */
+ /* _mesa_function_pool[24116]: DrawElements (offset 311) */
"iiip\0"
"glDrawElements\0"
"\0"
- /* _mesa_function_pool[24062]: BindVertexArrayAPPLE (will be remapped) */
+ /* _mesa_function_pool[24137]: BindVertexArrayAPPLE (will be remapped) */
"i\0"
"glBindVertexArrayAPPLE\0"
"\0"
- /* _mesa_function_pool[24088]: GetProgramLocalParameterdvARB (will be remapped) */
+ /* _mesa_function_pool[24163]: GetProgramLocalParameterdvARB (will be remapped) */
"iip\0"
"glGetProgramLocalParameterdvARB\0"
"\0"
- /* _mesa_function_pool[24125]: GetHistogramParameteriv (offset 363) */
+ /* _mesa_function_pool[24200]: GetHistogramParameteriv (offset 363) */
"iip\0"
"glGetHistogramParameteriv\0"
"glGetHistogramParameterivEXT\0"
"\0"
- /* _mesa_function_pool[24185]: MultiTexCoord1iARB (offset 380) */
+ /* _mesa_function_pool[24260]: MultiTexCoord1iARB (offset 380) */
"ii\0"
"glMultiTexCoord1i\0"
"glMultiTexCoord1iARB\0"
"\0"
- /* _mesa_function_pool[24228]: GetConvolutionFilter (offset 356) */
+ /* _mesa_function_pool[24303]: GetConvolutionFilter (offset 356) */
"iiip\0"
"glGetConvolutionFilter\0"
"glGetConvolutionFilterEXT\0"
"\0"
- /* _mesa_function_pool[24283]: GetProgramivARB (will be remapped) */
+ /* _mesa_function_pool[24358]: GetProgramivARB (will be remapped) */
"iip\0"
"glGetProgramivARB\0"
"\0"
- /* _mesa_function_pool[24306]: BlendFuncSeparateEXT (will be remapped) */
+ /* _mesa_function_pool[24381]: BlendFuncSeparateEXT (will be remapped) */
"iiii\0"
"glBlendFuncSeparate\0"
"glBlendFuncSeparateEXT\0"
"glBlendFuncSeparateINGR\0"
"\0"
- /* _mesa_function_pool[24379]: MapBufferRange (will be remapped) */
+ /* _mesa_function_pool[24454]: MapBufferRange (will be remapped) */
"iiii\0"
"glMapBufferRange\0"
"\0"
- /* _mesa_function_pool[24402]: ProgramParameters4dvNV (will be remapped) */
+ /* _mesa_function_pool[24477]: ProgramParameters4dvNV (will be remapped) */
"iiip\0"
"glProgramParameters4dvNV\0"
"\0"
- /* _mesa_function_pool[24433]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[24508]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
"ppp\0"
"glTexCoord2fColor3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[24470]: EvalPoint2 (offset 239) */
+ /* _mesa_function_pool[24545]: EvalPoint2 (offset 239) */
"ii\0"
"glEvalPoint2\0"
"\0"
- /* _mesa_function_pool[24487]: EvalPoint1 (offset 237) */
+ /* _mesa_function_pool[24562]: EvalPoint1 (offset 237) */
"i\0"
"glEvalPoint1\0"
"\0"
- /* _mesa_function_pool[24503]: Binormal3dvEXT (dynamic) */
+ /* _mesa_function_pool[24578]: Binormal3dvEXT (dynamic) */
"p\0"
"glBinormal3dvEXT\0"
"\0"
- /* _mesa_function_pool[24523]: PopMatrix (offset 297) */
+ /* _mesa_function_pool[24598]: PopMatrix (offset 297) */
"\0"
"glPopMatrix\0"
"\0"
- /* _mesa_function_pool[24537]: FinishFenceNV (will be remapped) */
+ /* _mesa_function_pool[24612]: FinishFenceNV (will be remapped) */
"i\0"
"glFinishFenceNV\0"
"\0"
- /* _mesa_function_pool[24556]: GetFogFuncSGIS (dynamic) */
+ /* _mesa_function_pool[24631]: GetFogFuncSGIS (dynamic) */
"p\0"
"glGetFogFuncSGIS\0"
"\0"
- /* _mesa_function_pool[24576]: GetUniformLocationARB (will be remapped) */
+ /* _mesa_function_pool[24651]: GetUniformLocationARB (will be remapped) */
"ip\0"
"glGetUniformLocation\0"
"glGetUniformLocationARB\0"
"\0"
- /* _mesa_function_pool[24625]: SecondaryColor3fEXT (will be remapped) */
+ /* _mesa_function_pool[24700]: SecondaryColor3fEXT (will be remapped) */
"fff\0"
"glSecondaryColor3f\0"
"glSecondaryColor3fEXT\0"
"\0"
- /* _mesa_function_pool[24671]: GetTexGeniv (offset 280) */
+ /* _mesa_function_pool[24746]: GetTexGeniv (offset 280) */
"iip\0"
"glGetTexGeniv\0"
"\0"
- /* _mesa_function_pool[24690]: CombinerInputNV (will be remapped) */
+ /* _mesa_function_pool[24765]: CombinerInputNV (will be remapped) */
"iiiiii\0"
"glCombinerInputNV\0"
"\0"
- /* _mesa_function_pool[24716]: VertexAttrib3sARB (will be remapped) */
+ /* _mesa_function_pool[24791]: VertexAttrib3sARB (will be remapped) */
"iiii\0"
"glVertexAttrib3s\0"
"glVertexAttrib3sARB\0"
"\0"
- /* _mesa_function_pool[24759]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[24834]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
"ppp\0"
"glReplacementCodeuiNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[24804]: Map2d (offset 222) */
+ /* _mesa_function_pool[24879]: Map2d (offset 222) */
"iddiiddiip\0"
"glMap2d\0"
"\0"
- /* _mesa_function_pool[24824]: Map2f (offset 223) */
+ /* _mesa_function_pool[24899]: Map2f (offset 223) */
"iffiiffiip\0"
"glMap2f\0"
"\0"
- /* _mesa_function_pool[24844]: ProgramStringARB (will be remapped) */
+ /* _mesa_function_pool[24919]: ProgramStringARB (will be remapped) */
"iiip\0"
"glProgramStringARB\0"
"\0"
- /* _mesa_function_pool[24869]: Vertex4s (offset 148) */
+ /* _mesa_function_pool[24944]: Vertex4s (offset 148) */
"iiii\0"
"glVertex4s\0"
"\0"
- /* _mesa_function_pool[24886]: TexCoord4fVertex4fvSUN (dynamic) */
+ /* _mesa_function_pool[24961]: TexCoord4fVertex4fvSUN (dynamic) */
"pp\0"
"glTexCoord4fVertex4fvSUN\0"
"\0"
- /* _mesa_function_pool[24915]: VertexAttrib3sNV (will be remapped) */
+ /* _mesa_function_pool[24990]: VertexAttrib3sNV (will be remapped) */
"iiii\0"
"glVertexAttrib3sNV\0"
"\0"
- /* _mesa_function_pool[24940]: VertexAttrib1fNV (will be remapped) */
+ /* _mesa_function_pool[25015]: VertexAttrib1fNV (will be remapped) */
"if\0"
"glVertexAttrib1fNV\0"
"\0"
- /* _mesa_function_pool[24963]: Vertex4f (offset 144) */
+ /* _mesa_function_pool[25038]: Vertex4f (offset 144) */
"ffff\0"
"glVertex4f\0"
"\0"
- /* _mesa_function_pool[24980]: EvalCoord1d (offset 228) */
+ /* _mesa_function_pool[25055]: EvalCoord1d (offset 228) */
"d\0"
"glEvalCoord1d\0"
"\0"
- /* _mesa_function_pool[24997]: Vertex4d (offset 142) */
+ /* _mesa_function_pool[25072]: Vertex4d (offset 142) */
"dddd\0"
"glVertex4d\0"
"\0"
- /* _mesa_function_pool[25014]: RasterPos4dv (offset 79) */
+ /* _mesa_function_pool[25089]: RasterPos4dv (offset 79) */
"p\0"
"glRasterPos4dv\0"
"\0"
- /* _mesa_function_pool[25032]: FragmentLightfSGIX (dynamic) */
+ /* _mesa_function_pool[25107]: FragmentLightfSGIX (dynamic) */
"iif\0"
"glFragmentLightfSGIX\0"
"\0"
- /* _mesa_function_pool[25058]: GetCompressedTexImageARB (will be remapped) */
+ /* _mesa_function_pool[25133]: GetCompressedTexImageARB (will be remapped) */
"iip\0"
"glGetCompressedTexImage\0"
"glGetCompressedTexImageARB\0"
"\0"
- /* _mesa_function_pool[25114]: GetTexGenfv (offset 279) */
+ /* _mesa_function_pool[25189]: GetTexGenfv (offset 279) */
"iip\0"
"glGetTexGenfv\0"
"\0"
- /* _mesa_function_pool[25133]: Vertex4i (offset 146) */
+ /* _mesa_function_pool[25208]: Vertex4i (offset 146) */
"iiii\0"
"glVertex4i\0"
"\0"
- /* _mesa_function_pool[25150]: VertexWeightPointerEXT (dynamic) */
+ /* _mesa_function_pool[25225]: VertexWeightPointerEXT (dynamic) */
"iiip\0"
"glVertexWeightPointerEXT\0"
"\0"
- /* _mesa_function_pool[25181]: GetHistogram (offset 361) */
+ /* _mesa_function_pool[25256]: GetHistogram (offset 361) */
"iiiip\0"
"glGetHistogram\0"
"glGetHistogramEXT\0"
"\0"
- /* _mesa_function_pool[25221]: ActiveStencilFaceEXT (will be remapped) */
+ /* _mesa_function_pool[25296]: ActiveStencilFaceEXT (will be remapped) */
"i\0"
"glActiveStencilFaceEXT\0"
"\0"
- /* _mesa_function_pool[25247]: StencilFuncSeparateATI (will be remapped) */
+ /* _mesa_function_pool[25322]: StencilFuncSeparateATI (will be remapped) */
"iiii\0"
"glStencilFuncSeparateATI\0"
"\0"
- /* _mesa_function_pool[25278]: Materialf (offset 169) */
+ /* _mesa_function_pool[25353]: Materialf (offset 169) */
"iif\0"
"glMaterialf\0"
"\0"
- /* _mesa_function_pool[25295]: GetShaderSourceARB (will be remapped) */
+ /* _mesa_function_pool[25370]: GetShaderSourceARB (will be remapped) */
"iipp\0"
"glGetShaderSource\0"
"glGetShaderSourceARB\0"
"\0"
- /* _mesa_function_pool[25340]: IglooInterfaceSGIX (dynamic) */
+ /* _mesa_function_pool[25415]: IglooInterfaceSGIX (dynamic) */
"ip\0"
"glIglooInterfaceSGIX\0"
"\0"
- /* _mesa_function_pool[25365]: Materiali (offset 171) */
+ /* _mesa_function_pool[25440]: Materiali (offset 171) */
"iii\0"
"glMateriali\0"
"\0"
- /* _mesa_function_pool[25382]: VertexAttrib4dNV (will be remapped) */
+ /* _mesa_function_pool[25457]: VertexAttrib4dNV (will be remapped) */
"idddd\0"
"glVertexAttrib4dNV\0"
"\0"
- /* _mesa_function_pool[25408]: MultiModeDrawElementsIBM (will be remapped) */
+ /* _mesa_function_pool[25483]: MultiModeDrawElementsIBM (will be remapped) */
"ppipii\0"
"glMultiModeDrawElementsIBM\0"
"\0"
- /* _mesa_function_pool[25443]: Indexsv (offset 51) */
+ /* _mesa_function_pool[25518]: Indexsv (offset 51) */
"p\0"
"glIndexsv\0"
"\0"
- /* _mesa_function_pool[25456]: MultiTexCoord4svARB (offset 407) */
+ /* _mesa_function_pool[25531]: MultiTexCoord4svARB (offset 407) */
"ip\0"
"glMultiTexCoord4sv\0"
"glMultiTexCoord4svARB\0"
"\0"
- /* _mesa_function_pool[25501]: LightModelfv (offset 164) */
+ /* _mesa_function_pool[25576]: LightModelfv (offset 164) */
"ip\0"
"glLightModelfv\0"
"\0"
- /* _mesa_function_pool[25520]: TexCoord2dv (offset 103) */
+ /* _mesa_function_pool[25595]: TexCoord2dv (offset 103) */
"p\0"
"glTexCoord2dv\0"
"\0"
- /* _mesa_function_pool[25537]: GenQueriesARB (will be remapped) */
+ /* _mesa_function_pool[25612]: GenQueriesARB (will be remapped) */
"ip\0"
"glGenQueries\0"
"glGenQueriesARB\0"
"\0"
- /* _mesa_function_pool[25570]: EvalCoord1dv (offset 229) */
+ /* _mesa_function_pool[25645]: EvalCoord1dv (offset 229) */
"p\0"
"glEvalCoord1dv\0"
"\0"
- /* _mesa_function_pool[25588]: ReplacementCodeuiVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[25663]: ReplacementCodeuiVertex3fSUN (dynamic) */
"ifff\0"
"glReplacementCodeuiVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[25625]: Translated (offset 303) */
+ /* _mesa_function_pool[25700]: Translated (offset 303) */
"ddd\0"
"glTranslated\0"
"\0"
- /* _mesa_function_pool[25643]: Translatef (offset 304) */
+ /* _mesa_function_pool[25718]: Translatef (offset 304) */
"fff\0"
"glTranslatef\0"
"\0"
- /* _mesa_function_pool[25661]: StencilMask (offset 209) */
+ /* _mesa_function_pool[25736]: StencilMask (offset 209) */
"i\0"
"glStencilMask\0"
"\0"
- /* _mesa_function_pool[25678]: Tangent3iEXT (dynamic) */
+ /* _mesa_function_pool[25753]: Tangent3iEXT (dynamic) */
"iii\0"
"glTangent3iEXT\0"
"\0"
- /* _mesa_function_pool[25698]: GetLightiv (offset 265) */
+ /* _mesa_function_pool[25773]: GetLightiv (offset 265) */
"iip\0"
"glGetLightiv\0"
"\0"
- /* _mesa_function_pool[25716]: DrawMeshArraysSUN (dynamic) */
+ /* _mesa_function_pool[25791]: DrawMeshArraysSUN (dynamic) */
"iiii\0"
"glDrawMeshArraysSUN\0"
"\0"
- /* _mesa_function_pool[25742]: IsList (offset 287) */
+ /* _mesa_function_pool[25817]: IsList (offset 287) */
"i\0"
"glIsList\0"
"\0"
- /* _mesa_function_pool[25754]: IsSync (will be remapped) */
+ /* _mesa_function_pool[25829]: IsSync (will be remapped) */
"i\0"
"glIsSync\0"
"\0"
- /* _mesa_function_pool[25766]: RenderMode (offset 196) */
+ /* _mesa_function_pool[25841]: RenderMode (offset 196) */
"i\0"
"glRenderMode\0"
"\0"
- /* _mesa_function_pool[25782]: GetMapControlPointsNV (dynamic) */
+ /* _mesa_function_pool[25857]: GetMapControlPointsNV (dynamic) */
"iiiiiip\0"
"glGetMapControlPointsNV\0"
"\0"
- /* _mesa_function_pool[25815]: DrawBuffersARB (will be remapped) */
+ /* _mesa_function_pool[25890]: DrawBuffersARB (will be remapped) */
"ip\0"
"glDrawBuffers\0"
"glDrawBuffersARB\0"
"glDrawBuffersATI\0"
"\0"
- /* _mesa_function_pool[25867]: ProgramLocalParameter4fARB (will be remapped) */
+ /* _mesa_function_pool[25942]: ProgramLocalParameter4fARB (will be remapped) */
"iiffff\0"
"glProgramLocalParameter4fARB\0"
"\0"
- /* _mesa_function_pool[25904]: SpriteParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[25979]: SpriteParameterivSGIX (dynamic) */
"ip\0"
"glSpriteParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[25932]: ProvokingVertexEXT (will be remapped) */
+ /* _mesa_function_pool[26007]: ProvokingVertexEXT (will be remapped) */
"i\0"
"glProvokingVertexEXT\0"
"glProvokingVertex\0"
"\0"
- /* _mesa_function_pool[25974]: MultiTexCoord1fARB (offset 378) */
+ /* _mesa_function_pool[26049]: MultiTexCoord1fARB (offset 378) */
"if\0"
"glMultiTexCoord1f\0"
"glMultiTexCoord1fARB\0"
"\0"
- /* _mesa_function_pool[26017]: LoadName (offset 198) */
+ /* _mesa_function_pool[26092]: LoadName (offset 198) */
"i\0"
"glLoadName\0"
"\0"
- /* _mesa_function_pool[26031]: VertexAttribs4ubvNV (will be remapped) */
+ /* _mesa_function_pool[26106]: VertexAttribs4ubvNV (will be remapped) */
"iip\0"
"glVertexAttribs4ubvNV\0"
"\0"
- /* _mesa_function_pool[26058]: WeightsvARB (dynamic) */
+ /* _mesa_function_pool[26133]: WeightsvARB (dynamic) */
"ip\0"
"glWeightsvARB\0"
"\0"
- /* _mesa_function_pool[26076]: Uniform1fvARB (will be remapped) */
+ /* _mesa_function_pool[26151]: Uniform1fvARB (will be remapped) */
"iip\0"
"glUniform1fv\0"
"glUniform1fvARB\0"
"\0"
- /* _mesa_function_pool[26110]: CopyTexSubImage1D (offset 325) */
+ /* _mesa_function_pool[26185]: CopyTexSubImage1D (offset 325) */
"iiiiii\0"
"glCopyTexSubImage1D\0"
"glCopyTexSubImage1DEXT\0"
"\0"
- /* _mesa_function_pool[26161]: CullFace (offset 152) */
+ /* _mesa_function_pool[26236]: CullFace (offset 152) */
"i\0"
"glCullFace\0"
"\0"
- /* _mesa_function_pool[26175]: BindTexture (offset 307) */
+ /* _mesa_function_pool[26250]: BindTexture (offset 307) */
"ii\0"
"glBindTexture\0"
"glBindTextureEXT\0"
"\0"
- /* _mesa_function_pool[26210]: BeginFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[26285]: BeginFragmentShaderATI (will be remapped) */
"\0"
"glBeginFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[26237]: MultiTexCoord4fARB (offset 402) */
+ /* _mesa_function_pool[26312]: MultiTexCoord4fARB (offset 402) */
"iffff\0"
"glMultiTexCoord4f\0"
"glMultiTexCoord4fARB\0"
"\0"
- /* _mesa_function_pool[26283]: VertexAttribs3svNV (will be remapped) */
+ /* _mesa_function_pool[26358]: VertexAttribs3svNV (will be remapped) */
"iip\0"
"glVertexAttribs3svNV\0"
"\0"
- /* _mesa_function_pool[26309]: StencilFunc (offset 243) */
+ /* _mesa_function_pool[26384]: StencilFunc (offset 243) */
"iii\0"
"glStencilFunc\0"
"\0"
- /* _mesa_function_pool[26328]: CopyPixels (offset 255) */
+ /* _mesa_function_pool[26403]: CopyPixels (offset 255) */
"iiiii\0"
"glCopyPixels\0"
"\0"
- /* _mesa_function_pool[26348]: Rectsv (offset 93) */
+ /* _mesa_function_pool[26423]: Rectsv (offset 93) */
"pp\0"
"glRectsv\0"
"\0"
- /* _mesa_function_pool[26361]: ReplacementCodeuivSUN (dynamic) */
+ /* _mesa_function_pool[26436]: ReplacementCodeuivSUN (dynamic) */
"p\0"
"glReplacementCodeuivSUN\0"
"\0"
- /* _mesa_function_pool[26388]: EnableVertexAttribArrayARB (will be remapped) */
+ /* _mesa_function_pool[26463]: EnableVertexAttribArrayARB (will be remapped) */
"i\0"
"glEnableVertexAttribArray\0"
"glEnableVertexAttribArrayARB\0"
"\0"
- /* _mesa_function_pool[26446]: NormalPointervINTEL (dynamic) */
+ /* _mesa_function_pool[26521]: NormalPointervINTEL (dynamic) */
"ip\0"
"glNormalPointervINTEL\0"
"\0"
- /* _mesa_function_pool[26472]: CopyConvolutionFilter2D (offset 355) */
+ /* _mesa_function_pool[26547]: CopyConvolutionFilter2D (offset 355) */
"iiiiii\0"
"glCopyConvolutionFilter2D\0"
"glCopyConvolutionFilter2DEXT\0"
"\0"
- /* _mesa_function_pool[26535]: WindowPos3ivMESA (will be remapped) */
+ /* _mesa_function_pool[26610]: WindowPos3ivMESA (will be remapped) */
"p\0"
"glWindowPos3iv\0"
"glWindowPos3ivARB\0"
"glWindowPos3ivMESA\0"
"\0"
- /* _mesa_function_pool[26590]: CopyBufferSubData (will be remapped) */
+ /* _mesa_function_pool[26665]: CopyBufferSubData (will be remapped) */
"iiiii\0"
"glCopyBufferSubData\0"
"\0"
- /* _mesa_function_pool[26617]: NormalPointer (offset 318) */
+ /* _mesa_function_pool[26692]: NormalPointer (offset 318) */
"iip\0"
"glNormalPointer\0"
"\0"
- /* _mesa_function_pool[26638]: TexParameterfv (offset 179) */
+ /* _mesa_function_pool[26713]: TexParameterfv (offset 179) */
"iip\0"
"glTexParameterfv\0"
"\0"
- /* _mesa_function_pool[26660]: IsBufferARB (will be remapped) */
+ /* _mesa_function_pool[26735]: IsBufferARB (will be remapped) */
"i\0"
"glIsBuffer\0"
"glIsBufferARB\0"
"\0"
- /* _mesa_function_pool[26688]: WindowPos4iMESA (will be remapped) */
+ /* _mesa_function_pool[26763]: WindowPos4iMESA (will be remapped) */
"iiii\0"
"glWindowPos4iMESA\0"
"\0"
- /* _mesa_function_pool[26712]: VertexAttrib4uivARB (will be remapped) */
+ /* _mesa_function_pool[26787]: VertexAttrib4uivARB (will be remapped) */
"ip\0"
"glVertexAttrib4uiv\0"
"glVertexAttrib4uivARB\0"
"\0"
- /* _mesa_function_pool[26757]: Tangent3bvEXT (dynamic) */
+ /* _mesa_function_pool[26832]: Tangent3bvEXT (dynamic) */
"p\0"
"glTangent3bvEXT\0"
"\0"
- /* _mesa_function_pool[26776]: UniformMatrix3x4fv (will be remapped) */
+ /* _mesa_function_pool[26851]: UniformMatrix3x4fv (will be remapped) */
"iiip\0"
"glUniformMatrix3x4fv\0"
"\0"
- /* _mesa_function_pool[26803]: ClipPlane (offset 150) */
+ /* _mesa_function_pool[26878]: ClipPlane (offset 150) */
"ip\0"
"glClipPlane\0"
"\0"
- /* _mesa_function_pool[26819]: Recti (offset 90) */
+ /* _mesa_function_pool[26894]: Recti (offset 90) */
"iiii\0"
"glRecti\0"
"\0"
- /* _mesa_function_pool[26833]: DrawRangeElementsBaseVertex (will be remapped) */
+ /* _mesa_function_pool[26908]: DrawRangeElementsBaseVertex (will be remapped) */
"iiiiipi\0"
"glDrawRangeElementsBaseVertex\0"
"\0"
- /* _mesa_function_pool[26872]: TexCoordPointervINTEL (dynamic) */
+ /* _mesa_function_pool[26947]: TexCoordPointervINTEL (dynamic) */
"iip\0"
"glTexCoordPointervINTEL\0"
"\0"
- /* _mesa_function_pool[26901]: DeleteBuffersARB (will be remapped) */
+ /* _mesa_function_pool[26976]: DeleteBuffersARB (will be remapped) */
"ip\0"
"glDeleteBuffers\0"
"glDeleteBuffersARB\0"
"\0"
- /* _mesa_function_pool[26940]: WindowPos4fvMESA (will be remapped) */
+ /* _mesa_function_pool[27015]: WindowPos4fvMESA (will be remapped) */
"p\0"
"glWindowPos4fvMESA\0"
"\0"
- /* _mesa_function_pool[26962]: GetPixelMapuiv (offset 272) */
+ /* _mesa_function_pool[27037]: GetPixelMapuiv (offset 272) */
"ip\0"
"glGetPixelMapuiv\0"
"\0"
- /* _mesa_function_pool[26983]: Rectf (offset 88) */
+ /* _mesa_function_pool[27058]: Rectf (offset 88) */
"ffff\0"
"glRectf\0"
"\0"
- /* _mesa_function_pool[26997]: VertexAttrib1sNV (will be remapped) */
+ /* _mesa_function_pool[27072]: VertexAttrib1sNV (will be remapped) */
"ii\0"
"glVertexAttrib1sNV\0"
"\0"
- /* _mesa_function_pool[27020]: Indexfv (offset 47) */
+ /* _mesa_function_pool[27095]: Indexfv (offset 47) */
"p\0"
"glIndexfv\0"
"\0"
- /* _mesa_function_pool[27033]: SecondaryColor3svEXT (will be remapped) */
+ /* _mesa_function_pool[27108]: SecondaryColor3svEXT (will be remapped) */
"p\0"
"glSecondaryColor3sv\0"
"glSecondaryColor3svEXT\0"
"\0"
- /* _mesa_function_pool[27079]: LoadTransposeMatrixfARB (will be remapped) */
+ /* _mesa_function_pool[27154]: LoadTransposeMatrixfARB (will be remapped) */
"p\0"
"glLoadTransposeMatrixf\0"
"glLoadTransposeMatrixfARB\0"
"\0"
- /* _mesa_function_pool[27131]: GetPointerv (offset 329) */
+ /* _mesa_function_pool[27206]: GetPointerv (offset 329) */
"ip\0"
"glGetPointerv\0"
"glGetPointervEXT\0"
"\0"
- /* _mesa_function_pool[27166]: Tangent3bEXT (dynamic) */
+ /* _mesa_function_pool[27241]: Tangent3bEXT (dynamic) */
"iii\0"
"glTangent3bEXT\0"
"\0"
- /* _mesa_function_pool[27186]: CombinerParameterfNV (will be remapped) */
+ /* _mesa_function_pool[27261]: CombinerParameterfNV (will be remapped) */
"if\0"
"glCombinerParameterfNV\0"
"\0"
- /* _mesa_function_pool[27213]: IndexMask (offset 212) */
+ /* _mesa_function_pool[27288]: IndexMask (offset 212) */
"i\0"
"glIndexMask\0"
"\0"
- /* _mesa_function_pool[27228]: BindProgramNV (will be remapped) */
+ /* _mesa_function_pool[27303]: BindProgramNV (will be remapped) */
"ii\0"
"glBindProgramARB\0"
"glBindProgramNV\0"
"\0"
- /* _mesa_function_pool[27265]: VertexAttrib4svARB (will be remapped) */
+ /* _mesa_function_pool[27340]: VertexAttrib4svARB (will be remapped) */
"ip\0"
"glVertexAttrib4sv\0"
"glVertexAttrib4svARB\0"
"\0"
- /* _mesa_function_pool[27308]: GetFloatv (offset 262) */
+ /* _mesa_function_pool[27383]: GetFloatv (offset 262) */
"ip\0"
"glGetFloatv\0"
"\0"
- /* _mesa_function_pool[27324]: CreateDebugObjectMESA (dynamic) */
+ /* _mesa_function_pool[27399]: CreateDebugObjectMESA (dynamic) */
"\0"
"glCreateDebugObjectMESA\0"
"\0"
- /* _mesa_function_pool[27350]: GetShaderiv (will be remapped) */
+ /* _mesa_function_pool[27425]: GetShaderiv (will be remapped) */
"iip\0"
"glGetShaderiv\0"
"\0"
- /* _mesa_function_pool[27369]: ClientWaitSync (will be remapped) */
+ /* _mesa_function_pool[27444]: ClientWaitSync (will be remapped) */
"iii\0"
"glClientWaitSync\0"
"\0"
- /* _mesa_function_pool[27391]: TexCoord4s (offset 124) */
+ /* _mesa_function_pool[27466]: TexCoord4s (offset 124) */
"iiii\0"
"glTexCoord4s\0"
"\0"
- /* _mesa_function_pool[27410]: TexCoord3sv (offset 117) */
+ /* _mesa_function_pool[27485]: TexCoord3sv (offset 117) */
"p\0"
"glTexCoord3sv\0"
"\0"
- /* _mesa_function_pool[27427]: BindFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[27502]: BindFragmentShaderATI (will be remapped) */
"i\0"
"glBindFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[27454]: PopAttrib (offset 218) */
+ /* _mesa_function_pool[27529]: PopAttrib (offset 218) */
"\0"
"glPopAttrib\0"
"\0"
- /* _mesa_function_pool[27468]: Fogfv (offset 154) */
+ /* _mesa_function_pool[27543]: Fogfv (offset 154) */
"ip\0"
"glFogfv\0"
"\0"
- /* _mesa_function_pool[27480]: UnmapBufferARB (will be remapped) */
+ /* _mesa_function_pool[27555]: UnmapBufferARB (will be remapped) */
"i\0"
"glUnmapBuffer\0"
"glUnmapBufferARB\0"
"\0"
- /* _mesa_function_pool[27514]: InitNames (offset 197) */
+ /* _mesa_function_pool[27589]: InitNames (offset 197) */
"\0"
"glInitNames\0"
"\0"
- /* _mesa_function_pool[27528]: Normal3sv (offset 61) */
+ /* _mesa_function_pool[27603]: Normal3sv (offset 61) */
"p\0"
"glNormal3sv\0"
"\0"
- /* _mesa_function_pool[27543]: Minmax (offset 368) */
+ /* _mesa_function_pool[27618]: Minmax (offset 368) */
"iii\0"
"glMinmax\0"
"glMinmaxEXT\0"
"\0"
- /* _mesa_function_pool[27569]: TexCoord4d (offset 118) */
+ /* _mesa_function_pool[27644]: TexCoord4d (offset 118) */
"dddd\0"
"glTexCoord4d\0"
"\0"
- /* _mesa_function_pool[27588]: DeformationMap3dSGIX (dynamic) */
- "iddiiddiiddiip\0"
- "glDeformationMap3dSGIX\0"
- "\0"
- /* _mesa_function_pool[27627]: TexCoord4f (offset 120) */
+ /* _mesa_function_pool[27663]: TexCoord4f (offset 120) */
"ffff\0"
"glTexCoord4f\0"
"\0"
- /* _mesa_function_pool[27646]: FogCoorddvEXT (will be remapped) */
+ /* _mesa_function_pool[27682]: FogCoorddvEXT (will be remapped) */
"p\0"
"glFogCoorddv\0"
"glFogCoorddvEXT\0"
"\0"
- /* _mesa_function_pool[27678]: FinishTextureSUNX (dynamic) */
+ /* _mesa_function_pool[27714]: FinishTextureSUNX (dynamic) */
"\0"
"glFinishTextureSUNX\0"
"\0"
- /* _mesa_function_pool[27700]: GetFragmentLightfvSGIX (dynamic) */
+ /* _mesa_function_pool[27736]: GetFragmentLightfvSGIX (dynamic) */
"iip\0"
"glGetFragmentLightfvSGIX\0"
"\0"
- /* _mesa_function_pool[27730]: Binormal3fvEXT (dynamic) */
+ /* _mesa_function_pool[27766]: Binormal3fvEXT (dynamic) */
"p\0"
"glBinormal3fvEXT\0"
"\0"
- /* _mesa_function_pool[27750]: GetBooleanv (offset 258) */
+ /* _mesa_function_pool[27786]: GetBooleanv (offset 258) */
"ip\0"
"glGetBooleanv\0"
"\0"
- /* _mesa_function_pool[27768]: ColorFragmentOp3ATI (will be remapped) */
+ /* _mesa_function_pool[27804]: ColorFragmentOp3ATI (will be remapped) */
"iiiiiiiiiiiii\0"
"glColorFragmentOp3ATI\0"
"\0"
- /* _mesa_function_pool[27805]: Hint (offset 158) */
+ /* _mesa_function_pool[27841]: Hint (offset 158) */
"ii\0"
"glHint\0"
"\0"
- /* _mesa_function_pool[27816]: Color4dv (offset 28) */
+ /* _mesa_function_pool[27852]: Color4dv (offset 28) */
"p\0"
"glColor4dv\0"
"\0"
- /* _mesa_function_pool[27830]: VertexAttrib2svARB (will be remapped) */
+ /* _mesa_function_pool[27866]: VertexAttrib2svARB (will be remapped) */
"ip\0"
"glVertexAttrib2sv\0"
"glVertexAttrib2svARB\0"
"\0"
- /* _mesa_function_pool[27873]: AreProgramsResidentNV (will be remapped) */
+ /* _mesa_function_pool[27909]: AreProgramsResidentNV (will be remapped) */
"ipp\0"
"glAreProgramsResidentNV\0"
"\0"
- /* _mesa_function_pool[27902]: WindowPos3svMESA (will be remapped) */
+ /* _mesa_function_pool[27938]: WindowPos3svMESA (will be remapped) */
"p\0"
"glWindowPos3sv\0"
"glWindowPos3svARB\0"
"glWindowPos3svMESA\0"
"\0"
- /* _mesa_function_pool[27957]: CopyColorSubTable (offset 347) */
+ /* _mesa_function_pool[27993]: CopyColorSubTable (offset 347) */
"iiiii\0"
"glCopyColorSubTable\0"
"glCopyColorSubTableEXT\0"
"\0"
- /* _mesa_function_pool[28007]: WeightdvARB (dynamic) */
+ /* _mesa_function_pool[28043]: WeightdvARB (dynamic) */
"ip\0"
"glWeightdvARB\0"
"\0"
- /* _mesa_function_pool[28025]: DeleteRenderbuffersEXT (will be remapped) */
+ /* _mesa_function_pool[28061]: DeleteRenderbuffersEXT (will be remapped) */
"ip\0"
"glDeleteRenderbuffers\0"
"glDeleteRenderbuffersEXT\0"
"\0"
- /* _mesa_function_pool[28076]: VertexAttrib4NubvARB (will be remapped) */
+ /* _mesa_function_pool[28112]: VertexAttrib4NubvARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nubv\0"
"glVertexAttrib4NubvARB\0"
"\0"
- /* _mesa_function_pool[28123]: VertexAttrib3dvNV (will be remapped) */
+ /* _mesa_function_pool[28159]: VertexAttrib3dvNV (will be remapped) */
"ip\0"
"glVertexAttrib3dvNV\0"
"\0"
- /* _mesa_function_pool[28147]: GetObjectParameterfvARB (will be remapped) */
+ /* _mesa_function_pool[28183]: GetObjectParameterfvARB (will be remapped) */
"iip\0"
"glGetObjectParameterfvARB\0"
"\0"
- /* _mesa_function_pool[28178]: Vertex4iv (offset 147) */
+ /* _mesa_function_pool[28214]: Vertex4iv (offset 147) */
"p\0"
"glVertex4iv\0"
"\0"
- /* _mesa_function_pool[28193]: GetProgramEnvParameterdvARB (will be remapped) */
+ /* _mesa_function_pool[28229]: GetProgramEnvParameterdvARB (will be remapped) */
"iip\0"
"glGetProgramEnvParameterdvARB\0"
"\0"
- /* _mesa_function_pool[28228]: TexCoord4dv (offset 119) */
+ /* _mesa_function_pool[28264]: TexCoord4dv (offset 119) */
"p\0"
"glTexCoord4dv\0"
"\0"
- /* _mesa_function_pool[28245]: LockArraysEXT (will be remapped) */
+ /* _mesa_function_pool[28281]: LockArraysEXT (will be remapped) */
"ii\0"
"glLockArraysEXT\0"
"\0"
- /* _mesa_function_pool[28265]: Begin (offset 7) */
+ /* _mesa_function_pool[28301]: Begin (offset 7) */
"i\0"
"glBegin\0"
"\0"
- /* _mesa_function_pool[28276]: LightModeli (offset 165) */
+ /* _mesa_function_pool[28312]: LightModeli (offset 165) */
"ii\0"
"glLightModeli\0"
"\0"
- /* _mesa_function_pool[28294]: Rectfv (offset 89) */
+ /* _mesa_function_pool[28330]: Rectfv (offset 89) */
"pp\0"
"glRectfv\0"
"\0"
- /* _mesa_function_pool[28307]: LightModelf (offset 163) */
+ /* _mesa_function_pool[28343]: LightModelf (offset 163) */
"if\0"
"glLightModelf\0"
"\0"
- /* _mesa_function_pool[28325]: GetTexParameterfv (offset 282) */
+ /* _mesa_function_pool[28361]: GetTexParameterfv (offset 282) */
"iip\0"
"glGetTexParameterfv\0"
"\0"
- /* _mesa_function_pool[28350]: GetLightfv (offset 264) */
+ /* _mesa_function_pool[28386]: GetLightfv (offset 264) */
"iip\0"
"glGetLightfv\0"
"\0"
- /* _mesa_function_pool[28368]: PixelTransformParameterivEXT (dynamic) */
+ /* _mesa_function_pool[28404]: PixelTransformParameterivEXT (dynamic) */
"iip\0"
"glPixelTransformParameterivEXT\0"
"\0"
- /* _mesa_function_pool[28404]: BinormalPointerEXT (dynamic) */
+ /* _mesa_function_pool[28440]: BinormalPointerEXT (dynamic) */
"iip\0"
"glBinormalPointerEXT\0"
"\0"
- /* _mesa_function_pool[28430]: VertexAttrib1dNV (will be remapped) */
+ /* _mesa_function_pool[28466]: VertexAttrib1dNV (will be remapped) */
"id\0"
"glVertexAttrib1dNV\0"
"\0"
- /* _mesa_function_pool[28453]: GetCombinerInputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[28489]: GetCombinerInputParameterivNV (will be remapped) */
"iiiip\0"
"glGetCombinerInputParameterivNV\0"
"\0"
- /* _mesa_function_pool[28492]: Disable (offset 214) */
+ /* _mesa_function_pool[28528]: Disable (offset 214) */
"i\0"
"glDisable\0"
"\0"
- /* _mesa_function_pool[28505]: MultiTexCoord2fvARB (offset 387) */
+ /* _mesa_function_pool[28541]: MultiTexCoord2fvARB (offset 387) */
"ip\0"
"glMultiTexCoord2fv\0"
"glMultiTexCoord2fvARB\0"
"\0"
- /* _mesa_function_pool[28550]: GetRenderbufferParameterivEXT (will be remapped) */
+ /* _mesa_function_pool[28586]: GetRenderbufferParameterivEXT (will be remapped) */
"iip\0"
"glGetRenderbufferParameteriv\0"
"glGetRenderbufferParameterivEXT\0"
"\0"
- /* _mesa_function_pool[28616]: CombinerParameterivNV (will be remapped) */
+ /* _mesa_function_pool[28652]: CombinerParameterivNV (will be remapped) */
"ip\0"
"glCombinerParameterivNV\0"
"\0"
- /* _mesa_function_pool[28644]: GenFragmentShadersATI (will be remapped) */
+ /* _mesa_function_pool[28680]: GenFragmentShadersATI (will be remapped) */
"i\0"
"glGenFragmentShadersATI\0"
"\0"
- /* _mesa_function_pool[28671]: DrawArrays (offset 310) */
+ /* _mesa_function_pool[28707]: DrawArrays (offset 310) */
"iii\0"
"glDrawArrays\0"
"glDrawArraysEXT\0"
"\0"
- /* _mesa_function_pool[28705]: WeightuivARB (dynamic) */
+ /* _mesa_function_pool[28741]: WeightuivARB (dynamic) */
"ip\0"
"glWeightuivARB\0"
"\0"
- /* _mesa_function_pool[28724]: VertexAttrib2sARB (will be remapped) */
+ /* _mesa_function_pool[28760]: VertexAttrib2sARB (will be remapped) */
"iii\0"
"glVertexAttrib2s\0"
"glVertexAttrib2sARB\0"
"\0"
- /* _mesa_function_pool[28766]: ColorMask (offset 210) */
+ /* _mesa_function_pool[28802]: ColorMask (offset 210) */
"iiii\0"
"glColorMask\0"
"\0"
- /* _mesa_function_pool[28784]: GenAsyncMarkersSGIX (dynamic) */
+ /* _mesa_function_pool[28820]: GenAsyncMarkersSGIX (dynamic) */
"i\0"
"glGenAsyncMarkersSGIX\0"
"\0"
- /* _mesa_function_pool[28809]: Tangent3svEXT (dynamic) */
+ /* _mesa_function_pool[28845]: Tangent3svEXT (dynamic) */
"p\0"
"glTangent3svEXT\0"
"\0"
- /* _mesa_function_pool[28828]: GetListParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[28864]: GetListParameterivSGIX (dynamic) */
"iip\0"
"glGetListParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[28858]: BindBufferARB (will be remapped) */
+ /* _mesa_function_pool[28894]: BindBufferARB (will be remapped) */
"ii\0"
"glBindBuffer\0"
"glBindBufferARB\0"
"\0"
- /* _mesa_function_pool[28891]: GetInfoLogARB (will be remapped) */
+ /* _mesa_function_pool[28927]: GetInfoLogARB (will be remapped) */
"iipp\0"
"glGetInfoLogARB\0"
"\0"
- /* _mesa_function_pool[28913]: RasterPos4iv (offset 83) */
+ /* _mesa_function_pool[28949]: RasterPos4iv (offset 83) */
"p\0"
"glRasterPos4iv\0"
"\0"
- /* _mesa_function_pool[28931]: Enable (offset 215) */
+ /* _mesa_function_pool[28967]: Enable (offset 215) */
"i\0"
"glEnable\0"
"\0"
- /* _mesa_function_pool[28943]: LineStipple (offset 167) */
+ /* _mesa_function_pool[28979]: LineStipple (offset 167) */
"ii\0"
"glLineStipple\0"
"\0"
- /* _mesa_function_pool[28961]: VertexAttribs4svNV (will be remapped) */
+ /* _mesa_function_pool[28997]: VertexAttribs4svNV (will be remapped) */
"iip\0"
"glVertexAttribs4svNV\0"
"\0"
- /* _mesa_function_pool[28987]: EdgeFlagPointerListIBM (dynamic) */
+ /* _mesa_function_pool[29023]: EdgeFlagPointerListIBM (dynamic) */
"ipi\0"
"glEdgeFlagPointerListIBM\0"
"\0"
- /* _mesa_function_pool[29017]: UniformMatrix3x2fv (will be remapped) */
+ /* _mesa_function_pool[29053]: UniformMatrix3x2fv (will be remapped) */
"iiip\0"
"glUniformMatrix3x2fv\0"
"\0"
- /* _mesa_function_pool[29044]: GetMinmaxParameterfv (offset 365) */
+ /* _mesa_function_pool[29080]: GetMinmaxParameterfv (offset 365) */
"iip\0"
"glGetMinmaxParameterfv\0"
"glGetMinmaxParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[29098]: VertexAttrib1fvARB (will be remapped) */
+ /* _mesa_function_pool[29134]: VertexAttrib1fvARB (will be remapped) */
"ip\0"
"glVertexAttrib1fv\0"
"glVertexAttrib1fvARB\0"
"\0"
- /* _mesa_function_pool[29141]: GenBuffersARB (will be remapped) */
+ /* _mesa_function_pool[29177]: GenBuffersARB (will be remapped) */
"ip\0"
"glGenBuffers\0"
"glGenBuffersARB\0"
"\0"
- /* _mesa_function_pool[29174]: VertexAttribs1svNV (will be remapped) */
+ /* _mesa_function_pool[29210]: VertexAttribs1svNV (will be remapped) */
"iip\0"
"glVertexAttribs1svNV\0"
"\0"
- /* _mesa_function_pool[29200]: Vertex3fv (offset 137) */
+ /* _mesa_function_pool[29236]: Vertex3fv (offset 137) */
"p\0"
"glVertex3fv\0"
"\0"
- /* _mesa_function_pool[29215]: GetTexBumpParameterivATI (will be remapped) */
+ /* _mesa_function_pool[29251]: GetTexBumpParameterivATI (will be remapped) */
"ip\0"
"glGetTexBumpParameterivATI\0"
"\0"
- /* _mesa_function_pool[29246]: Binormal3bEXT (dynamic) */
+ /* _mesa_function_pool[29282]: Binormal3bEXT (dynamic) */
"iii\0"
"glBinormal3bEXT\0"
"\0"
- /* _mesa_function_pool[29267]: FragmentMaterialivSGIX (dynamic) */
+ /* _mesa_function_pool[29303]: FragmentMaterialivSGIX (dynamic) */
"iip\0"
"glFragmentMaterialivSGIX\0"
"\0"
- /* _mesa_function_pool[29297]: IsRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[29333]: IsRenderbufferEXT (will be remapped) */
"i\0"
"glIsRenderbuffer\0"
"glIsRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[29337]: GenProgramsNV (will be remapped) */
+ /* _mesa_function_pool[29373]: GenProgramsNV (will be remapped) */
"ip\0"
"glGenProgramsARB\0"
"glGenProgramsNV\0"
"\0"
- /* _mesa_function_pool[29374]: VertexAttrib4dvNV (will be remapped) */
+ /* _mesa_function_pool[29410]: VertexAttrib4dvNV (will be remapped) */
"ip\0"
"glVertexAttrib4dvNV\0"
"\0"
- /* _mesa_function_pool[29398]: EndFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[29434]: EndFragmentShaderATI (will be remapped) */
"\0"
"glEndFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[29423]: Binormal3iEXT (dynamic) */
+ /* _mesa_function_pool[29459]: Binormal3iEXT (dynamic) */
"iii\0"
"glBinormal3iEXT\0"
"\0"
- /* _mesa_function_pool[29444]: WindowPos2fMESA (will be remapped) */
+ /* _mesa_function_pool[29480]: WindowPos2fMESA (will be remapped) */
"ff\0"
"glWindowPos2f\0"
"glWindowPos2fARB\0"
@@ -4334,390 +4335,390 @@ static const struct {
} MESA_remap_table_functions[] = {
{ 1461, AttachShader_remap_index },
{ 8704, CreateProgram_remap_index },
- { 20115, CreateShader_remap_index },
- { 22375, DeleteProgram_remap_index },
- { 16150, DeleteShader_remap_index },
- { 20561, DetachShader_remap_index },
- { 15674, GetAttachedShaders_remap_index },
+ { 20158, CreateShader_remap_index },
+ { 22418, DeleteProgram_remap_index },
+ { 16193, DeleteShader_remap_index },
+ { 20604, DetachShader_remap_index },
+ { 15717, GetAttachedShaders_remap_index },
{ 4244, GetProgramInfoLog_remap_index },
{ 361, GetProgramiv_remap_index },
{ 5547, GetShaderInfoLog_remap_index },
- { 27350, GetShaderiv_remap_index },
- { 11657, IsProgram_remap_index },
- { 10728, IsShader_remap_index },
+ { 27425, GetShaderiv_remap_index },
+ { 11732, IsProgram_remap_index },
+ { 10767, IsShader_remap_index },
{ 8808, StencilFuncSeparate_remap_index },
{ 3487, StencilMaskSeparate_remap_index },
{ 6623, StencilOpSeparate_remap_index },
- { 19492, UniformMatrix2x3fv_remap_index },
+ { 19535, UniformMatrix2x3fv_remap_index },
{ 2615, UniformMatrix2x4fv_remap_index },
- { 29017, UniformMatrix3x2fv_remap_index },
- { 26776, UniformMatrix3x4fv_remap_index },
- { 14222, UniformMatrix4x2fv_remap_index },
+ { 29053, UniformMatrix3x2fv_remap_index },
+ { 26851, UniformMatrix3x4fv_remap_index },
+ { 14265, UniformMatrix4x2fv_remap_index },
{ 2937, UniformMatrix4x3fv_remap_index },
{ 8722, LoadTransposeMatrixdARB_remap_index },
- { 27079, LoadTransposeMatrixfARB_remap_index },
+ { 27154, LoadTransposeMatrixfARB_remap_index },
{ 4817, MultTransposeMatrixdARB_remap_index },
- { 20748, MultTransposeMatrixfARB_remap_index },
+ { 20791, MultTransposeMatrixfARB_remap_index },
{ 172, SampleCoverageARB_remap_index },
{ 4971, CompressedTexImage1DARB_remap_index },
- { 21205, CompressedTexImage2DARB_remap_index },
+ { 21248, CompressedTexImage2DARB_remap_index },
{ 3550, CompressedTexImage3DARB_remap_index },
- { 15966, CompressedTexSubImage1DARB_remap_index },
+ { 16009, CompressedTexSubImage1DARB_remap_index },
{ 1880, CompressedTexSubImage2DARB_remap_index },
- { 17758, CompressedTexSubImage3DARB_remap_index },
- { 25058, GetCompressedTexImageARB_remap_index },
+ { 17801, CompressedTexSubImage3DARB_remap_index },
+ { 25133, GetCompressedTexImageARB_remap_index },
{ 3395, DisableVertexAttribArrayARB_remap_index },
- { 26388, EnableVertexAttribArrayARB_remap_index },
- { 28193, GetProgramEnvParameterdvARB_remap_index },
- { 20628, GetProgramEnvParameterfvARB_remap_index },
- { 24088, GetProgramLocalParameterdvARB_remap_index },
+ { 26463, EnableVertexAttribArrayARB_remap_index },
+ { 28229, GetProgramEnvParameterdvARB_remap_index },
+ { 20671, GetProgramEnvParameterfvARB_remap_index },
+ { 24163, GetProgramLocalParameterdvARB_remap_index },
{ 7065, GetProgramLocalParameterfvARB_remap_index },
- { 16057, GetProgramStringARB_remap_index },
- { 24283, GetProgramivARB_remap_index },
- { 17953, GetVertexAttribdvARB_remap_index },
- { 14111, GetVertexAttribfvARB_remap_index },
+ { 16100, GetProgramStringARB_remap_index },
+ { 24358, GetProgramivARB_remap_index },
+ { 17996, GetVertexAttribdvARB_remap_index },
+ { 14154, GetVertexAttribfvARB_remap_index },
{ 8617, GetVertexAttribivARB_remap_index },
- { 16862, ProgramEnvParameter4dARB_remap_index },
- { 22175, ProgramEnvParameter4dvARB_remap_index },
- { 14719, ProgramEnvParameter4fARB_remap_index },
+ { 16905, ProgramEnvParameter4dARB_remap_index },
+ { 22218, ProgramEnvParameter4dvARB_remap_index },
+ { 14762, ProgramEnvParameter4fARB_remap_index },
{ 7928, ProgramEnvParameter4fvARB_remap_index },
{ 3513, ProgramLocalParameter4dARB_remap_index },
- { 11403, ProgramLocalParameter4dvARB_remap_index },
- { 25867, ProgramLocalParameter4fARB_remap_index },
- { 22693, ProgramLocalParameter4fvARB_remap_index },
- { 24844, ProgramStringARB_remap_index },
- { 17112, VertexAttrib1dARB_remap_index },
- { 13765, VertexAttrib1dvARB_remap_index },
+ { 11442, ProgramLocalParameter4dvARB_remap_index },
+ { 25942, ProgramLocalParameter4fARB_remap_index },
+ { 22736, ProgramLocalParameter4fvARB_remap_index },
+ { 24919, ProgramStringARB_remap_index },
+ { 17155, VertexAttrib1dARB_remap_index },
+ { 13808, VertexAttrib1dvARB_remap_index },
{ 3688, VertexAttrib1fARB_remap_index },
- { 29098, VertexAttrib1fvARB_remap_index },
+ { 29134, VertexAttrib1fvARB_remap_index },
{ 6149, VertexAttrib1sARB_remap_index },
{ 2054, VertexAttrib1svARB_remap_index },
- { 13196, VertexAttrib2dARB_remap_index },
- { 15293, VertexAttrib2dvARB_remap_index },
+ { 13239, VertexAttrib2dARB_remap_index },
+ { 15336, VertexAttrib2dvARB_remap_index },
{ 1480, VertexAttrib2fARB_remap_index },
- { 15406, VertexAttrib2fvARB_remap_index },
- { 28724, VertexAttrib2sARB_remap_index },
- { 27830, VertexAttrib2svARB_remap_index },
+ { 15449, VertexAttrib2fvARB_remap_index },
+ { 28760, VertexAttrib2sARB_remap_index },
+ { 27866, VertexAttrib2svARB_remap_index },
{ 9926, VertexAttrib3dARB_remap_index },
{ 7631, VertexAttrib3dvARB_remap_index },
{ 1567, VertexAttrib3fARB_remap_index },
- { 19729, VertexAttrib3fvARB_remap_index },
- { 24716, VertexAttrib3sARB_remap_index },
- { 17695, VertexAttrib3svARB_remap_index },
+ { 19772, VertexAttrib3fvARB_remap_index },
+ { 24791, VertexAttrib3sARB_remap_index },
+ { 17738, VertexAttrib3svARB_remap_index },
{ 4270, VertexAttrib4NbvARB_remap_index },
- { 15629, VertexAttrib4NivARB_remap_index },
- { 19684, VertexAttrib4NsvARB_remap_index },
- { 20580, VertexAttrib4NubARB_remap_index },
- { 28076, VertexAttrib4NubvARB_remap_index },
- { 16523, VertexAttrib4NuivARB_remap_index },
+ { 15672, VertexAttrib4NivARB_remap_index },
+ { 19727, VertexAttrib4NsvARB_remap_index },
+ { 20623, VertexAttrib4NubARB_remap_index },
+ { 28112, VertexAttrib4NubvARB_remap_index },
+ { 16566, VertexAttrib4NuivARB_remap_index },
{ 2810, VertexAttrib4NusvARB_remap_index },
{ 9549, VertexAttrib4bvARB_remap_index },
- { 23496, VertexAttrib4dARB_remap_index },
- { 18678, VertexAttrib4dvARB_remap_index },
+ { 23571, VertexAttrib4dARB_remap_index },
+ { 18721, VertexAttrib4dvARB_remap_index },
{ 10033, VertexAttrib4fARB_remap_index },
{ 10403, VertexAttrib4fvARB_remap_index },
{ 9001, VertexAttrib4ivARB_remap_index },
- { 15107, VertexAttrib4sARB_remap_index },
- { 27265, VertexAttrib4svARB_remap_index },
- { 14524, VertexAttrib4ubvARB_remap_index },
- { 26712, VertexAttrib4uivARB_remap_index },
- { 17506, VertexAttrib4usvARB_remap_index },
- { 19366, VertexAttribPointerARB_remap_index },
- { 28858, BindBufferARB_remap_index },
+ { 15150, VertexAttrib4sARB_remap_index },
+ { 27340, VertexAttrib4svARB_remap_index },
+ { 14567, VertexAttrib4ubvARB_remap_index },
+ { 26787, VertexAttrib4uivARB_remap_index },
+ { 17549, VertexAttrib4usvARB_remap_index },
+ { 19409, VertexAttribPointerARB_remap_index },
+ { 28894, BindBufferARB_remap_index },
{ 5862, BufferDataARB_remap_index },
{ 1382, BufferSubDataARB_remap_index },
- { 26901, DeleteBuffersARB_remap_index },
- { 29141, GenBuffersARB_remap_index },
- { 15449, GetBufferParameterivARB_remap_index },
- { 14671, GetBufferPointervARB_remap_index },
+ { 26976, DeleteBuffersARB_remap_index },
+ { 29177, GenBuffersARB_remap_index },
+ { 15492, GetBufferParameterivARB_remap_index },
+ { 14714, GetBufferPointervARB_remap_index },
{ 1335, GetBufferSubDataARB_remap_index },
- { 26660, IsBufferARB_remap_index },
- { 23124, MapBufferARB_remap_index },
- { 27480, UnmapBufferARB_remap_index },
+ { 26735, IsBufferARB_remap_index },
+ { 23167, MapBufferARB_remap_index },
+ { 27555, UnmapBufferARB_remap_index },
{ 268, BeginQueryARB_remap_index },
- { 17207, DeleteQueriesARB_remap_index },
+ { 17250, DeleteQueriesARB_remap_index },
{ 10664, EndQueryARB_remap_index },
- { 25537, GenQueriesARB_remap_index },
+ { 25612, GenQueriesARB_remap_index },
{ 1772, GetQueryObjectivARB_remap_index },
- { 15151, GetQueryObjectuivARB_remap_index },
+ { 15194, GetQueryObjectuivARB_remap_index },
{ 1624, GetQueryivARB_remap_index },
- { 17413, IsQueryARB_remap_index },
+ { 17456, IsQueryARB_remap_index },
{ 7241, AttachObjectARB_remap_index },
- { 16112, CompileShaderARB_remap_index },
+ { 16155, CompileShaderARB_remap_index },
{ 2879, CreateProgramObjectARB_remap_index },
{ 5807, CreateShaderObjectARB_remap_index },
- { 12613, DeleteObjectARB_remap_index },
- { 20979, DetachObjectARB_remap_index },
+ { 12656, DeleteObjectARB_remap_index },
+ { 21022, DetachObjectARB_remap_index },
{ 10475, GetActiveUniformARB_remap_index },
{ 8320, GetAttachedObjectsARB_remap_index },
{ 8599, GetHandleARB_remap_index },
- { 28891, GetInfoLogARB_remap_index },
- { 28147, GetObjectParameterfvARB_remap_index },
- { 23962, GetObjectParameterivARB_remap_index },
- { 25295, GetShaderSourceARB_remap_index },
- { 24576, GetUniformLocationARB_remap_index },
- { 20850, GetUniformfvARB_remap_index },
- { 11025, GetUniformivARB_remap_index },
- { 17551, LinkProgramARB_remap_index },
- { 17609, ShaderSourceARB_remap_index },
+ { 28927, GetInfoLogARB_remap_index },
+ { 28183, GetObjectParameterfvARB_remap_index },
+ { 24037, GetObjectParameterivARB_remap_index },
+ { 25370, GetShaderSourceARB_remap_index },
+ { 24651, GetUniformLocationARB_remap_index },
+ { 20893, GetUniformfvARB_remap_index },
+ { 11064, GetUniformivARB_remap_index },
+ { 17594, LinkProgramARB_remap_index },
+ { 17652, ShaderSourceARB_remap_index },
{ 6523, Uniform1fARB_remap_index },
- { 26076, Uniform1fvARB_remap_index },
- { 19335, Uniform1iARB_remap_index },
- { 18367, Uniform1ivARB_remap_index },
+ { 26151, Uniform1fvARB_remap_index },
+ { 19378, Uniform1iARB_remap_index },
+ { 18410, Uniform1ivARB_remap_index },
{ 2003, Uniform2fARB_remap_index },
- { 12449, Uniform2fvARB_remap_index },
- { 23011, Uniform2iARB_remap_index },
+ { 12492, Uniform2fvARB_remap_index },
+ { 23054, Uniform2iARB_remap_index },
{ 2123, Uniform2ivARB_remap_index },
- { 16222, Uniform3fARB_remap_index },
+ { 16265, Uniform3fARB_remap_index },
{ 8350, Uniform3fvARB_remap_index },
{ 5481, Uniform3iARB_remap_index },
- { 14777, Uniform3ivARB_remap_index },
- { 16668, Uniform4fARB_remap_index },
- { 20714, Uniform4fvARB_remap_index },
- { 21854, Uniform4iARB_remap_index },
- { 17919, Uniform4ivARB_remap_index },
+ { 14820, Uniform3ivARB_remap_index },
+ { 16711, Uniform4fARB_remap_index },
+ { 20757, Uniform4fvARB_remap_index },
+ { 21897, Uniform4iARB_remap_index },
+ { 17962, Uniform4ivARB_remap_index },
{ 7293, UniformMatrix2fvARB_remap_index },
{ 17, UniformMatrix3fvARB_remap_index },
{ 2475, UniformMatrix4fvARB_remap_index },
- { 22287, UseProgramObjectARB_remap_index },
- { 12884, ValidateProgramARB_remap_index },
- { 18721, BindAttribLocationARB_remap_index },
+ { 22330, UseProgramObjectARB_remap_index },
+ { 12927, ValidateProgramARB_remap_index },
+ { 18764, BindAttribLocationARB_remap_index },
{ 4315, GetActiveAttribARB_remap_index },
- { 14458, GetAttribLocationARB_remap_index },
- { 25815, DrawBuffersARB_remap_index },
- { 11508, RenderbufferStorageMultisample_remap_index },
- { 16716, FlushMappedBufferRange_remap_index },
- { 24379, MapBufferRange_remap_index },
- { 14333, BindVertexArray_remap_index },
- { 12743, GenVertexArrays_remap_index },
- { 26590, CopyBufferSubData_remap_index },
- { 27369, ClientWaitSync_remap_index },
+ { 14501, GetAttribLocationARB_remap_index },
+ { 25890, DrawBuffersARB_remap_index },
+ { 11547, RenderbufferStorageMultisample_remap_index },
+ { 16759, FlushMappedBufferRange_remap_index },
+ { 24454, MapBufferRange_remap_index },
+ { 14376, BindVertexArray_remap_index },
+ { 12786, GenVertexArrays_remap_index },
+ { 26665, CopyBufferSubData_remap_index },
+ { 27444, ClientWaitSync_remap_index },
{ 2394, DeleteSync_remap_index },
{ 6190, FenceSync_remap_index },
- { 13255, GetInteger64v_remap_index },
- { 19791, GetSynciv_remap_index },
- { 25754, IsSync_remap_index },
+ { 13298, GetInteger64v_remap_index },
+ { 19834, GetSynciv_remap_index },
+ { 25829, IsSync_remap_index },
{ 8268, WaitSync_remap_index },
{ 3363, DrawElementsBaseVertex_remap_index },
- { 26833, DrawRangeElementsBaseVertex_remap_index },
- { 23155, MultiDrawElementsBaseVertex_remap_index },
+ { 26908, DrawRangeElementsBaseVertex_remap_index },
+ { 23198, MultiDrawElementsBaseVertex_remap_index },
{ 4680, PolygonOffsetEXT_remap_index },
- { 20350, GetPixelTexGenParameterfvSGIS_remap_index },
+ { 20393, GetPixelTexGenParameterfvSGIS_remap_index },
{ 3895, GetPixelTexGenParameterivSGIS_remap_index },
- { 20083, PixelTexGenParameterfSGIS_remap_index },
+ { 20126, PixelTexGenParameterfSGIS_remap_index },
{ 580, PixelTexGenParameterfvSGIS_remap_index },
- { 11063, PixelTexGenParameteriSGIS_remap_index },
- { 12020, PixelTexGenParameterivSGIS_remap_index },
- { 14421, SampleMaskSGIS_remap_index },
- { 17353, SamplePatternSGIS_remap_index },
- { 23084, ColorPointerEXT_remap_index },
- { 15336, EdgeFlagPointerEXT_remap_index },
+ { 11102, PixelTexGenParameteriSGIS_remap_index },
+ { 12063, PixelTexGenParameterivSGIS_remap_index },
+ { 14464, SampleMaskSGIS_remap_index },
+ { 17396, SamplePatternSGIS_remap_index },
+ { 23127, ColorPointerEXT_remap_index },
+ { 15379, EdgeFlagPointerEXT_remap_index },
{ 5135, IndexPointerEXT_remap_index },
{ 5215, NormalPointerEXT_remap_index },
- { 13849, TexCoordPointerEXT_remap_index },
+ { 13892, TexCoordPointerEXT_remap_index },
{ 5985, VertexPointerEXT_remap_index },
{ 3165, PointParameterfEXT_remap_index },
{ 6830, PointParameterfvEXT_remap_index },
- { 28245, LockArraysEXT_remap_index },
- { 12948, UnlockArraysEXT_remap_index },
+ { 28281, LockArraysEXT_remap_index },
+ { 12991, UnlockArraysEXT_remap_index },
{ 7837, CullParameterdvEXT_remap_index },
{ 10270, CullParameterfvEXT_remap_index },
{ 1151, SecondaryColor3bEXT_remap_index },
{ 6989, SecondaryColor3bvEXT_remap_index },
{ 9178, SecondaryColor3dEXT_remap_index },
- { 22433, SecondaryColor3dvEXT_remap_index },
- { 24625, SecondaryColor3fEXT_remap_index },
- { 15902, SecondaryColor3fvEXT_remap_index },
+ { 22476, SecondaryColor3dvEXT_remap_index },
+ { 24700, SecondaryColor3fEXT_remap_index },
+ { 15945, SecondaryColor3fvEXT_remap_index },
{ 426, SecondaryColor3iEXT_remap_index },
- { 14159, SecondaryColor3ivEXT_remap_index },
+ { 14202, SecondaryColor3ivEXT_remap_index },
{ 8836, SecondaryColor3sEXT_remap_index },
- { 27033, SecondaryColor3svEXT_remap_index },
- { 23798, SecondaryColor3ubEXT_remap_index },
- { 18612, SecondaryColor3ubvEXT_remap_index },
- { 11258, SecondaryColor3uiEXT_remap_index },
- { 19970, SecondaryColor3uivEXT_remap_index },
- { 22645, SecondaryColor3usEXT_remap_index },
- { 11331, SecondaryColor3usvEXT_remap_index },
+ { 27108, SecondaryColor3svEXT_remap_index },
+ { 23873, SecondaryColor3ubEXT_remap_index },
+ { 18655, SecondaryColor3ubvEXT_remap_index },
+ { 11297, SecondaryColor3uiEXT_remap_index },
+ { 20013, SecondaryColor3uivEXT_remap_index },
+ { 22688, SecondaryColor3usEXT_remap_index },
+ { 11370, SecondaryColor3usvEXT_remap_index },
{ 10346, SecondaryColorPointerEXT_remap_index },
- { 22494, MultiDrawArraysEXT_remap_index },
- { 18302, MultiDrawElementsEXT_remap_index },
- { 18497, FogCoordPointerEXT_remap_index },
+ { 22537, MultiDrawArraysEXT_remap_index },
+ { 18345, MultiDrawElementsEXT_remap_index },
+ { 18540, FogCoordPointerEXT_remap_index },
{ 4044, FogCoorddEXT_remap_index },
- { 27646, FogCoorddvEXT_remap_index },
+ { 27682, FogCoorddvEXT_remap_index },
{ 4105, FogCoordfEXT_remap_index },
- { 23721, FogCoordfvEXT_remap_index },
- { 16620, PixelTexGenSGIX_remap_index },
- { 24306, BlendFuncSeparateEXT_remap_index },
+ { 23796, FogCoordfvEXT_remap_index },
+ { 16663, PixelTexGenSGIX_remap_index },
+ { 24381, BlendFuncSeparateEXT_remap_index },
{ 5897, FlushVertexArrayRangeNV_remap_index },
{ 4629, VertexArrayRangeNV_remap_index },
- { 24690, CombinerInputNV_remap_index },
+ { 24765, CombinerInputNV_remap_index },
{ 1946, CombinerOutputNV_remap_index },
- { 27186, CombinerParameterfNV_remap_index },
+ { 27261, CombinerParameterfNV_remap_index },
{ 4549, CombinerParameterfvNV_remap_index },
- { 19541, CombinerParameteriNV_remap_index },
- { 28616, CombinerParameterivNV_remap_index },
+ { 19584, CombinerParameteriNV_remap_index },
+ { 28652, CombinerParameterivNV_remap_index },
{ 6267, FinalCombinerInputNV_remap_index },
{ 8665, GetCombinerInputParameterfvNV_remap_index },
- { 28453, GetCombinerInputParameterivNV_remap_index },
+ { 28489, GetCombinerInputParameterivNV_remap_index },
{ 6066, GetCombinerOutputParameterfvNV_remap_index },
- { 11949, GetCombinerOutputParameterivNV_remap_index },
+ { 12024, GetCombinerOutputParameterivNV_remap_index },
{ 5642, GetFinalCombinerInputParameterfvNV_remap_index },
- { 21726, GetFinalCombinerInputParameterivNV_remap_index },
- { 11003, ResizeBuffersMESA_remap_index },
+ { 21769, GetFinalCombinerInputParameterivNV_remap_index },
+ { 11042, ResizeBuffersMESA_remap_index },
{ 9753, WindowPos2dMESA_remap_index },
{ 944, WindowPos2dvMESA_remap_index },
- { 29444, WindowPos2fMESA_remap_index },
+ { 29480, WindowPos2fMESA_remap_index },
{ 6934, WindowPos2fvMESA_remap_index },
- { 15849, WindowPos2iMESA_remap_index },
- { 17826, WindowPos2ivMESA_remap_index },
- { 18401, WindowPos2sMESA_remap_index },
+ { 15892, WindowPos2iMESA_remap_index },
+ { 17869, WindowPos2ivMESA_remap_index },
+ { 18444, WindowPos2sMESA_remap_index },
{ 4885, WindowPos2svMESA_remap_index },
{ 6759, WindowPos3dMESA_remap_index },
- { 12228, WindowPos3dvMESA_remap_index },
+ { 12271, WindowPos3dvMESA_remap_index },
{ 472, WindowPos3fMESA_remap_index },
- { 13009, WindowPos3fvMESA_remap_index },
- { 21021, WindowPos3iMESA_remap_index },
- { 26535, WindowPos3ivMESA_remap_index },
- { 16366, WindowPos3sMESA_remap_index },
- { 27902, WindowPos3svMESA_remap_index },
+ { 13052, WindowPos3fvMESA_remap_index },
+ { 21064, WindowPos3iMESA_remap_index },
+ { 26610, WindowPos3ivMESA_remap_index },
+ { 16409, WindowPos3sMESA_remap_index },
+ { 27938, WindowPos3svMESA_remap_index },
{ 9704, WindowPos4dMESA_remap_index },
- { 14862, WindowPos4dvMESA_remap_index },
- { 12187, WindowPos4fMESA_remap_index },
- { 26940, WindowPos4fvMESA_remap_index },
- { 26688, WindowPos4iMESA_remap_index },
- { 10842, WindowPos4ivMESA_remap_index },
- { 16499, WindowPos4sMESA_remap_index },
+ { 14905, WindowPos4dvMESA_remap_index },
+ { 12230, WindowPos4fMESA_remap_index },
+ { 27015, WindowPos4fvMESA_remap_index },
+ { 26763, WindowPos4iMESA_remap_index },
+ { 10881, WindowPos4ivMESA_remap_index },
+ { 16542, WindowPos4sMESA_remap_index },
{ 2857, WindowPos4svMESA_remap_index },
- { 11988, MultiModeDrawArraysIBM_remap_index },
- { 25408, MultiModeDrawElementsIBM_remap_index },
+ { 23539, MultiModeDrawArraysIBM_remap_index },
+ { 25483, MultiModeDrawElementsIBM_remap_index },
{ 10692, DeleteFencesNV_remap_index },
- { 24537, FinishFenceNV_remap_index },
+ { 24612, FinishFenceNV_remap_index },
{ 3287, GenFencesNV_remap_index },
- { 14842, GetFenceivNV_remap_index },
+ { 14885, GetFenceivNV_remap_index },
{ 7226, IsFenceNV_remap_index },
- { 11876, SetFenceNV_remap_index },
+ { 11951, SetFenceNV_remap_index },
{ 3744, TestFenceNV_remap_index },
- { 27873, AreProgramsResidentNV_remap_index },
- { 27228, BindProgramNV_remap_index },
- { 22728, DeleteProgramsNV_remap_index },
- { 18830, ExecuteProgramNV_remap_index },
- { 29337, GenProgramsNV_remap_index },
- { 20429, GetProgramParameterdvNV_remap_index },
+ { 27909, AreProgramsResidentNV_remap_index },
+ { 27303, BindProgramNV_remap_index },
+ { 22771, DeleteProgramsNV_remap_index },
+ { 18873, ExecuteProgramNV_remap_index },
+ { 29373, GenProgramsNV_remap_index },
+ { 20472, GetProgramParameterdvNV_remap_index },
{ 9240, GetProgramParameterfvNV_remap_index },
- { 23058, GetProgramStringNV_remap_index },
- { 21415, GetProgramivNV_remap_index },
- { 20663, GetTrackMatrixivNV_remap_index },
- { 22878, GetVertexAttribPointervNV_remap_index },
- { 21659, GetVertexAttribdvNV_remap_index },
- { 16339, GetVertexAttribfvNV_remap_index },
- { 16030, GetVertexAttribivNV_remap_index },
- { 16746, IsProgramNV_remap_index },
+ { 23101, GetProgramStringNV_remap_index },
+ { 21458, GetProgramivNV_remap_index },
+ { 20706, GetTrackMatrixivNV_remap_index },
+ { 22921, GetVertexAttribPointervNV_remap_index },
+ { 21702, GetVertexAttribdvNV_remap_index },
+ { 16382, GetVertexAttribfvNV_remap_index },
+ { 16073, GetVertexAttribivNV_remap_index },
+ { 16789, IsProgramNV_remap_index },
{ 8246, LoadProgramNV_remap_index },
- { 24402, ProgramParameters4dvNV_remap_index },
- { 21345, ProgramParameters4fvNV_remap_index },
- { 18130, RequestResidentProgramsNV_remap_index },
- { 19519, TrackMatrixNV_remap_index },
- { 28430, VertexAttrib1dNV_remap_index },
- { 11817, VertexAttrib1dvNV_remap_index },
- { 24940, VertexAttrib1fNV_remap_index },
+ { 24477, ProgramParameters4dvNV_remap_index },
+ { 21388, ProgramParameters4fvNV_remap_index },
+ { 18173, RequestResidentProgramsNV_remap_index },
+ { 19562, TrackMatrixNV_remap_index },
+ { 28466, VertexAttrib1dNV_remap_index },
+ { 11892, VertexAttrib1dvNV_remap_index },
+ { 25015, VertexAttrib1fNV_remap_index },
{ 2245, VertexAttrib1fvNV_remap_index },
- { 26997, VertexAttrib1sNV_remap_index },
- { 13082, VertexAttrib1svNV_remap_index },
+ { 27072, VertexAttrib1sNV_remap_index },
+ { 13125, VertexAttrib1svNV_remap_index },
{ 4220, VertexAttrib2dNV_remap_index },
- { 11732, VertexAttrib2dvNV_remap_index },
- { 17585, VertexAttrib2fNV_remap_index },
- { 11379, VertexAttrib2fvNV_remap_index },
+ { 11807, VertexAttrib2dvNV_remap_index },
+ { 17628, VertexAttrib2fNV_remap_index },
+ { 11418, VertexAttrib2fvNV_remap_index },
{ 5045, VertexAttrib2sNV_remap_index },
- { 16420, VertexAttrib2svNV_remap_index },
+ { 16463, VertexAttrib2svNV_remap_index },
{ 9901, VertexAttrib3dNV_remap_index },
- { 28123, VertexAttrib3dvNV_remap_index },
+ { 28159, VertexAttrib3dvNV_remap_index },
{ 9052, VertexAttrib3fNV_remap_index },
- { 21686, VertexAttrib3fvNV_remap_index },
- { 24915, VertexAttrib3sNV_remap_index },
- { 20690, VertexAttrib3svNV_remap_index },
- { 25382, VertexAttrib4dNV_remap_index },
- { 29374, VertexAttrib4dvNV_remap_index },
+ { 21729, VertexAttrib3fvNV_remap_index },
+ { 24990, VertexAttrib3sNV_remap_index },
+ { 20733, VertexAttrib3svNV_remap_index },
+ { 25457, VertexAttrib4dNV_remap_index },
+ { 29410, VertexAttrib4dvNV_remap_index },
{ 3945, VertexAttrib4fNV_remap_index },
{ 8296, VertexAttrib4fvNV_remap_index },
- { 23380, VertexAttrib4sNV_remap_index },
+ { 23423, VertexAttrib4sNV_remap_index },
{ 1293, VertexAttrib4svNV_remap_index },
{ 4378, VertexAttrib4ubNV_remap_index },
{ 734, VertexAttrib4ubvNV_remap_index },
- { 19010, VertexAttribPointerNV_remap_index },
+ { 19053, VertexAttribPointerNV_remap_index },
{ 2097, VertexAttribs1dvNV_remap_index },
- { 16444, VertexAttribs1fvNV_remap_index },
- { 29174, VertexAttribs1svNV_remap_index },
+ { 16487, VertexAttribs1fvNV_remap_index },
+ { 29210, VertexAttribs1svNV_remap_index },
{ 9077, VertexAttribs2dvNV_remap_index },
- { 22248, VertexAttribs2fvNV_remap_index },
- { 15362, VertexAttribs2svNV_remap_index },
+ { 22291, VertexAttribs2fvNV_remap_index },
+ { 15405, VertexAttribs2svNV_remap_index },
{ 4577, VertexAttribs3dvNV_remap_index },
{ 1977, VertexAttribs3fvNV_remap_index },
- { 26283, VertexAttribs3svNV_remap_index },
- { 23470, VertexAttribs4dvNV_remap_index },
+ { 26358, VertexAttribs3svNV_remap_index },
+ { 23513, VertexAttribs4dvNV_remap_index },
{ 4603, VertexAttribs4fvNV_remap_index },
- { 28961, VertexAttribs4svNV_remap_index },
- { 26031, VertexAttribs4ubvNV_remap_index },
- { 23540, GetTexBumpParameterfvATI_remap_index },
- { 29215, GetTexBumpParameterivATI_remap_index },
- { 16084, TexBumpParameterfvATI_remap_index },
- { 18001, TexBumpParameterivATI_remap_index },
- { 13628, AlphaFragmentOp1ATI_remap_index },
+ { 28997, VertexAttribs4svNV_remap_index },
+ { 26106, VertexAttribs4ubvNV_remap_index },
+ { 23615, GetTexBumpParameterfvATI_remap_index },
+ { 29251, GetTexBumpParameterivATI_remap_index },
+ { 16127, TexBumpParameterfvATI_remap_index },
+ { 18044, TexBumpParameterivATI_remap_index },
+ { 13671, AlphaFragmentOp1ATI_remap_index },
{ 9592, AlphaFragmentOp2ATI_remap_index },
- { 21602, AlphaFragmentOp3ATI_remap_index },
- { 26210, BeginFragmentShaderATI_remap_index },
- { 27427, BindFragmentShaderATI_remap_index },
- { 20819, ColorFragmentOp1ATI_remap_index },
+ { 21645, AlphaFragmentOp3ATI_remap_index },
+ { 26285, BeginFragmentShaderATI_remap_index },
+ { 27502, BindFragmentShaderATI_remap_index },
+ { 20862, ColorFragmentOp1ATI_remap_index },
{ 3823, ColorFragmentOp2ATI_remap_index },
- { 27768, ColorFragmentOp3ATI_remap_index },
+ { 27804, ColorFragmentOp3ATI_remap_index },
{ 4722, DeleteFragmentShaderATI_remap_index },
- { 29398, EndFragmentShaderATI_remap_index },
- { 28644, GenFragmentShadersATI_remap_index },
- { 22352, PassTexCoordATI_remap_index },
+ { 29434, EndFragmentShaderATI_remap_index },
+ { 28680, GenFragmentShadersATI_remap_index },
+ { 22395, PassTexCoordATI_remap_index },
{ 5965, SampleMapATI_remap_index },
{ 5738, SetFragmentShaderConstantATI_remap_index },
{ 319, PointParameteriNV_remap_index },
- { 12389, PointParameterivNV_remap_index },
- { 25221, ActiveStencilFaceEXT_remap_index },
- { 24062, BindVertexArrayAPPLE_remap_index },
+ { 12432, PointParameterivNV_remap_index },
+ { 25296, ActiveStencilFaceEXT_remap_index },
+ { 24137, BindVertexArrayAPPLE_remap_index },
{ 2522, DeleteVertexArraysAPPLE_remap_index },
- { 15701, GenVertexArraysAPPLE_remap_index },
- { 20494, IsVertexArrayAPPLE_remap_index },
+ { 15744, GenVertexArraysAPPLE_remap_index },
+ { 20537, IsVertexArrayAPPLE_remap_index },
{ 775, GetProgramNamedParameterdvNV_remap_index },
{ 3128, GetProgramNamedParameterfvNV_remap_index },
- { 23571, ProgramNamedParameter4dNV_remap_index },
- { 12664, ProgramNamedParameter4dvNV_remap_index },
+ { 23646, ProgramNamedParameter4dNV_remap_index },
+ { 12707, ProgramNamedParameter4dvNV_remap_index },
{ 7862, ProgramNamedParameter4fNV_remap_index },
{ 10311, ProgramNamedParameter4fvNV_remap_index },
- { 21324, DepthBoundsEXT_remap_index },
+ { 21367, DepthBoundsEXT_remap_index },
{ 1043, BlendEquationSeparateEXT_remap_index },
- { 12783, BindFramebufferEXT_remap_index },
- { 22539, BindRenderbufferEXT_remap_index },
+ { 12826, BindFramebufferEXT_remap_index },
+ { 22582, BindRenderbufferEXT_remap_index },
{ 8515, CheckFramebufferStatusEXT_remap_index },
- { 19810, DeleteFramebuffersEXT_remap_index },
- { 28025, DeleteRenderbuffersEXT_remap_index },
- { 11756, FramebufferRenderbufferEXT_remap_index },
- { 11893, FramebufferTexture1DEXT_remap_index },
+ { 19853, DeleteFramebuffersEXT_remap_index },
+ { 28061, DeleteRenderbuffersEXT_remap_index },
+ { 11831, FramebufferRenderbufferEXT_remap_index },
+ { 11968, FramebufferTexture1DEXT_remap_index },
{ 10139, FramebufferTexture2DEXT_remap_index },
{ 9806, FramebufferTexture3DEXT_remap_index },
- { 20386, GenFramebuffersEXT_remap_index },
- { 15248, GenRenderbuffersEXT_remap_index },
+ { 20429, GenFramebuffersEXT_remap_index },
+ { 15291, GenRenderbuffersEXT_remap_index },
{ 5684, GenerateMipmapEXT_remap_index },
- { 19041, GetFramebufferAttachmentParameterivEXT_remap_index },
- { 28550, GetRenderbufferParameterivEXT_remap_index },
- { 17881, IsFramebufferEXT_remap_index },
- { 29297, IsRenderbufferEXT_remap_index },
+ { 19084, GetFramebufferAttachmentParameterivEXT_remap_index },
+ { 28586, GetRenderbufferParameterivEXT_remap_index },
+ { 17924, IsFramebufferEXT_remap_index },
+ { 29333, IsRenderbufferEXT_remap_index },
{ 7173, RenderbufferStorageEXT_remap_index },
{ 651, BlitFramebufferEXT_remap_index },
- { 12483, BufferParameteriAPPLE_remap_index },
- { 16778, FlushMappedBufferRangeAPPLE_remap_index },
+ { 12526, BufferParameteriAPPLE_remap_index },
+ { 16821, FlushMappedBufferRangeAPPLE_remap_index },
{ 2701, FramebufferTextureLayerEXT_remap_index },
- { 25932, ProvokingVertexEXT_remap_index },
+ { 26007, ProvokingVertexEXT_remap_index },
{ 9461, GetTexParameterPointervAPPLE_remap_index },
{ 4405, TextureRangeAPPLE_remap_index },
- { 25247, StencilFuncSeparateATI_remap_index },
- { 15768, ProgramEnvParameters4fvEXT_remap_index },
- { 14986, ProgramLocalParameters4fvEXT_remap_index },
- { 12317, GetQueryObjecti64vEXT_remap_index },
+ { 25322, StencilFuncSeparateATI_remap_index },
+ { 15811, ProgramEnvParameters4fvEXT_remap_index },
+ { 15029, ProgramLocalParameters4fvEXT_remap_index },
+ { 12360, GetQueryObjecti64vEXT_remap_index },
{ 9103, GetQueryObjectui64vEXT_remap_index },
{ -1, -1 }
};
@@ -4729,8 +4730,8 @@ static const struct gl_function_remap MESA_alt_functions[] = {
/* from GL_EXT_blend_minmax */
{ 9863, _gloffset_BlendEquation },
/* from GL_EXT_color_subtable */
- { 14884, _gloffset_ColorSubTable },
- { 27957, _gloffset_CopyColorSubTable },
+ { 14927, _gloffset_ColorSubTable },
+ { 27993, _gloffset_CopyColorSubTable },
/* from GL_EXT_convolution */
{ 213, _gloffset_ConvolutionFilter1D },
{ 2284, _gloffset_CopyConvolutionFilter1D },
@@ -4738,62 +4739,62 @@ static const struct gl_function_remap MESA_alt_functions[] = {
{ 7522, _gloffset_ConvolutionFilter2D },
{ 7688, _gloffset_ConvolutionParameteriv },
{ 8148, _gloffset_ConvolutionParameterfv },
- { 18029, _gloffset_GetSeparableFilter },
- { 21075, _gloffset_SeparableFilter2D },
- { 21904, _gloffset_ConvolutionParameteri },
- { 22027, _gloffset_ConvolutionParameterf },
- { 23406, _gloffset_GetConvolutionParameterfv },
- { 24228, _gloffset_GetConvolutionFilter },
- { 26472, _gloffset_CopyConvolutionFilter2D },
+ { 18072, _gloffset_GetSeparableFilter },
+ { 21118, _gloffset_SeparableFilter2D },
+ { 21947, _gloffset_ConvolutionParameteri },
+ { 22070, _gloffset_ConvolutionParameterf },
+ { 23449, _gloffset_GetConvolutionParameterfv },
+ { 24303, _gloffset_GetConvolutionFilter },
+ { 26547, _gloffset_CopyConvolutionFilter2D },
/* from GL_EXT_copy_texture */
- { 13142, _gloffset_CopyTexSubImage3D },
- { 14624, _gloffset_CopyTexImage2D },
- { 21512, _gloffset_CopyTexImage1D },
- { 23909, _gloffset_CopyTexSubImage2D },
- { 26110, _gloffset_CopyTexSubImage1D },
+ { 13185, _gloffset_CopyTexSubImage3D },
+ { 14667, _gloffset_CopyTexImage2D },
+ { 21555, _gloffset_CopyTexImage1D },
+ { 23984, _gloffset_CopyTexSubImage2D },
+ { 26185, _gloffset_CopyTexSubImage1D },
/* from GL_EXT_draw_range_elements */
{ 8402, _gloffset_DrawRangeElements },
/* from GL_EXT_histogram */
{ 812, _gloffset_Histogram },
{ 3088, _gloffset_ResetHistogram },
{ 8774, _gloffset_GetMinmax },
- { 13476, _gloffset_GetHistogramParameterfv },
- { 21437, _gloffset_GetMinmaxParameteriv },
- { 23296, _gloffset_ResetMinmax },
- { 24125, _gloffset_GetHistogramParameteriv },
- { 25181, _gloffset_GetHistogram },
- { 27543, _gloffset_Minmax },
- { 29044, _gloffset_GetMinmaxParameterfv },
+ { 13519, _gloffset_GetHistogramParameterfv },
+ { 21480, _gloffset_GetMinmaxParameteriv },
+ { 23339, _gloffset_ResetMinmax },
+ { 24200, _gloffset_GetHistogramParameteriv },
+ { 25256, _gloffset_GetHistogram },
+ { 27618, _gloffset_Minmax },
+ { 29080, _gloffset_GetMinmaxParameterfv },
/* from GL_EXT_paletted_texture */
{ 7384, _gloffset_ColorTable },
- { 13322, _gloffset_GetColorTable },
- { 20133, _gloffset_GetColorTableParameterfv },
- { 22083, _gloffset_GetColorTableParameteriv },
+ { 13365, _gloffset_GetColorTable },
+ { 20176, _gloffset_GetColorTableParameterfv },
+ { 22126, _gloffset_GetColorTableParameteriv },
/* from GL_EXT_subtexture */
{ 6105, _gloffset_TexSubImage1D },
{ 9388, _gloffset_TexSubImage2D },
/* from GL_EXT_texture3D */
{ 1658, _gloffset_TexImage3D },
- { 19902, _gloffset_TexSubImage3D },
+ { 19945, _gloffset_TexSubImage3D },
/* from GL_EXT_texture_object */
{ 2964, _gloffset_PrioritizeTextures },
{ 6554, _gloffset_AreTexturesResident },
- { 11841, _gloffset_GenTextures },
- { 13808, _gloffset_DeleteTextures },
- { 17059, _gloffset_IsTexture },
- { 26175, _gloffset_BindTexture },
+ { 11916, _gloffset_GenTextures },
+ { 13851, _gloffset_DeleteTextures },
+ { 17102, _gloffset_IsTexture },
+ { 26250, _gloffset_BindTexture },
/* from GL_EXT_vertex_array */
- { 21264, _gloffset_ArrayElement },
- { 27131, _gloffset_GetPointerv },
- { 28671, _gloffset_DrawArrays },
+ { 21307, _gloffset_ArrayElement },
+ { 27206, _gloffset_GetPointerv },
+ { 28707, _gloffset_DrawArrays },
/* from GL_SGI_color_table */
{ 6672, _gloffset_ColorTableParameteriv },
{ 7384, _gloffset_ColorTable },
- { 13322, _gloffset_GetColorTable },
- { 13432, _gloffset_CopyColorTable },
- { 16920, _gloffset_ColorTableParameterfv },
- { 20133, _gloffset_GetColorTableParameterfv },
- { 22083, _gloffset_GetColorTableParameteriv },
+ { 13365, _gloffset_GetColorTable },
+ { 13475, _gloffset_CopyColorTable },
+ { 16963, _gloffset_ColorTableParameterfv },
+ { 20176, _gloffset_GetColorTableParameterfv },
+ { 22126, _gloffset_GetColorTableParameteriv },
/* from GL_VERSION_1_3 */
{ 381, _gloffset_MultiTexCoord3sARB },
{ 613, _gloffset_ActiveTextureARB },
@@ -4806,29 +4807,29 @@ static const struct gl_function_remap MESA_alt_functions[] = {
{ 9625, _gloffset_MultiTexCoord4sARB },
{ 10225, _gloffset_MultiTexCoord2dvARB },
{ 10607, _gloffset_MultiTexCoord1svARB },
- { 10864, _gloffset_MultiTexCoord3svARB },
- { 10925, _gloffset_MultiTexCoord4iARB },
- { 11612, _gloffset_MultiTexCoord3iARB },
- { 12346, _gloffset_MultiTexCoord1dARB },
- { 12512, _gloffset_MultiTexCoord3dvARB },
- { 13676, _gloffset_MultiTexCoord3ivARB },
- { 13721, _gloffset_MultiTexCoord2sARB },
- { 14941, _gloffset_MultiTexCoord4ivARB },
- { 16570, _gloffset_ClientActiveTextureARB },
- { 18786, _gloffset_MultiTexCoord2dARB },
- { 19161, _gloffset_MultiTexCoord4dvARB },
- { 19447, _gloffset_MultiTexCoord4fvARB },
- { 20274, _gloffset_MultiTexCoord3fARB },
- { 22584, _gloffset_MultiTexCoord4dARB },
- { 22788, _gloffset_MultiTexCoord1sARB },
- { 22966, _gloffset_MultiTexCoord1dvARB },
- { 23753, _gloffset_MultiTexCoord1ivARB },
- { 23846, _gloffset_MultiTexCoord2ivARB },
- { 24185, _gloffset_MultiTexCoord1iARB },
- { 25456, _gloffset_MultiTexCoord4svARB },
- { 25974, _gloffset_MultiTexCoord1fARB },
- { 26237, _gloffset_MultiTexCoord4fARB },
- { 28505, _gloffset_MultiTexCoord2fvARB },
+ { 10903, _gloffset_MultiTexCoord3svARB },
+ { 10964, _gloffset_MultiTexCoord4iARB },
+ { 11687, _gloffset_MultiTexCoord3iARB },
+ { 12389, _gloffset_MultiTexCoord1dARB },
+ { 12555, _gloffset_MultiTexCoord3dvARB },
+ { 13719, _gloffset_MultiTexCoord3ivARB },
+ { 13764, _gloffset_MultiTexCoord2sARB },
+ { 14984, _gloffset_MultiTexCoord4ivARB },
+ { 16613, _gloffset_ClientActiveTextureARB },
+ { 18829, _gloffset_MultiTexCoord2dARB },
+ { 19204, _gloffset_MultiTexCoord4dvARB },
+ { 19490, _gloffset_MultiTexCoord4fvARB },
+ { 20317, _gloffset_MultiTexCoord3fARB },
+ { 22627, _gloffset_MultiTexCoord4dARB },
+ { 22831, _gloffset_MultiTexCoord1sARB },
+ { 23009, _gloffset_MultiTexCoord1dvARB },
+ { 23828, _gloffset_MultiTexCoord1ivARB },
+ { 23921, _gloffset_MultiTexCoord2ivARB },
+ { 24260, _gloffset_MultiTexCoord1iARB },
+ { 25531, _gloffset_MultiTexCoord4svARB },
+ { 26049, _gloffset_MultiTexCoord1fARB },
+ { 26312, _gloffset_MultiTexCoord4fARB },
+ { 28541, _gloffset_MultiTexCoord2fvARB },
{ -1, -1 }
};
@@ -4900,10 +4901,10 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = {
#if defined(need_GL_ARB_matrix_palette)
static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
{ 3339, -1 }, /* MatrixIndexusvARB */
- { 11469, -1 }, /* MatrixIndexuivARB */
- { 12634, -1 }, /* MatrixIndexPointerARB */
- { 17308, -1 }, /* CurrentPaletteMatrixARB */
- { 20018, -1 }, /* MatrixIndexubvARB */
+ { 11508, -1 }, /* MatrixIndexuivARB */
+ { 12677, -1 }, /* MatrixIndexPointerARB */
+ { 17351, -1 }, /* CurrentPaletteMatrixARB */
+ { 20061, -1 }, /* MatrixIndexubvARB */
{ -1, -1 }
};
#endif
@@ -4976,13 +4977,13 @@ static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
{ 2226, -1 }, /* WeightubvARB */
{ 5572, -1 }, /* WeightivARB */
{ 9728, -1 }, /* WeightPointerARB */
- { 12103, -1 }, /* WeightfvARB */
- { 15388, -1 }, /* WeightbvARB */
- { 18454, -1 }, /* WeightusvARB */
- { 21001, -1 }, /* VertexBlendARB */
- { 26058, -1 }, /* WeightsvARB */
- { 28007, -1 }, /* WeightdvARB */
- { 28705, -1 }, /* WeightuivARB */
+ { 12146, -1 }, /* WeightfvARB */
+ { 15431, -1 }, /* WeightbvARB */
+ { 18497, -1 }, /* WeightusvARB */
+ { 21044, -1 }, /* VertexBlendARB */
+ { 26133, -1 }, /* WeightsvARB */
+ { 28043, -1 }, /* WeightdvARB */
+ { 28741, -1 }, /* WeightuivARB */
{ -1, -1 }
};
#endif
@@ -5080,8 +5081,8 @@ static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
#if defined(need_GL_EXT_color_subtable)
static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
- { 14884, _gloffset_ColorSubTable },
- { 27957, _gloffset_CopyColorSubTable },
+ { 14927, _gloffset_ColorSubTable },
+ { 27993, _gloffset_CopyColorSubTable },
{ -1, -1 }
};
#endif
@@ -5101,13 +5102,13 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = {
{ 7522, _gloffset_ConvolutionFilter2D },
{ 7688, _gloffset_ConvolutionParameteriv },
{ 8148, _gloffset_ConvolutionParameterfv },
- { 18029, _gloffset_GetSeparableFilter },
- { 21075, _gloffset_SeparableFilter2D },
- { 21904, _gloffset_ConvolutionParameteri },
- { 22027, _gloffset_ConvolutionParameterf },
- { 23406, _gloffset_GetConvolutionParameterfv },
- { 24228, _gloffset_GetConvolutionFilter },
- { 26472, _gloffset_CopyConvolutionFilter2D },
+ { 18072, _gloffset_GetSeparableFilter },
+ { 21118, _gloffset_SeparableFilter2D },
+ { 21947, _gloffset_ConvolutionParameteri },
+ { 22070, _gloffset_ConvolutionParameterf },
+ { 23449, _gloffset_GetConvolutionParameterfv },
+ { 24303, _gloffset_GetConvolutionFilter },
+ { 26547, _gloffset_CopyConvolutionFilter2D },
{ -1, -1 }
};
#endif
@@ -5115,38 +5116,38 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = {
#if defined(need_GL_EXT_coordinate_frame)
static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
{ 9272, -1 }, /* TangentPointerEXT */
- { 10983, -1 }, /* Binormal3ivEXT */
- { 11565, -1 }, /* Tangent3sEXT */
- { 12699, -1 }, /* Tangent3fvEXT */
- { 16320, -1 }, /* Tangent3dvEXT */
- { 17006, -1 }, /* Binormal3bvEXT */
- { 18082, -1 }, /* Binormal3dEXT */
- { 19950, -1 }, /* Tangent3fEXT */
- { 21976, -1 }, /* Binormal3sEXT */
- { 22394, -1 }, /* Tangent3ivEXT */
- { 22413, -1 }, /* Tangent3dEXT */
- { 23193, -1 }, /* Binormal3svEXT */
- { 23651, -1 }, /* Binormal3fEXT */
- { 24503, -1 }, /* Binormal3dvEXT */
- { 25678, -1 }, /* Tangent3iEXT */
- { 26757, -1 }, /* Tangent3bvEXT */
- { 27166, -1 }, /* Tangent3bEXT */
- { 27730, -1 }, /* Binormal3fvEXT */
- { 28404, -1 }, /* BinormalPointerEXT */
- { 28809, -1 }, /* Tangent3svEXT */
- { 29246, -1 }, /* Binormal3bEXT */
- { 29423, -1 }, /* Binormal3iEXT */
+ { 11022, -1 }, /* Binormal3ivEXT */
+ { 11640, -1 }, /* Tangent3sEXT */
+ { 12742, -1 }, /* Tangent3fvEXT */
+ { 16363, -1 }, /* Tangent3dvEXT */
+ { 17049, -1 }, /* Binormal3bvEXT */
+ { 18125, -1 }, /* Binormal3dEXT */
+ { 19993, -1 }, /* Tangent3fEXT */
+ { 22019, -1 }, /* Binormal3sEXT */
+ { 22437, -1 }, /* Tangent3ivEXT */
+ { 22456, -1 }, /* Tangent3dEXT */
+ { 23236, -1 }, /* Binormal3svEXT */
+ { 23726, -1 }, /* Binormal3fEXT */
+ { 24578, -1 }, /* Binormal3dvEXT */
+ { 25753, -1 }, /* Tangent3iEXT */
+ { 26832, -1 }, /* Tangent3bvEXT */
+ { 27241, -1 }, /* Tangent3bEXT */
+ { 27766, -1 }, /* Binormal3fvEXT */
+ { 28440, -1 }, /* BinormalPointerEXT */
+ { 28845, -1 }, /* Tangent3svEXT */
+ { 29282, -1 }, /* Binormal3bEXT */
+ { 29459, -1 }, /* Binormal3iEXT */
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_copy_texture)
static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
- { 13142, _gloffset_CopyTexSubImage3D },
- { 14624, _gloffset_CopyTexImage2D },
- { 21512, _gloffset_CopyTexImage1D },
- { 23909, _gloffset_CopyTexSubImage2D },
- { 26110, _gloffset_CopyTexSubImage1D },
+ { 13185, _gloffset_CopyTexSubImage3D },
+ { 14667, _gloffset_CopyTexImage2D },
+ { 21555, _gloffset_CopyTexImage1D },
+ { 23984, _gloffset_CopyTexSubImage2D },
+ { 26185, _gloffset_CopyTexSubImage1D },
{ -1, -1 }
};
#endif
@@ -5186,6 +5187,13 @@ static const struct gl_function_remap GL_EXT_framebuffer_blit_functions[] = {
};
#endif
+#if defined(need_GL_EXT_framebuffer_multisample)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_framebuffer_multisample_functions[] = {
+ { -1, -1 }
+};
+#endif
+
#if defined(need_GL_EXT_framebuffer_object)
/* functions defined in MESA_remap_table_functions are excluded */
static const struct gl_function_remap GL_EXT_framebuffer_object_functions[] = {
@@ -5205,13 +5213,13 @@ static const struct gl_function_remap GL_EXT_histogram_functions[] = {
{ 812, _gloffset_Histogram },
{ 3088, _gloffset_ResetHistogram },
{ 8774, _gloffset_GetMinmax },
- { 13476, _gloffset_GetHistogramParameterfv },
- { 21437, _gloffset_GetMinmaxParameteriv },
- { 23296, _gloffset_ResetMinmax },
- { 24125, _gloffset_GetHistogramParameteriv },
- { 25181, _gloffset_GetHistogram },
- { 27543, _gloffset_Minmax },
- { 29044, _gloffset_GetMinmaxParameterfv },
+ { 13519, _gloffset_GetHistogramParameterfv },
+ { 21480, _gloffset_GetMinmaxParameteriv },
+ { 23339, _gloffset_ResetMinmax },
+ { 24200, _gloffset_GetHistogramParameteriv },
+ { 25256, _gloffset_GetHistogram },
+ { 27618, _gloffset_Minmax },
+ { 29080, _gloffset_GetMinmaxParameterfv },
{ -1, -1 }
};
#endif
@@ -5225,16 +5233,16 @@ static const struct gl_function_remap GL_EXT_index_func_functions[] = {
#if defined(need_GL_EXT_index_material)
static const struct gl_function_remap GL_EXT_index_material_functions[] = {
- { 18541, -1 }, /* IndexMaterialEXT */
+ { 18584, -1 }, /* IndexMaterialEXT */
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_light_texture)
static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
- { 23213, -1 }, /* ApplyTextureEXT */
- { 23250, -1 }, /* TextureMaterialEXT */
- { 23275, -1 }, /* TextureLightEXT */
+ { 23256, -1 }, /* ApplyTextureEXT */
+ { 23293, -1 }, /* TextureMaterialEXT */
+ { 23318, -1 }, /* TextureLightEXT */
{ -1, -1 }
};
#endif
@@ -5256,9 +5264,9 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = {
#if defined(need_GL_EXT_paletted_texture)
static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
{ 7384, _gloffset_ColorTable },
- { 13322, _gloffset_GetColorTable },
- { 20133, _gloffset_GetColorTableParameterfv },
- { 22083, _gloffset_GetColorTableParameteriv },
+ { 13365, _gloffset_GetColorTable },
+ { 20176, _gloffset_GetColorTableParameterfv },
+ { 22126, _gloffset_GetColorTableParameteriv },
{ -1, -1 }
};
#endif
@@ -5266,9 +5274,9 @@ static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
#if defined(need_GL_EXT_pixel_transform)
static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
{ 9513, -1 }, /* PixelTransformParameterfvEXT */
- { 19126, -1 }, /* PixelTransformParameterfEXT */
- { 19206, -1 }, /* PixelTransformParameteriEXT */
- { 28368, -1 }, /* PixelTransformParameterivEXT */
+ { 19169, -1 }, /* PixelTransformParameterfEXT */
+ { 19249, -1 }, /* PixelTransformParameteriEXT */
+ { 28404, -1 }, /* PixelTransformParameterivEXT */
{ -1, -1 }
};
#endif
@@ -5319,7 +5327,7 @@ static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
#if defined(need_GL_EXT_texture3D)
static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
{ 1658, _gloffset_TexImage3D },
- { 19902, _gloffset_TexSubImage3D },
+ { 19945, _gloffset_TexSubImage3D },
{ -1, -1 }
};
#endif
@@ -5335,17 +5343,17 @@ static const struct gl_function_remap GL_EXT_texture_array_functions[] = {
static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
{ 2964, _gloffset_PrioritizeTextures },
{ 6554, _gloffset_AreTexturesResident },
- { 11841, _gloffset_GenTextures },
- { 13808, _gloffset_DeleteTextures },
- { 17059, _gloffset_IsTexture },
- { 26175, _gloffset_BindTexture },
+ { 11916, _gloffset_GenTextures },
+ { 13851, _gloffset_DeleteTextures },
+ { 17102, _gloffset_IsTexture },
+ { 26250, _gloffset_BindTexture },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_texture_perturb_normal)
static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = {
- { 12053, -1 }, /* TextureNormalEXT */
+ { 12096, -1 }, /* TextureNormalEXT */
{ -1, -1 }
};
#endif
@@ -5360,18 +5368,18 @@ static const struct gl_function_remap GL_EXT_timer_query_functions[] = {
#if defined(need_GL_EXT_vertex_array)
/* functions defined in MESA_remap_table_functions are excluded */
static const struct gl_function_remap GL_EXT_vertex_array_functions[] = {
- { 21264, _gloffset_ArrayElement },
- { 27131, _gloffset_GetPointerv },
- { 28671, _gloffset_DrawArrays },
+ { 21307, _gloffset_ArrayElement },
+ { 27206, _gloffset_GetPointerv },
+ { 28707, _gloffset_DrawArrays },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_vertex_weighting)
static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
- { 17089, -1 }, /* VertexWeightfvEXT */
- { 23629, -1 }, /* VertexWeightfEXT */
- { 25150, -1 }, /* VertexWeightPointerEXT */
+ { 17132, -1 }, /* VertexWeightfvEXT */
+ { 23704, -1 }, /* VertexWeightfEXT */
+ { 25225, -1 }, /* VertexWeightPointerEXT */
{ -1, -1 }
};
#endif
@@ -5382,8 +5390,8 @@ static const struct gl_function_remap GL_HP_image_transform_functions[] = {
{ 3305, -1 }, /* ImageTransformParameterfHP */
{ 8966, -1 }, /* ImageTransformParameterfvHP */
{ 10525, -1 }, /* ImageTransformParameteriHP */
- { 10754, -1 }, /* GetImageTransformParameterivHP */
- { 17153, -1 }, /* ImageTransformParameterivHP */
+ { 10793, -1 }, /* GetImageTransformParameterivHP */
+ { 17196, -1 }, /* ImageTransformParameterivHP */
{ -1, -1 }
};
#endif
@@ -5402,9 +5410,9 @@ static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
{ 6728, -1 }, /* FogCoordPointerListIBM */
{ 7035, -1 }, /* VertexPointerListIBM */
{ 10446, -1 }, /* ColorPointerListIBM */
- { 11672, -1 }, /* TexCoordPointerListIBM */
- { 12075, -1 }, /* IndexPointerListIBM */
- { 28987, -1 }, /* EdgeFlagPointerListIBM */
+ { 11747, -1 }, /* TexCoordPointerListIBM */
+ { 12118, -1 }, /* IndexPointerListIBM */
+ { 29023, -1 }, /* EdgeFlagPointerListIBM */
{ -1, -1 }
};
#endif
@@ -5418,10 +5426,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] =
#if defined(need_GL_INTEL_parallel_arrays)
static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
- { 11095, -1 }, /* VertexPointervINTEL */
- { 13569, -1 }, /* ColorPointervINTEL */
- { 26446, -1 }, /* NormalPointervINTEL */
- { 26872, -1 }, /* TexCoordPointervINTEL */
+ { 11134, -1 }, /* VertexPointervINTEL */
+ { 13612, -1 }, /* ColorPointervINTEL */
+ { 26521, -1 }, /* NormalPointervINTEL */
+ { 26947, -1 }, /* TexCoordPointervINTEL */
{ -1, -1 }
};
#endif
@@ -5438,7 +5446,7 @@ static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
{ 1522, -1 }, /* GetDebugLogLengthMESA */
{ 3063, -1 }, /* ClearDebugLogMESA */
{ 4018, -1 }, /* GetDebugLogMESA */
- { 27324, -1 }, /* CreateDebugObjectMESA */
+ { 27399, -1 }, /* CreateDebugObjectMESA */
{ -1, -1 }
};
#endif
@@ -5456,11 +5464,11 @@ static const struct gl_function_remap GL_NV_evaluators_functions[] = {
{ 7490, -1 }, /* MapControlPointsNV */
{ 7589, -1 }, /* MapParameterfvNV */
{ 9371, -1 }, /* EvalMapsNV */
- { 15058, -1 }, /* GetMapAttribParameterfvNV */
- { 15224, -1 }, /* MapParameterivNV */
- { 21827, -1 }, /* GetMapParameterivNV */
- { 22325, -1 }, /* GetMapParameterfvNV */
- { 25782, -1 }, /* GetMapControlPointsNV */
+ { 15101, -1 }, /* GetMapAttribParameterfvNV */
+ { 15267, -1 }, /* MapParameterivNV */
+ { 21870, -1 }, /* GetMapParameterivNV */
+ { 22368, -1 }, /* GetMapParameterfvNV */
+ { 25857, -1 }, /* GetMapControlPointsNV */
{ -1, -1 }
};
#endif
@@ -5495,8 +5503,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
#if defined(need_GL_NV_register_combiners2)
static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
- { 13961, -1 }, /* CombinerStageParameterfvNV */
- { 14276, -1 }, /* GetCombinerStageParameterfvNV */
+ { 14004, -1 }, /* CombinerStageParameterfvNV */
+ { 14319, -1 }, /* GetCombinerStageParameterfvNV */
{ -1, -1 }
};
#endif
@@ -5524,16 +5532,16 @@ static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
#if defined(need_GL_SGIS_detail_texture)
static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
- { 14249, -1 }, /* GetDetailTexFuncSGIS */
- { 14569, -1 }, /* DetailTexFuncSGIS */
+ { 14292, -1 }, /* GetDetailTexFuncSGIS */
+ { 14612, -1 }, /* DetailTexFuncSGIS */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIS_fog_function)
static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
- { 23891, -1 }, /* FogFuncSGIS */
- { 24556, -1 }, /* GetFogFuncSGIS */
+ { 23966, -1 }, /* FogFuncSGIS */
+ { 24631, -1 }, /* GetFogFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5562,7 +5570,7 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
#if defined(need_GL_SGIS_sharpen_texture)
static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
{ 5834, -1 }, /* GetSharpenTexFuncSGIS */
- { 19421, -1 }, /* SharpenTexFuncSGIS */
+ { 19464, -1 }, /* SharpenTexFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5570,14 +5578,14 @@ static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
#if defined(need_GL_SGIS_texture4D)
static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
{ 894, -1 }, /* TexImage4DSGIS */
- { 13877, -1 }, /* TexSubImage4DSGIS */
+ { 13920, -1 }, /* TexSubImage4DSGIS */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIS_texture_color_mask)
static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
- { 13275, -1 }, /* TextureColorMaskSGIS */
+ { 13318, -1 }, /* TextureColorMaskSGIS */
{ -1, -1 }
};
#endif
@@ -5585,7 +5593,7 @@ static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
#if defined(need_GL_SGIS_texture_filter4)
static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
{ 6011, -1 }, /* GetTexFilterFuncSGIS */
- { 14395, -1 }, /* TexFilterFuncSGIS */
+ { 14438, -1 }, /* TexFilterFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5595,9 +5603,9 @@ static const struct gl_function_remap GL_SGIX_async_functions[] = {
{ 3014, -1 }, /* AsyncMarkerSGIX */
{ 3997, -1 }, /* FinishAsyncSGIX */
{ 4703, -1 }, /* PollAsyncSGIX */
- { 19568, -1 }, /* DeleteAsyncMarkersSGIX */
- { 19597, -1 }, /* IsAsyncMarkerSGIX */
- { 28784, -1 }, /* GenAsyncMarkersSGIX */
+ { 19611, -1 }, /* DeleteAsyncMarkersSGIX */
+ { 19640, -1 }, /* IsAsyncMarkerSGIX */
+ { 28820, -1 }, /* GenAsyncMarkersSGIX */
{ -1, -1 }
};
#endif
@@ -5620,29 +5628,29 @@ static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
{ 8100, -1 }, /* FragmentLightModeliSGIX */
{ 9434, -1 }, /* FragmentLightivSGIX */
{ 9671, -1 }, /* GetFragmentMaterialivSGIX */
- { 16976, -1 }, /* FragmentLightModelfSGIX */
- { 17276, -1 }, /* FragmentColorMaterialSGIX */
- { 17648, -1 }, /* FragmentMaterialiSGIX */
- { 18869, -1 }, /* LightEnviSGIX */
- { 20225, -1 }, /* FragmentLightModelfvSGIX */
- { 20534, -1 }, /* FragmentLightfvSGIX */
- { 25032, -1 }, /* FragmentLightfSGIX */
- { 27700, -1 }, /* GetFragmentLightfvSGIX */
- { 29267, -1 }, /* FragmentMaterialivSGIX */
+ { 17019, -1 }, /* FragmentLightModelfSGIX */
+ { 17319, -1 }, /* FragmentColorMaterialSGIX */
+ { 17691, -1 }, /* FragmentMaterialiSGIX */
+ { 18912, -1 }, /* LightEnviSGIX */
+ { 20268, -1 }, /* FragmentLightModelfvSGIX */
+ { 20577, -1 }, /* FragmentLightfvSGIX */
+ { 25107, -1 }, /* FragmentLightfSGIX */
+ { 27736, -1 }, /* GetFragmentLightfvSGIX */
+ { 29303, -1 }, /* FragmentMaterialivSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_framezoom)
static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
- { 19620, -1 }, /* FrameZoomSGIX */
+ { 19663, -1 }, /* FrameZoomSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_igloo_interface)
static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
- { 25340, -1 }, /* IglooInterfaceSGIX */
+ { 25415, -1 }, /* IglooInterfaceSGIX */
{ -1, -1 }
};
#endif
@@ -5652,9 +5660,9 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
{ 2573, -1 }, /* ReadInstrumentsSGIX */
{ 5590, -1 }, /* PollInstrumentsSGIX */
{ 9332, -1 }, /* GetInstrumentsSGIX */
- { 11306, -1 }, /* StartInstrumentsSGIX */
- { 13995, -1 }, /* StopInstrumentsSGIX */
- { 15601, -1 }, /* InstrumentsBufferSGIX */
+ { 11345, -1 }, /* StartInstrumentsSGIX */
+ { 14038, -1 }, /* StopInstrumentsSGIX */
+ { 15644, -1 }, /* InstrumentsBufferSGIX */
{ -1, -1 }
};
#endif
@@ -5663,10 +5671,10 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
{ 1125, -1 }, /* ListParameterfSGIX */
{ 2763, -1 }, /* GetListParameterfvSGIX */
- { 15516, -1 }, /* ListParameteriSGIX */
- { 16270, -1 }, /* ListParameterfvSGIX */
- { 18275, -1 }, /* ListParameterivSGIX */
- { 28828, -1 }, /* GetListParameterivSGIX */
+ { 15559, -1 }, /* ListParameteriSGIX */
+ { 16313, -1 }, /* ListParameterfvSGIX */
+ { 18318, -1 }, /* ListParameterivSGIX */
+ { 28864, -1 }, /* GetListParameterivSGIX */
{ -1, -1 }
};
#endif
@@ -5681,16 +5689,16 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
#if defined(need_GL_SGIX_polynomial_ffd)
static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
{ 3251, -1 }, /* LoadIdentityDeformationMapSGIX */
- { 14095, -1 }, /* DeformSGIX */
- { 21376, -1 }, /* DeformationMap3fSGIX */
- { 27588, -1 }, /* DeformationMap3dSGIX */
+ { 10713, -1 }, /* DeformationMap3dSGIX */
+ { 14138, -1 }, /* DeformSGIX */
+ { 21419, -1 }, /* DeformationMap3fSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_reference_plane)
static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
- { 12826, -1 }, /* ReferencePlaneSGIX */
+ { 12869, -1 }, /* ReferencePlaneSGIX */
{ -1, -1 }
};
#endif
@@ -5698,16 +5706,16 @@ static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
#if defined(need_GL_SGIX_sprite)
static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
{ 8487, -1 }, /* SpriteParameterfvSGIX */
- { 18103, -1 }, /* SpriteParameteriSGIX */
- { 23330, -1 }, /* SpriteParameterfSGIX */
- { 25904, -1 }, /* SpriteParameterivSGIX */
+ { 18146, -1 }, /* SpriteParameteriSGIX */
+ { 23373, -1 }, /* SpriteParameterfSGIX */
+ { 25979, -1 }, /* SpriteParameterivSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_tag_sample_buffer)
static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
- { 18162, -1 }, /* TagSampleBufferSGIX */
+ { 18205, -1 }, /* TagSampleBufferSGIX */
{ -1, -1 }
};
#endif
@@ -5716,18 +5724,18 @@ static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
static const struct gl_function_remap GL_SGI_color_table_functions[] = {
{ 6672, _gloffset_ColorTableParameteriv },
{ 7384, _gloffset_ColorTable },
- { 13322, _gloffset_GetColorTable },
- { 13432, _gloffset_CopyColorTable },
- { 16920, _gloffset_ColorTableParameterfv },
- { 20133, _gloffset_GetColorTableParameterfv },
- { 22083, _gloffset_GetColorTableParameteriv },
+ { 13365, _gloffset_GetColorTable },
+ { 13475, _gloffset_CopyColorTable },
+ { 16963, _gloffset_ColorTableParameterfv },
+ { 20176, _gloffset_GetColorTableParameterfv },
+ { 22126, _gloffset_GetColorTableParameteriv },
{ -1, -1 }
};
#endif
#if defined(need_GL_SUNX_constant_data)
static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
- { 27678, -1 }, /* FinishTextureSUNX */
+ { 27714, -1 }, /* FinishTextureSUNX */
{ -1, -1 }
};
#endif
@@ -5739,16 +5747,16 @@ static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
{ 5615, -1 }, /* GlobalAlphaFactordSUN */
{ 8571, -1 }, /* GlobalAlphaFactoruiSUN */
{ 8923, -1 }, /* GlobalAlphaFactorbSUN */
- { 11585, -1 }, /* GlobalAlphaFactorfSUN */
- { 11704, -1 }, /* GlobalAlphaFactorusSUN */
- { 19859, -1 }, /* GlobalAlphaFactorsSUN */
+ { 11660, -1 }, /* GlobalAlphaFactorfSUN */
+ { 11779, -1 }, /* GlobalAlphaFactorusSUN */
+ { 19902, -1 }, /* GlobalAlphaFactorsSUN */
{ -1, -1 }
};
#endif
#if defined(need_GL_SUN_mesh_array)
static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
- { 25716, -1 }, /* DrawMeshArraysSUN */
+ { 25791, -1 }, /* DrawMeshArraysSUN */
{ -1, -1 }
};
#endif
@@ -5757,11 +5765,11 @@ static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
{ 3971, -1 }, /* ReplacementCodeubSUN */
{ 5454, -1 }, /* ReplacementCodeubvSUN */
- { 16641, -1 }, /* ReplacementCodeusvSUN */
- { 16829, -1 }, /* ReplacementCodePointerSUN */
- { 18186, -1 }, /* ReplacementCodeusSUN */
- { 18933, -1 }, /* ReplacementCodeuiSUN */
- { 26361, -1 }, /* ReplacementCodeuivSUN */
+ { 16684, -1 }, /* ReplacementCodeusvSUN */
+ { 16872, -1 }, /* ReplacementCodePointerSUN */
+ { 18229, -1 }, /* ReplacementCodeusSUN */
+ { 18976, -1 }, /* ReplacementCodeuiSUN */
+ { 26436, -1 }, /* ReplacementCodeuivSUN */
{ -1, -1 }
};
#endif
@@ -5786,28 +5794,28 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = {
{ 8882, -1 }, /* Color3fVertex3fvSUN */
{ 9297, -1 }, /* Color4fNormal3fVertex3fvSUN */
{ 9969, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
- { 11169, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
- { 12557, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
- { 12968, -1 }, /* TexCoord2fColor3fVertex3fSUN */
- { 14020, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
- { 14354, -1 }, /* Color4ubVertex2fvSUN */
- { 14594, -1 }, /* Normal3fVertex3fSUN */
- { 15542, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
- { 15803, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
- { 16470, -1 }, /* TexCoord2fVertex3fvSUN */
- { 17246, -1 }, /* Color4ubVertex2fSUN */
- { 17439, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
- { 19292, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
- { 19639, -1 }, /* Normal3fVertex3fvSUN */
- { 20042, -1 }, /* Color4fNormal3fVertex3fSUN */
- { 20908, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
- { 21128, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
- { 22831, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
- { 24007, -1 }, /* TexCoord4fVertex4fSUN */
- { 24433, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
- { 24759, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
- { 24886, -1 }, /* TexCoord4fVertex4fvSUN */
- { 25588, -1 }, /* ReplacementCodeuiVertex3fSUN */
+ { 11208, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
+ { 12600, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
+ { 13011, -1 }, /* TexCoord2fColor3fVertex3fSUN */
+ { 14063, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
+ { 14397, -1 }, /* Color4ubVertex2fvSUN */
+ { 14637, -1 }, /* Normal3fVertex3fSUN */
+ { 15585, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
+ { 15846, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
+ { 16513, -1 }, /* TexCoord2fVertex3fvSUN */
+ { 17289, -1 }, /* Color4ubVertex2fSUN */
+ { 17482, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
+ { 19335, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
+ { 19682, -1 }, /* Normal3fVertex3fvSUN */
+ { 20085, -1 }, /* Color4fNormal3fVertex3fSUN */
+ { 20951, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
+ { 21171, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
+ { 22874, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
+ { 24082, -1 }, /* TexCoord4fVertex4fSUN */
+ { 24508, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
+ { 24834, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
+ { 24961, -1 }, /* TexCoord4fVertex4fvSUN */
+ { 25663, -1 }, /* ReplacementCodeuiVertex3fSUN */
{ -1, -1 }
};
#endif
@@ -5826,29 +5834,29 @@ static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
{ 9625, _gloffset_MultiTexCoord4sARB },
{ 10225, _gloffset_MultiTexCoord2dvARB },
{ 10607, _gloffset_MultiTexCoord1svARB },
- { 10864, _gloffset_MultiTexCoord3svARB },
- { 10925, _gloffset_MultiTexCoord4iARB },
- { 11612, _gloffset_MultiTexCoord3iARB },
- { 12346, _gloffset_MultiTexCoord1dARB },
- { 12512, _gloffset_MultiTexCoord3dvARB },
- { 13676, _gloffset_MultiTexCoord3ivARB },
- { 13721, _gloffset_MultiTexCoord2sARB },
- { 14941, _gloffset_MultiTexCoord4ivARB },
- { 16570, _gloffset_ClientActiveTextureARB },
- { 18786, _gloffset_MultiTexCoord2dARB },
- { 19161, _gloffset_MultiTexCoord4dvARB },
- { 19447, _gloffset_MultiTexCoord4fvARB },
- { 20274, _gloffset_MultiTexCoord3fARB },
- { 22584, _gloffset_MultiTexCoord4dARB },
- { 22788, _gloffset_MultiTexCoord1sARB },
- { 22966, _gloffset_MultiTexCoord1dvARB },
- { 23753, _gloffset_MultiTexCoord1ivARB },
- { 23846, _gloffset_MultiTexCoord2ivARB },
- { 24185, _gloffset_MultiTexCoord1iARB },
- { 25456, _gloffset_MultiTexCoord4svARB },
- { 25974, _gloffset_MultiTexCoord1fARB },
- { 26237, _gloffset_MultiTexCoord4fARB },
- { 28505, _gloffset_MultiTexCoord2fvARB },
+ { 10903, _gloffset_MultiTexCoord3svARB },
+ { 10964, _gloffset_MultiTexCoord4iARB },
+ { 11687, _gloffset_MultiTexCoord3iARB },
+ { 12389, _gloffset_MultiTexCoord1dARB },
+ { 12555, _gloffset_MultiTexCoord3dvARB },
+ { 13719, _gloffset_MultiTexCoord3ivARB },
+ { 13764, _gloffset_MultiTexCoord2sARB },
+ { 14984, _gloffset_MultiTexCoord4ivARB },
+ { 16613, _gloffset_ClientActiveTextureARB },
+ { 18829, _gloffset_MultiTexCoord2dARB },
+ { 19204, _gloffset_MultiTexCoord4dvARB },
+ { 19490, _gloffset_MultiTexCoord4fvARB },
+ { 20317, _gloffset_MultiTexCoord3fARB },
+ { 22627, _gloffset_MultiTexCoord4dARB },
+ { 22831, _gloffset_MultiTexCoord1sARB },
+ { 23009, _gloffset_MultiTexCoord1dvARB },
+ { 23828, _gloffset_MultiTexCoord1ivARB },
+ { 23921, _gloffset_MultiTexCoord2ivARB },
+ { 24260, _gloffset_MultiTexCoord1iARB },
+ { 25531, _gloffset_MultiTexCoord4svARB },
+ { 26049, _gloffset_MultiTexCoord1fARB },
+ { 26312, _gloffset_MultiTexCoord4fARB },
+ { 28541, _gloffset_MultiTexCoord2fvARB },
{ -1, -1 }
};
#endif
diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S
index aaa17e6a3b..731ff2b823 100644
--- a/src/mesa/sparc/glapi_sparc.S
+++ b/src/mesa/sparc/glapi_sparc.S
@@ -1272,6 +1272,7 @@ gl_dispatch_functions_start:
GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB)
GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB)
GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB)
+ GL_STUB_ALIAS(glRenderbufferStorageMultisampleEXT, glRenderbufferStorageMultisample)
GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT)
GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT)
GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT)
diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S
index 72d0532906..134cff7ca4 100644
--- a/src/mesa/x86-64/glapi_x86-64.S
+++ b/src/mesa/x86-64/glapi_x86-64.S
@@ -30302,6 +30302,7 @@ GL_PREFIX(_dispatch_stub_794):
.globl GL_PREFIX(GetAttribLocation) ; .set GL_PREFIX(GetAttribLocation), GL_PREFIX(GetAttribLocationARB)
.globl GL_PREFIX(DrawBuffers) ; .set GL_PREFIX(DrawBuffers), GL_PREFIX(DrawBuffersARB)
.globl GL_PREFIX(DrawBuffersATI) ; .set GL_PREFIX(DrawBuffersATI), GL_PREFIX(DrawBuffersARB)
+ .globl GL_PREFIX(RenderbufferStorageMultisampleEXT) ; .set GL_PREFIX(RenderbufferStorageMultisampleEXT), GL_PREFIX(RenderbufferStorageMultisample)
.globl GL_PREFIX(PointParameterf) ; .set GL_PREFIX(PointParameterf), GL_PREFIX(PointParameterfEXT)
.globl GL_PREFIX(PointParameterfARB) ; .set GL_PREFIX(PointParameterfARB), GL_PREFIX(PointParameterfEXT)
.globl GL_PREFIX(PointParameterfv) ; .set GL_PREFIX(PointParameterfv), GL_PREFIX(PointParameterfvEXT)
diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S
index 12c77f434e..0da924c37f 100644
--- a/src/mesa/x86/glapi_x86.S
+++ b/src/mesa/x86/glapi_x86.S
@@ -1226,6 +1226,7 @@ GLNAME(gl_dispatch_functions_start):
GL_STUB_ALIAS(GetAttribLocation, _gloffset_GetAttribLocationARB, GetAttribLocation@8, GetAttribLocationARB, GetAttribLocationARB@8)
GL_STUB_ALIAS(DrawBuffers, _gloffset_DrawBuffersARB, DrawBuffers@8, DrawBuffersARB, DrawBuffersARB@8)
GL_STUB_ALIAS(DrawBuffersATI, _gloffset_DrawBuffersARB, DrawBuffersATI@8, DrawBuffersARB, DrawBuffersARB@8)
+ GL_STUB_ALIAS(RenderbufferStorageMultisampleEXT, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisampleEXT@20, RenderbufferStorageMultisample, RenderbufferStorageMultisample@20)
GL_STUB_ALIAS(PointParameterf, _gloffset_PointParameterfEXT, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8)
GL_STUB_ALIAS(PointParameterfARB, _gloffset_PointParameterfEXT, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8)
GL_STUB_ALIAS(PointParameterfSGIS, _gloffset_PointParameterfEXT, PointParameterfSGIS@8, PointParameterfEXT, PointParameterfEXT@8)
--
cgit v1.2.3
From 4d6ec214396461c0cf3ad8ede449b299ff06c1aa Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Wed, 11 Nov 2009 15:33:23 -0800
Subject: ARB_fbo: Enable GL_EXT_framebuffer_multisample
All of this functionality is already included in ARB_fbo. This just
enables the string.
I was a bit lazy in using FEATURE_ARB_framebuffer_object for this
feature as well. I don't think it makes much difference in the long run.
---
src/mesa/main/extensions.c | 6 +++++-
src/mesa/main/mtypes.h | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 96f3511273..2138bfe40e 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -104,8 +104,9 @@ static const struct {
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
{ OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
{ ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) },
- { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) },
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
+ { OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
+ { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) },
{ OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
{ OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) },
{ OFF, "GL_EXT_histogram", F(EXT_histogram) },
@@ -274,6 +275,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#endif
#if FEATURE_EXT_framebuffer_blit
ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
+#endif
+#if FEATURE_ARB_framebuffer_object
+ ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
#endif
ctx->Extensions.EXT_histogram = GL_TRUE;
/*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 94d29a7dbb..34c51b5442 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2412,9 +2412,10 @@ struct gl_extensions
GLboolean EXT_copy_texture;
GLboolean EXT_depth_bounds_test;
GLboolean EXT_draw_range_elements;
- GLboolean EXT_framebuffer_object;
GLboolean EXT_fog_coord;
GLboolean EXT_framebuffer_blit;
+ GLboolean EXT_framebuffer_multisample;
+ GLboolean EXT_framebuffer_object;
GLboolean EXT_gpu_program_parameters;
GLboolean EXT_histogram;
GLboolean EXT_multi_draw_arrays;
--
cgit v1.2.3
From 5fbfd883386a8ff78bd6ca10ab761aff1b38e46d Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Thu, 12 Nov 2009 11:59:35 -0800
Subject: Add missing XML files to API_XML
When the files missing from the list were modified, the generated files
weren't regenerated.
---
src/mesa/glapi/Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile
index fb6be1a3a9..71bef68ea5 100644
--- a/src/mesa/glapi/Makefile
+++ b/src/mesa/glapi/Makefile
@@ -47,16 +47,19 @@ SERVER_OUTPUTS = \
$(SERVER_GLAPI_FILES)
API_XML = gl_API.xml \
- EXT_framebuffer_object.xml \
ARB_copy_buffer.xml \
ARB_depth_clamp.xml \
+ ARB_draw_elements_base_vertex.xml \
ARB_framebuffer_object.xml \
ARB_map_buffer_range.xml \
ARB_seamless_cube_map.xml \
ARB_sync.xml \
ARB_vertex_array_object.xml \
APPLE_vertex_array_object.xml \
- EXT_provoking_vertex.xml
+ EXT_framebuffer_object.xml \
+ EXT_packed_depth_stencil.xml \
+ EXT_provoking_vertex.xml \
+ EXT_texture_array.xml
COMMON = gl_XML.py glX_XML.py license.py $(API_XML) typeexpr.py
COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
--
cgit v1.2.3
From 4e7476f601e15cf4c52d7de44f0f775aaaedd094 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Thu, 12 Nov 2009 13:22:12 -0800
Subject: ARB_fbo: Add missing GLX render opcode for
glFramebufferTextureLayerEXT
Also regenerate the GLX protocol files from this change.
---
src/glx/x11/indirect.c | 20 ++++++++++++++++++++
src/glx/x11/indirect.h | 1 +
src/glx/x11/indirect_init.c | 4 ++++
src/mesa/glapi/EXT_texture_array.xml | 1 +
4 files changed, 26 insertions(+)
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index 3ca71f56ff..ea90ce4463 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -10643,6 +10643,26 @@ __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1,
}
}
+#define X_GLrop_FramebufferTextureLayerEXT 237
+void
+__indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
+ GLuint texture, GLint level,
+ GLint layer)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 24;
+ emit_header(gc->pc, X_GLrop_FramebufferTextureLayerEXT, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&texture), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&level), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&layer), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
# undef FASTCALL
# undef NOINLINE
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index 4a1b81ca6e..19a8c0d134 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -712,6 +712,7 @@ extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer);
extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer);
extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
# undef HIDDEN
# undef FASTCALL
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
index aa9a6bb2b0..73ca993027 100644
--- a/src/glx/x11/indirect_init.c
+++ b/src/glx/x11/indirect_init.c
@@ -776,6 +776,10 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT;
+ /* 329. GL_EXT_texture_array */
+
+ glAPI->FramebufferTextureLayerEXT = __indirect_glFramebufferTextureLayerEXT;
+
return glAPI;
}
diff --git a/src/mesa/glapi/EXT_texture_array.xml b/src/mesa/glapi/EXT_texture_array.xml
index e5bd9f3c69..b5b8bd406f 100644
--- a/src/mesa/glapi/EXT_texture_array.xml
+++ b/src/mesa/glapi/EXT_texture_array.xml
@@ -35,6 +35,7 @@
+
--
cgit v1.2.3
From b43887cf7e64cc44cf1409f910d1324549b265d2 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Thu, 12 Nov 2009 13:28:12 -0800
Subject: ARB_fbo: Enable extensions related to GL_ARB_framebuffer_object for
GLX
---
src/glx/x11/glxextensions.c | 5 +++++
src/glx/x11/glxextensions.h | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
index 473f46d1e5..6852128e2a 100644
--- a/src/glx/x11/glxextensions.c
+++ b/src/glx/x11/glxextensions.c
@@ -112,6 +112,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(ARB_draw_buffers), VER(0,0), Y, N, N, N },
{ GL(ARB_fragment_program), VER(0,0), Y, N, N, N },
{ GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N },
+ { GL(ARB_framebuffer_object), VER(0,0), Y, N, N, N },
{ GL(ARB_imaging), VER(0,0), Y, N, N, N },
{ GL(ARB_multisample), VER(1,3), Y, N, N, N },
{ GL(ARB_multitexture), VER(1,3), Y, N, N, N },
@@ -150,8 +151,11 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(EXT_depth_bounds_test), VER(0,0), N, N, N, N },
{ GL(EXT_draw_range_elements), VER(1,2), Y, N, Y, N },
{ GL(EXT_fog_coord), VER(1,4), Y, N, N, N },
+ { GL(EXT_framebuffer_blit), VER(0,0), Y, N, N, N },
+ { GL(EXT_framebuffer_multisample), VER(0,0), Y, N, N, N },
{ GL(EXT_framebuffer_object), VER(0,0), Y, N, N, N },
{ GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N },
+ { GL(EXT_packed_depth_stencil), VER(0,0), Y, N, N, N },
{ GL(EXT_packed_pixels), VER(1,2), Y, N, N, N },
{ GL(EXT_paletted_texture), VER(0,0), Y, N, N, N },
{ GL(EXT_pixel_buffer_object), VER(0,0), N, N, N, N },
@@ -209,6 +213,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(NV_fragment_program2), VER(0,0), Y, N, N, N },
{ GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
{ GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
+ { GL(NV_packed_depth_stencil), VER(0,0), Y, N, N, N },
{ GL(NV_point_sprite), VER(0,0), Y, N, N, N },
{ GL(NV_texgen_reflection), VER(0,0), Y, N, N, N },
{ GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N },
diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h
index 9f1c697487..652c5db1c8 100644
--- a/src/glx/x11/glxextensions.h
+++ b/src/glx/x11/glxextensions.h
@@ -74,6 +74,7 @@ enum
GL_ARB_draw_buffers_bit,
GL_ARB_fragment_program_bit,
GL_ARB_fragment_program_shadow_bit,
+ GL_ARB_framebuffer_object_bit,
GL_ARB_imaging_bit,
GL_ARB_multisample_bit,
GL_ARB_multitexture_bit,
@@ -112,8 +113,11 @@ enum
GL_EXT_depth_bounds_test_bit,
GL_EXT_draw_range_elements_bit,
GL_EXT_fog_coord_bit,
+ GL_EXT_framebuffer_blit_bit,
+ GL_EXT_framebuffer_multisample_bit,
GL_EXT_framebuffer_object_bit,
GL_EXT_multi_draw_arrays_bit,
+ GL_EXT_packed_depth_stencil_bit,
GL_EXT_packed_pixels_bit,
GL_EXT_paletted_texture_bit,
GL_EXT_pixel_buffer_object_bit,
@@ -164,6 +168,7 @@ enum
GL_NV_fragment_program2_bit,
GL_NV_light_max_exponent_bit,
GL_NV_multisample_filter_hint_bit,
+ GL_NV_packed_depth_stencil_bit,
GL_NV_point_sprite_bit,
GL_NV_texgen_reflection_bit,
GL_NV_texture_compression_vtc_bit,
--
cgit v1.2.3
From 5606dfb572bf4b89b4882265924705bacc8c182b Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Tue, 17 Nov 2009 16:10:24 -0800
Subject: Merge branch 'outputswritten64'
Add a GLbitfield64 type and several macros to operate on 64-bit
fields. The OutputsWritten field of gl_program is changed to use that
type. This results in a fair amount of fallout in drivers that use
programs.
No changes are strictly necessary at this point as all bits used are
below the 32-bit boundary. Fairly soon several bits will be added for
clip distances written by a vertex shader. This will cause several
bits used for varyings to be pushed above the 32-bit boundary. This
will affect any drivers that support GLSL.
At this point, only the i965 driver has been modified to support this
eventuality.
I did this as a "squash" merge. There were several places through the
outputswritten64 branch where things were broken. I foresee this
causing difficulties later for bisecting. The history is still
available in the branch.
Conflicts:
src/mesa/drivers/dri/i965/brw_wm.h
---
src/mesa/drivers/dri/i965/brw_clip.c | 2 +-
src/mesa/drivers/dri/i965/brw_clip.h | 2 +-
src/mesa/drivers/dri/i965/brw_context.h | 6 +-----
src/mesa/drivers/dri/i965/brw_gs.h | 2 +-
src/mesa/drivers/dri/i965/brw_sf.c | 6 +++---
src/mesa/drivers/dri/i965/brw_sf.h | 2 +-
src/mesa/drivers/dri/i965/brw_sf_emit.c | 18 +++++++++---------
src/mesa/drivers/dri/i965/brw_util.c | 2 +-
src/mesa/drivers/dri/i965/brw_util.h | 2 +-
src/mesa/drivers/dri/i965/brw_vs.c | 2 +-
src/mesa/drivers/dri/i965/brw_vs_emit.c | 8 ++++----
src/mesa/drivers/dri/i965/brw_wm.c | 4 ++--
src/mesa/drivers/dri/i965/brw_wm.h | 2 +-
src/mesa/drivers/dri/i965/brw_wm_fp.c | 2 +-
src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 +-
src/mesa/drivers/dri/i965/brw_wm_pass2.c | 4 ++--
src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +-
src/mesa/drivers/dri/r200/r200_tcl.c | 15 ++++++++-------
src/mesa/main/config.h | 2 +-
src/mesa/main/context.c | 8 +++++---
src/mesa/main/ffvertex_prog.c | 2 +-
src/mesa/main/mtypes.h | 27 ++++++++++++++++++++++++++-
src/mesa/main/texenvprogram.c | 2 +-
src/mesa/shader/prog_print.c | 6 +++---
src/mesa/shader/program_parse.tab.c | 2 +-
src/mesa/shader/program_parse.y | 2 +-
src/mesa/shader/programopt.c | 8 ++++----
src/mesa/shader/slang/slang_link.c | 25 +++++++++++++++----------
src/mesa/state_tracker/st_atom_shader.c | 2 +-
src/mesa/state_tracker/st_program.c | 2 +-
src/mesa/swrast/s_fragprog.c | 12 ++++++------
src/mesa/tnl/t_context.c | 2 +-
src/mesa/tnl/t_vb_program.c | 8 ++++----
33 files changed, 111 insertions(+), 82 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index f45dcf8282..dbd10a5297 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -78,7 +78,7 @@ static void compile_clip_prog( struct brw_context *brw,
delta = REG_SIZE;
for (i = 0; i < VERT_RESULT_MAX; i++)
- if (c.key.attrs & (1<= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) {
@@ -147,7 +147,7 @@ static void upload_sf_prog(struct brw_context *brw)
* edgeflag testing here, it is already done in the clip
* program.
*/
- if (key.attrs & (1<key.attrs & (1<key.attrs & BITFIELD64_BIT(attr)) ? 1 : 0;
}
/***********************************************************************
@@ -122,8 +122,8 @@ static void do_twoside_color( struct brw_sf_compile *c )
* Flat shading
*/
-#define VERT_RESULT_COLOR_BITS ((1<nr_setup_regs - 1);
- GLuint persp_mask;
- GLuint linear_mask;
+ GLbitfield64 persp_mask;
+ GLbitfield64 linear_mask;
if (c->key.do_flat_shading || c->key.linear_color)
persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
@@ -331,10 +331,10 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
*pc_linear = 0;
*pc = 0xf;
- if (persp_mask & (1 << c->idx_to_attr[reg*2]))
+ if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2]))
*pc_persp = 0xf;
- if (linear_mask & (1 << c->idx_to_attr[reg*2]))
+ if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2]))
*pc_linear = 0xf;
/* Maybe only processs one attribute on the final round:
@@ -342,10 +342,10 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
if (reg*2+1 < c->nr_setup_attrs) {
*pc |= 0xf0;
- if (persp_mask & (1 << c->idx_to_attr[reg*2+1]))
+ if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1]))
*pc_persp |= 0xf0;
- if (linear_mask & (1 << c->idx_to_attr[reg*2+1]))
+ if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1]))
*pc_linear |= 0xf0;
}
diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c
index ce21aa4869..bba9249d1b 100644
--- a/src/mesa/drivers/dri/i965/brw_util.c
+++ b/src/mesa/drivers/dri/i965/brw_util.c
@@ -35,7 +35,7 @@
#include "brw_util.h"
#include "brw_defines.h"
-GLuint brw_count_bits( GLuint val )
+GLuint brw_count_bits(uint64_t val)
{
GLuint i;
for (i = 0; val ; val >>= 1)
diff --git a/src/mesa/drivers/dri/i965/brw_util.h b/src/mesa/drivers/dri/i965/brw_util.h
index 33e7cd87e4..04f3175d3e 100644
--- a/src/mesa/drivers/dri/i965/brw_util.h
+++ b/src/mesa/drivers/dri/i965/brw_util.h
@@ -35,7 +35,7 @@
#include "main/mtypes.h"
-extern GLuint brw_count_bits( GLuint val );
+extern GLuint brw_count_bits(uint64_t val);
extern GLuint brw_parameter_list_state_flags(struct gl_program_parameter_list *paramList);
extern GLuint brw_translate_blend_factor( GLenum factor );
extern GLuint brw_translate_blend_equation( GLenum mode );
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index f0c79efbd9..fd055e225e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -56,7 +56,7 @@ static void do_vs_prog( struct brw_context *brw,
c.prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
- c.prog_data.outputs_written |= 1<prog_data.outputs_written & (1 << i)) {
+ if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) {
c->nr_outputs++;
assert(i < Elements(c->regs[PROGRAM_OUTPUT]));
if (i == VERT_RESULT_HPOS) {
@@ -1124,7 +1124,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
/* Update the header for point size, user clipping flags, and -ve rhw
* workaround.
*/
- if ((c->prog_data.outputs_written & (1<prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) ||
c->key.nr_userclip || BRW_IS_965(p->brw))
{
struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
@@ -1134,7 +1134,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
brw_set_access_mode(p, BRW_ALIGN_16);
- if (c->prog_data.outputs_written & (1<prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
struct brw_reg psiz = c->regs[PROGRAM_OUTPUT][VERT_RESULT_PSIZ];
brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11));
brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8));
@@ -1224,7 +1224,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
*/
GLuint i, mrf = 0;
for (i = c->first_overflow_output; i < VERT_RESULT_MAX; i++) {
- if (c->prog_data.outputs_written & (1 << i)) {
+ if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) {
/* move from GRF to MRF */
brw_MOV(p, brw_message_reg(4+mrf), c->regs[PROGRAM_OUTPUT][i]);
mrf++;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index d8971321f3..77e3b2c32a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -231,7 +231,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
ctx->Color.AlphaEnabled)
lookup |= IZ_PS_KILL_ALPHATEST_BIT;
- if (fp->program.Base.OutputsWritten & (1<program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
/* _NEW_DEPTH */
@@ -347,7 +347,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
key->nr_color_regions = brw->state.nr_color_regions;
/* CACHE_NEW_VS_PROG */
- key->vp_outputs_written = brw->vs.prog_data->outputs_written & DO_SETUP_BITS;
+ key->vp_outputs_written = brw->vs.prog_data->outputs_written;
/* The unique fragment program ID */
key->program_string_id = fp->id;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index b3c05eb0ad..9dcb6e14bb 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -79,7 +79,7 @@ struct brw_wm_prog_key {
GLuint program_string_id:32;
GLushort origin_x, origin_y;
GLushort drawable_height;
- GLuint vp_outputs_written;
+ GLbitfield64 vp_outputs_written;
};
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 1c4f62ba48..7d03179588 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -986,7 +986,7 @@ static void emit_render_target_writes( struct brw_wm_compile *c )
}
else {
/* if gl_FragData[0] is written, use it, else use gl_FragColor */
- if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0))
+ if (c->fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0))
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
else
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 3ab446164c..e8c2cb66ec 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -371,7 +371,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
for (j = 0; j < 4; j++)
set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg);
}
- if (c->key.vp_outputs_written & (1 << i)) {
+ if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) {
reg_index += 2;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c
index 6faea018fb..31303febf0 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c
@@ -82,8 +82,8 @@ static void init_registers( struct brw_wm_compile *c )
for (j = 0; j < c->nr_creg; j++)
prealloc_reg(c, &c->creg[j], i++);
- for (j = 0; j < FRAG_ATTRIB_MAX; j++) {
- if (c->key.vp_outputs_written & (1<key.vp_outputs_written & BITFIELD64_BIT(j)) {
int fp_index;
if (j >= VERT_RESULT_VAR0)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c
index 361f91292b..f89ed9bce7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_state.c
@@ -106,7 +106,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
/* as far as we can tell */
key->computes_depth =
- (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0;
+ (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) != 0;
/* BRW_NEW_DEPTH_BUFFER
* Override for NULL depthbuffer case, required by the Pixel Shader Computed
* Depth field.
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
index c702910ef2..e7d48a7f29 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -509,25 +509,26 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
prog to a not enabled output however, so just don't mess with it.
We only need to change compsel. */
GLuint out_compsel = 0;
- GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
+ const GLbitfield64 vp_out =
+ rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
- assert(vp_out & (1 << VERT_RESULT_HPOS));
+ assert(vp_out & BITFIELD64_BIT(VERT_RESULT_HPOS));
out_compsel = R200_OUTPUT_XYZW;
- if (vp_out & (1 << VERT_RESULT_COL0)) {
+ if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL0)) {
out_compsel |= R200_OUTPUT_COLOR_0;
}
- if (vp_out & (1 << VERT_RESULT_COL1)) {
+ if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL1)) {
out_compsel |= R200_OUTPUT_COLOR_1;
}
- if (vp_out & (1 << VERT_RESULT_FOGC)) {
+ if (vp_out & BITFIELD64_BIT(VERT_RESULT_FOGC)) {
out_compsel |= R200_OUTPUT_DISCRETE_FOG;
}
- if (vp_out & (1 << VERT_RESULT_PSIZ)) {
+ if (vp_out & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
out_compsel |= R200_OUTPUT_PT_SIZE;
}
for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) {
- if (vp_out & (1 << i)) {
+ if (vp_out & BITFIELD64_BIT(i)) {
out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0);
}
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 8a09efdb53..c5048970cc 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -205,7 +205,7 @@
#define MAX_VARYING 16 /**< number of float[4] vectors */
#define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS
#define MAX_PROGRAM_INPUTS 32
-#define MAX_PROGRAM_OUTPUTS 32
+#define MAX_PROGRAM_OUTPUTS 64
/*@}*/
/** For GL_ARB_vertex_program */
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 101d3c6b67..b5bf46718f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -601,9 +601,11 @@ _mesa_init_constants(GLcontext *ctx)
ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX);
ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX);
- /* check that we don't exceed various 32-bit bitfields */
- ASSERT(VERT_RESULT_MAX <= 32);
- ASSERT(FRAG_ATTRIB_MAX <= 32);
+ /* check that we don't exceed the size of various bitfields */
+ ASSERT(VERT_RESULT_MAX <=
+ (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
+ ASSERT(FRAG_ATTRIB_MAX <=
+ (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
}
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 356476e35a..fe2416d894 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -438,7 +438,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
*/
static struct ureg register_output( struct tnl_program *p, GLuint output )
{
- p->program->Base.OutputsWritten |= (1<program->Base.OutputsWritten |= BITFIELD64_BIT(output);
return make_ureg(PROGRAM_OUTPUT, output);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 34c51b5442..881d233ca3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -78,6 +78,31 @@
#endif
+/**
+ * \name 64-bit extension of GLbitfield.
+ */
+/*@{*/
+typedef GLuint64 GLbitfield64;
+
+#define BITFIELD64_ONE 1ULL
+#define BITFIELD64_ALLONES ~0ULL
+
+/** Set a single bit */
+#define BITFIELD64_BIT(b) (BITFIELD64_ONE << (b))
+
+/** Set a mask of the least significant \c b bits */
+#define BITFIELD64_MASK(b) (((b) >= 64) ? BITFIELD64_ALLONES : \
+ (BITFIELD64_BIT(b) - 1))
+
+/**
+ * Set all bits from l (low bit) to h (high bit), inclusive.
+ *
+ * \note \C BITFIELD_64_RANGE(0, 63) return 64 set bits.
+ */
+#define BITFIELD64_RANGE(l, h) (BITFIELD64_MASK((h) + 1) & ~BITFIELD64_MASK(l))
+/*@}*/
+
+
/**
* \name Some forward type declarations
*/
@@ -1670,7 +1695,7 @@ struct gl_program
struct prog_instruction *Instructions;
GLbitfield InputsRead; /**< Bitmask of which input regs are read */
- GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */
+ GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */
GLbitfield InputFlags[MAX_PROGRAM_INPUTS]; /**< PROG_PARAM_BIT_x flags */
GLbitfield OutputFlags[MAX_PROGRAM_OUTPUTS]; /**< PROG_PARAM_BIT_x flags */
GLbitfield TexturesUsed[MAX_TEXTURE_UNITS]; /**< TEXTURE_x_BIT bitmask */
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index d7e77e759e..f439d4addb 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -367,7 +367,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx )
else {
/* calculate from vp->outputs */
struct gl_vertex_program *vprog;
- GLbitfield vp_outputs;
+ GLbitfield64 vp_outputs;
/* Choose GLSL vertex shader over ARB vertex program. Need this
* since vertex shader state validation comes after fragment state
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index ba4d39452f..52c102cbaa 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -826,11 +826,11 @@ _mesa_print_program(const struct gl_program *prog)
* XXX move to imports.[ch] if useful elsewhere.
*/
static const char *
-binary(GLbitfield val)
+binary(GLbitfield64 val)
{
- static char buf[50];
+ static char buf[80];
GLint i, len = 0;
- for (i = 31; i >= 0; --i) {
+ for (i = 63; i >= 0; --i) {
if (val & (1 << i))
buf[len++] = '1';
else if (len > 0 || i == 0)
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c
index b9ef88b64b..d4f8429488 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -2622,7 +2622,7 @@ yyreduce:
YYERROR;
}
- state->prog->OutputsWritten |= (1U << (yyval.dst_reg).Index);
+ state->prog->OutputsWritten |= BITFIELD64_BIT((yyval.dst_reg).Index);
}
;}
break;
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index d07bf85b36..8ca6f9805b 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -643,7 +643,7 @@ maskedDstReg: dstReg optionalMask optionalCcMask
YYERROR;
}
- state->prog->OutputsWritten |= (1U << $$.Index);
+ state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index);
}
}
;
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index 3b8529592d..a0daac1b80 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -109,7 +109,7 @@ _mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog)
vprog->Base.Instructions = newInst;
vprog->Base.NumInstructions = newLen;
vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS);
+ vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
}
@@ -211,7 +211,7 @@ _mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog)
vprog->Base.Instructions = newInst;
vprog->Base.NumInstructions = newLen;
vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS);
+ vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
}
@@ -613,7 +613,7 @@ _mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog)
prog->Base.Instructions = inst;
prog->Base.NumInstructions = 2;
prog->Base.InputsRead = 1 << inputAttr;
- prog->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
+ prog->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
}
@@ -657,7 +657,7 @@ _mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog)
prog->Base.Instructions = inst;
prog->Base.NumInstructions = 2;
prog->Base.InputsRead = 1 << inputAttr;
- prog->Base.OutputsWritten = 1 << VERT_RESULT_COL0;
+ prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0);
/*
* Now insert code to do standard modelview/projection transformation.
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 144c126525..0a2bc49780 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -515,7 +515,7 @@ _slang_update_inputs_outputs(struct gl_program *prog)
}
if (inst->DstReg.File == PROGRAM_OUTPUT) {
- prog->OutputsWritten |= 1 << inst->DstReg.Index;
+ prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index);
if (inst->DstReg.RelAddr) {
/* If the output attribute is indexed with relative addressing
* we know that it must be a varying or texcoord such as
@@ -528,14 +528,17 @@ _slang_update_inputs_outputs(struct gl_program *prog)
if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
if (inst->DstReg.Index == VERT_RESULT_TEX0) {
/* mark all texcoord outputs as written */
- const GLbitfield mask =
- ((1 << MAX_TEXTURE_COORD_UNITS) - 1) << VERT_RESULT_TEX0;
+ const GLbitfield64 mask =
+ BITFIELD64_RANGE(VERT_RESULT_TEX0,
+ (VERT_RESULT_TEX0
+ + MAX_TEXTURE_COORD_UNITS - 1));
prog->OutputsWritten |= mask;
}
else if (inst->DstReg.Index == VERT_RESULT_VAR0) {
/* mark all generic varying outputs as written */
- const GLbitfield mask =
- ((1 << MAX_VARYING) - 1) << VERT_RESULT_VAR0;
+ const GLbitfield64 mask =
+ BITFIELD64_RANGE(VERT_RESULT_VAR0,
+ (VERT_RESULT_VAR0 + MAX_VARYING - 1));
prog->OutputsWritten |= mask;
}
}
@@ -807,7 +810,8 @@ _slang_link(GLcontext *ctx,
if (shProg->VertexProgram) {
_slang_update_inputs_outputs(&shProg->VertexProgram->Base);
_slang_count_temporaries(&shProg->VertexProgram->Base);
- if (!(shProg->VertexProgram->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) {
+ if (!(shProg->VertexProgram->Base.OutputsWritten
+ & BITFIELD64_BIT(VERT_RESULT_HPOS))) {
/* the vertex program did not compute a vertex position */
link_error(shProg,
"gl_Position was not written by vertex shader\n");
@@ -825,7 +829,7 @@ _slang_link(GLcontext *ctx,
if (shProg->FragmentProgram) {
const GLbitfield varyingRead
= shProg->FragmentProgram->Base.InputsRead >> FRAG_ATTRIB_VAR0;
- const GLbitfield varyingWritten = shProg->VertexProgram ?
+ const GLbitfield64 varyingWritten = shProg->VertexProgram ?
shProg->VertexProgram->Base.OutputsWritten >> VERT_RESULT_VAR0 : 0x0;
if ((varyingRead & varyingWritten) != varyingRead) {
link_error(shProg,
@@ -836,9 +840,10 @@ _slang_link(GLcontext *ctx,
/* check that gl_FragColor and gl_FragData are not both written to */
if (shProg->FragmentProgram) {
- GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
- if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
- (outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
+ const GLbitfield64 outputsWritten =
+ shProg->FragmentProgram->Base.OutputsWritten;
+ if ((outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) &&
+ (outputsWritten >= BITFIELD64_BIT(FRAG_RESULT_DATA0))) {
link_error(shProg, "Fragment program cannot write both gl_FragColor"
" and gl_FragData[].\n");
return;
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index ee649be885..6e311e537e 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -176,7 +176,7 @@ find_translated_vp(struct st_context *st,
/* See if we need to translate vertex program to TGSI form */
if (xvp->serialNo != stvp->serialNo) {
GLuint outAttr;
- const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten;
+ const GLbitfield64 outputsWritten = stvp->Base.Base.OutputsWritten;
GLuint numVpOuts = 0;
GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE;
GLbitfield usedGenerics = 0x0;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 6d02722c13..190b6a5526 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -469,7 +469,7 @@ st_translate_fragment_program(struct st_context *st,
*/
{
uint numColors = 0;
- GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten;
+ GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
/* if z is written, emit that first */
if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 77a77f0bcb..a22d34415d 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -190,7 +190,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
- const GLbitfield outputsWritten = program->Base.OutputsWritten;
+ const GLbitfield64 outputsWritten = program->Base.OutputsWritten;
struct gl_program_machine *machine = &swrast->FragProgMachine;
GLuint i;
@@ -201,7 +201,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
if (_mesa_execute_program(ctx, &program->Base, machine)) {
/* Store result color */
- if (outputsWritten & (1 << FRAG_RESULT_COLOR)) {
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
machine->Outputs[FRAG_RESULT_COLOR]);
}
@@ -212,7 +212,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
*/
GLuint buf;
for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
- if (outputsWritten & (1 << (FRAG_RESULT_DATA0 + buf))) {
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i],
machine->Outputs[FRAG_RESULT_DATA0 + buf]);
}
@@ -220,7 +220,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
}
/* Store result depth/z */
- if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
if (depth <= 0.0)
span->array->z[i] = 0;
@@ -256,12 +256,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span )
run_program(ctx, span, 0, span->end);
- if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
span->interpMask &= ~SPAN_RGBA;
span->arrayMask |= SPAN_RGBA;
}
- if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) {
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z;
}
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index f2771cde09..db21b4589d 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -171,7 +171,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
if (vp) {
GLuint i;
for (i = 0; i < MAX_VARYING; i++) {
- if (vp->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) {
+ if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
RENDERINPUTS_SET(tnl->render_inputs_bitset,
_TNL_ATTRIB_GENERIC(i));
}
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index c10a27614f..e69f7d5766 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -329,7 +329,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
/* make list of outputs to save some time below */
numOutputs = 0;
for (i = 0; i < VERT_RESULT_MAX; i++) {
- if (program->Base.OutputsWritten & (1 << i)) {
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) {
outputs[numOutputs++] = i;
}
}
@@ -407,14 +407,14 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
/* Fixup fog and point size results if needed */
if (program->IsNVProgram) {
if (ctx->Fog.Enabled &&
- (program->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) {
+ (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_FOGC)) == 0) {
for (i = 0; i < VB->Count; i++) {
store->results[VERT_RESULT_FOGC].data[i][0] = 1.0;
}
}
if (ctx->VertexProgram.PointSizeEnabled &&
- (program->Base.OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) {
+ (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) == 0) {
for (i = 0; i < VB->Count; i++) {
store->results[VERT_RESULT_PSIZ].data[i][0] = ctx->Point.Size;
}
@@ -472,7 +472,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
}
for (i = 0; i < ctx->Const.MaxVarying; i++) {
- if (program->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) {
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
/* Note: varying results get put into the generic attributes */
VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
= &store->results[VERT_RESULT_VAR0 + i];
--
cgit v1.2.3
From 6acb82dab0056f0d5f3522c7b063db8024ef81d8 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 19:22:11 -0700
Subject: progs/util: warn when GLSL not supported
---
progs/util/shaderutil.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index aebf23a78c..4fb3199a19 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -34,7 +34,8 @@ ShadersSupported(void)
fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n");
return GL_TRUE;
}
- return GL_TRUE;
+ fprintf(stderr, "Sorry, GLSL not supported with this OpenGL.\n");
+ return GL_FALSE;
}
--
cgit v1.2.3
From 89e20ab3aeff37f0eff79ab0c5e73be3d3185ce8 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Tue, 17 Nov 2009 19:22:29 -0700
Subject: progs/glsl: use ShadersSupported()
---
progs/glsl/multitex.c | 7 ++-----
progs/glsl/texdemo1.c | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c
index bf46fd5210..49b32253ee 100644
--- a/progs/glsl/multitex.c
+++ b/progs/glsl/multitex.c
@@ -369,12 +369,9 @@ InitPrograms(void)
static void
InitGL(void)
{
- const char *version = (const char *) glGetString(GL_VERSION);
+ if (!ShadersSupported())
+ exit(1);
- if (version[0] != '2' || version[1] != '.') {
- printf("Warning: this program expects OpenGL 2.0\n");
- /*exit(1);*/
- }
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
printf("Usage:\n");
printf(" a - toggle arrays vs. immediate mode rendering\n");
diff --git a/progs/glsl/texdemo1.c b/progs/glsl/texdemo1.c
index 5b1913a722..2076e6aef9 100644
--- a/progs/glsl/texdemo1.c
+++ b/progs/glsl/texdemo1.c
@@ -400,11 +400,8 @@ InitPrograms(void)
static void
Init(GLboolean useImageFiles)
{
- const char *version = (const char *) glGetString(GL_VERSION);
-
- if (version[0] != '2' || version[1] != '.') {
- printf("Warning: this program expects OpenGL 2.0\n");
- /*exit(1);*/
+ if (!ShadersSupported()) {
+ exit(1);
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
--
cgit v1.2.3
From 70dca0c273d681d004b014dd8d4434be664cb202 Mon Sep 17 00:00:00 2001
From: Ian Romanick
Date: Tue, 17 Nov 2009 22:53:06 -0800
Subject: AL1616: Fix cut-and-paste bug
One of the PACK_COLOR_88 cases was left over from copying
_mesa_texstore_al88 to _mesa_texstore_al1616.
---
src/mesa/main/texstore.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index abb4ed2663..5387eb1283 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2198,8 +2198,8 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS)
if (dstFormat == MESA_FORMAT_AL1616) {
for (col = 0; col < srcWidth; col++) {
/* src[0] is luminance, src[1] is alpha */
- dstUI[col] = PACK_COLOR_88( FLOAT_TO_USHORT(src[1]),
- FLOAT_TO_USHORT(src[0]) );
+ dstUI[col] = PACK_COLOR_1616( FLOAT_TO_USHORT(src[1]),
+ FLOAT_TO_USHORT(src[0]) );
src += 2;
}
}
--
cgit v1.2.3
From 04442841fb7e9138eb50ff692952ad7e8c3877d8 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Tue, 17 Nov 2009 23:15:25 -0800
Subject: progs/glsl: Fix mandelbrot GLSL compilation error on Mac OS.
---
progs/glsl/CH18-mandel.frag | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/glsl/CH18-mandel.frag b/progs/glsl/CH18-mandel.frag
index a472d81252..a972d68bcf 100644
--- a/progs/glsl/CH18-mandel.frag
+++ b/progs/glsl/CH18-mandel.frag
@@ -31,7 +31,7 @@ void main()
float iter;
// for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter)
- for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter)
+ for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter)
{
float tempreal = real;
--
cgit v1.2.3
From d4dc2e30dada1be425e95ba270920db6eb210982 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Wed, 18 Nov 2009 12:49:31 -0800
Subject: progs/glsl: Fix multinoise GLSL compilation errors on Mac OS.
---
progs/glsl/multinoise.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c
index 06207f78b5..d504ba1cc4 100644
--- a/progs/glsl/multinoise.c
+++ b/progs/glsl/multinoise.c
@@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = {
"void main()\n"
"{\n"
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n"
- " gl_FragColor.a = 1;\n"
+ " gl_FragColor.a = 1.0;\n"
"}\n",
"void main()\n"
"{\n"
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n"
- " gl_FragColor.a = 1;\n"
+ " gl_FragColor.a = 1.0;\n"
"}\n",
"void main()\n"
"{\n"
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n"
- " gl_FragColor.a = 1;\n"
+ " gl_FragColor.a = 1.0;\n"
"}\n",
"void main()\n"
"{\n"
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n"
- " gl_FragColor.a = 1;\n"
+ " gl_FragColor.a = 1.0;\n"
"}\n"
};
@@ -194,7 +194,7 @@ LoadAndCompileShader(GLuint shader, const char *text)
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog(shader, 1000, &len, log);
- fprintf(stderr, "noise: problem compiling shader: %s\n", log);
+ fprintf(stderr, "multinoise: problem compiling shader: %s\n", log);
exit(1);
}
else {
--
cgit v1.2.3
From 7118db870091d4c9c2465e79f361ff0ed36d1f90 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 18 Nov 2009 22:02:48 +0100
Subject: r600: align for mipmap tree changes
---
src/mesa/drivers/dri/r600/r600_tex.c | 17 +++-----------
src/mesa/drivers/dri/r600/r600_texstate.c | 37 ++++++++++++-------------------
src/mesa/drivers/dri/r600/r700_chip.c | 10 ++++++---
3 files changed, 24 insertions(+), 40 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c
index 20965bb3c8..9d83a64e22 100644
--- a/src/mesa/drivers/dri/r600/r600_tex.c
+++ b/src/mesa/drivers/dri/r600/r600_tex.c
@@ -312,16 +312,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target,
case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- t->validated = GL_FALSE;
- }
+ t->validated = GL_FALSE;
break;
case GL_DEPTH_TEXTURE_MODE:
@@ -369,10 +360,8 @@ static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
t->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = 0;
- }
+ radeon_miptree_unreference(&t->mt);
+
_mesa_delete_texture_object(ctx, texObj);
}
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index 27c8354923..4ec315b78c 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -649,7 +649,6 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
{
radeonTexObj *t = radeon_tex_obj(texObj);
const struct gl_texture_image *firstImage;
- int firstlevel = t->mt ? t->mt->firstLevel : 0;
GLuint uTexelPitch, row_align;
if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled &&
@@ -657,7 +656,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
t->bo)
return;
- firstImage = t->base.Image[0][firstlevel];
+ firstImage = t->base.Image[0][t->minLod];
if (!t->image_override) {
if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
@@ -692,7 +691,8 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
}
row_align = rmesa->radeon.texture_row_align - 1;
- uTexelPitch = ((firstImage->Width * t->mt->bpp + row_align) & ~row_align) / t->mt->bpp;
+ uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align;
+ uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat);
uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK)
& ~R700_TEXEL_PITCH_ALIGNMENT_MASK;
@@ -706,10 +706,10 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1,
TEX_HEIGHT_shift, TEX_HEIGHT_mask);
- if ((t->mt->lastLevel - t->mt->firstLevel) > 0) {
- t->SQ_TEX_RESOURCE3 = t->mt->levels[0].size / 256;
- SETfield(t->SQ_TEX_RESOURCE4, t->mt->firstLevel, BASE_LEVEL_shift, BASE_LEVEL_mask);
- SETfield(t->SQ_TEX_RESOURCE5, t->mt->lastLevel, LAST_LEVEL_shift, LAST_LEVEL_mask);
+ if ((t->maxLod - t->minLod) > 0) {
+ t->SQ_TEX_RESOURCE3 = t->mt->levels[t->minLod].size / 256;
+ SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask);
+ SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask);
}
}
@@ -808,9 +808,8 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
struct gl_texture_object *tObj =
_mesa_lookup_texture(rmesa->radeon.glCtx, texname);
radeonTexObjPtr t = radeon_tex_obj(tObj);
- int firstlevel = t->mt ? t->mt->firstLevel : 0;
const struct gl_texture_image *firstImage;
- uint32_t pitch_val, size, row_align, bpp;
+ uint32_t pitch_val, size, row_align;
if (!tObj)
return;
@@ -820,13 +819,9 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
if (!offset)
return;
- bpp = depth / 8;
- if (bpp == 3)
- bpp = 4;
-
- firstImage = t->base.Image[0][firstlevel];
+ firstImage = t->base.Image[0][t->minLod];
row_align = rmesa->radeon.texture_row_align - 1;
- size = ((firstImage->Width * bpp + row_align) & ~row_align) * firstImage->Height;
+ size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height;
if (t->bo) {
radeon_bo_unref(t->bo);
t->bo = NULL;
@@ -949,14 +944,10 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo
radeon_bo_unref(rImage->bo);
rImage->bo = NULL;
}
- if (t->mt) {
- radeon_miptree_unreference(t->mt);
- t->mt = NULL;
- }
- if (rImage->mt) {
- radeon_miptree_unreference(rImage->mt);
- rImage->mt = NULL;
- }
+
+ radeon_miptree_unreference(&t->mt);
+ radeon_miptree_unreference(&rImage->mt);
+
_mesa_init_teximage_fields(radeon->glCtx, target, texImage,
rb->base.Width, rb->base.Height, 1, 0, rb->cpp);
texImage->RowStride = rb->pitch / rb->cpp;
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index ec76fbcb6d..2b2b4d748f 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -54,11 +54,15 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom)
for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled) {
radeonTexObj *t = r700->textures[i];
+ uint32_t offset;
if (t) {
- if (!t->image_override)
+ if (!t->image_override) {
bo = t->mt->bo;
- else
+ offset = get_base_teximage_offset(t);
+ } else {
bo = t->bo;
+ offset = 0;
+ }
if (bo) {
r700SyncSurf(context, bo,
@@ -77,7 +81,7 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom)
R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE6);
R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE2,
bo,
- 0,
+ offset,
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE3,
bo,
--
cgit v1.2.3
From 3bf12c8bea667f5fff0b6f495820a27141f595a2 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Wed, 18 Nov 2009 22:19:25 +0100
Subject: r300: allow disabling s3tc support if libtxc_dxtn is available
---
src/mesa/drivers/dri/r300/r300_context.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 3ed49a85c5..5f07b95634 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -439,11 +439,11 @@ static void r300InitGLExtensions(GLcontext *ctx)
if (r300->options.stencil_two_side_disabled)
_mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
- if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) {
+ if (r300->options.s3tc_force_disabled) {
+ _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
+ } else if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) {
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
_mesa_enable_extension(ctx, "GL_S3_s3tc");
- } else if (r300->options.s3tc_force_disabled) {
- _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
}
if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
--
cgit v1.2.3
From 0d31990b4742eccdf6ae6a3b3e16c81cc863085d Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Wed, 18 Nov 2009 13:50:49 -0800
Subject: progs/glsl: Fix noise GLSL compilation error on Mac OS.
---
progs/glsl/noise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/glsl/noise.c b/progs/glsl/noise.c
index bb024b5012..1148580ff4 100644
--- a/progs/glsl/noise.c
+++ b/progs/glsl/noise.c
@@ -28,7 +28,7 @@ static const char *FragShaderText =
" vec4 p;\n"
" p.xy = gl_TexCoord[0].xy;\n"
" p.z = Slice;\n"
- " p.w = 0;\n"
+ " p.w = 0.0;\n"
" vec4 n = noise4(p * scale);\n"
" gl_FragColor = n * Scale + Bias;\n"
"}\n";
--
cgit v1.2.3
From 4b3ec2acf2cc2830b0907e4fb4db8bd1ff4a18e3 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Wed, 18 Nov 2009 14:02:20 -0800
Subject: progs/glsl: Fix trirast GLSL compilation errors on Mac OS.
---
progs/glsl/trirast.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/progs/glsl/trirast.c b/progs/glsl/trirast.c
index 53bd91ef97..857342636d 100644
--- a/progs/glsl/trirast.c
+++ b/progs/glsl/trirast.c
@@ -179,9 +179,9 @@ Init(void)
"\n"
"void main() {\n"
" vec2 p = gl_FragCoord.xy; \n"
- " if (crs(v1 - v0, p - v0) >= 0 && \n"
- " crs(v2 - v1, p - v1) >= 0 && \n"
- " crs(v0 - v2, p - v2) >= 0) \n"
+ " if (crs(v1 - v0, p - v0) >= 0.0 && \n"
+ " crs(v2 - v1, p - v1) >= 0.0 && \n"
+ " crs(v0 - v2, p - v2) >= 0.0) \n"
" gl_FragColor = vec4(1.0); \n"
" else \n"
" gl_FragColor = vec4(0.5); \n"
--
cgit v1.2.3
From e73553bff74a41f08cba9d52b5fec19f15ab3d48 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 18 Nov 2009 19:51:57 +0000
Subject: st/xorg: Use the correct DRI2BufferPtr struct on 1.6.4 servers
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index c41a7cd639..adc9531dbd 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -137,6 +137,11 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
buffer->cpp = 4;
buffer->driverPrivate = private;
buffer->flags = 0; /* not tiled */
+#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION == 2
+ ((DRI2Buffer2Ptr)buffer)->format = 0;
+#elif defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 3
+ buffer->format = 0;
+#endif
private->tex = tex;
return TRUE;
@@ -157,12 +162,12 @@ driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
(*pScreen->DestroyPixmap)(private->pPixmap);
}
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2
+#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2
-static DRI2BufferPtr
+static DRI2Buffer2Ptr
driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format)
{
- DRI2BufferPtr buffer;
+ DRI2Buffer2Ptr buffer;
BufferPrivatePtr private;
buffer = xcalloc(1, sizeof *buffer);
@@ -177,7 +182,8 @@ driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format)
buffer->attachment = attachment;
buffer->driverPrivate = private;
- if (driDoCreateBuffer(pDraw, buffer, format))
+ /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
+ if (driDoCreateBuffer(pDraw, (DRI2BufferPtr)buffer, format))
return buffer;
xfree(private);
@@ -187,15 +193,16 @@ fail:
}
static void
-driDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
+driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
{
- driDoDestroyBuffer(pDraw, buffer);
+ /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
+ driDoDestroyBuffer(pDraw, (DRI2BufferPtr)buffer);
xfree(buffer->driverPrivate);
xfree(buffer);
}
-#else /* DRI2INFOREC_VERSION <= 2 */
+#else /* !defined(DRI2INFOREC_VERSION) || DRI2INFOREC_VERSION < 2 */
static DRI2BufferPtr
driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
@@ -245,7 +252,7 @@ driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
}
}
-#endif /* DRI2INFOREC_VERSION */
+#endif /* defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 */
static void
driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
@@ -352,7 +359,7 @@ driScreenInit(ScreenPtr pScreen)
dri2info.driverName = pScrn->driverName;
dri2info.deviceName = "/dev/dri/card0"; /* FIXME */
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2
+#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = driCreateBuffer;
dri2info.DestroyBuffer = driDestroyBuffer;
#else
--
cgit v1.2.3
From 9ab3c70f6568d980c3910d7ea8a3032445eaf49f Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 18 Nov 2009 19:56:50 +0000
Subject: st/xorg: Make the #if more easier to read
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index adc9531dbd..bd4acf7f82 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -42,6 +42,12 @@
#include "util/u_rect.h"
+/* Make all the #if cases in the code esier to read */
+/* XXX can it be set to 1? */
+#ifndef DRI2INFOREC_VERSION
+#define DRI2INFOREC_VERSION 0
+#endif
+
typedef struct {
PixmapPtr pPixmap;
struct pipe_texture *tex;
@@ -79,7 +85,7 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
case DRI2BufferFrontLeft:
break;
case DRI2BufferStencil:
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2
+#if DRI2INFOREC_VERSION >= 3
case DRI2BufferDepthStencil:
#else
/* Works on old X servers because sanity checking is for the weak */
@@ -137,9 +143,9 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
buffer->cpp = 4;
buffer->driverPrivate = private;
buffer->flags = 0; /* not tiled */
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION == 2
+#if DRI2INFOREC_VERSION == 2
((DRI2Buffer2Ptr)buffer)->format = 0;
-#elif defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 3
+#elif DRI2INFOREC_VERSION >= 3
buffer->format = 0;
#endif
private->tex = tex;
@@ -162,7 +168,7 @@ driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
(*pScreen->DestroyPixmap)(private->pPixmap);
}
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2
+#if DRI2INFOREC_VERSION >= 2
static DRI2Buffer2Ptr
driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format)
@@ -202,7 +208,7 @@ driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
xfree(buffer);
}
-#else /* !defined(DRI2INFOREC_VERSION) || DRI2INFOREC_VERSION < 2 */
+#else /* DRI2INFOREC_VERSION < 2 */
static DRI2BufferPtr
driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
@@ -252,7 +258,7 @@ driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
}
}
-#endif /* defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 */
+#endif /* DRI2INFOREC_VERSION >= 2 */
static void
driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
@@ -349,7 +355,7 @@ driScreenInit(ScreenPtr pScreen)
modesettingPtr ms = modesettingPTR(pScrn);
DRI2InfoRec dri2info;
-#if defined(DRI2INFOREC_VERSION)
+#if DRI2INFORCE_VERSION >= 2
dri2info.version = DRI2INFOREC_VERSION;
#else
dri2info.version = 1;
@@ -359,7 +365,7 @@ driScreenInit(ScreenPtr pScreen)
dri2info.driverName = pScrn->driverName;
dri2info.deviceName = "/dev/dri/card0"; /* FIXME */
-#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2
+#if DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = driCreateBuffer;
dri2info.DestroyBuffer = driDestroyBuffer;
#else
--
cgit v1.2.3
From cde66437247feb8b14b6d8f3ec3a8b4665fefa08 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Wed, 18 Nov 2009 14:41:40 -0800
Subject: progs/fp: Redraw upon keypress.
---
progs/fp/fp-tri.c | 2 +-
progs/fp/point-position.c | 2 +-
progs/fp/tri-depth.c | 2 +-
progs/fp/tri-depth2.c | 2 +-
progs/fp/tri-depthwrite.c | 2 +-
progs/fp/tri-depthwrite2.c | 2 +-
progs/fp/tri-param.c | 2 +-
progs/fp/tri-tex.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c
index 52a8fcfc22..26af66ad84 100644
--- a/progs/fp/fp-tri.c
+++ b/progs/fp/fp-tri.c
@@ -197,7 +197,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c
index c0963d7a0b..1ae753c1d0 100644
--- a/progs/fp/point-position.c
+++ b/progs/fp/point-position.c
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c
index 5488469e80..a9f3a6a5be 100644
--- a/progs/fp/tri-depth.c
+++ b/progs/fp/tri-depth.c
@@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c
index 6ed2307115..8c4336817b 100644
--- a/progs/fp/tri-depth2.c
+++ b/progs/fp/tri-depth2.c
@@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c
index 8e4f3e6245..7b9d70f292 100644
--- a/progs/fp/tri-depthwrite.c
+++ b/progs/fp/tri-depthwrite.c
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c
index 3c0b4d30c9..599949551d 100644
--- a/progs/fp/tri-depthwrite2.c
+++ b/progs/fp/tri-depthwrite2.c
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c
index 57443d71bd..26a804d4b3 100644
--- a/progs/fp/tri-param.c
+++ b/progs/fp/tri-param.c
@@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c
index 1dbbb201ce..64299e9453 100644
--- a/progs/fp/tri-tex.c
+++ b/progs/fp/tri-tex.c
@@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
--
cgit v1.2.3
From e12c9a6f3af6ec10cbd2e5cd2a6b90056652a2c0 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 18 Nov 2009 22:50:26 +0000
Subject: st/xorg: Init all functions and fix spelling
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index bd4acf7f82..aca889d6f8 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -355,7 +355,7 @@ driScreenInit(ScreenPtr pScreen)
modesettingPtr ms = modesettingPTR(pScrn);
DRI2InfoRec dri2info;
-#if DRI2INFORCE_VERSION >= 2
+#if DRI2INFOREC_VERSION >= 2
dri2info.version = DRI2INFOREC_VERSION;
#else
dri2info.version = 1;
@@ -368,6 +368,8 @@ driScreenInit(ScreenPtr pScreen)
#if DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = driCreateBuffer;
dri2info.DestroyBuffer = driDestroyBuffer;
+ dri2info.CreateBuffers = NULL;
+ dri2info.DestroyBuffers = NULL;
#else
dri2info.CreateBuffers = driCreateBuffers;
dri2info.DestroyBuffers = driDestroyBuffers;
--
cgit v1.2.3
From 61a3716ab5ad72ed2d2e926055716be99a4b2abd Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 18 Nov 2009 07:25:33 -0700
Subject: mesa: bump version to 7.8
---
src/mesa/main/version.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 0cae1860a3..dc55cb7ccc 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.7
+ * Version: 7.8
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
@@ -30,9 +30,9 @@
/* Mesa version */
#define MESA_MAJOR 7
-#define MESA_MINOR 7
+#define MESA_MINOR 8
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.7-devel"
+#define MESA_VERSION_STRING "7.8-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
--
cgit v1.2.3
From d252f9d278e2226d1165ec88ca889b6ebc48c0a9 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 18 Nov 2009 07:25:46 -0700
Subject: mesa: bump version to 7.8
---
configs/default | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/default b/configs/default
index 9af816cf9b..15f9285dbf 100644
--- a/configs/default
+++ b/configs/default
@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
-MESA_MINOR=7
+MESA_MINOR=8
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
--
cgit v1.2.3
From 3ba983bf5d0ae8f9eb5083513e910abf41dd8b73 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 18 Nov 2009 07:46:17 -0700
Subject: docs: setup 7.8 release notes file
---
docs/relnotes-7.8.html | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
docs/relnotes.html | 1 +
2 files changed, 54 insertions(+)
create mode 100644 docs/relnotes-7.8.html
diff --git a/docs/relnotes-7.8.html b/docs/relnotes-7.8.html
new file mode 100644
index 0000000000..dc003566c7
--- /dev/null
+++ b/docs/relnotes-7.8.html
@@ -0,0 +1,53 @@
+
+
+Mesa Release Notes
+
+
+
+
+
+
+
+Mesa 7.8 Release Notes / date TBD
+
+
+Mesa 7.8 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.8.1.
+
+
+Mesa 7.8 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.
+
+
+See the Compiling/Installing page for prerequisites
+for DRI hardware acceleration.
+
+
+
+MD5 checksums
+
+tbd
+
+
+
+New features
+
+
+
+Bug fixes
+
+
+
+Changes
+
+
+
+
diff --git a/docs/relnotes.html b/docs/relnotes.html
index b301ee046a..d0d9b6e5b9 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
+7.8 release notes
7.7 release notes
7.6.1 release notes
7.6 release notes
--
cgit v1.2.3
From 881f55236ad85f95745e70f8363726fa3c201f80 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 22:46:19 -0800
Subject: progs/glsl: Redraw upon keypress.
---
progs/glsl/convolutions.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/glsl/convolutions.c b/progs/glsl/convolutions.c
index c2fb76e1aa..350e61bbdc 100644
--- a/progs/glsl/convolutions.c
+++ b/progs/glsl/convolutions.c
@@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y)
case 27:
exit(0);
default:
- return;
+ break;
}
glutPostRedisplay();
}
--
cgit v1.2.3
From 9553a42f638bd98eb90e5b7fb37d6b82758b6363 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 22:52:05 -0800
Subject: progs/trivial: Redraw upon keypress.
---
progs/trivial/linestrip-clip.c | 2 +-
progs/trivial/linestrip-flat-stipple.c | 2 +-
progs/trivial/linestrip.c | 2 +-
progs/trivial/tri-unfilled-tri.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c
index f252822921..5e90ea2eb0 100644
--- a/progs/trivial/linestrip-clip.c
+++ b/progs/trivial/linestrip-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c
index 5caa724423..bae5c3a1c3 100644
--- a/progs/trivial/linestrip-flat-stipple.c
+++ b/progs/trivial/linestrip-flat-stipple.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c
index 0219b1ab70..b6d6882146 100644
--- a/progs/trivial/linestrip.c
+++ b/progs/trivial/linestrip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c
index 695cc89095..75a70b8a41 100644
--- a/progs/trivial/tri-unfilled-tri.c
+++ b/progs/trivial/tri-unfilled-tri.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
--
cgit v1.2.3
From 760cf71572a071ce43da576ebfeff4a8099150bc Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 22:59:01 -0800
Subject: progs/vp: Fix memory leak in vp-tris.c.
---
progs/vp/vp-tris.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c
index 1356242d97..29cd027b00 100644
--- a/progs/vp/vp-tris.c
+++ b/progs/vp/vp-tris.c
@@ -99,9 +99,11 @@ static void Init( void )
sz = (GLuint) fread(buf, 1, sizeof(buf), f);
if (!feof(f)) {
fprintf(stderr, "file too long\n");
+ fclose(f);
exit(1);
}
+ fclose(f);
fprintf(stderr, "%.*s\n", sz, buf);
if (strncmp( buf, "!!VP", 4 ) == 0) {
--
cgit v1.2.3
From b98db7bf697c3ed6e6df303e9dd66f7ac31eb3e2 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 23:56:07 -0800
Subject: progs/vpglsl: Fix psiz-mul.glsl compilation error on Mac OS.
---
progs/vpglsl/psiz-mul.glsl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl
index 77f4a46b52..d2a90d8578 100644
--- a/progs/vpglsl/psiz-mul.glsl
+++ b/progs/vpglsl/psiz-mul.glsl
@@ -1,6 +1,6 @@
void main() {
gl_FrontColor = gl_Color;
- gl_PointSize = 10 * gl_Color.x;
+ gl_PointSize = 10.0 * gl_Color.x;
gl_Position = gl_Vertex;
}
--
cgit v1.2.3
From 08cb1d0ce4765536f1cb6a9253a2245c31fb8ea9 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 00:03:10 -0800
Subject: st/xorg: Fix type of 'unknown'.
---
src/gallium/state_trackers/xorg/xorg_composite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 86a52077c3..dd10e12867 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -152,7 +152,7 @@ render_filter_to_gallium(int xrender_filter, int *out_filter)
*out_filter = PIPE_TEX_FILTER_LINEAR;
break;
default:
- debug_printf("Unkown xrender filter\n");
+ debug_printf("Unknown xrender filter\n");
case PictFilterConvolution:
*out_filter = PIPE_TEX_FILTER_NEAREST;
return FALSE;
--
cgit v1.2.3
From d36cb2396c942f05ba56c5b899792a507bb0f0fd Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 11:22:13 -0800
Subject: progs/util: Fix memory leak if malloc fails in RawImageOpen.
---
progs/util/readtex.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 3922998fd5..1e1183cf9a 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -130,6 +130,12 @@ static rawImageRec *RawImageOpen(const char *fileName)
if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL ||
raw->tmpB == NULL) {
fprintf(stderr, "Out of memory!\n");
+ free(raw->tmp);
+ free(raw->tmpR);
+ free(raw->tmpG);
+ free(raw->tmpB);
+ free(raw->tmpA);
+ free(raw);
return NULL;
}
@@ -139,6 +145,14 @@ static rawImageRec *RawImageOpen(const char *fileName)
raw->rowSize = (GLint *)malloc(x);
if (raw->rowStart == NULL || raw->rowSize == NULL) {
fprintf(stderr, "Out of memory!\n");
+ free(raw->tmp);
+ free(raw->tmpR);
+ free(raw->tmpG);
+ free(raw->tmpB);
+ free(raw->tmpA);
+ free(raw->rowStart);
+ free(raw->rowSize);
+ free(raw);
return NULL;
}
raw->rleEnd = 512 + (2 * x);
--
cgit v1.2.3
From c88b18a4df753205321ce1f7ddcd99244b670a1e Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 11:34:21 -0800
Subject: progs/slang: Check for ftell failure in vstest.c.
---
progs/slang/vstest.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c
index 472ea9b62e..33c6f09dc5 100644
--- a/progs/slang/vstest.c
+++ b/progs/slang/vstest.c
@@ -220,6 +220,12 @@ static void load_test_file (const char *filename)
fseek (f, 0, SEEK_END);
size = ftell (f);
+
+ if (size == -1) {
+ fclose (f);
+ return;
+ }
+
fseek (f, 0, SEEK_SET);
code = (char *) (malloc (size));
--
cgit v1.2.3
From e26135a744f740430e3dc341fa692544ba99c11e Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 12:11:55 -0800
Subject: progs/util: Exit RawImageGetData early if malloc fails.
Prevents a null pointer deference later on.
---
progs/util/readtex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/util/readtex.c b/progs/util/readtex.c
index 1e1183cf9a..81cb626e91 100644
--- a/progs/util/readtex.c
+++ b/progs/util/readtex.c
@@ -230,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final)
final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4);
if (final->data == NULL) {
fprintf(stderr, "Out of memory!\n");
+ return;
}
ptr = final->data;
--
cgit v1.2.3
From 48deddaa6f81e58f0ad6ab1c6cbd31c0184a0a3b Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 12:34:21 -0800
Subject: progs/tests: Initialize variable in getprocaddress.c.
---
progs/tests/getprocaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c
index a09ea58e1d..b905eeaf81 100644
--- a/progs/tests/getprocaddress.c
+++ b/progs/tests/getprocaddress.c
@@ -3516,7 +3516,7 @@ check_functions( const char *extensions )
struct name_test_pair *entry;
int failures = 0, passes = 0, untested = 0;
int totalFail = 0, totalPass = 0, totalUntested = 0, totalUnsupported = 0;
- int doTests;
+ int doTests = 0;
const char *version = (const char *) glGetString(GL_VERSION);
/* The functions list will have "real" entries (consisting of
--
cgit v1.2.3
From c4e8918cd248189d43cdc8df9f9f0450040261c5 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Fri, 20 Nov 2009 21:42:06 +0100
Subject: mesa: Fix NULL deref in optimizer when NumInstructions == 0.
Bug #24984.
---
src/mesa/shader/prog_optimize.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index 3d28d885a4..4fe351251e 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -443,7 +443,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
* FOO tmpY, arg0, arg1;
*/
- for (i = 0; i < prog->NumInstructions - 1; i++) {
+ for (i = 0; i + 1 < prog->NumInstructions; i++) {
const struct prog_instruction *mov = prog->Instructions + i;
if (mov->Opcode != OPCODE_MOV ||
--
cgit v1.2.3
From 02c3e0b82da6877a7e170bb3fafd591bc2d76115 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 12:48:44 -0800
Subject: progs/tests: Silence unused value warnings in sharedtex.c.
---
progs/tests/sharedtex.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/progs/tests/sharedtex.c b/progs/tests/sharedtex.c
index c07ebd719c..2337b88d3f 100644
--- a/progs/tests/sharedtex.c
+++ b/progs/tests/sharedtex.c
@@ -424,13 +424,13 @@ main(int argc, char *argv[])
{
const char *dpyName = XDisplayName(NULL);
- struct window *h0, *h1, *h2, *h3;
+ struct window *h0;
/* four windows and contexts sharing display lists and texture objects */
h0 = AddWindow(dpyName, 10, 10, NULL);
- h1 = AddWindow(dpyName, 330, 10, h0);
- h2 = AddWindow(dpyName, 10, 350, h0);
- h3 = AddWindow(dpyName, 330, 350, h0);
+ (void) AddWindow(dpyName, 330, 10, h0);
+ (void) AddWindow(dpyName, 10, 350, h0);
+ (void) AddWindow(dpyName, 330, 350, h0);
InitGLstuff(h0);
--
cgit v1.2.3
From f080567f4c4018c4885c105a154cb0eb39e6234f Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 13:01:22 -0800
Subject: progs/xdemos: Fix memory leak in glxinfo.c.
---
progs/xdemos/glxinfo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index 445d3ea94b..c1a032872c 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -964,8 +964,10 @@ print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode)
/* get list of all fbconfigs on this screen */
fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs);
- if (numFBConfigs == 0)
+ if (numFBConfigs == 0) {
+ XFree(fbconfigs);
return;
+ }
printf("%d GLXFBConfigs:\n", numFBConfigs);
if (mode == Normal)
--
cgit v1.2.3
From 8556fad75124e1ade9af095e112ebb6ac5cbff61 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 13:09:42 -0800
Subject: progs/xdemos: Silence unused value warnings in sharedtex_mt.c.
---
progs/xdemos/sharedtex_mt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c
index 07c1bfcc38..f924448cc4 100644
--- a/progs/xdemos/sharedtex_mt.c
+++ b/progs/xdemos/sharedtex_mt.c
@@ -447,7 +447,7 @@ main(int argc, char *argv[])
const char *dpyName = XDisplayName(NULL);
pthread_t t0, t1, t2, t3;
struct thread_init_arg tia0, tia1, tia2, tia3;
- struct window *h0, *h1, *h2, *h3;
+ struct window *h0;
XInitThreads();
@@ -462,9 +462,9 @@ main(int argc, char *argv[])
/* four windows and contexts sharing display lists and texture objects */
h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx);
- h1 = AddWindow(gDpy, dpyName, 330, 10, gCtx);
- h2 = AddWindow(gDpy, dpyName, 10, 350, gCtx);
- h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx);
+ (void) AddWindow(gDpy, dpyName, 330, 10, gCtx);
+ (void) AddWindow(gDpy, dpyName, 10, 350, gCtx);
+ (void) AddWindow(gDpy, dpyName, 330, 350, gCtx);
if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) {
Error(dpyName, "glXMakeCurrent failed for init thread.");
--
cgit v1.2.3
From 1dbf3642b9c1c37f72e2212ce78056cf8959a957 Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:08:29 +0000
Subject: Fix memory leak.
---
src/gallium/drivers/softpipe/sp_state_fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 256faa94b8..b41f7e8ab7 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -143,6 +143,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
+ FREE( (void *)state->shader.tokens );
FREE( state );
}
--
cgit v1.2.3
From 910b58039a3980d9857380cf367bdbe2395d791f Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:09:10 +0000
Subject: Fix vega compilation.
---
src/gallium/state_trackers/vega/arc.c | 6 ++++--
src/gallium/state_trackers/vega/bezier.c | 7 +++++--
src/gallium/state_trackers/vega/vg_context.c | 4 +++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c
index e74c7f0334..8b04d21ea7 100644
--- a/src/gallium/state_trackers/vega/arc.c
+++ b/src/gallium/state_trackers/vega/arc.c
@@ -528,6 +528,7 @@ static INLINE int num_beziers_needed(struct arc *arc)
double threshold = 0.05;
VGboolean found = VG_FALSE;
int n = 1;
+ int i;
double min_eta, max_eta;
min_eta = MIN2(arc->eta1, arc->eta2);
@@ -538,7 +539,7 @@ static INLINE int num_beziers_needed(struct arc *arc)
if (d_eta <= 0.5 * M_PI) {
double eta_b = min_eta;
found = VG_TRUE;
- for (int i = 0; found && (i < n); ++i) {
+ for (i = 0; found && (i < n); ++i) {
double etaA = eta_b;
eta_b += d_eta;
found = (estimate_error(arc, etaA, eta_b) <= threshold);
@@ -554,6 +555,7 @@ static void arc_to_beziers(struct arc *arc,
struct arc_cb cb,
struct matrix *matrix)
{
+ int i;
int n = 1;
double d_eta, eta_b, cos_eta_b,
sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b,
@@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc,
t = tan(0.5 * d_eta);
alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3;
- for (int i = 0; i < n; ++i) {
+ for (i = 0; i < n; ++i) {
struct bezier bezier;
double xA = x_b;
double yA = y_b;
diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c
index 39a7ade016..0d5504004c 100644
--- a/src/gallium/state_trackers/vega/bezier.c
+++ b/src/gallium/state_trackers/vega/bezier.c
@@ -255,7 +255,9 @@ static enum shift_result good_offset(const struct bezier *b1,
const float max_dist_line = threshold*offset*offset;
const float max_dist_normal = threshold*offset;
const float spacing = 0.25;
- for (float i = spacing; i < 0.99; i += spacing) {
+ float i;
+
+ for (i = spacing; i < 0.99; i += spacing) {
float p1[2],p2[2], d, l;
float normal[2];
bezier_point_at(b1, i, p1);
@@ -330,6 +332,7 @@ static enum shift_result shift(const struct bezier *orig,
struct bezier *shifted,
float offset, float threshold)
{
+ int i;
int map[4];
VGboolean p1_p2_equal = (orig->x1 == orig->x2 && orig->y1 == orig->y2);
VGboolean p2_p3_equal = (orig->x2 == orig->x3 && orig->y2 == orig->y3);
@@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig,
points_shifted[0][0] = points[0][0] + offset * prev_normal[0];
points_shifted[0][1] = points[0][1] + offset * prev_normal[1];
- for (int i = 1; i < np - 1; ++i) {
+ for (i = 1; i < np - 1; ++i) {
float normal_sum[2], r;
float next_normal[2];
compute_pt_normal(points[i], points[i + 1], next_normal);
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index e0ff02f3a9..00d23f5c22 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -231,6 +231,8 @@ static void update_clip_state(struct vg_context *ctx)
if (state->scissoring) {
struct pipe_blend_state *blend = &ctx->state.g3d.blend;
struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
+ int i;
+
dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/
dsa->depth.func = PIPE_FUNC_ALWAYS;
dsa->depth.enabled = 1;
@@ -254,7 +256,7 @@ static void update_clip_state(struct vg_context *ctx)
cso_set_blend(ctx->cso_context, blend);
/* enable scissoring */
- for (int i = 0; i < state->scissor_rects_num; ++i) {
+ for (i = 0; i < state->scissor_rects_num; ++i) {
const float x = state->scissor_rects[i * 4 + 0].f;
const float y = state->scissor_rects[i * 4 + 1].f;
const float width = state->scissor_rects[i * 4 + 2].f;
--
cgit v1.2.3
From 8d6da811d4fff50dc42e71c6149759908a458f7f Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 18 Nov 2009 17:38:49 +0100
Subject: st/xorg: Unbind any textures in solid
Helps debuging with rbug
---
src/gallium/state_trackers/xorg/xorg_composite.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index dd10e12867..eed7a7d63a 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -565,6 +565,8 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
renderer_bind_viewport(exa->renderer, pixmap);
renderer_bind_rasterizer(exa->renderer);
bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL);
+ cso_set_samplers(exa->renderer->cso, 0, NULL);
+ cso_set_sampler_textures(exa->renderer->cso, 0, NULL);
setup_constant_buffers(exa, pixmap);
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
--
cgit v1.2.3
From 5109484bd9cd79ed88af59280bd0be5a4150f37c Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Wed, 18 Nov 2009 17:45:39 +0100
Subject: st/xorg: Flush any pending operations on upload
---
src/gallium/state_trackers/xorg/xorg_exa.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 3a51ad2d59..3d83b5700d 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -230,6 +230,11 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
if (!priv || !priv->tex)
return FALSE;
+ /* make sure that any pending operations are flushed to hardware */
+ if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
+ (PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE))
+ xorg_exa_flush(exa, 0, NULL);
+
transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, x, y, w, h);
if (!transfer)
--
cgit v1.2.3
From fafc016e1f298cfea332124e9d64e8e010ee9c45 Mon Sep 17 00:00:00 2001
From: Zack Rusin
Date: Wed, 18 Nov 2009 12:06:32 -0500
Subject: st/xorg: enable yv12 for xv
---
src/gallium/state_trackers/xorg/xorg_xv.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 2b935c0f73..5794395771 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -73,10 +73,11 @@ static XF86VideoEncodingRec DummyEncoding[1] = {
}
};
-#define NUM_IMAGES 2
+#define NUM_IMAGES 3
static XF86ImageRec Images[NUM_IMAGES] = {
XVIMAGE_UYVY,
XVIMAGE_YUY2,
+ XVIMAGE_YV12,
};
struct xorg_xv_port_priv {
@@ -537,6 +538,7 @@ put_image(ScrnInfoPtr pScrn,
switch (id) {
case FOURCC_UYVY:
case FOURCC_YUY2:
+ case FOURCC_YV12:
default:
srcPitch = width << 1;
break;
@@ -585,6 +587,7 @@ query_image_attributes(ScrnInfoPtr pScrn,
switch (id) {
case FOURCC_UYVY:
case FOURCC_YUY2:
+ case FOURCC_YV12:
default:
size = *w << 1;
if (pitches)
--
cgit v1.2.3
From 3132853e1242607d5ff62785cd7dad5ef3a783d0 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Tue, 17 Nov 2009 16:25:02 -0500
Subject: r600 : Initial version of glsl fc.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 2572 ++++++++++++++++++++++++----
src/mesa/drivers/dri/r600/r700_assembler.h | 111 +-
src/mesa/drivers/dri/r600/r700_chip.c | 99 +-
src/mesa/drivers/dri/r600/r700_fragprog.c | 94 +-
src/mesa/drivers/dri/r600/r700_shader.c | 9 +-
src/mesa/drivers/dri/r600/r700_shader.h | 3 +-
src/mesa/drivers/dri/r600/r700_vertprog.c | 21 +-
7 files changed, 2507 insertions(+), 402 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index e0d7d4fa6b..4b5d40bd3a 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -38,6 +38,8 @@
#include "r700_assembler.h"
+#define USE_CF_FOR_CONTINUE_BREAK 1
+
BITS addrmode_PVSDST(PVSDST * pPVSDST)
{
return pPVSDST->addrmode0 | ((BITS)pPVSDST->addrmode1 << 1);
@@ -343,6 +345,8 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm)
case SQ_OP2_INST_MIN:
//case SQ_OP2_INST_MAX_DX10:
//case SQ_OP2_INST_MIN_DX10:
+ case SQ_OP2_INST_SETE:
+ case SQ_OP2_INST_SETNE:
case SQ_OP2_INST_SETGT:
case SQ_OP2_INST_SETGE:
case SQ_OP2_INST_PRED_SETE:
@@ -398,6 +402,9 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
pAsm->number_of_exports = 0;
pAsm->number_of_export_opcodes = 0;
+ pAsm->alu_x_opcode = 0;
+
+ pAsm->D2.bits = 0;
pAsm->D.bits = 0;
pAsm->S[0].bits = 0;
@@ -474,6 +481,22 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
pAsm->is_tex = GL_FALSE;
pAsm->need_tex_barrier = GL_FALSE;
+ pAsm->subs = NULL;
+ pAsm->unSubArraySize = 0;
+ pAsm->unSubArrayPointer = 0;
+ pAsm->callers = NULL;
+ pAsm->unCallerArraySize = 0;
+ pAsm->unCallerArrayPointer = 0;
+
+ pAsm->CALLSP = 0;
+ pAsm->CALLSTACK[0].FCSP_BeforeEntry;
+ pAsm->CALLSTACK[0].plstCFInstructions_local
+ = &(pAsm->pR700Shader->lstCFInstructions);
+
+ SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local);
+
+ pAsm->unCFflags = 0;
+
return 0;
}
@@ -592,6 +615,31 @@ int check_current_clause(r700_AssemblerBase* pAsm,
return GL_TRUE;
}
+GLboolean add_cf_instruction(r700_AssemblerBase* pAsm)
+{
+ if(GL_FALSE == check_current_clause(pAsm, CF_OTHER_CLAUSE))
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->cf_current_cf_clause_ptr =
+ (R700ControlFlowGenericClause*) CALLOC_STRUCT(R700ControlFlowGenericClause);
+
+ if (pAsm->cf_current_cf_clause_ptr != NULL)
+ {
+ Init_R700ControlFlowGenericClause(pAsm->cf_current_cf_clause_ptr);
+ AddCFInstruction( pAsm->pR700Shader,
+ (R700ControlFlowInstruction *)pAsm->cf_current_cf_clause_ptr );
+ }
+ else
+ {
+ radeon_error("Could not allocate a new VFetch CF instruction.\n");
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm,
R700VertexInstruction* vertex_instruction_ptr)
{
@@ -1153,6 +1201,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
case PROGRAM_LOCAL_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
+ case PROGRAM_UNIFORM:
if (1 == pILInst->SrcReg[src].RelAddr)
{
setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_RELATIVE_A0);
@@ -1179,7 +1228,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
}
break;
default:
- radeon_error("Invalid source argument type\n");
+ radeon_error("Invalid source argument type : %d \n", pILInst->SrcReg[src].File);
return GL_FALSE;
}
}
@@ -1315,7 +1364,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm)
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
+ case FRAG_ATTRIB_TEX3:
case FRAG_ATTRIB_TEX4:
case FRAG_ATTRIB_TEX5:
case FRAG_ATTRIB_TEX6:
@@ -1335,6 +1384,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm)
fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n");
break;
}
+
+ if( (pILInst->SrcReg[0].Index >= FRAG_ATTRIB_VAR0) ||
+ (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) )
+ {
+ bValidTexCoord = GL_TRUE;
+ pAsm->S[0].src.reg =
+ pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index];
+ pAsm->S[0].src.rtype = SRC_REG_INPUT;
+ }
+
break;
}
}
@@ -1517,6 +1576,10 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr,
{
src_sel = pSource->reg + CFILE_REGISTER_OFFSET;
}
+ else if (pSource->rtype == SRC_REC_LITERAL)
+ {
+ src_sel = SQ_ALU_SRC_LITERAL;
+ }
else
{
radeon_error("Source (%d) register type (%d) not one of TEMP, INPUT, or CONSTANT.\n",
@@ -1606,7 +1669,8 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm,
return GL_FALSE;
}
- if ( pAsm->cf_current_alu_clause_ptr == NULL ||
+ if ( pAsm->alu_x_opcode != 0 ||
+ pAsm->cf_current_alu_clause_ptr == NULL ||
( (pAsm->cf_current_alu_clause_ptr != NULL) &&
(pAsm->cf_current_alu_clause_ptr->m_Word1.f.count >= (GetCFMaxInstructions(pAsm->cf_current_alu_clause_ptr->m_ShaderInstType)-contiguous_slots_needed-1) )
) )
@@ -1636,9 +1700,17 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm,
pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr0 = 0x0;
pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr1 = 0x0;
- //cf_current_alu_clause_ptr->m_Word1.f.count = number_of_scalar_operations - 1;
pAsm->cf_current_alu_clause_ptr->m_Word1.f.count = 0x0;
- pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ALU;
+
+ if(pAsm->alu_x_opcode != 0)
+ {
+ pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = pAsm->alu_x_opcode;
+ pAsm->alu_x_opcode = 0;
+ }
+ else
+ {
+ pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ALU;
+ }
pAsm->cf_current_alu_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
@@ -2358,146 +2430,711 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
-GLboolean next_ins(r700_AssemblerBase *pAsm)
+GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm)
{
- struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
+ GLuint number_of_scalar_operations;
+ GLboolean is_single_scalar_operation;
+ GLuint scalar_channel_index;
- if( GL_TRUE == pAsm->is_tex )
+ PVSSRC * pcurrent_source;
+ int current_source_index;
+ GLuint contiguous_slots_needed;
+
+ GLuint uNumSrc = r700GetNumOperands(pAsm);
+
+ GLboolean bSplitInst = GL_FALSE;
+
+ if (1 == pAsm->D.dst.math)
{
- if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) {
- if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) )
- {
- radeon_error("Error assembling TEX instruction\n");
- return GL_FALSE;
- }
- } else {
- if( GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE) )
- {
- radeon_error("Error assembling TEX instruction\n");
- return GL_FALSE;
- }
- }
+ is_single_scalar_operation = GL_TRUE;
+ number_of_scalar_operations = 1;
}
else
- { //ALU
- if( GL_FALSE == assemble_alu_instruction(pAsm) )
- {
- radeon_error("Error assembling ALU instruction\n");
- return GL_FALSE;
- }
- }
-
- if(pAsm->D.dst.rtype == DST_REG_OUT)
{
- if(pAsm->D.dst.op3)
- {
- // There is no mask for OP3 instructions, so all channels are written
- pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
- }
- else
- {
- pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number]
- |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
- }
+ is_single_scalar_operation = GL_FALSE;
+ number_of_scalar_operations = 4;
}
-
- //reset for next inst.
- pAsm->D.bits = 0;
- pAsm->S[0].bits = 0;
- pAsm->S[1].bits = 0;
- pAsm->S[2].bits = 0;
- pAsm->is_tex = GL_FALSE;
- pAsm->need_tex_barrier = GL_FALSE;
- return GL_TRUE;
-}
-
-GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode)
-{
- BITS tmp;
-
- checkop1(pAsm);
-
- tmp = gethelpr(pAsm);
-
- // opcode tmp.x, a.x
- // MOV dst, tmp.x
- pAsm->D.dst.opcode = opcode;
- pAsm->D.dst.math = 1;
-
- setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
- pAsm->D.dst.writex = 1;
+ contiguous_slots_needed = 0;
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) )
{
- return GL_FALSE;
+ contiguous_slots_needed = 4;
}
- if ( GL_FALSE == next_ins(pAsm) )
+ initialize(pAsm);
+
+ for (scalar_channel_index=0;
+ scalar_channel_index < number_of_scalar_operations;
+ scalar_channel_index++)
{
- return GL_FALSE;
- }
+ R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction);
+ if (alu_instruction_ptr == NULL)
+ {
+ return GL_FALSE;
+ }
+ Init_R700ALUInstruction(alu_instruction_ptr);
+
+ //src 0
+ current_source_index = 0;
+ pcurrent_source = &(pAsm->S[0].src);
- // Now replicate result to all necessary channels in destination
- pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+ if (GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ current_source_index,
+ pcurrent_source,
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+
+ if (uNumSrc > 1)
+ {
+ // Process source 1
+ current_source_index = 1;
+ pcurrent_source = &(pAsm->S[current_source_index].src);
- if( GL_FALSE == assemble_dst(pAsm) )
- {
- return GL_FALSE;
- }
+ if (GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ current_source_index,
+ pcurrent_source,
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+ }
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = DST_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp;
+ //other bits
+ alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP;
- setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
- noneg_PVSSRC(&(pAsm->S[0].src));
+ if( (is_single_scalar_operation == GL_TRUE)
+ || (GL_TRUE == bSplitInst) )
+ {
+ alu_instruction_ptr->m_Word0.f.last = 1;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word0.f.last = (scalar_channel_index == 3) ? 1 : 0;
+ }
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ alu_instruction_ptr->m_Word0.f.pred_sel = (pAsm->D.dst.pred_inv > 0) ? 1 : 0;
+ if(1 == pAsm->D.dst.predicated)
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1;
+ alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0;
+ }
+
+ // dst
+ if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) ||
+ (pAsm->D.dst.rtype == DST_REG_OUT) )
+ {
+ alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg;
+ }
+ else
+ {
+ radeon_error("Only temp destination registers supported for ALU dest regs.\n");
+ return GL_FALSE;
+ }
- return GL_TRUE;
-}
+ alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype
-GLboolean assemble_ABS(r700_AssemblerBase *pAsm)
-{
- checkop1(pAsm);
+ if ( is_single_scalar_operation == GL_TRUE )
+ {
+ // Override scalar_channel_index since only one scalar value will be written
+ if(pAsm->D.dst.writex)
+ {
+ scalar_channel_index = 0;
+ }
+ else if(pAsm->D.dst.writey)
+ {
+ scalar_channel_index = 1;
+ }
+ else if(pAsm->D.dst.writez)
+ {
+ scalar_channel_index = 2;
+ }
+ else if(pAsm->D.dst.writew)
+ {
+ scalar_channel_index = 3;
+ }
+ }
- pAsm->D.dst.opcode = SQ_OP2_INST_MAX;
+ alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index;
- if( GL_FALSE == assemble_dst(pAsm) )
- {
- return GL_FALSE;
- }
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
- {
- return GL_FALSE;
- }
-
- pAsm->S[1].bits = pAsm->S[0].bits;
- flipneg_PVSSRC(&(pAsm->S[1].src));
+ alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode;
- if ( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ if (pAsm->D.dst.op3)
+ {
+ //op3
- return GL_TRUE;
-}
+ alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode;
-GLboolean assemble_ADD(r700_AssemblerBase *pAsm)
-{
- if( GL_FALSE == checkop2(pAsm) )
- {
- return GL_FALSE;
- }
+ //There's 3rd src for op3
+ current_source_index = 2;
+ pcurrent_source = &(pAsm->S[current_source_index].src);
- pAsm->D.dst.opcode = SQ_OP2_INST_ADD;
-
+ if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ current_source_index,
+ pcurrent_source,
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ //op2
+ if (pAsm->bR6xx)
+ {
+ alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode;
+
+ alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0;
+
+ //alu_instruction_ptr->m_Word1_OP2.f6.update_execute_mask = 0x0;
+ //alu_instruction_ptr->m_Word1_OP2.f6.update_pred = 0x0;
+ switch (scalar_channel_index)
+ {
+ case 0:
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writex;
+ break;
+ case 1:
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writey;
+ break;
+ case 2:
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writez;
+ break;
+ case 3:
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writew;
+ break;
+ default:
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; //SQ_SEL_MASK;
+ break;
+ }
+ alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode;
+
+ alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0;
+
+ //alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0;
+ //alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0;
+ switch (scalar_channel_index)
+ {
+ case 0:
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writex;
+ break;
+ case 1:
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writey;
+ break;
+ case 2:
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writez;
+ break;
+ case 3:
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writew;
+ break;
+ default:
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; //SQ_SEL_MASK;
+ break;
+ }
+ alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF;
+ }
+ }
+
+ if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) )
+ {
+ return GL_FALSE;
+ }
+
+ /*
+ * Judge the type of current instruction, is it vector or scalar
+ * instruction.
+ */
+ if (is_single_scalar_operation)
+ {
+ if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) )
+ {
+ return 1;
+ }
+ }
+
+ contiguous_slots_needed = 0;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral)
+{
+ R700ALUInstruction * alu_instruction_ptr;
+ R700ALUInstructionHalfLiteral * alu_instruction_ptr_hl;
+ R700ALUInstructionFullLiteral * alu_instruction_ptr_fl;
+
+ GLuint number_of_scalar_operations;
+ GLboolean is_single_scalar_operation;
+ GLuint scalar_channel_index;
+
+ GLuint contiguous_slots_needed;
+ GLuint lastInstruction;
+ GLuint not_masked[4];
+
+ GLuint uNumSrc = r700GetNumOperands(pAsm);
+
+ GLboolean bSplitInst = GL_FALSE;
+
+ number_of_scalar_operations = 0;
+ contiguous_slots_needed = 0;
+
+ if(1 == pAsm->D.dst.writew)
+ {
+ lastInstruction = 3;
+ number_of_scalar_operations++;
+ not_masked[3] = 1;
+ }
+ else
+ {
+ not_masked[3] = 0;
+ }
+ if(1 == pAsm->D.dst.writez)
+ {
+ lastInstruction = 2;
+ number_of_scalar_operations++;
+ not_masked[2] = 1;
+ }
+ else
+ {
+ not_masked[2] = 0;
+ }
+ if(1 == pAsm->D.dst.writey)
+ {
+ lastInstruction = 1;
+ number_of_scalar_operations++;
+ not_masked[1] = 1;
+ }
+ else
+ {
+ not_masked[1] = 0;
+ }
+ if(1 == pAsm->D.dst.writex)
+ {
+ lastInstruction = 0;
+ number_of_scalar_operations++;
+ not_masked[0] = 1;
+ }
+ else
+ {
+ not_masked[0] = 0;
+ }
+
+ if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) )
+ {
+ contiguous_slots_needed = 4;
+ }
+ else
+ {
+ contiguous_slots_needed = number_of_scalar_operations;
+ }
+
+ if(1 == pAsm->D2.dst2.literal)
+ {
+ contiguous_slots_needed += 1;
+ }
+ else if(2 == pAsm->D2.dst2.literal)
+ {
+ contiguous_slots_needed += 2;
+ }
+
+ initialize(pAsm);
+
+ for (scalar_channel_index=0; scalar_channel_index < 4; scalar_channel_index++)
+ {
+ if(0 == not_masked[scalar_channel_index])
+ {
+ continue;
+ }
+
+ if(scalar_channel_index == lastInstruction)
+ {
+ switch (pAsm->D2.dst2.literal)
+ {
+ case 0:
+ alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction);
+ if (alu_instruction_ptr == NULL)
+ {
+ return GL_FALSE;
+ }
+ Init_R700ALUInstruction(alu_instruction_ptr);
+ break;
+ case 1:
+ alu_instruction_ptr_hl = (R700ALUInstructionHalfLiteral*) CALLOC_STRUCT(R700ALUInstructionHalfLiteral);
+ if (alu_instruction_ptr_hl == NULL)
+ {
+ return GL_FALSE;
+ }
+ Init_R700ALUInstructionHalfLiteral(alu_instruction_ptr_hl, pLiteral[0], pLiteral[1]);
+ alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_hl;
+ break;
+ case 2:
+ alu_instruction_ptr_fl = (R700ALUInstructionFullLiteral*) CALLOC_STRUCT(R700ALUInstructionFullLiteral);
+ if (alu_instruction_ptr_fl == NULL)
+ {
+ return GL_FALSE;
+ }
+ Init_R700ALUInstructionFullLiteral(alu_instruction_ptr_fl, pLiteral[0], pLiteral[1], pLiteral[2], pLiteral[3]);
+ alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_fl;
+ break;
+ default:
+ break;
+ };
+ }
+ else
+ {
+ alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction);
+ if (alu_instruction_ptr == NULL)
+ {
+ return GL_FALSE;
+ }
+ Init_R700ALUInstruction(alu_instruction_ptr);
+ }
+
+ //src 0
+ if (GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ 0,
+ &(pAsm->S[0].src),
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+
+ if (uNumSrc > 1)
+ {
+ // Process source 1
+ if (GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ 1,
+ &(pAsm->S[1].src),
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+ }
+
+ //other bits
+ alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP;
+
+ if(scalar_channel_index == lastInstruction)
+ {
+ alu_instruction_ptr->m_Word0.f.last = 1;
+ }
+
+ alu_instruction_ptr->m_Word0.f.pred_sel = 0x0;
+ if(1 == pAsm->D.dst.predicated)
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1;
+ alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0;
+ alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0;
+ }
+
+ // dst
+ if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) ||
+ (pAsm->D.dst.rtype == DST_REG_OUT) )
+ {
+ alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg;
+ }
+ else
+ {
+ radeon_error("Only temp destination registers supported for ALU dest regs.\n");
+ return GL_FALSE;
+ }
+
+ alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype
+
+ alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index;
+
+ alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode;
+
+ if (pAsm->D.dst.op3)
+ {
+ //op3
+ alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode;
+
+ //There's 3rd src for op3
+ if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr,
+ 2,
+ &(pAsm->S[2].src),
+ scalar_channel_index) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ //op2
+ if (pAsm->bR6xx)
+ {
+ alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode;
+ alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1;
+ alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode;
+ alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0;
+ alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1;
+ alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF;
+ }
+ }
+
+ if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) )
+ {
+ return GL_FALSE;
+ }
+
+ if (1 == number_of_scalar_operations)
+ {
+ if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) )
+ {
+ return GL_FALSE;
+ }
+ }
+
+ contiguous_slots_needed -= 2;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean next_ins(r700_AssemblerBase *pAsm)
+{
+ struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
+
+ if( GL_TRUE == pAsm->is_tex )
+ {
+ if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) {
+ if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) )
+ {
+ radeon_error("Error assembling TEX instruction\n");
+ return GL_FALSE;
+ }
+ } else {
+ if( GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE) )
+ {
+ radeon_error("Error assembling TEX instruction\n");
+ return GL_FALSE;
+ }
+ }
+ }
+ else
+ { //ALU
+ if( GL_FALSE == assemble_alu_instruction(pAsm) )
+ {
+ radeon_error("Error assembling ALU instruction\n");
+ return GL_FALSE;
+ }
+ }
+
+ if(pAsm->D.dst.rtype == DST_REG_OUT)
+ {
+ if(pAsm->D.dst.op3)
+ {
+ // There is no mask for OP3 instructions, so all channels are written
+ pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
+ }
+ else
+ {
+ pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number]
+ |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
+ }
+ }
+
+ //reset for next inst.
+ pAsm->D.bits = 0;
+ pAsm->D2.bits = 0;
+ pAsm->S[0].bits = 0;
+ pAsm->S[1].bits = 0;
+ pAsm->S[2].bits = 0;
+ pAsm->is_tex = GL_FALSE;
+ pAsm->need_tex_barrier = GL_FALSE;
+
+ return GL_TRUE;
+}
+
+GLboolean next_ins2(r700_AssemblerBase *pAsm)
+{
+ struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
+
+ //ALU
+ if( GL_FALSE == assemble_alu_instruction2(pAsm) )
+ {
+ radeon_error("Error assembling ALU instruction\n");
+ return GL_FALSE;
+ }
+
+ if(pAsm->D.dst.rtype == DST_REG_OUT)
+ {
+ if(pAsm->D.dst.op3)
+ {
+ // There is no mask for OP3 instructions, so all channels are written
+ pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
+ }
+ else
+ {
+ pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number]
+ |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
+ }
+ }
+
+ //reset for next inst.
+ pAsm->D.bits = 0;
+ pAsm->D2.bits = 0;
+ pAsm->S[0].bits = 0;
+ pAsm->S[1].bits = 0;
+ pAsm->S[2].bits = 0;
+ pAsm->is_tex = GL_FALSE;
+ pAsm->need_tex_barrier = GL_FALSE;
+
+ //richard nov.16 glsl
+ pAsm->D2.bits = 0;
+
+ return GL_TRUE;
+}
+
+/* not work yet */
+GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral)
+{
+ struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
+
+ //ALU
+ if( GL_FALSE == assemble_alu_instruction_literal(pAsm, pLiteral) )
+ {
+ radeon_error("Error assembling ALU instruction\n");
+ return GL_FALSE;
+ }
+
+ //reset for next inst.
+ pAsm->D.bits = 0;
+ pAsm->D2.bits = 0;
+ pAsm->S[0].bits = 0;
+ pAsm->S[1].bits = 0;
+ pAsm->S[2].bits = 0;
+ pAsm->is_tex = GL_FALSE;
+ pAsm->need_tex_barrier = GL_FALSE;
+ return GL_TRUE;
+}
+
+GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode)
+{
+ BITS tmp;
+
+ checkop1(pAsm);
+
+ tmp = gethelpr(pAsm);
+
+ // opcode tmp.x, a.x
+ // MOV dst, tmp.x
+
+ pAsm->D.dst.opcode = opcode;
+ pAsm->D.dst.math = 1;
+
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+ pAsm->D.dst.writex = 1;
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if ( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ // Now replicate result to all necessary channels in destination
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ pAsm->S[0].src.rtype = DST_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp;
+
+ setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_ABS(r700_AssemblerBase *pAsm)
+{
+ checkop1(pAsm);
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_MAX;
+
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->S[1].bits = pAsm->S[0].bits;
+ flipneg_PVSSRC(&(pAsm->S[1].src));
+
+ if ( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_ADD(r700_AssemblerBase *pAsm)
+{
+ if( GL_FALSE == checkop2(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_ADD;
+
if( GL_FALSE == assemble_dst(pAsm) )
{
return GL_FALSE;
@@ -3809,10 +4446,78 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm)
pAsm->S[0].src.swizzlez = SQ_SEL_0;
pAsm->S[0].src.swizzlew = SQ_SEL_0;
- if ( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ if ( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode)
+{
+ if( GL_FALSE == checkop2(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = opcode;
+ pAsm->D.dst.math = 1;
+
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode)
+{
+ if( GL_FALSE == checkop2(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = opcode;
+ pAsm->D.dst.math = 1;
+ pAsm->D.dst.predicated = 1;
+ pAsm->D2.dst2.SaturateMode = pAsm->pILInst[pAsm->uiCurInst].SaturateMode;
+
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == next_ins2(pAsm) )
+ {
+ return GL_FALSE;
+ }
return GL_TRUE;
}
@@ -4077,223 +4782,930 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm)
pAsm->D.dst.writez = 0;
pAsm->D.dst.writew = 0;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp2;
- noswizzle_PVSSRC(&(pAsm->S[0].src));
- setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
- pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5
- noswizzle_PVSSRC(&(pAsm->S[1].src));
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp2;
+ noswizzle_PVSSRC(&(pAsm->S[0].src));
+ setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
+ pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5
+ noswizzle_PVSSRC(&(pAsm->S[1].src));
+
+ next_ins(pAsm);
+
+ /* tmp1.xy = temp2.xy */
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp1;
+ pAsm->D.dst.writex = 1;
+ pAsm->D.dst.writey = 1;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
+
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp2;
+ noswizzle_PVSSRC(&(pAsm->S[0].src));
+
+ next_ins(pAsm);
+ pAsm->aArgSubst[1] = tmp1;
+ need_barrier = GL_TRUE;
+
+ }
+
+ pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE;
+ pAsm->is_tex = GL_TRUE;
+ if ( GL_TRUE == need_barrier )
+ {
+ pAsm->need_tex_barrier = GL_TRUE;
+ }
+ // Set src1 to tex unit id
+ pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit;
+ pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
+
+ //No sw info from mesa compiler, so hard code here.
+ pAsm->S[1].src.swizzlex = SQ_SEL_X;
+ pAsm->S[1].src.swizzley = SQ_SEL_Y;
+ pAsm->S[1].src.swizzlez = SQ_SEL_Z;
+ pAsm->S[1].src.swizzlew = SQ_SEL_W;
+
+ if( GL_FALSE == tex_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == tex_src(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP)
+ {
+ /* hopefully did swizzles before */
+ noswizzle_PVSSRC(&(pAsm->S[0].src));
+ }
+
+ if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX)
+ {
+ /* SAMPLE dst, tmp.yxwy, CUBE */
+ pAsm->S[0].src.swizzlex = SQ_SEL_Y;
+ pAsm->S[0].src.swizzley = SQ_SEL_X;
+ pAsm->S[0].src.swizzlez = SQ_SEL_W;
+ pAsm->S[0].src.swizzlew = SQ_SEL_Y;
+ }
+
+ if ( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
+{
+ BITS tmp;
+
+ if( GL_FALSE == checkop2(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ tmp = gethelpr(pAsm);
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_MUL;
+
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+ nomask_PVSDST(&(pAsm->D.dst));
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0);
+ swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0);
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+ pAsm->D.dst.op3 = 1;
+
+ if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask)
+ {
+ tmp = gethelpr(pAsm);
+
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+
+ nomask_PVSDST(&(pAsm->D.dst));
+ }
+ else
+ {
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ {
+ return GL_FALSE;
+ }
+
+ swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0);
+ swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0);
+
+ // result1 + (neg) result0
+ setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE);
+ pAsm->S[2].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[2].src.reg = tmp;
+
+ neg_PVSSRC(&(pAsm->S[2].src));
+ noswizzle_PVSSRC(&(pAsm->S[2].src));
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+
+ if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask)
+ {
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+
+ // Use tmp as source
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp;
+
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ noswizzle_PVSSRC(&(pAsm->S[0].src));
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+ }
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
+{
+ return GL_TRUE;
+}
+
+GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + offset;
+
+ return GL_TRUE;
+}
+
+GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+ pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_IF(r700_AssemblerBase *pAsm)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ if(GL_TRUE != bHasElse)
+ {
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ }
+ else
+ {
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0;
+ }
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->FCSP++;
+ pAsm->fc_stack[pAsm->FCSP].type = FC_IF;
+ pAsm->fc_stack[pAsm->FCSP].bpush = 0;
+ pAsm->fc_stack[pAsm->FCSP].mid = NULL;
+ pAsm->fc_stack[pAsm->FCSP].midLen= 0;
+ pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
+
+ if(GL_TRUE != bHasElse)
+ {
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
+ }
+
+ pAsm->branch_depth++;
+
+ if(pAsm->branch_depth > pAsm->max_branch_depth)
+ {
+ pAsm->max_branch_depth = pAsm->branch_depth;
+ }
+ return GL_TRUE;
+}
+
+GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; ///
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
- next_ins(pAsm);
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ELSE;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
- /* tmp1.xy = temp2.xy */
- pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
- setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp1;
- pAsm->D.dst.writex = 1;
- pAsm->D.dst.writey = 1;
- pAsm->D.dst.writez = 0;
- pAsm->D.dst.writew = 0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp2;
- noswizzle_PVSSRC(&(pAsm->S[0].src));
+ pAsm->fc_stack[pAsm->FCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[pAsm->FCSP].mid,
+ 0,
+ sizeof(R700ControlFlowGenericClause *) );
+ pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr;
+ //pAsm->fc_stack[pAsm->FCSP].unNumMid = 1;
- next_ins(pAsm);
- pAsm->aArgSubst[1] = tmp1;
- need_barrier = GL_TRUE;
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
+
+ pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1;
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
+{
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+ if(NULL == pAsm->fc_stack[pAsm->FCSP].mid)
+ {
+ /* no else in between */
+ pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode;
+ }
+ else
+ {
+ pAsm->fc_stack[pAsm->FCSP].mid[0]->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode;
}
- pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE;
- pAsm->is_tex = GL_TRUE;
- if ( GL_TRUE == need_barrier )
+ if(NULL != pAsm->fc_stack[pAsm->FCSP].mid)
{
- pAsm->need_tex_barrier = GL_TRUE;
+ FREE(pAsm->fc_stack[pAsm->FCSP].mid);
}
- // Set src1 to tex unit id
- pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit;
- pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
- //No sw info from mesa compiler, so hard code here.
- pAsm->S[1].src.swizzlex = SQ_SEL_X;
- pAsm->S[1].src.swizzley = SQ_SEL_Y;
- pAsm->S[1].src.swizzlez = SQ_SEL_Z;
- pAsm->S[1].src.swizzlew = SQ_SEL_W;
+ if(pAsm->fc_stack[pAsm->FCSP].type != FC_IF)
+ {
+ radeon_error("if/endif in shader code are not paired. \n");
+ return GL_FALSE;
+ }
+ pAsm->branch_depth--;
+ pAsm->FCSP--;
- if( GL_FALSE == tex_dst(pAsm) )
+ return GL_TRUE;
+}
+
+GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
}
- if( GL_FALSE == tex_src(pAsm) )
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_START_NO_AL;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->FCSP++;
+ pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP;
+ pAsm->fc_stack[pAsm->FCSP].bpush = 1;
+ pAsm->fc_stack[pAsm->FCSP].mid = NULL;
+ pAsm->fc_stack[pAsm->FCSP].unNumMid = 0;
+ pAsm->fc_stack[pAsm->FCSP].midLen = 0;
+ pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
+
+ pAsm->branch_depth++;
+
+ if(pAsm->branch_depth > pAsm->max_branch_depth)
+ {
+ pAsm->max_branch_depth = pAsm->branch_depth;
+ }
+ return GL_TRUE;
+}
+
+GLboolean assemble_BRK(r700_AssemblerBase *pAsm)
+{
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ unsigned int unFCSP;
+ for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--)
+ {
+ if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
+ {
+ break;
+ }
+ }
+ if(0 == FC_LOOP)
{
+ radeon_error("Break is not inside loop/endloop pair.\n");
return GL_FALSE;
}
- if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP)
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
- /* hopefully did swizzles before */
- noswizzle_PVSSRC(&(pAsm->S[0].src));
+ return GL_FALSE;
}
-
- if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX)
+
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc(
+ (void *)pAsm->fc_stack[unFCSP].mid,
+ sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid,
+ sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) );
+ pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr;
+ pAsm->fc_stack[unFCSP].unNumMid++;
+
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
- /* SAMPLE dst, tmp.yxwy, CUBE */
- pAsm->S[0].src.swizzlex = SQ_SEL_Y;
- pAsm->S[0].src.swizzley = SQ_SEL_X;
- pAsm->S[0].src.swizzlez = SQ_SEL_W;
- pAsm->S[0].src.swizzlew = SQ_SEL_Y;
+ return GL_FALSE;
}
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP;
- if ( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+ pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+#endif //USE_CF_FOR_CONTINUE_BREAK
return GL_TRUE;
}
-GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
+GLboolean assemble_CONT(r700_AssemblerBase *pAsm)
{
- BITS tmp;
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ unsigned int unFCSP;
+ for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--)
+ {
+ if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
+ {
+ break;
+ }
+ }
+ if(0 == FC_LOOP)
+ {
+ radeon_error("Continue is not inside loop/endloop pair.\n");
+ return GL_FALSE;
+ }
- if( GL_FALSE == checkop2(pAsm) )
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
- return GL_FALSE;
+ return GL_FALSE;
}
- tmp = gethelpr(pAsm);
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
- pAsm->D.dst.opcode = SQ_OP2_INST_MUL;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_CONTINUE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
- setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
- nomask_PVSDST(&(pAsm->D.dst));
-
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc(
+ (void *)pAsm->fc_stack[unFCSP].mid,
+ sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid,
+ sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) );
+ pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr;
+ pAsm->fc_stack[unFCSP].unNumMid++;
+
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
}
- if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+ pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+
+#endif /* USE_CF_FOR_CONTINUE_BREAK */
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm)
+{
+ GLuint i;
+
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
}
-
- swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0);
- swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0);
- if( GL_FALSE == next_ins(pAsm) )
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_END;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->fc_stack[pAsm->FCSP].first->m_uIndex + 1;
+ pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ for(i=0; ifc_stack[pAsm->FCSP].unNumMid; i++)
+ {
+ pAsm->fc_stack[pAsm->FCSP].mid[i]->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex;
+ }
+ if(NULL != pAsm->fc_stack[pAsm->FCSP].mid)
+ {
+ FREE(pAsm->fc_stack[pAsm->FCSP].mid);
+ }
+#endif
+
+ if(pAsm->fc_stack[pAsm->FCSP].type != FC_LOOP)
{
+ radeon_error("loop/endloop in shader code are not paired. \n");
return GL_FALSE;
}
- pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
- pAsm->D.dst.op3 = 1;
+ unsigned int unFCSP = 0;
+ if((pAsm->unCFflags & HAS_CURRENT_LOOPRET) > 0)
+ {
+ for(unFCSP=(pAsm->FCSP-1); unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--)
+ {
+ if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
+ {
+ break;
+ }
+ }
+ if(unFCSP <= pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry)
+ {
+ unFCSP = 0;
- if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask)
- {
- tmp = gethelpr(pAsm);
+ returnOnFlag(pAsm);
+ pAsm->unCFflags &= ~HAS_CURRENT_LOOPRET;
+ }
+ }
- setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
+ pAsm->branch_depth--;
+ pAsm->FCSP--;
- nomask_PVSDST(&(pAsm->D.dst));
+ if(unFCSP > 0)
+ {
+ breakLoopOnFlag(pAsm, unFCSP);
}
- else
+
+ return GL_TRUE;
+}
+
+void add_return_inst(r700_AssemblerBase *pAsm)
+{
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
- if( GL_FALSE == assemble_dst(pAsm) )
+ return GL_FALSE;
+ }
+ //pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_RETURN;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+}
+
+GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex)
+{
+ /* Put in sub */
+ if( (pAsm->unSubArrayPointer + 1) > pAsm->unSubArraySize )
+ {
+ pAsm->subs = (SUB_OFFSET*)_mesa_realloc( (void *)pAsm->subs,
+ sizeof(SUB_OFFSET) * pAsm->unSubArraySize,
+ sizeof(SUB_OFFSET) * (pAsm->unSubArraySize + 10) );
+ if(NULL == pAsm->subs)
{
return GL_FALSE;
}
+ pAsm->unSubArraySize += 10;
}
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex;
+ pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL;
+ pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL;
+ pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0;
+
+ pAsm->CALLSP++;
+ pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP;
+ pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local
+ = &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local);
+ SetActiveCFlist(pAsm->pR700Shader,
+ pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
+
+ pAsm->unSubArrayPointer++;
+
+ /* start sub */
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm)
+{
+ pAsm->CALLSP--;
+ SetActiveCFlist(pAsm->pR700Shader,
+ pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
+
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_RET(r700_AssemblerBase *pAsm)
+{
+ if(pAsm->CALLSP > 0)
+ { /* in sub */
+ unsigned int unFCSP;
+ for(unFCSP=pAsm->FCSP; unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--)
+ {
+ if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
+ {
+ setRetInLoopFlag(pAsm, SQ_SEL_1);
+ breakLoopOnFlag(pAsm, unFCSP);
+ pAsm->unCFflags |= LOOPRET_FLAGS;
+
+ return GL_TRUE;
+ }
+ }
+ }
+
+ add_return_inst(pAsm);
+
+ return GL_TRUE;
+}
+
+GLboolean assemble_CAL(r700_AssemblerBase *pAsm,
+ GLint nILindex,
+ GLuint uiNumberInsts,
+ struct prog_instruction *pILInst)
+{
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+
+ if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
}
- if( GL_FALSE == assemble_src(pAsm, 1, -1) )
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.call_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_CALL;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ /* Put in caller */
+ if( (pAsm->unCallerArrayPointer + 1) > pAsm->unCallerArraySize )
{
- return GL_FALSE;
+ pAsm->callers = (CALLER_POINTER*)_mesa_realloc( (void *)pAsm->callers,
+ sizeof(CALLER_POINTER) * pAsm->unCallerArraySize,
+ sizeof(CALLER_POINTER) * (pAsm->unCallerArraySize + 10) );
+ if(NULL == pAsm->callers)
+ {
+ return GL_FALSE;
+ }
+ pAsm->unCallerArraySize += 10;
}
-
- swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0);
- swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0);
+
+ pAsm->callers[pAsm->unCallerArrayPointer].subIL_Offset = nILindex;
+ pAsm->callers[pAsm->unCallerArrayPointer].cf_ptr = pAsm->cf_current_cf_clause_ptr;
- // result1 + (neg) result0
- setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE);
- pAsm->S[2].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[2].src.reg = tmp;
+ pAsm->unCallerArrayPointer++;
- neg_PVSSRC(&(pAsm->S[2].src));
- noswizzle_PVSSRC(&(pAsm->S[2].src));
+ int j;
+ for(j=0; junSubArrayPointer; j++)
+ {
+ if(nILindex == pAsm->subs[j].subIL_Offset)
+ { /* compiled before */
+ pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = j;
+ return GL_TRUE;
+ }
+ }
+
+ pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer;
+
+ return AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm);
+}
+
+GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue)
+{
+ GLfloat fLiteral[2] = {0.1, 0.0};
+
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+ pAsm->D.dst.op3 = 0;
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = pAsm->flag_reg_index;
+ pAsm->D.dst.writex = 1;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
+ pAsm->D2.dst2.literal = 1;
+ pAsm->D2.dst2.SaturateMode = SATURATE_OFF;
+ pAsm->D.dst.predicated = 0;
+#if 0
+ pAsm->S[0].src.rtype = SRC_REC_LITERAL;
+ //pAsm->S[0].src.reg = 0;
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.swizzlex = SQ_SEL_X;
+ pAsm->S[0].src.swizzley = SQ_SEL_Y;
+ pAsm->S[0].src.swizzlez = SQ_SEL_Z;
+ pAsm->S[0].src.swizzlew = SQ_SEL_W;
+
+ if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) )
+ {
+ return GL_FALSE;
+ }
+#else
+ pAsm->S[0].src.rtype = DST_REG_TEMPORARY;
+ pAsm->S[0].src.reg = 0;
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.swizzlex = flagValue;
+ pAsm->S[0].src.swizzley = flagValue;
+ pAsm->S[0].src.swizzlez = flagValue;
+ pAsm->S[0].src.swizzlew = flagValue;
- if( GL_FALSE == next_ins(pAsm) )
+ if( GL_FALSE == next_ins2(pAsm) )
{
return GL_FALSE;
}
+#endif
+ return GL_TRUE;
+}
- if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask)
- {
- if( GL_FALSE == assemble_dst(pAsm) )
- {
- return GL_FALSE;
- }
+GLboolean testFlag(r700_AssemblerBase *pAsm)
+{
+ GLfloat fLiteral[2] = {0.1, 0.0};
- pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+ //Test flag
+ GLuint tmp = gethelpr(pAsm);
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
- // Use tmp as source
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp;
+ pAsm->D.dst.opcode = SQ_OP2_INST_PRED_SETE;
+ pAsm->D.dst.math = 1;
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+ pAsm->D.dst.writex = 1;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
+ pAsm->D2.dst2.literal = 1;
+ pAsm->D2.dst2.SaturateMode = SATURATE_OFF;
+ pAsm->D.dst.predicated = 1;
- noneg_PVSSRC(&(pAsm->S[0].src));
- noswizzle_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.rtype = DST_REG_TEMPORARY;
+ pAsm->S[0].src.reg = pAsm->flag_reg_index;
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.swizzlex = SQ_SEL_X;
+ pAsm->S[0].src.swizzley = SQ_SEL_Y;
+ pAsm->S[0].src.swizzlez = SQ_SEL_Z;
+ pAsm->S[0].src.swizzlew = SQ_SEL_W;
+#if 0
+ pAsm->S[1].src.rtype = SRC_REC_LITERAL;
+ //pAsm->S[1].src.reg = 0;
+ setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[1].src));
+ pAsm->S[1].src.swizzlex = SQ_SEL_X;
+ pAsm->S[1].src.swizzley = SQ_SEL_Y;
+ pAsm->S[1].src.swizzlez = SQ_SEL_Z;
+ pAsm->S[1].src.swizzlew = SQ_SEL_W;
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) )
+ {
+ return GL_FALSE;
+ }
+#else
+ pAsm->S[1].src.rtype = DST_REG_TEMPORARY;
+ pAsm->S[1].src.reg = 0;
+ setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[1].src));
+ pAsm->S[1].src.swizzlex = SQ_SEL_1;
+ pAsm->S[1].src.swizzley = SQ_SEL_1;
+ pAsm->S[1].src.swizzlez = SQ_SEL_1;
+ pAsm->S[1].src.swizzlew = SQ_SEL_1;
+
+ if( GL_FALSE == next_ins2(pAsm) )
+ {
+ return GL_FALSE;
}
+#endif
return GL_TRUE;
}
-GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
+GLboolean returnOnFlag(r700_AssemblerBase *pAsm)
{
- return GL_TRUE;
-}
+ testFlag(pAsm);
+ jumpToOffest(pAsm, 1, 4);
+ setRetInLoopFlag(pAsm, SQ_SEL_0);
+ pops(pAsm, 1);
+ add_return_inst(pAsm);
-GLboolean assemble_IF(r700_AssemblerBase *pAsm)
-{
return GL_TRUE;
}
-GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
+GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP)
{
+ testFlag(pAsm);
+
+ //break
+ if(GL_FALSE == add_cf_instruction(pAsm) )
+ {
+ return GL_FALSE;
+ }
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0;
+
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
+
+ pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc(
+ (void *)pAsm->fc_stack[unFCSP].mid,
+ sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid,
+ sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) );
+ pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr;
+ pAsm->fc_stack[unFCSP].unNumMid++;
+
+ pops(pAsm, 1);
+
return GL_TRUE;
}
-GLboolean AssembleInstr(GLuint uiNumberInsts,
+GLboolean AssembleInstr(GLuint uiFirstInst,
+ GLuint uiNumberInsts,
struct prog_instruction *pILInst,
r700_AssemblerBase *pR700AsmCode)
{
GLuint i;
pR700AsmCode->pILInst = pILInst;
- for(i=0; iuiCurInst = i;
+#ifndef USE_CF_FOR_CONTINUE_BREAK
+ if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+ switch(pILInst[i].Opcode)
+ {
+ case OPCODE_SLE:
+ pILInst[i].Opcode = OPCODE_SGT;
+ break;
+ case OPCODE_SLT:
+ pILInst[i].Opcode = OPCODE_SGE;
+ break;
+ case OPCODE_SGE:
+ pILInst[i].Opcode = OPCODE_SLT;
+ break;
+ case OPCODE_SGT:
+ pILInst[i].Opcode = OPCODE_SLE;
+ break;
+ case OPCODE_SEQ:
+ pILInst[i].Opcode = OPCODE_SNE;
+ break;
+ case OPCODE_SNE:
+ pILInst[i].Opcode = OPCODE_SEQ;
+ break;
+ default:
+ break;
+ }
+ }
+#endif
+
switch (pILInst[i].Opcode)
{
case OPCODE_ABS:
@@ -4337,101 +5749,383 @@ GLboolean AssembleInstr(GLuint uiNumberInsts,
return GL_FALSE;
break;
- case OPCODE_EX2:
- if ( GL_FALSE == assemble_EX2(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_EXP:
- if ( GL_FALSE == assemble_EXP(pR700AsmCode) )
- return GL_FALSE;
+ case OPCODE_EX2:
+ if ( GL_FALSE == assemble_EX2(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_EXP:
+ if ( GL_FALSE == assemble_EXP(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_FLR:
+ if ( GL_FALSE == assemble_FLR(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ //case OP_FLR_INT:
+ // if ( GL_FALSE == assemble_FLR_INT() )
+ // return GL_FALSE;
+ // break;
+
+ case OPCODE_FRC:
+ if ( GL_FALSE == assemble_FRC(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_KIL:
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_LG2:
+ if ( GL_FALSE == assemble_LG2(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_LIT:
+ if ( GL_FALSE == assemble_LIT(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_LRP:
+ if ( GL_FALSE == assemble_LRP(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_LOG:
+ if ( GL_FALSE == assemble_LOG(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_MAD:
+ if ( GL_FALSE == assemble_MAD(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_MAX:
+ if ( GL_FALSE == assemble_MAX(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_MIN:
+ if ( GL_FALSE == assemble_MIN(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_MOV:
+ if ( GL_FALSE == assemble_MOV(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_MUL:
+ if ( GL_FALSE == assemble_MUL(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_POW:
+ if ( GL_FALSE == assemble_POW(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_RCP:
+ if ( GL_FALSE == assemble_RCP(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_RSQ:
+ if ( GL_FALSE == assemble_RSQ(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_SIN:
+ if ( GL_FALSE == assemble_SIN(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+ case OPCODE_SCS:
+ if ( GL_FALSE == assemble_SCS(pR700AsmCode) )
+ return GL_FALSE;
+ break;
+
+ case OPCODE_SEQ:
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ break;
+
+ case OPCODE_SGT:
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
+
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) )
+ {
+ return GL_FALSE;
+ }
+ }
+ break;
+
+ case OPCODE_SGE:
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
+
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_SGE(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ }
+ break;
+
+ /* NO LT, LE, TODO : use GE => LE, GT => LT : reverse 2 src order would be simpliest. Or use SQ_CF_COND_FALSE for SQ_CF_COND_ACTIVE.*/
+ case OPCODE_SLT:
+ {
+ struct prog_src_register SrcRegSave[2];
+ SrcRegSave[0] = pILInst[i].SrcReg[0];
+ SrcRegSave[1] = pILInst[i].SrcReg[1];
+ pILInst[i].SrcReg[0] = SrcRegSave[1];
+ pILInst[i].SrcReg[1] = SrcRegSave[0];
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
+
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ }
break;
- case OPCODE_FLR:
- if ( GL_FALSE == assemble_FLR(pR700AsmCode) )
- return GL_FALSE;
- break;
- //case OP_FLR_INT:
- // if ( GL_FALSE == assemble_FLR_INT() )
- // return GL_FALSE;
- // break;
-
- case OPCODE_FRC:
- if ( GL_FALSE == assemble_FRC(pR700AsmCode) )
- return GL_FALSE;
- break;
+ case OPCODE_SLE:
+ {
+ struct prog_src_register SrcRegSave[2];
+ SrcRegSave[0] = pILInst[i].SrcReg[0];
+ SrcRegSave[1] = pILInst[i].SrcReg[1];
+ pILInst[i].SrcReg[0] = SrcRegSave[1];
+ pILInst[i].SrcReg[1] = SrcRegSave[0];
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
- case OPCODE_KIL:
- if ( GL_FALSE == assemble_KIL(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_LG2:
- if ( GL_FALSE == assemble_LG2(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_LIT:
- if ( GL_FALSE == assemble_LIT(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_LRP:
- if ( GL_FALSE == assemble_LRP(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_LOG:
- if ( GL_FALSE == assemble_LOG(pR700AsmCode) )
- return GL_FALSE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) )
+ {
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ return GL_FALSE;
+ }
+ }
+ pILInst[i].SrcReg[0] = SrcRegSave[0];
+ pILInst[i].SrcReg[1] = SrcRegSave[1];
+ }
break;
- case OPCODE_MAD:
- if ( GL_FALSE == assemble_MAD(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_MAX:
- if ( GL_FALSE == assemble_MAX(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_MIN:
- if ( GL_FALSE == assemble_MIN(pR700AsmCode) )
- return GL_FALSE;
- break;
-
- case OPCODE_MOV:
- if ( GL_FALSE == assemble_MOV(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_MUL:
- if ( GL_FALSE == assemble_MUL(pR700AsmCode) )
- return GL_FALSE;
- break;
-
- case OPCODE_POW:
- if ( GL_FALSE == assemble_POW(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_RCP:
- if ( GL_FALSE == assemble_RCP(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_RSQ:
- if ( GL_FALSE == assemble_RSQ(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_SIN:
- if ( GL_FALSE == assemble_SIN(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_SCS:
- if ( GL_FALSE == assemble_SCS(pR700AsmCode) )
- return GL_FALSE;
- break;
-
- case OPCODE_SGE:
- if ( GL_FALSE == assemble_SGE(pR700AsmCode) )
- return GL_FALSE;
- break;
- case OPCODE_SLT:
- if ( GL_FALSE == assemble_SLT(pR700AsmCode) )
- return GL_FALSE;
- break;
+ case OPCODE_SNE:
+ if(OPCODE_IF == pILInst[i+1].Opcode)
+ {
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_BRK == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else if(OPCODE_CONT == pILInst[i+1].Opcode)
+ {
+#ifdef USE_CF_FOR_CONTINUE_BREAK
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE;
+#else
+ pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE;
+#endif
+ if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ else
+ {
+ if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) )
+ {
+ return GL_FALSE;
+ }
+ }
+ break;
//case OP_STP:
// if ( GL_FALSE == assemble_STP(pR700AsmCode) )
@@ -4471,24 +6165,91 @@ GLboolean AssembleInstr(GLuint uiNumberInsts,
break;
case OPCODE_IF :
- if ( GL_FALSE == assemble_IF(pR700AsmCode) )
- return GL_FALSE;
+ {
+ GLboolean bHasElse = GL_FALSE;
+
+ if(pILInst[pILInst[i].BranchTarget - 1].Opcode == OPCODE_ELSE)
+ {
+ bHasElse = GL_TRUE;
+ }
+
+ if ( GL_FALSE == assemble_IF(pR700AsmCode, bHasElse) )
+ {
+ return GL_FALSE;
+ }
+ }
break;
+
case OPCODE_ELSE :
- radeon_error("Not yet implemented instruction OPCODE_ELSE \n");
- //if ( GL_FALSE == assemble_BAD("ELSE") )
+ if ( GL_FALSE == assemble_ELSE(pR700AsmCode) )
return GL_FALSE;
break;
+
case OPCODE_ENDIF:
if ( GL_FALSE == assemble_ENDIF(pR700AsmCode) )
return GL_FALSE;
break;
+ case OPCODE_BGNLOOP:
+ if( GL_FALSE == assemble_BGNLOOP(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_BRK:
+ if( GL_FALSE == assemble_BRK(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_CONT:
+ if( GL_FALSE == assemble_CONT(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_ENDLOOP:
+ if( GL_FALSE == assemble_ENDLOOP(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_BGNSUB:
+ if( GL_FALSE == assemble_BGNSUB(pR700AsmCode, i) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_RET:
+ if( GL_FALSE == assemble_RET(pR700AsmCode) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
+ case OPCODE_CAL:
+ if( GL_FALSE == assemble_CAL(pR700AsmCode,
+ pILInst[i].BranchTarget,
+ uiNumberInsts,
+ pILInst) )
+ {
+ return GL_FALSE;
+ }
+ break;
+
//case OPCODE_EXPORT:
// if ( GL_FALSE == assemble_EXPORT() )
// return GL_FALSE;
// break;
+ case OPCODE_ENDSUB:
+ return assemble_ENDSUB(pR700AsmCode);
+
case OPCODE_END:
//pR700AsmCode->uiCurInst = i;
//This is to remaind that if in later exoort there is depth/stencil
@@ -4505,6 +6266,116 @@ GLboolean AssembleInstr(GLuint uiNumberInsts,
return GL_TRUE;
}
+GLboolean InitShaderProgram(r700_AssemblerBase * pAsm)
+{
+ setRetInLoopFlag(pAsm, SQ_SEL_0);
+ return GL_TRUE;
+}
+
+GLboolean RelocProgram(r700_AssemblerBase * pAsm)
+{
+ GLuint i;
+ GLuint unCFoffset;
+ TypedShaderList * plstCFmain;
+ TypedShaderList * plstCFsub;
+
+ R700ShaderInstruction * pInst;
+ R700ControlFlowGenericClause * pCFInst;
+
+ if(0 == pAsm->unSubArrayPointer)
+ {
+ return GL_TRUE;
+ }
+
+ plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local;
+ unCFoffset = plstCFmain->uNumOfNode;
+
+ /* Reloc subs */
+ for(i=0; iunSubArrayPointer; i++)
+ {
+ pAsm->subs[i].unCFoffset = unCFoffset;
+ plstCFsub = &(pAsm->subs[i].lstCFInstructions_local);
+
+ pInst = plstCFsub->pHead;
+
+ /* reloc instructions */
+ while(pInst)
+ {
+ if(SIT_CF_GENERIC == pInst->m_ShaderInstType)
+ {
+ pCFInst = (R700ControlFlowGenericClause *)pInst;
+
+ switch (pCFInst->m_Word1.f.cf_inst)
+ {
+ case SQ_CF_INST_POP:
+ case SQ_CF_INST_JUMP:
+ case SQ_CF_INST_ELSE:
+ case SQ_CF_INST_LOOP_END:
+ case SQ_CF_INST_LOOP_START:
+ case SQ_CF_INST_LOOP_START_NO_AL:
+ case SQ_CF_INST_LOOP_CONTINUE:
+ case SQ_CF_INST_LOOP_BREAK:
+ pCFInst->m_Word0.f.addr += unCFoffset;
+ break;
+ default:
+ break;
+ }
+ }
+
+ pInst->m_uIndex += unCFoffset;
+
+ pInst = pInst->pNextInst;
+ };
+
+ /* Put sub into main */
+ plstCFmain->pTail->pNextInst = plstCFsub->pHead;
+ plstCFmain->pTail = plstCFsub->pTail;
+ plstCFmain->uNumOfNode += plstCFsub->uNumOfNode;
+
+ unCFoffset += plstCFsub->uNumOfNode;
+ }
+
+ /* reloc callers */
+ for(i=0; iunCallerArrayPointer; i++)
+ {
+ pAsm->callers[i].cf_ptr->m_Word0.f.addr
+ = pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset;
+ }
+
+ /* remove flags init if they are not used */
+ if((pAsm->unCFflags & HAS_LOOPRET) == 0)
+ {
+ R700ControlFlowALUClause * pCF_ALU;
+ pInst = plstCFmain->pHead;
+ while(pInst)
+ {
+ if(SIT_CF_ALU == pInst->m_ShaderInstType)
+ {
+ pCF_ALU = (R700ControlFlowALUClause *)pInst;
+ if(1 == pCF_ALU->m_Word1.f.count)
+ {
+ pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP;
+ }
+ else
+ {
+ R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction;
+
+ pALU->m_pLinkedALUClause = NULL;
+ pALU = (R700ALUInstruction *)(pALU->pNextInst);
+ pALU->m_pLinkedALUClause = pCF_ALU;
+ pCF_ALU->m_pLinkedALUInstruction = pALU;
+
+ pCF_ALU->m_Word1.f.count--;
+ }
+ break;
+ }
+ pInst = pInst->pNextInst;
+ };
+ }
+
+ return GL_TRUE;
+}
+
GLboolean Process_Export(r700_AssemblerBase* pAsm,
GLuint type,
GLuint export_starting_index,
@@ -4800,6 +6671,25 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode,
}
}
+ for(i=VERT_RESULT_VAR0; iucVP_OutputMap[i],
+ GL_FALSE) )
+ {
+ return GL_FALSE;
+ }
+
+ export_starting_index++;
+ }
+ }
+
// At least one param should be exported
if (export_count)
{
@@ -4833,6 +6723,16 @@ GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode)
{
FREE(pR700AsmCode->pucOutMask);
FREE(pR700AsmCode->pInstDeps);
+
+ if(NULL != pR700AsmCode->subs)
+ {
+ FREE(pR700AsmCode->subs);
+ }
+ if(NULL != pR700AsmCode->callers)
+ {
+ FREE(pR700AsmCode->callers);
+ }
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index c66db502a1..85d32212c0 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -72,7 +72,8 @@ typedef enum SrcRegisterType
SRC_REG_INPUT = 1,
SRC_REG_CONSTANT = 2,
SRC_REG_ALT_TEMPORARY = 3,
- NUMBER_OF_SRC_REG_TYPE = 4
+ SRC_REC_LITERAL = 4,
+ NUMBER_OF_SRC_REG_TYPE = 5
} SrcRegisterType;
typedef enum DstRegisterType
@@ -111,6 +112,12 @@ typedef struct PVSDSTtag
BITS addrmode1:1; //32
} PVSDST;
+typedef struct PVSINSTtag
+{
+ BITS literal :2;
+ BITS SaturateMode :2;
+} PVSINST;
+
typedef struct PVSSRCtag
{
BITS rtype:4;
@@ -148,6 +155,7 @@ typedef union PVSDWORDtag
{
BITS bits;
PVSDST dst;
+ PVSINST dst2;
PVSSRC src;
PVSMATH math;
float f;
@@ -263,14 +271,15 @@ enum
typedef struct FC_LEVEL
{
- unsigned int first; ///< first fc instruction on level (if, rep, loop)
- unsigned int* mid; ///< middle instructions - else or all breaks on this level
- unsigned int midLen;
- unsigned int type;
- unsigned int cond;
- unsigned int inv;
- unsigned int bpush; ///< 1 if first instruction does branch stack push
- int id; ///< id of bool or int variable
+ R700ControlFlowGenericClause * first;
+ R700ControlFlowGenericClause ** mid;
+ unsigned int unNumMid;
+ unsigned int midLen;
+ unsigned int type;
+ unsigned int cond;
+ unsigned int inv;
+ unsigned int bpush; ///< 1 if first instruction does branch stack push
+ int id; ///< id of bool or int variable
} FC_LEVEL;
typedef struct VTX_FETCH_METHOD
@@ -279,6 +288,28 @@ typedef struct VTX_FETCH_METHOD
GLuint mega_fetch_remainder;
} VTX_FETCH_METHOD;
+typedef struct SUB_OFFSET
+{
+ GLint subIL_Offset;
+ GLuint unCFoffset;
+ TypedShaderList lstCFInstructions_local;
+} SUB_OFFSET;
+
+typedef struct CALLER_POINTER
+{
+ GLint subIL_Offset;
+ GLint subDescIndex;
+ R700ControlFlowGenericClause* cf_ptr;
+} CALLER_POINTER;
+
+#define SQ_MAX_CALL_DEPTH 0x00000020
+
+typedef struct CALL_LEVEL
+{
+ unsigned int FCSP_BeforeEntry;
+ TypedShaderList * plstCFInstructions_local;
+} CALL_LEVEL;
+
typedef struct r700_AssemblerBase
{
R700ControlFlowSXClause* cf_last_export_ptr;
@@ -294,11 +325,14 @@ typedef struct r700_AssemblerBase
// No clause has been created yet
CF_CLAUSE_TYPE cf_current_clause_type;
+ BITS alu_x_opcode;
+
GLuint number_of_exports;
GLuint number_of_colorandz_exports;
GLuint number_of_export_opcodes;
PVSDWORD D;
+ PVSDWORD D2;
PVSDWORD S[3];
unsigned int uLastPosUpdate;
@@ -310,6 +344,8 @@ typedef struct r700_AssemblerBase
unsigned int number_used_registers;
unsigned int uUsedConsts;
+ unsigned int flag_reg_index;
+
// Fragment programs
unsigned int uiFP_AttributeMap[FRAG_ATTRIB_MAX];
unsigned int uiFP_OutputMap[FRAG_RESULT_MAX];
@@ -378,6 +414,18 @@ typedef struct r700_AssemblerBase
GLboolean is_tex;
/* we inserted helper intructions and need barrier on next TEX ins */
GLboolean need_tex_barrier;
+
+ SUB_OFFSET * subs;
+ GLuint unSubArraySize;
+ GLuint unSubArrayPointer;
+ CALLER_POINTER * callers;
+ GLuint unCallerArraySize;
+ GLuint unCallerArrayPointer;
+ unsigned int CALLSP;
+ CALL_LEVEL CALLSTACK[SQ_MAX_CALL_DEPTH];
+
+ GLuint unCFflags;
+
} r700_AssemblerBase;
//Internal use
@@ -446,6 +494,10 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr,
GLboolean add_alu_instruction(r700_AssemblerBase* pAsm,
R700ALUInstruction* alu_instruction_ptr,
GLuint contiguous_slots_needed);
+
+GLboolean add_cf_instruction(r700_AssemblerBase* pAsm);
+void add_return_inst(r700_AssemblerBase *pAsm);
+
void get_src_properties(R700ALUInstruction* alu_instruction_ptr,
int source_index,
BITS* psrc_sel,
@@ -467,6 +519,21 @@ GLboolean check_vector(r700_AssemblerBase* pAsm,
R700ALUInstruction* alu_instruction_ptr);
GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm);
GLboolean next_ins(r700_AssemblerBase *pAsm);
+
+GLboolean next_ins2(r700_AssemblerBase *pAsm);
+GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm);
+
+/* TODO : merge next_ins/2/literal, assemble_alu_instruction/2/literal */
+GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral);
+GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral);
+
+GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops);
+GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset);
+GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue);
+GLboolean testFlag(r700_AssemblerBase *pAsm);
+GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP);
+GLboolean returnOnFlag(r700_AssemblerBase *pAsm);
+
GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode);
GLboolean assemble_ABS(r700_AssemblerBase *pAsm);
GLboolean assemble_ADD(r700_AssemblerBase *pAsm);
@@ -497,14 +564,32 @@ GLboolean assemble_RSQ(r700_AssemblerBase *pAsm);
GLboolean assemble_SIN(r700_AssemblerBase *pAsm);
GLboolean assemble_SCS(r700_AssemblerBase *pAsm);
GLboolean assemble_SGE(r700_AssemblerBase *pAsm);
+
+GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode);
+GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode);
+
GLboolean assemble_SLT(r700_AssemblerBase *pAsm);
GLboolean assemble_STP(r700_AssemblerBase *pAsm);
GLboolean assemble_TEX(r700_AssemblerBase *pAsm);
GLboolean assemble_XPD(r700_AssemblerBase *pAsm);
GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm);
-GLboolean assemble_IF(r700_AssemblerBase *pAsm);
+GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse);
+GLboolean assemble_ELSE(r700_AssemblerBase *pAsm);
GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm);
+GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm);
+GLboolean assemble_BRK(r700_AssemblerBase *pAsm);
+GLboolean assemble_COND(r700_AssemblerBase *pAsm);
+GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm);
+
+GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex);
+GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm);
+GLboolean assemble_RET(r700_AssemblerBase *pAsm);
+GLboolean assemble_CAL(r700_AssemblerBase *pAsm,
+ GLint nILindex,
+ GLuint uiNumberInsts,
+ struct prog_instruction *pILInst);
+
GLboolean Process_Export(r700_AssemblerBase* pAsm,
GLuint type,
GLuint export_starting_index,
@@ -516,12 +601,16 @@ GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm,
//Interface
-GLboolean AssembleInstr(GLuint uiNumberInsts,
+GLboolean AssembleInstr(GLuint uiFirstInst,
+ GLuint uiNumberInsts,
struct prog_instruction *pILInst,
r700_AssemblerBase *pR700AsmCode);
GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten);
GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten);
+GLboolean RelocProgram(r700_AssemblerBase * pAsm);
+GLboolean InitShaderProgram(r700_AssemblerBase * pAsm);
+
int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader);
GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode);
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index ec76fbcb6d..197916ac0d 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -442,68 +442,77 @@ static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom *
static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom)
{
- context_t *context = R700_CONTEXT(ctx);
- R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
- struct radeon_bo * pbo;
- BATCH_LOCALS(&context->radeon);
- radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
+ context_t *context = R700_CONTEXT(ctx);
+ R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
+ struct radeon_bo * pbo;
+ BATCH_LOCALS(&context->radeon);
+ radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
- pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(GL_CONTEXT(context));
+ pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(GL_CONTEXT(context));
- if (!pbo)
- return;
+ if (!pbo)
+ return;
- r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
+ r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
- BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
- R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1);
- R600_OUT_BATCH(r700->ps.SQ_PGM_START_PS.u32All);
- R600_OUT_BATCH_RELOC(r700->ps.SQ_PGM_START_PS.u32All,
- pbo,
- r700->ps.SQ_PGM_START_PS.u32All,
- RADEON_GEM_DOMAIN_GTT, 0, 0);
- END_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1);
+ R600_OUT_BATCH(r700->ps.SQ_PGM_START_PS.u32All);
+ R600_OUT_BATCH_RELOC(r700->ps.SQ_PGM_START_PS.u32All,
+ pbo,
+ r700->ps.SQ_PGM_START_PS.u32All,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
- BEGIN_BATCH_NO_AUTOSTATE(9);
- R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, r700->ps.SQ_PGM_RESOURCES_PS.u32All);
- R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, r700->ps.SQ_PGM_EXPORTS_PS.u32All);
- R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, r700->ps.SQ_PGM_CF_OFFSET_PS.u32All);
- END_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(9);
+ R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, r700->ps.SQ_PGM_RESOURCES_PS.u32All);
+ R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, r700->ps.SQ_PGM_EXPORTS_PS.u32All);
+ R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, r700->ps.SQ_PGM_CF_OFFSET_PS.u32All);
+ END_BATCH();
- COMMIT_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ R600_OUT_BATCH_REGVAL(SQ_LOOP_CONST_0, 0x01000FFF);
+ END_BATCH();
+
+ COMMIT_BATCH();
}
static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom)
{
- context_t *context = R700_CONTEXT(ctx);
- R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
- struct radeon_bo * pbo;
- BATCH_LOCALS(&context->radeon);
- radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
+ context_t *context = R700_CONTEXT(ctx);
+ R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
+ struct radeon_bo * pbo;
+ BATCH_LOCALS(&context->radeon);
+ radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
- pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context));
+ pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context));
- if (!pbo)
- return;
+ if (!pbo)
+ return;
- r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
+ r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
- BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
- R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1);
- R600_OUT_BATCH(r700->vs.SQ_PGM_START_VS.u32All);
- R600_OUT_BATCH_RELOC(r700->vs.SQ_PGM_START_VS.u32All,
- pbo,
- r700->vs.SQ_PGM_START_VS.u32All,
- RADEON_GEM_DOMAIN_GTT, 0, 0);
- END_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1);
+ R600_OUT_BATCH(r700->vs.SQ_PGM_START_VS.u32All);
+ R600_OUT_BATCH_RELOC(r700->vs.SQ_PGM_START_VS.u32All,
+ pbo,
+ r700->vs.SQ_PGM_START_VS.u32All,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
- BEGIN_BATCH_NO_AUTOSTATE(6);
- R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, r700->vs.SQ_PGM_RESOURCES_VS.u32All);
- R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, r700->vs.SQ_PGM_CF_OFFSET_VS.u32All);
- END_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(6);
+ R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, r700->vs.SQ_PGM_RESOURCES_VS.u32All);
+ R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, r700->vs.SQ_PGM_CF_OFFSET_VS.u32All);
+ END_BATCH();
- COMMIT_BATCH();
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + 32*4), 0x0100000F);
+ //R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F);
+ END_BATCH();
+
+ COMMIT_BATCH();
}
static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom)
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index ccafd433bf..21ac46e7b8 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -73,11 +73,11 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++;
}
- unBit = 1 << FRAG_ATTRIB_FOGC;
- if(mesa_fp->Base.InputsRead & unBit)
- {
- pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++;
- }
+ unBit = 1 << FRAG_ATTRIB_FOGC;
+ if(mesa_fp->Base.InputsRead & unBit)
+ {
+ pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++;
+ }
for(i=0; i<8; i++)
{
@@ -88,6 +88,62 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
}
}
+/* order has been taken care of */
+#if 1
+ for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit)
+ {
+ pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers++;
+ }
+ }
+#else
+ if( (mesa_fp->Base.InputsRead >> FRAG_ATTRIB_VAR0) > 0 )
+ {
+ struct r700_vertex_program_cont *vpc =
+ (struct r700_vertex_program_cont *)ctx->VertexProgram._Current;
+ struct gl_program_parameter_list * VsVarying = vpc->mesa_program.Base.Varying;
+ struct gl_program_parameter_list * PsVarying = mesa_fp->Base.Varying;
+ struct gl_program_parameter * pVsParam;
+ struct gl_program_parameter * pPsParam;
+ GLuint j, k;
+ GLuint unMaxVarying = 0;
+
+ for(i=0; iNumParameters; i++)
+ {
+ pAsm->uiFP_AttributeMap[i + FRAG_ATTRIB_VAR0] = 0;
+ }
+
+ for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit)
+ {
+ j = i - FRAG_ATTRIB_VAR0;
+ pPsParam = PsVarying->Parameters + j;
+
+ for(k=0; kNumParameters; k++)
+ {
+ pVsParam = VsVarying->Parameters + k;
+
+ if( strcmp(pPsParam->Name, pVsParam->Name) == 0)
+ {
+ pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers + k;
+ if(k > unMaxVarying)
+ {
+ unMaxVarying = k;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ pAsm->number_used_registers += unMaxVarying + 1;
+ }
+#endif
+
/* Map temporary registers (GPRs) */
pAsm->starting_temp_register_number = pAsm->number_used_registers;
@@ -127,6 +183,8 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
pAsm->pucOutMask[ui] = 0x0;
}
+ pAsm->flag_reg_index = pAsm->number_used_registers++;
+
pAsm->uFirstHelpReg = pAsm->number_used_registers;
}
@@ -247,8 +305,11 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
{
return GL_FALSE;
}
+
+ InitShaderProgram(&(fp->r700AsmCode));
- if( GL_FALSE == AssembleInstr(mesa_fp->Base.NumInstructions,
+ if( GL_FALSE == AssembleInstr(0,
+ mesa_fp->Base.NumInstructions,
&(mesa_fp->Base.Instructions[0]),
&(fp->r700AsmCode)) )
{
@@ -260,6 +321,11 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
return GL_FALSE;
}
+ if( GL_FALSE == RelocProgram(&(fp->r700AsmCode)) )
+ {
+ return GL_FALSE;
+ }
+
fp->r700Shader.nRegs = (fp->r700AsmCode.number_used_registers == 0) ? 0
: (fp->r700AsmCode.number_used_registers - 1);
@@ -459,6 +525,22 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
}
}
+ for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit)
+ {
+ ui = pAsm->uiFP_AttributeMap[i];
+ SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit);
+ SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui,
+ SEMANTIC_shift, SEMANTIC_mask);
+ if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit)
+ SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit);
+ else
+ CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit);
+ }
+ }
+
exportCount = (r700->ps.SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift);
if (r700->CB_SHADER_CONTROL.u32All != ((1 << exportCount) - 1))
{
diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c
index 955ea4e4e1..2eed1acc2f 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.c
+++ b/src/mesa/drivers/dri/r600/r700_shader.c
@@ -159,13 +159,18 @@ void Init_R700_Shader(R700_Shader * pShader)
pShader->lstVTXInstructions.uNumOfNode=0;
}
+void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF)
+{
+ pShader->plstCFInstructions_active = plstCF;
+}
+
void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst)
{
R700ControlFlowSXClause* pSXClause;
R700ControlFlowSMXClause* pSMXClause;
- pCFInst->m_uIndex = pShader->lstCFInstructions.uNumOfNode;
- AddInstToList(&(pShader->lstCFInstructions),
+ pCFInst->m_uIndex = pShader->plstCFInstructions_active->uNumOfNode;
+ AddInstToList(pShader->plstCFInstructions_active,
(R700ShaderInstruction*)pCFInst);
pShader->uShaderBinaryDWORDSize += GetInstructionSize(pCFInst->m_ShaderInstType);
diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h
index c6a058617e..0599ffd901 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.h
+++ b/src/mesa/drivers/dri/r600/r700_shader.h
@@ -109,6 +109,7 @@ typedef struct R700_Shader
GLuint uStackSize;
GLuint uMaxCallDepth;
+ TypedShaderList * plstCFInstructions_active;
TypedShaderList lstCFInstructions;
TypedShaderList lstALUInstructions;
TypedShaderList lstTEXInstructions;
@@ -132,13 +133,13 @@ void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruc
void ResolveLinks(R700_Shader *pShader);
void Assemble(R700_Shader *pShader);
-
//Interface
void Init_R700_Shader(R700_Shader * pShader);
void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst);
void AddVTXInstruction(R700_Shader *pShader, R700VertexInstruction *pVTXInst);
void AddTEXInstruction(R700_Shader *pShader, R700TextureInstruction *pTEXInst);
void AddALUInstruction(R700_Shader *pShader, R700ALUInstruction *pALUInst);
+void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF);
void LoadProgram(R700_Shader *pShader);
void UpdateShaderRegisters(R700_Shader *pShader);
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index ffc6068bd8..c8f72d588b 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -111,6 +111,15 @@ unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm,
}
}
+ for(i=VERT_RESULT_VAR0; iBase.OutputsWritten & unBit)
+ {
+ pAsm->ucVP_OutputMap[i] = unTotal++;
+ }
+ }
+
return (unTotal - unStart);
}
@@ -235,6 +244,8 @@ void Map_Vertex_Program(GLcontext *ctx,
pAsm->number_used_registers += mesa_vp->Base.NumTemporaries;
}
+ pAsm->flag_reg_index = pAsm->number_used_registers++;
+
pAsm->uFirstHelpReg = pAsm->number_used_registers;
}
@@ -324,7 +335,10 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
return NULL;
}
- if(GL_FALSE == AssembleInstr(vp->mesa_program->Base.NumInstructions,
+ InitShaderProgram(&(vp->r700AsmCode));
+
+ if(GL_FALSE == AssembleInstr(0,
+ vp->mesa_program->Base.NumInstructions,
&(vp->mesa_program->Base.Instructions[0]),
&(vp->r700AsmCode)) )
{
@@ -336,6 +350,11 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
return NULL;
}
+ if( GL_FALSE == RelocProgram(&(vp->r700AsmCode)) )
+ {
+ return GL_FALSE;
+ }
+
vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0
: (vp->r700AsmCode.number_used_registers - 1);
--
cgit v1.2.3
From de460871605c5575c5513dd1283cb61710b60cfe Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Wed, 18 Nov 2009 14:43:59 -0500
Subject: r600 : add some defs
---
src/mesa/drivers/dri/r600/r700_assembler.c | 35 ++++++++++++++++++++++++++++--
src/mesa/drivers/dri/r600/r700_assembler.h | 21 ++++++++++++++++++
src/mesa/drivers/dri/r600/r700_shader.c | 2 +-
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 4b5d40bd3a..6e8d1cd927 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -39,6 +39,7 @@
#include "r700_assembler.h"
#define USE_CF_FOR_CONTINUE_BREAK 1
+#define USE_CF_FOR_POP_AFTER 1
BITS addrmode_PVSDST(PVSDST * pPVSDST)
{
@@ -489,10 +490,12 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
pAsm->unCallerArrayPointer = 0;
pAsm->CALLSP = 0;
- pAsm->CALLSTACK[0].FCSP_BeforeEntry;
+ pAsm->CALLSTACK[0].FCSP_BeforeEntry = 0;
pAsm->CALLSTACK[0].plstCFInstructions_local
= &(pAsm->pR700Shader->lstCFInstructions);
+ pAsm->CALLSTACK[0].stackUsage.bits = 0;
+
SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local);
pAsm->unCFflags = 0;
@@ -4978,6 +4981,21 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason)
+{
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ break;
+ case FC_PUSH_WQM:
+ break;
+ case FC_LOOP:
+ break;
+ case FC_REP:
+ break;
+ };
+}
+
GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset)
{
if(GL_FALSE == add_cf_instruction(pAsm) )
@@ -5024,7 +5042,7 @@ GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops)
return GL_TRUE;
}
-GLboolean assemble_IF(r700_AssemblerBase *pAsm)
+GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
{
if(GL_FALSE == add_cf_instruction(pAsm) )
{
@@ -5056,10 +5074,12 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm)
pAsm->fc_stack[pAsm->FCSP].midLen= 0;
pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
+#ifndef USE_CF_FOR_POP_AFTER
if(GL_TRUE != bHasElse)
{
pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
}
+#endif /* USE_CF_FOR_POP_AFTER */
pAsm->branch_depth++;
@@ -5072,6 +5092,10 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm)
GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
{
+#ifdef USE_CF_FOR_POP_AFTER
+ pops(pAsm, 1);
+#endif /* USE_CF_FOR_POP_AFTER */
+
if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
@@ -5094,7 +5118,9 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr;
//pAsm->fc_stack[pAsm->FCSP].unNumMid = 1;
+#ifndef USE_CF_FOR_POP_AFTER
pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
+#endif /* USE_CF_FOR_POP_AFTER */
pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1;
@@ -5103,6 +5129,10 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
{
+#ifdef USE_CF_FOR_POP_AFTER
+ pops(pAsm, 1);
+#endif /* USE_CF_FOR_POP_AFTER */
+
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
if(NULL == pAsm->fc_stack[pAsm->FCSP].mid)
@@ -5410,6 +5440,7 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex)
pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP;
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local
= &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local);
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.bits = 0;
SetActiveCFlist(pAsm->pR700Shader,
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 85d32212c0..516923f67c 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -259,6 +259,8 @@ enum
FC_IF = 1,
FC_LOOP = 2,
FC_REP = 3,
+ FC_PUSH_VPM = 4,
+ FC_PUSH_WQM = 5,
COND_NONE = 0,
COND_BOOL = 1,
@@ -304,12 +306,30 @@ typedef struct CALLER_POINTER
#define SQ_MAX_CALL_DEPTH 0x00000020
+typedef struct STACK_USAGE
+{
+ BITS pushs :8;
+ BITS current :8;
+ BITS max :8;
+} STACK_USAGE;
+
+typedef union STACKDWORDtag
+{
+ BITS bits;
+ STACK_USAGE su;
+} STACKDWORD;
+
typedef struct CALL_LEVEL
{
unsigned int FCSP_BeforeEntry;
+ STACKDWORD stackUsage;
TypedShaderList * plstCFInstructions_local;
} CALL_LEVEL;
+#define HAS_CURRENT_LOOPRET 0x1L
+#define HAS_LOOPRET 0x2L
+#define LOOPRET_FLAGS HAS_LOOPRET | HAS_CURRENT_LOOPRET
+
typedef struct r700_AssemblerBase
{
R700ControlFlowSXClause* cf_last_export_ptr;
@@ -429,6 +449,7 @@ typedef struct r700_AssemblerBase
} r700_AssemblerBase;
//Internal use
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason);
BITS addrmode_PVSDST(PVSDST * pPVSDST);
void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode);
void nomask_PVSDST(PVSDST * pPVSDST);
diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c
index 2eed1acc2f..db951e48c4 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.c
+++ b/src/mesa/drivers/dri/r600/r700_shader.c
@@ -140,7 +140,7 @@ void Init_R700_Shader(R700_Shader * pShader)
pShader->killIsUsed = GL_FALSE;
pShader->uCFOffset = 0;
- pShader->uStackSize = 0;
+ pShader->uStackSize = 10; //richard test
pShader->uMaxCallDepth = 0;
pShader->bSurfAllocated = GL_FALSE;
--
cgit v1.2.3
From eec428280075c12dfef61bf3f18012dece384923 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Wed, 18 Nov 2009 14:56:01 -0500
Subject: r600 : update PS and VS emit count for loop constants.
---
src/mesa/drivers/dri/r600/r700_chip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index 197916ac0d..705b5738ed 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -1310,8 +1310,8 @@ void r600InitAtoms(context_t *context)
ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState);
ALLOC_STATE(vpt, always, 16, r700SendViewportState);
ALLOC_STATE(fs, always, 18, r700SendFSState);
- ALLOC_STATE(vs, always, 18, r700SendVSState);
- ALLOC_STATE(ps, always, 21, r700SendPSState);
+ ALLOC_STATE(vs, always, 21, r700SendVSState);
+ ALLOC_STATE(ps, always, 24, r700SendPSState);
ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts);
ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts);
ALLOC_STATE(vtx, vtx, (6 + (VERT_ATTRIB_MAX * 18)), r700SendVTXState);
--
cgit v1.2.3
From e3cfd78969cd4a94fc83a5d6fb2f33730cc4e70f Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Wed, 18 Nov 2009 17:30:50 -0800
Subject: progs/tests: Fix memory leak in texdown.c if malloc fails.
---
progs/tests/texdown.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c
index 7e46045832..e6881d39a0 100644
--- a/progs/tests/texdown.c
+++ b/progs/tests/texdown.c
@@ -176,6 +176,8 @@ MeasureDownloadRate(void)
orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN);
if (!orig_texImage || !orig_getImage) {
DownloadRate = 0.0;
+ free(orig_texImage);
+ free(orig_getImage);
return;
}
--
cgit v1.2.3
From c5dc8d7eccab38bf644ac1b9a58d0c5fe4acc4d7 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 19 Nov 2009 08:17:25 +0100
Subject: tgsi: Provide ultimate solution for SOA dependencies in exec.
Reorder STOREs in such a way that they appear after the last FETCH.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 351 ++++++++++++++++++---------------
1 file changed, 189 insertions(+), 162 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index b7569e74d4..ba7a225db3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -62,9 +62,6 @@
#define FAST_MATH 1
-/** for tgsi_full_instruction::Flags */
-#define SOA_DEPENDENCY_FLAG 0x1
-
#define TILE_TOP_LEFT 0
#define TILE_TOP_RIGHT 1
#define TILE_BOTTOM_LEFT 2
@@ -332,20 +329,6 @@ tgsi_exec_machine_bind_shader(
maxInstructions += 10;
}
- if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
- uint opcode = parse.FullToken.FullInstruction.Instruction.Opcode;
- parse.FullToken.FullInstruction.Flags = SOA_DEPENDENCY_FLAG;
- /* XXX we only handle SOA dependencies properly for MOV/SWZ
- * at this time!
- */
- if (opcode != TGSI_OPCODE_MOV) {
- debug_printf("Warning: SOA dependency in instruction"
- " is not handled:\n");
- tgsi_dump_instruction(&parse.FullToken.FullInstruction,
- numInstructions);
- }
- }
-
memcpy(instructions + numInstructions,
&parse.FullToken.FullInstruction,
sizeof(instructions[0]));
@@ -1847,6 +1830,7 @@ exec_instruction(
{
uint chan_index;
union tgsi_exec_channel r[10];
+ union tgsi_exec_channel d[8];
(*pc)++;
@@ -1855,42 +1839,27 @@ exec_instruction(
case TGSI_OPCODE_FLR:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_flr( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_flr(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_MOV:
- if (inst->Flags & SOA_DEPENDENCY_FLAG) {
- /* Do all fetches into temp regs, then do all stores to avoid
- * intermediate/accidental clobbering. This could be done all the
- * time for MOV but for other instructions we'll need more temps...
- */
- FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
- FETCH( &r[chan_index], 0, chan_index );
- }
- FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
- STORE( &r[chan_index], 0, chan_index );
- }
+ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
+ FETCH(&d[chan_index], 0, chan_index);
}
- else {
- FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
- FETCH( &r[0], 0, chan_index );
- STORE( &r[0], 0, chan_index );
- }
+ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_LIT:
- if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
- STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
- }
-
if (IS_CHANNEL_ENABLED( *inst, CHAN_Y ) || IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
FETCH( &r[0], 0, CHAN_X );
if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
- micro_max( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, CHAN_Y );
+ micro_max(&d[CHAN_Y], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
}
if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
@@ -1901,11 +1870,19 @@ exec_instruction(
micro_min( &r[2], &r[2], &mach->Temps[TEMP_128_I].xyzw[TEMP_128_C] );
micro_max( &r[2], &r[2], &mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C] );
micro_pow( &r[1], &r[1], &r[2] );
- micro_lt( &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, CHAN_Z );
+ micro_lt(&d[CHAN_Z], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
}
- }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ STORE(&d[CHAN_Y], 0, CHAN_Y);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ STORE(&d[CHAN_Z], 0, CHAN_Z);
+ }
+ }
+ if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
+ STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
+ }
if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
}
@@ -1973,14 +1950,13 @@ exec_instruction(
break;
case TGSI_OPCODE_MUL:
- FOR_EACH_ENABLED_CHANNEL( *inst, chan_index )
- {
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
FETCH(&r[0], 0, chan_index);
FETCH(&r[1], 1, chan_index);
-
- micro_mul( &r[0], &r[0], &r[1] );
-
- STORE(&r[0], 0, chan_index);
+ micro_mul(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -1988,8 +1964,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_add( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_add(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2045,25 +2023,29 @@ exec_instruction(
break;
case TGSI_OPCODE_DST:
- if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
- STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X );
- }
-
if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
FETCH( &r[0], 0, CHAN_Y );
FETCH( &r[1], 1, CHAN_Y);
- micro_mul( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, CHAN_Y );
+ micro_mul(&d[CHAN_Y], &r[0], &r[1]);
}
-
if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
- FETCH( &r[0], 0, CHAN_Z );
- STORE( &r[0], 0, CHAN_Z );
+ FETCH(&d[CHAN_Z], 0, CHAN_Z);
}
-
if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
- FETCH( &r[0], 1, CHAN_W );
- STORE( &r[0], 0, CHAN_W );
+ FETCH(&d[CHAN_W], 1, CHAN_W);
+ }
+
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+ STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ STORE(&d[CHAN_Y], 0, CHAN_Y);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ STORE(&d[CHAN_Z], 0, CHAN_Z);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+ STORE(&d[CHAN_W], 0, CHAN_W);
}
break;
@@ -2073,9 +2055,10 @@ exec_instruction(
FETCH(&r[1], 1, chan_index);
/* XXX use micro_min()?? */
- micro_lt( &r[0], &r[0], &r[1], &r[0], &r[1] );
-
- STORE(&r[0], 0, chan_index);
+ micro_lt(&d[chan_index], &r[0], &r[1], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2085,9 +2068,10 @@ exec_instruction(
FETCH(&r[1], 1, chan_index);
/* XXX use micro_max()?? */
- micro_lt( &r[0], &r[0], &r[1], &r[1], &r[0] );
-
- STORE(&r[0], 0, chan_index );
+ micro_lt(&d[chan_index], &r[0], &r[1], &r[1], &r[0] );
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2096,8 +2080,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_lt( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, chan_index );
+ micro_lt(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2106,8 +2092,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_le( &r[0], &r[1], &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, chan_index );
+ micro_le(&d[chan_index], &r[1], &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2118,8 +2106,10 @@ exec_instruction(
FETCH( &r[1], 1, chan_index );
micro_mul( &r[0], &r[0], &r[1] );
FETCH( &r[1], 2, chan_index );
- micro_add( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_add(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2127,10 +2117,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH(&r[0], 0, chan_index);
FETCH(&r[1], 1, chan_index);
-
- micro_sub( &r[0], &r[0], &r[1] );
-
- STORE(&r[0], 0, chan_index);
+ micro_sub(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2139,12 +2129,12 @@ exec_instruction(
FETCH(&r[0], 0, chan_index);
FETCH(&r[1], 1, chan_index);
FETCH(&r[2], 2, chan_index);
-
micro_sub( &r[1], &r[1], &r[2] );
micro_mul( &r[0], &r[0], &r[1] );
- micro_add( &r[0], &r[0], &r[2] );
-
- STORE(&r[0], 0, chan_index);
+ micro_add(&d[chan_index], &r[0], &r[2]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2153,8 +2143,10 @@ exec_instruction(
FETCH(&r[0], 0, chan_index);
FETCH(&r[1], 1, chan_index);
FETCH(&r[2], 2, chan_index);
- micro_lt(&r[0], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]);
- STORE(&r[0], 0, chan_index);
+ micro_lt(&d[chan_index], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2179,8 +2171,10 @@ exec_instruction(
case TGSI_OPCODE_FRC:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_frc( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_frc(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2190,8 +2184,10 @@ exec_instruction(
FETCH(&r[1], 1, chan_index);
micro_max(&r[0], &r[0], &r[1]);
FETCH(&r[1], 2, chan_index);
- micro_min(&r[0], &r[0], &r[1]);
- STORE(&r[0], 0, chan_index);
+ micro_min(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2199,8 +2195,10 @@ exec_instruction(
case TGSI_OPCODE_ARR:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_rnd( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_rnd(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2247,11 +2245,7 @@ exec_instruction(
FETCH(&r[4], 1, CHAN_Y);
micro_mul( &r[5], &r[3], &r[4] );
- micro_sub( &r[2], &r[2], &r[5] );
-
- if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) {
- STORE( &r[2], 0, CHAN_X );
- }
+ micro_sub(&d[CHAN_X], &r[2], &r[5]);
FETCH(&r[2], 1, CHAN_X);
@@ -2260,20 +2254,21 @@ exec_instruction(
FETCH(&r[5], 0, CHAN_X);
micro_mul( &r[1], &r[1], &r[5] );
- micro_sub( &r[3], &r[3], &r[1] );
-
- if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) {
- STORE( &r[3], 0, CHAN_Y );
- }
+ micro_sub(&d[CHAN_Y], &r[3], &r[1]);
micro_mul( &r[5], &r[5], &r[4] );
micro_mul( &r[0], &r[0], &r[2] );
- micro_sub( &r[5], &r[5], &r[0] );
+ micro_sub(&d[CHAN_Z], &r[5], &r[0]);
- if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) {
- STORE( &r[5], 0, CHAN_Z );
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+ STORE(&d[CHAN_X], 0, CHAN_X);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ STORE(&d[CHAN_Y], 0, CHAN_Y);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ STORE(&d[CHAN_Z], 0, CHAN_Z);
}
-
if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) {
STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W );
}
@@ -2282,11 +2277,11 @@ exec_instruction(
case TGSI_OPCODE_ABS:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH(&r[0], 0, chan_index);
-
- micro_abs( &r[0], &r[0] );
-
- STORE(&r[0], 0, chan_index);
+ micro_abs(&d[chan_index], &r[0]);
}
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
+ }
break;
case TGSI_OPCODE_RCC:
@@ -2338,16 +2333,20 @@ exec_instruction(
case TGSI_OPCODE_DDX:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_ddx( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_ddx(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_DDY:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_ddy( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_ddy(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2428,10 +2427,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_eq( &r[0], &r[0], &r[1],
- &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C],
- &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, chan_index );
+ micro_eq(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2445,8 +2444,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
- STORE( &r[0], 0, chan_index );
+ micro_le(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2462,8 +2463,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] );
- STORE( &r[0], 0, chan_index );
+ micro_le(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2471,8 +2474,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_eq( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
- STORE( &r[0], 0, chan_index );
+ micro_eq(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2546,13 +2551,8 @@ exec_instruction(
micro_mul(&r[3], &r[3], &r[1]);
micro_add(&r[2], &r[2], &r[3]);
FETCH(&r[3], 0, CHAN_X);
- micro_add(&r[2], &r[2], &r[3]);
- if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
- STORE(&r[2], 0, CHAN_X);
- }
- if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
- STORE(&r[2], 0, CHAN_Z);
- }
+ micro_add(&d[CHAN_X], &r[2], &r[3]);
+
}
if (IS_CHANNEL_ENABLED(*inst, CHAN_Y) ||
IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
@@ -2562,13 +2562,20 @@ exec_instruction(
micro_mul(&r[3], &r[3], &r[1]);
micro_add(&r[2], &r[2], &r[3]);
FETCH(&r[3], 0, CHAN_Y);
- micro_add(&r[2], &r[2], &r[3]);
- if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
- STORE(&r[2], 0, CHAN_Y);
- }
- if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
- STORE(&r[2], 0, CHAN_W);
- }
+ micro_add(&d[CHAN_Y], &r[2], &r[3]);
+
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) {
+ STORE(&d[CHAN_X], 0, CHAN_X);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) {
+ STORE(&d[CHAN_Y], 0, CHAN_Y);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) {
+ STORE(&d[CHAN_X], 0, CHAN_Z);
+ }
+ if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) {
+ STORE(&d[CHAN_Y], 0, CHAN_W);
}
break;
@@ -2653,8 +2660,10 @@ exec_instruction(
/* TGSI_OPCODE_SGN */
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_sgn( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_sgn(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2663,10 +2672,10 @@ exec_instruction(
FETCH(&r[0], 0, chan_index);
FETCH(&r[1], 1, chan_index);
FETCH(&r[2], 2, chan_index);
-
- micro_lt( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2] );
-
- STORE(&r[0], 0, chan_index);
+ micro_lt(&d[chan_index], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2841,32 +2850,40 @@ exec_instruction(
case TGSI_OPCODE_CEIL:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_ceil( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_ceil(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_I2F:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_i2f( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_i2f(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_NOT:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_not( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_not(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
case TGSI_OPCODE_TRUNC:
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
- micro_trunc( &r[0], &r[0] );
- STORE( &r[0], 0, chan_index );
+ micro_trunc(&d[chan_index], &r[0]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2874,8 +2891,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_shl( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_shl(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2883,8 +2902,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_ishr( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_ishr(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2892,8 +2913,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_and( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_and(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2901,8 +2924,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_or( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_or(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
@@ -2914,8 +2939,10 @@ exec_instruction(
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
FETCH( &r[1], 1, chan_index );
- micro_xor( &r[0], &r[0], &r[1] );
- STORE( &r[0], 0, chan_index );
+ micro_xor(&d[chan_index], &r[0], &r[1]);
+ }
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&d[chan_index], 0, chan_index);
}
break;
--
cgit v1.2.3
From f56b95e40796ea3859b1cb83341730bf74a6f85f Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 19 Nov 2009 08:18:58 +0100
Subject: identity: Add missing screen methods.
---
src/gallium/drivers/identity/id_objects.c | 39 +++++++++++++++++++++++++++++++
src/gallium/drivers/identity/id_objects.h | 25 ++++++++++++++++++++
src/gallium/drivers/identity/id_public.h | 2 +-
src/gallium/drivers/identity/id_screen.c | 33 ++++++++++++++++++++++++++
4 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c
index e893e59940..bc9bc7121d 100644
--- a/src/gallium/drivers/identity/id_objects.c
+++ b/src/gallium/drivers/identity/id_objects.c
@@ -180,3 +180,42 @@ identity_transfer_destroy(struct identity_transfer *id_transfer)
screen->tex_transfer_destroy(id_transfer->transfer);
FREE(id_transfer);
}
+
+struct pipe_video_surface *
+identity_video_surface_create(struct identity_screen *id_screen,
+ struct pipe_video_surface *video_surface)
+{
+ struct identity_video_surface *id_video_surface;
+
+ if (!video_surface) {
+ goto error;
+ }
+
+ assert(video_surface->screen == id_screen->screen);
+
+ id_video_surface = CALLOC_STRUCT(identity_video_surface);
+ if (!id_video_surface) {
+ goto error;
+ }
+
+ memcpy(&id_video_surface->base,
+ video_surface,
+ sizeof(struct pipe_video_surface));
+
+ pipe_reference_init(&id_video_surface->base.reference, 1);
+ id_video_surface->base.screen = &id_screen->base;
+ id_video_surface->video_surface = video_surface;
+
+ return &id_video_surface->base;
+
+error:
+ pipe_video_surface_reference(&video_surface, NULL);
+ return NULL;
+}
+
+void
+identity_video_surface_destroy(struct identity_video_surface *id_video_surface)
+{
+ pipe_video_surface_reference(&id_video_surface->video_surface, NULL);
+ FREE(id_video_surface);
+}
diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h
index ce58faa3c7..77cc719079 100644
--- a/src/gallium/drivers/identity/id_objects.h
+++ b/src/gallium/drivers/identity/id_objects.h
@@ -31,6 +31,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
+#include "pipe/p_video_state.h"
#include "id_screen.h"
@@ -67,6 +68,14 @@ struct identity_transfer
};
+struct identity_video_surface
+{
+ struct pipe_video_surface base;
+
+ struct pipe_video_surface *video_surface;
+};
+
+
static INLINE struct identity_buffer *
identity_buffer(struct pipe_buffer *_buffer)
{
@@ -103,6 +112,15 @@ identity_transfer(struct pipe_transfer *_transfer)
return (struct identity_transfer *)_transfer;
}
+static INLINE struct identity_video_surface *
+identity_video_surface(struct pipe_video_surface *_video_surface)
+{
+ if (!_video_surface) {
+ return NULL;
+ }
+ (void)identity_screen(_video_surface->screen);
+ return (struct identity_video_surface *)_video_surface;
+}
static INLINE struct pipe_buffer *
identity_buffer_unwrap(struct pipe_buffer *_buffer)
@@ -165,5 +183,12 @@ identity_transfer_create(struct identity_texture *id_texture,
void
identity_transfer_destroy(struct identity_transfer *id_transfer);
+struct pipe_video_surface *
+identity_video_surface_create(struct identity_screen *id_screen,
+ struct pipe_video_surface *video_surface);
+
+void
+identity_video_surface_destroy(struct identity_video_surface *id_video_surface);
+
#endif /* ID_OBJECTS_H */
diff --git a/src/gallium/drivers/identity/id_public.h b/src/gallium/drivers/identity/id_public.h
index cac14cfd60..3d2862eaa0 100644
--- a/src/gallium/drivers/identity/id_public.h
+++ b/src/gallium/drivers/identity/id_public.h
@@ -37,4 +37,4 @@ identity_screen_create(struct pipe_screen *screen);
struct pipe_context *
identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
-#endif /* PT_PUBLIC_H */
+#endif /* ID_PUBLIC_H */
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 26439637d0..53eae3ef54 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -379,6 +379,33 @@ identity_screen_buffer_destroy(struct pipe_buffer *_buffer)
identity_buffer_destroy(identity_buffer(_buffer));
}
+static struct pipe_video_surface *
+identity_screen_video_surface_create(struct pipe_screen *_screen,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width,
+ unsigned height)
+{
+ struct identity_screen *id_screen = identity_screen(_screen);
+ struct pipe_screen *screen = id_screen->screen;
+ struct pipe_video_surface *result;
+
+ result = screen->video_surface_create(screen,
+ chroma_format,
+ width,
+ height);
+
+ if (result) {
+ return identity_video_surface_create(id_screen, result);
+ }
+ return NULL;
+}
+
+static void
+identity_screen_video_surface_destroy(struct pipe_video_surface *_vsfc)
+{
+ identity_video_surface_destroy(identity_video_surface(_vsfc));
+}
+
static void
identity_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_surface *_surface,
@@ -472,6 +499,12 @@ identity_screen_create(struct pipe_screen *screen)
if (screen->buffer_unmap)
id_screen->base.buffer_unmap = identity_screen_buffer_unmap;
id_screen->base.buffer_destroy = identity_screen_buffer_destroy;
+ if (screen->video_surface_create) {
+ id_screen->base.video_surface_create = identity_screen_video_surface_create;
+ }
+ if (screen->video_surface_destroy) {
+ id_screen->base.video_surface_destroy = identity_screen_video_surface_destroy;
+ }
id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer;
id_screen->base.fence_reference = identity_screen_fence_reference;
id_screen->base.fence_signalled = identity_screen_fence_signalled;
--
cgit v1.2.3
From ea114345a6f19331628910745650cb64750b2bda Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 10:38:08 +0100
Subject: st/xorg: Don't initialize non-existing fields.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index aca889d6f8..660ea6a1ba 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -368,8 +368,6 @@ driScreenInit(ScreenPtr pScreen)
#if DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = driCreateBuffer;
dri2info.DestroyBuffer = driDestroyBuffer;
- dri2info.CreateBuffers = NULL;
- dri2info.DestroyBuffers = NULL;
#else
dri2info.CreateBuffers = driCreateBuffers;
dri2info.DestroyBuffers = driDestroyBuffers;
--
cgit v1.2.3
From 10dbdee05694489edd03b353dfe133a17e65b469 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 10:54:49 +0100
Subject: st/xorg: Remove superfluous flushes from the EXA WaitMarker hook.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to Thomas Hellström for pointing this out.
---
src/gallium/state_trackers/xorg/xorg_exa.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 6fa274eb0a..29fc861748 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -170,15 +170,7 @@ xorg_exa_common_done(struct exa_context *exa)
static void
ExaWaitMarker(ScreenPtr pScreen, int marker)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_context *exa = ms->exa;
-
-#if 0
- xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
-#else
- xorg_exa_finish(exa);
-#endif
+ /* Nothing to do, handled in the PrepareAccess hook */
}
static int
--
cgit v1.2.3
From abed06421b892aed9f38ea75862e4b7e8aca25fa Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Tue, 17 Nov 2009 11:15:13 -0800
Subject: tnl: Remove unused NotifyInputChanges() tnl dd hook.
---
src/mesa/tnl/t_context.h | 5 -----
src/mesa/tnl/t_pipeline.c | 4 ----
2 files changed, 9 deletions(-)
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 6137c2d2fe..8915770d8b 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -402,11 +402,6 @@ struct tnl_device_driver
/* Alert tnl-aware drivers of changes to material.
*/
- void (*NotifyInputChanges)(GLcontext *ctx, GLuint bitmask);
- /* Alert tnl-aware drivers of changes to size and stride of input
- * arrays.
- */
-
/***
*** Rendering -- These functions called only from t_vb_render.c
***/
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index 357ef1e24b..01b30babb4 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -86,10 +86,6 @@ static GLuint check_input_changes( GLcontext *ctx )
}
}
- if (tnl->pipeline.input_changes &&
- tnl->Driver.NotifyInputChanges)
- tnl->Driver.NotifyInputChanges( ctx, tnl->pipeline.input_changes );
-
return tnl->pipeline.input_changes;
}
--
cgit v1.2.3
From 22bcb59a95ec833cfd73b300376c918eb6a658f2 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Tue, 17 Nov 2009 13:00:01 -0800
Subject: tnl: Replace NormalPtr with AttribPtr[_TNL_ATTRIB_NORMAL]
---
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++--
src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 6 +++---
src/mesa/tnl/t_context.h | 3 +--
src/mesa/tnl/t_draw.c | 1 -
src/mesa/tnl/t_vb_normals.c | 1 -
src/mesa/x86/gen_matypes.c | 2 +-
6 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 08e1c5d00d..4769f1cb4d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -216,9 +216,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (!rmesa->tcl.norm.buf)
rcommon_emit_vector( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->NormalPtr->data,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data,
3,
- VB->NormalPtr->stride,
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride,
count);
vfmt |= RADEON_CP_VC_FRMT_N0;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
index 515783135d..1abde5ddee 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
@@ -112,9 +112,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_NORM) {
- if (VB->NormalPtr) {
- norm_stride = VB->NormalPtr->stride;
- norm = (GLuint (*)[4])VB->NormalPtr->data;
+ if (VB->AttribPtr[_TNL_ATTRIB_NORMAL]) {
+ norm_stride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ norm = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
} else {
norm_stride = 0;
norm = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 8915770d8b..504e8c5044 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -200,7 +200,7 @@ struct vertex_buffer
/* Pointers to current data.
* XXX some of these fields alias AttribPtr below and should be removed
- * such as NormalPtr, TexCoordPtr, FogCoordPtr, etc.
+ * such as TexCoordPtr, FogCoordPtr, etc.
*/
GLuint *Elts;
GLvector4f *ObjPtr; /* _TNL_BIT_POS */
@@ -210,7 +210,6 @@ struct vertex_buffer
GLubyte ClipOrMask; /* _TNL_BIT_POS */
GLubyte ClipAndMask; /* _TNL_BIT_POS */
GLubyte *ClipMask; /* _TNL_BIT_POS */
- GLvector4f *NormalPtr; /* _TNL_BIT_NORMAL */
GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */
GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 04fa106300..2df9444d2b 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -255,7 +255,6 @@ static void bind_inputs( GLcontext *ctx,
/* Legacy pointers -- remove one day.
*/
VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS];
- VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index a4821cc1cc..693d3dc118 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -79,7 +79,6 @@ run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
}
VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal;
- VB->NormalPtr = &store->normal;
VB->NormalLengthPtr = NULL; /* no longer valid */
return GL_TRUE;
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index d56b701aa8..f78a277601 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -126,7 +126,7 @@ int main( int argc, char **argv )
OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr );
OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask );
OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask );
- OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr );
+ OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] );
OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag );
OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] );
OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] );
--
cgit v1.2.3
From df582ca767a38f185f9b4c449e7ed4266c414ae2 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Tue, 17 Nov 2009 16:00:53 -0800
Subject: tnl: Replace deprecated TexCoordPtr with AttribPtr[_TNL_ATTRIB_TEX*]
---
src/mesa/drivers/dri/gamma/gamma_render.c | 6 +-
src/mesa/drivers/dri/i915/i830_vtbl.c | 2 +-
src/mesa/drivers/dri/i915/i915_fragprog.c | 2 +-
src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 20 +++----
src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 64 +++++++++++-----------
src/mesa/drivers/dri/r128/r128_tris.c | 4 +-
src/mesa/drivers/dri/r200/r200_swtcl.c | 2 +-
src/mesa/drivers/dri/r300/r300_swtcl.c | 6 +-
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 12 ++--
src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 30 +++++-----
src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 6 +-
src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +-
src/mesa/drivers/dri/savage/savagerender.c | 8 +--
src/mesa/drivers/dri/savage/savagetris.c | 18 +++---
src/mesa/drivers/dri/sis/sis_tris.c | 4 +-
src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 20 +++----
src/mesa/drivers/dri/unichrome/via_tris.c | 4 +-
src/mesa/drivers/glide/fxvbtmp.h | 21 +++----
.../windows/gldirect/dx7/gld_primitive_dx7.c | 8 +--
.../windows/gldirect/dx8/gld_primitive_dx8.c | 8 +--
.../windows/gldirect/dx9/gld_primitive_dx9.c | 8 +--
src/mesa/tnl/t_context.h | 3 +-
src/mesa/tnl/t_draw.c | 4 --
src/mesa/tnl/t_vb_program.c | 1 -
src/mesa/tnl/t_vb_texgen.c | 1 -
src/mesa/tnl/t_vb_texmat.c | 1 -
src/mesa/tnl_dd/t_dd_vbtmp.h | 64 +++++++++++-----------
src/mesa/x86/gen_matypes.c | 8 +--
28 files changed, 165 insertions(+), 172 deletions(-)
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
index 1b9fd169f4..741936488a 100644
--- a/src/mesa/drivers/dri/gamma/gamma_render.c
+++ b/src/mesa/drivers/dri/gamma/gamma_render.c
@@ -57,9 +57,9 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
col_stride = VB->ColorPtr[0]->stride;
if (ctx->Texture.Unit[0]._ReallyEnabled) {
- tc0_stride = VB->TexCoordPtr[0]->stride;
- tc0 = VB->TexCoordPtr[0]->data;
- tc0_size = VB->TexCoordPtr[0]->size;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0]->size;
coord = VB->ClipPtr->data;
coord_stride = VB->ClipPtr->stride;
} else {
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index a6f554701e..7d76b39caa 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -126,7 +126,7 @@ i830_render_start(struct intel_context *intel)
for (i = 0; i < I830_TEX_UNITS; i++) {
if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_TEX(i))) {
- GLuint sz = VB->TexCoordPtr[i]->size;
+ GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
GLuint emit;
GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
~TEXCOORDTYPE_MASK);
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index d9c61446f5..9e4d318036 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -1301,7 +1301,7 @@ i915ValidateFragmentProgram(struct i915_context *i915)
for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
if (inputsRead & FRAG_BIT_TEX(i)) {
- int sz = VB->TexCoordPtr[i]->size;
+ int sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz));
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
index 684f2acc89..1a93e5f034 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
@@ -103,10 +103,10 @@ static void TAG(emit)( GLcontext *ctx,
#if DO_TEX1
{
const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
+ tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride;
#if DO_PTEX
- tc1_size = VB->TexCoordPtr[t1]->size;
+ tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size;
#endif
}
#endif
@@ -114,10 +114,10 @@ static void TAG(emit)( GLcontext *ctx,
#if DO_TEX0
{
const GLuint t0 = GET_TEXSOURCE(0);
- tc0 = VB->TexCoordPtr[t0]->data;
- tc0_stride = VB->TexCoordPtr[t0]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride;
#if DO_PTEX
- tc0_size = VB->TexCoordPtr[t0]->size;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size;
#endif
}
#endif
@@ -319,8 +319,8 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* Force 'missing' texcoords to something valid.
*/
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
if (DO_PTEX)
return GL_TRUE;
@@ -328,12 +328,12 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* No hardware support for projective texture. Can fake it for
* TEX0 only.
*/
- if ((DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
+ if ((DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) {
PTEX_FALLBACK();
return GL_FALSE;
}
- if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
+ if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) {
if (DO_TEX1) {
PTEX_FALLBACK();
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
index 938804af9e..eb94e6e398 100644
--- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
@@ -156,34 +156,34 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_TEX3) {
const GLuint t3 = GET_TEXSOURCE(3);
- tc3 = VB->TexCoordPtr[t3]->data;
- tc3_stride = VB->TexCoordPtr[t3]->stride;
+ tc3 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->data;
+ tc3_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->stride;
if (DO_PTEX)
- tc3_size = VB->TexCoordPtr[t3]->size;
+ tc3_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->size;
}
if (DO_TEX2) {
const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
+ tc2 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data;
+ tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride;
if (DO_PTEX)
- tc2_size = VB->TexCoordPtr[t2]->size;
+ tc2_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size;
}
if (DO_TEX1) {
const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
+ tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride;
if (DO_PTEX)
- tc1_size = VB->TexCoordPtr[t1]->size;
+ tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size;
}
if (DO_TEX0) {
const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = VB->TexCoordPtr[t0]->data;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data;
if (DO_PTEX)
- tc0_size = VB->TexCoordPtr[t0]->size;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size;
}
if (DO_RGBA) {
@@ -473,22 +473,22 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* Force 'missing' texcoords to something valid.
*/
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+ if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX2] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX2] = VB->AttribPtr[_TNL_ATTRIB_TEX3];
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+ if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX1] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX1] = VB->AttribPtr[_TNL_ATTRIB_TEX2];
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
if (DO_PTEX)
return GL_TRUE;
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) ||
- (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4))
+ if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) ||
+ (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
+ (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4) ||
+ (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4))
return GL_FALSE;
return GL_TRUE;
@@ -501,14 +501,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* Force 'missing' texcoords to something valid.
*/
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+ if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX2] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX2] = VB->AttribPtr[_TNL_ATTRIB_TEX3];
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+ if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX1] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX1] = VB->AttribPtr[_TNL_ATTRIB_TEX2];
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
if (DO_PTEX)
return GL_TRUE;
@@ -516,14 +516,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* No hardware support for projective texture. Can fake it for
* TEX0 only.
*/
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
+ if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) ||
+ (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
+ (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) {
PTEX_FALLBACK();
return GL_FALSE;
}
- if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
+ if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) {
if (DO_TEX1 || DO_TEX2 || DO_TEX3) {
PTEX_FALLBACK();
}
diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c
index 5b91271d74..448e34e047 100644
--- a/src/mesa/drivers/dri/r128/r128_tris.c
+++ b/src/mesa/drivers/dri/r128/r128_tris.c
@@ -650,12 +650,12 @@ static void r128RenderStart( GLcontext *ctx )
}
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[0]) )) {
- if ( VB->TexCoordPtr[rmesa->tmu_source[0]]->size > 2 )
+ if ( VB->AttribPtr[_TNL_ATTRIB_TEX0 + rmesa->tmu_source[0]]->size > 2 )
fallback_projtex = GL_TRUE;
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, R128_CCE_VC_FRMT_S_T, 8 );
}
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[1]) )) {
- if ( VB->TexCoordPtr[rmesa->tmu_source[1]]->size > 2 )
+ if ( VB->AttribPtr[_TNL_ATTRIB_TEX0 + rmesa->tmu_source[1]]->size > 2 )
fallback_projtex = GL_TRUE;
EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, R128_CCE_VC_FRMT_S2_T2, 8 );
}
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 240fb45078..fadc766b49 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -168,7 +168,7 @@ static void r200SetVertexFormat( GLcontext *ctx )
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
- GLuint sz = VB->TexCoordPtr[i]->size;
+ GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
fmt_1 |= sz << (3 * i);
EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1, 0 );
diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c
index ee2c71e1a7..677c504b90 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -159,7 +159,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
int tex_id = rmesa->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0;
VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS];
- VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_POS];
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS];
RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id);
}
@@ -167,7 +167,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
int tex_id = rmesa->selected_fp->fog_attr - FRAG_ATTRIB_TEX0;
VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG];
- VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG];
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG];
RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id);
}
@@ -180,7 +180,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
GLuint swiz, format, hw_format;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (fp_reads & FRAG_BIT_TEX(i)) {
- switch (VB->TexCoordPtr[i]->size) {
+ switch (VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size) {
case 1:
format = EMIT_1F;
hw_format = R300_DATA_TYPE_FLOAT_1;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 4769f1cb4d..1cd1d6e778 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -290,24 +290,24 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (!rmesa->tcl.tex[unit].buf)
emit_tex_vector( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->TexCoordPtr[unit]->data,
- VB->TexCoordPtr[unit]->size,
- VB->TexCoordPtr[unit]->stride,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->data,
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size,
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->stride,
count );
nr++;
vfmt |= RADEON_ST_BIT(unit);
/* assume we need the 3rd coord if texgen is active for r/q OR at least
3 coords are submitted. This may not be 100% correct */
- if (VB->TexCoordPtr[unit]->size >= 3) {
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) {
vtx |= RADEON_Q_BIT(unit);
vfmt |= RADEON_Q_BIT(unit);
}
if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
vtx |= RADEON_Q_BIT(unit);
- else if ((VB->TexCoordPtr[unit]->size >= 3) &&
+ else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) {
- GLuint swaptexmatcol = (VB->TexCoordPtr[unit]->size - 3);
+ GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3);
if (((rmesa->NeedTexMatrix >> unit) & 1) &&
(swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1)))
radeonUploadTexMatrix( rmesa, unit, swaptexmatcol ) ;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
index 1abde5ddee..cb57416c3e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
@@ -60,14 +60,14 @@ static void TAG(emit)( GLcontext *ctx,
coord_stride = VB->ObjPtr->stride;
if (DO_TEX2) {
- if (VB->TexCoordPtr[2]) {
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX2]) {
const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t2]->size < 3) {
+ tc2 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data;
+ tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride;
+ if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size < 3) {
fill_tex |= (1<<2);
}
- else if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
+ else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size < 4) {
rqcoordsnoswap |= (1<<2);
}
} else {
@@ -77,14 +77,14 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_TEX1) {
- if (VB->TexCoordPtr[1]) {
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) {
const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t1]->size < 3) {
+ tc1 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride;
+ if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size < 3) {
fill_tex |= (1<<1);
}
- else if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
+ else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size < 4) {
rqcoordsnoswap |= (1<<1);
}
} else {
@@ -94,14 +94,14 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_TEX0) {
- if (VB->TexCoordPtr[0]) {
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) {
const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
- if (DO_PTEX && VB->TexCoordPtr[t0]->size < 3) {
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride;
+ tc0 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data;
+ if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size < 3) {
fill_tex |= (1<<0);
}
- else if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
+ else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size < 4) {
rqcoordsnoswap |= (1<<0);
}
} else {
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index 78ec119302..a6aff69aac 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -348,15 +348,15 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
req |= RADEON_ST_BIT(unit);
/* assume we need the 3rd coord if texgen is active for r/q OR at least
3 coords are submitted. This may not be 100% correct */
- if (VB->TexCoordPtr[unit]->size >= 3) {
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) {
req |= RADEON_Q_BIT(unit);
vtx |= RADEON_Q_BIT(unit);
}
if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
vtx |= RADEON_Q_BIT(unit);
- else if ((VB->TexCoordPtr[unit]->size >= 3) &&
+ else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) {
- GLuint swaptexmatcol = (VB->TexCoordPtr[unit]->size - 3);
+ GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3);
if (((rmesa->NeedTexMatrix >> unit) & 1) &&
(swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1)))
radeonUploadTexMatrix( rmesa, unit, swaptexmatcol ) ;
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index e61f59eaea..6bbe8e252e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -179,7 +179,7 @@ static void radeonSetVertexFormat( GLcontext *ctx )
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
- GLuint sz = VB->TexCoordPtr[i]->size;
+ GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
switch (sz) {
case 1:
diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c
index 32c74f9467..8221edf387 100644
--- a/src/mesa/drivers/dri/savage/savagerender.c
+++ b/src/mesa/drivers/dri/savage/savagerender.c
@@ -252,13 +252,13 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT);
const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) &&
(texObj->WrapT == GL_REPEAT);
- const GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data;
- const GLint instride = VB->TexCoordPtr[i]->stride;
+ const GLfloat *in = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->data;
+ const GLint instride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->stride;
GLfloat (*out)[4] = store->texcoord[i].data;
GLint j;
if (!ctx->Texture.Unit[i]._ReallyEnabled ||
- VB->TexCoordPtr[i]->size == 4)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size == 4)
/* Never try to normalize homogenous tex coords! */
continue;
@@ -297,7 +297,7 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
}
if (normalizeS || normalizeT)
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i];
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &store->texcoord[i];
}
}
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index c04763b40e..e9529d1939 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -879,13 +879,13 @@ static GLboolean savageCheckPTexHack( GLcontext *ctx )
RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) {
if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX ))
return GL_TRUE; /* apply ptex hack */
else
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
}
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
return GL_FALSE; /* don't apply ptex hack */
@@ -976,13 +976,13 @@ static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx )
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (imesa->ptexHack)
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
- else if (VB->TexCoordPtr[0]->size == 4)
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4)
assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[0]->size >= 2)
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size >= 2)
/* The chromium menu emits some 3D tex coords even though no
* 3D texture is enabled. Ignore the 3rd coordinate. */
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 );
- else if (VB->TexCoordPtr[0]->size == 1) {
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 1) {
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_1F, SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 );
EMIT_PAD( 4 );
} else
@@ -1025,9 +1025,9 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx )
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (imesa->ptexHack)
NEED_ATTR( SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
- else if (VB->TexCoordPtr[0]->size == 4)
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4)
assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[0]->size >= 2)
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size >= 2)
/* The chromium menu emits some 3D tex coords even though no
* 3D texture is enabled. Ignore the 3rd coordinate. */
NEED_ATTR( SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 );
@@ -1035,10 +1035,10 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx )
NEED_ATTR( SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 );
}
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) {
- if (VB->TexCoordPtr[1]->size == 4)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
/* projective textures are not supported by the hardware */
assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[1]->size >= 2)
+ else if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size >= 2)
NEED_ATTR( SAVAGE_EMIT_ST1, SAVAGE_SKIP_ST1 );
else
NEED_ATTR( SAVAGE_EMIT_S1, SAVAGE_SKIP_S1 );
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index 76d12d07b3..3cf10007b5 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -903,14 +903,14 @@ static void sisRenderStart( GLcontext *ctx )
/* projective textures are not supported by the hardware */
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
- if (VB->TexCoordPtr[0]->size > 2)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size > 2)
tex_fallback = GL_TRUE;
EMIT_ATTR(_TNL_ATTRIB_TEX0, EMIT_2F);
AGPParseSet |= SiS_PS_HAS_UV0;
}
/* Will only hit tex1 on SiS300 */
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) {
- if (VB->TexCoordPtr[1]->size > 2)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size > 2)
tex_fallback = GL_TRUE;
EMIT_ATTR(_TNL_ATTRIB_TEX1, EMIT_2F);
AGPParseSet |= SiS_PS_HAS_UV1;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
index 9b780761f4..809d5d7dd9 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
@@ -58,21 +58,21 @@ static void TAG(emit)( GLcontext *ctx,
/* fprintf(stderr, "%s\n", __FUNCTION__); */
if (IND & TDFX_TEX0_BIT) {
- tc0_stride = VB->TexCoordPtr[tmu0_source]->stride;
- tc0 = VB->TexCoordPtr[tmu0_source]->data;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->data;
u0scale = fxMesa->sScale0;
v0scale = fxMesa->tScale0;
if (IND & TDFX_PTEX_BIT)
- tc0_size = VB->TexCoordPtr[tmu0_source]->size;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->size;
}
if (IND & TDFX_TEX1_BIT) {
- tc1 = VB->TexCoordPtr[tmu1_source]->data;
- tc1_stride = VB->TexCoordPtr[tmu1_source]->stride;
+ tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->stride;
u1scale = fxMesa->sScale1;
v1scale = fxMesa->tScale1;
if (IND & TDFX_PTEX_BIT)
- tc1_size = VB->TexCoordPtr[tmu1_source]->size;
+ tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->size;
}
if (IND & TDFX_RGBA_BIT) {
@@ -168,14 +168,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (IND & TDFX_TEX1_BIT) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
- if (VB->TexCoordPtr[1]->size == 4)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
return GL_FALSE;
}
- if (VB->TexCoordPtr[0]->size == 4)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4)
return GL_FALSE;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 79e67620c9..ab457d41dc 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -832,13 +832,13 @@ static GLboolean viaCheckPTexHack( GLcontext *ctx )
RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) {
if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX ))
ptexHack = GL_TRUE;
else
fallback = GL_TRUE;
}
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
fallback = GL_TRUE;
FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_PROJ_TEXTURE, fallback);
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index f7970c78e2..674d9c6799 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -62,21 +62,21 @@ static void TAG(emit)( GLcontext *ctx,
}
if (IND & SETUP_TMU0) {
- tc0 = VB->TexCoordPtr[tmu0_source]->data;
- tc0_stride = VB->TexCoordPtr[tmu0_source]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->data;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->stride;
u0scale = fxMesa->s0scale;
v0scale = fxMesa->t0scale;
if (IND & SETUP_PTEX)
- tc0_size = VB->TexCoordPtr[tmu0_source]->size;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->size;
}
if (IND & SETUP_TMU1) {
- tc1 = VB->TexCoordPtr[tmu1_source]->data;
- tc1_stride = VB->TexCoordPtr[tmu1_source]->stride;
+ tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->stride;
u1scale = fxMesa->s1scale; /* wrong if tmu1_source == 0, possible? */
v1scale = fxMesa->t1scale;
if (IND & SETUP_PTEX)
- tc1_size = VB->TexCoordPtr[tmu1_source]->size;
+ tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->size;
}
if (IND & SETUP_RGBA) {
@@ -220,14 +220,15 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (IND & SETUP_TMU1) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
- if (VB->TexCoordPtr[1]->size == 4)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
return GL_FALSE;
}
- if (VB->TexCoordPtr[0] && VB->TexCoordPtr[0]->size == 4)
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0] &&
+ VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4)
return GL_FALSE;
}
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
index c99ba0bba5..aa2e7e3a8d 100644
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
+++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
@@ -259,15 +259,15 @@
pV->Diffuse = dwColor;
#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \
+ tc = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data; \
pV->TexUnit0.x = tc[##v][0]; \
pV->TexUnit0.y = tc[##v][1]; \
}
#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) { \
+ tc = VB->AttribPtr[_TNL_ATTRIB_TEX1]->data; \
pV->TexUnit1.x = tc[##v][0]; \
pV->TexUnit1.y = tc[##v][1]; \
}
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
index a5b5462f03..7cc2ef6f30 100644
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
+++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
@@ -259,15 +259,15 @@
pV->Diffuse = dwColor;
#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \
+ tc = VB->TnlAttribPtr[_TNL_ATTRIB_TEX0]->data; \
pV->TexUnit0.x = tc[##v][0]; \
pV->TexUnit0.y = tc[##v][1]; \
}
#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
+ if (VB->TnlAttribPtr[_TNL_ATTRIB_TEX1]) { \
+ tc = VB->TnlAttribPtr[_TNL_ATTRIB_TEX1]->data; \
pV->TexUnit1.x = tc[##v][0]; \
pV->TexUnit1.y = tc[##v][1]; \
}
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
index 403a9d5f86..3b8af8546e 100644
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
+++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
@@ -259,15 +259,15 @@
pV->Diffuse = dwColor;
#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \
+ tc = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data; \
pV->TexUnit0.x = tc[##v][0]; \
pV->TexUnit0.y = tc[##v][1]; \
}
#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
+ if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) { \
+ tc = VB->AttribPtr[_TNL_ATTRIB_TEX1]->data; \
pV->TexUnit1.x = tc[##v][0]; \
pV->TexUnit1.y = tc[##v][1]; \
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 504e8c5044..d2b13f1b02 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -200,7 +200,7 @@ struct vertex_buffer
/* Pointers to current data.
* XXX some of these fields alias AttribPtr below and should be removed
- * such as TexCoordPtr, FogCoordPtr, etc.
+ * such as FogCoordPtr, etc.
*/
GLuint *Elts;
GLvector4f *ObjPtr; /* _TNL_BIT_POS */
@@ -212,7 +212,6 @@ struct vertex_buffer
GLubyte *ClipMask; /* _TNL_BIT_POS */
GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */
GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
- GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */
GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */
GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */
GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 2df9444d2b..202c6ae3ce 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -263,10 +263,6 @@ static void bind_inputs( GLcontext *ctx,
VB->SecondaryColorPtr[1] = NULL;
VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i];
- }
-
/* Clipping and drawing code still requires this to be a packed
* array of ubytes which can be written into. TODO: Fix and
* remove.
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index e69f7d5766..d76b0a6b9d 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -466,7 +466,6 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ];
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- VB->TexCoordPtr[i] =
VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]
= &store->results[VERT_RESULT_TEX0 + i];
}
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 7c1819b223..83b74c0ebf 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -498,7 +498,6 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
store->TexgenFunc[i]( ctx, store, i );
- VB->TexCoordPtr[i] =
VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i];
}
}
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 0abe8cc35d..83688290e5 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -73,7 +73,6 @@ static GLboolean run_texmat_stage( GLcontext *ctx,
ctx->TextureMatrixStack[i].Top,
VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]);
- VB->TexCoordPtr[i] =
VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i];
}
}
diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h
index 92dd8931c3..c1cc6ae1bf 100644
--- a/src/mesa/tnl_dd/t_dd_vbtmp.h
+++ b/src/mesa/tnl_dd/t_dd_vbtmp.h
@@ -153,34 +153,34 @@ static void TAG(emit)( GLcontext *ctx,
if (DO_TEX3) {
const GLuint t3 = GET_TEXSOURCE(3);
- tc3 = VB->TexCoordPtr[t3]->data;
- tc3_stride = VB->TexCoordPtr[t3]->stride;
+ tc3 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->data;
+ tc3_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->stride;
if (DO_PTEX)
- tc3_size = VB->TexCoordPtr[t3]->size;
+ tc3_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->size;
}
if (DO_TEX2) {
const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
+ tc2 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data;
+ tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride;
if (DO_PTEX)
- tc2_size = VB->TexCoordPtr[t2]->size;
+ tc2_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size;
}
if (DO_TEX1) {
const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
+ tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data;
+ tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride;
if (DO_PTEX)
- tc1_size = VB->TexCoordPtr[t1]->size;
+ tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size;
}
if (DO_TEX0) {
const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = VB->TexCoordPtr[t0]->data;
+ tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride;
+ tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data;
if (DO_PTEX)
- tc0_size = VB->TexCoordPtr[t0]->size;
+ tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size;
}
if (DO_RGBA) {
@@ -410,22 +410,22 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* Force 'missing' texcoords to something valid.
*/
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+ if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3];
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+ if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2];
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1];
if (DO_PTEX)
return GL_TRUE;
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) ||
- (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4))
+ if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) ||
+ (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
+ (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4) ||
+ (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4))
return GL_FALSE;
return GL_TRUE;
@@ -438,14 +438,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* Force 'missing' texcoords to something valid.
*/
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
+ if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3];
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
+ if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2];
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
+ if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] == 0)
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1];
if (DO_PTEX)
return GL_TRUE;
@@ -453,14 +453,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
/* No hardware support for projective texture. Can fake it for
* TEX0 only.
*/
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
+ if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) ||
+ (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) ||
+ (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) {
PTEX_FALLBACK();
return GL_FALSE;
}
- if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
+ if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) {
if (DO_TEX1 || DO_TEX2 || DO_TEX3) {
PTEX_FALLBACK();
}
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index f78a277601..a70fdc1fa0 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -128,10 +128,10 @@ int main( int argc, char **argv )
OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask );
OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] );
OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag );
- OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] );
- OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] );
- OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, TexCoordPtr[2] );
- OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, TexCoordPtr[3] );
+ OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX0] );
+ OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] );
+ OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] );
+ OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] );
OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr );
OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr );
OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr );
--
cgit v1.2.3
From 165b860da6f16ef4817a4959774a57f57ba3756d Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Tue, 17 Nov 2009 23:27:13 -0800
Subject: tnl: Replace deprecated ObjPtr with AttribPtr[_TNL_ATTRIB_POS]
---
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 8 ++++----
src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 4 ++--
src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 16 ++++++++--------
.../drivers/windows/gldirect/dx7/gld_primitive_dx7.c | 2 +-
.../drivers/windows/gldirect/dx8/gld_primitive_dx8.c | 2 +-
.../drivers/windows/gldirect/dx9/gld_primitive_dx9.c | 2 +-
src/mesa/tnl/t_context.h | 1 -
src/mesa/tnl/t_draw.c | 1 -
src/mesa/tnl/t_vb_fog.c | 13 +++++++------
src/mesa/tnl/t_vb_light.c | 10 +++++-----
src/mesa/tnl/t_vb_texgen.c | 2 +-
src/mesa/tnl/t_vb_vertex.c | 6 +++---
src/mesa/x86/gen_matypes.c | 2 +-
13 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 1cd1d6e778..74b66900c9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -196,12 +196,12 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (!rmesa->tcl.obj.buf)
rcommon_emit_vector( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_POS]->data,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->size,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->stride,
count);
- switch( VB->ObjPtr->size ) {
+ switch( VB->AttribPtr[_TNL_ATTRIB_POS]->size ) {
case 4: vfmt |= RADEON_CP_VC_FRMT_W0;
case 3: vfmt |= RADEON_CP_VC_FRMT_Z;
case 2: vfmt |= RADEON_CP_VC_FRMT_XY;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
index cb57416c3e..efb06db80e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
@@ -56,8 +56,8 @@ static void TAG(emit)( GLcontext *ctx,
radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __FUNCTION__);
- coord = (GLuint (*)[4])VB->ObjPtr->data;
- coord_stride = VB->ObjPtr->stride;
+ coord = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_POS]->data;
+ coord_stride = VB->AttribPtr[_TNL_ATTRIB_POS]->stride;
if (DO_TEX2) {
if (VB->AttribPtr[_TNL_ATTRIB_TEX2]) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index a6aff69aac..5ed11d0a9d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -326,7 +326,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (1) {
req |= RADEON_CP_VC_FRMT_Z;
- if (VB->ObjPtr->size == 4) {
+ if (VB->AttribPtr[_TNL_ATTRIB_POS]->size == 4) {
req |= RADEON_CP_VC_FRMT_W0;
}
}
@@ -390,19 +390,19 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
* this, add more vertex code (for obj-2, obj-3) or preferably move
* to maos.
*/
- if (VB->ObjPtr->size < 3 ||
- (VB->ObjPtr->size == 3 &&
+ if (VB->AttribPtr[_TNL_ATTRIB_POS]->size < 3 ||
+ (VB->AttribPtr[_TNL_ATTRIB_POS]->size == 3 &&
(setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) {
_math_trans_4f( rmesa->tcl.ObjClean.data,
- VB->ObjPtr->data,
- VB->ObjPtr->stride,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->data,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->stride,
GL_FLOAT,
- VB->ObjPtr->size,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->size,
0,
VB->Count );
- switch (VB->ObjPtr->size) {
+ switch (VB->AttribPtr[_TNL_ATTRIB_POS]->size) {
case 1:
_mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1);
case 2:
@@ -416,7 +416,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
break;
}
- VB->ObjPtr = &rmesa->tcl.ObjClean;
+ VB->AttribPtr[_TNL_ATTRIB_POS] = &rmesa->tcl.ObjClean;
}
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
index aa2e7e3a8d..46e652dc73 100644
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
+++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
@@ -241,7 +241,7 @@
DWORD dwColor;
#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
+ p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \
pV->Position.x = p4f[##v][0]; \
pV->Position.y = p4f[##v][1]; \
pV->Position.z = p4f[##v][2];
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
index 7cc2ef6f30..b95351553c 100644
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
+++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
@@ -241,7 +241,7 @@
DWORD dwColor;
#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
+ p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \
pV->Position.x = p4f[##v][0]; \
pV->Position.y = p4f[##v][1]; \
pV->Position.z = p4f[##v][2];
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
index 3b8af8546e..1b84cdee28 100644
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
+++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
@@ -241,7 +241,7 @@
DWORD dwColor;
#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
+ p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \
pV->Position.x = p4f[##v][0]; \
pV->Position.y = p4f[##v][1]; \
pV->Position.z = p4f[##v][2];
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index d2b13f1b02..bfba09fd56 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -203,7 +203,6 @@ struct vertex_buffer
* such as FogCoordPtr, etc.
*/
GLuint *Elts;
- GLvector4f *ObjPtr; /* _TNL_BIT_POS */
GLvector4f *EyePtr; /* _TNL_BIT_POS */
GLvector4f *ClipPtr; /* _TNL_BIT_POS */
GLvector4f *NdcPtr; /* _TNL_BIT_POS */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 202c6ae3ce..2a293243e5 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -254,7 +254,6 @@ static void bind_inputs( GLcontext *ctx,
/* Legacy pointers -- remove one day.
*/
- VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS];
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index f3a7bd49f4..a68310de4d 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -156,7 +156,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
GLuint i;
GLfloat *coord;
/* Fog is computed from vertex or fragment Z values */
- /* source = VB->ObjPtr or VB->EyePtr coords */
+ /* source = VB->AttribPtr[_TNL_ATTRIB_POS] or VB->EyePtr coords */
/* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */
VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord;
@@ -176,11 +176,12 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
/* Full eye coords weren't required, just calculate the
* eye Z values.
*/
- _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data,
- 4 * sizeof(GLfloat),
- VB->ObjPtr, plane );
+ _mesa_dotprod_tab[VB->AttribPtr[_TNL_ATTRIB_POS]->size]
+ ( (GLfloat *) input->data,
+ 4 * sizeof(GLfloat),
+ VB->AttribPtr[_TNL_ATTRIB_POS], plane );
- input->count = VB->ObjPtr->count;
+ input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count;
/* make sure coords are really positive
NOTE should avoid going through array twice */
@@ -213,7 +214,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
/* input->count may be one if glFogCoord was only called once
* before glBegin. But we need to compute fog for all vertices.
*/
- input->count = VB->ObjPtr->count;
+ input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count;
VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; /* dest data */
}
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index f47f99397c..360452192d 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -200,7 +200,7 @@ static GLboolean run_lighting( GLcontext *ctx,
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
+ GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->AttribPtr[_TNL_ATTRIB_POS];
GLuint idx;
if (!ctx->Light.Enabled || ctx->VertexProgram._Current)
@@ -208,13 +208,13 @@ static GLboolean run_lighting( GLcontext *ctx,
/* Make sure we can talk about position x,y and z:
*/
- if (input->size <= 2 && input == VB->ObjPtr) {
+ if (input->size <= 2 && input == VB->AttribPtr[_TNL_ATTRIB_POS]) {
_math_trans_4f( store->Input.data,
- VB->ObjPtr->data,
- VB->ObjPtr->stride,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->data,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->stride,
GL_FLOAT,
- VB->ObjPtr->size,
+ VB->AttribPtr[_TNL_ATTRIB_POS]->size,
0,
VB->Count );
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 83b74c0ebf..9ef13bc96d 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -341,7 +341,7 @@ static void texgen( GLcontext *ctx,
GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const GLvector4f *obj = VB->ObjPtr;
+ const GLvector4f *obj = VB->AttribPtr[_TNL_ATTRIB_POS];
const GLvector4f *eye = VB->EyePtr;
const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
const GLfloat *m = store->tmp_m;
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 4734754ea4..bc7e0951ec 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -152,16 +152,16 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
* Use combined ModelProject to avoid some depth artifacts
*/
if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY)
- VB->EyePtr = VB->ObjPtr;
+ VB->EyePtr = VB->AttribPtr[_TNL_ATTRIB_POS];
else
VB->EyePtr = TransformRaw( &store->eye,
ctx->ModelviewMatrixStack.Top,
- VB->ObjPtr);
+ VB->AttribPtr[_TNL_ATTRIB_POS]);
}
VB->ClipPtr = TransformRaw( &store->clip,
&ctx->_ModelProjectMatrix,
- VB->ObjPtr );
+ VB->AttribPtr[_TNL_ATTRIB_POS] );
/* Drivers expect this to be clean to element 4...
*/
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index a70fdc1fa0..61d6d16a76 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -120,7 +120,7 @@ int main( int argc, char **argv )
OFFSET( "VB_COUNT ", struct vertex_buffer, Count );
printf( "\n" );
OFFSET( "VB_ELTS ", struct vertex_buffer, Elts );
- OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr );
+ OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_POS] );
OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr );
OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr );
OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr );
--
cgit v1.2.3
From fc9a2970dc539b21b035ea0a770ec69822962145 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Tue, 17 Nov 2009 23:38:35 -0800
Subject: tnl: Replace deprecated IndexPtr[] with AttribPtr[] or new
BackfaceIndexPtr
---
src/mesa/swrast_setup/ss_tritmp.h | 2 +-
src/mesa/tnl/t_context.h | 7 +++++--
src/mesa/tnl/t_draw.c | 3 +--
src/mesa/tnl/t_vb_light.c | 1 -
src/mesa/tnl/t_vb_lighttmp.h | 8 ++++----
src/mesa/tnl/t_vertex_generic.c | 12 ++++++------
src/mesa/tnl_dd/t_dd_tritmp.h | 4 ++--
src/mesa/x86/gen_matypes.c | 2 +-
8 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 724b5e94fa..9700cf8c54 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -127,7 +127,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
} else {
- GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data;
+ GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data;
saved_index[0] = v[0]->attrib[FRAG_ATTRIB_CI][0];
saved_index[1] = v[1]->attrib[FRAG_ATTRIB_CI][0];
saved_index[2] = v[2]->attrib[FRAG_ATTRIB_CI][0];
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index bfba09fd56..b41cf93897 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -198,7 +198,10 @@ struct vertex_buffer
*/
GLuint Count; /**< Number of vertices currently in buffer */
- /* Pointers to current data.
+ /* Pointers to current data. Most of the data is in AttribPtr -- all of
+ * it that is one of VERT_ATTRIB_X. For things only produced by TNL,
+ * such as backface color or eye-space coordinates, they are stored
+ * here.
* XXX some of these fields alias AttribPtr below and should be removed
* such as FogCoordPtr, etc.
*/
@@ -211,7 +214,7 @@ struct vertex_buffer
GLubyte *ClipMask; /* _TNL_BIT_POS */
GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */
GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
- GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */
+ GLvector4f *BackfaceIndexPtr; /* _TNL_BIT_INDEX */
GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */
GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 2a293243e5..8092627645 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -256,8 +256,7 @@ static void bind_inputs( GLcontext *ctx,
*/
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
- VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
- VB->IndexPtr[1] = NULL;
+ VB->BackfaceIndexPtr = NULL;
VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
VB->SecondaryColorPtr[1] = NULL;
VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 360452192d..e72a807f0d 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -248,7 +248,6 @@ static GLboolean run_lighting( GLcontext *ctx,
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0];
VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
- VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0];
return GL_TRUE;
}
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index 124ca3c74f..dd117e435c 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -665,14 +665,14 @@ static void TAG(light_ci)( GLcontext *ctx,
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
- VB->IndexPtr[0] = &store->LitIndex[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = &store->LitIndex[0];
#if IDX & LIGHT_TWOSIDE
- VB->IndexPtr[1] = &store->LitIndex[1];
+ VB->BackfaceIndexPtr = &store->LitIndex[1];
#endif
- indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data;
+ indexResult[0] = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]->data;
#if IDX & LIGHT_TWOSIDE
- indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data;
+ indexResult[1] = (GLfloat *)VB->BackfaceIndexPtr->data;
#endif
/* loop over vertices */
diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index 9812f8c808..f97ad7c2ed 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -1115,10 +1115,10 @@ void _tnl_generic_interp_extras( GLcontext *ctx,
VB->SecondaryColorPtr[1]->data[in] );
}
- if (VB->IndexPtr[1]) {
- VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
- VB->IndexPtr[1]->data[out][0],
- VB->IndexPtr[1]->data[in][0] );
+ if (VB->BackfaceIndexPtr) {
+ VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t,
+ VB->BackfaceIndexPtr->data[out][0],
+ VB->BackfaceIndexPtr->data[in][0] );
}
if (VB->EdgeFlag) {
@@ -1145,8 +1145,8 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx,
VB->SecondaryColorPtr[1]->data[src] );
}
- if (VB->IndexPtr[1]) {
- VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0];
+ if (VB->BackfaceIndexPtr) {
+ VB->BackfaceIndexPtr->data[dst][0] = VB->BackfaceIndexPtr->data[src][0];
}
_tnl_generic_copy_pv(ctx, dst, src);
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 1ae70f4059..0e3bc1329d 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -237,7 +237,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
else {
- GLfloat (*vbindex) = (GLfloat *)VB->IndexPtr[1]->data;
+ GLfloat (*vbindex) = (GLfloat *)VB->BackfaceIndexPtr->data;
if (!DO_FLAT) {
VERT_SAVE_IND( 0 );
VERT_SAVE_IND( 1 );
@@ -506,7 +506,7 @@ static void TAG(quadr)( GLcontext *ctx,
}
}
else {
- GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data;
+ GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data;
if (!DO_FLAT) {
VERT_SAVE_IND( 0 );
VERT_SAVE_IND( 1 );
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index 61d6d16a76..5355c26874 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -132,7 +132,7 @@ int main( int argc, char **argv )
OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] );
OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] );
OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] );
- OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr );
+ OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] );
OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr );
OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr );
OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr );
--
cgit v1.2.3
From 0a9187801505130738ae947c69cafa8a1dd118d1 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 01:38:55 -0800
Subject: tnl: Replace deprecated ColorPtr[] with AttribPtr or new
BackfaceColorPtr.
---
src/mesa/drivers/dri/ffb/ffb_vbtmp.h | 8 ++---
src/mesa/drivers/dri/gamma/gamma_render.c | 4 +--
src/mesa/drivers/dri/mach64/mach64_native_vb.c | 30 +++++++++----------
src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 10 +++----
src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 16 +++++-----
src/mesa/drivers/dri/r300/r300_swtcl.c | 4 +--
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 14 ++++-----
src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 12 ++++----
src/mesa/drivers/dri/tdfx/tdfx_vb.c | 14 ++++-----
src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 6 ++--
src/mesa/drivers/glide/fxvb.c | 34 +++++++++++-----------
src/mesa/drivers/glide/fxvbtmp.h | 10 +++----
.../windows/gldirect/dx7/gld_primitive_dx7.c | 10 +++----
.../windows/gldirect/dx7/gld_vb_d3d_render_dx7.c | 2 +-
.../windows/gldirect/dx8/gld_primitive_dx8.c | 10 +++----
.../windows/gldirect/dx8/gld_vb_d3d_render_dx8.c | 2 +-
.../windows/gldirect/dx9/gld_primitive_dx9.c | 10 +++----
.../windows/gldirect/dx9/gld_vb_d3d_render_dx9.c | 2 +-
src/mesa/swrast_setup/ss_tritmp.h | 16 +++++-----
src/mesa/tnl/t_context.h | 6 ++--
src/mesa/tnl/t_draw.c | 6 ++--
src/mesa/tnl/t_vb_light.c | 5 +---
src/mesa/tnl/t_vb_lighttmp.h | 20 ++++++-------
src/mesa/tnl/t_vb_program.c | 8 ++---
src/mesa/tnl/t_vertex_generic.c | 34 +++++++++++-----------
src/mesa/tnl_dd/t_dd_dmatmp.h | 4 +--
src/mesa/tnl_dd/t_dd_tritmp.h | 34 +++++++++++-----------
src/mesa/tnl_dd/t_dd_vb.c | 30 +++++++++----------
src/mesa/tnl_dd/t_dd_vbtmp.h | 18 ++++++------
src/mesa/x86/gen_matypes.c | 4 +--
30 files changed, 189 insertions(+), 194 deletions(-)
diff --git a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h b/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
index 0495d0e276..c548ef3ad5 100644
--- a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
+++ b/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
@@ -38,11 +38,11 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end)
#endif
#if (IND & (FFB_VB_RGBA_BIT))
- col0 = VB->ColorPtr[0]->data;
- col0_stride = VB->ColorPtr[0]->stride;
+ col0 = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col0_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = VB->ColorPtr[1]->data;
- col1_stride = VB->ColorPtr[1]->stride;
+ col1 = VB->BackfaceColorPtr->data;
+ col1_stride = VB->BackfaceColorPtr->stride;
#endif
#endif
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
index 741936488a..a03a93d132 100644
--- a/src/mesa/drivers/dri/gamma/gamma_render.c
+++ b/src/mesa/drivers/dri/gamma/gamma_render.c
@@ -53,8 +53,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
GLfloat (*tc0)[4] = 0;
GLuint tc0_size = 0;
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
if (ctx->Texture.Unit[0]._ReallyEnabled) {
tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0]->stride;
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
index 99f1a14e17..816682ec5f 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
@@ -207,19 +207,19 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
+ if (VB->BackfaceColorPtr) {
+ assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, out),
+ GET_COLOR(VB->BackfaceColorPtr, in) );
- if (VB->SecondaryColorPtr[1]) {
+ if (VB->BackfaceSecondaryColorPtr) {
INTERP_3F( t,
- GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], out),
- GET_COLOR(VB->SecondaryColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, out),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, in) );
}
}
@@ -236,13 +236,13 @@ INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
+ if (VB->BackfaceColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, src) );
- if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], src) );
+ if (VB->BackfaceSecondaryColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, src) );
}
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
index 1a93e5f034..2af84fa9b6 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
@@ -123,9 +123,9 @@ static void TAG(emit)( GLcontext *ctx,
#endif
#if DO_SPEC
- if (VB->SecondaryColorPtr[0]) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
+ spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
+ spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
} else {
spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
spec_stride = 0;
@@ -144,8 +144,8 @@ static void TAG(emit)( GLcontext *ctx,
#endif
#if DO_RGBA
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
#endif
coord = VB->NdcPtr->data;
diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
index eb94e6e398..636b7de80f 100644
--- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
@@ -187,13 +187,13 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_RGBA) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
}
if (DO_SPEC) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
+ spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
+ spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
} else {
spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
spec_stride = 0;
@@ -384,8 +384,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
ASSERT(stride == 4);
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
/* Pack what's left into a 4-dword vertex. Color is in a different
* place, and there is no 'w' coordinate.
@@ -432,8 +432,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
GLfloat *v = (GLfloat *)dest;
int i;
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
if (start)
STRIDE_4F(col, col_stride * start);
diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c
index 677c504b90..99bd22edac 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -124,7 +124,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
}
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- VB->AttribPtr[VERT_ATTRIB_GENERIC0] = VB->ColorPtr[1];
+ VB->AttribPtr[VERT_ATTRIB_GENERIC0] = VB->BackfaceColorPtr;
OutputsWritten |= 1 << VERT_RESULT_BFC0;
#if MESA_LITTLE_ENDIAN
EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA );
@@ -134,7 +134,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1);
#endif
if (fp_reads & FRAG_BIT_COL1) {
- VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->SecondaryColorPtr[1];
+ VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->BackfaceSecondaryColorPtr;
GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE);
OutputsWritten |= 1 << VERT_RESULT_BFC1;
#if MESA_LITTLE_ENDIAN
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 74b66900c9..8b51af81a6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -227,9 +227,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (inputs & VERT_BIT_COLOR0) {
int emitsize;
- if (VB->ColorPtr[0]->size == 4 &&
- (VB->ColorPtr[0]->stride != 0 ||
- VB->ColorPtr[0]->data[0][3] != 1.0)) {
+ if (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size == 4 &&
+ (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride != 0 ||
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data[0][3] != 1.0)) {
vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
emitsize = 4;
}
@@ -242,9 +242,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (!rmesa->tcl.rgba.buf)
rcommon_emit_vector( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->ColorPtr[0]->data,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data,
emitsize,
- VB->ColorPtr[0]->stride,
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride,
count);
nr++;
@@ -256,9 +256,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
rcommon_emit_vector( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->SecondaryColorPtr[0]->data,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data,
3,
- VB->SecondaryColorPtr[0]->stride,
+ VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride,
count);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
index efb06db80e..aa53e98fc8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
@@ -122,9 +122,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_RGBA) {
- if (VB->ColorPtr[0]) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_COLOR0]) {
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
} else {
col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
col_stride = 0;
@@ -132,9 +132,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_SPEC_OR_FOG) {
- if (VB->SecondaryColorPtr[0]) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
+ spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
+ spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
} else {
spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
spec_stride = 0;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
index 4928802232..c200ba3255 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
@@ -69,11 +69,11 @@ static void interp_extras( GLcontext *ctx,
/*fprintf(stderr, "%s\n", __FUNCTION__);*/
- if (VB->ColorPtr[1]) {
+ if (VB->BackfaceColorPtr) {
INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, out),
+ GET_COLOR(VB->BackfaceColorPtr, in) );
}
if (VB->EdgeFlag) {
@@ -88,9 +88,9 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
+ if (VB->BackfaceColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, src) );
}
setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
index 809d5d7dd9..07e6e9a6a7 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
@@ -76,9 +76,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (IND & TDFX_RGBA_BIT) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- col_size = VB->ColorPtr[0]->size;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
+ col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
}
if (IND & TDFX_FOGC_BIT) {
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index 1dc5f9891a..cc9ad0e8b8 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -104,24 +104,24 @@ static void interp_extras( GLcontext *ctx,
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- /* If stride is zero, ColorPtr[1] is constant across the VB, so
+ if (VB->BackfaceColorPtr) {
+ /* If stride is zero, BackfaceColorPtr is constant across the VB, so
* there is no point interpolating between two values as they will
* be identical. This case is handled in t_dd_tritmp.h
*/
- if (VB->ColorPtr[1]->stride) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
+ if (VB->BackfaceColorPtr->stride) {
+ assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, out),
+ GET_COLOR(VB->BackfaceColorPtr, in) );
}
- if (VB->SecondaryColorPtr[1]) {
+ if (VB->BackfaceSecondaryColorPtr) {
INTERP_3F( t,
- GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], out),
- GET_COLOR(VB->SecondaryColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, out),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, in) );
}
}
@@ -137,13 +137,13 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
+ if (VB->BackfaceColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, src) );
- if (VB->SecondaryColorPtr[1]) {
- COPY_3FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], src) );
+ if (VB->BackfaceSecondaryColorPtr) {
+ COPY_3FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, src) );
}
}
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index 674d9c6799..742f500863 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -80,14 +80,14 @@ static void TAG(emit)( GLcontext *ctx,
}
if (IND & SETUP_RGBA) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- col_size = VB->ColorPtr[0]->size;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
+ col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
}
if (IND & SETUP_SPEC) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
+ spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
+ spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
}
if (IND & SETUP_FOGC) {
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
index 46e652dc73..0b373814fe 100644
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
+++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
@@ -189,9 +189,9 @@
GLfloat ex,ey,fx,fy,cc; \
/* Get vars for later */ \
VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
+ vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \
+ if (VB->BackfaceSecondaryColorPtr) { \
+ vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \
} else { \
vbspec = NULL; \
} \
@@ -247,12 +247,12 @@
pV->Position.z = p4f[##v][2];
#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \
pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \
dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_USE_FLAT_COLOUR_3D \
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
index a85620dde8..c39775cad3 100644
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
+++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
@@ -151,7 +151,7 @@ static GLboolean gld_d3d_render_stage_run(
#if 0
// For debugging: Useful to see if an app passes colour data in
// an unusual format.
- switch (VB->ColorPtr[0]->Type) {
+ switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) {
case GL_FLOAT:
ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
break;
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
index b95351553c..990922580a 100644
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
+++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
@@ -189,9 +189,9 @@
GLfloat ex,ey,fx,fy,cc; \
/* Get vars for later */ \
VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
+ vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \
+ if (VB->BackfaceSecondaryColorPtr) { \
+ vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \
} else { \
vbspec = NULL; \
} \
@@ -247,12 +247,12 @@
pV->Position.z = p4f[##v][2];
#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \
pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \
dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_USE_FLAT_COLOUR_3D \
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
index cafbf4f5c5..265c81fb4a 100644
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
+++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
@@ -149,7 +149,7 @@ static GLboolean gld_d3d_render_stage_run(
#if 0
// For debugging: Useful to see if an app passes colour data in
// an unusual format.
- switch (VB->ColorPtr[0]->Type) {
+ switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) {
case GL_FLOAT:
ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
break;
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
index 1b84cdee28..fd4dd4ed75 100644
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
+++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
@@ -189,9 +189,9 @@
GLfloat ex,ey,fx,fy,cc; \
/* Get vars for later */ \
VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
+ vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \
+ if (VB->BackfaceSecondaryColorPtr) { \
+ vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \
} else { \
vbspec = NULL; \
} \
@@ -247,12 +247,12 @@
pV->Position.z = p4f[##v][2];
#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \
pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
+ p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR00]->data; \
dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
#define GLD_SETUP_USE_FLAT_COLOUR_3D \
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
index 4fa6bcaf1a..91a68b3f2d 100644
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
+++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
@@ -149,7 +149,7 @@ static GLboolean gld_d3d_render_stage_run(
#if 0
// For debugging: Useful to see if an app passes colour data in
// an unusual format.
- switch (VB->ColorPtr[0]->Type) {
+ switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) {
case GL_FLOAT:
ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
break;
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 9700cf8c54..17f3863956 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -67,8 +67,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (facing == 1) {
if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- if (VB->ColorPtr[1]) {
- GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ if (VB->BackfaceColorPtr) {
+ GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
if (swsetup->intColors) {
COPY_CHAN4(saved_color[0], v[0]->color);
@@ -81,7 +81,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]);
}
- if (VB->ColorPtr[1]->stride) {
+ if (VB->BackfaceColorPtr->stride) {
if (swsetup->intColors) {
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
@@ -108,14 +108,14 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
- if (VB->SecondaryColorPtr[1]) {
- GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
+ if (VB->BackfaceSecondaryColorPtr) {
+ GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]);
COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]);
COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]);
- if (VB->SecondaryColorPtr[1]->stride) {
+ if (VB->BackfaceSecondaryColorPtr->stride) {
SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]);
SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]);
SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]);
@@ -200,7 +200,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & SS_TWOSIDE_BIT) {
if (facing == 1) {
if (IND & SS_RGBA_BIT) {
- if (VB->ColorPtr[1]) {
+ if (VB->BackfaceColorPtr) {
if (swsetup->intColors) {
COPY_CHAN4(v[0]->color, saved_color[0]);
COPY_CHAN4(v[1]->color, saved_color[1]);
@@ -213,7 +213,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
- if (VB->SecondaryColorPtr[1]) {
+ if (VB->BackfaceSecondaryColorPtr) {
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]);
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]);
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]);
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index b41cf93897..09ff8f8252 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -214,9 +214,9 @@ struct vertex_buffer
GLubyte *ClipMask; /* _TNL_BIT_POS */
GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */
GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
- GLvector4f *BackfaceIndexPtr; /* _TNL_BIT_INDEX */
- GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */
- GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
+ GLvector4f *BackfaceIndexPtr;
+ GLvector4f *BackfaceColorPtr;
+ GLvector4f *BackfaceSecondaryColorPtr;
GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
const struct _mesa_prim *Primitive;
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 8092627645..0862fdfa85 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -254,11 +254,9 @@ static void bind_inputs( GLcontext *ctx,
/* Legacy pointers -- remove one day.
*/
- VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
- VB->ColorPtr[1] = NULL;
+ VB->BackfaceColorPtr = NULL;
VB->BackfaceIndexPtr = NULL;
- VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
- VB->SecondaryColorPtr[1] = NULL;
+ VB->BackfaceSecondaryColorPtr = NULL;
VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
/* Clipping and drawing code still requires this to be a packed
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index e72a807f0d..8a0fe63fd8 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -127,7 +127,7 @@ prepare_materials(GLcontext *ctx,
const GLuint bitmask = ctx->Light.ColorMaterialBitmask;
for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
if (bitmask & (1<AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->ColorPtr[0];
+ VB->AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
}
/* Now, for each material attribute that's tracking vertex color, save
@@ -246,9 +246,6 @@ static GLboolean run_lighting( GLcontext *ctx,
*/
store->light_func_tab[idx]( ctx, VB, stage, input );
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0];
- VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
-
return GL_TRUE;
}
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index dd117e435c..4ebef2356f 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -72,13 +72,13 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
- VB->ColorPtr[0] = &store->LitColor[0];
- VB->SecondaryColorPtr[0] = &store->LitSecondary[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->LitSecondary[0];
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
#if IDX & LIGHT_TWOSIDE
- VB->ColorPtr[1] = &store->LitColor[1];
- VB->SecondaryColorPtr[1] = &store->LitSecondary[1];
+ VB->BackfaceColorPtr = &store->LitColor[1];
+ VB->BackfaceSecondaryColorPtr = &store->LitSecondary[1];
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
#endif
@@ -259,11 +259,11 @@ static void TAG(light_rgba)( GLcontext *ctx,
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
- VB->ColorPtr[0] = &store->LitColor[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
#if IDX & LIGHT_TWOSIDE
- VB->ColorPtr[1] = &store->LitColor[1];
+ VB->BackfaceColorPtr = &store->LitColor[1];
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
#endif
@@ -449,9 +449,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
(void) input; /* doesn't refer to Eye or Obj */
- VB->ColorPtr[0] = &store->LitColor[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
#if IDX & LIGHT_TWOSIDE
- VB->ColorPtr[1] = &store->LitColor[1];
+ VB->BackfaceColorPtr = &store->LitColor[1];
#endif
if (nr > 1) {
@@ -559,9 +559,9 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- VB->ColorPtr[0] = &store->LitColor[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
#if IDX & LIGHT_TWOSIDE
- VB->ColorPtr[1] = &store->LitColor[1];
+ VB->BackfaceColorPtr = &store->LitColor[1];
#endif
if (nr > 1) {
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index d76b0a6b9d..7002f74a00 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -454,10 +454,10 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
VB->ClipPtr->count = VB->Count;
}
- VB->ColorPtr[0] = &store->results[VERT_RESULT_COL0];
- VB->ColorPtr[1] = &store->results[VERT_RESULT_BFC0];
- VB->SecondaryColorPtr[0] = &store->results[VERT_RESULT_COL1];
- VB->SecondaryColorPtr[1] = &store->results[VERT_RESULT_BFC1];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0];
+ VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1];
+ VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1];
VB->FogCoordPtr = &store->results[VERT_RESULT_FOGC];
VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0];
diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index f97ad7c2ed..fa34d11d7b 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -1092,27 +1092,27 @@ void _tnl_generic_interp_extras( GLcontext *ctx,
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- /* If stride is zero, ColorPtr[1] is constant across the VB, so
+ /* If stride is zero, BackfaceColorPtr is constant across the VB, so
* there is no point interpolating between two values as they will
* be identical. In all other cases, this value is generated by
* t_vb_lighttmp.h and has a stride of 4 dwords.
*/
- if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
+ if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
+ assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
INTERP_4F( t,
- VB->ColorPtr[1]->data[dst],
- VB->ColorPtr[1]->data[out],
- VB->ColorPtr[1]->data[in] );
+ VB->BackfaceColorPtr->data[dst],
+ VB->BackfaceColorPtr->data[out],
+ VB->BackfaceColorPtr->data[in] );
}
- if (VB->SecondaryColorPtr[1]) {
- assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat));
+ if (VB->BackfaceSecondaryColorPtr) {
+ assert(VB->BackfaceSecondaryColorPtr->stride == 4 * sizeof(GLfloat));
INTERP_3F( t,
- VB->SecondaryColorPtr[1]->data[dst],
- VB->SecondaryColorPtr[1]->data[out],
- VB->SecondaryColorPtr[1]->data[in] );
+ VB->BackfaceSecondaryColorPtr->data[dst],
+ VB->BackfaceSecondaryColorPtr->data[out],
+ VB->BackfaceSecondaryColorPtr->data[in] );
}
if (VB->BackfaceIndexPtr) {
@@ -1135,14 +1135,14 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx,
/* See above comment:
*/
- if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
- COPY_4FV( VB->ColorPtr[1]->data[dst],
- VB->ColorPtr[1]->data[src] );
+ if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
+ COPY_4FV( VB->BackfaceColorPtr->data[dst],
+ VB->BackfaceColorPtr->data[src] );
}
- if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( VB->SecondaryColorPtr[1]->data[dst],
- VB->SecondaryColorPtr[1]->data[src] );
+ if (VB->BackfaceSecondaryColorPtr) {
+ COPY_4FV( VB->BackfaceSecondaryColorPtr->data[dst],
+ VB->BackfaceSecondaryColorPtr->data[src] );
}
if (VB->BackfaceIndexPtr) {
diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index e4b535fb68..e5885782c7 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -443,7 +443,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
} else if (HAVE_TRI_STRIPS &&
ctx->Light.ShadeModel == GL_FLAT &&
- TNL_CONTEXT(ctx)->vb.ColorPtr[0]->stride) {
+ TNL_CONTEXT(ctx)->vb.AttribPtr[_TNL_ATTRIB_COLOR0]->stride) {
if (HAVE_ELTS) {
LOCAL_VARS;
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
@@ -1221,7 +1221,7 @@ static GLboolean TAG(validate_render)( GLcontext *ctx,
ok = GL_TRUE;
} else if (HAVE_TRI_STRIPS &&
ctx->Light.ShadeModel == GL_FLAT &&
- VB->ColorPtr[0]->stride != 0) {
+ VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride != 0) {
if (HAVE_ELTS) {
ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS();
}
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 0e3bc1329d..8574fe618b 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -195,7 +195,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
else {
- GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
(void) vbcolor;
if (!DO_FLAT) {
@@ -204,8 +204,8 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
VERT_SAVE_RGBA( 2 );
- if (VB->ColorPtr[1]->stride) {
- ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLfloat));
+ if (VB->BackfaceColorPtr->stride) {
+ ASSERT(VB->BackfaceColorPtr->stride == 4*sizeof(GLfloat));
if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
@@ -221,9 +221,9 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
VERT_SET_RGBA( v[2], vbcolor[0] );
}
- if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
- GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
- ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLfloat));
+ if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
+ GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
+ ASSERT(VB->BackfaceSecondaryColorPtr->stride == 4*sizeof(GLfloat));
if (!DO_FLAT) {
VERT_SAVE_SPEC( 0 );
@@ -279,7 +279,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
VERT_SAVE_RGBA( 1 );
VERT_COPY_RGBA( v[0], v[2] );
VERT_COPY_RGBA( v[1], v[2] );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_SAVE_SPEC( 0 );
VERT_SAVE_SPEC( 1 );
VERT_COPY_SPEC( v[0], v[2] );
@@ -374,7 +374,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (HAVE_RGBA) {
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_RESTORE_SPEC( 0 );
VERT_RESTORE_SPEC( 1 );
}
@@ -436,7 +436,7 @@ static void TAG(quadr)( GLcontext *ctx,
if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
- GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data;
(void)vbcolor;
if (HAVE_BACK_COLORS) {
@@ -471,7 +471,7 @@ static void TAG(quadr)( GLcontext *ctx,
}
VERT_SAVE_RGBA( 3 );
- if (VB->ColorPtr[1]->stride) {
+ if (VB->BackfaceColorPtr->stride) {
if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
VERT_SET_RGBA( v[1], vbcolor[e1] );
@@ -488,9 +488,9 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_SET_RGBA( v[3], vbcolor[0] );
}
- if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
- GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
- ASSERT(VB->SecondaryColorPtr[1]->stride==4*sizeof(GLfloat));
+ if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) {
+ GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
+ ASSERT(VB->BackfaceSecondaryColorPtr->stride==4*sizeof(GLfloat));
if (!DO_FLAT) {
VERT_SAVE_SPEC( 0 );
@@ -553,7 +553,7 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_COPY_RGBA( v[0], v[3] );
VERT_COPY_RGBA( v[1], v[3] );
VERT_COPY_RGBA( v[2], v[3] );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_SAVE_SPEC( 0 );
VERT_SAVE_SPEC( 1 );
VERT_SAVE_SPEC( 2 );
@@ -659,7 +659,7 @@ static void TAG(quadr)( GLcontext *ctx,
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
VERT_RESTORE_RGBA( 2 );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_RESTORE_SPEC( 0 );
VERT_RESTORE_SPEC( 1 );
VERT_RESTORE_SPEC( 2 );
@@ -708,7 +708,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
if (HAVE_RGBA) {
VERT_SAVE_RGBA( 0 );
VERT_COPY_RGBA( v[0], v[1] );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_SAVE_SPEC( 0 );
VERT_COPY_SPEC( v[0], v[1] );
}
@@ -725,7 +725,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
if (HAVE_RGBA) {
VERT_RESTORE_RGBA( 0 );
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
+ if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
VERT_RESTORE_SPEC( 0 );
}
}
diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c
index b3937c29a0..a8a0a69768 100644
--- a/src/mesa/tnl_dd/t_dd_vb.c
+++ b/src/mesa/tnl_dd/t_dd_vb.c
@@ -297,19 +297,19 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
+ if (VB->BackfaceColorPtr) {
+ assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, out),
+ GET_COLOR(VB->BackfaceColorPtr, in) );
- if (VB->SecondaryColorPtr[1]) {
+ if (VB->BackfaceSecondaryColorPtr) {
INTERP_3F( t,
- GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], out),
- GET_COLOR(VB->SecondaryColorPtr[1], in) );
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, out),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, in) );
}
}
@@ -326,13 +326,13 @@ INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
+ if (VB->BackfaceColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst),
+ GET_COLOR(VB->BackfaceColorPtr, src) );
- if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], src) );
+ if (VB->BackfaceSecondaryColorPtr) {
+ COPY_4FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
+ GET_COLOR(VB->BackfaceSecondaryColorPtr, src) );
}
}
diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h
index c1cc6ae1bf..a35218a158 100644
--- a/src/mesa/tnl_dd/t_dd_vbtmp.h
+++ b/src/mesa/tnl_dd/t_dd_vbtmp.h
@@ -184,15 +184,15 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_RGBA) {
- col_stride = VB->ColorPtr[0]->stride;
- col = VB->ColorPtr[0]->data;
- col_size = VB->ColorPtr[0]->size;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
}
if (DO_SPEC) {
- if (VB->SecondaryColorPtr[0]) {
- spec_stride = VB->SecondaryColorPtr[0]->stride;
- spec = VB->SecondaryColorPtr[0]->data;
+ if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) {
+ spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
+ spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
} else {
spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
spec_stride = 0;
@@ -356,9 +356,9 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
ASSERT(stride == 4);
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- col_size = VB->ColorPtr[0]->size;
+ col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
+ col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
+ col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
/* fprintf(stderr, "%s(small) importable %x\n", */
/* __FUNCTION__, VB->importable_data); */
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index 5355c26874..ce91b75f3a 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -133,8 +133,8 @@ int main( int argc, char **argv )
OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] );
OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] );
OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] );
- OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr );
- OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr );
+ OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] );
+ OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] );
OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr );
OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive );
printf( "\n" );
--
cgit v1.2.3
From 37c79d4d765b10a79e0cf217cc1e70d3fbb7a0c5 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 01:45:42 -0800
Subject: tnl: Replace deprecated FogCoordPtr with AttribPtr[_TNL_ATTRIB_FOG]
---
src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 6 +++---
src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 6 +++---
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++--
src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 6 +++---
src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 4 ++--
src/mesa/drivers/glide/fxvbtmp.h | 4 ++--
src/mesa/tnl/t_context.h | 3 ---
src/mesa/tnl/t_draw.c | 5 +----
src/mesa/tnl/t_vb_fog.c | 1 -
src/mesa/tnl/t_vb_program.c | 8 ++------
src/mesa/tnl_dd/t_dd_vbtmp.h | 6 +++---
src/mesa/x86/gen_matypes.c | 2 +-
12 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
index 2af84fa9b6..6e5fa3520e 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
@@ -133,9 +133,9 @@ static void TAG(emit)( GLcontext *ctx,
#endif
#if DO_FOG
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_FOG]) {
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
} else {
static GLfloat tmp[4] = {0, 0, 0, 0};
fog = &tmp;
diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
index 636b7de80f..60bfab8f6d 100644
--- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
+++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
@@ -200,9 +200,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_FOG]) {
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
} else {
static GLfloat tmp[4] = {0, 0, 0, 0};
fog = &tmp;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 8b51af81a6..de18d2ddd6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -273,8 +273,8 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (!rmesa->tcl.fog.buf)
emit_vecfog( ctx,
&(rmesa->tcl.aos[nr]),
- (char *)VB->FogCoordPtr->data,
- VB->FogCoordPtr->stride,
+ (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
+ VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
count);
vfmt |= RADEON_CP_VC_FRMT_FPFOG;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
index aa53e98fc8..d764ccb982 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
@@ -142,9 +142,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_SPEC_OR_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_FOG]) {
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
} else {
fog = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_FOG];
fog_stride = 0;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
index 07e6e9a6a7..19baf7d0d2 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
@@ -82,8 +82,8 @@ static void TAG(emit)( GLcontext *ctx,
}
if (IND & TDFX_FOGC_BIT) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
}
{
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index 742f500863..f7893c1573 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -91,8 +91,8 @@ static void TAG(emit)( GLcontext *ctx,
}
if (IND & SETUP_FOGC) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
}
if (start) {
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 09ff8f8252..ebaae6335b 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -202,8 +202,6 @@ struct vertex_buffer
* it that is one of VERT_ATTRIB_X. For things only produced by TNL,
* such as backface color or eye-space coordinates, they are stored
* here.
- * XXX some of these fields alias AttribPtr below and should be removed
- * such as FogCoordPtr, etc.
*/
GLuint *Elts;
GLvector4f *EyePtr; /* _TNL_BIT_POS */
@@ -217,7 +215,6 @@ struct vertex_buffer
GLvector4f *BackfaceIndexPtr;
GLvector4f *BackfaceColorPtr;
GLvector4f *BackfaceSecondaryColorPtr;
- GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
const struct _mesa_prim *Primitive;
GLuint PrimitiveCount;
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 0862fdfa85..1c7c733883 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -251,13 +251,10 @@ static void bind_inputs( GLcontext *ctx,
*/
VB->Count = count;
-
- /* Legacy pointers -- remove one day.
- */
+ /* These should perhaps be part of _TNL_ATTRIB_* */
VB->BackfaceColorPtr = NULL;
VB->BackfaceIndexPtr = NULL;
VB->BackfaceSecondaryColorPtr = NULL;
- VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
/* Clipping and drawing code still requires this to be a packed
* array of ubytes which can be written into. TODO: Fix and
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index a68310de4d..4a0e6ad4f9 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -228,7 +228,6 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
VB->AttribPtr[_TNL_ATTRIB_FOG] = input;
}
- VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
return GL_TRUE;
}
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 7002f74a00..c289cdfbaa 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -454,16 +454,12 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
VB->ClipPtr->count = VB->Count;
}
- VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0];
- VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0];
- VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1];
- VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1];
- VB->FogCoordPtr = &store->results[VERT_RESULT_FOGC];
-
VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0];
VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1];
VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VERT_RESULT_FOGC];
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ];
+ VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0];
+ VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1];
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]
diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h
index a35218a158..85101b9ceb 100644
--- a/src/mesa/tnl_dd/t_dd_vbtmp.h
+++ b/src/mesa/tnl_dd/t_dd_vbtmp.h
@@ -200,9 +200,9 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ if (VB->AttribPtr[_TNL_ATTRIB_FOG]) {
+ fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
}
else {
static GLfloat tmp[4] = {0, 0, 0, 0};
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index ce91b75f3a..0d7e0f1f98 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -135,7 +135,7 @@ int main( int argc, char **argv )
OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] );
OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] );
OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] );
- OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr );
+ OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_FOG] );
OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive );
printf( "\n" );
--
cgit v1.2.3
From cc39fcad89db2a4fc96b64915d42e5b1ac59d345 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 02:58:15 -0800
Subject: i915: Remove dead meta_draw_quad code.
---
src/mesa/drivers/dri/i915/intel_tris.c | 78 ------------------------------
src/mesa/drivers/dri/intel/intel_context.h | 8 ---
2 files changed, 86 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index bc527aae47..8a3ab39bc2 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -1250,81 +1250,6 @@ union fi
GLint i;
};
-
-/**********************************************************************/
-/* Used only with the metaops callbacks. */
-/**********************************************************************/
-static void
-intel_meta_draw_poly(struct intel_context *intel,
- GLuint n,
- GLfloat xy[][2],
- GLfloat z, GLuint color, GLfloat tex[][2])
-{
- union fi *vb;
- GLint i;
- unsigned int saved_vertex_size = intel->vertex_size;
-
- LOCK_HARDWARE(intel);
-
- intel->vertex_size = 6;
-
- /* All 3d primitives should be emitted with LOOP_CLIPRECTS,
- * otherwise the drawing origin (DR4) might not be set correctly.
- */
- intel_set_prim(intel, PRIM3D_TRIFAN);
- vb = (union fi *) intel_get_prim_space(intel, n);
-
- for (i = 0; i < n; i++) {
- vb[0].f = xy[i][0];
- vb[1].f = xy[i][1];
- vb[2].f = z;
- vb[3].i = color;
- vb[4].f = tex[i][0];
- vb[5].f = tex[i][1];
- vb += 6;
- }
-
- INTEL_FIREVERTICES(intel);
-
- intel->vertex_size = saved_vertex_size;
-
- UNLOCK_HARDWARE(intel);
-}
-
-static void
-intel_meta_draw_quad(struct intel_context *intel,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLfloat z,
- GLuint color,
- GLfloat s0, GLfloat s1, GLfloat t0, GLfloat t1)
-{
- GLfloat xy[4][2];
- GLfloat tex[4][2];
-
- xy[0][0] = x0;
- xy[0][1] = y0;
- xy[1][0] = x1;
- xy[1][1] = y0;
- xy[2][0] = x1;
- xy[2][1] = y1;
- xy[3][0] = x0;
- xy[3][1] = y1;
-
- tex[0][0] = s0;
- tex[0][1] = t0;
- tex[1][0] = s1;
- tex[1][1] = t0;
- tex[2][0] = s1;
- tex[2][1] = t1;
- tex[3][0] = s0;
- tex[3][1] = t1;
-
- intel_meta_draw_poly(intel, 4, xy, z, color, tex);
-}
-
-
-
/**********************************************************************/
/* Initialization. */
/**********************************************************************/
@@ -1333,7 +1258,6 @@ intel_meta_draw_quad(struct intel_context *intel,
void
intelInitTriFuncs(GLcontext * ctx)
{
- struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
@@ -1350,6 +1274,4 @@ intelInitTriFuncs(GLcontext * ctx)
tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
tnl->Driver.Render.CopyPV = _tnl_copy_pv;
tnl->Driver.Render.Interp = _tnl_interp;
-
- intel->vtbl.meta_draw_quad = intel_meta_draw_quad;
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index eb7be7ddd0..81beff4819 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -135,14 +135,6 @@ struct intel_context
struct intel_region * draw_region,
struct intel_region * depth_region);
- void (*meta_draw_quad)(struct intel_context *intel,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLfloat z,
- GLuint color, /* ARGB32 */
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1);
-
void (*meta_color_mask) (struct intel_context * intel, GLboolean);
void (*meta_stencil_replace) (struct intel_context * intel,
--
cgit v1.2.3
From 92d35b91f132deda1fb27d2071a50e8187301fe5 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:01:42 -0800
Subject: i965: Pack the brw_wm_prog_key better.
---
src/mesa/drivers/dri/i965/brw_wm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 9dcb6e14bb..b9b987ea70 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -76,10 +76,10 @@ struct brw_wm_prog_key {
GLushort tex_swizzles[BRW_MAX_TEX_UNIT];
- GLuint program_string_id:32;
GLushort origin_x, origin_y;
GLushort drawable_height;
GLbitfield64 vp_outputs_written;
+ GLuint program_string_id:32;
};
--
cgit v1.2.3
From 15fa484f514726a29bbf24df33c0551844f878d0 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:05:14 -0800
Subject: mesa: Remove gratuitous padding in prog_dst_register.
The padding was there to indicate the amount of space left from the
number of expected bytes in the struct minus allocated bits. But
uint bitfields get packed so that they don't cross uint boundaries, and we
ended up allocating an extra dword to hold the pad field!
---
src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 -
src/mesa/main/ffvertex_prog.c | 1 -
src/mesa/shader/prog_instruction.h | 1 -
3 files changed, 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 7d03179588..3737faf26f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -138,7 +138,6 @@ static struct prog_dst_register dst_reg(GLuint file, GLuint idx)
reg.CondMask = COND_TR;
reg.CondSwizzle = 0;
reg.CondSrc = 0;
- reg.pad = 0;
return reg;
}
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index fe2416d894..5cfa898031 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -523,7 +523,6 @@ static void emit_dst( struct prog_dst_register *dst,
dst->CondMask = COND_TR; /* always pass cond test */
dst->CondSwizzle = SWIZZLE_NOOP;
dst->CondSrc = 0;
- dst->pad = 0;
/* Check that bitfield sizes aren't exceeded */
ASSERT(dst->Index == reg.idx);
}
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 1c687bc16c..224350caac 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -312,7 +312,6 @@ struct prog_dst_register
*/
GLuint CondSrc:1;
/*@}*/
- GLuint pad:28;
};
--
cgit v1.2.3
From edd449fb9714ec1aa2d6c0cf95623f460594e685 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:13:14 -0800
Subject: i965: Pack brw_wm_fragment_program better.
---
src/mesa/drivers/dri/i965/brw_context.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index fded47aa2f..6d2ce15682 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -172,8 +172,8 @@ struct brw_fragment_program {
GLuint id; /**< serial no. to identify frag progs, never re-used */
GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */
- dri_bo *const_buffer; /** Program constant buffer/surface */
GLboolean use_const_buffer;
+ dri_bo *const_buffer; /** Program constant buffer/surface */
/** for debugging, which texture units are referenced */
GLbitfield tex_units_used;
--
cgit v1.2.3
From a376e5c48237be0300bce6702ed947086d3ee23f Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:21:17 -0800
Subject: intel: Consistently use no_batch_wrap in intel_context struct.
---
src/mesa/drivers/dri/i915/i830_vtbl.c | 3 ---
src/mesa/drivers/dri/i915/i915_vtbl.c | 3 ---
src/mesa/drivers/dri/i965/brw_context.h | 1 -
src/mesa/drivers/dri/i965/brw_draw.c | 4 ++--
src/mesa/drivers/dri/i965/brw_vtbl.c | 3 ---
src/mesa/drivers/dri/intel/intel_batchbuffer.c | 3 +++
6 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 7d76b39caa..c05c7759ac 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -714,9 +714,6 @@ i830_new_batch(struct intel_context *intel)
{
struct i830_context *i830 = i830_context(&intel->ctx);
i830->state.emitted = 0;
-
- /* Check that we didn't just wrap our batchbuffer at a bad time. */
- assert(!intel->no_batch_wrap);
}
static void
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 77ba8d5581..3e7b5101cc 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -667,9 +667,6 @@ i915_new_batch(struct intel_context *intel)
* difficulties associated with them (physical address requirements).
*/
i915->state.emitted = 0;
-
- /* Check that we didn't just wrap our batchbuffer at a bad time. */
- assert(!intel->no_batch_wrap);
}
static void
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6d2ce15682..e73e21433c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -438,7 +438,6 @@ struct brw_context
GLuint primitive;
GLboolean emit_state_always;
- GLboolean no_batch_wrap;
struct {
struct brw_state_flags dirty;
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 8bcb6083f7..7ad860898f 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -145,7 +145,7 @@ static void brw_emit_prim(struct brw_context *brw,
prim_packet.base_vert_location = prim->basevertex;
/* Can't wrap here, since we rely on the validated state. */
- brw->no_batch_wrap = GL_TRUE;
+ intel->no_batch_wrap = GL_TRUE;
/* If we're set to always flush, do it before and after the primitive emit.
* We want to catch both missed flushes that hurt instruction/state cache
@@ -163,7 +163,7 @@ static void brw_emit_prim(struct brw_context *brw,
intel_batchbuffer_emit_mi_flush(intel->batch);
}
- brw->no_batch_wrap = GL_FALSE;
+ intel->no_batch_wrap = GL_FALSE;
}
static void brw_merge_inputs( struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 114e6bd018..dc47f08dd4 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -144,9 +144,6 @@ static void brw_new_batch( struct intel_context *intel )
{
struct brw_context *brw = brw_context(&intel->ctx);
- /* Check that we didn't just wrap our batchbuffer at a bad time. */
- assert(!brw->no_batch_wrap);
-
brw->curbe.need_new_bo = GL_TRUE;
/* Mark all context state as needing to be re-emitted.
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index ca6e2fa5b1..12c5a30d6b 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -244,6 +244,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
if (intel->vtbl.finish_batch)
intel->vtbl.finish_batch(intel);
+ /* Check that we didn't just wrap our batchbuffer at a bad time. */
+ assert(!intel->no_batch_wrap);
+
batch->reserved_space = BATCH_RESERVED;
/* TODO: Just pass the relocation list and dma buffer up to the
--
cgit v1.2.3
From c4b7c47fe3135f852919cf2d4a2f64210e8cf125 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:32:35 -0800
Subject: intel: Pack colors for blit at blit time, rather than at ClearColor.
---
src/mesa/drivers/dri/intel/intel_blit.c | 5 +++--
src/mesa/drivers/dri/intel/intel_context.h | 4 ----
src/mesa/drivers/dri/intel/intel_state.c | 20 --------------------
3 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 817223da41..f14854602b 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -499,10 +499,11 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_XRGB8888:
- clearVal = intel->ClearColor8888;
+ clearVal = PACK_COLOR_8888(clear[3], clear[0],
+ clear[1], clear[2]);
break;
case MESA_FORMAT_RGB565:
- clearVal = intel->ClearColor565;
+ clearVal = PACK_COLOR_565(clear[0], clear[1], clear[2]);
break;
case MESA_FORMAT_ARGB4444:
clearVal = PACK_COLOR_4444(clear[3], clear[0],
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 81beff4819..2d352090a5 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -209,10 +209,6 @@ struct intel_context
char *prevLockFile;
int prevLockLine;
- GLuint ClearColor565;
- GLuint ClearColor8888;
-
-
/* Offsets of fields within the current vertex:
*/
GLuint coloroffset;
diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c
index 4ee742377d..aefae53eb2 100644
--- a/src/mesa/drivers/dri/intel/intel_state.c
+++ b/src/mesa/drivers/dri/intel/intel_state.c
@@ -196,25 +196,6 @@ intel_translate_logic_op(GLenum opcode)
}
}
-
-static void
-intelClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- struct intel_context *intel = intel_context(ctx);
- GLubyte clear[4];
-
- CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
-
- /* compute both 32 and 16-bit clear values */
- intel->ClearColor8888 = INTEL_PACKCOLOR8888(clear[0], clear[1],
- clear[2], clear[3]);
- intel->ClearColor565 = INTEL_PACKCOLOR565(clear[0], clear[1], clear[2]);
-}
-
-
/* Fallback to swrast for select and feedback.
*/
static void
@@ -229,5 +210,4 @@ void
intelInitStateFuncs(struct dd_function_table *functions)
{
functions->RenderMode = intelRenderMode;
- functions->ClearColor = intelClearColor;
}
--
cgit v1.2.3
From ee64347979b4e22976910cb97869887f7de4241c Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:39:20 -0800
Subject: intel: Remove our special color packing macros and just use
colormac.h.
---
src/mesa/drivers/dri/i915/i830_texstate.c | 10 +++++-----
src/mesa/drivers/dri/i915/i915_texstate.c | 17 +++++++++--------
src/mesa/drivers/dri/intel/intel_context.h | 23 -----------------------
src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 5 ++---
4 files changed, 16 insertions(+), 39 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index f4bbb53b86..c62281d341 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -27,6 +27,7 @@
#include "main/mtypes.h"
#include "main/enums.h"
+#include "main/colormac.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
@@ -311,11 +312,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]);
CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]);
- state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(border[0],
- border[1],
- border[2],
- border[3]);
-
+ state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3],
+ border[0],
+ border[1],
+ border[2]);
I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE);
/* memcmp was already disabled, but definitely won't work as the
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index d6689af53f..1bacd51aec 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -28,6 +28,7 @@
#include "main/mtypes.h"
#include "main/enums.h"
#include "main/macros.h"
+#include "main/colormac.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
@@ -363,15 +364,15 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
* R channel, while the hardware uses A. Spam R into all the channels
* for safety.
*/
- state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
- border[0],
- border[0],
- border[0]);
+ state[I915_TEXREG_SS4] = PACK_COLOR_8888(border[0],
+ border[0],
+ border[0],
+ border[0]);
} else {
- state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
- border[1],
- border[2],
- border[3]);
+ state[I915_TEXREG_SS4] = PACK_COLOR_8888(border[3],
+ border[0],
+ border[1],
+ border[2]);
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 2d352090a5..8cd3efea8a 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -361,29 +361,6 @@ do { \
(intel)->prim.flush(intel); \
} while (0)
-/* ================================================================
- * Color packing:
- */
-
-#define INTEL_PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define INTEL_PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define INTEL_PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define INTEL_PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-#define INTEL_PACKCOLOR(format, r, g, b, a) \
-(format == DV_PF_555 ? INTEL_PACKCOLOR1555(r,g,b,a) : \
- (format == DV_PF_565 ? INTEL_PACKCOLOR565(r,g,b) : \
- (format == DV_PF_8888 ? INTEL_PACKCOLOR8888(r,g,b,a) : \
- 0)))
-
/* ================================================================
* From linux kernel i386 header files, copes with odd sizes better
* than COPY_DWORDS would:
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 99330b6ddf..9572b67326 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -228,10 +228,9 @@ do_blit_bitmap( GLcontext *ctx,
UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]);
if (dst->cpp == 2)
- color = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]);
+ color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]);
else
- color = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1],
- ubcolor[2], ubcolor[3]);
+ color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]);
if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F))
return GL_FALSE;
--
cgit v1.2.3
From 667760f53c16fae45ab29881c5ea12eef5fcda54 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 03:43:16 -0800
Subject: intel: Remove dead intel_context members and move some packing
around.
---
src/mesa/drivers/dri/intel/intel_context.c | 6 ------
src/mesa/drivers/dri/intel/intel_context.h | 10 +---------
2 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 2aeca6b81b..7b7c0a0b5a 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -733,12 +733,6 @@ intelInitContext(struct intel_context *intel,
intel->RenderIndex = ~0;
fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
- intel->irqsEmitted = 0;
-
- intel->do_irqs = (intel->intelScreen->irq_active &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS);
-
- intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
if (intel->gen >= 4 && !intel->intelScreen->irq_active) {
_mesa_printf("IRQs not active. Exiting\n");
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 8cd3efea8a..f16f502c1d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -225,6 +225,7 @@ struct intel_context
GLboolean hw_stipple;
GLboolean depth_buffer_is_float;
GLboolean no_rast;
+ GLboolean no_hw;
GLboolean always_flush_batch;
GLboolean always_flush_cache;
@@ -290,13 +291,6 @@ struct intel_context
GLboolean use_early_z;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
- int perf_boxes;
-
- GLuint do_usleeps;
- int do_irqs;
- GLuint irqsEmitted;
-
- GLboolean scissor;
drm_clip_rect_t draw_rect;
drm_clip_rect_t scissor_rect;
@@ -313,8 +307,6 @@ struct intel_context
GLuint lastStamp;
- GLboolean no_hw;
-
/**
* Configuration cache
*/
--
cgit v1.2.3
From 827ba44f6ee83ab21c6a2b09323f6f1df4a7d4c8 Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Wed, 18 Nov 2009 18:15:25 +0100
Subject: intel: Remove non-GEM support.
This really isn't supported at this point. GEM's been in the kernel for
a year, and the fake bufmgr never really worked.
---
src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 ----
src/mesa/drivers/dri/intel/intel_batchbuffer.c | 4 +-
src/mesa/drivers/dri/intel/intel_context.c | 38 ++++-------------
src/mesa/drivers/dri/intel/intel_context.h | 6 ---
src/mesa/drivers/dri/intel/intel_extensions.c | 14 ++-----
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 16 +++-----
src/mesa/drivers/dri/intel/intel_regions.c | 57 +++++---------------------
src/mesa/drivers/dri/intel/intel_screen.c | 38 ++++-------------
src/mesa/drivers/dri/intel/intel_screen.h | 1 -
src/mesa/drivers/dri/intel/intel_span.c | 13 ++----
10 files changed, 43 insertions(+), 152 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 271a88dae0..7c796dae93 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -243,14 +243,6 @@ static void wrap_buffers( struct brw_context *brw,
dri_bo_unreference(brw->vb.upload.bo);
brw->vb.upload.bo = dri_bo_alloc(brw->intel.bufmgr, "temporary VBO",
size, 1);
-
- /* Set the internal VBO\ to no-backing-store. We only use them as a
- * temporary within a brw_try_draw_prims while the lock is held.
- */
- /* DON'T DO THIS AS IF WE HAVE TO RE-ORG MEMORY WE NEED SOMEWHERE WITH
- FAKE TO PUSH THIS STUFF */
-// if (!brw->intel.ttm)
-// dri_bo_fake_disable_backing_store(brw->vb.upload.bo, NULL, NULL);
}
static void get_space( struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 12c5a30d6b..2eae9b66d8 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -80,7 +80,7 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
batch->buf = NULL;
}
- if (!batch->buffer && intel->ttm == GL_TRUE)
+ if (!batch->buffer)
batch->buffer = malloc (intel->maxBatchSize);
batch->buf = dri_bo_alloc(intel->bufmgr, "batchbuffer",
@@ -212,7 +212,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
batch->reserved_space = 0;
/* Emit a flush if the bufmgr doesn't do it for us. */
- if (intel->always_flush_cache || !intel->ttm) {
+ if (intel->always_flush_cache) {
intel_batchbuffer_emit_mi_flush(batch);
used = batch->ptr - batch->map;
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 7b7c0a0b5a..1434ae530b 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -176,9 +176,7 @@ intelGetString(GLcontext * ctx, GLenum name)
break;
}
- (void) driGetRendererString(buffer, chipset,
- (intel->ttm) ? DRIVER_DATE_GEM : DRIVER_DATE,
- 0);
+ (void) driGetRendererString(buffer, chipset, DRIVER_DATE_GEM, 0);
return (GLubyte *) buffer;
default:
@@ -601,6 +599,7 @@ intelInitContext(struct intel_context *intel,
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
int fthrottle_mode;
+ int bo_reuse_mode;
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
functions, (void *) intel)) {
@@ -635,18 +634,14 @@ intelInitContext(struct intel_context *intel,
intel->maxBatchSize = BATCH_SZ;
intel->bufmgr = intelScreen->bufmgr;
- intel->ttm = intelScreen->ttm;
- if (intel->ttm) {
- int bo_reuse_mode;
- bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse");
- switch (bo_reuse_mode) {
- case DRI_CONF_BO_REUSE_DISABLED:
- break;
- case DRI_CONF_BO_REUSE_ALL:
- intel_bufmgr_gem_enable_reuse(intel->bufmgr);
- break;
- }
+ bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse");
+ switch (bo_reuse_mode) {
+ case DRI_CONF_BO_REUSE_DISABLED:
+ break;
+ case DRI_CONF_BO_REUSE_ALL:
+ intel_bufmgr_gem_enable_reuse(intel->bufmgr);
+ break;
}
/* This doesn't yet catch all non-conformant rendering, but it's a
@@ -1052,21 +1047,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
sarea->ctxOwner = me;
}
- /* If the last consumer of the texture memory wasn't us, notify the fake
- * bufmgr and record the new owner. We should have the memory shared
- * between contexts of a single fake bufmgr, but this will at least make
- * things correct for now.
- */
- if (!intel->ttm && sarea->texAge != intel->hHWContext) {
- sarea->texAge = intel->hHWContext;
- intel_bufmgr_fake_contended_lock_take(intel->bufmgr);
- if (INTEL_DEBUG & DEBUG_BATCH)
- intel_decode_context_reset();
- if (INTEL_DEBUG & DEBUG_BUFMGR)
- fprintf(stderr, "Lost Textures: sarea->texAge %x hw context %x\n",
- sarea->ctxOwner, intel->hHWContext);
- }
-
/* Drawable changed?
*/
if (dPriv && intel->lastStamp != dPriv->lastStamp) {
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index f16f502c1d..481202c971 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -181,12 +181,6 @@ struct intel_context
struct intel_region *back_region;
struct intel_region *depth_region;
- /**
- * This value indicates that the kernel memory manager is being used
- * instead of the fake client-side memory manager.
- */
- GLboolean ttm;
-
struct intel_batchbuffer *batch;
drm_intel_bo *first_post_swapbuffers_batch;
GLboolean no_batch_wrap;
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 1682e115cc..f5fe543b5d 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -79,6 +79,7 @@ static const struct dri_extension card_extensions[] = {
{ "GL_ARB_half_float_pixel", NULL },
{ "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions },
{ "GL_ARB_multitexture", NULL },
+ { "GL_ARB_pixel_buffer_object", NULL },
{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
{ "GL_ARB_point_sprite", NULL },
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
@@ -104,6 +105,8 @@ static const struct dri_extension card_extensions[] = {
{ "GL_EXT_blend_logic_op", NULL },
{ "GL_EXT_blend_subtract", NULL },
{ "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions },
+ { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
+ { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
{ "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions },
{ "GL_EXT_packed_depth_stencil", NULL },
@@ -176,14 +179,6 @@ static const struct dri_extension arb_oq_extensions[] = {
{ NULL, NULL }
};
-
-static const struct dri_extension ttm_extensions[] = {
- { "GL_ARB_pixel_buffer_object", NULL },
- { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
- { NULL, NULL }
-};
-
static const struct dri_extension fragment_shader_extensions[] = {
{ "GL_ARB_fragment_shader", NULL },
{ NULL, NULL }
@@ -202,9 +197,6 @@ intelInitExtensions(GLcontext *ctx)
*/
driInitExtensions(ctx, card_extensions, GL_FALSE);
- if (intel->ttm)
- driInitExtensions(ctx, ttm_extensions, GL_FALSE);
-
if (IS_965(intel->intelScreen->deviceID))
driInitExtensions(ctx, brw_extensions, GL_FALSE);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index abb3024bfb..6a565f80cf 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -224,16 +224,12 @@ int intel_miptree_pitch_align (struct intel_context *intel,
if (!mt->compressed) {
int pitch_align;
- if (intel->ttm) {
- /* XXX: Align pitch to multiple of 64 bytes for now to allow
- * render-to-texture to work in all cases. This should probably be
- * replaced at some point by some scheme to only do this when really
- * necessary.
- */
- pitch_align = 64;
- } else {
- pitch_align = 4;
- }
+ /* XXX: Align pitch to multiple of 64 bytes for now to allow
+ * render-to-texture to work in all cases. This should probably be
+ * replaced at some point by some scheme to only do this when really
+ * necessary.
+ */
+ pitch_align = 64;
if (tiling == I915_TILING_X)
pitch_align = 512;
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 80975163d4..d6b9dc4446 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -542,55 +542,18 @@ intel_recreate_static(struct intel_context *intel,
region->buffer = NULL;
}
- if (intel->ttm) {
- assert(region_desc->bo_handle != -1);
- region->buffer = intel_bo_gem_create_from_name(intel->bufmgr,
- name,
- region_desc->bo_handle);
-
- ret = dri_bo_get_tiling(region->buffer, ®ion->tiling,
- ®ion->bit_6_swizzle);
- if (ret != 0) {
- fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n",
- region_desc->bo_handle, name, strerror(-ret));
- intel_region_release(®ion);
- return NULL;
- }
- } else {
- if (region->classic_map != NULL) {
- drmUnmap(region->classic_map,
- region->pitch * region->cpp * region->height);
- region->classic_map = NULL;
- }
- ret = drmMap(intel->driFd, region_desc->handle,
- region->pitch * region->cpp * region->height,
- ®ion->classic_map);
- if (ret != 0) {
- fprintf(stderr, "Failed to drmMap %s buffer\n", name);
- free(region);
- return NULL;
- }
-
- region->buffer = intel_bo_fake_alloc_static(intel->bufmgr,
+ assert(region_desc->bo_handle != -1);
+ region->buffer = intel_bo_gem_create_from_name(intel->bufmgr,
name,
- region_desc->offset,
- region->pitch * region->cpp *
- region->height,
- region->classic_map);
-
- /* The sarea just gives us a boolean for whether it's tiled or not,
- * instead of which tiling mode it is. Guess.
- */
- if (region_desc->tiled) {
- if (intel->gen >= 4 && region_desc == &intelScreen->depth)
- region->tiling = I915_TILING_Y;
- else
- region->tiling = I915_TILING_X;
- } else {
- region->tiling = I915_TILING_NONE;
- }
+ region_desc->bo_handle);
- region->bit_6_swizzle = I915_BIT_6_SWIZZLE_NONE;
+ ret = dri_bo_get_tiling(region->buffer, ®ion->tiling,
+ ®ion->bit_6_swizzle);
+ if (ret != 0) {
+ fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n",
+ region_desc->bo_handle, name, strerror(-ret));
+ intel_region_release(®ion);
+ return NULL;
}
assert(region->buffer != NULL);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 789135b49f..2c5a884a9b 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -605,7 +605,6 @@ intelFillInModes(__DRIscreenPrivate *psp,
static GLboolean
intel_init_bufmgr(intelScreenPrivate *intelScreen)
{
- GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL;
int gem_kernel = 0;
GLboolean gem_supported;
struct drm_i915_getparam gp;
@@ -622,43 +621,24 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
/* If we've got a new enough DDX that's initializing GEM and giving us
* object handles for the shared buffers, use that.
*/
- intelScreen->ttm = GL_FALSE;
if (intelScreen->driScrnPriv->dri2.enabled)
gem_supported = GL_TRUE;
else if (intelScreen->driScrnPriv->ddx_version.minor >= 9 &&
gem_kernel &&
intelScreen->front.bo_handle != -1)
gem_supported = GL_TRUE;
- else
- gem_supported = GL_FALSE;
-
- if (!gem_disable && gem_supported) {
- intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
- if (intelScreen->bufmgr != NULL)
- intelScreen->ttm = GL_TRUE;
+ else {
+ fprintf(stderr, "[%s:%u] Error initializing GEM.\n",
+ __func__, __LINE__);
+ return GL_FALSE;
}
+
+ intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
/* Otherwise, use the classic buffer manager. */
if (intelScreen->bufmgr == NULL) {
- if (gem_disable) {
- _mesa_warning(NULL, "GEM disabled. Using classic.");
- } else {
- _mesa_warning(NULL,
- "Failed to initialize GEM. Falling back to classic.");
- }
-
- if (intelScreen->tex.size == 0) {
- fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
- __func__, __LINE__);
- return GL_FALSE;
- }
-
- intelScreen->bufmgr =
- intel_bufmgr_fake_init(spriv->fd,
- intelScreen->tex.offset,
- intelScreen->tex.map,
- intelScreen->tex.size,
- (unsigned int * volatile)
- &intelScreen->sarea->last_dispatch);
+ fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
+ __func__, __LINE__);
+ return GL_FALSE;
}
if (intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences))
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index a9b9e109a6..14ca0903b6 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -77,7 +77,6 @@ typedef struct
GLboolean no_hw;
GLboolean no_vbo;
- int ttm;
dri_bufmgr *bufmgr;
GLboolean kernel_exec_fencing;
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 3607c7dded..2c89a66a95 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -613,15 +613,7 @@ intel_set_span_functions(struct intel_context *intel,
struct gl_renderbuffer *rb)
{
struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
- uint32_t tiling;
-
- /* If in GEM mode, we need to do the tile address swizzling ourselves,
- * instead of the fence registers handling it.
- */
- if (intel->ttm)
- tiling = irb->region->tiling;
- else
- tiling = I915_TILING_NONE;
+ uint32_t tiling = irb->region->tiling;
if (intel->intelScreen->kernel_exec_fencing) {
switch (irb->texformat) {
@@ -673,6 +665,9 @@ intel_set_span_functions(struct intel_context *intel,
return;
}
+ /* If in GEM mode, we need to do the tile address swizzling ourselves,
+ * instead of the fence registers handling it.
+ */
switch (irb->texformat) {
case MESA_FORMAT_RGB565:
switch (tiling) {
--
cgit v1.2.3
From 012d0193cc9ad6fdc9829db0a6884a5a590dd4c5 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 17:25:05 +0100
Subject: st/xorg: Don't complain about convolution filter being 'unknown'.
Also add a newline to the complaint so it'll be a little less annoying if we
actually encounter an unknown filter value again.
---
src/gallium/state_trackers/xorg/xorg_composite.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 733bd53fca..86a52077c3 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -152,7 +152,8 @@ render_filter_to_gallium(int xrender_filter, int *out_filter)
*out_filter = PIPE_TEX_FILTER_LINEAR;
break;
default:
- debug_printf("Unkown xrender filter");
+ debug_printf("Unkown xrender filter\n");
+ case PictFilterConvolution:
*out_filter = PIPE_TEX_FILTER_NEAREST;
return FALSE;
}
--
cgit v1.2.3
From 34145fc3b739d21387e7df483ca902c8373ce319 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 17:30:32 +0100
Subject: st/xorg: Try harder to ensure a shared texture has valid contents
right away.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 660ea6a1ba..9a7c356860 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -127,9 +127,12 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
}
if (!tex) {
+ /* First call to make sure we have a pixmap private */
exaMoveInPixmap(private->pPixmap);
xorg_exa_set_shared_usage(private->pPixmap);
pScreen->ModifyPixmapHeader(private->pPixmap, 0, 0, 0, 0, 0, NULL);
+ /* Second call to make sure texture has valid contents */
+ exaMoveInPixmap(private->pPixmap);
tex = xorg_exa_get_texture(private->pPixmap);
}
--
cgit v1.2.3
From 10c67f938194a3b99ce2717318c77d86abc54933 Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 17:47:21 +0100
Subject: st/xorg: Miscellaneous XVideo fixes.
* Make sure the destination pixmap has a texture to render into.
* Fix damage reporting so the EXA migration code can do the right thing.
* Fix destination coordinates for redirected windows.
---
src/gallium/state_trackers/xorg/xorg_xv.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 2b935c0f73..7cc532b1c8 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -446,6 +446,11 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
int x, y, w, h;
struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap);
+ if (!dst->tex) {
+ xorg_exa_set_shared_usage(pPixmap);
+ pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL);
+ }
+
if (!dst || !dst->tex)
XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex");
@@ -469,6 +474,9 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
setup_vs_video_constants(pPriv->r, dst);
setup_fs_video_constants(pPriv->r, hdtv);
+ exaMoveInPixmap(pPixmap);
+ DamageDamageRegion(&pPixmap->drawable, dstRegion);
+
while (nbox--) {
int box_x1 = pbox->x1;
int box_y1 = pbox->y1;
@@ -476,8 +484,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
int box_y2 = pbox->y2;
float diff_x = (float)src_w / (float)dst_w;
float diff_y = (float)src_h / (float)dst_h;
- int offset_x = box_x1 - dstX;
- int offset_y = box_y1 - dstY;
+ int offset_x = box_x1 - dstX + pPixmap->screen_x;
+ int offset_y = box_y1 - dstY + pPixmap->screen_y;
int offset_w;
int offset_h;
@@ -495,7 +503,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
pbox++;
}
- DamageDamageRegion(&pPixmap->drawable, dstRegion);
+ DamageRegionProcessPending(&pPixmap->drawable);
return TRUE;
}
--
cgit v1.2.3
From 31ea323b4d432b557d7664187f17ccefc6d3947b Mon Sep 17 00:00:00 2001
From: Michel Dänzer
Date: Thu, 19 Nov 2009 17:52:55 +0100
Subject: st/xorg: Replace compile-time acceleration switch with Option
"2DAccel".
This option can be used to disable 2D acceleration. DRI2 and XVideo blits will
still be accelerated, at least to some degree even with compositing.
---
src/gallium/state_trackers/xorg/xorg_dri2.c | 4 ++++
src/gallium/state_trackers/xorg/xorg_driver.c | 5 ++++-
src/gallium/state_trackers/xorg/xorg_exa.c | 24 ++++++++++++++----------
src/gallium/state_trackers/xorg/xorg_exa.h | 2 ++
src/gallium/state_trackers/xorg/xorg_tracker.h | 2 +-
5 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 9a7c356860..ca3c712dcd 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -276,6 +276,7 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
PixmapPtr dst_pixmap;
GCPtr gc;
RegionPtr copy_clip;
+ Bool save_accel;
/*
* In driCreateBuffers we dewrap windows into the
@@ -341,8 +342,11 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
}
}
+ save_accel = ms->exa->accel;
+ ms->exa->accel = TRUE;
(*gc->ops->CopyArea)(&src_pixmap->drawable, &dst_pixmap->drawable, gc,
0, 0, pDraw->width, pDraw->height, 0, 0);
+ ms->exa->accel = save_accel;
FreeScratchGC(gc);
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 26cf2dd772..d949167adc 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -75,10 +75,12 @@ static Bool PreInit(ScrnInfoPtr pScrn, int flags);
typedef enum
{
OPTION_SW_CURSOR,
+ OPTION_2D_ACCEL,
} modesettingOpts;
static const OptionInfoRec Options[] = {
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -609,7 +611,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
- ms->exa = xorg_exa_init(pScrn);
+ ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options,
+ OPTION_2D_ACCEL, TRUE));
ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE);
xorg_init_video(pScreen);
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 29fc861748..3a51ad2d59 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -46,7 +46,6 @@
#include "util/u_rect.h"
#define DEBUG_PRINT 0
-#define ACCEL_ENABLED TRUE
/*
* Helper functions
@@ -376,7 +375,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
XORG_FALLBACK("format %s", pf_name(priv->tex->format));
}
- return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg);
+ return exa->accel && xorg_solid_bind_state(exa, priv, fg);
}
static void
@@ -435,7 +434,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
exa->copy.src = src_priv;
exa->copy.dst = priv;
- return ACCEL_ENABLED;
+ return exa->accel;
}
static void
@@ -564,7 +563,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
render_format_name(pMaskPicture->format));
}
- return ACCEL_ENABLED &&
+ return exa->accel &&
xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
@@ -597,6 +596,9 @@ ExaCheckComposite(int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
+ ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
boolean accelerated = xorg_composite_accelerated(op,
pSrcPicture,
pMaskPicture,
@@ -605,7 +607,7 @@ ExaCheckComposite(int op,
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
- return ACCEL_ENABLED && accelerated;
+ return exa->accel && accelerated;
}
static void *
@@ -743,10 +745,11 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
bitsPerPixel, devKind, NULL);
/* Deal with screen resize */
- if (!priv->tex ||
- (priv->tex->width[0] != width ||
- priv->tex->height[0] != height ||
- priv->tex_flags != priv->flags)) {
+ if ((exa->accel || priv->flags) &&
+ (!priv->tex ||
+ (priv->tex->width[0] != width ||
+ priv->tex->height[0] != height ||
+ priv->tex_flags != priv->flags))) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
@@ -861,7 +864,7 @@ xorg_exa_close(ScrnInfoPtr pScrn)
}
void *
-xorg_exa_init(ScrnInfoPtr pScrn)
+xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
{
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa;
@@ -926,6 +929,7 @@ xorg_exa_init(ScrnInfoPtr pScrn)
ms->ctx = exa->pipe;
exa->renderer = renderer_create(exa->pipe);
+ exa->accel = accel;
return (void *)exa;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index 7f4aebb9c3..15cc29d662 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -24,6 +24,8 @@ struct exa_context
float solid_color[4];
boolean has_solid_color;
+ boolean accel;
+
/* float[9] projective matrix bound to pictures */
struct {
float src[9];
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 6130cf6621..20c9259c7b 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -131,7 +131,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
int depth, int bpp);
void *
-xorg_exa_init(ScrnInfoPtr pScrn);
+xorg_exa_init(ScrnInfoPtr pScrn, Bool accel);
void
xorg_exa_close(ScrnInfoPtr pScrn);
--
cgit v1.2.3
From 367cfca808e74101689dd0acb247f3ec38fc4c7f Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 11:37:50 -0700
Subject: softpipe: add missing check in softpipe_is_texture_referenced()
Check if the named texture is referenced by the texture cache.
---
src/gallium/drivers/softpipe/sp_context.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 94d000a5ac..d325499bf8 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -120,7 +120,7 @@ softpipe_destroy( struct pipe_context *pipe )
* if (the texture is being used as a framebuffer surface)
* return PIPE_REFERENCED_FOR_WRITE
* else if (the texture is a bound texture source)
- * return PIPE_REFERENCED_FOR_READ XXX not done yet
+ * return PIPE_REFERENCED_FOR_READ
* else
* return PIPE_UNREFERENCED
*/
@@ -132,6 +132,7 @@ softpipe_is_texture_referenced( struct pipe_context *pipe,
struct softpipe_context *softpipe = softpipe_context( pipe );
unsigned i;
+ /* check if any of the bound drawing surfaces are this texture */
if (softpipe->dirty_render_cache) {
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
if (softpipe->framebuffer.cbufs[i] &&
@@ -145,7 +146,12 @@ softpipe_is_texture_referenced( struct pipe_context *pipe,
}
}
- /* FIXME: we also need to do the same for the texture cache */
+ /* check if any of the tex_cache textures are this texture */
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ if (softpipe->tex_cache[i] &&
+ softpipe->tex_cache[i]->texture == texture)
+ return PIPE_REFERENCED_FOR_READ;
+ }
return PIPE_UNREFERENCED;
}
--
cgit v1.2.3
From 90e69c81e445136b7d14c569cab5b517b8073498 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Thu, 19 Nov 2009 19:46:21 +0000
Subject: pb: Make fenced buffers threadsafe.
---
.../auxiliary/pipebuffer/pb_buffer_fenced.c | 280 ++++++++++++---------
1 file changed, 168 insertions(+), 112 deletions(-)
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 2ef4293d4d..2f973684f6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007-2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -80,11 +80,27 @@ struct fenced_buffer_list
*/
struct fenced_buffer
{
+ /*
+ * Immutable members.
+ */
+
struct pb_buffer base;
-
struct pb_buffer *buffer;
+ struct fenced_buffer_list *list;
+
+ /**
+ * Protected by fenced_buffer_list::mutex
+ */
+ struct list_head head;
- /* FIXME: protect access with mutex */
+ /**
+ * Following members are mutable and protected by this mutex.
+ *
+ * You may lock this mutex alone, or lock it with fenced_buffer_list::mutex
+ * held, but in order to prevent deadlocks you must never lock
+ * fenced_buffer_list::mutex with this mutex held.
+ */
+ pipe_mutex mutex;
/**
* A bitmask of PIPE_BUFFER_USAGE_CPU/GPU_READ/WRITE describing the current
@@ -96,9 +112,6 @@ struct fenced_buffer
struct pb_validate *vl;
unsigned validation_flags;
struct pipe_fence_handle *fence;
-
- struct list_head head;
- struct fenced_buffer_list *list;
};
@@ -110,15 +123,24 @@ fenced_buffer(struct pb_buffer *buf)
}
+/**
+ * Add the buffer to the fenced list.
+ *
+ * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
+ * order before calling this function.
+ *
+ * Reference count should be incremented before calling this function.
+ */
static INLINE void
-_fenced_buffer_add(struct fenced_buffer *fenced_buf)
+fenced_buffer_add_locked(struct fenced_buffer_list *fenced_list,
+ struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
-
assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
assert(fenced_buf->fence);
+ /* TODO: Move the reference count increment here */
+
#ifdef DEBUG
LIST_DEL(&fenced_buf->head);
assert(fenced_list->numUnfenced);
@@ -130,32 +152,16 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
/**
- * Actually destroy the buffer.
+ * Remove the buffer from the fenced list.
+ *
+ * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
+ * order before calling this function.
+ *
+ * Reference count should be decremented after calling this function.
*/
static INLINE void
-_fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
-{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
-
- assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
- assert(!fenced_buf->fence);
-#ifdef DEBUG
- assert(fenced_buf->head.prev);
- assert(fenced_buf->head.next);
- LIST_DEL(&fenced_buf->head);
- assert(fenced_list->numUnfenced);
- --fenced_list->numUnfenced;
-#else
- (void)fenced_list;
-#endif
- pb_reference(&fenced_buf->buffer, NULL);
- FREE(fenced_buf);
-}
-
-
-static INLINE void
-_fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
- struct fenced_buffer *fenced_buf)
+fenced_buffer_remove_locked(struct fenced_buffer_list *fenced_list,
+ struct fenced_buffer *fenced_buf)
{
struct pb_fence_ops *ops = fenced_list->ops;
@@ -177,37 +183,53 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
++fenced_list->numUnfenced;
#endif
- /**
- * FIXME!!!
- */
-
- if(!pipe_is_referenced(&fenced_buf->base.base.reference))
- _fenced_buffer_destroy(fenced_buf);
+ /* TODO: Move the reference count decrement and destruction here */
}
+/**
+ * Wait for the fence to expire, and remove it from the fenced list.
+ *
+ * fenced_buffer::mutex must be held. fenced_buffer_list::mutex must not be
+ * held -- it will
+ */
static INLINE enum pipe_error
-_fenced_buffer_finish(struct fenced_buffer *fenced_buf)
+fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
+ struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
struct pb_fence_ops *ops = fenced_list->ops;
+ enum pipe_error ret = PIPE_ERROR;
#if 0
debug_warning("waiting for GPU");
#endif
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->fence);
+
+ /* Acquire the global lock */
+ pipe_mutex_unlock(fenced_buf->mutex);
+ pipe_mutex_lock(fenced_list->mutex);
+ pipe_mutex_lock(fenced_buf->mutex);
+
if(fenced_buf->fence) {
- if(ops->fence_finish(ops, fenced_buf->fence, 0) != 0) {
- return PIPE_ERROR;
+ if(ops->fence_finish(ops, fenced_buf->fence, 0) == 0) {
+ /* Remove from the fenced list */
+ /* TODO: remove consequents */
+ fenced_buffer_remove_locked(fenced_list, fenced_buf);
+
+ p_atomic_dec(&fenced_buf->base.base.reference.count);
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+
+ fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
+
+ ret = PIPE_OK;
}
- /* Remove from the fenced list */
- /* TODO: remove consequents */
- _fenced_buffer_remove(fenced_list, fenced_buf);
}
- fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
- return PIPE_OK;
+ pipe_mutex_unlock(fenced_list->mutex);
+
+ return ret;
}
@@ -215,7 +237,7 @@ _fenced_buffer_finish(struct fenced_buffer *fenced_buf)
* Free as many fenced buffers from the list head as possible.
*/
static void
-_fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
+fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
int wait)
{
struct pb_fence_ops *ops = fenced_list->ops;
@@ -228,21 +250,28 @@ _fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
while(curr != &fenced_list->delayed) {
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ pipe_mutex_lock(fenced_buf->mutex);
+
if(fenced_buf->fence != prev_fence) {
int signaled;
if (wait)
signaled = ops->fence_finish(ops, fenced_buf->fence, 0);
else
signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
- if (signaled != 0)
+ if (signaled != 0) {
+ pipe_mutex_unlock(fenced_buf->mutex);
break;
+ }
prev_fence = fenced_buf->fence;
}
else {
assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0);
}
- _fenced_buffer_remove(fenced_list, fenced_buf);
+ fenced_buffer_remove_locked(fenced_list, fenced_buf);
+ pipe_mutex_unlock(fenced_buf->mutex);
+
+ pb_reference((struct pb_buffer **)&fenced_buf, NULL);
curr = next;
next = curr->next;
@@ -256,30 +285,25 @@ fenced_buffer_destroy(struct pb_buffer *buf)
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
struct fenced_buffer_list *fenced_list = fenced_buf->list;
- pipe_mutex_lock(fenced_list->mutex);
assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
- if (fenced_buf->fence) {
- struct pb_fence_ops *ops = fenced_list->ops;
- if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
- struct list_head *curr, *prev;
- curr = &fenced_buf->head;
- prev = curr->prev;
- do {
- fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
- assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0);
- _fenced_buffer_remove(fenced_list, fenced_buf);
- curr = prev;
- prev = curr->prev;
- } while (curr != &fenced_list->delayed);
- }
- else {
- /* delay destruction */
- }
- }
- else {
- _fenced_buffer_destroy(fenced_buf);
- }
+ assert(!fenced_buf->fence);
+
+#ifdef DEBUG
+ pipe_mutex_lock(fenced_list->mutex);
+ assert(fenced_buf->head.prev);
+ assert(fenced_buf->head.next);
+ LIST_DEL(&fenced_buf->head);
+ assert(fenced_list->numUnfenced);
+ --fenced_list->numUnfenced;
pipe_mutex_unlock(fenced_list->mutex);
+#else
+ (void)fenced_list;
+#endif
+
+ pb_reference(&fenced_buf->buffer, NULL);
+
+ pipe_mutex_destroy(fenced_buf->mutex);
+ FREE(fenced_buf);
}
@@ -290,24 +314,23 @@ fenced_buffer_map(struct pb_buffer *buf,
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
struct fenced_buffer_list *fenced_list = fenced_buf->list;
struct pb_fence_ops *ops = fenced_list->ops;
- void *map;
+ void *map = NULL;
+
+ pipe_mutex_lock(fenced_buf->mutex);
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
/* Serialize writes */
if((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) ||
((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) && (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) {
- if(flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+ if((flags & PIPE_BUFFER_USAGE_DONTBLOCK) &&
+ ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
/* Don't wait for the GPU to finish writing */
- if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0)
- _fenced_buffer_remove(fenced_list, fenced_buf);
- else
- return NULL;
- }
- else {
- /* Wait for the GPU to finish writing */
- _fenced_buffer_finish(fenced_buf);
+ goto finish;
}
+
+ /* Wait for the GPU to finish writing */
+ fenced_buffer_finish_locked(fenced_list, fenced_buf);
}
#if 0
@@ -324,6 +347,9 @@ fenced_buffer_map(struct pb_buffer *buf,
fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE;
}
+finish:
+ pipe_mutex_unlock(fenced_buf->mutex);
+
return map;
}
@@ -332,6 +358,9 @@ static void
fenced_buffer_unmap(struct pb_buffer *buf)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+
+ pipe_mutex_lock(fenced_buf->mutex);
+
assert(fenced_buf->mapcount);
if(fenced_buf->mapcount) {
pb_unmap(fenced_buf->buffer);
@@ -339,6 +368,8 @@ fenced_buffer_unmap(struct pb_buffer *buf)
if(!fenced_buf->mapcount)
fenced_buf->flags &= ~PIPE_BUFFER_USAGE_CPU_READ_WRITE;
}
+
+ pipe_mutex_unlock(fenced_buf->mutex);
}
@@ -350,11 +381,14 @@ fenced_buffer_validate(struct pb_buffer *buf,
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
enum pipe_error ret;
+ pipe_mutex_lock(fenced_buf->mutex);
+
if(!vl) {
/* invalidate */
fenced_buf->vl = NULL;
fenced_buf->validation_flags = 0;
- return PIPE_OK;
+ ret = PIPE_OK;
+ goto finish;
}
assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
@@ -362,14 +396,17 @@ fenced_buffer_validate(struct pb_buffer *buf,
flags &= PIPE_BUFFER_USAGE_GPU_READ_WRITE;
/* Buffer cannot be validated in two different lists */
- if(fenced_buf->vl && fenced_buf->vl != vl)
- return PIPE_ERROR_RETRY;
+ if(fenced_buf->vl && fenced_buf->vl != vl) {
+ ret = PIPE_ERROR_RETRY;
+ goto finish;
+ }
#if 0
/* Do not validate if buffer is still mapped */
if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
/* TODO: wait for the thread that mapped the buffer to unmap it */
- return PIPE_ERROR_RETRY;
+ ret = PIPE_ERROR_RETRY;
+ goto finish;
}
/* Final sanity checking */
assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
@@ -379,17 +416,21 @@ fenced_buffer_validate(struct pb_buffer *buf,
if(fenced_buf->vl == vl &&
(fenced_buf->validation_flags & flags) == flags) {
/* Nothing to do -- buffer already validated */
- return PIPE_OK;
+ ret = PIPE_OK;
+ goto finish;
}
ret = pb_validate(fenced_buf->buffer, vl, flags);
if (ret != PIPE_OK)
- return ret;
+ goto finish;
fenced_buf->vl = vl;
fenced_buf->validation_flags |= flags;
- return PIPE_OK;
+finish:
+ pipe_mutex_unlock(fenced_buf->mutex);
+
+ return ret;
}
@@ -404,29 +445,36 @@ fenced_buffer_fence(struct pb_buffer *buf,
fenced_buf = fenced_buffer(buf);
fenced_list = fenced_buf->list;
ops = fenced_list->ops;
-
- if(fence == fenced_buf->fence) {
- /* Nothing to do */
- return;
- }
- assert(fenced_buf->vl);
- assert(fenced_buf->validation_flags);
-
pipe_mutex_lock(fenced_list->mutex);
- if (fenced_buf->fence)
- _fenced_buffer_remove(fenced_list, fenced_buf);
- if (fence) {
- ops->fence_reference(ops, &fenced_buf->fence, fence);
- fenced_buf->flags |= fenced_buf->validation_flags;
- _fenced_buffer_add(fenced_buf);
- }
- pipe_mutex_unlock(fenced_list->mutex);
+ pipe_mutex_lock(fenced_buf->mutex);
+
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+
+ if(fence != fenced_buf->fence) {
+ assert(fenced_buf->vl);
+ assert(fenced_buf->validation_flags);
+
+ if (fenced_buf->fence) {
+ fenced_buffer_remove_locked(fenced_list, fenced_buf);
+ p_atomic_dec(&fenced_buf->base.base.reference.count);
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+ }
+ if (fence) {
+ ops->fence_reference(ops, &fenced_buf->fence, fence);
+ fenced_buf->flags |= fenced_buf->validation_flags;
+ p_atomic_inc(&fenced_buf->base.base.reference.count);
+ fenced_buffer_add_locked(fenced_list, fenced_buf);
+ }
+
+ pb_fence(fenced_buf->buffer, fence);
- pb_fence(fenced_buf->buffer, fence);
+ fenced_buf->vl = NULL;
+ fenced_buf->validation_flags = 0;
+ }
- fenced_buf->vl = NULL;
- fenced_buf->validation_flags = 0;
+ pipe_mutex_unlock(fenced_buf->mutex);
+ pipe_mutex_unlock(fenced_list->mutex);
}
@@ -436,6 +484,7 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf,
pb_size *offset)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ /* NOTE: accesses immutable members only -- mutex not necessary */
pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);
}
@@ -475,6 +524,8 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list,
buf->buffer = buffer;
buf->list = fenced_list;
+ pipe_mutex_init(buf->mutex);
+
#ifdef DEBUG
pipe_mutex_lock(fenced_list->mutex);
LIST_ADDTAIL(&buf->head, &fenced_list->unfenced);
@@ -516,7 +567,7 @@ fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
int wait)
{
pipe_mutex_lock(fenced_list->mutex);
- _fenced_buffer_list_check_free(fenced_list, wait);
+ fenced_buffer_list_check_free_locked(fenced_list, wait);
pipe_mutex_unlock(fenced_list->mutex);
}
@@ -538,11 +589,13 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
next = curr->next;
while(curr != &fenced_list->unfenced) {
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ pipe_mutex_lock(fenced_buf->mutex);
assert(!fenced_buf->fence);
debug_printf("%10p %7u %7u\n",
(void *) fenced_buf,
fenced_buf->base.base.size,
p_atomic_read(&fenced_buf->base.base.reference.count));
+ pipe_mutex_unlock(fenced_buf->mutex);
curr = next;
next = curr->next;
}
@@ -552,6 +605,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
while(curr != &fenced_list->delayed) {
int signaled;
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ pipe_mutex_lock(fenced_buf->mutex);
signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
debug_printf("%10p %7u %7u %10p %s\n",
(void *) fenced_buf,
@@ -559,6 +613,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
p_atomic_read(&fenced_buf->base.base.reference.count),
(void *) fenced_buf->fence,
signaled == 0 ? "y" : "n");
+ pipe_mutex_unlock(fenced_buf->mutex);
curr = next;
next = curr->next;
}
@@ -579,8 +634,8 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
sched_yield();
#endif
- _fenced_buffer_list_check_free(fenced_list, 1);
pipe_mutex_lock(fenced_list->mutex);
+ fenced_buffer_list_check_free_locked(fenced_list, 1);
}
#ifdef DEBUG
@@ -588,6 +643,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
#endif
pipe_mutex_unlock(fenced_list->mutex);
+ pipe_mutex_destroy(fenced_list->mutex);
fenced_list->ops->destroy(fenced_list->ops);
--
cgit v1.2.3
From 3790c6a13b86dfe0afd4bb0bf9a4d9f4b429cfd8 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 13:03:12 -0800
Subject: progs/trivial: Redraw upon keypress.
---
progs/trivial/clear-fbo-tex.c | 2 +-
progs/trivial/clear-fbo.c | 2 +-
progs/trivial/clear-random.c | 2 +-
progs/trivial/clear-scissor.c | 2 +-
progs/trivial/clear.c | 2 +-
progs/trivial/createwin.c | 2 +-
progs/trivial/dlist-begin-call-end.c | 2 +-
progs/trivial/dlist-dangling.c | 2 +-
progs/trivial/dlist-edgeflag-dangling.c | 2 +-
progs/trivial/dlist-edgeflag.c | 2 +-
progs/trivial/dlist-flat-tri.c | 2 +-
progs/trivial/dlist-mat-tri.c | 2 +-
progs/trivial/dlist-recursive-call.c | 2 +-
progs/trivial/dlist-tri-flat-tri.c | 2 +-
progs/trivial/dlist-tri-mat-tri.c | 2 +-
progs/trivial/line-clip.c | 2 +-
progs/trivial/line-cull.c | 2 +-
progs/trivial/line-flat.c | 2 +-
progs/trivial/line-stipple-wide.c | 2 +-
progs/trivial/line-userclip-clip.c | 2 +-
progs/trivial/line-userclip-nop-clip.c | 2 +-
progs/trivial/line-userclip-nop.c | 2 +-
progs/trivial/line-userclip.c | 2 +-
progs/trivial/line-wide.c | 2 +-
progs/trivial/line.c | 2 +-
progs/trivial/lineloop-clip.c | 2 +-
progs/trivial/lineloop.c | 2 +-
progs/trivial/linestrip-stipple-wide.c | 2 +-
progs/trivial/linestrip-stipple.c | 2 +-
progs/trivial/point-clip.c | 2 +-
progs/trivial/point-param.c | 2 +-
progs/trivial/point-sprite.c | 2 +-
progs/trivial/point-wide-smooth.c | 2 +-
progs/trivial/point-wide.c | 2 +-
progs/trivial/point.c | 2 +-
progs/trivial/poly-flat-clip.c | 2 +-
progs/trivial/poly-flat-unfilled-clip.c | 2 +-
progs/trivial/poly-flat.c | 2 +-
progs/trivial/poly-unfilled.c | 2 +-
progs/trivial/poly.c | 2 +-
progs/trivial/quad-clip-all-vertices.c | 2 +-
progs/trivial/quad-clip.c | 2 +-
progs/trivial/quad-degenerate.c | 2 +-
progs/trivial/quad-flat.c | 2 +-
progs/trivial/quad-offset-factor.c | 2 +-
progs/trivial/quad-offset-unfilled.c | 2 +-
progs/trivial/quad-offset-units.c | 2 +-
progs/trivial/quad-tex-alpha.c | 2 +-
progs/trivial/quad-tex-pbo.c | 2 +-
progs/trivial/quad-unfilled-clip.c | 2 +-
progs/trivial/quad-unfilled-stipple.c | 2 +-
progs/trivial/quad-unfilled.c | 2 +-
progs/trivial/quad.c | 2 +-
progs/trivial/quads.c | 2 +-
progs/trivial/quadstrip-cont.c | 2 +-
progs/trivial/quadstrip-flat.c | 2 +-
progs/trivial/quadstrip.c | 2 +-
progs/trivial/readpixels.c | 2 +-
progs/trivial/tri-alpha-tex.c | 2 +-
progs/trivial/tri-alpha.c | 2 +-
progs/trivial/tri-blend-color.c | 2 +-
progs/trivial/tri-clear.c | 2 +-
progs/trivial/tri-clip.c | 2 +-
progs/trivial/tri-cull-both.c | 2 +-
progs/trivial/tri-dlist.c | 2 +-
progs/trivial/tri-fbo.c | 2 +-
progs/trivial/tri-flat-clip.c | 2 +-
progs/trivial/tri-flat.c | 2 +-
progs/trivial/tri-fog.c | 2 +-
progs/trivial/tri-fp-const-imm.c | 2 +-
progs/trivial/tri-fp.c | 2 +-
progs/trivial/tri-lit-material.c | 2 +-
progs/trivial/tri-lit.c | 2 +-
progs/trivial/tri-multitex-vbo.c | 2 +-
progs/trivial/tri-orig.c | 2 +-
progs/trivial/tri-query.c | 2 +-
progs/trivial/tri-scissor-tri.c | 2 +-
progs/trivial/tri-square.c | 2 +-
progs/trivial/tri-stipple.c | 2 +-
progs/trivial/tri-tex-3d.c | 2 +-
progs/trivial/tri-tex.c | 2 +-
progs/trivial/tri-tri.c | 2 +-
progs/trivial/tri-unfilled-clip.c | 2 +-
progs/trivial/tri-unfilled-edgeflag.c | 2 +-
progs/trivial/tri-unfilled-point.c | 2 +-
progs/trivial/tri-unfilled-smooth.c | 2 +-
progs/trivial/tri-unfilled-tri-lit.c | 2 +-
progs/trivial/tri-unfilled-userclip-stip.c | 2 +-
progs/trivial/tri-unfilled-userclip.c | 2 +-
progs/trivial/tri-unfilled.c | 2 +-
progs/trivial/tri-userclip.c | 2 +-
progs/trivial/tri-z-9.c | 2 +-
progs/trivial/tri-z-eq.c | 2 +-
progs/trivial/trifan-flat-clip.c | 2 +-
progs/trivial/trifan-flat-unfilled-clip.c | 2 +-
progs/trivial/trifan-flat.c | 2 +-
progs/trivial/trifan-unfilled.c | 2 +-
progs/trivial/trifan.c | 2 +-
progs/trivial/tristrip-clip.c | 2 +-
progs/trivial/tristrip-flat.c | 2 +-
progs/trivial/tristrip.c | 2 +-
progs/trivial/vp-tri-cb-pos.c | 2 +-
progs/trivial/vp-tri-cb-tex.c | 2 +-
progs/trivial/vp-tri-invariant.c | 2 +-
104 files changed, 104 insertions(+), 104 deletions(-)
diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c
index a206676e48..238f634bf5 100644
--- a/progs/trivial/clear-fbo-tex.c
+++ b/progs/trivial/clear-fbo-tex.c
@@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c
index 0aeb45489f..6435c901ad 100644
--- a/progs/trivial/clear-fbo.c
+++ b/progs/trivial/clear-fbo.c
@@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c
index e3da23a8f5..ab67f84518 100644
--- a/progs/trivial/clear-random.c
+++ b/progs/trivial/clear-random.c
@@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(0);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c
index 0173532748..2b6dee77a9 100644
--- a/progs/trivial/clear-scissor.c
+++ b/progs/trivial/clear-scissor.c
@@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
}
diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c
index 03857b4b89..56c3ea52e6 100644
--- a/progs/trivial/clear.c
+++ b/progs/trivial/clear.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(0);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c
index f2cc6f1cff..04a088642b 100644
--- a/progs/trivial/createwin.c
+++ b/progs/trivial/createwin.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c
index 0d0aed7c72..da3864a02a 100644
--- a/progs/trivial/dlist-begin-call-end.c
+++ b/progs/trivial/dlist-begin-call-end.c
@@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c
index de10628009..756ab93f87 100644
--- a/progs/trivial/dlist-dangling.c
+++ b/progs/trivial/dlist-dangling.c
@@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c
index 3d3aaeb694..51504471e2 100644
--- a/progs/trivial/dlist-edgeflag-dangling.c
+++ b/progs/trivial/dlist-edgeflag-dangling.c
@@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c
index 8002129ed1..9456b96473 100644
--- a/progs/trivial/dlist-edgeflag.c
+++ b/progs/trivial/dlist-edgeflag.c
@@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-flat-tri.c b/progs/trivial/dlist-flat-tri.c
index c3dd7921e3..3ee9b283a4 100644
--- a/progs/trivial/dlist-flat-tri.c
+++ b/progs/trivial/dlist-flat-tri.c
@@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-mat-tri.c b/progs/trivial/dlist-mat-tri.c
index ed3a4c5981..d17c4b913b 100644
--- a/progs/trivial/dlist-mat-tri.c
+++ b/progs/trivial/dlist-mat-tri.c
@@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-recursive-call.c b/progs/trivial/dlist-recursive-call.c
index fe06b2bbd7..90224f63cb 100644
--- a/progs/trivial/dlist-recursive-call.c
+++ b/progs/trivial/dlist-recursive-call.c
@@ -118,7 +118,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-tri-flat-tri.c b/progs/trivial/dlist-tri-flat-tri.c
index 4dbb788486..3265a4d6dc 100644
--- a/progs/trivial/dlist-tri-flat-tri.c
+++ b/progs/trivial/dlist-tri-flat-tri.c
@@ -99,7 +99,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/dlist-tri-mat-tri.c b/progs/trivial/dlist-tri-mat-tri.c
index f69854ae58..053bb124a2 100644
--- a/progs/trivial/dlist-tri-mat-tri.c
+++ b/progs/trivial/dlist-tri-mat-tri.c
@@ -102,7 +102,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c
index 5276baffd5..e4e388ed5c 100644
--- a/progs/trivial/line-clip.c
+++ b/progs/trivial/line-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c
index 1e1b77a942..c531ff132f 100644
--- a/progs/trivial/line-cull.c
+++ b/progs/trivial/line-cull.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c
index 14f0ac0782..e2ddb87b9e 100644
--- a/progs/trivial/line-flat.c
+++ b/progs/trivial/line-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c
index 1804ffad3f..767583bbea 100644
--- a/progs/trivial/line-stipple-wide.c
+++ b/progs/trivial/line-stipple-wide.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c
index 8e030b47ce..3265b2c3bf 100644
--- a/progs/trivial/line-userclip-clip.c
+++ b/progs/trivial/line-userclip-clip.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c
index 6fcd4bcfe7..0198e27807 100644
--- a/progs/trivial/line-userclip-nop-clip.c
+++ b/progs/trivial/line-userclip-nop-clip.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c
index e59fd133a5..6c863a3c82 100644
--- a/progs/trivial/line-userclip-nop.c
+++ b/progs/trivial/line-userclip-nop.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c
index e30be5580b..6cfcb6fc73 100644
--- a/progs/trivial/line-userclip.c
+++ b/progs/trivial/line-userclip.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c
index b74021dea7..1945712c5d 100644
--- a/progs/trivial/line-wide.c
+++ b/progs/trivial/line-wide.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/line.c b/progs/trivial/line.c
index e1d73280bf..58ab96836f 100644
--- a/progs/trivial/line.c
+++ b/progs/trivial/line.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c
index 45fa47491f..5e6b6217a1 100644
--- a/progs/trivial/lineloop-clip.c
+++ b/progs/trivial/lineloop-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c
index c290dbd8cb..82eccd24f8 100644
--- a/progs/trivial/lineloop.c
+++ b/progs/trivial/lineloop.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c
index 701c82c266..0296941a0d 100644
--- a/progs/trivial/linestrip-stipple-wide.c
+++ b/progs/trivial/linestrip-stipple-wide.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c
index df2eef96b5..a847d47dee 100644
--- a/progs/trivial/linestrip-stipple.c
+++ b/progs/trivial/linestrip-stipple.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c
index 4c89ba598d..23cfd77863 100644
--- a/progs/trivial/point-clip.c
+++ b/progs/trivial/point-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c
index 6f43720a89..46bd773265 100644
--- a/progs/trivial/point-param.c
+++ b/progs/trivial/point-param.c
@@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
}
diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c
index 5d29a6a3cf..16e6771514 100644
--- a/progs/trivial/point-sprite.c
+++ b/progs/trivial/point-sprite.c
@@ -96,7 +96,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c
index f6e9b8df5f..752cb8aee3 100644
--- a/progs/trivial/point-wide-smooth.c
+++ b/progs/trivial/point-wide-smooth.c
@@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c
index 8abd64c6a9..3b00ee9e50 100644
--- a/progs/trivial/point-wide.c
+++ b/progs/trivial/point-wide.c
@@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/point.c b/progs/trivial/point.c
index 49959dcc48..8f5299cf6b 100644
--- a/progs/trivial/point.c
+++ b/progs/trivial/point.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c
index 5490068b08..2a968bed40 100644
--- a/progs/trivial/poly-flat-clip.c
+++ b/progs/trivial/poly-flat-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c
index 26b90ef964..89f4e0656a 100644
--- a/progs/trivial/poly-flat-unfilled-clip.c
+++ b/progs/trivial/poly-flat-unfilled-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c
index a4e3cdb633..33c2e04e0f 100644
--- a/progs/trivial/poly-flat.c
+++ b/progs/trivial/poly-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c
index 2ad443dc15..c8c0d7a9e3 100644
--- a/progs/trivial/poly-unfilled.c
+++ b/progs/trivial/poly-unfilled.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c
index e5b788ea5b..964eb42d78 100644
--- a/progs/trivial/poly.c
+++ b/progs/trivial/poly.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c
index 60c87fc9ce..7712d8ca5b 100644
--- a/progs/trivial/quad-clip-all-vertices.c
+++ b/progs/trivial/quad-clip-all-vertices.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c
index 063de6106a..2847c9f960 100644
--- a/progs/trivial/quad-clip.c
+++ b/progs/trivial/quad-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c
index fdc142bcd6..85e129d4be 100644
--- a/progs/trivial/quad-degenerate.c
+++ b/progs/trivial/quad-degenerate.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c
index e3147b3b3f..bed98e31a4 100644
--- a/progs/trivial/quad-flat.c
+++ b/progs/trivial/quad-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c
index dfe99bbae6..1fc57a54ae 100644
--- a/progs/trivial/quad-offset-factor.c
+++ b/progs/trivial/quad-offset-factor.c
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c
index 06590021fe..62f50fb98c 100644
--- a/progs/trivial/quad-offset-unfilled.c
+++ b/progs/trivial/quad-offset-unfilled.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c
index 922529d977..1ac2338692 100644
--- a/progs/trivial/quad-offset-units.c
+++ b/progs/trivial/quad-offset-units.c
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c
index eebaf9170e..9db6792fad 100644
--- a/progs/trivial/quad-tex-alpha.c
+++ b/progs/trivial/quad-tex-alpha.c
@@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c
index ad41a9a22e..b7aa1db436 100644
--- a/progs/trivial/quad-tex-pbo.c
+++ b/progs/trivial/quad-tex-pbo.c
@@ -105,7 +105,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c
index 761878bd4b..d2e8718775 100644
--- a/progs/trivial/quad-unfilled-clip.c
+++ b/progs/trivial/quad-unfilled-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c
index cd7d276928..8c1737e675 100644
--- a/progs/trivial/quad-unfilled-stipple.c
+++ b/progs/trivial/quad-unfilled-stipple.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c
index d64f17fdf9..b756449d7a 100644
--- a/progs/trivial/quad-unfilled.c
+++ b/progs/trivial/quad-unfilled.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c
index d360e309d3..582de783d5 100644
--- a/progs/trivial/quad.c
+++ b/progs/trivial/quad.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c
index fe11fef207..de7854a255 100644
--- a/progs/trivial/quads.c
+++ b/progs/trivial/quads.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c
index 329523531a..44412698dc 100644
--- a/progs/trivial/quadstrip-cont.c
+++ b/progs/trivial/quadstrip-cont.c
@@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c
index 228c6c255e..0e0b3b49fa 100644
--- a/progs/trivial/quadstrip-flat.c
+++ b/progs/trivial/quadstrip-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c
index d49a9a5302..1be815fb8c 100644
--- a/progs/trivial/quadstrip.c
+++ b/progs/trivial/quadstrip.c
@@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c
index 5671618446..b063f17956 100644
--- a/progs/trivial/readpixels.c
+++ b/progs/trivial/readpixels.c
@@ -39,7 +39,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(0);
default:
- return;
+ break;
}
glutPostRedisplay();
}
diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c
index 780ebe6be5..853d564ae7 100644
--- a/progs/trivial/tri-alpha-tex.c
+++ b/progs/trivial/tri-alpha-tex.c
@@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c
index aec1cbb377..bd1c88ecf8 100644
--- a/progs/trivial/tri-alpha.c
+++ b/progs/trivial/tri-alpha.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c
index 92f019259e..629b35c4ab 100644
--- a/progs/trivial/tri-blend-color.c
+++ b/progs/trivial/tri-blend-color.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c
index f49186bd8a..e52ed81bf4 100644
--- a/progs/trivial/tri-clear.c
+++ b/progs/trivial/tri-clear.c
@@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c
index e1deca1bdc..3e3879c985 100644
--- a/progs/trivial/tri-clip.c
+++ b/progs/trivial/tri-clip.c
@@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
}
diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c
index 864be710c2..809599d4a6 100644
--- a/progs/trivial/tri-cull-both.c
+++ b/progs/trivial/tri-cull-both.c
@@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c
index c410be221a..62d0a965d8 100644
--- a/progs/trivial/tri-dlist.c
+++ b/progs/trivial/tri-dlist.c
@@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c
index 1ed177ffdf..089180f97a 100644
--- a/progs/trivial/tri-fbo.c
+++ b/progs/trivial/tri-fbo.c
@@ -75,7 +75,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c
index 2aab5ba00a..a23f8a382b 100644
--- a/progs/trivial/tri-flat-clip.c
+++ b/progs/trivial/tri-flat-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c
index ea703ec6f3..0614321844 100644
--- a/progs/trivial/tri-flat.c
+++ b/progs/trivial/tri-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c
index 0cea3d3258..7fc254a467 100644
--- a/progs/trivial/tri-fog.c
+++ b/progs/trivial/tri-fog.c
@@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c
index d2df442abf..accea62042 100644
--- a/progs/trivial/tri-fp-const-imm.c
+++ b/progs/trivial/tri-fp-const-imm.c
@@ -92,7 +92,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c
index 4d1508120e..8f933befd3 100644
--- a/progs/trivial/tri-fp.c
+++ b/progs/trivial/tri-fp.c
@@ -90,7 +90,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-lit-material.c b/progs/trivial/tri-lit-material.c
index ff9fb2c4dd..16cebb2b98 100644
--- a/progs/trivial/tri-lit-material.c
+++ b/progs/trivial/tri-lit-material.c
@@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c
index 15a7ad24c5..26ebd99d91 100644
--- a/progs/trivial/tri-lit.c
+++ b/progs/trivial/tri-lit.c
@@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c
index e319447ac1..ca4edaa5dd 100644
--- a/progs/trivial/tri-multitex-vbo.c
+++ b/progs/trivial/tri-multitex-vbo.c
@@ -192,7 +192,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c
index e7cfee3a36..d86d34c39d 100644
--- a/progs/trivial/tri-orig.c
+++ b/progs/trivial/tri-orig.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c
index 94956a86f3..8898f182c7 100644
--- a/progs/trivial/tri-query.c
+++ b/progs/trivial/tri-query.c
@@ -72,7 +72,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c
index 608ebf29cf..d65502d91b 100644
--- a/progs/trivial/tri-scissor-tri.c
+++ b/progs/trivial/tri-scissor-tri.c
@@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c
index 0b82a1dd8e..2014bd489c 100644
--- a/progs/trivial/tri-square.c
+++ b/progs/trivial/tri-square.c
@@ -63,7 +63,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c
index aa94fa224b..15a08fec7c 100644
--- a/progs/trivial/tri-stipple.c
+++ b/progs/trivial/tri-stipple.c
@@ -77,7 +77,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c
index 3ccbe12510..073a080d7a 100644
--- a/progs/trivial/tri-tex-3d.c
+++ b/progs/trivial/tri-tex-3d.c
@@ -97,7 +97,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c
index 56afb4748d..244e154504 100644
--- a/progs/trivial/tri-tex.c
+++ b/progs/trivial/tri-tex.c
@@ -94,7 +94,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c
index f996bd01a1..7bf400793e 100644
--- a/progs/trivial/tri-tri.c
+++ b/progs/trivial/tri-tri.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c
index 2fd894a49a..585919e16d 100644
--- a/progs/trivial/tri-unfilled-clip.c
+++ b/progs/trivial/tri-unfilled-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c
index 11c21d1bf6..f536f64229 100644
--- a/progs/trivial/tri-unfilled-edgeflag.c
+++ b/progs/trivial/tri-unfilled-edgeflag.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c
index 750a254669..11e276e1a5 100644
--- a/progs/trivial/tri-unfilled-point.c
+++ b/progs/trivial/tri-unfilled-point.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c
index eddae176e5..fa31667e65 100644
--- a/progs/trivial/tri-unfilled-smooth.c
+++ b/progs/trivial/tri-unfilled-smooth.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c
index 1d42b40b71..d6baeb4697 100644
--- a/progs/trivial/tri-unfilled-tri-lit.c
+++ b/progs/trivial/tri-unfilled-tri-lit.c
@@ -65,7 +65,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c
index ddc0dffd4f..02bfa92f83 100644
--- a/progs/trivial/tri-unfilled-userclip-stip.c
+++ b/progs/trivial/tri-unfilled-userclip-stip.c
@@ -67,7 +67,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c
index 0dec0bfc9b..11e53fc7cc 100644
--- a/progs/trivial/tri-unfilled-userclip.c
+++ b/progs/trivial/tri-unfilled-userclip.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c
index b98cb9a842..afa1058dad 100644
--- a/progs/trivial/tri-unfilled.c
+++ b/progs/trivial/tri-unfilled.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c
index 8f37e0fae2..5651c73832 100644
--- a/progs/trivial/tri-userclip.c
+++ b/progs/trivial/tri-userclip.c
@@ -66,7 +66,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c
index 099e89f6f4..37b9e2f873 100644
--- a/progs/trivial/tri-z-9.c
+++ b/progs/trivial/tri-z-9.c
@@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c
index b81c992f7d..6bdac47419 100644
--- a/progs/trivial/tri-z-eq.c
+++ b/progs/trivial/tri-z-eq.c
@@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c
index 199f91a637..89bc471191 100644
--- a/progs/trivial/trifan-flat-clip.c
+++ b/progs/trivial/trifan-flat-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c
index ea3e155387..3a1a226e54 100644
--- a/progs/trivial/trifan-flat-unfilled-clip.c
+++ b/progs/trivial/trifan-flat-unfilled-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c
index d69b4887e3..d25abdf49e 100644
--- a/progs/trivial/trifan-flat.c
+++ b/progs/trivial/trifan-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c
index 91447e4e44..2e3ff8218f 100644
--- a/progs/trivial/trifan-unfilled.c
+++ b/progs/trivial/trifan-unfilled.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c
index 84eb4172de..b8a7615114 100644
--- a/progs/trivial/trifan.c
+++ b/progs/trivial/trifan.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c
index 343e293804..4e6ee1fbca 100644
--- a/progs/trivial/tristrip-clip.c
+++ b/progs/trivial/tristrip-clip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c
index 02da97efce..a90b8b6cb6 100644
--- a/progs/trivial/tristrip-flat.c
+++ b/progs/trivial/tristrip-flat.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c
index 77bf2fad28..29915ff111 100644
--- a/progs/trivial/tristrip.c
+++ b/progs/trivial/tristrip.c
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c
index 42bf9806b1..9cbc4d1193 100644
--- a/progs/trivial/vp-tri-cb-pos.c
+++ b/progs/trivial/vp-tri-cb-pos.c
@@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c
index 8290226675..e543e2ec3f 100644
--- a/progs/trivial/vp-tri-cb-tex.c
+++ b/progs/trivial/vp-tri-cb-tex.c
@@ -114,7 +114,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c
index ff24139365..4dbe95eb9a 100644
--- a/progs/trivial/vp-tri-invariant.c
+++ b/progs/trivial/vp-tri-invariant.c
@@ -69,7 +69,7 @@ static void Key(unsigned char key, int x, int y)
case 27:
exit(1);
default:
- return;
+ break;
}
glutPostRedisplay();
--
cgit v1.2.3
From 6345a7ba447d3e04b939ead6fee44fe9201ec2e3 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Thu, 19 Nov 2009 16:05:43 -0500
Subject: r600 : check in shader code test enable flag: if flag
R600_ENABLE_GLSL_TEST defined, IL shader code will goto r600 assembler. The
test base is /mesa/progs/glsl/brick, and changes shader code in
CH06-brick.frag/vert to test different logic op combination.
(if,else,while,function,...). The stack depth code is not in yet, so it is
hard coded now. So complex code would not run (such as things like 8 loops
embeded loop in loop).
---
src/mesa/drivers/dri/r600/r600_context.c | 54 +++++++++++++++++++++++++++---
src/mesa/drivers/dri/r600/r700_assembler.c | 44 +++++++++++++++---------
2 files changed, 77 insertions(+), 21 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index dbd233729c..ca0a670f3c 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -72,7 +72,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vblank.h"
#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
+#include "xmlpool.h" /* for symbolic values of enum-type options */
+
+//#define R600_ENABLE_GLSL_TEST 1
#define need_GL_VERSION_2_0
#define need_GL_ARB_occlusion_query
@@ -154,8 +156,12 @@ static const struct dri_extension mm_extensions[] = {
* The GL 2.0 functions are needed to make display lists work with
* functions added by GL_ATI_separate_stencil.
*/
-static const struct dri_extension gl_20_extension[] = {
- {"GL_VERSION_2_0", GL_VERSION_2_0_functions },
+static const struct dri_extension gl_20_extension[] = {
+#ifdef R600_ENABLE_GLSL_TEST
+ {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
+#else
+ {"GL_VERSION_2_0", GL_VERSION_2_0_functions },
+#endif /* R600_ENABLE_GLSL_TEST */
};
static const struct tnl_pipeline_stage *r600_pipeline[] = {
@@ -306,7 +312,28 @@ static void r600InitGLExtensions(GLcontext *ctx)
driInitExtensions(ctx, card_extensions, GL_TRUE);
if (r600->radeon.radeonScreen->kernel_mm)
- driInitExtensions(ctx, mm_extensions, GL_FALSE);
+ driInitExtensions(ctx, mm_extensions, GL_FALSE);
+
+#ifdef R600_ENABLE_GLSL_TEST
+ driInitExtensions(ctx, gl_20_extension, GL_TRUE);
+ //_mesa_enable_2_0_extensions(ctx);
+ //1.5
+ ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+ ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
+ ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
+ //2.0
+ ctx->Extensions.ARB_draw_buffers = GL_TRUE;
+ ctx->Extensions.ARB_point_sprite = GL_TRUE;
+ ctx->Extensions.ARB_shader_objects = GL_TRUE;
+ ctx->Extensions.ARB_vertex_shader = GL_TRUE;
+ ctx->Extensions.ARB_fragment_shader = GL_TRUE;
+ ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
+ ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
+ ctx->Extensions.ATI_separate_stencil = GL_TRUE;
+
+ /* glsl compiler has problem if this is not GL_TRUE */
+ ctx->Shader.EmitCondCodes = GL_TRUE;
+#endif /* R600_ENABLE_GLSL_TEST */
if (driQueryOptionb
(&r600->radeon.optionCache, "disable_stencil_two_side"))
@@ -341,7 +368,24 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual,
assert(glVisual);
assert(driContextPriv);
- assert(screen);
+ assert(screen);
+
+ //richard test
+ FILE *pFile = NULL;
+ unsigned long ulByteToWrite = 0;
+ char szStr[1024];
+
+ pFile = fopen("//home//richard//rtp-log//func_call.log", "a+");
+ if(NULL != pFile)
+ {
+ sprintf(szStr, "r600CreateContext \r\n");
+ ulByteToWrite = strlen(szStr);
+ fwrite(szStr, 1, ulByteToWrite, pFile);
+
+ fclose(pFile);
+ pFile = NULL;
+ }
+ //-------------
/* Allocate the R600 context */
r600 = (context_t*) CALLOC(sizeof(*r600));
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 6e8d1cd927..16ac920f29 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4983,17 +4983,31 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason)
{
- switch (uReason)
- {
- case FC_PUSH_VPM:
- break;
- case FC_PUSH_WQM:
- break;
- case FC_LOOP:
- break;
- case FC_REP:
- break;
- };
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++;
+ break;
+ case FC_PUSH_WQM:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4;
+ break;
+ case FC_LOOP:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4;
+ break;
+ case FC_REP:
+ /* TODO : for 16 vp asic, should += 2; */
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1;
+ break;
+ };
+
+ if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs
+ > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max =
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs;
+ }
}
GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset)
@@ -5092,10 +5106,6 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
{
-#ifdef USE_CF_FOR_POP_AFTER
- pops(pAsm, 1);
-#endif /* USE_CF_FOR_POP_AFTER */
-
if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
@@ -5647,7 +5657,9 @@ GLboolean testFlag(r700_AssemblerBase *pAsm)
{
return GL_FALSE;
}
-#endif
+#endif
+
+ checkStackDepth(pAsm, FC_PUSH_VPM);
return GL_TRUE;
}
--
cgit v1.2.3
From 3f4016650099642f900fc169c078b1d78128899a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 14:02:06 -0700
Subject: softpipe: whitespace/indentation fixes
---
src/gallium/drivers/softpipe/sp_context.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index d325499bf8..5f60139968 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -249,9 +249,9 @@ softpipe_create( struct pipe_screen *screen )
/* setup quad rendering stages */
- softpipe->quad.shade = sp_quad_shade_stage(softpipe);
- softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe);
- softpipe->quad.blend = sp_quad_blend_stage(softpipe);
+ softpipe->quad.shade = sp_quad_shade_stage(softpipe);
+ softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe);
+ softpipe->quad.blend = sp_quad_blend_stage(softpipe);
/*
@@ -281,7 +281,6 @@ softpipe_create( struct pipe_screen *screen )
draw_set_render(softpipe->draw, softpipe->vbuf_backend);
-
/* plug in AA line/point stages */
draw_install_aaline_stage(softpipe->draw, &softpipe->pipe);
draw_install_aapoint_stage(softpipe->draw, &softpipe->pipe);
@@ -297,4 +296,3 @@ softpipe_create( struct pipe_screen *screen )
softpipe_destroy(&softpipe->pipe);
return NULL;
}
-
--
cgit v1.2.3
From 273f4d6b5fe125bf0cba44c5ee8b25c76d3396c0 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 14:10:57 -0700
Subject: st/mesa: remove pointless assertion
---
src/mesa/state_tracker/st_cb_texture.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 9186db76e1..5283ece551 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1724,8 +1724,6 @@ copy_image_data_to_texture(struct st_context *st,
pipe_texture_reference(&stImage->pt, NULL);
}
else if (stImage->base.Data) {
- assert(stImage->base.Data != NULL);
-
/* More straightforward upload.
*/
--
cgit v1.2.3
From 92863109af05acdb4ee5e42141c83ab0f18b7f88 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 14:17:09 -0700
Subject: st/mesa: remove is_compressed_mesa_format()
---
src/mesa/state_tracker/st_cb_texture.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 5283ece551..76b6bbeb4b 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -119,25 +119,6 @@ compressed_num_bytes(gl_format format)
}
-static GLboolean
-is_compressed_mesa_format(gl_format format)
-{
- switch (format) {
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
/** called via ctx->Driver.NewTextureImage() */
static struct gl_texture_image *
st_NewTextureImage(GLcontext * ctx)
@@ -663,7 +644,7 @@ st_TexImage(GLcontext * ctx,
*/
if (!compressed_src &&
!ctx->Mesa_DXTn &&
- is_compressed_mesa_format(texImage->TexFormat) &&
+ _mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
stImage->pt->target,
@@ -1066,7 +1047,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
/* See if we can do texture compression with a blit/render.
*/
if (!ctx->Mesa_DXTn &&
- is_compressed_mesa_format(texImage->TexFormat) &&
+ _mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
stImage->pt->target,
--
cgit v1.2.3
From dc41d62250ce51f28e94f1d365836ac9f2ff8907 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 14:35:38 -0700
Subject: st/mesa: get rid of compressed_num_bytes() code
---
src/mesa/state_tracker/st_cb_texture.c | 40 ++++------------------------------
1 file changed, 4 insertions(+), 36 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 76b6bbeb4b..d4630a514f 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -93,32 +93,6 @@ gl_target_to_pipe(GLenum target)
}
-/**
- * Return nominal bytes per texel for a compressed format, 0 for non-compressed
- * format.
- */
-static GLuint
-compressed_num_bytes(gl_format format)
-{
- switch (format) {
-#if FEATURE_texture_fxt1
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
-#endif
-#if FEATURE_texture_s3tc
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- return 2;
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
- return 4;
-#endif
- default:
- return 0;
- }
-}
-
-
/** called via ctx->Driver.NewTextureImage() */
static struct gl_texture_image *
st_NewTextureImage(GLcontext * ctx)
@@ -1743,7 +1717,7 @@ st_finalize_texture(GLcontext *ctx,
{
struct st_texture_object *stObj = st_texture_object(tObj);
const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- GLuint cpp, face;
+ GLuint blockSize, face;
struct st_texture_image *firstImage;
*needFlush = GL_FALSE;
@@ -1775,13 +1749,8 @@ st_finalize_texture(GLcontext *ctx,
pipe_texture_reference(&stObj->pt, firstImage->pt);
}
- /* FIXME: determine format block instead of cpp */
- if (_mesa_is_format_compressed(firstImage->base.TexFormat)) {
- cpp = compressed_num_bytes(firstImage->base.TexFormat);
- }
- else {
- cpp = _mesa_get_format_bytes(firstImage->base.TexFormat);
- }
+ /* bytes per pixel block (blocks are usually 1x1) */
+ blockSize = _mesa_get_format_bytes(firstImage->base.TexFormat);
/* If we already have a gallium texture, check that it matches the texture
* object's format, target, size, num_levels, etc.
@@ -1795,8 +1764,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->width[0] != firstImage->base.Width2 ||
stObj->pt->height[0] != firstImage->base.Height2 ||
stObj->pt->depth[0] != firstImage->base.Depth2 ||
- /* Nominal bytes per pixel: */
- stObj->pt->block.size / stObj->pt->block.width != cpp)
+ stObj->pt->block.size != blockSize)
{
pipe_texture_reference(&stObj->pt, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
--
cgit v1.2.3
From 48dfd3938e428295c45692cfde0a2afff04a7970 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Thu, 19 Nov 2009 16:55:16 -0500
Subject: r600 : change shader pop method for now.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 54 +++++++++++++++---------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 16ac920f29..e3bc46802f 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -39,7 +39,7 @@
#include "r700_assembler.h"
#define USE_CF_FOR_CONTINUE_BREAK 1
-#define USE_CF_FOR_POP_AFTER 1
+//#define USE_CF_FOR_POP_AFTER 1
BITS addrmode_PVSDST(PVSDST * pPVSDST)
{
@@ -4983,30 +4983,30 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason)
{
- switch (uReason)
- {
- case FC_PUSH_VPM:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++;
- break;
- case FC_PUSH_WQM:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4;
- break;
- case FC_LOOP:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4;
- break;
- case FC_REP:
- /* TODO : for 16 vp asic, should += 2; */
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1;
- break;
- };
-
- if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs
- > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max)
- {
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max =
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs;
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++;
+ break;
+ case FC_PUSH_WQM:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4;
+ break;
+ case FC_LOOP:
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4;
+ break;
+ case FC_REP:
+ /* TODO : for 16 vp asic, should += 2; */
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1;
+ break;
+ };
+
+ if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs
+ > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max =
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs;
}
}
@@ -5657,8 +5657,8 @@ GLboolean testFlag(r700_AssemblerBase *pAsm)
{
return GL_FALSE;
}
-#endif
-
+#endif
+
checkStackDepth(pAsm, FC_PUSH_VPM);
return GL_TRUE;
--
cgit v1.2.3
From 2198497203ec427f836978098028abf3350e5e57 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 15:17:56 -0700
Subject: vbo: added recursion check in vbo_exec_FlushVertices()
---
src/mesa/vbo/vbo_exec_api.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index f72d2d84f3..c90565eae8 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -867,15 +867,27 @@ void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap )
}
-
+/**
+ * \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT
+ */
void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+#ifdef DEBUG
+ /* debug check: make sure we don't get called recursively */
+ static GLuint callDepth = 0;
+ callDepth++;
+ assert(callDepth == 1);
+#endif
+
if (0) _mesa_printf("%s\n", __FUNCTION__);
if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__);
+#ifdef DEBUG
+ callDepth--;
+#endif
return;
}
@@ -889,6 +901,10 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
}
exec->ctx->Driver.NeedFlush &= ~flags;
+
+#ifdef DEBUG
+ callDepth--;
+#endif
}
--
cgit v1.2.3
From 4e6c79ac166b71414f09e671aaad0e1d0d406e42 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Thu, 19 Nov 2009 15:18:17 -0700
Subject: st/mesa: replace st_flush() with pipe->flush()
We only need to flush the gallium driver in this case.
Fixes a recursive state validation bug.
---
src/mesa/state_tracker/st_texture.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 3945822f66..10f1351283 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -588,5 +588,5 @@ st_teximage_flush_before_map(struct st_context *st,
if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
(usage & PIPE_TRANSFER_WRITE)))
- st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ st->pipe->flush(st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
}
--
cgit v1.2.3
From 4ab8dbe5935d5c946cbc9af6982461073a784d07 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 14:20:26 -0800
Subject: progs/xdemos: Add missing break statement in offset.c.
---
progs/xdemos/offset.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/xdemos/offset.c b/progs/xdemos/offset.c
index 6c5abf383b..314a4fcdd1 100644
--- a/progs/xdemos/offset.c
+++ b/progs/xdemos/offset.c
@@ -294,6 +294,7 @@ process_input(Display *dpy, Window win) {
default:
break;
}
+ break;
case ButtonPress:
prevx = event.xbutton.x;
prevy = event.xbutton.y;
--
cgit v1.2.3
From 683e35f726a182ed9fc6b6d5cb07146eebe14dea Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Thu, 19 Nov 2009 14:39:34 -0800
Subject: gallium: don't use arrays for texture width,height,depth
---
src/gallium/auxiliary/draw/draw_pipe_aaline.c | 10 +--
src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 6 +-
src/gallium/auxiliary/util/u_blit.c | 26 +++----
src/gallium/auxiliary/util/u_gen_mipmap.c | 25 +++---
src/gallium/auxiliary/util/u_math.h | 4 +-
src/gallium/auxiliary/util/u_surface.c | 6 +-
src/gallium/auxiliary/vl/vl_compositor.c | 12 +--
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 22 +++---
src/gallium/drivers/i915/i915_state_sampler.c | 2 +-
src/gallium/drivers/i915/i915_texture.c | 96 +++++++++++-------------
src/gallium/drivers/softpipe/sp_tex_sample.c | 58 +++++++-------
src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 7 +-
src/gallium/drivers/softpipe/sp_texture.c | 49 ++++++------
src/gallium/drivers/trace/tr_dump_state.c | 6 +-
src/gallium/drivers/trace/tr_rbug.c | 6 +-
src/gallium/include/pipe/p_state.h | 6 +-
src/mesa/state_tracker/st_atom_framebuffer.c | 5 +-
src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +-
src/mesa/state_tracker/st_cb_drawpixels.c | 4 +-
src/mesa/state_tracker/st_cb_fbo.c | 6 +-
src/mesa/state_tracker/st_cb_readpixels.c | 2 +-
src/mesa/state_tracker/st_cb_texture.c | 12 +--
src/mesa/state_tracker/st_gen_mipmap.c | 39 +++++-----
src/mesa/state_tracker/st_texture.c | 36 ++++-----
24 files changed, 226 insertions(+), 221 deletions(-)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 9f956715a2..31de84b272 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -398,9 +398,9 @@ aaline_create_texture(struct aaline_stage *aaline)
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
texTemp.last_level = MAX_TEXTURE_LEVEL;
- texTemp.width[0] = 1 << MAX_TEXTURE_LEVEL;
- texTemp.height[0] = 1 << MAX_TEXTURE_LEVEL;
- texTemp.depth[0] = 1;
+ texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
+ texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
+ texTemp.depth0 = 1;
pf_get_block(texTemp.format, &texTemp.block);
aaline->texture = screen->texture_create(screen, &texTemp);
@@ -413,11 +413,11 @@ aaline_create_texture(struct aaline_stage *aaline)
*/
for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
struct pipe_transfer *transfer;
- const uint size = aaline->texture->width[level];
+ const uint size = u_minify(aaline->texture->width0, level);
ubyte *data;
uint i, j;
- assert(aaline->texture->width[level] == aaline->texture->height[level]);
+ assert(aaline->texture->width0 == aaline->texture->height0);
/* This texture is new, no need to flush.
*/
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 283502cdf3..27d89721b1 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -427,9 +427,9 @@ pstip_create_texture(struct pstip_stage *pstip)
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
texTemp.last_level = 0;
- texTemp.width[0] = 32;
- texTemp.height[0] = 32;
- texTemp.depth[0] = 1;
+ texTemp.width0 = 32;
+ texTemp.height0 = 32;
+ texTemp.depth0 = 1;
pf_get_block(texTemp.format, &texTemp.block);
pstip->texture = screen->texture_create(screen, &texTemp);
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 5038642599..5372df5735 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -354,9 +354,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = src->format;
texTemp.last_level = 0;
- texTemp.width[0] = srcW;
- texTemp.height[0] = srcH;
- texTemp.depth[0] = 1;
+ texTemp.width0 = srcW;
+ texTemp.height0 = srcH;
+ texTemp.depth0 = 1;
pf_get_block(src->format, &texTemp.block);
tex = screen->texture_create(screen, &texTemp);
@@ -389,10 +389,10 @@ util_blit_pixels_writemask(struct blit_state *ctx,
}
else {
pipe_texture_reference(&tex, src->texture);
- s0 = srcX0 / (float)tex->width[0];
- s1 = srcX1 / (float)tex->width[0];
- t0 = srcY0 / (float)tex->height[0];
- t1 = srcY1 / (float)tex->height[0];
+ s0 = srcX0 / (float)tex->width0;
+ s1 = srcX1 / (float)tex->width0;
+ t0 = srcY0 / (float)tex->height0;
+ t1 = srcY1 / (float)tex->height0;
}
@@ -518,13 +518,13 @@ util_blit_pixels_tex(struct blit_state *ctx,
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
filter == PIPE_TEX_MIPFILTER_LINEAR);
- assert(tex->width[0] != 0);
- assert(tex->height[0] != 0);
+ assert(tex->width0 != 0);
+ assert(tex->height0 != 0);
- s0 = srcX0 / (float)tex->width[0];
- s1 = srcX1 / (float)tex->width[0];
- t0 = srcY0 / (float)tex->height[0];
- t1 = srcY1 / (float)tex->height[0];
+ s0 = srcX0 / (float)tex->width0;
+ s1 = srcX1 / (float)tex->width0;
+ t0 = srcY0 / (float)tex->height0;
+ t1 = srcY1 / (float)tex->height0;
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
PIPE_TEXTURE_2D,
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index aa823aa218..84db14576e 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -45,6 +45,7 @@
#include "util/u_draw_quad.h"
#include "util/u_gen_mipmap.h"
#include "util/u_simple_shaders.h"
+#include "util/u_math.h"
#include "cso_cache/cso_context.h"
@@ -1125,12 +1126,12 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
- pt->width[srcLevel],
- pt->height[srcLevel]);
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel));
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
- pt->width[dstLevel],
- pt->height[dstLevel]);
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel));
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
@@ -1168,12 +1169,12 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
- pt->width[srcLevel],
- pt->height[srcLevel]);
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel));
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
- pt->width[dstLevel],
- pt->height[dstLevel]);
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel));
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
@@ -1575,8 +1576,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
* Setup framebuffer / dest surface
*/
fb.cbufs[0] = surf;
- fb.width = pt->width[dstLevel];
- fb.height = pt->height[dstLevel];
+ fb.width = u_minify(pt->width0, dstLevel);
+ fb.height = u_minify(pt->height0, dstLevel);
cso_set_framebuffer(ctx->cso, &fb);
/*
@@ -1597,8 +1598,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
offset = set_vertex_data(ctx,
pt->target,
face,
- (float) pt->width[dstLevel],
- (float) pt->height[dstLevel]);
+ (float) u_minify(pt->width0, dstLevel),
+ (float) u_minify(pt->height0, dstLevel));
util_draw_vertex_buffer(ctx->pipe,
ctx->vbuf,
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 75b075f160..7a598efc3a 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -507,9 +507,9 @@ align(int value, int alignment)
}
static INLINE unsigned
-minify(unsigned value)
+u_minify(unsigned value, unsigned levels)
{
- return MAX2(1, value >> 1);
+ return MAX2(1, value >> levels);
}
#ifndef COPY_4V
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 85e443204e..de8c266db8 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -79,9 +79,9 @@ util_create_rgba_surface(struct pipe_screen *screen,
templ.target = target;
templ.format = format;
templ.last_level = 0;
- templ.width[0] = width;
- templ.height[0] = height;
- templ.depth[0] = 1;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
pf_get_block(format, &templ.block);
templ.tex_usage = usage;
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index cda6dc134a..592dd17421 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -455,8 +455,8 @@ void vl_compositor_render(struct vl_compositor *compositor,
assert(dst_area);
assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME);
- compositor->fb_state.width = dst_surface->width[0];
- compositor->fb_state.height = dst_surface->height[0];
+ compositor->fb_state.width = dst_surface->width0;
+ compositor->fb_state.height = dst_surface->height0;
compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface
(
compositor->pipe->screen,
@@ -504,12 +504,12 @@ void vl_compositor_render(struct vl_compositor *compositor,
vs_consts->dst_trans.z = 0;
vs_consts->dst_trans.w = 0;
- vs_consts->src_scale.x = src_area->w / (float)src_surface->width[0];
- vs_consts->src_scale.y = src_area->h / (float)src_surface->height[0];
+ vs_consts->src_scale.x = src_area->w / (float)src_surface->width0;
+ vs_consts->src_scale.y = src_area->h / (float)src_surface->height0;
vs_consts->src_scale.z = 1;
vs_consts->src_scale.w = 1;
- vs_consts->src_trans.x = src_area->x / (float)src_surface->width[0];
- vs_consts->src_trans.y = src_area->y / (float)src_surface->height[0];
+ vs_consts->src_trans.x = src_area->x / (float)src_surface->width0;
+ vs_consts->src_trans.y = src_area->y / (float)src_surface->height0;
vs_consts->src_trans.z = 0;
vs_consts->src_trans.w = 0;
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index c4ba69817f..1934965995 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -681,7 +681,7 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r)
(
r->pipe->screen, r->textures.all[i],
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
- r->textures.all[i]->width[0], r->textures.all[i]->height[0]
+ r->textures.all[i]->width0, r->textures.all[i]->height0
);
r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]);
@@ -835,26 +835,26 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
/* TODO: Accomodate HW that can't do this and also for cases when this isn't precise enough */
template.format = PIPE_FORMAT_R16_SNORM;
template.last_level = 0;
- template.width[0] = r->pot_buffers ?
+ template.width0 = r->pot_buffers ?
util_next_power_of_two(r->picture_width) : r->picture_width;
- template.height[0] = r->pot_buffers ?
+ template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height) : r->picture_height;
- template.depth[0] = 1;
+ template.depth0 = 1;
pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
- template.width[0] = r->pot_buffers ?
+ template.width0 = r->pot_buffers ?
util_next_power_of_two(r->picture_width / 2) :
r->picture_width / 2;
- template.height[0] = r->pot_buffers ?
+ template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height / 2) :
r->picture_height / 2;
}
else if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422)
- template.height[0] = r->pot_buffers ?
+ template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height / 2) :
r->picture_height / 2;
@@ -1283,8 +1283,8 @@ flush(struct vl_mpeg12_mc_renderer *r)
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
);
- vs_consts->denorm.x = r->surface->width[0];
- vs_consts->denorm.y = r->surface->height[0];
+ vs_consts->denorm.x = r->surface->width0;
+ vs_consts->denorm.y = r->surface->height0;
pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf.buffer);
@@ -1633,8 +1633,8 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer
renderer->past = past;
renderer->future = future;
renderer->fence = fence;
- renderer->surface_tex_inv_size.x = 1.0f / surface->width[0];
- renderer->surface_tex_inv_size.y = 1.0f / surface->height[0];
+ renderer->surface_tex_inv_size.x = 1.0f / surface->width0;
+ renderer->surface_tex_inv_size.y = 1.0f / surface->height0;
}
while (num_macroblocks) {
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index c5e9084d12..cbac4175c8 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -231,7 +231,7 @@ i915_update_texture(struct i915_context *i915,
{
const struct pipe_texture *pt = &tex->base;
uint format, pitch;
- const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
+ const uint width = pt->width0, height = pt->height0, depth = pt->depth0;
const uint num_levels = pt->last_level;
unsigned max_lod = num_levels * 4;
unsigned tiled = MS3_USE_FENCE_REGS;
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 286c9ace8e..c7b86dd4c5 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -105,10 +105,6 @@ i915_miptree_set_level_info(struct i915_texture *tex,
assert(level < PIPE_MAX_TEXTURE_LEVELS);
- pt->width[level] = w;
- pt->height[level] = h;
- pt->depth[level] = d;
-
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w);
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h);
@@ -168,16 +164,16 @@ i915_scanout_layout(struct i915_texture *tex)
return FALSE;
i915_miptree_set_level_info(tex, 0, 1,
- tex->base.width[0],
- tex->base.height[0],
+ tex->base.width0,
+ tex->base.height0,
1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
- if (tex->base.width[0] >= 240) {
+ if (tex->base.width0 >= 240) {
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
tex->hw_tiled = INTEL_TILE_X;
- } else if (tex->base.width[0] == 64 && tex->base.height[0] == 64) {
+ } else if (tex->base.width0 == 64 && tex->base.height0 == 64) {
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
} else {
@@ -185,7 +181,7 @@ i915_scanout_layout(struct i915_texture *tex)
}
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- tex->base.width[0], tex->base.height[0], pt->block.size,
+ tex->base.width0, tex->base.height0, pt->block.size,
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
return TRUE;
@@ -203,12 +199,12 @@ i915_display_target_layout(struct i915_texture *tex)
return FALSE;
/* fallback to normal textures for small textures */
- if (tex->base.width[0] < 240)
+ if (tex->base.width0 < 240)
return FALSE;
i915_miptree_set_level_info(tex, 0, 1,
- tex->base.width[0],
- tex->base.height[0],
+ tex->base.width0,
+ tex->base.height0,
1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
@@ -217,7 +213,7 @@ i915_display_target_layout(struct i915_texture *tex)
tex->hw_tiled = INTEL_TILE_X;
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- tex->base.width[0], tex->base.height[0], pt->block.size,
+ tex->base.width0, tex->base.height0, pt->block.size,
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
return TRUE;
@@ -228,8 +224,8 @@ i915_miptree_layout_2d(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
unsigned level;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
unsigned nblocksx = pt->nblocksx[0];
unsigned nblocksy = pt->nblocksy[0];
@@ -254,8 +250,8 @@ i915_miptree_layout_2d(struct i915_texture *tex)
tex->total_nblocksy += nblocksy;
- width = minify(width);
- height = minify(height);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
nblocksx = pf_get_nblocksx(&pt->block, width);
nblocksy = pf_get_nblocksy(&pt->block, height);
}
@@ -267,9 +263,9 @@ i915_miptree_layout_3d(struct i915_texture *tex)
struct pipe_texture *pt = &tex->base;
unsigned level;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
+ unsigned depth = pt->depth0;
unsigned nblocksx = pt->nblocksx[0];
unsigned nblocksy = pt->nblocksy[0];
unsigned stack_nblocksy = 0;
@@ -285,36 +281,34 @@ i915_miptree_layout_3d(struct i915_texture *tex)
stack_nblocksy += MAX2(2, nblocksy);
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
nblocksx = pf_get_nblocksx(&pt->block, width);
nblocksy = pf_get_nblocksy(&pt->block, height);
}
/* Fixup depth image_offsets:
*/
- depth = pt->depth[0];
for (level = 0; level <= pt->last_level; level++) {
unsigned i;
for (i = 0; i < depth; i++)
i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy);
- depth = minify(depth);
+ depth = u_minify(depth, 1);
}
/* Multiply slice size by texture depth for total size. It's
* remarkable how wasteful of memory the i915 texture layouts
* are. They are largely fixed in the i945.
*/
- tex->total_nblocksy = stack_nblocksy * pt->depth[0];
+ tex->total_nblocksy = stack_nblocksy * pt->depth0;
}
static void
i915_miptree_layout_cube(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
- unsigned width = pt->width[0], height = pt->height[0];
+ unsigned width = pt->width0, height = pt->height0;
const unsigned nblocks = pt->nblocksx[0];
unsigned level;
unsigned face;
@@ -383,8 +377,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
unsigned level;
unsigned x = 0;
unsigned y = 0;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
unsigned nblocksx = pt->nblocksx[0];
unsigned nblocksy = pt->nblocksy[0];
@@ -407,8 +401,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
*/
if (pt->last_level > 0) {
unsigned mip1_nblocksx
- = align(pf_get_nblocksx(&pt->block, minify(width)), align_x)
- + pf_get_nblocksx(&pt->block, minify(minify(width)));
+ = align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x)
+ + pf_get_nblocksx(&pt->block, u_minify(width, 2));
if (mip1_nblocksx > nblocksx)
tex->stride = mip1_nblocksx * pt->block.size;
@@ -439,8 +433,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
y += nblocksy;
}
- width = minify(width);
- height = minify(height);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
nblocksx = pf_get_nblocksx(&pt->block, width);
nblocksy = pf_get_nblocksy(&pt->block, height);
}
@@ -450,9 +444,9 @@ static void
i945_miptree_layout_3d(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
+ unsigned depth = pt->depth0;
unsigned nblocksx = pt->nblocksx[0];
unsigned nblocksy = pt->nblocksy[0];
unsigned pack_x_pitch, pack_x_nr;
@@ -495,9 +489,9 @@ i945_miptree_layout_3d(struct i915_texture *tex)
pack_y_pitch >>= 1;
}
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
nblocksx = pf_get_nblocksx(&pt->block, width);
nblocksy = pf_get_nblocksy(&pt->block, height);
}
@@ -511,11 +505,11 @@ i945_miptree_layout_cube(struct i915_texture *tex)
const unsigned nblocks = pt->nblocksx[0];
unsigned face;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
/*
- printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]);
+ printf("%s %i, %i\n", __FUNCTION__, pt->width0, pt->height0);
*/
assert(width == height); /* cubemap images are square */
@@ -651,8 +645,8 @@ i915_texture_create(struct pipe_screen *screen,
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
- tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]);
- tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]);
+ tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0);
+ tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0);
if (is->is_i945) {
if (!i945_miptree_layout(tex))
@@ -667,7 +661,7 @@ i915_texture_create(struct pipe_screen *screen,
/* for scanouts and cursors, cursors arn't scanouts */
- if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width[0] != 64)
+ if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
buf_usage = INTEL_NEW_SCANOUT;
else
buf_usage = INTEL_NEW_TEXTURE;
@@ -710,7 +704,7 @@ i915_texture_blanket(struct pipe_screen * screen,
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
- base->depth[0] != 1) {
+ base->depth0 != 1) {
return NULL;
}
@@ -724,7 +718,7 @@ i915_texture_blanket(struct pipe_screen * screen,
tex->stride = stride[0];
- i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
+ i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
pipe_buffer_reference(&tex->buffer, buffer);
@@ -788,8 +782,8 @@ i915_get_tex_surface(struct pipe_screen *screen,
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->offset = offset;
ps->usage = flags;
}
@@ -919,7 +913,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen,
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
- base->depth[0] != 1) {
+ base->depth0 != 1) {
return NULL;
}
@@ -933,7 +927,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen,
tex->stride = stride;
- i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
+ i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
tex->buffer = buffer;
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index c22ee86b66..e26153b1d9 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -521,7 +521,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp,
const struct pipe_sampler_state *sampler = samp->sampler;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
- float rho = MAX2(dsdx, dsdy) * texture->width[0];
+ float rho = MAX2(dsdx, dsdy) * texture->width0;
float lambda;
lambda = util_fast_log2(rho);
@@ -545,8 +545,8 @@ compute_lambda_2d(const struct sp_sampler_varient *samp,
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
- float maxx = MAX2(dsdx, dsdy) * texture->width[0];
- float maxy = MAX2(dtdx, dtdy) * texture->height[0];
+ float maxx = MAX2(dsdx, dsdy) * texture->width0;
+ float maxy = MAX2(dtdx, dtdy) * texture->height0;
float rho = MAX2(maxx, maxy);
float lambda;
@@ -573,9 +573,9 @@ compute_lambda_3d(const struct sp_sampler_varient *samp,
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
float dpdx = fabsf(p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]);
float dpdy = fabsf(p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]);
- float maxx = MAX2(dsdx, dsdy) * texture->width[0];
- float maxy = MAX2(dtdx, dtdy) * texture->height[0];
- float maxz = MAX2(dpdx, dpdy) * texture->depth[0];
+ float maxx = MAX2(dsdx, dsdy) * texture->width0;
+ float maxy = MAX2(dtdx, dtdy) * texture->height0;
+ float maxz = MAX2(dpdx, dpdy) * texture->depth0;
float rho, lambda;
rho = MAX2(maxx, maxy);
@@ -644,8 +644,8 @@ get_texel_2d(const struct sp_sampler_varient *samp,
const struct pipe_texture *texture = samp->texture;
unsigned level = addr.bits.level;
- if (x < 0 || x >= (int) texture->width[level] ||
- y < 0 || y >= (int) texture->height[level]) {
+ if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
+ y < 0 || y >= (int) u_minify(texture->height0, level)) {
return samp->sampler->border_color;
}
else {
@@ -737,9 +737,9 @@ get_texel_3d(const struct sp_sampler_varient *samp,
const struct pipe_texture *texture = samp->texture;
unsigned level = addr.bits.level;
- if (x < 0 || x >= (int) texture->width[level] ||
- y < 0 || y >= (int) texture->height[level] ||
- z < 0 || z >= (int) texture->depth[level]) {
+ if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
+ y < 0 || y >= (int) u_minify(texture->height0, level) ||
+ z < 0 || z >= (int) u_minify(texture->depth0, level)) {
return samp->sampler->border_color;
}
else {
@@ -925,7 +925,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
+ width = u_minify(texture->width0, level0);
assert(width > 0);
@@ -961,8 +961,8 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
assert(height > 0);
@@ -1008,8 +1008,8 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
assert(height > 0);
@@ -1046,9 +1046,9 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
- depth = texture->depth[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
+ depth = u_minify(texture->depth0, level0);
assert(width > 0);
assert(height > 0);
@@ -1088,7 +1088,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
+ width = u_minify(texture->width0, level0);
assert(width > 0);
@@ -1127,8 +1127,8 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
assert(height > 0);
@@ -1174,8 +1174,8 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
assert(height > 0);
@@ -1221,9 +1221,9 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
union tex_tile_address addr;
level0 = samp->level;
- width = texture->width[level0];
- height = texture->height[level0];
- depth = texture->depth[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
+ depth = u_minify(texture->depth0, level0);
addr.value = 0;
addr.bits.level = level0;
@@ -1778,8 +1778,8 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp,
samp->texture = texture;
samp->cache = tex_cache;
- samp->xpot = util_unsigned_logbase2( texture->width[0] );
- samp->ypot = util_unsigned_logbase2( texture->height[0] );
+ samp->xpot = util_unsigned_logbase2( texture->width0 );
+ samp->ypot = util_unsigned_logbase2( texture->height0 );
samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level);
}
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index 407a22a9f4..e50a76a73b 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -35,6 +35,7 @@
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "util/u_tile.h"
+#include "util/u_math.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_texture.h"
@@ -246,9 +247,9 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
addr.bits.level,
addr.bits.z,
PIPE_TRANSFER_READ, 0, 0,
- tc->texture->width[addr.bits.level],
- tc->texture->height[addr.bits.level]);
-
+ u_minify(tc->texture->width0, addr.bits.level),
+ u_minify(tc->texture->height0, addr.bits.level));
+
tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
tc->tex_face = addr.bits.face;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 7caf2928b4..ac5f61e46f 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -52,16 +52,17 @@ softpipe_texture_layout(struct pipe_screen *screen,
{
struct pipe_texture *pt = &spt->base;
unsigned level;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
+ unsigned depth = pt->depth0;
unsigned buffer_size = 0;
+ pt->width0 = width;
+ pt->height0 = height;
+ pt->depth0 = depth;
+
for (level = 0; level <= pt->last_level; level++) {
- pt->width[level] = width;
- pt->height[level] = height;
- pt->depth[level] = depth;
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
spt->stride[level] = pt->nblocksx[level]*pt->block.size;
@@ -72,9 +73,9 @@ softpipe_texture_layout(struct pipe_screen *screen,
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
spt->stride[level]);
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
spt->buffer = screen->buffer_create(screen, 32,
@@ -96,12 +97,12 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
unsigned tex_usage = spt->base.tex_usage;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
+ spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
+ spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
spt->buffer = screen->surface_buffer_create( screen,
- spt->base.width[0],
- spt->base.height[0],
+ spt->base.width0,
+ spt->base.height0,
spt->base.format,
usage,
tex_usage,
@@ -126,9 +127,9 @@ softpipe_texture_create(struct pipe_screen *screen,
pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
- spt->pot = (util_is_power_of_two(template->width[0]) &&
- util_is_power_of_two(template->height[0]) &&
- util_is_power_of_two(template->depth[0]));
+ spt->pot = (util_is_power_of_two(template->width0) &&
+ util_is_power_of_two(template->height0) &&
+ util_is_power_of_two(template->depth0));
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY)) {
@@ -163,7 +164,7 @@ softpipe_texture_blanket(struct pipe_screen * screen,
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
- base->depth[0] != 1) {
+ base->depth0 != 1) {
return NULL;
}
@@ -174,8 +175,8 @@ softpipe_texture_blanket(struct pipe_screen * screen,
spt->base = *base;
pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
- spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
- spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
+ spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
+ spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
spt->stride[0] = stride[0];
pipe_buffer_reference(&spt->buffer, buffer);
@@ -213,8 +214,8 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->offset = spt->level_offset[level];
ps->usage = usage;
@@ -434,9 +435,9 @@ softpipe_video_surface_create(struct pipe_screen *screen,
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
template.last_level = 0;
/* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */
- template.width[0] = util_next_power_of_two(width);
- template.height[0] = util_next_power_of_two(height);
- template.depth[0] = 1;
+ template.width0 = util_next_power_of_two(width);
+ template.height0 = util_next_power_of_two(height);
+ template.depth0 = 1;
pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index bcf6751af4..6d58209294 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -83,15 +83,15 @@ void trace_dump_template(const struct pipe_texture *templat)
trace_dump_member(format, templat, format);
trace_dump_member_begin("width");
- trace_dump_array(uint, templat->width, 1);
+ trace_dump_uint(templat->width0);
trace_dump_member_end();
trace_dump_member_begin("height");
- trace_dump_array(uint, templat->height, 1);
+ trace_dump_uint(templat->height0);
trace_dump_member_end();
trace_dump_member_begin("depth");
- trace_dump_array(uint, templat->depth, 1);
+ trace_dump_uint(templat->depth0);
trace_dump_member_end();
trace_dump_member_begin("block");
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index 81e0a6f3b0..b59458c0e3 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -200,9 +200,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
t = tr_tex->texture;
rbug_send_texture_info_reply(tr_rbug->con, serial,
t->target, t->format,
- t->width, t->last_level + 1,
- t->height, t->last_level + 1,
- t->depth, t->last_level + 1,
+ &t->width0, 1,
+ &t->height0, 1,
+ &t->depth0, 1,
t->block.width, t->block.height, t->block.size,
t->last_level,
t->nr_samples,
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 287b424e4a..9766e86620 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -343,9 +343,9 @@ struct pipe_texture
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
enum pipe_format format; /**< PIPE_FORMAT_x */
- unsigned width[PIPE_MAX_TEXTURE_LEVELS];
- unsigned height[PIPE_MAX_TEXTURE_LEVELS];
- unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned width0;
+ unsigned height0;
+ unsigned depth0;
struct pipe_format_block block;
unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index e18c0f6e0a..8ca4335e33 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -40,6 +40,7 @@
#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
#include "util/u_rect.h"
+#include "util/u_math.h"
@@ -64,8 +65,8 @@ update_renderbuffer_surface(struct st_context *st,
GLuint level;
/* find matching mipmap level size */
for (level = 0; level <= texture->last_level; level++) {
- if (texture->width[level] == rtt_width &&
- texture->height[level] == rtt_height) {
+ if (u_minify(texture->width0, level) == rtt_width &&
+ u_minify(texture->height0, level) == rtt_height) {
pipe_surface_reference(&strb->surface, NULL);
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index babfcc87b4..4b35f59cc2 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -145,7 +145,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
const GLuint gSize = ctx->PixelMaps.GtoG.Size;
const GLuint bSize = ctx->PixelMaps.BtoB.Size;
const GLuint aSize = ctx->PixelMaps.AtoA.Size;
- const uint texSize = pt->width[0];
+ const uint texSize = pt->width0;
uint *dest;
uint i, j;
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 1d33e81c2c..7ec4599280 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -637,8 +637,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
y1 = y + height * ctx->Pixel.ZoomY;
draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex,
- (GLfloat) width / pt->width[0],
- (GLfloat) height / pt->height[0]);
+ (GLfloat) width / pt->width0,
+ (GLfloat) height / pt->height0);
/* restore state */
cso_restore_rasterizer(cso);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 65ce12ccd4..0469fb9978 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -128,9 +128,9 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
template.target = PIPE_TEXTURE_2D;
template.format = format;
pf_get_block(format, &template.block);
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
template.last_level = 0;
template.nr_samples = rb->NumSamples;
if (pf_is_depth_stencil(format)) {
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 772bb3bb69..103861d6f9 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -243,7 +243,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
GLint row, col, dy, dstStride;
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
- y = strb->texture->height[0] - y - height;
+ y = strb->texture->height0 - y - height;
}
trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 9186db76e1..72892b7c8c 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -451,9 +451,9 @@ compress_with_blit(GLcontext * ctx,
templ.target = PIPE_TEXTURE_2D;
templ.format = st_mesa_format_to_pipe_format(mesa_format);
pf_get_block(templ.format, &templ.block);
- templ.width[0] = width;
- templ.height[0] = height;
- templ.depth[0] = 1;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
templ.last_level = 0;
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
src_tex = screen->texture_create(screen, &templ);
@@ -1813,9 +1813,9 @@ st_finalize_texture(GLcontext *ctx,
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
stObj->pt->format != fmt ||
stObj->pt->last_level < stObj->lastLevel ||
- stObj->pt->width[0] != firstImage->base.Width2 ||
- stObj->pt->height[0] != firstImage->base.Height2 ||
- stObj->pt->depth[0] != firstImage->base.Depth2 ||
+ stObj->pt->width0 != firstImage->base.Width2 ||
+ stObj->pt->height0 != firstImage->base.Height2 ||
+ stObj->pt->depth0 != firstImage->base.Depth2 ||
/* Nominal bytes per pixel: */
stObj->pt->block.size / stObj->pt->block.width != cpp)
{
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 16ca2771b0..f8068fa12b 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -38,6 +38,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_gen_mipmap.h"
+#include "util/u_math.h"
#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_context.h"
@@ -133,14 +134,14 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
- pt->width[srcLevel],
- pt->height[srcLevel]);
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel));
dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
- pt->width[dstLevel],
- pt->height[dstLevel]);
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel));
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
@@ -149,13 +150,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
dstStride = dstTrans->stride / dstTrans->block.size;
_mesa_generate_mipmap_level(target, datatype, comps,
- 0 /*border*/,
- pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel],
- srcData,
- srcStride, /* stride in texels */
- pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel],
- dstData,
- dstStride); /* stride in texels */
+ 0 /*border*/,
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel),
+ u_minify(pt->depth0, srcLevel),
+ srcData,
+ srcStride, /* stride in texels */
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel),
+ u_minify(pt->depth0, dstLevel),
+ dstData,
+ dstStride); /* stride in texels */
screen->transfer_unmap(screen, srcTrans);
screen->transfer_unmap(screen, dstTrans);
@@ -232,9 +237,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
oldTex->target,
oldTex->format,
lastLevel,
- oldTex->width[0],
- oldTex->height[0],
- oldTex->depth[0],
+ oldTex->width0,
+ oldTex->height0,
+ oldTex->depth0,
oldTex->tex_usage);
/* The texture isn't in a "complete" state yet so set the expected
@@ -269,9 +274,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
= _mesa_get_tex_image(ctx, texObj, target, srcLevel);
struct gl_texture_image *dstImage;
struct st_texture_image *stImage;
- uint dstWidth = pt->width[dstLevel];
- uint dstHeight = pt->height[dstLevel];
- uint dstDepth = pt->depth[dstLevel];
+ uint dstWidth = u_minify(pt->width0, dstLevel);
+ uint dstHeight = u_minify(pt->height0, dstLevel);
+ uint dstDepth = u_minify(pt->depth0, dstLevel);
uint border = srcImage->Border;
dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 3945822f66..aa88fdcd78 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -44,6 +44,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_rect.h"
+#include "util/u_math.h"
#define DBG if(0) printf
@@ -100,9 +101,9 @@ st_texture_create(struct st_context *st,
pt.target = target;
pt.format = format;
pt.last_level = last_level;
- pt.width[0] = width0;
- pt.height[0] = height0;
- pt.depth[0] = depth0;
+ pt.width0 = width0;
+ pt.height0 = height0;
+ pt.depth0 = depth0;
pf_get_block(format, &pt.block);
pt.tex_usage = usage;
@@ -135,9 +136,9 @@ st_texture_match_image(const struct pipe_texture *pt,
/* Test if this image's size matches what's expected in the
* established texture.
*/
- if (image->Width != pt->width[level] ||
- image->Height != pt->height[level] ||
- image->Depth != pt->depth[level])
+ if (image->Width != u_minify(pt->width0, level) ||
+ image->Height != u_minify(pt->height0, level) ||
+ image->Depth != u_minify(pt->depth0, level))
return GL_FALSE;
return GL_TRUE;
@@ -265,7 +266,7 @@ st_texture_image_data(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- GLuint depth = dst->depth[level];
+ GLuint depth = u_minify(dst->depth0, level);
GLuint i;
const GLubyte *srcUB = src;
struct pipe_transfer *dst_transfer;
@@ -275,15 +276,16 @@ st_texture_image_data(struct st_context *st,
for (i = 0; i < depth; i++) {
dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
PIPE_TRANSFER_WRITE, 0, 0,
- dst->width[level],
- dst->height[level]);
+ u_minify(dst->width0, level),
+ u_minify(dst->height0, level));
st_surface_data(pipe, dst_transfer,
0, 0, /* dstx, dsty */
srcUB,
src_row_stride,
0, 0, /* source x, y */
- dst->width[level], dst->height[level]); /* width, height */
+ u_minify(dst->width0, level),
+ u_minify(dst->height0, level)); /* width, height */
screen->tex_transfer_destroy(dst_transfer);
@@ -301,9 +303,9 @@ st_texture_image_copy(struct pipe_context *pipe,
GLuint face)
{
struct pipe_screen *screen = pipe->screen;
- GLuint width = dst->width[dstLevel];
- GLuint height = dst->height[dstLevel];
- GLuint depth = dst->depth[dstLevel];
+ GLuint width = u_minify(dst->width0, dstLevel);
+ GLuint height = u_minify(dst->height0, dstLevel);
+ GLuint depth = u_minify(dst->depth0, dstLevel);
struct pipe_surface *src_surface;
struct pipe_surface *dst_surface;
GLuint i;
@@ -313,13 +315,13 @@ st_texture_image_copy(struct pipe_context *pipe,
/* find src texture level of needed size */
for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) {
- if (src->width[srcLevel] == width &&
- src->height[srcLevel] == height) {
+ if (u_minify(src->width0, srcLevel) == width &&
+ u_minify(src->height0, srcLevel) == height) {
break;
}
}
- assert(src->width[srcLevel] == width);
- assert(src->height[srcLevel] == height);
+ assert(u_minify(src->width0, srcLevel) == width);
+ assert(u_minify(src->height0, srcLevel) == height);
#if 0
{
--
cgit v1.2.3
From 8b808d50e2f4be57c3a245afea462540dab1484e Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Thu, 19 Nov 2009 14:38:39 -0800
Subject: st/xorg: Fix infinite loop in copy_packed_data.
---
src/gallium/state_trackers/xorg/xorg_xv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 7cc532b1c8..a1e74fad59 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -256,7 +256,7 @@ copy_packed_data(ScrnInfoPtr pScrn,
switch (id) {
case FOURCC_YV12: {
for (i = 0; i < w; ++i) {
- for (j = 0; i < h; ++j) {
+ for (j = 0; j < h; ++j) {
/*XXX use src? */
y1 = buf[j*w + i];
u = buf[(j/2) * (w/2) + i/2 + y_array_size];
--
cgit v1.2.3
From b09e74901a4f92299fe3f52f57d27fd5ca5bdd2d Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Thu, 19 Nov 2009 17:41:10 -0500
Subject: r600 : Clean up a bit test code mess.
---
src/mesa/drivers/dri/r600/r600_context.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index ca0a670f3c..97b25ea3ff 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -369,23 +369,6 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual,
assert(glVisual);
assert(driContextPriv);
assert(screen);
-
- //richard test
- FILE *pFile = NULL;
- unsigned long ulByteToWrite = 0;
- char szStr[1024];
-
- pFile = fopen("//home//richard//rtp-log//func_call.log", "a+");
- if(NULL != pFile)
- {
- sprintf(szStr, "r600CreateContext \r\n");
- ulByteToWrite = strlen(szStr);
- fwrite(szStr, 1, ulByteToWrite, pFile);
-
- fclose(pFile);
- pFile = NULL;
- }
- //-------------
/* Allocate the R600 context */
r600 = (context_t*) CALLOC(sizeof(*r600));
--
cgit v1.2.3
From f8ea5318200c1ed839fc387b16a57c8d9969974b Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Fri, 20 Nov 2009 11:45:43 +1000
Subject: r100: fix texture_from_pixmap and compiz.
r100 state emission has separate rect and non-rect states,
if we are doing TFP for a TEXTURE_2D we shouldn't use the rect
states as they won't get emitted properly.
Signed-off-by: Dave Airlie
---
src/mesa/drivers/dri/radeon/radeon_texstate.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 4d9eb73d20..3cbe3b4725 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -714,8 +714,6 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
t->tile_bits = 0;
t->image_override = GL_TRUE;
t->override_offset = 0;
- t->pp_txpitch &= (1 << 13) -1;
- pitch_val = rb->pitch;
switch (rb->cpp) {
case 4:
if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
@@ -734,12 +732,17 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_
t->pp_txfilter |= tx_table[MESA_FORMAT_RGB565].filter;
break;
}
- t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT)
- | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT);
- t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2;
- t->pp_txpitch = pitch_val;
- t->pp_txpitch -= 32;
+ t->pp_txpitch &= (1 << 13) -1;
+ pitch_val = rb->pitch;
+
+ t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT)
+ | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT);
+ if (target == GL_TEXTURE_RECTANGLE_NV) {
+ t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2;
+ t->pp_txpitch = pitch_val;
+ t->pp_txpitch -= 32;
+ }
t->validated = GL_TRUE;
_mesa_unlock_texture(radeon->glCtx, texObj);
return;
--
cgit v1.2.3
From 08e5d1ecad79d1c08541ba08a436f5145c5c9376 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Fri, 20 Nov 2009 10:58:05 -0500
Subject: r600 : eliminate Wondows line ending for test code.
---
src/mesa/drivers/dri/r600/r600_context.c | 56 ++++++++++++++++----------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 97b25ea3ff..7de29e5bb8 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -72,8 +72,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vblank.h"
#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-
+#include "xmlpool.h" /* for symbolic values of enum-type options */
+
//#define R600_ENABLE_GLSL_TEST 1
#define need_GL_VERSION_2_0
@@ -156,11 +156,11 @@ static const struct dri_extension mm_extensions[] = {
* The GL 2.0 functions are needed to make display lists work with
* functions added by GL_ATI_separate_stencil.
*/
-static const struct dri_extension gl_20_extension[] = {
-#ifdef R600_ENABLE_GLSL_TEST
- {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
+static const struct dri_extension gl_20_extension[] = {
+#ifdef R600_ENABLE_GLSL_TEST
+ {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
#else
- {"GL_VERSION_2_0", GL_VERSION_2_0_functions },
+ {"GL_VERSION_2_0", GL_VERSION_2_0_functions },
#endif /* R600_ENABLE_GLSL_TEST */
};
@@ -312,27 +312,27 @@ static void r600InitGLExtensions(GLcontext *ctx)
driInitExtensions(ctx, card_extensions, GL_TRUE);
if (r600->radeon.radeonScreen->kernel_mm)
- driInitExtensions(ctx, mm_extensions, GL_FALSE);
-
-#ifdef R600_ENABLE_GLSL_TEST
- driInitExtensions(ctx, gl_20_extension, GL_TRUE);
- //_mesa_enable_2_0_extensions(ctx);
- //1.5
- ctx->Extensions.ARB_occlusion_query = GL_TRUE;
- ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
- ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
- //2.0
- ctx->Extensions.ARB_draw_buffers = GL_TRUE;
- ctx->Extensions.ARB_point_sprite = GL_TRUE;
- ctx->Extensions.ARB_shader_objects = GL_TRUE;
- ctx->Extensions.ARB_vertex_shader = GL_TRUE;
- ctx->Extensions.ARB_fragment_shader = GL_TRUE;
- ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
- ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
- ctx->Extensions.ATI_separate_stencil = GL_TRUE;
-
- /* glsl compiler has problem if this is not GL_TRUE */
- ctx->Shader.EmitCondCodes = GL_TRUE;
+ driInitExtensions(ctx, mm_extensions, GL_FALSE);
+
+#ifdef R600_ENABLE_GLSL_TEST
+ driInitExtensions(ctx, gl_20_extension, GL_TRUE);
+ //_mesa_enable_2_0_extensions(ctx);
+ //1.5
+ ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+ ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
+ ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
+ //2.0
+ ctx->Extensions.ARB_draw_buffers = GL_TRUE;
+ ctx->Extensions.ARB_point_sprite = GL_TRUE;
+ ctx->Extensions.ARB_shader_objects = GL_TRUE;
+ ctx->Extensions.ARB_vertex_shader = GL_TRUE;
+ ctx->Extensions.ARB_fragment_shader = GL_TRUE;
+ ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
+ ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
+ ctx->Extensions.ATI_separate_stencil = GL_TRUE;
+
+ /* glsl compiler has problem if this is not GL_TRUE */
+ ctx->Shader.EmitCondCodes = GL_TRUE;
#endif /* R600_ENABLE_GLSL_TEST */
if (driQueryOptionb
@@ -368,7 +368,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual,
assert(glVisual);
assert(driContextPriv);
- assert(screen);
+ assert(screen);
/* Allocate the R600 context */
r600 = (context_t*) CALLOC(sizeof(*r600));
--
cgit v1.2.3
From a24631bcd7ab2cbc6fff2a536502a07a13a9bc83 Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:08:29 +0000
Subject: Fix memory leak.
---
src/gallium/drivers/softpipe/sp_state_fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 256faa94b8..b41f7e8ab7 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -143,6 +143,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
+ FREE( (void *)state->shader.tokens );
FREE( state );
}
--
cgit v1.2.3
From 8f648cd3e45f2364e8f3b956f1250364ba56af81 Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:09:10 +0000
Subject: Fix vega compilation.
---
src/gallium/state_trackers/vega/arc.c | 6 ++++--
src/gallium/state_trackers/vega/bezier.c | 7 +++++--
src/gallium/state_trackers/vega/vg_context.c | 4 +++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c
index e74c7f0334..8b04d21ea7 100644
--- a/src/gallium/state_trackers/vega/arc.c
+++ b/src/gallium/state_trackers/vega/arc.c
@@ -528,6 +528,7 @@ static INLINE int num_beziers_needed(struct arc *arc)
double threshold = 0.05;
VGboolean found = VG_FALSE;
int n = 1;
+ int i;
double min_eta, max_eta;
min_eta = MIN2(arc->eta1, arc->eta2);
@@ -538,7 +539,7 @@ static INLINE int num_beziers_needed(struct arc *arc)
if (d_eta <= 0.5 * M_PI) {
double eta_b = min_eta;
found = VG_TRUE;
- for (int i = 0; found && (i < n); ++i) {
+ for (i = 0; found && (i < n); ++i) {
double etaA = eta_b;
eta_b += d_eta;
found = (estimate_error(arc, etaA, eta_b) <= threshold);
@@ -554,6 +555,7 @@ static void arc_to_beziers(struct arc *arc,
struct arc_cb cb,
struct matrix *matrix)
{
+ int i;
int n = 1;
double d_eta, eta_b, cos_eta_b,
sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b,
@@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc,
t = tan(0.5 * d_eta);
alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3;
- for (int i = 0; i < n; ++i) {
+ for (i = 0; i < n; ++i) {
struct bezier bezier;
double xA = x_b;
double yA = y_b;
diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c
index 39a7ade016..0d5504004c 100644
--- a/src/gallium/state_trackers/vega/bezier.c
+++ b/src/gallium/state_trackers/vega/bezier.c
@@ -255,7 +255,9 @@ static enum shift_result good_offset(const struct bezier *b1,
const float max_dist_line = threshold*offset*offset;
const float max_dist_normal = threshold*offset;
const float spacing = 0.25;
- for (float i = spacing; i < 0.99; i += spacing) {
+ float i;
+
+ for (i = spacing; i < 0.99; i += spacing) {
float p1[2],p2[2], d, l;
float normal[2];
bezier_point_at(b1, i, p1);
@@ -330,6 +332,7 @@ static enum shift_result shift(const struct bezier *orig,
struct bezier *shifted,
float offset, float threshold)
{
+ int i;
int map[4];
VGboolean p1_p2_equal = (orig->x1 == orig->x2 && orig->y1 == orig->y2);
VGboolean p2_p3_equal = (orig->x2 == orig->x3 && orig->y2 == orig->y3);
@@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig,
points_shifted[0][0] = points[0][0] + offset * prev_normal[0];
points_shifted[0][1] = points[0][1] + offset * prev_normal[1];
- for (int i = 1; i < np - 1; ++i) {
+ for (i = 1; i < np - 1; ++i) {
float normal_sum[2], r;
float next_normal[2];
compute_pt_normal(points[i], points[i + 1], next_normal);
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index e0ff02f3a9..00d23f5c22 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -231,6 +231,8 @@ static void update_clip_state(struct vg_context *ctx)
if (state->scissoring) {
struct pipe_blend_state *blend = &ctx->state.g3d.blend;
struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
+ int i;
+
dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/
dsa->depth.func = PIPE_FUNC_ALWAYS;
dsa->depth.enabled = 1;
@@ -254,7 +256,7 @@ static void update_clip_state(struct vg_context *ctx)
cso_set_blend(ctx->cso_context, blend);
/* enable scissoring */
- for (int i = 0; i < state->scissor_rects_num; ++i) {
+ for (i = 0; i < state->scissor_rects_num; ++i) {
const float x = state->scissor_rects[i * 4 + 0].f;
const float y = state->scissor_rects[i * 4 + 1].f;
const float width = state->scissor_rects[i * 4 + 2].f;
--
cgit v1.2.3
From 904469dcd2e50d950c5e061103907da659053ff2 Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:10:54 +0000
Subject: Fix indentation.
---
src/gallium/drivers/softpipe/sp_context.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 5f60139968..bdbb7fa9b9 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -90,14 +90,15 @@ softpipe_destroy( struct pipe_context *pipe )
if (softpipe->draw)
draw_destroy( softpipe->draw );
- softpipe->quad.shade->destroy( softpipe->quad.shade );
- softpipe->quad.depth_test->destroy( softpipe->quad.depth_test );
- softpipe->quad.blend->destroy( softpipe->quad.blend );
+ softpipe->quad.shade->destroy( softpipe->quad.shade );
+ softpipe->quad.depth_test->destroy( softpipe->quad.depth_test );
+ softpipe->quad.blend->destroy( softpipe->quad.blend );
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
sp_destroy_tile_cache(softpipe->cbuf_cache[i]);
pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL);
}
+
sp_destroy_tile_cache(softpipe->zsbuf_cache);
pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL);
--
cgit v1.2.3
From 0295edf5963a4abf812c68df3c937f0767d6ad7a Mon Sep 17 00:00:00 2001
From: Alan Hourihane
Date: Fri, 20 Nov 2009 18:11:30 +0000
Subject: Fix comment to use /* */ rather than //
---
src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 32 ++++++++++++-------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 3bf64b6331..52b97af163 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -47,22 +47,22 @@ static void
print_fs_traits(int fs_traits)
{
const char *strings[] = {
- "FS_COMPOSITE", // = 1 << 0,
- "FS_MASK", // = 1 << 1,
- "FS_SOLID_FILL", // = 1 << 2,
- "FS_LINGRAD_FILL", // = 1 << 3,
- "FS_RADGRAD_FILL", // = 1 << 4,
- "FS_CA_FULL", // = 1 << 5, /* src.rgba * mask.rgba */
- "FS_CA_SRCALPHA", // = 1 << 6, /* src.aaaa * mask.rgba */
- "FS_YUV", // = 1 << 7,
- "FS_SRC_REPEAT_NONE", // = 1 << 8,
- "FS_MASK_REPEAT_NONE",// = 1 << 9,
- "FS_SRC_SWIZZLE_RGB", // = 1 << 10,
- "FS_MASK_SWIZZLE_RGB",// = 1 << 11,
- "FS_SRC_SET_ALPHA", // = 1 << 12,
- "FS_MASK_SET_ALPHA", // = 1 << 13,
- "FS_SRC_LUMINANCE", // = 1 << 14,
- "FS_MASK_LUMINANCE", // = 1 << 15,
+ "FS_COMPOSITE", /* = 1 << 0 */
+ "FS_MASK", /* = 1 << 1 */
+ "FS_SOLID_FILL", /* = 1 << 2 */
+ "FS_LINGRAD_FILL", /* = 1 << 3 */
+ "FS_RADGRAD_FILL", /* = 1 << 4 */
+ "FS_CA_FULL", /* = 1 << 5 - src.rgba * mask.rgba */
+ "FS_CA_SRCALPHA", /* = 1 << 6 - src.aaaa * mask.rgba */
+ "FS_YUV", /* = 1 << 7 */
+ "FS_SRC_REPEAT_NONE", /* = 1 << 8 */
+ "FS_MASK_REPEAT_NONE",/* = 1 << 9 */
+ "FS_SRC_SWIZZLE_RGB", /* = 1 << 10 */
+ "FS_MASK_SWIZZLE_RGB",/* = 1 << 11 */
+ "FS_SRC_SET_ALPHA", /* = 1 << 12 */
+ "FS_MASK_SET_ALPHA", /* = 1 << 13 */
+ "FS_SRC_LUMINANCE", /* = 1 << 14 */
+ "FS_MASK_LUMINANCE", /* = 1 << 15 */
};
int i, k;
debug_printf("%s: ", __func__);
--
cgit v1.2.3
From beea241374a91b8aab81db175b28e98c2b4835d9 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Thu, 19 Nov 2009 01:35:08 +0100
Subject: r300g: set better values in the R300_VAP_CNTL register
---
src/gallium/drivers/r300/r300_emit.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index eeb97a2d37..2a8d32242b 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -690,12 +690,35 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
END_CS;
}
+/* XXX This should probably go to util ... */
+/* Return the number of bits set in the given number. */
+static unsigned bitcount(unsigned n)
+{
+ unsigned bits;
+ for (bits = 0; n > 0; n = n >> 1) {
+ bits += n & 1;
+ }
+ return bits;
+}
+
+/* XXX ... and this one too. */
+#define MIN3(x, y, z) MIN2(MIN2(x, y), z)
+
void r300_emit_vertex_program_code(struct r300_context* r300,
struct r300_vertex_program_code* code)
{
int i;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
unsigned instruction_count = code->length / 4;
+
+ int vtx_mem_size = r300screen->caps->is_r500 ? 128 : 72;
+ int input_count = MAX2(bitcount(code->InputsRead), 1);
+ int output_count = MAX2(bitcount(code->OutputsWritten), 1);
+ int temp_count = MAX2(code->num_temporaries, 1);
+ int pvs_num_slots = MIN3(vtx_mem_size / input_count,
+ vtx_mem_size / output_count, 10);
+ int pvs_num_controllers = MIN2(6, vtx_mem_size / temp_count);
+
CS_LOCALS(r300);
if (!r300screen->caps->has_tcl) {
@@ -708,8 +731,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300,
/* R300_VAP_PVS_CODE_CNTL_0
* R300_VAP_PVS_CONST_CNTL
* R300_VAP_PVS_CODE_CNTL_1
- * See the r5xx docs for instructions on how to use these.
- * XXX these could be optimized to select better values... */
+ * See the r5xx docs for instructions on how to use these. */
OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0, 3);
OUT_CS(R300_PVS_FIRST_INST(0) |
R300_PVS_XYZW_VALID_INST(instruction_count - 1) |
@@ -722,10 +744,11 @@ void r300_emit_vertex_program_code(struct r300_context* r300,
for (i = 0; i < code->length; i++)
OUT_CS(code->body.d[i]);
- OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(10) |
- R300_PVS_NUM_CNTLRS(5) |
+ OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(pvs_num_slots) |
+ R300_PVS_NUM_CNTLRS(pvs_num_controllers) |
R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) |
- R300_PVS_VF_MAX_VTX_NUM(12));
+ R300_PVS_VF_MAX_VTX_NUM(12) |
+ (r300screen->caps->is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
END_CS;
}
--
cgit v1.2.3
From 37ba97421c5cf351e2e3c7c1e41ffd72fb73f7e9 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 20 Nov 2009 14:08:58 -0800
Subject: util: Add MAX3 and MIN3.
---
src/gallium/auxiliary/util/u_math.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 75b075f160..731a11475e 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -499,6 +499,9 @@ util_next_power_of_two(unsigned x)
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
+#define MIN3( A, B, C ) MIN2( MIN2( A, B ), C )
+#define MAX3( A, B, C ) MAX2( MAX2( A, B ), C )
+
static INLINE int
align(int value, int alignment)
--
cgit v1.2.3
From 6a3eb1f91b4ccd4ee7ac6b91505e0dfa476922d4 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 20 Nov 2009 14:10:45 -0800
Subject: r300g: Use MAX3 and MIN3.
---
src/gallium/drivers/r300/r300_emit.c | 3 ---
src/gallium/drivers/r300/r300_state_derived.c | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 2a8d32242b..4cd5074379 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -701,9 +701,6 @@ static unsigned bitcount(unsigned n)
return bits;
}
-/* XXX ... and this one too. */
-#define MIN3(x, y, z) MIN2(MIN2(x, y), z)
-
void r300_emit_vertex_program_code(struct r300_context* r300,
struct r300_vertex_program_code* code)
{
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 7166694edf..b4d0eeaf8c 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -458,7 +458,7 @@ static void r300_update_rs_block(struct r300_context* r300,
rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) |
R300_HIRES_EN;
- rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0);
+ rs->inst_count = MAX3(col_count - 1, tex_count - 1, 0);
}
/* Update the vertex format. */
--
cgit v1.2.3
From 06ec216d191e160494dd0a922ab0395418a78402 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 20 Nov 2009 14:10:59 -0800
Subject: r300g: Clean up bitcounting function.
I didn't see this in u_math; surely somebody else has this wheel
reinvented elsewhere.
---
src/gallium/drivers/r300/r300_emit.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 4cd5074379..c50c989f01 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -690,14 +690,19 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
END_CS;
}
-/* XXX This should probably go to util ... */
+/* XXX This should go to util ... */
/* Return the number of bits set in the given number. */
static unsigned bitcount(unsigned n)
{
- unsigned bits;
- for (bits = 0; n > 0; n = n >> 1) {
- bits += n & 1;
+ unsigned bits = 0;
+
+ while (n) {
+ if (n & 1) {
+ bits++;
+ }
+ n >>= 1;
}
+
return bits;
}
@@ -714,7 +719,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300,
int temp_count = MAX2(code->num_temporaries, 1);
int pvs_num_slots = MIN3(vtx_mem_size / input_count,
vtx_mem_size / output_count, 10);
- int pvs_num_controllers = MIN2(6, vtx_mem_size / temp_count);
+ int pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 6);
CS_LOCALS(r300);
--
cgit v1.2.3
From 36e2074b63e3e5bc489eb74cad0cd97eafcedb40 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 14:20:15 -0800
Subject: gallium/util: Initialize variables in u_pack_color.h.
---
src/gallium/auxiliary/util/u_pack_color.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index eda883b3b9..9dacc6d83d 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -302,7 +302,10 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
static INLINE void
util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
{
- ubyte r, g, b, a;
+ ubyte r = 0;
+ ubyte g = 0;
+ ubyte b = 0;
+ ubyte a = 0;
if (pf_size_x(format) <= 8) {
/* format uses 8-bit components or less */
--
cgit v1.2.3
From f6541773c4661247879995637207dcc5803bbf00 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 14:31:42 -0800
Subject: i915g: Add missing break statement in i915_debug.c.
---
src/gallium/drivers/i915/i915_debug.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c
index e6640e587b..c6e6d6fd31 100644
--- a/src/gallium/drivers/i915/i915_debug.c
+++ b/src/gallium/drivers/i915/i915_debug.c
@@ -851,6 +851,7 @@ static boolean i915_debug_packet( struct debug_stream *stream )
default:
return debug(stream, "", 0);
}
+ break;
default:
assert(0);
return 0;
--
cgit v1.2.3
From f4041b37e2d305cff0a97eb836250e9f8b1840a8 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Sat, 14 Nov 2009 22:14:42 +0100
Subject: r300g: fix rectangle textures on r3xx
Adapted from Maciej Cencora's patch.
---
src/gallium/drivers/r300/r300_emit.c | 22 ++++++++++++++++++++--
src/gallium/drivers/r300/r300_state.c | 8 ++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index c50c989f01..0bdf58202f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -129,7 +129,9 @@ static const float * get_shader_constant(
struct rc_constant * constant,
struct r300_constant_buffer * externals)
{
- static const float zero[4] = { 0.0, 0.0, 0.0, 0.0 };
+ static float vec[4] = { 0.0, 0.0, 0.0, 0.0 };
+ struct pipe_texture *tex;
+
switch(constant->Type) {
case RC_CONSTANT_EXTERNAL:
return externals->constants[constant->u.External];
@@ -137,10 +139,26 @@ static const float * get_shader_constant(
case RC_CONSTANT_IMMEDIATE:
return constant->u.Immediate;
+ case RC_CONSTANT_STATE:
+ switch (constant->u.State[0])
+ {
+ /* R3xx-specific */
+ case RC_STATE_R300_TEXRECT_FACTOR:
+ tex = &r300->textures[constant->u.State[1]]->tex;
+ vec[0] = 1.0 / tex->width[0];
+ vec[1] = 1.0 / tex->height[0];
+ vec[2] = vec[3] = 1;
+ break;
+
+ default:
+ assert(0);
+ }
+ return vec;
+
default:
debug_printf("r300: Implementation error: Unhandled constant type %i\n",
constant->Type);
- return zero;
+ return vec;
}
}
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d1eced61db..00f10ffd73 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -571,6 +571,7 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
struct pipe_texture** texture)
{
struct r300_context* r300 = r300_context(pipe);
+ boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
int i;
/* XXX magic num */
@@ -585,6 +586,13 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
texture[i]);
r300->dirty_state |= (R300_NEW_TEXTURE << i);
+
+ /* R300-specific - set the texrect factor in a fragment shader */
+ if (!is_r500 && r300->textures[i]->is_npot) {
+ /* XXX It would be nice to re-emit just 1 constant,
+ * XXX not all of them */
+ r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+ }
}
}
--
cgit v1.2.3
From 6a95996abb33a040f957ffedf3824afcc98a9e71 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Fri, 20 Nov 2009 14:55:22 -0800
Subject: r300g: Texrect factor cleanup.
(0, 0, 0, 1) is a much saner default value, and texrect factors only need
to be (1/s, 1/t, 0, 1).
---
src/gallium/drivers/r300/r300_emit.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 0bdf58202f..37e75ba061 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -129,7 +129,7 @@ static const float * get_shader_constant(
struct rc_constant * constant,
struct r300_constant_buffer * externals)
{
- static float vec[4] = { 0.0, 0.0, 0.0, 0.0 };
+ static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
struct pipe_texture *tex;
switch(constant->Type) {
@@ -140,26 +140,30 @@ static const float * get_shader_constant(
return constant->u.Immediate;
case RC_CONSTANT_STATE:
- switch (constant->u.State[0])
- {
- /* R3xx-specific */
+ switch (constant->u.State[0]) {
+ /* Factor for converting rectangle coords to
+ * normalized coords. Should only show up on non-r500. */
case RC_STATE_R300_TEXRECT_FACTOR:
tex = &r300->textures[constant->u.State[1]]->tex;
vec[0] = 1.0 / tex->width[0];
vec[1] = 1.0 / tex->height[0];
- vec[2] = vec[3] = 1;
break;
default:
- assert(0);
+ debug_printf("r300: Implementation error: "
+ "Unknown RC_CONSTANT type %d\n", constant->u.State[0]);
}
- return vec;
+ break;
default:
- debug_printf("r300: Implementation error: Unhandled constant type %i\n",
- constant->Type);
- return vec;
+ debug_printf("r300: Implementation error: "
+ "Unhandled constant type %d\n", constant->Type);
}
+
+ /* This should either be (0, 0, 0, 1), which should be a relatively safe
+ * RGBA or STRQ value, or it could be one of the RC_CONSTANT_STATE
+ * state factors. */
+ return vec;
}
/* Convert a normal single-precision float into the 7.16 format
--
cgit v1.2.3
From 66a4ec14c38d407256545e0cf31c98974d621fe4 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 15:03:16 -0800
Subject: progs/xdemos: Add assert in corender.c.
---
progs/xdemos/corender.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/xdemos/corender.c b/progs/xdemos/corender.c
index ca8ee1eed3..8c70535482 100644
--- a/progs/xdemos/corender.c
+++ b/progs/xdemos/corender.c
@@ -55,6 +55,7 @@ setup_ipc(void)
printf("Waiting for connection from another 'corender'\n");
Sock = AcceptConnection(k);
+ assert(Sock != -1);
printf("Got connection, sending windowID\n");
--
cgit v1.2.3
From a4720a1a3206dd2edecf47a21fce547a79b67610 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 15:06:56 -0800
Subject: progs/xdemos: Remove duplicate code in glxinfo.c.
---
progs/xdemos/glxinfo.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index c1a032872c..b182a3091d 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -426,8 +426,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
GLXFBConfig *configs = NULL;
int nConfigs;
- if (!visinfo)
- configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);
if (!visinfo)
configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);
--
cgit v1.2.3
From ae70cd1f027bdfc7f500d78b6c5333e6b35d3ee8 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Thu, 19 Nov 2009 21:07:20 +0100
Subject: r300g: remove variant states from emit_state_invariant
---
src/gallium/drivers/r300/r300_state_invariant.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index c07e6ae676..46d1cb39b5 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -84,7 +84,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
END_CS;
/* XXX unsorted stuff from surface_fill */
- BEGIN_CS(60 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0));
+ BEGIN_CS(56 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0));
/* Flush PVS. */
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
@@ -135,8 +135,6 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
- OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
- OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
/* XXX */
--
cgit v1.2.3
From 015e7e7724a64d3d9e02e57f6a8eb88a6441f596 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Fri, 20 Nov 2009 05:17:00 +0100
Subject: r300g: emit R300_TEX_ENABLE to indicate there are no textures bound
Previously, this reg wasn't emitted at all if texture_count == 0.
---
src/gallium/drivers/r300/r300_emit.c | 15 +++++++++++++--
src/gallium/drivers/r300/r300_emit.h | 2 ++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 37e75ba061..6d702c0027 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -837,13 +837,22 @@ void r300_emit_viewport_state(struct r300_context* r300,
END_CS;
}
+void r300_emit_texture_count(struct r300_context* r300)
+{
+ CS_LOCALS(r300);
+
+ BEGIN_CS(2);
+ OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
+ END_CS;
+
+}
+
void r300_flush_textures(struct r300_context* r300)
{
CS_LOCALS(r300);
- BEGIN_CS(4);
+ BEGIN_CS(2);
OUT_CS_REG(R300_TX_INVALTAGS, 0);
- OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
END_CS;
}
@@ -997,6 +1006,8 @@ validate:
/* Samplers and textures are tracked separately but emitted together. */
if (r300->dirty_state &
(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
+ r300_emit_texture_count(r300);
+
for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
if (r300->dirty_state &
((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 7c83c5166d..3797d3d332 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -92,6 +92,8 @@ void r300_emit_vertex_shader(struct r300_context* r300,
void r300_emit_viewport_state(struct r300_context* r300,
struct r300_viewport_state* viewport);
+void r300_emit_texture_count(struct r300_context* r300);
+
void r300_flush_textures(struct r300_context* r300);
/* Emit all dirty state. */
--
cgit v1.2.3
From 538a8df65238994f70617a79ec1a0dbcd381001d Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 15:18:19 -0800
Subject: progs/xdemos: Fix memory leak in glxpbdemo.c.
---
progs/xdemos/glxpbdemo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/xdemos/glxpbdemo.c b/progs/xdemos/glxpbdemo.c
index 91fd30dcaa..ecf318ec6a 100644
--- a/progs/xdemos/glxpbdemo.c
+++ b/progs/xdemos/glxpbdemo.c
@@ -106,6 +106,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
if (0 == nConfigs || !fbConfigs) {
printf("Error: glxChooseFBConfig failed\n");
+ XFree(fbConfigs);
XCloseDisplay(dpy);
return 0;
}
--
cgit v1.2.3
From e0857962b911ef317238498305651515d83029ae Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 15:48:29 -0800
Subject: progs/xdemos: Fix memory leak in pbdemo.c.
---
progs/xdemos/pbdemo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/xdemos/pbdemo.c b/progs/xdemos/pbdemo.c
index 2573209336..277df72924 100644
--- a/progs/xdemos/pbdemo.c
+++ b/progs/xdemos/pbdemo.c
@@ -131,6 +131,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
if (nConfigs==0 || !fbConfigs) {
printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
+ XFree(fbConfigs);
continue;
}
--
cgit v1.2.3
From e19195c1855ca0a12697ed3196f3d9a763d1363d Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 15:52:53 -0800
Subject: progs/xdemos: Fix memory leak in pbinfo.c.
---
progs/xdemos/pbinfo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/progs/xdemos/pbinfo.c b/progs/xdemos/pbinfo.c
index b43adf1bb7..edfa9c1f3b 100644
--- a/progs/xdemos/pbinfo.c
+++ b/progs/xdemos/pbinfo.c
@@ -27,6 +27,7 @@ PrintConfigs(Display *dpy, int screen, Bool horizFormat)
fbConfigs = GetAllFBConfigs(dpy, screen, &nConfigs);
if (!nConfigs || !fbConfigs) {
printf("Error: glxGetFBConfigs failed\n");
+ XFree(fbConfigs);
return;
}
--
cgit v1.2.3
From ea98e9820d7117f7a187f355445796b1ef5d9e0c Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 16:03:48 -0800
Subject: draw: Initialize variable in draw_pt.c.
---
src/gallium/auxiliary/draw/draw_pt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index dbb5ac7182..4865a2d854 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -192,7 +192,8 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
prim, start, count);
for (i = 0; i < count; i++) {
- uint ii, j;
+ uint ii = 0;
+ uint j;
if (draw->pt.user.elts) {
/* indexed arrays */
--
cgit v1.2.3
From 052b127842af3372fd768eae8e29b240a696a12a Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Fri, 20 Nov 2009 16:33:25 -0800
Subject: st/egl: Fix memory leak in egl_tracker.c.
---
src/gallium/state_trackers/egl/egl_tracker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index 5811c20f03..745803c7eb 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -88,11 +88,11 @@ drm_get_device_id(struct drm_device *device)
}
ret = fgets(path, sizeof( path ), file);
+ fclose(file);
if (!ret)
return;
sscanf(path, "%x", &device->deviceID);
- fclose(file);
}
static void
--
cgit v1.2.3
From 1c181a7eff96816b5d72ea5daab5818eef0ebc60 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Sun, 15 Nov 2009 05:25:15 +0100
Subject: r300g: Begin separating HW TCL and SW TCL state and setup.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch removes draw_context entirely from the HW TCL path and cleans up
a few other things along the way. Hopefully, nothing got broken.
Thanks to Marek Olšák for testing, review, and pointing out my bugs. :3
---
src/gallium/drivers/r300/r300_context.c | 31 ++---
src/gallium/drivers/r300/r300_render.c | 4 -
src/gallium/drivers/r300/r300_state.c | 8 +-
src/gallium/drivers/r300/r300_state_derived.c | 192 +++++++++++++-------------
src/gallium/drivers/r300/r300_vbo.c | 46 ------
src/gallium/drivers/r300/r300_vs.h | 3 -
6 files changed, 110 insertions(+), 174 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index ae23329b83..26db536248 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -123,15 +123,24 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.clear = r300_clear;
- if (r300screen->caps->has_tcl)
- {
+ if (r300screen->caps->has_tcl) {
r300->context.draw_arrays = r300_draw_arrays;
r300->context.draw_elements = r300_draw_elements;
r300->context.draw_range_elements = r300_draw_range_elements;
- }
- else
- {
- assert(0);
+ } else {
+ r300->context.draw_arrays = r300_swtcl_draw_arrays;
+ r300->context.draw_elements = r300_draw_elements;
+ r300->context.draw_range_elements = r300_swtcl_draw_range_elements;
+
+ /* Create a Draw. This is used for SW TCL. */
+ r300->draw = draw_create();
+ /* Enable our renderer. */
+ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
+ /* Enable Draw's clipping. */
+ draw_set_driver_clipping(r300->draw, FALSE);
+ /* Force Draw to never do viewport transform, since we can do
+ * transform in hardware, always. */
+ draw_set_viewport_state(r300->draw, &r300_viewport_identity);
}
r300->context.is_texture_referenced = r300_is_texture_referenced;
@@ -145,16 +154,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
r300->viewport_state = CALLOC_STRUCT(r300_viewport_state);
- /* Create a Draw. This is used for vert collation and SW TCL. */
- r300->draw = draw_create();
- /* Enable our renderer. */
- draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
- /* Disable Draw's clipping if TCL is present. */
- draw_set_driver_clipping(r300->draw, r300_screen(screen)->caps->has_tcl);
- /* Force Draw to never do viewport transform, since (again) we can do
- * transform in hardware, always. */
- draw_set_viewport_state(r300->draw, &r300_viewport_identity);
-
/* Open up the OQ BO. */
r300->oqbo = screen->buffer_create(screen, 4096,
PIPE_BUFFER_USAGE_VERTEX, 4096);
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 62e1456ed3..4c5fb405c6 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -183,8 +183,6 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
return FALSE;
}
- setup_vertex_attributes(r300);
-
setup_index_buffer(r300, indexBuffer, indexSize);
r300_emit_dirty_state(r300);
@@ -226,8 +224,6 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
return FALSE;
}
- setup_vertex_attributes(r300);
-
r300_emit_dirty_state(r300);
r300_emit_aos(r300, start);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 00f10ffd73..5422a2cc9c 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -714,9 +714,6 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
tgsi_scan_shader(shader->tokens, &vs->info);
- /* Appease Draw. */
- vs->draw = draw_create_vertex_shader(r300->draw, shader);
-
return (void*)vs;
} else {
return draw_create_vertex_shader(r300->draw, shader);
@@ -727,8 +724,6 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
- draw_flush(r300->draw);
-
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
@@ -739,10 +734,10 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
r300_translate_vertex_shader(r300, vs);
}
- draw_bind_vertex_shader(r300->draw, vs->draw);
r300->vs = vs;
r300->dirty_state |= R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS;
} else {
+ draw_flush(r300->draw);
draw_bind_vertex_shader(r300->draw,
(struct draw_vertex_shader*)shader);
}
@@ -756,7 +751,6 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
rc_constants_destroy(&vs->code.constants);
- draw_delete_vertex_shader(r300->draw, vs->draw);
FREE((void*)vs->state.tokens);
FREE(shader);
} else {
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index b4d0eeaf8c..5aa4166d93 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -65,84 +65,43 @@ int r300_shader_key_compare(void* key1, void* key2) {
static void r300_vs_tab_routes(struct r300_context* r300,
struct r300_vertex_info* vformat)
{
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct vertex_info* vinfo = &vformat->vinfo;
int* tab = vformat->vs_tab;
boolean pos = FALSE, psize = FALSE, fog = FALSE;
int i, texs = 0, cols = 0;
- struct tgsi_shader_info* info;
-
- if (r300screen->caps->has_tcl) {
- /* Use vertex shader to determine required routes. */
- info = &r300->vs->info;
- } else {
- /* Use fragment shader to determine required routes. */
- info = &r300->fs->info;
- }
+ struct tgsi_shader_info* info = &r300->fs->info;
- assert(info->num_inputs <= 16);
+ /* XXX One day we should figure out how to handle a different number of
+ * VS outputs and FS inputs, as well as a different number of vertex streams
+ * and VS inputs. It's definitely one of the sources of hardlocks. */
- if (!r300screen->caps->has_tcl || !r300->rs_state->enable_vte)
- {
- for (i = 0; i < info->num_inputs; i++) {
- switch (r300->vs->code.inputs[i]) {
- case TGSI_SEMANTIC_POSITION:
- pos = TRUE;
- tab[i] = 0;
- break;
- case TGSI_SEMANTIC_COLOR:
- tab[i] = 2 + cols;
- cols++;
- break;
- case TGSI_SEMANTIC_PSIZE:
- assert(psize == FALSE);
- psize = TRUE;
- tab[i] = 15;
- break;
- case TGSI_SEMANTIC_FOG:
- assert(fog == FALSE);
- fog = TRUE;
- /* Fall through */
- case TGSI_SEMANTIC_GENERIC:
- tab[i] = 6 + texs;
- texs++;
- break;
- default:
- debug_printf("r300: Unknown vertex input %d\n",
- info->input_semantic_name[i]);
- break;
- }
- }
- }
- else
- {
- /* Just copy vert attribs over as-is. */
- for (i = 0; i < info->num_inputs; i++) {
- tab[i] = i;
- }
-
- for (i = 0; i < info->num_outputs; i++) {
- switch (info->output_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- pos = TRUE;
- break;
- case TGSI_SEMANTIC_COLOR:
- cols++;
- break;
- case TGSI_SEMANTIC_PSIZE:
- psize = TRUE;
- break;
- case TGSI_SEMANTIC_FOG:
- fog = TRUE;
- /* Fall through */
- case TGSI_SEMANTIC_GENERIC:
- texs++;
- break;
- default:
- debug_printf("r300: Unknown vertex output %d\n",
- info->output_semantic_name[i]);
- break;
- }
+ for (i = 0; i < info->num_inputs; i++) {
+ switch (info->input_semantic_name[i]) {
+ case TGSI_SEMANTIC_POSITION:
+ pos = TRUE;
+ tab[i] = 0;
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ tab[i] = 2 + cols;
+ cols++;
+ break;
+ case TGSI_SEMANTIC_PSIZE:
+ assert(psize == FALSE);
+ psize = TRUE;
+ tab[i] = 15;
+ break;
+ case TGSI_SEMANTIC_FOG:
+ assert(fog == FALSE);
+ fog = TRUE;
+ /* Fall through */
+ case TGSI_SEMANTIC_GENERIC:
+ tab[i] = 6 + texs;
+ texs++;
+ break;
+ default:
+ debug_printf("r300: Unknown vertex input %d\n",
+ info->input_semantic_name[i]);
+ break;
}
}
@@ -161,8 +120,7 @@ static void r300_vs_tab_routes(struct r300_context* r300,
/* We need to add vertex position attribute only for SW TCL case,
* for HW TCL case it could be generated by vertex shader */
- if (!pos && !r300screen->caps->has_tcl) {
- debug_printf("r300: Forcing vertex position attribute emit...\n");
+ if (!pos) {
/* Make room for the position attribute
* at the beginning of the tab. */
for (i = 15; i > 0; i--) {
@@ -230,31 +188,66 @@ static void r300_vs_tab_routes(struct r300_context* r300,
static void r300_vertex_psc(struct r300_context* r300,
struct r300_vertex_info* vformat)
{
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
- struct vertex_info* vinfo = &vformat->vinfo;
- int* tab = vformat->vs_tab;
uint16_t type, swizzle;
enum pipe_format format;
- unsigned i, attrib_count;
+ unsigned i;
/* Vertex shaders have no semantics on their inputs,
- * so PSC should just route stuff based on their info,
+ * so PSC should just route stuff based on the vertex elements,
* and not on attrib information. */
- if (r300screen->caps->has_tcl) {
- attrib_count = r300->vs->info.num_inputs;
- DBG(r300, DBG_DRAW, "r300: routing %d attribs in psc for vs\n",
- attrib_count);
- } else {
- attrib_count = vinfo->num_attribs;
- DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count);
- for (i = 0; i < attrib_count; i++) {
- DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d,"
- " tab %d\n", vinfo->attrib[i].src_index,
- vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
- tab[i]);
+ DBG(r300, DBG_DRAW, "r300: vs expects %d attribs, routing %d elements"
+ " in psc\n",
+ r300->vs->info.num_inputs,
+ r300->vertex_element_count);
+
+ for (i = 0; i < r300->vertex_element_count; i++) {
+ format = r300->vertex_element[i].src_format;
+
+ type = r300_translate_vertex_data_type(format) |
+ (i << R300_DST_VEC_LOC_SHIFT);
+ swizzle = r300_translate_vertex_data_swizzle(format);
+
+ if (i % 2) {
+ vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
+ vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
+ } else {
+ vformat->vap_prog_stream_cntl[i >> 1] |= type;
+ vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
}
}
+
+ assert(i <= 15);
+
+ /* Set the last vector in the PSC. */
+ if (i) {
+ i -= 1;
+ }
+ vformat->vap_prog_stream_cntl[i >> 1] |=
+ (R300_LAST_VEC << (i & 1 ? 16 : 0));
+}
+
+/* Update the PSC tables for SW TCL, using Draw. */
+static void r300_swtcl_vertex_psc(struct r300_context* r300,
+ struct r300_vertex_info* vformat)
+{
+ struct vertex_info* vinfo = &vformat->vinfo;
+ int* tab = vformat->vs_tab;
+ uint16_t type, swizzle;
+ enum pipe_format format;
+ unsigned i, attrib_count;
+
+ /* For each Draw attribute, route it to the fragment shader according
+ * to the tab. */
+ attrib_count = vinfo->num_attribs;
+ DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count);
+ for (i = 0; i < attrib_count; i++) {
+ DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d,"
+ " tab %d\n", vinfo->attrib[i].src_index,
+ vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
+ tab[i]);
+ }
+
for (i = 0; i < attrib_count; i++) {
/* Make sure we have a proper destination for our attribute. */
assert(tab[i] != -1);
@@ -272,12 +265,10 @@ static void r300_vertex_psc(struct r300_context* r300,
/* Add the attribute to the PSC table. */
if (i & 1) {
vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
-
vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
} else {
- vformat->vap_prog_stream_cntl[i >> 1] |= type << 0;
-
- vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 0;
+ vformat->vap_prog_stream_cntl[i >> 1] |= type;
+ vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
}
}
@@ -505,7 +496,13 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
}
r300_vs_tab_routes(r300, vformat);
- r300_vertex_psc(r300, vformat);
+
+ if (r300screen->caps->has_tcl) {
+ r300_vertex_psc(r300, vformat);
+ } else {
+ r300_swtcl_vertex_psc(r300, vformat);
+ }
+
r300_update_fs_tab(r300, vformat);
r300_update_rs_block(r300, rs_block);
@@ -553,8 +550,7 @@ static void r300_update_ztop(struct r300_context* r300)
void r300_update_derived_state(struct r300_context* r300)
{
- /* XXX */
- if (TRUE || r300->dirty_state &
+ if (r300->dirty_state &
(R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
r300_update_derived_shader_state(r300);
}
diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c
index a6a159667a..6ebaf715dc 100644
--- a/src/gallium/drivers/r300/r300_vbo.c
+++ b/src/gallium/drivers/r300/r300_vbo.c
@@ -34,52 +34,6 @@
#include "r300_reg.h"
#include "r300_winsys.h"
-static INLINE void setup_vertex_attribute(struct r300_vertex_info *vinfo,
- struct pipe_vertex_element *vert_elem,
- unsigned attr_num)
-{
- uint16_t hw_fmt1, hw_fmt2;
-
- hw_fmt1 = r300_translate_vertex_data_type(vert_elem->src_format) |
- (attr_num << R300_DST_VEC_LOC_SHIFT);
- hw_fmt2 = r300_translate_vertex_data_swizzle(vert_elem->src_format);
-
- if (attr_num % 2 == 0)
- {
- vinfo->vap_prog_stream_cntl[attr_num >> 1] = hw_fmt1;
- vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] = hw_fmt2;
- }
- else
- {
- vinfo->vap_prog_stream_cntl[attr_num >> 1] |= hw_fmt1 << 16;
- vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] |= hw_fmt2 << 16;
- }
-}
-
-static void finish_vertex_attribs_setup(struct r300_vertex_info *vinfo,
- unsigned attribs_num)
-{
- uint32_t last_vec_bit = (attribs_num % 2 == 0) ?
- (R300_LAST_VEC << 16) : R300_LAST_VEC;
-
- assert(attribs_num > 0 && attribs_num <= 16);
- vinfo->vap_prog_stream_cntl[(attribs_num - 1) >> 1] |= last_vec_bit;
-}
-
-void setup_vertex_attributes(struct r300_context *r300)
-{
- struct pipe_vertex_element *vert_elem;
- int i;
-
- for (i = 0; i < r300->vertex_element_count; i++) {
- vert_elem = &r300->vertex_element[i];
- setup_vertex_attribute(r300->vertex_info, vert_elem, i);
- }
-
- finish_vertex_attribs_setup(r300->vertex_info,
- r300->vertex_element_count);
-}
-
static INLINE int get_buffer_offset(struct r300_context *r300,
unsigned int buf_nr,
unsigned int elem_offset)
diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h
index 2a4ce315e3..00b02bf510 100644
--- a/src/gallium/drivers/r300/r300_vs.h
+++ b/src/gallium/drivers/r300/r300_vs.h
@@ -35,9 +35,6 @@ struct r300_vertex_shader {
struct pipe_shader_state state;
struct tgsi_shader_info info;
- /* Fallback shader, because Draw has issues */
- struct draw_vertex_shader* draw;
-
/* Has this shader been translated yet? */
boolean translated;
--
cgit v1.2.3
From b7078a88119e248b0196f7446abe029c22f1ee28 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Sat, 14 Nov 2009 23:27:20 +0100
Subject: r300g: add texture lod clamping
These now work:
piglit/lodclamp
piglit/levelclamp
---
src/gallium/drivers/r300/r300_context.h | 4 ++++
src/gallium/drivers/r300/r300_emit.c | 11 ++++++++++-
src/gallium/drivers/r300/r300_reg.h | 5 +++--
src/gallium/drivers/r300/r300_state.c | 5 +++++
src/gallium/drivers/r300/r300_texture.c | 3 +--
5 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index f954ba7f9a..60ef415caa 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -92,6 +92,10 @@ struct r300_sampler_state {
uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */
uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */
uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */
+
+ /* Min/max LOD must be clamped to [0, last_level], thus
+ * it's dependent on a currently bound texture */
+ unsigned min_lod, max_lod;
};
struct r300_scissor_state {
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 6d702c0027..ad7dff36be 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -583,6 +583,8 @@ void r300_emit_texture(struct r300_context* r300,
unsigned offset)
{
uint32_t filter0 = sampler->filter0;
+ uint32_t format0 = tex->state.format0;
+ unsigned min_level, max_level;
CS_LOCALS(r300);
/* to emulate 1D textures through 2D ones correctly */
@@ -591,13 +593,20 @@ void r300_emit_texture(struct r300_context* r300,
filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
}
+ /* determine min/max levels */
+ /* the MAX_MIP level is the largest (finest) one */
+ max_level = MIN2(sampler->max_lod, tex->tex.last_level);
+ min_level = MIN2(sampler->min_lod, max_level);
+ format0 |= R300_TX_NUM_LEVELS(max_level);
+ filter0 |= R300_TX_MAX_MIP_LEVEL(min_level);
+
BEGIN_CS(16);
OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), filter0 |
(offset << 28));
OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1);
OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color);
- OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), tex->state.format0);
+ OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), format0);
OUT_CS_REG(R300_TX_FORMAT1_0 + (offset * 4), tex->state.format1);
OUT_CS_REG(R300_TX_FORMAT2_0 + (offset * 4), tex->state.format2);
OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (offset * 4), 1);
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 8ca785cb58..66fdada221 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -1463,6 +1463,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TX_MIN_FILTER_MIP_NEAREST (1 << 13)
# define R300_TX_MIN_FILTER_MIP_LINEAR (2 << 13)
# define R300_TX_MIN_FILTER_MIP_MASK (3 << 13)
+# define R300_TX_MAX_MIP_LEVEL_SHIFT 17
+# define R300_TX_MAX_MIP_LEVEL_MASK (0xf << 17)
# define R300_TX_MAX_ANISO_1_TO_1 (0 << 21)
# define R300_TX_MAX_ANISO_2_TO_1 (1 << 21)
# define R300_TX_MAX_ANISO_4_TO_1 (2 << 21)
@@ -1471,6 +1473,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TX_MAX_ANISO_MASK (7 << 21)
# define R300_TX_WRAP_S(x) ((x) << 0)
# define R300_TX_WRAP_T(x) ((x) << 3)
+# define R300_TX_MAX_MIP_LEVEL(x) ((x) << 17)
#define R300_TX_FILTER1_0 0x4440
# define R300_CHROMA_KEY_MODE_DISABLE 0
@@ -1500,8 +1503,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TX_HEIGHTMASK_MASK (2047 << 11)
# define R300_TX_DEPTHMASK_SHIFT 22
# define R300_TX_DEPTHMASK_MASK (0xf << 22)
-# define R300_TX_MAX_MIP_LEVEL_SHIFT 26
-# define R300_TX_MAX_MIP_LEVEL_MASK (0xf << 26)
# define R300_TX_SIZE_PROJECTED (1 << 30)
# define R300_TX_PITCH_EN (1 << 31)
# define R300_TX_WIDTH(x) ((x) << 0)
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 5422a2cc9c..f2867675f0 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -523,6 +523,11 @@ static void*
state->mag_img_filter,
state->min_mip_filter);
+ /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
+ /* We must pass these to the emit function to clamp them properly. */
+ sampler->min_lod = MAX2((unsigned)state->min_lod, 0);
+ sampler->max_lod = MAX2((unsigned)ceilf(state->max_lod), 0);
+
lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index aea25cf71d..d13aa8f036 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -43,8 +43,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500)
state->format2 = (tex->pitch[0] - 1) & 0x1fff;
} else {
/* power of two textures (3D, mipmaps, and no pitch) */
- state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) |
- R300_TX_NUM_LEVELS(pt->last_level & 0xf);
+ state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf);
}
state->format1 = r300_translate_texformat(pt->format);
--
cgit v1.2.3
From 4e1236e60267d036a1a604412bd7efd7a249a588 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Sun, 15 Nov 2009 16:41:25 +0100
Subject: r300g: fix updating a vertex format
We must update PSC when we change the vertex format, e.g. vertex colors
from RGBA to BGRA.
---
src/gallium/drivers/r300/r300_state.c | 2 ++
src/gallium/drivers/r300/r300_state_derived.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index f2867675f0..997d59ff6f 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -687,6 +687,8 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
draw_flush(r300->draw);
draw_set_vertex_buffers(r300->draw, count, buffers);
}
+
+ r300->state |= R300_NEW_VERTEX_FORMAT;
}
static void r300_set_vertex_elements(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 5aa4166d93..82f2be3101 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -512,7 +512,7 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
r300->vertex_info = vformat;
r300->rs_block = rs_block;
- r300->dirty_state |= (R300_NEW_VERTEX_FORMAT | R300_NEW_RS_BLOCK);
+ r300->dirty_state |= R300_NEW_RS_BLOCK;
}
static void r300_update_ztop(struct r300_context* r300)
@@ -551,7 +551,8 @@ static void r300_update_ztop(struct r300_context* r300)
void r300_update_derived_state(struct r300_context* r300)
{
if (r300->dirty_state &
- (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
+ (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER |
+ R300_NEW_VERTEX_FORMAT)) {
r300_update_derived_shader_state(r300);
}
--
cgit v1.2.3
From 624a0cd9c1bcc8d0952bb30e3336237fb99041b2 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Thu, 19 Nov 2009 20:41:19 +0100
Subject: r300g: fix typo in r300_reg.h to prevent the RS unit from doing
random things
And reorder fragment shader inputs so that the colors are before texcoords,
as is allocated by the shader compiler. This commit makes VS->FS attribute
routing work on R500.
---
src/gallium/drivers/r300/r300_reg.h | 2 +-
src/gallium/drivers/r300/r300_state_derived.c | 26 ++++++++++++--------------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 66fdada221..3a419b24b0 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -1293,7 +1293,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R500_RS_INST_TEX_ID(x) ((x) << 0)
#define R500_RS_INST_TEX_CN_WRITE (1 << 4)
#define R500_RS_INST_TEX_ADDR_SHIFT 5
-# define R500_RS_INST_TEX_ADDR(x) ((x) << 0)
+# define R500_RS_INST_TEX_ADDR(x) ((x) << 5)
#define R500_RS_INST_COL_ID_SHIFT 12
# define R500_RS_INST_COL_ID(x) ((x) << 12)
#define R500_RS_INST_COL_CN_NO_WRITE (0 << 16)
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 82f2be3101..8faf78932d 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -381,17 +381,18 @@ static void r300_update_rs_block(struct r300_context* r300,
col_count++;
}
+ for (i = 0; i < col_count; i++) {
+ rs->inst[i] |= R500_RS_INST_COL_ID(i) |
+ R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
+ fp_offset++;
+ }
+
for (i = 0; i < tex_count; i++) {
rs->inst[i] |= R500_RS_INST_TEX_ID(i) |
R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_offset);
fp_offset++;
}
- for (i = 0; i < col_count; i++) {
- rs->inst[i] |= R500_RS_INST_COL_ID(i) |
- R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
- fp_offset++;
- }
} else {
for (i = 0; i < info->num_inputs; i++) {
switch (info->input_semantic_name[i]) {
@@ -416,8 +417,10 @@ static void r300_update_rs_block(struct r300_context* r300,
}
}
+ /* Rasterize at least one color, or bad things happen. */
if (col_count == 0) {
rs->ip[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
+ col_count++;
}
if (tex_count == 0) {
@@ -428,9 +431,10 @@ static void r300_update_rs_block(struct r300_context* r300,
R300_RS_SEL_Q(R300_RS_SEL_K1);
}
- /* Rasterize at least one color, or bad things happen. */
- if ((col_count == 0) && (tex_count == 0)) {
- col_count++;
+ for (i = 0; i < col_count; i++) {
+ rs->inst[i] |= R300_RS_INST_COL_ID(i) |
+ R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
+ fp_offset++;
}
for (i = 0; i < tex_count; i++) {
@@ -438,12 +442,6 @@ static void r300_update_rs_block(struct r300_context* r300,
R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_offset);
fp_offset++;
}
-
- for (i = 0; i < col_count; i++) {
- rs->inst[i] |= R300_RS_INST_COL_ID(i) |
- R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
- fp_offset++;
- }
}
rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) |
--
cgit v1.2.3
From 435c495549d707432f9fb9868e665a42a6923058 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Thu, 19 Nov 2009 22:40:11 +0100
Subject: r300g: silence warnings
---
src/gallium/drivers/r300/r300_screen.h | 2 ++
src/gallium/drivers/r300/r300_state_derived.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 41df31f670..1ce5ff3904 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -27,6 +27,8 @@
#include "r300_chipset.h"
+struct r300_winsys;
+
struct r300_screen {
/* Parent class */
struct pipe_screen screen;
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 8faf78932d..962754f3b1 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -47,8 +47,8 @@ struct r300_shader_derived_value {
unsigned r300_shader_key_hash(void* key) {
struct r300_shader_key* shader_key = (struct r300_shader_key*)key;
- unsigned vs = (unsigned)shader_key->vs;
- unsigned fs = (unsigned)shader_key->fs;
+ unsigned vs = (intptr_t)shader_key->vs;
+ unsigned fs = (intptr_t)shader_key->fs;
return (vs << 16) | (fs & 0xffff);
}
--
cgit v1.2.3
From 8451b29d9628f09b65962385bfbd95cd7f26427f Mon Sep 17 00:00:00 2001
From: Eric Anholt
Date: Sat, 21 Nov 2009 13:33:21 +0100
Subject: i965: Fix several memory leaks on exit.
Bug #25194.
---
src/mesa/drivers/dri/i965/brw_state.h | 1 +
src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +-
src/mesa/drivers/dri/i965/brw_vtbl.c | 12 +++++++++---
src/mesa/drivers/dri/i965/brw_wm.c | 1 -
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index ab6f158080..b129b1f1c3 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -112,6 +112,7 @@ void brw_validate_state(struct brw_context *brw);
void brw_upload_state(struct brw_context *brw);
void brw_init_state(struct brw_context *brw);
void brw_destroy_state(struct brw_context *brw);
+void brw_clear_validated_bos(struct brw_context *brw);
/***********************************************************************
* brw_state_cache.c
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index f4283bda1b..af8dfb4c15 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -143,7 +143,7 @@ static void xor_states( struct brw_state_flags *result,
result->cache = a->cache ^ b->cache;
}
-static void
+void
brw_clear_validated_bos(struct brw_context *brw)
{
int i;
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 114e6bd018..34aaea3736 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -46,7 +46,7 @@
#include "brw_state.h"
#include "brw_fallback.h"
#include "brw_vs.h"
-
+#include "brw_wm.h"
static void
dri_bo_release(dri_bo **bo)
@@ -66,8 +66,14 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
-
- _mesa_free(brw->wm.compile_data);
+ brw_clear_validated_bos(brw);
+ if (brw->wm.compile_data) {
+ _mesa_free(brw->wm.compile_data->instruction);
+ _mesa_free(brw->wm.compile_data->vreg);
+ _mesa_free(brw->wm.compile_data->refs);
+ _mesa_free(brw->wm.compile_data->prog_instructions);
+ _mesa_free(brw->wm.compile_data);
+ }
for (i = 0; i < brw->state.nr_color_regions; i++)
intel_region_release(&brw->state.color_regions[i]);
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 77e3b2c32a..6895f64410 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -157,7 +157,6 @@ static void do_wm_prog( struct brw_context *brw,
sizeof(*c->prog_instructions));
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
- c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
} else {
void *instruction = c->instruction;
void *prog_instructions = c->prog_instructions;
--
cgit v1.2.3
From c367f4d46ee70c1d5879031235824e59e13f6677 Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Sat, 21 Nov 2009 04:22:50 -0800
Subject: mesa: handle different RowStride in _mesa_get_compressed_teximage
drivers storing compressed textures with non-native stride but relying on
_mesa_get_compressed_teximage for GetCompressedTexImage otherwise won't
work correctly (for instance i965 compressed mipmaps).
---
src/mesa/main/texgetimage.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 2f88718933..008407210d 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -521,10 +521,11 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- const GLuint size = _mesa_format_image_size(texImage->TexFormat,
- texImage->Width,
- texImage->Height,
- texImage->Depth);
+ const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
+ texImage->Width);
+ const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
+ texImage->RowStride);
+ GLuint i;
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
/* pack texture image into a PBO */
@@ -540,8 +541,22 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
img = ADD_POINTERS(buf, img);
}
- /* just memcpy, no pixelstore or pixel transfer */
- _mesa_memcpy(img, texImage->Data, size);
+ /* no pixelstore or pixel transfer, but respect stride */
+
+ if (row_stride == row_stride_stored) {
+ const GLuint size = _mesa_format_image_size(texImage->TexFormat,
+ texImage->Width,
+ texImage->Height,
+ texImage->Depth);
+ _mesa_memcpy(img, texImage->Data, size);
+ }
+ else {
+ GLuint bw, bh;
+ _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+ for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
+ memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride);
+ }
+ }
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
--
cgit v1.2.3
From 465fee75ee8991349da742e5a1a5be3cd179bb62 Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Sat, 21 Nov 2009 04:39:30 -0800
Subject: intel: make CopyTex[Sub]Image fallback debug messages more consistent
---
src/mesa/drivers/dri/intel/intel_tex_copy.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 4b5fe7be9f..767d04d2f4 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -221,6 +221,8 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
return;
fail:
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
_mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y,
width, border);
}
@@ -268,6 +270,8 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
return;
fail:
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
_mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
width, height, border);
}
@@ -292,6 +296,8 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
if (!do_copy_texsubimage(intel_context(ctx), target,
intel_texture_image(texImage),
internalFormat, xoffset, 0, x, y, width, 1)) {
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
_mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width);
}
}
@@ -317,8 +323,8 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
internalFormat,
xoffset, yoffset, x, y, width, height)) {
- DBG("%s - fallback to _mesa_meta_CopyTexSubImage2D\n", __FUNCTION__);
-
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
_mesa_meta_CopyTexSubImage2D(ctx, target, level,
xoffset, yoffset, x, y, width, height);
}
--
cgit v1.2.3
From df8787763602f8e27e2b81385d397fb4a86c107b Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 21 Nov 2009 15:56:02 +0100
Subject: radeon: fix glCompressedTexSubImage
---
src/mesa/drivers/dri/radeon/radeon_texture.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 6f11f1fa4a..1ee9e2792a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -582,12 +582,12 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
/* TODO */
assert(0);
} else {
- dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
+ dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
}
if (dims == 3) {
unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
- dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
+ dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, texImage->Height, texImage->Depth);
if (!dstImageOffsets) {
return;
}
@@ -598,8 +598,11 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
radeon_teximage_map(image, GL_TRUE);
if (compressed) {
- uint32_t srcRowStride, bytesPerRow, rows;
+ uint32_t srcRowStride, bytesPerRow, rows, block_width, block_height;
GLubyte *img_start;
+
+ _mesa_get_format_block_size(texImage->TexFormat, &block_width, &block_height);
+
if (!image->mt) {
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
@@ -607,17 +610,16 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
texImage->Width, texImage->Data);
}
else {
- uint32_t blocks_x, block_width, block_height;
- _mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height);
- blocks_x = dstRowStride / block_width;
- img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
+ uint32_t offset;
+ offset = dstRowStride / _mesa_get_format_bytes(texImage->TexFormat) * yoffset / block_height + xoffset / block_width;
+ offset *= _mesa_get_format_bytes(texImage->TexFormat);
+ img_start = texImage->Data + offset;
}
srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
bytesPerRow = srcRowStride;
- rows = (height + 3) / 4;
-
- copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
+ rows = (height + block_height - 1) / block_height;
+ copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
}
else {
if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
--
cgit v1.2.3
From d20b79172df18b27c8b4e428119814ffef2c8494 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 21 Nov 2009 15:56:23 +0100
Subject: radeon: fix compressed mipmapped textures
Tested on r300 only, other cards may require adjusting texture_compressed_row_align.
---
.../drivers/dri/radeon/radeon_common_context.c | 2 +-
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 49 ++++++++++++----------
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 2a38c4599c..71f70d724b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -262,7 +262,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
else
radeon->texture_row_align = 32;
radeon->texture_rect_row_align = 64;
- radeon->texture_compressed_row_align = 64;
+ radeon->texture_compressed_row_align = 32;
}
radeon_init_dma(radeon);
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 0497fa7db5..a11b5b9979 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -37,26 +37,35 @@
#include "main/texobj.h"
#include "radeon_texture.h"
-static GLuint radeon_compressed_texture_size(GLcontext *ctx,
- GLsizei width, GLsizei height, GLsizei depth,
- gl_format mesaFormat)
+static unsigned get_aligned_compressed_row_stride(
+ gl_format format,
+ unsigned width,
+ unsigned minStride)
{
- GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth);
-
- if (mesaFormat == MESA_FORMAT_RGB_DXT1 ||
- mesaFormat == MESA_FORMAT_RGBA_DXT1) {
- if (width + 3 < 8) /* width one block */
- size = size * 4;
- else if (width + 3 < 16)
- size = size * 2;
- } else {
- /* DXT3/5, 16 bytes per block */
- // WARN_ONCE("DXT 3/5 suffers from multitexturing problems!\n");
- if (width + 3 < 8)
- size = size * 2;
+ const unsigned blockSize = _mesa_get_format_bytes(format);
+ unsigned blockWidth, blockHeight, numXBlocks;
+
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+ numXBlocks = (width + blockWidth - 1) / blockWidth;
+
+ while (numXBlocks * blockSize < minStride)
+ {
+ ++numXBlocks;
}
- return size;
+ return numXBlocks * blockSize;
+}
+
+static unsigned get_compressed_image_size(
+ gl_format format,
+ unsigned rowStride,
+ unsigned height)
+{
+ unsigned blockWidth, blockHeight;
+
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+
+ return rowStride * ((height + blockHeight - 1) / blockHeight);
}
/**
@@ -74,10 +83,8 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
/* Find image size in bytes */
if (_mesa_is_format_compressed(mt->mesaFormat)) {
- /* TODO: Is this correct? Need test cases for compressed textures! */
- row_align = rmesa->texture_compressed_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat);
+ lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
+ lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height);
} else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
row_align = rmesa->texture_rect_row_align - 1;
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
--
cgit v1.2.3
From 1d1f81af93058541992bd0795b86500509edea56 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 21 Nov 2009 15:56:02 +0100
Subject: radeon: fix glCompressedTexSubImage
---
src/mesa/drivers/dri/radeon/radeon_texture.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 6f11f1fa4a..1ee9e2792a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -582,12 +582,12 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
/* TODO */
assert(0);
} else {
- dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
+ dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
}
if (dims == 3) {
unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
- dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
+ dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, texImage->Height, texImage->Depth);
if (!dstImageOffsets) {
return;
}
@@ -598,8 +598,11 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
radeon_teximage_map(image, GL_TRUE);
if (compressed) {
- uint32_t srcRowStride, bytesPerRow, rows;
+ uint32_t srcRowStride, bytesPerRow, rows, block_width, block_height;
GLubyte *img_start;
+
+ _mesa_get_format_block_size(texImage->TexFormat, &block_width, &block_height);
+
if (!image->mt) {
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
@@ -607,17 +610,16 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
texImage->Width, texImage->Data);
}
else {
- uint32_t blocks_x, block_width, block_height;
- _mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height);
- blocks_x = dstRowStride / block_width;
- img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
+ uint32_t offset;
+ offset = dstRowStride / _mesa_get_format_bytes(texImage->TexFormat) * yoffset / block_height + xoffset / block_width;
+ offset *= _mesa_get_format_bytes(texImage->TexFormat);
+ img_start = texImage->Data + offset;
}
srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
bytesPerRow = srcRowStride;
- rows = (height + 3) / 4;
-
- copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
+ rows = (height + block_height - 1) / block_height;
+ copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
}
else {
if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
--
cgit v1.2.3
From 563fe6e8f6c021ea45120cb1f201a1950b8d6057 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sat, 21 Nov 2009 15:56:23 +0100
Subject: radeon: fix compressed mipmapped textures
Tested on r300 only, other cards may require adjusting texture_compressed_row_align.
---
.../drivers/dri/radeon/radeon_common_context.c | 2 +-
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 49 ++++++++++++----------
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 2a38c4599c..71f70d724b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -262,7 +262,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
else
radeon->texture_row_align = 32;
radeon->texture_rect_row_align = 64;
- radeon->texture_compressed_row_align = 64;
+ radeon->texture_compressed_row_align = 32;
}
radeon_init_dma(radeon);
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 0497fa7db5..a11b5b9979 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -37,26 +37,35 @@
#include "main/texobj.h"
#include "radeon_texture.h"
-static GLuint radeon_compressed_texture_size(GLcontext *ctx,
- GLsizei width, GLsizei height, GLsizei depth,
- gl_format mesaFormat)
+static unsigned get_aligned_compressed_row_stride(
+ gl_format format,
+ unsigned width,
+ unsigned minStride)
{
- GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth);
-
- if (mesaFormat == MESA_FORMAT_RGB_DXT1 ||
- mesaFormat == MESA_FORMAT_RGBA_DXT1) {
- if (width + 3 < 8) /* width one block */
- size = size * 4;
- else if (width + 3 < 16)
- size = size * 2;
- } else {
- /* DXT3/5, 16 bytes per block */
- // WARN_ONCE("DXT 3/5 suffers from multitexturing problems!\n");
- if (width + 3 < 8)
- size = size * 2;
+ const unsigned blockSize = _mesa_get_format_bytes(format);
+ unsigned blockWidth, blockHeight, numXBlocks;
+
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+ numXBlocks = (width + blockWidth - 1) / blockWidth;
+
+ while (numXBlocks * blockSize < minStride)
+ {
+ ++numXBlocks;
}
- return size;
+ return numXBlocks * blockSize;
+}
+
+static unsigned get_compressed_image_size(
+ gl_format format,
+ unsigned rowStride,
+ unsigned height)
+{
+ unsigned blockWidth, blockHeight;
+
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+
+ return rowStride * ((height + blockHeight - 1) / blockHeight);
}
/**
@@ -74,10 +83,8 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
/* Find image size in bytes */
if (_mesa_is_format_compressed(mt->mesaFormat)) {
- /* TODO: Is this correct? Need test cases for compressed textures! */
- row_align = rmesa->texture_compressed_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat);
+ lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
+ lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height);
} else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
row_align = rmesa->texture_rect_row_align - 1;
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
--
cgit v1.2.3
From 3a2cd66af8774af15eabef655ded9b48e67242d5 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Sat, 21 Nov 2009 05:51:13 +0100
Subject: r300g: clean up vs/fs tabs
Instead of vs_tab, we use vs_output_tab and it's local now. fs_tab hasn't
been used anywhere, so I removed it and r300_update_fs_tab too.
---
src/gallium/drivers/r300/r300_context.h | 5 --
src/gallium/drivers/r300/r300_state_derived.c | 114 ++++++--------------------
2 files changed, 25 insertions(+), 94 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 60ef415caa..39c0914cff 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -223,11 +223,6 @@ struct r300_texture {
struct r300_vertex_info {
/* Parent class */
struct vertex_info vinfo;
- /* Map of vertex attributes into PVS memory for HW TCL,
- * or GA memory for SW TCL. */
- int vs_tab[16];
- /* Map of rasterizer attributes from GB through RS to US. */
- int fs_tab[16];
/* R300_VAP_PROG_STREAK_CNTL_[0-7] */
uint32_t vap_prog_stream_cntl[8];
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 962754f3b1..45aeefb483 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -61,12 +61,12 @@ int r300_shader_key_compare(void* key1, void* key2) {
(shader_key1->fs == shader_key2->fs);
}
-/* Set up the vs_tab and routes. */
-static void r300_vs_tab_routes(struct r300_context* r300,
- struct r300_vertex_info* vformat)
+/* Set up the vs_output_tab and routes. */
+static void r300_vs_output_tab_routes(struct r300_context* r300,
+ struct r300_vertex_info* vformat,
+ int* vs_output_tab)
{
struct vertex_info* vinfo = &vformat->vinfo;
- int* tab = vformat->vs_tab;
boolean pos = FALSE, psize = FALSE, fog = FALSE;
int i, texs = 0, cols = 0;
struct tgsi_shader_info* info = &r300->fs->info;
@@ -79,23 +79,23 @@ static void r300_vs_tab_routes(struct r300_context* r300,
switch (info->input_semantic_name[i]) {
case TGSI_SEMANTIC_POSITION:
pos = TRUE;
- tab[i] = 0;
+ vs_output_tab[i] = 0;
break;
case TGSI_SEMANTIC_COLOR:
- tab[i] = 2 + cols;
+ vs_output_tab[i] = 2 + cols;
cols++;
break;
case TGSI_SEMANTIC_PSIZE:
assert(psize == FALSE);
psize = TRUE;
- tab[i] = 15;
+ vs_output_tab[i] = 15;
break;
case TGSI_SEMANTIC_FOG:
assert(fog == FALSE);
fog = TRUE;
/* Fall through */
case TGSI_SEMANTIC_GENERIC:
- tab[i] = 6 + texs;
+ vs_output_tab[i] = 6 + texs;
texs++;
break;
default:
@@ -122,11 +122,11 @@ static void r300_vs_tab_routes(struct r300_context* r300,
* for HW TCL case it could be generated by vertex shader */
if (!pos) {
/* Make room for the position attribute
- * at the beginning of the tab. */
+ * at the beginning of the vs_output_tab. */
for (i = 15; i > 0; i--) {
- tab[i] = tab[i-1];
+ vs_output_tab[i] = vs_output_tab[i-1];
}
- tab[0] = 0;
+ vs_output_tab[0] = 0;
}
/* Position. */
@@ -229,34 +229,34 @@ static void r300_vertex_psc(struct r300_context* r300,
/* Update the PSC tables for SW TCL, using Draw. */
static void r300_swtcl_vertex_psc(struct r300_context* r300,
- struct r300_vertex_info* vformat)
+ struct r300_vertex_info* vformat,
+ int* vs_output_tab)
{
struct vertex_info* vinfo = &vformat->vinfo;
- int* tab = vformat->vs_tab;
uint16_t type, swizzle;
enum pipe_format format;
unsigned i, attrib_count;
/* For each Draw attribute, route it to the fragment shader according
- * to the tab. */
+ * to the vs_output_tab. */
attrib_count = vinfo->num_attribs;
DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count);
for (i = 0; i < attrib_count; i++) {
DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d,"
- " tab %d\n", vinfo->attrib[i].src_index,
+ " vs_output_tab %d\n", vinfo->attrib[i].src_index,
vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
- tab[i]);
+ vs_output_tab[i]);
}
for (i = 0; i < attrib_count; i++) {
/* Make sure we have a proper destination for our attribute. */
- assert(tab[i] != -1);
+ assert(vs_output_tab[i] != -1);
format = draw_translate_vinfo_format(vinfo->attrib[i].emit);
/* Obtain the type of data in this attribute. */
type = r300_translate_vertex_data_type(format) |
- tab[i] << R300_DST_VEC_LOC_SHIFT;
+ vs_output_tab[i] << R300_DST_VEC_LOC_SHIFT;
/* Obtain the swizzle for this attribute. Note that the default
* swizzle in the hardware is not XYZW! */
@@ -280,68 +280,6 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300,
(R300_LAST_VEC << (i & 1 ? 16 : 0));
}
-/* Set up the mappings from GB to US, for RS block. */
-static void r300_update_fs_tab(struct r300_context* r300,
- struct r300_vertex_info* vformat)
-{
- struct tgsi_shader_info* info = &r300->fs->info;
- int i, cols = 0, texs = 0, cols_emitted = 0;
- int* tab = vformat->fs_tab;
-
- for (i = 0; i < 16; i++) {
- tab[i] = -1;
- }
-
- assert(info->num_inputs <= 16);
- for (i = 0; i < info->num_inputs; i++) {
- switch (info->input_semantic_name[i]) {
- case TGSI_SEMANTIC_COLOR:
- tab[i] = INTERP_LINEAR;
- cols++;
- break;
- case TGSI_SEMANTIC_POSITION:
- case TGSI_SEMANTIC_PSIZE:
- debug_printf("r300: Implementation error: Can't use "
- "pos attribs in fragshader yet!\n");
- /* Pass through for now */
- case TGSI_SEMANTIC_FOG:
- case TGSI_SEMANTIC_GENERIC:
- tab[i] = INTERP_PERSPECTIVE;
- break;
- default:
- debug_printf("r300: Unknown vertex input %d\n",
- info->input_semantic_name[i]);
- break;
- }
- }
-
- /* Now that we know where everything is... */
- DBG(r300, DBG_DRAW, "r300: fp input count: %d\n", info->num_inputs);
- for (i = 0; i < info->num_inputs; i++) {
- switch (tab[i]) {
- case INTERP_LINEAR:
- DBG(r300, DBG_DRAW, "r300: attrib: "
- "stack offset %d, color, tab %d\n",
- i, cols_emitted);
- tab[i] = cols_emitted;
- cols_emitted++;
- break;
- case INTERP_PERSPECTIVE:
- DBG(r300, DBG_DRAW, "r300: attrib: "
- "stack offset %d, texcoord, tab %d\n",
- i, cols + texs);
- tab[i] = cols + texs;
- texs++;
- break;
- case -1:
- debug_printf("r300: Implementation error: Bad fp interp!\n");
- default:
- break;
- }
- }
-
-}
-
/* Set up the RS block. This is the part of the chipset that actually does
* the rasterization of vertices into fragments. This is also the part of the
* chipset that locks up if any part of it is even slightly wrong. */
@@ -456,8 +394,13 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_vertex_info* vformat;
struct r300_rs_block* rs_block;
+ int vs_output_tab[16];
int i;
+ for (i = 0; i < 16; i++) {
+ vs_output_tab[i] = -1;
+ }
+
/*
struct r300_shader_key* key;
struct r300_shader_derived_value* value;
@@ -488,21 +431,14 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
vformat = CALLOC_STRUCT(r300_vertex_info);
rs_block = CALLOC_STRUCT(r300_rs_block);
- for (i = 0; i < 16; i++) {
- vformat->vs_tab[i] = -1;
- vformat->fs_tab[i] = -1;
- }
-
- r300_vs_tab_routes(r300, vformat);
+ r300_vs_output_tab_routes(r300, vformat, vs_output_tab);
if (r300screen->caps->has_tcl) {
r300_vertex_psc(r300, vformat);
} else {
- r300_swtcl_vertex_psc(r300, vformat);
+ r300_swtcl_vertex_psc(r300, vformat, vs_output_tab);
}
- r300_update_fs_tab(r300, vformat);
-
r300_update_rs_block(r300, rs_block);
FREE(r300->vertex_info);
--
cgit v1.2.3
From 44c0aaf990f46c6dcb46d58dda0c182f5d40cb42 Mon Sep 17 00:00:00 2001
From: Marek Olšák
Date: Fri, 20 Nov 2009 04:52:49 +0100
Subject: r300g: do not reallocate r300_vertex_info and r300_rs_block all the
time
---
src/gallium/drivers/r300/r300_context.c | 2 ++
src/gallium/drivers/r300/r300_state_derived.c | 42 ++++++++++++---------------
2 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 26db536248..769733b6dd 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -69,6 +69,7 @@ static void r300_destroy_context(struct pipe_context* context)
FREE(r300->blend_color_state);
FREE(r300->rs_block);
FREE(r300->scissor_state);
+ FREE(r300->vertex_info);
FREE(r300->viewport_state);
FREE(r300);
}
@@ -152,6 +153,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
r300->rs_block = CALLOC_STRUCT(r300_rs_block);
r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
+ r300->vertex_info = CALLOC_STRUCT(r300_vertex_info);
r300->viewport_state = CALLOC_STRUCT(r300_viewport_state);
/* Open up the OQ BO. */
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 45aeefb483..6fb780cb29 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -63,10 +63,9 @@ int r300_shader_key_compare(void* key1, void* key2) {
/* Set up the vs_output_tab and routes. */
static void r300_vs_output_tab_routes(struct r300_context* r300,
- struct r300_vertex_info* vformat,
int* vs_output_tab)
{
- struct vertex_info* vinfo = &vformat->vinfo;
+ struct vertex_info* vinfo = &r300->vertex_info->vinfo;
boolean pos = FALSE, psize = FALSE, fog = FALSE;
int i, texs = 0, cols = 0;
struct tgsi_shader_info* info = &r300->fs->info;
@@ -185,9 +184,9 @@ static void r300_vs_output_tab_routes(struct r300_context* r300,
}
/* Update the PSC tables. */
-static void r300_vertex_psc(struct r300_context* r300,
- struct r300_vertex_info* vformat)
+static void r300_vertex_psc(struct r300_context* r300)
{
+ struct r300_vertex_info *vformat = r300->vertex_info;
uint16_t type, swizzle;
enum pipe_format format;
unsigned i;
@@ -229,9 +228,9 @@ static void r300_vertex_psc(struct r300_context* r300,
/* Update the PSC tables for SW TCL, using Draw. */
static void r300_swtcl_vertex_psc(struct r300_context* r300,
- struct r300_vertex_info* vformat,
int* vs_output_tab)
{
+ struct r300_vertex_info *vformat = r300->vertex_info;
struct vertex_info* vinfo = &vformat->vinfo;
uint16_t type, swizzle;
enum pipe_format format;
@@ -283,9 +282,9 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300,
/* Set up the RS block. This is the part of the chipset that actually does
* the rasterization of vertices into fragments. This is also the part of the
* chipset that locks up if any part of it is even slightly wrong. */
-static void r300_update_rs_block(struct r300_context* r300,
- struct r300_rs_block* rs)
+static void r300_update_rs_block(struct r300_context* r300)
{
+ struct r300_rs_block* rs = r300->rs_block;
struct tgsi_shader_info* info = &r300->fs->info;
int col_count = 0, fp_offset = 0, i, tex_count = 0;
int rs_tex_comp = 0;
@@ -392,14 +391,9 @@ static void r300_update_rs_block(struct r300_context* r300,
static void r300_update_derived_shader_state(struct r300_context* r300)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
- struct r300_vertex_info* vformat;
- struct r300_rs_block* rs_block;
int vs_output_tab[16];
int i;
- for (i = 0; i < 16; i++) {
- vs_output_tab[i] = -1;
- }
/*
struct r300_shader_key* key;
@@ -427,25 +421,25 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
(void*)key, (void*)value);
} */
- /* XXX This will be refactored ASAP. */
- vformat = CALLOC_STRUCT(r300_vertex_info);
- rs_block = CALLOC_STRUCT(r300_rs_block);
+ /* Reset structures */
+ memset(r300->rs_block, 0, sizeof(struct r300_rs_block));
+ memset(r300->vertex_info, 0, sizeof(struct r300_vertex_info));
- r300_vs_output_tab_routes(r300, vformat, vs_output_tab);
+ for (i = 0; i < 16; i++) {
+ vs_output_tab[i] = -1;
+ }
+
+ /* Update states */
+ r300_vs_output_tab_routes(r300, vs_output_tab);
if (r300screen->caps->has_tcl) {
- r300_vertex_psc(r300, vformat);
+ r300_vertex_psc(r300);
} else {
- r300_swtcl_vertex_psc(r300, vformat, vs_output_tab);
+ r300_swtcl_vertex_psc(r300, vs_output_tab);
}
- r300_update_rs_block(r300, rs_block);
-
- FREE(r300->vertex_info);
- FREE(r300->rs_block);
+ r300_update_rs_block(r300);
- r300->vertex_info = vformat;
- r300->rs_block = rs_block;
r300->dirty_state |= R300_NEW_RS_BLOCK;
}
--
cgit v1.2.3
From 2b07b640619ac68344276ba0557ea46b2cbc3f26 Mon Sep 17 00:00:00 2001
From: Corbin Simpson
Date: Sat, 21 Nov 2009 19:13:26 -0800
Subject: r300g: Build fix.
Oops.
---
src/gallium/drivers/r300/r300_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 997d59ff6f..a88d66db24 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -688,7 +688,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
draw_set_vertex_buffers(r300->draw, count, buffers);
}
- r300->state |= R300_NEW_VERTEX_FORMAT;
+ r300->dirty_state |= R300_NEW_VERTEX_FORMAT;
}
static void r300_set_vertex_elements(struct pipe_context* pipe,
--
cgit v1.2.3
From 46feb7db71b05ec67a7c78f6bc608adec0734dec Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 00:55:52 -0500
Subject: st/xorg: Reorder cases in switch statement.
Silences missing break statement warning.
---
src/gallium/state_trackers/xorg/xorg_composite.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index eed7a7d63a..4dbb490ca5 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -151,9 +151,11 @@ render_filter_to_gallium(int xrender_filter, int *out_filter)
case PictFilterBest:
*out_filter = PIPE_TEX_FILTER_LINEAR;
break;
+ case PictFilterConvolution:
+ *out_filter = PIPE_TEX_FILTER_NEAREST;
+ return FALSE;
default:
debug_printf("Unknown xrender filter\n");
- case PictFilterConvolution:
*out_filter = PIPE_TEX_FILTER_NEAREST;
return FALSE;
}
--
cgit v1.2.3
From 88aab56a26dd33a2d3177a41420f00473d7270af Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 01:10:38 -0500
Subject: st/xorg: Prevent potential null pointer deference in xorg_xv.c.
---
src/gallium/state_trackers/xorg/xorg_xv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index a1e74fad59..e7f4900528 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -446,7 +446,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
int x, y, w, h;
struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap);
- if (!dst->tex) {
+ if (dst && !dst->tex) {
xorg_exa_set_shared_usage(pPixmap);
pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL);
}
--
cgit v1.2.3
From b62a74d3b94024bc08b31394f827761d354d2516 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 01:20:07 -0500
Subject: svga: Fix memory leak in vmw_screen_ioctl.c
---
src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
index b3515732a2..51e455f925 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
@@ -331,6 +331,7 @@ vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size)
return region;
out_err1:
+ FREE(region);
return NULL;
}
--
cgit v1.2.3
From 57d389aab5ea4462475756c0e262f3cb543f889d Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 01:26:32 -0500
Subject: svga: Prevent potential null pointer deference in vmw_surface.c.
---
src/gallium/winsys/drm/vmware/core/vmw_surface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c
index 9ec4bf9272..c19e556df9 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c
@@ -39,7 +39,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
struct pipe_reference *dst_ref;
struct vmw_svga_winsys_surface *dst = *pdst;
- if(*pdst == src || pdst == NULL)
+ if(pdst == NULL || *pdst == src)
return;
src_ref = src ? &src->refcnt : NULL;
--
cgit v1.2.3
From d3b4c99c703f70a9d0e715a97e52672f7f8fc980 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 01:45:53 -0500
Subject: glu: Fix memory leak in __gl_meshMakeEdge.
---
src/glu/sgi/libtess/mesh.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/glu/sgi/libtess/mesh.c b/src/glu/sgi/libtess/mesh.c
index ae861f8642..95f87cdc94 100644
--- a/src/glu/sgi/libtess/mesh.c
+++ b/src/glu/sgi/libtess/mesh.c
@@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh )
}
e = MakeEdge( &mesh->eHead );
- if (e == NULL) return NULL;
+ if (e == NULL) {
+ memFree(newVertex1);
+ memFree(newVertex2);
+ memFree(newFace);
+ return NULL;
+ }
MakeVertex( newVertex1, e, &mesh->vHead );
MakeVertex( newVertex2, e->Sym, &mesh->vHead );
--
cgit v1.2.3
From a9c540f5dedbf593f8038fdbc95eecb60826ab26 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Sun, 22 Nov 2009 01:57:35 -0500
Subject: glu/sgi: Fix memory leak in gluScaleImage.
---
src/glu/sgi/libutil/mipmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c
index af647af73c..4139c304a1 100644
--- a/src/glu/sgi/libutil/mipmap.c
+++ b/src/glu/sgi/libutil/mipmap.c
@@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin,
afterImage =
malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) {
+ free(beforeImage);
+ free(afterImage);
return GLU_OUT_OF_MEMORY;
}
--
cgit v1.2.3
From dfe440c856826450195e3fc5100a3b97d7c0b173 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sun, 22 Nov 2009 14:13:18 +0100
Subject: r300: fix SIN/COS/SCS instructions for R300 fp
---
src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index 0326d25233..ced66af1eb 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -560,23 +560,23 @@ static void sincos_constants(struct radeon_compiler* c, unsigned int *constants)
* MAD dest, tmp.y, weight, tmp.x
*/
static void sin_approx(
- struct radeon_compiler* c, struct rc_instruction * before,
+ struct radeon_compiler* c, struct rc_instruction * inst,
struct rc_dst_register dst, struct rc_src_register src, const unsigned int* constants)
{
unsigned int tempreg = rc_find_free_temporary(c);
- emit2(c, before, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
+ emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X),
srcreg(RC_FILE_CONSTANT, constants[0]));
- emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
+ emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y),
absolute(swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)),
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X));
- emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
+ emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X),
absolute(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)),
negate(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)));
- emit3(c, before, RC_OPCODE_MAD, 0, dst,
+ emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dst,
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y),
swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W),
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X));
--
cgit v1.2.3
From e0fda040135490fdd54e57000c7995e27dc70657 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Sun, 22 Nov 2009 15:08:46 +0100
Subject: r300: fix VP source conflict resolution on 64-bit machines
On 32bit machines we were lucky because the sizeof(reg) == sizeof(rc_src_register).
On 64bit machines pointers are 8 bytes long, so we were overwriting other data.
---
src/mesa/drivers/dri/r300/compiler/radeon_program.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
index 33db3ea0ff..03592884eb 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
@@ -191,7 +191,7 @@ struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register
static inline void reset_srcreg(struct rc_src_register* reg)
{
- memset(reg, 0, sizeof(reg));
+ memset(reg, 0, sizeof(struct rc_src_register));
reg->Swizzle = RC_SWIZZLE_XYZW;
}
--
cgit v1.2.3
From a02938a8421270389178d4969a5411a1691d929a Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Fri, 20 Nov 2009 16:36:55 -0500
Subject: r600 : use cf for all pop now, left optimization for future.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 56 ++++++++++++++++++++++--------
src/mesa/drivers/dri/r600/r700_assembler.h | 2 +-
2 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index e3bc46802f..27083a895c 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -39,7 +39,7 @@
#include "r700_assembler.h"
#define USE_CF_FOR_CONTINUE_BREAK 1
-//#define USE_CF_FOR_POP_AFTER 1
+#define USE_CF_FOR_POP_AFTER 1
BITS addrmode_PVSDST(PVSDST * pPVSDST)
{
@@ -3022,7 +3022,6 @@ GLboolean next_ins2(r700_AssemblerBase *pAsm)
pAsm->is_tex = GL_FALSE;
pAsm->need_tex_barrier = GL_FALSE;
- //richard nov.16 glsl
pAsm->D2.bits = 0;
return GL_TRUE;
@@ -5377,32 +5376,35 @@ GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm)
return GL_FALSE;
}
- unsigned int unFCSP = 0;
+ GLuint unFCSP;
+ GLuint unIF = 0;
if((pAsm->unCFflags & HAS_CURRENT_LOOPRET) > 0)
{
for(unFCSP=(pAsm->FCSP-1); unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--)
{
if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
{
+ breakLoopOnFlag(pAsm, unFCSP);
break;
}
+ else if(FC_IF == pAsm->fc_stack[unFCSP].type)
+ {
+ unIF++;
+ }
}
if(unFCSP <= pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry)
{
- unFCSP = 0;
-
- returnOnFlag(pAsm);
+#ifdef USE_CF_FOR_POP_AFTER
+ returnOnFlag(pAsm, unIF);
+#else
+ returnOnFlag(pAsm, 0);
+#endif /* USE_CF_FOR_POP_AFTER */
pAsm->unCFflags &= ~HAS_CURRENT_LOOPRET;
}
}
pAsm->branch_depth--;
pAsm->FCSP--;
-
- if(unFCSP > 0)
- {
- breakLoopOnFlag(pAsm, unFCSP);
- }
return GL_TRUE;
}
@@ -5459,25 +5461,38 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex)
/* start sub */
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+ pAsm->FCSP++;
+ pAsm->fc_stack[pAsm->FCSP].type = FC_REP;
+
return GL_TRUE;
}
GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm)
{
+ if(pAsm->fc_stack[pAsm->FCSP].type != FC_REP)
+ {
+ radeon_error("BGNSUB/ENDSUB in shader code are not paired. \n");
+ return GL_FALSE;
+ }
+
pAsm->CALLSP--;
SetActiveCFlist(pAsm->pR700Shader,
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
+ pAsm->FCSP--;
+
return GL_TRUE;
}
GLboolean assemble_RET(r700_AssemblerBase *pAsm)
{
+ GLuint unIF = 0;
+
if(pAsm->CALLSP > 0)
{ /* in sub */
- unsigned int unFCSP;
+ GLuint unFCSP;
for(unFCSP=pAsm->FCSP; unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--)
{
if(FC_LOOP == pAsm->fc_stack[unFCSP].type)
@@ -5488,9 +5503,20 @@ GLboolean assemble_RET(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
+ else if(FC_IF == pAsm->fc_stack[unFCSP].type)
+ {
+ unIF++;
+ }
}
}
-
+
+#ifdef USE_CF_FOR_POP_AFTER
+ if(unIF > 0)
+ {
+ pops(pAsm, unIF);
+ }
+#endif /* USE_CF_FOR_POP_AFTER */
+
add_return_inst(pAsm);
return GL_TRUE;
@@ -5664,12 +5690,12 @@ GLboolean testFlag(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
-GLboolean returnOnFlag(r700_AssemblerBase *pAsm)
+GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF)
{
testFlag(pAsm);
jumpToOffest(pAsm, 1, 4);
setRetInLoopFlag(pAsm, SQ_SEL_0);
- pops(pAsm, 1);
+ pops(pAsm, unIF + 1);
add_return_inst(pAsm);
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 516923f67c..ca562d29f1 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -553,7 +553,7 @@ GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset);
GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue);
GLboolean testFlag(r700_AssemblerBase *pAsm);
GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP);
-GLboolean returnOnFlag(r700_AssemblerBase *pAsm);
+GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF);
GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode);
GLboolean assemble_ABS(r700_AssemblerBase *pAsm);
--
cgit v1.2.3
From 1f8c23d9db84178f5b129dcd5f6dbae4a31f796a Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Sun, 22 Nov 2009 12:58:28 -0500
Subject: r600 : add stack depth calculation, enable CF pop.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 341 ++++++++++++++++++-----------
src/mesa/drivers/dri/r600/r700_assembler.h | 41 ++--
src/mesa/drivers/dri/r600/r700_shader.c | 2 +-
3 files changed, 223 insertions(+), 161 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 27083a895c..16cdb741ae 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -388,99 +388,94 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
pAsm->pR700Shader = pShader;
pAsm->currentShaderType = spt;
- pAsm->cf_last_export_ptr = NULL;
+ pAsm->cf_last_export_ptr = NULL;
- pAsm->cf_current_export_clause_ptr = NULL;
- pAsm->cf_current_alu_clause_ptr = NULL;
- pAsm->cf_current_tex_clause_ptr = NULL;
- pAsm->cf_current_vtx_clause_ptr = NULL;
- pAsm->cf_current_cf_clause_ptr = NULL;
+ pAsm->cf_current_export_clause_ptr = NULL;
+ pAsm->cf_current_alu_clause_ptr = NULL;
+ pAsm->cf_current_tex_clause_ptr = NULL;
+ pAsm->cf_current_vtx_clause_ptr = NULL;
+ pAsm->cf_current_cf_clause_ptr = NULL;
- // No clause has been created yet
- pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE;
+ // No clause has been created yet
+ pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE;
- pAsm->number_of_colorandz_exports = 0;
- pAsm->number_of_exports = 0;
- pAsm->number_of_export_opcodes = 0;
+ pAsm->number_of_colorandz_exports = 0;
+ pAsm->number_of_exports = 0;
+ pAsm->number_of_export_opcodes = 0;
pAsm->alu_x_opcode = 0;
pAsm->D2.bits = 0;
- pAsm->D.bits = 0;
- pAsm->S[0].bits = 0;
- pAsm->S[1].bits = 0;
- pAsm->S[2].bits = 0;
+ pAsm->D.bits = 0;
+ pAsm->S[0].bits = 0;
+ pAsm->S[1].bits = 0;
+ pAsm->S[2].bits = 0;
- pAsm->uLastPosUpdate = 0;
+ pAsm->uLastPosUpdate = 0;
- *(BITS *) &pAsm->fp_stOutFmt0 = 0;
-
- pAsm->uIIns = 0;
- pAsm->uOIns = 0;
- pAsm->number_used_registers = 0;
- pAsm->uUsedConsts = 256;
-
+ *(BITS *) &pAsm->fp_stOutFmt0 = 0;
- // Fragment programs
- pAsm->uBoolConsts = 0;
- pAsm->uIntConsts = 0;
- pAsm->uInsts = 0;
- pAsm->uConsts = 0;
+ pAsm->uIIns = 0;
+ pAsm->uOIns = 0;
+ pAsm->number_used_registers = 0;
+ pAsm->uUsedConsts = 256;
- pAsm->FCSP = 0;
- pAsm->fc_stack[0].type = FC_NONE;
- pAsm->branch_depth = 0;
- pAsm->max_branch_depth = 0;
+ // Fragment programs
+ pAsm->uBoolConsts = 0;
+ pAsm->uIntConsts = 0;
+ pAsm->uInsts = 0;
+ pAsm->uConsts = 0;
- pAsm->aArgSubst[0] =
- pAsm->aArgSubst[1] =
- pAsm->aArgSubst[2] =
- pAsm->aArgSubst[3] = (-1);
+ pAsm->FCSP = 0;
+ pAsm->fc_stack[0].type = FC_NONE;
- pAsm->uOutputs = 0;
-
- for (i=0; icolor_export_register_number[i] = (-1);
- }
+ pAsm->aArgSubst[0] =
+ pAsm->aArgSubst[1] =
+ pAsm->aArgSubst[2] =
+ pAsm->aArgSubst[3] = (-1);
+ pAsm->uOutputs = 0;
- pAsm->depth_export_register_number = (-1);
- pAsm->stencil_export_register_number = (-1);
- pAsm->coverage_to_mask_export_register_number = (-1);
- pAsm->mask_export_register_number = (-1);
+ for (i=0; icolor_export_register_number[i] = (-1);
+ }
- pAsm->starting_export_register_number = 0;
- pAsm->starting_vfetch_register_number = 0;
- pAsm->starting_temp_register_number = 0;
- pAsm->uFirstHelpReg = 0;
+ pAsm->depth_export_register_number = (-1);
+ pAsm->stencil_export_register_number = (-1);
+ pAsm->coverage_to_mask_export_register_number = (-1);
+ pAsm->mask_export_register_number = (-1);
- pAsm->input_position_is_used = GL_FALSE;
- pAsm->input_normal_is_used = GL_FALSE;
+ pAsm->starting_export_register_number = 0;
+ pAsm->starting_vfetch_register_number = 0;
+ pAsm->starting_temp_register_number = 0;
+ pAsm->uFirstHelpReg = 0;
+ pAsm->input_position_is_used = GL_FALSE;
+ pAsm->input_normal_is_used = GL_FALSE;
- for (i=0; iinput_color_is_used[ i ] = GL_FALSE;
- }
+ for (i=0; iinput_color_is_used[ i ] = GL_FALSE;
+ }
- for (i=0; iinput_texture_unit_is_used[ i ] = GL_FALSE;
- }
+ for (i=0; iinput_texture_unit_is_used[ i ] = GL_FALSE;
+ }
- for (i=0; ivfetch_instruction_ptr_array[ i ] = NULL;
- }
+ for (i=0; ivfetch_instruction_ptr_array[ i ] = NULL;
+ }
- pAsm->number_of_inputs = 0;
+ pAsm->number_of_inputs = 0;
- pAsm->is_tex = GL_FALSE;
- pAsm->need_tex_barrier = GL_FALSE;
+ pAsm->is_tex = GL_FALSE;
+ pAsm->need_tex_barrier = GL_FALSE;
pAsm->subs = NULL;
pAsm->unSubArraySize = 0;
@@ -494,13 +489,14 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
pAsm->CALLSTACK[0].plstCFInstructions_local
= &(pAsm->pR700Shader->lstCFInstructions);
- pAsm->CALLSTACK[0].stackUsage.bits = 0;
+ pAsm->CALLSTACK[0].max = 0;
+ pAsm->CALLSTACK[0].current = 0;
SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local);
pAsm->unCFflags = 0;
- return 0;
+ return 0;
}
GLboolean IsTex(gl_inst_opcode Opcode)
@@ -4980,32 +4976,74 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
-inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason)
+inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason)
+{
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ pAsm->CALLSTACK[pAsm->CALLSP].current--;
+ break;
+ case FC_PUSH_WQM:
+ pAsm->CALLSTACK[pAsm->CALLSP].current -= 4;
+ break;
+ case FC_LOOP:
+ pAsm->CALLSTACK[pAsm->CALLSP].current -= 4;
+ break;
+ case FC_REP:
+ /* TODO : for 16 vp asic, should -= 2; */
+ pAsm->CALLSTACK[pAsm->CALLSP].current -= 1;
+ break;
+ };
+}
+
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly)
{
+ if(GL_TRUE == bCheckMaxOnly)
+ {
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ if((pAsm->CALLSTACK[pAsm->CALLSP].current + 1)
+ > pAsm->CALLSTACK[pAsm->CALLSP].max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].max =
+ pAsm->CALLSTACK[pAsm->CALLSP].current + 1;
+ }
+ break;
+ case FC_PUSH_WQM:
+ if((pAsm->CALLSTACK[pAsm->CALLSP].current + 4)
+ > pAsm->CALLSTACK[pAsm->CALLSP].max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].max =
+ pAsm->CALLSTACK[pAsm->CALLSP].current + 4;
+ }
+ break;
+ }
+ return;
+ }
+
switch (uReason)
{
case FC_PUSH_VPM:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++;
+ pAsm->CALLSTACK[pAsm->CALLSP].current++;
break;
case FC_PUSH_WQM:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++;
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4;
+ pAsm->CALLSTACK[pAsm->CALLSP].current += 4;
break;
case FC_LOOP:
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4;
+ pAsm->CALLSTACK[pAsm->CALLSP].current += 4;
break;
case FC_REP:
/* TODO : for 16 vp asic, should += 2; */
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1;
+ pAsm->CALLSTACK[pAsm->CALLSP].current += 1;
break;
};
- if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs
- > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max)
+ if(pAsm->CALLSTACK[pAsm->CALLSP].current
+ > pAsm->CALLSTACK[pAsm->CALLSP].max)
{
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max =
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs;
+ pAsm->CALLSTACK[pAsm->CALLSP].max =
+ pAsm->CALLSTACK[pAsm->CALLSP].current;
}
}
@@ -5082,7 +5120,6 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
pAsm->FCSP++;
pAsm->fc_stack[pAsm->FCSP].type = FC_IF;
- pAsm->fc_stack[pAsm->FCSP].bpush = 0;
pAsm->fc_stack[pAsm->FCSP].mid = NULL;
pAsm->fc_stack[pAsm->FCSP].midLen= 0;
pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
@@ -5094,12 +5131,8 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
}
#endif /* USE_CF_FOR_POP_AFTER */
- pAsm->branch_depth++;
+ checkStackDepth(pAsm, FC_PUSH_VPM, GL_FALSE);
- if(pAsm->branch_depth > pAsm->max_branch_depth)
- {
- pAsm->max_branch_depth = pAsm->branch_depth;
- }
return GL_TRUE;
}
@@ -5164,9 +5197,11 @@ GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
radeon_error("if/endif in shader code are not paired. \n");
return GL_FALSE;
}
- pAsm->branch_depth--;
+
pAsm->FCSP--;
+ decreaseCurrent(pAsm, FC_PUSH_VPM);
+
return GL_TRUE;
}
@@ -5191,18 +5226,13 @@ GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm)
pAsm->FCSP++;
pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP;
- pAsm->fc_stack[pAsm->FCSP].bpush = 1;
pAsm->fc_stack[pAsm->FCSP].mid = NULL;
pAsm->fc_stack[pAsm->FCSP].unNumMid = 0;
pAsm->fc_stack[pAsm->FCSP].midLen = 0;
pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
- pAsm->branch_depth++;
+ checkStackDepth(pAsm, FC_LOOP, GL_FALSE);
- if(pAsm->branch_depth > pAsm->max_branch_depth)
- {
- pAsm->max_branch_depth = pAsm->branch_depth;
- }
return GL_TRUE;
}
@@ -5266,6 +5296,8 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm)
pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+ checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE);
+
#endif //USE_CF_FOR_CONTINUE_BREAK
return GL_TRUE;
}
@@ -5330,6 +5362,8 @@ GLboolean assemble_CONT(r700_AssemblerBase *pAsm)
pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1;
pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1;
+ checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE);
+
#endif /* USE_CF_FOR_CONTINUE_BREAK */
return GL_TRUE;
@@ -5403,8 +5437,9 @@ GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm)
}
}
- pAsm->branch_depth--;
pAsm->FCSP--;
+
+ decreaseCurrent(pAsm, FC_LOOP);
return GL_TRUE;
}
@@ -5445,14 +5480,16 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex)
pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex;
pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL;
- pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL;
- pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0;
+ pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL;
+ pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0;
pAsm->CALLSP++;
+ pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex = pAsm->unSubArrayPointer;
pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP;
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local
= &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local);
- pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.bits = 0;
+ pAsm->CALLSTACK[pAsm->CALLSP].max = 0;
+ pAsm->CALLSTACK[pAsm->CALLSP].current = 0;
SetActiveCFlist(pAsm->pR700Shader,
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
@@ -5462,7 +5499,9 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex)
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
pAsm->FCSP++;
- pAsm->fc_stack[pAsm->FCSP].type = FC_REP;
+ pAsm->fc_stack[pAsm->FCSP].type = FC_REP;
+
+ checkStackDepth(pAsm, FC_REP, GL_FALSE);
return GL_TRUE;
}
@@ -5475,6 +5514,12 @@ GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm)
return GL_FALSE;
}
+ /* copy max to sub structure */
+ pAsm->subs[pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex].unStackDepthMax
+ = pAsm->CALLSTACK[pAsm->CALLSP].max;
+
+ decreaseCurrent(pAsm, FC_REP);
+
pAsm->CALLSP--;
SetActiveCFlist(pAsm->pR700Shader,
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
@@ -5565,18 +5610,42 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm,
pAsm->unCallerArrayPointer++;
int j;
+ GLuint max;
+ GLuint unSubID;
+ GLboolean bRet;
for(j=0; junSubArrayPointer; j++)
{
if(nILindex == pAsm->subs[j].subIL_Offset)
{ /* compiled before */
+
+ max = pAsm->subs[j].unStackDepthMax
+ + pAsm->CALLSTACK[pAsm->CALLSP].current;
+ if(max > pAsm->CALLSTACK[pAsm->CALLSP].max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].max = max;
+ }
+
pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = j;
return GL_TRUE;
}
}
pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer;
+ unSubID = pAsm->unSubArrayPointer;
+
+ bRet = AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm);
+
+ if(GL_TRUE == bRet)
+ {
+ max = pAsm->subs[unSubID].unStackDepthMax
+ + pAsm->CALLSTACK[pAsm->CALLSP].current;
+ if(max > pAsm->CALLSTACK[pAsm->CALLSP].max)
+ {
+ pAsm->CALLSTACK[pAsm->CALLSP].max = max;
+ }
+ }
- return AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm);
+ return bRet;
}
GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue)
@@ -5685,7 +5754,7 @@ GLboolean testFlag(r700_AssemblerBase *pAsm)
}
#endif
- checkStackDepth(pAsm, FC_PUSH_VPM);
+ checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE);
return GL_TRUE;
}
@@ -5704,7 +5773,7 @@ GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF)
GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP)
{
testFlag(pAsm);
-
+
//break
if(GL_FALSE == add_cf_instruction(pAsm) )
{
@@ -5831,7 +5900,8 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
if ( GL_FALSE == assemble_FLR(pR700AsmCode) )
return GL_FALSE;
break;
- //case OP_FLR_INT:
+ //case OP_FLR_INT: ;
+
// if ( GL_FALSE == assemble_FLR_INT() )
// return GL_FALSE;
// break;
@@ -6351,11 +6421,47 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
R700ShaderInstruction * pInst;
R700ControlFlowGenericClause * pCFInst;
+ /* remove flags init if they are not used */
+ if((pAsm->unCFflags & HAS_LOOPRET) == 0)
+ {
+ R700ControlFlowALUClause * pCF_ALU;
+ pInst = plstCFmain->pHead;
+ while(pInst)
+ {
+ if(SIT_CF_ALU == pInst->m_ShaderInstType)
+ {
+ pCF_ALU = (R700ControlFlowALUClause *)pInst;
+ if(1 == pCF_ALU->m_Word1.f.count)
+ {
+ pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP;
+ }
+ else
+ {
+ R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction;
+
+ pALU->m_pLinkedALUClause = NULL;
+ pALU = (R700ALUInstruction *)(pALU->pNextInst);
+ pALU->m_pLinkedALUClause = pCF_ALU;
+ pCF_ALU->m_pLinkedALUInstruction = pALU;
+
+ pCF_ALU->m_Word1.f.count--;
+ }
+ break;
+ }
+ pInst = pInst->pNextInst;
+ };
+ }
+
if(0 == pAsm->unSubArrayPointer)
{
return GL_TRUE;
}
+ if(pAsm->CALLSTACK[0].max > 0)
+ {
+ pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2;
+ }
+
plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local;
unCFoffset = plstCFmain->uNumOfNode;
@@ -6411,37 +6517,6 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
= pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset;
}
- /* remove flags init if they are not used */
- if((pAsm->unCFflags & HAS_LOOPRET) == 0)
- {
- R700ControlFlowALUClause * pCF_ALU;
- pInst = plstCFmain->pHead;
- while(pInst)
- {
- if(SIT_CF_ALU == pInst->m_ShaderInstType)
- {
- pCF_ALU = (R700ControlFlowALUClause *)pInst;
- if(1 == pCF_ALU->m_Word1.f.count)
- {
- pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP;
- }
- else
- {
- R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction;
-
- pALU->m_pLinkedALUClause = NULL;
- pALU = (R700ALUInstruction *)(pALU->pNextInst);
- pALU->m_pLinkedALUClause = pCF_ALU;
- pCF_ALU->m_pLinkedALUInstruction = pALU;
-
- pCF_ALU->m_Word1.f.count--;
- }
- break;
- }
- pInst = pInst->pNextInst;
- };
- }
-
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index ca562d29f1..7efb346fa7 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -273,27 +273,27 @@ enum
typedef struct FC_LEVEL
{
- R700ControlFlowGenericClause * first;
+ R700ControlFlowGenericClause * first;
R700ControlFlowGenericClause ** mid;
unsigned int unNumMid;
- unsigned int midLen;
- unsigned int type;
- unsigned int cond;
- unsigned int inv;
- unsigned int bpush; ///< 1 if first instruction does branch stack push
- int id; ///< id of bool or int variable
+ unsigned int midLen;
+ unsigned int type;
+ unsigned int cond;
+ unsigned int inv;
+ int id; ///< id of bool or int variable
} FC_LEVEL;
typedef struct VTX_FETCH_METHOD
{
- GLboolean bEnableMini;
- GLuint mega_fetch_remainder;
+ GLboolean bEnableMini;
+ GLuint mega_fetch_remainder;
} VTX_FETCH_METHOD;
typedef struct SUB_OFFSET
{
GLint subIL_Offset;
GLuint unCFoffset;
+ GLuint unStackDepthMax;
TypedShaderList lstCFInstructions_local;
} SUB_OFFSET;
@@ -306,23 +306,12 @@ typedef struct CALLER_POINTER
#define SQ_MAX_CALL_DEPTH 0x00000020
-typedef struct STACK_USAGE
-{
- BITS pushs :8;
- BITS current :8;
- BITS max :8;
-} STACK_USAGE;
-
-typedef union STACKDWORDtag
-{
- BITS bits;
- STACK_USAGE su;
-} STACKDWORD;
-
typedef struct CALL_LEVEL
{
unsigned int FCSP_BeforeEntry;
- STACKDWORD stackUsage;
+ GLint subDescIndex;
+ GLushort current;
+ GLushort max;
TypedShaderList * plstCFInstructions_local;
} CALL_LEVEL;
@@ -386,9 +375,6 @@ typedef struct r700_AssemblerBase
unsigned int FCSP;
FC_LEVEL fc_stack[32];
- unsigned int branch_depth;
- unsigned int max_branch_depth;
-
//-----------------------------------------------------------------------------------
// ArgSubst used in Assemble_Source() function
//-----------------------------------------------------------------------------------
@@ -449,7 +435,8 @@ typedef struct r700_AssemblerBase
} r700_AssemblerBase;
//Internal use
-inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason);
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly);
+inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason);
BITS addrmode_PVSDST(PVSDST * pPVSDST);
void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode);
void nomask_PVSDST(PVSDST * pPVSDST);
diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c
index db951e48c4..2eed1acc2f 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.c
+++ b/src/mesa/drivers/dri/r600/r700_shader.c
@@ -140,7 +140,7 @@ void Init_R700_Shader(R700_Shader * pShader)
pShader->killIsUsed = GL_FALSE;
pShader->uCFOffset = 0;
- pShader->uStackSize = 10; //richard test
+ pShader->uStackSize = 0;
pShader->uMaxCallDepth = 0;
pShader->bSurfAllocated = GL_FALSE;
--
cgit v1.2.3
From f9b0f1dfa1695db79553f67fd0c156d445062ffa Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Mon, 23 Nov 2009 06:31:29 +1000
Subject: r600: fix inline issues
---
src/mesa/drivers/dri/r600/r700_assembler.c | 4 ++--
src/mesa/drivers/dri/r600/r700_assembler.h | 2 --
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 16cdb741ae..c46dd757d0 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4976,7 +4976,7 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
-inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason)
+static inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason)
{
switch (uReason)
{
@@ -4996,7 +4996,7 @@ inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason)
};
}
-inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly)
+static inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly)
{
if(GL_TRUE == bCheckMaxOnly)
{
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 7efb346fa7..3e4106335a 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -435,8 +435,6 @@ typedef struct r700_AssemblerBase
} r700_AssemblerBase;
//Internal use
-inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly);
-inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason);
BITS addrmode_PVSDST(PVSDST * pPVSDST);
void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode);
void nomask_PVSDST(PVSDST * pPVSDST);
--
cgit v1.2.3
From c3c8c40cab193e0aa0f1a42bff7b0d726df8cf9f Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Mon, 23 Nov 2009 06:44:29 +1000
Subject: r600: hopefully fix segfault.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index c46dd757d0..702add9772 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -6421,6 +6421,8 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
R700ShaderInstruction * pInst;
R700ControlFlowGenericClause * pCFInst;
+ plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local;
+
/* remove flags init if they are not used */
if((pAsm->unCFflags & HAS_LOOPRET) == 0)
{
@@ -6462,7 +6464,6 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2;
}
- plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local;
unCFoffset = plstCFmain->uNumOfNode;
/* Reloc subs */
--
cgit v1.2.3
From a12b468d002edb6c8a7c95882edd3e5e7f615a4e Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Sun, 22 Nov 2009 21:31:46 -0500
Subject: r600 : add support for shader instruction trunc and discard.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 105 +++++++++++++++++++++--------
src/mesa/drivers/dri/r600/r700_assembler.h | 2 +-
2 files changed, 78 insertions(+), 29 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 702add9772..8e57396a0d 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -340,7 +340,10 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm)
switch (pAsm->D.dst.opcode)
{
case SQ_OP2_INST_ADD:
+ case SQ_OP2_INST_KILLE:
case SQ_OP2_INST_KILLGT:
+ case SQ_OP2_INST_KILLGE:
+ case SQ_OP2_INST_KILLNE:
case SQ_OP2_INST_MUL:
case SQ_OP2_INST_MAX:
case SQ_OP2_INST_MIN:
@@ -363,6 +366,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm)
case SQ_OP2_INST_MOVA_FLOOR:
case SQ_OP2_INST_FRACT:
case SQ_OP2_INST_FLOOR:
+ case SQ_OP2_INST_TRUNC:
case SQ_OP2_INST_EXP_IEEE:
case SQ_OP2_INST_LOG_CLAMPED:
case SQ_OP2_INST_LOG_IEEE:
@@ -1379,19 +1383,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm)
case FRAG_ATTRIB_PNTC:
fprintf(stderr, "FRAG_ATTRIB_PNTC unsupported\n");
break;
- case FRAG_ATTRIB_VAR0:
- fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n");
- break;
}
if( (pILInst->SrcReg[0].Index >= FRAG_ATTRIB_VAR0) ||
- (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) )
- {
+ (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) )
+ {
bValidTexCoord = GL_TRUE;
pAsm->S[0].src.reg =
pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index];
pAsm->S[0].src.rtype = SRC_REG_INPUT;
- }
+ }
break;
}
@@ -2469,9 +2470,9 @@ GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm)
{
R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction);
if (alu_instruction_ptr == NULL)
- {
- return GL_FALSE;
- }
+ {
+ return GL_FALSE;
+ }
Init_R700ALUInstruction(alu_instruction_ptr);
//src 0
@@ -3545,13 +3546,12 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm)
return GL_TRUE;
}
-GLboolean assemble_KIL(r700_AssemblerBase *pAsm)
-{
- /* TODO: doc says KILL has to be last(end) ALU clause */
-
- checkop1(pAsm);
+GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode)
+{
+ checkop2(pAsm);
- pAsm->D.dst.opcode = SQ_OP2_INST_KILLGT;
+ pAsm->D.dst.opcode = opcode;
+ pAsm->D.dst.math = 1;
setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
pAsm->D.dst.rtype = DST_REG_TEMPORARY;
@@ -3561,24 +3561,24 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm)
pAsm->D.dst.writez = 0;
pAsm->D.dst.writew = 0;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = 0;
-
- setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0);
- noneg_PVSSRC(&(pAsm->S[0].src));
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
- if ( GL_FALSE == assemble_src(pAsm, 0, 1) )
+ if( GL_FALSE == assemble_src(pAsm, 1, -1) )
{
return GL_FALSE;
}
- if ( GL_FALSE == next_ins(pAsm) )
+ if ( GL_FALSE == next_ins2(pAsm) )
{
return GL_FALSE;
}
+ /* Doc says KILL has to be last(end) ALU clause */
pAsm->pR700Shader->killIsUsed = GL_TRUE;
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
return GL_TRUE;
}
@@ -5018,7 +5018,7 @@ static inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLb
pAsm->CALLSTACK[pAsm->CALLSP].current + 4;
}
break;
- }
+ }
return;
}
@@ -5102,7 +5102,7 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
if(GL_TRUE != bHasElse)
{
- pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
+ pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1;
}
else
{
@@ -5172,7 +5172,7 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
{
#ifdef USE_CF_FOR_POP_AFTER
- pops(pAsm, 1);
+ pops(pAsm, 1);
#endif /* USE_CF_FOR_POP_AFTER */
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
@@ -5912,8 +5912,10 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
break;
case OPCODE_KIL:
- if ( GL_FALSE == assemble_KIL(pR700AsmCode) )
- return GL_FALSE;
+ case OPCODE_KIL_NV:
+ /* done at OPCODE_SE/SGT...etc. */
+ /* if ( GL_FALSE == assemble_KIL(pR700AsmCode) )
+ return GL_FALSE; */
break;
case OPCODE_LG2:
if ( GL_FALSE == assemble_LG2(pR700AsmCode) )
@@ -6008,6 +6010,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLE) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) )
@@ -6051,6 +6060,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) )
@@ -6094,6 +6110,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_SGE(pR700AsmCode) )
@@ -6150,6 +6173,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) )
@@ -6210,6 +6240,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) )
@@ -6257,6 +6294,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
}
}
+ else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode))
+ {
+ if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLNE) )
+ {
+ return GL_FALSE;
+ }
+ }
else
{
if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) )
@@ -6298,6 +6342,11 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
return GL_FALSE;
break;
+ case OPCODE_TRUNC:
+ if ( GL_FALSE == assemble_math_function(pR700AsmCode, SQ_OP2_INST_TRUNC) )
+ return GL_FALSE;
+ break;
+
case OPCODE_XPD:
if ( GL_FALSE == assemble_XPD(pR700AsmCode) )
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 3e4106335a..130fc89dae 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -554,7 +554,7 @@ GLboolean assemble_EXP(r700_AssemblerBase *pAsm);
GLboolean assemble_FLR(r700_AssemblerBase *pAsm);
GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm);
GLboolean assemble_FRC(r700_AssemblerBase *pAsm);
-GLboolean assemble_KIL(r700_AssemblerBase *pAsm);
+GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode);
GLboolean assemble_LG2(r700_AssemblerBase *pAsm);
GLboolean assemble_LRP(r700_AssemblerBase *pAsm);
GLboolean assemble_LOG(r700_AssemblerBase *pAsm);
--
cgit v1.2.3
From b611f639b4bffdcca376293f7ce71af9f6bdbff3 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 23 Nov 2009 00:57:37 -0500
Subject: glu/sgi: Fix memory leak in gluScaleImage3D.
---
src/glu/sgi/libutil/mipmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c
index 4139c304a1..223621f49f 100644
--- a/src/glu/sgi/libutil/mipmap.c
+++ b/src/glu/sgi/libutil/mipmap.c
@@ -7384,6 +7384,8 @@ int gluScaleImage3D(GLenum format,
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) {
+ free(beforeImage);
+ free(afterImage);
return GLU_OUT_OF_MEMORY;
}
retrieveStoreModes3D(&psm);
--
cgit v1.2.3
From 5b925b7daa566d799c4f50911a7fcca114131503 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 23 Nov 2009 01:09:06 -0500
Subject: glu/sgi: Fix memory leak in bitmapBuild2DMipmaps.
---
src/glu/sgi/libutil/mipmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c
index 223621f49f..c5faebd6a3 100644
--- a/src/glu/sgi/libutil/mipmap.c
+++ b/src/glu/sgi/libutil/mipmap.c
@@ -3762,6 +3762,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(newImage);
return GLU_OUT_OF_MEMORY;
}
}
--
cgit v1.2.3
From 4b0b250aae6ae7d48cd24f9d91d05ab58086c4b2 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 23 Nov 2009 01:30:32 -0500
Subject: glx: Prevent potential null pointer deference in driCreateContext.
---
src/glx/x11/drisw_glx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
index 15e1586658..1866b2cc87 100644
--- a/src/glx/x11/drisw_glx.c
+++ b/src/glx/x11/drisw_glx.c
@@ -250,12 +250,14 @@ driCreateContext(__GLXscreenConfigs * psc,
{
__GLXDRIcontextPrivate *pcp, *pcp_shared;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
- const __DRIcoreExtension *core = psc->core;
+ const __DRIcoreExtension *core;
__DRIcontext *shared = NULL;
if (!psc || !psc->driScreen)
return NULL;
+ core = psc->core;
+
if (shareList) {
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
shared = pcp_shared->driContext;
--
cgit v1.2.3
From 67125c7f9aa141a7948ebb915ece9d991bb6ff19 Mon Sep 17 00:00:00 2001
From: Vinson Lee
Date: Mon, 23 Nov 2009 01:52:59 -0500
Subject: mesa: Initialize variable in _mesa_get_texel_fetch_func.
---
src/mesa/main/texfetch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index f4f2be48c3..b37039429f 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -570,7 +570,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
static FetchTexelFuncF
_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
{
- FetchTexelFuncF f;
+ FetchTexelFuncF f = NULL;
GLuint i;
/* XXX replace loop with direct table lookup */
for (i = 0; i < MESA_FORMAT_COUNT; i++) {
--
cgit v1.2.3
From f61865799defe6636ac893c7ddb510911e5bfa0c Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 19 Nov 2009 12:52:58 +0100
Subject: slang: Be more robust with memory in concat_shaders().
---
src/mesa/shader/slang/slang_link.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 0a2bc49780..ed27821a95 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -590,11 +590,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
{
struct gl_shader *newShader;
const struct gl_shader *firstShader = NULL;
- GLuint shaderLengths[100];
+ GLuint *shaderLengths;
GLchar *source;
GLuint totalLen = 0, len = 0;
GLuint i;
+ shaderLengths = (GLuint *)_mesa_malloc(shProg->NumShaders * sizeof(GLuint));
+ if (!shaderLengths) {
+ return NULL;
+ }
+
/* compute total size of new shader source code */
for (i = 0; i < shProg->NumShaders; i++) {
const struct gl_shader *shader = shProg->Shaders[i];
@@ -606,12 +611,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
}
}
- if (totalLen == 0)
+ if (totalLen == 0) {
+ _mesa_free(shaderLengths);
return NULL;
+ }
source = (GLchar *) _mesa_malloc(totalLen + 1);
- if (!source)
+ if (!source) {
+ _mesa_free(shaderLengths);
return NULL;
+ }
/* concatenate shaders */
for (i = 0; i < shProg->NumShaders; i++) {
@@ -626,9 +635,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
_mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source);
*/
+ _mesa_free(shaderLengths);
+
remove_extra_version_directives(source);
newShader = CALLOC_STRUCT(gl_shader);
+ if (!newShader) {
+ _mesa_free(source);
+ return NULL;
+ }
+
newShader->Type = shaderType;
newShader->Source = source;
newShader->Pragmas = firstShader->Pragmas;
--
cgit v1.2.3
From f359ac5486b14d98ab4a855302b67d1700f031ae Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 19 Nov 2009 13:01:08 +0100
Subject: tgsi: Add execution debugging facilities to exec.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 67 ++++++++++++++++++++++++++++++++--
1 file changed, 63 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index ba7a225db3..f164fce5c0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -3087,6 +3087,8 @@ exec_instruction(
}
}
+#define DEBUG_EXECUTION 0
+
/**
* Run TGSI interpreter.
@@ -3130,10 +3132,67 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
exec_declaration( mach, mach->Declarations+i );
}
- /* execute instructions, until pc is set to -1 */
- while (pc != -1) {
- assert(pc < (int) mach->NumInstructions);
- exec_instruction( mach, mach->Instructions + pc, &pc );
+ {
+#if DEBUG_EXECUTION
+ struct tgsi_exec_vector temps[TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS];
+ struct tgsi_exec_vector outputs[PIPE_MAX_ATTRIBS];
+ uint inst = 1;
+
+ memcpy(temps, mach->Temps, sizeof(temps));
+ memcpy(outputs, mach->Outputs, sizeof(outputs));
+#endif
+
+ /* execute instructions, until pc is set to -1 */
+ while (pc != -1) {
+
+#if DEBUG_EXECUTION
+ uint i;
+
+ tgsi_dump_instruction(&mach->Instructions[pc], inst++);
+#endif
+
+ assert(pc < (int) mach->NumInstructions);
+ exec_instruction(mach, mach->Instructions + pc, &pc);
+
+#if DEBUG_EXECUTION
+ for (i = 0; i < TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS; i++) {
+ if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) {
+ uint j;
+
+ memcpy(&temps[i], &mach->Temps[i], sizeof(temps[i]));
+ debug_printf("TEMP[%2u] = ", i);
+ for (j = 0; j < 4; j++) {
+ if (j > 0) {
+ debug_printf(" ");
+ }
+ debug_printf("(%6f, %6f, %6f, %6f)\n",
+ temps[i].xyzw[0].f[j],
+ temps[i].xyzw[1].f[j],
+ temps[i].xyzw[2].f[j],
+ temps[i].xyzw[3].f[j]);
+ }
+ }
+ }
+ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
+ if (memcmp(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]))) {
+ uint j;
+
+ memcpy(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]));
+ debug_printf("OUT[%2u] = ", i);
+ for (j = 0; j < 4; j++) {
+ if (j > 0) {
+ debug_printf(" ");
+ }
+ debug_printf("{%6f, %6f, %6f, %6f}\n",
+ outputs[i].xyzw[0].f[j],
+ outputs[i].xyzw[1].f[j],
+ outputs[i].xyzw[2].f[j],
+ outputs[i].xyzw[3].f[j]);
+ }
+ }
+ }
+#endif
+ }
}
#if 0
--
cgit v1.2.3
From cde758a2b50da8d7a8db5467f5629ce366380c41 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 19 Nov 2009 13:05:58 +0100
Subject: tgsi: Fake TXD implementation in exec.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 60 +++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index f164fce5c0..b2dc24c2fe 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1698,6 +1698,64 @@ exec_tex(struct tgsi_exec_machine *mach,
}
}
+static void
+exec_txd(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ const uint unit = inst->FullSrcRegisters[3].SrcRegister.Index;
+ union tgsi_exec_channel r[4];
+ uint chan_index;
+
+ /*
+ * XXX: This is fake TXD -- the derivatives are not taken into account, yet.
+ */
+
+ switch (inst->InstructionExtTexture.Texture) {
+ case TGSI_TEXTURE_1D:
+ case TGSI_TEXTURE_SHADOW1D:
+
+ FETCH(&r[0], 0, CHAN_X);
+
+ fetch_texel(mach->Samplers[unit],
+ &r[0], &ZeroVec, &ZeroVec, 0.0f, /* S, T, P, BIAS */
+ &r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
+ break;
+
+ case TGSI_TEXTURE_2D:
+ case TGSI_TEXTURE_RECT:
+ case TGSI_TEXTURE_SHADOW2D:
+ case TGSI_TEXTURE_SHADOWRECT:
+
+ FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[1], 0, CHAN_Y);
+ FETCH(&r[2], 0, CHAN_Z);
+
+ fetch_texel(mach->Samplers[unit],
+ &r[0], &r[1], &r[2], 0.0f, /* inputs */
+ &r[0], &r[1], &r[2], &r[3]); /* outputs */
+ break;
+
+ case TGSI_TEXTURE_3D:
+ case TGSI_TEXTURE_CUBE:
+
+ FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[1], 0, CHAN_Y);
+ FETCH(&r[2], 0, CHAN_Z);
+
+ fetch_texel(mach->Samplers[unit],
+ &r[0], &r[1], &r[2], 0.0f,
+ &r[0], &r[1], &r[2], &r[3]);
+ break;
+
+ default:
+ assert(0);
+ }
+
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&r[chan_index], 0, chan_index);
+ }
+}
+
/**
* Evaluate a constant-valued coefficient at the position of the
@@ -2507,7 +2565,7 @@ exec_instruction(
/* src[1] = d[strq]/dx */
/* src[2] = d[strq]/dy */
/* src[3] = sampler unit */
- assert (0);
+ exec_txd(mach, inst);
break;
case TGSI_OPCODE_TXL:
--
cgit v1.2.3
From b7590cde4a475cd785030d7c7909846ae72608e5 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 10:40:05 +0100
Subject: tgsi: Bring BGNFOR/ENDFOR implementation up to spec.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 46 +++++++++++++++++++++++++---------
src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 +-
2 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index b2dc24c2fe..36682bbd30 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1461,6 +1461,13 @@ store_dest(
dst = &mach->Addrs[index].xyzw[chan_index];
break;
+ case TGSI_FILE_LOOP:
+ assert(reg->DstRegister.Index == 0);
+ assert(mach->LoopCounterStackTop > 0);
+ assert(chan_index == CHAN_X);
+ dst = &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[chan_index];
+ break;
+
case TGSI_FILE_PREDICATE:
index = reg->DstRegister.Index;
assert(index < TGSI_EXEC_NUM_PREDS);
@@ -3031,8 +3038,23 @@ exec_instruction(
for (chan_index = 0; chan_index < 3; chan_index++) {
FETCH( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[chan_index], 0, chan_index );
}
- STORE( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_Y], 0, CHAN_X );
++mach->LoopCounterStackTop;
+ STORE(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], 0, CHAN_X);
+ /* update LoopMask */
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[0] <= 0.0f) {
+ mach->LoopMask &= ~0x1;
+ }
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[1] <= 0.0f) {
+ mach->LoopMask &= ~0x2;
+ }
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[2] <= 0.0f) {
+ mach->LoopMask &= ~0x4;
+ }
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[3] <= 0.0f) {
+ mach->LoopMask &= ~0x8;
+ }
+ /* TODO: if mach->LoopMask == 0, jump to end of loop */
+ UPDATE_EXEC_MASK(mach);
/* fall-through (for now) */
case TGSI_OPCODE_BGNLOOP:
/* push LoopMask and ContMasks */
@@ -3046,28 +3068,28 @@ exec_instruction(
case TGSI_OPCODE_ENDFOR:
assert(mach->LoopCounterStackTop > 0);
- micro_sub( &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X],
- &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X],
- &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] );
+ micro_sub(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y],
+ &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y],
+ &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]);
/* update LoopMask */
- if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[0] <= 0) {
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[0] <= 0.0f) {
mach->LoopMask &= ~0x1;
}
- if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[1] <= 0 ) {
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[1] <= 0.0f) {
mach->LoopMask &= ~0x2;
}
- if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[2] <= 0 ) {
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[2] <= 0.0f) {
mach->LoopMask &= ~0x4;
}
- if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[3] <= 0 ) {
+ if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[3] <= 0.0f) {
mach->LoopMask &= ~0x8;
}
- micro_add( &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y],
- &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y],
- &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Z]);
+ micro_add(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X],
+ &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X],
+ &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Z]);
assert(mach->LoopLabelStackTop > 0);
inst = mach->Instructions + mach->LoopLabelStack[mach->LoopLabelStackTop - 1];
- STORE( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_Y], 0, CHAN_X );
+ STORE(&mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_X], 0, CHAN_X);
/* Restore ContMask, but don't pop */
assert(mach->ContStackTop > 0);
mach->ContMask = mach->ContStack[mach->ContStackTop - 1];
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 471f591dd6..f0aaca92b3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -252,7 +252,7 @@ struct tgsi_exec_machine
uint LoopLabelStack[TGSI_EXEC_MAX_LOOP_NESTING];
int LoopLabelStackTop;
- /** Loop counter stack (x = count, y = current, z = step) */
+ /** Loop counter stack (x = index, y = counter, z = step) */
struct tgsi_exec_vector LoopCounterStack[TGSI_EXEC_MAX_LOOP_NESTING];
int LoopCounterStackTop;
--
cgit v1.2.3
From cc35a454da08e7303c76a51972bcccf7d67b7704 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 10:49:41 +0100
Subject: tgsi: Fix POSITION and FACE fragment shader inputs.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 77 ++++++++++++++++++----------------
src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 +
2 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 36682bbd30..0197db8883 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1832,53 +1832,58 @@ typedef void (* eval_coef_func)(
unsigned chan );
static void
-exec_declaration(
- struct tgsi_exec_machine *mach,
- const struct tgsi_full_declaration *decl )
+exec_declaration(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_declaration *decl)
{
- if( mach->Processor == TGSI_PROCESSOR_FRAGMENT ) {
- if( decl->Declaration.File == TGSI_FILE_INPUT ) {
- unsigned first, last, mask;
- eval_coef_func eval;
+ if (mach->Processor == TGSI_PROCESSOR_FRAGMENT) {
+ if (decl->Declaration.File == TGSI_FILE_INPUT) {
+ uint first, last, mask;
first = decl->DeclarationRange.First;
last = decl->DeclarationRange.Last;
mask = decl->Declaration.UsageMask;
- switch( decl->Declaration.Interpolate ) {
- case TGSI_INTERPOLATE_CONSTANT:
- eval = eval_constant_coef;
- break;
-
- case TGSI_INTERPOLATE_LINEAR:
- eval = eval_linear_coef;
- break;
+ if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) {
+ assert(decl->Semantic.SemanticIndex == 0);
+ assert(first == last);
+ assert(mask = TGSI_WRITEMASK_XYZW);
- case TGSI_INTERPOLATE_PERSPECTIVE:
- eval = eval_perspective_coef;
- break;
+ mach->Inputs[first] = mach->QuadPos;
+ } else if (decl->Semantic.SemanticName == TGSI_SEMANTIC_FACE) {
+ uint i;
- default:
- assert( 0 );
- return;
- }
+ assert(decl->Semantic.SemanticIndex == 0);
+ assert(first == last);
- if( mask == TGSI_WRITEMASK_XYZW ) {
- unsigned i, j;
-
- for( i = first; i <= last; i++ ) {
- for( j = 0; j < NUM_CHANNELS; j++ ) {
- eval( mach, i, j );
- }
+ for (i = 0; i < QUAD_SIZE; i++) {
+ mach->Inputs[first].xyzw[0].f[i] = mach->Face;
+ }
+ } else {
+ eval_coef_func eval;
+ uint i, j;
+
+ switch (decl->Declaration.Interpolate) {
+ case TGSI_INTERPOLATE_CONSTANT:
+ eval = eval_constant_coef;
+ break;
+
+ case TGSI_INTERPOLATE_LINEAR:
+ eval = eval_linear_coef;
+ break;
+
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ eval = eval_perspective_coef;
+ break;
+
+ default:
+ assert(0);
+ return;
}
- }
- else {
- unsigned i, j;
- for( j = 0; j < NUM_CHANNELS; j++ ) {
- if( mask & (1 << j) ) {
- for( i = first; i <= last; i++ ) {
- eval( mach, i, j );
+ for (j = 0; j < NUM_CHANNELS; j++) {
+ if (mask & (1 << j)) {
+ for (i = first; i <= last; i++) {
+ eval(mach, i, j);
}
}
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index f0aaca92b3..3dff69a505 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -232,6 +232,7 @@ struct tgsi_exec_machine
/* FRAGMENT processor only. */
const struct tgsi_interp_coef *InterpCoefs;
struct tgsi_exec_vector QuadPos;
+ float Face; /**< +1 if front facing, -1 if back facing */
/* Conditional execution masks */
uint CondMask; /**< For IF/ELSE/ENDIF */
--
cgit v1.2.3
From cc93fa3527e64963acd0e643d7d1061306d9e1df Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 10:51:07 +0100
Subject: softpipe: Initialise TGSI machine's Face.
---
src/gallium/drivers/softpipe/sp_fs_exec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 4076114d39..a8999ed347 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -126,7 +126,13 @@ exec_run( const struct sp_fragment_shader *base,
setup_pos_vector(quad->posCoef,
(float)quad->input.x0, (float)quad->input.y0,
&machine->QuadPos);
-
+
+ if (quad->input.facing) {
+ machine->Face = -1.0f;
+ } else {
+ machine->Face = 1.0f;
+ }
+
quad->inout.mask &= tgsi_exec_machine_run( machine );
if (quad->inout.mask == 0)
return FALSE;
--
cgit v1.2.3
From eacdd8fa75d83ed1e3e2d7c003cea857a310bffd Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 11:29:29 +0100
Subject: tgsi: Remove code that actually had no effect.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 0197db8883..d52c94fcfa 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2275,11 +2275,7 @@ exec_instruction(
case TGSI_OPCODE_EX2:
FETCH(&r[0], 0, CHAN_X);
-#if FAST_MATH
micro_exp2( &r[0], &r[0] );
-#else
- micro_pow( &r[0], &mach->Temps[TEMP_2_I].xyzw[TEMP_2_C], &r[0] );
-#endif
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
STORE( &r[0], 0, chan_index );
--
cgit v1.2.3
From c511e0b8442f0ddd4265137446180d5ced3f1671 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 11:32:58 +0100
Subject: tgsi: Clamp the source argument in micro_exp2() to avoid Inf.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index d52c94fcfa..af914f6d08 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -578,6 +578,24 @@ micro_exp2(
dst->f[2] = util_fast_exp2( src->f[2] );
dst->f[3] = util_fast_exp2( src->f[3] );
#else
+
+#if DEBUG
+ /* Inf is okay for this instruction, so clamp it to silence assertions. */
+ uint i;
+ union tgsi_exec_channel clamped;
+
+ for (i = 0; i < 4; i++) {
+ if (src->f[i] > 127.99999f) {
+ clamped.f[i] = 127.99999f;
+ } else if (src->f[i] < -126.99999f) {
+ clamped.f[i] = -126.99999f;
+ } else {
+ clamped.f[i] = src->f[i];
+ }
+ }
+ src = &clamped;
+#endif
+
dst->f[0] = powf( 2.0f, src->f[0] );
dst->f[1] = powf( 2.0f, src->f[1] );
dst->f[2] = powf( 2.0f, src->f[2] );
--
cgit v1.2.3
From 18384af7491c408c4182b72807b02c11b55509f8 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Mon, 23 Nov 2009 13:22:04 +0100
Subject: slang: Check return value from emit_instruction().
---
src/mesa/shader/slang/slang_emit.c | 73 ++++++++++++++++++++++++++++++++++----
1 file changed, 67 insertions(+), 6 deletions(-)
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index c0e4b27aa5..fe39b46dbb 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -551,6 +551,9 @@ emit_instruction(slang_emit_info *emitInfo,
&srcRelAddr,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
src[i] = &newSrc[i];
}
@@ -948,6 +951,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
n->Children[1]->Store,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "Compare values");
/* Compute val = DOT(temp, temp) (reduction) */
@@ -957,6 +963,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
&tempStore,
&tempStore,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst->SrcReg[0].Swizzle = inst->SrcReg[1].Swizzle = swizzle; /*override*/
inst_comment(inst, "Reduce vec to bool");
@@ -972,6 +981,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
n->Store,
&zero,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "Invert true/false");
}
}
@@ -1001,6 +1013,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
&srcStore0,
&srcStore1,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "Begin struct/array comparison");
}
else {
@@ -1010,12 +1025,18 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
&srcStore0,
&srcStore1,
NULL);
+ if (!inst) {
+ return NULL;
+ }
/* ADD accTemp, accTemp, sneTemp; # like logical-OR */
inst = emit_instruction(emitInfo, OPCODE_ADD,
&accTemp, /* dest */
&accTemp,
&sneTemp,
NULL);
+ if (!inst) {
+ return NULL;
+ }
}
}
@@ -1025,6 +1046,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
&accTemp,
&accTemp,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "End struct/array comparison");
if (n->Opcode == IR_EQUAL) {
@@ -1036,6 +1060,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
n->Store,
&zero,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "Invert true/false");
}
@@ -1119,6 +1146,9 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
n->Children[1]->Store,
NULL);
+ if (!inst) {
+ return NULL;
+ }
/* n->dest = min(tmp, ch[2]) */
inst = emit_instruction(emitInfo, OPCODE_MIN,
@@ -1153,7 +1183,9 @@ emit_negation(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
NULL,
NULL);
- inst->SrcReg[0].Negate = NEGATE_XYZW;
+ if (inst) {
+ inst->SrcReg[0].Negate = NEGATE_XYZW;
+ }
return inst;
}
@@ -1356,6 +1388,9 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[1]->Store,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst->TexShadow = shadow;
@@ -1458,6 +1493,9 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
&srcStore,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "IR_COPY block");
srcStore.Index++;
dstStore.Index++;
@@ -1473,6 +1511,9 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[1]->Store,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
dstAnnot = storage_annotation(n->Children[0], emitInfo->prog);
srcAnnot = storage_annotation(n->Children[1], emitInfo->prog);
inst->Comment = instruction_annotation(inst->Opcode, dstAnnot,
@@ -1534,6 +1575,9 @@ emit_cond(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst->CondUpdate = GL_TRUE;
inst_comment(inst, "COND expr");
_slang_free_temp(emitInfo->vt, n->Store);
@@ -1596,6 +1640,9 @@ emit_not(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
&zero,
NULL);
+ if (!inst) {
+ return NULL;
+ }
inst_comment(inst, "NOT");
free_node_storage(emitInfo->vt, n->Children[0]);
@@ -1646,12 +1693,17 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask);
}
else {
+ struct prog_instruction *inst;
+
/* IF src[0] THEN ... */
- emit_instruction(emitInfo, OPCODE_IF,
- NULL, /* dst */
- n->Children[0]->Store, /* op0 */
- NULL,
- NULL);
+ inst = emit_instruction(emitInfo, OPCODE_IF,
+ NULL, /* dst */
+ n->Children[0]->Store, /* op0 */
+ NULL,
+ NULL);
+ if (!inst) {
+ return NULL;
+ }
}
}
else {
@@ -1875,6 +1927,9 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
n->Children[0]->Store,
NULL,
NULL);
+ if (!inst) {
+ return NULL;
+ }
n->InstLocation = emitInfo->prog->NumInstructions;
inst = new_instruction(emitInfo, opcode);
@@ -2045,6 +2100,9 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
indexStore, /* the index */
&elemSizeStore,
NULL);
+ if (!inst) {
+ return NULL;
+ }
indexStore = indexTemp;
}
@@ -2071,6 +2129,9 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
indexStore, /* the index */
&indirectArray, /* indirect array base */
NULL);
+ if (!inst) {
+ return NULL;
+ }
indexStore = indexTemp;
}
--
cgit v1.2.3
From 86710c3334850eeaeffcac6d538e01fd5c203167 Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz
Date: Mon, 23 Nov 2009 19:59:02 +0100
Subject: svga: Scrub Makefiles a bit
Remove x86 specific hacks. Not that they will ever be used on
none x86 arches, but they are built by default. And the way the
flags where added was a hack.
---
src/gallium/drivers/svga/Makefile | 8 +-------
src/gallium/winsys/drm/vmware/core/Makefile | 14 +-------------
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile
index fe1d6d7384..d1413319c9 100644
--- a/src/gallium/drivers/svga/Makefile
+++ b/src/gallium/drivers/svga/Makefile
@@ -51,13 +51,7 @@ LIBRARY_INCLUDES = \
-I$(TOP)/src/gallium/drivers/svga/include
LIBRARY_DEFINES = \
+ -std=gnu99 -fvisibility=hidden \
-DHAVE_STDINT_H -DHAVE_SYS_TYPES_H
-CC = gcc -fvisibility=hidden -msse -msse2
-
-# Set the gnu99 standard to enable anonymous structs in vmware headers.
-#
-CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
- $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
-
include ../../Makefile.template
diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile
index ff8f01b322..a52957c1a5 100644
--- a/src/gallium/winsys/drm/vmware/core/Makefile
+++ b/src/gallium/winsys/drm/vmware/core/Makefile
@@ -28,20 +28,8 @@ LIBRARY_INCLUDES = \
$(shell pkg-config libdrm --cflags-only-I)
LIBRARY_DEFINES = \
+ -std=gnu99 -fvisibility=hidden \
-DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \
$(shell pkg-config libdrm --cflags-only-other)
-CC = gcc -fvisibility=hidden -msse -msse2
-
-# Set the gnu99 standard to enable anonymous structs in vmware headers.
-#
-CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
- $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
-
include ../../../../Makefile.template
-
-
-symlinks:
-
-
-include depend
--
cgit v1.2.3
From 960464e42dce138fde11c379ce7744bc4be14aa2 Mon Sep 17 00:00:00 2001
From: Maciej Cencora
Date: Mon, 23 Nov 2009 21:59:08 +0100
Subject: radeon: fix errors in miptree related function
- typo
- memory leak
- off by one (spotted by airlied)
---
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index a11b5b9979..46603de2e7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -492,11 +492,12 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
unsigned firstLevel,
unsigned lastLevel)
{
- const unsigned numLevels = lastLevel - firstLevel;
+ const unsigned numLevels = lastLevel - firstLevel + 1;
unsigned *mtSizes = calloc(numLevels, sizeof(unsigned));
radeon_mipmap_tree **mts = calloc(numLevels, sizeof(radeon_mipmap_tree *));
unsigned mtCount = 0;
unsigned maxMtIndex = 0;
+ radeon_mipmap_tree *tmp;
for (unsigned level = firstLevel; level <= lastLevel; ++level) {
radeon_texture_image *img = get_radeon_texture_image(texObj->base.Image[0][level]);
@@ -518,7 +519,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
if (!found) {
mtSizes[mtCount] += img->mt->levels[img->mtlevel].size;
- mts[mtCount++] = img->mt;
+ mts[mtCount] = img->mt;
mtCount++;
}
}
@@ -533,7 +534,11 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
}
}
- return mts[maxMtIndex];
+ tmp = mts[maxMtIndex];
+ free(mtSizes);
+ free(mts);
+
+ return tmp;
}
/**
--
cgit v1.2.3
From 15740eb03ca8fb7eda585c612c1b36ec9df4474a Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 23 Nov 2009 18:04:22 -0700
Subject: gallium/util: added util_bitcount()
---
src/gallium/auxiliary/util/u_math.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 731a11475e..9ed1ab6d8e 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -490,6 +490,26 @@ util_next_power_of_two(unsigned x)
}
+/**
+ * Return number of bits set in n.
+ */
+static INLINE unsigned
+util_bitcount(unsigned n)
+{
+#if defined(PIPE_CC_GCC)
+ return __builtin_popcount(n);
+#else
+ /* XXX there are more clever ways of doing this */
+ unsigned bits = 0;
+ while (n) {
+ bits += (n & 1);
+ n = n >> 1;
+ }
+ return bits;
+#endif
+}
+
+
/**
* Clamp X to [MIN, MAX].
* This is a macro to allow float, int, uint, etc. types.
--
cgit v1.2.3
From 0a27c7b96337b1a56100d2cc3b5fa0454fc7c165 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 23 Nov 2009 18:04:47 -0700
Subject: egl: use util_bitcount()
---
src/gallium/winsys/egl_xlib/egl_xlib.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index d02f825047..599973ce12 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -41,6 +41,7 @@
#include "pipe/p_state.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
+#include "util/u_math.h"
#include "softpipe/sp_winsys.h"
#include "softpipe/sp_texture.h"
@@ -138,17 +139,6 @@ lookup_context(_EGLContext *ctx)
}
-static unsigned int
-bitcount(unsigned int n)
-{
- unsigned int bits;
- for (bits = 0; n > 0; n = n >> 1) {
- bits += (n & 1);
- }
- return bits;
-}
-
-
/**
* Create the EGLConfigs. (one per X visual)
*/
@@ -174,9 +164,9 @@ create_configs(struct xlib_egl_display *xdpy, _EGLDisplay *disp)
for (i = 0; i < num_visuals; i++) {
_EGLConfig *config = calloc(1, sizeof(_EGLConfig));
int id = i + 1;
- int rbits = bitcount(visInfo[i].red_mask);
- int gbits = bitcount(visInfo[i].green_mask);
- int bbits = bitcount(visInfo[i].blue_mask);
+ int rbits = util_bitcount(visInfo[i].red_mask);
+ int gbits = util_bitcount(visInfo[i].green_mask);
+ int bbits = util_bitcount(visInfo[i].blue_mask);
int abits = bbits == 8 ? 8 : 0;
int zbits = 24;
int sbits = 8;
--
cgit v1.2.3
From 8d80b5400a1bbf4e959cd8257d11dfe0483e93db Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 23 Nov 2009 18:06:19 -0700
Subject: r300g: use util_bitcount()
---
src/gallium/drivers/r300/r300_emit.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index ad7dff36be..e6ab8e4af1 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -721,21 +721,6 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
END_CS;
}
-/* XXX This should go to util ... */
-/* Return the number of bits set in the given number. */
-static unsigned bitcount(unsigned n)
-{
- unsigned bits = 0;
-
- while (n) {
- if (n & 1) {
- bits++;
- }
- n >>= 1;
- }
-
- return bits;
-}
void r300_emit_vertex_program_code(struct r300_context* r300,
struct r300_vertex_program_code* code)
@@ -745,8 +730,8 @@ void r300_emit_vertex_program_code(struct r300_context* r300,
unsigned instruction_count = code->length / 4;
int vtx_mem_size = r300screen->caps->is_r500 ? 128 : 72;
- int input_count = MAX2(bitcount(code->InputsRead), 1);
- int output_count = MAX2(bitcount(code->OutputsWritten), 1);
+ int input_count = MAX2(util_bitcount(code->InputsRead), 1);
+ int output_count = MAX2(util_bitcount(code->OutputsWritten), 1);
int temp_count = MAX2(code->num_temporaries, 1);
int pvs_num_slots = MIN3(vtx_mem_size / input_count,
vtx_mem_size / output_count, 10);
--
cgit v1.2.3
From 863ad9a68388979e1d305f8689146e18ef4f098c Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Mon, 23 Nov 2009 18:09:46 -0700
Subject: mesa: use gcc __builtin_popcount()
---
src/mesa/main/imports.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 46ffb929b6..c9e00cf752 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -629,11 +629,15 @@ _mesa_ffsll(int64_t val)
unsigned int
_mesa_bitcount(unsigned int n)
{
+#if defined(__GNUC__)
+ return __builtin_popcount(n);
+#else
unsigned int bits;
for (bits = 0; n > 0; n = n >> 1) {
bits += (n & 1);
}
return bits;
+#endif
}
--
cgit v1.2.3
From bd13e6e5e2403ada2098e3a07c0af4b4ba989ab7 Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Tue, 24 Nov 2009 10:49:34 +1000
Subject: radeon/r200/r300/r600: make bo mapping be explicit
This moves the bo mapping outside the DMA layer and makes it explicit,
this should in theory make it simpler to split the clean up the dma/cmdbuf
linkage that I created before that is broken.
Tested on: r600, rv380 (tcl/no-tcl), rv200 (tcl/no-tcl)
Signed-off-by: Dave Airlie
---
src/mesa/drivers/dri/r200/r200_maos_arrays.c | 2 ++
src/mesa/drivers/dri/r200/r200_swtcl.c | 2 +-
src/mesa/drivers/dri/r300/r300_draw.c | 15 ++++++++++++--
src/mesa/drivers/dri/r300/r300_swtcl.c | 8 ++++----
src/mesa/drivers/dri/r600/r700_render.c | 21 ++++++++++++++++++-
.../drivers/dri/radeon/radeon_common_context.h | 1 +
src/mesa/drivers/dri/radeon/radeon_dma.c | 24 +++++++++++-----------
src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++++
src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 4 ++--
src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +-
10 files changed, 60 insertions(+), 23 deletions(-)
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index 383a0c4b0d..249c0bbc11 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -90,12 +90,14 @@ static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
aos->components = size;
aos->count = count;
+ radeon_bo_map(aos->bo, 1);
out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
for (i = 0; i < count; i++) {
out[0] = r200ComputeFogBlendFactor( ctx, *(GLfloat *)data );
out++;
data += stride;
}
+ radeon_bo_unmap(aos->bo);
}
/* Emit any changed arrays to new GART memory, re-emit a packet to
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index fadc766b49..4596912ddc 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -297,7 +297,7 @@ void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
radeonEmitState(&rmesa->radeon);
r200EmitVertexAOS( rmesa,
rmesa->radeon.swtcl.vertex_size,
- first_elem(&rmesa->radeon.dma.reserved)->bo,
+ rmesa->radeon.swtcl.bo,
current_offset);
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index e9968f9ffe..3dcd986e22 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -100,7 +100,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
GLubyte *in = (GLubyte *)src_ptr;
radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo, &r300->ind_buf.bo_offset, size, 4);
-
+ radeon_bo_map(r300->ind_buf.bo, 1);
assert(r300->ind_buf.bo->ptr != NULL);
out = (GLuint *)ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset);
@@ -111,7 +111,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
if (i < mesa_ind_buf->count) {
*out++ = in[i];
}
-
+ radeon_bo_unmap(r300->ind_buf.bo);
#if MESA_BIG_ENDIAN
} else { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */
GLushort *in = (GLushort *)src_ptr;
@@ -120,6 +120,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo,
&r300->ind_buf.bo_offset, size, 4);
+ radeon_bo_map(r300->ind_buf.bo, 1);
assert(r300->ind_buf.bo->ptr != NULL);
out = (GLuint *)ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset);
@@ -130,6 +131,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
if (i < mesa_ind_buf->count) {
*out++ = in[i];
}
+ radeon_bo_unmap(r300->ind_buf.bo);
#endif
}
@@ -173,10 +175,12 @@ static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo, &r300->ind_buf.bo_offset, size, 4);
+ radeon_bo_map(r300->ind_buf.bo, 1);
assert(r300->ind_buf.bo->ptr != NULL);
dst_ptr = ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset);
_mesa_memcpy(dst_ptr, src_ptr, size);
+ radeon_bo_unmap(r300->ind_buf.bo);
r300->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT);
r300->ind_buf.count = mesa_ind_buf->count;
@@ -242,6 +246,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_
}
radeonAllocDmaRegion(&r300->radeon, &attr->bo, &attr->bo_offset, sizeof(GLfloat) * input->Size * count, 32);
+ radeon_bo_map(attr->bo, 1);
dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset);
radeon_print(RADEON_FALLBACKS, RADEON_IMPORTANT,
@@ -280,6 +285,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_
break;
}
+ radeon_bo_unmap(attr->bo);
if (mapped_named_bo) {
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj);
}
@@ -294,6 +300,8 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i
radeonAllocDmaRegion(&r300->radeon, &attr->bo, &attr->bo_offset, size, 32);
+ radeon_bo_map(attr->bo, 1);
+
if (!input->BufferObj->Pointer) {
ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj);
mapped_named_bo = GL_TRUE;
@@ -317,6 +325,7 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj);
}
+ radeon_bo_unmap(attr->bo);
attr->stride = dst_stride;
}
@@ -527,6 +536,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in
}
radeonAllocDmaRegion(&r300->radeon, &vbuf->attribs[index].bo, &vbuf->attribs[index].bo_offset, size, 32);
+ radeon_bo_map(vbuf->attribs[index].bo, 1);
assert(vbuf->attribs[index].bo->ptr != NULL);
dst = (uint32_t *)ADD_POINTERS(vbuf->attribs[index].bo->ptr, vbuf->attribs[index].bo_offset);
switch (vbuf->attribs[index].dwords) {
@@ -536,6 +546,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in
case 4: radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); break;
default: assert(0); break;
}
+ radeon_bo_unmap(vbuf->attribs[index].bo);
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c
index 99bd22edac..383c8a274b 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -665,11 +665,11 @@ void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
r300EmitCacheFlush(rmesa);
radeonEmitState(&rmesa->radeon);
- r300_emit_scissor(ctx);
+ r300_emit_scissor(ctx);
r300EmitVertexAOS(rmesa,
- rmesa->radeon.swtcl.vertex_size,
- first_elem(&rmesa->radeon.dma.reserved)->bo,
- current_offset);
+ rmesa->radeon.swtcl.vertex_size,
+ rmesa->radeon.swtcl.bo,
+ current_offset);
r300EmitVbufPrim(rmesa,
rmesa->radeon.swtcl.hw_primitive,
diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c
index 47f89c91f8..eab27cbd84 100644
--- a/src/mesa/drivers/dri/r600/r700_render.c
+++ b/src/mesa/drivers/dri/r600/r700_render.c
@@ -526,6 +526,9 @@ static void r700ConvertAttrib(GLcontext *ctx, int count,
radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset,
sizeof(GLfloat) * input->Size * count, 32);
+
+ radeon_bo_map(attr->bo, 1);
+
dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset);
assert(src_ptr != NULL);
@@ -559,6 +562,8 @@ static void r700ConvertAttrib(GLcontext *ctx, int count,
break;
}
+ radeon_bo_unmap(attr->bo);
+
if (mapped_named_bo)
{
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj);
@@ -577,6 +582,8 @@ static void r700AlignDataToDword(GLcontext *ctx,
radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32);
+ radeon_bo_map(attr->bo, 1);
+
if (!input->BufferObj->Pointer)
{
ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj);
@@ -596,6 +603,7 @@ static void r700AlignDataToDword(GLcontext *ctx,
}
}
+ radeon_bo_unmap(attr->bo);
if (mapped_named_bo)
{
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj);
@@ -664,14 +672,18 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input
radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo,
&context->stream_desc[index].bo_offset, size, 32);
+
+ radeon_bo_map(context->stream_desc[index].bo, 1);
assert(context->stream_desc[index].bo->ptr != NULL);
+
+
dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr,
context->stream_desc[index].bo_offset);
switch (context->stream_desc[index].dwords)
{
case 1:
- radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count);
+ radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count);
break;
case 2:
radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count);
@@ -686,6 +698,7 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input
assert(0);
break;
}
+ radeon_bo_unmap(context->stream_desc[index].bo);
}
}
@@ -757,6 +770,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo,
&context->ind_buf.bo_offset, size, 4);
+ radeon_bo_map(context->ind_buf.bo, 1);
assert(context->ind_buf.bo->ptr != NULL);
out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset);
@@ -770,6 +784,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
*out++ = in[i];
}
+ radeon_bo_unmap(context->ind_buf.bo);
#if MESA_BIG_ENDIAN
}
else
@@ -780,6 +795,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo,
&context->ind_buf.bo_offset, size, 4);
+ radeon_bo_map(context->ind_buf.bo, 1);
assert(context->ind_buf.bo->ptr != NULL);
out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset);
@@ -792,6 +808,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
{
*out++ = in[i];
}
+ radeon_bo_unmap(context->ind_buf.bo);
#endif
}
@@ -837,11 +854,13 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo,
&context->ind_buf.bo_offset, size, 4);
+ radeon_bo_map(context->ind_buf.bo, 1);
assert(context->ind_buf.bo->ptr != NULL);
dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset);
_mesa_memcpy(dst_ptr, src_ptr, size);
+ radeon_bo_unmap(context->ind_buf.bo);
context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT);
context->ind_buf.count = mesa_ind_buf->count;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index ded81fff29..ad953ddbb5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -328,6 +328,7 @@ struct radeon_swtcl_info {
GLuint vertex_attr_count;
GLuint emit_prediction;
+ struct radeon_bo *bo;
};
#define RADEON_MAX_AOS_ARRAYS 16
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index c6edbae9a1..2a1bd7357a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -151,6 +151,7 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
aos->components = size;
aos->count = count;
+ radeon_bo_map(aos->bo, 1);
out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
switch (size) {
case 1: radeonEmitVec4(out, data, stride, count); break;
@@ -161,6 +162,7 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
assert(0);
break;
}
+ radeon_bo_unmap(aos->bo);
}
void radeon_init_dma(radeonContextPtr rmesa)
@@ -183,10 +185,6 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
__FUNCTION__, size, rmesa->dma.minimum_size);
- /* unmap old reserved bo */
- if (!is_empty_list(&rmesa->dma.reserved))
- radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
-
if (is_empty_list(&rmesa->dma.free)
|| last_elem(&rmesa->dma.free)->bo->size < size) {
dma_bo = CALLOC_STRUCT(radeon_dma_bo);
@@ -223,8 +221,6 @@ again_alloc:
/* Cmd buff have been flushed in radeon_revalidate_bos */
goto again_alloc;
}
-
- radeon_bo_map(first_elem(&rmesa->dma.reserved)->bo, 1);
}
/* Allocates a region from rmesa->dma.current. If there isn't enough
@@ -281,7 +277,6 @@ void radeonFreeDmaRegions(radeonContextPtr rmesa)
foreach_s(dma_bo, temp, &rmesa->dma.reserved) {
remove_from_list(dma_bo);
- radeon_bo_unmap(dma_bo->bo);
radeon_bo_unref(dma_bo->bo);
FREE(dma_bo);
}
@@ -367,9 +362,6 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
insert_at_tail(&rmesa->dma.free, dma_bo);
}
- /* unmap the last dma region */
- if (!is_empty_list(&rmesa->dma.reserved))
- radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
/* move reserved to wait list */
foreach_s(dma_bo, temp, &rmesa->dma.reserved) {
/* free objects that are too small to be used because of large request */
@@ -403,11 +395,12 @@ void rcommon_flush_last_swtcl_prim( GLcontext *ctx )
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct radeon_dma *dma = &rmesa->dma;
-
if (RADEON_DEBUG & RADEON_IOCTL)
fprintf(stderr, "%s\n", __FUNCTION__);
dma->flush = NULL;
+ radeon_bo_unmap(rmesa->swtcl.bo);
+
if (!is_empty_list(&dma->reserved)) {
GLuint current_offset = dma->current_used;
@@ -422,6 +415,8 @@ void rcommon_flush_last_swtcl_prim( GLcontext *ctx )
}
rmesa->swtcl.numverts = 0;
}
+ radeon_bo_unref(rmesa->swtcl.bo);
+ rmesa->swtcl.bo = NULL;
}
/* Alloc space in the current dma region.
*/
@@ -432,6 +427,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
void *head;
if (RADEON_DEBUG & RADEON_IOCTL)
fprintf(stderr, "%s\n", __FUNCTION__);
+
if(is_empty_list(&rmesa->dma.reserved)
||rmesa->dma.current_vertexptr + bytes > first_elem(&rmesa->dma.reserved)->bo->size) {
if (rmesa->dma.flush) {
@@ -455,7 +451,11 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
rmesa->dma.current_vertexptr );
- head = (first_elem(&rmesa->dma.reserved)->bo->ptr + rmesa->dma.current_vertexptr);
+ rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo;
+ radeon_bo_ref(rmesa->swtcl.bo);
+ radeon_bo_map(rmesa->swtcl.bo, 1);
+
+ head = (rmesa->swtcl.bo->ptr + rmesa->dma.current_vertexptr);
rmesa->dma.current_vertexptr += bytes;
rmesa->swtcl.numverts += nverts;
return head;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index de18d2ddd6..d810e6080e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -76,12 +76,14 @@ static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
/* Emit the data
*/
+ radeon_bo_map(aos->bo, 1);
out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
for (i = 0; i < count; i++) {
out[0] = radeonComputeFogBlendFactor( ctx, *(GLfloat *)data );
out++;
data += stride;
}
+ radeon_bo_unmap(aos->bo);
}
static void emit_s0_vec(uint32_t *out, GLvoid *data, int stride, int count)
@@ -151,6 +153,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
/* Emit the data
*/
+ radeon_bo_map(aos->bo, 1);
out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
switch (size) {
case 1:
@@ -170,6 +173,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
exit(1);
break;
}
+ radeon_bo_unmap(aos->bo);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index 5ed11d0a9d..98f96ff2a7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -420,10 +420,10 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
-
+ radeon_bo_map(rmesa->radeon.tcl.aos[0].bo, 1);
setup_tab[i].emit( ctx, 0, VB->Count,
rmesa->radeon.tcl.aos[0].bo->ptr + rmesa->radeon.tcl.aos[0].offset);
-
+ radeon_bo_unmap(rmesa->radeon.tcl.aos[0].bo);
// rmesa->radeon.tcl.aos[0].size = setup_tab[i].vertex_size;
rmesa->radeon.tcl.aos[0].stride = setup_tab[i].vertex_size;
rmesa->tcl.vertex_format = setup_tab[i].vertex_format;
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index 6bbe8e252e..8bf1bfbc57 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -309,7 +309,7 @@ void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
radeonEmitState(&rmesa->radeon);
radeonEmitVertexAOS( rmesa,
rmesa->radeon.swtcl.vertex_size,
- first_elem(&rmesa->radeon.dma.reserved)->bo,
+ rmesa->radeon.swtcl.bo,
current_offset);
--
cgit v1.2.3
From 2176b3ed9ab832122e56aed3242dfda102a5fec6 Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Tue, 24 Nov 2009 11:56:45 +1000
Subject: r300: fix swtcl bo leak problem.
We can get a lot of swtcl bo allocations - need to probably abstract
this a bit further.
Signed-off-by: Dave Airlie
---
src/mesa/drivers/dri/radeon/radeon_dma.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index 2a1bd7357a..89a99974e2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -451,9 +451,11 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
rmesa->dma.current_vertexptr );
- rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo;
- radeon_bo_ref(rmesa->swtcl.bo);
- radeon_bo_map(rmesa->swtcl.bo, 1);
+ if (!rmesa->swtcl.bo) {
+ rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo;
+ radeon_bo_ref(rmesa->swtcl.bo);
+ radeon_bo_map(rmesa->swtcl.bo, 1);
+ }
head = (rmesa->swtcl.bo->ptr + rmesa->dma.current_vertexptr);
rmesa->dma.current_vertexptr += bytes;
--
cgit v1.2.3
From 57221c54387a43e268a80ee6b578d57e03efcc5e Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 08:55:40 +0100
Subject: gallium: Refactor the instruction predicate TGSI token.
Rename it to tgsi_instruction_predicate -- it's no longer an extended
token. Its presence is indicated by a new flag in tgsi_instruction that
indicates whether an instruction is predicated.
Also, change predicate index representation to match the other
tokens that specify register indices.
---
src/gallium/include/pipe/p_shader_tokens.h | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index d4c8aadaf9..c4c28522c8 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -293,6 +293,8 @@ union tgsi_immediate_data
* respectively. For a given operation code, those numbers are fixed and are
* present here only for convenience.
*
+ * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows.
+ *
* If Extended is TRUE, it is now executed.
*
* Saturate controls how are final results in destination registers modified.
@@ -306,7 +308,8 @@ struct tgsi_instruction
unsigned Saturate : 2; /* TGSI_SAT_ */
unsigned NumDstRegs : 2; /* UINT */
unsigned NumSrcRegs : 4; /* UINT */
- unsigned Padding : 3;
+ unsigned Predicate : 1; /* BOOL */
+ unsigned Padding : 2;
unsigned Extended : 1; /* BOOL */
};
@@ -323,7 +326,6 @@ struct tgsi_instruction
#define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1
#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2
-#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
struct tgsi_instruction_ext
{
@@ -339,9 +341,6 @@ struct tgsi_instruction_ext
* If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
* should be cast to tgsi_instruction_ext_texture.
*
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
- * should be cast to tgsi_instruction_ext_predicate.
- *
* If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
* follows.
*/
@@ -382,17 +381,15 @@ struct tgsi_instruction_ext_texture
* For SM3, the following constraint applies.
* - Swizzle is either set to identity or replicate.
*/
-struct tgsi_instruction_ext_predicate
+struct tgsi_instruction_predicate
{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
+ int Index : 16; /* SINT */
unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */
unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */
unsigned Negate : 1; /* BOOL */
- unsigned SrcIndex : 8; /* UINT */
- unsigned Padding : 10;
- unsigned Extended : 1; /* BOOL */
+ unsigned Padding : 7;
};
/**
--
cgit v1.2.3
From 5ee0d9f632383339088cc33005b7794b0915d4e0 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 09:01:48 +0100
Subject: tgsi: Account for gallium shader token representation changes.
---
src/gallium/auxiliary/tgsi/tgsi_build.c | 166 +++++++++++++++-----------------
src/gallium/auxiliary/tgsi/tgsi_build.h | 32 +++---
src/gallium/auxiliary/tgsi/tgsi_parse.c | 8 +-
src/gallium/auxiliary/tgsi/tgsi_parse.h | 2 +-
src/gallium/auxiliary/tgsi/tgsi_ureg.c | 30 +++---
5 files changed, 106 insertions(+), 132 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 4fa10e2f7e..9791e58db3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -419,6 +419,7 @@ tgsi_default_instruction( void )
instruction.NrTokens = 1;
instruction.Opcode = TGSI_OPCODE_MOV;
instruction.Saturate = TGSI_SAT_NONE;
+ instruction.Predicate = 0;
instruction.NumDstRegs = 1;
instruction.NumSrcRegs = 1;
instruction.Padding = 0;
@@ -428,12 +429,12 @@ tgsi_default_instruction( void )
}
struct tgsi_instruction
-tgsi_build_instruction(
- unsigned opcode,
- unsigned saturate,
- unsigned num_dst_regs,
- unsigned num_src_regs,
- struct tgsi_header *header )
+tgsi_build_instruction(unsigned opcode,
+ unsigned saturate,
+ unsigned predicate,
+ unsigned num_dst_regs,
+ unsigned num_src_regs,
+ struct tgsi_header *header)
{
struct tgsi_instruction instruction;
@@ -445,6 +446,7 @@ tgsi_build_instruction(
instruction = tgsi_default_instruction();
instruction.Opcode = opcode;
instruction.Saturate = saturate;
+ instruction.Predicate = predicate;
instruction.NumDstRegs = num_dst_regs;
instruction.NumSrcRegs = num_src_regs;
@@ -472,9 +474,9 @@ tgsi_default_full_instruction( void )
unsigned i;
full_instruction.Instruction = tgsi_default_instruction();
+ full_instruction.InstructionPredicate = tgsi_default_instruction_predicate();
full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label();
full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture();
- full_instruction.InstructionExtPredicate = tgsi_default_instruction_ext_predicate();
for( i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) {
full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register();
}
@@ -504,14 +506,34 @@ tgsi_build_full_instruction(
instruction = (struct tgsi_instruction *) &tokens[size];
size++;
- *instruction = tgsi_build_instruction(
- full_inst->Instruction.Opcode,
- full_inst->Instruction.Saturate,
- full_inst->Instruction.NumDstRegs,
- full_inst->Instruction.NumSrcRegs,
- header );
+ *instruction = tgsi_build_instruction(full_inst->Instruction.Opcode,
+ full_inst->Instruction.Saturate,
+ full_inst->Instruction.Predicate,
+ full_inst->Instruction.NumDstRegs,
+ full_inst->Instruction.NumSrcRegs,
+ header);
prev_token = (struct tgsi_token *) instruction;
+ if (full_inst->Instruction.Predicate) {
+ struct tgsi_instruction_predicate *instruction_predicate;
+
+ if (maxsize <= size) {
+ return 0;
+ }
+ instruction_predicate = (struct tgsi_instruction_predicate *)&tokens[size];
+ size++;
+
+ *instruction_predicate =
+ tgsi_build_instruction_predicate(full_inst->InstructionPredicate.Index,
+ full_inst->InstructionPredicate.Negate,
+ full_inst->InstructionPredicate.SwizzleX,
+ full_inst->InstructionPredicate.SwizzleY,
+ full_inst->InstructionPredicate.SwizzleZ,
+ full_inst->InstructionPredicate.SwizzleW,
+ instruction,
+ header);
+ }
+
if( tgsi_compare_instruction_ext_label(
full_inst->InstructionExtLabel,
tgsi_default_instruction_ext_label() ) ) {
@@ -550,29 +572,6 @@ tgsi_build_full_instruction(
prev_token = (struct tgsi_token *) instruction_ext_texture;
}
- if (tgsi_compare_instruction_ext_predicate(full_inst->InstructionExtPredicate,
- tgsi_default_instruction_ext_predicate())) {
- struct tgsi_instruction_ext_predicate *instruction_ext_predicate;
-
- if (maxsize <= size) {
- return 0;
- }
- instruction_ext_predicate = (struct tgsi_instruction_ext_predicate *)&tokens[size];
- size++;
-
- *instruction_ext_predicate =
- tgsi_build_instruction_ext_predicate(full_inst->InstructionExtPredicate.SrcIndex,
- full_inst->InstructionExtPredicate.Negate,
- full_inst->InstructionExtPredicate.SwizzleX,
- full_inst->InstructionExtPredicate.SwizzleY,
- full_inst->InstructionExtPredicate.SwizzleZ,
- full_inst->InstructionExtPredicate.SwizzleW,
- prev_token,
- instruction,
- header);
- prev_token = (struct tgsi_token *)instruction_ext_predicate;
- }
-
for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) {
const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i];
struct tgsi_dst_register *dst_register;
@@ -746,6 +745,47 @@ tgsi_build_full_instruction(
return size;
}
+struct tgsi_instruction_predicate
+tgsi_default_instruction_predicate(void)
+{
+ struct tgsi_instruction_predicate instruction_predicate;
+
+ instruction_predicate.SwizzleX = TGSI_SWIZZLE_X;
+ instruction_predicate.SwizzleY = TGSI_SWIZZLE_Y;
+ instruction_predicate.SwizzleZ = TGSI_SWIZZLE_Z;
+ instruction_predicate.SwizzleW = TGSI_SWIZZLE_W;
+ instruction_predicate.Negate = 0;
+ instruction_predicate.Index = 0;
+ instruction_predicate.Padding = 0;
+
+ return instruction_predicate;
+}
+
+struct tgsi_instruction_predicate
+tgsi_build_instruction_predicate(int index,
+ unsigned negate,
+ unsigned swizzleX,
+ unsigned swizzleY,
+ unsigned swizzleZ,
+ unsigned swizzleW,
+ struct tgsi_instruction *instruction,
+ struct tgsi_header *header)
+{
+ struct tgsi_instruction_predicate instruction_predicate;
+
+ instruction_predicate = tgsi_default_instruction_predicate();
+ instruction_predicate.SwizzleX = swizzleX;
+ instruction_predicate.SwizzleY = swizzleY;
+ instruction_predicate.SwizzleZ = swizzleZ;
+ instruction_predicate.SwizzleW = swizzleW;
+ instruction_predicate.Negate = negate;
+ instruction_predicate.Index = index;
+
+ instruction_grow(instruction, header);
+
+ return instruction_predicate;
+}
+
/** test for inequality of 32-bit values pointed to by a and b */
static INLINE boolean
compare32(const void *a, const void *b)
@@ -835,60 +875,6 @@ tgsi_build_instruction_ext_texture(
return instruction_ext_texture;
}
-struct tgsi_instruction_ext_predicate
-tgsi_default_instruction_ext_predicate(void)
-{
- struct tgsi_instruction_ext_predicate instruction_ext_predicate;
-
- instruction_ext_predicate.Type = TGSI_INSTRUCTION_EXT_TYPE_PREDICATE;
- instruction_ext_predicate.SwizzleX = TGSI_SWIZZLE_X;
- instruction_ext_predicate.SwizzleY = TGSI_SWIZZLE_Y;
- instruction_ext_predicate.SwizzleZ = TGSI_SWIZZLE_Z;
- instruction_ext_predicate.SwizzleW = TGSI_SWIZZLE_W;
- instruction_ext_predicate.Negate = 0;
- instruction_ext_predicate.SrcIndex = 0;
- instruction_ext_predicate.Padding = 0;
- instruction_ext_predicate.Extended = 0;
-
- return instruction_ext_predicate;
-}
-
-unsigned
-tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a,
- struct tgsi_instruction_ext_predicate b)
-{
- a.Padding = b.Padding = 0;
- a.Extended = b.Extended = 0;
- return compare32(&a, &b);
-}
-
-struct tgsi_instruction_ext_predicate
-tgsi_build_instruction_ext_predicate(unsigned index,
- unsigned negate,
- unsigned swizzleX,
- unsigned swizzleY,
- unsigned swizzleZ,
- unsigned swizzleW,
- struct tgsi_token *prev_token,
- struct tgsi_instruction *instruction,
- struct tgsi_header *header)
-{
- struct tgsi_instruction_ext_predicate instruction_ext_predicate;
-
- instruction_ext_predicate = tgsi_default_instruction_ext_predicate();
- instruction_ext_predicate.SwizzleX = swizzleX;
- instruction_ext_predicate.SwizzleY = swizzleY;
- instruction_ext_predicate.SwizzleZ = swizzleZ;
- instruction_ext_predicate.SwizzleW = swizzleW;
- instruction_ext_predicate.Negate = negate;
- instruction_ext_predicate.SrcIndex = index;
-
- prev_token->Extended = 1;
- instruction_grow(instruction, header);
-
- return instruction_ext_predicate;
-}
-
struct tgsi_src_register
tgsi_default_src_register( void )
{
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h
index 669712eb8f..0fe5f229d3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.h
@@ -143,6 +143,7 @@ struct tgsi_instruction
tgsi_build_instruction(
unsigned opcode,
unsigned saturate,
+ unsigned predicate,
unsigned num_dst_regs,
unsigned num_src_regs,
struct tgsi_header *header );
@@ -157,6 +158,19 @@ tgsi_build_full_instruction(
struct tgsi_header *header,
unsigned maxsize );
+struct tgsi_instruction_predicate
+tgsi_default_instruction_predicate(void);
+
+struct tgsi_instruction_predicate
+tgsi_build_instruction_predicate(int index,
+ unsigned negate,
+ unsigned swizzleX,
+ unsigned swizzleY,
+ unsigned swizzleZ,
+ unsigned swizzleW,
+ struct tgsi_instruction *instruction,
+ struct tgsi_header *header);
+
struct tgsi_instruction_ext_label
tgsi_default_instruction_ext_label( void );
@@ -187,24 +201,6 @@ tgsi_build_instruction_ext_texture(
struct tgsi_instruction *instruction,
struct tgsi_header *header );
-struct tgsi_instruction_ext_predicate
-tgsi_default_instruction_ext_predicate(void);
-
-unsigned
-tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a,
- struct tgsi_instruction_ext_predicate b);
-
-struct tgsi_instruction_ext_predicate
-tgsi_build_instruction_ext_predicate(unsigned index,
- unsigned negate,
- unsigned swizzleX,
- unsigned swizzleY,
- unsigned swizzleZ,
- unsigned swizzleW,
- struct tgsi_token *prev_token,
- struct tgsi_instruction *instruction,
- struct tgsi_header *header);
-
struct tgsi_src_register
tgsi_default_src_register( void );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 83f9df1183..9ca2993452 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -175,6 +175,10 @@ tgsi_parse_token(
copy_token(&inst->Instruction, &token);
extended = inst->Instruction.Extended;
+ if (inst->Instruction.Predicate) {
+ next_token(ctx, &inst->InstructionPredicate);
+ }
+
while( extended ) {
struct tgsi_src_register_ext token;
@@ -189,10 +193,6 @@ tgsi_parse_token(
copy_token(&inst->InstructionExtTexture, &token);
break;
- case TGSI_INSTRUCTION_EXT_TYPE_PREDICATE:
- copy_token(&inst->InstructionExtPredicate, &token);
- break;
-
default:
assert( 0 );
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h
index 76f1676d85..cb4772ade8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h
@@ -80,9 +80,9 @@ struct tgsi_full_immediate
struct tgsi_full_instruction
{
struct tgsi_instruction Instruction;
+ struct tgsi_instruction_predicate InstructionPredicate;
struct tgsi_instruction_ext_label InstructionExtLabel;
struct tgsi_instruction_ext_texture InstructionExtTexture;
- struct tgsi_instruction_ext_predicate InstructionExtPredicate;
struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
uint Flags; /**< user-defined usage */
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 3f752e9352..61cd3bf407 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -47,9 +47,9 @@ union tgsi_any_token {
struct tgsi_immediate imm;
union tgsi_immediate_data imm_data;
struct tgsi_instruction insn;
+ struct tgsi_instruction_predicate insn_predicate;
struct tgsi_instruction_ext_label insn_ext_label;
struct tgsi_instruction_ext_texture insn_ext_texture;
- struct tgsi_instruction_ext_predicate insn_ext_predicate;
struct tgsi_src_register src;
struct tgsi_src_register_ext_mod src_ext_mod;
struct tgsi_dimension dim;
@@ -661,35 +661,27 @@ ureg_emit_insn(struct ureg_program *ureg,
validate( opcode, num_dst, num_src );
out = get_tokens( ureg, DOMAIN_INSN, count );
- out[0].value = 0;
- out[0].insn.Type = TGSI_TOKEN_TYPE_INSTRUCTION;
- out[0].insn.NrTokens = 0;
+ out[0].insn = tgsi_default_instruction();
out[0].insn.Opcode = opcode;
out[0].insn.Saturate = saturate;
out[0].insn.NumDstRegs = num_dst;
out[0].insn.NumSrcRegs = num_src;
- out[0].insn.Padding = 0;
result.insn_token = ureg->domain[DOMAIN_INSN].count - count;
+ result.extended_token = result.insn_token;
if (predicate) {
- out[0].insn.Extended = 1;
- out[1].insn_ext_predicate = tgsi_default_instruction_ext_predicate();
- out[1].insn_ext_predicate.Negate = pred_negate;
- out[1].insn_ext_predicate.SwizzleX = pred_swizzle_x;
- out[1].insn_ext_predicate.SwizzleY = pred_swizzle_y;
- out[1].insn_ext_predicate.SwizzleZ = pred_swizzle_z;
- out[1].insn_ext_predicate.SwizzleW = pred_swizzle_w;
-
- result.extended_token = result.insn_token + 1;
- } else {
- out[0].insn.Extended = 0;
-
- result.extended_token = result.insn_token;
+ out[0].insn.Predicate = 1;
+ out[1].insn_predicate = tgsi_default_instruction_predicate();
+ out[1].insn_predicate.Negate = pred_negate;
+ out[1].insn_predicate.SwizzleX = pred_swizzle_x;
+ out[1].insn_predicate.SwizzleY = pred_swizzle_y;
+ out[1].insn_predicate.SwizzleZ = pred_swizzle_z;
+ out[1].insn_predicate.SwizzleW = pred_swizzle_w;
}
ureg->nr_instructions++;
-
+
return result;
}
--
cgit v1.2.3
From 59a70c364df03c34abc72bca2cdca8fae12d8f68 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 09:02:29 +0100
Subject: tgsi: Add ureg_DECL_loop().
---
src/gallium/auxiliary/tgsi/tgsi_ureg.c | 22 ++++++++++++++++++++++
src/gallium/auxiliary/tgsi/tgsi_ureg.h | 3 +++
2 files changed, 25 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 61cd3bf407..5526a5d034 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -72,6 +72,7 @@ struct ureg_tokens {
#define UREG_MAX_IMMEDIATE 32
#define UREG_MAX_TEMP 256
#define UREG_MAX_ADDR 2
+#define UREG_MAX_LOOP 1
#define UREG_MAX_PRED 1
#define DOMAIN_DECL 0
@@ -117,6 +118,7 @@ struct ureg_program
unsigned nr_addrs;
unsigned nr_preds;
+ unsigned nr_loops;
unsigned nr_instructions;
struct ureg_tokens domain[2];
@@ -417,6 +419,19 @@ struct ureg_dst ureg_DECL_address( struct ureg_program *ureg )
return ureg_dst_register( TGSI_FILE_ADDRESS, 0 );
}
+/* Allocate a new loop register.
+ */
+struct ureg_dst
+ureg_DECL_loop(struct ureg_program *ureg)
+{
+ if (ureg->nr_loops < UREG_MAX_LOOP) {
+ return ureg_dst_register(TGSI_FILE_LOOP, ureg->nr_loops++);
+ }
+
+ assert(0);
+ return ureg_dst_register(TGSI_FILE_LOOP, 0);
+}
+
/* Allocate a new predicate register.
*/
struct ureg_dst
@@ -1015,6 +1030,13 @@ static void emit_decls( struct ureg_program *ureg )
0, ureg->nr_addrs );
}
+ if (ureg->nr_loops) {
+ emit_decl_range(ureg,
+ TGSI_FILE_LOOP,
+ 0,
+ ureg->nr_loops);
+ }
+
if (ureg->nr_preds) {
emit_decl_range(ureg,
TGSI_FILE_PREDICATE,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index dae4291194..94cc70a208 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -157,6 +157,9 @@ ureg_release_temporary( struct ureg_program *ureg,
struct ureg_dst
ureg_DECL_address( struct ureg_program * );
+struct ureg_dst
+ureg_DECL_loop( struct ureg_program * );
+
struct ureg_dst
ureg_DECL_predicate(struct ureg_program *);
--
cgit v1.2.3
From 0c54d76f3783091267cb18e6bd23697d024c95b2 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 09:03:41 +0100
Subject: tgsi: Implement predicated instructions in exec.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 52 ++++++++++++++++++++++++++++++----
src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 +
2 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index af914f6d08..89740cee89 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -369,6 +369,7 @@ tgsi_exec_machine_create( void )
memset(mach, 0, sizeof(*mach));
mach->Addrs = &mach->Temps[TGSI_EXEC_TEMP_ADDR];
+ mach->Predicates = &mach->Temps[TGSI_EXEC_TEMP_P0];
/* Setup constants. */
for( i = 0; i < 4; i++ ) {
@@ -1194,10 +1195,10 @@ fetch_src_file_channel(
assert(index->i[1] < TGSI_EXEC_NUM_PREDS);
assert(index->i[2] < TGSI_EXEC_NUM_PREDS);
assert(index->i[3] < TGSI_EXEC_NUM_PREDS);
- chan->u[0] = mach->Addrs[0].xyzw[swizzle].u[0];
- chan->u[1] = mach->Addrs[0].xyzw[swizzle].u[1];
- chan->u[2] = mach->Addrs[0].xyzw[swizzle].u[2];
- chan->u[3] = mach->Addrs[0].xyzw[swizzle].u[3];
+ chan->u[0] = mach->Predicates[0].xyzw[swizzle].u[0];
+ chan->u[1] = mach->Predicates[0].xyzw[swizzle].u[1];
+ chan->u[2] = mach->Predicates[0].xyzw[swizzle].u[2];
+ chan->u[3] = mach->Predicates[0].xyzw[swizzle].u[3];
break;
case TGSI_FILE_OUTPUT:
@@ -1489,7 +1490,7 @@ store_dest(
case TGSI_FILE_PREDICATE:
index = reg->DstRegister.Index;
assert(index < TGSI_EXEC_NUM_PREDS);
- dst = &mach->Addrs[index].xyzw[chan_index];
+ dst = &mach->Predicates[index].xyzw[chan_index];
break;
default:
@@ -1497,6 +1498,47 @@ store_dest(
return;
}
+ if (inst->Instruction.Predicate) {
+ uint swizzle;
+ union tgsi_exec_channel *pred;
+
+ switch (chan_index) {
+ case CHAN_X:
+ swizzle = inst->InstructionPredicate.SwizzleX;
+ break;
+ case CHAN_Y:
+ swizzle = inst->InstructionPredicate.SwizzleY;
+ break;
+ case CHAN_Z:
+ swizzle = inst->InstructionPredicate.SwizzleZ;
+ break;
+ case CHAN_W:
+ swizzle = inst->InstructionPredicate.SwizzleW;
+ break;
+ default:
+ assert(0);
+ return;
+ }
+
+ assert(inst->InstructionPredicate.Index == 0);
+
+ pred = &mach->Predicates[inst->InstructionPredicate.Index].xyzw[swizzle];
+
+ if (inst->InstructionPredicate.Negate) {
+ for (i = 0; i < QUAD_SIZE; i++) {
+ if (pred->u[i]) {
+ execmask &= ~(1 << i);
+ }
+ }
+ } else {
+ for (i = 0; i < QUAD_SIZE; i++) {
+ if (!pred->u[i]) {
+ execmask &= ~(1 << i);
+ }
+ }
+ }
+ }
+
switch (inst->Instruction.Saturate) {
case TGSI_SAT_NONE:
for (i = 0; i < QUAD_SIZE; i++)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 3dff69a505..fd94c1bc44 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -218,6 +218,7 @@ struct tgsi_exec_machine
struct tgsi_exec_vector Outputs[PIPE_MAX_ATTRIBS];
struct tgsi_exec_vector *Addrs;
+ struct tgsi_exec_vector *Predicates;
struct tgsi_sampler **Samplers;
--
cgit v1.2.3
From 53d9b7d361915d6cf33b73017789e746342cc453 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 11:17:16 +0100
Subject: mesa: Fix pointer arithmetic.
---
src/mesa/main/texgetimage.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 008407210d..bd7cc8d278 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -554,7 +554,9 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
GLuint bw, bh;
_mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
- memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride);
+ memcpy((GLubyte *)img + i * row_stride,
+ (GLubyte *)texImage->Data + i * row_stride_stored,
+ row_stride);
}
}
--
cgit v1.2.3
From bae9ece685e3c10fc0118e99771845d15895a0cc Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 11:22:03 +0100
Subject: slang: Fix allocation size.
We don't need 16K+ to store a single pointer.
---
src/mesa/shader/slang/slang_emit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index fe39b46dbb..99eb254cee 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -81,8 +81,8 @@ new_subroutine(slang_emit_info *emitInfo, GLuint *id)
emitInfo->Subroutines = (struct gl_program **)
_mesa_realloc(emitInfo->Subroutines,
- n * sizeof(struct gl_program),
- (n + 1) * sizeof(struct gl_program));
+ n * sizeof(struct gl_program *),
+ (n + 1) * sizeof(struct gl_program *));
emitInfo->Subroutines[n] = ctx->Driver.NewProgram(ctx, emitInfo->prog->Target, 0);
emitInfo->Subroutines[n]->Parameters = emitInfo->prog->Parameters;
emitInfo->NumSubroutines++;
--
cgit v1.2.3
From 3c46bbee1bb4f107d68addae472cf7bbc0976653 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Tue, 24 Nov 2009 11:58:01 +0100
Subject: tgsi: Document Declaration Semantic token and FACE semantic name.
---
.../auxiliary/tgsi/tgsi-instruction-set.txt | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
index eb492076b7..080fd4c731 100644
--- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
+++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
@@ -1129,3 +1129,35 @@ TGSI Instruction Specification
target Label of target instruction.
+
+3 Other tokens
+===============
+
+
+3.1 Declaration Semantic
+-------------------------
+
+
+ Follows Declaration token if Semantic bit is set.
+
+ Since its purpose is to link a shader with other stages of the pipeline,
+ it is valid to follow only those Declaration tokens that declare a register
+ either in INPUT or OUTPUT file.
+
+ SemanticName field contains the semantic name of the register being declared.
+ There is no default value.
+
+ SemanticIndex is an optional subscript that can be used to distinguish
+ different register declarations with the same semantic name. The default value
+ is 0.
+
+ The meanings of the individual semantic names are explained in the following
+ sections.
+
+
+3.1.1 FACE
+
+ Valid only in a fragment shader INPUT declaration.
+
+ FACE.x is negative when the primitive is back facing. FACE.x is positive
+ when the primitive is front facing.
--
cgit v1.2.3
From 52df532b02594e624bddd58ee60fd25075f8ec42 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 10 Nov 2009 16:55:44 -0800
Subject: llvmpipe: Fix typo in comparison operator.
---
src/gallium/drivers/llvmpipe/lp_bld_depth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
index 98ec1cb1b9..d438c0e63d 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -90,7 +90,7 @@ lp_depth_type(const struct util_format_description *format_desc,
if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_FLOAT) {
type.floating = TRUE;
- assert(swizzle = 0);
+ assert(swizzle == 0);
assert(format_desc->channel[swizzle].size == format_desc->block.bits);
}
else if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED) {
--
cgit v1.2.3
From c6d663e6dc8799a178b03bc3059ef5c5c3d7f629 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 10 Nov 2009 16:56:43 -0800
Subject: wgl: Fix copy'n'paste typo in comment.
---
src/gallium/state_trackers/wgl/stw_winsys.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h
index 1ead47d6e6..1de6e906d0 100644
--- a/src/gallium/state_trackers/wgl/stw_winsys.h
+++ b/src/gallium/state_trackers/wgl/stw_winsys.h
@@ -73,7 +73,7 @@ struct stw_winsys
HANDLE hSharedSurface);
/**
- * Open a shared surface (optional).
+ * Close a shared surface (optional).
*/
void
(*shared_surface_close)(struct pipe_screen *screen,
--
cgit v1.2.3
From b375526b50271317868a20484c8a1f36707e6005 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 10 Nov 2009 17:51:06 -0800
Subject: llvmpipe: Be more conservative with the supported formats.
We'll likely support much more formats, but doing this allows to run
more testsuites without immediately hit assertion failures.
---
src/gallium/drivers/llvmpipe/lp_screen.c | 58 ++++++++++++++++++++++++++++----
1 file changed, 51 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 0518927458..0fb133486a 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -27,6 +27,7 @@
#include "util/u_memory.h"
+#include "util/u_format.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -131,17 +132,17 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
struct llvmpipe_winsys *winsys = screen->winsys;
+ const struct util_format_description *format_desc;
+
+ format_desc = util_format_description(format);
+ if(!format_desc)
+ return FALSE;
assert(target == PIPE_TEXTURE_1D ||
target == PIPE_TEXTURE_2D ||
target == PIPE_TEXTURE_3D ||
target == PIPE_TEXTURE_CUBE);
- if(format == PIPE_FORMAT_Z16_UNORM)
- return FALSE;
- if(format == PIPE_FORMAT_S8_UNORM)
- return FALSE;
-
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
@@ -152,8 +153,51 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
break;
}
- if(tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
- return winsys->is_displaytarget_format_supported(winsys, format);
+ if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
+ if(format_desc->block.width != 1 ||
+ format_desc->block.height != 1)
+ return FALSE;
+
+ if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR &&
+ format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+ format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY)
+ return FALSE;
+
+ if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
+ format_desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB)
+ return FALSE;
+ }
+
+ if(tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
+ if(!winsys->is_displaytarget_format_supported(winsys, format))
+ return FALSE;
+ }
+
+ if(tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
+ if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
+ return FALSE;
+
+ /* FIXME: Temporary restriction. See lp_state_fs.c. */
+ if(format_desc->block.bits != 32)
+ return FALSE;
+ }
+
+ /* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
+ if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
+ if(format_desc->block.width != 1 ||
+ format_desc->block.height != 1)
+ return FALSE;
+
+ if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR &&
+ format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+ format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY)
+ return FALSE;
+
+ if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
+ format_desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB &&
+ format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
+ return FALSE;
+ }
return TRUE;
}
--
cgit v1.2.3
From 2282fb7710d386bd10ccdd18f030069fae0a5d55 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 10 Nov 2009 17:52:53 -0800
Subject: llvmpipe: Use the generic conversion routine for depths.
This allows for z32f depth format to work correctly.
---
src/gallium/drivers/llvmpipe/lp_state_fs.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 2e9aa9fffe..2bde24430e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -148,6 +148,20 @@ generate_depth(LLVMBuilderRef builder,
format_desc = util_format_description(key->zsbuf_format);
assert(format_desc);
+ /*
+ * Depths are expected to be between 0 and 1, even if they are stored in
+ * floats. Setting these bits here will ensure that the lp_build_conv() call
+ * below won't try to unnecessarily clamp the incoming values.
+ */
+ if(src_type.floating) {
+ src_type.sign = FALSE;
+ src_type.norm = TRUE;
+ }
+ else {
+ assert(!src_type.sign);
+ assert(src_type.norm);
+ }
+
/* Pick the depth type. */
dst_type = lp_depth_type(format_desc, src_type.width*src_type.length);
@@ -155,14 +169,11 @@ generate_depth(LLVMBuilderRef builder,
assert(dst_type.width == src_type.width);
assert(dst_type.length == src_type.length);
-#if 1
- src = lp_build_clamped_float_to_unsigned_norm(builder,
- src_type,
- dst_type.width,
- src);
-#else
lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1);
-#endif
+
+ dst_ptr = LLVMBuildBitCast(builder,
+ dst_ptr,
+ LLVMPointerType(lp_build_vec_type(dst_type), 0), "");
lp_build_depth_test(builder,
&key->depth,
--
cgit v1.2.3
From 066991c8d147db94b9661361bb191919b962fc4e Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Sun, 15 Nov 2009 06:46:48 -0800
Subject: llvmpipe: Fix memory leak.
---
src/gallium/drivers/llvmpipe/lp_state_vs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/llvmpipe/lp_state_vs.c b/src/gallium/drivers/llvmpipe/lp_state_vs.c
index 15c3029614..8a761648e7 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_vs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_vs.c
@@ -92,5 +92,6 @@ llvmpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
(struct lp_vertex_shader *)vs;
draw_delete_vertex_shader(llvmpipe->draw, state->draw_data);
+ FREE( (void *)state->shader.tokens );
FREE( state );
}
--
cgit v1.2.3
From 4ae3e88dc9856f2f32c37dd04a3321765ed61e07 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Mon, 23 Nov 2009 11:21:11 +0000
Subject: llvmpipe: Use assert instead of abort. Only verify functions on debug
builds.
---
src/gallium/drivers/llvmpipe/lp_jit.c | 2 +-
src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 13535dd638..c601c79480 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -167,7 +167,7 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
if (LLVMCreateJITCompiler(&screen->engine, screen->provider, 1, &error)) {
_debug_printf("%s\n", error);
LLVMDisposeMessage(error);
- abort();
+ assert(0);
}
screen->target = LLVMGetExecutionEngineTargetData(screen->engine);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 2bde24430e..ee0f69b2af 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -622,10 +622,12 @@ generate_fragment(struct llvmpipe_context *lp,
* Translate the LLVM IR into machine code.
*/
+#ifdef DEBUG
if(LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) {
LLVMDumpValue(variant->function);
- abort();
+ assert(0);
}
+#endif
LLVMRunFunctionPassManager(screen->pass, variant->function);
--
cgit v1.2.3
From 1325361abe0f1f89c3f675f04e482f580033abe9 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 24 Nov 2009 14:24:38 +0000
Subject: util: Describe a few more formats.
---
src/gallium/auxiliary/util/u_format.csv | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index f1bf94f17d..b9cc2aa716 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -97,3 +97,13 @@ PIPE_FORMAT_B8G8R8A8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyxw,
PIPE_FORMAT_B8G8R8X8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyx1, srgb
PIPE_FORMAT_X8UB8UG8SR8S_NORM , arith , 1, 1, sn8 , sn8 , un8 , x8 , 1zyx, rgb
PIPE_FORMAT_B6UG5SR5S_NORM , arith , 1, 1, sn5 , sn5 , un6 , , xyz1, rgb
+PIPE_FORMAT_YCBCR , yuv , 2, 1, x32 , , , , xyz1, yuv
+PIPE_FORMAT_YCBCR_REV , yuv , 2, 1, x32 , , , , xyz1, yuv
+PIPE_FORMAT_DXT1_RGBA , dxt , 4, 4, x64 , , , , xyzw, rgb
+PIPE_FORMAT_DXT1_RGB , dxt , 4, 4, x64 , , , , xyz1, rgb
+PIPE_FORMAT_DXT3_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_DXT5_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_DXT1_SRGBA , dxt , 4, 4, x64 , , , , xyzw, srgb
+PIPE_FORMAT_DXT1_SRGB , dxt , 4, 4, x64 , , , , xyz1, srgb
+PIPE_FORMAT_DXT3_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb
+PIPE_FORMAT_DXT5_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb
--
cgit v1.2.3
From a71f8365049fb81f63245089b5438dcad6e83b19 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 24 Nov 2009 14:37:45 +0000
Subject: svga: Use consistent file names for dumping facilities.
---
src/gallium/drivers/svga/Makefile | 4 +-
src/gallium/drivers/svga/SConscript | 4 +-
src/gallium/drivers/svga/svga_tgsi.c | 2 +-
src/gallium/drivers/svga/svgadump/st_shader.h | 214 -------
src/gallium/drivers/svga/svgadump/st_shader_dump.c | 649 ---------------------
src/gallium/drivers/svga/svgadump/st_shader_dump.h | 42 --
src/gallium/drivers/svga/svgadump/st_shader_op.c | 168 ------
src/gallium/drivers/svga/svgadump/st_shader_op.h | 46 --
src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +-
src/gallium/drivers/svga/svgadump/svga_dump.py | 2 +-
src/gallium/drivers/svga/svgadump/svga_shader.h | 214 +++++++
.../drivers/svga/svgadump/svga_shader_dump.c | 649 +++++++++++++++++++++
.../drivers/svga/svgadump/svga_shader_dump.h | 42 ++
src/gallium/drivers/svga/svgadump/svga_shader_op.c | 168 ++++++
src/gallium/drivers/svga/svgadump/svga_shader_op.h | 46 ++
15 files changed, 1126 insertions(+), 1126 deletions(-)
delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader.h
delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.c
delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.h
delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.c
delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.h
create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader.h
create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.c
create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.h
create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.c
create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.h
diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile
index d1413319c9..38b63394e3 100644
--- a/src/gallium/drivers/svga/Makefile
+++ b/src/gallium/drivers/svga/Makefile
@@ -4,8 +4,8 @@ include $(TOP)/configs/current
LIBNAME = svga
C_SOURCES = \
- svgadump/st_shader_dump.c \
- svgadump/st_shader_op.c \
+ svgadump/svga_shader_dump.c \
+ svgadump/svga_shader_op.c \
svgadump/svga_dump.c \
svga_cmd.c \
svga_context.c \
diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript
index ff9645fc03..737b791ceb 100644
--- a/src/gallium/drivers/svga/SConscript
+++ b/src/gallium/drivers/svga/SConscript
@@ -60,8 +60,8 @@ sources = [
'svga_tgsi_insn.c',
'svgadump/svga_dump.c',
- 'svgadump/st_shader_dump.c',
- 'svgadump/st_shader_op.c',
+ 'svgadump/svga_shader_dump.c',
+ 'svgadump/svga_shader_op.c',
]
svga = env.ConvenienceLibrary(
diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c
index 44d0930bc0..81eea1a145 100644
--- a/src/gallium/drivers/svga/svga_tgsi.c
+++ b/src/gallium/drivers/svga/svga_tgsi.c
@@ -32,7 +32,7 @@
#include "tgsi/tgsi_scan.h"
#include "util/u_memory.h"
-#include "svgadump/st_shader_dump.h"
+#include "svgadump/svga_shader_dump.h"
#include "svga_context.h"
#include "svga_tgsi.h"
diff --git a/src/gallium/drivers/svga/svgadump/st_shader.h b/src/gallium/drivers/svga/svgadump/st_shader.h
deleted file mode 100644
index 2fc1796a90..0000000000
--- a/src/gallium/drivers/svga/svgadump/st_shader.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/**********************************************************
- * Copyright 2007-2009 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-/**
- * @file
- * SVGA Shader Token Definitions
- *
- * @author Michal Krol
- */
-
-#ifndef ST_SHADER_SVGA_H
-#define ST_SHADER_SVGA_H
-
-#include "pipe/p_compiler.h"
-
-struct sh_op
-{
- unsigned opcode:16;
- unsigned control:8;
- unsigned length:4;
- unsigned predicated:1;
- unsigned unused:1;
- unsigned coissue:1;
- unsigned is_reg:1;
-};
-
-struct sh_reg
-{
- unsigned number:11;
- unsigned type_hi:2;
- unsigned relative:1;
- unsigned unused:14;
- unsigned type_lo:3;
- unsigned is_reg:1;
-};
-
-static INLINE unsigned
-sh_reg_type( struct sh_reg reg )
-{
- return reg.type_lo | (reg.type_hi << 3);
-}
-
-struct sh_cdata
-{
- float xyzw[4];
-};
-
-struct sh_def
-{
- struct sh_op op;
- struct sh_reg reg;
- struct sh_cdata cdata;
-};
-
-struct sh_defb
-{
- struct sh_op op;
- struct sh_reg reg;
- uint data;
-};
-
-struct sh_idata
-{
- int xyzw[4];
-};
-
-struct sh_defi
-{
- struct sh_op op;
- struct sh_reg reg;
- struct sh_idata idata;
-};
-
-#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN
-#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D
-#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE
-#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME
-
-struct ps_sampleinfo
-{
- unsigned unused:27;
- unsigned texture_type:4;
- unsigned is_reg:1;
-};
-
-struct vs_semantic
-{
- unsigned usage:5;
- unsigned unused1:11;
- unsigned usage_index:4;
- unsigned unused2:12;
-};
-
-struct sh_dstreg
-{
- unsigned number:11;
- unsigned type_hi:2;
- unsigned relative:1;
- unsigned unused:2;
- unsigned write_mask:4;
- unsigned modifier:4;
- unsigned shift_scale:4;
- unsigned type_lo:3;
- unsigned is_reg:1;
-};
-
-static INLINE unsigned
-sh_dstreg_type( struct sh_dstreg reg )
-{
- return reg.type_lo | (reg.type_hi << 3);
-}
-
-struct sh_dcl
-{
- struct sh_op op;
- union {
- struct {
- struct ps_sampleinfo sampleinfo;
- } ps;
- struct {
- struct vs_semantic semantic;
- } vs;
- } u;
- struct sh_dstreg reg;
-};
-
-
-struct sh_srcreg
-{
- unsigned number:11;
- unsigned type_hi:2;
- unsigned relative:1;
- unsigned unused:2;
- unsigned swizzle_x:2;
- unsigned swizzle_y:2;
- unsigned swizzle_z:2;
- unsigned swizzle_w:2;
- unsigned modifier:4;
- unsigned type_lo:3;
- unsigned is_reg:1;
-};
-
-static INLINE unsigned
-sh_srcreg_type( struct sh_srcreg reg )
-{
- return reg.type_lo | (reg.type_hi << 3);
-}
-
-struct sh_dstop
-{
- struct sh_op op;
- struct sh_dstreg dst;
-};
-
-struct sh_srcop
-{
- struct sh_op op;
- struct sh_srcreg src;
-};
-
-struct sh_src2op
-{
- struct sh_op op;
- struct sh_srcreg src0;
- struct sh_srcreg src1;
-};
-
-struct sh_unaryop
-{
- struct sh_op op;
- struct sh_dstreg dst;
- struct sh_srcreg src;
-};
-
-struct sh_binaryop
-{
- struct sh_op op;
- struct sh_dstreg dst;
- struct sh_srcreg src0;
- struct sh_srcreg src1;
-};
-
-struct sh_trinaryop
-{
- struct sh_op op;
- struct sh_dstreg dst;
- struct sh_srcreg src0;
- struct sh_srcreg src1;
- struct sh_srcreg src2;
-};
-
-#endif /* ST_SHADER_SVGA_H */
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.c b/src/gallium/drivers/svga/svgadump/st_shader_dump.c
deleted file mode 100644
index d65cc93bfd..0000000000
--- a/src/gallium/drivers/svga/svgadump/st_shader_dump.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/**********************************************************
- * Copyright 2008-2009 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-/**
- * @file
- * SVGA Shader Dump Facilities
- *
- * @author Michal Krol
- */
-
-#include "st_shader.h"
-#include "st_shader_dump.h"
-#include "st_shader_op.h"
-#include "util/u_debug.h"
-
-#include "../svga_hw_reg.h"
-#include "svga3d_shaderdefs.h"
-
-struct dump_info
-{
- SVGA3dShaderVersion version;
- boolean is_ps;
-};
-
-static void dump_op( struct sh_op op, const char *mnemonic )
-{
- assert( op.predicated == 0 );
- assert( op.is_reg == 0 );
-
- if (op.coissue)
- debug_printf( "+" );
- debug_printf( "%s", mnemonic );
- switch (op.control) {
- case 0:
- break;
- case SVGA3DOPCONT_PROJECT:
- debug_printf( "p" );
- break;
- case SVGA3DOPCONT_BIAS:
- debug_printf( "b" );
- break;
- default:
- assert( 0 );
- }
-}
-
-
-static void dump_comp_op( struct sh_op op, const char *mnemonic )
-{
- assert( op.is_reg == 0 );
-
- if (op.coissue)
- debug_printf( "+" );
- debug_printf( "%s", mnemonic );
- switch (op.control) {
- case SVGA3DOPCOMP_RESERVED0:
- break;
- case SVGA3DOPCOMP_GT:
- debug_printf("_gt");
- break;
- case SVGA3DOPCOMP_EQ:
- debug_printf("_eq");
- break;
- case SVGA3DOPCOMP_GE:
- debug_printf("_ge");
- break;
- case SVGA3DOPCOMP_LT:
- debug_printf("_lt");
- break;
- case SVGA3DOPCOMPC_NE:
- debug_printf("_ne");
- break;
- case SVGA3DOPCOMP_LE:
- debug_printf("_le");
- break;
- case SVGA3DOPCOMP_RESERVED1:
- default:
- assert( 0 );
- }
-}
-
-
-static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di )
-{
- assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 );
- assert( reg.is_reg == 1 );
-
- switch (sh_reg_type( reg )) {
- case SVGA3DREG_TEMP:
- debug_printf( "r%u", reg.number );
- break;
-
- case SVGA3DREG_INPUT:
- debug_printf( "v%u", reg.number );
- break;
-
- case SVGA3DREG_CONST:
- if (reg.relative) {
- if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP)
- debug_printf( "c[aL+%u]", reg.number );
- else
- debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
- }
- else
- debug_printf( "c%u", reg.number );
- break;
-
- case SVGA3DREG_ADDR: /* VS */
- /* SVGA3DREG_TEXTURE */ /* PS */
- if (di->is_ps)
- debug_printf( "t%u", reg.number );
- else
- debug_printf( "a%u", reg.number );
- break;
-
- case SVGA3DREG_RASTOUT:
- switch (reg.number) {
- case 0 /*POSITION*/:
- debug_printf( "oPos" );
- break;
- case 1 /*FOG*/:
- debug_printf( "oFog" );
- break;
- case 2 /*POINT_SIZE*/:
- debug_printf( "oPts" );
- break;
- default:
- assert( 0 );
- debug_printf( "???" );
- }
- break;
-
- case SVGA3DREG_ATTROUT:
- assert( reg.number < 2 );
- debug_printf( "oD%u", reg.number );
- break;
-
- case SVGA3DREG_TEXCRDOUT:
- /* SVGA3DREG_OUTPUT */
- debug_printf( "oT%u", reg.number );
- break;
-
- case SVGA3DREG_COLOROUT:
- debug_printf( "oC%u", reg.number );
- break;
-
- case SVGA3DREG_DEPTHOUT:
- debug_printf( "oD%u", reg.number );
- break;
-
- case SVGA3DREG_SAMPLER:
- debug_printf( "s%u", reg.number );
- break;
-
- case SVGA3DREG_CONSTBOOL:
- assert( !reg.relative );
- debug_printf( "b%u", reg.number );
- break;
-
- case SVGA3DREG_CONSTINT:
- assert( !reg.relative );
- debug_printf( "i%u", reg.number );
- break;
-
- case SVGA3DREG_LOOP:
- assert( reg.number == 0 );
- debug_printf( "aL" );
- break;
-
- case SVGA3DREG_MISCTYPE:
- switch (reg.number) {
- case SVGA3DMISCREG_POSITION:
- debug_printf( "vPos" );
- break;
- case SVGA3DMISCREG_FACE:
- debug_printf( "vFace" );
- break;
- default:
- assert(0);
- break;
- }
- break;
-
- case SVGA3DREG_LABEL:
- debug_printf( "l%u", reg.number );
- break;
-
- case SVGA3DREG_PREDICATE:
- debug_printf( "p%u", reg.number );
- break;
-
-
- default:
- assert( 0 );
- debug_printf( "???" );
- }
-}
-
-static void dump_cdata( struct sh_cdata cdata )
-{
- debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] );
-}
-
-static void dump_idata( struct sh_idata idata )
-{
- debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] );
-}
-
-static void dump_bdata( boolean bdata )
-{
- debug_printf( bdata ? "TRUE" : "FALSE" );
-}
-
-static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
-{
- switch (sampleinfo.texture_type) {
- case SVGA3DSAMP_2D:
- debug_printf( "_2d" );
- break;
- case SVGA3DSAMP_CUBE:
- debug_printf( "_cube" );
- break;
- case SVGA3DSAMP_VOLUME:
- debug_printf( "_volume" );
- break;
- default:
- assert( 0 );
- }
-}
-
-
-static void dump_usageinfo( struct vs_semantic semantic )
-{
- switch (semantic.usage) {
- case SVGA3D_DECLUSAGE_POSITION:
- debug_printf("_position" );
- break;
- case SVGA3D_DECLUSAGE_BLENDWEIGHT:
- debug_printf("_blendweight" );
- break;
- case SVGA3D_DECLUSAGE_BLENDINDICES:
- debug_printf("_blendindices" );
- break;
- case SVGA3D_DECLUSAGE_NORMAL:
- debug_printf("_normal" );
- break;
- case SVGA3D_DECLUSAGE_PSIZE:
- debug_printf("_psize" );
- break;
- case SVGA3D_DECLUSAGE_TEXCOORD:
- debug_printf("_texcoord");
- break;
- case SVGA3D_DECLUSAGE_TANGENT:
- debug_printf("_tangent" );
- break;
- case SVGA3D_DECLUSAGE_BINORMAL:
- debug_printf("_binormal" );
- break;
- case SVGA3D_DECLUSAGE_TESSFACTOR:
- debug_printf("_tessfactor" );
- break;
- case SVGA3D_DECLUSAGE_POSITIONT:
- debug_printf("_positiont" );
- break;
- case SVGA3D_DECLUSAGE_COLOR:
- debug_printf("_color" );
- break;
- case SVGA3D_DECLUSAGE_FOG:
- debug_printf("_fog" );
- break;
- case SVGA3D_DECLUSAGE_DEPTH:
- debug_printf("_depth" );
- break;
- case SVGA3D_DECLUSAGE_SAMPLE:
- debug_printf("_sample");
- break;
- default:
- assert( 0 );
- return;
- }
-
- if (semantic.usage_index != 0) {
- debug_printf("%d", semantic.usage_index );
- }
-}
-
-static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
-{
- union {
- struct sh_reg reg;
- struct sh_dstreg dstreg;
- } u;
-
- assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier );
-
- if (dstreg.modifier & SVGA3DDSTMOD_SATURATE)
- debug_printf( "_sat" );
- if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION)
- debug_printf( "_pp" );
- switch (dstreg.shift_scale) {
- case 0:
- break;
- case 1:
- debug_printf( "_x2" );
- break;
- case 2:
- debug_printf( "_x4" );
- break;
- case 3:
- debug_printf( "_x8" );
- break;
- case 13:
- debug_printf( "_d8" );
- break;
- case 14:
- debug_printf( "_d4" );
- break;
- case 15:
- debug_printf( "_d2" );
- break;
- default:
- assert( 0 );
- }
- debug_printf( " " );
-
- u.dstreg = dstreg;
- dump_reg( u.reg, NULL, di );
- if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) {
- debug_printf( "." );
- if (dstreg.write_mask & SVGA3DWRITEMASK_0)
- debug_printf( "x" );
- if (dstreg.write_mask & SVGA3DWRITEMASK_1)
- debug_printf( "y" );
- if (dstreg.write_mask & SVGA3DWRITEMASK_2)
- debug_printf( "z" );
- if (dstreg.write_mask & SVGA3DWRITEMASK_3)
- debug_printf( "w" );
- }
-}
-
-static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di )
-{
- union {
- struct sh_reg reg;
- struct sh_srcreg srcreg;
- } u;
-
- switch (srcreg.modifier) {
- case SVGA3DSRCMOD_NEG:
- case SVGA3DSRCMOD_BIASNEG:
- case SVGA3DSRCMOD_SIGNNEG:
- case SVGA3DSRCMOD_X2NEG:
- debug_printf( "-" );
- break;
- case SVGA3DSRCMOD_ABS:
- debug_printf( "|" );
- break;
- case SVGA3DSRCMOD_ABSNEG:
- debug_printf( "-|" );
- break;
- case SVGA3DSRCMOD_COMP:
- debug_printf( "1-" );
- break;
- case SVGA3DSRCMOD_NOT:
- debug_printf( "!" );
- }
-
- u.srcreg = srcreg;
- dump_reg( u.reg, indreg, di );
- switch (srcreg.modifier) {
- case SVGA3DSRCMOD_NONE:
- case SVGA3DSRCMOD_NEG:
- case SVGA3DSRCMOD_COMP:
- case SVGA3DSRCMOD_NOT:
- break;
- case SVGA3DSRCMOD_ABS:
- case SVGA3DSRCMOD_ABSNEG:
- debug_printf( "|" );
- break;
- case SVGA3DSRCMOD_BIAS:
- case SVGA3DSRCMOD_BIASNEG:
- debug_printf( "_bias" );
- break;
- case SVGA3DSRCMOD_SIGN:
- case SVGA3DSRCMOD_SIGNNEG:
- debug_printf( "_bx2" );
- break;
- case SVGA3DSRCMOD_X2:
- case SVGA3DSRCMOD_X2NEG:
- debug_printf( "_x2" );
- break;
- case SVGA3DSRCMOD_DZ:
- debug_printf( "_dz" );
- break;
- case SVGA3DSRCMOD_DW:
- debug_printf( "_dw" );
- break;
- default:
- assert( 0 );
- }
- if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) {
- debug_printf( "." );
- if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) {
- debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
- }
- else {
- debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_y] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_z] );
- debug_printf( "%c", "xyzw"[srcreg.swizzle_w] );
- }
- }
-}
-
-void
-sh_svga_dump(
- const unsigned *assem,
- unsigned dwords,
- unsigned do_binary )
-{
- const unsigned *start = assem;
- boolean finished = FALSE;
- struct dump_info di;
- unsigned i;
-
- if (do_binary) {
- for (i = 0; i < dwords; i++)
- debug_printf(" 0x%08x,\n", assem[i]);
-
- debug_printf("\n\n");
- }
-
- di.version.value = *assem++;
- di.is_ps = (di.version.type == SVGA3D_PS_TYPE);
-
- debug_printf(
- "%s_%u_%u\n",
- di.is_ps ? "ps" : "vs",
- di.version.major,
- di.version.minor );
-
- while (!finished) {
- struct sh_op op = *(struct sh_op *) assem;
-
- if (assem - start >= dwords) {
- debug_printf("... ran off end of buffer\n");
- assert(0);
- return;
- }
-
- switch (op.opcode) {
- case SVGA3DOP_DCL:
- {
- struct sh_dcl dcl = *(struct sh_dcl *) assem;
-
- debug_printf( "dcl" );
- if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER)
- dump_sampleinfo( dcl.u.ps.sampleinfo );
- else if (di.is_ps) {
- if (di.version.major == 3 &&
- sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE)
- dump_usageinfo( dcl.u.vs.semantic );
- }
- else
- dump_usageinfo( dcl.u.vs.semantic );
- dump_dstreg( dcl.reg, &di );
- debug_printf( "\n" );
- assem += sizeof( struct sh_dcl ) / sizeof( unsigned );
- }
- break;
-
- case SVGA3DOP_DEFB:
- {
- struct sh_defb defb = *(struct sh_defb *) assem;
-
- debug_printf( "defb " );
- dump_reg( defb.reg, NULL, &di );
- debug_printf( ", " );
- dump_bdata( defb.data );
- debug_printf( "\n" );
- assem += sizeof( struct sh_defb ) / sizeof( unsigned );
- }
- break;
-
- case SVGA3DOP_DEFI:
- {
- struct sh_defi defi = *(struct sh_defi *) assem;
-
- debug_printf( "defi " );
- dump_reg( defi.reg, NULL, &di );
- debug_printf( ", " );
- dump_idata( defi.idata );
- debug_printf( "\n" );
- assem += sizeof( struct sh_defi ) / sizeof( unsigned );
- }
- break;
-
- case SVGA3DOP_TEXCOORD:
- assert( di.is_ps );
- dump_op( op, "texcoord" );
- if (0) {
- struct sh_dstop dstop = *(struct sh_dstop *) assem;
- dump_dstreg( dstop.dst, &di );
- assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
- }
- else {
- struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
- dump_dstreg( unaryop.dst, &di );
- debug_printf( ", " );
- dump_srcreg( unaryop.src, NULL, &di );
- assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
- }
- debug_printf( "\n" );
- break;
-
- case SVGA3DOP_TEX:
- assert( di.is_ps );
- if (0) {
- dump_op( op, "tex" );
- if (0) {
- struct sh_dstop dstop = *(struct sh_dstop *) assem;
-
- dump_dstreg( dstop.dst, &di );
- assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
- }
- else {
- struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
-
- dump_dstreg( unaryop.dst, &di );
- debug_printf( ", " );
- dump_srcreg( unaryop.src, NULL, &di );
- assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
- }
- }
- else {
- struct sh_binaryop binaryop = *(struct sh_binaryop *) assem;
-
- dump_op( op, "texld" );
- dump_dstreg( binaryop.dst, &di );
- debug_printf( ", " );
- dump_srcreg( binaryop.src0, NULL, &di );
- debug_printf( ", " );
- dump_srcreg( binaryop.src1, NULL, &di );
- assem += sizeof( struct sh_binaryop ) / sizeof( unsigned );
- }
- debug_printf( "\n" );
- break;
-
- case SVGA3DOP_DEF:
- {
- struct sh_def def = *(struct sh_def *) assem;
-
- debug_printf( "def " );
- dump_reg( def.reg, NULL, &di );
- debug_printf( ", " );
- dump_cdata( def.cdata );
- debug_printf( "\n" );
- assem += sizeof( struct sh_def ) / sizeof( unsigned );
- }
- break;
-
- case SVGA3DOP_PHASE:
- debug_printf( "phase\n" );
- assem += sizeof( struct sh_op ) / sizeof( unsigned );
- break;
-
- case SVGA3DOP_COMMENT:
- assert( 0 );
- break;
-
- case SVGA3DOP_RET:
- debug_printf( "ret\n" );
- assem += sizeof( struct sh_op ) / sizeof( unsigned );
- break;
-
- case SVGA3DOP_END:
- debug_printf( "end\n" );
- finished = TRUE;
- break;
-
- default:
- {
- const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode );
- uint i;
- uint num_src = info->num_src + op.predicated;
- boolean not_first_arg = FALSE;
-
- assert( info->num_dst <= 1 );
-
- if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3)
- num_src += 2;
-
- dump_comp_op( op, info->mnemonic );
- assem += sizeof( struct sh_op ) / sizeof( unsigned );
-
- if (info->num_dst > 0) {
- struct sh_dstreg dstreg = *(struct sh_dstreg *) assem;
-
- dump_dstreg( dstreg, &di );
- assem += sizeof( struct sh_dstreg ) / sizeof( unsigned );
- not_first_arg = TRUE;
- }
-
- for (i = 0; i < num_src; i++) {
- struct sh_srcreg srcreg;
- struct sh_srcreg indreg;
-
- srcreg = *(struct sh_srcreg *) assem;
- assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
- if (srcreg.relative && !di.is_ps && di.version.major >= 2) {
- indreg = *(struct sh_srcreg *) assem;
- assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
- }
-
- if (not_first_arg)
- debug_printf( ", " );
- else
- debug_printf( " " );
- dump_srcreg( srcreg, &indreg, &di );
- not_first_arg = TRUE;
- }
-
- debug_printf( "\n" );
- }
- }
- }
-}
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.h b/src/gallium/drivers/svga/svgadump/st_shader_dump.h
deleted file mode 100644
index af5549cdba..0000000000
--- a/src/gallium/drivers/svga/svgadump/st_shader_dump.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**********************************************************
- * Copyright 2008-2009 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-/**
- * @file
- * SVGA Shader Dump Facilities
- *
- * @author Michal Krol
- */
-
-#ifndef ST_SHADER_SVGA_DUMP_H
-#define ST_SHADER_SVGA_DUMP_H
-
-void
-sh_svga_dump(
- const unsigned *assem,
- unsigned dwords,
- unsigned do_binary );
-
-#endif /* ST_SHADER_SVGA_DUMP_H */
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.c b/src/gallium/drivers/svga/svgadump/st_shader_op.c
deleted file mode 100644
index 2c05382ab9..0000000000
--- a/src/gallium/drivers/svga/svgadump/st_shader_op.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/**********************************************************
- * Copyright 2008-2009 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-/**
- * @file
- * SVGA Shader Token Opcode Info
- *
- * @author Michal Krol
- */
-
-#include "util/u_debug.h"
-#include "st_shader_op.h"
-
-#include "../svga_hw_reg.h"
-#include "svga3d_shaderdefs.h"
-
-#define SVGA3DOP_INVALID SVGA3DOP_END
-#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST
-
-static struct sh_opcode_info opcode_info[] =
-{
- { "nop", 0, 0, SVGA3DOP_NOP },
- { "mov", 1, 1, SVGA3DOP_MOV, },
- { "add", 1, 2, SVGA3DOP_ADD, },
- { "sub", 1, 2, SVGA3DOP_SUB, },
- { "mad", 1, 3, SVGA3DOP_MAD, },
- { "mul", 1, 2, SVGA3DOP_MUL, },
- { "rcp", 1, 1, SVGA3DOP_RCP, },
- { "rsq", 1, 1, SVGA3DOP_RSQ, },
- { "dp3", 1, 2, SVGA3DOP_DP3, },
- { "dp4", 1, 2, SVGA3DOP_DP4, },
- { "min", 1, 2, SVGA3DOP_MIN, },
- { "max", 1, 2, SVGA3DOP_MAX, },
- { "slt", 1, 2, SVGA3DOP_SLT, },
- { "sge", 1, 2, SVGA3DOP_SGE, },
- { "exp", 1, 1, SVGA3DOP_EXP, },
- { "log", 1, 1, SVGA3DOP_LOG, },
- { "lit", 1, 1, SVGA3DOP_LIT, },
- { "dst", 1, 2, SVGA3DOP_DST, },
- { "lrp", 1, 3, SVGA3DOP_LRP, },
- { "frc", 1, 1, SVGA3DOP_FRC, },
- { "m4x4", 1, 2, SVGA3DOP_M4x4, },
- { "m4x3", 1, 2, SVGA3DOP_M4x3, },
- { "m3x4", 1, 2, SVGA3DOP_M3x4, },
- { "m3x3", 1, 2, SVGA3DOP_M3x3, },
- { "m3x2", 1, 2, SVGA3DOP_M3x2, },
- { "call", 0, 1, SVGA3DOP_CALL, },
- { "callnz", 0, 2, SVGA3DOP_CALLNZ, },
- { "loop", 0, 2, SVGA3DOP_LOOP, },
- { "ret", 0, 0, SVGA3DOP_RET, },
- { "endloop", 0, 0, SVGA3DOP_ENDLOOP, },
- { "label", 0, 1, SVGA3DOP_LABEL, },
- { "dcl", 0, 0, SVGA3DOP_DCL, },
- { "pow", 1, 2, SVGA3DOP_POW, },
- { "crs", 1, 2, SVGA3DOP_CRS, },
- { "sgn", 1, 3, SVGA3DOP_SGN, },
- { "abs", 1, 1, SVGA3DOP_ABS, },
- { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */
- { "sincos", 1, 1, SVGA3DOP_SINCOS, },
- { "rep", 0, 1, SVGA3DOP_REP, },
- { "endrep", 0, 0, SVGA3DOP_ENDREP, },
- { "if", 0, 1, SVGA3DOP_IF, },
- { "ifc", 0, 2, SVGA3DOP_IFC, },
- { "else", 0, 0, SVGA3DOP_ELSE, },
- { "endif", 0, 0, SVGA3DOP_ENDIF, },
- { "break", 0, 0, SVGA3DOP_BREAK, },
- { "breakc", 0, 0, SVGA3DOP_BREAKC, },
- { "mova", 1, 1, SVGA3DOP_MOVA, },
- { "defb", 0, 0, SVGA3DOP_DEFB, },
- { "defi", 0, 0, SVGA3DOP_DEFI, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "???", 0, 0, SVGA3DOP_INVALID, },
- { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, },
- { "texkill", 1, 0, SVGA3DOP_TEXKILL, },
- { "tex", 0, 0, SVGA3DOP_TEX, },
- { "texbem", 1, 1, SVGA3DOP_TEXBEM, },
- { "texbeml", 1, 1, SVGA3DOP_TEXBEML, },
- { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, },
- { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, },
- { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, },
- { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, },
- { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, },
- { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, },
- { "reserved0", 0, 0, SVGA3DOP_RESERVED0, },
- { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, },
- { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,},
- { "expp", 1, 1, SVGA3DOP_EXPP, },
- { "logp", 1, 1, SVGA3DOP_LOGP, },
- { "cnd", 1, 3, SVGA3DOP_CND, },
- { "def", 0, 0, SVGA3DOP_DEF, },
- { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, },
- { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, },
- { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,},
- { "texdp3", 1, 1, SVGA3DOP_TEXDP3, },
- { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, },
- { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, },
- { "cmp", 1, 3, SVGA3DOP_CMP, },
- { "bem", 1, 2, SVGA3DOP_BEM, },
- { "dp2add", 1, 3, SVGA3DOP_DP2ADD, },
- { "dsx", 1, 1, SVGA3DOP_INVALID, },
- { "dsy", 1, 1, SVGA3DOP_INVALID, },
- { "texldd", 1, 1, SVGA3DOP_INVALID, },
- { "setp", 1, 2, SVGA3DOP_SETP, },
- { "texldl", 1, 1, SVGA3DOP_INVALID, },
- { "breakp", 1, 1, SVGA3DOP_INVALID, },
-};
-
-const struct sh_opcode_info *sh_svga_opcode_info( uint op )
-{
- struct sh_opcode_info *info;
-
- if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) {
- /* The opcode is either PHASE, COMMENT, END or out of range.
- */
- assert( 0 );
- return NULL;
- }
-
- info = &opcode_info[op];
-
- if (info->svga_opcode == SVGA3DOP_INVALID) {
- /* No valid information. Please provide number of dst/src registers.
- */
- assert( 0 );
- return NULL;
- }
-
- /* Sanity check.
- */
- assert( op == info->svga_opcode );
-
- return info;
-}
diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.h b/src/gallium/drivers/svga/svgadump/st_shader_op.h
deleted file mode 100644
index 01d39dca84..0000000000
--- a/src/gallium/drivers/svga/svgadump/st_shader_op.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**********************************************************
- * Copyright 2008-2009 VMware, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
-
-/**
- * @file
- * SVGA Shader Token Opcode Info
- *
- * @author Michal Krol
- */
-
-#ifndef ST_SHADER_SVGA_OP_H
-#define ST_SHADER_SVGA_OP_H
-
-struct sh_opcode_info
-{
- const char *mnemonic;
- unsigned num_dst:8;
- unsigned num_src:8;
- unsigned svga_opcode:16;
-};
-
-const struct sh_opcode_info *sh_svga_opcode_info( unsigned op );
-
-#endif /* ST_SHADER_SVGA_OP_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c
index 180dde8dc1..c6c353f58e 100644
--- a/src/gallium/drivers/svga/svgadump/svga_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.c
@@ -31,7 +31,7 @@
*/
#include "svga_types.h"
-#include "st_shader_dump.h"
+#include "svga_shader_dump.h"
#include "svga3d_reg.h"
#include "util/u_debug.h"
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py
index 3cb29c395b..288e753296 100755
--- a/src/gallium/drivers/svga/svgadump/svga_dump.py
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.py
@@ -291,7 +291,7 @@ def main():
print ' */'
print
print '#include "svga_types.h"'
- print '#include "shader_dump/st_shader_dump.h"'
+ print '#include "svga_shader_dump.h"'
print '#include "svga3d_reg.h"'
print
print '#include "pipe/p_debug.h"'
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h
new file mode 100644
index 0000000000..2fc1796a90
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_shader.h
@@ -0,0 +1,214 @@
+/**********************************************************
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Definitions
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_H
+#define ST_SHADER_SVGA_H
+
+#include "pipe/p_compiler.h"
+
+struct sh_op
+{
+ unsigned opcode:16;
+ unsigned control:8;
+ unsigned length:4;
+ unsigned predicated:1;
+ unsigned unused:1;
+ unsigned coissue:1;
+ unsigned is_reg:1;
+};
+
+struct sh_reg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:14;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_reg_type( struct sh_reg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_cdata
+{
+ float xyzw[4];
+};
+
+struct sh_def
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ struct sh_cdata cdata;
+};
+
+struct sh_defb
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ uint data;
+};
+
+struct sh_idata
+{
+ int xyzw[4];
+};
+
+struct sh_defi
+{
+ struct sh_op op;
+ struct sh_reg reg;
+ struct sh_idata idata;
+};
+
+#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN
+#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D
+#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE
+#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME
+
+struct ps_sampleinfo
+{
+ unsigned unused:27;
+ unsigned texture_type:4;
+ unsigned is_reg:1;
+};
+
+struct vs_semantic
+{
+ unsigned usage:5;
+ unsigned unused1:11;
+ unsigned usage_index:4;
+ unsigned unused2:12;
+};
+
+struct sh_dstreg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:2;
+ unsigned write_mask:4;
+ unsigned modifier:4;
+ unsigned shift_scale:4;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_dstreg_type( struct sh_dstreg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_dcl
+{
+ struct sh_op op;
+ union {
+ struct {
+ struct ps_sampleinfo sampleinfo;
+ } ps;
+ struct {
+ struct vs_semantic semantic;
+ } vs;
+ } u;
+ struct sh_dstreg reg;
+};
+
+
+struct sh_srcreg
+{
+ unsigned number:11;
+ unsigned type_hi:2;
+ unsigned relative:1;
+ unsigned unused:2;
+ unsigned swizzle_x:2;
+ unsigned swizzle_y:2;
+ unsigned swizzle_z:2;
+ unsigned swizzle_w:2;
+ unsigned modifier:4;
+ unsigned type_lo:3;
+ unsigned is_reg:1;
+};
+
+static INLINE unsigned
+sh_srcreg_type( struct sh_srcreg reg )
+{
+ return reg.type_lo | (reg.type_hi << 3);
+}
+
+struct sh_dstop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+};
+
+struct sh_srcop
+{
+ struct sh_op op;
+ struct sh_srcreg src;
+};
+
+struct sh_src2op
+{
+ struct sh_op op;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+};
+
+struct sh_unaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src;
+};
+
+struct sh_binaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+};
+
+struct sh_trinaryop
+{
+ struct sh_op op;
+ struct sh_dstreg dst;
+ struct sh_srcreg src0;
+ struct sh_srcreg src1;
+ struct sh_srcreg src2;
+};
+
+#endif /* ST_SHADER_SVGA_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
new file mode 100644
index 0000000000..c654126d3a
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -0,0 +1,649 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Dump Facilities
+ *
+ * @author Michal Krol
+ */
+
+#include "svga_shader.h"
+#include "svga_shader_dump.h"
+#include "svga_shader_op.h"
+#include "util/u_debug.h"
+
+#include "../svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+struct dump_info
+{
+ SVGA3dShaderVersion version;
+ boolean is_ps;
+};
+
+static void dump_op( struct sh_op op, const char *mnemonic )
+{
+ assert( op.predicated == 0 );
+ assert( op.is_reg == 0 );
+
+ if (op.coissue)
+ debug_printf( "+" );
+ debug_printf( "%s", mnemonic );
+ switch (op.control) {
+ case 0:
+ break;
+ case SVGA3DOPCONT_PROJECT:
+ debug_printf( "p" );
+ break;
+ case SVGA3DOPCONT_BIAS:
+ debug_printf( "b" );
+ break;
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_comp_op( struct sh_op op, const char *mnemonic )
+{
+ assert( op.is_reg == 0 );
+
+ if (op.coissue)
+ debug_printf( "+" );
+ debug_printf( "%s", mnemonic );
+ switch (op.control) {
+ case SVGA3DOPCOMP_RESERVED0:
+ break;
+ case SVGA3DOPCOMP_GT:
+ debug_printf("_gt");
+ break;
+ case SVGA3DOPCOMP_EQ:
+ debug_printf("_eq");
+ break;
+ case SVGA3DOPCOMP_GE:
+ debug_printf("_ge");
+ break;
+ case SVGA3DOPCOMP_LT:
+ debug_printf("_lt");
+ break;
+ case SVGA3DOPCOMPC_NE:
+ debug_printf("_ne");
+ break;
+ case SVGA3DOPCOMP_LE:
+ debug_printf("_le");
+ break;
+ case SVGA3DOPCOMP_RESERVED1:
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di )
+{
+ assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 );
+ assert( reg.is_reg == 1 );
+
+ switch (sh_reg_type( reg )) {
+ case SVGA3DREG_TEMP:
+ debug_printf( "r%u", reg.number );
+ break;
+
+ case SVGA3DREG_INPUT:
+ debug_printf( "v%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONST:
+ if (reg.relative) {
+ if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP)
+ debug_printf( "c[aL+%u]", reg.number );
+ else
+ debug_printf( "c[a%u.x+%u]", indreg->number, reg.number );
+ }
+ else
+ debug_printf( "c%u", reg.number );
+ break;
+
+ case SVGA3DREG_ADDR: /* VS */
+ /* SVGA3DREG_TEXTURE */ /* PS */
+ if (di->is_ps)
+ debug_printf( "t%u", reg.number );
+ else
+ debug_printf( "a%u", reg.number );
+ break;
+
+ case SVGA3DREG_RASTOUT:
+ switch (reg.number) {
+ case 0 /*POSITION*/:
+ debug_printf( "oPos" );
+ break;
+ case 1 /*FOG*/:
+ debug_printf( "oFog" );
+ break;
+ case 2 /*POINT_SIZE*/:
+ debug_printf( "oPts" );
+ break;
+ default:
+ assert( 0 );
+ debug_printf( "???" );
+ }
+ break;
+
+ case SVGA3DREG_ATTROUT:
+ assert( reg.number < 2 );
+ debug_printf( "oD%u", reg.number );
+ break;
+
+ case SVGA3DREG_TEXCRDOUT:
+ /* SVGA3DREG_OUTPUT */
+ debug_printf( "oT%u", reg.number );
+ break;
+
+ case SVGA3DREG_COLOROUT:
+ debug_printf( "oC%u", reg.number );
+ break;
+
+ case SVGA3DREG_DEPTHOUT:
+ debug_printf( "oD%u", reg.number );
+ break;
+
+ case SVGA3DREG_SAMPLER:
+ debug_printf( "s%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONSTBOOL:
+ assert( !reg.relative );
+ debug_printf( "b%u", reg.number );
+ break;
+
+ case SVGA3DREG_CONSTINT:
+ assert( !reg.relative );
+ debug_printf( "i%u", reg.number );
+ break;
+
+ case SVGA3DREG_LOOP:
+ assert( reg.number == 0 );
+ debug_printf( "aL" );
+ break;
+
+ case SVGA3DREG_MISCTYPE:
+ switch (reg.number) {
+ case SVGA3DMISCREG_POSITION:
+ debug_printf( "vPos" );
+ break;
+ case SVGA3DMISCREG_FACE:
+ debug_printf( "vFace" );
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ break;
+
+ case SVGA3DREG_LABEL:
+ debug_printf( "l%u", reg.number );
+ break;
+
+ case SVGA3DREG_PREDICATE:
+ debug_printf( "p%u", reg.number );
+ break;
+
+
+ default:
+ assert( 0 );
+ debug_printf( "???" );
+ }
+}
+
+static void dump_cdata( struct sh_cdata cdata )
+{
+ debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] );
+}
+
+static void dump_idata( struct sh_idata idata )
+{
+ debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] );
+}
+
+static void dump_bdata( boolean bdata )
+{
+ debug_printf( bdata ? "TRUE" : "FALSE" );
+}
+
+static void dump_sampleinfo( struct ps_sampleinfo sampleinfo )
+{
+ switch (sampleinfo.texture_type) {
+ case SVGA3DSAMP_2D:
+ debug_printf( "_2d" );
+ break;
+ case SVGA3DSAMP_CUBE:
+ debug_printf( "_cube" );
+ break;
+ case SVGA3DSAMP_VOLUME:
+ debug_printf( "_volume" );
+ break;
+ default:
+ assert( 0 );
+ }
+}
+
+
+static void dump_usageinfo( struct vs_semantic semantic )
+{
+ switch (semantic.usage) {
+ case SVGA3D_DECLUSAGE_POSITION:
+ debug_printf("_position" );
+ break;
+ case SVGA3D_DECLUSAGE_BLENDWEIGHT:
+ debug_printf("_blendweight" );
+ break;
+ case SVGA3D_DECLUSAGE_BLENDINDICES:
+ debug_printf("_blendindices" );
+ break;
+ case SVGA3D_DECLUSAGE_NORMAL:
+ debug_printf("_normal" );
+ break;
+ case SVGA3D_DECLUSAGE_PSIZE:
+ debug_printf("_psize" );
+ break;
+ case SVGA3D_DECLUSAGE_TEXCOORD:
+ debug_printf("_texcoord");
+ break;
+ case SVGA3D_DECLUSAGE_TANGENT:
+ debug_printf("_tangent" );
+ break;
+ case SVGA3D_DECLUSAGE_BINORMAL:
+ debug_printf("_binormal" );
+ break;
+ case SVGA3D_DECLUSAGE_TESSFACTOR:
+ debug_printf("_tessfactor" );
+ break;
+ case SVGA3D_DECLUSAGE_POSITIONT:
+ debug_printf("_positiont" );
+ break;
+ case SVGA3D_DECLUSAGE_COLOR:
+ debug_printf("_color" );
+ break;
+ case SVGA3D_DECLUSAGE_FOG:
+ debug_printf("_fog" );
+ break;
+ case SVGA3D_DECLUSAGE_DEPTH:
+ debug_printf("_depth" );
+ break;
+ case SVGA3D_DECLUSAGE_SAMPLE:
+ debug_printf("_sample");
+ break;
+ default:
+ assert( 0 );
+ return;
+ }
+
+ if (semantic.usage_index != 0) {
+ debug_printf("%d", semantic.usage_index );
+ }
+}
+
+static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di )
+{
+ union {
+ struct sh_reg reg;
+ struct sh_dstreg dstreg;
+ } u;
+
+ assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier );
+
+ if (dstreg.modifier & SVGA3DDSTMOD_SATURATE)
+ debug_printf( "_sat" );
+ if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION)
+ debug_printf( "_pp" );
+ switch (dstreg.shift_scale) {
+ case 0:
+ break;
+ case 1:
+ debug_printf( "_x2" );
+ break;
+ case 2:
+ debug_printf( "_x4" );
+ break;
+ case 3:
+ debug_printf( "_x8" );
+ break;
+ case 13:
+ debug_printf( "_d8" );
+ break;
+ case 14:
+ debug_printf( "_d4" );
+ break;
+ case 15:
+ debug_printf( "_d2" );
+ break;
+ default:
+ assert( 0 );
+ }
+ debug_printf( " " );
+
+ u.dstreg = dstreg;
+ dump_reg( u.reg, NULL, di );
+ if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) {
+ debug_printf( "." );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_0)
+ debug_printf( "x" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_1)
+ debug_printf( "y" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_2)
+ debug_printf( "z" );
+ if (dstreg.write_mask & SVGA3DWRITEMASK_3)
+ debug_printf( "w" );
+ }
+}
+
+static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di )
+{
+ union {
+ struct sh_reg reg;
+ struct sh_srcreg srcreg;
+ } u;
+
+ switch (srcreg.modifier) {
+ case SVGA3DSRCMOD_NEG:
+ case SVGA3DSRCMOD_BIASNEG:
+ case SVGA3DSRCMOD_SIGNNEG:
+ case SVGA3DSRCMOD_X2NEG:
+ debug_printf( "-" );
+ break;
+ case SVGA3DSRCMOD_ABS:
+ debug_printf( "|" );
+ break;
+ case SVGA3DSRCMOD_ABSNEG:
+ debug_printf( "-|" );
+ break;
+ case SVGA3DSRCMOD_COMP:
+ debug_printf( "1-" );
+ break;
+ case SVGA3DSRCMOD_NOT:
+ debug_printf( "!" );
+ }
+
+ u.srcreg = srcreg;
+ dump_reg( u.reg, indreg, di );
+ switch (srcreg.modifier) {
+ case SVGA3DSRCMOD_NONE:
+ case SVGA3DSRCMOD_NEG:
+ case SVGA3DSRCMOD_COMP:
+ case SVGA3DSRCMOD_NOT:
+ break;
+ case SVGA3DSRCMOD_ABS:
+ case SVGA3DSRCMOD_ABSNEG:
+ debug_printf( "|" );
+ break;
+ case SVGA3DSRCMOD_BIAS:
+ case SVGA3DSRCMOD_BIASNEG:
+ debug_printf( "_bias" );
+ break;
+ case SVGA3DSRCMOD_SIGN:
+ case SVGA3DSRCMOD_SIGNNEG:
+ debug_printf( "_bx2" );
+ break;
+ case SVGA3DSRCMOD_X2:
+ case SVGA3DSRCMOD_X2NEG:
+ debug_printf( "_x2" );
+ break;
+ case SVGA3DSRCMOD_DZ:
+ debug_printf( "_dz" );
+ break;
+ case SVGA3DSRCMOD_DW:
+ debug_printf( "_dw" );
+ break;
+ default:
+ assert( 0 );
+ }
+ if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) {
+ debug_printf( "." );
+ if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) {
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ }
+ else {
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_x] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_y] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_z] );
+ debug_printf( "%c", "xyzw"[srcreg.swizzle_w] );
+ }
+ }
+}
+
+void
+sh_svga_dump(
+ const unsigned *assem,
+ unsigned dwords,
+ unsigned do_binary )
+{
+ const unsigned *start = assem;
+ boolean finished = FALSE;
+ struct dump_info di;
+ unsigned i;
+
+ if (do_binary) {
+ for (i = 0; i < dwords; i++)
+ debug_printf(" 0x%08x,\n", assem[i]);
+
+ debug_printf("\n\n");
+ }
+
+ di.version.value = *assem++;
+ di.is_ps = (di.version.type == SVGA3D_PS_TYPE);
+
+ debug_printf(
+ "%s_%u_%u\n",
+ di.is_ps ? "ps" : "vs",
+ di.version.major,
+ di.version.minor );
+
+ while (!finished) {
+ struct sh_op op = *(struct sh_op *) assem;
+
+ if (assem - start >= dwords) {
+ debug_printf("... ran off end of buffer\n");
+ assert(0);
+ return;
+ }
+
+ switch (op.opcode) {
+ case SVGA3DOP_DCL:
+ {
+ struct sh_dcl dcl = *(struct sh_dcl *) assem;
+
+ debug_printf( "dcl" );
+ if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER)
+ dump_sampleinfo( dcl.u.ps.sampleinfo );
+ else if (di.is_ps) {
+ if (di.version.major == 3 &&
+ sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE)
+ dump_usageinfo( dcl.u.vs.semantic );
+ }
+ else
+ dump_usageinfo( dcl.u.vs.semantic );
+ dump_dstreg( dcl.reg, &di );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_dcl ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_DEFB:
+ {
+ struct sh_defb defb = *(struct sh_defb *) assem;
+
+ debug_printf( "defb " );
+ dump_reg( defb.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_bdata( defb.data );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_defb ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_DEFI:
+ {
+ struct sh_defi defi = *(struct sh_defi *) assem;
+
+ debug_printf( "defi " );
+ dump_reg( defi.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_idata( defi.idata );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_defi ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_TEXCOORD:
+ assert( di.is_ps );
+ dump_op( op, "texcoord" );
+ if (0) {
+ struct sh_dstop dstop = *(struct sh_dstop *) assem;
+ dump_dstreg( dstop.dst, &di );
+ assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
+ }
+ else {
+ struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
+ dump_dstreg( unaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( unaryop.src, NULL, &di );
+ assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ }
+ debug_printf( "\n" );
+ break;
+
+ case SVGA3DOP_TEX:
+ assert( di.is_ps );
+ if (0) {
+ dump_op( op, "tex" );
+ if (0) {
+ struct sh_dstop dstop = *(struct sh_dstop *) assem;
+
+ dump_dstreg( dstop.dst, &di );
+ assem += sizeof( struct sh_dstop ) / sizeof( unsigned );
+ }
+ else {
+ struct sh_unaryop unaryop = *(struct sh_unaryop *) assem;
+
+ dump_dstreg( unaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( unaryop.src, NULL, &di );
+ assem += sizeof( struct sh_unaryop ) / sizeof( unsigned );
+ }
+ }
+ else {
+ struct sh_binaryop binaryop = *(struct sh_binaryop *) assem;
+
+ dump_op( op, "texld" );
+ dump_dstreg( binaryop.dst, &di );
+ debug_printf( ", " );
+ dump_srcreg( binaryop.src0, NULL, &di );
+ debug_printf( ", " );
+ dump_srcreg( binaryop.src1, NULL, &di );
+ assem += sizeof( struct sh_binaryop ) / sizeof( unsigned );
+ }
+ debug_printf( "\n" );
+ break;
+
+ case SVGA3DOP_DEF:
+ {
+ struct sh_def def = *(struct sh_def *) assem;
+
+ debug_printf( "def " );
+ dump_reg( def.reg, NULL, &di );
+ debug_printf( ", " );
+ dump_cdata( def.cdata );
+ debug_printf( "\n" );
+ assem += sizeof( struct sh_def ) / sizeof( unsigned );
+ }
+ break;
+
+ case SVGA3DOP_PHASE:
+ debug_printf( "phase\n" );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+ break;
+
+ case SVGA3DOP_COMMENT:
+ assert( 0 );
+ break;
+
+ case SVGA3DOP_RET:
+ debug_printf( "ret\n" );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+ break;
+
+ case SVGA3DOP_END:
+ debug_printf( "end\n" );
+ finished = TRUE;
+ break;
+
+ default:
+ {
+ const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode );
+ uint i;
+ uint num_src = info->num_src + op.predicated;
+ boolean not_first_arg = FALSE;
+
+ assert( info->num_dst <= 1 );
+
+ if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3)
+ num_src += 2;
+
+ dump_comp_op( op, info->mnemonic );
+ assem += sizeof( struct sh_op ) / sizeof( unsigned );
+
+ if (info->num_dst > 0) {
+ struct sh_dstreg dstreg = *(struct sh_dstreg *) assem;
+
+ dump_dstreg( dstreg, &di );
+ assem += sizeof( struct sh_dstreg ) / sizeof( unsigned );
+ not_first_arg = TRUE;
+ }
+
+ for (i = 0; i < num_src; i++) {
+ struct sh_srcreg srcreg;
+ struct sh_srcreg indreg;
+
+ srcreg = *(struct sh_srcreg *) assem;
+ assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
+ if (srcreg.relative && !di.is_ps && di.version.major >= 2) {
+ indreg = *(struct sh_srcreg *) assem;
+ assem += sizeof( struct sh_srcreg ) / sizeof( unsigned );
+ }
+
+ if (not_first_arg)
+ debug_printf( ", " );
+ else
+ debug_printf( " " );
+ dump_srcreg( srcreg, &indreg, &di );
+ not_first_arg = TRUE;
+ }
+
+ debug_printf( "\n" );
+ }
+ }
+ }
+}
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h
new file mode 100644
index 0000000000..af5549cdba
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h
@@ -0,0 +1,42 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Dump Facilities
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_DUMP_H
+#define ST_SHADER_SVGA_DUMP_H
+
+void
+sh_svga_dump(
+ const unsigned *assem,
+ unsigned dwords,
+ unsigned do_binary );
+
+#endif /* ST_SHADER_SVGA_DUMP_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
new file mode 100644
index 0000000000..cecc22106b
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
@@ -0,0 +1,168 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Opcode Info
+ *
+ * @author Michal Krol
+ */
+
+#include "util/u_debug.h"
+#include "svga_shader_op.h"
+
+#include "../svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
+
+#define SVGA3DOP_INVALID SVGA3DOP_END
+#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST
+
+static struct sh_opcode_info opcode_info[] =
+{
+ { "nop", 0, 0, SVGA3DOP_NOP },
+ { "mov", 1, 1, SVGA3DOP_MOV, },
+ { "add", 1, 2, SVGA3DOP_ADD, },
+ { "sub", 1, 2, SVGA3DOP_SUB, },
+ { "mad", 1, 3, SVGA3DOP_MAD, },
+ { "mul", 1, 2, SVGA3DOP_MUL, },
+ { "rcp", 1, 1, SVGA3DOP_RCP, },
+ { "rsq", 1, 1, SVGA3DOP_RSQ, },
+ { "dp3", 1, 2, SVGA3DOP_DP3, },
+ { "dp4", 1, 2, SVGA3DOP_DP4, },
+ { "min", 1, 2, SVGA3DOP_MIN, },
+ { "max", 1, 2, SVGA3DOP_MAX, },
+ { "slt", 1, 2, SVGA3DOP_SLT, },
+ { "sge", 1, 2, SVGA3DOP_SGE, },
+ { "exp", 1, 1, SVGA3DOP_EXP, },
+ { "log", 1, 1, SVGA3DOP_LOG, },
+ { "lit", 1, 1, SVGA3DOP_LIT, },
+ { "dst", 1, 2, SVGA3DOP_DST, },
+ { "lrp", 1, 3, SVGA3DOP_LRP, },
+ { "frc", 1, 1, SVGA3DOP_FRC, },
+ { "m4x4", 1, 2, SVGA3DOP_M4x4, },
+ { "m4x3", 1, 2, SVGA3DOP_M4x3, },
+ { "m3x4", 1, 2, SVGA3DOP_M3x4, },
+ { "m3x3", 1, 2, SVGA3DOP_M3x3, },
+ { "m3x2", 1, 2, SVGA3DOP_M3x2, },
+ { "call", 0, 1, SVGA3DOP_CALL, },
+ { "callnz", 0, 2, SVGA3DOP_CALLNZ, },
+ { "loop", 0, 2, SVGA3DOP_LOOP, },
+ { "ret", 0, 0, SVGA3DOP_RET, },
+ { "endloop", 0, 0, SVGA3DOP_ENDLOOP, },
+ { "label", 0, 1, SVGA3DOP_LABEL, },
+ { "dcl", 0, 0, SVGA3DOP_DCL, },
+ { "pow", 1, 2, SVGA3DOP_POW, },
+ { "crs", 1, 2, SVGA3DOP_CRS, },
+ { "sgn", 1, 3, SVGA3DOP_SGN, },
+ { "abs", 1, 1, SVGA3DOP_ABS, },
+ { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */
+ { "sincos", 1, 1, SVGA3DOP_SINCOS, },
+ { "rep", 0, 1, SVGA3DOP_REP, },
+ { "endrep", 0, 0, SVGA3DOP_ENDREP, },
+ { "if", 0, 1, SVGA3DOP_IF, },
+ { "ifc", 0, 2, SVGA3DOP_IFC, },
+ { "else", 0, 0, SVGA3DOP_ELSE, },
+ { "endif", 0, 0, SVGA3DOP_ENDIF, },
+ { "break", 0, 0, SVGA3DOP_BREAK, },
+ { "breakc", 0, 0, SVGA3DOP_BREAKC, },
+ { "mova", 1, 1, SVGA3DOP_MOVA, },
+ { "defb", 0, 0, SVGA3DOP_DEFB, },
+ { "defi", 0, 0, SVGA3DOP_DEFI, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "???", 0, 0, SVGA3DOP_INVALID, },
+ { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, },
+ { "texkill", 1, 0, SVGA3DOP_TEXKILL, },
+ { "tex", 0, 0, SVGA3DOP_TEX, },
+ { "texbem", 1, 1, SVGA3DOP_TEXBEM, },
+ { "texbeml", 1, 1, SVGA3DOP_TEXBEML, },
+ { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, },
+ { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, },
+ { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, },
+ { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, },
+ { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, },
+ { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, },
+ { "reserved0", 0, 0, SVGA3DOP_RESERVED0, },
+ { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, },
+ { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,},
+ { "expp", 1, 1, SVGA3DOP_EXPP, },
+ { "logp", 1, 1, SVGA3DOP_LOGP, },
+ { "cnd", 1, 3, SVGA3DOP_CND, },
+ { "def", 0, 0, SVGA3DOP_DEF, },
+ { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, },
+ { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, },
+ { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,},
+ { "texdp3", 1, 1, SVGA3DOP_TEXDP3, },
+ { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, },
+ { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, },
+ { "cmp", 1, 3, SVGA3DOP_CMP, },
+ { "bem", 1, 2, SVGA3DOP_BEM, },
+ { "dp2add", 1, 3, SVGA3DOP_DP2ADD, },
+ { "dsx", 1, 1, SVGA3DOP_INVALID, },
+ { "dsy", 1, 1, SVGA3DOP_INVALID, },
+ { "texldd", 1, 1, SVGA3DOP_INVALID, },
+ { "setp", 1, 2, SVGA3DOP_SETP, },
+ { "texldl", 1, 1, SVGA3DOP_INVALID, },
+ { "breakp", 1, 1, SVGA3DOP_INVALID, },
+};
+
+const struct sh_opcode_info *sh_svga_opcode_info( uint op )
+{
+ struct sh_opcode_info *info;
+
+ if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) {
+ /* The opcode is either PHASE, COMMENT, END or out of range.
+ */
+ assert( 0 );
+ return NULL;
+ }
+
+ info = &opcode_info[op];
+
+ if (info->svga_opcode == SVGA3DOP_INVALID) {
+ /* No valid information. Please provide number of dst/src registers.
+ */
+ assert( 0 );
+ return NULL;
+ }
+
+ /* Sanity check.
+ */
+ assert( op == info->svga_opcode );
+
+ return info;
+}
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
new file mode 100644
index 0000000000..01d39dca84
--- /dev/null
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
@@ -0,0 +1,46 @@
+/**********************************************************
+ * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+/**
+ * @file
+ * SVGA Shader Token Opcode Info
+ *
+ * @author Michal Krol
+ */
+
+#ifndef ST_SHADER_SVGA_OP_H
+#define ST_SHADER_SVGA_OP_H
+
+struct sh_opcode_info
+{
+ const char *mnemonic;
+ unsigned num_dst:8;
+ unsigned num_src:8;
+ unsigned svga_opcode:16;
+};
+
+const struct sh_opcode_info *sh_svga_opcode_info( unsigned op );
+
+#endif /* ST_SHADER_SVGA_OP_H */
--
cgit v1.2.3
From d185c2fd1318bd41f303ab4a5f6e0a048b76c11c Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 24 Nov 2009 14:43:30 +0000
Subject: svga: Use consistent names for public symbol names of shader dumping
facilities.
---
src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +-
src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 4 ++--
src/gallium/drivers/svga/svgadump/svga_shader_dump.h | 8 ++++----
src/gallium/drivers/svga/svgadump/svga_shader_op.c | 2 +-
src/gallium/drivers/svga/svgadump/svga_shader_op.h | 8 ++++----
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c
index c6c353f58e..910afa2528 100644
--- a/src/gallium/drivers/svga/svgadump/svga_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_dump.c
@@ -1627,7 +1627,7 @@ svga_dump_commands(const void *commands, uint32_t size)
const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body;
dump_SVGA3dCmdDefineShader(cmd);
body = (const uint8_t *)&cmd[1];
- sh_svga_dump((const uint32_t *)body,
+ svga_shader_dump((const uint32_t *)body,
(unsigned)(next - body)/sizeof(uint32_t),
FALSE );
body = next;
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
index c654126d3a..7718bdf757 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -435,7 +435,7 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons
}
void
-sh_svga_dump(
+svga_shader_dump(
const unsigned *assem,
unsigned dwords,
unsigned do_binary )
@@ -602,7 +602,7 @@ sh_svga_dump(
default:
{
- const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode );
+ const struct sh_opcode_info *info = svga_opcode_info( op.opcode );
uint i;
uint num_src = info->num_src + op.predicated;
boolean not_first_arg = FALSE;
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h
index af5549cdba..a2657acb2f 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h
@@ -30,13 +30,13 @@
* @author Michal Krol
*/
-#ifndef ST_SHADER_SVGA_DUMP_H
-#define ST_SHADER_SVGA_DUMP_H
+#ifndef SVGA_SHADER_DUMP_H
+#define SVGA_SHADER_DUMP_H
void
-sh_svga_dump(
+svga_shader_dump(
const unsigned *assem,
unsigned dwords,
unsigned do_binary );
-#endif /* ST_SHADER_SVGA_DUMP_H */
+#endif /* SVGA_SHADER_DUMP_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
index cecc22106b..8343bfdaab 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c
@@ -140,7 +140,7 @@ static struct sh_opcode_info opcode_info[] =
{ "breakp", 1, 1, SVGA3DOP_INVALID, },
};
-const struct sh_opcode_info *sh_svga_opcode_info( uint op )
+const struct sh_opcode_info *svga_opcode_info( uint op )
{
struct sh_opcode_info *info;
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
index 01d39dca84..e558de02c5 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h
@@ -30,8 +30,8 @@
* @author Michal Krol
*/
-#ifndef ST_SHADER_SVGA_OP_H
-#define ST_SHADER_SVGA_OP_H
+#ifndef SVGA_SHADER_OP_H
+#define SVGA_SHADER_OP_H
struct sh_opcode_info
{
@@ -41,6 +41,6 @@ struct sh_opcode_info
unsigned svga_opcode:16;
};
-const struct sh_opcode_info *sh_svga_opcode_info( unsigned op );
+const struct sh_opcode_info *svga_opcode_info( unsigned op );
-#endif /* ST_SHADER_SVGA_OP_H */
+#endif /* SVGA_SHADER_OP_H */
--
cgit v1.2.3
From f3a0615fb0452f11f4db88861b30b2177bdd948a Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Sun, 15 Nov 2009 12:14:03 -0800
Subject: svga: Handle comment tokens when dumping.
---
src/gallium/drivers/svga/svgadump/svga_shader.h | 6 ++++++
src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h
index 2fc1796a90..9217af2dd9 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader.h
+++ b/src/gallium/drivers/svga/svgadump/svga_shader.h
@@ -211,4 +211,10 @@ struct sh_trinaryop
struct sh_srcreg src2;
};
+struct sh_comment
+{
+ unsigned opcode:16;
+ unsigned size:16;
+};
+
#endif /* ST_SHADER_SVGA_H */
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
index 7718bdf757..b0e7fdf378 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -587,7 +587,12 @@ svga_shader_dump(
break;
case SVGA3DOP_COMMENT:
- assert( 0 );
+ {
+ struct sh_comment comment = *(struct sh_comment *)assem;
+
+ /* Ignore comment contents. */
+ assem += sizeof(struct sh_comment) / sizeof(unsigned) + comment.size;
+ }
break;
case SVGA3DOP_RET:
--
cgit v1.2.3
From 8bf4e5d6176b0efb93c11bcd14fa5d320088e2e3 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Tue, 24 Nov 2009 16:01:01 +0000
Subject: llvmpipe: Update instructions.
---
src/gallium/drivers/llvmpipe/README | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README
index 89d08834a3..478e0139c8 100644
--- a/src/gallium/drivers/llvmpipe/README
+++ b/src/gallium/drivers/llvmpipe/README
@@ -51,21 +51,18 @@ Requirements
- Linux
- - udis86, http://udis86.sourceforge.net/ . Use my repository, which decodes
- opcodes not yet supported by upstream.
+ - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD
+ instructions. This is necessary because we emit several SSE intrinsics for
+ convenience. See /proc/cpuinfo to know what your CPU supports.
- git clone git://people.freedesktop.org/~jrfonseca/udis86
- cd udis86
- ./configure --with-pic
- make
- sudo make install
+ - LLVM 2.5 or greater. LLVM 2.6 is preferred.
- - LLVM 2.5. On Debian based distributions do:
+ On Debian based distributions do:
aptitude install llvm-dev
- There is a typo in one of the llvm-dev 2.5 headers, that causes compilation
- errors in the debug build:
+ There is a typo in one of the llvm 2.5 headers, that may cause compilation
+ errors. To fix it apply the change:
--- /usr/include/llvm-c/Core.h.orig 2009-08-10 15:38:54.000000000 +0100
+++ /usr/include/llvm-c/Core.h 2009-08-10 15:38:25.000000000 +0100
@@ -79,12 +76,17 @@ Requirements
#endif
return reinterpret_cast(Vals);
- - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD
- instructions. This is necessary because we emit several SSE intrinsics for
- convenience. See /proc/cpuinfo to know what your CPU supports.
-
- - scons
+ - scons (optional)
+ - udis86, http://udis86.sourceforge.net/ (optional):
+
+ git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86
+ cd udis86
+ ./autogen.sh
+ ./configure --with-pic
+ make
+ sudo make install
+
Building
========
--
cgit v1.2.3
From d4c2f53ca56beb8fe9289fb17c3f5fcc2cc7dc10 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Tue, 24 Nov 2009 12:16:39 -0500
Subject: r600 : fix stack depth setting bug.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 8e57396a0d..0c16594adc 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -6503,14 +6503,14 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
};
}
- if(0 == pAsm->unSubArrayPointer)
+ if(pAsm->CALLSTACK[0].max > 0)
{
- return GL_TRUE;
+ pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2;
}
- if(pAsm->CALLSTACK[0].max > 0)
+ if(0 == pAsm->unSubArrayPointer)
{
- pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2;
+ return GL_TRUE;
}
unCFoffset = plstCFmain->uNumOfNode;
--
cgit v1.2.3
From 11dce740305ea3f45966a9e9f72ba94b4eae6d40 Mon Sep 17 00:00:00 2001
From: Richard Li
Date: Tue, 24 Nov 2009 16:00:25 -0500
Subject: r600 : reset stack flag with one channel only.
---
src/mesa/drivers/dri/r600/r700_assembler.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 0c16594adc..ba97d3e073 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -5663,6 +5663,8 @@ GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue)
pAsm->D2.dst2.literal = 1;
pAsm->D2.dst2.SaturateMode = SATURATE_OFF;
pAsm->D.dst.predicated = 0;
+ /* in reloc where dislink flag init inst, only one slot alu inst is handled. */
+ pAsm->D.dst.math = 1; /* TODO : not math really, but one channel op, more generic alu assembler needed */
#if 0
pAsm->S[0].src.rtype = SRC_REC_LITERAL;
//pAsm->S[0].src.reg = 0;
@@ -6457,6 +6459,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
GLboolean InitShaderProgram(r700_AssemblerBase * pAsm)
{
setRetInLoopFlag(pAsm, SQ_SEL_0);
+ pAsm->alu_x_opcode = SQ_CF_INST_ALU;
return GL_TRUE;
}
@@ -6482,7 +6485,7 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm)
if(SIT_CF_ALU == pInst->m_ShaderInstType)
{
pCF_ALU = (R700ControlFlowALUClause *)pInst;
- if(1 == pCF_ALU->m_Word1.f.count)
+ if(0 == pCF_ALU->m_Word1.f.count)
{
pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP;
}
--
cgit v1.2.3
From ce56a867f71d0a74172a00869a3c5cb1862f4b04 Mon Sep 17 00:00:00 2001
From: Dave Airlie
Date: Wed, 25 Nov 2009 15:45:31 +1000
Subject: r600: add ARB_texture_non_power_of_two support.
This makes the miptree rounds up to the near POT for each level for
all radeons, however since mipmaps aren't support with NPOT on previous
radeons this calculation shouldn't cause any problems. If it does
we can just make it r600 only.
I tested a few mipmap demos on r500 and they all seem to work.
Signed-off-by: Dave Airlie
---
src/mesa/drivers/dri/r600/r600_context.c | 2 +-
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 26 +++++++++++++++++++-----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 7de29e5bb8..25314eff56 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -111,6 +111,7 @@ static const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_env_crossbar", NULL},
{"GL_ARB_texture_env_dot3", NULL},
{"GL_ARB_texture_mirrored_repeat", NULL},
+ {"GL_ARB_texture_non_power_of_two", NULL},
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
@@ -327,7 +328,6 @@ static void r600InitGLExtensions(GLcontext *ctx)
ctx->Extensions.ARB_shader_objects = GL_TRUE;
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
- ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
ctx->Extensions.ATI_separate_stencil = GL_TRUE;
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 46603de2e7..f2f7b2a9fd 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -68,6 +68,19 @@ static unsigned get_compressed_image_size(
return rowStride * ((height + blockHeight - 1) / blockHeight);
}
+static int find_next_power_of_two(GLuint value)
+{
+ int i, tmp;
+
+ i = 0;
+ tmp = value - 1;
+ while (tmp) {
+ tmp >>= 1;
+ i++;
+ }
+ return (1 << i);
+}
+
/**
* Compute sizes and fill in offset and blit information for the given
* image (determined by \p face and \p level).
@@ -80,25 +93,28 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
{
radeon_mipmap_level *lvl = &mt->levels[level];
uint32_t row_align;
+ GLuint height;
+
+ height = find_next_power_of_two(lvl->height);
/* Find image size in bytes */
if (_mesa_is_format_compressed(mt->mesaFormat)) {
lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
- lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height);
+ lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, height);
} else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
row_align = rmesa->texture_rect_row_align - 1;
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * lvl->height;
+ lvl->size = lvl->rowstride * height;
} else if (mt->tilebits & RADEON_TXO_MICRO_TILE) {
/* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned,
* though the actual offset may be different (if texture is less than
* 32 bytes width) to the untiled case */
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31;
- lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth;
+ lvl->size = lvl->rowstride * ((height + 1) / 2) * lvl->depth;
} else {
row_align = rmesa->texture_row_align - 1;
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * lvl->height * lvl->depth;
+ lvl->size = lvl->rowstride * height * lvl->depth;
}
assert(lvl->size > 0);
@@ -110,7 +126,7 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
if (RADEON_DEBUG & RADEON_TEXTURE)
fprintf(stderr,
"level %d, face %d: rs:%d %dx%d at %d\n",
- level, face, lvl->rowstride, lvl->width, lvl->height, lvl->faces[face].offset);
+ level, face, lvl->rowstride, lvl->width, height, lvl->faces[face].offset);
}
static GLuint minify(GLuint size, GLuint levels)
--
cgit v1.2.3
From 9e3728c858e0f84b05a24f858f6aeba53fa4e7cb Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Wed, 25 Nov 2009 18:06:12 +0000
Subject: scons: Make it work with MinGW build of LLVM 2.6.
LLVM 2.5 is no longer supported on windows.
---
scons/llvm.py | 52 +++++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/scons/llvm.py b/scons/llvm.py
index 73e9310f71..7b26650290 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -58,45 +58,47 @@ def generate(env):
env.PrependENVPath('PATH', llvm_bin_dir)
- if env['msvc']:
+ if env['platform'] == 'windows':
# XXX: There is no llvm-config on Windows, so assume a standard layout
if llvm_dir is not None:
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
+ env.AppendUnique(CPPDEFINES = [
+ '__STDC_LIMIT_MACROS',
+ '__STDC_CONSTANT_MACROS',
+ ])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
env.Prepend(LIBS = [
+ 'LLVMX86AsmParser',
+ 'LLVMX86AsmPrinter',
+ 'LLVMX86CodeGen',
+ 'LLVMX86Info',
+ 'LLVMLinker',
+ 'LLVMipo',
+ 'LLVMInterpreter',
+ 'LLVMInstrumentation',
+ 'LLVMJIT',
+ 'LLVMExecutionEngine',
+ 'LLVMDebugger',
'LLVMBitWriter',
- 'LLVMCore',
- 'LLVMSupport',
- 'LLVMSystem',
- 'LLVMSupport',
- 'LLVMSystem',
- 'LLVMCore',
- 'LLVMCodeGen',
+ 'LLVMAsmParser',
+ 'LLVMArchive',
+ 'LLVMBitReader',
'LLVMSelectionDAG',
'LLVMAsmPrinter',
- 'LLVMBitReader',
- 'LLVMBitWriter',
- 'LLVMTransformUtils',
- 'LLVMInstrumentation',
+ 'LLVMCodeGen',
'LLVMScalarOpts',
- 'LLVMipo',
- 'LLVMHello',
- 'LLVMLinker',
- 'LLVMAnalysis',
+ 'LLVMTransformUtils',
'LLVMipa',
- 'LLVMX86CodeGen',
- 'LLVMX86AsmPrinter',
- 'LLVMExecutionEngine',
- 'LLVMInterpreter',
- 'LLVMJIT',
+ 'LLVMAnalysis',
'LLVMTarget',
- 'LLVMAsmParser',
- 'LLVMDebugger',
- 'LLVMArchive',
+ 'LLVMMC',
+ 'LLVMCore',
+ 'LLVMSupport',
+ 'LLVMSystem',
'imagehlp',
'psapi',
])
- env['LLVM_VERSION'] = '2.5'
+ env['LLVM_VERSION'] = '2.6'
return
elif env.Detect('llvm-config'):
version = env.backtick('llvm-config --version').rstrip()
--
cgit v1.2.3
From da1c40260d8cb49eacbb6c394198dc37e020e75a Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Thu, 26 Nov 2009 11:15:08 +0000
Subject: llvmpipe: Update/correct CPU requirements.
There are no hard requirements at the moment.
We don't really emit any sse3 yet. Just some ssse3.
Thanks to Roland for spotting these incorrections.
---
src/gallium/drivers/llvmpipe/README | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README
index 478e0139c8..0c3f00fd58 100644
--- a/src/gallium/drivers/llvmpipe/README
+++ b/src/gallium/drivers/llvmpipe/README
@@ -51,9 +51,13 @@ Requirements
- Linux
- - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD
- instructions. This is necessary because we emit several SSE intrinsics for
- convenience. See /proc/cpuinfo to know what your CPU supports.
+ - A x86 or amd64 processor. 64bit mode is preferred.
+
+ Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
+ yield the most efficient code. The less features the CPU has the more
+ likely is that you ran into underperforming, buggy, or incomplete code.
+
+ See /proc/cpuinfo to know what your CPU supports.
- LLVM 2.5 or greater. LLVM 2.6 is preferred.
--
cgit v1.2.3
From 953b74d116c88f2b93740b6d1f713bb1b5989e98 Mon Sep 17 00:00:00 2001
From: José Fonseca
Date: Thu, 26 Nov 2009 11:16:19 +0000
Subject: llvmpipe: Fake missing SSSE3 when simulation less capabable machines.
SSE3 != SSSE3 and so far we only use the later.
---
src/gallium/drivers/llvmpipe/lp_jit.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index c601c79480..bce3baec16 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -154,6 +154,7 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
#if 0
/* For simulating less capable machines */
util_cpu_caps.has_sse3 = 0;
+ util_cpu_caps.has_ssse3 = 0;
util_cpu_caps.has_sse4_1 = 0;
#endif
--
cgit v1.2.3
From 75df599e30bda03b40c0442eff3e39ec84397ede Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 26 Nov 2009 19:21:55 +0100
Subject: tgsi/ureg: Add forgotten goto in ureg_DECL_constant().
---
src/gallium/auxiliary/tgsi/tgsi_ureg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 5526a5d034..bd963267cc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -352,6 +352,7 @@ struct ureg_src ureg_DECL_constant(struct ureg_program *ureg,
i = ureg->nr_constant_ranges++;
ureg->constant_range[i].first = index;
ureg->constant_range[i].last = index;
+ goto out;
}
/* Collapse all ranges down to one:
--
cgit v1.2.3
From 3bae72e20493aeb683e16297d67648e59a817b76 Mon Sep 17 00:00:00 2001
From: Keith Whitwell
Date: Thu, 26 Nov 2009 19:24:57 +0100
Subject: draw: Fix max_index check.
We want to fallback to draw splitting when vertex element indices
might be too high for atomic draw path (currently limited to 4095).
---
src/gallium/auxiliary/draw/draw_pt_vcache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index d3f179ced1..757c487454 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -346,7 +346,8 @@ vcache_check_run( struct draw_pt_front_end *frontend,
vcache->fetch_max,
draw_count);
- if (max_index == 0xffffffff ||
+ if (max_index >= DRAW_PIPE_MAX_VERTICES ||
+ fetch_count >= UNDEFINED_VERTEX_ID ||
fetch_count > draw_count) {
if (0) debug_printf("fail\n");
goto fail;
--
cgit v1.2.3
From a2c101029d5cb3f74ec9a2a9a53cb1d74ab9cc57 Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 26 Nov 2009 20:30:04 +0100
Subject: tgsi/exec: Force return from a subroutine at ENDSUB.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 89740cee89..268c5a632a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -3217,7 +3217,28 @@ exec_instruction(
break;
case TGSI_OPCODE_ENDSUB:
- /* no-op */
+ /*
+ * XXX: This really should be a no-op. We should never reach this opcode.
+ */
+
+ assert(mach->CallStackTop > 0);
+ mach->CallStackTop--;
+
+ mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop;
+ mach->CondMask = mach->CondStack[mach->CondStackTop];
+
+ mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop;
+ mach->LoopMask = mach->LoopStack[mach->LoopStackTop];
+
+ mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop;
+ mach->ContMask = mach->ContStack[mach->ContStackTop];
+
+ assert(mach->FuncStackTop > 0);
+ mach->FuncMask = mach->FuncStack[--mach->FuncStackTop];
+
+ *pc = mach->CallStack[mach->CallStackTop].ReturnAddr;
+
+ UPDATE_EXEC_MASK(mach);
break;
case TGSI_OPCODE_NOP:
@@ -3347,5 +3368,10 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
}
#endif
+ assert(mach->CondStackTop == 0);
+ assert(mach->LoopStackTop == 0);
+ assert(mach->ContStackTop == 0);
+ assert(mach->CallStackTop == 0);
+
return ~mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0];
}
--
cgit v1.2.3
From 884007546c98b1779bf266ec5111b1e7e2b68b2e Mon Sep 17 00:00:00 2001
From: Michal Krol
Date: Thu, 26 Nov 2009 20:38:43 +0100
Subject: tgsi/exec: Fix orientation of DDY.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 268c5a632a..e22a1643c8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -501,7 +501,7 @@ micro_ddy(
dst->f[0] =
dst->f[1] =
dst->f[2] =
- dst->f[3] = src->f[TILE_TOP_LEFT] - src->f[TILE_BOTTOM_LEFT];
+ dst->f[3] = src->f[TILE_BOTTOM_LEFT] - src->f[TILE_TOP_LEFT];
}
static void
--
cgit v1.2.3
From d509f84543d0979e9bb53c20c195f378dd61e728 Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Thu, 26 Nov 2009 22:49:58 +0100
Subject: gallium: fix more statetrackers/drivers for not using texture
width/height/depth arrays
---
src/gallium/auxiliary/util/u_gen_mipmap.c | 8 +--
src/gallium/drivers/cell/ppu/cell_state_emit.c | 7 +-
src/gallium/drivers/cell/ppu/cell_texture.c | 27 ++++---
src/gallium/drivers/llvmpipe/lp_bld_sample.c | 6 +-
src/gallium/drivers/llvmpipe/lp_state_sampler.c | 4 +-
src/gallium/drivers/llvmpipe/lp_tex_cache.c | 5 +-
src/gallium/drivers/llvmpipe/lp_tex_sample_c.c | 30 ++++----
src/gallium/drivers/llvmpipe/lp_texture.c | 31 ++++----
src/gallium/drivers/nv04/nv04_fragtex.c | 4 +-
src/gallium/drivers/nv04/nv04_miptree.c | 19 +++--
src/gallium/drivers/nv04/nv04_transfer.c | 7 +-
src/gallium/drivers/nv10/nv10_fragtex.c | 8 +--
src/gallium/drivers/nv10/nv10_miptree.c | 18 ++---
src/gallium/drivers/nv10/nv10_transfer.c | 7 +-
src/gallium/drivers/nv20/nv20_fragtex.c | 8 +--
src/gallium/drivers/nv20/nv20_miptree.c | 31 ++++----
src/gallium/drivers/nv20/nv20_transfer.c | 7 +-
src/gallium/drivers/nv30/nv30_fragtex.c | 10 +--
src/gallium/drivers/nv30/nv30_miptree.c | 36 +++++-----
src/gallium/drivers/nv30/nv30_transfer.c | 7 +-
src/gallium/drivers/nv40/nv40_fragtex.c | 6 +-
src/gallium/drivers/nv40/nv40_miptree.c | 36 +++++-----
src/gallium/drivers/nv40/nv40_transfer.c | 7 +-
src/gallium/drivers/nv50/nv50_miptree.c | 21 +++---
src/gallium/drivers/nv50/nv50_tex.c | 4 +-
src/gallium/drivers/nv50/nv50_transfer.c | 11 +--
src/gallium/drivers/r300/r300_texture.c | 48 ++++++-------
src/gallium/state_trackers/dri/dri_drawable.c | 8 +--
src/gallium/state_trackers/egl/egl_surface.c | 6 +-
src/gallium/state_trackers/python/p_device.i | 6 +-
src/gallium/state_trackers/python/p_texture.i | 12 ++--
.../state_trackers/python/retrace/interpreter.py | 6 +-
src/gallium/state_trackers/python/st_device.c | 10 +--
src/gallium/state_trackers/python/st_sample.c | 4 +-
src/gallium/state_trackers/vega/api_filters.c | 8 +--
src/gallium/state_trackers/vega/image.c | 16 ++---
src/gallium/state_trackers/vega/mask.c | 12 ++--
src/gallium/state_trackers/vega/paint.c | 10 +--
src/gallium/state_trackers/vega/renderer.c | 46 ++++++------
src/gallium/state_trackers/vega/vg_tracker.c | 6 +-
src/gallium/state_trackers/xorg/xorg_composite.c | 4 +-
src/gallium/state_trackers/xorg/xorg_crtc.c | 6 +-
src/gallium/state_trackers/xorg/xorg_dri2.c | 6 +-
src/gallium/state_trackers/xorg/xorg_exa.c | 30 ++++----
src/gallium/state_trackers/xorg/xorg_renderer.c | 82 +++++++++++-----------
src/gallium/state_trackers/xorg/xorg_xv.c | 22 +++---
src/gallium/state_trackers/xorg/xvmc/surface.c | 6 +-
.../winsys/drm/nouveau/drm/nouveau_drm_api.c | 6 +-
src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 6 +-
src/mesa/state_tracker/st_cb_fbo.c | 2 +-
50 files changed, 360 insertions(+), 373 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 84db14576e..f67f1e458d 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1214,12 +1214,12 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
- pt->width[srcLevel],
- pt->height[srcLevel]);
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel));
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
- pt->width[dstLevel],
- pt->height[dstLevel]);
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel));
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c
index 9479c0898f..ac5fafec1a 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_emit.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c
@@ -27,6 +27,7 @@
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
+#include "util/u_math.h"
#include "cell_context.h"
#include "cell_gen_fragment.h"
#include "cell_state.h"
@@ -299,9 +300,9 @@ cell_emit_state(struct cell_context *cell)
for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) {
texture->start[level] = (ct->mapped +
ct->level_offset[level]);
- texture->width[level] = ct->base.width[level];
- texture->height[level] = ct->base.height[level];
- texture->depth[level] = ct->base.depth[level];
+ texture->width[level] = u_minify(ct->base.width0, level);
+ texture->height[level] = u_minify(ct->base.height0, level);
+ texture->depth[level] = u_minify(ct->base.depth0, level);
}
texture->target = ct->base.target;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index ae4c61efb3..e6b8a87045 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -49,9 +49,9 @@ cell_texture_layout(struct cell_texture *ct)
{
struct pipe_texture *pt = &ct->base;
unsigned level;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
+ unsigned depth = pt->depth0;
ct->buffer_size = 0;
@@ -65,9 +65,6 @@ cell_texture_layout(struct cell_texture *ct)
w_tile = align(width, TILE_SIZE);
h_tile = align(height, TILE_SIZE);
- pt->width[level] = width;
- pt->height[level] = height;
- pt->depth[level] = depth;
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w_tile);
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h_tile);
@@ -83,9 +80,9 @@ cell_texture_layout(struct cell_texture *ct)
ct->buffer_size += size;
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
}
@@ -276,8 +273,8 @@ cell_get_tex_surface(struct pipe_screen *screen,
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->offset = ct->level_offset[level];
/* XXX may need to override usage flags (see sp_texture.c) */
ps->usage = usage;
@@ -386,8 +383,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
struct pipe_texture *pt = transfer->texture;
struct cell_texture *ct = cell_texture(pt);
const uint level = ctrans->base.level;
- const uint texWidth = pt->width[level];
- const uint texHeight = pt->height[level];
+ const uint texWidth = u_minify(pt->width0, level);
+ const uint texHeight = u_minify(pt->height0, level);
const uint stride = ct->stride[level];
unsigned size;
@@ -440,8 +437,8 @@ cell_transfer_unmap(struct pipe_screen *screen,
struct pipe_texture *pt = transfer->texture;
struct cell_texture *ct = cell_texture(pt);
const uint level = ctrans->base.level;
- const uint texWidth = pt->width[level];
- const uint texHeight = pt->height[level];
+ const uint texWidth = u_minify(pt->width0, level);
+ const uint texHeight = u_minify(pt->height0, level);
const uint stride = ct->stride[level];
if (!ct->mapped) {
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.c b/src/gallium/drivers/llvmpipe/lp_bld_sample.c
index 4d272bea87..af70ddc6ab 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.c
@@ -59,9 +59,9 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
state->format = texture->format;
state->target = texture->target;
- state->pot_width = util_is_pot(texture->width[0]);
- state->pot_height = util_is_pot(texture->height[0]);
- state->pot_depth = util_is_pot(texture->depth[0]);
+ state->pot_width = util_is_pot(texture->width0);
+ state->pot_height = util_is_pot(texture->height0);
+ state->pot_depth = util_is_pot(texture->depth0);
state->wrap_s = sampler->wrap_s;
state->wrap_t = sampler->wrap_t;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index c69d90c723..8333805a3f 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -102,8 +102,8 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe,
if(tex) {
struct llvmpipe_texture *lp_tex = llvmpipe_texture(tex);
struct lp_jit_texture *jit_tex = &llvmpipe->jit_context.textures[i];
- jit_tex->width = tex->width[0];
- jit_tex->height = tex->height[0];
+ jit_tex->width = tex->width0;
+ jit_tex->height = tex->height0;
jit_tex->stride = lp_tex->stride[0];
if(!lp_tex->dt)
jit_tex->data = lp_tex->data;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
index 773e848242..c7c4143bc6 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
@@ -36,6 +36,7 @@
#include "util/u_memory.h"
#include "util/u_tile.h"
#include "util/u_format.h"
+#include "util/u_math.h"
#include "lp_context.h"
#include "lp_surface.h"
#include "lp_texture.h"
@@ -270,8 +271,8 @@ lp_find_cached_tex_tile(struct llvmpipe_tex_tile_cache *tc,
addr.bits.level,
addr.bits.z,
PIPE_TRANSFER_READ, 0, 0,
- tc->texture->width[addr.bits.level],
- tc->texture->height[addr.bits.level]);
+ u_minify(tc->texture->width0, addr.bits.level),
+ u_minify(tc->texture->height0, addr.bits.level));
tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c b/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c
index a1365a045f..0d01c07fb5 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c
@@ -544,7 +544,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler,
float dsdy = s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT];
dsdx = fabsf(dsdx);
dsdy = fabsf(dsdy);
- rho = MAX2(dsdx, dsdy) * texture->width[0];
+ rho = MAX2(dsdx, dsdy) * texture->width0;
}
if (t) {
float dtdx = t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT];
@@ -552,7 +552,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler,
float max;
dtdx = fabsf(dtdx);
dtdy = fabsf(dtdy);
- max = MAX2(dtdx, dtdy) * texture->height[0];
+ max = MAX2(dtdx, dtdy) * texture->height0;
rho = MAX2(rho, max);
}
if (p) {
@@ -561,7 +561,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler,
float max;
dpdx = fabsf(dpdx);
dpdy = fabsf(dpdy);
- max = MAX2(dpdx, dpdy) * texture->depth[0];
+ max = MAX2(dpdx, dpdy) * texture->depth0;
rho = MAX2(rho, max);
}
@@ -726,9 +726,9 @@ get_texel(const struct tgsi_sampler *tgsi_sampler,
const struct pipe_texture *texture = samp->texture;
const struct pipe_sampler_state *sampler = samp->sampler;
- if (x < 0 || x >= (int) texture->width[level] ||
- y < 0 || y >= (int) texture->height[level] ||
- z < 0 || z >= (int) texture->depth[level]) {
+ if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
+ y < 0 || y >= (int) u_minify(texture->height0, level) ||
+ z < 0 || z >= (int) u_minify(texture->depth0, level)) {
rgba[0][j] = sampler->border_color[0];
rgba[1][j] = sampler->border_color[1];
rgba[2][j] = sampler->border_color[2];
@@ -1093,8 +1093,8 @@ lp_get_samples_2d_common(struct tgsi_sampler *tgsi_sampler,
assert(sampler->normalized_coords);
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
@@ -1250,9 +1250,9 @@ lp_get_samples_3d(struct tgsi_sampler *tgsi_sampler,
assert(sampler->normalized_coords);
- width = texture->width[level0];
- height = texture->height[level0];
- depth = texture->depth[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
+ depth = u_minify(texture->depth0, level0);
assert(width > 0);
assert(height > 0);
@@ -1394,8 +1394,8 @@ lp_get_samples_rect(struct tgsi_sampler *tgsi_sampler,
/* texture RECTS cannot be mipmapped */
assert(level0 == level1);
- width = texture->width[level0];
- height = texture->height[level0];
+ width = u_minify(texture->width0, level0);
+ height = u_minify(texture->height0, level0);
assert(width > 0);
@@ -1513,8 +1513,8 @@ lp_get_samples(struct tgsi_sampler *tgsi_sampler,
/* Do this elsewhere:
*/
- samp->xpot = util_unsigned_logbase2( samp->texture->width[0] );
- samp->ypot = util_unsigned_logbase2( samp->texture->height[0] );
+ samp->xpot = util_unsigned_logbase2( samp->texture->width0 );
+ samp->ypot = util_unsigned_logbase2( samp->texture->height0 );
/* Try to hook in a faster sampler. Ultimately we'll have to
* code-generate these. Luckily most of this looks like it is
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index a00f2495df..0a0f31f8a3 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -57,9 +57,9 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
{
struct pipe_texture *pt = &lpt->base;
unsigned level;
- unsigned width = pt->width[0];
- unsigned height = pt->height[0];
- unsigned depth = pt->depth[0];
+ unsigned width = pt->width0;
+ unsigned height = pt->height0;
+ unsigned depth = pt->depth0;
unsigned buffer_size = 0;
@@ -68,9 +68,6 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
for (level = 0; level <= pt->last_level; level++) {
unsigned nblocksx, nblocksy;
- pt->width[level] = width;
- pt->height[level] = height;
- pt->depth[level] = depth;
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
@@ -87,9 +84,9 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
lpt->stride[level]);
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
lpt->data = align_malloc(buffer_size, 16);
@@ -104,13 +101,13 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
struct llvmpipe_winsys *winsys = screen->winsys;
pf_get_block(lpt->base.format, &lpt->base.block);
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width[0]);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height[0]);
+ lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
+ lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
lpt->dt = winsys->displaytarget_create(winsys,
lpt->base.format,
- lpt->base.width[0],
- lpt->base.height[0],
+ lpt->base.width0,
+ lpt->base.height0,
16,
&lpt->stride[0] );
@@ -183,8 +180,8 @@ llvmpipe_texture_blanket(struct pipe_screen * screen,
lpt->base = *base;
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = screen;
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width[0]);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height[0]);
+ lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
+ lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
lpt->stride[0] = stride[0];
pipe_buffer_reference(&lpt->buffer, buffer);
@@ -229,8 +226,8 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->offset = lpt->level_offset[level];
ps->usage = usage;
diff --git a/src/gallium/drivers/nv04/nv04_fragtex.c b/src/gallium/drivers/nv04/nv04_fragtex.c
index 21f990fd53..0cce71ad1d 100644
--- a/src/gallium/drivers/nv04/nv04_fragtex.c
+++ b/src/gallium/drivers/nv04/nv04_fragtex.c
@@ -57,8 +57,8 @@ nv04_fragtex_build(struct nv04_context *nv04, int unit)
| NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER
| nv04_fragtex_format(pt->format)
| ( (pt->last_level + 1) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT )
- | ( log2i(pt->width[0]) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT )
- | ( log2i(pt->height[0]) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT )
+ | ( log2i(pt->width0) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT )
+ | ( log2i(pt->height0) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT )
| NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE
| NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE
;
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 93f752faec..4fd72c82e6 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv04_context.h"
#include "nv04_screen.h"
@@ -9,31 +10,29 @@ static void
nv04_miptree_layout(struct nv04_miptree *nv04mt)
{
struct pipe_texture *pt = &nv04mt->base;
- uint width = pt->width[0], height = pt->height[0];
+ uint width = pt->width0, height = pt->height0;
uint offset = 0;
int nr_faces, l;
nr_faces = 1;
for (l = 0; l <= pt->last_level; l++) {
- pt->width[l] = width;
- pt->height[l] = height;
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
- nv04mt->level[l].pitch = pt->width[0];
+ nv04mt->level[l].pitch = pt->width0;
nv04mt->level[l].pitch = (nv04mt->level[l].pitch + 63) & ~63;
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
}
for (l = 0; l <= pt->last_level; l++) {
nv04mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
- offset += nv04mt->level[l].pitch * pt->height[l];
+ offset += nv04mt->level[l].pitch * u_minify(pt->height0, l);
}
nv04mt->total_size = offset;
@@ -75,7 +74,7 @@ nv04_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv04_miptree);
@@ -120,8 +119,8 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ns->base.texture, pt);
ns->base.format = pt->format;
- ns->base.width = pt->width[level];
- ns->base.height = pt->height[level];
+ ns->base.width = u_minify(pt->width0, level);
+ ns->base.height = u_minify(pt->height0, level);
ns->base.usage = flags;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c
index 6618660743..e6456429f4 100644
--- a/src/gallium/drivers/nv04/nv04_transfer.c
+++ b/src/gallium/drivers/nv04/nv04_transfer.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include "nv04_context.h"
#include "nv04_screen.h"
@@ -20,9 +21,9 @@ nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
memset(template, 0, sizeof(struct pipe_texture));
template->target = pt->target;
template->format = pt->format;
- template->width[0] = pt->width[level];
- template->height[0] = pt->height[level];
- template->depth[0] = 1;
+ template->width0 = u_minify(pt->width0, level);
+ template->height0 = u_minify(pt->height0, level);
+ template->depth0 = 1;
template->block = pt->block;
template->nblocksx[0] = pt->nblocksx[level];
template->nblocksy[0] = pt->nblocksx[level];
diff --git a/src/gallium/drivers/nv10/nv10_fragtex.c b/src/gallium/drivers/nv10/nv10_fragtex.c
index 27f2f87584..906fdfeeb9 100644
--- a/src/gallium/drivers/nv10/nv10_fragtex.c
+++ b/src/gallium/drivers/nv10/nv10_fragtex.c
@@ -62,9 +62,9 @@ nv10_fragtex_build(struct nv10_context *nv10, int unit)
txf = tf->format << 8;
txf |= (pt->last_level + 1) << 16;
- txf |= log2i(pt->width[0]) << 20;
- txf |= log2i(pt->height[0]) << 24;
- txf |= log2i(pt->depth[0]) << 28;
+ txf |= log2i(pt->width0) << 20;
+ txf |= log2i(pt->height0) << 24;
+ txf |= log2i(pt->depth0) << 28;
txf |= 8;
switch (pt->target) {
@@ -89,7 +89,7 @@ nv10_fragtex_build(struct nv10_context *nv10, int unit)
OUT_RING (0x40000000); /* enable */
OUT_RING (txs);
OUT_RING (ps->filt | 0x2000 /* magic */);
- OUT_RING ((pt->width[0] << 16) | pt->height[0]);
+ OUT_RING ((pt->width0 << 16) | pt->height0);
OUT_RING (ps->bcol);
#endif
}
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index 34e3c2ebd7..b2a6c59b74 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv10_context.h"
#include "nv10_screen.h"
@@ -10,7 +11,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
{
struct pipe_texture *pt = &nv10mt->base;
boolean swizzled = FALSE;
- uint width = pt->width[0], height = pt->height[0];
+ uint width = pt->width0, height = pt->height0;
uint offset = 0;
int nr_faces, l, f;
@@ -21,8 +22,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
}
for (l = 0; l <= pt->last_level; l++) {
- pt->width[l] = width;
- pt->height[l] = height;
+
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
@@ -35,15 +35,15 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
nv10mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
}
for (f = 0; f < nr_faces; f++) {
for (l = 0; l <= pt->last_level; l++) {
nv10mt->level[l].image_offset[f] = offset;
- offset += nv10mt->level[l].pitch * pt->height[l];
+ offset += nv10mt->level[l].pitch * u_minify(pt->height0, l);
}
}
@@ -58,7 +58,7 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv10_miptree);
@@ -133,8 +133,8 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ns->base.texture, pt);
ns->base.format = pt->format;
- ns->base.width = pt->width[level];
- ns->base.height = pt->height[level];
+ ns->base.width = u_minify(pt->width0, level);
+ ns->base.height = u_minify(pt->height0, level);
ns->base.usage = flags;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c
index 8feb85e4bd..ec54297ab0 100644
--- a/src/gallium/drivers/nv10/nv10_transfer.c
+++ b/src/gallium/drivers/nv10/nv10_transfer.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include "nv10_context.h"
#include "nv10_screen.h"
@@ -20,9 +21,9 @@ nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
memset(template, 0, sizeof(struct pipe_texture));
template->target = pt->target;
template->format = pt->format;
- template->width[0] = pt->width[level];
- template->height[0] = pt->height[level];
- template->depth[0] = 1;
+ template->width0 = u_minify(pt->width0, level);
+ template->height0 = u_minify(pt->height0, level);
+ template->depth0 = 1;
template->block = pt->block;
template->nblocksx[0] = pt->nblocksx[level];
template->nblocksy[0] = pt->nblocksx[level];
diff --git a/src/gallium/drivers/nv20/nv20_fragtex.c b/src/gallium/drivers/nv20/nv20_fragtex.c
index 495a7be912..2db4a4015a 100644
--- a/src/gallium/drivers/nv20/nv20_fragtex.c
+++ b/src/gallium/drivers/nv20/nv20_fragtex.c
@@ -62,9 +62,9 @@ nv20_fragtex_build(struct nv20_context *nv20, int unit)
txf = tf->format << 8;
txf |= (pt->last_level + 1) << 16;
- txf |= log2i(pt->width[0]) << 20;
- txf |= log2i(pt->height[0]) << 24;
- txf |= log2i(pt->depth[0]) << 28;
+ txf |= log2i(pt->width0) << 20;
+ txf |= log2i(pt->height0) << 24;
+ txf |= log2i(pt->depth0) << 28;
txf |= 8;
switch (pt->target) {
@@ -89,7 +89,7 @@ nv20_fragtex_build(struct nv20_context *nv20, int unit)
OUT_RING (0x40000000); /* enable */
OUT_RING (txs);
OUT_RING (ps->filt | 0x2000 /* magic */);
- OUT_RING ((pt->width[0] << 16) | pt->height[0]);
+ OUT_RING ((pt->width0 << 16) | pt->height0);
OUT_RING (ps->bcol);
#endif
}
diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c
index 185fbf53e0..554e28e47d 100644
--- a/src/gallium/drivers/nv20/nv20_miptree.c
+++ b/src/gallium/drivers/nv20/nv20_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv20_context.h"
#include "nv20_screen.h"
@@ -9,7 +10,7 @@ static void
nv20_miptree_layout(struct nv20_miptree *nv20mt)
{
struct pipe_texture *pt = &nv20mt->base;
- uint width = pt->width[0], height = pt->height[0];
+ uint width = pt->width0, height = pt->height0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -25,21 +26,19 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
}
for (l = 0; l <= pt->last_level; l++) {
- pt->width[l] = width;
- pt->height[l] = height;
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- nv20mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64);
+ nv20mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
else
- nv20mt->level[l].pitch = pt->width[l] * pt->block.size;
+ nv20mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
nv20mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -47,14 +46,14 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt)
nv20mt->level[l].image_offset[f] = offset;
if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
- pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
- offset += align(nv20mt->level[l].pitch * pt->height[l], 64);
+ u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1)
+ offset += align(nv20mt->level[l].pitch * u_minify(pt->height0, l), 64);
else
- offset += nv20mt->level[l].pitch * pt->height[l];
+ offset += nv20mt->level[l].pitch * u_minify(pt->height0, l);
}
nv20mt->level[l].image_offset[f] = offset;
- offset += nv20mt->level[l].pitch * pt->height[l];
+ offset += nv20mt->level[l].pitch * u_minify(pt->height0, l);
}
nv20mt->total_size = offset;
@@ -68,7 +67,7 @@ nv20_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv20_miptree);
@@ -100,8 +99,8 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
mt->base.screen = screen;
/* Swizzled textures must be POT */
- if (pt->width[0] & (pt->width[0] - 1) ||
- pt->height[0] & (pt->height[0] - 1))
+ if (pt->width0 & (pt->width0 - 1) ||
+ pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
@@ -167,8 +166,8 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ns->base.texture, pt);
ns->base.format = pt->format;
- ns->base.width = pt->width[level];
- ns->base.height = pt->height[level];
+ ns->base.width = u_minify(pt->width0, level);
+ ns->base.height = u_minify(pt->height0, level);
ns->base.usage = flags;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c
index 81b4f1a917..87b5c14a3c 100644
--- a/src/gallium/drivers/nv20/nv20_transfer.c
+++ b/src/gallium/drivers/nv20/nv20_transfer.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include "nv20_context.h"
#include "nv20_screen.h"
@@ -20,9 +21,9 @@ nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
memset(template, 0, sizeof(struct pipe_texture));
template->target = pt->target;
template->format = pt->format;
- template->width[0] = pt->width[level];
- template->height[0] = pt->height[level];
- template->depth[0] = 1;
+ template->width0 = u_minify(pt->width0, level);
+ template->height0 = u_minify(pt->height0, level);
+ template->depth0 = 1;
template->block = pt->block;
template->nblocksx[0] = pt->nblocksx[level];
template->nblocksy[0] = pt->nblocksx[level];
diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c
index dca760cae6..b3293ee700 100644
--- a/src/gallium/drivers/nv30/nv30_fragtex.c
+++ b/src/gallium/drivers/nv30/nv30_fragtex.c
@@ -74,9 +74,9 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
txf = tf->format;
txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0);
- txf |= log2i(pt->width[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT;
- txf |= log2i(pt->height[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT;
- txf |= log2i(pt->depth[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT;
+ txf |= log2i(pt->width0) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT;
+ txf |= log2i(pt->height0) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT;
+ txf |= log2i(pt->depth0) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT;
txf |= NV34TCL_TX_FORMAT_NO_BORDER | 0x10000;
switch (pt->target) {
@@ -115,8 +115,8 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
so_data (so, NV34TCL_TX_ENABLE_ENABLE | ps->en);
so_data (so, txs);
so_data (so, ps->filt | 0x2000 /*voodoo*/);
- so_data (so, (pt->width[0] << NV34TCL_TX_NPOT_SIZE_W_SHIFT) |
- pt->height[0]);
+ so_data (so, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) |
+ pt->height0);
so_data (so, ps->bcol);
return so;
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 280696d450..b4c306d127 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv30_context.h"
@@ -8,7 +9,7 @@ static void
nv30_miptree_layout(struct nv30_miptree *nv30mt)
{
struct pipe_texture *pt = &nv30mt->base;
- uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
+ uint width = pt->width0, height = pt->height0, depth = pt->depth0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -21,29 +22,26 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
nr_faces = 6;
} else
if (pt->target == PIPE_TEXTURE_3D) {
- nr_faces = pt->depth[0];
+ nr_faces = pt->depth0;
} else {
nr_faces = 1;
}
for (l = 0; l <= pt->last_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, height);
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- nv30mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64);
+ nv30mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
else
- nv30mt->level[l].pitch = pt->width[l] * pt->block.size;
+ nv30mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
nv30mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
- depth = MAX2(1, depth >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -51,14 +49,14 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
nv30mt->level[l].image_offset[f] = offset;
if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
- pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
- offset += align(nv30mt->level[l].pitch * pt->height[l], 64);
+ u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1)
+ offset += align(nv30mt->level[l].pitch * u_minify(pt->height0, l), 64);
else
- offset += nv30mt->level[l].pitch * pt->height[l];
+ offset += nv30mt->level[l].pitch * u_minify(pt->height0, l);
}
nv30mt->level[l].image_offset[f] = offset;
- offset += nv30mt->level[l].pitch * pt->height[l];
+ offset += nv30mt->level[l].pitch * u_minify(pt->height0, l);
}
nv30mt->total_size = offset;
@@ -79,8 +77,8 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base.screen = pscreen;
/* Swizzled textures must be POT */
- if (pt->width[0] & (pt->width[0] - 1) ||
- pt->height[0] & (pt->height[0] - 1))
+ if (pt->width0 & (pt->width0 - 1) ||
+ pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
@@ -134,7 +132,7 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv30_miptree);
@@ -182,8 +180,8 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ns->base.texture, pt);
ns->base.format = pt->format;
- ns->base.width = pt->width[level];
- ns->base.height = pt->height[level];
+ ns->base.width = u_minify(pt->width0, level);
+ ns->base.height = u_minify(pt->height0, level);
ns->base.usage = flags;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
index 98011decf7..5e429b4d85 100644
--- a/src/gallium/drivers/nv30/nv30_transfer.c
+++ b/src/gallium/drivers/nv30/nv30_transfer.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include "nv30_context.h"
#include "nv30_screen.h"
@@ -20,9 +21,9 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
memset(template, 0, sizeof(struct pipe_texture));
template->target = pt->target;
template->format = pt->format;
- template->width[0] = pt->width[level];
- template->height[0] = pt->height[level];
- template->depth[0] = 1;
+ template->width0 = u_minify(pt->width0, level);
+ template->height0 = u_minify(pt->height0, level);
+ template->depth0 = 1;
template->block = pt->block;
template->nblocksx[0] = pt->nblocksx[level];
template->nblocksy[0] = pt->nblocksx[level];
diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c
index e2ec57564d..44abc84596 100644
--- a/src/gallium/drivers/nv40/nv40_fragtex.c
+++ b/src/gallium/drivers/nv40/nv40_fragtex.c
@@ -117,11 +117,11 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en);
so_data (so, txs);
so_data (so, ps->filt | tf->sign | 0x2000 /*voodoo*/);
- so_data (so, (pt->width[0] << NV40TCL_TEX_SIZE0_W_SHIFT) |
- pt->height[0]);
+ so_data (so, (pt->width0 << NV40TCL_TEX_SIZE0_W_SHIFT) |
+ pt->height0);
so_data (so, ps->bcol);
so_method(so, nv40->screen->curie, NV40TCL_TEX_SIZE1(unit), 1);
- so_data (so, (pt->depth[0] << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp);
+ so_data (so, (pt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp);
return so;
}
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index 465dd3b069..f73bedff6d 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv40_context.h"
@@ -8,7 +9,7 @@ static void
nv40_miptree_layout(struct nv40_miptree *mt)
{
struct pipe_texture *pt = &mt->base;
- uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
+ uint width = pt->width0, height = pt->height0, depth = pt->depth0;
uint offset = 0;
int nr_faces, l, f;
uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
@@ -21,29 +22,26 @@ nv40_miptree_layout(struct nv40_miptree *mt)
nr_faces = 6;
} else
if (pt->target == PIPE_TEXTURE_3D) {
- nr_faces = pt->depth[0];
+ nr_faces = pt->depth0;
} else {
nr_faces = 1;
}
for (l = 0; l <= pt->last_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, height);
if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64);
+ mt->level[l].pitch = align(pt->width0 * pt->block.size, 64);
else
- mt->level[l].pitch = pt->width[l] * pt->block.size;
+ mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size;
mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
- depth = MAX2(1, depth >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
for (f = 0; f < nr_faces; f++) {
@@ -51,14 +49,14 @@ nv40_miptree_layout(struct nv40_miptree *mt)
mt->level[l].image_offset[f] = offset;
if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
- pt->width[l + 1] > 1 && pt->height[l + 1] > 1)
- offset += align(mt->level[l].pitch * pt->height[l], 64);
+ u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1)
+ offset += align(mt->level[l].pitch * u_minify(pt->height0, l), 64);
else
- offset += mt->level[l].pitch * pt->height[l];
+ offset += mt->level[l].pitch * u_minify(pt->height0, l);
}
mt->level[l].image_offset[f] = offset;
- offset += mt->level[l].pitch * pt->height[l];
+ offset += mt->level[l].pitch * u_minify(pt->height0, l);
}
mt->total_size = offset;
@@ -79,8 +77,8 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base.screen = pscreen;
/* Swizzled textures must be POT */
- if (pt->width[0] & (pt->width[0] - 1) ||
- pt->height[0] & (pt->height[0] - 1))
+ if (pt->width0 & (pt->width0 - 1) ||
+ pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
@@ -128,7 +126,7 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv40_miptree);
@@ -176,8 +174,8 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ns->base.texture, pt);
ns->base.format = pt->format;
- ns->base.width = pt->width[level];
- ns->base.height = pt->height[level];
+ ns->base.width = u_minify(pt->width0, level);
+ ns->base.height = u_minify(pt->height0, level);
ns->base.usage = flags;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c
index 92caee6f38..36e253c96f 100644
--- a/src/gallium/drivers/nv40/nv40_transfer.c
+++ b/src/gallium/drivers/nv40/nv40_transfer.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include "nv40_context.h"
#include "nv40_screen.h"
@@ -20,9 +21,9 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
memset(template, 0, sizeof(struct pipe_texture));
template->target = pt->target;
template->format = pt->format;
- template->width[0] = pt->width[level];
- template->height[0] = pt->height[level];
- template->depth[0] = 1;
+ template->width0 = u_minify(pt->width0, level);
+ template->height0 = u_minify(pt->height0, level);
+ template->depth0 = 1;
template->block = pt->block;
template->nblocksx[0] = pt->nblocksx[level];
template->nblocksy[0] = pt->nblocksx[level];
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 9c20c5cc28..3d58746793 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -61,8 +61,8 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
struct pipe_texture *pt = &mt->base.base;
- unsigned width = tmp->width[0], height = tmp->height[0];
- unsigned depth = tmp->depth[0], image_alignment;
+ unsigned width = tmp->width0, height = tmp->height0;
+ unsigned depth = tmp->depth0, image_alignment;
uint32_t tile_flags;
int ret, i, l;
@@ -92,9 +92,6 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
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, height);
@@ -102,9 +99,9 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64);
lvl->tile_mode = get_tile_mode(pt->nblocksy[l], depth);
- width = MAX2(1, width >> 1);
- height = MAX2(1, height >> 1);
- depth = MAX2(1, depth >> 1);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
image_alignment = get_tile_height(mt->level[0].tile_mode) * 64;
@@ -122,7 +119,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
size = lvl->pitch;
size *= align(pt->nblocksy[l], tile_h);
- size *= align(pt->depth[l], tile_d);
+ size *= align(u_minify(pt->depth0, l), tile_d);
lvl->image_offset[i] = mt->total_size;
@@ -151,7 +148,7 @@ nv50_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth[0] != 1)
+ pt->depth0 != 1)
return NULL;
mt = CALLOC_STRUCT(nv50_miptree);
@@ -202,8 +199,8 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->usage = flags;
pipe_reference_init(&ps->reference, 1);
ps->face = face;
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 2813f54477..417d367942 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -131,9 +131,9 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
NOUVEAU_BO_RD, 0, 0);
so_data (so, mode);
so_data (so, 0x00300000);
- so_data (so, mt->base.base.width[0] | (1 << 31));
+ so_data (so, mt->base.base.width0 | (1 << 31));
so_data (so, (mt->base.base.last_level << 28) |
- (mt->base.base.depth[0] << 16) | mt->base.base.height[0]);
+ (mt->base.base.depth0 << 16) | mt->base.base.height0);
so_data (so, 0x03000000);
so_data (so, mt->base.base.last_level << 4);
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
index ea61357aaa..39d65279fc 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -1,6 +1,7 @@
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
+#include "util/u_math.h"
#include "nv50_context.h"
@@ -156,9 +157,9 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
tx->base.block = pt->block;
if (!pt->nblocksx[level]) {
tx->base.nblocksx = pf_get_nblocksx(&pt->block,
- pt->width[level]);
+ u_minify(pt->width0, level));
tx->base.nblocksy = pf_get_nblocksy(&pt->block,
- pt->height[level]);
+ u_minify(pt->height0, level));
} else {
tx->base.nblocksx = pt->nblocksx[level];
tx->base.nblocksy = pt->nblocksy[level];
@@ -167,9 +168,9 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
tx->base.usage = usage;
tx->level_pitch = lvl->pitch;
- tx->level_width = mt->base.base.width[level];
- tx->level_height = mt->base.base.height[level];
- tx->level_depth = mt->base.base.depth[level];
+ tx->level_width = u_minify(mt->base.base.width0, level);
+ tx->level_height = u_minify(mt->base.base.height0, level);
+ tx->level_depth = u_minify(mt->base.base.depth0, level);
tx->level_offset = lvl->image_offset[image];
tx->level_tiling = lvl->tile_mode;
tx->level_x = pf_get_nblocksx(&tx->base.block, x);
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index aea25cf71d..f4d148cdc5 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -34,8 +34,8 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500)
struct r300_texture_state* state = &tex->state;
struct pipe_texture *pt = &tex->tex;
- state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) |
- R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff);
+ state->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) |
+ R300_TX_HEIGHT((pt->height0 - 1) & 0x7ff);
if (tex->is_npot) {
/* rectangles love this */
@@ -43,7 +43,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500)
state->format2 = (tex->pitch[0] - 1) & 0x1fff;
} else {
/* power of two textures (3D, mipmaps, and no pitch) */
- state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) |
+ state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth0) & 0xf) |
R300_TX_NUM_LEVELS(pt->last_level & 0xf);
}
@@ -58,17 +58,17 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500)
/* large textures on r500 */
if (is_r500)
{
- if (pt->width[0] > 2048) {
+ if (pt->width0 > 2048) {
state->format2 |= R500_TXWIDTH_BIT11;
}
- if (pt->height[0] > 2048) {
+ if (pt->height0 > 2048) {
state->format2 |= R500_TXHEIGHT_BIT11;
}
}
- assert(is_r500 || (pt->width[0] <= 2048 && pt->height[0] <= 2048));
+ assert(is_r500 || (pt->width0 <= 2048 && pt->height0 <= 2048));
debug_printf("r300: Set texture state (%dx%d, %d levels)\n",
- pt->width[0], pt->height[0], pt->last_level);
+ pt->width0, pt->height0, pt->last_level);
}
unsigned r300_texture_get_offset(struct r300_texture* tex, unsigned level,
@@ -106,7 +106,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level)
return 0;
}
- return align(pf_get_stride(&tex->tex.block, tex->tex.width[level]), 32);
+ return align(pf_get_stride(&tex->tex.block, u_minify(tex->tex.width0, level)), 32);
}
static void r300_setup_miptree(struct r300_texture* tex)
@@ -116,14 +116,8 @@ static void r300_setup_miptree(struct r300_texture* tex)
int i;
for (i = 0; i <= base->last_level; i++) {
- if (i > 0) {
- base->width[i] = minify(base->width[i-1]);
- base->height[i] = minify(base->height[i-1]);
- base->depth[i] = minify(base->depth[i-1]);
- }
-
- base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]);
- base->nblocksy[i] = pf_get_nblocksy(&base->block, base->height[i]);
+ base->nblocksx[i] = pf_get_nblocksx(&base->block, u_minify(base->width0, i));
+ base->nblocksy[i] = pf_get_nblocksy(&base->block, u_minify(base->height0, i));
stride = r300_texture_get_stride(tex, i);
layer_size = stride * base->nblocksy[i];
@@ -131,7 +125,7 @@ static void r300_setup_miptree(struct r300_texture* tex)
if (base->target == PIPE_TEXTURE_CUBE)
size = layer_size * 6;
else
- size = layer_size * base->depth[i];
+ size = layer_size * u_minify(base->depth0, i);
tex->offset[i] = align(tex->size, 32);
tex->size = tex->offset[i] + size;
@@ -140,15 +134,15 @@ static void r300_setup_miptree(struct r300_texture* tex)
debug_printf("r300: Texture miptree: Level %d "
"(%dx%dx%d px, pitch %d bytes)\n",
- i, base->width[i], base->height[i], base->depth[i],
- stride);
+ i, u_minify(base->width0, i), u_minify(base->height0, i),
+ u_minify(base->depth0, i), stride);
}
}
static void r300_setup_flags(struct r300_texture* tex)
{
- tex->is_npot = !util_is_power_of_two(tex->tex.width[0]) ||
- !util_is_power_of_two(tex->tex.height[0]);
+ tex->is_npot = !util_is_power_of_two(tex->tex.width0) ||
+ !util_is_power_of_two(tex->tex.height0);
}
/* Create a new texture. */
@@ -208,8 +202,8 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
pipe_reference_init(&surface->reference, 1);
pipe_texture_reference(&surface->texture, texture);
surface->format = texture->format;
- surface->width = texture->width[level];
- surface->height = texture->height[level];
+ surface->width = u_minify(texture->width0, level);
+ surface->height = u_minify(texture->height0, level);
surface->offset = offset;
surface->usage = flags;
surface->zslice = zslice;
@@ -237,7 +231,7 @@ static struct pipe_texture*
/* Support only 2D textures without mipmaps */
if (base->target != PIPE_TEXTURE_2D ||
- base->depth[0] != 1 ||
+ base->depth0 != 1 ||
base->last_level != 0) {
return NULL;
}
@@ -287,9 +281,9 @@ r300_video_surface_create(struct pipe_screen *screen,
template.target = PIPE_TEXTURE_2D;
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
template.last_level = 0;
- template.width[0] = util_next_power_of_two(width);
- template.height[0] = util_next_power_of_two(height);
- template.depth[0] = 1;
+ template.width0 = util_next_power_of_two(width);
+ template.height0 = util_next_power_of_two(height);
+ template.depth0 = 1;
pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER |
PIPE_TEXTURE_USAGE_RENDER_TARGET;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 5625ff53cf..45a6059ea8 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -46,7 +46,7 @@
#include "util/u_memory.h"
#include "util/u_rect.h"
-
+
static struct pipe_surface *
dri_surface_from_handle(struct drm_api *api,
struct pipe_screen *screen,
@@ -62,10 +62,10 @@ dri_surface_from_handle(struct drm_api *api,
templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
- templat.depth[0] = 1;
+ templat.depth0 = 1;
templat.format = format;
- templat.width[0] = width;
- templat.height[0] = height;
+ templat.width0 = width;
+ templat.height0 = height;
pf_get_block(templat.format, &templat.block);
texture = api->texture_from_shared_handle(api, screen, &templat,
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 91615abebe..ddd9b04cd4 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -114,10 +114,10 @@ drm_create_texture(_EGLDisplay *dpy,
templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
- templat.depth[0] = 1;
+ templat.depth0 = 1;
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
- templat.width[0] = w;
- templat.height[0] = h;
+ templat.width0 = w;
+ templat.height0 = h;
pf_get_block(templat.format, &templat.block);
texture = screen->texture_create(dev->screen,
diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i
index f16fe5b0ff..a83bcc71a1 100644
--- a/src/gallium/state_trackers/python/p_device.i
+++ b/src/gallium/state_trackers/python/p_device.i
@@ -113,9 +113,9 @@ struct st_device {
memset(&templat, 0, sizeof(templat));
templat.format = format;
pf_get_block(templat.format, &templat.block);
- templat.width[0] = width;
- templat.height[0] = height;
- templat.depth[0] = depth;
+ templat.width0 = width;
+ templat.height0 = height;
+ templat.depth0 = depth;
templat.last_level = last_level;
templat.target = target;
templat.tex_usage = tex_usage;
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 1d513abf3c..5416b872f5 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -59,15 +59,15 @@
}
unsigned get_width(unsigned level=0) {
- return $self->width[level];
+ return u_minify($self->width0, level);
}
unsigned get_height(unsigned level=0) {
- return $self->height[level];
+ return u_minify($self->height0, level);
}
unsigned get_depth(unsigned level=0) {
- return $self->depth[level];
+ return u_minify($self->depth0, level);
}
unsigned get_nblocksx(unsigned level=0) {
@@ -88,7 +88,7 @@
SWIG_exception(SWIG_ValueError, "face out of bounds");
if(level > $self->last_level)
SWIG_exception(SWIG_ValueError, "level out of bounds");
- if(zslice >= $self->depth[level])
+ if(zslice >= u_minify($self->depth0, level))
SWIG_exception(SWIG_ValueError, "zslice out of bounds");
surface = CALLOC_STRUCT(st_surface);
@@ -375,13 +375,13 @@ struct st_surface
static unsigned
st_surface_width_get(struct st_surface *surface)
{
- return surface->texture->width[surface->level];
+ return u_minify(surface->texture->width0, surface->level);
}
static unsigned
st_surface_height_get(struct st_surface *surface)
{
- return surface->texture->height[surface->level];
+ return u_minify(surface->texture->height0, surface->level);
}
static unsigned
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index 348f2e4368..d0bcb690a9 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -279,9 +279,9 @@ class Screen(Object):
def texture_create(self, templat):
return self.real.texture_create(
format = templat.format,
- width = templat.width[0],
- height = templat.height[0],
- depth = templat.depth[0],
+ width = templat.width0,
+ height = templat.height0,
+ depth = templat.depth0,
last_level = templat.last_level,
target = templat.target,
tex_usage = templat.tex_usage,
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index ea7d18738f..a791113aba 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -252,9 +252,9 @@ st_context_create(struct st_device *st_dev)
templat.block.size = 4;
templat.block.width = 1;
templat.block.height = 1;
- templat.width[0] = 1;
- templat.height[0] = 1;
- templat.depth[0] = 1;
+ templat.width0 = 1;
+ templat.height0 = 1;
+ templat.depth0 = 1;
templat.last_level = 0;
st_ctx->default_texture = screen->texture_create( screen, &templat );
@@ -264,8 +264,8 @@ st_context_create(struct st_device *st_dev)
0, 0, 0,
PIPE_TRANSFER_WRITE,
0, 0,
- st_ctx->default_texture->width[0],
- st_ctx->default_texture->height[0]);
+ st_ctx->default_texture->width0,
+ st_ctx->default_texture->height0);
if (transfer) {
uint32_t *map;
map = (uint32_t *) screen->transfer_map(screen, transfer);
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
index 53a01891e1..6fee90afda 100644
--- a/src/gallium/state_trackers/python/st_sample.c
+++ b/src/gallium/state_trackers/python/st_sample.c
@@ -528,8 +528,8 @@ st_sample_surface(struct st_surface *surface, float *rgba)
{
struct pipe_texture *texture = surface->texture;
struct pipe_screen *screen = texture->screen;
- unsigned width = texture->width[surface->level];
- unsigned height = texture->height[surface->level];
+ unsigned width = u_minify(texture->width0, surface->level);
+ unsigned height = u_minify(texture->height0, surface->level);
uint rgba_stride = width * 4;
struct pipe_transfer *transfer;
void *raw;
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 862cbb03c4..faf396d087 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -68,9 +68,9 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
templ.target = PIPE_TEXTURE_1D;
templ.format = PIPE_FORMAT_A8R8G8B8_UNORM;
templ.last_level = 0;
- templ.width[0] = color_data_len;
- templ.height[0] = 1;
- templ.depth[0] = 1;
+ templ.width0 = color_data_len;
+ templ.height0 = 1;
+ templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -81,7 +81,7 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
screen->get_tex_transfer(screen, tex,
0, 0, 0,
PIPE_TRANSFER_READ_WRITE ,
- 0, 0, tex->width[0], tex->height[0]);
+ 0, 0, tex->width0, tex->height0);
void *map = screen->transfer_map(screen, transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
screen->transfer_unmap(screen, transfer);
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 9a722980d5..4684a5727d 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -93,8 +93,8 @@ static void vg_copy_texture(struct vg_context *ctx,
dst_loc[3] = height;
dst_bounds[0] = 0.f;
dst_bounds[1] = 0.f;
- dst_bounds[2] = dst->width[0];
- dst_bounds[3] = dst->height[0];
+ dst_bounds[2] = dst->width0;
+ dst_bounds[3] = dst->height0;
src_loc[0] = sx;
src_loc[1] = sy;
@@ -102,8 +102,8 @@ static void vg_copy_texture(struct vg_context *ctx,
src_loc[3] = height;
src_bounds[0] = 0.f;
src_bounds[1] = 0.f;
- src_bounds[2] = src->width[0];
- src_bounds[3] = src->height[0];
+ src_bounds[2] = src->width0;
+ src_bounds[3] = src->height0;
vg_bound_rect(src_loc, src_bounds, src_shift);
vg_bound_rect(dst_loc, dst_bounds, dst_shift);
@@ -272,9 +272,9 @@ struct vg_image * image_create(VGImageFormat format,
pt.format = pformat;
pf_get_block(pformat, &pt.block);
pt.last_level = 0;
- pt.width[0] = width;
- pt.height[0] = height;
- pt.depth[0] = 1;
+ pt.width0 = width;
+ pt.height0 = height;
+ pt.depth0 = 1;
pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
newtex = screen->texture_create(screen, &pt);
@@ -414,7 +414,7 @@ void image_sub_data(struct vg_image *image,
{ /* upload color_data */
struct pipe_transfer *transfer = screen->get_tex_transfer(
screen, texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, texture->width[0], texture->height[0]);
+ PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
src += (dataStride * yoffset);
for (i = 0; i < height; i++) {
_vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp);
diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c
index 24650a37d5..b84103fdba 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -426,7 +426,7 @@ static void mask_using_texture(struct pipe_texture *texture,
if (!surface)
return;
if (!intersect_rectangles(surface->width, surface->height,
- texture->width[0], texture->height[0],
+ texture->width0, texture->height0,
x, y, width, height,
offsets, loc))
return;
@@ -493,9 +493,9 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
pt.format = PIPE_FORMAT_A8R8G8B8_UNORM;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block);
pt.last_level = 0;
- pt.width[0] = width;
- pt.height[0] = height;
- pt.depth[0] = 1;
+ pt.width0 = width;
+ pt.height0 = height;
+ pt.depth0 = 1;
pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
pt.compressed = 0;
@@ -607,8 +607,8 @@ void mask_render_to(struct path *path,
struct vg_mask_layer *temp_layer;
VGint width, height;
- width = fb_buffers->alpha_mask->width[0];
- height = fb_buffers->alpha_mask->width[0];
+ width = fb_buffers->alpha_mask->width0;
+ height = fb_buffers->alpha_mask->width0;
temp_layer = mask_layer_create(width, height);
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index 04a6ba9cdc..e8ca7d9e89 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -151,9 +151,9 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
templ.target = PIPE_TEXTURE_1D;
templ.format = PIPE_FORMAT_A8R8G8B8_UNORM;
templ.last_level = 0;
- templ.width[0] = 1024;
- templ.height[0] = 1;
- templ.depth[0] = 1;
+ templ.width0 = 1024;
+ templ.height0 = 1;
+ templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -328,8 +328,8 @@ static INLINE void paint_pattern_buffer(struct vg_paint *paint, void *buffer)
map[4] = 0.f;
map[5] = 1.f;
- map[6] = paint->pattern.texture->width[0];
- map[7] = paint->pattern.texture->height[0];
+ map[6] = paint->pattern.texture->width0;
+ map[7] = paint->pattern.texture->height0;
{
struct matrix mat;
memcpy(&mat, &ctx->state.vg.fill_paint_to_user_matrix,
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 396c88aa3d..9085ed1bfe 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -230,13 +230,13 @@ void renderer_draw_texture(struct renderer *r,
struct pipe_buffer *buf;
VGfloat s0, t0, s1, t1;
- assert(tex->width[0] != 0);
- assert(tex->height[0] != 0);
+ assert(tex->width0 != 0);
+ assert(tex->height0 != 0);
- s0 = x1offset / tex->width[0];
- s1 = x2offset / tex->width[0];
- t0 = y1offset / tex->height[0];
- t1 = y2offset / tex->height[0];
+ s0 = x1offset / tex->width0;
+ s1 = x2offset / tex->width0;
+ t0 = y1offset / tex->height0;
+ t1 = y2offset / tex->height0;
cso_save_vertex_shader(r->cso);
/* shaders */
@@ -276,10 +276,10 @@ void renderer_copy_texture(struct renderer *ctx,
struct pipe_framebuffer_state fb;
float s0, t0, s1, t1;
- assert(src->width[0] != 0);
- assert(src->height[0] != 0);
- assert(dst->width[0] != 0);
- assert(dst->height[0] != 0);
+ assert(src->width0 != 0);
+ assert(src->height0 != 0);
+ assert(dst->width0 != 0);
+ assert(dst->height0 != 0);
#if 0
debug_printf("copy texture [%f, %f, %f, %f], [%f, %f, %f, %f]\n",
@@ -287,10 +287,10 @@ void renderer_copy_texture(struct renderer *ctx,
#endif
#if 1
- s0 = sx1 / src->width[0];
- s1 = sx2 / src->width[0];
- t0 = sy1 / src->height[0];
- t1 = sy2 / src->height[0];
+ s0 = sx1 / src->width0;
+ s1 = sx2 / src->width0;
+ t0 = sy1 / src->height0;
+ t1 = sy2 / src->height0;
#else
s0 = 0;
s1 = 1;
@@ -445,9 +445,9 @@ void renderer_copy_surface(struct renderer *ctx,
texTemp.target = PIPE_TEXTURE_2D;
texTemp.format = src->format;
texTemp.last_level = 0;
- texTemp.width[0] = srcW;
- texTemp.height[0] = srcH;
- texTemp.depth[0] = 1;
+ texTemp.width0 = srcW;
+ texTemp.height0 = srcH;
+ texTemp.depth0 = 1;
pf_get_block(src->format, &texTemp.block);
tex = screen->texture_create(screen, &texTemp);
@@ -570,13 +570,13 @@ void renderer_texture_quad(struct renderer *r,
struct pipe_buffer *buf;
VGfloat s0, t0, s1, t1;
- assert(tex->width[0] != 0);
- assert(tex->height[0] != 0);
+ assert(tex->width0 != 0);
+ assert(tex->height0 != 0);
- s0 = x1offset / tex->width[0];
- s1 = x2offset / tex->width[0];
- t0 = y1offset / tex->height[0];
- t1 = y2offset / tex->height[0];
+ s0 = x1offset / tex->width0;
+ s1 = x2offset / tex->width0;
+ t0 = y1offset / tex->height0;
+ t1 = y2offset / tex->height0;
cso_save_vertex_shader(r->cso);
/* shaders */
diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c
index c4da01e52c..d28463dd1b 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.c
+++ b/src/gallium/state_trackers/vega/vg_tracker.c
@@ -51,9 +51,9 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
templ.target = PIPE_TEXTURE_2D;
pf_get_block(templ.format, &templ.block);
- templ.width[0] = width;
- templ.height[0] = height;
- templ.depth[0] = 1;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
templ.last_level = 0;
if (pf_get_component_bits(format, PIPE_FORMAT_COMP_S)) {
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 733bd53fca..6064648ab0 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -436,8 +436,8 @@ setup_fs_constant_buffer(struct exa_context *exa)
static void
setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst)
{
- int width = pDst->tex->width[0];
- int height = pDst->tex->height[0];
+ int width = pDst->tex->width0;
+ int height = pDst->tex->height0;
setup_vs_constant_buffer(exa, width, height);
setup_fs_constant_buffer(exa);
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 85b9162d4c..c4751724c9 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -187,10 +187,10 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
- templat.depth[0] = 1;
+ templat.depth0 = 1;
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
- templat.width[0] = 64;
- templat.height[0] = 64;
+ templat.width0 = 64;
+ templat.height0 = 64;
pf_get_block(templat.format, &templat.block);
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index c41a7cd639..e16e79719c 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -103,9 +103,9 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format)
template.format = ms->ds_depth_bits_last ?
PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
pf_get_block(template.format, &template.block);
- template.width[0] = pDraw->width;
- template.height[0] = pDraw->height;
- template.depth[0] = 1;
+ template.width0 = pDraw->width;
+ template.height0 = pDraw->height;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 6fa274eb0a..534d4da13f 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -288,7 +288,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
PIPE_TRANSFER_MAP_DIRECTLY |
#endif
PIPE_TRANSFER_READ_WRITE,
- 0, 0, priv->tex->width[0], priv->tex->height[0]);
+ 0, 0, priv->tex->width0, priv->tex->height0);
if (!priv->map_transfer)
#ifdef EXA_MIXED_PIXMAPS
return FALSE;
@@ -752,8 +752,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
/* Deal with screen resize */
if (!priv->tex ||
- (priv->tex->width[0] != width ||
- priv->tex->height[0] != height ||
+ (priv->tex->width0 != width ||
+ priv->tex->height0 != height ||
priv->tex_flags != priv->flags)) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
@@ -762,9 +762,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
pf_get_block(template.format, &template.block);
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags;
priv->tex_flags = priv->flags;
@@ -779,12 +779,12 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
if (exa->pipe->surface_copy) {
exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width[0]),
- min(height, texture->height[0]));
+ 0, 0, min(width, texture->width0),
+ min(height, texture->height0));
} else {
util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width[0]),
- min(height, texture->height[0]));
+ 0, 0, min(width, texture->width0),
+ min(height, texture->height0));
}
exa->scrn->tex_surface_destroy(dst_surf);
exa->scrn->tex_surface_destroy(src_surf);
@@ -817,8 +817,8 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex)
if (!priv)
return FALSE;
- if (pPixmap->drawable.width != tex->width[0] ||
- pPixmap->drawable.height != tex->height[0])
+ if (pPixmap->drawable.width != tex->width0 ||
+ pPixmap->drawable.height != tex->height0)
return FALSE;
pipe_texture_reference(&priv->tex, tex);
@@ -841,9 +841,9 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy);
pf_get_block(template.format, &template.block);
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 723605312c..418a8dd88b 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -167,14 +167,14 @@ add_vertex_data1(struct xorg_renderer *r,
map_point(src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]);
}
- s0 = pt0[0] / src->width[0];
- s1 = pt1[0] / src->width[0];
- s2 = pt2[0] / src->width[0];
- s3 = pt3[0] / src->width[0];
- t0 = pt0[1] / src->height[0];
- t1 = pt1[1] / src->height[0];
- t2 = pt2[1] / src->height[0];
- t3 = pt3[1] / src->height[0];
+ s0 = pt0[0] / src->width0;
+ s1 = pt1[0] / src->width0;
+ s2 = pt2[0] / src->width0;
+ s3 = pt3[0] / src->width0;
+ t0 = pt0[1] / src->height0;
+ t1 = pt1[1] / src->height0;
+ t2 = pt2[1] / src->height0;
+ t3 = pt3[1] / src->height0;
/* 1st vertex */
add_vertex_1tex(r, dstX, dstY, s0, t0);
@@ -262,15 +262,15 @@ add_vertex_data2(struct xorg_renderer *r,
map_point(mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]);
}
- src_s0 = spt0[0] / src->width[0];
- src_t0 = spt0[1] / src->height[0];
- src_s1 = spt1[0] / src->width[0];
- src_t1 = spt1[1] / src->height[0];
+ src_s0 = spt0[0] / src->width0;
+ src_t0 = spt0[1] / src->height0;
+ src_s1 = spt1[0] / src->width0;
+ src_t1 = spt1[1] / src->height0;
- mask_s0 = mpt0[0] / mask->width[0];
- mask_t0 = mpt0[1] / mask->height[0];
- mask_s1 = mpt1[0] / mask->width[0];
- mask_t1 = mpt1[1] / mask->height[0];
+ mask_s0 = mpt0[0] / mask->width0;
+ mask_t0 = mpt0[1] / mask->height0;
+ mask_s1 = mpt1[0] / mask->width0;
+ mask_t1 = mpt1[1] / mask->height0;
/* 1st vertex */
add_vertex_2tex(r, dstX, dstY,
@@ -300,10 +300,10 @@ setup_vertex_data_yuv(struct xorg_renderer *r,
spt1[0] = srcX + srcW;
spt1[1] = srcY + srcH;
- s0 = spt0[0] / tex[0]->width[0];
- t0 = spt0[1] / tex[0]->height[0];
- s1 = spt1[0] / tex[0]->width[0];
- t1 = spt1[1] / tex[0]->height[0];
+ s0 = spt0[0] / tex[0]->width0;
+ t0 = spt0[1] / tex[0]->height0;
+ s1 = spt1[0] / tex[0]->width0;
+ t1 = spt1[1] / tex[0]->height0;
/* 1st vertex */
add_vertex_1tex(r, dstX, dstY, s0, t0);
@@ -387,8 +387,8 @@ void renderer_bind_framebuffer(struct xorg_renderer *r,
struct pipe_surface *surface = xorg_gpu_surface(r->pipe->screen, priv);
memset(&state, 0, sizeof(struct pipe_framebuffer_state));
- state.width = priv->tex->width[0];
- state.height = priv->tex->height[0];
+ state.width = priv->tex->width0;
+ state.height = priv->tex->height0;
state.nr_cbufs = 1;
state.cbufs[0] = surface;
@@ -407,8 +407,8 @@ void renderer_bind_framebuffer(struct xorg_renderer *r,
void renderer_bind_viewport(struct xorg_renderer *r,
struct exa_pixmap_priv *dst)
{
- int width = dst->tex->width[0];
- int height = dst->tex->height[0];
+ int width = dst->tex->width0;
+ int height = dst->tex->height0;
/*debug_printf("Bind viewport (%d, %d)\n", width, height);*/
@@ -584,16 +584,16 @@ static void renderer_copy_texture(struct xorg_renderer *r,
float s0, t0, s1, t1;
struct xorg_shader shader;
- assert(src->width[0] != 0);
- assert(src->height[0] != 0);
- assert(dst->width[0] != 0);
- assert(dst->height[0] != 0);
+ assert(src->width0 != 0);
+ assert(src->height0 != 0);
+ assert(dst->width0 != 0);
+ assert(dst->height0 != 0);
#if 1
- s0 = sx1 / src->width[0];
- s1 = sx2 / src->width[0];
- t0 = sy1 / src->height[0];
- t1 = sy2 / src->height[0];
+ s0 = sx1 / src->width0;
+ s1 = sx2 / src->width0;
+ t0 = sy1 / src->height0;
+ t1 = sy2 / src->height0;
#else
s0 = 0;
s1 = 1;
@@ -730,9 +730,9 @@ create_sampler_texture(struct xorg_renderer *r,
templ.target = PIPE_TEXTURE_2D;
templ.format = format;
templ.last_level = 0;
- templ.width[0] = src->width[0];
- templ.height[0] = src->height[0];
- templ.depth[0] = 1;
+ templ.width0 = src->width0;
+ templ.height0 = src->height0;
+ templ.depth0 = 1;
pf_get_block(format, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -754,13 +754,13 @@ create_sampler_texture(struct xorg_renderer *r,
ps_tex, /* dest */
0, 0, /* destx/y */
ps_read,
- 0, 0, src->width[0], src->height[0]);
+ 0, 0, src->width0, src->height0);
} else {
util_surface_copy(pipe, FALSE,
ps_tex, /* dest */
0, 0, /* destx/y */
ps_read,
- 0, 0, src->width[0], src->height[0]);
+ 0, 0, src->width0, src->height0);
}
pipe_surface_reference(&ps_read, NULL);
pipe_surface_reference(&ps_tex, NULL);
@@ -791,8 +791,8 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
dst_loc[3] = height;
dst_bounds[0] = 0.f;
dst_bounds[1] = 0.f;
- dst_bounds[2] = dst->width[0];
- dst_bounds[3] = dst->height[0];
+ dst_bounds[2] = dst->width0;
+ dst_bounds[3] = dst->height0;
src_loc[0] = sx;
src_loc[1] = sy;
@@ -800,8 +800,8 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
src_loc[3] = height;
src_bounds[0] = 0.f;
src_bounds[1] = 0.f;
- src_bounds[2] = src->width[0];
- src_bounds[3] = src->height[0];
+ src_bounds[2] = src->width0;
+ src_bounds[3] = src->height0;
bound_rect(src_loc, src_bounds, src_shift);
bound_rect(dst_loc, dst_bounds, dst_shift);
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 2b935c0f73..856599e640 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -166,9 +166,9 @@ create_component_texture(struct pipe_context *pipe,
templ.target = PIPE_TEXTURE_2D;
templ.format = PIPE_FORMAT_L8_UNORM;
templ.last_level = 0;
- templ.width[0] = width;
- templ.height[0] = height;
- templ.depth[0] = 1;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -182,18 +182,18 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
{
struct pipe_texture **dst = priv->yuv[priv->current_set];
if (!dst[0] ||
- dst[0]->width[0] != width ||
- dst[0]->height[0] != height) {
+ dst[0]->width0 != width ||
+ dst[0]->height0 != height) {
pipe_texture_reference(&dst[0], NULL);
}
if (!dst[1] ||
- dst[1]->width[0] != width ||
- dst[1]->height[0] != height) {
+ dst[1]->width0 != width ||
+ dst[1]->height0 != height) {
pipe_texture_reference(&dst[1], NULL);
}
if (!dst[2] ||
- dst[2]->width[0] != width ||
- dst[2]->height[0] != height) {
+ dst[2]->width0 != width ||
+ dst[2]->height0 != height) {
pipe_texture_reference(&dst[2], NULL);
}
@@ -320,8 +320,8 @@ copy_packed_data(ScrnInfoPtr pScrn,
static void
setup_vs_video_constants(struct xorg_renderer *r, struct exa_pixmap_priv *dst)
{
- int width = dst->tex->width[0];
- int height = dst->tex->height[0];
+ int width = dst->tex->width0;
+ int height = dst->tex->height0;
const int param_bytes = 8 * sizeof(float);
float vs_consts[8] = {
2.f/width, 2.f/height, 1, 1,
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index bf9038f356..8cb73f4897 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -103,9 +103,9 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u
/* XXX: Needs to match the drawable's format? */
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
template.last_level = 0;
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
index 317dc44d22..d497861324 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -24,10 +24,10 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY;
tmpl.target = PIPE_TEXTURE_2D;
tmpl.last_level = 0;
- tmpl.depth[0] = 1;
+ tmpl.depth0 = 1;
tmpl.format = format;
- tmpl.width[0] = width;
- tmpl.height[0] = height;
+ tmpl.width0 = width;
+ tmpl.height0 = height;
pf_get_block(tmpl.format, &tmpl.block);
pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 81cd9dc4fb..74afffc9cf 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -317,9 +317,9 @@ struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_co
memset(&tmpl, 0, sizeof(tmpl));
tmpl.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
tmpl.target = PIPE_TEXTURE_2D;
- tmpl.width[0] = w;
- tmpl.height[0] = h;
- tmpl.depth[0] = 1;
+ tmpl.width0 = w;
+ tmpl.height0 = h;
+ tmpl.depth0 = 1;
tmpl.format = format;
pf_get_block(tmpl.format, &tmpl.block);
tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 0469fb9978..659a6c9193 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -376,7 +376,7 @@ st_render_texture(GLcontext *ctx,
rb->_BaseFormat = texImage->_BaseFormat;
/*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/
- /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/
+ /*printf("***** pipe texture %d x %d\n", pt->width0, pt->height0);*/
pipe_texture_reference( &strb->texture, pt );
--
cgit v1.2.3
From b748a9f574361273df6b05c06c647ac4fd9b3e41 Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Fri, 27 Nov 2009 17:40:24 +0100
Subject: r300g,llvmpipe: fix some more merge problems
---
src/gallium/drivers/llvmpipe/lp_texture.c | 2 +-
src/gallium/drivers/r300/r300_emit.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 0a0f31f8a3..65d62fd072 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -169,7 +169,7 @@ llvmpipe_texture_blanket(struct pipe_screen * screen,
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
- base->depth[0] != 1) {
+ base->depth0 != 1) {
return NULL;
}
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index e6ab8e4af1..98a39390bf 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -145,8 +145,8 @@ static const float * get_shader_constant(
* normalized coords. Should only show up on non-r500. */
case RC_STATE_R300_TEXRECT_FACTOR:
tex = &r300->textures[constant->u.State[1]]->tex;
- vec[0] = 1.0 / tex->width[0];
- vec[1] = 1.0 / tex->height[0];
+ vec[0] = 1.0 / tex->width0;
+ vec[1] = 1.0 / tex->height0;
break;
default:
--
cgit v1.2.3
From 7fa1bcc05a237365e5ea09512453f29a91c7a141 Mon Sep 17 00:00:00 2001
From: Roland Scheidegger
Date: Fri, 27 Nov 2009 17:41:42 +0100
Subject: svga: fix for not using texture width/height/depth arrays
---
src/gallium/drivers/svga/svga_screen_texture.c | 61 ++++++++++++-------------
src/gallium/drivers/svga/svga_state_constants.c | 4 +-
2 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index 8472dea04d..fb11b80dcf 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -287,23 +287,20 @@ svga_texture_create(struct pipe_screen *screen,
if(templat->last_level >= SVGA_MAX_TEXTURE_LEVELS)
goto error2;
- width = templat->width[0];
- height = templat->height[0];
- depth = templat->depth[0];
+ width = templat->width0;
+ height = templat->height0;
+ depth = templat->depth0;
for(level = 0; level <= templat->last_level; ++level) {
- tex->base.width[level] = width;
- tex->base.height[level] = height;
- tex->base.depth[level] = depth;
tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width);
tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height);
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = u_minify(width, 1);
+ height = u_minify(height, 1);
+ depth = u_minify(depth, 1);
}
- size.width = templat->width[0];
- size.height = templat->height[0];
- size.depth = templat->depth[0];
+ size.width = templat->width0;
+ size.height = templat->height0;
+ size.depth = templat->depth0;
if(templat->target == PIPE_TEXTURE_CUBE) {
flags |= SVGA3D_SURFACE_CUBEMAP;
@@ -367,7 +364,7 @@ svga_texture_blanket(struct pipe_screen * screen,
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
- base->depth[0] != 1) {
+ base->depth0 != 1) {
return NULL;
}
@@ -534,9 +531,9 @@ svga_texture_view_surface(struct pipe_context *pipe,
"svga: Create surface view: face %d zslice %d mips %d..%d\n",
face_pick, zslice_pick, start_mip, start_mip+num_mip-1);
- size.width = tex->base.width[start_mip];
- size.height = tex->base.height[start_mip];
- size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1;
+ size.width = u_minify(tex->base.width0, start_mip);
+ size.height = u_minify(tex->base.height0, start_mip);
+ size.depth = zslice_pick < 0 ? u_minify(tex->base.depth0, start_mip) : 1;
assert(size.depth == 1);
if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) {
@@ -565,11 +562,12 @@ svga_texture_view_surface(struct pipe_context *pipe,
for (i = 0; i < num_mip; i++) {
for (j = 0; j < numFaces; j++) {
if(tex->defined[j + face_pick][i + start_mip]) {
- unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1;
+ unsigned depth = zslice_pick < 0 ? u_minify(tex->base.depth0, i + start_mip) : 1;
svga_texture_copy_handle(svga_context(pipe), ss,
tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick,
handle, 0, 0, 0, i, j,
- tex->base.width[i + start_mip], tex->base.height[i + start_mip], depth);
+ u_minify(tex->base.width0, i + start_mip),
+ u_minify(tex->base.height0, i + start_mip), depth);
}
}
}
@@ -599,8 +597,8 @@ svga_get_tex_surface(struct pipe_screen *screen,
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
ps->format = pt->format;
- ps->width = pt->width[level];
- ps->height = pt->height[level];
+ ps->width = u_minify(pt->width0, level);
+ ps->height = u_minify(pt->height0, level);
ps->usage = flags;
ps->level = level;
ps->face = face;
@@ -723,7 +721,8 @@ svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf)
svga_texture_copy_handle(svga_context(pipe), ss,
s->handle, 0, 0, 0, s->real_level, s->real_face,
tex->handle, 0, 0, surf->zslice, surf->level, surf->face,
- tex->base.width[surf->level], tex->base.height[surf->level], 1);
+ u_minify(tex->base.width0, surf->level),
+ u_minify(tex->base.height0, surf->level), 1);
tex->defined[surf->face][surf->level] = TRUE;
}
}
@@ -953,9 +952,9 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
"svga: Sampler view: no %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n",
pt, min_lod, max_lod,
max_lod - min_lod + 1,
- pt->width[0],
- pt->height[0],
- pt->depth[0],
+ pt->width0,
+ pt->height0,
+ pt->depth0,
pt->last_level);
sws->surface_reference(sws, &sv->handle, tex->handle);
return sv;
@@ -965,9 +964,9 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
"svga: Sampler view: yes %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n",
pt, min_lod, max_lod,
max_lod - min_lod + 1,
- pt->width[0],
- pt->height[0],
- pt->depth[0],
+ pt->width0,
+ pt->height0,
+ pt->depth0,
pt->last_level);
sv->age = tex->age;
@@ -1015,9 +1014,9 @@ svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *
svga_texture_copy_handle(svga, NULL,
tex->handle, 0, 0, 0, i, k,
v->handle, 0, 0, 0, i - v->min_lod, k,
- tex->base.width[i],
- tex->base.height[i],
- tex->base.depth[i]);
+ u_minify(tex->base.width0, i),
+ u_minify(tex->base.height0, i),
+ u_minify(tex->base.depth0, i));
}
}
@@ -1047,7 +1046,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture,
svga_translate_format(texture->format),
stex->handle);
- *stride = pf_get_nblocksx(&texture->block, texture->width[0]) *
+ *stride = pf_get_nblocksx(&texture->block, texture->width0) *
texture->block.size;
return *buffer != NULL;
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index 18cce7dde1..209ed28245 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -140,8 +140,8 @@ static int emit_fs_consts( struct svga_context *svga,
struct pipe_texture *tex = svga->curr.texture[i];
float data[4];
- data[0] = 1.0 / (float)tex->width[0];
- data[1] = 1.0 / (float)tex->height[0];
+ data[0] = 1.0 / (float)tex->width0;
+ data[1] = 1.0 / (float)tex->height0;
data[2] = 1.0;
data[3] = 1.0;
--
cgit v1.2.3
From e65258abf52bd1923a547f76bd7346bf5ed1c5c6 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller
Date: Thu, 26 Nov 2009 16:58:59 +0100
Subject: gallium/util: added util_bswap32()
---
src/gallium/auxiliary/util/u_math.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index b7fc0586f3..7e75702701 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -510,6 +510,23 @@ util_bitcount(unsigned n)
}
+/**
+ * Reverse byte order of a 32 bit word.
+ */
+static INLINE uint32_t
+util_bswap32(uint32_t n)
+{
+#if defined(PIPE_CC_GCC)
+ return __builtin_bswap32(n);
+#else
+ return (n >> 24) |
+ ((n >> 8) & 0x0000ff00) |
+ ((n << 8) & 0x00ff0000) |
+ (n << 24);
+#endif
+}
+
+
/**
* Clamp X to [MIN, MAX].
* This is a macro to allow float, int, uint, etc. types.
--
cgit v1.2.3
From 510fd280b54fa33ed229ef297a1a77c78811c592 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller
Date: Thu, 26 Nov 2009 16:59:39 +0100
Subject: nv50: bswap32 the polygon stipple pattern
The hardware wants the pattern the same way it is
passed to glPolygonStipple.
---
src/gallium/drivers/nv50/nv50_state_validate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 799d2758fe..19b8ef07b5 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -285,7 +285,7 @@ nv50_state_validate(struct nv50_context *nv50)
so = so_new(33, 0);
so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_PATTERN(0), 32);
for (i = 0; i < 32; i++)
- so_data(so, nv50->stipple.stipple[i]);
+ so_data(so, util_bswap32(nv50->stipple.stipple[i]));
so_ref(so, &nv50->state.stipple);
so_ref(NULL, &so);
}
--
cgit v1.2.3
From cad14c2542698de144bb5434cefa02d7a00aaa74 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller
Date: Fri, 27 Nov 2009 21:29:38 +0100
Subject: nv50: do conversion of last insn to 64 bit format first
Simplifies things since the second to last one will then
be converted in the subsequent pass that ensures alignment
automatically.
---
src/gallium/drivers/nv50/nv50_program.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index bf50982dd1..855079f293 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -2914,7 +2914,7 @@ nv50_fp_move_results(struct nv50_pc *pc)
static void
nv50_program_fixup_insns(struct nv50_pc *pc)
{
- struct nv50_program_exec *e, *prev = NULL, **bra_list;
+ struct nv50_program_exec *e, **bra_list;
unsigned i, n, pos;
bra_list = CALLOC(pc->p->exec_size, sizeof(struct nv50_program_exec *));
@@ -2926,6 +2926,16 @@ nv50_program_fixup_insns(struct nv50_pc *pc)
if (e->param.index >= 0 && !e->param.mask)
bra_list[n++] = e;
+ /* last instruction must be long so it can have the exit bit set */
+ if (!is_long(pc->p->exec_tail))
+ convert_to_long(pc, pc->p->exec_tail);
+ /* set exit bit */
+ pc->p->exec_tail->inst[1] |= 1;
+
+ /* !immd on exit insn simultaneously means !join */
+ assert(!is_immd(pc->p->exec_head));
+ assert(!is_immd(pc->p->exec_tail));
+
/* Make sure we don't have any single 32 bit instructions. */
for (e = pc->p->exec_head, pos = 0; e; e = e->next) {
pos += is_long(e) ? 2 : 1;
@@ -2937,23 +2947,8 @@ nv50_program_fixup_insns(struct nv50_pc *pc)
convert_to_long(pc, e);
++pos;
}
- if (e->next)
- prev = e;
}
- assert(!is_immd(pc->p->exec_head));
- assert(!is_immd(pc->p->exec_tail));
-
- /* last instruction must be long so it can have the end bit set */
- if (!is_long(pc->p->exec_tail)) {
- convert_to_long(pc, pc->p->exec_tail);
- if (prev)
- convert_to_long(pc, prev);
- }
- assert(!(pc->p->exec_tail->inst[1] & 2));
- /* set the end-bit */
- pc->p->exec_tail->inst[1] |= 1;
-
FREE(bra_list);
}
--
cgit v1.2.3