Vulkan: Keep unused uniforms list to fix glslang issues
We we're unable to cleanup the unused uniforms if we did not keep
a list of them while parsing them in ProgramLinkResource. Now
that we keep a history of them, we're able to clean them up and
fix a few dEQP tests.
Bug: angleproject:2582
Bug: angleproject:2585
Bug: angleproject:2587
Bug: angleproject:2589
Bug: angleproject:2590
Bug: angleproject:2593
Change-Id: Ic1f9151e356a3d05e83f1031cc7b187b370284e5
Reviewed-on: https://chromium-review.googlesource.com/1085644
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 7a736e0..5c7f031 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1096,8 +1096,16 @@
if (mState.mAttachedShaders[ShaderType::Compute])
{
+ ProgramLinkedResources resources = {
+ {0, PackMode::ANGLE_RELAXED},
+ {&mState.mUniformBlocks, &mState.mUniforms},
+ {&mState.mShaderStorageBlocks, &mState.mBufferVariables},
+ {&mState.mAtomicCounterBuffers},
+ {}};
+
GLuint combinedImageUniforms = 0u;
- if (!linkUniforms(context, mInfoLog, mUniformLocationBindings, &combinedImageUniforms))
+ if (!linkUniforms(context, mInfoLog, mUniformLocationBindings, &combinedImageUniforms,
+ &resources.unusedUniforms))
{
return NoError();
}
@@ -1124,12 +1132,6 @@
return NoError();
}
- ProgramLinkedResources resources = {
- {0, PackMode::ANGLE_RELAXED},
- {&mState.mUniformBlocks, &mState.mUniforms},
- {&mState.mShaderStorageBlocks, &mState.mBufferVariables},
- {&mState.mAtomicCounterBuffers}};
-
InitUniformBlockLinker(context, mState, &resources.uniformBlockLinker);
InitShaderStorageBlockLinker(context, mState, &resources.shaderStorageBlockLinker);
@@ -1141,6 +1143,26 @@
}
else
{
+ // Map the varyings to the register file
+ // In WebGL, we use a slightly different handling for packing variables.
+ gl::PackMode packMode = PackMode::ANGLE_RELAXED;
+ if (data.getLimitations().noFlexibleVaryingPacking)
+ {
+ // D3D9 pack mode is strictly more strict than WebGL, so takes priority.
+ packMode = PackMode::ANGLE_NON_CONFORMANT_D3D9;
+ }
+ else if (data.getExtensions().webglCompatibility)
+ {
+ packMode = PackMode::WEBGL_STRICT;
+ }
+
+ ProgramLinkedResources resources = {
+ {data.getCaps().maxVaryingVectors, packMode},
+ {&mState.mUniformBlocks, &mState.mUniforms},
+ {&mState.mShaderStorageBlocks, &mState.mBufferVariables},
+ {&mState.mAtomicCounterBuffers},
+ {}};
+
if (!linkAttributes(context, mInfoLog))
{
return NoError();
@@ -1152,7 +1174,8 @@
}
GLuint combinedImageUniforms = 0u;
- if (!linkUniforms(context, mInfoLog, mUniformLocationBindings, &combinedImageUniforms))
+ if (!linkUniforms(context, mInfoLog, mUniformLocationBindings, &combinedImageUniforms,
+ &resources.unusedUniforms))
{
return NoError();
}
@@ -1178,25 +1201,6 @@
ASSERT(mState.mAttachedShaders[ShaderType::Vertex]);
mState.mNumViews = mState.mAttachedShaders[ShaderType::Vertex]->getNumViews(context);
- // Map the varyings to the register file
- // In WebGL, we use a slightly different handling for packing variables.
- gl::PackMode packMode = PackMode::ANGLE_RELAXED;
- if (data.getLimitations().noFlexibleVaryingPacking)
- {
- // D3D9 pack mode is strictly more strict than WebGL, so takes priority.
- packMode = PackMode::ANGLE_NON_CONFORMANT_D3D9;
- }
- else if (data.getExtensions().webglCompatibility)
- {
- packMode = PackMode::WEBGL_STRICT;
- }
-
- ProgramLinkedResources resources = {
- {data.getCaps().maxVaryingVectors, packMode},
- {&mState.mUniformBlocks, &mState.mUniforms},
- {&mState.mShaderStorageBlocks, &mState.mBufferVariables},
- {&mState.mAtomicCounterBuffers}};
-
InitUniformBlockLinker(context, mState, &resources.uniformBlockLinker);
InitShaderStorageBlockLinker(context, mState, &resources.shaderStorageBlockLinker);
@@ -2558,7 +2562,8 @@
bool Program::linkUniforms(const Context *context,
InfoLog &infoLog,
const ProgramBindings &uniformLocationBindings,
- GLuint *combinedImageUniformsCount)
+ GLuint *combinedImageUniformsCount,
+ std::vector<UnusedUniform> *unusedUniforms)
{
UniformLinker linker(mState);
if (!linker.link(context, infoLog, uniformLocationBindings))
@@ -2566,7 +2571,7 @@
return false;
}
- linker.getResults(&mState.mUniforms, &mState.mUniformLocations);
+ linker.getResults(&mState.mUniforms, unusedUniforms, &mState.mUniformLocations);
linkSamplerAndImageBindings(combinedImageUniformsCount);