Skip to content

Commit

Permalink
spirv: Fix bogus detection of PSIZE0
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jul 7, 2020
1 parent 7a9966b commit 475e163
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions mojoshader_common.c
Expand Up @@ -1091,6 +1091,8 @@ void MOJOSHADER_spirv_link_attributes(const MOJOSHADER_parseData *vertex,
const MOJOSHADER_attribute *vAttr = &vertex->outputs[i];
if (vAttr->usage == MOJOSHADER_USAGE_POSITION && vAttr->index == 0)
continue;
if (vAttr->usage == MOJOSHADER_USAGE_POINTSIZE && vAttr->index == 0)
continue;
if (vAttr->usage == MOJOSHADER_USAGE_COLOR && vAttr->index == 0)
continue;

Expand Down
12 changes: 6 additions & 6 deletions profiles/mojoshader_profile_spirv.c
Expand Up @@ -271,17 +271,14 @@ static uint32 spv_output_location(Context *ctx, uint32 id, uint32 loc)
return (buffer_size(ctx->helpers) >> 2) - 1;
} // spv_output_location

static uint32 spv_output_attrib_location(Context *ctx, uint32 id,
MOJOSHADER_usage usage, uint32 index)
static void spv_output_attrib_location(Context *ctx, uint32 id,
MOJOSHADER_usage usage, uint32 index)
{
uint32 result;
SpirvPatchTable* table = &ctx->spirv.patch_table;
push_output(ctx, &ctx->helpers);
spv_emit(ctx, 4, SpvOpDecorate, id, SpvDecorationLocation, 0xDEADBEEF);
pop_output(ctx);
result = (buffer_size(ctx->helpers) >> 2) - 1;
table->attrib_offsets[usage][index] = result;
return result;
table->attrib_offsets[usage][index] = (buffer_size(ctx->helpers) >> 2) - 1;
} // spv_output_attrib_location

static void spv_output_sampler_binding(Context *ctx, uint32 id, uint32 binding)
Expand Down Expand Up @@ -1631,7 +1628,10 @@ static void spv_link_vs_attributes(Context *ctx, uint32 id,
if (usage == MOJOSHADER_USAGE_POSITION && index == 0)
spv_output_builtin(ctx, id, SpvBuiltInPosition);
else if (usage == MOJOSHADER_USAGE_POINTSIZE && index == 0)
{
spv_output_builtin(ctx, id, SpvBuiltInPointSize);
ctx->spirv.patch_table.attrib_offsets[usage][index] = 1;
} // else if
else if (usage == MOJOSHADER_USAGE_COLOR && index == 0)
spv_output_location(ctx, id, 0);
else
Expand Down

0 comments on commit 475e163

Please sign in to comment.