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;
......
...@@ -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);
......
...@@ -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