r600: add compute support to compressed resource handling.
authorDave Airlie <airlied@redhat.com>
Fri, 3 Nov 2017 01:27:23 +0000 (11:27 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 5 Dec 2017 20:31:48 +0000 (20:31 +0000)
This just adds support for decompressing compute resources.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c

index 711accc..4af87e1 100644 (file)
@@ -1032,5 +1032,6 @@ void evergreen_emit_atomic_buffer_save(struct r600_context *rctx,
                                       bool is_compute,
                                       struct r600_shader_atomic *combined_atomics,
                                       uint8_t *atomic_used_mask_p);
+void r600_update_compressed_resource_state(struct r600_context *rctx, bool compute_only);
 
 #endif
index 6b0045f..aedf210 100644 (file)
@@ -1526,7 +1526,7 @@ static void r600_generate_fixed_func_tcs(struct r600_context *rctx)
                ureg_create_shader_and_destroy(ureg, &rctx->b.b);
 }
 
-static void r600_update_compressed_resource_state(struct r600_context *rctx)
+void r600_update_compressed_resource_state(struct r600_context *rctx, bool compute_only)
 {
        unsigned i;
        unsigned counter;
@@ -1535,15 +1535,25 @@ static void r600_update_compressed_resource_state(struct r600_context *rctx)
        if (counter != rctx->b.last_compressed_colortex_counter) {
                rctx->b.last_compressed_colortex_counter = counter;
 
-               for (i = 0; i < PIPE_SHADER_TYPES; ++i) {
-                       r600_update_compressed_colortex_mask(&rctx->samplers[i].views);
+               if (compute_only) {
+                       r600_update_compressed_colortex_mask(&rctx->samplers[PIPE_SHADER_COMPUTE].views);
+               } else {
+                       for (i = 0; i < PIPE_SHADER_TYPES; ++i) {
+                               r600_update_compressed_colortex_mask(&rctx->samplers[i].views);
+                       }
                }
-               r600_update_compressed_colortex_mask_images(&rctx->fragment_images);
+               if (!compute_only)
+                       r600_update_compressed_colortex_mask_images(&rctx->fragment_images);
+               r600_update_compressed_colortex_mask_images(&rctx->compute_images);
        }
 
        /* Decompress textures if needed. */
        for (i = 0; i < PIPE_SHADER_TYPES; i++) {
                struct r600_samplerview_state *views = &rctx->samplers[i].views;
+
+               if (compute_only)
+                       if (i != PIPE_SHADER_COMPUTE)
+                               continue;
                if (views->compressed_depthtex_mask) {
                        r600_decompress_depth_textures(rctx, views);
                }
@@ -1554,7 +1564,16 @@ static void r600_update_compressed_resource_state(struct r600_context *rctx)
 
        {
                struct r600_image_state *istate;
-               istate = &rctx->fragment_images;
+
+               if (!compute_only) {
+                       istate = &rctx->fragment_images;
+                       if (istate->compressed_depthtex_mask)
+                               r600_decompress_depth_images(rctx, istate);
+                       if (istate->compressed_colortex_mask)
+                               r600_decompress_color_images(rctx, istate);
+               }
+
+               istate = &rctx->compute_images;
                if (istate->compressed_depthtex_mask)
                        r600_decompress_depth_images(rctx, istate);
                if (istate->compressed_colortex_mask)
@@ -1603,7 +1622,7 @@ static bool r600_update_derived_state(struct r600_context *rctx)
        struct r600_pipe_shader *clip_so_current = NULL;
 
        if (!rctx->blitter->running)
-               r600_update_compressed_resource_state(rctx);
+               r600_update_compressed_resource_state(rctx, false);
 
        SELECT_SHADER_OR_FAIL(ps);