Commit 06ef36b9 by Jamie Madill Committed by Commit Bot

Add top-level state sync for Samplers.

This also reformats the Sampler class to use a shared state struct with the implementation. It removes the call to sync the sampler state from the StateManagerGL::setGenericShaderState method, since it should all be handled at the front-end now. Also rename 'syncImplState' to 'syncState' methods. BUG=angleproject:1387 Change-Id: I5f0219b719aee99aaaa486ec188b2af0c9128e6a Reviewed-on: https://chromium-review.googlesource.com/648054 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 81c2e253
...@@ -2356,6 +2356,7 @@ void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param) ...@@ -2356,6 +2356,7 @@ void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
Sampler *samplerObject = Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
SetSamplerParameteri(samplerObject, pname, param); SetSamplerParameteri(samplerObject, pname, param);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param) void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
...@@ -2363,6 +2364,7 @@ void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *para ...@@ -2363,6 +2364,7 @@ void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *para
Sampler *samplerObject = Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
SetSamplerParameteriv(samplerObject, pname, param); SetSamplerParameteriv(samplerObject, pname, param);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param) void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
...@@ -2370,6 +2372,7 @@ void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param) ...@@ -2370,6 +2372,7 @@ void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
Sampler *samplerObject = Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
SetSamplerParameterf(samplerObject, pname, param); SetSamplerParameterf(samplerObject, pname, param);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param) void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
...@@ -2377,6 +2380,7 @@ void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *pa ...@@ -2377,6 +2380,7 @@ void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *pa
Sampler *samplerObject = Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
SetSamplerParameterfv(samplerObject, pname, param); SetSamplerParameterfv(samplerObject, pname, param);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
...@@ -2384,6 +2388,7 @@ void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) ...@@ -2384,6 +2388,7 @@ void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
const Sampler *samplerObject = const Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
QuerySamplerParameteriv(samplerObject, pname, params); QuerySamplerParameteriv(samplerObject, pname, params);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params) void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
...@@ -2391,6 +2396,7 @@ void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *param ...@@ -2391,6 +2396,7 @@ void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *param
const Sampler *samplerObject = const Sampler *samplerObject =
mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler); mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
QuerySamplerParameterfv(samplerObject, pname, params); QuerySamplerParameterfv(samplerObject, pname, params);
mGLState.setObjectDirty(GL_SAMPLER);
} }
void Context::programParameteri(GLuint program, GLenum pname, GLint value) void Context::programParameteri(GLuint program, GLenum pname, GLint value)
......
...@@ -16,7 +16,7 @@ namespace gl ...@@ -16,7 +16,7 @@ namespace gl
{ {
Sampler::Sampler(rx::GLImplFactory *factory, GLuint id) Sampler::Sampler(rx::GLImplFactory *factory, GLuint id)
: RefCountObject(id), mImpl(factory->createSampler()), mLabel(), mSamplerState() : RefCountObject(id), mState(), mImpl(factory->createSampler(mState)), mLabel()
{ {
} }
...@@ -37,117 +37,117 @@ const std::string &Sampler::getLabel() const ...@@ -37,117 +37,117 @@ const std::string &Sampler::getLabel() const
void Sampler::setMinFilter(GLenum minFilter) void Sampler::setMinFilter(GLenum minFilter)
{ {
mSamplerState.minFilter = minFilter; mState.minFilter = minFilter;
} }
GLenum Sampler::getMinFilter() const GLenum Sampler::getMinFilter() const
{ {
return mSamplerState.minFilter; return mState.minFilter;
} }
void Sampler::setMagFilter(GLenum magFilter) void Sampler::setMagFilter(GLenum magFilter)
{ {
mSamplerState.magFilter = magFilter; mState.magFilter = magFilter;
} }
GLenum Sampler::getMagFilter() const GLenum Sampler::getMagFilter() const
{ {
return mSamplerState.magFilter; return mState.magFilter;
} }
void Sampler::setWrapS(GLenum wrapS) void Sampler::setWrapS(GLenum wrapS)
{ {
mSamplerState.wrapS = wrapS; mState.wrapS = wrapS;
} }
GLenum Sampler::getWrapS() const GLenum Sampler::getWrapS() const
{ {
return mSamplerState.wrapS; return mState.wrapS;
} }
void Sampler::setWrapT(GLenum wrapT) void Sampler::setWrapT(GLenum wrapT)
{ {
mSamplerState.wrapT = wrapT; mState.wrapT = wrapT;
} }
GLenum Sampler::getWrapT() const GLenum Sampler::getWrapT() const
{ {
return mSamplerState.wrapT; return mState.wrapT;
} }
void Sampler::setWrapR(GLenum wrapR) void Sampler::setWrapR(GLenum wrapR)
{ {
mSamplerState.wrapR = wrapR; mState.wrapR = wrapR;
} }
GLenum Sampler::getWrapR() const GLenum Sampler::getWrapR() const
{ {
return mSamplerState.wrapR; return mState.wrapR;
} }
void Sampler::setMaxAnisotropy(float maxAnisotropy) void Sampler::setMaxAnisotropy(float maxAnisotropy)
{ {
mSamplerState.maxAnisotropy = maxAnisotropy; mState.maxAnisotropy = maxAnisotropy;
} }
float Sampler::getMaxAnisotropy() const float Sampler::getMaxAnisotropy() const
{ {
return mSamplerState.maxAnisotropy; return mState.maxAnisotropy;
} }
void Sampler::setMinLod(GLfloat minLod) void Sampler::setMinLod(GLfloat minLod)
{ {
mSamplerState.minLod = minLod; mState.minLod = minLod;
} }
GLfloat Sampler::getMinLod() const GLfloat Sampler::getMinLod() const
{ {
return mSamplerState.minLod; return mState.minLod;
} }
void Sampler::setMaxLod(GLfloat maxLod) void Sampler::setMaxLod(GLfloat maxLod)
{ {
mSamplerState.maxLod = maxLod; mState.maxLod = maxLod;
} }
GLfloat Sampler::getMaxLod() const GLfloat Sampler::getMaxLod() const
{ {
return mSamplerState.maxLod; return mState.maxLod;
} }
void Sampler::setCompareMode(GLenum compareMode) void Sampler::setCompareMode(GLenum compareMode)
{ {
mSamplerState.compareMode = compareMode; mState.compareMode = compareMode;
} }
GLenum Sampler::getCompareMode() const GLenum Sampler::getCompareMode() const
{ {
return mSamplerState.compareMode; return mState.compareMode;
} }
void Sampler::setCompareFunc(GLenum compareFunc) void Sampler::setCompareFunc(GLenum compareFunc)
{ {
mSamplerState.compareFunc = compareFunc; mState.compareFunc = compareFunc;
} }
GLenum Sampler::getCompareFunc() const GLenum Sampler::getCompareFunc() const
{ {
return mSamplerState.compareFunc; return mState.compareFunc;
} }
void Sampler::setSRGBDecode(GLenum sRGBDecode) void Sampler::setSRGBDecode(GLenum sRGBDecode)
{ {
mSamplerState.sRGBDecode = sRGBDecode; mState.sRGBDecode = sRGBDecode;
} }
GLenum Sampler::getSRGBDecode() const GLenum Sampler::getSRGBDecode() const
{ {
return mSamplerState.sRGBDecode; return mState.sRGBDecode;
} }
const SamplerState &Sampler::getSamplerState() const const SamplerState &Sampler::getSamplerState() const
{ {
return mSamplerState; return mState;
} }
rx::SamplerImpl *Sampler::getImplementation() const rx::SamplerImpl *Sampler::getImplementation() const
...@@ -155,4 +155,10 @@ rx::SamplerImpl *Sampler::getImplementation() const ...@@ -155,4 +155,10 @@ rx::SamplerImpl *Sampler::getImplementation() const
return mImpl; return mImpl;
} }
void Sampler::syncState(const Context *context)
{
// TODO(jmadill): Use actual dirty bits for sampler.
mImpl->syncState(context);
}
} // namespace gl } // namespace gl
...@@ -71,12 +71,13 @@ class Sampler final : public RefCountObject, public LabeledObject ...@@ -71,12 +71,13 @@ class Sampler final : public RefCountObject, public LabeledObject
rx::SamplerImpl *getImplementation() const; rx::SamplerImpl *getImplementation() const;
void syncState(const Context *context);
private: private:
SamplerState mState;
rx::SamplerImpl *mImpl; rx::SamplerImpl *mImpl;
std::string mLabel; std::string mLabel;
SamplerState mSamplerState;
}; };
} // namespace gl } // namespace gl
......
...@@ -2177,7 +2177,7 @@ void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset) ...@@ -2177,7 +2177,7 @@ void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset)
break; break;
case DIRTY_OBJECT_VERTEX_ARRAY: case DIRTY_OBJECT_VERTEX_ARRAY:
ASSERT(mVertexArray); ASSERT(mVertexArray);
mVertexArray->syncImplState(context); mVertexArray->syncState(context);
break; break;
case DIRTY_OBJECT_PROGRAM_TEXTURES: case DIRTY_OBJECT_PROGRAM_TEXTURES:
syncProgramTextures(context); syncProgramTextures(context);
...@@ -2218,16 +2218,15 @@ void State::syncProgramTextures(const Context *context) ...@@ -2218,16 +2218,15 @@ void State::syncProgramTextures(const Context *context)
for (GLuint textureUnitIndex : samplerBinding.boundTextureUnits) for (GLuint textureUnitIndex : samplerBinding.boundTextureUnits)
{ {
Texture *texture = getSamplerTexture(textureUnitIndex, textureType); Texture *texture = getSamplerTexture(textureUnitIndex, textureType);
Sampler *sampler = getSampler(textureUnitIndex);
if (texture != nullptr) if (texture != nullptr)
{ {
const Sampler *sampler = getSampler(textureUnitIndex);
// Mark the texture binding bit as dirty if the texture completeness changes. // Mark the texture binding bit as dirty if the texture completeness changes.
// TODO(jmadill): Use specific dirty bit for completeness change. // TODO(jmadill): Use specific dirty bit for completeness change.
if (texture->isSamplerComplete(context, sampler)) if (texture->isSamplerComplete(context, sampler))
{ {
texture->syncImplState(); texture->syncState();
ASSERT(static_cast<size_t>(textureUnitIndex) < mCompleteTextureCache.size()); ASSERT(static_cast<size_t>(textureUnitIndex) < mCompleteTextureCache.size());
ASSERT(mCompleteTextureCache[textureUnitIndex] == nullptr || ASSERT(mCompleteTextureCache[textureUnitIndex] == nullptr ||
mCompleteTextureCache[textureUnitIndex] == texture); mCompleteTextureCache[textureUnitIndex] == texture);
...@@ -2238,7 +2237,10 @@ void State::syncProgramTextures(const Context *context) ...@@ -2238,7 +2237,10 @@ void State::syncProgramTextures(const Context *context)
mCompleteTextureBindings[textureUnitIndex].bind(texture->getDirtyChannel()); mCompleteTextureBindings[textureUnitIndex].bind(texture->getDirtyChannel());
} }
// TODO(jmadill): Sync sampler state. if (sampler != nullptr)
{
sampler->syncState(context);
}
} }
} }
} }
......
...@@ -1109,7 +1109,7 @@ Error Texture::generateMipmap(const Context *context) ...@@ -1109,7 +1109,7 @@ Error Texture::generateMipmap(const Context *context)
if (maxLevel > baseLevel) if (maxLevel > baseLevel)
{ {
syncImplState(); syncState();
ANGLE_TRY(mTexture->generateMipmap(context)); ANGLE_TRY(mTexture->generateMipmap(context));
const ImageDesc &baseImageInfo = const ImageDesc &baseImageInfo =
...@@ -1264,7 +1264,7 @@ GLuint Texture::getId() const ...@@ -1264,7 +1264,7 @@ GLuint Texture::getId() const
return id(); return id();
} }
void Texture::syncImplState() void Texture::syncState()
{ {
mTexture->syncState(mDirtyBits); mTexture->syncState(mDirtyBits);
mDirtyBits.reset(); mDirtyBits.reset();
......
...@@ -387,7 +387,7 @@ class Texture final : public egl::ImageSibling, ...@@ -387,7 +387,7 @@ class Texture final : public egl::ImageSibling,
}; };
using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>; using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>;
void syncImplState(); void syncState();
bool hasAnyDirtyBit() const { return mDirtyBits.any(); } bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
private: private:
......
...@@ -255,7 +255,7 @@ void VertexArray::setElementArrayBuffer(const Context *context, Buffer *buffer) ...@@ -255,7 +255,7 @@ void VertexArray::setElementArrayBuffer(const Context *context, Buffer *buffer)
mDirtyBits.set(DIRTY_BIT_ELEMENT_ARRAY_BUFFER); mDirtyBits.set(DIRTY_BIT_ELEMENT_ARRAY_BUFFER);
} }
void VertexArray::syncImplState(const Context *context) void VertexArray::syncState(const Context *context)
{ {
if (mDirtyBits.any()) if (mDirtyBits.any())
{ {
......
...@@ -186,7 +186,7 @@ class VertexArray final : public LabeledObject ...@@ -186,7 +186,7 @@ class VertexArray final : public LabeledObject
static size_t GetVertexIndexFromDirtyBit(size_t dirtyBit); static size_t GetVertexIndexFromDirtyBit(size_t dirtyBit);
void syncImplState(const Context *context); void syncState(const Context *context);
bool hasAnyDirtyBit() const { return mDirtyBits.any(); } bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
private: private:
......
...@@ -78,7 +78,7 @@ class GLImplFactory : angle::NonCopyable ...@@ -78,7 +78,7 @@ class GLImplFactory : angle::NonCopyable
const gl::TransformFeedbackState &state) = 0; const gl::TransformFeedbackState &state) = 0;
// Sampler object creation // Sampler object creation
virtual SamplerImpl *createSampler() = 0; virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0;
virtual std::vector<PathImpl *> createPaths(GLsizei range) = 0; virtual std::vector<PathImpl *> createPaths(GLsizei range) = 0;
}; };
......
...@@ -11,15 +11,29 @@ ...@@ -11,15 +11,29 @@
#include "common/angleutils.h" #include "common/angleutils.h"
namespace gl
{
class Context;
struct SamplerState;
} // namespace gl
namespace rx namespace rx
{ {
class SamplerImpl : angle::NonCopyable class SamplerImpl : angle::NonCopyable
{ {
public: public:
SamplerImpl() {} SamplerImpl(const gl::SamplerState &state) : mState(state) {}
virtual ~SamplerImpl() {} virtual ~SamplerImpl() {}
virtual void syncState(const gl::Context *context)
{
// Default implementation: no-op.
}
protected:
const gl::SamplerState &mState;
}; };
} } // namespace rx
#endif // LIBANGLE_RENDERER_SAMPLERIMPL_H_ #endif // LIBANGLE_RENDERER_SAMPLERIMPL_H_
...@@ -17,7 +17,7 @@ namespace rx ...@@ -17,7 +17,7 @@ namespace rx
class SamplerD3D : public SamplerImpl class SamplerD3D : public SamplerImpl
{ {
public: public:
SamplerD3D() {} SamplerD3D(const gl::SamplerState &state) : SamplerImpl(state) {}
~SamplerD3D() override {} ~SamplerD3D() override {}
}; };
} }
......
...@@ -131,9 +131,9 @@ TransformFeedbackImpl *Context11::createTransformFeedback(const gl::TransformFee ...@@ -131,9 +131,9 @@ TransformFeedbackImpl *Context11::createTransformFeedback(const gl::TransformFee
return new TransformFeedback11(state, mRenderer); return new TransformFeedback11(state, mRenderer);
} }
SamplerImpl *Context11::createSampler() SamplerImpl *Context11::createSampler(const gl::SamplerState &state)
{ {
return new SamplerD3D(); return new SamplerD3D(state);
} }
std::vector<PathImpl *> Context11::createPaths(GLsizei) std::vector<PathImpl *> Context11::createPaths(GLsizei)
......
...@@ -54,7 +54,7 @@ class Context11 : public ContextImpl ...@@ -54,7 +54,7 @@ class Context11 : public ContextImpl
const gl::TransformFeedbackState &state) override; const gl::TransformFeedbackState &state) override;
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Path object creation. // Path object creation.
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
...@@ -115,9 +115,9 @@ TransformFeedbackImpl *Context9::createTransformFeedback(const gl::TransformFeed ...@@ -115,9 +115,9 @@ TransformFeedbackImpl *Context9::createTransformFeedback(const gl::TransformFeed
return nullptr; return nullptr;
} }
SamplerImpl *Context9::createSampler() SamplerImpl *Context9::createSampler(const gl::SamplerState &state)
{ {
return new SamplerD3D(); return new SamplerD3D(state);
} }
std::vector<PathImpl *> Context9::createPaths(GLsizei) std::vector<PathImpl *> Context9::createPaths(GLsizei)
......
...@@ -54,7 +54,7 @@ class Context9 : public ContextImpl ...@@ -54,7 +54,7 @@ class Context9 : public ContextImpl
const gl::TransformFeedbackState &state) override; const gl::TransformFeedbackState &state) override;
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
...@@ -117,9 +117,9 @@ TransformFeedbackImpl *ContextGL::createTransformFeedback(const gl::TransformFee ...@@ -117,9 +117,9 @@ TransformFeedbackImpl *ContextGL::createTransformFeedback(const gl::TransformFee
return new TransformFeedbackGL(state, getFunctions(), getStateManager()); return new TransformFeedbackGL(state, getFunctions(), getStateManager());
} }
SamplerImpl *ContextGL::createSampler() SamplerImpl *ContextGL::createSampler(const gl::SamplerState &state)
{ {
return new SamplerGL(getFunctions(), getStateManager()); return new SamplerGL(state, getFunctions(), getStateManager());
} }
std::vector<PathImpl *> ContextGL::createPaths(GLsizei range) std::vector<PathImpl *> ContextGL::createPaths(GLsizei range)
......
...@@ -62,7 +62,7 @@ class ContextGL : public ContextImpl ...@@ -62,7 +62,7 @@ class ContextGL : public ContextImpl
const gl::TransformFeedbackState &state) override; const gl::TransformFeedbackState &state) override;
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei range) override; std::vector<PathImpl *> createPaths(GLsizei range) override;
......
...@@ -33,8 +33,10 @@ static inline void SyncSamplerStateMember(const rx::FunctionsGL *functions, ...@@ -33,8 +33,10 @@ static inline void SyncSamplerStateMember(const rx::FunctionsGL *functions,
namespace rx namespace rx
{ {
SamplerGL::SamplerGL(const FunctionsGL *functions, StateManagerGL *stateManager) SamplerGL::SamplerGL(const gl::SamplerState &state,
: SamplerImpl(), const FunctionsGL *functions,
StateManagerGL *stateManager)
: SamplerImpl(state),
mFunctions(functions), mFunctions(functions),
mStateManager(stateManager), mStateManager(stateManager),
mAppliedSamplerState(), mAppliedSamplerState(),
...@@ -49,20 +51,20 @@ SamplerGL::~SamplerGL() ...@@ -49,20 +51,20 @@ SamplerGL::~SamplerGL()
mSamplerID = 0; mSamplerID = 0;
} }
void SamplerGL::syncState(const gl::SamplerState &samplerState) const void SamplerGL::syncState(const gl::Context *context)
{ {
// clang-format off // clang-format off
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::minFilter); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::minFilter);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MAG_FILTER, &gl::SamplerState::magFilter); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MAG_FILTER, &gl::SamplerState::magFilter);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_WRAP_S, &gl::SamplerState::wrapS); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_WRAP_S, &gl::SamplerState::wrapS);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_WRAP_T, &gl::SamplerState::wrapT); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_WRAP_T, &gl::SamplerState::wrapT);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_WRAP_R, &gl::SamplerState::wrapR); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_WRAP_R, &gl::SamplerState::wrapR);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MAX_ANISOTROPY_EXT, &gl::SamplerState::maxAnisotropy); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MAX_ANISOTROPY_EXT, &gl::SamplerState::maxAnisotropy);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MIN_LOD, &gl::SamplerState::minLod); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MIN_LOD, &gl::SamplerState::minLod);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc);
SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_SRGB_DECODE_EXT, &gl::SamplerState::sRGBDecode); SyncSamplerStateMember(mFunctions, mSamplerID, mState, mAppliedSamplerState, GL_TEXTURE_SRGB_DECODE_EXT, &gl::SamplerState::sRGBDecode);
// clang-format on // clang-format on
} }
......
...@@ -21,10 +21,12 @@ class StateManagerGL; ...@@ -21,10 +21,12 @@ class StateManagerGL;
class SamplerGL : public SamplerImpl class SamplerGL : public SamplerImpl
{ {
public: public:
SamplerGL(const FunctionsGL *functions, StateManagerGL *stateManager); SamplerGL(const gl::SamplerState &state,
const FunctionsGL *functions,
StateManagerGL *stateManager);
~SamplerGL() override; ~SamplerGL() override;
void syncState(const gl::SamplerState &samplerState) const; void syncState(const gl::Context *context) override;
GLuint getSamplerID() const; GLuint getSamplerID() const;
......
...@@ -907,8 +907,7 @@ void StateManagerGL::setGenericShaderState(const gl::Context *context) ...@@ -907,8 +907,7 @@ void StateManagerGL::setGenericShaderState(const gl::Context *context)
const gl::Sampler *sampler = glState.getSampler(textureUnitIndex); const gl::Sampler *sampler = glState.getSampler(textureUnitIndex);
if (sampler != nullptr) if (sampler != nullptr)
{ {
const SamplerGL *samplerGL = GetImplAs<SamplerGL>(sampler); SamplerGL *samplerGL = GetImplAs<SamplerGL>(sampler);
samplerGL->syncState(sampler->getSamplerState());
bindSampler(textureUnitIndex, samplerGL->getSamplerID()); bindSampler(textureUnitIndex, samplerGL->getSamplerID());
} }
else else
......
...@@ -357,9 +357,9 @@ TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformF ...@@ -357,9 +357,9 @@ TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformF
return new TransformFeedbackNULL(state); return new TransformFeedbackNULL(state);
} }
SamplerImpl *ContextNULL::createSampler() SamplerImpl *ContextNULL::createSampler(const gl::SamplerState &state)
{ {
return new SamplerNULL(); return new SamplerNULL(state);
} }
std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range) std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range)
......
...@@ -183,7 +183,7 @@ class ContextNULL : public ContextImpl ...@@ -183,7 +183,7 @@ class ContextNULL : public ContextImpl
const gl::TransformFeedbackState &state) override; const gl::TransformFeedbackState &state) override;
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
std::vector<PathImpl *> createPaths(GLsizei range) override; std::vector<PathImpl *> createPaths(GLsizei range) override;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace rx namespace rx
{ {
SamplerNULL::SamplerNULL() : SamplerImpl() SamplerNULL::SamplerNULL(const gl::SamplerState &state) : SamplerImpl(state)
{ {
} }
......
...@@ -18,7 +18,7 @@ namespace rx ...@@ -18,7 +18,7 @@ namespace rx
class SamplerNULL : public SamplerImpl class SamplerNULL : public SamplerImpl
{ {
public: public:
SamplerNULL(); SamplerNULL(const gl::SamplerState &state);
~SamplerNULL() override; ~SamplerNULL() override;
}; };
......
...@@ -540,9 +540,9 @@ TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFee ...@@ -540,9 +540,9 @@ TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFee
return new TransformFeedbackVk(state); return new TransformFeedbackVk(state);
} }
SamplerImpl *ContextVk::createSampler() SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state)
{ {
return new SamplerVk(); return new SamplerVk(state);
} }
std::vector<PathImpl *> ContextVk::createPaths(GLsizei) std::vector<PathImpl *> ContextVk::createPaths(GLsizei)
......
...@@ -126,7 +126,7 @@ class ContextVk : public ContextImpl, public ResourceVk ...@@ -126,7 +126,7 @@ class ContextVk : public ContextImpl, public ResourceVk
const gl::TransformFeedbackState &state) override; const gl::TransformFeedbackState &state) override;
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace rx namespace rx
{ {
SamplerVk::SamplerVk() : SamplerImpl() SamplerVk::SamplerVk(const gl::SamplerState &state) : SamplerImpl(state)
{ {
} }
......
...@@ -18,7 +18,7 @@ namespace rx ...@@ -18,7 +18,7 @@ namespace rx
class SamplerVk : public SamplerImpl class SamplerVk : public SamplerImpl
{ {
public: public:
SamplerVk(); SamplerVk(const gl::SamplerState &state);
~SamplerVk() override; ~SamplerVk() override;
}; };
......
...@@ -61,7 +61,7 @@ class NullFactory : public GLImplFactory ...@@ -61,7 +61,7 @@ class NullFactory : public GLImplFactory
} }
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler() override { return nullptr; } SamplerImpl *createSampler(const gl::SamplerState &state) override { return nullptr; }
std::vector<PathImpl *> createPaths(GLsizei range) override std::vector<PathImpl *> createPaths(GLsizei range) override
{ {
...@@ -87,7 +87,7 @@ class MockGLFactory : public GLImplFactory ...@@ -87,7 +87,7 @@ class MockGLFactory : public GLImplFactory
MOCK_METHOD0(createSync, SyncImpl *()); MOCK_METHOD0(createSync, SyncImpl *());
MOCK_METHOD1(createTransformFeedback, MOCK_METHOD1(createTransformFeedback,
TransformFeedbackImpl *(const gl::TransformFeedbackState &)); TransformFeedbackImpl *(const gl::TransformFeedbackState &));
MOCK_METHOD0(createSampler, SamplerImpl *()); MOCK_METHOD1(createSampler, SamplerImpl *(const gl::SamplerState &));
MOCK_METHOD1(createPaths, std::vector<PathImpl *>(GLsizei)); MOCK_METHOD1(createPaths, std::vector<PathImpl *>(GLsizei));
}; };
......
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