diff options
author | Roland Scheidegger <[email protected]> | 2010-05-21 20:02:22 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2010-05-21 20:02:22 +0200 |
commit | 3293bcdc80cdfa20a2381aae2b94505bdf95d857 (patch) | |
tree | 16ab1ae66010f6d8b1325dbfa9006126a8e95771 /src/gallium/drivers/r300 | |
parent | 8504c5d931e47765a15fdaec2df2cb6502a1bd5c (diff) | |
parent | ce65caba846b03b5ef4144e311b85cfd48ab9bbb (diff) |
Merge branch 'gallium-msaa'
Conflicts:
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_texture.c
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.c | 73 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.h | 18 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_transfer.c | 51 |
6 files changed, 97 insertions, 61 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 85c2c149016..2bf9317803e 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -117,25 +117,36 @@ static void r300_hw_copy(struct pipe_context* pipe, /* Copy a block of pixels from one surface to another. */ void r300_surface_copy(struct pipe_context* pipe, - struct pipe_surface* dst, - unsigned dstx, unsigned dsty, - struct pipe_surface* src, - unsigned srcx, unsigned srcy, + struct pipe_resource* dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource* src, + struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height) { - enum pipe_format old_format = dst->texture->format; + struct pipe_screen *screen = pipe->screen; + enum pipe_format old_format = dst->format; enum pipe_format new_format = old_format; + struct pipe_surface *srcsurf, *dstsurf; + unsigned bind; - if (dst->texture->format != src->texture->format) { + if (util_format_is_depth_or_stencil(dst->format)) + bind = PIPE_BIND_DEPTH_STENCIL; + else + bind = PIPE_BIND_RENDER_TARGET; + + if (dst->format != src->format) { debug_printf("r300: Implementation error: Format mismatch in %s\n" " : src: %s dst: %s\n", __FUNCTION__, - util_format_short_name(src->texture->format), - util_format_short_name(dst->texture->format)); + util_format_short_name(src->format), + util_format_short_name(dst->format)); debug_assert(0); } if (!pipe->screen->is_format_supported(pipe->screen, - old_format, src->texture->target, + old_format, src->target, + src->nr_samples, PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW, 0) && util_format_is_plain(old_format)) { @@ -164,36 +175,64 @@ void r300_surface_copy(struct pipe_context* pipe, src->format = new_format; r300_texture_reinterpret_format(pipe->screen, - dst->texture, new_format); + dst, new_format); r300_texture_reinterpret_format(pipe->screen, - src->texture, new_format); + src, new_format); } - r300_hw_copy(pipe, dst, dstx, dsty, src, srcx, srcy, width, height); + srcsurf = screen->get_tex_surface(screen, src, + subsrc.face, subsrc.level, srcz, + PIPE_BIND_SAMPLER_VIEW); + + dstsurf = screen->get_tex_surface(screen, dst, + subdst.face, subdst.level, dstz, + bind); + + r300_hw_copy(pipe, dstsurf, dstx, dsty, srcsurf, srcx, srcy, width, height); + + pipe_surface_reference(&srcsurf, NULL); + pipe_surface_reference(&dstsurf, NULL); if (old_format != new_format) { dst->format = old_format; src->format = old_format; r300_texture_reinterpret_format(pipe->screen, - dst->texture, old_format); + dst, old_format); r300_texture_reinterpret_format(pipe->screen, - src->texture, old_format); + src, old_format); } } /* Fill a region of a surface with a constant value. */ void r300_surface_fill(struct pipe_context* pipe, - struct pipe_surface* dst, - unsigned dstx, unsigned dsty, + struct pipe_resource* dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, unsigned width, unsigned height, unsigned value) { + struct pipe_screen *screen = pipe->screen; struct r300_context* r300 = r300_context(pipe); + struct pipe_surface *dstsurf; + unsigned bind; + + if (util_format_is_depth_or_stencil(dst->format)) + bind = PIPE_BIND_DEPTH_STENCIL; + else + bind = PIPE_BIND_RENDER_TARGET; + + dstsurf = screen->get_tex_surface(screen, dst, + subdst.face, + subdst.level, + dstz, + bind); r300_blitter_save_states(r300); util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state); util_blitter_fill(r300->blitter, - dst, dstx, dsty, width, height, value); + dstsurf, dstx, dsty, width, height, value); + + pipe_surface_reference(&dstsurf, NULL); } diff --git a/src/gallium/drivers/r300/r300_blit.h b/src/gallium/drivers/r300/r300_blit.h index 029e4f98e7d..c97872662aa 100644 --- a/src/gallium/drivers/r300/r300_blit.h +++ b/src/gallium/drivers/r300/r300_blit.h @@ -24,7 +24,8 @@ #define R300_BLIT_H struct pipe_context; -struct pipe_surface; +struct pipe_resource; +struct pipe_subresource; void r300_clear(struct pipe_context* pipe, unsigned buffers, @@ -33,15 +34,18 @@ void r300_clear(struct pipe_context* pipe, unsigned stencil); void r300_surface_copy(struct pipe_context* pipe, - struct pipe_surface* dst, - unsigned dstx, unsigned dsty, - struct pipe_surface* src, - unsigned srcx, unsigned srcy, + struct pipe_resource* dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource* src, + struct pipe_subresource subsrc, + unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height); void r300_surface_fill(struct pipe_context* pipe, - struct pipe_surface* dst, - unsigned dstx, unsigned dsty, + struct pipe_resource* dst, + struct pipe_subresource subdst, + unsigned dstx, unsigned dsty, unsigned dstz, unsigned width, unsigned height, unsigned value); diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 9837deaa5e3..f771e10c64e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -186,8 +186,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.destroy = r300_destroy_context; r300->context.clear = r300_clear; - r300->context.surface_copy = r300_surface_copy; - r300->context.surface_fill = r300_surface_fill; + r300->context.resource_copy_region = r300_surface_copy; + r300->context.resource_fill_region = r300_surface_fill; if (r300screen->caps.has_tcl) { r300->context.draw_arrays = r300_draw_arrays; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 640b3d34688..ef0255066b7 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -241,6 +241,7 @@ static float r300_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) static boolean r300_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, + unsigned sample_count, unsigned usage, unsigned geom_flags) { @@ -264,6 +265,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, return FALSE; } + if (sample_count > 1) + return FALSE; + /* Check sampler format support. */ if ((usage & PIPE_BIND_SAMPLER_VIEW) && /* Z24 cannot be sampled from on non-r5xx. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 11c10e2f2a8..67e09362d8e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -404,6 +404,13 @@ static void r300_set_clip_state(struct pipe_context* pipe, } } +static void +r300_set_sample_mask(struct pipe_context *pipe, + unsigned sample_mask) +{ +} + + /* Create a new depth, stencil, and alpha state based on the CSO dsa state. * * This contains the depth buffer, stencil buffer, alpha test, and such. @@ -1561,6 +1568,7 @@ void r300_init_state_functions(struct r300_context* r300) r300->context.set_blend_color = r300_set_blend_color; r300->context.set_clip_state = r300_set_clip_state; + r300->context.set_sample_mask = r300_set_sample_mask; r300->context.set_constant_buffer = r300_set_constant_buffer; diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 14a9bfd8650..beb321cb238 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -56,63 +56,44 @@ r300_transfer(struct pipe_transfer* transfer) static void r300_copy_from_tiled_texture(struct pipe_context *ctx, struct r300_transfer *r300transfer) { - struct pipe_screen *screen = ctx->screen; struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer; struct pipe_resource *tex = transfer->resource; - struct pipe_surface *src, *dst; + struct pipe_subresource subdst; - src = screen->get_tex_surface(screen, tex, - transfer->sr.face, - transfer->sr.level, - transfer->box.z, - PIPE_BIND_BLIT_SOURCE); + subdst.face = 0; + subdst.level = 0; - dst = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b, - 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION); - - ctx->surface_copy(ctx, dst, 0, 0, src, - transfer->box.x, transfer->box.y, - transfer->box.width, transfer->box.height); - - pipe_surface_reference(&src, NULL); - pipe_surface_reference(&dst, NULL); + ctx->resource_copy_region(ctx, &r300transfer->detiled_texture->b.b, subdst, + 0, 0, 0, + tex, transfer->sr, + transfer->box.x, transfer->box.y, transfer->box.z, + transfer->box.width, transfer->box.height); } /* Copy a detiled texture to a tiled one. */ static void r300_copy_into_tiled_texture(struct pipe_context *ctx, struct r300_transfer *r300transfer) { - struct pipe_screen *screen = ctx->screen; struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer; struct pipe_resource *tex = transfer->resource; - struct pipe_surface *src, *dst; + struct pipe_subresource subsrc; - src = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b, - 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); - - dst = screen->get_tex_surface(screen, tex, - transfer->sr.face, - transfer->sr.level, - transfer->box.z, - PIPE_BIND_BLIT_DESTINATION); + subsrc.face = 0; + subsrc.level = 0; /* XXX this flush prevents the following DRM error from occuring: * [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation ! * Reproducible with perf/copytex. */ ctx->flush(ctx, 0, NULL); - ctx->surface_copy(ctx, dst, - transfer->box.x, transfer->box.y, - src, 0, 0, - transfer->box.width, transfer->box.height); + ctx->resource_copy_region(ctx, tex, transfer->sr, + transfer->box.x, transfer->box.y, transfer->box.z, + &r300transfer->detiled_texture->b.b, subsrc, + 0, 0, 0, + transfer->box.width, transfer->box.height); /* XXX this flush fixes a few piglit tests (e.g. glean/pixelFormats). */ ctx->flush(ctx, 0, NULL); - - pipe_surface_reference(&src, NULL); - pipe_surface_reference(&dst, NULL); } struct pipe_transfer* |