Merge branch '7.8'
[mesa.git] / src / mesa / state_tracker / st_cb_accum.c
index da7b97d3253c78b702a7ff664e0c3ea6b30c1955..01aba3e3dd43863cd342170c809c417e3d8048b7 100644 (file)
 #include "st_context.h"
 #include "st_cb_accum.h"
 #include "st_cb_fbo.h"
-#include "st_draw.h"
 #include "st_public.h"
-#include "st_format.h"
 #include "st_texture.h"
 #include "st_inlines.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 #include "util/u_tile.h"
 
 
@@ -131,7 +129,6 @@ accum_accum(struct st_context *st, GLfloat value,
             struct st_renderbuffer *color_strb)
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct pipe_transfer *color_trans;
    size_t stride = acc_strb->stride;
    GLubyte *data = acc_strb->data;
@@ -145,9 +142,9 @@ accum_accum(struct st_context *st, GLfloat value,
                                                PIPE_TRANSFER_READ, xpos, ypos,
                                                width, height);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
-   pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+   pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
 
    switch (acc_strb->format) {
    case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -167,8 +164,8 @@ accum_accum(struct st_context *st, GLfloat value,
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   _mesa_free(buf);
-   screen->tex_transfer_destroy(color_trans);
+   free(buf);
+   pipe->tex_transfer_destroy(pipe, color_trans);
 }
 
 
@@ -179,7 +176,6 @@ accum_load(struct st_context *st, GLfloat value,
            struct st_renderbuffer *color_strb)
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct pipe_transfer *color_trans;
    size_t stride = acc_strb->stride;
    GLubyte *data = acc_strb->data;
@@ -194,9 +190,9 @@ accum_load(struct st_context *st, GLfloat value,
                                                PIPE_TRANSFER_READ, xpos, ypos,
                                                width, height);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
-   pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+   pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
 
    switch (acc_strb->format) {
    case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -216,8 +212,8 @@ accum_load(struct st_context *st, GLfloat value,
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   _mesa_free(buf);
-   screen->tex_transfer_destroy(color_trans);
+   free(buf);
+   pipe->tex_transfer_destroy(pipe, color_trans);
 }
 
 
@@ -228,7 +224,6 @@ accum_return(GLcontext *ctx, GLfloat value,
              struct st_renderbuffer *color_strb)
 {
    struct pipe_context *pipe = ctx->st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    const GLubyte *colormask = ctx->Color.ColorMask[0];
    enum pipe_transfer_usage usage;
    struct pipe_transfer *color_trans;
@@ -239,7 +234,7 @@ accum_return(GLcontext *ctx, GLfloat value,
    if (ST_DEBUG & DEBUG_FALLBACK)
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
-   buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+   buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
    if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
       usage = PIPE_TRANSFER_READ_WRITE;
@@ -253,7 +248,7 @@ accum_return(GLcontext *ctx, GLfloat value,
                                                width, height);
 
    if (usage & PIPE_TRANSFER_READ)
-      pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+      pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
 
    switch (acc_strb->format) {
    case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -282,10 +277,10 @@ accum_return(GLcontext *ctx, GLfloat value,
       _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
    }
 
-   pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf);
+   pipe_put_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
 
-   _mesa_free(buf);
-   screen->tex_transfer_destroy(color_trans);
+   free(buf);
+   pipe->tex_transfer_destroy(pipe, color_trans);
 }