summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_private.h
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-05-08 23:48:20 -0400
committerZack Rusin <[email protected]>2013-05-14 03:09:32 -0400
commit29853ab7b8656cee9b92a53bec43f6e9f1e49691 (patch)
tree6b4ac7f1accc0358717fe98d6e8b1c5b982baafb /src/gallium/auxiliary/draw/draw_private.h
parent386327c48f88b052449afa4f41b1090d3fdb5ce9 (diff)
draw: don't crash on vertex buffer overflow
We would crash when stride was bigger than the size of the buffer. The correct behavior is to just fetch zero's in this case. Unfortunatly with user_buffer's there's no way to validate the size because currently we're just not getting it. Adjust the draw interface to pass the size along the mapped buffer, which works perfectly for buffer backed vertex_buffers and, in future, it will allow us to plumb user_buffer sizes through the same interface. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_private.h')
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 25a8ae61498..84344c36773 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -67,6 +67,14 @@ struct draw_pt_front_end;
/**
+ * Represents the mapped vertex buffer.
+ */
+struct draw_vertex_buffer {
+ const void *map;
+ size_t size;
+};
+
+/**
* Basic vertex info.
* Carry some useful information around with the vertices in the prim pipe.
*/
@@ -183,7 +191,7 @@ struct draw_context
unsigned max_index;
/** vertex arrays */
- const void *vbuffer[PIPE_MAX_ATTRIBS];
+ struct draw_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
/** constant buffers (for vertex/geometry shader) */
const void *vs_constants[PIPE_MAX_CONSTANT_BUFFERS];