st/mesa: Drop st_public support.
[mesa.git] / src / mesa / state_tracker / st_cb_readpixels.c
index 7afb275fe2fa11fc96108b1bebbda9f77d704788..67c3b9adbb9b62fcb322653025e3acda678999ed 100644 (file)
@@ -48,7 +48,6 @@
 #include "st_atom.h"
 #include "st_cb_readpixels.h"
 #include "st_cb_fbo.h"
-#include "st_public.h"
 #include "st_texture.h"
 #include "st_inlines.h"
 
@@ -82,7 +81,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
                                       width, height);
 
    /* map the stencil buffer */
-   stmap = pipe->transfer_map(pipe, pt);
+   stmap = pipe_transfer_map(pipe, pt);
 
    /* width should never be > MAX_WIDTH since we did clipping earlier */
    ASSERT(width <= MAX_WIDTH);
@@ -102,14 +101,14 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
       }
 
       /* get stencil (and Z) values */
-      switch (pt->texture->format) {
-      case PIPE_FORMAT_S8_UNORM:
+      switch (pt->resource->format) {
+      case PIPE_FORMAT_S8_USCALED:
          {
             const ubyte *src = stmap + srcY * pt->stride;
             memcpy(sValues, src, width);
          }
          break;
-      case PIPE_FORMAT_Z24S8_UNORM:
+      case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
          if (format == GL_DEPTH_STENCIL) {
             const uint *src = (uint *) (stmap + srcY * pt->stride);
             const GLfloat scale = 1.0f / (0xffffff);
@@ -127,7 +126,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
             }
          }
          break;
-      case PIPE_FORMAT_S8Z24_UNORM:
+      case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
          if (format == GL_DEPTH_STENCIL) {
             const uint *src = (uint *) (stmap + srcY * pt->stride);
             const GLfloat scale = 1.0f / (0xffffff);
@@ -162,15 +161,14 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    }
 
    /* unmap the stencil buffer */
-   pipe->transfer_unmap(pipe, pt);
-   pipe->tex_transfer_destroy(pipe, pt);
+   pipe_transfer_unmap(pipe, pt);
+   pipe->transfer_destroy(pipe, pt);
 }
 
 
 /**
  * Return renderbuffer to use for reading color pixels for glRead/CopyPixel
  * commands.
- * Special care is needed for the front buffer.
  */
 struct st_renderbuffer *
 st_get_color_read_renderbuffer(GLcontext *ctx)
@@ -178,18 +176,6 @@ st_get_color_read_renderbuffer(GLcontext *ctx)
    struct gl_framebuffer *fb = ctx->ReadBuffer;
    struct st_renderbuffer *strb =
       st_renderbuffer(fb->_ColorReadBuffer);
-   struct st_renderbuffer *front = 
-      st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
-
-   if (strb == front
-       && ctx->st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) {
-      /* reading from front color buffer, which is a logical copy of the
-       * back color buffer.
-       */
-      struct st_renderbuffer *back = 
-         st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
-      strb = back;
-   }
 
    return strb;
 }
@@ -253,9 +239,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
          return GL_FALSE;
       }
 
-      map = pipe->transfer_map(pipe, trans);
+      map = pipe_transfer_map(pipe, trans);
       if (!map) {
-         pipe->tex_transfer_destroy(pipe, trans);
+         pipe->transfer_destroy(pipe, trans);
          return GL_FALSE;
       }
 
@@ -317,8 +303,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
          ; /* nothing */
       }
 
-      pipe->transfer_unmap(pipe, trans);
-      pipe->tex_transfer_destroy(pipe, trans);
+      pipe_transfer_unmap(pipe, trans);
+      pipe->transfer_destroy(pipe, trans);
    }
 
    return GL_TRUE;
@@ -437,8 +423,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width,
                                                      format, type);
 
-      if (trans->texture->format == PIPE_FORMAT_Z24S8_UNORM ||
-          trans->texture->format == PIPE_FORMAT_Z24X8_UNORM) {
+      if (trans->resource->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
+          trans->resource->format == PIPE_FORMAT_Z24X8_UNORM) {
          if (format == GL_DEPTH_COMPONENT) {
             for (i = 0; i < height; i++) {
                GLuint ztemp[MAX_WIDTH];
@@ -469,8 +455,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             }
          }
       }
-      else if (trans->texture->format == PIPE_FORMAT_S8Z24_UNORM ||
-               trans->texture->format == PIPE_FORMAT_X8Z24_UNORM) {
+      else if (trans->resource->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM ||
+               trans->resource->format == PIPE_FORMAT_X8Z24_UNORM) {
          if (format == GL_DEPTH_COMPONENT) {
             for (i = 0; i < height; i++) {
                GLuint ztemp[MAX_WIDTH];
@@ -496,7 +482,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             }
          }
       }
-      else if (trans->texture->format == PIPE_FORMAT_Z16_UNORM) {
+      else if (trans->resource->format == PIPE_FORMAT_Z16_UNORM) {
          for (i = 0; i < height; i++) {
             GLushort ztemp[MAX_WIDTH];
             GLfloat zfloat[MAX_WIDTH];
@@ -511,7 +497,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             dst += dstStride;
          }
       }
-      else if (trans->texture->format == PIPE_FORMAT_Z32_UNORM) {
+      else if (trans->resource->format == PIPE_FORMAT_Z32_UNORM) {
          for (i = 0; i < height; i++) {
             GLuint ztemp[MAX_WIDTH];
             GLfloat zfloat[MAX_WIDTH];
@@ -542,7 +528,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       }
    }
 
-   pipe->tex_transfer_destroy(pipe, trans);
+   pipe->transfer_destroy(pipe, trans);
 
    _mesa_unmap_pbo_dest(ctx, &clippedPacking);
 }