Skip to content

Commit

Permalink
spirv: Fix support for POSITION1+
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jun 24, 2020
1 parent f007f43 commit 2e9df2c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions profiles/mojoshader_profile_spirv.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2e9df2c

Please sign in to comment.