diff options
author | Fredrik Höglund <[email protected]> | 2016-12-07 19:20:08 +0100 |
---|---|---|
committer | Fredrik Höglund <[email protected]> | 2016-12-22 02:07:17 +0100 |
commit | 27a8aab882980e35b66f7f318fd2fd7b500401b4 (patch) | |
tree | aed11dd391716ead3c9e1d6740455bed5cb9d9f1 | |
parent | 877202b6dc202fff3ba548aaf423bab484200b61 (diff) |
radv: fix dual source blending
Add the index to the location when assigning driver locations for
output variables.
Otherwise two fragment shader outputs declared as:
layout (location = 0, index = 0) out vec4 output1;
layout (location = 0, index = 1) out vec4 output2;
will end up aliasing one another.
Note that this patch will make the second output variable in the above
example alias a possible third output variable with location = 1 and
index = 0. But this shouldn't be a problem in practice since only one
color attachment is supported when dual-source blending is used.
Cc: "13.0" <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index d66fefbe954..90ee917d13b 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -4125,7 +4125,7 @@ static void handle_shader_output_decl(struct nir_to_llvm_context *ctx, struct nir_variable *variable) { - int idx = variable->data.location; + int idx = variable->data.location + variable->data.index; unsigned attrib_count = glsl_count_attribute_slots(variable->type, false); variable->data.driver_location = idx * 4; @@ -4155,7 +4155,7 @@ handle_shader_output_decl(struct nir_to_llvm_context *ctx, si_build_alloca_undef(ctx, ctx->f32, ""); } } - ctx->output_mask |= ((1ull << attrib_count) - 1) << variable->data.location; + ctx->output_mask |= ((1ull << attrib_count) - 1) << idx; } static void |