From a2af956963b6bc4d29f37485e44c98008d2ef077 Mon Sep 17 00:00:00 2001 From: Fabian Bieler Date: Fri, 7 Mar 2014 10:19:09 +0100 Subject: [PATCH] mesa: add tessellation shader enums Reviewed-by: Jordan Justen Reviewed-by: Matt Turner Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke --- src/glsl/shader_enums.h | 8 +++++--- src/mesa/drivers/common/meta.c | 2 ++ src/mesa/drivers/dri/i965/intel_debug.c | 4 +++- src/mesa/main/context.c | 2 ++ src/mesa/main/shaderobj.h | 4 ++++ src/mesa/program/prog_print.c | 6 ++++++ src/mesa/program/program.h | 8 ++++++++ 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/glsl/shader_enums.h b/src/glsl/shader_enums.h index 79e0f6b5f78..42a30ae8fb9 100644 --- a/src/glsl/shader_enums.h +++ b/src/glsl/shader_enums.h @@ -36,9 +36,11 @@ typedef enum { MESA_SHADER_VERTEX = 0, - MESA_SHADER_GEOMETRY = 1, - MESA_SHADER_FRAGMENT = 2, - MESA_SHADER_COMPUTE = 3, + MESA_SHADER_TESS_CTRL = 1, + MESA_SHADER_TESS_EVAL = 2, + MESA_SHADER_GEOMETRY = 3, + MESA_SHADER_FRAGMENT = 4, + MESA_SHADER_COMPUTE = 5, } gl_shader_stage; #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 12045ebbf8e..ca10bbe81f6 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -945,6 +945,8 @@ _mesa_meta_end(struct gl_context *ctx) if (state & MESA_META_SHADER) { static const GLenum targets[] = { GL_VERTEX_SHADER, + GL_TESS_CONTROL_SHADER, + GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER, }; diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index b68c2127f8d..a0777310e2a 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -79,11 +79,13 @@ intel_debug_flag_for_shader_stage(gl_shader_stage stage) { uint64_t flags[] = { [MESA_SHADER_VERTEX] = DEBUG_VS, + [MESA_SHADER_TESS_CTRL] = 0, + [MESA_SHADER_TESS_EVAL] = 0, [MESA_SHADER_GEOMETRY] = DEBUG_GS, [MESA_SHADER_FRAGMENT] = DEBUG_WM, [MESA_SHADER_COMPUTE] = DEBUG_CS, }; - STATIC_ASSERT(MESA_SHADER_STAGES == 4); + STATIC_ASSERT(MESA_SHADER_STAGES == 6); return flags[stage]; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f4dc4e3c4da..380c21fb2bf 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -478,6 +478,8 @@ init_program_limits(struct gl_constants *consts, gl_shader_stage stage, prog->MaxInputComponents = 16 * 4; /* old limit not to break tnl and swrast */ prog->MaxOutputComponents = 0; /* value not used */ break; + case MESA_SHADER_TESS_CTRL: + case MESA_SHADER_TESS_EVAL: case MESA_SHADER_GEOMETRY: prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS; prog->MaxAttribs = MAX_VERTEX_GENERIC_ATTRIBS; diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 3d696a1887e..75f019dbd3d 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -111,6 +111,10 @@ _mesa_shader_enum_to_shader_stage(GLenum v) return MESA_SHADER_FRAGMENT; case GL_GEOMETRY_SHADER: return MESA_SHADER_GEOMETRY; + case GL_TESS_CONTROL_SHADER: + return MESA_SHADER_TESS_CTRL; + case GL_TESS_EVALUATION_SHADER: + return MESA_SHADER_TESS_EVAL; case GL_COMPUTE_SHADER: return MESA_SHADER_COMPUTE; default: diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index e4faa63c06f..336a5ef4448 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -1015,6 +1015,12 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) case MESA_SHADER_FRAGMENT: type = "frag"; break; + case MESA_SHADER_TESS_CTRL: + type = "tesc"; + break; + case MESA_SHADER_TESS_EVAL: + type = "tese"; + break; case MESA_SHADER_VERTEX: type = "vert"; break; diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h index 2d92ab2f118..396a5c89db3 100644 --- a/src/mesa/program/program.h +++ b/src/mesa/program/program.h @@ -216,6 +216,10 @@ _mesa_program_enum_to_shader_stage(GLenum v) return MESA_SHADER_FRAGMENT; case GL_GEOMETRY_PROGRAM_NV: return MESA_SHADER_GEOMETRY; + case GL_TESS_CONTROL_PROGRAM_NV: + return MESA_SHADER_TESS_CTRL; + case GL_TESS_EVALUATION_PROGRAM_NV: + return MESA_SHADER_TESS_EVAL; case GL_COMPUTE_PROGRAM_NV: return MESA_SHADER_COMPUTE; default: @@ -235,6 +239,10 @@ _mesa_shader_stage_to_program(unsigned stage) return GL_FRAGMENT_PROGRAM_ARB; case MESA_SHADER_GEOMETRY: return GL_GEOMETRY_PROGRAM_NV; + case MESA_SHADER_TESS_CTRL: + return GL_TESS_CONTROL_PROGRAM_NV; + case MESA_SHADER_TESS_EVAL: + return GL_TESS_EVALUATION_PROGRAM_NV; case MESA_SHADER_COMPUTE: return GL_COMPUTE_PROGRAM_NV; } -- 2.30.2