Mesa (master): glsl: Add extension plumbing for OES/ EXT_tessellation_shader.
Kenneth Graunke
kwg at kemper.freedesktop.org
Mon Aug 8 18:07:52 UTC 2016
Module: Mesa
Branch: master
Commit: 58709d36d73419c21b899d4b9d08a4a82a2cc28b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58709d36d73419c21b899d4b9d08a4a82a2cc28b
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Fri Jul 8 12:00:30 2016 -0700
glsl: Add extension plumbing for OES/EXT_tessellation_shader.
This adds the #extension directive support, built-in #defines,
lexer keyword support, and updates has_tessellation_shader().
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/glsl/glsl_lexer.ll | 2 +-
src/compiler/glsl/glsl_parser.yy | 3 ++-
src/compiler/glsl/glsl_parser_extras.cpp | 4 ++++
src/compiler/glsl/glsl_parser_extras.h | 13 ++++++++++++-
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index 11711ee..7be2b89 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -311,7 +311,7 @@ invariant KEYWORD(120, 100, 120, 100, INVARIANT);
flat KEYWORD(130, 100, 130, 300, FLAT);
smooth KEYWORD(130, 300, 130, 300, SMOOTH);
noperspective KEYWORD(130, 300, 130, 0, NOPERSPECTIVE);
-patch KEYWORD_WITH_ALT(0, 300, 400, 0, yyextra->ARB_tessellation_shader_enable, PATCH);
+patch KEYWORD_WITH_ALT(0, 300, 400, 320, yyextra->has_tessellation_shader(), PATCH);
sampler1D DEPRECATED_ES_KEYWORD(SAMPLER1D);
sampler2D return SAMPLER2D;
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 146589a..4ab9e14 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1274,7 +1274,8 @@ layout_qualifier_id:
}
}
- if ($$.flags.i && !state->has_geometry_shader()) {
+ if ($$.flags.i && !state->has_geometry_shader() &&
+ !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state, "#version 150 layout "
"qualifier `%s' used", $1);
}
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index e702291..14a5540 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -634,6 +634,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(OES_shader_io_blocks),
EXT(OES_shader_multisample_interpolation),
EXT(OES_standard_derivatives),
+ EXT(OES_tessellation_point_size),
+ EXT(OES_tessellation_shader),
EXT(OES_texture_3D),
EXT(OES_texture_buffer),
EXT(OES_texture_storage_multisample_2d_array),
@@ -653,6 +655,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(EXT_shader_integer_mix),
EXT(EXT_shader_io_blocks),
EXT(EXT_shader_samples_identical),
+ EXT(EXT_tessellation_point_size),
+ EXT(EXT_tessellation_shader),
EXT(EXT_texture_array),
EXT(EXT_texture_buffer),
EXT(MESA_shader_integer_functions),
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index f9c1ffc..991cfc6 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -279,7 +279,10 @@ struct _mesa_glsl_parse_state {
bool has_tessellation_shader() const
{
- return ARB_tessellation_shader_enable || is_version(400, 0);
+ return ARB_tessellation_shader_enable ||
+ OES_tessellation_shader_enable ||
+ EXT_tessellation_shader_enable ||
+ is_version(400, 320);
}
bool has_clip_distance() const
@@ -649,6 +652,10 @@ struct _mesa_glsl_parse_state {
bool OES_shader_multisample_interpolation_warn;
bool OES_standard_derivatives_enable;
bool OES_standard_derivatives_warn;
+ bool OES_tessellation_point_size_enable;
+ bool OES_tessellation_point_size_warn;
+ bool OES_tessellation_shader_enable;
+ bool OES_tessellation_shader_warn;
bool OES_texture_3D_enable;
bool OES_texture_3D_warn;
bool OES_texture_buffer_enable;
@@ -684,6 +691,10 @@ struct _mesa_glsl_parse_state {
bool EXT_shader_io_blocks_warn;
bool EXT_shader_samples_identical_enable;
bool EXT_shader_samples_identical_warn;
+ bool EXT_tessellation_point_size_enable;
+ bool EXT_tessellation_point_size_warn;
+ bool EXT_tessellation_shader_enable;
+ bool EXT_tessellation_shader_warn;
bool EXT_texture_array_enable;
bool EXT_texture_array_warn;
bool EXT_texture_buffer_enable;
More information about the mesa-commit
mailing list