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,24 +437,38 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum ...@@ -437,24 +437,38 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum
return; return;
} }
for (auto &uniformBlock : mDefaultUniformBlocks) if (linkedUniform.typeInfo->type == entryPointType)
{ {
const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location]; for (auto &uniformBlock : mDefaultUniformBlocks)
// Assume an offset of -1 means the block is unused.
if (layoutInfo.offset == -1)
{ {
continue; const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
}
const GLint componentCount = linkedUniform.typeInfo->componentCount; // Assume an offset of -1 means the block is unused.
if (linkedUniform.typeInfo->type == entryPointType) if (layoutInfo.offset == -1)
{ {
continue;
}
const GLint componentCount = linkedUniform.typeInfo->componentCount;
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,8 +484,8 @@ void ProgramVk::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum ...@@ -470,8 +484,8 @@ 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;
} }
} }
......
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