Commit 0fa74639 by enne@chromium.org

Allow blitting to a render texture in BlitFramebuffer.

Change the type check to allow blitting between render buffers and render textures. Store the format for render textures so that resolving to a render texture Colorbuffer will pass the format check. BUG=37 Review URL: http://codereview.appspot.com/2205043 git-svn-id: https://angleproject.googlecode.com/svn/trunk@430 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9398a6b2
......@@ -3351,7 +3351,11 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
if (mask & GL_COLOR_BUFFER_BIT)
{
if (readFramebuffer->getColorbufferType() != drawFramebuffer->getColorbufferType() ||
const bool validReadType = readFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
readFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
const bool validDrawType = drawFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
drawFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
if (!validReadType || !validDrawType ||
readFramebuffer->getColorbuffer()->getD3DFormat() != drawFramebuffer->getColorbuffer()->getD3DFormat())
{
ERR("Color buffer format conversion in BlitFramebufferANGLE not supported by this implementation");
......
......@@ -11,6 +11,7 @@
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Texture.h"
#include "libGLESv2/utilities.h"
namespace gl
......@@ -186,6 +187,13 @@ Colorbuffer::Colorbuffer(IDirect3DSurface9 *renderTarget) : mRenderTarget(render
}
}
Colorbuffer::Colorbuffer(const Texture* texture) : mRenderTarget(NULL)
{
setSize(texture->getWidth(), texture->getHeight());
mD3DFormat = texture->getD3DFormat();
mSamples = 0;
}
Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples)
{
IDirect3DDevice9 *device = getDevice();
......
......@@ -21,6 +21,7 @@
namespace gl
{
class Texture;
// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
// is called. The specific concrete type depends on whether the internal format is
......@@ -101,6 +102,7 @@ class Colorbuffer : public RenderbufferStorage
{
public:
explicit Colorbuffer(IDirect3DSurface9 *renderTarget);
explicit Colorbuffer(const Texture* texture);
Colorbuffer(int width, int height, GLenum format, GLsizei samples);
~Colorbuffer();
......
......@@ -832,6 +832,11 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
return true;
}
D3DFORMAT Texture::getD3DFormat() const
{
return selectFormat(getFormat(), mType);
}
IDirect3DBaseTexture9 *Texture::getTexture()
{
if (!isComplete())
......@@ -2046,7 +2051,7 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
}
Texture::TextureColorbufferProxy::TextureColorbufferProxy(Texture *texture, GLenum target)
: Colorbuffer(NULL), mTexture(texture), mTarget(target)
: Colorbuffer(texture), mTexture(texture), mTarget(target)
{
ASSERT(target == GL_TEXTURE_2D || IsCubemapTextureTarget(target));
}
......
......@@ -61,6 +61,7 @@ class Texture : public RefCountObject
virtual bool isCompressed() const = 0;
bool isFloatingPoint() const;
D3DFORMAT getD3DFormat() const;
IDirect3DBaseTexture9 *getTexture();
virtual Renderbuffer *getColorbuffer(GLenum target) = 0;
......
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