summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-06 00:56:07 +0200
committerIan Romanick <[email protected]>2010-09-08 20:36:37 -0700
commitede4205b245ee58bacf866d298273ebbe31feacf (patch)
tree863681fadafd7e3e3d777cbd0bb07a5c0c58a703 /src/mesa/program
parent5ecd9c70cecc05eaa1fef05f9bd4e8cf50f2c03a (diff)
mesa: add PIPE_SHADER_* like constants and conversions to/from enums (v2)
Changes in v2: - No longer adds tessellation enums
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/program.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 286573de1fb..f8f37980863 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -167,5 +167,37 @@ _mesa_find_free_register(const GLboolean used[],
extern void
_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog);
+/* keep these in the same order as TGSI_PROCESSOR_* */
+
+static INLINE GLuint
+_mesa_program_target_to_index(GLenum v)
+{
+ switch(v)
+ {
+ case GL_VERTEX_PROGRAM_ARB:
+ return MESA_SHADER_VERTEX;
+ case GL_FRAGMENT_PROGRAM_ARB:
+ return MESA_SHADER_FRAGMENT;
+ case GL_GEOMETRY_PROGRAM_NV:
+ return MESA_SHADER_GEOMETRY;
+ default:
+ ASSERT(0);
+ return ~0;
+ }
+}
+
+static INLINE GLenum
+_mesa_program_index_to_target(GLuint i)
+{
+ GLenum enums[MESA_SHADER_TYPES] = {
+ GL_VERTEX_PROGRAM_ARB,
+ GL_FRAGMENT_PROGRAM_ARB,
+ GL_GEOMETRY_PROGRAM_NV,
+ };
+ if(i >= MESA_SHADER_TYPES)
+ return 0;
+ else
+ return enums[i];
+}
#endif /* PROGRAM_H */