Commit 3a36f306 by Jiacheng Lu Committed by Commit Bot

Always set matrix uniform to dirty when it updates

Remove the dirty checking of matrix uniform update at frontend and always let backend update whenever glUniformMatrix* is called. Profiled with UniformsBenchmark/* with vulkan backend, performance increases around 6% when data being updated is changing and performance increases around 2% when data being updated stays same. Bug: angleproject:3705 Change-Id: I8eaf6a1231e634b69c6dc540db1b9d3a312bf45d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709725 Commit-Queue: Jiacheng Lu <lujc@google.com> Reviewed-by: 's avatarTobin Ehlis <tobine@google.com>
parent bf3d9333
......@@ -2612,12 +2612,10 @@ void ProgramD3D::setUniformMatrixfvInternal(GLint location,
{
if (targetUniform->mShaderData[shaderType])
{
if (SetFloatUniformMatrixHLSL<cols, rows>::Run(arrayElementOffset, elementCount,
countIn, transpose, value,
targetUniform->mShaderData[shaderType]))
{
mShaderUniformsDirty.set(shaderType);
}
SetFloatUniformMatrixHLSL<cols, rows>::Run(arrayElementOffset, elementCount, countIn,
transpose, value,
targetUniform->mShaderData[shaderType]);
mShaderUniformsDirty.set(shaderType);
}
}
}
......
......@@ -269,7 +269,7 @@ class IncompleteTextureSet final : angle::NonCopyable
template <int cols, int rows>
struct SetFloatUniformMatrixGLSL
{
static bool Run(unsigned int arrayElementOffset,
static void Run(unsigned int arrayElementOffset,
unsigned int elementCount,
GLsizei countIn,
GLboolean transpose,
......@@ -280,7 +280,7 @@ struct SetFloatUniformMatrixGLSL
template <int cols, int rows>
struct SetFloatUniformMatrixHLSL
{
static bool Run(unsigned int arrayElementOffset,
static void Run(unsigned int arrayElementOffset,
unsigned int elementCount,
GLsizei countIn,
GLboolean transpose,
......
......@@ -930,17 +930,11 @@ void ProgramVk::setUniformMatrixfv(GLint location,
continue;
}
bool updated = SetFloatUniformMatrixGLSL<cols, rows>::Run(
SetFloatUniformMatrixGLSL<cols, rows>::Run(
locationInfo.arrayIndex, linkedUniform.getArraySizeProduct(), count, transpose, value,
uniformBlock.uniformData.data() + layoutInfo.offset);
// If the uniformsDirty flag was true, we don't want to flip it to false here if the
// setter did not update any data. We still want the uniform to be included when we'll
// update the descriptor sets.
if (updated)
{
mDefaultUniformBlocksDirty.set(shaderType);
}
mDefaultUniformBlocksDirty.set(shaderType);
}
}
......
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