<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Also forgot that (like Ilia suggested
for NV_image_formats) you can update docs/relnotes/ to list the
new feature.<br>
<br>
Cheers,<br>
<br>
-<br>
Lionel<br>
<br>
On 30/11/16 13:33, Ilia Mirkin wrote:<br>
</div>
<blockquote
cite="mid:CAKb7UvgdR3hkG=xaDiFimTwUtZz56-vRRZ3d6ELJGZW1goXa3Q@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p dir="ltr">On Nov 30, 2016 7:17 AM, "Lionel Landwerlin" <<a
moz-do-not-send="true"
href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>>
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
moz-do-not-send="true"
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.cpp | 5 +++++<br>
>> src/compiler/glsl/ast_type.cpp | 8
+++++++-<br>
>> src/compiler/glsl/glsl_parser.yy | 11
+++++++++++<br>
>> src/compiler/glsl/glsl_parser_extras.cpp | 4 ++++<br>
>> src/compiler/glsl/glsl_parser_extras.h | 4 ++++<br>
>> src/compiler/glsl/linker.cpp | 4 ++++<br>
>> src/compiler/shader_info.h | 1 +<br>
>> src/mesa/main/extensions_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_hir.cpp
b/src/compiler/glsl/ast_to_hir.cpp<br>
>> index 9b8678c..c31da86 100644<br>
>> --- a/src/compiler/glsl/ast_to_hir.cpp<br>
>> +++ b/src/compiler/glsl/ast_to_hir.cpp<br>
>> @@ -3632,6 +3632,11 @@
apply_layout_qualifier_to_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_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.cpp
b/src/compiler/glsl/ast_type.cpp<br>
>> index 2856f18..1905721 100644<br>
>> --- a/src/compiler/glsl/ast_type.cpp<br>
>> +++ b/src/compiler/glsl/ast_type.cpp<br>
>> @@ -489,6 +489,7 @@
ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,<br>
>> break;<br>
>> case MESA_SHADER_FRAGMENT:<br>
>> valid_in_mask.flags.q.early_fragment_tests = 1;<br>
>> + valid_in_mask.flags.q.post_depth_coverage = 1;<br>
>> break;<br>
>> case MESA_SHADER_COMPUTE:<br>
>> create_cs_ast |=<br>
>> @@ -540,6 +541,10 @@
ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,<br>
>> state->fs_early_fragment_tests = true;<br>
>> }<br>
>> + if (q.flags.q.post_depth_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_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_coverage ?
" post_depth_coverage" : "");<br>
>> return false;<br>
>> }<br>
>> diff --git a/src/compiler/glsl/glsl_parser.yy
b/src/compiler/glsl/glsl_parser.yy<br>
>> index a48dc68..a53f476 100644<br>
>> --- a/src/compiler/glsl/glsl_parser.yy<br>
>> +++ b/src/compiler/glsl/glsl_parser.yy<br>
>> @@ -1373,6 +1373,17 @@ layout_qualifier_id:<br>
>> $$.flags.q.early_fragment_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>
<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>
<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_parser_extras.cpp
b/src/compiler/glsl/glsl_parser_extras.cpp<br>
>> index 85a2e94..bc252a0 100644<br>
>> --- a/src/compiler/glsl/glsl_parser_extras.cpp<br>
>> +++ b/src/compiler/glsl/glsl_parser_extras.cpp<br>
>> @@ -295,6 +295,7 @@
_mesa_glsl_parse_state::_mesa_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_offsets, 0,<br>
>> sizeof(this->atomic_counter_offsets));<br>
>> @@ -608,6 +609,7 @@ static const _mesa_glsl_extension
_mesa_glsl_supported_extensions[] = {<br>
>> EXT(ARB_fragment_layer_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_objects),<br>
>> EXT(ARB_shader_atomic_counter_ops),<br>
>> @@ -1692,6 +1694,7 @@ set_shader_inout_layout(struct
gl_shader *shader,<br>
>> assert(!state->fs_pixel_center_integer);<br>
>> assert(!state->fs_origin_upper_left);<br>
>> assert(!state->fs_early_fragment_tests);<br>
>> + assert(!state->fs_post_depth_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_coord_conventions_enable =<br>
>>
state->ARB_fragment_coord_conventions_enable;<br>
>> shader->info.EarlyFragmentTests =
state->fs_early_fragment_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_parser_extras.h
b/src/compiler/glsl/glsl_parser_extras.h<br>
>> index d757c1d..4277d43 100644<br>
>> --- a/src/compiler/glsl/glsl_parser_extras.h<br>
>> +++ b/src/compiler/glsl/glsl_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_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_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_qualifiers(struct gl_shader_program *prog,<br>
>> linked_shader->info.EarlyFragmentTests |=<br>
>> shader->info.EarlyFragmentTests;<br>
>> +<br>
>> + linked_shader->info.PostDepthCoverage |=<br>
>> + shader->info.PostDepthCoverage;<br>
>> +<br>
>> linked_shader->info.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_table.h
b/src/mesa/main/extensions_table.h<br>
>> index d3ec551..f2d3a5b 100644<br>
>> --- a/src/mesa/main/extensions_table.h<br>
>> +++ b/src/mesa/main/extensions_table.h<br>
>> @@ -93,6 +93,7 @@ EXT(ARB_pipeline_statistics_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_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_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_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_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_tests =
dst_sh->info.EarlyFragmentTests;<br>
>> + dst->info.fs.post_depth_coverage =
dst_sh->info.PostDepthCoverage;<br>
>> break;<br>
>> }<br>
>> case MESA_SHADER_COMPUTE: {<br>
><br>
><br>
></p>
</blockquote>
<p><br>
</p>
</body>
</html>