Skip to contentSkip to conversation

nv50/ir: retrieve shadow compare from first arg

PATCH New Ilia Mirkin 2 participants 2 messages Jul 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nv50/ir: retrieve shadow compare from first arg

This can only happen with texture(samplerCubeShadow, bias), where the compare will be in the first argument.

---
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp +1 -1
index 9b7c490..af3a87c 100644
@@ -2504,7 +2504,7 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
       break;
    case TGSI_OPCODE_TXB2:
    case TGSI_OPCODE_TXL2:
-      handleTEX(dst0, 2, 2, 0x10, 0x11, 0x00, 0x00);
+      handleTEX(dst0, 2, 2, 0x10, 0x0f, 0x00, 0x00);
       break;
    case TGSI_OPCODE_SAMPLE:
    case TGSI_OPCODE_SAMPLE_B:
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 2/2 nv50/ir: ignore bias for samplerCubeShadow on nv50

Unfortunately there's no good way to do this on the nv50 shader isa. Dropping the bias seems preferable to doing the compare post-filtering.

---
 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp +10 -0
index ed06def..e283424 100644
@@ -797,6 +797,16 @@ NV50LoweringPreSSA::handleTXB(TexInstruction *i)
    const CondCode cc[4] = { CC_EQU, CC_S, CC_C, CC_O };
    int l, d;
 
+   // We can't actually apply bias *and* do a compare for a cube
+   // texture. Since the compare has to be done before the filtering, just
+   // drop the bias on the floor.
+   if (i->tex.target == TEX_TARGET_CUBE_SHADOW) {
+      i->op = OP_TEX;
+      i->setSrc(3, i->getSrc(4));
+      i->setSrc(4, NULL);
+      return handleTEX(i);
+   }
+
    handleTEX(i);
    Value *bias = i->getSrc(i->tex.target.getArgCount());
    if (bias->isUniform())
Signature · 1 line
1.8.5.5