Commit e8356bb0 by Geoff Lang

Update Renderer::copyImage to return Error objects.

BUG=angle:520 Change-Id: I1bb7a53bc75ebb8bf324935b673ea636bdff6931 Reviewed-on: https://chromium-review.googlesource.com/216641Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 64839155
...@@ -175,14 +175,14 @@ class Renderer ...@@ -175,14 +175,14 @@ class Renderer
virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source) = 0; virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source) = 0;
virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source) = 0; virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source) = 0;
virtual bool copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level) = 0; GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level) = 0;
virtual bool copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level) = 0; GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level) = 0;
virtual bool copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) = 0;
virtual bool copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) = 0; GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) = 0;
virtual gl::Error copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) = 0;
virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect, virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter) = 0; const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter) = 0;
......
...@@ -1947,50 +1947,44 @@ bool Renderer11::copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage ...@@ -1947,50 +1947,44 @@ bool Renderer11::copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage
return false; return false;
} }
bool Renderer11::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer11::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level)
{ {
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the color buffer from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer); RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer);
if (!sourceRenderTarget) if (!sourceRenderTarget)
{ {
ERR("Failed to retrieve the render target from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView(); ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target view from the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage); TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage);
if (!storage11) if (!storage11)
{ {
ERR("Failed to retrieve the texture storage from the destination."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the texture storage from the destination.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::ImageIndex index = gl::ImageIndex::Make2D(level); gl::ImageIndex index = gl::ImageIndex::Make2D(level);
RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index)); RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index));
if (!destRenderTarget) if (!destRenderTarget)
{ {
ERR("Failed to retrieve the render target from the destination storage."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the destination storage.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView(); ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
if (!dest) if (!dest)
{ {
ERR("Failed to retrieve the render target view from the destination render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the destination render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1); gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
...@@ -2001,61 +1995,56 @@ bool Renderer11::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle & ...@@ -2001,61 +1995,56 @@ bool Renderer11::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &
// Use nearest filtering because source and destination are the same size for the direct // Use nearest filtering because source and destination are the same size for the direct
// copy // copy
if (mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, gl::Error error = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
destFormat, GL_NEAREST).isError()) destFormat, GL_NEAREST);
if (error.isError())
{ {
return false; return error;
} }
storage11->invalidateSwizzleCacheLevel(level); storage11->invalidateSwizzleCacheLevel(level);
return true; return gl::Error(GL_NO_ERROR);
} }
bool Renderer11::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer11::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level) GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level)
{ {
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the color buffer from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer); RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer);
if (!sourceRenderTarget) if (!sourceRenderTarget)
{ {
ERR("Failed to retrieve the render target from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView(); ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target view from the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage); TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage);
if (!storage11) if (!storage11)
{ {
ERR("Failed to retrieve the texture storage from the destination."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the texture storage from the destination.");;
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level); gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index)); RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index));
if (!destRenderTarget) if (!destRenderTarget)
{ {
ERR("Failed to retrieve the render target from the destination storage."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the destination storage.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView(); ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
if (!dest) if (!dest)
{ {
ERR("Failed to retrieve the render target view from the destination render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the destination render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1); gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
...@@ -2066,61 +2055,56 @@ bool Renderer11::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle ...@@ -2066,61 +2055,56 @@ bool Renderer11::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle
// Use nearest filtering because source and destination are the same size for the direct // Use nearest filtering because source and destination are the same size for the direct
// copy // copy
if (mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, gl::Error error = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
destFormat, GL_NEAREST).isError()) destFormat, GL_NEAREST);
if (error.isError())
{ {
return false; return error;
} }
storage11->invalidateSwizzleCacheLevel(level); storage11->invalidateSwizzleCacheLevel(level);
return true; return gl::Error(GL_NO_ERROR);
} }
bool Renderer11::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer11::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level)
{ {
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the color buffer from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer); RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer);
if (!sourceRenderTarget) if (!sourceRenderTarget)
{ {
ERR("Failed to retrieve the render target from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView(); ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target view from the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage); TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage);
if (!storage11) if (!storage11)
{ {
ERR("Failed to retrieve the texture storage from the destination."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the texture storage from the destination.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::ImageIndex index = gl::ImageIndex::Make3D(level, zOffset); gl::ImageIndex index = gl::ImageIndex::Make3D(level, zOffset);
RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index)); RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(index));
if (!destRenderTarget) if (!destRenderTarget)
{ {
ERR("Failed to retrieve the render target from the destination storage."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the destination storage.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView(); ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
if (!dest) if (!dest)
{ {
ERR("Failed to retrieve the render target view from the destination render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the destination render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1); gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
...@@ -2131,47 +2115,44 @@ bool Renderer11::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle & ...@@ -2131,47 +2115,44 @@ bool Renderer11::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &
// Use nearest filtering because source and destination are the same size for the direct // Use nearest filtering because source and destination are the same size for the direct
// copy // copy
if (mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, gl::Error error = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
destFormat, GL_NEAREST).isError()) destFormat, GL_NEAREST);
if (error.isError())
{ {
return false; return error;
} }
storage11->invalidateSwizzleCacheLevel(level); storage11->invalidateSwizzleCacheLevel(level);
return true; return gl::Error(GL_NO_ERROR);
} }
bool Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level)
{ {
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the color buffer from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer); RenderTarget11 *sourceRenderTarget = d3d11::GetAttachmentRenderTarget(colorbuffer);
if (!sourceRenderTarget) if (!sourceRenderTarget)
{ {
ERR("Failed to retrieve the render target from the frame buffer."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the frame buffer.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView(); ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target view from the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage); TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage);
if (!storage11) if (!storage11)
{ {
SafeRelease(source); SafeRelease(source);
ERR("Failed to retrieve the texture storage from the destination."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the texture storage from the destination.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, zOffset); gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, zOffset);
...@@ -2179,15 +2160,13 @@ bool Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectan ...@@ -2179,15 +2160,13 @@ bool Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectan
if (!destRenderTarget) if (!destRenderTarget)
{ {
SafeRelease(source); SafeRelease(source);
ERR("Failed to retrieve the render target from the destination storage."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target from the destination storage.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView(); ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
if (!dest) if (!dest)
{ {
ERR("Failed to retrieve the render target view from the destination render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the render target view from the destination render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1); gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
...@@ -2198,15 +2177,16 @@ bool Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectan ...@@ -2198,15 +2177,16 @@ bool Renderer11::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectan
// Use nearest filtering because source and destination are the same size for the direct // Use nearest filtering because source and destination are the same size for the direct
// copy // copy
if (mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, gl::Error error = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
destFormat, GL_NEAREST).isError()) destFormat, GL_NEAREST);
if (error.isError())
{ {
return false; return error;
} }
storage11->invalidateSwizzleCacheLevel(level); storage11->invalidateSwizzleCacheLevel(level);
return true; return gl::Error(GL_NO_ERROR);
} }
void Renderer11::unapplyRenderTargets() void Renderer11::unapplyRenderTargets()
......
...@@ -120,14 +120,14 @@ class Renderer11 : public Renderer ...@@ -120,14 +120,14 @@ class Renderer11 : public Renderer
virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source); virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source);
virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source); virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source);
virtual bool copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level); GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level);
virtual bool copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level); GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level);
virtual bool copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual bool copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level); GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual gl::Error copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect, virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter); const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
......
...@@ -113,9 +113,9 @@ void Blit9::initGeometry() ...@@ -113,9 +113,9 @@ void Blit9::initGeometry()
} }
template <class D3DShaderType> template <class D3DShaderType>
bool Blit9::setShader(ShaderId source, const char *profile, gl::Error Blit9::setShader(ShaderId source, const char *profile,
D3DShaderType *(rx::Renderer9::*createShader)(const DWORD *, size_t length), D3DShaderType *(rx::Renderer9::*createShader)(const DWORD *, size_t length),
HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*)) HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
{ {
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -133,30 +133,27 @@ bool Blit9::setShader(ShaderId source, const char *profile, ...@@ -133,30 +133,27 @@ bool Blit9::setShader(ShaderId source, const char *profile,
shader = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize); shader = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize);
if (!shader) if (!shader)
{ {
ERR("Failed to create shader for blit operation"); return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal shader for blit operation");
return false;
} }
mCompiledShaders[source] = shader; mCompiledShaders[source] = shader;
} }
HRESULT hr = (device->*setShader)(shader); HRESULT hr = (device->*setShader)(shader);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to set shader for blit operation"); return gl::Error(GL_OUT_OF_MEMORY, "Failed to set shader for blit operation, result: 0x%X.", hr);
return false;
} }
return true; return gl::Error(GL_NO_ERROR);
} }
bool Blit9::setVertexShader(ShaderId shader) gl::Error Blit9::setVertexShader(ShaderId shader)
{ {
return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &rx::Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader); return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &rx::Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader);
} }
bool Blit9::setPixelShader(ShaderId shader) gl::Error Blit9::setPixelShader(ShaderId shader)
{ {
return setShader<IDirect3DPixelShader9>(shader, "ps_2_0", &rx::Renderer9::createPixelShader, &IDirect3DDevice9::SetPixelShader); return setShader<IDirect3DPixelShader9>(shader, "ps_2_0", &rx::Renderer9::createPixelShader, &IDirect3DDevice9::SetPixelShader);
} }
...@@ -175,12 +172,13 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const ...@@ -175,12 +172,13 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
return rect; return rect;
} }
bool Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{ {
IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source)); IDirect3DTexture9 *texture = NULL;
if (!texture) gl::Error error = copySurfaceToTexture(source, getSurfaceRect(source), &texture);
if (error.isError())
{ {
return false; return error;
} }
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -205,10 +203,10 @@ bool Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) ...@@ -205,10 +203,10 @@ bool Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
restoreState(); restoreState();
return true; return gl::Error(GL_NO_ERROR);
} }
bool Blit9::copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level) gl::Error Blit9::copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level)
{ {
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL; IDirect3DSurface9 *source = NULL;
...@@ -226,25 +224,26 @@ bool Blit9::copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum ...@@ -226,25 +224,26 @@ bool Blit9::copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the internal render target for texture blit.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage); TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage);
IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true); IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true);
bool result = false; if (!destSurface)
if (destSurface)
{ {
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface); SafeRelease(source);
SafeRelease(destSurface); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the destination surface for texture blit.");
} }
gl::Error result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
SafeRelease(destSurface);
SafeRelease(source); SafeRelease(source);
return result; return result;
} }
bool Blit9::copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level) gl::Error Blit9::copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level)
{ {
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL; IDirect3DSurface9 *source = NULL;
...@@ -262,30 +261,29 @@ bool Blit9::copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenu ...@@ -262,30 +261,29 @@ bool Blit9::copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenu
if (!source) if (!source)
{ {
ERR("Failed to retrieve the render target."); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the internal render target for texture blit.");
return gl::error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage); TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage);
IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(target, level, true); IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(target, level, true);
bool result = false;
if (destSurface) if (!destSurface)
{ {
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface); SafeRelease(source);
SafeRelease(destSurface); return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the destination surface for texture blit.");
} }
gl::Error result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
SafeRelease(destSurface);
SafeRelease(source); SafeRelease(source);
return result; return result;
} }
bool Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest) gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{ {
if (!dest) ASSERT(source != NULL && dest != NULL);
{
return false;
}
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -303,22 +301,24 @@ bool Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destF ...@@ -303,22 +301,24 @@ bool Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destF
if (FAILED(result)) if (FAILED(result))
{ {
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY, false); return gl::Error(GL_OUT_OF_MEMORY, "Failed to blit between textures, StretchRect result: 0x%X.", result);
} }
return gl::Error(GL_NO_ERROR);
} }
else else
{ {
return formatConvert(source, sourceRect, destFormat, xoffset, yoffset, dest); return formatConvert(source, sourceRect, destFormat, xoffset, yoffset, dest);
} }
return true;
} }
bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest) gl::Error Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{ {
IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect); IDirect3DTexture9 *texture = NULL;
if (!texture) gl::Error error = copySurfaceToTexture(source, sourceRect, &texture);
if (error.isError())
{ {
return false; return error;
} }
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -331,7 +331,9 @@ bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLe ...@@ -331,7 +331,9 @@ bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLe
setViewport(sourceRect, xoffset, yoffset); setViewport(sourceRect, xoffset, yoffset);
setCommonBlitState(); setCommonBlitState();
if (setFormatConvertShaders(destFormat))
error = setFormatConvertShaders(destFormat);
if (!error.isError())
{ {
render(); render();
} }
...@@ -340,12 +342,16 @@ bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLe ...@@ -340,12 +342,16 @@ bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLe
restoreState(); restoreState();
return true; return error;
} }
bool Blit9::setFormatConvertShaders(GLenum destFormat) gl::Error Blit9::setFormatConvertShaders(GLenum destFormat)
{ {
bool okay = setVertexShader(SHADER_VS_STANDARD); gl::Error error = setVertexShader(SHADER_VS_STANDARD);
if (error.isError())
{
return error;
}
switch (destFormat) switch (destFormat)
{ {
...@@ -356,18 +362,18 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat) ...@@ -356,18 +362,18 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat)
case GL_RG_EXT: case GL_RG_EXT:
case GL_RED_EXT: case GL_RED_EXT:
case GL_ALPHA: case GL_ALPHA:
okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK); error = setPixelShader(SHADER_PS_COMPONENTMASK);
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
okay = okay && setPixelShader(SHADER_PS_LUMINANCE); error = setPixelShader(SHADER_PS_LUMINANCE);
break; break;
} }
if (!okay) if (error.isError())
{ {
return false; return error;
} }
enum { X = 0, Y = 1, Z = 2, W = 3 }; enum { X = 0, Y = 1, Z = 2, W = 3 };
...@@ -463,15 +469,12 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat) ...@@ -463,15 +469,12 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat)
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2); mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
return true; return gl::Error(GL_NO_ERROR);
} }
IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect) gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect, IDirect3DTexture9 **outTexture)
{ {
if (!surface) ASSERT(surface);
{
return NULL;
}
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -485,7 +488,7 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const ...@@ -485,7 +488,7 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const
if (FAILED(result)) if (FAILED(result))
{ {
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL); return gl::Error(GL_OUT_OF_MEMORY, "Failed to allocate internal texture for blit, result: 0x%X.", result);
} }
IDirect3DSurface9 *textureSurface; IDirect3DSurface9 *textureSurface;
...@@ -495,7 +498,7 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const ...@@ -495,7 +498,7 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const
{ {
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(texture); SafeRelease(texture);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL); return gl::Error(GL_OUT_OF_MEMORY, "Failed to query surface of internal blit texture, result: 0x%X.", result);
} }
mRenderer->endScene(); mRenderer->endScene();
...@@ -507,10 +510,11 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const ...@@ -507,10 +510,11 @@ IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const
{ {
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(texture); SafeRelease(texture);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL); return gl::Error(GL_OUT_OF_MEMORY, "Failed to copy between internal blit textures, result: 0x%X.", result);
} }
return texture; *outTexture = texture;
return gl::Error(GL_NO_ERROR);
} }
void Blit9::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset) void Blit9::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define LIBGLESV2_BLIT9_H_ #define LIBGLESV2_BLIT9_H_
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libGLESv2/Error.h"
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
...@@ -31,17 +32,17 @@ class Blit9 ...@@ -31,17 +32,17 @@ class Blit9
// Copy from source surface to dest surface. // Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left) // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
bool copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level); gl::Error copy2D(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level);
bool copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level); gl::Error copyCube(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level);
// Copy from source surface to dest surface. // Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left) // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
// source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0. // source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
bool formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest); gl::Error formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
// 2x2 box filter sample from source to dest. // 2x2 box filter sample from source to dest.
// Requires that source is RGB(A) and dest has the same format as source. // Requires that source is RGB(A) and dest has the same format as source.
bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest); gl::Error boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
private: private:
rx::Renderer9 *mRenderer; rx::Renderer9 *mRenderer;
...@@ -51,10 +52,10 @@ class Blit9 ...@@ -51,10 +52,10 @@ class Blit9
void initGeometry(); void initGeometry();
bool setFormatConvertShaders(GLenum destFormat); gl::Error setFormatConvertShaders(GLenum destFormat);
bool copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest); gl::Error copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
IDirect3DTexture9 *copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect); gl::Error copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect, IDirect3DTexture9 **outTexture);
void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset); void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset);
void setCommonBlitState(); void setCommonBlitState();
RECT getSurfaceRect(IDirect3DSurface9 *surface) const; RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
...@@ -74,12 +75,12 @@ class Blit9 ...@@ -74,12 +75,12 @@ class Blit9
IUnknown *mCompiledShaders[SHADER_COUNT]; IUnknown *mCompiledShaders[SHADER_COUNT];
template <class D3DShaderType> template <class D3DShaderType>
bool setShader(ShaderId source, const char *profile, gl::Error setShader(ShaderId source, const char *profile,
D3DShaderType *(Renderer9::*createShader)(const DWORD *, size_t length), D3DShaderType *(Renderer9::*createShader)(const DWORD *, size_t length),
HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*)); HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
bool setVertexShader(ShaderId shader); gl::Error setVertexShader(ShaderId shader);
bool setPixelShader(ShaderId shader); gl::Error setPixelShader(ShaderId shader);
void render(); void render();
void saveState(); void saveState();
......
...@@ -2429,8 +2429,8 @@ D3DPOOL Renderer9::getBufferPool(DWORD usage) const ...@@ -2429,8 +2429,8 @@ D3DPOOL Renderer9::getBufferPool(DWORD usage) const
return D3DPOOL_DEFAULT; return D3DPOOL_DEFAULT;
} }
bool Renderer9::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer9::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level)
{ {
RECT rect; RECT rect;
rect.left = sourceRect.x; rect.left = sourceRect.x;
...@@ -2441,8 +2441,8 @@ bool Renderer9::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &s ...@@ -2441,8 +2441,8 @@ bool Renderer9::copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &s
return mBlit->copy2D(framebuffer, rect, destFormat, xoffset, yoffset, storage, level); return mBlit->copy2D(framebuffer, rect, destFormat, xoffset, yoffset, storage, level);
} }
bool Renderer9::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer9::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level) GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level)
{ {
RECT rect; RECT rect;
rect.left = sourceRect.x; rect.left = sourceRect.x;
...@@ -2453,20 +2453,20 @@ bool Renderer9::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle ...@@ -2453,20 +2453,20 @@ bool Renderer9::copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle
return mBlit->copyCube(framebuffer, rect, destFormat, xoffset, yoffset, storage, target, level); return mBlit->copyCube(framebuffer, rect, destFormat, xoffset, yoffset, storage, target, level);
} }
bool Renderer9::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer9::copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level)
{ {
// 3D textures are not available in the D3D9 backend. // 3D textures are not available in the D3D9 backend.
UNREACHABLE(); UNREACHABLE();
return false; return gl::Error(GL_INVALID_OPERATION);
} }
bool Renderer9::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, gl::Error Renderer9::copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level)
{ {
// 2D array textures are not available in the D3D9 backend. // 2D array textures are not available in the D3D9 backend.
UNREACHABLE(); UNREACHABLE();
return false; return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &readRect, gl::Framebuffer *drawFramebuffer, const gl::Rectangle &drawRect, gl::Error Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &readRect, gl::Framebuffer *drawFramebuffer, const gl::Rectangle &drawRect,
...@@ -2973,7 +2973,7 @@ rx::UniformStorage *Renderer9::createUniformStorage(size_t storageSize) ...@@ -2973,7 +2973,7 @@ rx::UniformStorage *Renderer9::createUniformStorage(size_t storageSize)
return new UniformStorage(storageSize); return new UniformStorage(storageSize);
} }
bool Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) gl::Error Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{ {
return mBlit->boxFilter(source, dest); return mBlit->boxFilter(source, dest);
} }
......
...@@ -124,14 +124,14 @@ class Renderer9 : public Renderer ...@@ -124,14 +124,14 @@ class Renderer9 : public Renderer
virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source); virtual bool copyToRenderTarget3D(TextureStorage *dest, TextureStorage *source);
virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source); virtual bool copyToRenderTarget2DArray(TextureStorage *dest, TextureStorage *source);
virtual bool copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage2D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level); GLint xoffset, GLint yoffset, TextureStorage *storage, GLint level);
virtual bool copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImageCube(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level); GLint xoffset, GLint yoffset, TextureStorage *storage, GLenum target, GLint level);
virtual bool copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, virtual gl::Error copyImage3D(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual bool copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level); GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual gl::Error copyImage2DArray(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorage *storage, GLint level);
virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect, virtual gl::Error blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter); const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
...@@ -190,7 +190,7 @@ class Renderer9 : public Renderer ...@@ -190,7 +190,7 @@ class Renderer9 : public Renderer
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea); GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
// D3D9-renderer specific methods // D3D9-renderer specific methods
bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest); gl::Error boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
D3DPOOL getTexturePool(DWORD usage) const; D3DPOOL getTexturePool(DWORD usage) const;
......
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