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, ...@@ -2612,12 +2612,10 @@ void ProgramD3D::setUniformMatrixfvInternal(GLint location,
{ {
if (targetUniform->mShaderData[shaderType]) if (targetUniform->mShaderData[shaderType])
{ {
if (SetFloatUniformMatrixHLSL<cols, rows>::Run(arrayElementOffset, elementCount, SetFloatUniformMatrixHLSL<cols, rows>::Run(arrayElementOffset, elementCount, countIn,
countIn, transpose, value, transpose, value,
targetUniform->mShaderData[shaderType])) targetUniform->mShaderData[shaderType]);
{ mShaderUniformsDirty.set(shaderType);
mShaderUniformsDirty.set(shaderType);
}
} }
} }
} }
......
...@@ -269,7 +269,7 @@ class IncompleteTextureSet final : angle::NonCopyable ...@@ -269,7 +269,7 @@ class IncompleteTextureSet final : angle::NonCopyable
template <int cols, int rows> template <int cols, int rows>
struct SetFloatUniformMatrixGLSL struct SetFloatUniformMatrixGLSL
{ {
static bool Run(unsigned int arrayElementOffset, static void Run(unsigned int arrayElementOffset,
unsigned int elementCount, unsigned int elementCount,
GLsizei countIn, GLsizei countIn,
GLboolean transpose, GLboolean transpose,
...@@ -280,7 +280,7 @@ struct SetFloatUniformMatrixGLSL ...@@ -280,7 +280,7 @@ struct SetFloatUniformMatrixGLSL
template <int cols, int rows> template <int cols, int rows>
struct SetFloatUniformMatrixHLSL struct SetFloatUniformMatrixHLSL
{ {
static bool Run(unsigned int arrayElementOffset, static void Run(unsigned int arrayElementOffset,
unsigned int elementCount, unsigned int elementCount,
GLsizei countIn, GLsizei countIn,
GLboolean transpose, GLboolean transpose,
......
...@@ -930,17 +930,11 @@ void ProgramVk::setUniformMatrixfv(GLint location, ...@@ -930,17 +930,11 @@ void ProgramVk::setUniformMatrixfv(GLint location,
continue; continue;
} }
bool updated = SetFloatUniformMatrixGLSL<cols, rows>::Run( SetFloatUniformMatrixGLSL<cols, rows>::Run(
locationInfo.arrayIndex, linkedUniform.getArraySizeProduct(), count, transpose, value, locationInfo.arrayIndex, linkedUniform.getArraySizeProduct(), count, transpose, value,
uniformBlock.uniformData.data() + layoutInfo.offset); uniformBlock.uniformData.data() + layoutInfo.offset);
// If the uniformsDirty flag was true, we don't want to flip it to false here if the mDefaultUniformBlocksDirty.set(shaderType);
// 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);
}
} }
} }
......
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