swrast: implement GL_ARB_texture_storage
[mesa.git] / src / mesa / swrast / s_blit.c
index f73ac78ae26d6c67ba1745a3f3cac2348b05ab1a..f094be8985ceda8f9a35cb2e41bcf5d7c1f05b54 100644 (file)
@@ -103,7 +103,7 @@ RESAMPLE(resample_row_16, GLuint, 4)
  * Blit color, depth or stencil with GL_NEAREST filtering.
  */
 static void
-blit_nearest(GLcontext *ctx,
+blit_nearest(struct gl_context *ctx,
              GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
              GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
              GLbitfield buffer)
@@ -198,14 +198,14 @@ blit_nearest(GLcontext *ctx,
    }
 
    /* allocate the src/dst row buffers */
-   srcBuffer = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer = malloc(pixelSize * srcWidth);
    if (!srcBuffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+   dstBuffer = malloc(pixelSize * dstWidth);
    if (!dstBuffer) {
-      _mesa_free(srcBuffer);
+      free(srcBuffer);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
@@ -235,15 +235,15 @@ blit_nearest(GLcontext *ctx,
       drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
    }
 
-   _mesa_free(srcBuffer);
-   _mesa_free(dstBuffer);
+   free(srcBuffer);
+   free(dstBuffer);
 }
 
 
 
 #define LERP(T, A, B)  ( (A) + (T) * ((B) - (A)) )
 
-static INLINE GLfloat
+static inline GLfloat
 lerp_2d(GLfloat a, GLfloat b,
         GLfloat v00, GLfloat v10, GLfloat v01, GLfloat v11)
 {
@@ -316,7 +316,7 @@ resample_linear_row_ub(GLint srcWidth, GLint dstWidth,
  * Bilinear filtered blit (color only).
  */
 static void
-blit_linear(GLcontext *ctx,
+blit_linear(struct gl_context *ctx,
             GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
             GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
 {
@@ -366,21 +366,21 @@ blit_linear(GLcontext *ctx,
    /* Allocate the src/dst row buffers.
     * Keep two adjacent src rows around for bilinear sampling.
     */
-   srcBuffer0 = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer0 = malloc(pixelSize * srcWidth);
    if (!srcBuffer0) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   srcBuffer1 = _mesa_malloc(pixelSize * srcWidth);
+   srcBuffer1 = malloc(pixelSize * srcWidth);
    if (!srcBuffer1) {
-      _mesa_free(srcBuffer0);
+      free(srcBuffer0);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
-   dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+   dstBuffer = malloc(pixelSize * dstWidth);
    if (!dstBuffer) {
-      _mesa_free(srcBuffer0);
-      _mesa_free(srcBuffer1);
+      free(srcBuffer0);
+      free(srcBuffer1);
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
    }
@@ -444,9 +444,9 @@ blit_linear(GLcontext *ctx,
       drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
    }
 
-   _mesa_free(srcBuffer0);
-   _mesa_free(srcBuffer1);
-   _mesa_free(dstBuffer);
+   free(srcBuffer0);
+   free(srcBuffer1);
+   free(dstBuffer);
 }
 
 
@@ -455,7 +455,7 @@ blit_linear(GLcontext *ctx,
  * XXX we could easily support vertical flipping here.
  */
 static void
-simple_blit(GLcontext *ctx,
+simple_blit(struct gl_context *ctx,
             GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
             GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
             GLbitfield buffer)
@@ -535,7 +535,7 @@ simple_blit(GLcontext *ctx,
    }
 
    /* allocate the row buffer */
-   rowBuffer = _mesa_malloc(bytesPerRow);
+   rowBuffer = malloc(bytesPerRow);
    if (!rowBuffer) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
       return;
@@ -548,7 +548,7 @@ simple_blit(GLcontext *ctx,
       dstY += yStep;
    }
 
-   _mesa_free(rowBuffer);
+   free(rowBuffer);
 }
 
 
@@ -556,7 +556,7 @@ simple_blit(GLcontext *ctx,
  * Software fallback for glBlitFramebufferEXT().
  */
 void
-_swrast_BlitFramebuffer(GLcontext *ctx,
+_swrast_BlitFramebuffer(struct gl_context *ctx,
                         GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
                         GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
                         GLbitfield mask, GLenum filter)
@@ -568,12 +568,6 @@ _swrast_BlitFramebuffer(GLcontext *ctx,
    };
    GLint i;
 
-   if (!_mesa_check_conditional_render(ctx))
-      return; /* don't clear */
-
-   if (!ctx->DrawBuffer->_NumColorDrawBuffers)
-      return;
-
    if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
                         &dstX0, &dstY0, &dstX1, &dstY1)) {
       return;