i965/fs: Disable CSE optimization for untyped & typed surface reads
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 20 Oct 2015 06:13:09 +0000 (23:13 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 22 Oct 2015 07:36:37 +0000 (00:36 -0700)
commit627c15cde46a76e9bce4425646c5caba11788ec4
tree7a9d7820ae9182160b4c78e380c6728f2317cb30
parent13a5805b646b19fd9c155d5c586ad1967d7d9e00
i965/fs: Disable CSE optimization for untyped & typed surface reads

An untyped surface read is volatile because it might be affected by a
write.

In the ES31-CTS.compute_shader.resources-max test, two back to back
read/modify/writes of an SSBO variable looked something like this:

  r1 = untyped_surface_read(ssbo_float)
  r2 = r1 + 1
  untyped_surface_write(ssbo_float, r2)
  r3 = untyped_surface_read(ssbo_float)
  r4 = r3 + 1
  untyped_surface_write(ssbo_float, r4)

And after CSE, we had:

  r1 = untyped_surface_read(ssbo_float)
  r2 = r1 + 1
  untyped_surface_write(ssbo_float, r2)
  r4 = r1 + 1
  untyped_surface_write(ssbo_float, r4)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h