diff options
author | Marek Olšák <[email protected]> | 2020-01-20 21:35:54 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-11 00:34:57 +0000 |
commit | f89ee44ab0300b72ab957c3135858ff46187dfb5 (patch) | |
tree | e833a26806babd4f2e27f1c280a349717d7ba329 /src/mesa/main/varray.c | |
parent | 27dada7ce90315d47184c51879a3f67e99f2bab2 (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.c | 14 |
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) { |