summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.h
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-09-14 22:38:14 -0700
committerKenneth Graunke <[email protected]>2014-09-19 00:43:01 -0700
commit26ee6f23a9aec6b1f392baa0e3f1f2c62c038a57 (patch)
treee53380a98e2895a1e22c3a17d12defb19a045f02 /src/mesa/main/varray.h
parent19589147ef660c0bf7fcc52ca82dfbbadf3a9a23 (diff)
mesa: Delete VAO _MaxElement code and index buffer bounds checking.
Fredrik's implementation of ARB_vertex_attrib_binding introduced new gl_vertex_attrib_array and gl_vertex_buffer_binding structures, and converted Mesa's older gl_client_array to be derived state. Ultimately, we'd like to drop gl_client_array and use those structures directly. One hitch is that gl_client_array::_MaxElement doesn't correspond to either structure (unlike every other field), so we'd have to figure out where to store it. The _MaxElement computation uses values from both structures, so it doesn't really belong in either place. We could put it in the VAO, but we'd have to pass it around everywhere. It turns out that it's only used when ctx->Const.CheckArrayBounds is set, which is only set by the (rarely used) classic swrast driver. It appears that drivers/x11 used to set it as well, which was intended to avoid segmentation faults on out-of-bounds memory access in the X server (probably for indirect GLX clients). However, ajax deleted that code in 2010 (commit 1ccef926be46dce3b6b5c76e812e2fae4e205ce7). The bounds checking apparently doesn't actually work, either. Non-VBO attributes arbitrarily set _MaxElement to 2 * 1000 * 1000 * 1000. vbo_save_draw and vbo_exec_draw remark /* ??? */ when setting it, and the i965 code contains a comment noting that _MaxElement is often bogus. Given that the code is complex, rarely used, and dubiously functional, it doesn't seem worth maintaining going forward. This patch drops it. This will probably mean the classic swrast driver may begin crashing on out of bounds vertex buffer access in some cases, but I believe that is allowed by OpenGL (and probably happened for non-VBO accesses anyway). There do not appear to be any Piglit regressions, either. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.h')
-rw-r--r--src/mesa/main/varray.h33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index d5d8b363d43..4e4bd5f80a7 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -34,39 +34,6 @@
struct gl_client_array;
struct gl_context;
-
-/**
- * Compute the index of the last array element that can be safely accessed in
- * a vertex array. We can really only do this when the array lives in a VBO.
- * The array->_MaxElement field will be updated.
- * Later in glDrawArrays/Elements/etc we can do some bounds checking.
- */
-static inline void
-_mesa_update_array_max_element(struct gl_client_array *array)
-{
- assert(array->Enabled);
-
- if (array->BufferObj->Name) {
- GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
- GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
-
- if (offset < bufSize) {
- const GLuint stride = array->StrideB ?
- array->StrideB : array->_ElementSize;
- array->_MaxElement = (bufSize - offset + stride
- - array->_ElementSize) / stride;
- }
- else {
- array->_MaxElement = 0;
- }
- }
- else {
- /* user-space array, no idea how big it is */
- array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
- }
-}
-
-
/**
* Returns a pointer to the vertex attribute data in a client array,
* or the offset into the vertex buffer for an array that resides in