From 5352f42e03740989d9ae8df6b11eb189a16b5cc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 22 Nov 2016 12:13:23 -0200 Subject: [PATCH] Merge branch 'wip/apinheiro/memory-barriers' into 'master' Extra memory barriers needed on different tests We found several tests to consistently fail or to be flaky (not always failing/passing) on Intel Skylake GT2 model. Those get solved adding memory barriers. Those memory barriers are convenient as could prevent the tests failing on other hw. The branch includes 4 new commits, to make easier the review, but I think that they can be squashed without problems. See merge request !108 Change-Id: I4ec91df6c1d8721eee18f9aa0223d3c5ba6465ef --- external/openglcts/modules/gl/gl4cShaderImageLoadStoreTests.cpp | 4 ++++ external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp | 1 + external/openglcts/modules/gl/gl4cShadingLanguage420PackTests.cpp | 3 +++ .../glesext/gpu_shader5/esextcGPUShader5ImagesArrayIndexing.cpp | 3 +++ .../texture_cube_map_array/esextcTextureCubeMapArraySampling.cpp | 1 + 5 files changed, 12 insertions(+) diff --git a/external/openglcts/modules/gl/gl4cShaderImageLoadStoreTests.cpp b/external/openglcts/modules/gl/gl4cShaderImageLoadStoreTests.cpp index 951c5c5..ea8db91 100644 --- a/external/openglcts/modules/gl/gl4cShaderImageLoadStoreTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderImageLoadStoreTests.cpp @@ -5625,6 +5625,7 @@ class AdvancedAllStagesOneImage : public ShaderImageLoadStoreBase glDrawElementsInstancedBaseVertex(GL_PATCHES, 1, GL_UNSIGNED_SHORT, 0, 1, 0); glDrawElementsInstanced(GL_PATCHES, 1, GL_UNSIGNED_SHORT, 0, 1); + glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); glBindBuffer(GL_TEXTURE_BUFFER, m_buffer); glGetBufferSubData(GL_TEXTURE_BUFFER, 0, 4, &i32); if (i32 < 20 || i32 > 50) @@ -6121,6 +6122,7 @@ class AdvancedSSOSubroutine : public ShaderImageLoadStoreBase glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); std::vector data(getWindowWidth() * getWindowHeight() * 3); + glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT); glGetTexImage(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, GL_FLOAT, &data[0]); for (int layer = 0; layer < 3; ++layer) @@ -6152,6 +6154,7 @@ class AdvancedSSOSubroutine : public ShaderImageLoadStoreBase glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, &indices[1]); glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); + glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT); glGetTexImage(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, GL_FLOAT, &data[0]); for (int layer = 0; layer < 3; ++layer) @@ -6516,6 +6519,7 @@ class AdvancedCast : public ShaderImageLoadStoreBase std::vector data(getWindowWidth() * getWindowHeight() * 4); glBindTexture(GL_TEXTURE_2D, m_texture[0]); + glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); for (int h = 0; h < getWindowHeight(); ++h) diff --git a/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp b/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp index 7bca051..3075912 100644 --- a/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp @@ -5070,6 +5070,7 @@ class BasicNoBindingLayout : public ShaderStorageBufferObjectBase int data; glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_ssbo); + glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); glGetBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, 4, &data); if (data != 1) return ERROR; diff --git a/external/openglcts/modules/gl/gl4cShadingLanguage420PackTests.cpp b/external/openglcts/modules/gl/gl4cShadingLanguage420PackTests.cpp index f4d2e3b..d0fc20e 100644 --- a/external/openglcts/modules/gl/gl4cShadingLanguage420PackTests.cpp +++ b/external/openglcts/modules/gl/gl4cShadingLanguage420PackTests.cpp @@ -18562,6 +18562,9 @@ void Utils::texture::get(glw::GLenum format, glw::GLenum type, glw::GLvoid* out_ bind(); + gl.memoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT); + GLU_EXPECT_NO_ERROR(gl.getError(), "MemoryBarrier"); + if (TEX_CUBE != m_texture_type) { gl.getTexImage(target, 0 /* level */, format, type, out_data); diff --git a/external/openglcts/modules/glesext/gpu_shader5/esextcGPUShader5ImagesArrayIndexing.cpp b/external/openglcts/modules/glesext/gpu_shader5/esextcGPUShader5ImagesArrayIndexing.cpp index e473d52..b8ea738 100644 --- a/external/openglcts/modules/glesext/gpu_shader5/esextcGPUShader5ImagesArrayIndexing.cpp +++ b/external/openglcts/modules/glesext/gpu_shader5/esextcGPUShader5ImagesArrayIndexing.cpp @@ -200,6 +200,9 @@ tcu::TestNode::IterateResult GPUShader5ImagesArrayIndexing::iterate(void) const glw::GLuint dataSize = m_texture_width * m_texture_height * m_texture_n_components * 4; m_data_buffer = new glw::GLuint[dataSize]; + gl.memoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); + GLU_EXPECT_NO_ERROR(gl.getError(), "Could not set memory barrier!"); + for (unsigned int i = 0; i < m_array_size; ++i) { /* Attach texture to framebuffer's color attachment 0 */ diff --git a/external/openglcts/modules/glesext/texture_cube_map_array/esextcTextureCubeMapArraySampling.cpp b/external/openglcts/modules/glesext/texture_cube_map_array/esextcTextureCubeMapArraySampling.cpp index 23476cc..5a8740c 100644 --- a/external/openglcts/modules/glesext/texture_cube_map_array/esextcTextureCubeMapArraySampling.cpp +++ b/external/openglcts/modules/glesext/texture_cube_map_array/esextcTextureCubeMapArraySampling.cpp @@ -3762,6 +3762,7 @@ void TextureCubeMapArraySamplingTest::testTexture(const formatDefinition& format gl.viewport(0, 0, 3 * resolution.m_depth, 3); GLU_EXPECT_NO_ERROR(gl.getError(), "viewport"); + gl.memoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); gl.readPixels(0 /* x */, 0 /* y */, image_width, image_height, format.m_destination.m_format, format.m_destination.m_type, &result_image[0]); -- 2.7.4