Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor fixes from FNA branch
  • Loading branch information
flibitijibibo committed Feb 3, 2017
1 parent dfa17bf commit fa633ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions mojoshader.c
Expand Up @@ -9036,8 +9036,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;

Expand Down Expand Up @@ -10722,6 +10723,13 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, 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
Expand Down
3 changes: 1 addition & 2 deletions mojoshader_effects.c
Expand Up @@ -745,15 +745,14 @@ static void readlargeobjects(const uint32 numlargeobjects,
*/
object->shader.is_preshader = 1;
const uint32 start = *((uint32 *) *ptr) + 4;
const uint32 end = 16; // FIXME: Why? -flibit
const char *array = readstring(*ptr, 0, m, d);
object->shader.param_count = 1;
object->shader.params = (uint32 *) m(sizeof (uint32), d);
object->shader.params[0] = findparameter(effect->params,
effect->param_count,
array);
f((void *) array, d);
object->shader.preshader = MOJOSHADER_parsePreshader(*ptr + start, length - end,
object->shader.preshader = MOJOSHADER_parsePreshader(*ptr + start, length,
m, f, d);
// !!! FIXME: check for errors.
object->shader.preshader_param_count = object->shader.preshader->symbol_count;
Expand Down

0 comments on commit fa633ad

Please sign in to comment.