Add a glMemoryBarrier between buffer write and read
authorSunny Sun <sunny.sun@arm.com>
Thu, 27 May 2021 07:44:36 +0000 (15:44 +0800)
committerSunny Sun <sunny.sun@arm.com>
Thu, 27 May 2021 07:49:01 +0000 (15:49 +0800)
The tests' behavior is like this:
1. Use transform feedback to write to one buffer
2. Set this buffer to texture, and then to image
3. glDispatchCompute -> use ImageLoad to read from the image
We have to add a glMemoryBarrier between step 1 and 3.

Affects:
KHR-GLES3*.core.texture_buffer.texture_buffer_operations_transform_feedback

Components: OpenGL

VK-GL-CTS issue: 2936

Change-Id: If711469a6cbf4ae1df6851e4006d937760e37ca7

external/openglcts/modules/glesext/texture_buffer/esextcTextureBufferOperations.cpp

index 850ee45..b1b01c1 100644 (file)
@@ -392,6 +392,9 @@ void TextureBufferOperations::iterateFirstPhase(glw::GLint* result, glw::GLuint
        gl.useProgram(m_po_cs_id);
        GLU_EXPECT_NO_ERROR(gl.getError(), "Error setting active program!");
 
+       gl.memoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
+       GLU_EXPECT_NO_ERROR(gl.getError(), "Error setting memory barrier!");
+
        gl.bindImageTexture(0, m_texbuff_id, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32I);
        GLU_EXPECT_NO_ERROR(gl.getError(), "Error binding texture to image unit!");