Commit 31ab533e by Tobin Ehlis Committed by Commit Bot

Sampler::syncState now returns angle::Result

This is a foundational refactor in preparation for implementing sampler objects in the Vulkan backend. Bug: angleproject:3208 Change-Id: I5970f141d3f825aee1f8b713be8e162c7d0f8bbe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1710961Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent 8400d05c
...@@ -178,10 +178,10 @@ rx::SamplerImpl *Sampler::getImplementation() const ...@@ -178,10 +178,10 @@ rx::SamplerImpl *Sampler::getImplementation() const
return mImpl; return mImpl;
} }
void Sampler::syncState(const Context *context) angle::Result Sampler::syncState(const Context *context)
{ {
// TODO(jmadill): Use actual dirty bits for sampler. // TODO(jmadill): Use actual dirty bits for sampler.
mImpl->syncState(context); return mImpl->syncState(context);
} }
} // namespace gl } // namespace gl
...@@ -75,7 +75,7 @@ class Sampler final : public RefCountObject, public LabeledObject, public angle: ...@@ -75,7 +75,7 @@ class Sampler final : public RefCountObject, public LabeledObject, public angle:
rx::SamplerImpl *getImplementation() const; rx::SamplerImpl *getImplementation() const;
void syncState(const Context *context); angle::Result syncState(const Context *context);
private: private:
SamplerState mState; SamplerState mState;
......
...@@ -2689,7 +2689,7 @@ angle::Result State::syncSamplers(const Context *context) ...@@ -2689,7 +2689,7 @@ angle::Result State::syncSamplers(const Context *context)
BindingPointer<Sampler> &sampler = mSamplers[samplerIndex]; BindingPointer<Sampler> &sampler = mSamplers[samplerIndex];
if (sampler.get()) if (sampler.get())
{ {
sampler->syncState(context); ANGLE_TRY(sampler->syncState(context));
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define LIBANGLE_RENDERER_SAMPLERIMPL_H_ #define LIBANGLE_RENDERER_SAMPLERIMPL_H_
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h"
namespace gl namespace gl
{ {
...@@ -26,10 +27,7 @@ class SamplerImpl : angle::NonCopyable ...@@ -26,10 +27,7 @@ class SamplerImpl : angle::NonCopyable
SamplerImpl(const gl::SamplerState &state) : mState(state) {} SamplerImpl(const gl::SamplerState &state) : mState(state) {}
virtual ~SamplerImpl() {} virtual ~SamplerImpl() {}
virtual void syncState(const gl::Context *context) virtual angle::Result syncState(const gl::Context *context) = 0;
{
// Default implementation: no-op.
}
protected: protected:
const gl::SamplerState &mState; const gl::SamplerState &mState;
......
...@@ -19,7 +19,15 @@ class SamplerD3D : public SamplerImpl ...@@ -19,7 +19,15 @@ class SamplerD3D : public SamplerImpl
public: public:
SamplerD3D(const gl::SamplerState &state) : SamplerImpl(state) {} SamplerD3D(const gl::SamplerState &state) : SamplerImpl(state) {}
~SamplerD3D() override {} ~SamplerD3D() override {}
angle::Result syncState(const gl::Context *context) override;
}; };
inline angle::Result SamplerD3D::syncState(const gl::Context *context)
{
return angle::Result::Continue;
}
} // namespace rx } // namespace rx
#endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_ #endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
...@@ -83,7 +83,7 @@ SamplerGL::~SamplerGL() ...@@ -83,7 +83,7 @@ SamplerGL::~SamplerGL()
mSamplerID = 0; mSamplerID = 0;
} }
void SamplerGL::syncState(const gl::Context *context) angle::Result SamplerGL::syncState(const gl::Context *context)
{ {
// clang-format off // clang-format off
SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::getMinFilter, &gl::SamplerState::setMinFilter); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::getMinFilter, &gl::SamplerState::setMinFilter);
...@@ -99,6 +99,7 @@ void SamplerGL::syncState(const gl::Context *context) ...@@ -99,6 +99,7 @@ void SamplerGL::syncState(const gl::Context *context)
SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_SRGB_DECODE_EXT, &gl::SamplerState::getSRGBDecode, &gl::SamplerState::setSRGBDecode); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_SRGB_DECODE_EXT, &gl::SamplerState::getSRGBDecode, &gl::SamplerState::setSRGBDecode);
SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_BORDER_COLOR, &gl::SamplerState::getBorderColor, &gl::SamplerState::setBorderColor); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_BORDER_COLOR, &gl::SamplerState::getBorderColor, &gl::SamplerState::setBorderColor);
// clang-format on // clang-format on
return angle::Result::Continue;
} }
GLuint SamplerGL::getSamplerID() const GLuint SamplerGL::getSamplerID() const
......
...@@ -26,7 +26,7 @@ class SamplerGL : public SamplerImpl ...@@ -26,7 +26,7 @@ class SamplerGL : public SamplerImpl
StateManagerGL *stateManager); StateManagerGL *stateManager);
~SamplerGL() override; ~SamplerGL() override;
void syncState(const gl::Context *context) override; angle::Result syncState(const gl::Context *context) override;
GLuint getSamplerID() const; GLuint getSamplerID() const;
......
...@@ -18,4 +18,9 @@ SamplerNULL::SamplerNULL(const gl::SamplerState &state) : SamplerImpl(state) {} ...@@ -18,4 +18,9 @@ SamplerNULL::SamplerNULL(const gl::SamplerState &state) : SamplerImpl(state) {}
SamplerNULL::~SamplerNULL() {} SamplerNULL::~SamplerNULL() {}
angle::Result SamplerNULL::syncState(const gl::Context *context)
{
return angle::Result::Continue;
}
} // namespace rx } // namespace rx
...@@ -20,6 +20,8 @@ class SamplerNULL : public SamplerImpl ...@@ -20,6 +20,8 @@ class SamplerNULL : public SamplerImpl
public: public:
SamplerNULL(const gl::SamplerState &state); SamplerNULL(const gl::SamplerState &state);
~SamplerNULL() override; ~SamplerNULL() override;
angle::Result syncState(const gl::Context *context) override;
}; };
} // namespace rx } // namespace rx
......
...@@ -18,4 +18,9 @@ SamplerVk::SamplerVk(const gl::SamplerState &state) : SamplerImpl(state) {} ...@@ -18,4 +18,9 @@ SamplerVk::SamplerVk(const gl::SamplerState &state) : SamplerImpl(state) {}
SamplerVk::~SamplerVk() {} SamplerVk::~SamplerVk() {}
angle::Result SamplerVk::syncState(const gl::Context *context)
{
return angle::Result::Continue;
}
} // namespace rx } // namespace rx
...@@ -20,6 +20,8 @@ class SamplerVk : public SamplerImpl ...@@ -20,6 +20,8 @@ class SamplerVk : public SamplerImpl
public: public:
SamplerVk(const gl::SamplerState &state); SamplerVk(const gl::SamplerState &state);
~SamplerVk() override; ~SamplerVk() override;
angle::Result syncState(const gl::Context *context) override;
}; };
} // namespace rx } // namespace rx
......
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