diff options
author | Kenneth Graunke <[email protected]> | 2013-04-17 17:30:20 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-05-12 09:36:18 -0700 |
commit | 1c95cea40b518166bfa8d6925d58adf4e73d74fa (patch) | |
tree | 2a73f148bb14d213ff6ab38e546bd5da006dabe4 /src/glsl/standalone_scaffolding.h | |
parent | a67b18e5a7c47fd38d526bac409c04daedec9f8c (diff) |
glsl: Copy _mesa_shader_type_to_index() to standalone scaffolding.
We can't include shaderobj.h from the standalone utilities, so we
unfortunately have to copy this function.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/standalone_scaffolding.h')
-rw-r--r-- | src/glsl/standalone_scaffolding.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h index 0a2cde8a348..7afb1c313e6 100644 --- a/src/glsl/standalone_scaffolding.h +++ b/src/glsl/standalone_scaffolding.h @@ -31,6 +31,7 @@ #ifndef STANDALONE_SCAFFOLDING_H #define STANDALONE_SCAFFOLDING_H +#include <assert.h> #include "main/mtypes.h" extern "C" void @@ -47,6 +48,22 @@ extern "C" void _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id, const char *msg, int len); +static inline gl_shader_type +_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(!"bad value in _mesa_shader_type_to_index()"); + return MESA_SHADER_TYPES; + } +} + /** * Initialize the given gl_context structure to a reasonable set of * defaults representing the minimum capabilities required by the |