From c272bb58f5cded827b8a4c94a419504f8ff4cc9e Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 6 Oct 2015 15:10:45 -0700 Subject: [PATCH] nir/spirv: Better texture handling --- src/glsl/nir/spirv_to_nir.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index e4035f222a6..d0fb6a255a5 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -1508,7 +1508,7 @@ static nir_tex_src vtn_tex_src(struct vtn_builder *b, unsigned index, nir_tex_src_type type) { nir_tex_src src; - src.src = nir_src_for_ssa(vtn_value(b, index, vtn_value_type_ssa)->ssa->def); + src.src = nir_src_for_ssa(vtn_ssa_value(b, index)->def); src.src_type = type; return src; } @@ -1568,16 +1568,19 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, nir_texop texop; switch (opcode) { case SpvOpImageSampleImplicitLod: - case SpvOpImageSampleExplicitLod: case SpvOpImageSampleDrefImplicitLod: - case SpvOpImageSampleDrefExplicitLod: case SpvOpImageSampleProjImplicitLod: - case SpvOpImageSampleProjExplicitLod: case SpvOpImageSampleProjDrefImplicitLod: - case SpvOpImageSampleProjDrefExplicitLod: texop = nir_texop_tex; break; + case SpvOpImageSampleExplicitLod: + case SpvOpImageSampleDrefExplicitLod: + case SpvOpImageSampleProjExplicitLod: + case SpvOpImageSampleProjDrefExplicitLod: + texop = nir_texop_txl; + break; + case SpvOpImageFetch: texop = nir_texop_txf; break; @@ -1616,8 +1619,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, } if (operands & SpvImageOperandsLodMask) { - assert(texop == nir_texop_tex); - texop = nir_texop_txl; + assert(texop == nir_texop_txl || texop == nir_texop_txf || + texop == nir_texop_txs); (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_lod); } -- 2.30.2