mojoshader.h
changeset 1090 636ffcd3f14a
parent 1068 89f0be59ad5d
child 1104 9147482e1ec7
equal deleted inserted replaced
1089:b965d0942dff 1090:636ffcd3f14a
   174  *  type==MOJOSHADER_SAMPLER_2D, that means we'd expect a regular 2D texture
   174  *  type==MOJOSHADER_SAMPLER_2D, that means we'd expect a regular 2D texture
   175  *  to be specified for what would be register "s6" in D3D assembly language,
   175  *  to be specified for what would be register "s6" in D3D assembly language,
   176  *  before drawing with the shader.
   176  *  before drawing with the shader.
   177  * (name) is a profile-specific variable name; it may be NULL if it isn't
   177  * (name) is a profile-specific variable name; it may be NULL if it isn't
   178  *  applicable to the requested profile.
   178  *  applicable to the requested profile.
       
   179  * (texbem) will be non-zero if a TEXBEM opcode references this sampler. This
       
   180  *  is only used in legacy shaders (ps_1_1 through ps_1_3), but it needs some
       
   181  *  special support to work, as we have to load a magic uniform behind the
       
   182  *  scenes to support it. Most code can ignore this field in general, and no
       
   183  *  one has to touch it unless they really know what they're doing.
   179  */
   184  */
   180 typedef struct MOJOSHADER_sampler
   185 typedef struct MOJOSHADER_sampler
   181 {
   186 {
   182     MOJOSHADER_samplerType type;
   187     MOJOSHADER_samplerType type;
   183     int index;
   188     int index;
   184     const char *name;
   189     const char *name;
       
   190     int texbem;
   185 } MOJOSHADER_sampler;
   191 } MOJOSHADER_sampler;
   186 
   192 
   187 /*
   193 /*
   188  * Data types for attributes. See MOJOSHADER_attribute for more information.
   194  * Data types for attributes. See MOJOSHADER_attribute for more information.
   189  */
   195  */
  3012  */
  3018  */
  3013 void MOJOSHADER_glGetPixelShaderUniformB(unsigned int idx, int *data,
  3019 void MOJOSHADER_glGetPixelShaderUniformB(unsigned int idx, int *data,
  3014                                          unsigned int bcount);
  3020                                          unsigned int bcount);
  3015 
  3021 
  3016 /*
  3022 /*
       
  3023  * Set up the vector for the TEXBEM opcode. Most apps can ignore this API.
       
  3024  *
       
  3025  * Shader Model 1.1 through 1.3 had an instruction for "fake bump mapping"
       
  3026  *  called TEXBEM. To use it, you had to set some sampler states,
       
  3027  *  D3DTSS_BUMPENVMATxx, which would be referenced by the opcode.
       
  3028  *
       
  3029  * This functionality was removed from Shader Model 1.4 and later, because
       
  3030  *  it was special-purpose and limited. The functionality could be built on
       
  3031  *  more general opcodes, and the sampler state could be supplied in a more
       
  3032  *  general uniform.
       
  3033  *
       
  3034  * However, to support this opcode, we supply a way to specify that sampler
       
  3035  *  state, and the OpenGL glue code does the right thing to pass that
       
  3036  *  information to the shader.
       
  3037  *
       
  3038  * This call maps to IDirect3DDevice::SetTextureStageState() with the
       
  3039  *  D3DTSS_BUMPENVMAT00, D3DTSS_BUMPENVMAT01, D3DTSS_BUMPENVMAT10,
       
  3040  *  D3DTSS_BUMPENVMAT11, D3DTSS_BUMPENVLSCALE, and D3DTSS_BUMPENVLOFFSET
       
  3041  *  targets. This is only useful for Shader Model < 1.4 pixel shaders, if
       
  3042  *  they use the TEXBEM or TEXBEML opcode. If you aren't sure, you don't need
       
  3043  *  this function.
       
  3044  *
       
  3045  * Like the rest of your uniforms, you must call MOJOSHADER_glProgramReady()
       
  3046  *  between setting new values and drawing with them.
       
  3047  *
       
  3048  * This call is NOT thread safe! As most OpenGL implementations are not thread
       
  3049  *  safe, you should probably only call this from the same thread that created
       
  3050  *  the GL context.
       
  3051  *
       
  3052  * This call requires a valid MOJOSHADER_glContext to have been made current,
       
  3053  *  or it will crash your program. See MOJOSHADER_glMakeContextCurrent().
       
  3054  *
       
  3055  * These values are not shared between contexts.
       
  3056  */
       
  3057 void MOJOSHADER_glSetLegacyBumpMapEnv(unsigned int sampler, float mat00,
       
  3058                                       float mat01, float mat10, float mat11,
       
  3059                                       float lscale, float loffset);
       
  3060 
       
  3061 /*
  3017  * Connect a client-side array to the currently-bound program.
  3062  * Connect a client-side array to the currently-bound program.
  3018  *
  3063  *
  3019  * (usage) and (index) map to Direct3D vertex declaration values: COLOR1 would
  3064  * (usage) and (index) map to Direct3D vertex declaration values: COLOR1 would
  3020  *  be MOJOSHADER_USAGE_COLOR and 1.
  3065  *  be MOJOSHADER_USAGE_COLOR and 1.
  3021  *
  3066  *