diff options
Diffstat (limited to 'src/mesa/main/shaderobj.h')
-rw-r--r-- | src/mesa/main/shaderobj.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 48000463752..cbe7ae7b068 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -96,6 +96,37 @@ _mesa_init_shader_state(GLcontext *ctx); extern void _mesa_free_shader_state(GLcontext *ctx); +static INLINE GLuint +_mesa_shader_type_to_index(GLenum v) +{ + switch(v) + { + case GL_VERTEX_SHADER: + return MESA_SHADER_VERTEX; + case GL_FRAGMENT_SHADER: + return MESA_SHADER_FRAGMENT; + case GL_GEOMETRY_SHADER: + return MESA_SHADER_GEOMETRY; + default: + ASSERT(0); + return ~0; + } +} + +static INLINE GLenum +_mesa_shader_index_to_type(GLuint i) +{ + GLenum enums[MESA_SHADER_TYPES] = { + GL_VERTEX_SHADER, + GL_FRAGMENT_SHADER, + GL_GEOMETRY_SHADER , + }; + if(i >= MESA_SHADER_TYPES) + return 0; + else + return enums[i]; +} + #ifdef __cplusplus } #endif |