mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 19:20:12 +01:00
spirv: set correct dest_type for texture query ops
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
parent
37dec33676
commit
39d7cb36ff
1 changed files with 17 additions and 7 deletions
|
|
@ -2017,6 +2017,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
|||
const struct glsl_type *image_type = sampled.type->type;
|
||||
const enum glsl_sampler_dim sampler_dim = glsl_get_sampler_dim(image_type);
|
||||
const bool is_array = glsl_sampler_type_is_array(image_type);
|
||||
nir_alu_type dest_type = nir_type_invalid;
|
||||
|
||||
/* Figure out the base texture operation */
|
||||
nir_texop texop;
|
||||
|
|
@ -2051,18 +2052,22 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
|||
case SpvOpImageQuerySizeLod:
|
||||
case SpvOpImageQuerySize:
|
||||
texop = nir_texop_txs;
|
||||
dest_type = nir_type_int;
|
||||
break;
|
||||
|
||||
case SpvOpImageQueryLod:
|
||||
texop = nir_texop_lod;
|
||||
dest_type = nir_type_float;
|
||||
break;
|
||||
|
||||
case SpvOpImageQueryLevels:
|
||||
texop = nir_texop_query_levels;
|
||||
dest_type = nir_type_int;
|
||||
break;
|
||||
|
||||
case SpvOpImageQuerySamples:
|
||||
texop = nir_texop_texture_samples;
|
||||
dest_type = nir_type_int;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -2269,15 +2274,20 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
|||
if (sampled.sampler && (sampled.sampler->access & ACCESS_NON_UNIFORM))
|
||||
instr->sampler_non_uniform = true;
|
||||
|
||||
switch (glsl_get_sampler_result_type(image_type)) {
|
||||
case GLSL_TYPE_FLOAT: instr->dest_type = nir_type_float; break;
|
||||
case GLSL_TYPE_INT: instr->dest_type = nir_type_int; break;
|
||||
case GLSL_TYPE_UINT: instr->dest_type = nir_type_uint; break;
|
||||
case GLSL_TYPE_BOOL: instr->dest_type = nir_type_bool; break;
|
||||
default:
|
||||
vtn_fail("Invalid base type for sampler result");
|
||||
/* for non-query ops, get dest_type from sampler type */
|
||||
if (dest_type == nir_type_invalid) {
|
||||
switch (glsl_get_sampler_result_type(image_type)) {
|
||||
case GLSL_TYPE_FLOAT: dest_type = nir_type_float; break;
|
||||
case GLSL_TYPE_INT: dest_type = nir_type_int; break;
|
||||
case GLSL_TYPE_UINT: dest_type = nir_type_uint; break;
|
||||
case GLSL_TYPE_BOOL: dest_type = nir_type_bool; break;
|
||||
default:
|
||||
vtn_fail("Invalid base type for sampler result");
|
||||
}
|
||||
}
|
||||
|
||||
instr->dest_type = dest_type;
|
||||
|
||||
nir_ssa_dest_init(&instr->instr, &instr->dest,
|
||||
nir_tex_instr_dest_size(instr), 32, NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue