From 2e9df2c0991220bcd88eed8906536eb93b2138fa Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 24 Jun 2020 14:19:28 -0400 Subject: [PATCH] spirv: Fix support for POSITION1+ --- profiles/mojoshader_profile_spirv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/profiles/mojoshader_profile_spirv.c b/profiles/mojoshader_profile_spirv.c index 11e04ba5..cd6489f5 100644 --- a/profiles/mojoshader_profile_spirv.c +++ b/profiles/mojoshader_profile_spirv.c @@ -1516,8 +1516,13 @@ static void spv_link_vs_attributes(Context *ctx, uint32 id, MOJOSHADER_usage usa switch (usage) { case MOJOSHADER_USAGE_POSITION: - assert(index == 0); - spv_output_builtin(ctx, id, SpvBuiltInPosition); + if (index == 0) + spv_output_builtin(ctx, id, SpvBuiltInPosition); + else // locations [24,32] + { + assert(index < 10); + spv_output_location(ctx, id, 24 + (index - 1)); + } // else break; case MOJOSHADER_USAGE_POINTSIZE: spv_output_builtin(ctx, id, SpvBuiltInPointSize); @@ -1688,6 +1693,10 @@ static void spv_link_ps_attributes(Context *ctx, uint32 id, RegisterType regtype case MOJOSHADER_USAGE_NORMAL: spv_output_location(ctx, id, 14 + index); break; + case MOJOSHADER_USAGE_POSITION: + assert(index > 0 && index < 10); + spv_output_location(ctx, id, 24 + (index - 1)); + break; default: failf(ctx, "unexpected attribute usage %d in pixel shader", usage); break;