Update to clang-format 14

This commit is contained in:
Martijn Braam
2022-06-21 14:49:53 +02:00
parent d41fb6745a
commit f66fcc5a71
5 changed files with 557 additions and 503 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
cd "$MESON_SOURCE_ROOT" cd "$MESON_SOURCE_ROOT"
clang-format-12 $@ clang-format-14 $@

View File

@@ -11,8 +11,8 @@ https://github.com/benhoyt/inih
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "ini.h" #include "ini.h"
@@ -115,13 +115,13 @@ ini_parse_stream(ini_reader reader, void *stream, ini_handler handler, void *use
start = lskip(rstrip(start)); start = lskip(rstrip(start));
if (*start == ';' || *start == '#') { if (*start == ';' || *start == '#') {
/* Per Python configparser, allow both ; and # comments at the /* Per Python configparser, allow both ; and # comments at
start of a line */ the start of a line */
} }
#if INI_ALLOW_MULTILINE #if INI_ALLOW_MULTILINE
else if (*prev_name && *start && start > line) { else if (*prev_name && *start && start > line) {
/* Non-blank line with leading whitespace, treat as continuation /* Non-blank line with leading whitespace, treat as
of previous name's value (as per Python configparser). */ continuation of previous name's value (as per Python configparser). */
if (!handler(user, section, prev_name, start) && !error) if (!handler(user, section, prev_name, start) && !error)
error = lineno; error = lineno;
} }

View File

@@ -18,7 +18,9 @@ extern "C" {
#include <stdio.h> #include <stdio.h>
/* Typedef for prototype of handler function. */ /* Typedef for prototype of handler function. */
typedef int (*ini_handler)(void *user, const char *section, const char *name, typedef int (*ini_handler)(void *user,
const char *section,
const char *name,
const char *value); const char *value);
/* Typedef for prototype of fgets-style reader function. */ /* Typedef for prototype of fgets-style reader function. */
@@ -45,8 +47,8 @@ int ini_parse_file(FILE *file, ini_handler handler, void *user);
/* Same as ini_parse(), but takes an ini_reader function pointer instead of /* Same as ini_parse(), but takes an ini_reader function pointer instead of
filename. Used for implementing custom or string-based I/O. */ filename. Used for implementing custom or string-based I/O. */
int ini_parse_stream(ini_reader reader, void *stream, ini_handler handler, int
void *user); ini_parse_stream(ini_reader reader, void *stream, ini_handler handler, void *user);
/* Nonzero to allow multi-line value parsing, in the style of Python's /* Nonzero to allow multi-line value parsing, in the style of Python's
configparser. If allowed, ini_parse() will call the handler with the same configparser. If allowed, ini_parse() will call the handler with the same

View File

@@ -26,7 +26,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Documentation for the API is available at https://renderdoc.org/docs/in_application_api.html // Documentation for the API is available at
// https://renderdoc.org/docs/in_application_api.html
// //
#if !defined(RENDERDOC_NO_STDINT) #if !defined(RENDERDOC_NO_STDINT)
@@ -50,19 +51,21 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// Constants not used directly in below API // Constants not used directly in below API
// This is a GUID/magic value used for when applications pass a path where shader debug // This is a GUID/magic value used for when applications pass a path where shader
// information can be found to match up with a stripped shader. // debug information can be found to match up with a stripped shader. the define can
// the define can be used like so: const GUID RENDERDOC_ShaderDebugMagicValue = // be used like so: const GUID RENDERDOC_ShaderDebugMagicValue =
// RENDERDOC_ShaderDebugMagicValue_value // RENDERDOC_ShaderDebugMagicValue_value
#define RENDERDOC_ShaderDebugMagicValue_struct \ #define RENDERDOC_ShaderDebugMagicValue_struct \
{ \ { \
0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \ 0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, \
0x00, 0xff \
} }
// as an alternative when you want a byte array (assuming x86 endianness): // as an alternative when you want a byte array (assuming x86 endianness):
#define RENDERDOC_ShaderDebugMagicValue_bytearray \ #define RENDERDOC_ShaderDebugMagicValue_bytearray \
{ \ { \
0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \ 0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, \
0x8, 0x51, 0x54, 0x00, 0xff \
} }
// truncated version when only a uint64_t is available (e.g. Vulkan tags): // truncated version when only a uint64_t is available (e.g. Vulkan tags):
@@ -118,7 +121,8 @@ typedef enum RENDERDOC_CaptureOption {
eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4, eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4,
// Specify a delay in seconds to wait for a debugger to attach, after // Specify a delay in seconds to wait for a debugger to attach, after
// creating or injecting into a process, before continuing to allow it to run. // creating or injecting into a process, before continuing to allow it to
// run.
// //
// 0 indicates no delay, and the process will run immediately after injection // 0 indicates no delay, and the process will run immediately after injection
// //
@@ -126,22 +130,29 @@ typedef enum RENDERDOC_CaptureOption {
// //
eRENDERDOC_Option_DelayForDebugger = 5, eRENDERDOC_Option_DelayForDebugger = 5,
// Verify buffer access. This includes checking the memory returned by a Map() call to // Verify buffer access. This includes checking the memory returned by a
// detect any out-of-bounds modification, as well as initialising buffers with undefined contents // Map() call to
// detect any out-of-bounds modification, as well as initialising buffers
// with undefined contents
// to a marker value to catch use of uninitialised memory. // to a marker value to catch use of uninitialised memory.
// //
// NOTE: This option is only valid for OpenGL and D3D11. Explicit APIs such as D3D12 and Vulkan do // NOTE: This option is only valid for OpenGL and D3D11. Explicit APIs such
// not do the same kind of interception & checking and undefined contents are really undefined. // as D3D12 and Vulkan do
// not do the same kind of interception & checking and undefined contents are
// really undefined.
// //
// Default - disabled // Default - disabled
// //
// 1 - Verify buffer access // 1 - Verify buffer access
// 0 - No verification is performed, and overwriting bounds may cause crashes or corruption in // 0 - No verification is performed, and overwriting bounds may cause crashes
// or corruption in
// RenderDoc. // RenderDoc.
eRENDERDOC_Option_VerifyBufferAccess = 6, eRENDERDOC_Option_VerifyBufferAccess = 6,
// The old name for eRENDERDOC_Option_VerifyBufferAccess was eRENDERDOC_Option_VerifyMapWrites. // The old name for eRENDERDOC_Option_VerifyBufferAccess was
// This option now controls the filling of uninitialised buffers with 0xdddddddd which was // eRENDERDOC_Option_VerifyMapWrites.
// This option now controls the filling of uninitialised buffers with
// 0xdddddddd which was
// previously always enabled // previously always enabled
eRENDERDOC_Option_VerifyMapWrites = eRENDERDOC_Option_VerifyBufferAccess, eRENDERDOC_Option_VerifyMapWrites = eRENDERDOC_Option_VerifyBufferAccess,
@@ -154,7 +165,8 @@ typedef enum RENDERDOC_CaptureOption {
// 0 - Child processes are not hooked by RenderDoc // 0 - Child processes are not hooked by RenderDoc
eRENDERDOC_Option_HookIntoChildren = 7, eRENDERDOC_Option_HookIntoChildren = 7,
// By default RenderDoc only includes resources in the final capture necessary // By default RenderDoc only includes resources in the final capture
// necessary
// for that frame, this allows you to override that behaviour. // for that frame, this allows you to override that behaviour.
// //
// Default - disabled // Default - disabled
@@ -174,14 +186,17 @@ typedef enum RENDERDOC_CaptureOption {
// //
// Default - disabled // Default - disabled
// //
// 1 - initial contents at the start of each captured frame are saved, even if // 1 - initial contents at the start of each captured frame are saved, even
// if
// they are later overwritten or cleared before being used. // they are later overwritten or cleared before being used.
// 0 - unless a read is detected, initial contents will not be saved and will // 0 - unless a read is detected, initial contents will not be saved and will
// appear as black or empty data. // appear as black or empty data.
eRENDERDOC_Option_SaveAllInitials = 9, eRENDERDOC_Option_SaveAllInitials = 9,
// In APIs that allow for the recording of command lists to be replayed later, // In APIs that allow for the recording of command lists to be replayed
// RenderDoc may choose to not capture command lists before a frame capture is // later,
// RenderDoc may choose to not capture command lists before a frame capture
// is
// triggered, to reduce overheads. This means any command lists recorded once // triggered, to reduce overheads. This means any command lists recorded once
// and replayed many times will not be available and may cause a failure to // and replayed many times will not be available and may cause a failure to
// capture. // capture.
@@ -219,18 +234,24 @@ typedef enum RENDERDOC_CaptureOption {
// //
// Returns 1 if the option and value are valid // Returns 1 if the option and value are valid
// Returns 0 if either is invalid and the option is unchanged // Returns 0 if either is invalid and the option is unchanged
typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionU32)(RENDERDOC_CaptureOption opt, uint32_t val); typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionU32)(
typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionF32)(RENDERDOC_CaptureOption opt, float val); RENDERDOC_CaptureOption opt,
uint32_t val);
typedef int(RENDERDOC_CC *pRENDERDOC_SetCaptureOptionF32)(
RENDERDOC_CaptureOption opt,
float val);
// Gets the current value of an option as a uint32_t // Gets the current value of an option as a uint32_t
// //
// If the option is invalid, 0xffffffff is returned // If the option is invalid, 0xffffffff is returned
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionU32)(RENDERDOC_CaptureOption opt); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionU32)(
RENDERDOC_CaptureOption opt);
// Gets the current value of an option as a float // Gets the current value of an option as a float
// //
// If the option is invalid, -FLT_MAX is returned // If the option is invalid, -FLT_MAX is returned
typedef float(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionF32)(RENDERDOC_CaptureOption opt); typedef float(RENDERDOC_CC *pRENDERDOC_GetCaptureOptionF32)(
RENDERDOC_CaptureOption opt);
typedef enum RENDERDOC_InputButton { typedef enum RENDERDOC_InputButton {
// '0' - '9' matches ASCII values // '0' - '9' matches ASCII values
@@ -313,15 +334,19 @@ typedef enum RENDERDOC_InputButton {
// Sets which key or keys can be used to toggle focus between multiple windows // Sets which key or keys can be used to toggle focus between multiple windows
// //
// If keys is NULL or num is 0, toggle keys will be disabled // If keys is NULL or num is 0, toggle keys will be disabled
typedef void(RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(RENDERDOC_InputButton *keys, int num); typedef void(RENDERDOC_CC *pRENDERDOC_SetFocusToggleKeys)(
RENDERDOC_InputButton *keys,
int num);
// Sets which key or keys can be used to capture the next frame // Sets which key or keys can be used to capture the next frame
// //
// If keys is NULL or num is 0, captures keys will be disabled // If keys is NULL or num is 0, captures keys will be disabled
typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(RENDERDOC_InputButton *keys, int num); typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureKeys)(RENDERDOC_InputButton *keys,
int num);
typedef enum RENDERDOC_OverlayBits { typedef enum RENDERDOC_OverlayBits {
// This single bit controls whether the overlay is enabled or disabled globally // This single bit controls whether the overlay is enabled or disabled
// globally
eRENDERDOC_Overlay_Enabled = 0x1, eRENDERDOC_Overlay_Enabled = 0x1,
// Show the average framerate over several seconds as well as min/max // Show the average framerate over several seconds as well as min/max
@@ -334,7 +359,8 @@ typedef enum RENDERDOC_OverlayBits {
eRENDERDOC_Overlay_CaptureList = 0x8, eRENDERDOC_Overlay_CaptureList = 0x8,
// Default values for the overlay mask // Default values for the overlay mask
eRENDERDOC_Overlay_Default = (eRENDERDOC_Overlay_Enabled | eRENDERDOC_Overlay_FrameRate | eRENDERDOC_Overlay_Default =
(eRENDERDOC_Overlay_Enabled | eRENDERDOC_Overlay_FrameRate |
eRENDERDOC_Overlay_FrameNumber | eRENDERDOC_Overlay_CaptureList), eRENDERDOC_Overlay_FrameNumber | eRENDERDOC_Overlay_CaptureList),
// Enable all bits // Enable all bits
@@ -370,8 +396,8 @@ typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)();
// Sets the capture file path template // Sets the capture file path template
// //
// pathtemplate 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
// and where they will be saved. // named and where they will be saved.
// //
// Any extension is stripped off the path, and captures are saved in the directory // Any extension is stripped off the path, and captures are saved in the directory
// specified, and named with the filename and the frame number appended. If the // specified, and named with the filename and the frame number appended. If the
@@ -385,9 +411,11 @@ typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)();
// //
// Capture #1 -> my_captures/example_frame123.rdc // Capture #1 -> my_captures/example_frame123.rdc
// Capture #2 -> my_captures/example_frame456.rdc // Capture #2 -> my_captures/example_frame456.rdc
typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(const char *pathtemplate); typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(
const char *pathtemplate);
// returns the current capture path template, see SetCaptureFileTemplate 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)(); typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)();
// DEPRECATED: compatibility for code compiled against pre-1.1.2 headers. // DEPRECATED: compatibility for code compiled against pre-1.1.2 headers.
@@ -400,26 +428,29 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)();
// This function returns the details of a capture, by index. New captures are added // This function returns the details of a capture, by index. New captures are added
// to the end of the list. // to the end of the list.
// //
// filename will be filled with the absolute path to the capture file, as a UTF-8 string // filename will be filled with the absolute path to the capture file, as a UTF-8
// pathlength will be written with the length in bytes of the filename string // 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 // 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. // Any of the parameters can be NULL and they'll be skipped.
// //
// The function will return 1 if the capture index is valid, or 0 if the index is invalid // The function will return 1 if the capture index is valid, or 0 if the index is
// If the index is invalid, the values will be unchanged // invalid 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 // Note: when captures are deleted in the UI they will remain in this list, so the
// capture path may not exist anymore. // capture path may not exist anymore.
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *filename, typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx,
uint32_t *pathlength, uint64_t *timestamp); char *filename,
uint32_t *pathlength,
uint64_t *timestamp);
// Sets the comments associated with a capture file. These comments are displayed in the // Sets the comments associated with a capture file. These comments are displayed in
// UI program when opening. // the UI program when opening.
// //
// filePath should be a path to the capture file to add comments to. If set to NULL or "" // filePath should be a path to the capture file to add comments to. If set to NULL
// the most recent capture file created made will be used instead. // or "" the most recent capture file created made will be used instead. comments
// comments should be a NULL-terminated UTF-8 string to add as comments. // should be a NULL-terminated UTF-8 string to add as comments.
// //
// Any existing comments will be overwritten. // Any existing comments will be overwritten.
typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFileComments)(const char *filePath, typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFileComments)(const char *filePath,
@@ -429,27 +460,30 @@ typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFileComments)(const char *filePa
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)();
// DEPRECATED: compatibility for code compiled against pre-1.1.1 headers. // 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 // This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept
// backwards compatibility with old code, it is castable either way since it's ABI compatible // here for backwards compatibility with old code, it is castable either way since
// as the same function pointer type. // it's ABI compatible as the same function pointer type.
typedef pRENDERDOC_IsTargetControlConnected pRENDERDOC_IsRemoteAccessConnected; typedef pRENDERDOC_IsTargetControlConnected pRENDERDOC_IsRemoteAccessConnected;
// This function will launch the Replay UI associated with the RenderDoc library injected // This function will launch the Replay UI associated with the RenderDoc library
// into the running application. // injected into the running application.
// //
// if connectTargetControl is 1, the Replay UI will be launched with a command line parameter // if connectTargetControl is 1, the Replay UI will be launched with a command line
// to connect to this application // parameter to connect to this application cmdline is the rest of the command line,
// cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open // as a UTF-8 string. E.g. a captures to open if cmdline is NULL, the command line
// if cmdline is NULL, the command line will be empty. // will be empty.
// //
// returns the PID of the replay UI if successful, 0 if not successful. // returns the PID of the replay UI if successful, 0 if not successful.
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTargetControl, typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(
uint32_t connectTargetControl,
const char *cmdline); const char *cmdline);
// RenderDoc can return a higher version than requested if it's backwards compatible, // RenderDoc can return a higher version than requested if it's backwards compatible,
// this function returns the actual version returned. If a parameter is NULL, it will be // this function returns the actual version returned. If a parameter is NULL, it will
// ignored and the others will be filled out. // be ignored and the others will be filled out.
typedef void(RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major, int *minor, int *patch); typedef void(RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major,
int *minor,
int *patch);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Capturing functions // Capturing functions
@@ -467,43 +501,49 @@ typedef void *RENDERDOC_WindowHandle;
// A helper macro for Vulkan, where the device handle cannot be used directly. // A helper macro for Vulkan, where the device handle cannot be used directly.
// //
// Passing the VkInstance to this macro will return the RENDERDOC_DevicePointer to use. // Passing the VkInstance to this macro will return the RENDERDOC_DevicePointer to
// use.
// //
// Specifically, the value needed is the dispatch table pointer, which sits as the first // Specifically, the value needed is the dispatch table pointer, which sits as the
// pointer-sized object in the memory pointed to by the VkInstance. Thus we cast to a void** and // first pointer-sized object in the memory pointed to by the VkInstance. Thus we
// indirect once. // cast to a void** and indirect once.
#define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst))) #define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst)))
// This sets the RenderDoc in-app overlay in the API/window pair as 'active' and it will // This sets the RenderDoc in-app overlay in the API/window pair as 'active' and it
// respond to keypresses. Neither parameter can be NULL // will respond to keypresses. Neither parameter can be NULL
typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device, typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(
RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle); RENDERDOC_WindowHandle wndHandle);
// capture the next frame on whichever window and API is currently considered active // capture the next frame on whichever window and API is currently considered active
typedef void(RENDERDOC_CC *pRENDERDOC_TriggerCapture)(); typedef void(RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
// capture the next N frames on whichever window and API is currently considered active // capture the next N frames on whichever window and API is currently considered
// active
typedef void(RENDERDOC_CC *pRENDERDOC_TriggerMultiFrameCapture)(uint32_t numFrames); typedef void(RENDERDOC_CC *pRENDERDOC_TriggerMultiFrameCapture)(uint32_t numFrames);
// When choosing either a device pointer or a window handle to capture, you can pass NULL. // When choosing either a device pointer or a window handle to capture, you can pass
// Passing NULL specifies a 'wildcard' match against anything. This allows you to specify // NULL. Passing NULL specifies a 'wildcard' match against anything. This allows you
// any API rendering to a specific window, or a specific API instance rendering to any window, // to specify any API rendering to a specific window, or a specific API instance
// or in the simplest case of one window and one API, you can just pass NULL for both. // rendering to any window, or in the simplest case of one window and one API, you
// can just pass NULL for both.
// //
// In either case, if there are two or more possible matching (device,window) pairs it // In either case, if there are two or more possible matching (device,window) pairs
// is undefined which one will be captured. // it is undefined which one will be captured.
// //
// Note: for headless rendering you can pass NULL for the window handle and either specify // Note: for headless rendering you can pass NULL for the window handle and either
// a device pointer or leave it NULL as above. // specify a device pointer or leave it NULL as above.
// Immediately starts capturing API calls on the specified device pointer and window handle. // Immediately starts capturing API calls on the specified device pointer and window
// handle.
// //
// If there is no matching thing to capture (e.g. no supported API has been initialised), // If there is no matching thing to capture (e.g. no supported API has been
// this will do nothing. // initialised), this will do nothing.
// //
// The results are undefined (including crashes) if two captures are started overlapping, // The results are undefined (including crashes) if two captures are started
// even on separate devices and/oror windows. // overlapping, even on separate devices and/oror windows.
typedef void(RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(RENDERDOC_DevicePointer device, typedef void(RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(
RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle); RENDERDOC_WindowHandle wndHandle);
// Returns whether or not a frame capture is currently ongoing anywhere. // Returns whether or not a frame capture is currently ongoing anywhere.
@@ -513,15 +553,18 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsFrameCapturing)();
// Ends capturing immediately. // Ends capturing immediately.
// //
// This will return 1 if the capture succeeded, and 0 if there was an error capturing. // This will return 1 if the capture succeeded, and 0 if there was an error
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePointer device, // capturing.
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(
RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle); RENDERDOC_WindowHandle wndHandle);
// Ends capturing immediately and discard any data stored without saving to disk. // Ends capturing immediately and discard any data stored without saving to disk.
// //
// This will return 1 if the capture was discarded, and 0 if there was an error or no capture // This will return 1 if the capture was discarded, and 0 if there was an error or no
// was in progress // capture was in progress
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(RENDERDOC_DevicePointer device, typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(
RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle); RENDERDOC_WindowHandle wndHandle);
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
@@ -531,12 +574,13 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(RENDERDOC_DeviceP
// RenderDoc uses semantic versioning (http://semver.org/). // RenderDoc uses semantic versioning (http://semver.org/).
// //
// MAJOR version is incremented when incompatible API changes happen. // MAJOR version is incremented when incompatible API changes happen.
// MINOR version is incremented when functionality is added in a backwards-compatible manner. // MINOR version is incremented when functionality is added in a backwards-compatible
// PATCH version is incremented when backwards-compatible bug fixes happen. // manner. PATCH version is incremented when backwards-compatible bug fixes happen.
// //
// Note that this means the API returned can be higher than the one you might have requested. // Note that this means the API returned can be higher than the one you might have
// e.g. if you are running against a newer RenderDoc that supports 1.0.1, it will be returned // requested. e.g. if you are running against a newer RenderDoc that supports 1.0.1,
// instead of 1.0.0. You can check this with the GetAPIVersion entry point // it will be returned instead of 1.0.0. You can check this with the GetAPIVersion
// entry point
typedef enum RENDERDOC_Version { typedef enum RENDERDOC_Version {
eRENDERDOC_API_Version_1_0_0 = 10000, // RENDERDOC_API_1_0_0 = 1 00 00 eRENDERDOC_API_Version_1_0_0 = 10000, // RENDERDOC_API_1_0_0 = 1 00 00
eRENDERDOC_API_Version_1_0_1 = 10001, // RENDERDOC_API_1_0_1 = 1 00 01 eRENDERDOC_API_Version_1_0_1 = 10001, // RENDERDOC_API_1_0_1 = 1 00 01
@@ -553,30 +597,38 @@ typedef enum RENDERDOC_Version {
// API version changelog: // API version changelog:
// //
// 1.0.0 - initial release // 1.0.0 - initial release
// 1.0.1 - Bugfix: IsFrameCapturing() was returning false for captures that were triggered // 1.0.1 - Bugfix: IsFrameCapturing() was returning false for captures that were
// triggered
// by keypress or TriggerCapture, instead of Start/EndFrameCapture. // by keypress or TriggerCapture, instead of Start/EndFrameCapture.
// 1.0.2 - Refactor: Renamed eRENDERDOC_Option_DebugDeviceMode to eRENDERDOC_Option_APIValidation // 1.0.2 - Refactor: Renamed eRENDERDOC_Option_DebugDeviceMode to
// 1.1.0 - Add feature: TriggerMultiFrameCapture(). Backwards compatible with 1.0.x since the new // eRENDERDOC_Option_APIValidation 1.1.0 - Add feature: TriggerMultiFrameCapture().
// function pointer is added to the end of the struct, the original layout is identical // Backwards compatible with 1.0.x since the new
// 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote // 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) // replay/remote server concept in replay UI)
// 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify that these // 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify
// are captures and not debug logging files. This is the first API version in the v1.0 // that these
// branch. // are captures and not debug logging files. This is the first API version in
// 1.2.0 - Added feature: SetCaptureFileComments() to add comments to a capture file that will be // the v1.0 branch.
// 1.2.0 - Added feature: SetCaptureFileComments() to add comments to a capture file
// that will be
// displayed in the UI program on load. // displayed in the UI program on load.
// 1.3.0 - Added feature: New capture option eRENDERDOC_Option_AllowUnsupportedVendorExtensions // 1.3.0 - Added feature: New capture option
// which allows users to opt-in to allowing unsupported vendor extensions to function. // eRENDERDOC_Option_AllowUnsupportedVendorExtensions
// Should be used at the user's own risk. // which allows users to opt-in to allowing unsupported vendor extensions to
// Refactor: Renamed eRENDERDOC_Option_VerifyMapWrites to // function. Should be used at the user's own risk. Refactor: Renamed
// eRENDERDOC_Option_VerifyBufferAccess, which now also controls initialisation to // eRENDERDOC_Option_VerifyMapWrites to eRENDERDOC_Option_VerifyBufferAccess,
// 0xdddddddd of uninitialised buffer contents. // which now also controls initialisation to 0xdddddddd of uninitialised
// 1.4.0 - Added feature: DiscardFrameCapture() to discard a frame capture in progress and stop // buffer contents.
// 1.4.0 - Added feature: DiscardFrameCapture() to discard a frame capture in
// progress and stop
// capturing without saving anything to disk. // capturing without saving anything to disk.
// 1.4.1 - Refactor: Renamed Shutdown to RemoveHooks to better clarify what is happening // 1.4.1 - Refactor: Renamed Shutdown to RemoveHooks to better clarify what is
// happening
typedef struct RENDERDOC_API_1_4_1 typedef struct RENDERDOC_API_1_4_1 {
{
pRENDERDOC_GetAPIVersion GetAPIVersion; pRENDERDOC_GetAPIVersion GetAPIVersion;
pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32; pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32;
@@ -593,24 +645,22 @@ typedef struct RENDERDOC_API_1_4_1
// Shutdown was renamed to RemoveHooks in 1.4.1. // Shutdown was renamed to RemoveHooks in 1.4.1.
// These unions allow old code to continue compiling without changes // These unions allow old code to continue compiling without changes
union union {
{
pRENDERDOC_Shutdown Shutdown; pRENDERDOC_Shutdown Shutdown;
pRENDERDOC_RemoveHooks RemoveHooks; pRENDERDOC_RemoveHooks RemoveHooks;
}; };
pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; pRENDERDOC_UnloadCrashHandler UnloadCrashHandler;
// Get/SetLogFilePathTemplate was renamed to Get/SetCaptureFilePathTemplate in 1.1.2. // Get/SetLogFilePathTemplate was renamed to Get/SetCaptureFilePathTemplate
// These unions allow old code to continue compiling without changes // in 1.1.2. These unions allow old code to continue compiling without
union // changes
{ union {
// deprecated name // deprecated name
pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate; pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate;
// current name // current name
pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate; pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate;
}; };
union union {
{
// deprecated name // deprecated name
pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate; pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate;
// current name // current name
@@ -624,8 +674,7 @@ typedef struct RENDERDOC_API_1_4_1
// IsRemoteAccessConnected was renamed to IsTargetControlConnected in 1.1.1. // IsRemoteAccessConnected was renamed to IsTargetControlConnected in 1.1.1.
// This union allows old code to continue compiling without changes // This union allows old code to continue compiling without changes
union union {
{
// deprecated name // deprecated name
pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected; pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected;
// current name // current name
@@ -662,26 +711,29 @@ typedef RENDERDOC_API_1_4_1 RENDERDOC_API_1_4_0;
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// RenderDoc API entry point // RenderDoc API entry point
// //
// This entry point can be obtained via GetProcAddress/dlsym if RenderDoc is available. // This entry point can be obtained via GetProcAddress/dlsym if RenderDoc is
// available.
// //
// The name is the same as the typedef - "RENDERDOC_GetAPI" // The name is the same as the typedef - "RENDERDOC_GetAPI"
// //
// This function is not thread safe, and should not be called on multiple threads at once. // This function is not thread safe, and should not be called on multiple threads at
// Ideally, call this once as early as possible in your application's startup, before doing // once. Ideally, call this once as early as possible in your application's startup,
// any API work, since some configuration functionality etc has to be done also before // before doing any API work, since some configuration functionality etc has to be
// initialising any APIs. // done also before initialising any APIs.
// //
// Parameters: // Parameters:
// version is a single value from the RENDERDOC_Version above. // version is a single value from the RENDERDOC_Version above.
// //
// outAPIPointers will be filled out with a pointer to the corresponding struct of function // outAPIPointers will be filled out with a pointer to the corresponding struct of
// pointers. // function pointers.
// //
// Returns: // Returns:
// 1 - if the outAPIPointers has been filled with a pointer to the API struct requested // 1 - if the outAPIPointers has been filled with a pointer to the API struct
// 0 - if the requested version is not supported or the arguments are invalid. // requested 0 - if the requested version is not supported or the arguments are
// invalid.
// //
typedef int(RENDERDOC_CC *pRENDERDOC_GetAPI)(RENDERDOC_Version version, void **outAPIPointers); typedef int(RENDERDOC_CC *pRENDERDOC_GetAPI)(RENDERDOC_Version version,
void **outAPIPointers);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"