<div dir="ltr">On 23 March 2013 10:59, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 03/21/2013 05:40 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This patch modifies post-GS pipeline stages (transform feedback, clip,<br>
sf, fs) to refer to the VUE map through brw->vue_map_geom_out rather<br>
than brw->vs.prog_data->vue_map. This ensures that when geometry<br>
shader support is added, these pipeline stages will consult the<br>
geometry shader output VUE map when appropriate, rather than the<br>
vertex shader output VUE map.<br>
---<br>
src/mesa/drivers/dri/i965/brw_<u></u>clip.c | 7 +++----<br>
src/mesa/drivers/dri/i965/brw_<u></u>sf.c | 7 +++----<br>
src/mesa/drivers/dri/i965/brw_<u></u>state.h | 2 +-<br>
src/mesa/drivers/dri/i965/brw_<u></u>wm.c | 6 +++---<br>
src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c | 10 +++++-----<br>
src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c | 8 ++++----<br>
src/mesa/drivers/dri/i965/<u></u>gen7_sol_state.c | 14 +++++++-------<br>
7 files changed, 26 insertions(+), 28 deletions(-)<br>
</blockquote>
<br></div>
I heartily approve of this patch :) It really untangles the mess of VS dependencies.<br>
<br>
Some comments below...<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_clip.c b/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
index e20f7c2..fa7e85d 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
@@ -69,7 +69,7 @@ static void compile_clip_prog( struct brw_context *brw,<br>
c.func.single_program_flow = 1;<br>
<br>
c.key = *key;<br>
</blockquote>
> - c.vue_map = brw->vs.prog_data->vue_map;<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ c.vue_map = brw->vue_map_geom_out;<br>
<br>
/* nr_regs is the number of registers filled by reading data from the VUE.<br>
* This program accesses the entire VUE, so nr_regs needs to be the size of<br>
@@ -146,7 +146,7 @@ brw_upload_clip_prog(struct brw_context *brw)<br>
/* BRW_NEW_REDUCED_PRIMITIVE */<br>
key.primitive = brw->intel.reduced_primitive;<br>
/* CACHE_NEW_VS_PROG (also part of VUE map) */<br>
- key.attrs = brw->vs.prog_data->vue_map.<u></u>slots_valid;<br>
+ key.attrs = brw->vue_map_geom_out.slots_<u></u>valid;<br>
</blockquote>
<br></div>
This comment is now wrong. It should be<br>
/* BRW_NEW_VUE_MAP_GEOM_OUT */ not /* CACHE_NEW_VS_PROG */.</blockquote><div><br></div><div>Oops, you're right. I'll fix before pushing.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/* _NEW_LIGHT */<br>
key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);<br>
key.pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);<br>
@@ -258,8 +258,7 @@ const struct brw_tracked_state brw_clip_prog = {<br>
_NEW_TRANSFORM |<br>
_NEW_POLYGON |<br>
_NEW_BUFFERS),<br>
- .brw = (BRW_NEW_REDUCED_PRIMITIVE),<br>
- .cache = CACHE_NEW_VS_PROG<br>
</blockquote>
<br></div>
...and I think this was actually the last use of CACHE_NEW_VS_PROG, so you can probably eliminate that.</blockquote><div><br></div><div>Actually I did (note the "-" at the beginning of the line above).<br></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ .brw = (BRW_NEW_REDUCED_PRIMITIVE | BRW_NEW_VUE_MAP_GEOM_OUT)<br>
},<br>
.emit = brw_upload_clip_prog<br>
};<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_sf.c b/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
index c8b7033..fc36961 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
@@ -65,7 +65,7 @@ static void compile_sf_prog( struct brw_context *brw,<br>
brw_init_compile(brw, &c.func, mem_ctx);<br>
<br>
c.key = *key;<br>
- c.vue_map = brw->vs.prog_data->vue_map;<br>
+ c.vue_map = brw->vue_map_geom_out;<br>
if (c.key.do_point_coord) {<br>
/*<br>
* gl_PointCoord is a FS instead of VS builtin variable, thus it's<br>
@@ -145,7 +145,7 @@ brw_upload_sf_prog(struct brw_context *brw)<br>
/* Populate the key, noting state dependencies:<br>
*/<br>
/* CACHE_NEW_VS_PROG */<br>
- key.attrs = brw->vs.prog_data->vue_map.<u></u>slots_valid;<br>
</blockquote>
<br></div>
Ditto (wrong comment)</blockquote><div><br></div><div>Fixed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ key.attrs = brw->vue_map_geom_out.slots_<u></u>valid;<br>
<br>
/* BRW_NEW_REDUCED_PRIMITIVE */<br>
switch (brw->intel.reduced_primitive) {<br>
@@ -216,8 +216,7 @@ const struct brw_tracked_state brw_sf_prog = {<br>
.dirty = {<br>
.mesa = (_NEW_HINT | _NEW_LIGHT | _NEW_POLYGON | _NEW_POINT |<br>
_NEW_TRANSFORM | _NEW_BUFFERS | _NEW_PROGRAM),<br>
- .brw = (BRW_NEW_REDUCED_PRIMITIVE),<br>
- .cache = CACHE_NEW_VS_PROG<br>
</blockquote>
<br></div>
Ditto (CACHE_NEW_VS_PROG doesn't appear necessary)</blockquote><div><br></div><div>Already deleted this one too.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ .brw = (BRW_NEW_REDUCED_PRIMITIVE | BRW_NEW_VUE_MAP_GEOM_OUT)<br>
},<br>
.emit = brw_upload_sf_prog<br>
};<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_state.h b/src/mesa/drivers/dri/i965/<u></u>brw_state.h<br>
index 02ce57b..1f5e18a 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_state.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_state.h<br>
@@ -227,7 +227,7 @@ void upload_default_color(struct brw_context *brw,<br>
<br>
/* gen6_sf_state.c */<br>
uint32_t<br>
-get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,<br>
+get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,<br>
int fs_attr, bool two_side_color, uint32_t *max_source_attr);<br>
<br>
#ifdef __cplusplus<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_wm.c b/src/mesa/drivers/dri/i965/<u></u>brw_wm.c<br>
index e7e9ddc..6053f94 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_wm.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_wm.c<br>
@@ -481,7 +481,7 @@ static void brw_wm_populate_key( struct brw_context *brw,<br>
<br>
/* CACHE_NEW_VS_PROG */<br>
if (intel->gen < 6)<br>
- key->vp_outputs_written = brw->vs.prog_data->vue_map.<u></u>slots_valid;<br>
+ key->vp_outputs_written = brw->vue_map_geom_out.slots_<u></u>valid;<br>
</blockquote>
<br></div>
Ditto (wrong comment)</blockquote><div><br></div><div>Fixed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
/* The unique fragment program ID */<br>
key->program_string_id = fp->id;<br>
@@ -524,8 +524,8 @@ const struct brw_tracked_state brw_wm_prog = {<br>
_NEW_MULTISAMPLE),<br>
.brw = (BRW_NEW_FRAGMENT_PROGRAM |<br>
BRW_NEW_WM_INPUT_DIMENSIONS |<br>
- BRW_NEW_REDUCED_PRIMITIVE),<br>
- .cache = CACHE_NEW_VS_PROG,<br>
+ BRW_NEW_REDUCED_PRIMITIVE |<br>
+ BRW_NEW_VUE_MAP_GEOM_OUT)<br>
</blockquote>
<br></div>
Hey, you caught it in the rest of the cases :)<br>
<br>
I would like to see this series run through Piglit on pre-Gen6 just to be sure we haven't broken anything. I can do that, as I'm setting up my Ironlake for other reasons anyway...</blockquote><div><br></div><div>
I wouldn't say no to additional testing, but FWIW I have tested this series on Gen5, and there were no regressions :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
},<br>
.emit = brw_upload_wm_prog<br>
};<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c b/src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c<br>
index 7fe1dca..4ee7f56 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c<br>
@@ -53,7 +53,7 @@<br>
* 256-bit increments.<br>
*/<br>
uint32_t<br>
-get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,<br>
+get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,<br>
int fs_attr, bool two_side_color, uint32_t *max_source_attr)<br>
{<br>
if (fs_attr == VARYING_SLOT_POS) {<br>
@@ -312,9 +312,9 @@ upload_sf_state(struct brw_context *brw)<br>
*/<br>
assert(input_index < 16 || attr == input_index);<br>
<br>
- /* CACHE_NEW_VS_PROG | _NEW_LIGHT | _NEW_PROGRAM */<br>
+ /* BRW_NEW_VUE_MAP_GEOM_OUT | _NEW_LIGHT | _NEW_PROGRAM */<br>
attr_overrides[input_index++] =<br>
- get_attr_override(&brw->vs.<u></u>prog_data->vue_map,<br>
+ get_attr_override(&brw->vue_<u></u>map_geom_out,<br>
urb_entry_read_offset, attr,<br>
ctx->VertexProgram._<u></u>TwoSideEnabled,<br>
&max_source_attr);<br>
@@ -370,8 +370,8 @@ const struct brw_tracked_state gen6_sf_state = {<br>
_NEW_POINT |<br>
_NEW_MULTISAMPLE),<br>
.brw = (BRW_NEW_CONTEXT |<br>
- BRW_NEW_FRAGMENT_PROGRAM),<br>
- .cache = CACHE_NEW_VS_PROG<br>
+ BRW_NEW_FRAGMENT_PROGRAM |<br>
+ BRW_NEW_VUE_MAP_GEOM_OUT)<br>
},<br>
.emit = upload_sf_state,<br>
};<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c b/src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c<br>
index 86809a1..5ebe6f2 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c<br>
@@ -100,9 +100,9 @@ upload_sbe_state(struct brw_context *brw)<br>
*/<br>
assert(input_index < 16 || attr == input_index);<br>
<br>
- /* CACHE_NEW_VS_PROG | _NEW_LIGHT | _NEW_PROGRAM */<br>
+ /* BRW_NEW_VUE_MAP_GEOM_OUT | _NEW_LIGHT | _NEW_PROGRAM */<br>
attr_overrides[input_index++] =<br>
- get_attr_override(&brw->vs.<u></u>prog_data->vue_map,<br>
+ get_attr_override(&brw->vue_<u></u>map_geom_out,<br>
urb_entry_read_offset, attr,<br>
ctx->VertexProgram._<u></u>TwoSideEnabled,<br>
&max_source_attr);<br>
@@ -149,8 +149,8 @@ const struct brw_tracked_state gen7_sbe_state = {<br>
_NEW_POINT |<br>
_NEW_PROGRAM),<br>
.brw = (BRW_NEW_CONTEXT |<br>
- BRW_NEW_FRAGMENT_PROGRAM),<br>
- .cache = CACHE_NEW_VS_PROG<br>
+ BRW_NEW_FRAGMENT_PROGRAM |<br>
+ BRW_NEW_VUE_MAP_GEOM_OUT)<br>
},<br>
.emit = upload_sbe_state,<br>
};<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>gen7_sol_state.c b/src/mesa/drivers/dri/i965/<u></u>gen7_sol_state.c<br>
index b55fccc..1c71d0f 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>gen7_sol_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>gen7_sol_state.c<br>
@@ -107,7 +107,7 @@ upload_3dstate_so_buffers(<u></u>struct brw_context *brw)<br>
*/<br>
static void<br>
upload_3dstate_so_decl_list(<u></u>struct brw_context *brw,<br>
- struct brw_vue_map *vue_map)<br>
+ const struct brw_vue_map *vue_map)<br>
</blockquote>
<br></div></div>
Good call on the const.<div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
{<br>
struct intel_context *intel = &brw->intel;<br>
struct gl_context *ctx = &intel->ctx;<br>
@@ -183,7 +183,7 @@ upload_3dstate_so_decl_list(<u></u>struct brw_context *brw,<br>
<br>
static void<br>
upload_3dstate_streamout(<u></u>struct brw_context *brw, bool active,<br>
- struct brw_vue_map *vue_map)<br>
+ const struct brw_vue_map *vue_map)<br>
{<br>
struct intel_context *intel = &brw->intel;<br>
struct gl_context *ctx = &intel->ctx;<br>
@@ -241,8 +241,8 @@ upload_sol_state(struct brw_context *brw)<br>
<br>
if (active) {<br>
upload_3dstate_so_buffers(brw)<u></u>;<br>
- /* CACHE_NEW_VS_PROG */<br>
- upload_3dstate_so_decl_list(<u></u>brw, &brw->vs.prog_data->vue_map);<br>
+ /* BRW_NEW_VUE_MAP_GEOM_OUT */<br>
+ upload_3dstate_so_decl_list(<u></u>brw, &brw->vue_map_geom_out);<br>
<br>
intel->batch.needs_sol_reset = true;<br>
}<br>
@@ -252,7 +252,7 @@ upload_sol_state(struct brw_context *brw)<br>
* MMIO register updates (current performed by the kernel at each batch<br>
* emit).<br>
*/<br>
- upload_3dstate_streamout(brw, active, &brw->vs.prog_data->vue_map);<br>
+ upload_3dstate_streamout(brw, active, &brw->vue_map_geom_out);<br>
}<br>
<br>
const struct brw_tracked_state gen7_sol_state = {<br>
@@ -261,8 +261,8 @@ const struct brw_tracked_state gen7_sol_state = {<br>
_NEW_LIGHT |<br>
_NEW_TRANSFORM_FEEDBACK),<br>
.brw = (BRW_NEW_BATCH |<br>
- BRW_NEW_VERTEX_PROGRAM),<br>
- .cache = CACHE_NEW_VS_PROG,<br>
+ BRW_NEW_VERTEX_PROGRAM |<br>
+ BRW_NEW_VUE_MAP_GEOM_OUT)<br>
},<br>
.emit = upload_sol_state,<br>
};<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>