iris: Mark cbuf0 as not needing uploading every single time

I neglected to mark cbuf0_needs_upload = false after uploading it.
The obvious fix regressed user clip plane tests, because of a second
bug: we also forgot to mark that they may need re-uploading when
changing shader programs (which may have more or less system values).

Thanks to Timur Kristóf for catching the original issue.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
This commit is contained in:
Kenneth Graunke
2019-06-20 18:28:58 -05:00
committed by Timur Kristóf
parent 188dbb1679
commit ebc8c20b3e
2 changed files with 14 additions and 3 deletions

View File

@@ -970,6 +970,7 @@ iris_compile_vs(struct iris_context *ice,
static void static void
iris_update_compiled_vs(struct iris_context *ice) iris_update_compiled_vs(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_VERTEX];
struct iris_uncompiled_shader *ish = struct iris_uncompiled_shader *ish =
ice->shaders.uncompiled[MESA_SHADER_VERTEX]; ice->shaders.uncompiled[MESA_SHADER_VERTEX];
struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
@@ -994,6 +995,8 @@ iris_update_compiled_vs(struct iris_context *ice)
IRIS_DIRTY_BINDINGS_VS | IRIS_DIRTY_BINDINGS_VS |
IRIS_DIRTY_CONSTANTS_VS | IRIS_DIRTY_CONSTANTS_VS |
IRIS_DIRTY_VF_SGVS; IRIS_DIRTY_VF_SGVS;
shs->cbuf0_needs_upload = true;
const struct brw_vs_prog_data *vs_prog_data = const struct brw_vs_prog_data *vs_prog_data =
(void *) shader->prog_data; (void *) shader->prog_data;
const bool uses_draw_params = vs_prog_data->uses_firstvertex || const bool uses_draw_params = vs_prog_data->uses_firstvertex ||
@@ -1175,6 +1178,7 @@ iris_compile_tcs(struct iris_context *ice,
static void static void
iris_update_compiled_tcs(struct iris_context *ice) iris_update_compiled_tcs(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_TESS_CTRL];
struct iris_uncompiled_shader *tcs = struct iris_uncompiled_shader *tcs =
ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL]; ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL];
struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
@@ -1207,6 +1211,7 @@ iris_update_compiled_tcs(struct iris_context *ice)
ice->state.dirty |= IRIS_DIRTY_TCS | ice->state.dirty |= IRIS_DIRTY_TCS |
IRIS_DIRTY_BINDINGS_TCS | IRIS_DIRTY_BINDINGS_TCS |
IRIS_DIRTY_CONSTANTS_TCS; IRIS_DIRTY_CONSTANTS_TCS;
shs->cbuf0_needs_upload = true;
if (!tcs) { if (!tcs) {
/* We're binding a passthrough TCS, which doesn't have uniforms. /* We're binding a passthrough TCS, which doesn't have uniforms.
@@ -1218,9 +1223,6 @@ iris_update_compiled_tcs(struct iris_context *ice)
* data and try and read a dangling cbuf0->user_buffer pointer. * data and try and read a dangling cbuf0->user_buffer pointer.
* Just zero out the stale constants to avoid the upload. * Just zero out the stale constants to avoid the upload.
*/ */
struct iris_shader_state *shs =
&ice->state.shaders[MESA_SHADER_TESS_CTRL];
memset(&shs->cbuf0, 0, sizeof(shs->cbuf0)); memset(&shs->cbuf0, 0, sizeof(shs->cbuf0));
} }
} }
@@ -1300,6 +1302,7 @@ iris_compile_tes(struct iris_context *ice,
static void static void
iris_update_compiled_tes(struct iris_context *ice) iris_update_compiled_tes(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_TESS_EVAL];
struct iris_uncompiled_shader *ish = struct iris_uncompiled_shader *ish =
ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL]; ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL];
struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
@@ -1324,6 +1327,7 @@ iris_update_compiled_tes(struct iris_context *ice)
ice->state.dirty |= IRIS_DIRTY_TES | ice->state.dirty |= IRIS_DIRTY_TES |
IRIS_DIRTY_BINDINGS_TES | IRIS_DIRTY_BINDINGS_TES |
IRIS_DIRTY_CONSTANTS_TES; IRIS_DIRTY_CONSTANTS_TES;
shs->cbuf0_needs_upload = true;
} }
/* TODO: Could compare and avoid flagging this. */ /* TODO: Could compare and avoid flagging this. */
@@ -1408,6 +1412,7 @@ iris_compile_gs(struct iris_context *ice,
static void static void
iris_update_compiled_gs(struct iris_context *ice) iris_update_compiled_gs(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_GEOMETRY];
struct iris_uncompiled_shader *ish = struct iris_uncompiled_shader *ish =
ice->shaders.uncompiled[MESA_SHADER_GEOMETRY]; ice->shaders.uncompiled[MESA_SHADER_GEOMETRY];
struct iris_compiled_shader *old = ice->shaders.prog[IRIS_CACHE_GS]; struct iris_compiled_shader *old = ice->shaders.prog[IRIS_CACHE_GS];
@@ -1434,6 +1439,7 @@ iris_update_compiled_gs(struct iris_context *ice)
ice->state.dirty |= IRIS_DIRTY_GS | ice->state.dirty |= IRIS_DIRTY_GS |
IRIS_DIRTY_BINDINGS_GS | IRIS_DIRTY_BINDINGS_GS |
IRIS_DIRTY_CONSTANTS_GS; IRIS_DIRTY_CONSTANTS_GS;
shs->cbuf0_needs_upload = true;
} }
} }
@@ -1504,6 +1510,7 @@ iris_compile_fs(struct iris_context *ice,
static void static void
iris_update_compiled_fs(struct iris_context *ice) iris_update_compiled_fs(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_FRAGMENT];
struct iris_uncompiled_shader *ish = struct iris_uncompiled_shader *ish =
ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]; ice->shaders.uncompiled[MESA_SHADER_FRAGMENT];
struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
@@ -1534,6 +1541,7 @@ iris_update_compiled_fs(struct iris_context *ice)
IRIS_DIRTY_WM | IRIS_DIRTY_WM |
IRIS_DIRTY_CLIP | IRIS_DIRTY_CLIP |
IRIS_DIRTY_SBE; IRIS_DIRTY_SBE;
shs->cbuf0_needs_upload = true;
} }
} }
@@ -1762,6 +1770,7 @@ iris_compile_cs(struct iris_context *ice,
void void
iris_update_compiled_compute_shader(struct iris_context *ice) iris_update_compiled_compute_shader(struct iris_context *ice)
{ {
struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_COMPUTE];
struct iris_uncompiled_shader *ish = struct iris_uncompiled_shader *ish =
ice->shaders.uncompiled[MESA_SHADER_COMPUTE]; ice->shaders.uncompiled[MESA_SHADER_COMPUTE];
@@ -1785,6 +1794,7 @@ iris_update_compiled_compute_shader(struct iris_context *ice)
ice->state.dirty |= IRIS_DIRTY_CS | ice->state.dirty |= IRIS_DIRTY_CS |
IRIS_DIRTY_BINDINGS_CS | IRIS_DIRTY_BINDINGS_CS |
IRIS_DIRTY_CONSTANTS_CS; IRIS_DIRTY_CONSTANTS_CS;
shs->cbuf0_needs_upload = true;
} }
} }

View File

@@ -2630,6 +2630,7 @@ upload_uniforms(struct iris_context *ice,
cbuf->buffer_size = upload_size; cbuf->buffer_size = upload_size;
iris_upload_ubo_ssbo_surf_state(ice, cbuf, iris_upload_ubo_ssbo_surf_state(ice, cbuf,
&shs->constbuf_surf_state[0], false); &shs->constbuf_surf_state[0], false);
shs->cbuf0_needs_upload = false;
} }
/** /**