summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_blit.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-11-15 09:59:42 +1000
committerDave Airlie <[email protected]>2017-11-17 11:31:40 +1000
commita6b379284365e8adee780b691596d3a66de1ba93 (patch)
treec188e600e823ffc64a4f31006c648e50fda7505e /src/gallium/drivers/r600/r600_blit.c
parent5689bb00229a422267ada6aef770dacc81e3319e (diff)
r600: add core pieces of image support.
This adds the atoms and gallium api implementations, along with support for compress/decompress paths for shader images. Tested-By: Gert Wollny <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_blit.c')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 64f06e8bd4e..05d04f5399e 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -291,6 +291,40 @@ void r600_decompress_depth_textures(struct r600_context *rctx,
}
}
+void r600_decompress_depth_images(struct r600_context *rctx,
+ struct r600_image_state *images)
+{
+ unsigned i;
+ unsigned depth_texture_mask = images->compressed_depthtex_mask;
+
+ while (depth_texture_mask) {
+ struct r600_image_view *view;
+ struct r600_texture *tex;
+
+ i = u_bit_scan(&depth_texture_mask);
+
+ view = &images->views[i];
+ assert(view);
+
+ tex = (struct r600_texture *)view->base.resource;
+ assert(tex->db_compatible);
+
+ if (r600_can_sample_zs(tex, false)) {
+ r600_blit_decompress_depth_in_place(rctx, tex,
+ false,
+ view->base.u.tex.level,
+ view->base.u.tex.level,
+ 0, util_max_layer(&tex->resource.b.b, view->base.u.tex.level));
+ } else {
+ r600_blit_decompress_depth(&rctx->b.b, tex, NULL,
+ view->base.u.tex.level,
+ view->base.u.tex.level,
+ 0, util_max_layer(&tex->resource.b.b, view->base.u.tex.level),
+ 0, u_max_sample(&tex->resource.b.b));
+ }
+ }
+}
+
static void r600_blit_decompress_color(struct pipe_context *ctx,
struct r600_texture *rtex,
unsigned first_level, unsigned last_level,
@@ -360,6 +394,31 @@ void r600_decompress_color_textures(struct r600_context *rctx,
}
}
+void r600_decompress_color_images(struct r600_context *rctx,
+ struct r600_image_state *images)
+{
+ unsigned i;
+ unsigned mask = images->compressed_colortex_mask;
+
+ while (mask) {
+ struct r600_image_view *view;
+ struct r600_texture *tex;
+
+ i = u_bit_scan(&mask);
+
+ view = &images->views[i];
+ assert(view);
+
+ tex = (struct r600_texture *)view->base.resource;
+ assert(tex->cmask.size);
+
+ r600_blit_decompress_color(&rctx->b.b, tex,
+ view->base.u.tex.level, view->base.u.tex.level,
+ view->base.u.tex.first_layer,
+ view->base.u.tex.last_layer);
+ }
+}
+
/* Helper for decompressing a portion of a color or depth resource before
* blitting if any decompression is needed.
* The driver doesn't decompress resources automatically while u_blitter is