diff --git a/renderdoc/api/app/renderdoc_app.h b/renderdoc/api/app/renderdoc_app.h index 6fa1ac039..c2c76f6d9 100644 --- a/renderdoc/api/app/renderdoc_app.h +++ b/renderdoc/api/app/renderdoc_app.h @@ -94,7 +94,7 @@ typedef enum { // Default - disabled // // 1 - Enable built-in API debugging features and records the results into - // the capture logfile, which is matched up with events on replay + // the capture, which is matched up with events on replay // 0 - no API debugging is forcibly enabled eRENDERDOC_Option_APIValidation = 2, eRENDERDOC_Option_DebugDeviceMode = 2, // deprecated name of this enum @@ -145,12 +145,12 @@ typedef enum { // 0 - Child processes are not hooked by RenderDoc eRENDERDOC_Option_HookIntoChildren = 7, - // By default RenderDoc only includes resources in the final logfile necessary + // By default RenderDoc only includes resources in the final capture necessary // for that frame, this allows you to override that behaviour. // // Default - disabled // - // 1 - all live resources at the time of capture are included in the log + // 1 - all live resources at the time of capture are included in the capture // and available for inspection // 0 - only the resources referenced by the captured frame are included eRENDERDOC_Option_RefAllResources = 8, @@ -342,9 +342,9 @@ typedef void(RENDERDOC_CC *pRENDERDOC_Shutdown)(); // exceptions will pass to the next handler. typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); -// Sets the logfile path template +// Sets the capture file path template // -// logfile is a UTF-8 string that gives a template for how captures will be named +// pathtemplate is a UTF-8 string that gives a template for how captures will be named // and where they will be saved. // // Any extension is stripped off the path, and captures are saved in the directory @@ -355,13 +355,17 @@ typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); // // Example: // -// SetLogFilePathTemplate("my_captures/example"); +// SetCaptureFilePathTemplate("my_captures/example"); // // Capture #1 -> my_captures/example_frame123.rdc // Capture #2 -> my_captures/example_frame456.rdc -typedef void(RENDERDOC_CC *pRENDERDOC_SetLogFilePathTemplate)(const char *pathtemplate); +typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(const char *pathtemplate); -// returns the current logfile template, see SetLogFileTemplate above, as a UTF-8 string +// returns the current capture path template, see SetCaptureFileTemplate above, as a UTF-8 string +typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)(); + +// DEPRECATED: compatibility for code compiled against pre-1.1.2 headers. +typedef void(RENDERDOC_CC *pRENDERDOC_SetLogFilePathTemplate)(const char *pathtemplate); typedef const char *(RENDERDOC_CC *pRENDERDOC_GetLogFilePathTemplate)(); // returns the number of captures that have been made @@ -370,8 +374,8 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); // This function returns the details of a capture, by index. New captures are added // to the end of the list. // -// logfile will be filled with the absolute path to the capture file, as a UTF-8 string -// pathlength will be written with the length in bytes of the logfile string +// filename will be filled with the absolute path to the capture file, as a UTF-8 string +// pathlength will be written with the length in bytes of the filename string // timestamp will be written with the time of the capture, in seconds since the Unix epoch // // Any of the parameters can be NULL and they'll be skipped. @@ -380,16 +384,18 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); // If the index is invalid, the values will be unchanged // // Note: when captures are deleted in the UI they will remain in this list, so the -// logfile path may not exist anymore. -typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfile, +// capture path may not exist anymore. +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *filename, uint32_t *pathlength, uint64_t *timestamp); // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); + +// DEPRECATED: compatibility for code compiled against pre-1.1.1 headers. // This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept here for // backwards compatibility with old code, it is castable either way since it's ABI compatible // as the same function pointer type. typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsRemoteAccessConnected)(); -typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); // This function will launch the Replay UI associated with the RenderDoc library injected // into the running application. @@ -493,6 +499,7 @@ typedef enum { eRENDERDOC_API_Version_1_0_2 = 10002, // RENDERDOC_API_1_0_2 = 1 00 02 eRENDERDOC_API_Version_1_1_0 = 10100, // RENDERDOC_API_1_1_0 = 1 01 00 eRENDERDOC_API_Version_1_1_1 = 10101, // RENDERDOC_API_1_1_1 = 1 01 01 + eRENDERDOC_API_Version_1_1_2 = 10102, // RENDERDOC_API_1_1_2 = 1 01 02 } RENDERDOC_Version; // API version changelog: @@ -505,6 +512,9 @@ typedef enum { // function pointer is added to the end of the struct, the original layout is identical // 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote // replay/remote server concept in replay UI) +// 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify that these +// are captures and not debug logging files. This is the first API version in the v1.0 +// branch. // eRENDERDOC_API_Version_1_1_0 typedef struct @@ -597,6 +607,50 @@ typedef struct pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; } RENDERDOC_API_1_1_1; +// similarly to above, we renamed Get/SetLogFilePathTemplate to Get/SetCaptureFilePathTemplate. +// We thus declare a new struct so that code that was referencing the RENDERDOC_API_1_1_1 struct +// can still compile without changes, but new code will use the new struct members + +// eRENDERDOC_API_Version_1_1_2 +typedef struct +{ + pRENDERDOC_GetAPIVersion GetAPIVersion; + + pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32; + pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32; + + pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32; + pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32; + + pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys; + pRENDERDOC_SetCaptureKeys SetCaptureKeys; + + pRENDERDOC_GetOverlayBits GetOverlayBits; + pRENDERDOC_MaskOverlayBits MaskOverlayBits; + + pRENDERDOC_Shutdown Shutdown; + pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; + + pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate; + pRENDERDOC_GetCaptureFilePathTemplate GetCaptureFilePathTemplate; + + pRENDERDOC_GetNumCaptures GetNumCaptures; + pRENDERDOC_GetCapture GetCapture; + + pRENDERDOC_TriggerCapture TriggerCapture; + + pRENDERDOC_IsTargetControlConnected IsTargetControlConnected; + pRENDERDOC_LaunchReplayUI LaunchReplayUI; + + pRENDERDOC_SetActiveWindow SetActiveWindow; + + pRENDERDOC_StartFrameCapture StartFrameCapture; + pRENDERDOC_IsFrameCapturing IsFrameCapturing; + pRENDERDOC_EndFrameCapture EndFrameCapture; + + pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; +} RENDERDOC_API_1_1_2; + ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API entry point // diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index c9f1cab81..0d18490c5 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -199,7 +199,7 @@ void RenderDoc::UnloadCrashHandler() RenderDoc::RenderDoc() { - m_LogFile = ""; + m_CaptureFileTemplate = ""; m_MarkerIndentLevel = 0; m_CapturesActive = 0; @@ -286,8 +286,8 @@ void RenderDoc::Initialise() FileIO::GetDefaultFiles(base, capture_filename, m_LoggingFilename, m_Target); - if(m_LogFile.empty()) - SetLogFile(capture_filename.c_str()); + if(m_CaptureFileTemplate.empty()) + SetCaptureFileTemplate(capture_filename.c_str()); RDCLOGFILE(m_LoggingFilename.c_str()); } @@ -702,7 +702,7 @@ RDCFile *RenderDoc::CreateRDC(RDCDriver driver, uint32_t frameNum, void *thpixel { RDCFile *ret = new RDCFile; - m_CurrentLogFile = StringFormat::Fmt("%s_frame%u.rdc", m_LogFile.c_str(), frameNum); + m_CurrentLogFile = StringFormat::Fmt("%s_frame%u.rdc", m_CaptureFileTemplate.c_str(), frameNum); // make sure we don't stomp another capture if we make multiple captures in the same frame. { @@ -712,7 +712,8 @@ RDCFile *RenderDoc::CreateRDC(RDCDriver driver, uint32_t frameNum, void *thpixel return o.path == m_CurrentLogFile; }) != m_Captures.end()) { - m_CurrentLogFile = StringFormat::Fmt("%s_frame%u_%d.rdc", m_LogFile.c_str(), frameNum, altnum); + m_CurrentLogFile = + StringFormat::Fmt("%s_frame%u_%d.rdc", m_CaptureFileTemplate.c_str(), frameNum, altnum); altnum++; } } @@ -1043,17 +1044,18 @@ void RenderDoc::SetCaptureOptions(const CaptureOptions &opts) LibraryHooks::GetInstance().OptionsUpdated(); } -void RenderDoc::SetLogFile(const char *logFile) +void RenderDoc::SetCaptureFileTemplate(const char *pathtemplate) { - if(logFile == NULL || logFile[0] == '\0') + if(pathtemplate == NULL || pathtemplate[0] == '\0') return; - m_LogFile = logFile; + m_CaptureFileTemplate = pathtemplate; - if(m_LogFile.length() > 4 && m_LogFile.substr(m_LogFile.length() - 4) == ".rdc") - m_LogFile = m_LogFile.substr(0, m_LogFile.length() - 4); + if(m_CaptureFileTemplate.length() > 4 && + m_CaptureFileTemplate.substr(m_CaptureFileTemplate.length() - 4) == ".rdc") + m_CaptureFileTemplate = m_CaptureFileTemplate.substr(0, m_CaptureFileTemplate.length() - 4); - FileIO::CreateParentDirectory(m_LogFile); + FileIO::CreateParentDirectory(m_CaptureFileTemplate); } void RenderDoc::FinishCaptureWriting(RDCFile *rdc, uint32_t frameNumber) diff --git a/renderdoc/core/core.h b/renderdoc/core/core.h index 6d1c66f74..8e66b2c03 100644 --- a/renderdoc/core/core.h +++ b/renderdoc/core/core.h @@ -370,8 +370,8 @@ public: } // set from outside of the device creation interface - void SetLogFile(const char *logFile); - const char *GetLogFile() const { return m_LogFile.c_str(); } + void SetCaptureFileTemplate(const char *logFile); + const char *GetCaptureFileTemplate() const { return m_CaptureFileTemplate.c_str(); } const char *GetCurrentTarget() const { return m_Target.c_str(); } void Initialise(); void Shutdown(); @@ -552,7 +552,7 @@ private: string m_LoggingFilename; string m_Target; - string m_LogFile; + string m_CaptureFileTemplate; string m_CurrentLogFile; CaptureOptions m_Options; uint32_t m_Overlay; diff --git a/renderdoc/os/posix/posix_libentry.cpp b/renderdoc/os/posix/posix_libentry.cpp index fc533c521..72f1c92ca 100644 --- a/renderdoc/os/posix/posix_libentry.cpp +++ b/renderdoc/os/posix/posix_libentry.cpp @@ -63,7 +63,7 @@ void library_loaded() if(logfile) { - RenderDoc::Inst().SetLogFile(logfile); + RenderDoc::Inst().SetCaptureFileTemplate(logfile); } RDCLOG("Loading into %s", curfile.c_str()); diff --git a/renderdoc/os/win32/sys_win32_hooks.cpp b/renderdoc/os/win32/sys_win32_hooks.cpp index 9f281d1d5..0e69675f4 100644 --- a/renderdoc/os/win32/sys_win32_hooks.cpp +++ b/renderdoc/os/win32/sys_win32_hooks.cpp @@ -251,7 +251,7 @@ private: // inherit logfile and capture options ExecuteResult res = RENDERDOC_InjectIntoProcess(lpProcessInformation->dwProcessId, env, - RenderDoc::Inst().GetLogFile(), + RenderDoc::Inst().GetCaptureFileTemplate(), RenderDoc::Inst().GetCaptureOptions(), false); if(res.status == ReplayStatus::Succeeded) diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 7e7ea9ee9..3b031295f 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -186,7 +186,7 @@ extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetCaptureOptions(Capture extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetLogFile(const char *log) { if(log) - RenderDoc::Inst().SetLogFile(log); + RenderDoc::Inst().SetCaptureFileTemplate(log); } static EnvironmentModification tempEnvMod; diff --git a/renderdoc/replay/app_api.cpp b/renderdoc/replay/app_api.cpp index 62dd1bffc..92051992c 100644 --- a/renderdoc/replay/app_api.cpp +++ b/renderdoc/replay/app_api.cpp @@ -60,15 +60,15 @@ static void UnloadCrashHandler() RenderDoc::Inst().UnloadCrashHandler(); } -static void SetLogFilePathTemplate(const char *logfile) +static void SetCaptureFilePathTemplate(const char *pathtemplate) { - RDCLOG("Using logfile %s", logfile); - RenderDoc::Inst().SetLogFile(logfile); + RDCLOG("Using capture file template %s", pathtemplate); + RenderDoc::Inst().SetCaptureFileTemplate(pathtemplate); } -static const char *GetLogFilePathTemplate() +static const char *GetCaptureFilePathTemplate() { - return RenderDoc::Inst().GetLogFile(); + return RenderDoc::Inst().GetCaptureFileTemplate(); } static uint32_t GetNumCaptures() @@ -76,14 +76,14 @@ static uint32_t GetNumCaptures() return (uint32_t)RenderDoc::Inst().GetCaptures().size(); } -static uint32_t GetCapture(uint32_t idx, char *logfile, uint32_t *pathlength, uint64_t *timestamp) +static uint32_t GetCapture(uint32_t idx, char *filename, uint32_t *pathlength, uint64_t *timestamp) { vector caps = RenderDoc::Inst().GetCaptures(); if(idx >= (uint32_t)caps.size()) { - if(logfile) - logfile[0] = 0; + if(filename) + filename[0] = 0; if(pathlength) *pathlength = 0; if(timestamp) @@ -93,8 +93,8 @@ static uint32_t GetCapture(uint32_t idx, char *logfile, uint32_t *pathlength, ui CaptureData &c = caps[idx]; - if(logfile) - memcpy(logfile, c.path.c_str(), sizeof(char) * (c.path.size() + 1)); + if(filename) + memcpy(filename, c.path.c_str(), sizeof(char) * (c.path.size() + 1)); if(pathlength) *pathlength = uint32_t(c.path.size() + 1); if(timestamp) @@ -165,22 +165,22 @@ int RENDERDOC_CC SetCaptureOptionF32(RENDERDOC_CaptureOption opt, float val); uint32_t RENDERDOC_CC GetCaptureOptionU32(RENDERDOC_CaptureOption opt); float RENDERDOC_CC GetCaptureOptionF32(RENDERDOC_CaptureOption opt); -void RENDERDOC_CC GetAPIVersion_1_1_1(int *major, int *minor, int *patch) +void RENDERDOC_CC GetAPIVersion_1_1_2(int *major, int *minor, int *patch) { if(major) *major = 1; if(minor) *minor = 1; if(patch) - *patch = 1; + *patch = 2; } -RENDERDOC_API_1_1_1 api_1_1_1; -void Init_1_1_1() +RENDERDOC_API_1_1_2 api_1_1_2; +void Init_1_1_2() { - RENDERDOC_API_1_1_1 &api = api_1_1_1; + RENDERDOC_API_1_1_2 &api = api_1_1_2; - api.GetAPIVersion = &GetAPIVersion_1_1_1; + api.GetAPIVersion = &GetAPIVersion_1_1_2; api.SetCaptureOptionU32 = &SetCaptureOptionU32; api.SetCaptureOptionF32 = &SetCaptureOptionF32; @@ -197,8 +197,8 @@ void Init_1_1_1() api.Shutdown = &Shutdown; api.UnloadCrashHandler = &UnloadCrashHandler; - api.SetLogFilePathTemplate = &SetLogFilePathTemplate; - api.GetLogFilePathTemplate = &GetLogFilePathTemplate; + api.SetCaptureFilePathTemplate = &SetCaptureFilePathTemplate; + api.GetCaptureFilePathTemplate = &GetCaptureFilePathTemplate; api.GetNumCaptures = &GetNumCaptures; api.GetCapture = &GetCapture; @@ -241,11 +241,12 @@ extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_GetAPI(RENDERDOC_Version ver ret = 1; \ } - API_VERSION_HANDLE(1_0_0, 1_1_1); - API_VERSION_HANDLE(1_0_1, 1_1_1); - API_VERSION_HANDLE(1_0_2, 1_1_1); - API_VERSION_HANDLE(1_1_0, 1_1_1); - API_VERSION_HANDLE(1_1_1, 1_1_1); + API_VERSION_HANDLE(1_0_0, 1_1_2); + API_VERSION_HANDLE(1_0_1, 1_1_2); + API_VERSION_HANDLE(1_0_2, 1_1_2); + API_VERSION_HANDLE(1_1_0, 1_1_2); + API_VERSION_HANDLE(1_1_1, 1_1_2); + API_VERSION_HANDLE(1_1_2, 1_1_2); #undef API_VERSION_HANDLE