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

Author: Charmaine Lee <charmai...@vmware.com>
Date:   Thu Apr 26 09:21:52 2018 -0700

st/mesa: fix missing setting of _ElementSize in new_draw_rasterpos_stage

With this patch, _ElementSize is initialized along with the rest
of the vertex array attributes in new_draw_rasterpos_stage().
This fixes a crash in st_pipe_vertex_format() when running
topogun-1.06-orc-84k-resize trace file with VMware svga driver.

Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/mesa/state_tracker/st_cb_rasterpos.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c 
b/src/mesa/state_tracker/st_cb_rasterpos.c
index 4e5417baad..b73d543653 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -40,6 +40,7 @@
 #include "main/macros.h"
 #include "main/feedback.h"
 #include "main/rastpos.h"
+#include "glformats.h"
 
 #include "st_context.h"
 #include "st_atom.h"
@@ -182,6 +183,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct 
draw_context *draw)
 {
    struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
    GLuint i;
+   GLuint elementSize;
 
    rs->stage.draw = draw;
    rs->stage.next = NULL;
@@ -196,12 +198,15 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct 
draw_context *draw)
 
    rs->binding.Stride = 0;
    rs->binding.BufferObj = NULL;
+
+   elementSize = _mesa_bytes_per_vertex_attrib(4, GL_FLOAT);
    for (i = 0; i < ARRAY_SIZE(rs->array); i++) {
       rs->attrib[i].Size = 4;
       rs->attrib[i].Type = GL_FLOAT;
       rs->attrib[i].Format = GL_RGBA;
       rs->attrib[i].Ptr = (GLubyte *) ctx->Current.Attrib[i];
       rs->attrib[i].Normalized = GL_TRUE;
+      rs->attrib[i]._ElementSize = elementSize;
       rs->array[i].BufferBinding = &rs->binding;
       rs->array[i].VertexAttrib = &rs->attrib[i];
    }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to