d3d12: Really handle null constant buffers

Previous attempt was checking the wrong pointer...

Fixes: eb27db86 ("d3d12: Handle null constant buffers")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4362
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9349>
This commit is contained in:
Jesse Natalie 2021-03-01 13:46:55 -08:00 committed by Marge Bot
parent 8708d32d9c
commit 3b687722b3

View file

@ -60,10 +60,7 @@ fill_cbv_descriptors(struct d3d12_context *ctx,
struct pipe_constant_buffer *buffer = &ctx->cbufs[stage][binding];
D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_desc = {};
if (buffer) {
assert(buffer->buffer_size > 0);
assert(buffer->buffer);
if (buffer && buffer->buffer) {
struct d3d12_resource *res = d3d12_resource(buffer->buffer);
d3d12_transition_resource_state(ctx, res, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
cbv_desc.BufferLocation = d3d12_resource_gpu_virtual_address(res) + buffer->buffer_offset;