Commit 67333608 by Mohan Maiya Committed by Commit Bot

Vulkan: Check texture type before calling into feedbackloop check

In ContextVk::updateActiveTextures we end up calling this method shouldSwitchToReadOnlyDepthFeedbackLoopMode(...) for every active texture. Since color textures are more numerous than depth, check the texture type beforehand to decrease function stack depth. This removes 0.5% CPU overhead from a Manhattan30 offscreen run Bug: angleproject:5689 Change-Id: I14758b031e58b269392b4f450a5bb1ba8edabb44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2723493Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent b5af8bde
......@@ -4514,7 +4514,8 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context)
continue;
}
if (!isIncompleteTexture && shouldSwitchToReadOnlyDepthFeedbackLoopMode(context, texture))
if (!isIncompleteTexture && texture->isDepthOrStencil() &&
shouldSwitchToReadOnlyDepthFeedbackLoopMode(context, texture))
{
// The "readOnlyDepthMode" feature enables read-only depth-stencil feedback loops. We
// only switch to "read-only" mode when there's loop. We track the depth-stencil access
......@@ -5474,6 +5475,8 @@ angle::Result ContextVk::updateRenderPassDepthStencilAccess()
bool ContextVk::shouldSwitchToReadOnlyDepthFeedbackLoopMode(const gl::Context *context,
gl::Texture *texture) const
{
ASSERT(texture->isDepthOrStencil());
const gl::ProgramExecutable *programExecutable = mState.getProgramExecutable();
// When running compute we don't have a draw FBO.
......@@ -5482,8 +5485,7 @@ bool ContextVk::shouldSwitchToReadOnlyDepthFeedbackLoopMode(const gl::Context *c
return false;
}
return texture->isDepthOrStencil() &&
texture->isBoundToFramebuffer(mDrawFramebuffer->getState().getFramebufferSerial()) &&
return texture->isBoundToFramebuffer(mDrawFramebuffer->getState().getFramebufferSerial()) &&
!mDrawFramebuffer->isReadOnlyDepthFeedbackLoopMode();
}
......
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