<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 4:35 PM, Caio Marcelo de Oliveira Filho <span dir="ltr"><<a href="mailto:caio.oliveira@intel.com" target="_blank">caio.oliveira@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">From: Gustavo Lima Chaves <<a href="mailto:gustavo.lima.chaves@intel.com">gustavo.lima.chaves@intel.com</a><wbr>><br>
<br>
v2:<br>
An attempt to support SpvExecutionModeStencilRefRepl<wbr>acingEXT's behavior<br>
also follows, with the interpretation to said mode being we prevent<br>
writes to the built-in FragStencilRefEXT variable when the execution<br>
mode isn't set.<br>
<br>
v3:<br>
A more cautious reading of 1db44252d01bf7539452ccc2b5210c<wbr>74b8dcd573 led<br>
me to a missing change that would stop (what I later discovered were)<br>
GPU hangs on the CTS test written to exercise this.<br>
<br>
v4:<br>
Turn FragStencilRefEXT decoration usage without StencilRefReplacingEXT<br>
mode into a warning, instead of trying to make the variable read-only.<br>
If we are to follow the originating extension on GL, the built-in<br>
variable in question should never be readable anyway.<br>
<br>
v5/v6: rebases.<br>
<br>
v7:<br>
Fix check for gen9 lost in rebase. (Ilia)<br>
Reduce the scope of the bool used to track whether<br>
SpvExecutionModeStencilRefRepl<wbr>acingEXT was used. Was in shader_info,<br>
moved to vtn_builder. (Jason)<br>
<br>
</span>v8:<br>
Assert for fragment shader handling StencilRefReplacingEXT execution<br>
mode. (Caio)<br>
Remove warning logic, since an entry point might not have<br>
StencilRefReplacingEXT execution mode, but the global output variable<br>
might still exist for another entry point in the module. (Jason)<br>
---<br>
<span class=""> src/compiler/shader_info.h | 1 +<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 8 ++++++++<br>
</span> src/compiler/spirv/vtn_<wbr>variables.c | 4 ++++<br>
3 files changed, 13 insertions(+)<br>
<span class=""><br>
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h<br>
index afc53a88405..81f844d36ae 100644<br>
--- a/src/compiler/shader_info.h<br>
+++ b/src/compiler/shader_info.h<br>
@@ -56,6 +56,7 @@ struct spirv_supported_capabilities {<br>
bool trinary_minmax;<br>
bool descriptor_array_dynamic_<wbr>indexing;<br>
bool runtime_descriptor_array;<br>
+ bool stencil_export;<br>
};<br>
<br>
typedef struct shader_info {<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
</span>index 78437428aa7..3c3ef4658d6 100644<br>
<span class="">--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -3396,6 +3396,10 @@ vtn_handle_preamble_<wbr>instruction(struct vtn_builder *b, SpvOp opcode,<br>
spv_check_supported(runtime_<wbr>descriptor_array, cap);<br>
break;<br>
<br>
+ case SpvCapabilityStencilExportEXT:<br>
+ spv_check_supported(stencil_<wbr>export, cap);<br>
+ break;<br>
+<br>
default:<br>
vtn_fail("Unhandled capability");<br>
}<br>
@@ -3573,6 +3577,10 @@ vtn_handle_execution_mode(<wbr>struct vtn_builder *b, struct vtn_value *entry_point,<br>
case SpvExecutionModeContractionOff<wbr>:<br>
break; /* OpenCL */<br>
<br>
+ case SpvExecutionModeStencilRefRepl<wbr>acingEXT:<br>
</span>+ vtn_assert(b->shader->info.<wbr>stage == MESA_SHADER_FRAGMENT);<br>
<span class="">+ break;<br>
+<br>
default:<br>
vtn_fail("Unhandled execution mode");<br>
}<br>
</span>diff --git a/src/compiler/spirv/vtn_<wbr>variables.c b/src/compiler/spirv/vtn_<wbr>variables.c<br>
index fd8ab7f247a..53bee1b9288 100644<br>
<span class="im HOEnZb">--- a/src/compiler/spirv/vtn_<wbr>variables.c<br>
+++ b/src/compiler/spirv/vtn_<wbr>variables.c<br>
@@ -1354,6 +1354,10 @@ vtn_get_builtin_location(<wbr>struct vtn_builder *b,<br>
*location = SYSTEM_VALUE_SUBGROUP_LT_MASK,<br>
set_mode_system_value(b, mode);<br>
break;<br>
+ case SpvBuiltInFragStencilRefEXT:<br>
+ *location = FRAG_RESULT_STENCIL;<br>
+ vtn_assert(*mode == nir_var_shader_out);<br>
+ break;<br>
default:<br>
vtn_fail("unsupported builtin");<br>
}<br>
</span><div class="HOEnZb"><div class="h5">-- <br>
2.17.0<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>
</div></div></blockquote></div><br></div>