Commit 74b30e46 by Jamie Madill Committed by Commit Bot

Improve the speed of MarkAttachmentsDirty.

Only iterate the enabled draw buffers, and the depth/stencil buffer. This series of small optimizations gives about a 15% improvement on the draw call benchmark for the D3D11 backend with the null driver. BUG=angleproject:1155 Change-Id: I5b29362f93c016c146d2a6527b378853bc070239 Reviewed-on: https://chromium-review.googlesource.com/666046Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 1b7ed0ef
...@@ -33,7 +33,7 @@ namespace ...@@ -33,7 +33,7 @@ namespace
gl::Error MarkAttachmentsDirty(const gl::Context *context, gl::Error MarkAttachmentsDirty(const gl::Context *context,
const gl::FramebufferAttachment *attachment) const gl::FramebufferAttachment *attachment)
{ {
if (attachment && attachment->type() == GL_TEXTURE) if (attachment->type() == GL_TEXTURE)
{ {
gl::Texture *texture = attachment->getTexture(); gl::Texture *texture = attachment->getTexture();
...@@ -98,16 +98,19 @@ Framebuffer11::~Framebuffer11() ...@@ -98,16 +98,19 @@ Framebuffer11::~Framebuffer11()
gl::Error Framebuffer11::markAttachmentsDirty(const gl::Context *context) const gl::Error Framebuffer11::markAttachmentsDirty(const gl::Context *context) const
{ {
for (const auto &colorAttachment : mState.getColorAttachments()) const auto &colorAttachments = mState.getColorAttachments();
{ for (size_t drawBuffer : mState.getEnabledDrawBuffers())
if (colorAttachment.isAttached())
{ {
const gl::FramebufferAttachment &colorAttachment = colorAttachments[drawBuffer];
ASSERT(colorAttachment.isAttached());
ANGLE_TRY(MarkAttachmentsDirty(context, &colorAttachment)); ANGLE_TRY(MarkAttachmentsDirty(context, &colorAttachment));
} }
}
ANGLE_TRY(MarkAttachmentsDirty(context, mState.getDepthAttachment())); auto dsAttachment = mState.getDepthOrStencilAttachment();
ANGLE_TRY(MarkAttachmentsDirty(context, mState.getStencilAttachment())); if (dsAttachment)
{
ANGLE_TRY(MarkAttachmentsDirty(context, dsAttachment));
}
return gl::NoError(); return gl::NoError();
} }
......
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