aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <[email protected]>2020-07-06 08:58:28 -0400
committerMarge Bot <[email protected]>2020-07-08 14:51:34 +0000
commit0ca7bd73c6f1f59dcb41ead7a3923c55040377d9 (patch)
tree086865c56dea6dbe9c6a958e6c398809252a1503
parent1fd356302590b30524fb190360247a6c45e1d96c (diff)
zink: translate gl_FragColor to gl_FragData before ntv to fix multi-rt output
according to EXT_multiview_draw_buffers, gl_FragColor outputs to all available render targets when used, so we need to translate this to gl_FragData[PIPE_MAX_COLOR_BUFS] in order to correctly handle more than one color buffer attachment this fixes the rest of spec@arb_framebuffer_object tests in piglit Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5687>
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c10
-rw-r--r--src/gallium/drivers/zink/zink_compiler.c1
2 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 76fd90ed24b..095b8e08fcf 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -394,15 +394,14 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
ctx->so_output_gl_types[var->data.location] = var->type;
ctx->so_output_types[var->data.location] = var_type;
} else if (ctx->stage == MESA_SHADER_FRAGMENT) {
- if (var->data.location >= FRAG_RESULT_DATA0)
+ if (var->data.location >= FRAG_RESULT_DATA0) {
spirv_builder_emit_location(&ctx->builder, var_id,
var->data.location - FRAG_RESULT_DATA0);
- else {
+ spirv_builder_emit_index(&ctx->builder, var_id, var->data.index);
+ } else {
switch (var->data.location) {
case FRAG_RESULT_COLOR:
- spirv_builder_emit_location(&ctx->builder, var_id, 0);
- spirv_builder_emit_index(&ctx->builder, var_id, var->data.index);
- break;
+ unreachable("gl_FragColor should be lowered by now");
case FRAG_RESULT_DEPTH:
spirv_builder_emit_builtin(&ctx->builder, var_id, SpvBuiltInFragDepth);
@@ -411,6 +410,7 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
default:
spirv_builder_emit_location(&ctx->builder, var_id,
var->data.driver_location);
+ spirv_builder_emit_index(&ctx->builder, var_id, var->data.index);
}
}
}
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 9761b8e1805..65d4a2e3390 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -191,6 +191,7 @@ zink_compile_nir(struct zink_screen *screen, struct nir_shader *nir,
optimize_nir(nir);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
NIR_PASS_V(nir, lower_discard_if);
+ NIR_PASS_V(nir, nir_lower_fragcolor);
NIR_PASS_V(nir, nir_convert_from_ssa, true);
if (zink_debug & ZINK_DEBUG_NIR) {