mojoshader.h
changeset 1235 8fd6c5efe453
parent 1229 3ecd29a50d9d
child 1244 311c02c8475a
--- a/mojoshader.h	Tue Mar 24 21:17:37 2020 -0400
+++ b/mojoshader.h	Wed Apr 01 12:13:39 2020 -0400
@@ -43,6 +43,15 @@
 #endif
 #endif
 
+/* -Wpedantic nameless union/struct silencing */
+#ifndef MOJOSHADERNAMELESS
+#ifdef __GNUC__
+#define MOJOSHADERNAMELESS __extension__
+#else
+#define MOJOSHADERNAMELESS
+#endif /* __GNUC__ */
+#endif /* MOJOSHADERNAMELESS */
+
 /*
  * For determining the version of MojoShader you are using:
  *    const int compiled_against = MOJOSHADER_VERSION;
@@ -87,7 +96,7 @@
     MOJOSHADER_TYPE_PIXEL    = (1 << 0),
     MOJOSHADER_TYPE_VERTEX   = (1 << 1),
     MOJOSHADER_TYPE_GEOMETRY = (1 << 2),  /* (not supported yet.) */
-    MOJOSHADER_TYPE_ANY = 0xFFFFFFFF   /* used for bitmasks */
+    MOJOSHADER_TYPE_ANY = 0x7FFFFFFF   /* used for bitmasks */
 } MOJOSHADER_shaderType;
 
 /*
@@ -104,7 +113,7 @@
     MOJOSHADER_ATTRIBUTE_UINT,
     MOJOSHADER_ATTRIBUTE_FLOAT,
     MOJOSHADER_ATTRIBUTE_DOUBLE,
-    MOJOSHADER_ATTRIBUTE_HALF_FLOAT,  /* MAYBE available in your OpenGL! */
+    MOJOSHADER_ATTRIBUTE_HALF_FLOAT  /* MAYBE available in your OpenGL! */
 } MOJOSHADER_attributeType;
 
 /*
@@ -115,7 +124,7 @@
     MOJOSHADER_UNIFORM_UNKNOWN = -1, /* housekeeping value; never returned. */
     MOJOSHADER_UNIFORM_FLOAT,
     MOJOSHADER_UNIFORM_INT,
-    MOJOSHADER_UNIFORM_BOOL,
+    MOJOSHADER_UNIFORM_BOOL
 } MOJOSHADER_uniformType;
 
 /*
@@ -180,7 +189,7 @@
     MOJOSHADER_SAMPLER_UNKNOWN = -1, /* housekeeping value; never returned. */
     MOJOSHADER_SAMPLER_2D,
     MOJOSHADER_SAMPLER_CUBE,
-    MOJOSHADER_SAMPLER_VOLUME,
+    MOJOSHADER_SAMPLER_VOLUME
 } MOJOSHADER_samplerType;
 
 /*
@@ -432,7 +441,7 @@
     MOJOSHADER_PRESHADEROP_ATAN2_SCALAR,
     MOJOSHADER_PRESHADEROP_DIV_SCALAR,
     MOJOSHADER_PRESHADEROP_DOT_SCALAR,
-    MOJOSHADER_PRESHADEROP_NOISE_SCALAR,
+    MOJOSHADER_PRESHADEROP_NOISE_SCALAR
 } MOJOSHADER_preshaderOpcode;
 
 typedef enum MOJOSHADER_preshaderOperandType
@@ -440,7 +449,7 @@
     MOJOSHADER_PRESHADEROPERAND_INPUT,
     MOJOSHADER_PRESHADEROPERAND_OUTPUT,
     MOJOSHADER_PRESHADEROPERAND_LITERAL,
-    MOJOSHADER_PRESHADEROPERAND_TEMP,
+    MOJOSHADER_PRESHADEROPERAND_TEMP
 } MOJOSHADER_preshaderOperandType;
 
 typedef struct MOJOSHADER_preshaderOperand
@@ -869,10 +878,6 @@
 DECLSPEC void MOJOSHADER_freePreshader(const MOJOSHADER_preshader *preshader);
 
 
-/* Effects interface... */
-#include "mojoshader_effects.h"
-
-
 /* Preprocessor interface... */
 
 /*
@@ -1211,13 +1216,13 @@
     MOJOSHADER_AST_DATATYPE_MATRIX,
     MOJOSHADER_AST_DATATYPE_BUFFER,
     MOJOSHADER_AST_DATATYPE_FUNCTION,
-    MOJOSHADER_AST_DATATYPE_USER,
+    MOJOSHADER_AST_DATATYPE_USER
 } MOJOSHADER_astDataTypeType;
 #define MOJOSHADER_AST_DATATYPE_CONST (1 << 31)
 
 typedef union MOJOSHADER_astDataType MOJOSHADER_astDataType;
 
-// This is just part of DataTypeStruct, never appears outside of it.
+/* This is just part of DataTypeStruct, never appears outside of it. */
 typedef struct MOJOSHADER_astDataTypeStructMember
 {
     const MOJOSHADER_astDataType *datatype;
@@ -1423,7 +1428,7 @@
     MOJOSHADER_AST_IFATTR_IFALL,
     MOJOSHADER_AST_IFATTR_IFANY,
     MOJOSHADER_AST_IFATTR_PREDICATE,
-    MOJOSHADER_AST_IFATTR_PREDICATEBLOCK,
+    MOJOSHADER_AST_IFATTR_PREDICATEBLOCK
 } MOJOSHADER_astIfAttributes;
 
 typedef enum MOJOSHADER_astSwitchAttributes
@@ -2205,7 +2210,7 @@
     MOJOSHADER_irNodeInfo ir;  /* Always MOJOSHADER_IR_MOVE */
     MOJOSHADER_irExpression *dst; /* must result in a temp or mem! */
     MOJOSHADER_irExpression *src;
-    int writemask;  // for write-masking vector channels.
+    int writemask;  /* for write-masking vector channels. */
 } MOJOSHADER_irMove;
 
 typedef struct MOJOSHADER_irExprStmt  /* evaluate expression, throw it away. */
@@ -2218,7 +2223,7 @@
 {
     MOJOSHADER_irNodeInfo ir;  /* Always MOJOSHADER_IR_JUMP */
     int label;
-    // !!! FIXME: possible label list, for further optimization passes.
+    /* !!! FIXME: possible label list, for further optimization passes. */
 } MOJOSHADER_irJump;
 
 typedef struct MOJOSHADER_irCJump  /* conditional jump */
@@ -3302,6 +3307,11 @@
  */
 DECLSPEC const char *MOJOSHADER_mtlGetError(void);
 
+
+/* Effects interface... */
+#include "mojoshader_effects.h"
+
+
 #ifdef __cplusplus
 }
 #endif