<div dir="ltr">Thank you for reviewing guys! I'll go ahead and make that change.<div><br></div><div>Pam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 30, 2016 at 3:33 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><p dir="ltr">On Nov 30, 2016 7:17 AM, "Lionel Landwerlin" <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>> wrote:<br>
><br>
> On 22/11/16 21:53, Plamena Manolova wrote:<br>
>><br>
>> This extension allows the fragment shader to control whether values in<br>
>> gl_SampleMaskIn[] reflect the coverage after application of the early<br>
>> depth and stencil tests.<br>
>><br>
>> Signed-off-by: Plamena Manolova <<a href="mailto:plamena.manolova@intel.com" target="_blank">plamena.manolova@intel.com</a>><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 | 8 +++++++-<br>
>> src/compiler/glsl/glsl_parser.<wbr>yy | 11 +++++++++++<br>
>> src/compiler/glsl/glsl_parser_<wbr>extras.cpp | 4 ++++<br>
>> src/compiler/glsl/glsl_parser_<wbr>extras.h | 4 ++++<br>
>> src/compiler/glsl/linker.cpp | 4 ++++<br>
>> src/compiler/shader_info.h | 1 +<br>
>> src/mesa/main/extensions_<wbr>table.h | 1 +<br>
>> src/mesa/main/mtypes.h | 2 ++<br>
>> src/mesa/main/shaderapi.c | 1 +<br>
>> 11 files changed, 45 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h<br>
>> index 55f9a6c..ad19493 100644<br>
>> --- a/src/compiler/glsl/ast.h<br>
>> +++ b/src/compiler/glsl/ast.h<br>
>> @@ -606,6 +606,11 @@ struct ast_type_qualifier {<br>
>> /** \{ */<br>
>> unsigned blend_support:1; /**< Are there any blend_support_ qualifiers */<br>
>> /** \} */<br>
>> +<br>
>> + /**<br>
>> + * Flag set if GL_ARB_post_depth_coverage layout qualifier is used.<br>
>> + */<br>
>> + unsigned post_depth_coverage:1;<br>
>> }<br>
>> /** \brief Set of flags, accessed by name. */<br>
>> q;<br>
>> diff --git a/src/compiler/glsl/ast_to_<wbr>hir.cpp b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
>> index 9b8678c..c31da86 100644<br>
>> --- a/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
>> +++ b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
>> @@ -3632,6 +3632,11 @@ apply_layout_qualifier_to_<wbr>variable(const struct ast_type_qualifier *qual,<br>
>> _mesa_glsl_error(loc, state, "early_fragment_tests layout qualifier only "<br>
>> "valid in fragment shader input layout declaration.");<br>
>> }<br>
>> +<br>
>> + if (qual->flags.q.post_depth_<wbr>coverage) {<br>
>> + _mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier only "<br>
>> + "valid in fragment shader input layout declaration.");<br>
>> + }<br>
>> }<br>
>> static void<br>
>> diff --git a/src/compiler/glsl/ast_type.<wbr>cpp b/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> index 2856f18..1905721 100644<br>
>> --- a/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> +++ b/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> @@ -489,6 +489,7 @@ ast_type_qualifier::merge_in_<wbr>qualifier(YYLTYPE *loc,<br>
>> break;<br>
>> case MESA_SHADER_FRAGMENT:<br>
>> valid_in_mask.flags.q.early_<wbr>fragment_tests = 1;<br>
>> + valid_in_mask.flags.q.post_<wbr>depth_coverage = 1;<br>
>> break;<br>
>> case MESA_SHADER_COMPUTE:<br>
>> create_cs_ast |=<br>
>> @@ -540,6 +541,10 @@ ast_type_qualifier::merge_in_<wbr>qualifier(YYLTYPE *loc,<br>
>> state->fs_early_fragment_tests = true;<br>
>> }<br>
>> + if (q.flags.q.post_depth_<wbr>coverage) {<br>
>> + state->fs_post_depth_coverage = true;<br>
>> + }<br>
>> +<br>
>> if (this->flags.q.vertex_spacing) {<br>
>> if (q.flags.q.vertex_spacing &&<br>
>> this->vertex_spacing != q.vertex_spacing) {<br>
>> @@ -671,7 +676,8 @@ ast_type_qualifier::validate_<wbr>flags(YYLTYPE *loc,<br>
>> bad.flags.q.point_mode ? " point_mode" : "",<br>
>> bad.flags.q.vertices ? " vertices" : "",<br>
>> bad.flags.q.subroutine ? " subroutine" : "",<br>
>> - bad.flags.q.subroutine_def ? " subroutine_def" : "");<br>
>> + bad.flags.q.subroutine_def ? " subroutine_def" : "",<br>
>> + bad.flags.q.post_depth_<wbr>coverage ? " post_depth_coverage" : "");<br>
>> return false;<br>
>> }<br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser.yy b/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> index a48dc68..a53f476 100644<br>
>> --- a/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> +++ b/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> @@ -1373,6 +1373,17 @@ layout_qualifier_id:<br>
>> $$.flags.q.early_fragment_<wbr>tests = 1;<br>
>> }<br>
><br>
><br>
> I wonder if the following check should include state-> ARB_post_depth_coverage_enable as condition before matching the layout qualifier.<br>
> Maybe Ilia can confirm?</p>
</div></div><p dir="ltr">Sounds right. A shader without the enable but wit the layout qualifier should fail to compile. There should be a test in piglit to that effect with glslparsertest.</p><div class="HOEnZb"><div class="h5">
<p dir="ltr">><br>
> Thanks!<br>
><br>
><br>
>> +<br>
>> + if (!$$.flags.i &&<br>
>> + 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>
>> + $$.flags.q.post_depth_coverage = 1;<br>
>> + }<br>
>> }<br>
>> /* Layout qualifiers for tessellation evaluation shaders. */<br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser_extras.cpp b/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> index 85a2e94..bc252a0 100644<br>
>> --- a/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> +++ b/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> @@ -295,6 +295,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_post_depth_coverage = false;<br>
>> this->fs_blend_support = 0;<br>
>> memset(this->atomic_counter_<wbr>offsets, 0,<br>
>> sizeof(this->atomic_counter_<wbr>offsets));<br>
>> @@ -608,6 +609,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_<wbr>extensions[] = {<br>
>> EXT(ARB_fragment_layer_<wbr>viewport),<br>
>> EXT(ARB_gpu_shader5),<br>
>> EXT(ARB_gpu_shader_fp64),<br>
>> + EXT(ARB_post_depth_coverage),<br>
>> EXT(ARB_sample_shading),<br>
>> EXT(ARB_separate_shader_<wbr>objects),<br>
>> EXT(ARB_shader_atomic_<wbr>counter_ops),<br>
>> @@ -1692,6 +1694,7 @@ set_shader_inout_layout(struct gl_shader *shader,<br>
>> assert(!state->fs_pixel_<wbr>center_integer);<br>
>> assert(!state->fs_origin_<wbr>upper_left);<br>
>> assert(!state->fs_early_<wbr>fragment_tests);<br>
>> + assert(!state->fs_post_depth_<wbr>coverage);<br>
>> }<br>
>> for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) {<br>
>> @@ -1812,6 +1815,7 @@ set_shader_inout_layout(struct gl_shader *shader,<br>
>> shader->info.ARB_fragment_<wbr>coord_conventions_enable =<br>
>> state->ARB_fragment_coord_<wbr>conventions_enable;<br>
>> shader->info.<wbr>EarlyFragmentTests = state->fs_early_fragment_<wbr>tests;<br>
>> + shader->info.PostDepthCoverage = state->fs_post_depth_coverage;<br>
>> shader->info.BlendSupport = state->fs_blend_support;<br>
>> break;<br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser_extras.h b/src/compiler/glsl/glsl_<wbr>parser_extras.h<br>
>> index d757c1d..4277d43 100644<br>
>> --- a/src/compiler/glsl/glsl_<wbr>parser_extras.h<br>
>> +++ b/src/compiler/glsl/glsl_<wbr>parser_extras.h<br>
>> @@ -610,6 +610,8 @@ struct _mesa_glsl_parse_state {<br>
>> bool ARB_gpu_shader5_warn;<br>
>> bool ARB_gpu_shader_fp64_enable;<br>
>> bool ARB_gpu_shader_fp64_warn;<br>
>> + bool ARB_post_depth_coverage_<wbr>enable;<br>
>> + bool ARB_post_depth_coverage_warn;<br>
>> bool ARB_sample_shading_enable;<br>
>> bool ARB_sample_shading_warn;<br>
>> bool ARB_separate_shader_objects_<wbr>enable;<br>
>> @@ -786,6 +788,8 @@ struct _mesa_glsl_parse_state {<br>
>> bool fs_early_fragment_tests;<br>
>> + bool fs_post_depth_coverage;<br>
>> +<br>
>> unsigned fs_blend_support;<br>
>> /**<br>
>> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp<br>
>> index 1a00a90..d127d0c 100644<br>
>> --- a/src/compiler/glsl/linker.cpp<br>
>> +++ b/src/compiler/glsl/linker.cpp<br>
>> @@ -1887,6 +1887,10 @@ link_fs_inout_layout_<wbr>qualifiers(struct gl_shader_program *prog,<br>
>> linked_shader->info.<wbr>EarlyFragmentTests |=<br>
>> shader->info.<wbr>EarlyFragmentTests;<br>
>> +<br>
>> + linked_shader->info.<wbr>PostDepthCoverage |=<br>
>> + shader->info.<wbr>PostDepthCoverage;<br>
>> +<br>
>> linked_shader->info.<wbr>BlendSupport |= shader->info.BlendSupport;<br>
>> }<br>
>> }<br>
>> diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h<br>
>> index 7ea5d9c..b2830e0 100644<br>
>> --- a/src/compiler/shader_info.h<br>
>> +++ b/src/compiler/shader_info.h<br>
>> @@ -116,6 +116,7 @@ typedef struct shader_info {<br>
>> * ARB_shader_image_load_store.<br>
>> */<br>
>> bool early_fragment_tests;<br>
>> + bool post_depth_coverage;<br>
>> /** gl_FragDepth layout for ARB_conservative_depth. */<br>
>> enum gl_frag_depth_layout depth_layout;<br>
>> diff --git a/src/mesa/main/extensions_<wbr>table.h b/src/mesa/main/extensions_<wbr>table.h<br>
>> index d3ec551..f2d3a5b 100644<br>
>> --- a/src/mesa/main/extensions_<wbr>table.h<br>
>> +++ b/src/mesa/main/extensions_<wbr>table.h<br>
>> @@ -93,6 +93,7 @@ EXT(ARB_pipeline_statistics_<wbr>query , ARB_pipeline_statistics_query<br>
>> EXT(ARB_pixel_buffer_object , EXT_pixel_buffer_object , GLL, GLC, x , x , 2004)<br>
>> EXT(ARB_point_parameters , EXT_point_parameters , GLL, x , x , x , 1997)<br>
>> EXT(ARB_point_sprite , ARB_point_sprite , GLL, GLC, x , x , 2003)<br>
>> +EXT(ARB_post_depth_coverage , ARB_post_depth_coverage , x , 32, x , x, 2015)<br>
>> EXT(ARB_program_interface_<wbr>query , dummy_true , GLL, GLC, x , x , 2012)<br>
>> EXT(ARB_provoking_vertex , EXT_provoking_vertex , GLL, GLC, x , x , 2009)<br>
>> EXT(ARB_query_buffer_object , ARB_query_buffer_object , GLL, GLC, x , x , 2013)<br>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
>> index 26b1965..9d50304 100644<br>
>> --- a/src/mesa/main/mtypes.h<br>
>> +++ b/src/mesa/main/mtypes.h<br>
>> @@ -2174,6 +2174,7 @@ struct gl_shader_info<br>
>> {<br>
>> bool uses_gl_fragcoord;<br>
>> bool redeclares_gl_fragcoord;<br>
>> + bool PostDepthCoverage;<br>
>> bool ARB_fragment_coord_<wbr>conventions_enable;<br>
>> /**<br>
>> @@ -3815,6 +3816,7 @@ struct gl_extensions<br>
>> GLboolean ARB_occlusion_query2;<br>
>> GLboolean ARB_pipeline_statistics_query;<br>
>> GLboolean ARB_point_sprite;<br>
>> + GLboolean ARB_post_depth_coverage;<br>
>> GLboolean ARB_query_buffer_object;<br>
>> GLboolean ARB_robust_buffer_access_<wbr>behavior;<br>
>> GLboolean ARB_sample_shading;<br>
>> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>
>> index 83ee0d4..33e4334 100644<br>
>> --- a/src/mesa/main/shaderapi.c<br>
>> +++ b/src/mesa/main/shaderapi.c<br>
>> @@ -2194,6 +2194,7 @@ _mesa_copy_linked_program_<wbr>data(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_<wbr>tests = dst_sh->info.<wbr>EarlyFragmentTests;<br>
>> + dst->info.fs.post_depth_<wbr>coverage = dst_sh->info.<wbr>PostDepthCoverage;<br>
>> break;<br>
>> }<br>
>> case MESA_SHADER_COMPUTE: {<br>
><br>
><br>
></p>
</div></div></blockquote></div><br></div>