Module: Mesa Branch: master Commit: 80c3a5392790c2dd7b6820b58752a15e8b05e33b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80c3a5392790c2dd7b6820b58752a15e8b05e33b
Author: Erik Faye-Lund <[email protected]> Date: Tue Mar 23 17:16:48 2021 +0100 zink: factor out interpolation to helper We actually need to set all of these for fragment inputs as well, so let's make a helper for this that we can reuse. Reviewed-By: Mike Blumenkrantz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9775> --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 43 ++++++++++++++-------- 1 file changed, 27 insertions(+), 16 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 cbc39eeca20..4fa3c7709b8 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 @@ -452,6 +452,32 @@ input_var_init(struct ntv_context *ctx, struct nir_variable *var) return var_id; } +static void +emit_interpolation(struct ntv_context *ctx, SpvId var_id, + enum glsl_interp_mode mode) +{ + switch (mode) { + case INTERP_MODE_NONE: + case INTERP_MODE_SMOOTH: + /* XXX spirv doesn't seem to have anything for this */ + break; + case INTERP_MODE_FLAT: + spirv_builder_emit_decoration(&ctx->builder, var_id, + SpvDecorationFlat); + break; + case INTERP_MODE_EXPLICIT: + spirv_builder_emit_decoration(&ctx->builder, var_id, + SpvDecorationExplicitInterpAMD); + break; + case INTERP_MODE_NOPERSPECTIVE: + spirv_builder_emit_decoration(&ctx->builder, var_id, + SpvDecorationNoPerspective); + break; + default: + unreachable("unknown interpolation value"); + } +} + static void emit_input(struct ntv_context *ctx, struct nir_variable *var) { @@ -604,22 +630,7 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var) spirv_builder_emit_component(&ctx->builder, var_id, var->data.location_frac); - switch (var->data.interpolation) { - case INTERP_MODE_NONE: - case INTERP_MODE_SMOOTH: /* XXX spirv doesn't seem to have anything for this */ - break; - case INTERP_MODE_FLAT: - spirv_builder_emit_decoration(&ctx->builder, var_id, SpvDecorationFlat); - break; - case INTERP_MODE_EXPLICIT: - spirv_builder_emit_decoration(&ctx->builder, var_id, SpvDecorationExplicitInterpAMD); - break; - case INTERP_MODE_NOPERSPECTIVE: - spirv_builder_emit_decoration(&ctx->builder, var_id, SpvDecorationNoPerspective); - break; - default: - unreachable("unknown interpolation value"); - } + emit_interpolation(ctx, var_id, var->data.interpolation); if (var->data.patch) spirv_builder_emit_decoration(&ctx->builder, var_id, SpvDecorationPatch); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
