Fixes FBO completeness check

TRAC #12571 Automatically passes default framebuffer, and fails framebuffers which have no color attachments. Signed-off-by: Andrew Lewycky Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@361 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent da13f3e9
...@@ -236,7 +236,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -236,7 +236,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
IDirect3DSurface9 *defaultRenderTarget = surface->getRenderTarget(); IDirect3DSurface9 *defaultRenderTarget = surface->getRenderTarget();
IDirect3DSurface9 *depthStencil = surface->getDepthStencil(); IDirect3DSurface9 *depthStencil = surface->getDepthStencil();
Framebuffer *framebufferZero = new Framebuffer(); Framebuffer *framebufferZero = new Framebuffer(0);
Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget); Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil); DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
...@@ -874,7 +874,7 @@ void Context::bindFramebuffer(GLuint framebuffer) ...@@ -874,7 +874,7 @@ void Context::bindFramebuffer(GLuint framebuffer)
{ {
if (!getFramebuffer(framebuffer)) if (!getFramebuffer(framebuffer))
{ {
mFramebufferMap[framebuffer] = new Framebuffer(); mFramebufferMap[framebuffer] = new Framebuffer(framebuffer);
} }
mState.framebuffer = framebuffer; mState.framebuffer = framebuffer;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace gl namespace gl
{ {
Framebuffer::Framebuffer() Framebuffer::Framebuffer(GLuint handle) : mHandle(handle)
{ {
mColorbufferType = GL_NONE; mColorbufferType = GL_NONE;
mColorbufferHandle = 0; mColorbufferHandle = 0;
...@@ -225,6 +225,8 @@ GLenum Framebuffer::completeness() ...@@ -225,6 +225,8 @@ GLenum Framebuffer::completeness()
int width = 0; int width = 0;
int height = 0; int height = 0;
if (mHandle != 0)
{
if (mColorbufferType != GL_NONE) if (mColorbufferType != GL_NONE)
{ {
Colorbuffer *colorbuffer = getColorbuffer(); Colorbuffer *colorbuffer = getColorbuffer();
...@@ -242,6 +244,10 @@ GLenum Framebuffer::completeness() ...@@ -242,6 +244,10 @@ GLenum Framebuffer::completeness()
width = colorbuffer->getWidth(); width = colorbuffer->getWidth();
height = colorbuffer->getHeight(); height = colorbuffer->getHeight();
} }
else
{
return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
}
DepthStencilbuffer *depthbuffer = NULL; DepthStencilbuffer *depthbuffer = NULL;
DepthStencilbuffer *stencilbuffer = NULL; DepthStencilbuffer *stencilbuffer = NULL;
...@@ -305,6 +311,7 @@ GLenum Framebuffer::completeness() ...@@ -305,6 +311,7 @@ GLenum Framebuffer::completeness()
return GL_FRAMEBUFFER_UNSUPPORTED; return GL_FRAMEBUFFER_UNSUPPORTED;
} }
} }
}
return GL_FRAMEBUFFER_COMPLETE; return GL_FRAMEBUFFER_COMPLETE;
} }
......
...@@ -26,7 +26,7 @@ class DepthStencilbuffer; ...@@ -26,7 +26,7 @@ class DepthStencilbuffer;
class Framebuffer class Framebuffer
{ {
public: public:
Framebuffer(); explicit Framebuffer(GLuint handle);
~Framebuffer(); ~Framebuffer();
...@@ -68,6 +68,8 @@ class Framebuffer ...@@ -68,6 +68,8 @@ class Framebuffer
GLuint mStencilbufferHandle; GLuint mStencilbufferHandle;
GLenum mStencilbufferType; GLenum mStencilbufferType;
GLuint mHandle;
}; };
} }
......
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