Commit 8ed634c0 by Jamie Madill Committed by Commit Bot

Vulkan: Fix qualifier replacement for sampler arrays.

The uniform name by default has the array subscript [0] appended. In the shader code it uses no subscript. Fix this by parsing out the subscript in the glslang wrapper subsitution step. This is a preliminary fix. More work on descriptor set layouts and pipeline layouts will be necessary to support sampler arrays. Bug: angleproject:2462 Change-Id: I57d6304f33822d588c7cb192607380c2f3ba20f5 Reviewed-on: https://chromium-review.googlesource.com/1089808 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent 9b168d02
...@@ -195,26 +195,28 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext, ...@@ -195,26 +195,28 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
const gl::LinkedUniform &samplerUniform = uniforms[uniformIndex]; const gl::LinkedUniform &samplerUniform = uniforms[uniformIndex];
std::string setBindingString = "set = 1, binding = " + Str(textureCount); std::string setBindingString = "set = 1, binding = " + Str(textureCount);
std::string samplerName = gl::ParseResourceName(samplerUniform.name, nullptr);
ASSERT(samplerUniform.isActive(gl::ShaderType::Vertex) || ASSERT(samplerUniform.isActive(gl::ShaderType::Vertex) ||
samplerUniform.isActive(gl::ShaderType::Fragment)); samplerUniform.isActive(gl::ShaderType::Fragment));
if (samplerUniform.isActive(gl::ShaderType::Vertex)) if (samplerUniform.isActive(gl::ShaderType::Vertex))
{ {
InsertLayoutSpecifierString(&vertexSource, samplerUniform.name, setBindingString); InsertLayoutSpecifierString(&vertexSource, samplerName, setBindingString);
InsertQualifierSpecifierString(&vertexSource, samplerUniform.name, kUniformQualifier); InsertQualifierSpecifierString(&vertexSource, samplerName, kUniformQualifier);
} }
else else
{ {
InsertQualifierSpecifierString(&vertexSource, samplerUniform.name, ""); InsertQualifierSpecifierString(&vertexSource, samplerName, "");
} }
if (samplerUniform.isActive(gl::ShaderType::Fragment)) if (samplerUniform.isActive(gl::ShaderType::Fragment))
{ {
InsertLayoutSpecifierString(&fragmentSource, samplerUniform.name, setBindingString); InsertLayoutSpecifierString(&fragmentSource, samplerName, setBindingString);
InsertQualifierSpecifierString(&fragmentSource, samplerUniform.name, kUniformQualifier); InsertQualifierSpecifierString(&fragmentSource, samplerName, kUniformQualifier);
} }
else else
{ {
InsertQualifierSpecifierString(&fragmentSource, samplerUniform.name, ""); InsertQualifierSpecifierString(&fragmentSource, samplerName, "");
} }
textureCount += samplerUniform.getBasicTypeElementCount(); textureCount += samplerUniform.getBasicTypeElementCount();
......
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