Navigation Menu

Skip to content

Commit

Permalink
Make sure attribute registers are declared correctly in weird SM1 case.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 13, 2020
1 parent 410f63c commit 54a5dcb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mojoshader.c
Expand Up @@ -1736,6 +1736,16 @@ static void state_texops(Context *ctx, const char *opcode,
TextureType ttyp = (dims == 2) ? TEXTURE_TYPE_2D : TEXTURE_TYPE_CUBE;
add_sampler(ctx, dst->regnum, ttyp, texbem);
} // if

add_attribute_register(ctx, REG_TYPE_TEXTURE, dst->regnum,
MOJOSHADER_USAGE_TEXCOORD, dst->regnum, 0xF, 0);

// Strictly speaking, there should be a TEX opcode prior to this call that
// should fill in this metadata, but I'm not sure that's required for the
// shader to assemble in D3D, so we'll do this so we don't fail with a
// cryptic error message even if the developer didn't do the TEX.
add_attribute_register(ctx, REG_TYPE_TEXTURE, src->regnum,
MOJOSHADER_USAGE_TEXCOORD, src->regnum, 0xF, 0);
} // state_texops

static void state_texbem(Context *ctx, const char *opcode)
Expand Down

0 comments on commit 54a5dcb

Please sign in to comment.