Iris Shaders

Iris Shaders

36M Downloads

Memory barriers are missing for image load/store

coderbot16 opened this issue ยท 2 comments

commented

Image load / store follows the rules of incoherent memory access: https://www.khronos.org/opengl/wiki/Memory_Model#Incoherent_memory_access

As a result, we need to manually ensure that the results of writes are visible to other shader programs.

https://www.khronos.org/opengl/wiki/Memory_Model#Ensuring_visibility

https://www.khronos.org/opengl/wiki/Memory_Model#External_visibility

TL;DR we need to figure out when to call glMemoryBarrier() and figure out the flags we need to call it with. Currently image load store in Iris isn't fully usable because you can't actually 100% rely on stored values being available in other programs yet. Figuring out the optimal time to issue memory barriers might be complex if it involves figuring out when a shader program is making use of data written by image load store in another program.

commented

This actually isn't an issue, as barriers are only implemented for computes, leading into #1150.

commented

I think barriers should be present even without computes though? OptiFine only applying them for compute shaders just sounds like a correctness issue in OptiFine.