diff --git a/mojoshader/mojoshader.c b/mojoshader/mojoshader.c index 9bfa6ca..b7e78a4 100644 --- a/mojoshader/mojoshader.c +++ b/mojoshader/mojoshader.c @@ -6626,8 +6626,9 @@ static int parse_source_token(Context *ctx, SourceArgInfo *info) case SRCMOD_NOT: // !!! FIXME: I _think_ this is right... if (shader_version_atleast(ctx, 2, 0)) { - if (info->regtype != REG_TYPE_PREDICATE) - fail(ctx, "NOT only allowed on predicate register."); + if (info->regtype != REG_TYPE_PREDICATE + && info->regtype != REG_TYPE_CONSTBOOL) + fail(ctx, "NOT only allowed on bool registers."); } // if break; @@ -7508,8 +7509,6 @@ static void state_IF(Context *ctx) const RegisterType regtype = ctx->source_args[0].regtype; if ((regtype != REG_TYPE_PREDICATE) && (regtype != REG_TYPE_CONSTBOOL)) fail(ctx, "IF src0 must be CONSTBOOL or PREDICATE"); - else if (!replicate_swizzle(ctx->source_args[0].swizzle)) - fail(ctx, "IF src0 must have replicate swizzle"); // !!! FIXME: track if nesting depth. } // state_IF @@ -8248,6 +8247,13 @@ static void parse_preshader(Context *ctx, uint32 tokcount) if ( (!is_comment_token(ctx, *tokens, &subtokcount)) || (subtokcount > tokcount) ) { + // !!! FIXME: Standalone preshaders have this EOS-looking token, + // !!! FIXME: sometimes followed by tokens that don't appear to + // !!! FIXME: have anything to do with the rest of the blob. + // !!! FIXME: So for now, treat this as a special "EOS" comment. + if (SWAP32(*tokens) == 0xFFFF) + break; + fail(ctx, "Bogus preshader data."); return; } // if