summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-08-17 22:37:16 +1200
committerMarek Olšák <[email protected]>2015-07-23 00:59:27 +0200
commitda7adb99e85fc6efa7f0e570ab93bd7b625975ae (patch)
treea33ec243e6c12eca1ddd52ba59be0b7636a96a9e
parentb7f98f9f094090c6e8a24407dab67e4873c68694 (diff)
glsl: add builtin constants for ARB_tessellation_shader
Limits from other extensions added by Marek. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/glsl/builtin_variables.cpp40
-rw-r--r--src/glsl/glsl_parser_extras.cpp19
-rw-r--r--src/glsl/glsl_parser_extras.h17
3 files changed, 72 insertions, 4 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index c52c8e04720..0ff3a3f7062 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -672,8 +672,14 @@ builtin_variable_generator::generate_constants()
if (!state->es_shader) {
add_const("gl_MaxGeometryAtomicCounters",
state->Const.MaxGeometryAtomicCounters);
- add_const("gl_MaxTessControlAtomicCounters", 0);
- add_const("gl_MaxTessEvaluationAtomicCounters", 0);
+
+ if (state->is_version(400, 0) ||
+ state->ARB_tessellation_shader_enable) {
+ add_const("gl_MaxTessControlAtomicCounters",
+ state->Const.MaxTessControlAtomicCounters);
+ add_const("gl_MaxTessEvaluationAtomicCounters",
+ state->Const.MaxTessEvaluationAtomicCounters);
+ }
}
}
@@ -693,8 +699,10 @@ builtin_variable_generator::generate_constants()
if (!state->es_shader) {
add_const("gl_MaxGeometryAtomicCounterBuffers",
state->Const.MaxGeometryAtomicCounterBuffers);
- add_const("gl_MaxTessControlAtomicCounterBuffers", 0);
- add_const("gl_MaxTessEvaluationAtomicCounterBuffers", 0);
+ add_const("gl_MaxTessControlAtomicCounterBuffers",
+ state->Const.MaxTessControlAtomicCounterBuffers);
+ add_const("gl_MaxTessEvaluationAtomicCounterBuffers",
+ state->Const.MaxTessEvaluationAtomicCounterBuffers);
}
}
@@ -753,11 +761,35 @@ builtin_variable_generator::generate_constants()
state->Const.MaxFragmentImageUniforms);
add_const("gl_MaxCombinedImageUniforms",
state->Const.MaxCombinedImageUniforms);
+
+ if (state->is_version(400, 0) ||
+ state->ARB_tessellation_shader_enable) {
+ add_const("gl_MaxTessControlImageUniforms",
+ state->Const.MaxTessControlImageUniforms);
+ add_const("gl_MaxTessEvaluationImageUniforms",
+ state->Const.MaxTessEvaluationImageUniforms);
+ }
}
if (state->is_version(410, 0) ||
state->ARB_viewport_array_enable)
add_const("gl_MaxViewports", state->Const.MaxViewports);
+
+ if (state->is_version(400, 0) ||
+ state->ARB_tessellation_shader_enable) {
+ add_const("gl_MaxPatchVertices", state->Const.MaxPatchVertices);
+ add_const("gl_MaxTessGenLevel", state->Const.MaxTessGenLevel);
+ add_const("gl_MaxTessControlInputComponents", state->Const.MaxTessControlInputComponents);
+ add_const("gl_MaxTessControlOutputComponents", state->Const.MaxTessControlOutputComponents);
+ add_const("gl_MaxTessControlTextureImageUnits", state->Const.MaxTessControlTextureImageUnits);
+ add_const("gl_MaxTessEvaluationInputComponents", state->Const.MaxTessEvaluationInputComponents);
+ add_const("gl_MaxTessEvaluationOutputComponents", state->Const.MaxTessEvaluationOutputComponents);
+ add_const("gl_MaxTessEvaluationTextureImageUnits", state->Const.MaxTessEvaluationTextureImageUnits);
+ add_const("gl_MaxTessPatchComponents", state->Const.MaxTessPatchComponents);
+ add_const("gl_MaxTessControlTotalOutputComponents", state->Const.MaxTessControlTotalOutputComponents);
+ add_const("gl_MaxTessControlUniformComponents", state->Const.MaxTessControlUniformComponents);
+ add_const("gl_MaxTessEvaluationUniformComponents", state->Const.MaxTessEvaluationUniformComponents);
+ }
}
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 8979d3b49b6..43a3cd13f26 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -113,12 +113,18 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxGeometryUniformComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents;
this->Const.MaxVertexAtomicCounters = ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters;
+ this->Const.MaxTessControlAtomicCounters = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxAtomicCounters;
+ this->Const.MaxTessEvaluationAtomicCounters = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxAtomicCounters;
this->Const.MaxGeometryAtomicCounters = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters;
this->Const.MaxFragmentAtomicCounters = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters;
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
this->Const.MaxVertexAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers;
+ this->Const.MaxTessControlAtomicCounterBuffers =
+ ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxAtomicBuffers;
+ this->Const.MaxTessEvaluationAtomicCounterBuffers =
+ ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxAtomicBuffers;
this->Const.MaxGeometryAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers;
this->Const.MaxFragmentAtomicCounterBuffers =
@@ -138,6 +144,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxCombinedImageUnitsAndFragmentOutputs = ctx->Const.MaxCombinedImageUnitsAndFragmentOutputs;
this->Const.MaxImageSamples = ctx->Const.MaxImageSamples;
this->Const.MaxVertexImageUniforms = ctx->Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms;
+ this->Const.MaxTessControlImageUniforms = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxImageUniforms;
+ this->Const.MaxTessEvaluationImageUniforms = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxImageUniforms;
this->Const.MaxGeometryImageUniforms = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms;
this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
@@ -147,6 +155,17 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
/* tessellation shader constants */
this->Const.MaxPatchVertices = ctx->Const.MaxPatchVertices;
+ this->Const.MaxTessGenLevel = ctx->Const.MaxTessGenLevel;
+ this->Const.MaxTessControlInputComponents = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxInputComponents;
+ this->Const.MaxTessControlOutputComponents = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxOutputComponents;
+ this->Const.MaxTessControlTextureImageUnits = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits;
+ this->Const.MaxTessEvaluationInputComponents = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxInputComponents;
+ this->Const.MaxTessEvaluationOutputComponents = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxOutputComponents;
+ this->Const.MaxTessEvaluationTextureImageUnits = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits;
+ this->Const.MaxTessPatchComponents = ctx->Const.MaxTessPatchComponents;
+ this->Const.MaxTessControlTotalOutputComponents = ctx->Const.MaxTessControlTotalOutputComponents;
+ this->Const.MaxTessControlUniformComponents = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxUniformComponents;
+ this->Const.MaxTessEvaluationUniformComponents = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxUniformComponents;
this->current_function = NULL;
this->toplevel_ir = NULL;
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index de8f8c417fc..f4b60afcb37 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -360,6 +360,8 @@ struct _mesa_glsl_parse_state {
/* ARB_shader_atomic_counters */
unsigned MaxVertexAtomicCounters;
+ unsigned MaxTessControlAtomicCounters;
+ unsigned MaxTessEvaluationAtomicCounters;
unsigned MaxGeometryAtomicCounters;
unsigned MaxFragmentAtomicCounters;
unsigned MaxCombinedAtomicCounters;
@@ -370,6 +372,8 @@ struct _mesa_glsl_parse_state {
* 3.10.
*/
unsigned MaxVertexAtomicCounterBuffers;
+ unsigned MaxTessControlAtomicCounterBuffers;
+ unsigned MaxTessEvaluationAtomicCounterBuffers;
unsigned MaxGeometryAtomicCounterBuffers;
unsigned MaxFragmentAtomicCounterBuffers;
unsigned MaxCombinedAtomicCounterBuffers;
@@ -384,6 +388,8 @@ struct _mesa_glsl_parse_state {
unsigned MaxCombinedImageUnitsAndFragmentOutputs;
unsigned MaxImageSamples;
unsigned MaxVertexImageUniforms;
+ unsigned MaxTessControlImageUniforms;
+ unsigned MaxTessEvaluationImageUniforms;
unsigned MaxGeometryImageUniforms;
unsigned MaxFragmentImageUniforms;
unsigned MaxCombinedImageUniforms;
@@ -393,6 +399,17 @@ struct _mesa_glsl_parse_state {
/* ARB_tessellation_shader */
unsigned MaxPatchVertices;
+ unsigned MaxTessGenLevel;
+ unsigned MaxTessControlInputComponents;
+ unsigned MaxTessControlOutputComponents;
+ unsigned MaxTessControlTextureImageUnits;
+ unsigned MaxTessEvaluationInputComponents;
+ unsigned MaxTessEvaluationOutputComponents;
+ unsigned MaxTessEvaluationTextureImageUnits;
+ unsigned MaxTessPatchComponents;
+ unsigned MaxTessControlTotalOutputComponents;
+ unsigned MaxTessControlUniformComponents;
+ unsigned MaxTessEvaluationUniformComponents;
} Const;
/**