Remove GGP support

This commit is contained in:
Aliya Pazylbekova
2024-07-08 14:19:42 +01:00
committed by Jake Turner
parent aa5538b2e9
commit 9ebd796cd8
39 changed files with 13 additions and 1683 deletions
+1 -22
View File
@@ -208,7 +208,6 @@ option(ENABLE_PYRENDERDOC "Enable renderdoc python modules" ON)
option(ENABLE_XLIB "Enable xlib windowing support" ON)
option(ENABLE_XCB "Enable xcb windowing support" ON)
option(ENABLE_UNSUPPORTED_EXPERIMENTAL_POSSIBLY_BROKEN_WAYLAND "Enable EXPERIMENTAL, POSSIBLY BROKEN, UNSUPPORTED wayland windowing support" OFF)
option(ENABLE_GGP "Enable GGP support" OFF)
option(ENABLE_ASAN "Enable address sanitizer" OFF)
option(ENABLE_TSAN "Enable thread sanitizer" OFF)
@@ -307,20 +306,6 @@ if(ANDROID)
message(STATUS "Using Android native API level ${ANDROID_NATIVE_API_LEVEL}")
endif()
if(ENABLE_GGP)
message(STATUS "Disabling GL, GLES driver on ggp")
set(ENABLE_GL OFF CACHE BOOL "" FORCE)
set(ENABLE_GLES OFF CACHE BOOL "" FORCE)
set(ENABLE_EGL OFF CACHE BOOL "" FORCE)
# GGP doesn't support the Qt UI
message(STATUS "Disabling qrenderdoc for ggp build")
set(ENABLE_QRENDERDOC OFF CACHE BOOL "" FORCE)
message(STATUS "Disabling renderdoc python modules for ggp build")
set(ENABLE_PYRENDERDOC OFF CACHE BOOL "" FORCE)
endif()
if(ENABLE_GLES AND NOT ENABLE_EGL)
message(FATAL_ERROR "EGL is required for GLES")
endif()
@@ -397,9 +382,6 @@ endif ()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
if(ENABLE_GGP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gline-tables-only -fno-omit-frame-pointer")
endif()
set(warning_flags
-Wall
@@ -462,9 +444,6 @@ if(ANDROID)
add_definitions(-DRENDERDOC_PLATFORM_ANDROID)
elseif(APPLE)
add_definitions(-DRENDERDOC_PLATFORM_APPLE)
elseif(ENABLE_GGP)
add_definitions(-DRENDERDOC_PLATFORM_GGP)
add_definitions(-DRENDERDOC_WINDOWING_GGP)
elseif(UNIX)
add_definitions(-DRENDERDOC_PLATFORM_LINUX)
@@ -540,7 +519,7 @@ if(ENABLE_METAL)
message(STATUS " - Metal")
endif()
if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT ENABLE_GGP)
if(UNIX AND NOT ANDROID AND NOT APPLE)
message(STATUS "Enabled Window System Support:")
if(ENABLE_XLIB)
Regular → Executable
View File
-1
View File
@@ -30,7 +30,6 @@ Window Configuration
.. autofunction:: renderdoc.CreateXlibWindowingData
.. autofunction:: renderdoc.CreateXCBWindowingData
.. autofunction:: renderdoc.CreateWaylandWindowingData
.. autofunction:: renderdoc.CreateGgpWindowingData
.. autofunction:: renderdoc.CreateAndroidWindowingData
.. autofunction:: renderdoc.CreateMacOSWindowingData
-7
View File
@@ -1053,8 +1053,6 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const Repla
#elif defined(RENDERDOC_PLATFORM_APPLE)
m_CurWinSystem = WindowingSystem::MacOS;
#elif defined(RENDERDOC_PLATFORM_GGP)
m_CurWinSystem = WindowingSystem::GGP;
#endif
m_StructuredFile = &r->GetStructuredFile();
@@ -2198,11 +2196,6 @@ WindowingData CaptureContext::CreateWindowingData(QWidget *window)
return CreateMacOSWindowingData(view, layer);
#elif defined(RENDERDOC_PLATFORM_GGP)
WindowingData ret = {WindowingSystem::GGP};
return ret;
#else
#error "Unknown platform"
-29
View File
@@ -42,14 +42,6 @@ elseif(APPLE)
find_library(METAL_LIBRARY Metal)
list(APPEND RDOC_LIBRARIES PRIVATE ${METAL_LIBRARY})
endif()
elseif(ENABLE_GGP)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
list(APPEND RDOC_LIBRARIES
PRIVATE -lm
PRIVATE -ldl
PRIVATE -lrt)
elseif(UNIX)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
@@ -321,23 +313,6 @@ elseif(APPLE)
os/posix/posix_stringio.cpp
os/posix/posix_threading.cpp
os/posix/posix_specific.h)
elseif(ENABLE_GGP)
list(APPEND sources
data/embedded_files.h
os/posix/ggp/ggp_stringio.cpp
os/posix/ggp/ggp_callstack.cpp
os/posix/ggp/ggp_process.cpp
os/posix/ggp/ggp_threading.cpp
os/posix/ggp/ggp_hook.cpp
os/posix/ggp/ggp_network.cpp
3rdparty/plthook/plthook.h
3rdparty/plthook/plthook_elf.c
os/posix/posix_network.h
os/posix/posix_network.cpp
os/posix/posix_process.cpp
os/posix/posix_stringio.cpp
os/posix/posix_threading.cpp
os/posix/posix_specific.h)
elseif(FREEBSD)
list(APPEND sources
data/embedded_files.h
@@ -655,10 +630,6 @@ if(UNIX AND NOT ANDROID AND NOT APPLE)
set(RDOC_LINK_FLAGS "${RDOC_LINK_FLAGS} -Wl,--no-undefined")
endif()
if(ENABLE_GGP)
set(RDOC_LINK_FLAGS "${RDOC_LINK_FLAGS} -Wl,--hash-style=gnu -Wl,--build-id=sha1")
endif()
if(NOT RELEASE_MODE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/librenderdoc.so-gdb.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/librenderdoc.so-gdb.py)
endif()
+1 -2
View File
@@ -82,8 +82,7 @@
#define RENDERDOC_CC __cdecl
#elif defined(RENDERDOC_PLATFORM_LINUX) || defined(RENDERDOC_PLATFORM_APPLE) || \
defined(RENDERDOC_PLATFORM_ANDROID) || defined(RENDERDOC_PLATFORM_GGP) || \
defined(RENDERDOC_PLATFORM_SWITCH)
defined(RENDERDOC_PLATFORM_ANDROID) || defined(RENDERDOC_PLATFORM_SWITCH)
#define RENDERDOC_EXPORT_API __attribute__((visibility("default"), used))
#define RENDERDOC_IMPORT_API
-14
View File
@@ -173,20 +173,6 @@ inline const WindowingData CreateWaylandWindowingData(wl_display *display, wl_su
return ret;
}
DOCUMENT(R"(Create a :class:`WindowingData` for a GGP application.
:return: A :class:`WindowingData` corresponding to the given system.
:rtype: WindowingData
)");
inline const WindowingData CreateGgpWindowingData()
{
WindowingData ret = {};
ret.system = WindowingSystem::GGP;
return ret;
}
DOCUMENT(R"(Create a :class:`WindowingData` for an Android ``ANativeWindow`` handle.
:param ANativeWindow window: The native ``ANativeWindow`` handle for this window.
-1
View File
@@ -116,7 +116,6 @@ rdcstr DoStringise(const WindowingSystem &el)
STRINGISE_ENUM_CLASS(XCB);
STRINGISE_ENUM_CLASS(Android);
STRINGISE_ENUM_CLASS(MacOS);
STRINGISE_ENUM_CLASS(GGP);
STRINGISE_ENUM_CLASS(Wayland);
}
END_ENUM_STRINGISE();
-5
View File
@@ -4490,10 +4490,6 @@ DOCUMENT(R"(Specifies a windowing system to use for creating an output window.
The windowing data refers to a MacOS / OS X NSView & CALayer that is Metal/GL compatible.
See :func:`CreateMacOSWindowingData`.
.. data:: GGP
The windowing data refers to an GGP surface. See :func:`CreateGgpWindowingData`.
.. data:: Wayland
The windowing data refers to an Wayland window. See :func:`CreateWaylandWindowingData`.
@@ -4507,7 +4503,6 @@ enum class WindowingSystem : uint32_t
XCB,
Android,
MacOS,
GGP,
Wayland,
};
-15
View File
@@ -67,7 +67,6 @@
#define RDOC_LINUX OPTION_OFF
#define RDOC_APPLE OPTION_OFF
#define RDOC_POSIX OPTION_OFF
#define RDOC_GGP OPTION_OFF
#define RDOC_SWITCH OPTION_OFF
#elif defined(RENDERDOC_PLATFORM_ANDROID)
@@ -77,7 +76,6 @@
#define RDOC_LINUX OPTION_OFF
#define RDOC_APPLE OPTION_OFF
#define RDOC_POSIX OPTION_ON
#define RDOC_GGP OPTION_OFF
#define RDOC_SWITCH OPTION_OFF
#elif defined(RENDERDOC_PLATFORM_LINUX)
@@ -87,7 +85,6 @@
#define RDOC_LINUX OPTION_ON
#define RDOC_APPLE OPTION_OFF
#define RDOC_POSIX OPTION_ON
#define RDOC_GGP OPTION_OFF
#define RDOC_SWITCH OPTION_OFF
#elif defined(RENDERDOC_PLATFORM_APPLE)
@@ -97,17 +94,6 @@
#define RDOC_LINUX OPTION_OFF
#define RDOC_APPLE OPTION_ON
#define RDOC_POSIX OPTION_ON
#define RDOC_GGP OPTION_OFF
#define RDOC_SWITCH OPTION_OFF
#elif defined(RENDERDOC_PLATFORM_GGP)
#define RDOC_WIN32 OPTION_OFF
#define RDOC_ANDROID OPTION_OFF
#define RDOC_LINUX OPTION_OFF
#define RDOC_APPLE OPTION_OFF
#define RDOC_POSIX OPTION_ON
#define RDOC_GGP OPTION_ON
#define RDOC_SWITCH OPTION_OFF
#elif defined(RENDERDOC_PLATFORM_SWITCH)
@@ -117,7 +103,6 @@
#define RDOC_LINUX OPTION_OFF
#define RDOC_APPLE OPTION_OFF
#define RDOC_POSIX OPTION_ON
#define RDOC_GGP OPTION_OFF
#define RDOC_SWITCH OPTION_ON
#else
-2
View File
@@ -489,8 +489,6 @@ void RenderDoc::Initialise()
"Android";
#elif ENABLED(RDOC_APPLE)
"macOS";
#elif ENABLED(RDOC_GGP)
"GGP";
#else
"Unknown";
#endif
+1 -1
View File
@@ -68,7 +68,7 @@ AMDCounters::AMDCounters(bool dx12DebugLayerEnabled)
bool AMDCounters::Init(ApiType apiType, void *pContext)
{
#if DISABLED(RDOC_WIN32) && DISABLED(RDOC_LINUX) && DISABLED(RDOC_GGP) && DISABLED(RDOC_ANDROID)
#if DISABLED(RDOC_WIN32) && DISABLED(RDOC_LINUX) && DISABLED(RDOC_ANDROID)
(void)m_dx12DebugLayerEnabled;
return false;
#else
-14
View File
@@ -49,7 +49,6 @@ set(sources
official/vulkan.h
official/vulkan_android.h
official/vulkan_core.h
official/vulkan_ggp.h
official/vulkan_ios.h
official/vulkan_macos.h
official/vulkan_fuchsia.h
@@ -98,19 +97,6 @@ elseif(APPLE)
list(APPEND sources vk_posix.cpp vk_apple.cpp vk_apple_helpers.mm)
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK -DVK_USE_PLATFORM_METAL_EXT)
elseif(ENABLE_GGP)
list(APPEND sources vk_posix.cpp vk_ggp.cpp)
add_definitions(-DVK_USE_PLATFORM_GGP)
set(VULKAN_LAYER_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${LIB_SUBFOLDER_TRAIL_SLASH}lib${RDOC_BASE_NAME}.so")
set(VULKAN_ENABLE_VAR "ENABLE_VULKAN_${RDOC_BASE_NAME_UPPER}_CAPTURE")
set(json_in ${CMAKE_CURRENT_SOURCE_DIR}/renderdoc.json)
set(json_out ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${RDOC_BASE_NAME}_capture.json)
configure_file(${json_in} ${json_out})
install (FILES ${json_out} DESTINATION ${VULKAN_LAYER_FOLDER})
elseif(UNIX)
list(APPEND sources vk_posix.cpp vk_linux.cpp)
+2 -2
View File
@@ -119,8 +119,6 @@ Maintainers can update this file by updating vk.xml in this folder and running `
* `VK_EXT_vertex_input_dynamic_state`
* `VK_EXT_ycbcr_2plane_444_formats`
* `VK_EXT_ycbcr_image_arrays`
* `VK_GGP_frame_token`
* `VK_GGP_stream_descriptor_surface`
* `VK_GOOGLE_decorate_string`
* `VK_GOOGLE_display_timing`
* `VK_GOOGLE_hlsl_functionality1`
@@ -456,6 +454,8 @@ These are expected to never be implemented in their current form.
* `VK_AMD_draw_indirect_count`
* `VK_AMDX_shader_enqueue`
* `VK_GGP_frame_token`
* `VK_GGP_stream_descriptor_surface`
* `VK_KHR_video_encode_queue`
* `VK_EXT_video_encode_h264`
* `VK_EXT_video_encode_h265`
@@ -151,9 +151,6 @@
<ClCompile Include="vk_android.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vk_ggp.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vk_resources.cpp" />
<ClCompile Include="vk_acceleration_structure.cpp" />
<ClCompile Include="wrappers\vk_cmd_funcs.cpp" />
@@ -176,7 +173,6 @@
<ClInclude Include="official\vulkan_android.h" />
<ClInclude Include="official\vulkan_core.h" />
<ClInclude Include="official\vulkan_fuchsia.h" />
<ClInclude Include="official\vulkan_ggp.h" />
<ClInclude Include="official\vulkan_ios.h" />
<ClInclude Include="official\vulkan_macos.h" />
<ClInclude Include="official\vulkan_metal.h" />
@@ -88,9 +88,6 @@
<ClCompile Include="vk_linux.cpp">
<Filter>OS\Posix</Filter>
</ClCompile>
<ClCompile Include="vk_ggp.cpp">
<Filter>OS\Posix</Filter>
</ClCompile>
<ClCompile Include="vk_layer_android.cpp">
<Filter>OS\Posix</Filter>
</ClCompile>
@@ -213,9 +210,6 @@
<ClInclude Include="official\vulkan_core.h">
<Filter>official</Filter>
</ClInclude>
<ClInclude Include="official\vulkan_ggp.h">
<Filter>official</Filter>
</ClInclude>
<ClInclude Include="official\vulkan_ios.h">
<Filter>official</Filter>
</ClInclude>
@@ -243,9 +237,6 @@
<ClInclude Include="official\vulkan_fuchsia.h">
<Filter>official</Filter>
</ClInclude>
<ClInclude Include="official\vulkan_ggp.h">
<Filter>official</Filter>
</ClInclude>
<ClInclude Include="official\vulkan_metal.h">
<Filter>official</Filter>
</ClInclude>
-7
View File
@@ -2178,13 +2178,6 @@ DECLARE_DESERIALISE_TYPE(VkExternalFormatANDROID);
DECLARE_DESERIALISE_TYPE(VkAndroidHardwareBufferFormatProperties2ANDROID);
#endif
// GGP only structs
#ifdef VK_USE_PLATFORM_GGP
DECLARE_REFLECTION_STRUCT(VkPresentFrameTokenGGP);
DECLARE_DESERIALISE_TYPE(VkPresentFrameTokenGGP);
#endif
// we add these fake enums so we have a type for type-dispatch in the serialiser. Due to C ABI rules
// the vulkan API doesn't define native 64-bit enums itself
//
-12
View File
@@ -1296,18 +1296,6 @@ static const VkExtensionProperties supportedExtensions[] = {
VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME,
VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION,
},
#ifdef VK_GGP_frame_token
{
VK_GGP_FRAME_TOKEN_EXTENSION_NAME,
VK_GGP_FRAME_TOKEN_SPEC_VERSION,
},
#endif
#ifdef VK_GGP_stream_descriptor_surface
{
VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME,
VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION,
},
#endif
{
VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME,
VK_GOOGLE_DECORATE_STRING_SPEC_VERSION,
-6
View File
@@ -2106,12 +2106,6 @@ public:
#endif
#if defined(VK_USE_PLATFORM_GGP)
VkResult vkCreateStreamDescriptorSurfaceGGP(VkInstance instance,
const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo,
const VkAllocationCallbacks *, VkSurfaceKHR *pSurface);
#endif
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
// VK_KHR_wayland_surface
VkResult vkCreateWaylandSurfaceKHR(VkInstance instance,
@@ -185,11 +185,6 @@ struct VkInstDispatchTable
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// VK_GGP_stream_descriptor_surface
#ifdef VK_USE_PLATFORM_GGP
PFN_vkCreateStreamDescriptorSurfaceGGP CreateStreamDescriptorSurfaceGGP;
#endif // VK_USE_PLATFORM_GGP
// VK_NV_external_memory_capabilities
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV;
-95
View File
@@ -1,95 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "vk_core.h"
#include "vk_replay.h"
VkResult WrappedVulkan::vkCreateStreamDescriptorSurfaceGGP(
const VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo,
const VkAllocationCallbacks *, VkSurfaceKHR *pSurface)
{
// should not come in here at all on replay
RDCASSERT(IsCaptureMode(m_State));
VkResult ret = ObjDisp(instance)->CreateStreamDescriptorSurfaceGGP(Unwrap(instance), pCreateInfo,
NULL, pSurface);
if(ret == VK_SUCCESS)
{
GetResourceManager()->WrapResource(Unwrap(instance), *pSurface);
WrappedVkSurfaceKHR *wrapped = GetWrapped(*pSurface);
wrapped->record =
RegisterSurface(WindowingSystem::GGP, (void *)(uintptr_t)pCreateInfo->streamDescriptor);
}
return ret;
}
void VulkanReplay::OutputWindow::SetWindowHandle(WindowingData window)
{
RDCASSERT(window.system == WindowingSystem::GGP, window.system);
return; // there are no OS specific handles to save.
}
void VulkanReplay::OutputWindow::CreateSurface(WrappedVulkan *driver, VkInstance inst)
{
VkStreamDescriptorSurfaceCreateInfoGGP createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP;
createInfo.pNext = NULL;
createInfo.streamDescriptor = 1;
VkResult vkr =
ObjDisp(inst)->CreateStreamDescriptorSurfaceGGP(Unwrap(inst), &createInfo, NULL, &surface);
driver->CheckVkResult(vkr);
return;
}
void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h)
{
if(id == 0 || m_OutputWindows.find(id) == m_OutputWindows.end())
return;
OutputWindow &outw = m_OutputWindows[id];
if(outw.m_WindowSystem == WindowingSystem::Headless)
{
w = outw.width;
h = outw.height;
return;
}
RDCLOG("Window system is GGP (%d), size is %d, %d", outw.m_WindowSystem, outw.width, outw.height);
// No window, specify default resolution.
w = outw.width != 0 ? outw.width : 1920;
h = outw.height != 0 ? outw.height : 1080;
return;
}
void *LoadVulkanLibrary()
{
return Process::LoadModule("libvulkan.so.1");
}
-27
View File
@@ -175,25 +175,6 @@
#define HookInitExtension_PhysDev_Android()
#if defined(VK_USE_PLATFORM_GGP)
#define HookInitExtension_Instance_GGP() \
HookInitExtension(VK_GGP_stream_descriptor_surface, CreateStreamDescriptorSurfaceGGP);
#define HookDefine_GGP() \
HookDefine4(VkResult, vkCreateStreamDescriptorSurfaceGGP, VkInstance, instance, \
const VkStreamDescriptorSurfaceCreateInfoGGP *, pCreateInfo, \
const VkAllocationCallbacks *, pAllocator, VkSurfaceKHR *, pSurface);
#else // defined(VK_USE_PLATFORM_GGP)
#define HookInitExtension_Instance_GGP()
#define HookDefine_GGP()
#endif // defined(VK_USE_PLATFORM_GGP)
#define HookInitExtension_PhysDev_GGP()
#define HookInitExtension_Device_GGP()
#if defined(VK_USE_PLATFORM_XCB_KHR)
#define HookInitExtension_Instance_XCB() \
@@ -445,7 +426,6 @@
DeclExt(KHR_android_surface); \
DeclExt(MVK_macos_surface); \
DeclExt(KHR_surface); \
DeclExt(GGP_stream_descriptor_surface); \
DeclExt(EXT_debug_report); \
DeclExt(KHR_display); \
DeclExt(NV_external_memory_capabilities); \
@@ -467,7 +447,6 @@
DeclExt(EXT_acquire_drm_display); \
/* device extensions */ \
DeclExt(EXT_debug_marker); \
DeclExt(GGP_frame_token); \
DeclExt(KHR_swapchain); \
DeclExt(KHR_display_swapchain); \
DeclExt(NV_external_memory); \
@@ -571,7 +550,6 @@
CheckExt(KHR_android_surface, VKXX); \
CheckExt(MVK_macos_surface, VKXX); \
CheckExt(KHR_surface, VKXX); \
CheckExt(GGP_stream_descriptor_surface, VKXX); \
CheckExt(EXT_debug_report, VKXX); \
CheckExt(KHR_display, VKXX); \
CheckExt(NV_external_memory_capabilities, VKXX); \
@@ -600,7 +578,6 @@
#define CheckDeviceExts() \
CheckExt(EXT_debug_marker, VKXX); \
CheckExt(GGP_frame_token, VKXX); \
CheckExt(KHR_swapchain, VKXX); \
CheckExt(KHR_display_swapchain, VKXX); \
CheckExt(NV_external_memory, VKXX); \
@@ -743,7 +720,6 @@
HookInitExtension(KHR_calibrated_timestamps, GetPhysicalDeviceCalibrateableTimeDomainsKHR); \
HookInitExtension_PhysDev_Win32(); \
HookInitExtension_PhysDev_Linux(); \
HookInitExtension_PhysDev_GGP(); \
HookInitExtension_PhysDev_Android(); \
HookInitExtension_PhysDev_Mac();
@@ -812,7 +788,6 @@
HookInitExtension(KHR_calibrated_timestamps, GetPhysicalDeviceCalibrateableTimeDomainsKHR); \
HookInitExtension_Instance_Win32(); \
HookInitExtension_Instance_Linux(); \
HookInitExtension_Instance_GGP(); \
HookInitExtension_Instance_Android(); \
HookInitExtension_Instance_Mac();
@@ -1059,7 +1034,6 @@
HookInitExtension(KHR_ray_tracing_pipeline, GetRayTracingShaderGroupStackSizeKHR); \
HookInitExtension_Device_Win32(); \
HookInitExtension_Device_Linux(); \
HookInitExtension_Device_GGP(); \
HookInitExtension_Device_Android(); \
HookInitExtension_Device_Mac();
@@ -1961,6 +1935,5 @@
uint32_t, pipelineStackSize); \
HookDefine_Win32(); \
HookDefine_Linux(); \
HookDefine_GGP(); \
HookDefine_Android(); \
HookDefine_Mac();
+2 -31
View File
@@ -813,7 +813,6 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
case VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK: \
case VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK: \
case VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT: \
case VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP: \
case VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN: \
case VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR: \
case VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR: \
@@ -1120,6 +1119,7 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV: \
case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV: \
case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV: \
case VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP: \
case VK_STRUCTURE_TYPE_PUSH_CONSTANTS_INFO_KHR: \
case VK_STRUCTURE_TYPE_PUSH_DESCRIPTOR_SET_INFO_KHR: \
case VK_STRUCTURE_TYPE_PUSH_DESCRIPTOR_SET_WITH_TEMPLATE_INFO_KHR: \
@@ -1153,6 +1153,7 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct,
case VK_STRUCTURE_TYPE_SET_DESCRIPTOR_BUFFER_OFFSETS_INFO_EXT: \
case VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV: \
case VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT: \
case VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP: \
case VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI: \
case VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT: \
case VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT: \
@@ -1722,16 +1723,6 @@ size_t GetNextPatchSize(const void *pNext)
}
#endif
#if ENABLED(RDOC_GGP)
COPY_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP, VkPresentFrameTokenGGP);
#else
case VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP:
{
RDCERR("Support for GGP frame token extension not compiled in");
break;
}
#endif
// NV win32 external memory extensions
#if ENABLED(RDOC_WIN32)
COPY_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV,
@@ -2999,16 +2990,6 @@ void UnwrapNextChain(CaptureState state, const char *structName, byte *&tempMem,
}
#endif
#if ENABLED(RDOC_GGP)
COPY_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP, VkPresentFrameTokenGGP);
#else
case VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP:
{
RDCERR("Support for GGP frame token extension not compiled in");
break;
}
#endif
// NV win32 external memory extensions
#if ENABLED(RDOC_WIN32)
// Structs that can be copied into place
@@ -3328,16 +3309,6 @@ void CopyNextChainForPatching(const char *structName, byte *&tempMem, VkBaseInSt
}
#endif
#if ENABLED(RDOC_GGP)
COPY_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP, VkPresentFrameTokenGGP);
#else
case VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP:
{
RDCERR("Support for GGP frame token extension not compiled in");
break;
}
#endif
// NV win32 external memory extensions
#if ENABLED(RDOC_WIN32)
// Structs that can be copied into place
+1 -19
View File
@@ -59,8 +59,7 @@ void WrappedVulkan::AddRequiredExtensions(bool instance, rdcarray<rdcstr> &exten
#if(defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(VK_USE_PLATFORM_XCB_KHR) || \
defined(VK_USE_PLATFORM_WAYLAND_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || \
defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || \
defined(VK_USE_PLATFORM_GGP))
defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT))
#undef EXPECT_WSI
#define EXPECT_WSI 1
@@ -149,18 +148,6 @@ void WrappedVulkan::AddRequiredExtensions(bool instance, rdcarray<rdcstr> &exten
extensionList.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
#endif
#if defined(VK_USE_PLATFORM_GGP)
// must be supported
RDCASSERT(supportedExtensions.find(VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME) !=
supportedExtensions.end());
m_SupportedWindowSystems.push_back(WindowingSystem::GGP);
// don't add duplicates, application will have added this but just be sure
if(!extensionList.contains(VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME))
extensionList.push_back(VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME);
#endif
#if EXPECT_WSI
// we must have VK_KHR_surface to support WSI at all
if(supportedExtensions.find(VK_KHR_SURFACE_EXTENSION_NAME) == supportedExtensions.end())
@@ -211,11 +198,6 @@ void WrappedVulkan::AddRequiredExtensions(bool instance, rdcarray<rdcstr> &exten
RDCWARN("XLib Output requires the '%s' extension to be present",
VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif
#if defined(VK_USE_PLATFORM_GGP)
RDCWARN("GGP Output requires the '%s' extension to be present",
VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME);
#endif
}
#endif
-5
View File
@@ -119,11 +119,6 @@
#define WINDOW_HANDLE_INIT RDCEraseEl(cocoa);
#elif ENABLED(RDOC_GGP)
#define WINDOW_HANDLE_DECL void *wnd;
#define WINDOW_HANDLE_INIT wnd = NULL;
#else
#error "Unknown platform"
+4 -31
View File
@@ -288,17 +288,6 @@ void DoSerialiseViaResourceId(SerialiserType &ser, type &el)
SERIALISE_VK_HANDLES();
#ifdef VK_USE_PLATFORM_GGP
#define HANDLE_PNEXT_OS_GGP() \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP, VkPresentFrameTokenGGP)
#else
#define HANDLE_PNEXT_OS_GGP() PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP)
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#define HANDLE_PNEXT_OS_WIN32() \
@@ -448,7 +437,6 @@ SERIALISE_VK_HANDLES();
HANDLE_PNEXT_OS_WIN32() \
HANDLE_PNEXT_OS_ANDROID() \
HANDLE_PNEXT_OS_FUCHSIA() \
HANDLE_PNEXT_OS_GGP() \
\
/* Core 1.0 structs. Should never be serialised in a pNext chain */ \
PNEXT_STRUCT(VK_STRUCTURE_TYPE_APPLICATION_INFO, VkApplicationInfo) \
@@ -1485,7 +1473,6 @@ SERIALISE_VK_HANDLES();
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR) \
@@ -2140,7 +2127,10 @@ SERIALISE_VK_HANDLES();
/* VK_VALVE_descriptor_set_host_mapping */ \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE)
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE) \
\
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP) \
PNEXT_UNSUPPORTED(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP)
static const rdcliteral pNextName = "pNext"_lit;
static const rdcliteral pNextTypeName = "pNextType"_lit;
@@ -12943,23 +12933,6 @@ INSTANTIATE_SERIALISE_TYPE(ImageSubresourceRange);
INSTANTIATE_SERIALISE_TYPE(ImageSubresourceStateForRange);
INSTANTIATE_SERIALISE_TYPE(ImageState);
#ifdef VK_USE_PLATFORM_GGP
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VkPresentFrameTokenGGP &el)
{
RDCASSERT(ser.IsReading() || el.sType == VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP);
SerialiseNext(ser, el.sType, el.pNext);
}
template <>
void Deserialise(const VkPresentFrameTokenGGP &el)
{
DeserialiseNext(el.pNext);
}
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, VkImportMemoryWin32HandleInfoNV &el)
-3
View File
@@ -1943,7 +1943,6 @@ rdcstr DoStringise(const VkStructureType &el)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV)
@@ -2105,7 +2104,6 @@ rdcstr DoStringise(const VkStructureType &el)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV)
STRINGISE_ENUM(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV)
@@ -3207,7 +3205,6 @@ rdcstr DoStringise(const VkDriverId &el)
STRINGISE_ENUM(VK_DRIVER_ID_QUALCOMM_PROPRIETARY)
STRINGISE_ENUM(VK_DRIVER_ID_ARM_PROPRIETARY)
STRINGISE_ENUM(VK_DRIVER_ID_GOOGLE_SWIFTSHADER)
STRINGISE_ENUM(VK_DRIVER_ID_GGP_PROPRIETARY)
STRINGISE_ENUM(VK_DRIVER_ID_BROADCOM_PROPRIETARY)
STRINGISE_ENUM(VK_DRIVER_ID_MESA_LLVMPIPE)
STRINGISE_ENUM(VK_DRIVER_ID_MOLTENVK)
@@ -163,8 +163,7 @@ static void StripUnwantedExtensions(rdcarray<rdcstr> &Extensions)
if(ext == "VK_KHR_xlib_surface" || ext == "VK_KHR_xcb_surface" ||
ext == "VK_KHR_wayland_surface" || ext == "VK_KHR_mir_surface" ||
ext == "VK_MVK_macos_surface" || ext == "VK_KHR_android_surface" ||
ext == "VK_KHR_win32_surface" || ext == "VK_GGP_stream_descriptor_surface" ||
ext == "VK_GGP_frame_token")
ext == "VK_KHR_win32_surface")
{
return true;
}
@@ -807,7 +807,6 @@ VkResult WrappedVulkan::vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR
// allowed (and ignored) pNext structs
if(next->sType != VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR &&
next->sType != VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR &&
next->sType != VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP &&
next->sType != VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR &&
next->sType != VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE &&
next->sType != VK_STRUCTURE_TYPE_PRESENT_ID_KHR &&
-326
View File
@@ -1,326 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <execinfo.h>
#include <stdio.h>
#include <string.h>
#include <map>
#include "common/common.h"
#include "common/formatting.h"
#include "os/os_specific.h"
void *renderdocBase = NULL;
void *renderdocEnd = NULL;
class GgpCallstack : public Callstack::Stackwalk
{
public:
GgpCallstack()
{
RDCEraseEl(addrs);
numLevels = 0;
Collect();
}
GgpCallstack(uint64_t *calls, size_t num) { Set(calls, num); }
~GgpCallstack() {}
void Set(uint64_t *calls, size_t num)
{
numLevels = num;
for(size_t i = 0; i < numLevels; i++)
addrs[i] = calls[i];
}
size_t NumLevels() const { return numLevels; }
const uint64_t *GetAddrs() const { return addrs; }
private:
GgpCallstack(const Callstack::Stackwalk &other);
void Collect()
{
void *addrs_ptr[ARRAY_COUNT(addrs)];
numLevels = backtrace(addrs_ptr, ARRAY_COUNT(addrs));
int offs = 0;
// if we want to trim levels of the stack, we can do that here
// by incrementing offs and decrementing numLevels
while(numLevels > 0 && addrs_ptr[offs] >= renderdocBase && addrs_ptr[offs] < renderdocEnd)
{
offs++;
numLevels--;
}
for(size_t i = 0; i < numLevels; i++)
addrs[i] = (uint64_t)addrs_ptr[i + offs];
}
uint64_t addrs[128];
size_t numLevels;
};
namespace Callstack
{
void Init()
{
// look for our own line
FILE *f = FileIO::fopen("/proc/self/maps", FileIO::ReadText);
if(f)
{
while(!feof(f))
{
char line[512] = {0};
if(fgets(line, 511, f))
{
if(strstr(line, "lib" STRINGIZE(RDOC_BASE_NAME)) && strstr(line, "r-xp"))
{
sscanf(line, "%p-%p", &renderdocBase, &renderdocEnd);
break;
}
}
}
FileIO::fclose(f);
}
}
Stackwalk *Collect()
{
return new GgpCallstack();
}
Stackwalk *Create()
{
return new GgpCallstack(NULL, 0);
}
bool GetLoadedModules(byte *buf, size_t &size)
{
// we just dump the whole file rather than pre-parsing, that way we can improve
// parsing without needing to recapture
FILE *f = FileIO::fopen("/proc/self/maps", FileIO::ReadText);
if(f == NULL)
{
RDCWARN("Opening %s failed", "/proc/self/maps");
}
else
{
size = 0;
if(buf)
memcpy(buf, "LNUXCALL", 8);
size += 8;
byte dummy[512];
while(!feof(f))
{
byte *readbuf = buf ? buf + size : dummy;
size += FileIO::fread(readbuf, 1, 512, f);
}
FileIO::fclose(f);
}
return true;
}
struct LookupModule
{
uint64_t base;
uint64_t end;
uint64_t offset;
char path[2048];
};
class GgpResolver : public Callstack::StackResolver
{
public:
GgpResolver(rdcarray<LookupModule> modules) { m_Modules = modules; }
Callstack::AddressDetails GetAddr(uint64_t addr)
{
EnsureCached(addr);
return m_Cache[addr];
}
private:
void EnsureCached(uint64_t addr)
{
auto it = m_Cache.insert(
std::pair<uint64_t, Callstack::AddressDetails>(addr, Callstack::AddressDetails()));
if(!it.second)
return;
Callstack::AddressDetails &ret = it.first->second;
ret.filename = "Unknown";
ret.line = 0;
ret.function = StringFormat::Fmt("0x%08llx", addr);
for(size_t i = 0; i < m_Modules.size(); i++)
{
if(addr >= m_Modules[i].base && addr < m_Modules[i].end)
{
uint64_t relative = addr - m_Modules[i].base + m_Modules[i].offset;
rdcstr cmd = StringFormat::Fmt("addr2line -fCe \"%s\" 0x%llx", m_Modules[i].path, relative);
FILE *f = ::popen(cmd.c_str(), "r");
char result[2048] = {0};
fread(result, 1, 2047, f);
fclose(f);
char *line2 = strchr(result, '\n');
if(line2)
{
*line2 = 0;
line2++;
}
ret.function = result;
if(line2)
{
char *linenum = line2 + strlen(line2) - 1;
while(linenum > line2 && *linenum != ':')
linenum--;
ret.line = 0;
if(*linenum == ':')
{
*linenum = 0;
linenum++;
while(*linenum >= '0' && *linenum <= '9')
{
ret.line *= 10;
ret.line += (uint32_t(*linenum) - uint32_t('0'));
linenum++;
}
}
ret.filename = line2;
}
break;
}
}
}
rdcarray<LookupModule> m_Modules;
std::map<uint64_t, Callstack::AddressDetails> m_Cache;
};
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
RENDERDOC_ProgressCallback progress)
{
// we look in the original locations for the files, we don't prompt if we can't
// find the file, or the file doesn't have symbols (and we don't validate that
// the file is the right version). A good option for doing this would be
// http://github.com/mlabbe/nativefiledialog
if(DBSize < 8 || memcmp(moduleDB, "LNUXCALL", 8))
{
RDCWARN("Can't load callstack resolve for this log. Possibly from another platform?");
return NULL;
}
char *start = (char *)(moduleDB + 8);
char *search = start;
char *dbend = (char *)(moduleDB + DBSize);
rdcarray<LookupModule> modules;
while(search && search < dbend)
{
if(progress)
progress(float(search - start) / float(DBSize));
// find .text segments
{
long unsigned int base = 0, end = 0, offset = 0;
int inode = 0;
int offs = 0;
// base-end perms offset devid inode offs
int num = sscanf(search, "%lx-%lx r-xp %lx %*x:%*x %d %n", &base, &end, &offset,
&inode, &offs);
// we don't care about inode actually, we ust use it to verify that
// we read all 4 params (and so perms == r-xp)
if(num == 4 && offs > 0)
{
LookupModule mod = {0};
mod.base = (uint64_t)base;
mod.end = (uint64_t)end;
mod.offset = (uint64_t)offset;
search += offs;
while(search < dbend && (*search == ' ' || *search == '\t'))
search++;
if(search < dbend && *search != '[' && *search != 0 && *search != '\n')
{
size_t n = ARRAY_COUNT(mod.path) - 1;
mod.path[n] = 0;
for(size_t i = 0; i < n; i++)
{
if(search[i] == 0 || search[i] == '\n')
{
mod.path[i] = 0;
break;
}
if(search + i >= dbend)
{
mod.path[i] = 0;
break;
}
mod.path[i] = search[i];
}
modules.push_back(mod);
}
}
}
if(progress)
progress(RDCMIN(1.0f, float(search - start) / float(DBSize)));
if(search >= dbend)
break;
search = strchr(search, '\n');
if(search)
search++;
}
return new GgpResolver(modules);
}
};
-64
View File
@@ -1,64 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <dlfcn.h>
#include "hooks/hooks.h"
// No hooks needed for GGP.
void LibraryHooks::BeginHookRegistration()
{
}
bool LibraryHooks::Detect(const char *identifier)
{
return dlsym(RTLD_DEFAULT, identifier) != NULL;
}
void LibraryHooks::EndHookRegistration()
{
}
void LibraryHooks::RemoveHooks()
{
}
void LibraryHooks::ReplayInitialise()
{
}
void LibraryHooks::Refresh()
{
}
void LibraryHooks::IgnoreLibrary(const char *libraryName)
{
}
void LibraryHooks::RegisterLibraryHook(char const *name, FunctionLoadCallback cb)
{
}
void LibraryHooks::RegisterFunctionHook(const char *libraryName, const FunctionHook &hook)
{
}
-44
View File
@@ -1,44 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "os/os_specific.h"
#include "os/posix/posix_network.h"
namespace Network
{
void SocketPostSend()
{
// only needed for awful hack on Android
}
uint32_t Socket::GetRemoteIP() const
{
return GetIPFromTCPSocket((int)socket);
}
Socket *CreateServerSocket(const rdcstr &bindaddr, uint16_t port, int queuesize)
{
return CreateTCPServerSocket(bindaddr, port, queuesize);
}
};
-223
View File
@@ -1,223 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <unistd.h>
#include <algorithm>
#include "api/replay/data_types.h"
#include "common/common.h"
#include "common/formatting.h"
#include "os/os_specific.h"
extern char **environ;
// we wait 1ns, then 2ns, then 4ns, etc so our total is 0xfff etc
// 0xfffff == ~1s
#define INITIAL_WAIT_TIME 1
#define MAX_WAIT_TIME 0xfffff
char **GetCurrentEnvironment()
{
return environ;
}
rdcarray<int> getSockets(pid_t childPid)
{
rdcarray<int> sockets;
rdcstr dirPath = StringFormat::Fmt("/proc/%d/fd", (int)childPid);
rdcarray<PathEntry> files;
FileIO::GetFilesInDirectory(dirPath, files);
if(files.empty())
return sockets;
for(const PathEntry &file : files)
{
rdcstr target = StringFormat::Fmt("%s/%s", dirPath.c_str(), file.filename.c_str());
char linkname[1024];
ssize_t length = readlink(target.c_str(), linkname, 1023);
if(length == -1)
continue;
linkname[length] = '\0';
uint32_t inode = 0;
int num = sscanf(linkname, "socket:[%u]", &inode);
if(num == 1)
sockets.push_back(inode);
}
return sockets;
}
int GetIdentPort(pid_t childPid)
{
int ret = 0;
rdcstr procfile = StringFormat::Fmt("/proc/%d/net/tcp", (int)childPid);
int waitTime = INITIAL_WAIT_TIME;
// try for a little while for the /proc entry to appear
while(ret == 0 && waitTime <= MAX_WAIT_TIME)
{
// back-off for each retry
usleep(waitTime);
waitTime *= 2;
FILE *f = FileIO::fopen(procfile, FileIO::ReadText);
if(f == NULL)
{
// try again in a bit
continue;
}
rdcarray<int> sockets = getSockets(childPid);
// read through the proc file to check for an open listen socket
while(ret == 0 && !feof(f))
{
const size_t sz = 512;
char line[sz];
line[sz - 1] = 0;
fgets(line, sz - 1, f);
// an example for a line:
// sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
// 0: 00000000:9808 00000000:0000 0A 00000000:00000000 00:00000000 00000000 1000 0 109747
int socketnum = 0, hexip = 0, hexport = 0, inode = 0;
int num = sscanf(line, " %d: %x:%x %*x:%*x %*x %*x:%*x %*x:%*x %*x %*d %*d %d", &socketnum,
&hexip, &hexport, &inode);
// find open listen socket on 0.0.0.0:port
if(num == 4 && hexip == 0 && hexport >= RenderDoc_FirstTargetControlPort &&
hexport <= RenderDoc_LastTargetControlPort && sockets.contains(inode))
{
ret = hexport;
}
}
FileIO::fclose(f);
}
if(ret == 0)
{
RDCWARN("Couldn't locate renderdoc target control listening port between %u and %u in %s",
(uint32_t)RenderDoc_FirstTargetControlPort, (uint32_t)RenderDoc_LastTargetControlPort,
procfile.c_str());
if(!FileIO::exists(procfile))
{
RDCWARN("Process %u is no longer running - did it exit during initialisation or fail to run?",
childPid);
}
}
return ret;
}
void StopAtMainInChild()
{
}
bool StopChildAtMain(pid_t childPid, bool *exitWithNoExec)
{
return false;
}
void ResumeProcess(pid_t childPid, uint32_t delay)
{
}
// because OSUtility::DebuggerPresent is called often we want it to be
// cheap. Opening and parsing a file would cause high overhead on each
// call, so instead we just cache it at startup. This fails in the case
// of attaching to processes
bool debuggerPresent = false;
void CacheDebuggerPresent()
{
FILE *f = FileIO::fopen("/proc/self/status", FileIO::ReadText);
if(f == NULL)
{
RDCWARN("Couldn't open /proc/self/status");
return;
}
// read through the proc file to check for TracerPid
while(!feof(f))
{
const size_t sz = 512;
char line[sz];
line[sz - 1] = 0;
fgets(line, sz - 1, f);
int tracerpid = 0;
int num = sscanf(line, "TracerPid: %d", &tracerpid);
// found TracerPid line
if(num == 1)
{
debuggerPresent = (tracerpid != 0);
break;
}
}
FileIO::fclose(f);
}
bool OSUtility::DebuggerPresent()
{
return debuggerPresent;
}
rdcstr Process::GetEnvVariable(const rdcstr &name)
{
const char *val = getenv(name.c_str());
return val ? val : rdcstr();
}
uint64_t Process::GetMemoryUsage()
{
FILE *f = FileIO::fopen("/proc/self/statm", FileIO::ReadText);
if(f == NULL)
{
RDCWARN("Couldn't open /proc/self/statm");
return 0;
}
char line[512] = {};
fgets(line, 511, f);
FileIO::fclose(f);
uint32_t vmPages = 0;
int num = sscanf(line, "%u", &vmPages);
if(num == 1 && vmPages > 0)
return vmPages * (uint64_t)sysconf(_SC_PAGESIZE);
return 0;
}
-355
View File
@@ -1,355 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <ctype.h>
#include <dlfcn.h>
#include <errno.h>
#include <iconv.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "api/app/renderdoc_app.h"
#include "common/common.h"
#include "common/threading.h"
#include "os/os_specific.h"
#include "strings/string_utils.h"
namespace Keyboard
{
void Init()
{
}
bool PlatformHasKeyInput()
{
return false;
}
void AddInputWindow(WindowingSystem windowSystem, void *wnd)
{
}
void RemoveInputWindow(WindowingSystem windowSystem, void *wnd)
{
}
bool GetKeyState(int key)
{
return false;
}
}
namespace FileIO
{
rdcstr GetTempRootPath()
{
return "/tmp";
}
rdcstr GetAppFolderFilename(const rdcstr &filename)
{
const char *homedir = NULL;
if(getenv("HOME") != NULL)
{
homedir = getenv("HOME");
RDCLOG("$HOME value is %s", homedir);
}
else
{
RDCLOG("$HOME value is NULL");
homedir = getpwuid(getuid())->pw_dir;
}
rdcstr ret = rdcstr(homedir ? homedir : "") + "/.renderdoc/";
mkdir(ret.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
return ret + filename;
}
rdcstr DefaultFindFileInPath(const rdcstr &fileName);
rdcstr FindFileInPath(const rdcstr &fileName)
{
return DefaultFindFileInPath(fileName);
}
void GetExecutableFilename(rdcstr &selfName)
{
char path[512] = {0};
readlink("/proc/self/exe", path, 511);
selfName = rdcstr(path);
}
int LibraryLocator = 42;
void GetLibraryFilename(rdcstr &selfName)
{
// this is a hack, but the only reliable way to find the absolute path to the library.
// dladdr would be fine but it returns the wrong result for symbols in the library
rdcstr librenderdoc_path;
FILE *f = fopen("/proc/self/maps", FileIO::ReadText);
if(f)
{
// read the whole thing in one go. There's no need to try and be tight with
// this allocation, so just make sure we can read everything.
char *map_string = new char[1024 * 1024];
memset(map_string, 0, 1024 * 1024);
::fread(map_string, 1, 1024 * 1024, f);
::fclose(f);
char *c = strstr(map_string, "/librenderdoc.so");
if(c)
{
// walk backwards until we hit the start of the line
while(c > map_string)
{
c--;
if(c[0] == '\n')
{
c++;
break;
}
}
// walk forwards across the address range (00400000-0040c000)
while(isalnum(c[0]) || c[0] == '-')
c++;
// whitespace
while(c[0] == ' ')
c++;
// permissions (r-xp)
while(isalpha(c[0]) || c[0] == '-')
c++;
// whitespace
while(c[0] == ' ')
c++;
// offset (0000b000)
while(isalnum(c[0]) || c[0] == '-')
c++;
// whitespace
while(c[0] == ' ')
c++;
// dev
while(isalnum(c[0]) || c[0] == ':')
c++;
// whitespace
while(c[0] == ' ')
c++;
// inode
while(isdigit(c[0]))
c++;
// whitespace
while(c[0] == ' ')
c++;
// FINALLY we are at the start of the actual path
char *end = strchr(c, '\n');
if(end)
librenderdoc_path = rdcstr(c, end - c);
}
delete[] map_string;
}
if(librenderdoc_path.empty())
{
RDCWARN("Couldn't get librenderdoc.so path from /proc/self/maps, falling back to dladdr");
Dl_info info;
if(dladdr(&LibraryLocator, &info))
librenderdoc_path = info.dli_fname;
}
selfName = librenderdoc_path;
}
};
namespace StringFormat
{
// cache iconv_t descriptor to save on iconv_open/iconv_close each time
iconv_t iconvWide2UTF8 = (iconv_t)-1;
iconv_t iconvUTF82Wide = (iconv_t)-1;
// iconv is not thread safe when sharing an iconv_t descriptor
// I don't expect much contention but if it happens we could TryLock
// before creating a temporary iconv_t, or hold two iconv_ts, or something.
Threading::CriticalSection iconvLock;
void Shutdown()
{
SCOPED_LOCK(iconvLock);
if(iconvWide2UTF8 != (iconv_t)-1)
iconv_close(iconvWide2UTF8);
iconvWide2UTF8 = (iconv_t)-1;
if(iconvUTF82Wide != (iconv_t)-1)
iconv_close(iconvUTF82Wide);
iconvUTF82Wide = (iconv_t)-1;
}
rdcstr Wide2UTF8(const rdcwstr &s)
{
// include room for null terminator, assuming unicode input (not ucs)
// utf-8 characters can be max 4 bytes.
size_t len = (s.length() + 1) * 4;
rdcarray<char> charBuffer(len);
size_t ret;
{
SCOPED_LOCK(iconvLock);
if(iconvWide2UTF8 == (iconv_t)-1)
iconvWide2UTF8 = iconv_open("UTF-8", "WCHAR_T");
if(iconvWide2UTF8 == (iconv_t)-1)
{
RDCERR("Couldn't open iconv for WCHAR_T to UTF-8: %d", errno);
return "";
}
char *inbuf = (char *)s.c_str();
size_t insize = (s.length() + 1) * sizeof(wchar_t); // include null terminator
char *outbuf = &charBuffer[0];
size_t outsize = len;
ret = iconv(iconvWide2UTF8, &inbuf, &insize, &outbuf, &outsize);
}
if(ret == (size_t)-1)
{
#if ENABLED(RDOC_DEVEL)
RDCWARN("Failed to convert wstring");
#endif
return "";
}
// convert to string from null-terminated string - utf-8 never contains
// 0 bytes before the null terminator, and this way we don't care if
// charBuffer is larger than the string
return rdcstr(&charBuffer[0]);
}
rdcwstr UTF82Wide(const rdcstr &s)
{
// include room for null terminator, for ascii input we need at least as many output chars as
// input.
size_t len = s.length() + 1;
rdcarray<wchar_t> wcharBuffer(len);
size_t ret;
{
SCOPED_LOCK(iconvLock);
if(iconvUTF82Wide == (iconv_t)-1)
iconvUTF82Wide = iconv_open("WCHAR_T", "UTF-8");
if(iconvUTF82Wide == (iconv_t)-1)
{
RDCERR("Couldn't open iconv for UTF-8 to WCHAR_T: %d", errno);
return L"";
}
char *inbuf = (char *)s.c_str();
size_t insize = s.length() + 1; // include null terminator
char *outbuf = (char *)&wcharBuffer[0];
size_t outsize = len * sizeof(wchar_t);
ret = iconv(iconvUTF82Wide, &inbuf, &insize, &outbuf, &outsize);
}
if(ret == (size_t)-1)
{
#if ENABLED(RDOC_DEVEL)
RDCWARN("Failed to convert wstring");
#endif
return L"";
}
// convert to string from null-terminated string
return rdcwstr(&wcharBuffer[0]);
}
};
namespace OSUtility
{
void WriteOutput(int channel, const char *str)
{
if(channel == OSUtility::Output_StdOut)
{
fprintf(stdout, "%s", str);
fflush(stdout);
}
else if(channel == OSUtility::Output_StdErr)
{
fprintf(stderr, "%s", str);
fflush(stderr);
}
}
uint64_t GetMachineIdent()
{
uint64_t ret = MachineIdent_Linux;
#if defined(_M_ARM) || defined(__arm__)
ret |= MachineIdent_Arch_ARM;
#else
ret |= MachineIdent_Arch_x86;
#endif
#if ENABLED(RDOC_X64)
ret |= MachineIdent_64bit;
#else
ret |= MachineIdent_32bit;
#endif
return ret;
}
};
-44
View File
@@ -1,44 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "os/os_specific.h"
#include <time.h>
#include <unistd.h>
double Timing::GetTickFrequency()
{
return 1000000.0;
}
uint64_t Timing::GetTick()
{
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return uint64_t(ts.tv_sec) * 1000000000ULL + uint32_t(ts.tv_nsec & 0xffffffff);
}
void Threading::SetCurrentThreadName(const rdcstr &name)
{
}
-18
View File
@@ -591,24 +591,6 @@
<ClCompile Include="os\posix\apple\apple_threading.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_callstack.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_hook.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_network.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_process.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_stringio.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_threading.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="os\posix\linux\linux_callstack.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
-21
View File
@@ -127,9 +127,6 @@
<Filter Include="3rdparty\miniz">
<UniqueIdentifier>{5994c355-880b-45b9-b17a-2e9e1fc2044a}</UniqueIdentifier>
</Filter>
<Filter Include="OS\Posix\GGP">
<UniqueIdentifier>{b76c42f4-d523-4417-a474-56d278d35a36}</UniqueIdentifier>
</Filter>
<Filter Include="3rdparty\compressonator">
<UniqueIdentifier>{3d212b9b-bf42-40db-84a3-b94e064fd281}</UniqueIdentifier>
</Filter>
@@ -914,24 +911,6 @@
<ClCompile Include="core\intervals_tests.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_callstack.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_hook.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_network.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_process.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_stringio.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="os\posix\ggp\ggp_threading.cpp">
<Filter>OS\Posix\GGP</Filter>
</ClCompile>
<ClCompile Include="core\bit_flag_iterator_tests.cpp">
<Filter>Core</Filter>
</ClCompile>
-6
View File
@@ -41,12 +41,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_property(SOURCE renderdoccmd_android.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-shadow")
endif()
elseif(ENABLE_GGP)
list(APPEND sources renderdoccmd_ggp.cpp)
find_library(GGP_LIBRARY ggp)
list(APPEND libraries PRIVATE ${GGP_LIBRARY})
set(LINKER_FLAGS "-Wl,--no-as-needed -Wl,--hash-style=gnu -Wl,--build-id=sha1")
set_property(SOURCE renderdoccmd_ggp.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-shadow")
elseif(UNIX)
list(APPEND sources renderdoccmd_linux.cpp)
-210
View File
@@ -1,210 +0,0 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "renderdoccmd.h"
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <ggp_c/ggp.h>
#include <replay/renderdoc_replay.h>
const uint64_t kMicrosecondsPerFrame = 16666L;
// struct appData: Global application data
static struct
{
// GGP
GgpEventQueue event_queue;
GgpEventHandle stream_state_changed_handle;
// General
bool quit;
} app_data = {0};
void Daemonise()
{
// don't change dir, but close stdin/stdout
daemon(1, 0);
}
WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSystem> &systems)
{
static WindowingData remoteServerPreview = {WindowingSystem::Unknown};
// No preview implemented.
return remoteServerPreview;
}
// ClockNowMicroSeconds(): Return current time in microseconds
static inline uint64_t ClockNowMicroSeconds()
{
struct timespec now = {};
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
uint64_t nanoseconds = (now.tv_sec * 1000000000LL) + now.tv_nsec;
uint64_t microseconds = nanoseconds / 1000LL;
return microseconds;
}
static void HandleStreamStateChanged(const GgpStreamStateChangedEvent *event, void *user_data)
{
switch(event->new_state)
{
case kGgpStreamStateChanged_Exited:
std::cout << "GGP client disconnected" << std::endl;
app_data.quit = true;
break;
case kGgpStreamStateChanged_Started: std::cout << "GGP client connected" << std::endl; break;
default:;
// Invalid, Starting, Suspended.
// Nothing to do.
}
}
// UnregisterCallback(): Handler unregistered
static void UnregisterCallback(void *user_data)
{
std::cout << "Unregistered callback" << std::endl;
}
// Initialize(): Initialize application
static void Initialize()
{
// Initialize event queue
app_data.event_queue = GgpEventQueueCreate();
std::cout << "GGP event queue created" << std::endl;
// Add client connection handlers
app_data.stream_state_changed_handle = GgpAddStreamStateChangedHandler(
app_data.event_queue, HandleStreamStateChanged, &app_data, UnregisterCallback, NULL);
}
// Finalize(): Clean up application resources
static void Finalize()
{
// Destroy the event queue
GgpEventQueueDestroy(app_data.event_queue, NULL);
std::cout << "GGP event queue destroyed" << std::endl;
// Remove client connection handlers.
GgpRemoveStreamStateChangedHandler(app_data.stream_state_changed_handle, NULL);
}
void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width,
uint32_t height, uint32_t numLoops)
{
Initialize();
IReplayOutput *out = renderer->CreateOutput(CreateGgpWindowingData(), ReplayOutputType::Texture);
out->SetTextureDisplay(displayCfg);
// Wait until user closes the window, then exit
while(!app_data.quit)
{
uint64_t whenToResume = ClockNowMicroSeconds() + kMicrosecondsPerFrame;
while(GgpEventQueueProcessEvent(app_data.event_queue, 0))
{
}
renderer->SetFrameEvent(10000000, true);
out->Display();
// Sleep for 1/60 second (one frame)
uint64_t timeLeft = whenToResume - ClockNowMicroSeconds();
if(timeLeft > 0)
{
struct timespec sleepTime = {};
sleepTime.tv_nsec = timeLeft * 1000LL;
nanosleep(&sleepTime, NULL);
}
}
Finalize();
}
void sig_handler(int signo)
{
if(usingKillSignal)
killSignal = true;
else
exit(1);
}
int main(int argc, char *argv[])
{
setlocale(LC_CTYPE, "");
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
GlobalEnvironment env;
// add compiled-in support to version line
{
std::string support = "APIs supported at compile-time: ";
int count = 0;
#if defined(RENDERDOC_SUPPORT_VULKAN)
support += "Vulkan, ";
count++;
#endif
if(count == 0)
{
support += "None.";
}
else
{
// remove trailing ', '
support.pop_back();
support.pop_back();
support += ".";
}
add_version_line(support);
support = "Windowing systems supported at compile-time: ";
count = 0;
support += "GGP, ";
count++;
#if defined(RENDERDOC_SUPPORT_VULKAN)
support += "Vulkan KHR_display, ";
count++;
#endif
if(count == 0)
{
support += "None.";
}
else
{
// remove trailing ', '
support.pop_back();
support.pop_back();
support += ".";
}
add_version_line(support);
}
int ret = renderdoccmd(env, argc, argv);
return ret;
}