mesa: Fix pack_uint_Z_FLOAT32()
[mesa.git] / src / mesa / swrast / s_stencil.c
index 3eeeb24b2de551378a9bcb6aad758cc14305c7c0..8ccd5a16442cbcbcbcabbb7a826522c7266c1172 100644 (file)
@@ -28,7 +28,6 @@
 #include "main/imports.h"
 #include "main/format_pack.h"
 #include "main/format_unpack.h"
-#include "main/core.h"
 #include "main/stencil.h"
 
 #include "s_context.h"
@@ -61,7 +60,7 @@ ENDIF
  * within the 4-byte pixel will be either 0 or 3.
  */
 static GLint
-get_stencil_offset(gl_format format)
+get_stencil_offset(mesa_format format)
 {
    const GLubyte one = 1;
    GLubyte pixel[MAX_PIXEL_BYTES];
@@ -280,7 +279,7 @@ compute_pass_fail_masks(GLuint n, const GLubyte origMask[],
 {
    GLuint i;
    for (i = 0; i < n; i++) {
-      ASSERT(newMask[i] == 0 || newMask[i] == 1);
+      assert(newMask[i] == 0 || newMask[i] == 1);
       passMask[i] = origMask[i] & newMask[i];
       failMask[i] = origMask[i] & (newMask[i] ^ 1);
    }
@@ -300,7 +299,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
    const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
    GLuint i;
 
-   if (rb->Format == MESA_FORMAT_S8) {
+   if (rb->Format == MESA_FORMAT_S_UINT8) {
       const GLint rowStride = srb->RowStride;
       for (i = 0; i < count; i++) {
          if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
@@ -580,14 +579,15 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
    }
 
    ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height,
-                               mapMode, &map, &rowStride);
+                               mapMode, &map, &rowStride,
+                               ctx->DrawBuffer->FlipY);
    if (!map) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glClear(stencil)");
       return;
    }
 
    switch (rb->Format) {
-   case MESA_FORMAT_S8:
+   case MESA_FORMAT_S_UINT8:
       {
          GLubyte clear = ctx->Stencil.Clear & writeMask & 0xff;
          GLubyte mask = (~writeMask) & 0xff;
@@ -614,7 +614,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
          }
       }
       break;
-   case MESA_FORMAT_S8_Z24:
+   case MESA_FORMAT_Z24_UNORM_S8_UINT:
       {
          GLuint clear = (ctx->Stencil.Clear & writeMask & 0xff) << 24;
          GLuint mask = (((~writeMask) & 0xff) << 24) | 0xffffff;
@@ -627,7 +627,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
          }
       }
       break;
-   case MESA_FORMAT_Z24_S8:
+   case MESA_FORMAT_S8_UINT_Z24_UNORM:
       {
          GLuint clear = ctx->Stencil.Clear & writeMask & 0xff;
          GLuint mask = 0xffffff00 | ((~writeMask) & 0xff);