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
return mImpl;
}
void Sampler::syncState(const Context *context)
angle::Result Sampler::syncState(const Context *context)
{
// TODO(jmadill): Use actual dirty bits for sampler.
mImpl->syncState(context);
return mImpl->syncState(context);
}
} // namespace gl
......@@ -75,7 +75,7 @@ class Sampler final : public RefCountObject, public LabeledObject, public angle:
rx::SamplerImpl *getImplementation() const;
void syncState(const Context *context);
angle::Result syncState(const Context *context);
private:
SamplerState mState;
......
......@@ -2689,7 +2689,7 @@ angle::Result State::syncSamplers(const Context *context)
BindingPointer<Sampler> &sampler = mSamplers[samplerIndex];
if (sampler.get())
{
sampler->syncState(context);
ANGLE_TRY(sampler->syncState(context));
}
}
......
......@@ -10,6 +10,7 @@
#define LIBANGLE_RENDERER_SAMPLERIMPL_H_
#include "common/angleutils.h"
#include "libANGLE/Error.h"
namespace gl
{
......@@ -26,10 +27,7 @@ class SamplerImpl : angle::NonCopyable
SamplerImpl(const gl::SamplerState &state) : mState(state) {}
virtual ~SamplerImpl() {}
virtual void syncState(const gl::Context *context)
{
// Default implementation: no-op.
}
virtual angle::Result syncState(const gl::Context *context) = 0;
protected:
const gl::SamplerState &mState;
......
......@@ -19,7 +19,15 @@ class SamplerD3D : public SamplerImpl
public:
SamplerD3D(const gl::SamplerState &state) : SamplerImpl(state) {}
~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
#endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
......@@ -83,7 +83,7 @@ SamplerGL::~SamplerGL()
mSamplerID = 0;
}
void SamplerGL::syncState(const gl::Context *context)
angle::Result SamplerGL::syncState(const gl::Context *context)
{
// clang-format off
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)
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);
// clang-format on
return angle::Result::Continue;
}
GLuint SamplerGL::getSamplerID() const
......
......@@ -26,7 +26,7 @@ class SamplerGL : public SamplerImpl
StateManagerGL *stateManager);
~SamplerGL() override;
void syncState(const gl::Context *context) override;
angle::Result syncState(const gl::Context *context) override;
GLuint getSamplerID() const;
......
......@@ -18,4 +18,9 @@ SamplerNULL::SamplerNULL(const gl::SamplerState &state) : SamplerImpl(state) {}
SamplerNULL::~SamplerNULL() {}
angle::Result SamplerNULL::syncState(const gl::Context *context)
{
return angle::Result::Continue;
}
} // namespace rx
......@@ -20,6 +20,8 @@ class SamplerNULL : public SamplerImpl
public:
SamplerNULL(const gl::SamplerState &state);
~SamplerNULL() override;
angle::Result syncState(const gl::Context *context) override;
};
} // namespace rx
......
......@@ -18,4 +18,9 @@ SamplerVk::SamplerVk(const gl::SamplerState &state) : SamplerImpl(state) {}
SamplerVk::~SamplerVk() {}
angle::Result SamplerVk::syncState(const gl::Context *context)
{
return angle::Result::Continue;
}
} // namespace rx
......@@ -20,6 +20,8 @@ class SamplerVk : public SamplerImpl
public:
SamplerVk(const gl::SamplerState &state);
~SamplerVk() override;
angle::Result syncState(const gl::Context *context) override;
};
} // 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