Commit 5b27b4ad authored by Brian Paul's avatar Brian Paul

st: add support for GL_EXT_vertex_array_bgra

parent 3af0952b
......@@ -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);
}
......
......@@ -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);
/**
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment