result = build_tex_intrinsic(ctx, instr, &tinfo);
- if (instr->is_shadow)
- result = LLVMBuildExtractElement(ctx->builder, result, ctx->i32zero, "");
- else if (instr->op == nir_texop_query_levels)
+ if (instr->op == nir_texop_query_levels)
result = LLVMBuildExtractElement(ctx->builder, result, LLVMConstInt(ctx->i32, 3, false), "");
+ if (instr->is_shadow && instr->op != nir_texop_txs && instr->op != nir_texop_lod)
+ result = LLVMBuildExtractElement(ctx->builder, result, ctx->i32zero, "");
else if (instr->op == nir_texop_txs &&
instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&
instr->is_array) {