summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
authorItalo Nicola <italonicola@collabora.com>2023-06-22 18:35:06 +0000
committerMarge Bot <emma+marge@anholt.net>2023-07-10 15:23:06 +0000
commit3a044b16812f9d992036b3f571f24ff250fbfecb (patch)
tree2793781bdb7117017f3f8d2bc137bda7f681fd25 /src/gallium/drivers/r600/r600_texture.c
parent28837ac970f103a54b877340030d8f080d63337b (diff)
gallium: use u_default_clear_texture where applicable
This removes some shared code between backends that implemented their version of pipe->clear_texture without anything driver-specific code. Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>
Diffstat (limited to 'src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c59
1 files changed, 1 insertions, 58 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 2e82a68ac72..88666c00bdb 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -1587,63 +1587,6 @@ static void r600_surface_destroy(struct pipe_context *pipe,
FREE(surface);
}
-static void r600_clear_texture(struct pipe_context *pipe,
- struct pipe_resource *tex,
- unsigned level,
- const struct pipe_box *box,
- const void *data)
-{
- struct pipe_screen *screen = pipe->screen;
- struct r600_texture *rtex = (struct r600_texture*)tex;
- struct pipe_surface tmpl = {{0}};
- struct pipe_surface *sf;
-
- tmpl.format = tex->format;
- tmpl.u.tex.first_layer = box->z;
- tmpl.u.tex.last_layer = box->z + box->depth - 1;
- tmpl.u.tex.level = level;
- sf = pipe->create_surface(pipe, tex, &tmpl);
- if (!sf)
- return;
-
- if (rtex->is_depth) {
- unsigned clear;
- float depth;
- uint8_t stencil = 0;
-
- /* Depth is always present. */
- clear = PIPE_CLEAR_DEPTH;
- util_format_unpack_z_float(tex->format, &depth, data, 1);
-
- if (rtex->surface.has_stencil) {
- clear |= PIPE_CLEAR_STENCIL;
- util_format_unpack_s_8uint(tex->format, &stencil, data, 1);
- }
-
- pipe->clear_depth_stencil(pipe, sf, clear, depth, stencil,
- box->x, box->y,
- box->width, box->height, false);
- } else {
- union pipe_color_union color;
-
- util_format_unpack_rgba(tex->format, color.ui, data, 1);
-
- if (screen->is_format_supported(screen, tex->format,
- tex->target, 0, 0,
- PIPE_BIND_RENDER_TARGET)) {
- pipe->clear_render_target(pipe, sf, &color,
- box->x, box->y,
- box->width, box->height, false);
- } else {
- /* Software fallback - just for R9G9B9E5_FLOAT */
- util_clear_render_target(pipe, sf, &color,
- box->x, box->y,
- box->width, box->height);
- }
- }
- pipe_surface_reference(&sf, NULL);
-}
-
unsigned r600_translate_colorswap(enum pipe_format format, bool do_endian_swap)
{
const struct util_format_description *desc = util_format_description(format);
@@ -1949,5 +1892,5 @@ void r600_init_context_texture_functions(struct r600_common_context *rctx)
{
rctx->b.create_surface = r600_create_surface;
rctx->b.surface_destroy = r600_surface_destroy;
- rctx->b.clear_texture = r600_clear_texture;
+ rctx->b.clear_texture = u_default_clear_texture;
}