mojoshader.h
changeset 1019 e8988ca01c6d
parent 1017 5034d40d718a
child 1028 74e7ee46ac93
equal deleted inserted replaced
1018:ad6c6286df61 1019:e8988ca01c6d
   616  * This function is thread safe, so long as any allocator you passed into
   616  * This function is thread safe, so long as any allocator you passed into
   617  *  MOJOSHADER_parse() is, too.
   617  *  MOJOSHADER_parse() is, too.
   618  */
   618  */
   619 void MOJOSHADER_freeParseData(const MOJOSHADER_parseData *data);
   619 void MOJOSHADER_freeParseData(const MOJOSHADER_parseData *data);
   620 
   620 
       
   621 
       
   622 /* Effects interface... */  /* !!! FIXME: THIS API IS NOT STABLE YET! */
       
   623 
       
   624 typedef struct MOJOSHADER_effectState
       
   625 {
       
   626     unsigned int type;
       
   627 } MOJOSHADER_effectState;
       
   628 
       
   629 typedef struct MOJOSHADER_effectPass
       
   630 {
       
   631     const char *name;
       
   632     unsigned int state_count;
       
   633     MOJOSHADER_effectState *states;
       
   634 } MOJOSHADER_effectPass;
       
   635 
       
   636 typedef struct MOJOSHADER_effectTechnique
       
   637 {
       
   638     const char *name;
       
   639     unsigned int pass_count;
       
   640     MOJOSHADER_effectPass *passes;
       
   641 } MOJOSHADER_effectTechnique;
       
   642 
       
   643 typedef struct MOJOSHADER_effectTexture
       
   644 {
       
   645     unsigned int param;
       
   646     const char *name;
       
   647 } MOJOSHADER_effectTexture;
       
   648 
       
   649 typedef struct MOJOSHADER_effectShader
       
   650 {
       
   651     unsigned int technique;
       
   652     unsigned int pass;
       
   653     const MOJOSHADER_parseData *shader;
       
   654 } MOJOSHADER_effectShader;
       
   655 
       
   656 /*
       
   657  * Structure used to return data from parsing of an effect file...
       
   658  */
       
   659 /* !!! FIXME: most of these ints should be unsigned. */
       
   660 typedef struct MOJOSHADER_effect
       
   661 {
       
   662     /*
       
   663      * The number of elements pointed to by (errors).
       
   664      */
       
   665     int error_count;
       
   666 
       
   667     /*
       
   668      * (error_count) elements of data that specify errors that were generated
       
   669      *  by parsing this shader.
       
   670      * This can be NULL if there were no errors or if (error_count) is zero.
       
   671      */
       
   672     MOJOSHADER_error *errors;
       
   673 
       
   674     /*
       
   675      * The name of the profile used to parse the shader. Will be NULL on error.
       
   676      */
       
   677     const char *profile;
       
   678 
       
   679     /*
       
   680      * The number of elements pointed to by (techniques).
       
   681      */
       
   682     int technique_count;
       
   683 
       
   684     /*
       
   685      * (technique_count) elements of data that specify techniques used in
       
   686      *  this effect. Each technique contains a series of passes, and each pass
       
   687      *  specifies state and shaders that affect rendering.
       
   688      * This can be NULL on error or if (technique_count) is zero.
       
   689      */
       
   690     MOJOSHADER_effectTechnique *techniques;
       
   691 
       
   692     /*
       
   693      * The number of elements pointed to by (textures).
       
   694      */
       
   695     int texture_count;
       
   696 
       
   697     /*
       
   698      * (texture_count) elements of data that specify textures used in
       
   699      *  this effect.
       
   700      * This can be NULL on error or if (texture_count) is zero.
       
   701      */
       
   702     MOJOSHADER_effectTexture *textures;
       
   703 
       
   704     /*
       
   705      * The number of elements pointed to by (shaders).
       
   706      */
       
   707     int shader_count;
       
   708 
       
   709     /*
       
   710      * (shader_count) elements of data that specify shaders used in
       
   711      *  this effect.
       
   712      * This can be NULL on error or if (shader_count) is zero.
       
   713      */
       
   714     MOJOSHADER_effectShader *shaders;
       
   715 
       
   716     /*
       
   717      * This is the malloc implementation you passed to MOJOSHADER_parseEffect().
       
   718      */
       
   719     MOJOSHADER_malloc malloc;
       
   720 
       
   721     /*
       
   722      * This is the free implementation you passed to MOJOSHADER_parseEffect().
       
   723      */
       
   724     MOJOSHADER_free free;
       
   725 
       
   726     /*
       
   727      * This is the pointer you passed as opaque data for your allocator.
       
   728      */
       
   729     void *malloc_data;
       
   730 } MOJOSHADER_effect;
       
   731 
       
   732 /* !!! FIXME: document me. */
       
   733 const MOJOSHADER_effect *MOJOSHADER_parseEffect(const char *profile,
       
   734                                                 const unsigned char *buf,
       
   735                                                 const unsigned int _len,
       
   736                                                 const MOJOSHADER_swizzle *swiz,
       
   737                                                 const unsigned int swizcount,
       
   738                                                 MOJOSHADER_malloc m,
       
   739                                                 MOJOSHADER_free f,
       
   740                                                 void *d);
       
   741 
       
   742 
       
   743 /* !!! FIXME: document me. */
       
   744 void MOJOSHADER_freeEffect(const MOJOSHADER_effect *effect);
   621 
   745 
   622 
   746 
   623 /* Preprocessor interface... */
   747 /* Preprocessor interface... */
   624 
   748 
   625 /*
   749 /*