summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm.h
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-05-08 23:48:20 -0400
committerZack Rusin <zackr@vmware.com>2013-05-14 03:09:32 -0400
commit29853ab7b8656cee9b92a53bec43f6e9f1e49691 (patch)
tree6b4ac7f1accc0358717fe98d6e8b1c5b982baafb /src/gallium/auxiliary/draw/draw_llvm.h
parent386327c48f88b052449afa4f41b1090d3fdb5ce9 (diff)
downloadexternal_mesa3d-29853ab7b8656cee9b92a53bec43f6e9f1e49691.zip
external_mesa3d-29853ab7b8656cee9b92a53bec43f6e9f1e49691.tar.gz
external_mesa3d-29853ab7b8656cee9b92a53bec43f6e9f1e49691.tar.bz2
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 <zackr@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.h')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index 5909fc1..d517b29 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -173,6 +173,18 @@ enum {
#define draw_jit_vbuffer_offset(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 1, "buffer_offset")
+enum {
+ DRAW_JIT_DVBUFFER_MAP = 0,
+ DRAW_JIT_DVBUFFER_SIZE,
+ DRAW_JIT_DVBUFFER_NUM_FIELDS /* number of fields above */
+};
+
+#define draw_jit_dvbuffer_map(_gallivm, _ptr) \
+ lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_DVBUFFER_MAP, "map")
+
+#define draw_jit_dvbuffer_size(_gallivm, _ptr) \
+ lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_DVBUFFER_SIZE, "size")
+
/**
* This structure is passed directly to the generated geometry shader.
@@ -246,7 +258,7 @@ enum {
typedef int
(*draw_jit_vert_func)(struct draw_jit_context *context,
struct vertex_header *io,
- const char *vbuffers[PIPE_MAX_ATTRIBS],
+ const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
unsigned start,
unsigned count,
unsigned stride,
@@ -257,7 +269,7 @@ typedef int
typedef int
(*draw_jit_vert_func_elts)(struct draw_jit_context *context,
struct vertex_header *io,
- const char *vbuffers[PIPE_MAX_ATTRIBS],
+ const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
const unsigned *fetch_elts,
unsigned fetch_count,
unsigned stride,