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 <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9775>
This commit is contained in:
committed by
Marge Bot
parent
277ea7a015
commit
80c3a53927
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user