Commit 6b51c1a0 by Jamie Madill

Use ImageIndex in copyToStorage.

Also change the image association methods in TexStorage to use ImageIndex, for consistency and compatibility. BUG=angle:729 Change-Id: I05afa803735c9b93ae7d623fee5e6899c9ccec28 Reviewed-on: https://chromium-review.googlesource.com/221722Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c8d13843
...@@ -48,6 +48,11 @@ ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex) ...@@ -48,6 +48,11 @@ ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex)
return ImageIndex(GL_TEXTURE_3D, mipIndex, layerIndex); return ImageIndex(GL_TEXTURE_3D, mipIndex, layerIndex);
} }
ImageIndex ImageIndex::MakeInvalid()
{
return ImageIndex(GL_NONE, -1, -1);
}
ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn) ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn)
: type(typeIn), : type(typeIn),
mipIndex(mipIndexIn), mipIndex(mipIndexIn),
......
...@@ -31,6 +31,7 @@ struct ImageIndex ...@@ -31,6 +31,7 @@ struct ImageIndex
static ImageIndex MakeCube(GLenum target, GLint mipIndex); static ImageIndex MakeCube(GLenum target, GLint mipIndex);
static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex); static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex);
static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL); static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL);
static ImageIndex MakeInvalid();
static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1); static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1);
}; };
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
namespace gl namespace gl
{ {
class Framebuffer; class Framebuffer;
struct ImageIndex;
struct Box;
} }
namespace rx namespace rx
...@@ -37,10 +39,10 @@ class ImageD3D : public Image ...@@ -37,10 +39,10 @@ class ImageD3D : public Image
virtual void setManagedSurfaceCube(TextureStorage *storage, int face, int level) {}; virtual void setManagedSurfaceCube(TextureStorage *storage, int face, int level) {};
virtual void setManagedSurface3D(TextureStorage *storage, int level) {}; virtual void setManagedSurface3D(TextureStorage *storage, int level) {};
virtual void setManagedSurface2DArray(TextureStorage *storage, int layer, int level) {}; virtual void setManagedSurface2DArray(TextureStorage *storage, int layer, int level) {};
virtual gl::Error copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; virtual gl::Error copyToStorage2D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region) = 0;
virtual gl::Error copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; virtual gl::Error copyToStorageCube(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region) = 0;
virtual gl::Error copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0; virtual gl::Error copyToStorage3D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region) = 0;
virtual gl::Error copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) = 0; virtual gl::Error copyToStorage2DArray(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region) = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(ImageD3D); DISALLOW_COPY_AND_ASSIGN(ImageD3D);
......
...@@ -850,7 +850,7 @@ gl::Error TextureD3D_2D::commitRegion(const gl::ImageIndex &index, const gl::Box ...@@ -850,7 +850,7 @@ gl::Error TextureD3D_2D::commitRegion(const gl::ImageIndex &index, const gl::Box
if (isValidLevel(level)) if (isValidLevel(level))
{ {
ImageD3D *image = mImageArray[level]; ImageD3D *image = mImageArray[level];
gl::Error error = image->copyToStorage2D(mTexStorage, level, region.x, region.y, region.width, region.height); gl::Error error = image->copyToStorage2D(mTexStorage, index, region);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1319,7 +1319,7 @@ gl::Error TextureD3D_Cube::commitRegion(const gl::ImageIndex &index, const gl::B ...@@ -1319,7 +1319,7 @@ gl::Error TextureD3D_Cube::commitRegion(const gl::ImageIndex &index, const gl::B
if (isValidFaceLevel(faceIndex, level)) if (isValidFaceLevel(faceIndex, level))
{ {
ImageD3D *image = mImageArray[faceIndex][level]; ImageD3D *image = mImageArray[faceIndex][level];
gl::Error error = image->copyToStorageCube(mTexStorage, faceIndex, level, region.x, region.y, region.width, region.height); gl::Error error = image->copyToStorageCube(mTexStorage, index, region);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1813,7 +1813,7 @@ gl::Error TextureD3D_3D::commitRegion(const gl::ImageIndex &index, const gl::Box ...@@ -1813,7 +1813,7 @@ gl::Error TextureD3D_3D::commitRegion(const gl::ImageIndex &index, const gl::Box
if (isValidLevel(level)) if (isValidLevel(level))
{ {
ImageD3D *image = mImageArray[level]; ImageD3D *image = mImageArray[level];
gl::Error error = image->copyToStorage3D(mTexStorage, level, region.x, region.y, region.z, region.width, region.height, region.depth); gl::Error error = image->copyToStorage3D(mTexStorage, index, region);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2322,7 +2322,7 @@ gl::Error TextureD3D_2DArray::commitRegion(const gl::ImageIndex &index, const gl ...@@ -2322,7 +2322,7 @@ gl::Error TextureD3D_2DArray::commitRegion(const gl::ImageIndex &index, const gl
if (isValidLevel(level) && layerTarget < getLayerCount(level)) if (isValidLevel(level) && layerTarget < getLayerCount(level))
{ {
ImageD3D *image = mImageArray[level][layerTarget]; ImageD3D *image = mImageArray[level][layerTarget];
gl::Error error = image->copyToStorage2DArray(mTexStorage, level, region.x, region.y, layerTarget, region.width, region.height); gl::Error error = image->copyToStorage2DArray(mTexStorage, index, region);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -23,15 +23,16 @@ namespace rx ...@@ -23,15 +23,16 @@ namespace rx
{ {
Image11::Image11() Image11::Image11()
: mRenderer(NULL),
mDXGIFormat(DXGI_FORMAT_UNKNOWN),
mStagingTexture(NULL),
mStagingSubresource(0),
mRecoverFromStorage(false),
mAssociatedStorage(NULL),
mAssociatedImageIndex(gl::ImageIndex::MakeInvalid()),
mRecoveredFromStorageCount(0)
{ {
mStagingTexture = NULL;
mRenderer = NULL;
mDXGIFormat = DXGI_FORMAT_UNKNOWN;
mRecoverFromStorage = false;
mAssociatedStorage = NULL;
mAssociatedStorageLevel = 0;
mAssociatedStorageLayerTarget = 0;
mRecoveredFromStorageCount = 0;
} }
Image11::~Image11() Image11::~Image11()
...@@ -100,31 +101,31 @@ bool Image11::isDirty() const ...@@ -100,31 +101,31 @@ bool Image11::isDirty() const
return mDirty; return mDirty;
} }
gl::Error Image11::copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) gl::Error Image11::copyToStorage2D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage); TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(storage);
return copyToStorageImpl(storage11, level, 0, xoffset, yoffset, width, height); return copyToStorageImpl(storage11, index, region);
} }
gl::Error Image11::copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) gl::Error Image11::copyToStorageCube(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage); TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(storage);
return copyToStorageImpl(storage11, level, face, xoffset, yoffset, width, height); return copyToStorageImpl(storage11, index, region);
} }
gl::Error Image11::copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) gl::Error Image11::copyToStorage3D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage); TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(storage);
return copyToStorageImpl(storage11, level, 0, xoffset, yoffset, width, height); return copyToStorageImpl(storage11, index, region);
} }
gl::Error Image11::copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height) gl::Error Image11::copyToStorage2DArray(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage); TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(storage);
return copyToStorageImpl(storage11, level, arrayLayer, xoffset, yoffset, width, height); return copyToStorageImpl(storage11, index, region);
} }
gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, int level, int layerTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, const gl::ImageIndex &index, const gl::Box &region)
{ {
// If an app's behavior results in an Image11 copying its data to/from to a TextureStorage multiple times, // If an app's behavior results in an Image11 copying its data to/from to a TextureStorage multiple times,
// then we should just keep the staging texture around to prevent the copying from impacting perf. // then we should just keep the staging texture around to prevent the copying from impacting perf.
...@@ -135,11 +136,11 @@ gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, int level, int ...@@ -135,11 +136,11 @@ gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, int level, int
if (attemptToReleaseStagingTexture) if (attemptToReleaseStagingTexture)
{ {
// If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it. // If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it.
storage11->releaseAssociatedImage(level, layerTarget, this); storage11->releaseAssociatedImage(index, this);
} }
gl::Error error = storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, layerTarget, gl::Error error = storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(),
xoffset, yoffset, 0, width, height, 1); index, region);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -148,12 +149,11 @@ gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, int level, int ...@@ -148,12 +149,11 @@ gl::Error Image11::copyToStorageImpl(TextureStorage11 *storage11, int level, int
// Once the image data has been copied into the Storage, we can release it locally. // Once the image data has been copied into the Storage, we can release it locally.
if (attemptToReleaseStagingTexture) if (attemptToReleaseStagingTexture)
{ {
storage11->associateImage(this, level, layerTarget); storage11->associateImage(this, index);
releaseStagingTexture(); releaseStagingTexture();
mRecoverFromStorage = true; mRecoverFromStorage = true;
mAssociatedStorage = storage11; mAssociatedStorage = storage11;
mAssociatedStorageLevel = level; mAssociatedImageIndex = index;
mAssociatedStorageLayerTarget = layerTarget;
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -170,7 +170,7 @@ bool Image11::recoverFromAssociatedStorage() ...@@ -170,7 +170,7 @@ bool Image11::recoverFromAssociatedStorage()
{ {
createStagingTexture(); createStagingTexture();
bool textureStorageCorrect = mAssociatedStorage->isAssociatedImageValid(mAssociatedStorageLevel, mAssociatedStorageLayerTarget, this); bool textureStorageCorrect = mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
// This means that the cached TextureStorage has been modified after this Image11 released its copy of its data. // This means that the cached TextureStorage has been modified after this Image11 released its copy of its data.
// This should not have happened. The TextureStorage should have told this Image11 to recover its data before it was overwritten. // This should not have happened. The TextureStorage should have told this Image11 to recover its data before it was overwritten.
...@@ -179,7 +179,8 @@ bool Image11::recoverFromAssociatedStorage() ...@@ -179,7 +179,8 @@ bool Image11::recoverFromAssociatedStorage()
if (textureStorageCorrect) if (textureStorageCorrect)
{ {
// CopySubResource from the Storage to the Staging texture // CopySubResource from the Storage to the Staging texture
mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource, mAssociatedStorageLevel, mAssociatedStorageLayerTarget, 0, 0, 0, mWidth, mHeight, mDepth); gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource, mAssociatedImageIndex, region);
mRecoveredFromStorageCount += 1; mRecoveredFromStorageCount += 1;
} }
...@@ -197,12 +198,11 @@ void Image11::disassociateStorage() ...@@ -197,12 +198,11 @@ void Image11::disassociateStorage()
if (mRecoverFromStorage) if (mRecoverFromStorage)
{ {
// Make the texturestorage release the Image11 too // Make the texturestorage release the Image11 too
mAssociatedStorage->disassociateImage(mAssociatedStorageLevel, mAssociatedStorageLayerTarget, this); mAssociatedStorage->disassociateImage(mAssociatedImageIndex, this);
mRecoverFromStorage = false; mRecoverFromStorage = false;
mAssociatedStorage = NULL; mAssociatedStorage = NULL;
mAssociatedStorageLevel = 0; mAssociatedImageIndex = gl::ImageIndex::MakeInvalid();
mAssociatedStorageLayerTarget = 0;
} }
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define LIBGLESV2_RENDERER_IMAGE11_H_ #define LIBGLESV2_RENDERER_IMAGE11_H_
#include "libGLESv2/renderer/d3d/ImageD3D.h" #include "libGLESv2/renderer/d3d/ImageD3D.h"
#include "libGLESv2/ImageIndex.h"
#include "common/debug.h" #include "common/debug.h"
...@@ -37,10 +38,10 @@ class Image11 : public ImageD3D ...@@ -37,10 +38,10 @@ class Image11 : public ImageD3D
virtual bool isDirty() const; virtual bool isDirty() const;
virtual gl::Error copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual gl::Error copyToStorage2D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual gl::Error copyToStorageCube(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); virtual gl::Error copyToStorage3D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height); virtual gl::Error copyToStorage2DArray(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease); virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
...@@ -64,7 +65,7 @@ class Image11 : public ImageD3D ...@@ -64,7 +65,7 @@ class Image11 : public ImageD3D
private: private:
DISALLOW_COPY_AND_ASSIGN(Image11); DISALLOW_COPY_AND_ASSIGN(Image11);
gl::Error copyToStorageImpl(TextureStorage11 *storage11, int level, int layerTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); gl::Error copyToStorageImpl(TextureStorage11 *storage11, const gl::ImageIndex &index, const gl::Box &region);
ID3D11Resource *getStagingTexture(); ID3D11Resource *getStagingTexture();
unsigned int getStagingSubresource(); unsigned int getStagingSubresource();
...@@ -79,8 +80,7 @@ class Image11 : public ImageD3D ...@@ -79,8 +80,7 @@ class Image11 : public ImageD3D
bool mRecoverFromStorage; bool mRecoverFromStorage;
TextureStorage11 *mAssociatedStorage; TextureStorage11 *mAssociatedStorage;
int mAssociatedStorageLevel; gl::ImageIndex mAssociatedImageIndex;
int mAssociatedStorageLayerTarget;
unsigned int mRecoveredFromStorageCount; unsigned int mRecoveredFromStorageCount;
}; };
......
...@@ -51,24 +51,22 @@ class TextureStorage11 : public TextureStorage ...@@ -51,24 +51,22 @@ class TextureStorage11 : public TextureStorage
virtual bool isRenderTarget() const; virtual bool isRenderTarget() const;
virtual bool isManaged() const; virtual bool isManaged() const;
virtual int getLevelCount() const; virtual int getLevelCount() const;
UINT getSubresourceIndex(int mipLevel, int layerTarget) const; UINT getSubresourceIndex(const gl::ImageIndex &index) const;
gl::Error generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha); gl::Error generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
void invalidateSwizzleCacheLevel(int mipLevel); void invalidateSwizzleCacheLevel(int mipLevel);
void invalidateSwizzleCache(); void invalidateSwizzleCache();
gl::Error updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource, int level, gl::Error updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource,
int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset, const gl::ImageIndex &index, const gl::Box &copyArea);
GLsizei width, GLsizei height, GLsizei depth);
bool copySubresourceLevel(ID3D11Resource* dstTexture, unsigned int dstSubresource, int level, bool copySubresourceLevel(ID3D11Resource* dstTexture, unsigned int dstSubresource,
int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset, const gl::ImageIndex &index, const gl::Box &region);
GLsizei width, GLsizei height, GLsizei depth);
virtual void associateImage(Image11* image, int level, int layerTarget) = 0; virtual void associateImage(Image11* image, const gl::ImageIndex &index) = 0;
virtual void disassociateImage(int level, int layerTarget, Image11* expectedImage) = 0; virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage) = 0;
virtual bool isAssociatedImageValid(int level, int layerTarget, Image11* expectedImage) = 0; virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage) = 0;
virtual void releaseAssociatedImage(int level, int layerTarget, Image11* incomingImage) = 0; virtual void releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage) = 0;
virtual gl::Error copyToStorage(TextureStorage *destStorage); virtual gl::Error copyToStorage(TextureStorage *destStorage);
virtual gl::Error setData(const gl::ImageIndex &index, const gl::Box &sourceBox, GLenum internalFormat, GLenum type, virtual gl::Error setData(const gl::ImageIndex &index, const gl::Box &sourceBox, GLenum internalFormat, GLenum type,
...@@ -166,10 +164,10 @@ class TextureStorage11_2D : public TextureStorage11 ...@@ -166,10 +164,10 @@ class TextureStorage11_2D : public TextureStorage11
virtual ID3D11Resource *getResource() const; virtual ID3D11Resource *getResource() const;
virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index); virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index);
virtual void associateImage(Image11* image, int level, int layerTarget); virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(int level, int layerTarget, Image11* expectedImage); virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(int level, int layerTarget, Image11* expectedImage); virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual void releaseAssociatedImage(int level, int layerTarget, Image11* incomingImage); virtual void releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
protected: protected:
virtual ID3D11Resource *getSwizzleTexture(); virtual ID3D11Resource *getSwizzleTexture();
...@@ -200,10 +198,10 @@ class TextureStorage11_Cube : public TextureStorage11 ...@@ -200,10 +198,10 @@ class TextureStorage11_Cube : public TextureStorage11
virtual ID3D11Resource *getResource() const; virtual ID3D11Resource *getResource() const;
virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index); virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index);
virtual void associateImage(Image11* image, int level, int layerTarget); virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(int level, int layerTarget, Image11* expectedImage); virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(int level, int layerTarget, Image11* expectedImage); virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual void releaseAssociatedImage(int level, int layerTarget, Image11* incomingImage); virtual void releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
protected: protected:
virtual ID3D11Resource *getSwizzleTexture(); virtual ID3D11Resource *getSwizzleTexture();
...@@ -237,10 +235,10 @@ class TextureStorage11_3D : public TextureStorage11 ...@@ -237,10 +235,10 @@ class TextureStorage11_3D : public TextureStorage11
// Handles both layer and non-layer RTs // Handles both layer and non-layer RTs
virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index); virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index);
virtual void associateImage(Image11* image, int level, int layerTarget); virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(int level, int layerTarget, Image11* expectedImage); virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(int level, int layerTarget, Image11* expectedImage); virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual void releaseAssociatedImage(int level, int layerTarget, Image11* incomingImage); virtual void releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
protected: protected:
virtual ID3D11Resource *getSwizzleTexture(); virtual ID3D11Resource *getSwizzleTexture();
...@@ -276,10 +274,10 @@ class TextureStorage11_2DArray : public TextureStorage11 ...@@ -276,10 +274,10 @@ class TextureStorage11_2DArray : public TextureStorage11
virtual ID3D11Resource *getResource() const; virtual ID3D11Resource *getResource() const;
virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index); virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index);
virtual void associateImage(Image11* image, int level, int layerTarget); virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(int level, int layerTarget, Image11* expectedImage); virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(int level, int layerTarget, Image11* expectedImage); virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual void releaseAssociatedImage(int level, int layerTarget, Image11* incomingImage); virtual void releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
protected: protected:
virtual ID3D11Resource *getSwizzleTexture(); virtual ID3D11Resource *getSwizzleTexture();
......
...@@ -301,36 +301,36 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface) ...@@ -301,36 +301,36 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface)
} }
} }
gl::Error Image9::copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) gl::Error Image9::copyToStorage2D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
ASSERT(getSurface() != NULL); ASSERT(getSurface() != NULL);
TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage); TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage);
IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true); IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(index.mipIndex, true);
gl::Error error = copyToSurface(destSurface, xoffset, yoffset, width, height); gl::Error error = copyToSurface(destSurface, region.x, region.y, region.width, region.height);
SafeRelease(destSurface); SafeRelease(destSurface);
return error; return error;
} }
gl::Error Image9::copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) gl::Error Image9::copyToStorageCube(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
ASSERT(getSurface() != NULL); ASSERT(getSurface() != NULL);
TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage); TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage);
IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true); IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(index.type, index.mipIndex, true);
gl::Error error = copyToSurface(destSurface, xoffset, yoffset, width, height); gl::Error error = copyToSurface(destSurface, region.x, region.y, region.width, region.height);
SafeRelease(destSurface); SafeRelease(destSurface);
return error; return error;
} }
gl::Error Image9::copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) gl::Error Image9::copyToStorage3D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
// 3D textures are not supported by the D3D9 backend. // 3D textures are not supported by the D3D9 backend.
UNREACHABLE(); UNREACHABLE();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error Image9::copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) gl::Error Image9::copyToStorage2DArray(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{ {
// 2D array textures are not supported by the D3D9 backend. // 2D array textures are not supported by the D3D9 backend.
UNREACHABLE(); UNREACHABLE();
......
...@@ -44,10 +44,10 @@ class Image9 : public ImageD3D ...@@ -44,10 +44,10 @@ class Image9 : public ImageD3D
virtual void setManagedSurface2D(TextureStorage *storage, int level); virtual void setManagedSurface2D(TextureStorage *storage, int level);
virtual void setManagedSurfaceCube(TextureStorage *storage, int face, int level); virtual void setManagedSurfaceCube(TextureStorage *storage, int face, int level);
virtual gl::Error copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual gl::Error copyToStorage2D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); virtual gl::Error copyToStorageCube(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); virtual gl::Error copyToStorage3D(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height); virtual gl::Error copyToStorage2DArray(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
virtual gl::Error loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, virtual gl::Error loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
GLint unpackAlignment, GLenum type, const void *input); GLint unpackAlignment, GLenum type, const void *input);
......
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