Mesa (master): mesa/es: Fix GL_OES_draw_texture support.

Chia-I Wu olv at kemper.freedesktop.org
Thu Mar 11 15:33:05 UTC 2010


Module: Mesa
Branch: master
Commit: 9f5de23d0a73454b00236743d24326ec7b0d96f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f5de23d0a73454b00236743d24326ec7b0d96f9

Author: Chia-I Wu <olv at lunarg.com>
Date:   Thu Mar 11 18:07:07 2010 +0800

mesa/es: Fix GL_OES_draw_texture support.

st_DrawTex calls util_draw_vertex_buffer.  Since
ac4abaecd5f52e416c89bfe19b34ed7f4e014b21, the caller is expected to set
vertex elements before calling.

---

 src/mesa/es/state_tracker/st_cb_drawtex.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/es/state_tracker/st_cb_drawtex.c b/src/mesa/es/state_tracker/st_cb_drawtex.c
index 0a5cba9..e4b8954 100644
--- a/src/mesa/es/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/es/state_tracker/st_cb_drawtex.c
@@ -120,6 +120,7 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
    GLboolean emitColor;
    uint semantic_names[2 + MAX_TEXTURE_UNITS];
    uint semantic_indexes[2 + MAX_TEXTURE_UNITS];
+   struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS];
    GLbitfield inputs = VERT_BIT_POS;
 
    /* determine if we need vertex color */
@@ -232,6 +233,7 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
 
    cso_save_viewport(cso);
    cso_save_vertex_shader(cso);
+   cso_save_vertex_elements(cso);
 
    {
       void *vs = lookup_shader(pipe, numAttribs,
@@ -239,6 +241,14 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
       cso_set_vertex_shader_handle(cso, vs);
    }
 
+   for (i = 0; i < numAttribs; i++) {
+      velements[i].src_offset = i * 4 * sizeof(float);
+      velements[i].instance_divisor = 0;
+      velements[i].vertex_buffer_index = 0;
+      velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+   }
+   cso_set_vertex_elements(cso, numAttribs, velements);
+
    /* viewport state: viewport matching window dims */
    {
       const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
@@ -270,6 +280,7 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
    /* restore state */
    cso_restore_viewport(cso);
    cso_restore_vertex_shader(cso);
+   cso_restore_vertex_elements(cso);
 }
 
 




More information about the mesa-commit mailing list