tu_cs_emit_regs(&cs, A6XX_RB_STENCILREF(.ref = ds_info->front.reference & 0xff,
.bfref = ds_info->back.reference & 0xff));
}
+
+ if (ds_info->depthTestEnable) {
+ pipeline->lrz.write = ds_info->depthWriteEnable;
+ pipeline->lrz.invalidate = false;
+ pipeline->lrz.z_test_enable = true;
+
+ /* LRZ does not support some depth modes.
+ *
+ * The HW has a flag for GREATER and GREATER_OR_EQUAL modes which is used
+ * in freedreno, however there are some dEQP-VK tests that fail if we use here.
+ * Furthermore, blob disables LRZ on these comparison opcodes too.
+ *
+ * TODO: investigate if we can enable GREATER flag here.
+ */
+ switch(ds_info->depthCompareOp) {
+ case VK_COMPARE_OP_ALWAYS:
+ case VK_COMPARE_OP_NOT_EQUAL:
+ case VK_COMPARE_OP_GREATER:
+ case VK_COMPARE_OP_GREATER_OR_EQUAL:
+ pipeline->lrz.invalidate = true;
+ pipeline->lrz.write = false;
+ break;
+ case VK_COMPARE_OP_EQUAL:
+ case VK_COMPARE_OP_NEVER:
+ pipeline->lrz.enable = true;
+ pipeline->lrz.write = false;
+ break;
+ case VK_COMPARE_OP_LESS:
+ case VK_COMPARE_OP_LESS_OR_EQUAL:
+ pipeline->lrz.enable = true;
+ break;
+ default:
+ unreachable("bad VK_COMPARE_OP value");
+ break;
+ };
+ }
+
+ if (ds_info->stencilTestEnable) {
+ pipeline->lrz.write = false;
+ pipeline->lrz.invalidate = true;
+ }
}
static void