tnl: Don't dereference NULL obj pointer in t_rebase_prims
Structurally the code is now similar to the handling of other
gl_buffer_object::obj pointers elsewhere in TNL. The fixes tag is a
little bit misleading. I think the change in that commit just exposes a
previously existing bug.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2746
Fixes: f3cce7087a
("mesa: don't ever bind NullBufferObj for glBindBuffer targets")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
This commit is contained in:
parent
2e43b32e72
commit
7a03240b63
|
@ -151,16 +151,19 @@ void t_rebase_prims( struct gl_context *ctx,
|
||||||
} else if (ib) {
|
} else if (ib) {
|
||||||
/* Unfortunately need to adjust each index individually.
|
/* Unfortunately need to adjust each index individually.
|
||||||
*/
|
*/
|
||||||
GLboolean map_ib = ib->obj &&
|
bool map_ib = false;
|
||||||
!ib->obj->Mappings[MAP_INTERNAL].Pointer;
|
const void *ptr;
|
||||||
void *ptr;
|
|
||||||
|
|
||||||
if (map_ib)
|
if (ib->obj) {
|
||||||
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
if (!ib->obj->Mappings[MAP_INTERNAL].Pointer) {
|
||||||
ib->obj, MAP_INTERNAL);
|
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
||||||
|
ib->obj, MAP_INTERNAL);
|
||||||
|
map_ib = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
|
||||||
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
|
} else
|
||||||
|
ptr = ib->ptr;
|
||||||
|
|
||||||
/* Some users might prefer it if we translated elements to
|
/* Some users might prefer it if we translated elements to
|
||||||
* GLuints here. Others wouldn't...
|
* GLuints here. Others wouldn't...
|
||||||
|
|
Loading…
Reference in New Issue