zink: move ubo range assert to update_descriptor_state()

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
This commit is contained in:
Mike Blumenkrantz
2021-03-25 09:25:31 -04:00
parent e5b0d21628
commit 93021aa6c8
2 changed files with 3 additions and 3 deletions
+3 -1
View File
@@ -431,7 +431,8 @@ get_bufferview_for_binding(struct zink_context *ctx, enum pipe_shader_type stage
static void
update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader, enum zink_descriptor_type type, unsigned slot)
{
bool have_null_descriptors = zink_screen(ctx->base.screen)->info.rb2_feats.nullDescriptor;
struct zink_screen *screen = zink_screen(ctx->base.screen);
bool have_null_descriptors = screen->info.rb2_feats.nullDescriptor;
VkBuffer null_buffer = zink_resource(ctx->dummy_vertex_buffer)->obj->buffer;
struct zink_surface *null_surface = zink_surface(ctx->dummy_surface);
struct zink_buffer_view *null_bufferview = ctx->dummy_bufferview;
@@ -443,6 +444,7 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader,
if (res) {
ctx->di.ubos[shader][slot].buffer = res->obj->buffer;
ctx->di.ubos[shader][slot].range = ctx->ubos[shader][slot].buffer_size;
assert(ctx->di.ubos[shader][slot].range <= screen->info.props.limits.maxUniformBufferRange);
} else {
ctx->di.ubos[shader][slot].buffer = have_null_descriptors ? VK_NULL_HANDLE : null_buffer;
ctx->di.ubos[shader][slot].range = VK_WHOLE_SIZE;
@@ -1141,7 +1141,6 @@ update_ubo_descriptors(struct zink_context *ctx, struct zink_descriptor_set *zds
bool is_compute, bool cache_hit)
{
struct zink_program *pg = is_compute ? (struct zink_program *)ctx->curr_compute : (struct zink_program *)ctx->curr_program;
struct zink_screen *screen = zink_screen(ctx->base.screen);
unsigned num_descriptors = pg->dd->pool[ZINK_DESCRIPTOR_TYPE_UBO]->key.layout->num_descriptors;
unsigned num_bindings = zds->pool->num_resources;
VkWriteDescriptorSet wds[num_descriptors];
@@ -1168,7 +1167,6 @@ update_ubo_descriptors(struct zink_context *ctx, struct zink_descriptor_set *zds
if (!index)
continue;
assert(shader->bindings[ZINK_DESCRIPTOR_TYPE_UBO][j].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
assert(ctx->ubos[stage][index].buffer_size <= screen->info.props.limits.maxUniformBufferRange);
struct zink_resource *res = zink_get_resource_for_descriptor(ctx, ZINK_DESCRIPTOR_TYPE_UBO, stage, index);
assert(!res || info->range > 0);
assert(!res || info->buffer);