<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 18, 2018 at 11:10 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</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"><br>
<br>
On 28/02/18 03:45, Marek Olšák wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Feb 26, 2018 at 10:43 AM, Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/compiler/shader_info.h | 5 +++++<br>
src/mesa/state_tracker/st_glsl<wbr>_to_nir.cpp | 13 +++++++++++++<br>
2 files changed, 18 insertions(+)<br>
<br>
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h<br>
index e7fd7dbe62..11a59ff6ac 100644<br>
--- a/src/compiler/shader_info.h<br>
+++ b/src/compiler/shader_info.h<br>
@@ -54,6 +54,11 @@ typedef struct shader_info {<br>
/** The shader stage, such as MESA_SHADER_VERTEX. */<br>
gl_shader_stage stage;<br>
<br>
+ /** The shader stage in a non SSO linked program that follows this stage,<br>
+ * such as MESA_SHADER_FRAGMENT.<br>
+ */<br>
+ gl_shader_stage next_stage;<br>
+<br>
/* Number of textures used by this shader */<br>
unsigned num_textures;<br>
/* Number of uniform buffers used by this shader */<br>
diff --git a/src/mesa/state_tracker/st_gl<wbr>sl_to_nir.cpp b/src/mesa/state_tracker/st_gl<wbr>sl_to_nir.cpp<br>
index 765c827d93..914fd2e898 100644<br>
--- a/src/mesa/state_tracker/st_gl<wbr>sl_to_nir.cpp<br>
+++ b/src/mesa/state_tracker/st_gl<wbr>sl_to_nir.cpp<br>
@@ -317,6 +317,19 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,<br>
<br>
nir_shader *nir = glsl_to_nir(shader_program, stage, options);<br>
<br>
+ /* Set the next shader stage hint for VS and TES. */<br>
+ if (!nir->info.separate_shader &&<br>
+ (nir->info.stage == MESA_SHADER_VERTEX ||<br>
+ nir->info.stage == MESA_SHADER_TESS_EVAL)) {<br>
+<br>
+ unsigned prev_stages = (1 << (prog->info.stage + 1)) - 1;<br>
+ unsigned stages_mask =<br>
+ ~prev_stages & shader_program->data->linked_s<wbr>tages;<br>
+<br>
+ nir->info.next_stage = stages_mask ?<br>
+ (gl_shader_stage) u_bit_scan(&stages_mask) : MESA_SHADER_FRAGMENT;<br>
</blockquote>
<br>
ffs would be better.<br>
<br>
Also, ureg sets ..._SHADER_FRAGMENT if st/mesa doesn't set anything<br>
(e.g. it's a separate shader).<br>
</blockquote>
<br></div></div>
Yes the ureg function does that, which is what the "stages_mask ?" above does too. However separate shaders don't get set because ureg_set_next_shader_processor<wbr>() won't get called for them.<span class=""><br>
<br>
/* Set the next shader stage hint for VS and TES. */<br></span>
switch (procType) {<br>
case PIPE_SHADER_VERTEX:<br>
case PIPE_SHADER_TESS_EVAL:<br>
if (program->shader_program->Sepa<wbr>rateShader)<br>
break;<br>
<br>
for (i = program->shader->Stage+1; i <= MESA_SHADER_FRAGMENT; i++) {<br>
if (program->shader_program->_Lin<wbr>kedShaders[i]) {<br>
ureg_set_next_shader_processor<wbr>(<br>
ureg, pipe_shader_type_from_mesa((gl<wbr>_shader_stage)i));<br>
break;<br>
}<br>
}<br>
break;<br>
}<br></blockquote><div><br></div><div>Not here. See tgsi_ureg.c. It defaults to FRAGMENT.</div><div><br></div><div>Marek<br></div></div></div></div>