Fix compilation (mostly) on OSX, with stubs for VK WSI.

This commit is contained in:
baldurk
2016-11-28 12:57:55 +01:00
parent 1961ea465f
commit 08bd19a990
14 changed files with 155 additions and 8 deletions
+4
View File
@@ -413,6 +413,10 @@ void *CaptureContext::FillWindowingData(WId widget)
return &xlib;
}
#elif defined(RENDERDOC_PLATFORM_APPLE)
return (void *)widget;
#else
#error "Unknown platform"
+6 -2
View File
@@ -79,8 +79,12 @@ win32 {
QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-parameter -Wno-reorder
QT += x11extras
DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_LINUX RENDERDOC_WINDOWING_XLIB RENDERDOC_WINDOWING_XCB
macx: {
DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_APPLE
} else {
QT += x11extras
DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_LINUX RENDERDOC_WINDOWING_XLIB RENDERDOC_WINDOWING_XCB
}
}
SOURCES += 3rdparty/toolwindowmanager/ToolWindowManager.cpp \
-1
View File
@@ -24,7 +24,6 @@ elseif(APPLE)
list(APPEND RDOC_LIBRARIES
PRIVATE m
PRIVATE dl
PRIVATE log
PRIVATE ${CMAKE_THREAD_LIBS_INIT})
elseif(UNIX)
find_package(PkgConfig REQUIRED)
+7
View File
@@ -33,6 +33,8 @@
#include "driver/gl/gl_hookset_defs.h"
Threading::CriticalSection glLock;
class OpenGLHook : LibraryHook
{
public:
@@ -61,6 +63,11 @@ GLWindowingData MakeContext(GLWindowingData share)
return GLWindowingData();
}
Threading::CriticalSection &GetGLLock()
{
return glLock;
}
void DeleteContext(GLWindowingData context)
{
RDCUNIMPLEMENTED("DeleteContext");
+1 -1
View File
@@ -41,7 +41,7 @@ void GLReplay::CloseReplayContext()
RDCUNIMPLEMENTED("GLReplay::CloseReplayContext");
}
uint64_t GLReplay::MakeOutputWindow(void *wn, bool depth)
uint64_t GLReplay::MakeOutputWindow(WindowingSystem system, void *data, bool depth)
{
RDCUNIMPLEMENTED("GLReplay::MakeOutputWindow");
return 0;
+12
View File
@@ -41,6 +41,12 @@
<ClCompile Include="gl_counters.cpp" />
<ClCompile Include="gl_debug.cpp" />
<ClCompile Include="gl_driver.cpp" />
<ClCompile Include="gl_hooks_android.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl_hooks_apple.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl_hooks_linux.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
@@ -48,6 +54,12 @@
<ClCompile Include="gl_manager.cpp" />
<ClCompile Include="gl_renderstate.cpp" />
<ClCompile Include="gl_replay.cpp" />
<ClCompile Include="gl_replay_android.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl_replay_apple.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl_replay_linux.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
@@ -31,6 +31,12 @@
<Filter Include="Replay">
<UniqueIdentifier>{1122b6ee-006e-418b-9907-8f9d0a8b1f25}</UniqueIdentifier>
</Filter>
<Filter Include="OS\Apple">
<UniqueIdentifier>{28fbc354-c414-4647-9ce6-0fcea2cbe845}</UniqueIdentifier>
</Filter>
<Filter Include="OS\Android">
<UniqueIdentifier>{61304e3c-ff5e-4cb6-8c25-455f37d86b48}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="official\glcorearb.h">
@@ -155,5 +161,17 @@
<ClCompile Include="glx_hooks_linux.cpp">
<Filter>OS\Linux</Filter>
</ClCompile>
<ClCompile Include="gl_hooks_apple.cpp">
<Filter>OS\Apple</Filter>
</ClCompile>
<ClCompile Include="gl_replay_apple.cpp">
<Filter>OS\Apple</Filter>
</ClCompile>
<ClCompile Include="gl_hooks_android.cpp">
<Filter>OS\Android</Filter>
</ClCompile>
<ClCompile Include="gl_replay_android.cpp">
<Filter>OS\Android</Filter>
</ClCompile>
</ItemGroup>
</Project>
+2
View File
@@ -49,6 +49,8 @@ set(VULKAN_LAYER_FOLDER /etc/vulkan/implicit_layer.d CACHE PATH "Path to install
if(ANDROID)
list(APPEND sources vk_posix.cpp vk_android.cpp vk_tracelayer_android.cpp)
list(APPEND definitions PRIVATE -DVK_USE_PLATFORM_ANDROID_KHR)
elseif(APPLE)
list(APPEND sources vk_posix.cpp vk_apple.cpp)
elseif(UNIX)
list(APPEND sources vk_posix.cpp vk_linux.cpp)
@@ -19,6 +19,9 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="vk_apple.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vk_counters.cpp" />
<ClCompile Include="vk_dispatchtables.cpp" />
<ClCompile Include="vk_initstate.cpp" />
@@ -91,6 +91,9 @@
<ClCompile Include="vk_tracelayer_android.cpp">
<Filter>OS\Posix</Filter>
</ClCompile>
<ClCompile Include="vk_apple.cpp">
<Filter>OS\Posix</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="vk_replay.h">
+44
View File
@@ -0,0 +1,44 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2016 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"
void VulkanReplay::OutputWindow::SetWindowHandle(WindowingSystem system, void *data)
{
RDCUNIMPLEMENTED("SetWindowHandle");
m_WindowSystem = system;
}
void VulkanReplay::OutputWindow::CreateSurface(VkInstance inst)
{
RDCUNIMPLEMENTED("CreateSurface");
}
void VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h)
{
RDCUNIMPLEMENTED("GetOutputWindowDimensions");
}
const char *VulkanLibraryName = "libvulkan.so";
+4 -4
View File
@@ -834,7 +834,7 @@ void WrappedVulkan::EndCaptureFrame(VkImage presentImage)
RDCASSERT(call->NumLevels() < 0xff);
size_t numLevels = call->NumLevels();
uint64_t numLevels = (uint64_t)call->NumLevels();
uint64_t *stack = (uint64_t *)call->GetAddrs();
localSerialiser->SerialisePODArray("callstack", stack, numLevels);
@@ -2070,7 +2070,7 @@ void WrappedVulkan::ProcessChunk(uint64_t offset, VulkanChunkType context)
if(HasCallstack)
{
size_t numLevels = 0;
uint64_t numLevels = 0;
uint64_t *stack = NULL;
localSerialiser->SerialisePODArray("callstack", stack, numLevels);
@@ -2277,7 +2277,7 @@ void WrappedVulkan::Serialise_DebugMessages(Serialiser *localSerialiser, bool is
RDCASSERT(call->NumLevels() < 0xff);
size_t numLevels = call->NumLevels();
uint64_t numLevels = (uint64_t)call->NumLevels();
uint64_t *stack = (uint64_t *)call->GetAddrs();
localSerialiser->SerialisePODArray("callstack", stack, numLevels);
@@ -2286,7 +2286,7 @@ void WrappedVulkan::Serialise_DebugMessages(Serialiser *localSerialiser, bool is
}
else
{
size_t numLevels = 0;
uint64_t numLevels = 0;
uint64_t *stack = NULL;
localSerialiser->SerialisePODArray("callstack", stack, numLevels);
+5
View File
@@ -87,6 +87,11 @@
RDCEraseEl(xlib); \
RDCEraseEl(xcb);
#elif ENABLED(RDOC_APPLE)
#define WINDOW_HANDLE_DECL void *wnd;
#define WINDOW_HANDLE_INIT wnd = NULL;
#else
#error "Unknown platform"
@@ -23,7 +23,11 @@
******************************************************************************/
#include <mach-o/dyld.h>
#include <pwd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <uuid/uuid.h>
#include "os/os_specific.h"
typedef int Display;
@@ -60,6 +64,18 @@ const char *GetTempRootPath()
return "/tmp";
}
string GetAppFolderFilename(const string &filename)
{
passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
string ret = string(homedir) + "/.renderdoc/";
mkdir(ret.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
return ret + filename;
}
void GetExecutableFilename(string &selfName)
{
char path[512] = {0};
@@ -104,3 +120,33 @@ string Wide2UTF8(const std::wstring &s)
return "";
}
};
namespace OSUtility
{
void WriteOutput(int channel, const char *str)
{
if(channel == OSUtility::Output_StdOut)
fprintf(stdout, "%s", str);
else if(channel == OSUtility::Output_StdErr)
fprintf(stderr, "%s", str);
}
uint64_t GetMachineIdent()
{
uint64_t ret = MachineIdent_macOS;
#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;
}
};