[Mesa-dev] [PATCH v2 23/82] glsl: Do not do CSE for expressions involving SSBO loads

Matt Turner mattst88 at gmail.com
Wed Jun 17 19:33:23 PDT 2015

On Wed, Jun 17, 2015 at 5:20 PM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> I wanted to question whether this was required, based on this text
> from the extension spec:
> "The ability to write to buffer objects creates the potential for
>  multiple independent shader invocations to read and write the same
>  underlying memory. The same issue exists with the
>  ARB_shader_image_load_store extension provided in OpenGL 4.2, which
>  can write to texture objects and buffers. In both cases, the
>  specification makes few guarantees related to the relative order of
>  memory reads and writes performed by the shader invocations."
> But I'm not sure if we can reconcile CSE with 'memoryBarrier' and
> 'barrier'. curro, any thoughts from image load/store?

I think the point is that if you have two reads of the same location,
you can't combine them into a single load since in the intervening
time another shader invocation might have written to that location...?

The question about the semantics of memory-barriers is a good one though.

More information about the mesa-dev mailing list