Commit fab10c23 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Optimize unused uniform cleanup in glslang wrapper

Bug: angleproject:3803 Change-Id: Ib260c86c68e5b11deaec8658cd9768af9b44e086 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1949629 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c3f0352d
...@@ -863,26 +863,25 @@ void AssignTextureBindings(const GlslangSourceOptions &options, ...@@ -863,26 +863,25 @@ void AssignTextureBindings(const GlslangSourceOptions &options,
void CleanupUnusedEntities(bool useOldRewriteStructSamplers, void CleanupUnusedEntities(bool useOldRewriteStructSamplers,
const gl::ProgramState &programState, const gl::ProgramState &programState,
const gl::ProgramLinkedResources &resources, const gl::ProgramLinkedResources &resources,
gl::ShaderType shaderType,
gl::ShaderMap<IntermediateShaderSource> *shaderSources) gl::ShaderMap<IntermediateShaderSource> *shaderSources)
{ {
gl::Shader *shader = programState.getAttachedShader(shaderType); IntermediateShaderSource &vertexSource = (*shaderSources)[gl::ShaderType::Vertex];
IntermediateShaderSource &source = (*shaderSources)[shaderType]; if (!vertexSource.empty())
if (!source.empty())
{ {
ASSERT(shader != nullptr); gl::Shader *glVertexShader = programState.getAttachedShader(gl::ShaderType::Vertex);
ASSERT(glVertexShader != nullptr);
// The attributes in the programState could have been filled with active attributes only // The attributes in the programState could have been filled with active attributes only
// depending on the shader version. If there is inactive attributes left, we have to remove // depending on the shader version. If there is inactive attributes left, we have to remove
// their @@ QUALIFIER and @@ LAYOUT markers. // their @@ QUALIFIER and @@ LAYOUT markers.
for (const sh::ShaderVariable &attribute : shader->getAllAttributes()) for (const sh::ShaderVariable &attribute : glVertexShader->getAllAttributes())
{ {
if (attribute.active) if (attribute.active)
{ {
continue; continue;
} }
source.eraseLayoutAndQualifierSpecifiers(attribute.name, ""); vertexSource.eraseLayoutAndQualifierSpecifiers(attribute.name, "");
} }
} }
...@@ -1090,11 +1089,8 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options, ...@@ -1090,11 +1089,8 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options,
AssignTextureBindings(options, useOldRewriteStructSamplers, programState, &intermediateSources); AssignTextureBindings(options, useOldRewriteStructSamplers, programState, &intermediateSources);
AssignNonTextureBindings(options, programState, &intermediateSources); AssignNonTextureBindings(options, programState, &intermediateSources);
for (const auto shaderType : gl::kAllGraphicsShaderTypes) CleanupUnusedEntities(useOldRewriteStructSamplers, programState, resources,
{ &intermediateSources);
CleanupUnusedEntities(useOldRewriteStructSamplers, programState, resources, shaderType,
&intermediateSources);
}
// Write transform feedback output code. // Write transform feedback output code.
if (!vertexSource->empty()) if (!vertexSource->empty())
......
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