Commit 76f66954 by Qin Jiajia Committed by Commit Bot

ES31: Fix the bug that SSBO is active but not statically used

If a SSBO is active but not statically used, there will be no UAV slot is bound. So we should skip this kind of block. Bug: angleproject:1951 Change-Id: I4d813ddefcce6c31fa02701f26148eb21c00f380 Reviewed-on: https://chromium-review.googlesource.com/c/1381847Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
parent 0c667215
...@@ -3514,6 +3514,13 @@ angle::Result StateManager11::syncShaderStorageBuffersForShader(const gl::Contex ...@@ -3514,6 +3514,13 @@ angle::Result StateManager11::syncShaderStorageBuffersForShader(const gl::Contex
const unsigned int registerIndex = mProgramD3D->getShaderStorageBufferRegisterIndex( const unsigned int registerIndex = mProgramD3D->getShaderStorageBufferRegisterIndex(
static_cast<GLuint>(blockIndex), shaderType); static_cast<GLuint>(blockIndex), shaderType);
// It means this block is active but not statically used.
if (registerIndex == GL_INVALID_INDEX)
{
continue;
}
switch (shaderType) switch (shaderType)
{ {
case gl::ShaderType::Compute: case gl::ShaderType::Compute:
......
...@@ -332,6 +332,40 @@ TEST_P(ShaderStorageBufferTest31, ShaderStorageBufferVector) ...@@ -332,6 +332,40 @@ TEST_P(ShaderStorageBufferTest31, ShaderStorageBufferVector)
runVectorTest(vectorCase); runVectorTest(vectorCase);
} }
// Test that the shader works well with an active SSBO but not statically used.
TEST_P(ShaderStorageBufferTest31, ActiveSSBOButNotStaticallyUsed)
{
constexpr char kComputeShaderSource[] =
R"(#version 310 es
layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
layout(std140, binding = 0) buffer blockIn {
uvec2 data;
} instanceIn;
layout(std140, binding = 1) buffer blockOut {
uvec2 data;
} instanceOut;
layout(std140, binding = 2) buffer blockC {
uvec2 data;
} instanceC;
void main()
{
instanceOut.data[0] = instanceIn.data[0];
instanceOut.data[1] = instanceIn.data[1];
}
)";
GLBuffer shaderStorageBufferC;
glBindBuffer(GL_SHADER_STORAGE_BUFFER, shaderStorageBufferC);
glBufferData(GL_SHADER_STORAGE_BUFFER, 32, nullptr, GL_STATIC_DRAW);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, shaderStorageBufferC);
constexpr unsigned int kComponentCount = 2;
constexpr GLuint kInputValues[kComponentCount] = {3u, 4u};
VectorCase vectorCase(kComponentCount, kComputeShaderSource, kInputValues, kInputValues);
runVectorTest(vectorCase);
}
// Test that access/write to swizzle scalar data in shader storage block. // Test that access/write to swizzle scalar data in shader storage block.
TEST_P(ShaderStorageBufferTest31, ScalarSwizzleTest) TEST_P(ShaderStorageBufferTest31, ScalarSwizzleTest)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment