Skip to content

v3d: flush PIPE_VERTEX_BUFFER on v3d_memory_barrier too

Without this commit the following test: KHR-GLES31.core.shader_image_load_store.advanced-sync-vertexArray

fails if run included on a caselist with other shader image load/store tests (works individually).

That test uses two GL_ARRAY_BUFFER to store position and color. In order to fill those buffers, they are used as SSBO on a compute shader (that just copy the values from a image updated on a previous step). Then those are used for a normal draw arrays rendering.

The test includes a memory barrier using GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT, and as mentioned, fails if some specific image load/store tests are run before unless GL_SHADER_STORAGE_BARRIER_BIT is included. But the latter shouldn't be required, as from OpenGL ES 3.1 spec, section 7.11.2, "Shader Memory Access Synchronization":

"VERTEX_ATTRIB_ARRAY_BARRIER_BIT : If set, vertex data sourced from buffer objects after the barrier will reflect data written by shaders prior to the barrier."

As far as I interpret that paragraph, this covers any update on the vertex data, no matters if a SSBO was used to update it or not.

FWIW, the need of adding this makes more relevant the perf_debug comment just some lines below, about not flushing all jobs, as an improvement over this would be checking the existing jobs and being somewhat smart of which ones to flush (that is already TODO for SSBO/image, afaiu).

Merge request reports