summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-02-20 18:05:24 +0100
committerMarek Olšák <[email protected]>2011-03-12 22:10:44 +0100
commitea26cc8696013d6c44b915e96ed438cfcedc0a2c (patch)
tree2be441a473f3d8a9a1aa4be62374b160713c99eb
parent954787cee1c5ad32beb071445ea388e050be533d (diff)
st/mesa: fix crash when using both user and vbo buffers with the same stride
If two buffers had the same stride where one buffer is a user one and the other is a vbo, it was considered to be one interleaved buffer, resulting in incorrect rendering and crashes. This patch makes sure that the interleaved buffer is either user or vbo, not both. (cherry picked from commit 695cdee67827ee2c11e1445eb2022d3a530f1b23)
-rw-r--r--src/mesa/state_tracker/st_draw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 61a0e1b0877..73e3aeb4502 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -250,6 +250,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
GLint firstStride = -1;
GLuint num_client_arrays = 0;
const GLubyte *client_addr = NULL;
+ GLboolean user_memory;
for (attr = 0; attr < vpv->num_inputs; attr++) {
const GLuint mesaAttr = vp->index_to_input[attr];
@@ -258,6 +259,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
if (firstStride < 0) {
firstStride = stride;
+ user_memory = !bufObj || !bufObj->Name;
}
else if (firstStride != stride) {
return GL_FALSE;
@@ -268,6 +270,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
/* Try to detect if the client-space arrays are
* "close" to each other.
*/
+ if (!user_memory) {
+ return GL_FALSE;
+ }
if (!client_addr) {
client_addr = arrays[mesaAttr]->Ptr;
}
@@ -277,6 +282,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
}
}
else if (!firstBufObj) {
+ if (user_memory) {
+ return GL_FALSE;
+ }
firstBufObj = bufObj;
}
else if (bufObj != firstBufObj) {