On 04/29/2015 01:56 AM, kevin.rogo...@intel.com wrote:
> From: Kevin Rogovin <kevin.rogo...@intel.com>
> 
> If the fragment shader has atomic buffer access, the shader must execute
> even if the current draw buffer has no attachments.
> 
> ---
>  src/mesa/drivers/dri/i965/gen7_wm_state.c | 7 +++++++
>  src/mesa/drivers/dri/i965/gen8_ps_state.c | 4 ++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c 
> b/src/mesa/drivers/dri/i965/gen7_wm_state.c
> index 4d67b86..939d6e4 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c
> @@ -77,6 +77,13 @@ upload_wm_state(struct brw_context *brw)
>        dw1 |= GEN7_WM_KILL_ENABLE;
>     }
>  
> +   if (brw->ctx.Shader._CurrentFragmentProgram != NULL &&
> +       brw->ctx.Shader._CurrentFragmentProgram->NumAtomicBuffers > 0) {

I think this check should be put in a utility function up in core Mesa
somewhere.  It's open-coded twice in this patch, and the check will
change when GL_ARB_image_load_store lands.

> +     dw1 |= GEN7_WM_DISPATCH_ENABLE;
> +   }
> +
>     /* _NEW_BUFFERS | _NEW_COLOR */
>     if (brw_color_buffer_write_enabled(brw) || writes_depth ||
>         dw1 & GEN7_WM_KILL_ENABLE) {
> diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c 
> b/src/mesa/drivers/dri/i965/gen8_ps_state.c
> index 5f39e12..614bc9b 100644
> --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c
> @@ -62,6 +62,10 @@ upload_ps_extra(struct brw_context *brw)
>     if (prog_data->uses_omask)
>        dw1 |= GEN8_PSX_OMASK_TO_RENDER_TARGET;
>  
> +   if (brw->ctx.Shader._CurrentFragmentProgram != NULL &&
> +       brw->ctx.Shader._CurrentFragmentProgram->NumAtomicBuffers > 0)
> +      dw1 |= GEN8_PSX_SHADER_HAS_UAV;
> +
>     BEGIN_BATCH(2);
>     OUT_BATCH(_3DSTATE_PS_EXTRA << 16 | (2 - 2));
>     OUT_BATCH(dw1);
> 

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to