From c2f52cf94f68a918ecb5227074c6da03da34c4b0 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 15 Jul 2019 12:02:31 +0200 Subject: [PATCH] zink/spirv: be a bit more strict with fragment-results Acked-by: Jordan Justen --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 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 ca29e7e8398..3792729ccb3 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 @@ -280,14 +280,23 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var) } } } else if (ctx->stage == MESA_SHADER_FRAGMENT) { - switch (var->data.location) { - case FRAG_RESULT_DEPTH: - spirv_builder_emit_builtin(&ctx->builder, var_id, SpvBuiltInFragDepth); - break; - - default: + if (var->data.location >= FRAG_RESULT_DATA0) spirv_builder_emit_location(&ctx->builder, var_id, - var->data.driver_location); + var->data.location - FRAG_RESULT_DATA0); + else { + switch (var->data.location) { + case FRAG_RESULT_COLOR: + spirv_builder_emit_location(&ctx->builder, var_id, 0); + break; + + case FRAG_RESULT_DEPTH: + spirv_builder_emit_builtin(&ctx->builder, var_id, SpvBuiltInFragDepth); + break; + + default: + spirv_builder_emit_location(&ctx->builder, var_id, + var->data.driver_location); + } } } -- 2.30.2