Dnia poniedziaĆek, 8 czerwca 2009 o 09:28:25 Ian Romanick napisaĆ(a):
> Maciej Cencora wrote:
> > Hi,
> >
> > this patch brings few EXT_vertex_array_bgra fixes:
> >
> > 1) Pass the correct format when calling update_array in
> > _mesa_VertexAttribPointerARB.
> > 2) glVertexAttribPointerNV accepts GL_BGRA format too.
> > 3) raise INVALID_VALUE error when format is GL_BGRA and normalized is
> > false in glVertexAttribPointerARB
> >
> > This patch fixes wine d3d9 tests that use GL_BGRA attributes format.
>
> Eh... the patch seems to be missing.
Oops. Here it goes...
From e3f51318e95b22418fe30ed745405af4caca026c Mon Sep 17 00:00:00 2001
From: Maciej Cencora <[email protected]>
Date: Sat, 6 Jun 2009 23:29:06 +0200
Subject: [PATCH] mesa: EXT_vertex_array_bgra fixes
1) Pass the correct format when calling update_array in _mesa_VertexAttribPointerARB.
2) glVertexAttribPointerNV accepts GL_BGRA format too.
3) raise INVALID_VALUE error when format is BGRA and normalized is false in glVertexAttribPointerARB
---
src/mesa/main/varray.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index a9c9162..cf1d5ac 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -523,6 +523,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
{
GLboolean normalized = GL_FALSE;
GLsizei elementSize;
+ GLenum format;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -546,6 +547,21 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
return;
}
+ if (size == GL_BGRA) {
+ if (type != GL_UNSIGNED_BYTE) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glVertexAttribPointerNV(GL_BGRA/type)");
+ return;
+ }
+
+ format = GL_BGRA;
+ size = 4;
+ normalized = GL_TRUE;
+ }
+ else {
+ format = GL_RGBA;
+ }
+
/* check for valid 'type' and compute StrideB right away */
switch (type) {
case GL_UNSIGNED_BYTE:
@@ -568,7 +584,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
_NEW_ARRAY_ATTRIB(index),
- elementSize, size, type, GL_RGBA, stride, normalized, ptr);
+ elementSize, size, type, format, stride, normalized, ptr);
if (ctx->Driver.VertexAttribPointer)
ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
@@ -609,10 +625,14 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
_mesa_error(ctx, GL_INVALID_VALUE,
"glVertexAttribPointerARB(GL_BGRA/type)");
return;
+ } else if (normalized != GL_TRUE) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glVertexAttribPointerARB(GL_BGRA/normalized)");
+ return;
}
+
format = GL_BGRA;
size = 4;
- normalized = GL_TRUE;
}
else {
format = GL_RGBA;
@@ -657,7 +677,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
_NEW_ARRAY_ATTRIB(index),
- elementSize, size, type, GL_RGBA, stride, normalized, ptr);
+ elementSize, size, type, format, stride, normalized, ptr);
if (ctx->Driver.VertexAttribPointer)
ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr);
--
1.6.0.4
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev