[Mesa-dev] [PATCH] i965: do not emit empty sampler state

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Aug 6 14:15:17 UTC 2018


Hey Erik,

I don't think this is right, because by not filling out_offset, you're 
leaving it at 0 which makes the entry in the binding table point to a 
dynamic state base address.
I would emit the null surface instead.

-
Lionel

On 06/08/18 14:27, Erik Faye-Lund wrote:
> If called with an empty size, brw_emit_buffer_surface_state asserts.
> And since doing a zero-size upload is really just a lot of work for
> no gain, let's just avoid the call in the first place.
>
> Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
> ---
> This fixes an assert that triggers for me when running
> dEQP-GLES31.functional.shaders.opaque_type_indexing.ssbo.const_literal_vertex
> on top of a debug-build of mesa on top of i965. Since setting up a virgl
> setup is rather convoluted, here's a piglit shader-test that reproduce it
> directly on top of a debug-build of mesa on i965:
>
> https://gitlab.freedesktop.org/kusma/piglit/tree/ssbo-zero-size
>
>   .../drivers/dri/i965/brw_wm_surface_state.c    | 18 ++++++++++--------
>   1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 9397b637c7..0da7f97218 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -1322,14 +1322,16 @@ upload_buffer_surface(struct brw_context *brw,
>         if (!binding->AutomaticSize)
>            size = MIN2(size, binding->Size);
>   
> -      struct intel_buffer_object *iobj =
> -         intel_buffer_object(binding->BufferObject);
> -      struct brw_bo *bo =
> -         intel_bufferobj_buffer(brw, iobj, binding->Offset, size,
> -                                (reloc_flags & RELOC_WRITE) != 0);
> -
> -      brw_emit_buffer_surface_state(brw, out_offset, bo, binding->Offset,
> -                                    format, size, 1, reloc_flags);
> +      if (size > 0) {
> +         struct intel_buffer_object *iobj =
> +            intel_buffer_object(binding->BufferObject);
> +         struct brw_bo *bo =
> +            intel_bufferobj_buffer(brw, iobj, binding->Offset, size,
> +                                   (reloc_flags & RELOC_WRITE) != 0);
> +
> +         brw_emit_buffer_surface_state(brw, out_offset, bo, binding->Offset,
> +                                       format, size, 1, reloc_flags);
> +      }
>      }
>   }
>   




More information about the mesa-dev mailing list