radv/gfx10: use the component mask when storing/loading NGG stream outputs
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 17 Sep 2019 08:51:46 +0000 (10:51 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 2 Oct 2019 16:09:30 +0000 (18:09 +0200)
It's unnecessary to store/load more components that needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c

index 8339bc0..69a5e0b 100644 (file)
@@ -3205,6 +3205,9 @@ static void build_streamout_vertex(struct radv_shader_context *ctx,
                struct radv_shader_output_values out = {};
 
                for (unsigned comp = 0; comp < 4; comp++) {
+                       if (!(output->component_mask & (1 << comp)))
+                               continue;
+
                        tmp = ac_build_gep0(&ctx->ac, vertexptr,
                                            LLVMConstInt(ctx->ac.i32, 4 * i + comp, false));
                        out.values[comp] = LLVMBuildLoad(builder, tmp, "");
@@ -3595,6 +3598,9 @@ handle_ngg_outputs_post_1(struct radv_shader_context *ctx)
                unsigned loc = output->location;
 
                for (unsigned comp = 0; comp < 4; comp++) {
+                       if (!(output->component_mask & (1 << comp)))
+                               continue;
+
                        tmp = ac_build_gep0(&ctx->ac, vertex_ptr,
                                            LLVMConstInt(ctx->ac.i32, 4 * i + comp, false));
                        tmp2 = LLVMBuildLoad(builder,