aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-01-20 21:35:54 -0500
committerMarge Bot <[email protected]>2020-02-11 00:34:57 +0000
commitf89ee44ab0300b72ab957c3135858ff46187dfb5 (patch)
treee833a26806babd4f2e27f1c280a349717d7ba329 /src/mesa/main/varray.c
parent27dada7ce90315d47184c51879a3f67e99f2bab2 (diff)
mesa: import PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET handling
This should decrease overhead in st_update_array. Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 048e836b60c..bea3e8945ab 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -199,6 +199,20 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx,
assert(!vao->SharedAndImmutable);
struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index];
+ if (ctx->Const.VertexBufferOffsetIsInt32 && (int)offset < 0 &&
+ _mesa_is_bufferobj(vbo)) {
+ /* The offset will be interpreted as a signed int, so make sure
+ * the user supplied offset is not negative (driver limitation).
+ */
+ _mesa_warning(ctx, "Received negative int32 vertex buffer offset. "
+ "(driver limitation)\n");
+
+ /* We can't disable this binding, so use a non-negative offset value
+ * instead.
+ */
+ offset = 0;
+ }
+
if (binding->BufferObj != vbo ||
binding->Offset != offset ||
binding->Stride != stride) {