From: Jason Ekstrand Date: Fri, 15 Jan 2016 02:40:35 +0000 (-0800) Subject: nir/spirv: Fix texture return types X-Git-Tag: upstream/17.1.0~11012^2~675 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6483d3f8fe4301544550cf7665c26ec1d8616728;p=platform%2Fupstream%2Fmesa.git nir/spirv: Fix texture return types We were just hard-coding everything to a vec4. This meant we weren't handling shadow samplers at all and integer things were getting the wrong return type. --- diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index cdaf972..54030dd 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -2337,6 +2337,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, return; } + struct vtn_type *ret_type = vtn_value(b, w[1], vtn_value_type_type)->type; struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_ssa); struct vtn_sampled_image sampled; @@ -2496,6 +2497,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, instr->coord_components = coord_components; instr->is_array = glsl_sampler_type_is_array(sampler_type); instr->is_shadow = glsl_sampler_type_is_shadow(sampler_type); + instr->is_new_style_shadow = instr->is_shadow; instr->sampler = nir_deref_as_var(nir_copy_deref(instr, &sampled.sampler->deref)); @@ -2506,8 +2508,13 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, instr->texture = NULL; } - nir_ssa_dest_init(&instr->instr, &instr->dest, 4, NULL); - val->ssa = vtn_create_ssa_value(b, glsl_vector_type(GLSL_TYPE_FLOAT, 4)); + nir_ssa_dest_init(&instr->instr, &instr->dest, + nir_tex_instr_dest_size(instr), NULL); + + assert(glsl_get_vector_elements(ret_type->type) == + nir_tex_instr_dest_size(instr)); + + val->ssa = vtn_create_ssa_value(b, ret_type->type); val->ssa->def = &instr->dest.ssa; nir_builder_instr_insert(&b->nb, &instr->instr);