Commit f6b986c8 by Jiajia Qin Committed by Commit Bot

Refactor TextureStorage11

The CL includes below changes: 1. Change bool isAssociatedImageValid to void verifyAssociatedImageValid since we always required that the validation check should never be false. So ASSERT() is enough. Same to Image11::isAssociatedStorageValid->Image11::verifyAssociatedStorageValid. 2. Remove the unnecessary if checking after ASSERT 3. Use override instead of virtual if the function is virtual and is overriding a virtual function from the base class. BUG=angleproject:2006 Change-Id: I036666ae1ed4bfcaa8cef9e0e9626d375cd81a27 Reviewed-on: https://chromium-review.googlesource.com/480015Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent d22b8f72
......@@ -133,9 +133,9 @@ gl::Error Image11::copyToStorage(TextureStorage *storage,
return gl::NoError();
}
bool Image11::isAssociatedStorageValid(TextureStorage11 *textureStorage) const
void Image11::verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const
{
return (mAssociatedStorage == textureStorage);
ASSERT(mAssociatedStorage == textureStorage);
}
gl::Error Image11::recoverFromAssociatedStorage()
......@@ -144,22 +144,13 @@ gl::Error Image11::recoverFromAssociatedStorage()
{
ANGLE_TRY(createStagingTexture());
bool textureStorageCorrect =
mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
mAssociatedStorage->verifyAssociatedImageValid(mAssociatedImageIndex, this);
// 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.
ASSERT(textureStorageCorrect);
if (textureStorageCorrect)
{
// CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
mAssociatedImageIndex, region));
mRecoveredFromStorageCount += 1;
}
// CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
mAssociatedImageIndex, region));
mRecoveredFromStorageCount += 1;
// Reset all the recovery parameters, even if the texture storage association is broken.
disassociateStorage();
......
......@@ -58,7 +58,7 @@ class Image11 : public ImageD3D
const gl::Framebuffer *source) override;
gl::Error recoverFromAssociatedStorage();
bool isAssociatedStorageValid(TextureStorage11* textureStorage) const;
void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
void disassociateStorage();
protected:
......
......@@ -778,19 +778,15 @@ TextureStorage11_2D::~TextureStorage11_2D()
{
if (mAssociatedImages[i] != nullptr)
{
bool imageAssociationCorrect = mAssociatedImages[i]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
mAssociatedImages[i]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
// We must let the Images recover their data before we delete it from the
// TextureStorage.
gl::Error error = mAssociatedImages[i]->recoverFromAssociatedStorage();
if (error.isError())
{
// We must let the Images recover their data before we delete it from the
// TextureStorage.
gl::Error error = mAssociatedImages[i]->recoverFromAssociatedStorage();
if (error.isError())
{
// TODO: Find a way to report this back to the context
ERR() << "Error initialization texture storage: " << error;
}
// TODO: Find a way to report this back to the context
ERR() << "Error initialization texture storage: " << error;
}
}
}
......@@ -925,21 +921,15 @@ void TextureStorage11_2D::associateImage(Image11 *image, const gl::ImageIndex &i
}
}
bool TextureStorage11_2D::isAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
void TextureStorage11_2D::verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
{
const GLint level = index.mipIndex;
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
bool retValue = (mAssociatedImages[level] == expectedImage);
ASSERT(retValue);
return retValue;
}
return false;
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
ASSERT(mAssociatedImages[level] == expectedImage);
}
// disassociateImage allows an Image to end its association with a Storage.
......@@ -948,16 +938,8 @@ void TextureStorage11_2D::disassociateImage(const gl::ImageIndex &index, Image11
const GLint level = index.mipIndex;
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
ASSERT(mAssociatedImages[level] == expectedImage);
if (mAssociatedImages[level] == expectedImage)
{
mAssociatedImages[level] = nullptr;
}
}
ASSERT(mAssociatedImages[level] == expectedImage);
mAssociatedImages[level] = nullptr;
}
// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
......@@ -974,17 +956,12 @@ gl::Error TextureStorage11_2D::releaseAssociatedImage(const gl::ImageIndex &inde
// No need to let the old Image recover its data, if it is also the incoming Image.
if (mAssociatedImages[level] != nullptr && mAssociatedImages[level] != incomingImage)
{
// Ensure that the Image is still associated with this TextureStorage. This should be
// true.
bool imageAssociationCorrect = mAssociatedImages[level]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
// Ensure that the Image is still associated with this TextureStorage.
mAssociatedImages[level]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
}
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
}
}
......@@ -1398,10 +1375,10 @@ void TextureStorage11_External::associateImage(Image11 *image, const gl::ImageIn
mAssociatedImage = image;
}
bool TextureStorage11_External::isAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
void TextureStorage11_External::verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
{
return (index.mipIndex == 0 && mAssociatedImage == expectedImage);
ASSERT(index.mipIndex == 0 && mAssociatedImage == expectedImage);
}
void TextureStorage11_External::disassociateImage(const gl::ImageIndex &index,
......@@ -1419,13 +1396,9 @@ gl::Error TextureStorage11_External::releaseAssociatedImage(const gl::ImageIndex
if (mAssociatedImage != nullptr && mAssociatedImage != incomingImage)
{
bool imageAssociationCorrect = mAssociatedImage->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
mAssociatedImage->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
ANGLE_TRY(mAssociatedImage->recoverFromAssociatedStorage());
}
ANGLE_TRY(mAssociatedImage->recoverFromAssociatedStorage());
}
return gl::NoError();
......@@ -1592,9 +1565,8 @@ void TextureStorage11_EGLImage::disassociateImage(const gl::ImageIndex &, Image1
{
}
bool TextureStorage11_EGLImage::isAssociatedImageValid(const gl::ImageIndex &, Image11 *)
void TextureStorage11_EGLImage::verifyAssociatedImageValid(const gl::ImageIndex &, Image11 *)
{
return false;
}
gl::Error TextureStorage11_EGLImage::releaseAssociatedImage(const gl::ImageIndex &, Image11 *)
......@@ -1804,16 +1776,11 @@ TextureStorage11_Cube::~TextureStorage11_Cube()
{
if (mAssociatedImages[face][level] != nullptr)
{
bool imageAssociationCorrect =
mAssociatedImages[face][level]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
mAssociatedImages[face][level]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// We must let the Images recover their data before we delete it from the
// TextureStorage.
mAssociatedImages[face][level]->recoverFromAssociatedStorage();
}
// We must let the Images recover their data before we delete it from the
// TextureStorage.
mAssociatedImages[face][level]->recoverFromAssociatedStorage();
}
}
}
......@@ -1967,25 +1934,17 @@ void TextureStorage11_Cube::associateImage(Image11 *image, const gl::ImageIndex
}
}
bool TextureStorage11_Cube::isAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
void TextureStorage11_Cube::verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
{
const GLint level = index.mipIndex;
const GLint layerTarget = index.layerIndex;
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
if (0 <= layerTarget && layerTarget < static_cast<GLint>(CUBE_FACE_COUNT))
{
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
bool retValue = (mAssociatedImages[layerTarget][level] == expectedImage);
ASSERT(retValue);
return retValue;
}
}
return false;
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(CUBE_FACE_COUNT));
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
}
// disassociateImage allows an Image to end its association with a Storage.
......@@ -1996,19 +1955,8 @@ void TextureStorage11_Cube::disassociateImage(const gl::ImageIndex &index, Image
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(CUBE_FACE_COUNT));
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
if (0 <= layerTarget && layerTarget < static_cast<GLint>(CUBE_FACE_COUNT))
{
ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
if (mAssociatedImages[layerTarget][level] == expectedImage)
{
mAssociatedImages[layerTarget][level] = nullptr;
}
}
}
ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
mAssociatedImages[layerTarget][level] = nullptr;
}
// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
......@@ -2030,19 +1978,12 @@ gl::Error TextureStorage11_Cube::releaseAssociatedImage(const gl::ImageIndex &in
if (mAssociatedImages[layerTarget][level] != nullptr &&
mAssociatedImages[layerTarget][level] != incomingImage)
{
// Ensure that the Image is still associated with this TextureStorage. This should
// be true.
bool imageAssociationCorrect =
mAssociatedImages[layerTarget][level]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
// Ensure that the Image is still associated with this TextureStorage.
mAssociatedImages[layerTarget][level]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(
mAssociatedImages[layerTarget][level]->recoverFromAssociatedStorage());
}
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[layerTarget][level]->recoverFromAssociatedStorage());
}
}
}
......@@ -2559,15 +2500,11 @@ TextureStorage11_3D::~TextureStorage11_3D()
{
if (mAssociatedImages[i] != nullptr)
{
bool imageAssociationCorrect = mAssociatedImages[i]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
mAssociatedImages[i]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// We must let the Images recover their data before we delete it from the
// TextureStorage.
mAssociatedImages[i]->recoverFromAssociatedStorage();
}
// We must let the Images recover their data before we delete it from the
// TextureStorage.
mAssociatedImages[i]->recoverFromAssociatedStorage();
}
}
......@@ -2600,21 +2537,15 @@ void TextureStorage11_3D::associateImage(Image11 *image, const gl::ImageIndex &i
}
}
bool TextureStorage11_3D::isAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
void TextureStorage11_3D::verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
{
const GLint level = index.mipIndex;
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
bool retValue = (mAssociatedImages[level] == expectedImage);
ASSERT(retValue);
return retValue;
}
return false;
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
// This validation check should never return false. It means the Image/TextureStorage
// association is broken.
ASSERT(mAssociatedImages[level] == expectedImage);
}
// disassociateImage allows an Image to end its association with a Storage.
......@@ -2623,16 +2554,8 @@ void TextureStorage11_3D::disassociateImage(const gl::ImageIndex &index, Image11
const GLint level = index.mipIndex;
ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
ASSERT(mAssociatedImages[level] == expectedImage);
if (mAssociatedImages[level] == expectedImage)
{
mAssociatedImages[level] = nullptr;
}
}
ASSERT(mAssociatedImages[level] == expectedImage);
mAssociatedImages[level] = nullptr;
}
// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
......@@ -2649,17 +2572,12 @@ gl::Error TextureStorage11_3D::releaseAssociatedImage(const gl::ImageIndex &inde
// No need to let the old Image recover its data, if it is also the incoming Image.
if (mAssociatedImages[level] != nullptr && mAssociatedImages[level] != incomingImage)
{
// Ensure that the Image is still associated with this TextureStorage. This should be
// true.
bool imageAssociationCorrect = mAssociatedImages[level]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
// Ensure that the Image is still associated with this TextureStorage.
mAssociatedImages[level]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
}
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
}
}
......@@ -2961,15 +2879,11 @@ TextureStorage11_2DArray::~TextureStorage11_2DArray()
{
if (i->second)
{
bool imageAssociationCorrect = i->second->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
i->second->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// We must let the Images recover their data before we delete it from the
// TextureStorage.
i->second->recoverFromAssociatedStorage();
}
// We must let the Images recover their data before we delete it from the
// TextureStorage.
i->second->recoverFromAssociatedStorage();
}
}
mAssociatedImages.clear();
......@@ -3003,8 +2917,8 @@ void TextureStorage11_2DArray::associateImage(Image11 *image, const gl::ImageInd
}
}
bool TextureStorage11_2DArray::isAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
void TextureStorage11_2DArray::verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage)
{
const GLint level = index.mipIndex;
const GLint layerTarget = index.layerIndex;
......@@ -3016,7 +2930,6 @@ bool TextureStorage11_2DArray::isAssociatedImageValid(const gl::ImageIndex &inde
bool retValue = (mAssociatedImages.find(key) != mAssociatedImages.end() &&
(mAssociatedImages[key] == expectedImage));
ASSERT(retValue);
return retValue;
}
// disassociateImage allows an Image to end its association with a Storage.
......@@ -3031,11 +2944,7 @@ void TextureStorage11_2DArray::disassociateImage(const gl::ImageIndex &index,
bool imageAssociationCorrect = (mAssociatedImages.find(key) != mAssociatedImages.end() &&
(mAssociatedImages[key] == expectedImage));
ASSERT(imageAssociationCorrect);
if (imageAssociationCorrect)
{
mAssociatedImages[key] = nullptr;
}
mAssociatedImages[key] = nullptr;
}
// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
......@@ -3052,17 +2961,12 @@ gl::Error TextureStorage11_2DArray::releaseAssociatedImage(const gl::ImageIndex
{
if (mAssociatedImages[key] != nullptr && mAssociatedImages[key] != incomingImage)
{
// Ensure that the Image is still associated with this TextureStorage. This should be
// true.
bool imageAssociationCorrect = mAssociatedImages[key]->isAssociatedStorageValid(this);
ASSERT(imageAssociationCorrect);
// Ensure that the Image is still associated with this TextureStorage.
mAssociatedImages[key]->verifyAssociatedStorageValid(this);
if (imageAssociationCorrect)
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[key]->recoverFromAssociatedStorage());
}
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
ANGLE_TRY(mAssociatedImages[key]->recoverFromAssociatedStorage());
}
}
......
......@@ -36,28 +36,15 @@ struct Renderer11DeviceCaps;
class TextureStorage11 : public TextureStorage
{
public:
virtual ~TextureStorage11();
~TextureStorage11() override;
static DWORD GetTextureBindFlags(GLenum internalFormat, const Renderer11DeviceCaps &renderer11DeviceCaps, bool renderTarget);
static DWORD GetTextureMiscFlags(GLenum internalFormat, const Renderer11DeviceCaps &renderer11DeviceCaps, bool renderTarget, int levels);
UINT getBindFlags() const;
UINT getMiscFlags() const;
virtual gl::Error getResource(ID3D11Resource **outResource) = 0;
virtual gl::Error getSRV(const gl::TextureState &textureState,
ID3D11ShaderResourceView **outSRV);
virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) = 0;
virtual gl::Error generateMipmap(const gl::ImageIndex &sourceIndex, const gl::ImageIndex &destIndex);
virtual int getTopLevel() const;
virtual bool isRenderTarget() const;
virtual bool isManaged() const;
bool supportsNativeMipmapFunction() const override;
virtual int getLevelCount() const;
virtual UINT getSubresourceIndex(const gl::ImageIndex &index) const;
const d3d11::Format &getFormatSet() const;
gl::Error getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV);
gl::Error generateSwizzles(const gl::SwizzleState &swizzleTarget);
void markLevelDirty(int mipLevel);
void markDirty();
......@@ -68,19 +55,32 @@ class TextureStorage11 : public TextureStorage
gl::Error copySubresourceLevel(ID3D11Resource* dstTexture, unsigned int dstSubresource,
const gl::ImageIndex &index, const gl::Box &region);
// TextureStorage virtual functions
int getTopLevel() const override;
bool isRenderTarget() const override;
bool isManaged() const override;
bool supportsNativeMipmapFunction() const override;
int getLevelCount() const override;
gl::Error generateMipmap(const gl::ImageIndex &sourceIndex,
const gl::ImageIndex &destIndex) override;
gl::Error copyToStorage(TextureStorage *destStorage) override;
gl::Error setData(const gl::ImageIndex &index,
ImageD3D *image,
const gl::Box *destBox,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixelData) override;
virtual gl::Error getSRV(const gl::TextureState &textureState,
ID3D11ShaderResourceView **outSRV);
virtual UINT getSubresourceIndex(const gl::ImageIndex &index) const;
virtual gl::Error getResource(ID3D11Resource **outResource) = 0;
virtual void associateImage(Image11* image, const gl::ImageIndex &index) = 0;
virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage) = 0;
virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage) = 0;
virtual void verifyAssociatedImageValid(const gl::ImageIndex &index,
Image11 *expectedImage) = 0;
virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage) = 0;
virtual gl::Error copyToStorage(TextureStorage *destStorage);
virtual gl::Error setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixelData);
gl::Error getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV);
const d3d11::Format &getFormatSet() const;
protected:
TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags, GLenum internalFormat);
int getLevelWidth(int mipLevel) const;
......@@ -163,7 +163,7 @@ class TextureStorage11_2D : public TextureStorage11
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
bool isAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) override;
......@@ -223,7 +223,7 @@ class TextureStorage11_External : public TextureStorage11
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
bool isAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
protected:
......@@ -262,7 +262,7 @@ class TextureStorage11_EGLImage final : public TextureStorage11
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
bool isAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) override;
......@@ -296,34 +296,37 @@ class TextureStorage11_Cube : public TextureStorage11
{
public:
TextureStorage11_Cube(Renderer11 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly);
virtual ~TextureStorage11_Cube();
~TextureStorage11_Cube() override;
virtual UINT getSubresourceIndex(const gl::ImageIndex &index) const;
UINT getSubresourceIndex(const gl::ImageIndex &index) const override;
virtual gl::Error getResource(ID3D11Resource **outResource);
virtual gl::Error getMippedResource(ID3D11Resource **outResource);
virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT);
gl::Error getResource(ID3D11Resource **outResource) override;
gl::Error getMippedResource(ID3D11Resource **outResource) override;
gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) override;
virtual gl::Error copyToStorage(TextureStorage *destStorage);
gl::Error copyToStorage(TextureStorage *destStorage) override;
virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture);
gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) override;
protected:
virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
gl::Error getSwizzleTexture(ID3D11Resource **outTexture) override;
gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) override;
gl::ErrorOrResult<DropStencil> ensureDropStencilTexture() override;
gl::Error ensureTextureExists(int mipLevels);
private:
virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const;
gl::Error createSRV(int baseLevel,
int mipLevels,
DXGI_FORMAT format,
ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const override;
gl::Error createRenderTargetSRV(ID3D11Resource *texture,
const gl::ImageIndex &index,
DXGI_FORMAT resourceFormat,
......@@ -350,25 +353,28 @@ class TextureStorage11_3D : public TextureStorage11
public:
TextureStorage11_3D(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
GLsizei width, GLsizei height, GLsizei depth, int levels);
virtual ~TextureStorage11_3D();
~TextureStorage11_3D() override;
virtual gl::Error getResource(ID3D11Resource **outResource);
gl::Error getResource(ID3D11Resource **outResource) override;
// Handles both layer and non-layer RTs
virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT);
gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) override;
virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
protected:
virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
gl::Error getSwizzleTexture(ID3D11Resource **outTexture) override;
gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) override;
private:
virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const;
gl::Error createSRV(int baseLevel,
int mipLevels,
DXGI_FORMAT format,
ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const override;
typedef std::pair<int, int> LevelLayerKey;
typedef std::map<LevelLayerKey, RenderTarget11*> RenderTargetMap;
......@@ -388,25 +394,28 @@ class TextureStorage11_2DArray : public TextureStorage11
public:
TextureStorage11_2DArray(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
GLsizei width, GLsizei height, GLsizei depth, int levels);
virtual ~TextureStorage11_2DArray();
~TextureStorage11_2DArray() override;
virtual gl::Error getResource(ID3D11Resource **outResource);
virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT);
gl::Error getResource(ID3D11Resource **outResource) override;
gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) override;
virtual void associateImage(Image11* image, const gl::ImageIndex &index);
virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
protected:
virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
gl::Error getSwizzleTexture(ID3D11Resource **outTexture) override;
gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) override;
gl::ErrorOrResult<DropStencil> ensureDropStencilTexture() override;
private:
virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const;
gl::Error createSRV(int baseLevel,
int mipLevels,
DXGI_FORMAT format,
ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const override;
gl::Error createRenderTargetSRV(ID3D11Resource *texture,
const gl::ImageIndex &index,
DXGI_FORMAT resourceFormat,
......
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