mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 23:10:23 +01:00
zink: more accurately set ImageQuery cap
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17734>
This commit is contained in:
parent
f55a4407ef
commit
e22cadbed6
1 changed files with 7 additions and 6 deletions
|
|
@ -2859,6 +2859,8 @@ emit_image_deref_size(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
|||
/* SPIRV requires 2 components for non-array cube size */
|
||||
if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE && !glsl_sampler_type_is_array(type))
|
||||
num_components = 2;
|
||||
|
||||
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityImageQuery);
|
||||
SpvId result = spirv_builder_emit_image_query_size(&ctx->builder, get_uvec_type(ctx, 32, num_components), img, 0);
|
||||
store_dest(ctx, &intr->dest, result, nir_type_uint);
|
||||
}
|
||||
|
|
@ -2871,6 +2873,8 @@ emit_image_deref_samples(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
|||
nir_variable *var = deref->deref_type == nir_deref_type_var ? deref->var : get_var_from_image(ctx, img_var);
|
||||
SpvId img_type = var->data.bindless ? get_bare_image_type(ctx, var, false) : ctx->image_types[var->data.driver_location];
|
||||
SpvId img = spirv_builder_emit_load(&ctx->builder, img_type, img_var);
|
||||
|
||||
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityImageQuery);
|
||||
SpvId result = spirv_builder_emit_unop(&ctx->builder, SpvOpImageQuerySamples, get_dest_type(ctx, &intr->dest, nir_type_uint), img);
|
||||
store_dest(ctx, &intr->dest, result, nir_type_uint);
|
||||
}
|
||||
|
|
@ -3504,6 +3508,9 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
|||
tex->dest.ssa.num_components--;
|
||||
SpvId dest_type = get_dest_type(ctx, &tex->dest, tex->dest_type);
|
||||
|
||||
if (nir_tex_instr_is_query(tex))
|
||||
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityImageQuery);
|
||||
|
||||
if (!tex_instr_is_lod_allowed(tex))
|
||||
lod = 0;
|
||||
else if (ctx->stage != MESA_SHADER_FRAGMENT &&
|
||||
|
|
@ -4190,12 +4197,6 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_
|
|||
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityMultiViewport);
|
||||
}
|
||||
|
||||
if (s->info.num_textures)
|
||||
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImageQuery);
|
||||
|
||||
if (s->info.num_images)
|
||||
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImageQuery);
|
||||
|
||||
ctx.stage = s->info.stage;
|
||||
ctx.sinfo = sinfo;
|
||||
ctx.GLSL_std_450 = spirv_builder_import(&ctx.builder, "GLSL.std.450");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue