radv: fix image variable types in meta shaders
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 15 Jun 2020 16:37:52 +0000 (17:37 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 24 Jun 2020 10:52:27 +0000 (10:52 +0000)
We write to these variables using image intrinsics.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5207>

src/amd/vulkan/radv_meta_bufimage.c
src/amd/vulkan/radv_meta_fast_clear.c
src/amd/vulkan/radv_meta_fmask_expand.c
src/amd/vulkan/radv_meta_resolve_cs.c

index b5761b2607777bdc144292a5a3f8eb925bb02648..2354ebd90f4bf9e64dbf50b68809c8ee398d809c 100644 (file)
@@ -41,10 +41,9 @@ build_nir_itob_compute_shader(struct radv_device *dev, bool is_3d)
                                                                 false,
                                                                 false,
                                                                 GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_BUF,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_BUF,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, is_3d ? "meta_itob_cs_3d" : "meta_itob_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -271,10 +270,9 @@ build_nir_btoi_compute_shader(struct radv_device *dev, bool is_3d)
                                                             false,
                                                             false,
                                                             GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(dim,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(dim,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, is_3d ? "meta_btoi_cs_3d" : "meta_btoi_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -494,10 +492,9 @@ build_nir_btoi_r32g32b32_compute_shader(struct radv_device *dev)
                                                             false,
                                                             false,
                                                             GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_BUF,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_BUF,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, "meta_btoi_r32g32b32_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -703,10 +700,9 @@ build_nir_itoi_compute_shader(struct radv_device *dev, bool is_3d)
                                                             false,
                                                             false,
                                                             GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(dim,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(dim,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, is_3d ? "meta_itoi_cs_3d" : "meta_itoi_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -921,6 +917,9 @@ build_nir_itoi_r32g32b32_compute_shader(struct radv_device *dev)
                                                         false,
                                                         false,
                                                         GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_BUF,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, "meta_itoi_r32g32b32_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -932,7 +931,7 @@ build_nir_itoi_r32g32b32_compute_shader(struct radv_device *dev)
        input_img->data.binding = 0;
 
        nir_variable *output_img = nir_variable_create(b.shader, nir_var_uniform,
-                                                     type, "output_img");
+                                                     img_type, "output_img");
        output_img->data.descriptor_set = 0;
        output_img->data.binding = 1;
 
@@ -1129,10 +1128,9 @@ build_nir_cleari_compute_shader(struct radv_device *dev, bool is_3d)
 {
        nir_builder b;
        enum glsl_sampler_dim dim = is_3d ? GLSL_SAMPLER_DIM_3D : GLSL_SAMPLER_DIM_2D;
-       const struct glsl_type *img_type = glsl_sampler_type(dim,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(dim,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, is_3d ? "meta_cleari_cs_3d" : "meta_cleari_cs");
        b.shader->info.cs.local_size[0] = 16;
@@ -1322,10 +1320,9 @@ static nir_shader *
 build_nir_cleari_r32g32b32_compute_shader(struct radv_device *dev)
 {
        nir_builder b;
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_BUF,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_BUF,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, "meta_cleari_r32g32b32_cs");
        b.shader->info.cs.local_size[0] = 16;
index 8507f41d8383df9368b345c9ad683bd0349fc332..45d15fd9e2bf9f8ee53c8add06df69f5d8f7ab74 100644 (file)
@@ -37,10 +37,9 @@ build_dcc_decompress_compute_shader(struct radv_device *dev)
                                                             false,
                                                             false,
                                                             GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_2D,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_2D,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, "dcc_decompress_compute");
 
index ca0b82a3bf4155b3df91477675c4b9efba91ff08..8f229a8188b7054b6da6389234c65defaeaaa122 100644 (file)
@@ -31,9 +31,12 @@ build_fmask_expand_compute_shader(struct radv_device *device, int samples)
 {
        nir_builder b;
        char name[64];
-       const struct glsl_type *img_type =
+       const struct glsl_type *type =
                glsl_sampler_type(GLSL_SAMPLER_DIM_MS, false, false,
                                  GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type =
+               glsl_image_type(GLSL_SAMPLER_DIM_MS, false,
+                                 GLSL_TYPE_FLOAT);
 
        snprintf(name, 64, "meta_fmask_expand_cs-%d", samples);
 
@@ -44,7 +47,7 @@ build_fmask_expand_compute_shader(struct radv_device *device, int samples)
        b.shader->info.cs.local_size[2] = 1;
 
        nir_variable *input_img = nir_variable_create(b.shader, nir_var_uniform,
-                                                     img_type, "s_tex");
+                                                     type, "s_tex");
        input_img->data.descriptor_set = 0;
        input_img->data.binding = 0;
 
index c40c61929d2915fbc80329a7881f888130c774ee..b57bce8ef7ab08388bbb37a444fceb713f4d3f50 100644 (file)
@@ -73,10 +73,9 @@ build_resolve_compute_shader(struct radv_device *dev, bool is_integer, bool is_s
                                                                 false,
                                                                 false,
                                                                 GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_2D,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_2D,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        snprintf(name, 64, "meta_resolve_cs-%d-%s", samples, is_integer ? "int" : (is_srgb ? "srgb" : "float"));
        nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_COMPUTE, NULL);
        b.shader->info.name = ralloc_strdup(b.shader, name);
@@ -173,10 +172,9 @@ build_depth_stencil_resolve_compute_shader(struct radv_device *dev, int samples,
                                                                 false,
                                                                 false,
                                                                 GLSL_TYPE_FLOAT);
-       const struct glsl_type *img_type = glsl_sampler_type(GLSL_SAMPLER_DIM_2D,
-                                                            false,
-                                                            false,
-                                                            GLSL_TYPE_FLOAT);
+       const struct glsl_type *img_type = glsl_image_type(GLSL_SAMPLER_DIM_2D,
+                                                          false,
+                                                          GLSL_TYPE_FLOAT);
        snprintf(name, 64, "meta_resolve_cs_%s-%s-%d",
                 index == DEPTH_RESOLVE ? "depth" : "stencil",
                 get_resolve_mode_str(resolve_mode), samples);