mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 16:36:31 +00:00
Apple implementation of DisplayRendererPreview
This commit is contained in:
committed by
Baldur Karlsson
parent
cd5d0ede44
commit
f3b6e38db4
@@ -28,6 +28,13 @@
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
|
||||
// helpers defined in cocoa_window.mm
|
||||
extern void *cocoa_windowCreate(int width, int height, const char *title);
|
||||
extern void *cocoa_windowGetView(void *cocoaWindow);
|
||||
extern void *cocoa_windowGetLayer(void *cocoaWindow);
|
||||
extern bool cocoa_windowShouldClose(void *cocoaWindow);
|
||||
extern bool cocoa_windowPoll(unsigned short &appleKeyCode);
|
||||
|
||||
void Daemonise()
|
||||
{
|
||||
}
|
||||
@@ -41,6 +48,44 @@ WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSy
|
||||
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
|
||||
uint32_t height, uint32_t numLoops)
|
||||
{
|
||||
void *cocoaWindow = cocoa_windowCreate(width, height, "renderdoccmd");
|
||||
void *view = cocoa_windowGetView(cocoaWindow);
|
||||
void *layer = cocoa_windowGetLayer(cocoaWindow);
|
||||
IReplayOutput *out =
|
||||
renderer->CreateOutput(CreateMacOSWindowingData(view, layer), ReplayOutputType::Texture);
|
||||
|
||||
out->SetTextureDisplay(displayCfg);
|
||||
|
||||
uint32_t loopCount = 0;
|
||||
|
||||
bool done = false;
|
||||
while(!done)
|
||||
{
|
||||
if(cocoa_windowShouldClose(cocoaWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned short appleKeyCode;
|
||||
if(cocoa_windowPoll(appleKeyCode))
|
||||
{
|
||||
// kVK_Escape
|
||||
if(appleKeyCode == 0x35)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
renderer->SetFrameEvent(10000000, true);
|
||||
out->Display();
|
||||
|
||||
usleep(100000);
|
||||
|
||||
loopCount++;
|
||||
|
||||
if(numLoops > 0 && loopCount == numLoops)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -53,5 +98,35 @@ int main(int argc, char *argv[])
|
||||
|
||||
GlobalEnvironment env;
|
||||
|
||||
// add compiled-in support to version line
|
||||
{
|
||||
std::string support = "APIs supported at compile-time: ";
|
||||
int count = 0;
|
||||
|
||||
#if defined(RENDERDOC_SUPPORT_VULKAN)
|
||||
support += "Vulkan, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
#if defined(RENDERDOC_SUPPORT_GL)
|
||||
support += "GL, ";
|
||||
count++;
|
||||
#endif
|
||||
|
||||
if(count == 0)
|
||||
{
|
||||
support += "None.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove trailing ', '
|
||||
support.pop_back();
|
||||
support.pop_back();
|
||||
support += ".";
|
||||
}
|
||||
|
||||
add_version_line(support);
|
||||
}
|
||||
|
||||
return renderdoccmd(env, argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user