mojoshader.h
changeset 1030 a407c516e325
parent 1028 74e7ee46ac93
child 1032 464f38a2fb70
equal deleted inserted replaced
1029:5af5af0210df 1030:a407c516e325
   351      *  you supplied (starting at one).
   351      *  you supplied (starting at one).
   352      */
   352      */
   353     int error_position;
   353     int error_position;
   354 } MOJOSHADER_error;
   354 } MOJOSHADER_error;
   355 
   355 
       
   356 
       
   357 /* !!! FIXME: document me. */
       
   358 typedef enum MOJOSHADER_preshaderOpcode
       
   359 {
       
   360     MOJOSHADER_PRESHADEROP_NOP,
       
   361     MOJOSHADER_PRESHADEROP_MOV,
       
   362     MOJOSHADER_PRESHADEROP_CMP,
       
   363     MOJOSHADER_PRESHADEROP_DOT,
       
   364     MOJOSHADER_PRESHADEROP_DOT_SCALAR,
       
   365     MOJOSHADER_PRESHADEROP_NEG,
       
   366     MOJOSHADER_PRESHADEROP_MAX,
       
   367     MOJOSHADER_PRESHADEROP_MAX_SCALAR,
       
   368     MOJOSHADER_PRESHADEROP_CMPLT,
       
   369     MOJOSHADER_PRESHADEROP_CMPLT_SCALAR,
       
   370     MOJOSHADER_PRESHADEROP_CMPGE,
       
   371     MOJOSHADER_PRESHADEROP_CMPGE_SCALAR,
       
   372     MOJOSHADER_PRESHADEROP_RCP,
       
   373     MOJOSHADER_PRESHADEROP_FRC,
       
   374     MOJOSHADER_PRESHADEROP_EXP,
       
   375     MOJOSHADER_PRESHADEROP_ADD,
       
   376     MOJOSHADER_PRESHADEROP_ADD_SCALAR,
       
   377     MOJOSHADER_PRESHADEROP_MUL,
       
   378     MOJOSHADER_PRESHADEROP_MUL_SCALAR,
       
   379     MOJOSHADER_PRESHADEROP_LOG,
       
   380     MOJOSHADER_PRESHADEROP_RSQ,
       
   381     MOJOSHADER_PRESHADEROP_SIN,
       
   382     MOJOSHADER_PRESHADEROP_COS,
       
   383 } MOJOSHADER_preshaderOpcode;
       
   384 
       
   385 typedef enum MOJOSHADER_preshaderOperandType
       
   386 {
       
   387     MOJOSHADER_PRESHADEROPERAND_INPUT,
       
   388     MOJOSHADER_PRESHADEROPERAND_OUTPUT,
       
   389     MOJOSHADER_PRESHADEROPERAND_LITERAL,
       
   390     MOJOSHADER_PRESHADEROPERAND_TEMP,
       
   391 } MOJOSHADER_preshaderOperandType;
       
   392 
       
   393 typedef struct MOJOSHADER_preshaderOperand
       
   394 {
       
   395     MOJOSHADER_preshaderOperandType type;
       
   396     unsigned int index;
       
   397 } MOJOSHADER_preshaderOperand;
       
   398 
       
   399 typedef struct MOJOSHADER_preshaderInstruction
       
   400 {
       
   401     MOJOSHADER_preshaderOpcode opcode;
       
   402     unsigned int element_count;
       
   403     unsigned int operand_count;
       
   404     MOJOSHADER_preshaderOperand operands[3];
       
   405 } MOJOSHADER_preshaderInstruction;
       
   406 
       
   407 typedef struct MOJOSHADER_preshader
       
   408 {
       
   409     unsigned int literal_count;
       
   410     double *literals;
       
   411     unsigned int temp_count;  /* scalar, not vector! */
       
   412     unsigned int instruction_count;
       
   413     MOJOSHADER_preshaderInstruction *instructions;
       
   414 } MOJOSHADER_preshader;
       
   415 
   356 /*
   416 /*
   357  * Structure used to return data from parsing of a shader...
   417  * Structure used to return data from parsing of a shader...
   358  */
   418  */
   359 /* !!! FIXME: most of these ints should be unsigned. */
   419 /* !!! FIXME: most of these ints should be unsigned. */
   360 typedef struct MOJOSHADER_parseData
   420 typedef struct MOJOSHADER_parseData
   493      *  in bytecode, and will be a copy of what you provide to
   553      *  in bytecode, and will be a copy of what you provide to
   494      *  MOJOSHADER_assemble(). This data is optional.
   554      *  MOJOSHADER_assemble(). This data is optional.
   495      * This can be NULL on error or if (symbol_count) is zero.
   555      * This can be NULL on error or if (symbol_count) is zero.
   496      */
   556      */
   497     MOJOSHADER_symbol *symbols;
   557     MOJOSHADER_symbol *symbols;
       
   558 
       
   559     /*
       
   560      * !!! FIXME: document me.
       
   561      * This can be NULL on error or if no preshader was available.
       
   562      */
       
   563     MOJOSHADER_preshader *preshader;
   498 
   564 
   499     /*
   565     /*
   500      * This is the malloc implementation you passed to MOJOSHADER_parse().
   566      * This is the malloc implementation you passed to MOJOSHADER_parse().
   501      */
   567      */
   502     MOJOSHADER_malloc malloc;
   568     MOJOSHADER_malloc malloc;