diff options
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_blit.c | 17 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_draw_quad.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_gen_mipmap.c | 17 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_rect.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_screen.c | 28 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_timed_winsys.c | 7 |
7 files changed, 49 insertions, 32 deletions
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 4cc720269dd..813e41f1b11 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -38,6 +38,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_state.h" #include "util/u_blit.h" #include "util/u_draw_quad.h" @@ -166,7 +167,7 @@ util_destroy_blit(struct blit_state *ctx) FREE((void*) ctx->vert_shader.tokens); FREE((void*) ctx->frag_shader.tokens); - pipe_buffer_reference(pipe->screen, &ctx->vbuf, NULL); + pipe_buffer_reference(&ctx->vbuf, NULL); FREE(ctx); } @@ -368,7 +369,7 @@ util_blit_pixels(struct blit_state *ctx, /* free the surface, update the texture if necessary. */ - screen->tex_surface_release(screen, &texSurf); + pipe_surface_reference(&texSurf, NULL); /* save state (restored below) */ cso_save_blend(ctx->cso); @@ -429,7 +430,7 @@ util_blit_pixels(struct blit_state *ctx, cso_restore_vertex_shader(ctx->cso); cso_restore_viewport(ctx->cso); - screen->texture_release(screen, &tex); + pipe_texture_reference(&tex, NULL); } @@ -438,7 +439,7 @@ util_blit_pixels(struct blit_state *ctx, */ void util_blit_flush( struct blit_state *ctx ) { - pipe_buffer_reference(ctx->pipe->screen, &ctx->vbuf, NULL); + pipe_buffer_reference(&ctx->vbuf, NULL); ctx->vbuf_slot = 0; } @@ -461,8 +462,6 @@ util_blit_pixels_tex(struct blit_state *ctx, int dstX1, int dstY1, float z, uint filter) { - struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_framebuffer_state fb; float s0, t0, s1, t1; unsigned offset; @@ -478,8 +477,10 @@ util_blit_pixels_tex(struct blit_state *ctx, t0 = srcY0 / (float)tex->height[0]; t1 = srcY1 / (float)tex->height[0]; - assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); + assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, + 0)); /* save state (restored below) */ cso_save_blend(ctx->cso); diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index e05c419b2f3..f96e27e09fd 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -680,7 +680,7 @@ void debug_dump_surface(const char *prefix, screen->transfer_unmap(screen, transfer); error: - screen->tex_transfer_release(screen, &transfer); + screen->tex_transfer_destroy(transfer); } @@ -785,7 +785,7 @@ debug_dump_surface_bmp(const char *filename, } } - screen->tex_transfer_release(screen, &transfer); + screen->tex_transfer_destroy(transfer); util_stream_close(stream); error2: diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index f0bcd758999..4110485fb19 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -129,6 +129,6 @@ util_draw_texquad(struct pipe_context *pipe, util_draw_vertex_buffer(pipe, vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2); } - pipe_buffer_reference(pipe->screen, &vbuf, NULL); + pipe_buffer_reference(&vbuf, NULL); } } diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 1857a71dd82..2b675e71b23 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -39,6 +39,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_state.h" #include "util/u_memory.h" #include "util/u_draw_quad.h" @@ -1138,8 +1139,8 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); - screen->tex_transfer_release(screen, &srcTrans); - screen->tex_transfer_release(screen, &dstTrans); + screen->tex_transfer_destroy(srcTrans); + screen->tex_transfer_destroy(dstTrans); } } @@ -1183,8 +1184,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); - screen->tex_transfer_release(screen, &srcTrans); - screen->tex_transfer_release(screen, &dstTrans); + screen->tex_transfer_destroy(srcTrans); + screen->tex_transfer_destroy(dstTrans); } } @@ -1228,8 +1229,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); - screen->tex_transfer_release(screen, &srcTrans); - screen->tex_transfer_release(screen, &dstTrans); + screen->tex_transfer_destroy(srcTrans); + screen->tex_transfer_destroy(dstTrans); } #else (void) reduce_3d; @@ -1414,7 +1415,7 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx) FREE((void*) ctx->vert_shader.tokens); FREE((void*) ctx->frag_shader.tokens); - pipe_buffer_reference(pipe->screen, &ctx->vbuf, NULL); + pipe_buffer_reference(&ctx->vbuf, NULL); FREE(ctx); } @@ -1426,7 +1427,7 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx) */ void util_gen_mipmap_flush( struct gen_mipmap_state *ctx ) { - pipe_buffer_reference(ctx->pipe->screen, &ctx->vbuf, NULL); + pipe_buffer_reference(&ctx->vbuf, NULL); ctx->vbuf_slot = 0; } diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 6e24e594e46..74259d453b1 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -218,8 +218,8 @@ util_surface_copy(struct pipe_context *pipe, pipe->screen->transfer_unmap(pipe->screen, src_trans); pipe->screen->transfer_unmap(pipe->screen, dst_trans); - screen->tex_transfer_release(screen, &src_trans); - screen->tex_transfer_release(screen, &dst_trans); + screen->tex_transfer_destroy(src_trans); + screen->tex_transfer_destroy(dst_trans); } @@ -297,5 +297,5 @@ util_surface_fill(struct pipe_context *pipe, } pipe->screen->transfer_unmap(pipe->screen, dst_trans); - screen->tex_transfer_release(screen, &dst_trans); + screen->tex_transfer_destroy(dst_trans); } diff --git a/src/gallium/auxiliary/util/u_simple_screen.c b/src/gallium/auxiliary/util/u_simple_screen.c index 089bbbc48a8..8114b53cd0d 100644 --- a/src/gallium/auxiliary/util/u_simple_screen.c +++ b/src/gallium/auxiliary/util/u_simple_screen.c @@ -28,6 +28,7 @@ #include "u_simple_screen.h" #include "pipe/p_screen.h" +#include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" @@ -37,8 +38,12 @@ pass_buffer_create(struct pipe_screen *screen, unsigned usage, unsigned size) { - return screen->winsys->buffer_create(screen->winsys, - alignment, usage, size); + struct pipe_buffer *buffer = + screen->winsys->buffer_create(screen->winsys, alignment, usage, size); + + buffer->screen = screen; + + return buffer; } static struct pipe_buffer * @@ -46,8 +51,13 @@ pass_user_buffer_create(struct pipe_screen *screen, void *ptr, unsigned bytes) { - return screen->winsys->user_buffer_create(screen->winsys, + struct pipe_buffer *buffer = + screen->winsys->user_buffer_create(screen->winsys, ptr, bytes); + + buffer->screen = screen; + + return buffer; } static struct pipe_buffer * @@ -57,9 +67,14 @@ pass_surface_buffer_create(struct pipe_screen *screen, unsigned usage, unsigned *stride) { - return screen->winsys->surface_buffer_create(screen->winsys, + struct pipe_buffer *buffer = + screen->winsys->surface_buffer_create(screen->winsys, width, height, format, usage, stride); + + buffer->screen = screen; + + return buffer; } static void * @@ -79,10 +94,9 @@ pass_buffer_unmap(struct pipe_screen *screen, } static void -pass_buffer_destroy(struct pipe_screen *screen, - struct pipe_buffer *buf) +pass_buffer_destroy(struct pipe_buffer *buf) { - screen->winsys->buffer_destroy(screen->winsys, buf); + buf->screen->winsys->buffer_destroy(buf); } diff --git a/src/gallium/auxiliary/util/u_timed_winsys.c b/src/gallium/auxiliary/util/u_timed_winsys.c index f237e12d735..77b2a3a1c87 100644 --- a/src/gallium/auxiliary/util/u_timed_winsys.c +++ b/src/gallium/auxiliary/util/u_timed_winsys.c @@ -29,6 +29,7 @@ * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com> */ +#include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" #include "u_timed_winsys.h" #include "util/u_memory.h" @@ -178,13 +179,13 @@ timed_buffer_unmap(struct pipe_winsys *winsys, static void -timed_buffer_destroy(struct pipe_winsys *winsys, - struct pipe_buffer *buf) +timed_buffer_destroy(struct pipe_buffer *buf) { + struct pipe_winsys *winsys = buf->screen->winsys; struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); - backend->buffer_destroy( backend, buf ); + backend->buffer_destroy( buf ); time_finish(winsys, start, 4, __FUNCTION__); } |