st: add support for GL_EXT_vertex_array_bgra
This commit is contained in:
@@ -159,12 +159,21 @@ static GLuint fixed_types[4] = {
|
|||||||
* Return a PIPE_FORMAT_x for the given GL datatype and size.
|
* Return a PIPE_FORMAT_x for the given GL datatype and size.
|
||||||
*/
|
*/
|
||||||
GLuint
|
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) ||
|
assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
|
||||||
type == GL_FIXED);
|
type == GL_FIXED);
|
||||||
assert(size >= 1);
|
assert(size >= 1);
|
||||||
assert(size <= 4);
|
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) {
|
if (normalized) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -392,6 +401,7 @@ setup_interleaved_attribs(GLcontext *ctx,
|
|||||||
velements[attr].src_format =
|
velements[attr].src_format =
|
||||||
st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
||||||
arrays[mesaAttr]->Size,
|
arrays[mesaAttr]->Size,
|
||||||
|
arrays[mesaAttr]->Format,
|
||||||
arrays[mesaAttr]->Normalized);
|
arrays[mesaAttr]->Normalized);
|
||||||
assert(velements[attr].src_format);
|
assert(velements[attr].src_format);
|
||||||
}
|
}
|
||||||
@@ -479,6 +489,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
|
|||||||
velements[attr].src_format
|
velements[attr].src_format
|
||||||
= st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
= st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
||||||
arrays[mesaAttr]->Size,
|
arrays[mesaAttr]->Size,
|
||||||
|
arrays[mesaAttr]->Format,
|
||||||
arrays[mesaAttr]->Normalized);
|
arrays[mesaAttr]->Normalized);
|
||||||
assert(velements[attr].src_format);
|
assert(velements[attr].src_format);
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
|||||||
/* Internal function:
|
/* Internal function:
|
||||||
*/
|
*/
|
||||||
extern GLuint
|
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 =
|
velements[attr].src_format =
|
||||||
st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
st_pipe_vertex_format(arrays[mesaAttr]->Type,
|
||||||
arrays[mesaAttr]->Size,
|
arrays[mesaAttr]->Size,
|
||||||
|
arrays[mesaAttr]->Format,
|
||||||
arrays[mesaAttr]->Normalized);
|
arrays[mesaAttr]->Normalized);
|
||||||
assert(velements[attr].src_format);
|
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_combine = GL_TRUE;
|
||||||
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
|
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
|
||||||
ctx->Extensions.EXT_texture_lod_bias = 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;
|
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user