From 54a5dcb5d11e58c9ba131c019f44f3850faf919c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 13 Oct 2020 01:23:19 -0400 Subject: [PATCH] Make sure attribute registers are declared correctly in weird SM1 case. --- mojoshader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mojoshader.c b/mojoshader.c index ffd842b..a5c4f96 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -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)