aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/ast.h5
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp5
-rw-r--r--src/compiler/glsl/ast_type.cpp16
-rw-r--r--src/compiler/glsl/glsl_parser.yy34
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp4
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h4
-rw-r--r--src/compiler/glsl/linker.cpp3
-rw-r--r--src/compiler/shader_info.h6
8 files changed, 70 insertions, 7 deletions
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index df3a744de9c..0e32c36528e 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -610,6 +610,11 @@ struct ast_type_qualifier {
* Flag set if GL_ARB_post_depth_coverage layout qualifier is used.
*/
unsigned post_depth_coverage:1;
+ /**
+ * Flag set if GL_INTEL_conservartive_rasterization layout qualifier
+ * is used.
+ */
+ unsigned inner_coverage:1;
}
/** \brief Set of flags, accessed by name. */
q;
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 2434ce57505..1e14d27f5f0 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3633,6 +3633,11 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
"valid in fragment shader input layout declaration.");
}
+ if (qual->flags.q.inner_coverage) {
+ _mesa_glsl_error(loc, state, "inner_coverage layout qualifier only "
+ "valid in fragment shader input layout declaration.");
+ }
+
if (qual->flags.q.post_depth_coverage) {
_mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier only "
"valid in fragment shader input layout declaration.");
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index aa1ae7e4849..d68e6e2916f 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -579,6 +579,7 @@ ast_type_qualifier::validate_in_qualifier(YYLTYPE *loc,
break;
case MESA_SHADER_FRAGMENT:
valid_in_mask.flags.q.early_fragment_tests = 1;
+ valid_in_mask.flags.q.inner_coverage = 1;
valid_in_mask.flags.q.post_depth_coverage = 1;
break;
case MESA_SHADER_COMPUTE:
@@ -634,11 +635,23 @@ ast_type_qualifier::merge_into_in_qualifier(YYLTYPE *loc,
state->in_qualifier->flags.q.early_fragment_tests = false;
}
+ if (state->in_qualifier->flags.q.inner_coverage) {
+ state->fs_inner_coverage = true;
+ state->in_qualifier->flags.q.inner_coverage = false;
+ }
+
if (state->in_qualifier->flags.q.post_depth_coverage) {
state->fs_post_depth_coverage = true;
state->in_qualifier->flags.q.post_depth_coverage = false;
}
+ if (state->fs_inner_coverage && state->fs_post_depth_coverage) {
+ _mesa_glsl_error(loc, state,
+ "inner_coverage & post_depth_coverage layout qualifiers "
+ "are mutally exclusives");
+ r = false;
+ }
+
/* We allow the creation of multiple cs_input_layout nodes. Coherence among
* all existing nodes is checked later, when the AST node is transformed
* into HIR.
@@ -707,7 +720,7 @@ ast_type_qualifier::validate_flags(YYLTYPE *loc,
"%s '%s':"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
- "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
message, name,
bad.flags.q.invariant ? " invariant" : "",
bad.flags.q.precise ? " precise" : "",
@@ -768,6 +781,7 @@ ast_type_qualifier::validate_flags(YYLTYPE *loc,
bad.flags.q.vertices ? " vertices" : "",
bad.flags.q.subroutine ? " subroutine" : "",
bad.flags.q.subroutine_def ? " subroutine_def" : "",
+ bad.flags.q.inner_coverage ? " inner_coverage" : "",
bad.flags.q.post_depth_coverage ? " post_depth_coverage" : "");
return false;
}
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 09b7e79c40b..e3893d5ec3b 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1372,9 +1372,10 @@ layout_qualifier_id:
}
}
}
+ }
- if (!$$.flags.i &&
- match_layout_qualifier($1, "early_fragment_tests", state) == 0) {
+ if (!$$.flags.i) {
+ if (match_layout_qualifier($1, "early_fragment_tests", state) == 0) {
/* From section 4.4.1.3 of the GLSL 4.50 specification
* (Fragment Shader Inputs):
*
@@ -1393,15 +1394,32 @@ layout_qualifier_id:
$$.flags.q.early_fragment_tests = 1;
}
- if (!$$.flags.i &&
- match_layout_qualifier($1, "post_depth_coverage", state) == 0) {
+ if (match_layout_qualifier($1, "inner_coverage", state) == 0) {
+ if (state->stage != MESA_SHADER_FRAGMENT) {
+ _mesa_glsl_error(& @1, state,
+ "inner_coverage layout qualifier only "
+ "valid in fragment shaders");
+ }
+
+ if (state->INTEL_conservative_rasterization_enable) {
+ $$.flags.q.inner_coverage = 1;
+ } else {
+ _mesa_glsl_error(& @1, state,
+ "inner_coverage layout qualifier present, "
+ "but the INTEL_conservative_rasterization extension "
+ "is not enabled.");
+ }
+ }
+
+ if (match_layout_qualifier($1, "post_depth_coverage", state) == 0) {
if (state->stage != MESA_SHADER_FRAGMENT) {
_mesa_glsl_error(& @1, state,
"post_depth_coverage layout qualifier only "
"valid in fragment shaders");
}
- if (state->ARB_post_depth_coverage_enable) {
+ if (state->ARB_post_depth_coverage_enable ||
+ state->INTEL_conservative_rasterization_enable) {
$$.flags.q.post_depth_coverage = 1;
} else {
_mesa_glsl_error(& @1, state,
@@ -1410,6 +1428,12 @@ layout_qualifier_id:
"is not enabled.");
}
}
+
+ if ($$.flags.q.post_depth_coverage && $$.flags.q.inner_coverage) {
+ _mesa_glsl_error(& @1, state,
+ "post_depth_coverage & inner_coverage layout qualifiers "
+ "are mutually exclusive");
+ }
}
/* Layout qualifiers for tessellation evaluation shaders. */
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index d1fc98dd14e..14b71539eb7 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -293,6 +293,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->in_qualifier = new(this) ast_type_qualifier();
this->out_qualifier = new(this) ast_type_qualifier();
this->fs_early_fragment_tests = false;
+ this->fs_inner_coverage = false;
this->fs_post_depth_coverage = false;
this->fs_blend_support = 0;
memset(this->atomic_counter_offsets, 0,
@@ -687,6 +688,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
EXT(EXT_texture_array),
EXT_AEP(EXT_texture_buffer),
EXT_AEP(EXT_texture_cube_map_array),
+ EXT(INTEL_conservative_rasterization),
EXT(MESA_shader_integer_functions),
EXT(NV_image_formats),
};
@@ -1692,6 +1694,7 @@ set_shader_inout_layout(struct gl_shader *shader,
assert(!state->fs_pixel_center_integer);
assert(!state->fs_origin_upper_left);
assert(!state->fs_early_fragment_tests);
+ assert(!state->fs_inner_coverage);
assert(!state->fs_post_depth_coverage);
}
@@ -1813,6 +1816,7 @@ set_shader_inout_layout(struct gl_shader *shader,
shader->info.ARB_fragment_coord_conventions_enable =
state->ARB_fragment_coord_conventions_enable;
shader->info.EarlyFragmentTests = state->fs_early_fragment_tests;
+ shader->info.InnerCoverage = state->fs_inner_coverage;
shader->info.PostDepthCoverage = state->fs_post_depth_coverage;
shader->info.BlendSupport = state->fs_blend_support;
break;
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 4277d43aa72..d6fc37777e4 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -761,6 +761,8 @@ struct _mesa_glsl_parse_state {
bool EXT_texture_buffer_warn;
bool EXT_texture_cube_map_array_enable;
bool EXT_texture_cube_map_array_warn;
+ bool INTEL_conservative_rasterization_enable;
+ bool INTEL_conservative_rasterization_warn;
bool MESA_shader_framebuffer_fetch_enable;
bool MESA_shader_framebuffer_fetch_warn;
bool MESA_shader_framebuffer_fetch_non_coherent_enable;
@@ -788,6 +790,8 @@ struct _mesa_glsl_parse_state {
bool fs_early_fragment_tests;
+ bool fs_inner_coverage;
+
bool fs_post_depth_coverage;
unsigned fs_blend_support;
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index f650752fad4..366025748d0 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1889,7 +1889,8 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
linked_shader->info.EarlyFragmentTests |=
shader->info.EarlyFragmentTests;
-
+ linked_shader->info.InnerCoverage |=
+ shader->info.InnerCoverage;
linked_shader->Program->info.fs.post_depth_coverage |=
shader->info.PostDepthCoverage;
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index b2830e032cc..768f0531bc7 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -116,6 +116,12 @@ typedef struct shader_info {
* ARB_shader_image_load_store.
*/
bool early_fragment_tests;
+
+ /**
+ * Defined by INTEL_conservative_rasterization.
+ */
+ bool inner_coverage;
+
bool post_depth_coverage;
/** gl_FragDepth layout for ARB_conservative_depth. */