mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
Capture/Replay: Reset buffers on replay loop
This CL adds infrastructure for tracking whether resources need to be reset when looping back to the beginning of the frame sequence. A new function is generated on the last frame: ResetContext*Replay(). It will contain calls to gen, delete, and restore contents of resources. This CL only supports Buffer resets. Bug: b/152512564 Bug: angleproject:3662 Bug: angleproject:4599 Change-Id: I46672dd70dcb997967e3cc0897308144f2582e21 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2168121 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
c02cdff744
commit
06ce17e039
@@ -27,6 +27,9 @@ std::function<void()> SetupContextReplay = reinterpret_cast<void (*)()>(
|
||||
std::function<void(int)> ReplayContextFrame = reinterpret_cast<void (*)(int)>(
|
||||
ANGLE_MACRO_CONCAT(ReplayContext,
|
||||
ANGLE_MACRO_CONCAT(ANGLE_CAPTURE_REPLAY_SAMPLE_CONTEXT_ID, Frame)));
|
||||
std::function<void()> ResetContextReplay = reinterpret_cast<void (*)()>(
|
||||
ANGLE_MACRO_CONCAT(ResetContext,
|
||||
ANGLE_MACRO_CONCAT(ANGLE_CAPTURE_REPLAY_SAMPLE_CONTEXT_ID, Replay)));
|
||||
|
||||
class CaptureReplaySample : public SampleApplication
|
||||
{
|
||||
@@ -59,12 +62,19 @@ class CaptureReplaySample : public SampleApplication
|
||||
// Compute the current frame, looping from kReplayFrameStart to kReplayFrameEnd.
|
||||
uint32_t frame =
|
||||
kReplayFrameStart + (mCurrentFrame % (kReplayFrameEnd - kReplayFrameStart));
|
||||
|
||||
if (mPreviousFrame > frame)
|
||||
{
|
||||
ResetContextReplay();
|
||||
}
|
||||
ReplayContextFrame(frame);
|
||||
mPreviousFrame = frame;
|
||||
mCurrentFrame++;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t mCurrentFrame = 0;
|
||||
uint32_t mCurrentFrame = 0;
|
||||
uint32_t mPreviousFrame = 0;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
||||
Reference in New Issue
Block a user