Commit b983a4b2 by Jamie Madill Committed by Commit Bot

Pass Context to Framebuffer::invalidateCompletenessCache.

This will be useful for validation state caching. Bug: angleproject:2747 Change-Id: I0737adca7406f79b9e15429f30ae22e1299cd7e4 Reviewed-on: https://chromium-review.googlesource.com/1158611 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 43da7c4a
...@@ -3071,7 +3071,7 @@ void Context::requestExtension(const char *name) ...@@ -3071,7 +3071,7 @@ void Context::requestExtension(const char *name)
} }
} }
mState.mFramebuffers->invalidateFramebufferComplenessCache(); mState.mFramebuffers->invalidateFramebufferComplenessCache(this);
} }
size_t Context::getRequestableExtensionStringCount() const size_t Context::getRequestableExtensionStringCount() const
...@@ -5038,7 +5038,7 @@ void Context::getFramebufferParameterivRobust(GLenum target, ...@@ -5038,7 +5038,7 @@ void Context::getFramebufferParameterivRobust(GLenum target,
void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param) void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
{ {
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
SetFramebufferParameteri(framebuffer, pname, param); SetFramebufferParameteri(this, framebuffer, pname, param);
} }
bool Context::getScratchBuffer(size_t requstedSizeBytes, bool Context::getScratchBuffer(size_t requstedSizeBytes,
......
...@@ -994,7 +994,7 @@ bool Framebuffer::usingExtendedDrawBuffers() const ...@@ -994,7 +994,7 @@ bool Framebuffer::usingExtendedDrawBuffers() const
return false; return false;
} }
void Framebuffer::invalidateCompletenessCache() void Framebuffer::invalidateCompletenessCache(const Context *context)
{ {
if (mState.mId != 0) if (mState.mId != 0)
{ {
...@@ -1812,7 +1812,7 @@ void Framebuffer::updateAttachment(const Context *context, ...@@ -1812,7 +1812,7 @@ void Framebuffer::updateAttachment(const Context *context,
mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit); mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
onDirtyBinding->bind(resource ? resource->getSubject() : nullptr); onDirtyBinding->bind(resource ? resource->getSubject() : nullptr);
invalidateCompletenessCache(); invalidateCompletenessCache(context);
} }
void Framebuffer::resetAttachment(const Context *context, GLenum binding) void Framebuffer::resetAttachment(const Context *context, GLenum binding)
...@@ -1844,13 +1844,7 @@ void Framebuffer::onSubjectStateChange(const Context *context, ...@@ -1844,13 +1844,7 @@ void Framebuffer::onSubjectStateChange(const Context *context,
return; return;
} }
// Only reset the cached status if this is not the default framebuffer. The default framebuffer invalidateCompletenessCache(context);
// will still use this channel to mark itself dirty.
if (mState.mId != 0)
{
// TOOD(jmadill): Make this only update individual attachments to do less work.
mCachedStatus.reset();
}
FramebufferAttachment *attachment = getAttachmentFromSubjectIndex(index); FramebufferAttachment *attachment = getAttachmentFromSubjectIndex(index);
...@@ -1987,32 +1981,33 @@ GLint Framebuffer::getDefaultLayers() const ...@@ -1987,32 +1981,33 @@ GLint Framebuffer::getDefaultLayers() const
return mState.getDefaultLayers(); return mState.getDefaultLayers();
} }
void Framebuffer::setDefaultWidth(GLint defaultWidth) void Framebuffer::setDefaultWidth(const Context *context, GLint defaultWidth)
{ {
mState.mDefaultWidth = defaultWidth; mState.mDefaultWidth = defaultWidth;
mDirtyBits.set(DIRTY_BIT_DEFAULT_WIDTH); mDirtyBits.set(DIRTY_BIT_DEFAULT_WIDTH);
invalidateCompletenessCache(); invalidateCompletenessCache(context);
} }
void Framebuffer::setDefaultHeight(GLint defaultHeight) void Framebuffer::setDefaultHeight(const Context *context, GLint defaultHeight)
{ {
mState.mDefaultHeight = defaultHeight; mState.mDefaultHeight = defaultHeight;
mDirtyBits.set(DIRTY_BIT_DEFAULT_HEIGHT); mDirtyBits.set(DIRTY_BIT_DEFAULT_HEIGHT);
invalidateCompletenessCache(); invalidateCompletenessCache(context);
} }
void Framebuffer::setDefaultSamples(GLint defaultSamples) void Framebuffer::setDefaultSamples(const Context *context, GLint defaultSamples)
{ {
mState.mDefaultSamples = defaultSamples; mState.mDefaultSamples = defaultSamples;
mDirtyBits.set(DIRTY_BIT_DEFAULT_SAMPLES); mDirtyBits.set(DIRTY_BIT_DEFAULT_SAMPLES);
invalidateCompletenessCache(); invalidateCompletenessCache(context);
} }
void Framebuffer::setDefaultFixedSampleLocations(bool defaultFixedSampleLocations) void Framebuffer::setDefaultFixedSampleLocations(const Context *context,
bool defaultFixedSampleLocations)
{ {
mState.mDefaultFixedSampleLocations = defaultFixedSampleLocations; mState.mDefaultFixedSampleLocations = defaultFixedSampleLocations;
mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS); mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS);
invalidateCompletenessCache(); invalidateCompletenessCache(context);
} }
void Framebuffer::setDefaultLayers(GLint defaultLayers) void Framebuffer::setDefaultLayers(GLint defaultLayers)
......
...@@ -232,13 +232,13 @@ class Framebuffer final : public angle::ObserverInterface, ...@@ -232,13 +232,13 @@ class Framebuffer final : public angle::ObserverInterface,
GLint getDefaultSamples() const; GLint getDefaultSamples() const;
bool getDefaultFixedSampleLocations() const; bool getDefaultFixedSampleLocations() const;
GLint getDefaultLayers() const; GLint getDefaultLayers() const;
void setDefaultWidth(GLint defaultWidth); void setDefaultWidth(const Context *context, GLint defaultWidth);
void setDefaultHeight(GLint defaultHeight); void setDefaultHeight(const Context *context, GLint defaultHeight);
void setDefaultSamples(GLint defaultSamples); void setDefaultSamples(const Context *context, GLint defaultSamples);
void setDefaultFixedSampleLocations(bool defaultFixedSampleLocations); void setDefaultFixedSampleLocations(const Context *context, bool defaultFixedSampleLocations);
void setDefaultLayers(GLint defaultLayers); void setDefaultLayers(GLint defaultLayers);
void invalidateCompletenessCache(); void invalidateCompletenessCache(const Context *context);
GLenum checkStatus(const Context *context) GLenum checkStatus(const Context *context)
{ {
......
...@@ -444,13 +444,13 @@ void FramebufferManager::setDefaultFramebuffer(Framebuffer *framebuffer) ...@@ -444,13 +444,13 @@ void FramebufferManager::setDefaultFramebuffer(Framebuffer *framebuffer)
mObjectMap.assign(0, framebuffer); mObjectMap.assign(0, framebuffer);
} }
void FramebufferManager::invalidateFramebufferComplenessCache() const void FramebufferManager::invalidateFramebufferComplenessCache(const Context *context) const
{ {
for (const auto &framebuffer : mObjectMap) for (const auto &framebuffer : mObjectMap)
{ {
if (framebuffer.second) if (framebuffer.second)
{ {
framebuffer.second->invalidateCompletenessCache(); framebuffer.second->invalidateCompletenessCache(context);
} }
} }
} }
......
...@@ -249,7 +249,7 @@ class FramebufferManager ...@@ -249,7 +249,7 @@ class FramebufferManager
Framebuffer *getFramebuffer(GLuint handle) const; Framebuffer *getFramebuffer(GLuint handle) const;
void setDefaultFramebuffer(Framebuffer *framebuffer); void setDefaultFramebuffer(Framebuffer *framebuffer);
void invalidateFramebufferComplenessCache() const; void invalidateFramebufferComplenessCache(const Context *context) const;
Framebuffer *checkFramebufferAllocation(rx::GLImplFactory *factory, Framebuffer *checkFramebufferAllocation(rx::GLImplFactory *factory,
const Caps &caps, const Caps &caps,
......
...@@ -1417,23 +1417,26 @@ void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params) ...@@ -1417,23 +1417,26 @@ void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params)
SetSamplerParameterBase(sampler, pname, params); SetSamplerParameterBase(sampler, pname, params);
} }
void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param) void SetFramebufferParameteri(const Context *context,
Framebuffer *framebuffer,
GLenum pname,
GLint param)
{ {
ASSERT(framebuffer); ASSERT(framebuffer);
switch (pname) switch (pname)
{ {
case GL_FRAMEBUFFER_DEFAULT_WIDTH: case GL_FRAMEBUFFER_DEFAULT_WIDTH:
framebuffer->setDefaultWidth(param); framebuffer->setDefaultWidth(context, param);
break; break;
case GL_FRAMEBUFFER_DEFAULT_HEIGHT: case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
framebuffer->setDefaultHeight(param); framebuffer->setDefaultHeight(context, param);
break; break;
case GL_FRAMEBUFFER_DEFAULT_SAMPLES: case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
framebuffer->setDefaultSamples(param); framebuffer->setDefaultSamples(context, param);
break; break;
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
framebuffer->setDefaultFixedSampleLocations(ConvertToBool(param)); framebuffer->setDefaultFixedSampleLocations(context, ConvertToBool(param));
break; break;
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT: case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
framebuffer->setDefaultLayers(param); framebuffer->setDefaultLayers(param);
......
...@@ -117,7 +117,10 @@ void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params ...@@ -117,7 +117,10 @@ void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params
void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param); void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params); void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param); void SetFramebufferParameteri(const Context *context,
Framebuffer *framebuffer,
GLenum pname,
GLint param);
void SetProgramParameteri(Program *program, GLenum pname, GLint value); void SetProgramParameteri(Program *program, GLenum pname, GLint value);
......
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