aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-05-21 08:15:22 -0600
committerBrian Paul <[email protected]>2009-05-21 08:15:54 -0600
commit5b27b4ad37bd992d2d3a6fd9d407277113544f30 (patch)
treed3d5c924521bc5c3f292872ea28b37cdc7304bba
parent3af0952bc9bade8d5a5c60349c045b28762f8815 (diff)
st: add support for GL_EXT_vertex_array_bgra
-rw-r--r--src/mesa/state_tracker/st_draw.c13
-rw-r--r--src/mesa/state_tracker/st_draw.h3
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c1
-rw-r--r--src/mesa/state_tracker/st_extensions.c1
4 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 225541a30ba..8e036223c65 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -159,12 +159,21 @@ static GLuint fixed_types[4] = {
* Return a PIPE_FORMAT_x for the given GL datatype and size.
*/
GLuint
-st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized)
+st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
+ GLboolean normalized)
{
assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
type == GL_FIXED);
assert(size >= 1);
assert(size <= 4);
+ assert(format == GL_RGBA || format == GL_BGRA);
+
+ if (format == GL_BGRA) {
+ /* this is an odd-ball case */
+ assert(type == GL_UNSIGNED_BYTE);
+ assert(normalized);
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
+ }
if (normalized) {
switch (type) {
@@ -392,6 +401,7 @@ setup_interleaved_attribs(GLcontext *ctx,
velements[attr].src_format =
st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
+ arrays[mesaAttr]->Format,
arrays[mesaAttr]->Normalized);
assert(velements[attr].src_format);
}
@@ -479,6 +489,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
velements[attr].src_format
= st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
+ arrays[mesaAttr]->Format,
arrays[mesaAttr]->Normalized);
assert(velements[attr].src_format);
}
diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h
index da04fce8e24..dcfe7e15361 100644
--- a/src/mesa/state_tracker/st_draw.h
+++ b/src/mesa/state_tracker/st_draw.h
@@ -62,7 +62,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* Internal function:
*/
extern GLuint
-st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized);
+st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
+ GLboolean normalized);
/**
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 32502a9cda4..2712c131c0d 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -178,6 +178,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
velements[attr].src_format =
st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
+ arrays[mesaAttr]->Format,
arrays[mesaAttr]->Normalized);
assert(velements[attr].src_format);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index d526dfcf52e..efa88c2481f 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -167,6 +167,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
+ ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;