diff options
author | Ian Romanick <[email protected]> | 2015-11-05 14:42:07 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2015-11-24 11:31:30 -0800 |
commit | a222d4cbc3de49857aebbdf727e53c273abcc6c1 (patch) | |
tree | 39736a95941642e8c639093700f52ffd7eaf5923 /src/mesa/drivers/common | |
parent | b8a7369fb7e5773892d01fcb1140fe6569ee27eb (diff) |
meta: Use internal functions for buffer object and VAO access in _mesa_meta_DrawTex
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b38ac902264..cccb817741c 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3309,13 +3309,16 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, if (drawtex->VAO == 0) { /* one-time setup */ - GLint active_texture; + struct gl_vertex_array_object *array_obj; GLuint VBO; /* create vertex array object */ _mesa_GenVertexArrays(1, &drawtex->VAO); _mesa_BindVertexArray(drawtex->VAO); + array_obj = _mesa_lookup_vao(ctx, drawtex->VAO); + assert(array_obj != NULL); + /* create vertex array buffer */ _mesa_CreateBuffers(1, &VBO); drawtex->buf_obj = _mesa_lookup_bufferobj(ctx, VBO); @@ -3332,22 +3335,27 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, assert(drawtex->buf_obj->Size == sizeof(verts)); - /* client active texture is not part of the array object */ - active_texture = ctx->Array.ActiveTexture; - _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, VBO); /* setup vertex arrays */ - _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS, + 3, GL_FLOAT, GL_RGBA, GL_FALSE, + GL_FALSE, GL_FALSE, + offsetof(struct vertex, x), true); + _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS, + drawtex->buf_obj, 0, sizeof(struct vertex)); + _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS); + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - _mesa_ClientActiveTexture(GL_TEXTURE0 + i); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(st[i])); - _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(i), + 2, GL_FLOAT, GL_RGBA, GL_FALSE, + GL_FALSE, GL_FALSE, + offsetof(struct vertex, st[i]), true); + _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i), + drawtex->buf_obj, 0, sizeof(struct vertex)); + _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(i)); } - - /* restore client active texture */ - _mesa_ClientActiveTexture(GL_TEXTURE0 + active_texture); } else { _mesa_BindVertexArray(drawtex->VAO); |