Commit 4b48845f by Geoff Lang

Don't apply textures that are currently bound to the framebuffer.

parent 681c50e7
...@@ -1812,6 +1812,8 @@ void Context::applyTextures(SamplerType type) ...@@ -1812,6 +1812,8 @@ void Context::applyTextures(SamplerType type)
{ {
ProgramBinary *programBinary = getCurrentProgramBinary(); ProgramBinary *programBinary = getCurrentProgramBinary();
FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
// Range of Direct3D samplers of given sampler type // Range of Direct3D samplers of given sampler type
int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits(); int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits();
int samplerRange = programBinary->getUsedSamplerRange(type); int samplerRange = programBinary->getUsedSamplerRange(type);
...@@ -1825,7 +1827,8 @@ void Context::applyTextures(SamplerType type) ...@@ -1825,7 +1827,8 @@ void Context::applyTextures(SamplerType type)
TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex); TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
Texture *texture = getSamplerTexture(textureUnit, textureType); Texture *texture = getSamplerTexture(textureUnit, textureType);
if (texture->isSamplerComplete()) if (texture->isSamplerComplete() &&
boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end())
{ {
SamplerState samplerState; SamplerState samplerState;
texture->getSamplerState(&samplerState); texture->getSamplerState(&samplerState);
...@@ -2655,6 +2658,29 @@ const char *Context::getRendererString() const ...@@ -2655,6 +2658,29 @@ const char *Context::getRendererString() const
return mRendererString; 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, void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask) GLbitfield mask)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <set>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <hash_map> #include <hash_map>
#else #else
...@@ -420,6 +421,9 @@ class Context ...@@ -420,6 +421,9 @@ class Context
void initExtensionString(); void initExtensionString();
void initRendererString(); void initRendererString();
typedef std::set<unsigned> FramebufferTextureSerialSet;
FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
rx::Renderer *const mRenderer; rx::Renderer *const mRenderer;
State mState; State mState;
......
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