<p dir="ltr">Ah, I see. The difference is that it exists, unlike the ARB one :) I was confusing with the NV variant.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Dec 1, 2016 2:10 PM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Is this different from the arb variant?</p><div class="elided-text">
<div class="gmail_extra"><br><div class="gmail_quote">On Dec 1, 2016 10:56 AM, "Lionel Landwerlin" <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
src/compiler/glsl/ast.h | 5 ++++<br>
src/compiler/glsl/ast_to_hir.<wbr>cpp | 5 ++++<br>
src/compiler/glsl/ast_type.<wbr>cpp | 16 +++++++++++-<br>
src/compiler/glsl/glsl_<wbr>parser.yy | 34 ++++++++++++++++++++++----<br>
src/compiler/glsl/glsl_<wbr>parser_extras.cpp | 4 +++<br>
src/compiler/glsl/glsl_<wbr>parser_extras.h | 4 +++<br>
src/compiler/glsl/linker.cpp | 3 +++<br>
src/compiler/shader_info.h | 6 +++++<br>
src/mesa/main/api_validate.c | 42 ++++++++++++++++++++++++++++++<wbr>++<br>
src/mesa/main/enable.c | 12 +++++++++<br>
src/mesa/main/extensions_tabl<wbr>e.h | 1 +<br>
src/mesa/main/mtypes.h | 3 +++<br>
src/mesa/main/shaderapi.c | 1 +<br>
13 files changed, 130 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h<br>
index df3a744..0e32c36 100644<br>
--- a/src/compiler/glsl/ast.h<br>
+++ b/src/compiler/glsl/ast.h<br>
@@ -610,6 +610,11 @@ struct ast_type_qualifier {<br>
* Flag set if GL_ARB_post_depth_coverage layout qualifier is used.<br>
*/<br>
unsigned post_depth_coverage:1;<br>
+ /**<br>
+ * Flag set if GL_INTEL_conservartive_rasteri<wbr>zation layout qualifier<br>
+ * is used.<br>
+ */<br>
+ unsigned inner_coverage:1;<br>
}<br>
/** \brief Set of flags, accessed by name. */<br>
q;<br>
diff --git a/src/compiler/glsl/ast_to_hir<wbr>.cpp b/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
index 2434ce5..1e14d27 100644<br>
--- a/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
+++ b/src/compiler/glsl/ast_to_hir<wbr>.cpp<br>
@@ -3633,6 +3633,11 @@ apply_layout_qualifier_to_vari<wbr>able(const struct ast_type_qualifier *qual,<br>
"valid in fragment shader input layout declaration.");<br>
}<br>
<br>
+ if (qual->flags.q.inner_coverage) {<br>
+ _mesa_glsl_error(loc, state, "inner_coverage layout qualifier only "<br>
+ "valid in fragment shader input layout declaration.");<br>
+ }<br>
+<br>
if (qual->flags.q.post_depth_cove<wbr>rage) {<br>
_mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier only "<br>
"valid in fragment shader input layout declaration.");<br>
diff --git a/src/compiler/glsl/ast_type.c<wbr>pp b/src/compiler/glsl/ast_type.c<wbr>pp<br>
index aa1ae7e..d68e6e2 100644<br>
--- a/src/compiler/glsl/ast_type.c<wbr>pp<br>
+++ b/src/compiler/glsl/ast_type.c<wbr>pp<br>
@@ -579,6 +579,7 @@ ast_type_qualifier::validate_i<wbr>n_qualifier(YYLTYPE *loc,<br>
break;<br>
case MESA_SHADER_FRAGMENT:<br>
valid_in_mask.flags.q.early_f<wbr>ragment_tests = 1;<br>
+ valid_in_mask.flags.q.inner_co<wbr>verage = 1;<br>
valid_in_mask.flags.q.post_de<wbr>pth_coverage = 1;<br>
break;<br>
case MESA_SHADER_COMPUTE:<br>
@@ -634,11 +635,23 @@ ast_type_qualifier::merge_into<wbr>_in_qualifier(YYLTYPE *loc,<br>
state->in_qualifier->flags.q.<wbr>early_fragment_tests = false;<br>
}<br>
<br>
+ if (state->in_qualifier->flags.q.<wbr>inner_coverage) {<br>
+ state->fs_inner_coverage = true;<br>
+ state->in_qualifier->flags.q.i<wbr>nner_coverage = false;<br>
+ }<br>
+<br>
if (state->in_qualifier->flags.q.<wbr>post_depth_coverage) {<br>
state->fs_post_depth_coverage = true;<br>
state->in_qualifier->flags.q.<wbr>post_depth_coverage = false;<br>
}<br>
<br>
+ if (state->fs_inner_coverage && state->fs_post_depth_coverage) {<br>
+ _mesa_glsl_error(loc, state,<br>
+ "inner_coverage & post_depth_coverage layout qualifiers "<br>
+ "are mutally exclusives");<br>
+ r = false;<br>
+ }<br>
+<br>
/* We allow the creation of multiple cs_input_layout nodes. Coherence among<br>
* all existing nodes is checked later, when the AST node is transformed<br>
* into HIR.<br>
@@ -707,7 +720,7 @@ ast_type_qualifier::validate_f<wbr>lags(YYLTYPE *loc,<br>
"%s '%s':"<br>
"%s%s%s%s%s%s%s%s%s%s%s%s%s%<wbr>s%s%s%s%s%s%s"<br>
"%s%s%s%s%s%s%s%s%s%s%s%s%s%<wbr>s%s%s%s%s%s%s"<br>
- "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%<wbr>s\n",<br>
+ "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%<wbr>s%s\n",<br>
message, name,<br>
bad.flags.q.invariant ? " invariant" : "",<br>
bad.flags.q.precise ? " precise" : "",<br>
@@ -768,6 +781,7 @@ ast_type_qualifier::validate_f<wbr>lags(YYLTYPE *loc,<br>
bad.flags.q.vertices ? " vertices" : "",<br>
bad.flags.q.subroutine ? " subroutine" : "",<br>
bad.flags.q.subroutine_def ? " subroutine_def" : "",<br>
+ bad.flags.q.inner_coverage ? " inner_coverage" : "",<br>
bad.flags.q.post_depth_covera<wbr>ge ? " post_depth_coverage" : "");<br>
return false;<br>
}<br>
diff --git a/src/compiler/glsl/glsl_parse<wbr>r.yy b/src/compiler/glsl/glsl_parse<wbr>r.yy<br>
index 09b7e79..e3893d5 100644<br>
--- a/src/compiler/glsl/glsl_parse<wbr>r.yy<br>
+++ b/src/compiler/glsl/glsl_parse<wbr>r.yy<br>
@@ -1372,9 +1372,10 @@ layout_qualifier_id:<br>
}<br>
}<br>
}<br>
+ }<br>
<br>
- if (!$$.flags.i &&<br>
- match_layout_qualifier($1, "early_fragment_tests", state) == 0) {<br>
+ if (!$$.flags.i) {<br>
+ if (match_layout_qualifier($1, "early_fragment_tests", state) == 0) {<br>
/* From section 4.4.1.3 of the GLSL 4.50 specification<br>
* (Fragment Shader Inputs):<br>
*<br>
@@ -1393,15 +1394,32 @@ layout_qualifier_id:<br>
$$.flags.q.early_fragment_tes<wbr>ts = 1;<br>
}<br>
<br>
- if (!$$.flags.i &&<br>
- match_layout_qualifier($1, "post_depth_coverage", state) == 0) {<br>
+ if (match_layout_qualifier($1, "inner_coverage", state) == 0) {<br>
+ if (state->stage != MESA_SHADER_FRAGMENT) {<br>
+ _mesa_glsl_error(& @1, state,<br>
+ "inner_coverage layout qualifier only "<br>
+ "valid in fragment shaders");<br>
+ }<br>
+<br>
+ if (state->INTEL_conservative_ras<wbr>terization_enable) {<br>
+ $$.flags.q.inner_coverage = 1;<br>
+ } else {<br>
+ _mesa_glsl_error(& @1, state,<br>
+ "inner_coverage layout qualifier present, "<br>
+ "but the INTEL_conservative_rasterizati<wbr>on extension "<br>
+ "is not enabled.");<br>
+ }<br>
+ }<br>
+<br>
+ if (match_layout_qualifier($1, "post_depth_coverage", state) == 0) {<br>
if (state->stage != MESA_SHADER_FRAGMENT) {<br>
_mesa_glsl_error(& @1, state,<br>
"post_depth_coverage layout qualifier only "<br>
"valid in fragment shaders");<br>
}<br>
<br>
- if (state->ARB_post_depth_coverag<wbr>e_enable) {<br>
+ if (state->ARB_post_depth_coverag<wbr>e_enable ||<br>
+ state->INTEL_conservative_ras<wbr>terization_enable) {<br>
$$.flags.q.post_depth_coverage = 1;<br>
} else {<br>
_mesa_glsl_error(& @1, state,<br>
@@ -1410,6 +1428,12 @@ layout_qualifier_id:<br>
"is not enabled.");<br>
}<br>
}<br>
+<br>
+ if ($$.flags.q.post_depth_coverag<wbr>e && $$.flags.q.inner_coverage) {<br>
+ _mesa_glsl_error(& @1, state,<br>
+ "post_depth_coverage & inner_coverage layout qualifiers "<br>
+ "are mutually exclusive");<br>
+ }<br>
}<br>
<br>
/* Layout qualifiers for tessellation evaluation shaders. */<br>
diff --git a/src/compiler/glsl/glsl_parse<wbr>r_extras.cpp b/src/compiler/glsl/glsl_parse<wbr>r_extras.cpp<br>
index d1fc98d..14b7153 100644<br>
--- a/src/compiler/glsl/glsl_parse<wbr>r_extras.cpp<br>
+++ b/src/compiler/glsl/glsl_parse<wbr>r_extras.cpp<br>
@@ -293,6 +293,7 @@ _mesa_glsl_parse_state::_mesa_<wbr>glsl_parse_state(struct gl_context *_ctx,<br>
this->in_qualifier = new(this) ast_type_qualifier();<br>
this->out_qualifier = new(this) ast_type_qualifier();<br>
this->fs_early_fragment_tests = false;<br>
+ this->fs_inner_coverage = false;<br>
this->fs_post_depth_coverage = false;<br>
this->fs_blend_support = 0;<br>
memset(this->atomic_counter_of<wbr>fsets, 0,<br>
@@ -687,6 +688,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extension<wbr>s[] = {<br>
EXT(EXT_texture_array),<br>
EXT_AEP(EXT_texture_buffer),<br>
EXT_AEP(EXT_texture_cube_map_a<wbr>rray),<br>
+ EXT(INTEL_conservative_raster<wbr>ization),<br>
EXT(MESA_shader_integer_functi<wbr>ons),<br>
EXT(NV_image_formats),<br>
};<br>
@@ -1692,6 +1694,7 @@ set_shader_inout_layout(struct gl_shader *shader,<br>
assert(!state->fs_pixel_cente<wbr>r_integer);<br>
assert(!state->fs_origin_uppe<wbr>r_left);<br>
assert(!state->fs_early_fragm<wbr>ent_tests);<br>
+ assert(!state->fs_inner_covera<wbr>ge);<br>
assert(!state->fs_post_depth_<wbr>coverage);<br>
}<br>
<br>
@@ -1813,6 +1816,7 @@ set_shader_inout_layout(struct gl_shader *shader,<br>
shader->info.ARB_fragment_coo<wbr>rd_conventions_enable =<br>
state->ARB_fragment_coord_conv<wbr>entions_enable;<br>
shader->info.EarlyFragmentTes<wbr>ts = state->fs_early_fragment_tests<wbr>;<br>
+ shader->info.InnerCoverage = state->fs_inner_coverage;<br>
shader->info.<wbr>PostDepthCoverage = state->fs_post_depth_coverage;<br>
shader->info.BlendSupport = state->fs_blend_support;<br>
break;<br>
diff --git a/src/compiler/glsl/glsl_parse<wbr>r_extras.h b/src/compiler/glsl/glsl_parse<wbr>r_extras.h<br>
index 4277d43..d6fc377 100644<br>
--- a/src/compiler/glsl/glsl_parse<wbr>r_extras.h<br>
+++ b/src/compiler/glsl/glsl_parse<wbr>r_extras.h<br>
@@ -761,6 +761,8 @@ struct _mesa_glsl_parse_state {<br>
bool EXT_texture_buffer_warn;<br>
bool EXT_texture_cube_map_array_ena<wbr>ble;<br>
bool EXT_texture_cube_map_array_war<wbr>n;<br>
+ bool INTEL_conservative_rasterizati<wbr>on_enable;<br>
+ bool INTEL_conservative_rasterizati<wbr>on_warn;<br>
bool MESA_shader_framebuffer_fetch_<wbr>enable;<br>
bool MESA_shader_framebuffer_fetch_<wbr>warn;<br>
bool MESA_shader_framebuffer_fetch_<wbr>non_coherent_enable;<br>
@@ -788,6 +790,8 @@ struct _mesa_glsl_parse_state {<br>
<br>
bool fs_early_fragment_tests;<br>
<br>
+ bool fs_inner_coverage;<br>
+<br>
bool fs_post_depth_coverage;<br>
<br>
unsigned fs_blend_support;<br>
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp<br>
index 39c5e07..f43ee97 100644<br>
--- a/src/compiler/glsl/linker.cpp<br>
+++ b/src/compiler/glsl/linker.cpp<br>
@@ -1888,6 +1888,9 @@ link_fs_inout_layout_qualifier<wbr>s(struct gl_shader_program *prog,<br>
linked_shader->info.EarlyFrag<wbr>mentTests |=<br>
shader->info.EarlyFragmentTest<wbr>s;<br>
<br>
+ linked_shader->info.InnerCover<wbr>age |=<br>
+ shader->info.InnerCoverage;<br>
+<br>
linked_shader->info.PostDepth<wbr>Coverage |=<br>
shader->info.PostDepthCoverage<wbr>;<br>
<br>
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h<br>
index b2830e0..768f053 100644<br>
--- a/src/compiler/shader_info.h<br>
+++ b/src/compiler/shader_info.h<br>
@@ -116,6 +116,12 @@ typedef struct shader_info {<br>
* ARB_shader_image_load_store.<br>
*/<br>
bool early_fragment_tests;<br>
+<br>
+ /**<br>
+ * Defined by INTEL_conservative_rasterizati<wbr>on.<br>
+ */<br>
+ bool inner_coverage;<br>
+<br>
bool post_depth_coverage;<br>
<br>
/** gl_FragDepth layout for ARB_conservative_depth. */<br>
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c<br>
index d3b4cab..95a9676 100644<br>
--- a/src/mesa/main/api_validate.c<br>
+++ b/src/mesa/main/api_validate.c<br>
@@ -555,6 +555,48 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)<br>
}<br>
}<br>
<br>
+ /* From GL_INTEL_conservative_rasteriz<wbr>ation spec:<br>
+ *<br>
+ * The conservative rasterization option applies only to polygons with<br>
+ * PolygonMode state set to FILL. Draw requests for polygons with different<br>
+ * PolygonMode setting or for other primitive types (points/lines) generate<br>
+ * INVALID_OPERATION error.<br>
+ */<br>
+ if (ctx->IntelConservativeRasteri<wbr>zation) {<br>
+ GLboolean pass = GL_TRUE;<br>
+<br>
+ switch (mode) {<br>
+ case GL_POINTS:<br>
+ case GL_LINES:<br>
+ case GL_LINE_LOOP:<br>
+ case GL_LINE_STRIP:<br>
+ case GL_LINES_ADJACENCY:<br>
+ case GL_LINE_STRIP_ADJACENCY:<br>
+ pass = GL_FALSE;<br>
+ break;<br>
+ case GL_TRIANGLES:<br>
+ case GL_TRIANGLE_STRIP:<br>
+ case GL_TRIANGLE_FAN:<br>
+ case GL_QUADS:<br>
+ case GL_QUAD_STRIP:<br>
+ case GL_POLYGON:<br>
+ case GL_TRIANGLES_ADJACENCY:<br>
+ case GL_TRIANGLE_STRIP_ADJACENCY:<br>
+ if (ctx->Polygon.FrontMode != GL_FILL ||<br>
+ ctx->Polygon.BackMode != GL_FILL)<br>
+ pass = GL_FALSE;<br>
+ break;<br>
+ default:<br>
+ pass = GL_FALSE;<br>
+ }<br>
+ if (!pass) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "mode=%s invalid with GL_INTEL_conservative_rasteriz<wbr>ation",<br>
+ _mesa_lookup_prim_by_nr(mode)<wbr>);<br>
+ return GL_FALSE;<br>
+ }<br>
+ }<br>
+<br>
return GL_TRUE;<br>
}<br>
<br>
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c<br>
index d1ab81e..c9f10ab 100644<br>
--- a/src/mesa/main/enable.c<br>
+++ b/src/mesa/main/enable.c<br>
@@ -439,6 +439,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
FLUSH_VERTICES(ctx, _NEW_COLOR);<br>
ctx->Color.IndexLogicOpEnabled = state;<br>
break;<br>
+ case GL_CONSERVATIVE_RASTERIZATION_<wbr>INTEL:<br>
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)<br>
+ goto invalid_enum_error;<br>
+ if (ctx->IntelConservativeRasteri<wbr>zation == state)<br>
+ return;<br>
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);<br>
+ ctx->IntelConservativeRasteri<wbr>zation = state;<br>
+ break;<br>
case GL_COLOR_LOGIC_OP:<br>
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)<br>
goto invalid_enum_error;<br>
@@ -1631,6 +1639,10 @@ _mesa_IsEnabled( GLenum cap )<br>
CHECK_EXTENSION(KHR_blend_equa<wbr>tion_advanced_coherent);<br>
return ctx->Color.BlendCoherent;<br>
<br>
+ case GL_CONSERVATIVE_RASTERIZATION_<wbr>INTEL:<br>
+ CHECK_EXTENSION(INTEL_conserv<wbr>ative_rasterization);<br>
+ return ctx->IntelConservativeRasteriz<wbr>ation;<br>
+<br>
default:<br>
goto invalid_enum_error;<br>
}<br>
diff --git a/src/mesa/main/extensions_tab<wbr>le.h b/src/mesa/main/extensions_tab<wbr>le.h<br>
index f2d3a5b..6756f7c 100644<br>
--- a/src/mesa/main/extensions_tab<wbr>le.h<br>
+++ b/src/mesa/main/extensions_tab<wbr>le.h<br>
@@ -290,6 +290,7 @@ EXT(IBM_texture_mirrored_repea<wbr>t , dummy_true<br>
<br>
EXT(INGR_blend_func_separate , EXT_blend_func_separate , GLL, x , x , x , 1999)<br>
<br>
+EXT(INTEL_conservative_raster<wbr>ization , INTEL_conservative_rasterizati<wbr>on , x , 42, x , 32, 2013)<br>
EXT(INTEL_performance_query , INTEL_performance_query , GLL, GLC, x , ES2, 2013)<br>
<br>
EXT(KHR_blend_equation_advanc<wbr>ed , KHR_blend_equation_advanced , GLL, GLC, x , ES2, 2014)<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index dfa9a78..e91a8ac 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -2175,6 +2175,7 @@ struct gl_shader_info<br>
bool uses_gl_fragcoord;<br>
bool redeclares_gl_fragcoord;<br>
bool PostDepthCoverage;<br>
+ bool InnerCoverage;<br>
bool ARB_fragment_coord_conventions<wbr>_enable;<br>
<br>
/**<br>
@@ -3935,6 +3936,7 @@ struct gl_extensions<br>
GLboolean ATI_fragment_shader;<br>
GLboolean ATI_separate_stencil;<br>
GLboolean GREMEDY_string_marker;<br>
+ GLboolean INTEL_conservative_rasterizati<wbr>on;<br>
GLboolean INTEL_performance_query;<br>
GLboolean KHR_blend_equation_advanced;<br>
GLboolean KHR_blend_equation_advanced_co<wbr>herent;<br>
@@ -4618,6 +4620,7 @@ struct gl_context<br>
GLboolean TextureFormatSupported[MESA_FO<wbr>RMAT_COUNT];<br>
<br>
GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */<br>
+ GLboolean IntelConservativeRasterization<wbr>; /**< GL_INTEL_CONSERVATIVE_RASTERIZ<wbr>ATION */<br>
<br>
/**<br>
* \name Hooks for module contexts.<br>
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>
index 33e4334..d8f2e79 100644<br>
--- a/src/mesa/main/shaderapi.c<br>
+++ b/src/mesa/main/shaderapi.c<br>
@@ -2194,6 +2194,7 @@ _mesa_copy_linked_program_data<wbr>(const struct gl_shader_program *src,<br>
case MESA_SHADER_FRAGMENT: {<br>
dst->info.fs.depth_layout = src->FragDepthLayout;<br>
dst->info.fs.early_fragment_t<wbr>ests = dst_sh->info.EarlyFragmentTest<wbr>s;<br>
+ dst->info.fs.inner_coverage = dst_sh->info.InnerCoverage;<br>
dst->info.fs.post_depth_cover<wbr>age = dst_sh->info.PostDepthCoverage<wbr>;<br>
break;<br>
}<br>
--<br>
2.10.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>
</div></blockquote></div><br></div>