mojoshader.h
branchtrunk
changeset 94 57adfb4769a0
parent 92 bc1bb138e855
child 97 4a41e3d17297
equal deleted inserted replaced
93:fb4f31787e6f 94:57adfb4769a0
    44     MOJOSHADER_TYPE_VERTEX   = (1 << 1),
    44     MOJOSHADER_TYPE_VERTEX   = (1 << 1),
    45     MOJOSHADER_TYPE_GEOMETRY = (1 << 2),  /* (not supported yet.) */
    45     MOJOSHADER_TYPE_GEOMETRY = (1 << 2),  /* (not supported yet.) */
    46     MOJOSHADER_TYPE_ANY = 0xFFFFFFFF   /* used for bitmasks */
    46     MOJOSHADER_TYPE_ANY = 0xFFFFFFFF   /* used for bitmasks */
    47 } MOJOSHADER_shaderType;
    47 } MOJOSHADER_shaderType;
    48 
    48 
       
    49 /*
       
    50  * Data types for uniforms. See MOJOSHADER_uniform for more information.
       
    51  */
    49 typedef enum
    52 typedef enum
    50 {
    53 {
    51     MOJOSHADER_UNIFORM_FLOAT,
    54     MOJOSHADER_UNIFORM_FLOAT,
    52     MOJOSHADER_UNIFORM_INT,
    55     MOJOSHADER_UNIFORM_INT,
    53     MOJOSHADER_UNIFORM_BOOL
    56     MOJOSHADER_UNIFORM_BOOL
    54 } MOJOSHADER_uniform_type;
    57 } MOJOSHADER_uniformType;
    55 
    58 
       
    59 /*
       
    60  * These are the uniforms to be set for a shader. "Uniforms" are what Direct3D
       
    61  *  calls "Constants" ... IDirect3DDevice::SetVertexShaderConstantF() would
       
    62  *  need this data, for example. These integers are register indexes. So if
       
    63  *  index==6 and type==MOJOSHADER_UNIFORM_FLOAT, that means we'd expect a
       
    64  *  4-float vector to be specified for what would be register "c6" in D3D
       
    65  *  assembly language, before drawing with the shader.
       
    66  */
    56 typedef struct
    67 typedef struct
    57 {
    68 {
    58     int index;
    69     int index;
    59     const char *name;
    70     MOJOSHADER_uniformType type;
    60     MOJOSHADER_uniform_type type;
       
    61 } MOJOSHADER_uniform;
    71 } MOJOSHADER_uniform;
    62 
    72 
    63 
    73 
    64 /*
    74 /*
    65  * Structure used to return data from parsing of a shader...
    75  * Structure used to return data from parsing of a shader...
   116      * The number of elements pointed to by (uniforms).
   126      * The number of elements pointed to by (uniforms).
   117      */
   127      */
   118     int uniform_count;
   128     int uniform_count;
   119 
   129 
   120     /*
   130     /*
   121      * (uniform_count) elements of data on how to access uniforms to be
   131      * (uniform_count) elements of data that specify Uniforms to be set for
   122      *  set by this shader. "Uniforms" are what Direct3D calls "Constants" ...
   132      *  this shader. See discussion on MOJOSHADER_uniform for details.
   123      *  IDirect3DDevice::SetVertexShaderConstantF() would need this data.
       
   124      */
   133      */
   125     MOJOSHADER_uniform *uniforms;
   134     MOJOSHADER_uniform *uniforms;
   126 
   135 
   127     /*
   136     /*
   128      * This is the malloc implementation you passed to MOJOSHADER_parse().
   137      * This is the malloc implementation you passed to MOJOSHADER_parse().