zink: break out bo array type construction into ntv util function
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9624>
This commit is contained in:
committed by
Marge Bot
parent
10bfe8759b
commit
99a87a283a
@@ -862,17 +862,9 @@ emit_image(struct ntv_context *ctx, struct nir_variable *var)
|
||||
spirv_builder_emit_binding(&ctx->builder, var_id, binding);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_bo(struct ntv_context *ctx, struct nir_variable *var)
|
||||
static SpvId
|
||||
get_bo_array_type(struct ntv_context *ctx, struct nir_variable *var)
|
||||
{
|
||||
bool is_ubo_array = glsl_type_is_array(var->type) && glsl_type_is_interface(glsl_without_array(var->type));
|
||||
/* variables accessed inside a uniform block will get merged into a big
|
||||
* memory blob and accessed by offset
|
||||
*/
|
||||
if (var->data.location && !is_ubo_array && var->type != var->interface_type)
|
||||
return;
|
||||
bool ssbo = var->data.mode == nir_var_mem_ssbo;
|
||||
|
||||
SpvId array_type;
|
||||
SpvId uint_type = spirv_builder_type_uint(&ctx->builder, 32);
|
||||
uint32_t array_size = glsl_count_attribute_slots(var->interface_type, false);
|
||||
@@ -884,6 +876,21 @@ emit_bo(struct ntv_context *ctx, struct nir_variable *var)
|
||||
array_length);
|
||||
}
|
||||
spirv_builder_emit_array_stride(&ctx->builder, array_type, 4);
|
||||
return array_type;
|
||||
}
|
||||
|
||||
static void
|
||||
emit_bo(struct ntv_context *ctx, struct nir_variable *var)
|
||||
{
|
||||
bool is_ubo_array = glsl_type_is_array(var->type) && glsl_type_is_interface(glsl_without_array(var->type));
|
||||
/* variables accessed inside a uniform block will get merged into a big
|
||||
* memory blob and accessed by offset
|
||||
*/
|
||||
if (var->data.location && !is_ubo_array && var->type != var->interface_type)
|
||||
return;
|
||||
bool ssbo = var->data.mode == nir_var_mem_ssbo;
|
||||
|
||||
SpvId array_type = get_bo_array_type(ctx, var);
|
||||
|
||||
// wrap UBO-array in a struct
|
||||
SpvId runtime_array = 0;
|
||||
|
||||
Reference in New Issue
Block a user