Simplifed public uniform information.
No sense in having a name here, since it's basically meaningless in some
profiles, like D3D. Even profiles that actually need a string name to bind
data, like GLSL, can reconstruct it easily enough, since there was never a
human-readable name to start with.
--- a/mojoshader.h Fri Apr 04 09:48:55 2008 -0400
+++ b/mojoshader.h Fri Apr 04 11:27:09 2008 -0400
@@ -46,18 +46,28 @@
MOJOSHADER_TYPE_ANY = 0xFFFFFFFF /* used for bitmasks */
} MOJOSHADER_shaderType;
+/*
+ * Data types for uniforms. See MOJOSHADER_uniform for more information.
+ */
typedef enum
{
MOJOSHADER_UNIFORM_FLOAT,
MOJOSHADER_UNIFORM_INT,
MOJOSHADER_UNIFORM_BOOL
-} MOJOSHADER_uniform_type;
+} MOJOSHADER_uniformType;
+/*
+ * These are the uniforms to be set for a shader. "Uniforms" are what Direct3D
+ * calls "Constants" ... IDirect3DDevice::SetVertexShaderConstantF() would
+ * need this data, for example. These integers are register indexes. So if
+ * index==6 and type==MOJOSHADER_UNIFORM_FLOAT, that means we'd expect a
+ * 4-float vector to be specified for what would be register "c6" in D3D
+ * assembly language, before drawing with the shader.
+ */
typedef struct
{
int index;
- const char *name;
- MOJOSHADER_uniform_type type;
+ MOJOSHADER_uniformType type;
} MOJOSHADER_uniform;
@@ -118,9 +128,8 @@
int uniform_count;
/*
- * (uniform_count) elements of data on how to access uniforms to be
- * set by this shader. "Uniforms" are what Direct3D calls "Constants" ...
- * IDirect3DDevice::SetVertexShaderConstantF() would need this data.
+ * (uniform_count) elements of data that specify Uniforms to be set for
+ * this shader. See discussion on MOJOSHADER_uniform for details.
*/
MOJOSHADER_uniform *uniforms;
--- a/testparse.c Fri Apr 04 09:48:55 2008 -0400
+++ b/testparse.c Fri Apr 04 11:27:09 2008 -0400
@@ -60,15 +60,13 @@
printf(" (none.)\n");
else
{
- static const char *typenames[] = { "float", "int", "bool" };
int i;
printf("\n");
for (i = 0; i < pd->uniform_count; i++)
{
+ static const char *typenames[] = { "float", "int", "bool" };
const MOJOSHADER_uniform *u = &pd->uniforms[i];
- const char *name = u->name ? u->name : "";
- const char *typestr = typenames[(int) u->type];
- printf(" * %d: %s %s\n", u->index, typestr, name);
+ printf(" * %d: %s\n", u->index, typenames[(int) u->type]);
} // for
} // else