[Mesa-dev] [PATCH 11/14] i965/gen7: Enable fragment shader dispatch if the program has image uniforms.
Kenneth Graunke
kenneth at whitecape.org
Fri Feb 6 12:30:42 PST 2015
On Friday, February 06, 2015 07:23:25 PM Francisco Jerez wrote:
> Shaders with image uniforms may have side effects. Make sure that
> fragment shader threads are dispatched if the shader has any image
> uniforms.
> ---
> src/mesa/drivers/dri/i965/gen7_wm_state.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c
> index 923414e..034ce08 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c
> @@ -39,6 +39,9 @@ upload_wm_state(struct brw_context *brw)
> /* BRW_NEW_FRAGMENT_PROGRAM */
> const struct brw_fragment_program *fp =
> brw_fragment_program_const(brw->fragment_program);
> + struct gl_shader_program *prog = ctx->Shader._CurrentFragmentProgram;
> + struct gl_shader *shader =
> + prog ? prog->_LinkedShaders[MESA_SHADER_FRAGMENT] : NULL;
> /* BRW_NEW_FS_PROG_DATA */
> const struct brw_wm_prog_data *prog_data = brw->wm.prog_data;
> bool writes_depth = prog_data->computed_depth_mode != BRW_PSCDEPTH_OFF;
> @@ -76,8 +79,9 @@ upload_wm_state(struct brw_context *brw)
> dw1 |= GEN7_WM_KILL_ENABLE;
> }
>
> - /* _NEW_BUFFERS | _NEW_COLOR */
> + /* _NEW_BUFFERS | _NEW_COLOR, BRW_NEW_FRAGMENT_PROGRAM */
> if (brw_color_buffer_write_enabled(brw) || writes_depth ||
> + (shader && shader->NumImages) ||
> dw1 & GEN7_WM_KILL_ENABLE) {
> dw1 |= GEN7_WM_DISPATCH_ENABLE;
> }
>
Do you need to make a similar change in gen8_ps_state.c? I suppose it
could automatically get enabled when UAVs are on, but I haven't checked.
I've been trying to migrate the state upload code to exclusively rely on
prog_data, and not poke at the core Mesa shader structures directly
(and only listen to BRW_NEW_FS_PROG_DATA, not BRW_NEW_FRAGMENT_PROGRAM).
What do you think about adding a "uses_images" or "has_uav" flag to
prog_data and using it here?
While I think I'd prefer that, this should also work, so it gets:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150206/6060b759/attachment-0001.sig>
More information about the mesa-dev
mailing list