Minor fixes from FNA branch
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Fri, 03 Feb 2017 12:52:10 -0500
changeset 1183 ec44ee868688
parent 1182 179ffe99c57f
child 1184 62922fc6abe9
Minor fixes from FNA branch
mojoshader.c
mojoshader_effects.c
--- a/mojoshader.c	Fri May 04 17:45:20 2018 -0400
+++ b/mojoshader.c	Fri Feb 03 12:52:10 2017 -0500
@@ -9036,8 +9036,9 @@
         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;
 
@@ -10722,6 +10723,13 @@
         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
--- a/mojoshader_effects.c	Fri May 04 17:45:20 2018 -0400
+++ b/mojoshader_effects.c	Fri Feb 03 12:52:10 2017 -0500
@@ -745,7 +745,6 @@
                  */
                 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);
@@ -753,7 +752,7 @@
                                                          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;