Renames classes in the TextureStorage heirarchy for clarity

TRAC #22300 Author: Shannon Woods Signed-off-by: Geoff Lang Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1613 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 34da397e
...@@ -191,7 +191,7 @@ float Texture::getMaxAnisotropy() const ...@@ -191,7 +191,7 @@ float Texture::getMaxAnisotropy() const
int Texture::getLodOffset() int Texture::getLodOffset()
{ {
rx::TextureStorage *texture = getStorage(false); rx::TextureStorageInterface *texture = getStorage(false);
return texture ? texture->getLodOffset() : 0; return texture ? texture->getLodOffset() : 0;
} }
...@@ -263,11 +263,11 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL ...@@ -263,11 +263,11 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
return true; return true;
} }
rx::TextureStorage *Texture::getNativeTexture() rx::TextureStorageInterface *Texture::getNativeTexture()
{ {
// ensure the underlying texture is created // ensure the underlying texture is created
rx::TextureStorage *storage = getStorage(false); rx::TextureStorageInterface *storage = getStorage(false);
if (storage) if (storage)
{ {
updateTexture(); updateTexture();
...@@ -294,13 +294,13 @@ void Texture::resetDirty() ...@@ -294,13 +294,13 @@ void Texture::resetDirty()
unsigned int Texture::getTextureSerial() unsigned int Texture::getTextureSerial()
{ {
rx::TextureStorage *texture = getStorage(false); rx::TextureStorageInterface *texture = getStorage(false);
return texture ? texture->getTextureSerial() : 0; return texture ? texture->getTextureSerial() : 0;
} }
unsigned int Texture::getRenderTargetSerial(GLenum target) unsigned int Texture::getRenderTargetSerial(GLenum target)
{ {
rx::TextureStorage *texture = getStorage(true); rx::TextureStorageInterface *texture = getStorage(true);
return texture ? texture->getRenderTargetSerial(target) : 0; return texture ? texture->getRenderTargetSerial(target) : 0;
} }
...@@ -450,7 +450,7 @@ void Texture2D::bindTexImage(egl::Surface *surface) ...@@ -450,7 +450,7 @@ void Texture2D::bindTexImage(egl::Surface *surface)
delete mTexStorage; delete mTexStorage;
rx::SwapChain9 *swapchain = static_cast<rx::SwapChain9*>(surface->getSwapChain()); // D3D9_REPLACE rx::SwapChain9 *swapchain = static_cast<rx::SwapChain9*>(surface->getSwapChain()); // D3D9_REPLACE
mTexStorage = new rx::TextureStorage2D(mRenderer, swapchain); mTexStorage = new rx::TextureStorageInterface2D(mRenderer, swapchain);
mDirtyImages = true; mDirtyImages = true;
mSurface = surface; mSurface = surface;
...@@ -585,7 +585,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo ...@@ -585,7 +585,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
{ {
delete mTexStorage; delete mTexStorage;
mTexStorage = new rx::TextureStorage2D(mRenderer, levels, internalformat, mUsage, false, width, height); mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
mImmutable = true; mImmutable = true;
for (int level = 0; level < levels; level++) for (int level = 0; level < levels; level++)
...@@ -727,7 +727,7 @@ void Texture2D::createTexture() ...@@ -727,7 +727,7 @@ void Texture2D::createTexture()
GLenum internalformat = mImageArray[0]->getInternalFormat(); GLenum internalformat = mImageArray[0]->getInternalFormat();
delete mTexStorage; delete mTexStorage;
mTexStorage = new rx::TextureStorage2D(mRenderer, levels, internalformat, mUsage, false, width, height); mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
if (mTexStorage->isManaged()) if (mTexStorage->isManaged())
{ {
...@@ -761,7 +761,7 @@ void Texture2D::updateTexture() ...@@ -761,7 +761,7 @@ void Texture2D::updateTexture()
void Texture2D::convertToRenderTarget() void Texture2D::convertToRenderTarget()
{ {
rx::TextureStorage2D *newTexStorage = NULL; rx::TextureStorageInterface2D *newTexStorage = NULL;
if (mImageArray[0]->getWidth() != 0 && mImageArray[0]->getHeight() != 0) if (mImageArray[0]->getWidth() != 0 && mImageArray[0]->getHeight() != 0)
{ {
...@@ -770,7 +770,7 @@ void Texture2D::convertToRenderTarget() ...@@ -770,7 +770,7 @@ void Texture2D::convertToRenderTarget()
GLint levels = creationLevels(width, height); GLint levels = creationLevels(width, height);
GLenum internalformat = mImageArray[0]->getInternalFormat(); GLenum internalformat = mImageArray[0]->getInternalFormat();
newTexStorage = new rx::TextureStorage2D(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, width, height); newTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, width, height);
if (mTexStorage != NULL) if (mTexStorage != NULL)
{ {
...@@ -886,7 +886,7 @@ int Texture2D::levelCount() ...@@ -886,7 +886,7 @@ int Texture2D::levelCount()
return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0; return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0;
} }
rx::TextureStorage *Texture2D::getStorage(bool renderTarget) rx::TextureStorageInterface *Texture2D::getStorage(bool renderTarget)
{ {
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget())) if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
{ {
...@@ -1181,7 +1181,7 @@ void TextureCubeMap::createTexture() ...@@ -1181,7 +1181,7 @@ void TextureCubeMap::createTexture()
GLenum internalformat = mImageArray[0][0]->getInternalFormat(); GLenum internalformat = mImageArray[0][0]->getInternalFormat();
delete mTexStorage; delete mTexStorage;
mTexStorage = new rx::TextureStorageCubeMap(mRenderer, levels, internalformat, mUsage, false, size); mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
if (mTexStorage->isManaged()) if (mTexStorage->isManaged())
{ {
...@@ -1221,7 +1221,7 @@ void TextureCubeMap::updateTexture() ...@@ -1221,7 +1221,7 @@ void TextureCubeMap::updateTexture()
void TextureCubeMap::convertToRenderTarget() void TextureCubeMap::convertToRenderTarget()
{ {
rx::TextureStorageCubeMap *newTexStorage = NULL; rx::TextureStorageInterfaceCube *newTexStorage = NULL;
if (mImageArray[0][0]->getWidth() != 0) if (mImageArray[0][0]->getWidth() != 0)
{ {
...@@ -1229,7 +1229,7 @@ void TextureCubeMap::convertToRenderTarget() ...@@ -1229,7 +1229,7 @@ void TextureCubeMap::convertToRenderTarget()
GLint levels = creationLevels(size); GLint levels = creationLevels(size);
GLenum internalformat = mImageArray[0][0]->getInternalFormat(); GLenum internalformat = mImageArray[0][0]->getInternalFormat();
newTexStorage = new rx::TextureStorageCubeMap(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, size); newTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, size);
if (mTexStorage != NULL) if (mTexStorage != NULL)
{ {
...@@ -1366,7 +1366,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi ...@@ -1366,7 +1366,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size) void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
{ {
delete mTexStorage; delete mTexStorage;
mTexStorage = new rx::TextureStorageCubeMap(mRenderer, levels, internalformat, mUsage, false, size); mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
mImmutable = true; mImmutable = true;
for (int level = 0; level < levels; level++) for (int level = 0; level < levels; level++)
...@@ -1488,7 +1488,7 @@ int TextureCubeMap::levelCount() ...@@ -1488,7 +1488,7 @@ int TextureCubeMap::levelCount()
return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0; return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0;
} }
rx::TextureStorage *TextureCubeMap::getStorage(bool renderTarget) rx::TextureStorageInterface *TextureCubeMap::getStorage(bool renderTarget)
{ {
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget())) if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
{ {
......
...@@ -89,7 +89,7 @@ class Texture : public RefCountObject ...@@ -89,7 +89,7 @@ class Texture : public RefCountObject
virtual bool isSamplerComplete() const = 0; virtual bool isSamplerComplete() const = 0;
rx::TextureStorage *getNativeTexture(); rx::TextureStorageInterface *getNativeTexture();
virtual Renderbuffer *getRenderbuffer(GLenum target) = 0; virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
virtual void generateMipmaps() = 0; virtual void generateMipmaps() = 0;
...@@ -134,7 +134,7 @@ class Texture : public RefCountObject ...@@ -134,7 +134,7 @@ class Texture : public RefCountObject
private: private:
DISALLOW_COPY_AND_ASSIGN(Texture); DISALLOW_COPY_AND_ASSIGN(Texture);
virtual rx::TextureStorage *getStorage(bool renderTarget) = 0; virtual rx::TextureStorageInterface *getStorage(bool renderTarget) = 0;
}; };
class Texture2D : public Texture class Texture2D : public Texture
...@@ -184,7 +184,7 @@ class Texture2D : public Texture ...@@ -184,7 +184,7 @@ class Texture2D : public Texture
virtual void createTexture(); virtual void createTexture();
virtual void updateTexture(); virtual void updateTexture();
virtual void convertToRenderTarget(); virtual void convertToRenderTarget();
virtual rx::TextureStorage *getStorage(bool renderTarget); virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
bool isMipmapComplete() const; bool isMipmapComplete() const;
...@@ -193,7 +193,7 @@ class Texture2D : public Texture ...@@ -193,7 +193,7 @@ class Texture2D : public Texture
rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS]; rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
rx::TextureStorage2D *mTexStorage; rx::TextureStorageInterface2D *mTexStorage;
egl::Surface *mSurface; egl::Surface *mSurface;
// A specific internal reference count is kept for colorbuffer proxy references, // A specific internal reference count is kept for colorbuffer proxy references,
...@@ -257,7 +257,7 @@ class TextureCubeMap : public Texture ...@@ -257,7 +257,7 @@ class TextureCubeMap : public Texture
virtual void createTexture(); virtual void createTexture();
virtual void updateTexture(); virtual void updateTexture();
virtual void convertToRenderTarget(); virtual void convertToRenderTarget();
virtual rx::TextureStorage *getStorage(bool renderTarget); virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
bool isCubeComplete() const; bool isCubeComplete() const;
bool isMipmapCubeComplete() const; bool isMipmapCubeComplete() const;
...@@ -268,7 +268,7 @@ class TextureCubeMap : public Texture ...@@ -268,7 +268,7 @@ class TextureCubeMap : public Texture
rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS]; rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
rx::TextureStorageCubeMap *mTexStorage; rx::TextureStorageInterfaceCube *mTexStorage;
// A specific internal reference count is kept for colorbuffer proxy references, // A specific internal reference count is kept for colorbuffer proxy references,
// because, as the renderbuffer acting as proxy will maintain a binding pointer // because, as the renderbuffer acting as proxy will maintain a binding pointer
......
...@@ -213,7 +213,7 @@ bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) ...@@ -213,7 +213,7 @@ bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
return true; return true;
} }
bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{ {
// D3D9_REPLACE // D3D9_REPLACE
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
...@@ -236,7 +236,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des ...@@ -236,7 +236,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des
return error(GL_OUT_OF_MEMORY, false); return error(GL_OUT_OF_MEMORY, false);
} }
TextureStorage2D9 *storage9 = TextureStorage2D9::makeTextureStorage2D9(storage->getStorageInterface()); TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true); IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true);
bool result = false; bool result = false;
...@@ -250,7 +250,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des ...@@ -250,7 +250,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des
return result; return result;
} }
bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{ {
// D3D9_REPLACE // D3D9_REPLACE
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
...@@ -273,7 +273,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des ...@@ -273,7 +273,7 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des
return error(GL_OUT_OF_MEMORY, false); return error(GL_OUT_OF_MEMORY, false);
} }
TextureStorageCubeMap9 *storage9 = TextureStorageCubeMap9::makeTextureStorageCubeMap9(storage->getStorageInterface()); TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(target, level, true); IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(target, level, true);
bool result = false; bool result = false;
......
...@@ -35,8 +35,8 @@ class Blit ...@@ -35,8 +35,8 @@ class Blit
// 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 copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level); bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level); bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *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)
......
...@@ -21,8 +21,8 @@ class Framebuffer; ...@@ -21,8 +21,8 @@ class Framebuffer;
namespace rx namespace rx
{ {
class Renderer; class Renderer;
class TextureStorage2D; class TextureStorageInterface2D;
class TextureStorageCubeMap; class TextureStorageInterfaceCube;
class Image class Image
{ {
...@@ -39,10 +39,10 @@ class Image ...@@ -39,10 +39,10 @@ class Image
void markClean() {mDirty = false;} void markClean() {mDirty = false;}
virtual bool isDirty() const = 0; virtual bool isDirty() const = 0;
virtual void setManagedSurface(TextureStorage2D *storage, int level) {}; virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {};
virtual void setManagedSurface(TextureStorageCubeMap *storage, int face, int level) {}; virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {};
virtual bool updateSurface(TextureStorage2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
virtual bool updateSurface(TextureStorageCubeMap *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0; virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0;
......
...@@ -43,14 +43,14 @@ bool Image11::isDirty() const ...@@ -43,14 +43,14 @@ bool Image11::isDirty() const
return (mStagingTexture && mDirty); return (mStagingTexture && mDirty);
} }
bool Image11::updateSurface(TextureStorage2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{ {
// TODO - relies on TextureStorage11 implementation // TODO - relies on TextureStorage11 implementation
UNIMPLEMENTED(); UNIMPLEMENTED();
return false; return false;
} }
bool Image11::updateSurface(TextureStorageCubeMap *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) bool Image11::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{ {
// TODO - relies on TextureStorage11 implementation // TODO - relies on TextureStorage11 implementation
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -25,8 +25,8 @@ namespace rx ...@@ -25,8 +25,8 @@ namespace rx
{ {
class Renderer; class Renderer;
class Renderer11; class Renderer11;
class TextureStorage2D; class TextureStorageInterface2D;
class TextureStorageCubeMap; class TextureStorageInterfaceCube;
class Image11 : public Image class Image11 : public Image
{ {
...@@ -38,8 +38,8 @@ class Image11 : public Image ...@@ -38,8 +38,8 @@ class Image11 : public Image
virtual bool isDirty() const; virtual bool isDirty() const;
virtual bool updateSurface(TextureStorage2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
virtual bool updateSurface(TextureStorageCubeMap *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease); virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
......
...@@ -259,15 +259,15 @@ IDirect3DSurface9 *Image9::getSurface() ...@@ -259,15 +259,15 @@ IDirect3DSurface9 *Image9::getSurface()
return mSurface; return mSurface;
} }
void Image9::setManagedSurface(TextureStorage2D *storage, int level) void Image9::setManagedSurface(TextureStorageInterface2D *storage, int level)
{ {
TextureStorage2D9 *storage9 = TextureStorage2D9::makeTextureStorage2D9(storage->getStorageInterface()); TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
setManagedSurface(storage9->getSurfaceLevel(level, false)); setManagedSurface(storage9->getSurfaceLevel(level, false));
} }
void Image9::setManagedSurface(TextureStorageCubeMap *storage, int face, int level) void Image9::setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level)
{ {
TextureStorageCubeMap9 *storage9 = TextureStorageCubeMap9::makeTextureStorageCubeMap9(storage->getStorageInterface()); TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
setManagedSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, false)); setManagedSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, false));
} }
...@@ -290,17 +290,17 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface) ...@@ -290,17 +290,17 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface)
} }
} }
bool Image9::updateSurface(TextureStorage2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) bool Image9::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{ {
ASSERT(getSurface() != NULL); ASSERT(getSurface() != NULL);
TextureStorage2D9 *storage9 = TextureStorage2D9::makeTextureStorage2D9(storage->getStorageInterface()); TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
return updateSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height); return updateSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height);
} }
bool Image9::updateSurface(TextureStorageCubeMap *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) bool Image9::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{ {
ASSERT(getSurface() != NULL); ASSERT(getSurface() != NULL);
TextureStorageCubeMap9 *storage9 = TextureStorageCubeMap9::makeTextureStorageCubeMap9(storage->getStorageInterface()); TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
return updateSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height); return updateSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height);
} }
......
...@@ -26,8 +26,8 @@ namespace rx ...@@ -26,8 +26,8 @@ namespace rx
{ {
class Renderer; class Renderer;
class Renderer9; class Renderer9;
class TextureStorage2D; class TextureStorageInterface2D;
class TextureStorageCubeMap; class TextureStorageInterfaceCube;
class Image9 : public Image class Image9 : public Image
{ {
...@@ -49,10 +49,10 @@ class Image9 : public Image ...@@ -49,10 +49,10 @@ class Image9 : public Image
virtual bool isDirty() const {return mSurface && mDirty;} virtual bool isDirty() const {return mSurface && mDirty;}
IDirect3DSurface9 *getSurface(); IDirect3DSurface9 *getSurface();
virtual void setManagedSurface(TextureStorage2D *storage, int level); virtual void setManagedSurface(TextureStorageInterface2D *storage, int level);
virtual void setManagedSurface(TextureStorageCubeMap *storage, int face, int level); virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level);
virtual bool updateSurface(TextureStorage2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
virtual bool updateSurface(TextureStorageCubeMap *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
GLint unpackAlignment, const void *input); GLint unpackAlignment, const void *input);
......
...@@ -52,8 +52,8 @@ class Buffer; ...@@ -52,8 +52,8 @@ class Buffer;
namespace rx namespace rx
{ {
class TextureStorage2D; class TextureStorageInterface2D;
class TextureStorageCubeMap; class TextureStorageInterfaceCube;
class VertexBuffer; class VertexBuffer;
class IndexBuffer; class IndexBuffer;
class Blit; class Blit;
...@@ -149,13 +149,13 @@ class Renderer ...@@ -149,13 +149,13 @@ class Renderer
virtual GLsizei getMaxSupportedSamples() const = 0; virtual GLsizei getMaxSupportedSamples() const = 0;
// Pixel operations // Pixel operations
virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source) = 0; virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source) = 0;
virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source) = 0; virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source) = 0;
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) = 0; GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level) = 0;
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) = 0; GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level) = 0;
virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect, virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect,
bool blitRenderTarget, bool blitDepthStencil) = 0; bool blitRenderTarget, bool blitDepthStencil) = 0;
......
...@@ -1119,14 +1119,14 @@ int Renderer11::getMaxSupportedSamples() const ...@@ -1119,14 +1119,14 @@ int Renderer11::getMaxSupportedSamples() const
return 1; return 1;
} }
bool Renderer11::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source) bool Renderer11::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
return false; return false;
} }
bool Renderer11::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source) bool Renderer11::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
...@@ -1134,7 +1134,7 @@ bool Renderer11::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageC ...@@ -1134,7 +1134,7 @@ bool Renderer11::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageC
} }
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
...@@ -1142,7 +1142,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, ...@@ -1142,7 +1142,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect,
} }
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -116,13 +116,13 @@ class Renderer11 : public Renderer ...@@ -116,13 +116,13 @@ class Renderer11 : public Renderer
virtual GLsizei getMaxSupportedSamples() const; virtual GLsizei getMaxSupportedSamples() const;
// Pixel operations // Pixel operations
virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source); virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source); virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level); GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level); GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect, virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect,
bool blitRenderTarget, bool blitDepthStencil); bool blitRenderTarget, bool blitDepthStencil);
......
...@@ -634,10 +634,10 @@ void Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture ...@@ -634,10 +634,10 @@ void Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture
if (texture) if (texture)
{ {
TextureStorage *texStorage = texture->getNativeTexture(); TextureStorageInterface *texStorage = texture->getNativeTexture();
if (texStorage) if (texStorage)
{ {
TextureStorage9 *storage9 = TextureStorage9::makeTextureStorage9(texStorage->getStorageInterface()); TextureStorage9 *storage9 = TextureStorage9::makeTextureStorage9(texStorage->getStorageInstance());
d3dTexture = storage9->getBaseTexture(); d3dTexture = storage9->getBaseTexture();
} }
// If we get NULL back from getBaseTexture here, something went wrong // If we get NULL back from getBaseTexture here, something went wrong
...@@ -2370,14 +2370,14 @@ D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLint internalformat) ...@@ -2370,14 +2370,14 @@ D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLint internalformat)
return D3DFMT_A8R8G8B8; return D3DFMT_A8R8G8B8;
} }
bool Renderer9::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source) bool Renderer9::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source)
{ {
bool result = false; bool result = false;
if (source && dest) if (source && dest)
{ {
TextureStorage2D9 *source9 = TextureStorage2D9::makeTextureStorage2D9(source->getStorageInterface()); TextureStorage9_2D *source9 = TextureStorage9_2D::makeTextureStorage9_2D(source->getStorageInstance());
TextureStorage2D9 *dest9 = TextureStorage2D9::makeTextureStorage2D9(dest->getStorageInterface()); TextureStorage9_2D *dest9 = TextureStorage9_2D::makeTextureStorage9_2D(dest->getStorageInstance());
int levels = source9->levelCount(); int levels = source9->levelCount();
for (int i = 0; i < levels; ++i) for (int i = 0; i < levels; ++i)
...@@ -2398,14 +2398,14 @@ bool Renderer9::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *sou ...@@ -2398,14 +2398,14 @@ bool Renderer9::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *sou
return result; return result;
} }
bool Renderer9::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source) bool Renderer9::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source)
{ {
bool result = false; bool result = false;
if (source && dest) if (source && dest)
{ {
TextureStorageCubeMap9 *source9 = TextureStorageCubeMap9::makeTextureStorageCubeMap9(source->getStorageInterface()); TextureStorage9_Cube *source9 = TextureStorage9_Cube::makeTextureStorage9_Cube(source->getStorageInstance());
TextureStorageCubeMap9 *dest9 = TextureStorageCubeMap9::makeTextureStorageCubeMap9(dest->getStorageInterface()); TextureStorage9_Cube *dest9 = TextureStorage9_Cube::makeTextureStorage9_Cube(dest->getStorageInstance());
int levels = source9->levelCount(); int levels = source9->levelCount();
for (int f = 0; f < 6; f++) for (int f = 0; f < 6; f++)
{ {
...@@ -2446,13 +2446,13 @@ D3DPOOL Renderer9::getBufferPool(DWORD usage) const ...@@ -2446,13 +2446,13 @@ D3DPOOL Renderer9::getBufferPool(DWORD usage) const
} }
bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{ {
return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, level); return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, level);
} }
bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{ {
return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, target, level); return mBlit->copy(framebuffer, sourceRect, destFormat, xoffset, yoffset, storage, target, level);
} }
......
...@@ -147,13 +147,13 @@ class Renderer9 : public Renderer ...@@ -147,13 +147,13 @@ class Renderer9 : public Renderer
D3DFORMAT ConvertTextureInternalFormat(GLint internalformat); D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
// Pixel operations // Pixel operations
virtual bool copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source); virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
virtual bool copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source); virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level); GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, virtual bool copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level); GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect, virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect,
bool blitRenderTarget, bool blitDepthStencil); bool blitRenderTarget, bool blitDepthStencil);
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// TextureStorage.cpp: Implements the abstract rx::TextureStorage class and its concrete derived // TextureStorage.cpp: Implements the abstract rx::TextureStorageInterface class and its concrete derived
// classes TextureStorage2D and TextureStorageCubeMap, which act as the interface to the // classes TextureStorageInterface2D and TextureStorageInterfaceCube, which act as the interface to the
// GPU-side texture. // GPU-side texture.
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
...@@ -20,106 +20,106 @@ ...@@ -20,106 +20,106 @@
namespace rx namespace rx
{ {
unsigned int TextureStorage::mCurrentTextureSerial = 1; unsigned int TextureStorageInterface::mCurrentTextureSerial = 1;
TextureStorage::TextureStorage() TextureStorageInterface::TextureStorageInterface()
: mTextureSerial(issueTextureSerial()), : mTextureSerial(issueTextureSerial()),
mInterface(NULL) mInstance(NULL)
{ {
} }
TextureStorage::~TextureStorage() TextureStorageInterface::~TextureStorageInterface()
{ {
delete mInterface; delete mInstance;
} }
bool TextureStorage::isRenderTarget() const bool TextureStorageInterface::isRenderTarget() const
{ {
return mInterface->isRenderTarget(); return mInstance->isRenderTarget();
} }
bool TextureStorage::isManaged() const bool TextureStorageInterface::isManaged() const
{ {
return mInterface->isManaged(); return mInstance->isManaged();
} }
unsigned int TextureStorage::getTextureSerial() const unsigned int TextureStorageInterface::getTextureSerial() const
{ {
return mTextureSerial; return mTextureSerial;
} }
unsigned int TextureStorage::issueTextureSerial() unsigned int TextureStorageInterface::issueTextureSerial()
{ {
return mCurrentTextureSerial++; return mCurrentTextureSerial++;
} }
int TextureStorage::getLodOffset() const int TextureStorageInterface::getLodOffset() const
{ {
return mInterface->getLodOffset(); return mInstance->getLodOffset();
} }
int TextureStorage::levelCount() int TextureStorageInterface::levelCount()
{ {
return mInterface->levelCount(); return mInstance->levelCount();
} }
TextureStorage2D::TextureStorage2D(Renderer *renderer, SwapChain9 *swapchain) TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain9 *swapchain)
: mRenderTargetSerial(gl::RenderbufferStorage::issueSerial()) : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
{ {
TextureStorage2D9 *newInterface = new TextureStorage2D9(renderer, swapchain); TextureStorage9_2D *newInterface = new TextureStorage9_2D(renderer, swapchain);
mInterface = newInterface; mInstance = newInterface;
} }
TextureStorage2D::TextureStorage2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height) TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
: mRenderTargetSerial(gl::RenderbufferStorage::issueSerial()) : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
{ {
TextureStorage2D9 *newInterface = new TextureStorage2D9(renderer, levels, internalformat, usage, forceRenderable, width, height); // D3D9_REPLACE TextureStorage9_2D *newInterface = new TextureStorage9_2D(renderer, levels, internalformat, usage, forceRenderable, width, height); // D3D9_REPLACE
mInterface = newInterface; mInstance = newInterface;
} }
TextureStorage2D::~TextureStorage2D() TextureStorageInterface2D::~TextureStorageInterface2D()
{ {
} }
RenderTarget *TextureStorage2D::getRenderTarget() const RenderTarget *TextureStorageInterface2D::getRenderTarget() const
{ {
return mInterface->getRenderTarget(); return mInstance->getRenderTarget();
} }
void TextureStorage2D::generateMipmap(int level) void TextureStorageInterface2D::generateMipmap(int level)
{ {
mInterface->generateMipmap(level); mInstance->generateMipmap(level);
} }
unsigned int TextureStorage2D::getRenderTargetSerial(GLenum target) const unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLenum target) const
{ {
return mRenderTargetSerial; return mRenderTargetSerial;
} }
TextureStorageCubeMap::TextureStorageCubeMap(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size) TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
: mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials()) : mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials())
{ {
TextureStorageCubeMap9 *newInterface = new TextureStorageCubeMap9(renderer, levels, internalformat, usage, forceRenderable, size); // D3D9_REPLACE TextureStorage9_Cube *newInterface = new TextureStorage9_Cube(renderer, levels, internalformat, usage, forceRenderable, size); // D3D9_REPLACE
mInterface = newInterface; mInstance = newInterface;
} }
TextureStorageCubeMap::~TextureStorageCubeMap() TextureStorageInterfaceCube::~TextureStorageInterfaceCube()
{ {
} }
RenderTarget *TextureStorageCubeMap::getRenderTarget(GLenum faceTarget) const RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget) const
{ {
return mInterface->getRenderTarget(faceTarget); return mInstance->getRenderTarget(faceTarget);
} }
void TextureStorageCubeMap::generateMipmap(int face, int level) void TextureStorageInterfaceCube::generateMipmap(int face, int level)
{ {
mInterface->generateMipmap(face, level); mInstance->generateMipmap(face, level);
} }
unsigned int TextureStorageCubeMap::getRenderTargetSerial(GLenum target) const unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target) const
{ {
return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target); return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target);
} }
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// TextureStorage.h: Defines the abstract rx::TextureStorage class and its concrete derived // TextureStorage.h: Defines the abstract rx::TextureStorageInterface class and its concrete derived
// classes TextureStorage2D and TextureStorageCubeMap, which act as the interface to the // classes TextureStorageInterface2D and TextureStorageInterfaceCube, which act as the interface to the
// GPU-side texture. // GPU-side texture.
#ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ #ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE_H_
...@@ -25,11 +25,11 @@ class RenderTarget; ...@@ -25,11 +25,11 @@ class RenderTarget;
class RenderTarget9; class RenderTarget9;
class Blit; class Blit;
class TextureStorageInterface class TextureStorage
{ {
public: public:
TextureStorageInterface() {}; TextureStorage() {};
virtual ~TextureStorageInterface() {}; virtual ~TextureStorage() {};
virtual int getLodOffset() const = 0; virtual int getLodOffset() const = 0;
virtual bool isRenderTarget() const = 0; virtual bool isRenderTarget() const = 0;
...@@ -42,17 +42,17 @@ class TextureStorageInterface ...@@ -42,17 +42,17 @@ class TextureStorageInterface
virtual void generateMipmap(int face, int level) = 0; virtual void generateMipmap(int face, int level) = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface); DISALLOW_COPY_AND_ASSIGN(TextureStorage);
}; };
class TextureStorage class TextureStorageInterface
{ {
public: public:
TextureStorage(); TextureStorageInterface();
virtual ~TextureStorage(); virtual ~TextureStorageInterface();
TextureStorageInterface *getStorageInterface() { return mInterface; } TextureStorage *getStorageInstance() { return mInstance; }
unsigned int getTextureSerial() const; unsigned int getTextureSerial() const;
virtual unsigned int getRenderTargetSerial(GLenum target) const = 0; virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
...@@ -63,10 +63,10 @@ class TextureStorage ...@@ -63,10 +63,10 @@ class TextureStorage
virtual int levelCount(); virtual int levelCount();
protected: protected:
TextureStorageInterface *mInterface; TextureStorage *mInstance;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage); DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface);
const unsigned int mTextureSerial; const unsigned int mTextureSerial;
static unsigned int issueTextureSerial(); static unsigned int issueTextureSerial();
...@@ -74,12 +74,12 @@ class TextureStorage ...@@ -74,12 +74,12 @@ class TextureStorage
static unsigned int mCurrentTextureSerial; static unsigned int mCurrentTextureSerial;
}; };
class TextureStorage2D : public TextureStorage class TextureStorageInterface2D : public TextureStorageInterface
{ {
public: public:
TextureStorage2D(Renderer *renderer, SwapChain9 *swapchain); TextureStorageInterface2D(Renderer *renderer, SwapChain9 *swapchain);
TextureStorage2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height); TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
virtual ~TextureStorage2D(); virtual ~TextureStorageInterface2D();
void generateMipmap(int level); void generateMipmap(int level);
RenderTarget *getRenderTarget() const; RenderTarget *getRenderTarget() const;
...@@ -87,16 +87,16 @@ class TextureStorage2D : public TextureStorage ...@@ -87,16 +87,16 @@ class TextureStorage2D : public TextureStorage
virtual unsigned int getRenderTargetSerial(GLenum target) const; virtual unsigned int getRenderTargetSerial(GLenum target) const;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage2D); DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2D);
const unsigned int mRenderTargetSerial; const unsigned int mRenderTargetSerial;
}; };
class TextureStorageCubeMap : public TextureStorage class TextureStorageInterfaceCube : public TextureStorageInterface
{ {
public: public:
TextureStorageCubeMap(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size); TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
virtual ~TextureStorageCubeMap(); virtual ~TextureStorageInterfaceCube();
void generateMipmap(int face, int level); void generateMipmap(int face, int level);
RenderTarget *getRenderTarget(GLenum faceTarget) const; RenderTarget *getRenderTarget(GLenum faceTarget) const;
...@@ -104,7 +104,7 @@ class TextureStorageCubeMap : public TextureStorage ...@@ -104,7 +104,7 @@ class TextureStorageCubeMap : public TextureStorage
virtual unsigned int getRenderTargetSerial(GLenum target) const; virtual unsigned int getRenderTargetSerial(GLenum target) const;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageCubeMap); DISALLOW_COPY_AND_ASSIGN(TextureStorageInterfaceCube);
const unsigned int mFirstRenderTargetSerial; const unsigned int mFirstRenderTargetSerial;
}; };
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// //
// TextureStorage9.cpp: Implements the abstract rx::TextureStorage9 class and its concrete derived // TextureStorage9.cpp: Implements the abstract rx::TextureStorage9 class and its concrete derived
// classes TextureStorage2D9 and TextureStorageCubeMap9, which act as the interface to the // classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
// D3D9 texture. // D3D9 texture.
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
...@@ -31,7 +31,7 @@ TextureStorage9::~TextureStorage9() ...@@ -31,7 +31,7 @@ TextureStorage9::~TextureStorage9()
{ {
} }
TextureStorage9 *TextureStorage9::makeTextureStorage9(TextureStorageInterface *storage) TextureStorage9 *TextureStorage9::makeTextureStorage9(TextureStorage *storage)
{ {
ASSERT(dynamic_cast<TextureStorage9*>(storage) != NULL); ASSERT(dynamic_cast<TextureStorage9*>(storage) != NULL);
return static_cast<TextureStorage9*>(storage); return static_cast<TextureStorage9*>(storage);
...@@ -108,7 +108,7 @@ int TextureStorage9::levelCount() ...@@ -108,7 +108,7 @@ int TextureStorage9::levelCount()
return getBaseTexture() ? getBaseTexture()->GetLevelCount() - getLodOffset() : 0; return getBaseTexture() ? getBaseTexture()->GetLevelCount() - getLodOffset() : 0;
} }
TextureStorage2D9::TextureStorage2D9(Renderer *renderer, SwapChain9 *swapchain) : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET) TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain) : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
{ {
IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture(); IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture();
mTexture = surfaceTexture; mTexture = surfaceTexture;
...@@ -116,7 +116,7 @@ TextureStorage2D9::TextureStorage2D9(Renderer *renderer, SwapChain9 *swapchain) ...@@ -116,7 +116,7 @@ TextureStorage2D9::TextureStorage2D9(Renderer *renderer, SwapChain9 *swapchain)
initializeRenderTarget(); initializeRenderTarget();
} }
TextureStorage2D9::TextureStorage2D9(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height) TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
: TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable)) : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
{ {
mTexture = NULL; mTexture = NULL;
...@@ -139,7 +139,7 @@ TextureStorage2D9::TextureStorage2D9(Renderer *renderer, int levels, GLenum inte ...@@ -139,7 +139,7 @@ TextureStorage2D9::TextureStorage2D9(Renderer *renderer, int levels, GLenum inte
initializeRenderTarget(); initializeRenderTarget();
} }
TextureStorage2D9::~TextureStorage2D9() TextureStorage9_2D::~TextureStorage9_2D()
{ {
if (mTexture) if (mTexture)
{ {
...@@ -149,15 +149,15 @@ TextureStorage2D9::~TextureStorage2D9() ...@@ -149,15 +149,15 @@ TextureStorage2D9::~TextureStorage2D9()
delete mRenderTarget; delete mRenderTarget;
} }
TextureStorage2D9 *TextureStorage2D9::makeTextureStorage2D9(TextureStorageInterface *storage) TextureStorage9_2D *TextureStorage9_2D::makeTextureStorage9_2D(TextureStorage *storage)
{ {
ASSERT(dynamic_cast<TextureStorage2D9*>(storage) != NULL); ASSERT(dynamic_cast<TextureStorage9_2D*>(storage) != NULL);
return static_cast<TextureStorage2D9*>(storage); return static_cast<TextureStorage9_2D*>(storage);
} }
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
IDirect3DSurface9 *TextureStorage2D9::getSurfaceLevel(int level, bool dirty) IDirect3DSurface9 *TextureStorage9_2D::getSurfaceLevel(int level, bool dirty)
{ {
IDirect3DSurface9 *surface = NULL; IDirect3DSurface9 *surface = NULL;
...@@ -176,12 +176,12 @@ IDirect3DSurface9 *TextureStorage2D9::getSurfaceLevel(int level, bool dirty) ...@@ -176,12 +176,12 @@ IDirect3DSurface9 *TextureStorage2D9::getSurfaceLevel(int level, bool dirty)
return surface; return surface;
} }
RenderTarget *TextureStorage2D9::getRenderTarget() const RenderTarget *TextureStorage9_2D::getRenderTarget() const
{ {
return mRenderTarget; return mRenderTarget;
} }
void TextureStorage2D9::generateMipmap(int level) void TextureStorage9_2D::generateMipmap(int level)
{ {
IDirect3DSurface9 *upper = getSurfaceLevel(level - 1, false); IDirect3DSurface9 *upper = getSurfaceLevel(level - 1, false);
IDirect3DSurface9 *lower = getSurfaceLevel(level, true); IDirect3DSurface9 *lower = getSurfaceLevel(level, true);
...@@ -195,12 +195,12 @@ void TextureStorage2D9::generateMipmap(int level) ...@@ -195,12 +195,12 @@ void TextureStorage2D9::generateMipmap(int level)
if (lower != NULL) lower->Release(); if (lower != NULL) lower->Release();
} }
IDirect3DBaseTexture9 *TextureStorage2D9::getBaseTexture() const IDirect3DBaseTexture9 *TextureStorage9_2D::getBaseTexture() const
{ {
return mTexture; return mTexture;
} }
void TextureStorage2D9::initializeRenderTarget() void TextureStorage9_2D::initializeRenderTarget()
{ {
if (mTexture != NULL && isRenderTarget()) if (mTexture != NULL && isRenderTarget())
{ {
...@@ -214,7 +214,7 @@ void TextureStorage2D9::initializeRenderTarget() ...@@ -214,7 +214,7 @@ void TextureStorage2D9::initializeRenderTarget()
} }
} }
TextureStorageCubeMap9::TextureStorageCubeMap9(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size) TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
: TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable)) : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
{ {
mTexture = NULL; mTexture = NULL;
...@@ -238,7 +238,7 @@ TextureStorageCubeMap9::TextureStorageCubeMap9(Renderer *renderer, int levels, G ...@@ -238,7 +238,7 @@ TextureStorageCubeMap9::TextureStorageCubeMap9(Renderer *renderer, int levels, G
initializeRenderTarget(); initializeRenderTarget();
} }
TextureStorageCubeMap9::~TextureStorageCubeMap9() TextureStorage9_Cube::~TextureStorage9_Cube()
{ {
if (mTexture) if (mTexture)
{ {
...@@ -251,15 +251,15 @@ TextureStorageCubeMap9::~TextureStorageCubeMap9() ...@@ -251,15 +251,15 @@ TextureStorageCubeMap9::~TextureStorageCubeMap9()
} }
} }
TextureStorageCubeMap9 *TextureStorageCubeMap9::makeTextureStorageCubeMap9(TextureStorageInterface *storage) TextureStorage9_Cube *TextureStorage9_Cube::makeTextureStorage9_Cube(TextureStorage *storage)
{ {
ASSERT(dynamic_cast<TextureStorageCubeMap9*>(storage) != NULL); ASSERT(dynamic_cast<TextureStorage9_Cube*>(storage) != NULL);
return static_cast<TextureStorageCubeMap9*>(storage); return static_cast<TextureStorage9_Cube*>(storage);
} }
// Increments refcount on surface. // Increments refcount on surface.
// caller must Release() the returned surface // caller must Release() the returned surface
IDirect3DSurface9 *TextureStorageCubeMap9::getCubeMapSurface(GLenum faceTarget, int level, bool dirty) IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, int level, bool dirty)
{ {
IDirect3DSurface9 *surface = NULL; IDirect3DSurface9 *surface = NULL;
...@@ -279,12 +279,12 @@ IDirect3DSurface9 *TextureStorageCubeMap9::getCubeMapSurface(GLenum faceTarget, ...@@ -279,12 +279,12 @@ IDirect3DSurface9 *TextureStorageCubeMap9::getCubeMapSurface(GLenum faceTarget,
return surface; return surface;
} }
RenderTarget *TextureStorageCubeMap9::getRenderTarget(GLenum faceTarget) const RenderTarget *TextureStorage9_Cube::getRenderTarget(GLenum faceTarget) const
{ {
return mRenderTarget[gl::TextureCubeMap::faceIndex(faceTarget)]; return mRenderTarget[gl::TextureCubeMap::faceIndex(faceTarget)];
} }
void TextureStorageCubeMap9::generateMipmap(int face, int level) void TextureStorage9_Cube::generateMipmap(int face, int level)
{ {
IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1, false); IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1, false);
IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true); IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true);
...@@ -298,12 +298,12 @@ void TextureStorageCubeMap9::generateMipmap(int face, int level) ...@@ -298,12 +298,12 @@ void TextureStorageCubeMap9::generateMipmap(int face, int level)
if (lower != NULL) lower->Release(); if (lower != NULL) lower->Release();
} }
IDirect3DBaseTexture9 *TextureStorageCubeMap9::getBaseTexture() const IDirect3DBaseTexture9 *TextureStorage9_Cube::getBaseTexture() const
{ {
return mTexture; return mTexture;
} }
void TextureStorageCubeMap9::initializeRenderTarget() void TextureStorage9_Cube::initializeRenderTarget()
{ {
if (mTexture != NULL && isRenderTarget()) if (mTexture != NULL && isRenderTarget())
{ {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// //
// TextureStorage9.h: Defines the abstract rx::TextureStorage9 class and its concrete derived // TextureStorage9.h: Defines the abstract rx::TextureStorage9 class and its concrete derived
// classes TextureStorage2D9 and TextureStorageCubeMap9, which act as the interface to the // classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
// D3D9 texture. // D3D9 texture.
#ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE9_H_ #ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE9_H_
...@@ -26,13 +26,13 @@ class RenderTarget; ...@@ -26,13 +26,13 @@ class RenderTarget;
class RenderTarget9; class RenderTarget9;
class Blit; class Blit;
class TextureStorage9 : public TextureStorageInterface class TextureStorage9 : public TextureStorage
{ {
public: public:
TextureStorage9(Renderer *renderer, DWORD usage); TextureStorage9(Renderer *renderer, DWORD usage);
virtual ~TextureStorage9(); virtual ~TextureStorage9();
static TextureStorage9 *makeTextureStorage9(TextureStorageInterface *storage); static TextureStorage9 *makeTextureStorage9(TextureStorage *storage);
static DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable); static DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable);
static bool IsTextureFormatRenderable(D3DFORMAT format); static bool IsTextureFormatRenderable(D3DFORMAT format);
...@@ -62,14 +62,14 @@ class TextureStorage9 : public TextureStorageInterface ...@@ -62,14 +62,14 @@ class TextureStorage9 : public TextureStorageInterface
const D3DPOOL mD3DPool; const D3DPOOL mD3DPool;
}; };
class TextureStorage2D9 : public TextureStorage9 class TextureStorage9_2D : public TextureStorage9
{ {
public: public:
TextureStorage2D9(Renderer *renderer, SwapChain9 *swapchain); TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain);
TextureStorage2D9(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height); TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
virtual ~TextureStorage2D9(); virtual ~TextureStorage9_2D();
static TextureStorage2D9 *makeTextureStorage2D9(TextureStorageInterface *storage); static TextureStorage9_2D *makeTextureStorage9_2D(TextureStorage *storage);
IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty); IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty);
virtual RenderTarget *getRenderTarget() const; virtual RenderTarget *getRenderTarget() const;
...@@ -77,7 +77,7 @@ class TextureStorage2D9 : public TextureStorage9 ...@@ -77,7 +77,7 @@ class TextureStorage2D9 : public TextureStorage9
virtual void generateMipmap(int level); virtual void generateMipmap(int level);
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage2D9); DISALLOW_COPY_AND_ASSIGN(TextureStorage9_2D);
void initializeRenderTarget(); void initializeRenderTarget();
...@@ -85,13 +85,13 @@ class TextureStorage2D9 : public TextureStorage9 ...@@ -85,13 +85,13 @@ class TextureStorage2D9 : public TextureStorage9
RenderTarget9 *mRenderTarget; RenderTarget9 *mRenderTarget;
}; };
class TextureStorageCubeMap9 : public TextureStorage9 class TextureStorage9_Cube : public TextureStorage9
{ {
public: public:
TextureStorageCubeMap9(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size); TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
virtual ~TextureStorageCubeMap9(); virtual ~TextureStorage9_Cube();
static TextureStorageCubeMap9 *makeTextureStorageCubeMap9(TextureStorageInterface *storage); static TextureStorage9_Cube *makeTextureStorage9_Cube(TextureStorage *storage);
IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty); IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty);
virtual RenderTarget *getRenderTarget(GLenum faceTarget) const; virtual RenderTarget *getRenderTarget(GLenum faceTarget) const;
...@@ -99,7 +99,7 @@ class TextureStorageCubeMap9 : public TextureStorage9 ...@@ -99,7 +99,7 @@ class TextureStorageCubeMap9 : public TextureStorage9
virtual void generateMipmap(int face, int level); virtual void generateMipmap(int face, int level);
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageCubeMap9); DISALLOW_COPY_AND_ASSIGN(TextureStorage9_Cube);
void initializeRenderTarget(); void initializeRenderTarget();
......
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