From: Piotr Byszewski Date: Tue, 5 Sep 2017 10:39:13 +0000 (+0200) Subject: Test readonly and writeonly buffer variables X-Git-Tag: upstream/0.1.0~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc9b284253eb43eee6ab8a6b75778286886f1431;p=platform%2Fupstream%2FVK-GL-CTS.git Test readonly and writeonly buffer variables It is allowed the both readonly and writeonly qualifiers be used on buffer variables. It just means it can't be read or written, but can otherwise be referenced like with .size(), etc. Components: OpenGL VK-GL-CTS issue: 639 Affects: KHR-GL43.shader_storage_buffer_object.basic-readonly-writeonly KHR-GLES31.core.shader_storage_buffer_object.basic-readonly-writeonly Change-Id: Id8f68a8687e41cdd42d45c8300f812833312517e --- diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl43-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl43-master.txt index 1ef15f80a..e84a07f42 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl43-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl43-master.txt @@ -3876,6 +3876,7 @@ KHR-GL43.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GL43.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GL43.shader_storage_buffer_object.basic-matrixOperations-case7-cs KHR-GL43.shader_storage_buffer_object.basic-noBindingLayout +KHR-GL43.shader_storage_buffer_object.basic-readonly-writeonly KHR-GL43.shader_storage_buffer_object.advanced-switchBuffers KHR-GL43.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GL43.shader_storage_buffer_object.advanced-switchPrograms diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl44-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl44-master.txt index 3cfe11105..971a7916b 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl44-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl44-master.txt @@ -3876,6 +3876,7 @@ KHR-GL44.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GL44.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GL44.shader_storage_buffer_object.basic-matrixOperations-case7-cs KHR-GL44.shader_storage_buffer_object.basic-noBindingLayout +KHR-GL44.shader_storage_buffer_object.basic-readonly-writeonly KHR-GL44.shader_storage_buffer_object.advanced-switchBuffers KHR-GL44.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GL44.shader_storage_buffer_object.advanced-switchPrograms diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl45-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl45-master.txt index 18a7e3ac2..01fe4d295 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl45-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl45-master.txt @@ -3877,6 +3877,7 @@ KHR-GL45.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GL45.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GL45.shader_storage_buffer_object.basic-matrixOperations-case7-cs KHR-GL45.shader_storage_buffer_object.basic-noBindingLayout +KHR-GL45.shader_storage_buffer_object.basic-readonly-writeonly KHR-GL45.shader_storage_buffer_object.advanced-switchBuffers KHR-GL45.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GL45.shader_storage_buffer_object.advanced-switchPrograms diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl46-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl46-master.txt index 446572a88..01f1097ef 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl46-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.6.0.x/gl46-master.txt @@ -3877,6 +3877,7 @@ KHR-GL46.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GL46.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GL46.shader_storage_buffer_object.basic-matrixOperations-case7-cs KHR-GL46.shader_storage_buffer_object.basic-noBindingLayout +KHR-GL46.shader_storage_buffer_object.basic-readonly-writeonly KHR-GL46.shader_storage_buffer_object.advanced-switchBuffers KHR-GL46.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GL46.shader_storage_buffer_object.advanced-switchPrograms diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt index 583d2a7e2..60c082800 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles31-khr-master.txt @@ -1900,6 +1900,7 @@ KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case6-vs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case7-cs +KHR-GLES31.core.shader_storage_buffer_object.basic-readonly-writeonly KHR-GLES31.core.shader_storage_buffer_object.advanced-switchBuffers-vs KHR-GLES31.core.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GLES31.core.shader_storage_buffer_object.advanced-switchPrograms-vs diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt index 583d2a7e2..60c082800 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt @@ -1900,6 +1900,7 @@ KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case6-vs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case6-cs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case7-vs KHR-GLES31.core.shader_storage_buffer_object.basic-matrixOperations-case7-cs +KHR-GLES31.core.shader_storage_buffer_object.basic-readonly-writeonly KHR-GLES31.core.shader_storage_buffer_object.advanced-switchBuffers-vs KHR-GLES31.core.shader_storage_buffer_object.advanced-switchBuffers-cs KHR-GLES31.core.shader_storage_buffer_object.advanced-switchPrograms-vs diff --git a/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp b/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp index 950df6fa4..ed7881c25 100644 --- a/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderStorageBufferObjectTests.cpp @@ -5136,6 +5136,73 @@ class BasicNoBindingLayout : public ShaderStorageBufferObjectBase return NO_ERROR; } }; + +//---------------------------------------------------------------------------- +// 1.14 BasicReadonlyWriteonly +//----------------------------------------------------------------------------- +class BasicReadonlyWriteonly : public ShaderStorageBufferObjectBase +{ + GLuint m_program; + GLuint m_storage_buffer[2]; + + virtual long Setup() + { + m_program = 0; + memset(m_storage_buffer, 0, sizeof(m_storage_buffer)); + return NO_ERROR; + } + + virtual long Run() + { + const char* const glsl_cs = + NL "layout(local_size_x = 1) in;" NL "layout(std430, binding = 0) buffer Input {" NL + " readonly writeonly int g_in[];" NL "};" NL "layout(std430, binding = 1) buffer Output {" NL + " int count;" NL "} g_output;" NL "void main() {" NL " g_output.count = g_in.length();" NL "}"; + + m_program = CreateProgramCS(glsl_cs); + glLinkProgram(m_program); + if (!CheckProgram(m_program)) + return ERROR; + + glGenBuffers(2, m_storage_buffer); + + /* Input */ + int input_data[] = { 1, 2, 3 }; + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_storage_buffer[0]); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(input_data), input_data, GL_STATIC_DRAW); + + /* Output */ + int output_data[] = { 0 }; + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_storage_buffer[1]); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(output_data), output_data, GL_DYNAMIC_COPY); + + glUseProgram(m_program); + glDispatchCompute(1, 1, 1); + glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); + + glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_storage_buffer[1]); + int* data = (int*)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 4, GL_MAP_READ_BIT); + if (!data) + return ERROR; + if (*data != DE_LENGTH_OF_ARRAY(input_data)) + { + m_context.getTestContext().getLog() << tcu::TestLog::Message << "Buffer data is " << *data << " should be " + << sizeof(input_data) << tcu::TestLog::EndMessage; + return ERROR; + } + glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); + return NO_ERROR; + } + + virtual long Cleanup() + { + glUseProgram(0); + glDeleteProgram(m_program); + glDeleteBuffers(2, m_storage_buffer); + return NO_ERROR; + } +}; + //----------------------------------------------------------------------------- // 2.1 AdvancedSwitchBuffers //----------------------------------------------------------------------------- @@ -9003,6 +9070,7 @@ void ShaderStorageBufferObjectTests::init() addChild(new TestSubcase(m_context, "basic-matrixOperations-case7-cs", TestSubcase::Create)); addChild(new TestSubcase(m_context, "basic-noBindingLayout", TestSubcase::Create)); + addChild(new TestSubcase(m_context, "basic-readonly-writeonly", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchBuffers", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchBuffers-cs", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchPrograms", TestSubcase::Create)); diff --git a/external/openglcts/modules/gles31/es31cShaderStorageBufferObjectTests.cpp b/external/openglcts/modules/gles31/es31cShaderStorageBufferObjectTests.cpp index cece92ed1..3e9cfe6d9 100644 --- a/external/openglcts/modules/gles31/es31cShaderStorageBufferObjectTests.cpp +++ b/external/openglcts/modules/gles31/es31cShaderStorageBufferObjectTests.cpp @@ -4857,6 +4857,72 @@ class BasicMatrixOperationsCase7CS : public BasicMatrixOperationsBaseCS } }; +//---------------------------------------------------------------------------- +// 1.13 BasicReadonlyWriteonly +//----------------------------------------------------------------------------- +class BasicReadonlyWriteonly : public ShaderStorageBufferObjectBase +{ + GLuint m_program; + GLuint m_storage_buffer[2]; + + virtual long Setup() + { + m_program = 0; + memset(m_storage_buffer, 0, sizeof(m_storage_buffer)); + return NO_ERROR; + } + + virtual long Run() + { + const char* const glsl_cs = + NL "layout(local_size_x = 1) in;" NL "layout(std430, binding = 0) buffer Input {" NL + " readonly writeonly int g_in[];" NL "};" NL "layout(std430, binding = 1) buffer Output {" NL + " int count;" NL "} g_output;" NL "void main() {" NL " g_output.count = g_in.length();" NL "}"; + + m_program = CreateProgramCS(glsl_cs); + glLinkProgram(m_program); + if (!CheckProgram(m_program)) + return ERROR; + + glGenBuffers(2, m_storage_buffer); + + /* Input */ + int input_data[] = { 1, 2, 3 }; + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_storage_buffer[0]); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(input_data), input_data, GL_STATIC_DRAW); + + /* Output */ + int output_data[] = { 0 }; + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_storage_buffer[1]); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(output_data), output_data, GL_DYNAMIC_COPY); + + glUseProgram(m_program); + glDispatchCompute(1, 1, 1); + glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); + + glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_storage_buffer[1]); + int* data = (int*)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 4, GL_MAP_READ_BIT); + if (!data) + return ERROR; + if (*data != DE_LENGTH_OF_ARRAY(input_data)) + { + m_context.getTestContext().getLog() << tcu::TestLog::Message << "Buffer data is " << *data << " should be " + << sizeof(input_data) << tcu::TestLog::EndMessage; + return ERROR; + } + glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); + return NO_ERROR; + } + + virtual long Cleanup() + { + glUseProgram(0); + glDeleteProgram(m_program); + glDeleteBuffers(2, m_storage_buffer); + return NO_ERROR; + } +}; + //----------------------------------------------------------------------------- // 2.1 AdvancedSwitchBuffers //----------------------------------------------------------------------------- @@ -8532,6 +8598,7 @@ void ShaderStorageBufferObjectTests::init() TestSubcase::Create)); addChild(new TestSubcase(m_context, "basic-matrixOperations-case7-cs", TestSubcase::Create)); + addChild(new TestSubcase(m_context, "basic-readonly-writeonly", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchBuffers-vs", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchBuffers-cs", TestSubcase::Create)); addChild(new TestSubcase(m_context, "advanced-switchPrograms-vs", TestSubcase::Create));