Commit f8bdfebc by Jamie Madill

Revert "Unifying the various texture interfaces where possible"

This reverts commit 8c9038d6. Change-Id: I29c25121870e6f8d12144d235029f46fff90be7c Reviewed-on: https://chromium-review.googlesource.com/210651Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 8c9038d6
...@@ -95,7 +95,7 @@ rx::RenderTarget *Texture2DAttachment::getRenderTarget() ...@@ -95,7 +95,7 @@ rx::RenderTarget *Texture2DAttachment::getRenderTarget()
rx::RenderTarget *Texture2DAttachment::getDepthStencil() rx::RenderTarget *Texture2DAttachment::getDepthStencil()
{ {
return mTexture2D->getDepthStencil(mLevel); return mTexture2D->getDepthSencil(mLevel);
} }
rx::TextureStorage *Texture2DAttachment::getTextureStorage() rx::TextureStorage *Texture2DAttachment::getTextureStorage()
......
...@@ -51,7 +51,7 @@ class Texture : public RefCountObject ...@@ -51,7 +51,7 @@ class Texture : public RefCountObject
SamplerState &getSamplerState() { return mSamplerState; } SamplerState &getSamplerState() { return mSamplerState; }
void getSamplerStateWithNativeOffset(SamplerState *sampler); void getSamplerStateWithNativeOffset(SamplerState *sampler);
void setUsage(GLenum usage); virtual void setUsage(GLenum usage);
GLenum getUsage() const; GLenum getUsage() const;
GLint getBaseLevelWidth() const; GLint getBaseLevelWidth() const;
...@@ -63,7 +63,7 @@ class Texture : public RefCountObject ...@@ -63,7 +63,7 @@ class Texture : public RefCountObject
rx::TextureStorageInterface *getNativeTexture(); rx::TextureStorageInterface *getNativeTexture();
virtual void generateMipmaps(); virtual void generateMipmaps() = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
unsigned int getTextureSerial(); unsigned int getTextureSerial();
...@@ -89,7 +89,7 @@ class Texture : public RefCountObject ...@@ -89,7 +89,7 @@ class Texture : public RefCountObject
private: private:
DISALLOW_COPY_AND_ASSIGN(Texture); DISALLOW_COPY_AND_ASSIGN(Texture);
const rx::Image *getBaseLevelImage() const; virtual const rx::Image *getBaseLevelImage() const = 0;
}; };
class Texture2D : public Texture class Texture2D : public Texture
...@@ -99,6 +99,8 @@ class Texture2D : public Texture ...@@ -99,6 +99,8 @@ class Texture2D : public Texture
~Texture2D(); ~Texture2D();
virtual void setUsage(GLenum usage);
GLsizei getWidth(GLint level) const; GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLenum getInternalFormat(GLint level) const; GLenum getInternalFormat(GLint level) const;
...@@ -126,11 +128,15 @@ class Texture2D : public Texture ...@@ -126,11 +128,15 @@ class Texture2D : public Texture
protected: protected:
friend class Texture2DAttachment; friend class Texture2DAttachment;
rx::RenderTarget *getRenderTarget(GLint level); rx::RenderTarget *getRenderTarget(GLint level);
rx::RenderTarget *getDepthStencil(GLint level); rx::RenderTarget *getDepthSencil(GLint level);
private: private:
DISALLOW_COPY_AND_ASSIGN(Texture2D); DISALLOW_COPY_AND_ASSIGN(Texture2D);
virtual const rx::Image *getBaseLevelImage() const;
void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
rx::Texture2DImpl *mTexture; rx::Texture2DImpl *mTexture;
egl::Surface *mSurface; egl::Surface *mSurface;
}; };
...@@ -142,6 +148,8 @@ class TextureCubeMap : public Texture ...@@ -142,6 +148,8 @@ class TextureCubeMap : public Texture
~TextureCubeMap(); ~TextureCubeMap();
virtual void setUsage(GLenum usage);
GLsizei getWidth(GLenum target, GLint level) const; GLsizei getWidth(GLenum target, GLint level) const;
GLsizei getHeight(GLenum target, GLint level) const; GLsizei getHeight(GLenum target, GLint level) const;
GLenum getInternalFormat(GLenum target, GLint level) const; GLenum getInternalFormat(GLenum target, GLint level) const;
...@@ -165,10 +173,9 @@ class TextureCubeMap : public Texture ...@@ -165,10 +173,9 @@ class TextureCubeMap : public Texture
bool isCubeComplete() const; bool isCubeComplete() const;
unsigned int getRenderTargetSerial(GLenum target, GLint level); virtual void generateMipmaps();
static int targetToLayerIndex(GLenum target); unsigned int getRenderTargetSerial(GLenum target, GLint level);
static GLenum layerIndexToTarget(GLint layer);
virtual rx::TextureImpl *getImplementation() { return mTexture; } virtual rx::TextureImpl *getImplementation() { return mTexture; }
virtual const rx::TextureImpl *getImplementation() const { return mTexture; } virtual const rx::TextureImpl *getImplementation() const { return mTexture; }
...@@ -181,6 +188,8 @@ class TextureCubeMap : public Texture ...@@ -181,6 +188,8 @@ class TextureCubeMap : public Texture
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureCubeMap); DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
virtual const rx::Image *getBaseLevelImage() const;
rx::TextureCubeImpl *mTexture; rx::TextureCubeImpl *mTexture;
}; };
...@@ -191,6 +200,8 @@ class Texture3D : public Texture ...@@ -191,6 +200,8 @@ class Texture3D : public Texture
~Texture3D(); ~Texture3D();
virtual void setUsage(GLenum usage);
GLsizei getWidth(GLint level) const; GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLsizei getDepth(GLint level) const; GLsizei getDepth(GLint level) const;
...@@ -205,6 +216,8 @@ class Texture3D : public Texture ...@@ -205,6 +216,8 @@ class Texture3D : public Texture
void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels); void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
virtual void generateMipmaps();
unsigned int getRenderTargetSerial(GLint level, GLint layer); unsigned int getRenderTargetSerial(GLint level, GLint layer);
virtual rx::TextureImpl *getImplementation() { return mTexture; } virtual rx::TextureImpl *getImplementation() { return mTexture; }
...@@ -218,6 +231,8 @@ class Texture3D : public Texture ...@@ -218,6 +231,8 @@ class Texture3D : public Texture
private: private:
DISALLOW_COPY_AND_ASSIGN(Texture3D); DISALLOW_COPY_AND_ASSIGN(Texture3D);
virtual const rx::Image *getBaseLevelImage() const;
rx::Texture3DImpl *mTexture; rx::Texture3DImpl *mTexture;
}; };
...@@ -228,6 +243,8 @@ class Texture2DArray : public Texture ...@@ -228,6 +243,8 @@ class Texture2DArray : public Texture
~Texture2DArray(); ~Texture2DArray();
virtual void setUsage(GLenum usage);
GLsizei getWidth(GLint level) const; GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLsizei getLayers(GLint level) const; GLsizei getLayers(GLint level) const;
...@@ -242,6 +259,8 @@ class Texture2DArray : public Texture ...@@ -242,6 +259,8 @@ class Texture2DArray : public Texture
void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels); void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
virtual void generateMipmaps();
unsigned int getRenderTargetSerial(GLint level, GLint layer); unsigned int getRenderTargetSerial(GLint level, GLint layer);
virtual rx::TextureImpl *getImplementation() { return mTexture; } virtual rx::TextureImpl *getImplementation() { return mTexture; }
...@@ -255,6 +274,8 @@ class Texture2DArray : public Texture ...@@ -255,6 +274,8 @@ class Texture2DArray : public Texture
private: private:
DISALLOW_COPY_AND_ASSIGN(Texture2DArray); DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
virtual const rx::Image *getBaseLevelImage() const;
rx::Texture2DArrayImpl *mTexture; rx::Texture2DArrayImpl *mTexture;
}; };
......
...@@ -39,26 +39,13 @@ class TextureImpl ...@@ -39,26 +39,13 @@ class TextureImpl
// higher level code should not rely on it. // higher level code should not rely on it.
virtual TextureStorageInterface *getNativeTexture() = 0; virtual TextureStorageInterface *getNativeTexture() = 0;
virtual Image *getImage(int level, int layer) const = 0;
virtual GLsizei getLayerCount(int level) const = 0;
virtual void setUsage(GLenum usage) = 0; virtual void setUsage(GLenum usage) = 0;
virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0; virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
virtual void setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
virtual void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
virtual void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0; virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
virtual void storage(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
virtual void generateMipmaps() = 0; virtual void generateMipmaps() = 0;
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;
virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
}; };
class Texture2DImpl : public TextureImpl class Texture2DImpl : public TextureImpl
...@@ -66,8 +53,24 @@ class Texture2DImpl : public TextureImpl ...@@ -66,8 +53,24 @@ class Texture2DImpl : public TextureImpl
public: public:
virtual ~Texture2DImpl() {} virtual ~Texture2DImpl() {}
virtual Image *getImage(int level) const = 0;
virtual void bindTexImage(egl::Surface *surface) = 0; virtual void bindTexImage(egl::Surface *surface) = 0;
virtual void releaseTexImage() = 0; virtual void releaseTexImage() = 0;
virtual void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
virtual void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) = 0;
virtual unsigned int getRenderTargetSerial(GLint level) = 0;
virtual RenderTarget *getRenderTarget(GLint level) = 0;
virtual RenderTarget *getDepthSencil(GLint level) = 0;
virtual void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height) = 0;
}; };
class TextureCubeImpl : public TextureImpl class TextureCubeImpl : public TextureImpl
...@@ -75,19 +78,60 @@ class TextureCubeImpl : public TextureImpl ...@@ -75,19 +78,60 @@ class TextureCubeImpl : public TextureImpl
public: public:
virtual ~TextureCubeImpl() {} virtual ~TextureCubeImpl() {}
virtual Image *getImage(GLenum target, int level) const = 0;
virtual bool isCubeComplete() const = 0; virtual bool isCubeComplete() const = 0;
virtual void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
virtual void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
virtual void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
virtual void storage(GLsizei levels, GLenum internalformat, GLsizei size) = 0;
virtual unsigned int getRenderTargetSerial(GLenum target, GLint level) = 0;
virtual RenderTarget *getRenderTarget(GLenum target, GLint level) = 0;
virtual RenderTarget *getDepthStencil(GLenum target, GLint level) = 0;
}; };
class Texture3DImpl : public TextureImpl class Texture3DImpl : public TextureImpl
{ {
public: public:
virtual ~Texture3DImpl() {} virtual ~Texture3DImpl() {}
virtual Image *getImage(int level) const = 0;
virtual void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;
virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
}; };
class Texture2DArrayImpl : public TextureImpl class Texture2DArrayImpl : public TextureImpl
{ {
public: public:
virtual ~Texture2DArrayImpl() {} virtual ~Texture2DArrayImpl() {}
virtual Image *getImage(int level, int layer) const = 0;
virtual GLsizei getLayerCount(int level) const = 0;
virtual void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;
virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
}; };
} }
......
...@@ -117,7 +117,7 @@ void TextureStorageInterfaceCube::generateMipmap(int faceIndex, int level) ...@@ -117,7 +117,7 @@ void TextureStorageInterfaceCube::generateMipmap(int faceIndex, int level)
unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target, GLint level) const unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target, GLint level) const
{ {
return mFirstRenderTargetSerial + (level * 6) + gl::TextureCubeMap::targetToLayerIndex(target); return mFirstRenderTargetSerial + (level * 6) + TextureD3D_Cube::targetToIndex(target);
} }
TextureStorageInterface3D::TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget, TextureStorageInterface3D::TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
......
...@@ -771,7 +771,7 @@ RenderTarget *TextureStorage11_Cube::getRenderTargetFace(GLenum faceTarget, int ...@@ -771,7 +771,7 @@ RenderTarget *TextureStorage11_Cube::getRenderTargetFace(GLenum faceTarget, int
{ {
if (level >= 0 && level < getLevelCount()) if (level >= 0 && level < getLevelCount())
{ {
int faceIndex = gl::TextureCubeMap::targetToLayerIndex(faceTarget); int faceIndex = TextureD3D_Cube::targetToIndex(faceTarget);
if (!mRenderTarget[faceIndex][level]) if (!mRenderTarget[faceIndex][level])
{ {
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
......
...@@ -265,7 +265,7 @@ IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, in ...@@ -265,7 +265,7 @@ IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, in
RenderTarget *TextureStorage9_Cube::getRenderTargetFace(GLenum faceTarget, int level) RenderTarget *TextureStorage9_Cube::getRenderTargetFace(GLenum faceTarget, int level)
{ {
return mRenderTarget[gl::TextureCubeMap::targetToLayerIndex(faceTarget)]; return mRenderTarget[TextureD3D_Cube::targetToIndex(faceTarget)];
} }
void TextureStorage9_Cube::generateMipmap(int faceIndex, int level) void TextureStorage9_Cube::generateMipmap(int faceIndex, int level)
......
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