<div dir="ltr">Excellent, disregard that. Patch looks good.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 3:10 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"><span class="">On Wed, Nov 30, 2016 at 9:10 PM, Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>> wrote:<br>
> This patch misses adding the #define to the GLSL preprocessor. Other than<br>
<br>
</span>The future is today. That's no longer necessary :)<br>
<div class="HOEnZb"><div class="h5"><br>
> that it looks good though, so with that fixed:<br>
><br>
> Reviewed-by: Chris Forbes <<a href="mailto:chrisforbes@google.com">chrisforbes@google.com</a>><br>
><br>
> On Thu, Dec 1, 2016 at 8:53 AM, Plamena Manolova<br>
> <<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>> 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">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.cpp      | 9 ++++++++-<br>
>> src/compiler/glsl/glsl_parser.<wbr>yy     | 18 ++++++++++++++++++<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, 53 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h<br>
>> index afe91ea..df3a744 100644<br>
>> --- a/src/compiler/glsl/ast.h<br>
>> +++ b/src/compiler/glsl/ast.h<br>
>> @@ -605,6 +605,11 @@ struct ast_type_qualifier {<br>
>>Â Â Â Â Â Â /** \{ */<br>
>>Â Â Â Â Â Â unsigned blend_support:1; /**< Are there any blend_support_<br>
>> qualifiers */<br>
>>Â Â Â Â Â Â /** \} */<br>
>> +<br>
>> +Â Â Â Â Â /**<br>
>> +Â Â Â Â Â * Flag set if GL_ARB_post_depth_coverage layout qualifier is<br>
>> 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<br>
>> b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
>> index c2ce389..2434ce5 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<br>
>> ast_type_qualifier *qual,<br>
>>Â Â Â Â _mesa_glsl_error(loc, state, "early_fragment_tests layout qualifier<br>
>> only "<br>
>>Â Â Â Â Â Â Â Â Â Â Â Â Â "valid in fragment shader input layout<br>
>> declaration.");<br>
>>Â Â Â }<br>
>> +<br>
>> +Â Â if (qual->flags.q.post_depth_<wbr>coverage) {<br>
>> +Â Â Â _mesa_glsl_error(loc, state, "post_depth_coverage layout qualifier<br>
>> only "<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â "valid in fragment shader input layout<br>
>> declaration.");<br>
>> +Â Â }<br>
>>Â }<br>
>><br>
>>Â static void<br>
>> diff --git a/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> b/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> index 3431e24..aa1ae7e 100644<br>
>> --- a/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> +++ b/src/compiler/glsl/ast_type.<wbr>cpp<br>
>> @@ -579,6 +579,7 @@ ast_type_qualifier::validate_<wbr>in_qualifier(YYLTYPE<br>
>> *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>
>>Â Â Â Â valid_in_mask.flags.q.local_<wbr>size = 7;<br>
>> @@ -633,6 +634,11 @@ ast_type_qualifier::merge_<wbr>into_in_qualifier(YYLTYPE<br>
>> *loc,<br>
>>Â Â Â Â state->in_qualifier->flags.q.<wbr>early_fragment_tests = 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>
>>Â Â Â /* We allow the creation of multiple cs_input_layout nodes. Coherence<br>
>> among<br>
>>Â Â Â * all existing nodes is checked later, when the AST node is<br>
>> transformed<br>
>>Â Â Â * into HIR.<br>
>> @@ -761,7 +767,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 ? "<br>
>> post_depth_coverage" : "");<br>
>>Â Â Â return false;<br>
>>Â }<br>
>><br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> b/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> index 0c3781c..09b7e79 100644<br>
>> --- a/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> +++ b/src/compiler/glsl/glsl_<wbr>parser.yy<br>
>> @@ -1392,6 +1392,24 @@ layout_qualifier_id:<br>
>><br>
>>Â Â Â Â Â Â Â $$.flags.q.early_fragment_<wbr>tests = 1;<br>
>>Â Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â if (!$$.flags.i &&<br>
>> +Â Â Â Â Â Â Â match_layout_qualifier($1, "post_depth_coverage", state) ==<br>
>> 0) {<br>
>> +Â Â Â Â Â Â if (state->stage != MESA_SHADER_FRAGMENT) {<br>
>> +Â Â Â Â Â Â Â Â _mesa_glsl_error(& @1, state,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "post_depth_coverage layout qualifier<br>
>> only "<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "valid in fragment shaders");<br>
>> +Â Â Â Â Â Â }<br>
>> +<br>
>> +Â Â Â Â Â Â if (state->ARB_post_depth_<wbr>coverage_enable) {<br>
>> +Â Â Â Â Â Â Â Â $$.flags.q.post_depth_coverage = 1;<br>
>> +Â Â Â Â Â Â } else {<br>
>> +Â Â Â Â Â Â Â Â _mesa_glsl_error(& @1, state,<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "post_depth_coverage layout qualifier<br>
>> present, "<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "but the GL_ARB_post_depth_coverage<br>
>> extension "<br>
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "is not enabled.");<br>
>> +Â Â Â Â Â Â }<br>
>> +Â Â Â Â Â }<br>
>>Â Â Â Â }<br>
>><br>
>>Â Â Â Â /* Layout qualifiers for tessellation evaluation shaders. */<br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> b/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> index 1e0298e..d1fc98d 100644<br>
>> --- a/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> +++ b/src/compiler/glsl/glsl_<wbr>parser_extras.cpp<br>
>> @@ -293,6 +293,7 @@ _mesa_glsl_parse_state::_mesa_<wbr>glsl_parse_state(struct<br>
>> 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>
>> @@ -606,6 +607,7 @@ static const _mesa_glsl_extension<br>
>> _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_counter_<wbr>ops),<br>
>> @@ -1690,6 +1692,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>
>><br>
>>Â Â Â for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) {<br>
>> @@ -1810,6 +1813,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>
>><br>
>> diff --git a/src/compiler/glsl/glsl_<wbr>parser_extras.h<br>
>> 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>
>><br>
>>Â Â Â bool fs_early_fragment_tests;<br>
>><br>
>> +Â Â bool fs_post_depth_coverage;<br>
>> +<br>
>>Â Â Â unsigned fs_blend_support;<br>
>><br>
>>Â Â Â /**<br>
>> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp<br>
>> index 764938b..39c5e07 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<br>
>> gl_shader_program *prog,<br>
>><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>
>><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<br>
>> 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      ,<br>
>> ARB_pipeline_statistics_query<br>
>> EXT(ARB_pixel_buffer_object         , EXT_pixel_buffer_object<br>
>> , GLL, GLC, x , x , 2004)<br>
>> EXT(ARB_point_parameters          , EXT_point_parameters<br>
>> , GLL, x , x , x , 1997)<br>
>> EXT(ARB_point_sprite            , ARB_point_sprite<br>
>> , GLL, GLC, x , x , 2003)<br>
>> +EXT(ARB_post_depth_coverage         , ARB_post_depth_coverage<br>
>> , x , 32, x , x, 2015)<br>
>> EXT(ARB_program_interface_<wbr>query       , dummy_true<br>
>> , GLL, GLC, x , x , 2012)<br>
>> EXT(ARB_provoking_vertex          , EXT_provoking_vertex<br>
>> , GLL, GLC, x , x , 2009)<br>
>> EXT(ARB_query_buffer_object         , ARB_query_buffer_object<br>
>> , GLL, GLC, x , x , 2013)<br>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
>> index 250877d..dfa9a78 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>
>>Â Â Â /**<br>
>> @@ -3818,6 +3819,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<br>
>> 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 =<br>
>> 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>
>> 2.7.4<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> mesa-dev mailing list<br>
>> <a href="mailto:mesa-dev@lists.freedesktop.org">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>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">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>
><br>
</div></div></blockquote></div><br></div>