diff options
author | Geoff Lang <geofflang@chromium.org> | 2013-10-28 10:42:47 -0400 |
---|---|---|
committer | Geoff Lang <geofflang@chromium.org> | 2013-10-31 15:45:09 -0400 |
commit | 4b48845f74fb54052a6b693c62d269d0952d4289 (patch) | |
tree | 3c33fb85eecdca56e1576b654ca94fe62e520995 | |
parent | 681c50e705df7fde4f9c91210b777f185b63fb20 (diff) | |
download | angle_dx11-4b48845f74fb54052a6b693c62d269d0952d4289.tar.gz |
Don't apply textures that are currently bound to the framebuffer.
BUG=496
Review URL=https://codereview.appspot.com/18690043/
-rw-r--r-- | src/libGLESv2/Context.cpp | 28 | ||||
-rw-r--r-- | src/libGLESv2/Context.h | 4 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp index e084db1a..fba4104d 100644 --- a/src/libGLESv2/Context.cpp +++ b/src/libGLESv2/Context.cpp @@ -1812,6 +1812,8 @@ void Context::applyTextures(SamplerType type) { ProgramBinary *programBinary = getCurrentProgramBinary(); + FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials(); + // Range of Direct3D samplers of given sampler type int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits(); int samplerRange = programBinary->getUsedSamplerRange(type); @@ -1825,7 +1827,8 @@ void Context::applyTextures(SamplerType type) TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex); Texture *texture = getSamplerTexture(textureUnit, textureType); - if (texture->isSamplerComplete()) + if (texture->isSamplerComplete() && + boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end()) { SamplerState samplerState; texture->getSamplerState(&samplerState); @@ -2655,6 +2658,29 @@ const char *Context::getRendererString() const return mRendererString; } +Context::FramebufferTextureSerialSet Context::getBoundFramebufferTextureSerials() +{ + FramebufferTextureSerialSet set; + + Framebuffer *drawFramebuffer = getDrawFramebuffer(); + for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++) + { + Renderbuffer *renderBuffer = drawFramebuffer->getColorbuffer(i); + if (renderBuffer && renderBuffer->getTextureSerial() != 0) + { + set.insert(renderBuffer->getTextureSerial()); + } + } + + Renderbuffer *depthStencilBuffer = drawFramebuffer->getDepthOrStencilbuffer(); + if (depthStencilBuffer && depthStencilBuffer->getTextureSerial() != 0) + { + set.insert(depthStencilBuffer->getTextureSerial()); + } + + return set; +} + void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask) diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h index 349ec130..09eede9f 100644 --- a/src/libGLESv2/Context.h +++ b/src/libGLESv2/Context.h @@ -18,6 +18,7 @@ #include <string> #include <map> +#include <set> #ifdef _MSC_VER #include <hash_map> #else @@ -420,6 +421,9 @@ class Context void initExtensionString(); void initRendererString(); + typedef std::set<unsigned> FramebufferTextureSerialSet; + FramebufferTextureSerialSet getBoundFramebufferTextureSerials(); + rx::Renderer *const mRenderer; State mState; |