mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Add option to renderdoccmd replay to specify a loop count
This commit is contained in:
@@ -56,7 +56,8 @@ rdcarray<rdcstr> convertArgs(const std::vector<std::string> &args)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DisplayRendererPreview(IReplayController *renderer, uint32_t width, uint32_t height)
|
||||
void DisplayRendererPreview(IReplayController *renderer, uint32_t width, uint32_t height,
|
||||
uint32_t numLoops)
|
||||
{
|
||||
if(renderer == NULL)
|
||||
return;
|
||||
@@ -100,7 +101,7 @@ void DisplayRendererPreview(IReplayController *renderer, uint32_t width, uint32_
|
||||
d.resourceId = id;
|
||||
}
|
||||
|
||||
DisplayRendererPreview(renderer, d, width, height);
|
||||
DisplayRendererPreview(renderer, d, width, height, numLoops);
|
||||
}
|
||||
|
||||
std::map<std::string, Command *> commands;
|
||||
@@ -517,6 +518,8 @@ struct ReplayCommand : public Command
|
||||
parser.set_footer("<capture.rdc>");
|
||||
parser.add<uint32_t>("width", 'w', "The preview window width.", false, 1280);
|
||||
parser.add<uint32_t>("height", 'h', "The preview window height.", false, 720);
|
||||
parser.add<uint32_t>("loops", 'l', "How many times to loop the replay, or 0 for indefinite.",
|
||||
false, 0);
|
||||
parser.add<string>("remote-host", 0,
|
||||
"Instead of replaying locally, replay on this host over the network.", false);
|
||||
parser.add<uint32_t>("remote-port", 0, "If --remote-host is set, use this port.", false,
|
||||
@@ -574,7 +577,7 @@ struct ReplayCommand : public Command
|
||||
if(status == ReplayStatus::Succeeded)
|
||||
{
|
||||
DisplayRendererPreview(renderer, parser.get<uint32_t>("width"),
|
||||
parser.get<uint32_t>("height"));
|
||||
parser.get<uint32_t>("height"), parser.get<uint32_t>("loops"));
|
||||
|
||||
remote->CloseCapture(renderer);
|
||||
}
|
||||
@@ -606,7 +609,7 @@ struct ReplayCommand : public Command
|
||||
if(status == ReplayStatus::Succeeded)
|
||||
{
|
||||
DisplayRendererPreview(renderer, parser.get<uint32_t>("width"),
|
||||
parser.get<uint32_t>("height"));
|
||||
parser.get<uint32_t>("height"), parser.get<uint32_t>("loops"));
|
||||
|
||||
renderer->Shutdown();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ void readCapOpts(const std::string &str, CaptureOptions *opts);
|
||||
|
||||
// these must be defined in platform .cpps
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height);
|
||||
uint32_t height, uint32_t numLoops);
|
||||
WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSystem> &systems);
|
||||
void Daemonise();
|
||||
|
||||
@@ -343,7 +343,7 @@ WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSy
|
||||
}
|
||||
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height)
|
||||
uint32_t height, uint32_t numLoops)
|
||||
{
|
||||
ANativeWindow *connectionScreenWindow = android_state->window;
|
||||
|
||||
@@ -354,11 +354,14 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
|
||||
out->SetTextureDisplay(displayCfg);
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
if(numLoops == 0)
|
||||
numLoops = 100;
|
||||
|
||||
for(uint32_t i = 0; i < numLoops; i++)
|
||||
{
|
||||
renderer->SetFrameEvent(10000000, true);
|
||||
|
||||
ANDROID_LOG("Frame %i", i);
|
||||
ANDROID_LOG("Frame %u", i);
|
||||
out->Display();
|
||||
|
||||
usleep(100000);
|
||||
|
||||
@@ -41,7 +41,7 @@ WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSy
|
||||
}
|
||||
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height)
|
||||
uint32_t height, uint32_t numLoops)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSy
|
||||
}
|
||||
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height)
|
||||
uint32_t height, uint32_t numLoops)
|
||||
{
|
||||
// we only have the preview implemented for platforms that have xlib & xcb. It's unlikely
|
||||
// a meaningful platform exists with only one, and at the time of writing no other windowing
|
||||
@@ -418,6 +418,8 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
|
||||
xcb_flush(connection);
|
||||
|
||||
uint32_t loopCount = 0;
|
||||
|
||||
bool done = false;
|
||||
while(!done)
|
||||
{
|
||||
@@ -428,10 +430,7 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
{
|
||||
switch(event->response_type & 0x7f)
|
||||
{
|
||||
case XCB_EXPOSE:
|
||||
renderer->SetFrameEvent(10000000, true);
|
||||
out->Display();
|
||||
break;
|
||||
case XCB_EXPOSE: break;
|
||||
case XCB_CLIENT_MESSAGE:
|
||||
if((*(xcb_client_message_event_t *)event).data.data32[0] == (*atom_wm_delete_window).atom)
|
||||
{
|
||||
@@ -456,6 +455,11 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
out->Display();
|
||||
|
||||
usleep(100000);
|
||||
|
||||
loopCount++;
|
||||
|
||||
if(numLoops > 0 && loopCount == numLoops)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
std::cerr << "No supporting windowing systems defined at build time (xlib and xcb)" << std::endl;
|
||||
|
||||
@@ -184,7 +184,7 @@ WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSy
|
||||
}
|
||||
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height)
|
||||
uint32_t height, uint32_t numLoops)
|
||||
{
|
||||
RECT wr = {0, 0, (LONG)width, (LONG)height};
|
||||
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
@@ -204,6 +204,8 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
|
||||
out->SetTextureDisplay(displayCfg);
|
||||
|
||||
uint32_t loopCount = 0;
|
||||
|
||||
MSG msg;
|
||||
ZeroMemory(&msg, sizeof(msg));
|
||||
while(true)
|
||||
@@ -225,6 +227,11 @@ void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &display
|
||||
out->Display();
|
||||
|
||||
Sleep(40);
|
||||
|
||||
loopCount++;
|
||||
|
||||
if(numLoops > 0 && loopCount == numLoops)
|
||||
break;
|
||||
}
|
||||
|
||||
DestroyWindow(wnd);
|
||||
|
||||
Reference in New Issue
Block a user