[Mesa-dev] [PATCH 1/2] radv/resolve: pass number of components to resolve builder

Dave Airlie airlied at gmail.com
Mon May 14 23:15:21 UTC 2018


From: Dave Airlie <airlied at redhat.com>

This just adds the option to use more components
---
 src/amd/vulkan/radv_meta.c            | 9 +++++----
 src/amd/vulkan/radv_meta.h            | 3 ++-
 src/amd/vulkan/radv_meta_resolve_cs.c | 2 +-
 src/amd/vulkan/radv_meta_resolve_fs.c | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index 56b72d1c99b..98dfccae9e3 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -509,7 +509,8 @@ void radv_meta_build_resolve_shader_core(nir_builder *b,
 					 int samples,
 					 nir_variable *input_img,
 					 nir_variable *color,
-					 nir_ssa_def *img_coord)
+					 nir_ssa_def *img_coord,
+					 int coord_components)
 {
 	/* do a txf_ms on each sample */
 	nir_ssa_def *tmp;
@@ -524,7 +525,7 @@ void radv_meta_build_resolve_shader_core(nir_builder *b,
 	tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, 0));
 	tex->dest_type = nir_type_float;
 	tex->is_array = false;
-	tex->coord_components = 2;
+	tex->coord_components = coord_components;
 	tex->texture = nir_deref_var_create(tex, input_img);
 	tex->sampler = NULL;
 
@@ -541,7 +542,7 @@ void radv_meta_build_resolve_shader_core(nir_builder *b,
 		tex_all_same->src[0].src = nir_src_for_ssa(img_coord);
 		tex_all_same->dest_type = nir_type_float;
 		tex_all_same->is_array = false;
-		tex_all_same->coord_components = 2;
+		tex_all_same->coord_components = coord_components;
 		tex_all_same->texture = nir_deref_var_create(tex_all_same, input_img);
 		tex_all_same->sampler = NULL;
 
@@ -564,7 +565,7 @@ void radv_meta_build_resolve_shader_core(nir_builder *b,
 			tex_add->src[1].src = nir_src_for_ssa(nir_imm_int(b, i));
 			tex_add->dest_type = nir_type_float;
 			tex_add->is_array = false;
-			tex_add->coord_components = 2;
+			tex_add->coord_components = coord_components;
 			tex_add->texture = nir_deref_var_create(tex_add, input_img);
 			tex_add->sampler = NULL;
 
diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
index 4a9abae30ac..326f2ce1438 100644
--- a/src/amd/vulkan/radv_meta.h
+++ b/src/amd/vulkan/radv_meta.h
@@ -221,7 +221,8 @@ void radv_meta_build_resolve_shader_core(nir_builder *b,
 					 int samples,
 					 nir_variable *input_img,
 					 nir_variable *color,
-					 nir_ssa_def *img_coord);
+					 nir_ssa_def *img_coord,
+					 int coord_components);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c
index 322e72e465e..3f28a766cec 100644
--- a/src/amd/vulkan/radv_meta_resolve_cs.c
+++ b/src/amd/vulkan/radv_meta_resolve_cs.c
@@ -128,7 +128,7 @@ build_resolve_compute_shader(struct radv_device *dev, bool is_integer, bool is_s
 	nir_variable *color = nir_local_variable_create(b.impl, glsl_vec4_type(), "color");
 
 	radv_meta_build_resolve_shader_core(&b, is_integer, samples, input_img,
-	                                    color, img_coord);
+	                                    color, img_coord, 2);
 
 	nir_ssa_def *outval = nir_load_var(&b, color);
 	if (is_srgb)
diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c
index ef8c1d8b1da..3c42bbdd52d 100644
--- a/src/amd/vulkan/radv_meta_resolve_fs.c
+++ b/src/amd/vulkan/radv_meta_resolve_fs.c
@@ -93,7 +93,7 @@ build_resolve_fragment_shader(struct radv_device *dev, bool is_integer, int samp
 	nir_variable *color = nir_local_variable_create(b.impl, glsl_vec4_type(), "color");
 
 	radv_meta_build_resolve_shader_core(&b, is_integer, samples, input_img,
-	                                    color, img_coord);
+	                                    color, img_coord, 2);
 
 	nir_ssa_def *outval = nir_load_var(&b, color);
 	nir_store_var(&b, color_out, outval, 0xf);
-- 
2.14.3



More information about the mesa-dev mailing list