From 0cfee26bee3c58f055343ed17585f44e3f2a13a2 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 15 Jun 2020 17:37:52 +0100 Subject: [PATCH] radv: fix image variable types in meta shaders MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We write to these variables using image intrinsics. Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Reviewed-by: Daniel Schürmann Part-of: --- src/amd/vulkan/radv_meta_bufimage.c | 47 ++++++++++++------------- src/amd/vulkan/radv_meta_fast_clear.c | 7 ++-- src/amd/vulkan/radv_meta_fmask_expand.c | 7 ++-- src/amd/vulkan/radv_meta_resolve_cs.c | 14 ++++---- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/amd/vulkan/radv_meta_bufimage.c b/src/amd/vulkan/radv_meta_bufimage.c index b5761b26077..2354ebd90f4 100644 --- a/src/amd/vulkan/radv_meta_bufimage.c +++ b/src/amd/vulkan/radv_meta_bufimage.c @@ -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; diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index 8507f41d838..45d15fd9e2b 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -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"); diff --git a/src/amd/vulkan/radv_meta_fmask_expand.c b/src/amd/vulkan/radv_meta_fmask_expand.c index ca0b82a3bf4..8f229a8188b 100644 --- a/src/amd/vulkan/radv_meta_fmask_expand.c +++ b/src/amd/vulkan/radv_meta_fmask_expand.c @@ -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; diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index c40c61929d2..b57bce8ef7a 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -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); -- 2.30.2