Commit 2d1406a8 by Tim Van Patten Committed by Commit Bot

Capture/Replay: Capture glBindBufferBase during MEC setup

"World War Doh" binds uniform buffers via glBindBufferBase() calls before any frames have rendered and then uses those bound buffers for all subsequent frames. ANGLE's frame capture was failing to perform these calls during the mid-execution capture setup phase, leading to the replay generating VVL errors: VUID-vkCmdDispatch-None-02699 Descriptor in binding #0 index 0 is being used in draw but has never been updated via vkUpdateDescriptorSets() or a similar call. This CL adds those calls to the MEC setup phase, allowing the replay to execute without any errors. Bug: angleproject:5495 Test: angle_perftests --gtest_filter="*world_war_doh*" Change-Id: I751c9c6f60bf78c13428a9d1d6a06dbfe600c24b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2606806Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
parent a7158eb5
...@@ -2228,6 +2228,33 @@ void CaptureBufferBindingResetCalls(const gl::State &replayState, ...@@ -2228,6 +2228,33 @@ void CaptureBufferBindingResetCalls(const gl::State &replayState,
Capture(&bufferBindingCalls, CaptureBindBuffer(replayState, true, binding, id)); Capture(&bufferBindingCalls, CaptureBindBuffer(replayState, true, binding, id));
} }
void CaptureBindIndexedBuffer(const gl::State &glState,
gl::BufferBinding binding,
const gl::BufferVector &indexedBuffers,
const gl::BufferID bufferID,
std::vector<CallCapture> *setupCalls)
{
for (unsigned int index = 0; index < indexedBuffers.size(); ++index)
{
if (bufferID.value == indexedBuffers[index].id().value)
{
GLintptr offset = indexedBuffers[index].getOffset();
GLsizeiptr size = indexedBuffers[index].getSize();
// Context::bindBufferBase() calls Context::bindBufferRange() with size and offset = 0.
if ((offset == 0) && (size == 0))
{
Capture(setupCalls, CaptureBindBufferBase(glState, true, binding, index, bufferID));
}
else
{
Capture(setupCalls, CaptureBindBufferRange(glState, true, binding, index, bufferID,
offset, size));
}
}
}
}
void CaptureMidExecutionSetup(const gl::Context *context, void CaptureMidExecutionSetup(const gl::Context *context,
std::vector<CallCapture> *setupCalls, std::vector<CallCapture> *setupCalls,
ResourceTracker *resourceTracker, ResourceTracker *resourceTracker,
...@@ -2245,9 +2272,7 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2245,9 +2272,7 @@ void CaptureMidExecutionSetup(const gl::Context *context,
// TODO(jmadill): Use handle mapping for captured objects. http://anglebug.com/3662 // TODO(jmadill): Use handle mapping for captured objects. http://anglebug.com/3662
// Capture Buffer data. // Capture Buffer data.
const gl::BufferManager &buffers = apiState.getBufferManagerForCapture(); const gl::BufferManager &buffers = apiState.getBufferManagerForCapture();
const gl::BoundBufferMap &boundBuffers = apiState.getBoundBuffersForCapture();
for (const auto &bufferIter : buffers) for (const auto &bufferIter : buffers)
{ {
gl::BufferID id = {bufferIter.first}; gl::BufferID id = {bufferIter.first};
...@@ -2374,6 +2399,13 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2374,6 +2399,13 @@ void CaptureMidExecutionSetup(const gl::Context *context,
} }
// Capture Buffer bindings. // Capture Buffer bindings.
const gl::BufferVector &uniformIndexedBuffers =
apiState.getOffsetBindingPointerUniformBuffers();
const gl::BufferVector &atomicCounterIndexedBuffers =
apiState.getOffsetBindingPointerAtomicCounterBuffers();
const gl::BufferVector &shaderStorageIndexedBuffers =
apiState.getOffsetBindingPointerShaderStorageBuffers();
const gl::BoundBufferMap &boundBuffers = apiState.getBoundBuffersForCapture();
for (gl::BufferBinding binding : angle::AllEnums<gl::BufferBinding>()) for (gl::BufferBinding binding : angle::AllEnums<gl::BufferBinding>())
{ {
gl::BufferID bufferID = boundBuffers[binding].id(); gl::BufferID bufferID = boundBuffers[binding].id();
...@@ -2387,6 +2419,32 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2387,6 +2419,32 @@ void CaptureMidExecutionSetup(const gl::Context *context,
(!isArray && bufferID.value != 0)) (!isArray && bufferID.value != 0))
{ {
cap(CaptureBindBuffer(replayState, true, binding, bufferID)); cap(CaptureBindBuffer(replayState, true, binding, bufferID));
// Only the following buffer targets can be indexed:
// - GL_TRANSFORM_FEEDBACK_BUFFER
// - Transform feedback is handled separately, since transform feedback buffers are
// owned by the transform feedback object.
// - GL_UNIFORM_BUFFER
// - GL_ATOMIC_COUNTER_BUFFER
// - GL_SHADER_STORAGE_BUFFER
// Ignore all other binding types.
switch (binding)
{
case gl::BufferBinding::Uniform:
CaptureBindIndexedBuffer(replayState, binding, uniformIndexedBuffers, bufferID,
setupCalls);
break;
case gl::BufferBinding::AtomicCounter:
CaptureBindIndexedBuffer(replayState, binding, atomicCounterIndexedBuffers,
bufferID, setupCalls);
break;
case gl::BufferBinding::ShaderStorage:
CaptureBindIndexedBuffer(replayState, binding, shaderStorageIndexedBuffers,
bufferID, setupCalls);
break;
default:
break;
}
} }
// Restore all buffer bindings for Reset // Restore all buffer bindings for Reset
......
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