Commit 48ba75ac by Tim Van Patten Committed by Commit Bot

Remove TextureCommand

TextureCommand::GenerateMipmap can be moved into gl::Command allowing us to remove TextureCommand. Bug: angleproject:4753 Test: CQ Change-Id: Idc546df519e199ffd3a8b8e03b9868cd9152e9ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2338823 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com>
parent 81370214
...@@ -3123,7 +3123,7 @@ angle::Result State::syncTextures(const Context *context, Command command) ...@@ -3123,7 +3123,7 @@ angle::Result State::syncTextures(const Context *context, Command command)
Texture *texture = mActiveTexturesCache[textureIndex]; Texture *texture = mActiveTexturesCache[textureIndex];
if (texture && texture->hasAnyDirtyBit()) if (texture && texture->hasAnyDirtyBit())
{ {
ANGLE_TRY(texture->syncState(context, TextureCommand::Other)); ANGLE_TRY(texture->syncState(context, Command::Other));
} }
} }
...@@ -3141,7 +3141,7 @@ angle::Result State::syncImages(const Context *context, Command command) ...@@ -3141,7 +3141,7 @@ angle::Result State::syncImages(const Context *context, Command command)
Texture *texture = mImageUnits[imageUnitIndex].texture.get(); Texture *texture = mImageUnits[imageUnitIndex].texture.get();
if (texture && texture->hasAnyDirtyBit()) if (texture && texture->hasAnyDirtyBit())
{ {
ANGLE_TRY(texture->syncState(context, TextureCommand::Other)); ANGLE_TRY(texture->syncState(context, Command::Other));
} }
} }
...@@ -3297,7 +3297,7 @@ angle::Result State::onProgramExecutableChange(const Context *context, Program * ...@@ -3297,7 +3297,7 @@ angle::Result State::onProgramExecutableChange(const Context *context, Program *
if (image->hasAnyDirtyBit()) if (image->hasAnyDirtyBit())
{ {
ANGLE_TRY(image->syncState(context, TextureCommand::Other)); ANGLE_TRY(image->syncState(context, Command::Other));
} }
if (mRobustResourceInit && image->initState() == InitState::MayNeedInit) if (mRobustResourceInit && image->initState() == InitState::MayNeedInit)
...@@ -3342,7 +3342,7 @@ angle::Result State::onProgramPipelineExecutableChange(const Context *context, ...@@ -3342,7 +3342,7 @@ angle::Result State::onProgramPipelineExecutableChange(const Context *context,
if (image->hasAnyDirtyBit()) if (image->hasAnyDirtyBit())
{ {
ANGLE_TRY(image->syncState(context, TextureCommand::Other)); ANGLE_TRY(image->syncState(context, Command::Other));
} }
if (mRobustResourceInit && image->initState() == InitState::MayNeedInit) if (mRobustResourceInit && image->initState() == InitState::MayNeedInit)
......
...@@ -70,17 +70,6 @@ using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVec ...@@ -70,17 +70,6 @@ using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVec
using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>; using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>;
using BufferVector = std::vector<OffsetBindingPointer<Buffer>>; using BufferVector = std::vector<OffsetBindingPointer<Buffer>>;
enum class Command
{
Other,
Blit,
CopyImage,
Dispatch,
Draw,
ReadPixels,
TexImage
};
class ActiveTexturesCache final : angle::NonCopyable class ActiveTexturesCache final : angle::NonCopyable
{ {
public: public:
......
...@@ -1503,7 +1503,7 @@ angle::Result Texture::generateMipmap(Context *context) ...@@ -1503,7 +1503,7 @@ angle::Result Texture::generateMipmap(Context *context)
return angle::Result::Continue; return angle::Result::Continue;
} }
ANGLE_TRY(syncState(context, TextureCommand::GenerateMipmap)); ANGLE_TRY(syncState(context, Command::GenerateMipmap));
// Clear the base image(s) immediately if needed // Clear the base image(s) immediately if needed
if (context->isRobustResourceInitEnabled()) if (context->isRobustResourceInitEnabled())
...@@ -1794,9 +1794,9 @@ GLuint Texture::getNativeID() const ...@@ -1794,9 +1794,9 @@ GLuint Texture::getNativeID() const
return mTexture->getNativeID(); return mTexture->getNativeID();
} }
angle::Result Texture::syncState(const Context *context, TextureCommand source) angle::Result Texture::syncState(const Context *context, Command source)
{ {
ASSERT(hasAnyDirtyBit() || source == TextureCommand::GenerateMipmap); ASSERT(hasAnyDirtyBit() || source == Command::GenerateMipmap);
ANGLE_TRY(mTexture->syncState(context, mDirtyBits, source)); ANGLE_TRY(mTexture->syncState(context, mDirtyBits, source));
mDirtyBits.reset(); mDirtyBits.reset();
return angle::Result::Continue; return angle::Result::Continue;
...@@ -2010,7 +2010,7 @@ angle::Result Texture::getTexImage(const Context *context, ...@@ -2010,7 +2010,7 @@ angle::Result Texture::getTexImage(const Context *context,
{ {
if (hasAnyDirtyBit()) if (hasAnyDirtyBit())
{ {
ANGLE_TRY(syncState(context, TextureCommand::Other)); ANGLE_TRY(syncState(context, Command::Other));
} }
return mTexture->getTexImage(context, packState, packBuffer, target, level, format, type, return mTexture->getTexImage(context, packState, packBuffer, target, level, format, type,
......
...@@ -101,14 +101,6 @@ struct ContextBindingCount ...@@ -101,14 +101,6 @@ struct ContextBindingCount
uint32_t imageBindingCount; uint32_t imageBindingCount;
}; };
// The source of the syncState call. Knowing why syncState is being called can help the back-end
// make more-informed decisions.
enum class TextureCommand
{
GenerateMipmap,
Other,
};
// State from Table 6.9 (state per texture object) in the OpenGL ES 3.0.2 spec. // State from Table 6.9 (state per texture object) in the OpenGL ES 3.0.2 spec.
class TextureState final : private angle::NonCopyable class TextureState final : private angle::NonCopyable
{ {
...@@ -605,7 +597,7 @@ class Texture final : public RefCountObject<TextureID>, ...@@ -605,7 +597,7 @@ class Texture final : public RefCountObject<TextureID>,
}; };
using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>; using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>;
angle::Result syncState(const Context *context, TextureCommand source); angle::Result syncState(const Context *context, Command source);
bool hasAnyDirtyBit() const { return mDirtyBits.any(); } bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
// ObserverInterface implementation. // ObserverInterface implementation.
......
...@@ -30,6 +30,18 @@ namespace gl ...@@ -30,6 +30,18 @@ namespace gl
class Buffer; class Buffer;
class Texture; class Texture;
enum class Command
{
Blit,
CopyImage,
Dispatch,
Draw,
GenerateMipmap,
ReadPixels,
TexImage,
Other
};
struct Rectangle struct Rectangle
{ {
Rectangle() : x(0), y(0), width(0), height(0) {} Rectangle() : x(0), y(0), width(0), height(0) {}
......
...@@ -190,7 +190,7 @@ class TextureImpl : public FramebufferAttachmentObjectImpl ...@@ -190,7 +190,7 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
virtual angle::Result syncState(const gl::Context *context, virtual angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) = 0; gl::Command source) = 0;
virtual GLenum getColorReadFormat(const gl::Context *context); virtual GLenum getColorReadFormat(const gl::Context *context);
virtual GLenum getColorReadType(const gl::Context *context); virtual GLenum getColorReadType(const gl::Context *context);
......
...@@ -134,7 +134,7 @@ class MockTextureImpl : public TextureImpl ...@@ -134,7 +134,7 @@ class MockTextureImpl : public TextureImpl
MOCK_METHOD3(syncState, MOCK_METHOD3(syncState,
angle::Result(const gl::Context *, angle::Result(const gl::Context *,
const gl::Texture::DirtyBits &, const gl::Texture::DirtyBits &,
gl::TextureCommand source)); gl::Command source));
MOCK_METHOD0(destructor, void()); MOCK_METHOD0(destructor, void());
......
...@@ -684,7 +684,7 @@ angle::Result TextureD3D::setBaseLevel(const gl::Context *context, GLuint baseLe ...@@ -684,7 +684,7 @@ angle::Result TextureD3D::setBaseLevel(const gl::Context *context, GLuint baseLe
angle::Result TextureD3D::syncState(const gl::Context *context, angle::Result TextureD3D::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) gl::Command source)
{ {
// This could be improved using dirty bits. // This could be improved using dirty bits.
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -110,7 +110,7 @@ class TextureD3D : public TextureImpl, public angle::ObserverInterface ...@@ -110,7 +110,7 @@ class TextureD3D : public TextureImpl, public angle::ObserverInterface
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) override; gl::Command source) override;
angle::Result initializeContents(const gl::Context *context, angle::Result initializeContents(const gl::Context *context,
const gl::ImageIndex &imageIndex) override; const gl::ImageIndex &imageIndex) override;
......
...@@ -1389,7 +1389,7 @@ GLint TextureGL::getNativeID() const ...@@ -1389,7 +1389,7 @@ GLint TextureGL::getNativeID() const
angle::Result TextureGL::syncState(const gl::Context *context, angle::Result TextureGL::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) gl::Command source)
{ {
if (dirtyBits.none() && mLocalDirtyBits.none()) if (dirtyBits.none() && mLocalDirtyBits.none())
{ {
......
...@@ -193,7 +193,7 @@ class TextureGL : public TextureImpl ...@@ -193,7 +193,7 @@ class TextureGL : public TextureImpl
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) override; gl::Command source) override;
bool hasAnyDirtyBit() const; bool hasAnyDirtyBit() const;
angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) override; angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
......
...@@ -134,7 +134,7 @@ class TextureMtl : public TextureImpl ...@@ -134,7 +134,7 @@ class TextureMtl : public TextureImpl
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) override; gl::Command source) override;
angle::Result setStorageMultisample(const gl::Context *context, angle::Result setStorageMultisample(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
...@@ -795,7 +795,7 @@ angle::Result TextureMtl::getAttachmentRenderTarget(const gl::Context *context, ...@@ -795,7 +795,7 @@ angle::Result TextureMtl::getAttachmentRenderTarget(const gl::Context *context,
angle::Result TextureMtl::syncState(const gl::Context *context, angle::Result TextureMtl::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) gl::Command source)
{ {
if (dirtyBits.any()) if (dirtyBits.any())
{ {
......
...@@ -176,7 +176,7 @@ angle::Result TextureNULL::releaseTexImage(const gl::Context *context) ...@@ -176,7 +176,7 @@ angle::Result TextureNULL::releaseTexImage(const gl::Context *context)
angle::Result TextureNULL::syncState(const gl::Context *context, angle::Result TextureNULL::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) gl::Command source)
{ {
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -121,7 +121,7 @@ class TextureNULL : public TextureImpl ...@@ -121,7 +121,7 @@ class TextureNULL : public TextureImpl
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) override; gl::Command source) override;
angle::Result setStorageMultisample(const gl::Context *context, angle::Result setStorageMultisample(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
...@@ -622,7 +622,7 @@ angle::Result IncompleteTextureSet::getIncompleteTexture( ...@@ -622,7 +622,7 @@ angle::Result IncompleteTextureSet::getIncompleteTexture(
GL_UNSIGNED_BYTE, color)); GL_UNSIGNED_BYTE, color));
} }
ANGLE_TRY(t->syncState(context, gl::TextureCommand::Other)); ANGLE_TRY(t->syncState(context, gl::Command::Other));
mIncompleteTextures[type].set(context, t.release()); mIncompleteTextures[type].set(context, t.release());
*textureOut = mIncompleteTextures[type].get(); *textureOut = mIncompleteTextures[type].get();
......
...@@ -2055,7 +2055,7 @@ void TextureVk::prepareForGenerateMipmap(ContextVk *contextVk) ...@@ -2055,7 +2055,7 @@ void TextureVk::prepareForGenerateMipmap(ContextVk *contextVk)
angle::Result TextureVk::syncState(const gl::Context *context, angle::Result TextureVk::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) gl::Command source)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
RendererVk *renderer = contextVk->getRenderer(); RendererVk *renderer = contextVk->getRenderer();
...@@ -2082,7 +2082,7 @@ angle::Result TextureVk::syncState(const gl::Context *context, ...@@ -2082,7 +2082,7 @@ angle::Result TextureVk::syncState(const gl::Context *context,
// Before redefining the image for any reason, check to see if it's about to go through mipmap // Before redefining the image for any reason, check to see if it's about to go through mipmap
// generation. In that case, drop every staged change for the subsequent mips after base, and // generation. In that case, drop every staged change for the subsequent mips after base, and
// make sure the image is created with the complete mipchain. // make sure the image is created with the complete mipchain.
bool isGenerateMipmap = source == gl::TextureCommand::GenerateMipmap; bool isGenerateMipmap = source == gl::Command::GenerateMipmap;
if (isGenerateMipmap) if (isGenerateMipmap)
{ {
prepareForGenerateMipmap(contextVk); prepareForGenerateMipmap(contextVk);
......
...@@ -143,7 +143,7 @@ class TextureVk : public TextureImpl, public angle::ObserverInterface ...@@ -143,7 +143,7 @@ class TextureVk : public TextureImpl, public angle::ObserverInterface
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits, const gl::Texture::DirtyBits &dirtyBits,
gl::TextureCommand source) override; gl::Command source) override;
angle::Result setStorageMultisample(const gl::Context *context, angle::Result setStorageMultisample(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
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