Compare commits

...

5 Commits

Author SHA1 Message Date
Radosław Gliński 0031243d9e
Merge dd15183faf into 5abf67f540 2024-09-19 02:47:29 +03:00
Gliniak 5abf67f540 [MISC] Added devkit directory to gitignore file 2024-09-18 19:30:06 +02:00
Gliniak 17ca739935 [3PP] Reverted Catch2 back to 2.x version due to incompatibility 2024-09-18 19:28:39 +02:00
Xphalnos ecc92e4082 Third-party: Update a lot of submodules 2024-09-17 19:58:40 +02:00
Gliniak dd15183faf [HID] Enable Keyboard Passthru
Thanks Adrian for figuring out missing XINPUT_KEYSTROKE_VALIDUNICODE flag
2024-09-07 16:40:15 +02:00
32 changed files with 4018 additions and 1557 deletions

1
.gitignore vendored
View File

@ -106,4 +106,5 @@ node_modules/.bin/
/cache /cache
/cache1 /cache1
/cache0 /cache0
/devkit
recent.toml recent.toml

View File

@ -666,7 +666,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint32_t* value) {
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank; ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank;
if (state_.register_input_hex) { if (state_.register_input_hex) {
input_flags |= ImGuiInputTextFlags_CharsHexadecimal | input_flags |= ImGuiInputTextFlags_CharsHexadecimal |
ImGuiInputTextFlags_AlwaysInsertMode | ImGuiInputTextFlags_AlwaysOverwrite |
ImGuiInputTextFlags_NoHorizontalScroll; ImGuiInputTextFlags_NoHorizontalScroll;
auto src_value = xe::string_util::to_hex_string(*value); auto src_value = xe::string_util::to_hex_string(*value);
std::strcpy(buffer, src_value.c_str()); std::strcpy(buffer, src_value.c_str());
@ -706,7 +706,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint64_t* value) {
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank; ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank;
if (state_.register_input_hex) { if (state_.register_input_hex) {
input_flags |= ImGuiInputTextFlags_CharsHexadecimal | input_flags |= ImGuiInputTextFlags_CharsHexadecimal |
ImGuiInputTextFlags_AlwaysInsertMode | ImGuiInputTextFlags_AlwaysOverwrite |
ImGuiInputTextFlags_NoHorizontalScroll; ImGuiInputTextFlags_NoHorizontalScroll;
auto src_value = xe::string_util::to_hex_string(*value); auto src_value = xe::string_util::to_hex_string(*value);
std::strcpy(buffer, src_value.c_str()); std::strcpy(buffer, src_value.c_str());
@ -746,7 +746,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, double* value) {
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank; ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank;
if (state_.register_input_hex) { if (state_.register_input_hex) {
input_flags |= ImGuiInputTextFlags_CharsHexadecimal | input_flags |= ImGuiInputTextFlags_CharsHexadecimal |
ImGuiInputTextFlags_AlwaysInsertMode | ImGuiInputTextFlags_AlwaysOverwrite |
ImGuiInputTextFlags_NoHorizontalScroll; ImGuiInputTextFlags_NoHorizontalScroll;
auto src_value = xe::string_util::to_hex_string(*value); auto src_value = xe::string_util::to_hex_string(*value);
std::strcpy(buffer, src_value.c_str()); std::strcpy(buffer, src_value.c_str());
@ -785,7 +785,7 @@ bool DebugWindow::DrawRegisterTextBoxes(int id, float* value) {
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank; ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank;
if (state_.register_input_hex) { if (state_.register_input_hex) {
input_flags |= ImGuiInputTextFlags_CharsHexadecimal | input_flags |= ImGuiInputTextFlags_CharsHexadecimal |
ImGuiInputTextFlags_AlwaysInsertMode | ImGuiInputTextFlags_AlwaysOverwrite |
ImGuiInputTextFlags_NoHorizontalScroll; ImGuiInputTextFlags_NoHorizontalScroll;
} else { } else {
input_flags |= input_flags |=
@ -1178,7 +1178,7 @@ void DebugWindow::DrawBreakpointsPane() {
ImGuiInputTextFlags input_flags = ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags input_flags = ImGuiInputTextFlags_CharsUppercase |
ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsNoBlank |
ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsHexadecimal |
ImGuiInputTextFlags_AlwaysInsertMode | ImGuiInputTextFlags_AlwaysOverwrite |
ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_NoHorizontalScroll |
ImGuiInputTextFlags_EnterReturnsTrue; ImGuiInputTextFlags_EnterReturnsTrue;
ImGui::PushItemWidth(50); ImGui::PushItemWidth(50);

View File

@ -131,10 +131,15 @@ X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags,
if (result != X_ERROR_DEVICE_NOT_CONNECTED) { if (result != X_ERROR_DEVICE_NOT_CONNECTED) {
any_connected = true; any_connected = true;
} }
if (result == X_ERROR_SUCCESS || result == X_ERROR_EMPTY) { if (result == X_ERROR_SUCCESS || result == X_ERROR_EMPTY) {
UpdateUsedSlot(driver.get(), user_index, any_connected); UpdateUsedSlot(driver.get(), user_index, any_connected);
return result; return result;
} }
if (result == X_ERROR_EMPTY) {
continue;
}
} }
UpdateUsedSlot(nullptr, user_index, any_connected); UpdateUsedSlot(nullptr, user_index, any_connected);
return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED; return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED;

View File

@ -289,7 +289,9 @@ X_RESULT SDLInputDriver::GetKeystroke(uint32_t users, uint32_t flags,
if (!out_keystroke) { if (!out_keystroke) {
return X_ERROR_BAD_ARGUMENTS; return X_ERROR_BAD_ARGUMENTS;
} }
if ((flags & XINPUT_FLAG_KEYBOARD) != 0) {
return X_ERROR_INVALID_PARAMETER;
}
// The order of this list is also the order in which events are send if // The order of this list is also the order in which events are send if
// multiple buttons change at once. // multiple buttons change at once.
static_assert(sizeof(X_INPUT_GAMEPAD::buttons) == 2); static_assert(sizeof(X_INPUT_GAMEPAD::buttons) == 2);

View File

@ -28,10 +28,25 @@
DEFINE_int32(keyboard_user_index, 0, "Controller port that keyboard emulates", DEFINE_int32(keyboard_user_index, 0, "Controller port that keyboard emulates",
"HID.WinKey"); "HID.WinKey");
DEFINE_int32(keyboard_passthru_user_index, -1,
"Allows keyboard to be assigned as virtual keyboard to user with "
"specific index. This also forces keyboard to be assigned to that "
"slot to be interpreted as controller. Possible values: -1 - "
"Disabled (Keyboard is in "
"gamepad mode), [0, 3] - Keyboard is assigned as VK for that user",
"HID");
namespace xe { namespace xe {
namespace hid { namespace hid {
namespace winkey { namespace winkey {
bool static IsPassThruForUserEnabled(uint32_t user_index) {
if (cvars::keyboard_passthru_user_index == -1) {
return false;
}
return user_index == cvars::keyboard_passthru_user_index;
}
bool __inline IsKeyToggled(uint8_t key) { bool __inline IsKeyToggled(uint8_t key) {
return (GetKeyState(key) & 0x1) == 0x1; return (GetKeyState(key) & 0x1) == 0x1;
} }
@ -126,7 +141,8 @@ X_RESULT WinKeyInputDriver::GetCapabilities(uint32_t user_index, uint32_t flags,
X_RESULT WinKeyInputDriver::GetState(uint32_t user_index, X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
X_INPUT_STATE* out_state) { X_INPUT_STATE* out_state) {
if (user_index != cvars::keyboard_user_index) { if (!IsPassThruForUserEnabled(user_index) &&
user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED; return X_ERROR_DEVICE_NOT_CONNECTED;
} }
@ -241,7 +257,8 @@ X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
X_RESULT WinKeyInputDriver::SetState(uint32_t user_index, X_RESULT WinKeyInputDriver::SetState(uint32_t user_index,
X_INPUT_VIBRATION* vibration) { X_INPUT_VIBRATION* vibration) {
if (user_index != cvars::keyboard_user_index) { if (!IsPassThruForUserEnabled(user_index) &&
user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED; return X_ERROR_DEVICE_NOT_CONNECTED;
} }
@ -250,7 +267,8 @@ X_RESULT WinKeyInputDriver::SetState(uint32_t user_index,
X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags, X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
X_INPUT_KEYSTROKE* out_keystroke) { X_INPUT_KEYSTROKE* out_keystroke) {
if (user_index != cvars::keyboard_user_index) { if (!IsPassThruForUserEnabled(user_index) &&
user_index != cvars::keyboard_user_index) {
return X_ERROR_DEVICE_NOT_CONNECTED; return X_ERROR_DEVICE_NOT_CONNECTED;
} }
@ -278,6 +296,8 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
} }
bool capital = IsKeyToggled(VK_CAPITAL) || IsKeyDown(VK_SHIFT); bool capital = IsKeyToggled(VK_CAPITAL) || IsKeyDown(VK_SHIFT);
if (!IsPassThruForUserEnabled(user_index)) {
for (const KeyBinding& b : key_bindings_) { for (const KeyBinding& b : key_bindings_) {
if (b.input_key == evt.virtual_key && if (b.input_key == evt.virtual_key &&
((b.lowercase == b.uppercase) || (b.lowercase && !capital) || ((b.lowercase == b.uppercase) || (b.lowercase && !capital) ||
@ -285,16 +305,39 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
xinput_virtual_key = b.output_key; xinput_virtual_key = b.output_key;
} }
} }
} else {
xinput_virtual_key = evt.virtual_key;
if (capital) {
keystroke_flags |= 0x0008; // XINPUT_KEYSTROKE_SHIFT
}
if (IsKeyToggled(VK_CONTROL)) {
keystroke_flags |= 0x0010; // XINPUT_KEYSTROKE_CTRL
}
if (IsKeyToggled(VK_MENU)) {
keystroke_flags |= 0x0020; // XINPUT_KEYSTROKE_ALT
}
}
if (xinput_virtual_key != ui::VirtualKey::kNone) { if (xinput_virtual_key != ui::VirtualKey::kNone) {
if (evt.transition == true) { if (evt.transition == true) {
keystroke_flags |= 0x0001; // XINPUT_KEYSTROKE_KEYDOWN keystroke_flags |= 0x0001; // XINPUT_KEYSTROKE_KEYDOWN
if (evt.prev_state == evt.transition) {
keystroke_flags |= 0x0004; // XINPUT_KEYSTROKE_REPEAT
}
} else if (evt.transition == false) { } else if (evt.transition == false) {
keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP
} }
if (evt.prev_state == evt.transition) { if (IsPassThruForUserEnabled(user_index)) {
keystroke_flags |= 0x0004; // XINPUT_KEYSTROKE_REPEAT WCHAR buf;
if (ToUnicode(uint8_t(xinput_virtual_key), 0, key_map_, &buf, 1, 0) ==
1) {
keystroke_flags |= 0x1000; // XINPUT_KEYSTROKE_VALIDUNICODE
unicode = buf;
}
} }
result = X_ERROR_SUCCESS; result = X_ERROR_SUCCESS;
@ -303,7 +346,7 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
out_keystroke->virtual_key = uint16_t(xinput_virtual_key); out_keystroke->virtual_key = uint16_t(xinput_virtual_key);
out_keystroke->unicode = unicode; out_keystroke->unicode = unicode;
out_keystroke->flags = keystroke_flags; out_keystroke->flags = keystroke_flags;
out_keystroke->user_index = 0; out_keystroke->user_index = user_index;
out_keystroke->hid_code = hid_code; out_keystroke->hid_code = hid_code;
// X_ERROR_EMPTY if no new keys // X_ERROR_EMPTY if no new keys

View File

@ -72,7 +72,7 @@ class WinKeyInputDriver final : public InputDriver {
xe::global_critical_region global_critical_region_; xe::global_critical_region global_critical_region_;
std::queue<KeyEvent> key_events_; std::queue<KeyEvent> key_events_;
std::vector<KeyBinding> key_bindings_; std::vector<KeyBinding> key_bindings_;
uint8_t key_map_[256];
uint32_t packet_number_ = 1; uint32_t packet_number_ = 1;
}; };

View File

@ -200,6 +200,9 @@ X_RESULT XInputInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
// flags is reserved on desktop. // flags is reserved on desktop.
DWORD result; DWORD result;
if ((flags & XINPUT_FLAG_KEYBOARD) != 0) {
return X_ERROR_INVALID_PARAMETER;
}
// XInputGetKeystroke on Windows has a bug where it will return // XInputGetKeystroke on Windows has a bug where it will return
// ERROR_SUCCESS (0) even if the device is not connected: // ERROR_SUCCESS (0) even if the device is not connected:
// https://stackoverflow.com/questions/23669238/xinputgetkeystroke-returning-error-success-while-controller-is-unplugged // https://stackoverflow.com/questions/23669238/xinputgetkeystroke-returning-error-success-while-controller-is-unplugged

View File

@ -25,12 +25,6 @@ using xe::hid::X_INPUT_KEYSTROKE;
using xe::hid::X_INPUT_STATE; using xe::hid::X_INPUT_STATE;
using xe::hid::X_INPUT_VIBRATION; using xe::hid::X_INPUT_VIBRATION;
constexpr uint32_t XINPUT_FLAG_GAMEPAD = 0x01;
constexpr uint32_t XINPUT_FLAG_KEYBOARD = 0x02;
constexpr uint32_t XINPUT_FLAG_MIC = 0x20; // Based on "karaoke" titles
constexpr uint32_t XINPUT_FLAG_ANYDEVICE = 0xFF;
constexpr uint32_t XINPUT_FLAG_ANY_USER = 1 << 30;
dword_result_t XAutomationpUnbindController_entry(dword_t user_index) { dword_result_t XAutomationpUnbindController_entry(dword_t user_index) {
if (user_index > 4) { if (user_index > 4) {
return 0; return 0;
@ -73,11 +67,6 @@ dword_result_t XamInputGetCapabilitiesEx_entry(
// should trap // should trap
} }
if ((flags & XINPUT_FLAG_ANYDEVICE) && (flags & XINPUT_FLAG_GAMEPAD) == 0) {
// Ignore any query for other types of devices.
return X_ERROR_DEVICE_NOT_CONNECTED;
}
uint32_t actual_user_index = user_index; uint32_t actual_user_index = user_index;
if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) { if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) {
// Always pin user to 0. // Always pin user to 0.
@ -111,11 +100,6 @@ dword_result_t XamInputGetState_entry(dword_t user_index, dword_t flags,
// Games call this with a NULL state ptr, probably as a query. // Games call this with a NULL state ptr, probably as a query.
if ((flags & XINPUT_FLAG_ANYDEVICE) && (flags & XINPUT_FLAG_GAMEPAD) == 0) {
// Ignore any query for other types of devices.
return X_ERROR_DEVICE_NOT_CONNECTED;
}
uint32_t actual_user_index = user_index; uint32_t actual_user_index = user_index;
// chrispy: change this, logic is not right // chrispy: change this, logic is not right
if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) { if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) {
@ -164,11 +148,6 @@ dword_result_t XamInputGetKeystroke_entry(
return X_ERROR_BAD_ARGUMENTS; return X_ERROR_BAD_ARGUMENTS;
} }
if ((flags & XINPUT_FLAG_ANYDEVICE) && (flags & XINPUT_FLAG_GAMEPAD) == 0) {
// Ignore any query for other types of devices.
return X_ERROR_DEVICE_NOT_CONNECTED;
}
uint32_t actual_user_index = user_index; uint32_t actual_user_index = user_index;
if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) { if ((actual_user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) {
// Always pin user to 0. // Always pin user to 0.
@ -189,11 +168,6 @@ dword_result_t XamInputGetKeystrokeEx_entry(
return X_ERROR_BAD_ARGUMENTS; return X_ERROR_BAD_ARGUMENTS;
} }
if ((flags & XINPUT_FLAG_ANYDEVICE) && (flags & XINPUT_FLAG_GAMEPAD) == 0) {
// Ignore any query for other types of devices.
return X_ERROR_DEVICE_NOT_CONNECTED;
}
uint32_t user_index = *user_index_ptr; uint32_t user_index = *user_index_ptr;
auto input_system = kernel_state()->emulator()->input_system(); auto input_system = kernel_state()->emulator()->input_system();
auto lock = input_system->lock(); auto lock = input_system->lock();

View File

@ -539,6 +539,12 @@ enum class XDeploymentType : uint32_t {
kUnknown = 0xFF, kUnknown = 0xFF,
}; };
constexpr uint32_t XINPUT_FLAG_GAMEPAD = 0x01;
constexpr uint32_t XINPUT_FLAG_KEYBOARD = 0x02;
constexpr uint32_t XINPUT_FLAG_MIC = 0x20; // Based on "karaoke" titles
constexpr uint32_t XINPUT_FLAG_ANYDEVICE = 0xFF;
constexpr uint32_t XINPUT_FLAG_ANY_USER = 1 << 30;
} // namespace xe } // namespace xe
// clang-format on // clang-format on

2
third_party/FFmpeg vendored

@ -1 +1 @@
Subproject commit a437fe6d8efef17c8ad33d39f5815032e7adf5d7 Subproject commit a14f5c03834a79fc401626a4dad7a58a2da0c445

@ -1 +1 @@
Subproject commit 44d72a9b36702f093dd20815561a56778b2d181e Subproject commit 4451f6ab13dda98bf255a7cd7b4d120132dc0dfd

@ -1 +1 @@
Subproject commit 46dc0f6e514f5730784bb2cac2a7c731636839e8 Subproject commit c6391a7b8cd57e79ce6b6c832c8e3043c4d9967b

@ -1 +1 @@
Subproject commit 19b940e864bd3a5afb3c79e3c6788869d01a19eb Subproject commit 1c35ba99ce775f8342d87a83a3f0f696f99c2a39

2
third_party/aes_128 vendored

@ -1 +1 @@
Subproject commit b5b7f559cf4b1acbb506a7a8752bbe4adfdc3274 Subproject commit 7e3ac3bb6b478187472b4ac6f1698eb203e8e90b

@ -1 +1 @@
Subproject commit 097c04d9413c59a58b00d4d1c8d5dc0ac158ffaa Subproject commit af1ed2fb3d9d67926389a71e12531bef76f50482

2
third_party/catch vendored

@ -1 +1 @@
Subproject commit 62fd660583d3ae7a7886930b413c3c570e89786c Subproject commit ee1450f268dfd5c13aa8670ba97e93cabaf2e15d

2
third_party/cxxopts vendored

@ -1 +1 @@
Subproject commit 3bf268481da8208d171d8908e6491459de3651d7 Subproject commit 63d1b65a694cfceafc20863afa75df49dfbe6b2a

2
third_party/date vendored

@ -1 +1 @@
Subproject commit 9ea5654c1206e19245dc21d8a2c433e090c8c3f5 Subproject commit 51ce7e131079c061533d741be5fe7cca57f2faac

@ -1 +1 @@
Subproject commit eff23a770a07c3574cb48f299736c461c576286b Subproject commit 963aa9f3e5ce81a4682c6ca3d136cddda614db33

2
third_party/imgui vendored

@ -1 +1 @@
Subproject commit 81160fee56027226bc80b48e196d0332f5541a8c Subproject commit 1ebb91382757777382b3629ced2a573996e46453

View File

@ -21,8 +21,8 @@ project("imgui")
"imgui/imconfig.h", "imgui/imconfig.h",
"imgui/imgui.cpp", "imgui/imgui.cpp",
"imgui/imgui.h", "imgui/imgui.h",
"imgui/imgui_draw.cpp",
"imgui/imgui_demo.cpp", "imgui/imgui_demo.cpp",
"imgui/imgui_draw.cpp",
"imgui/imgui_internal.h", "imgui/imgui_internal.h",
"imgui/imgui_tables.cpp", "imgui/imgui_tables.cpp",
"imgui/imgui_widgets.cpp", "imgui/imgui_widgets.cpp",

@ -1 +1 @@
Subproject commit e6132d3f7877f9ad361c634db35b708c41075e3a Subproject commit 35a6955410a34840c9d091f071c46cd3e5280fb7

@ -1 +1 @@
Subproject commit 7e87d8cac42a03c323d06c8414d2afddd21788f2 Subproject commit a98b85e663114b8fdc9c0dc03abf22c296f38241

@ -1 +1 @@
Subproject commit d87b698d0fcc10a5f632ecbc80a9cb2a8fa094a5 Subproject commit 7c73dd7de7c4f14379b781418c6e947ad464c818

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2015-2016 Baldur Karlsson * Copyright (c) 2019-2024 Baldur Karlsson
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -24,27 +24,55 @@
#pragma once #pragma once
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// 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)
#include <stdint.h> #include <stdint.h>
#endif #endif
#if defined(WIN32) #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
#define RENDERDOC_CC __cdecl #define RENDERDOC_CC __cdecl
#elif defined(__linux__) #elif defined(__linux__) || defined(__FreeBSD__)
#define RENDERDOC_CC #define RENDERDOC_CC
#elif defined(__APPLE__)
#define RENDERDOC_CC
#else #else
#error "Unknown platform" #error "Unknown platform"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
//////////////////////////////////////////////////////////////////////////////////////////////////
// Constants not used directly in below API
// This is a GUID/magic value used for when applications pass a path where shader debug
// information can be found to match up with a stripped shader.
// the define can be used like so: const GUID RENDERDOC_ShaderDebugMagicValue =
// RENDERDOC_ShaderDebugMagicValue_value
#define RENDERDOC_ShaderDebugMagicValue_struct \
{ \
0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff \
}
// as an alternative when you want a byte array (assuming x86 endianness):
#define RENDERDOC_ShaderDebugMagicValue_bytearray \
{ \
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):
#define RENDERDOC_ShaderDebugMagicValue_truncated 0x48656670eab25520ULL
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// RenderDoc capture options // RenderDoc capture options
// //
typedef enum typedef enum RENDERDOC_CaptureOption
{ {
// Allow the application to enable vsync // Allow the application to enable vsync
// //
@ -67,9 +95,10 @@ typedef enum
// Default - disabled // Default - disabled
// //
// 1 - Enable built-in API debugging features and records the results into // 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 // 0 - no API debugging is forcibly enabled
eRENDERDOC_Option_DebugDeviceMode = 2, eRENDERDOC_Option_APIValidation = 2,
eRENDERDOC_Option_DebugDeviceMode = 2, // deprecated name of this enum
// Capture CPU callstacks for API events // Capture CPU callstacks for API events
// //
@ -79,15 +108,16 @@ typedef enum
// 0 - no callstacks are captured // 0 - no callstacks are captured
eRENDERDOC_Option_CaptureCallstacks = 3, eRENDERDOC_Option_CaptureCallstacks = 3,
// When capturing CPU callstacks, only capture them from drawcalls. // When capturing CPU callstacks, only capture them from actions.
// This option does nothing without the above option being enabled // This option does nothing without the above option being enabled
// //
// Default - disabled // Default - disabled
// //
// 1 - Only captures callstacks for drawcall type API events. // 1 - Only captures callstacks for actions.
// Ignored if CaptureCallstacks is disabled // Ignored if CaptureCallstacks is disabled
// 0 - Callstacks, if enabled, are captured for every event. // 0 - Callstacks, if enabled, are captured for every event.
eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4, eRENDERDOC_Option_CaptureCallstacksOnlyDraws = 4,
eRENDERDOC_Option_CaptureCallstacksOnlyActions = 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.
@ -98,15 +128,24 @@ typedef enum
// //
eRENDERDOC_Option_DelayForDebugger = 5, eRENDERDOC_Option_DelayForDebugger = 5,
// Verify any writes to mapped buffers, by checking the memory after the // Verify buffer access. This includes checking the memory returned by a Map() call to
// bounds of the returned pointer to detect any modification. // detect any out-of-bounds modification, as well as initialising buffers with undefined contents
// 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
// not do the same kind of interception & checking and undefined contents are really undefined.
// //
// Default - disabled // Default - disabled
// //
// 1 - Verify any writes to mapped buffers // 1 - Verify buffer access
// 0 - No verification is performed, and overwriting bounds may cause // 0 - No verification is performed, and overwriting bounds may cause crashes or corruption in
// crashes or corruption in RenderDoc // RenderDoc.
eRENDERDOC_Option_VerifyMapWrites = 6, eRENDERDOC_Option_VerifyBufferAccess = 6,
// The old name for eRENDERDOC_Option_VerifyBufferAccess was eRENDERDOC_Option_VerifyMapWrites.
// This option now controls the filling of uninitialised buffers with 0xdddddddd which was
// previously always enabled
eRENDERDOC_Option_VerifyMapWrites = eRENDERDOC_Option_VerifyBufferAccess,
// Hooks any system API calls that create child processes, and injects // Hooks any system API calls that create child processes, and injects
// RenderDoc into them recursively with the same options. // RenderDoc into them recursively with the same options.
@ -117,16 +156,20 @@ typedef enum
// 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 logfile 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
// //
// 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 // and available for inspection
// 0 - only the resources referenced by the captured frame are included // 0 - only the resources referenced by the captured frame are included
eRENDERDOC_Option_RefAllResources = 8, eRENDERDOC_Option_RefAllResources = 8,
// **NOTE**: As of RenderDoc v1.1 this option has been deprecated. Setting or
// getting it will be ignored, to allow compatibility with older versions.
// In v1.1 the option acts as if it's always enabled.
//
// By default RenderDoc skips saving initial states for resources where the // By default RenderDoc skips saving initial states for resources where the
// previous contents don't appear to be used, assuming that writes before // previous contents don't appear to be used, assuming that writes before
// reads indicate previous contents aren't used. // reads indicate previous contents aren't used.
@ -145,7 +188,7 @@ typedef enum
// 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.
// //
// Note this is only true for APIs where multithreading is difficult or // NOTE: This is only true for APIs where multithreading is difficult or
// discouraged. Newer APIs like Vulkan and D3D12 will ignore this option // discouraged. Newer APIs like Vulkan and D3D12 will ignore this option
// and always capture all command lists since the API is heavily oriented // and always capture all command lists since the API is heavily oriented
// around it and the overheads have been reduced by API design. // around it and the overheads have been reduced by API design.
@ -155,7 +198,7 @@ typedef enum
// the period when a frame capture is in progress. // the period when a frame capture is in progress.
eRENDERDOC_Option_CaptureAllCmdLists = 10, eRENDERDOC_Option_CaptureAllCmdLists = 10,
// Mute API debugging output when the debug device mode option is enabled // Mute API debugging output when the API validation mode option is enabled
// //
// Default - enabled // Default - enabled
// //
@ -163,26 +206,48 @@ typedef enum
// 0 - API debugging is displayed as normal // 0 - API debugging is displayed as normal
eRENDERDOC_Option_DebugOutputMute = 11, eRENDERDOC_Option_DebugOutputMute = 11,
// Option to allow vendor extensions to be used even when they may be
// incompatible with RenderDoc and cause corrupted replays or crashes.
//
// Default - inactive
//
// No values are documented, this option should only be used when absolutely
// necessary as directed by a RenderDoc developer.
eRENDERDOC_Option_AllowUnsupportedVendorExtensions = 12,
// Define a soft memory limit which some APIs may aim to keep overhead under where
// possible. Anything above this limit will where possible be saved directly to disk during
// capture.
// This will cause increased disk space use (which may cause a capture to fail if disk space is
// exhausted) as well as slower capture times.
//
// Not all memory allocations may be deferred like this so it is not a guarantee of a memory
// limit.
//
// Units are in MBs, suggested values would range from 200MB to 1000MB.
//
// Default - 0 Megabytes
eRENDERDOC_Option_SoftMemoryLimit = 13,
} RENDERDOC_CaptureOption; } RENDERDOC_CaptureOption;
// Sets an option that controls how RenderDoc behaves on capture. // Sets an option that controls how RenderDoc behaves on capture.
// //
// 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)(RENDERDOC_CaptureOption opt, uint32_t val);
typedef int (RENDERDOC_CC *pRENDERDOC_SetCaptureOptionF32)(RENDERDOC_CaptureOption opt, float 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 typedef enum RENDERDOC_InputButton
{ {
// '0' - '9' matches ASCII values // '0' - '9' matches ASCII values
eRENDERDOC_Key_0 = 0x30, eRENDERDOC_Key_0 = 0x30,
@ -264,14 +329,14 @@ typedef enum
// 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 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,
@ -286,11 +351,8 @@ typedef enum
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_Default = (eRENDERDOC_Overlay_Enabled | eRENDERDOC_Overlay_FrameRate |
(eRENDERDOC_Overlay_Enabled| eRENDERDOC_Overlay_FrameNumber | eRENDERDOC_Overlay_CaptureList),
eRENDERDOC_Overlay_FrameRate|
eRENDERDOC_Overlay_FrameNumber|
eRENDERDOC_Overlay_CaptureList),
// Enable all bits // Enable all bits
eRENDERDOC_Overlay_All = ~0U, eRENDERDOC_Overlay_All = ~0U,
@ -300,28 +362,32 @@ typedef enum
} RENDERDOC_OverlayBits; } RENDERDOC_OverlayBits;
// returns the overlay bits that have been set // returns the overlay bits that have been set
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetOverlayBits)(); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetOverlayBits)();
// sets the overlay bits with an and & or mask // sets the overlay bits with an and & or mask
typedef void (RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or); typedef void(RENDERDOC_CC *pRENDERDOC_MaskOverlayBits)(uint32_t And, uint32_t Or);
// this function will attempt to shut down RenderDoc. // this function will attempt to remove RenderDoc's hooks in the application.
// //
// Note: that this will only work correctly if done immediately after // Note: that this can only work correctly if done immediately after
// the dll is loaded, before any API work happens. RenderDoc will remove its // the module is loaded, before any API work happens. RenderDoc will remove its
// injected hooks and shut down. Behaviour is undefined if this is called // injected hooks and shut down. Behaviour is undefined if this is called
// after any API functions have been called. // after any API functions have been called, and there is still no guarantee of
typedef void (RENDERDOC_CC *pRENDERDOC_Shutdown)(); // success.
typedef void(RENDERDOC_CC *pRENDERDOC_RemoveHooks)();
// DEPRECATED: compatibility for code compiled against pre-1.4.1 headers.
typedef pRENDERDOC_RemoveHooks pRENDERDOC_Shutdown;
// This function will unload RenderDoc's crash handler. // This function will unload RenderDoc's crash handler.
// //
// If you use your own crash handler and don't want RenderDoc's handler to // If you use your own crash handler and don't want RenderDoc's handler to
// intercede, you can call this function to unload it and any unhandled // intercede, you can call this function to unload it and any unhandled
// exceptions will pass to the next handler. // exceptions will pass to the next handler.
typedef void (RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); 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. // 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
@ -332,23 +398,27 @@ typedef void (RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)();
// //
// Example: // Example:
// //
// SetLogFilePathTemplate("my_captures/example"); // SetCaptureFilePathTemplate("my_captures/example");
// //
// 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_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_GetLogFilePathTemplate)(); typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)();
// DEPRECATED: compatibility for code compiled against pre-1.1.2 headers.
typedef pRENDERDOC_SetCaptureFilePathTemplate pRENDERDOC_SetLogFilePathTemplate;
typedef pRENDERDOC_GetCaptureFilePathTemplate pRENDERDOC_GetLogFilePathTemplate;
// returns the number of captures that have been made // returns the number of captures that have been made
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); 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.
// //
// logfile 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 string
// pathlength will be written with the length in bytes of the logfile 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.
@ -357,30 +427,55 @@ typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetNumCaptures)();
// If the index is invalid, the values will be unchanged // 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
// logfile path may not exist anymore. // capture path may not exist anymore.
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfile, uint32_t *pathlength, uint64_t *timestamp); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *filename,
uint32_t *pathlength, uint64_t *timestamp);
// capture the next frame on whichever window and API is currently considered active // Sets the comments associated with a capture file. These comments are displayed in the
typedef void (RENDERDOC_CC *pRENDERDOC_TriggerCapture)(); // UI program when opening.
//
// filePath should be a path to the capture file to add comments to. If set to NULL or ""
// the most recent capture file created made will be used instead.
// comments should be a NULL-terminated UTF-8 string to add as comments.
//
// Any existing comments will be overwritten.
typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFileComments)(const char *filePath,
const char *comments);
// returns 1 if the RenderDoc UI is connected to this application, 0 otherwise // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_IsRemoteAccessConnected)(); 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 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 injected
// into the running application. // into the running application.
// //
// if connectRemoteAccess 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 parameter
// to connect to this application // to connect to this application
// cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open // cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open
// if cmdline is NULL, the command line will be empty. // if cmdline is NULL, the command line 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 connectRemoteAccess, const char *cmdline); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTargetControl,
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 be
// ignored and the others will be filled out. // 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);
// Requests that the replay UI show itself (if hidden or not the current top window). This can be
// used in conjunction with IsTargetControlConnected and LaunchReplayUI to intelligently handle
// showing the UI after making a capture.
//
// This will return 1 if the request was successfully passed on, though it's not guaranteed that
// the UI will be on top in all cases depending on OS rules. It will return 0 if there is no current
// target control connection to make such a request, or if there was another error
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_ShowReplayUI)();
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Capturing functions // Capturing functions
@ -389,16 +484,32 @@ typedef void (RENDERDOC_CC *pRENDERDOC_GetAPIVersion)(int *major, int *minor, in
// A device pointer is a pointer to the API's root handle. // A device pointer is a pointer to the API's root handle.
// //
// This would be an ID3D11Device, HGLRC/GLXContext, ID3D12Device, etc // This would be an ID3D11Device, HGLRC/GLXContext, ID3D12Device, etc
typedef void* RENDERDOC_DevicePointer; typedef void *RENDERDOC_DevicePointer;
// A window handle is the OS's native window handle // A window handle is the OS's native window handle
// //
// This would be an HWND, GLXDrawable, etc // This would be an HWND, GLXDrawable, etc
typedef void* RENDERDOC_WindowHandle; typedef void *RENDERDOC_WindowHandle;
// 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.
//
// Specifically, the value needed is the dispatch table pointer, which sits as the first
// pointer-sized object in the memory pointed to by the VkInstance. Thus we cast to a void** and
// indirect once.
#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 will
// respond to keypresses. Neither parameter can be NULL // respond to keypresses. Neither parameter can be NULL
typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device, RENDERDOC_WindowHandle wndHandle); typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle);
// capture the next frame on whichever window and API is currently considered active
typedef void(RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
// capture the next N frames on whichever window and API is currently considered active
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 NULL.
// Passing NULL specifies a 'wildcard' match against anything. This allows you to specify // Passing NULL specifies a 'wildcard' match against anything. This allows you to specify
@ -418,17 +529,36 @@ typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer
// //
// The results are undefined (including crashes) if two captures are started overlapping, // The results are undefined (including crashes) if two captures are started overlapping,
// even on separate devices and/oror windows. // even on separate devices and/oror windows.
typedef void (RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(RENDERDOC_DevicePointer device, RENDERDOC_WindowHandle wndHandle); typedef void(RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(RENDERDOC_DevicePointer device,
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.
// //
// This will return 1 if a capture is ongoing, and 0 if there is no capture running // This will return 1 if a capture is ongoing, and 0 if there is no capture running
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_IsFrameCapturing)(); 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 capturing.
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePointer device, RENDERDOC_WindowHandle wndHandle); typedef uint32_t(RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle);
// 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
// was in progress
typedef uint32_t(RENDERDOC_CC *pRENDERDOC_DiscardFrameCapture)(RENDERDOC_DevicePointer device,
RENDERDOC_WindowHandle wndHandle);
// Only valid to be called between a call to StartFrameCapture and EndFrameCapture. Gives a custom
// title to the capture produced which will be displayed in the UI.
//
// If multiple captures are ongoing, this title will be applied to the first capture to end after
// this call. The second capture to end will have no title, unless this function is called again.
//
// Calling this function has no effect if no capture is currently running, and if it is called
// multiple times only the last title will be used.
typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureTitle)(const char *title);
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// RenderDoc API versions // RenderDoc API versions
@ -443,10 +573,21 @@ typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePoin
// 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 requested.
// e.g. if you are running against a newer RenderDoc that supports 1.0.1, it will be returned // e.g. if you are running against a newer RenderDoc that supports 1.0.1, it will be returned
// instead of 1.0.0. You can check this with the GetAPIVersion entry point // instead of 1.0.0. You can check this with the GetAPIVersion entry point
typedef enum 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
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
eRENDERDOC_API_Version_1_2_0 = 10200, // RENDERDOC_API_1_2_0 = 1 02 00
eRENDERDOC_API_Version_1_3_0 = 10300, // RENDERDOC_API_1_3_0 = 1 03 00
eRENDERDOC_API_Version_1_4_0 = 10400, // RENDERDOC_API_1_4_0 = 1 04 00
eRENDERDOC_API_Version_1_4_1 = 10401, // RENDERDOC_API_1_4_1 = 1 04 01
eRENDERDOC_API_Version_1_4_2 = 10402, // RENDERDOC_API_1_4_2 = 1 04 02
eRENDERDOC_API_Version_1_5_0 = 10500, // RENDERDOC_API_1_5_0 = 1 05 00
eRENDERDOC_API_Version_1_6_0 = 10600, // RENDERDOC_API_1_6_0 = 1 06 00
} RENDERDOC_Version; } RENDERDOC_Version;
// API version changelog: // API version changelog:
@ -454,9 +595,31 @@ typedef enum
// 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.1.0 - Add feature: TriggerMultiFrameCapture(). Backwards compatible with 1.0.x since the new
// 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.
// 1.2.0 - Added feature: SetCaptureFileComments() to add comments to a capture file that will be
// displayed in the UI program on load.
// 1.3.0 - Added feature: New capture option eRENDERDOC_Option_AllowUnsupportedVendorExtensions
// which allows users to opt-in to allowing unsupported vendor extensions to function.
// Should be used at the user's own risk.
// Refactor: Renamed eRENDERDOC_Option_VerifyMapWrites to
// eRENDERDOC_Option_VerifyBufferAccess, which now also controls initialisation to
// 0xdddddddd of uninitialised buffer contents.
// 1.4.0 - Added feature: DiscardFrameCapture() to discard a frame capture in progress and stop
// capturing without saving anything to disk.
// 1.4.1 - Refactor: Renamed Shutdown to RemoveHooks to better clarify what is happening
// 1.4.2 - Refactor: Renamed 'draws' to 'actions' in callstack capture option.
// 1.5.0 - Added feature: ShowReplayUI() to request that the replay UI show itself if connected
// 1.6.0 - Added feature: SetCaptureTitle() which can be used to set a title for a
// capture made with StartFrameCapture() or EndFrameCapture()
// eRENDERDOC_API_Version_1_0_1 typedef struct RENDERDOC_API_1_6_0
typedef struct
{ {
pRENDERDOC_GetAPIVersion GetAPIVersion; pRENDERDOC_GetAPIVersion GetAPIVersion;
@ -472,18 +635,46 @@ typedef struct
pRENDERDOC_GetOverlayBits GetOverlayBits; pRENDERDOC_GetOverlayBits GetOverlayBits;
pRENDERDOC_MaskOverlayBits MaskOverlayBits; pRENDERDOC_MaskOverlayBits MaskOverlayBits;
// Shutdown was renamed to RemoveHooks in 1.4.1.
// These unions allow old code to continue compiling without changes
union
{
pRENDERDOC_Shutdown Shutdown; pRENDERDOC_Shutdown Shutdown;
pRENDERDOC_RemoveHooks RemoveHooks;
};
pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; pRENDERDOC_UnloadCrashHandler UnloadCrashHandler;
// Get/SetLogFilePathTemplate was renamed to Get/SetCaptureFilePathTemplate in 1.1.2.
// These unions allow old code to continue compiling without changes
union
{
// deprecated name
pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate; pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate;
// current name
pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate;
};
union
{
// deprecated name
pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate; pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate;
// current name
pRENDERDOC_GetCaptureFilePathTemplate GetCaptureFilePathTemplate;
};
pRENDERDOC_GetNumCaptures GetNumCaptures; pRENDERDOC_GetNumCaptures GetNumCaptures;
pRENDERDOC_GetCapture GetCapture; pRENDERDOC_GetCapture GetCapture;
pRENDERDOC_TriggerCapture TriggerCapture; pRENDERDOC_TriggerCapture TriggerCapture;
// IsRemoteAccessConnected was renamed to IsTargetControlConnected in 1.1.1.
// This union allows old code to continue compiling without changes
union
{
// deprecated name
pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected; pRENDERDOC_IsRemoteAccessConnected IsRemoteAccessConnected;
// current name
pRENDERDOC_IsTargetControlConnected IsTargetControlConnected;
};
pRENDERDOC_LaunchReplayUI LaunchReplayUI; pRENDERDOC_LaunchReplayUI LaunchReplayUI;
pRENDERDOC_SetActiveWindow SetActiveWindow; pRENDERDOC_SetActiveWindow SetActiveWindow;
@ -491,9 +682,35 @@ typedef struct
pRENDERDOC_StartFrameCapture StartFrameCapture; pRENDERDOC_StartFrameCapture StartFrameCapture;
pRENDERDOC_IsFrameCapturing IsFrameCapturing; pRENDERDOC_IsFrameCapturing IsFrameCapturing;
pRENDERDOC_EndFrameCapture EndFrameCapture; pRENDERDOC_EndFrameCapture EndFrameCapture;
} RENDERDOC_API_1_0_1;
typedef RENDERDOC_API_1_0_1 RENDERDOC_API_1_0_0; // new function in 1.1.0
pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture;
// new function in 1.2.0
pRENDERDOC_SetCaptureFileComments SetCaptureFileComments;
// new function in 1.4.0
pRENDERDOC_DiscardFrameCapture DiscardFrameCapture;
// new function in 1.5.0
pRENDERDOC_ShowReplayUI ShowReplayUI;
// new function in 1.6.0
pRENDERDOC_SetCaptureTitle SetCaptureTitle;
} RENDERDOC_API_1_6_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_1;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_0_2;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_1;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_1_2;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_2_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_3_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_0;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_1;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_4_2;
typedef RENDERDOC_API_1_6_0 RENDERDOC_API_1_5_0;
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// RenderDoc API entry point // RenderDoc API entry point
@ -517,7 +734,7 @@ typedef RENDERDOC_API_1_0_1 RENDERDOC_API_1_0_0;
// 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 requested
// 0 - if the requested version is not supported or the arguments are invalid. // 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"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit d553e59755b52f3abcbab432e630bcf43005ebdc Subproject commit 3a58301067bbc03da89ae5a51b3e05b7da719d38

2
third_party/xbyak vendored

@ -1 +1 @@
Subproject commit 63e6ee92cc906a3dbf6b333b2fd51ac1ca95f891 Subproject commit ccdf68421bc8eb85693f573080fc0a5faad862db

2
third_party/xxhash vendored

@ -1 +1 @@
Subproject commit bbb27a5efb85b92a0486cf361a8635715a53f6ba Subproject commit 3e321b4407318ac1348c0b80fb6fbae8c81ad5fa

@ -1 +1 @@
Subproject commit d2c717730092c7bf8cbb033b12fd4001b7c4d932 Subproject commit b467f7aa342895e66a1a003377ed63b3c1be3de3

2
third_party/zstd vendored

@ -1 +1 @@
Subproject commit 7806d803383b75b00868a5367154a18caf535a92 Subproject commit 20707e3718ee14250fb8a44b3bf023ea36bd88df