r300g: only check for an empty shader if there are no compile errors
[mesa.git] / src / gallium / drivers / softpipe / sp_quad_depth_test.c
index 4ee31969e6b2af34a826454d34608b4fe617efd4..5590d4089291f0ceebfae31deeb3ce12eb1fb365 100644 (file)
@@ -82,7 +82,7 @@ get_depth_stencil_values( struct depth_data *data,
          data->bzzzz[j] = tile->data.depth32[y][x] & 0xffffff;
          data->stencilVals[j] = tile->data.depth32[y][x] >> 24;
       }
-   break;
+      break;
    case PIPE_FORMAT_X8Z24_UNORM:
    case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
       for (j = 0; j < QUAD_SIZE; j++) {
@@ -92,6 +92,14 @@ get_depth_stencil_values( struct depth_data *data,
          data->stencilVals[j] = tile->data.depth32[y][x] & 0xff;
       }
       break;
+   case PIPE_FORMAT_S8_USCALED:
+      for (j = 0; j < QUAD_SIZE; j++) {
+         int x = quad->input.x0 % TILE_SIZE + (j & 1);
+         int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+         data->bzzzz[j] = 0;
+         data->stencilVals[j] = tile->data.stencil8[y][x];
+      }
+      break;
    default:
       assert(0);
    }
@@ -227,6 +235,14 @@ write_depth_stencil_values( struct depth_data *data,
          tile->data.depth32[y][x] = data->bzzzz[j] << 8;
       }
       break;
+   case PIPE_FORMAT_S8_USCALED:
+      for (j = 0; j < QUAD_SIZE; j++) {
+         int x = quad->input.x0 % TILE_SIZE + (j & 1);
+         int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+         tile->data.stencil8[y][x] = data->stencilVals[j];
+      }
+      break;
+
    default:
       assert(0);
    }
@@ -520,6 +536,9 @@ depth_stencil_test_quad(struct quad_stage *qs,
       face = 0;
    }
 
+   /* 0 = front-face, 1 = back-face */
+   assert(face == 0 || face == 1);
+
    /* choose front or back face function, operator, etc */
    /* XXX we could do these initializations once per primitive */
    func    = softpipe->depth_stencil->stencil[face].func;
@@ -658,20 +677,6 @@ static unsigned mask_count[16] =
 
 
 
-/** helper to get number of Z buffer bits */
-static unsigned
-get_depth_bits(struct quad_stage *qs)
-{
-   struct pipe_surface *zsurf = qs->softpipe->framebuffer.zsbuf;
-   if (zsurf)
-      return util_format_get_component_bits(zsurf->format,
-                                            UTIL_FORMAT_COLORSPACE_ZS, 0);
-   else
-      return 0;
-}
-
-
-
 /**
  * General depth/stencil test function.  Used when there's no fast-path.
  */
@@ -690,9 +695,8 @@ depth_test_quads_fallback(struct quad_stage *qs,
       nr = alpha_test_quads(qs, quads, nr);
    }
 
-   if (get_depth_bits(qs) > 0 &&
-       (qs->softpipe->depth_stencil->depth.enabled ||
-        qs->softpipe->depth_stencil->stencil[0].enabled)) {
+   if (qs->softpipe->depth_stencil->depth.enabled ||
+       qs->softpipe->depth_stencil->stencil[0].enabled) {
 
       data.ps = qs->softpipe->framebuffer.zsbuf;
       data.format = data.ps->format;
@@ -791,8 +795,7 @@ choose_depth_test(struct quad_stage *qs,
 
    boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
 
-   boolean depth = (get_depth_bits(qs) > 0 &&
-                    qs->softpipe->depth_stencil->depth.enabled);
+   boolean depth = qs->softpipe->depth_stencil->depth.enabled;
 
    unsigned depthfunc = qs->softpipe->depth_stencil->depth.func;