struct nouveau_pushbuf *push = nvc0->base.pushbuf;
struct nvc0_query *q;
uint32_t cond;
- boolean negated = FALSE;
boolean wait =
mode != PIPE_RENDER_COND_NO_WAIT &&
mode != PIPE_RENDER_COND_BY_REGION_NO_WAIT;
+ if (!pq) {
+ cond = NVC0_3D_COND_MODE_ALWAYS;
+ }
+ else {
+ q = nvc0_query(pq);
+ /* NOTE: comparison of 2 queries only works if both have completed */
+ switch (q->type) {
+ case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+ cond = condition ? NVC0_3D_COND_MODE_EQUAL :
+ NVC0_3D_COND_MODE_NOT_EQUAL;
+ wait = TRUE;
+ break;
+ case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
+ if (likely(!condition)) {
+ if (unlikely(q->nesting))
+ cond = wait ? NVC0_3D_COND_MODE_NOT_EQUAL :
+ NVC0_3D_COND_MODE_ALWAYS;
+ else
+ cond = NVC0_3D_COND_MODE_RES_NON_ZERO;
+ } else {
+ cond = wait ? NVC0_3D_COND_MODE_EQUAL : NVC0_3D_COND_MODE_ALWAYS;
+ }
+ break;
+ default:
+ assert(!"render condition query not a predicate");
+ cond = NVC0_3D_COND_MODE_ALWAYS;
+ break;
+ }
+ }
+
nvc0->cond_query = pq;
nvc0->cond_cond = condition;
+ nvc0->cond_condmode = cond;
nvc0->cond_mode = mode;
if (!pq) {
PUSH_SPACE(push, 1);
- IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
+ IMMED_NVC0(push, NVC0_3D(COND_MODE), cond);
return;
}
- q = nvc0_query(pq);
-
- /* NOTE: comparison of 2 queries only works if both have completed */
- switch (q->type) {
- case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
- cond = negated ? NVC0_3D_COND_MODE_EQUAL :
- NVC0_3D_COND_MODE_NOT_EQUAL;
- wait = TRUE;
- break;
- case PIPE_QUERY_OCCLUSION_COUNTER:
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- if (likely(!negated)) {
- if (unlikely(q->nesting))
- cond = wait ? NVC0_3D_COND_MODE_NOT_EQUAL :
- NVC0_3D_COND_MODE_ALWAYS;
- else
- cond = NVC0_3D_COND_MODE_RES_NON_ZERO;
- } else {
- cond = wait ? NVC0_3D_COND_MODE_EQUAL : NVC0_3D_COND_MODE_ALWAYS;
- }
- break;
- default:
- assert(!"render condition query not a predicate");
- mode = NVC0_3D_COND_MODE_ALWAYS;
- break;
- }
if (wait)
nvc0_query_fifo_wait(push, pq);
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
+ case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
case PIPE_CAP_COMPUTE:
return (class_3d == NVE4_3D_CLASS) ? 1 : 0;
- case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
- return 0;
/* unsupported caps */
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: