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 <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5687>
This commit is contained in:
committed by
Marge Bot
parent
1fd3563025
commit
0ca7bd73c6
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user