zink: simplify ntv shader descriptor emission

these can be emitted directly

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18144>
This commit is contained in:
Mike Blumenkrantz 2022-09-12 12:05:09 -04:00 committed by Marge Bot
parent 99ef2c9a1b
commit e32afce507

View file

@ -1086,20 +1086,6 @@ emit_bo(struct ntv_context *ctx, struct nir_variable *var)
spirv_builder_emit_binding(&ctx->builder, var_id, var->data.binding);
}
static void
emit_uniform(struct ntv_context *ctx, struct nir_variable *var)
{
if (var->data.mode == nir_var_mem_ubo || var->data.mode == nir_var_mem_ssbo)
emit_bo(ctx, var);
else {
assert(var->data.mode == nir_var_uniform ||
var->data.mode == nir_var_image);
const struct glsl_type *type = glsl_without_array(var->type);
if (glsl_type_is_sampler(type) || glsl_type_is_image(type))
emit_image(ctx, var, false);
}
}
static SpvId
get_vec_from_bit_size(struct ntv_context *ctx, uint32_t bit_size, uint32_t num_components)
{
@ -4334,13 +4320,13 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_
emit_so_info(&ctx, sinfo, max_output);
uint32_t tcs_vertices_out_word = 0;
/* we have to reverse iterate to match what's done in zink_compiler.c */
foreach_list_typed_reverse(nir_variable, var, node, &s->variables)
if (_nir_shader_variable_has_mode(var, nir_var_uniform |
nir_var_image |
nir_var_mem_ubo |
nir_var_mem_ssbo))
emit_uniform(&ctx, var);
nir_foreach_variable_with_modes(var, s, nir_var_mem_ubo | nir_var_mem_ssbo)
emit_bo(&ctx, var);
nir_foreach_variable_with_modes(var, s, nir_var_uniform | nir_var_image) {
const struct glsl_type *type = glsl_without_array(var->type);
if (glsl_type_is_sampler(type) || glsl_type_is_image(type))
emit_image(&ctx, var, false);
}
switch (s->info.stage) {
case MESA_SHADER_FRAGMENT: