Commit fc1e8503 by Cody Northrop Committed by Commit Bot

Capture/Replay: Initial support for framebuffer textures

Bug: angleproject:3662 Test: Working through Manhattan frames 5-10, TRex still works Change-Id: I3d9b4dced4c1667382154fb68839d01ba2db9b98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2039531 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 00b96fe7
...@@ -1067,6 +1067,35 @@ bool IsDefaultCurrentValue(const gl::VertexAttribCurrentValueData &currentValue) ...@@ -1067,6 +1067,35 @@ bool IsDefaultCurrentValue(const gl::VertexAttribCurrentValueData &currentValue)
currentValue.Values.FloatValues[2] == 0.0f && currentValue.Values.FloatValues[3] == 1.0f; currentValue.Values.FloatValues[2] == 0.0f && currentValue.Values.FloatValues[3] == 1.0f;
} }
void Capture(std::vector<CallCapture> *setupCalls, CallCapture &&call)
{
setupCalls->emplace_back(std::move(call));
}
void CaptureFramebufferAttachment(std::vector<CallCapture> *setupCalls,
const gl::State &replayState,
const gl::FramebufferAttachment &attachment)
{
GLuint resourceID = attachment.getResource()->getId();
// TODO(jmadill): Layer attachments. http://anglebug.com/3662
if (attachment.type() == GL_TEXTURE)
{
gl::ImageIndex index = attachment.getTextureImageIndex();
Capture(setupCalls, CaptureFramebufferTexture2D(replayState, true, GL_FRAMEBUFFER,
attachment.getBinding(), index.getTarget(),
{resourceID}, index.getLevelIndex()));
}
else
{
ASSERT(attachment.type() == GL_RENDERBUFFER);
Capture(setupCalls, CaptureFramebufferRenderbuffer(replayState, true, GL_FRAMEBUFFER,
attachment.getBinding(), GL_RENDERBUFFER,
{resourceID}));
}
}
void CaptureMidExecutionSetup(const gl::Context *context, void CaptureMidExecutionSetup(const gl::Context *context,
std::vector<CallCapture> *setupCalls, std::vector<CallCapture> *setupCalls,
const ShaderSourceMap &cachedShaderSources, const ShaderSourceMap &cachedShaderSources,
...@@ -1488,43 +1517,21 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -1488,43 +1517,21 @@ void CaptureMidExecutionSetup(const gl::Context *context,
continue; continue;
} }
GLuint resourceID = colorAttachment.getResource()->getId(); CaptureFramebufferAttachment(setupCalls, replayState, colorAttachment);
// TODO(jmadill): Layer attachments. http://anglebug.com/3662
if (colorAttachment.type() == GL_TEXTURE)
{
gl::ImageIndex index = colorAttachment.getTextureImageIndex();
cap(CaptureFramebufferTexture2D(replayState, true, GL_FRAMEBUFFER,
colorAttachment.getBinding(), index.getTarget(),
{resourceID}, index.getLevelIndex()));
}
else
{
ASSERT(colorAttachment.type() == GL_RENDERBUFFER);
cap(CaptureFramebufferRenderbuffer(replayState, true, GL_FRAMEBUFFER,
colorAttachment.getBinding(), GL_RENDERBUFFER,
{resourceID}));
}
} }
const gl::FramebufferAttachment *depthAttachment = framebuffer->getDepthAttachment(); const gl::FramebufferAttachment *depthAttachment = framebuffer->getDepthAttachment();
if (depthAttachment) if (depthAttachment)
{ {
ASSERT(depthAttachment->type() == GL_RENDERBUFFER); ASSERT(depthAttachment->getBinding() == GL_DEPTH_ATTACHMENT);
GLuint resourceID = depthAttachment->getResource()->getId(); CaptureFramebufferAttachment(setupCalls, replayState, *depthAttachment);
cap(CaptureFramebufferRenderbuffer(replayState, true, GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, {resourceID}));
} }
const gl::FramebufferAttachment *stencilAttachment = framebuffer->getStencilAttachment(); const gl::FramebufferAttachment *stencilAttachment = framebuffer->getStencilAttachment();
if (stencilAttachment) if (stencilAttachment)
{ {
ASSERT(stencilAttachment->type() == GL_RENDERBUFFER); ASSERT(stencilAttachment->getBinding() == GL_STENCIL_ATTACHMENT);
GLuint resourceID = stencilAttachment->getResource()->getId(); CaptureFramebufferAttachment(setupCalls, replayState, *stencilAttachment);
cap(CaptureFramebufferRenderbuffer(replayState, true, GL_FRAMEBUFFER,
GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
{resourceID}));
} }
// TODO(jmadill): Draw buffer states. http://anglebug.com/3662 // TODO(jmadill): Draw buffer states. http://anglebug.com/3662
......
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