summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-09-21 12:41:07 +1200
committerMarek Olšák <[email protected]>2015-07-23 00:59:25 +0200
commitbb97cc66c149d0782ec269aab29700252fda9db0 (patch)
treee2d7b5af60722f5898bf4372c79787cfafa8a938 /src
parenta2af956963b6bc4d29f37485e44c98008d2ef077 (diff)
mesa: add tessellation shader state and limits
Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/config.h8
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/shaderapi.c7
4 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 177f1766016..66eb6cb206d 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -296,6 +296,14 @@
/** For GL_ARB_pipeline_statistics_query */
#define MAX_PIPELINE_STATISTICS 11
+/** For GL_ARB_tessellation_shader */
+/*@{*/
+#define MAX_TESS_GEN_LEVEL 64
+#define MAX_PATCH_VERTICES 32
+#define MAX_TESS_PATCH_COMPONENTS 120
+#define MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 4096
+/*@}*/
+
/*
* Color channel component order
*
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 380c21fb2bf..a08c0d84f6b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -716,6 +716,14 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
/** GL_KHR_context_flush_control */
consts->ContextReleaseBehavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
+
+ /** GL_ARB_tessellation_shader */
+ consts->MaxTessGenLevel = MAX_TESS_GEN_LEVEL;
+ consts->MaxPatchVertices = MAX_PATCH_VERTICES;
+ consts->Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ consts->Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ consts->MaxTessPatchComponents = MAX_TESS_PATCH_COMPONENTS;
+ consts->MaxTessControlTotalOutputComponents = MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fc001c2db15..e4342e0308c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3745,6 +3745,12 @@ struct gl_constants
GLenum ContextReleaseBehavior;
struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES];
+
+ /** GL_ARB_tessellation_shader */
+ GLuint MaxPatchVertices;
+ GLuint MaxTessGenLevel;
+ GLuint MaxTessPatchComponents;
+ GLuint MaxTessControlTotalOutputComponents;
};
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index ccf008a914b..a666fdf3d7e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -110,6 +110,7 @@ _mesa_init_shader_state(struct gl_context *ctx)
*/
struct gl_shader_compiler_options options;
gl_shader_stage sh;
+ int i;
memset(&options, 0, sizeof(options));
options.MaxUnrollIterations = 32;
@@ -126,6 +127,12 @@ _mesa_init_shader_state(struct gl_context *ctx)
/* Extended for ARB_separate_shader_objects */
ctx->Shader.RefCount = 1;
mtx_init(&ctx->Shader.Mutex, mtx_plain);
+
+ ctx->TessCtrlProgram.patch_vertices = 3;
+ for (i = 0; i < 4; ++i)
+ ctx->TessCtrlProgram.patch_default_outer_level[i] = 1.0;
+ for (i = 0; i < 2; ++i)
+ ctx->TessCtrlProgram.patch_default_inner_level[i] = 1.0;
}