Commit 24a3137a by Luc Ferron Committed by Commit Bot

Vulkan: Follow up change to optimize number of condition checks

This is a follow up of a comment on this CL: https://chromium-review.googlesource.com/c/angle/angle/+/985954 Bug: angleproject:2442 Change-Id: Id104c1437d77e6102b94351623ee8538a1d6c3d7 Reviewed-on: https://chromium-review.googlesource.com/996012Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
parent 364a9557
...@@ -437,6 +437,8 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum ...@@ -437,6 +437,8 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum
return; return;
} }
if (linkedUniform.typeInfo->type == entryPointType)
{
for (auto &uniformBlock : mDefaultUniformBlocks) for (auto &uniformBlock : mDefaultUniformBlocks)
{ {
const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location]; const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
...@@ -448,13 +450,25 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum ...@@ -448,13 +450,25 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum
} }
const GLint componentCount = linkedUniform.typeInfo->componentCount; const GLint componentCount = linkedUniform.typeInfo->componentCount;
if (linkedUniform.typeInfo->type == entryPointType)
{
UpdateDefaultUniformBlock(count, locationInfo.arrayIndex, componentCount, v, layoutInfo, UpdateDefaultUniformBlock(count, locationInfo.arrayIndex, componentCount, v, layoutInfo,
&uniformBlock.uniformData); &uniformBlock.uniformData);
uniformBlock.uniformsDirty = true;
}
} }
else else
{ {
for (auto &uniformBlock : mDefaultUniformBlocks)
{
const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
// Assume an offset of -1 means the block is unused.
if (layoutInfo.offset == -1)
{
continue;
}
const GLint componentCount = linkedUniform.typeInfo->componentCount;
ASSERT(linkedUniform.typeInfo->type == gl::VariableBoolVectorType(entryPointType)); ASSERT(linkedUniform.typeInfo->type == gl::VariableBoolVectorType(entryPointType));
GLint initialArrayOffset = locationInfo.arrayIndex * layoutInfo.arrayStride; GLint initialArrayOffset = locationInfo.arrayIndex * layoutInfo.arrayStride;
...@@ -470,9 +484,9 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum ...@@ -470,9 +484,9 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum
dest[c] = (source[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE; dest[c] = (source[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE;
} }
} }
}
uniformBlock.uniformsDirty = true; uniformBlock.uniformsDirty = true;
} }
}
} }
template <typename T> template <typename T>
......
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