Commit a9de5d99 by Tim Van Patten Committed by Commit Bot

Vulkan: setAllDefaultUniformsDirty after createPipelineLayout

The default uniform descriptor set is reset while recreating the pipeline layout during handling of immutable samplers and then is never re-allocated and bound before the next draw. The call stack to allocate the program uniforms descriptor set: ProgramExecutableVk::allocUniformAndXfbDescriptorSet ProgramVk::updateUniforms ContextVk::setupDraw ContextVk::drawArrays Context::drawArrays Unfortunately, this occurs before the pipeline layout is reset (and the descriptor sets are reset) due to the presence of an immutable sampler: ProgramExecutableVk::reset <<---- mDescriptorSets.fill(VK_NULL_HANDLE); ProgramExecutableVk::createPipelineLayout ContextVk::updateActiveTextures ContextVk::invalidateCurrentTextures ContextVk::syncState Context::syncDirtyBits Context::prepareForDraw Context::drawArrays This CL calls setAllDefaultUniformsDirty() for the Program/PPO to ensure the default uniforms descriptor sets are re-allocated and re-bound before the next draw command. Bug: b/178424566 Bug: angleproject:5624 Test: CtsCameraTestCases Change-Id: If54a9f2cc09809a5103bc3eac641c77f56362229 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2677385Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
parent 46203e32
...@@ -4249,6 +4249,20 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context) ...@@ -4249,6 +4249,20 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context)
// TODO(http://anglebug.com/5624): rework updateActiveTextures(), createPipelineLayout(), // TODO(http://anglebug.com/5624): rework updateActiveTextures(), createPipelineLayout(),
// and handleDirtyGraphicsPipeline(). // and handleDirtyGraphicsPipeline().
mCurrentGraphicsPipeline = nullptr; mCurrentGraphicsPipeline = nullptr;
// The default uniforms descriptor set was reset during createPipelineLayout(), so mark them
// dirty to get everything reallocated/rebound before the next draw.
if (executable->hasDefaultUniforms())
{
if (mProgram)
{
mProgram->setAllDefaultUniformsDirty();
}
else if (mProgramPipeline)
{
mProgramPipeline->setAllDefaultUniformsDirty(context->getState());
}
}
} }
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -51,6 +51,7 @@ class ProgramPipelineVk : public ProgramPipelineImpl ...@@ -51,6 +51,7 @@ class ProgramPipelineVk : public ProgramPipelineImpl
angle::Result updateUniforms(ContextVk *contextVk); angle::Result updateUniforms(ContextVk *contextVk);
void setAllDefaultUniformsDirty(const gl::State &glState);
bool dirtyUniforms(const gl::State &glState); bool dirtyUniforms(const gl::State &glState);
void onProgramBind(ContextVk *contextVk); void onProgramBind(ContextVk *contextVk);
...@@ -59,7 +60,6 @@ class ProgramPipelineVk : public ProgramPipelineImpl ...@@ -59,7 +60,6 @@ class ProgramPipelineVk : public ProgramPipelineImpl
const gl::ProgramExecutable &glExecutable, const gl::ProgramExecutable &glExecutable,
const gl::State &glState, const gl::State &glState,
gl::ShaderMap<VkDeviceSize> *uniformOffsets) const; gl::ShaderMap<VkDeviceSize> *uniformOffsets) const;
void setAllDefaultUniformsDirty(const gl::State &glState);
ProgramExecutableVk mExecutable; ProgramExecutableVk mExecutable;
}; };
......
...@@ -105,6 +105,7 @@ class ProgramVk : public ProgramImpl ...@@ -105,6 +105,7 @@ class ProgramVk : public ProgramImpl
angle::Result updateUniforms(ContextVk *contextVk); angle::Result updateUniforms(ContextVk *contextVk);
void setAllDefaultUniformsDirty();
bool dirtyUniforms() const { return mDefaultUniformBlocksDirty.any(); } bool dirtyUniforms() const { return mDefaultUniformBlocksDirty.any(); }
bool isShaderUniformDirty(gl::ShaderType shaderType) const bool isShaderUniformDirty(gl::ShaderType shaderType) const
{ {
...@@ -215,8 +216,6 @@ class ProgramVk : public ProgramImpl ...@@ -215,8 +216,6 @@ class ProgramVk : public ProgramImpl
return angle::Result::Continue; return angle::Result::Continue;
} }
void setAllDefaultUniformsDirty();
gl::ShaderMap<DefaultUniformBlock> mDefaultUniformBlocks; gl::ShaderMap<DefaultUniformBlock> mDefaultUniformBlocks;
gl::ShaderBitSet mDefaultUniformBlocksDirty; gl::ShaderBitSet mDefaultUniformBlocksDirty;
......
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