Refactor Renderer11::getRenderTargetResource to accept a gl::Renderbuffer…

Refactor Renderer11::getRenderTargetResource to accept a gl::Renderbuffer instead of a gl::Framebuffer. TRAC #22656 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2078 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent f4fe7105
......@@ -278,13 +278,15 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GL
void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{
if (source->getReadColorbuffer() && source->getReadColorbuffer()->getActualFormat() == (GLuint)mActualFormat)
gl::Renderbuffer *colorbuffer = source->getReadColorbuffer();
if (colorbuffer && colorbuffer->getActualFormat() == (GLuint)mActualFormat)
{
// No conversion needed-- use copyback fastpath
ID3D11Texture2D *colorBufferTexture = NULL;
unsigned int subresourceIndex = 0;
if (mRenderer->getRenderTargetResource(source, &subresourceIndex, &colorBufferTexture))
if (mRenderer->getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
{
D3D11_TEXTURE2D_DESC textureDesc;
colorBufferTexture->GetDesc(&textureDesc);
......
......@@ -2845,12 +2845,10 @@ FenceImpl *Renderer11::createFence()
return new Fence11(this);
}
bool Renderer11::getRenderTargetResource(gl::Framebuffer *framebuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
{
// TODO: mrt supprt
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
ASSERT(colorbuffer != NULL);
RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(colorbuffer->getRenderTarget());
if (renderTarget)
{
......@@ -2880,7 +2878,6 @@ bool Renderer11::getRenderTargetResource(gl::Framebuffer *framebuffer, unsigned
}
}
}
}
return false;
}
......@@ -2907,7 +2904,9 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
ID3D11Texture2D *colorBufferTexture = NULL;
unsigned int subresourceIndex = 0;
if (getRenderTargetResource(framebuffer, &subresourceIndex, &colorBufferTexture))
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
if (colorbuffer && getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
{
gl::Rectangle area;
area.x = x;
......
......@@ -18,6 +18,11 @@
#include "libGLESv2/renderer/InputLayoutCache.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
{
class Renderbuffer;
}
namespace rx
{
......@@ -173,7 +178,7 @@ class Renderer11 : public Renderer
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
bool getRenderTargetResource(gl::Framebuffer *framebuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
private:
DISALLOW_COPY_AND_ASSIGN(Renderer11);
......
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