OSDN Git Service

radeonsi: do not write non-existent components through the GSVS ring
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 2 Dec 2016 20:20:49 +0000 (21:20 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 12 Dec 2016 08:04:58 +0000 (09:04 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c

index 441718b..7324eb3 100644 (file)
@@ -5317,7 +5317,8 @@ static void si_llvm_emit_vertex(
                        ctx->soa.outputs[i];
 
                for (chan = 0; chan < 4; chan++) {
-                       if (((info->output_streams[i] >> (2 * chan)) & 3) != stream)
+                       if (!(info->output_usagemask[i] & (1 << chan)) ||
+                           ((info->output_streams[i] >> (2 * chan)) & 3) != stream)
                                continue;
 
                        LLVMValueRef out_val = LLVMBuildLoad(gallivm->builder, out_ptr[chan], "");
@@ -6432,7 +6433,8 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
                /* Fetch vertex data from GSVS ring */
                for (i = 0; i < gsinfo->num_outputs; ++i) {
                        for (unsigned chan = 0; chan < 4; chan++) {
-                               if (outputs[i].vertex_stream[chan] != stream) {
+                               if (!(gsinfo->output_usagemask[i] & (1 << chan)) ||
+                                   outputs[i].vertex_stream[chan] != stream) {
                                        outputs[i].values[chan] = ctx.soa.bld_base.base.undef;
                                        continue;
                                }