Capture/Replay: Add Sampler Object support to mid-execution capture

Test: Manhattan mid-execution capture working
Bug: angleproject:3662
Bug: angleproject:4091
Change-Id: Iafa528e2a25efe1c49eb49ecc429eac8f25c162c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2080591
Reviewed-by: Courtney Goeltzenleuchter <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Cody Northrop <[email protected]>
This commit is contained in:
Cody Northrop authored and Commit Bot committed 2020-03-04 23:24:59 +00:00
1 parent 6125419cdc
commit e682bc57e1
3 files changed
+78 -2

No files matched your search

+74
View File
@@ -1946,6 +1946,80 @@ void CaptureMidExecutionSetup(const gl::Context *context,
gl::TransformFeedback *currentXFB = apiState.getCurrentTransformFeedback();
cap(CaptureBindTransformFeedback(replayState, true, GL_TRANSFORM_FEEDBACK, currentXFB->id()));
// Capture Sampler Objects
const gl::SamplerManager &samplers = apiState.getSamplerManagerForCapture();
for (const auto &samplerIter : samplers)
{
gl::SamplerID samplerID = {samplerIter.first};
cap(CaptureGenSamplers(replayState, true, 1, &samplerID));
MaybeCaptureUpdateResourceIDs(setupCalls);
gl::Sampler *sampler = samplerIter.second;
if (!sampler)
{
continue;
}
gl::SamplerState defaultSamplerState;
if (sampler->getMinFilter() != defaultSamplerState.getMinFilter())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_MIN_FILTER,
sampler->getMinFilter()));
}
if (sampler->getMagFilter() != defaultSamplerState.getMagFilter())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_MAG_FILTER,
sampler->getMagFilter()));
}
if (sampler->getWrapS() != defaultSamplerState.getWrapS())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_WRAP_S,
sampler->getWrapS()));
}
if (sampler->getWrapR() != defaultSamplerState.getWrapR())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_WRAP_R,
sampler->getWrapR()));
}
if (sampler->getWrapT() != defaultSamplerState.getWrapT())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_WRAP_T,
sampler->getWrapT()));
}
if (sampler->getMinLod() != defaultSamplerState.getMinLod())
{
cap(CaptureSamplerParameterf(replayState, true, samplerID, GL_TEXTURE_MIN_LOD,
sampler->getMinLod()));
}
if (sampler->getMaxLod() != defaultSamplerState.getMaxLod())
{
cap(CaptureSamplerParameterf(replayState, true, samplerID, GL_TEXTURE_MAX_LOD,
sampler->getMaxLod()));
}
if (sampler->getCompareMode() != defaultSamplerState.getCompareMode())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_COMPARE_MODE,
sampler->getCompareMode()));
}
if (sampler->getCompareFunc() != defaultSamplerState.getCompareFunc())
{
cap(CaptureSamplerParameteri(replayState, true, samplerID, GL_TEXTURE_COMPARE_FUNC,
sampler->getCompareFunc()));
}
}
// Bind samplers
gl::SamplerBindingVector samplerBindings = apiState.getSamplers();
for (GLuint bindingIndex = 0; bindingIndex < static_cast<GLuint>(samplerBindings.size());
++bindingIndex)
{
gl::SamplerID samplerID = samplerBindings[bindingIndex].id();
if (samplerID.value != 0)
{
cap(CaptureBindSampler(replayState, true, bindingIndex, samplerID));
}
}
// Capture GL Context states.
// TODO(http://anglebug.com/3662): Complete state capture.
auto capCap = [cap, &replayState](GLenum capEnum, bool capValue) {
+3 -1
View File
@@ -59,6 +59,7 @@ using ContextID = uintptr_t;
template <typename T>
using BufferBindingMap = angle::PackedEnumMap<BufferBinding, T>;
using BoundBufferMap = BufferBindingMap<BindingPointer<Buffer>>;
using SamplerBindingVector = std::vector<BindingPointer<Sampler>>;
using TextureBindingVector = std::vector<BindingPointer<Texture>>;
using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVector>;
using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>;
@@ -281,7 +282,6 @@ class State : angle::NonCopyable
Sampler *getSampler(GLuint textureUnit) const { return mSamplers[textureUnit].get(); }
using SamplerBindingVector = std::vector<BindingPointer<Sampler>>;
const SamplerBindingVector &getSamplers() const { return mSamplers; }
void detachSampler(const Context *context, SamplerID sampler);
@@ -734,6 +734,8 @@ class State : angle::NonCopyable
{
return *mShaderProgramManager;
}
const SamplerManager &getSamplerManagerForCapture() const { return *mSamplerManager; }
const SamplerBindingVector &getSamplerBindingsForCapture() const { return mSamplers; }
const ActiveQueryMap &getActiveQueriesForCapture() const { return mActiveQueries; }
+1 -1
View File
@@ -2123,7 +2123,7 @@ void StateManagerGL::updateMultiviewBaseViewLayerIndexUniformImpl(
void StateManagerGL::syncSamplersState(const gl::Context *context)
{
const gl::State::SamplerBindingVector &samplers = context->getState().getSamplers();
const gl::SamplerBindingVector &samplers = context->getState().getSamplers();
// This could be optimized by using a separate binding dirty bit per sampler.
for (size_t samplerIndex = 0; samplerIndex < samplers.size(); ++samplerIndex)