Allow zero sized system window FBO to be declared complete, and let the…

Allow zero sized system window FBO to be declared complete, and let the application use them for rendering. TRAC #22548 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1890 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 8c6d9df2
......@@ -457,9 +457,8 @@ int Framebuffer::getSamples()
GLenum DefaultFramebuffer::completeness()
{
// The default framebuffer should always be complete
ASSERT(Framebuffer::completeness() == GL_FRAMEBUFFER_COMPLETE);
// The default framebuffer *must* always be complete, though it may not be
// subject to the same rules as application FBOs. ie, it could have 0x0 size.
return GL_FRAMEBUFFER_COMPLETE;
}
......
......@@ -20,7 +20,15 @@ namespace rx
class RenderTarget
{
public:
RenderTarget() {};
RenderTarget()
{
mWidth = 0;
mHeight = 0;
mInternalFormat = GL_NONE;
mActualFormat = GL_NONE;
mSamples = 0;
}
virtual ~RenderTarget() {};
GLsizei getWidth() { return mWidth; }
......
......@@ -141,6 +141,7 @@ RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv,
mRenderTarget = rtv;
mDepthStencil = NULL;
mShaderResource = srv;
mSubresourceIndex = 0;
if (mRenderTarget && mTexture)
{
......@@ -167,7 +168,7 @@ RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv,
mRenderTarget = NULL;
mDepthStencil = dsv;
mShaderResource = srv;
mTexture = tex;
mSubresourceIndex = 0;
if (mDepthStencil && mTexture)
{
......
......@@ -750,6 +750,14 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
return false;
}
// check for zero-sized default framebuffer, which is a special case.
// in this case we do not wish to modify any state and just silently return false.
// this will not report any gl error but will cause the calling method to return.
if (renderbufferObject->getWidth() == 0 || renderbufferObject->getHeight() == 0)
{
return false;
}
renderTargetSerial = renderbufferObject->getSerial();
}
......
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