mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-27 08:05:42 +00:00
Report supported windowing systems from replay, and choose which to use
* This is primarily for vulkan, which supports either xlib or xcb (and not necessarily both). GL still only supports xlib, windows and android only support one system regardless of API. * This should also support xlib again for fetching keystates etc.
This commit is contained in:
@@ -134,7 +134,9 @@ class IReplayDriver : public IRemoteDriver
|
||||
public:
|
||||
virtual bool IsRemoteProxy() = 0;
|
||||
|
||||
virtual uint64_t MakeOutputWindow(void *w, bool depth) = 0;
|
||||
virtual vector<WindowingSystem> GetSupportedWindowSystems() = 0;
|
||||
|
||||
virtual uint64_t MakeOutputWindow(WindowingSystem system, void *data, bool depth) = 0;
|
||||
virtual void DestroyOutputWindow(uint64_t id) = 0;
|
||||
virtual bool CheckResizeOutputWindow(uint64_t id) = 0;
|
||||
virtual void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h) = 0;
|
||||
|
||||
@@ -23,12 +23,46 @@
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#if defined(RENDERDOC_PLATFORM_LINUX)
|
||||
#define RENDERDOC_WINDOWING_XLIB 1
|
||||
#define RENDERDOC_WINDOWING_XCB 1
|
||||
#endif
|
||||
|
||||
#include "common/common.h"
|
||||
#include "maths/matrix.h"
|
||||
#include "serialise/string_utils.h"
|
||||
#include "replay_renderer.h"
|
||||
|
||||
ReplayOutput::ReplayOutput(ReplayRenderer *parent, void *w, OutputType type)
|
||||
static uint64_t GetHandle(WindowingSystem system, void *data)
|
||||
{
|
||||
#if defined(RENDERDOC_PLATFORM_LINUX)
|
||||
|
||||
if(system == eWindowingSystem_Xlib)
|
||||
return (uint64_t)((XlibWindowData *)data)->window;
|
||||
|
||||
if(system == eWindowingSystem_XCB)
|
||||
return (uint64_t)((XCBWindowData *)data)->window;
|
||||
|
||||
RDCERR("Unrecognised window system %d", system);
|
||||
|
||||
return 0;
|
||||
|
||||
#elif defined(RENDERDOC_PLATFORM_WIN32)
|
||||
|
||||
RDCASSERT(system == eWindowingSystem_Win32);
|
||||
return (uint64_t)data; // HWND
|
||||
|
||||
#elif defined(RENDERDOC_PLATFORM_ANDROID)
|
||||
|
||||
RDCASSERT(system == eWindowingSystem_Android);
|
||||
return (uint64_t)data; // ANativeWindow *
|
||||
|
||||
#else
|
||||
RDCFATAL("No windowing data defined for this platform! Must be implemented for replay outputs");
|
||||
#endif
|
||||
}
|
||||
|
||||
ReplayOutput::ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, OutputType type)
|
||||
{
|
||||
m_pRenderer = parent;
|
||||
|
||||
@@ -45,7 +79,6 @@ ReplayOutput::ReplayOutput(ReplayRenderer *parent, void *w, OutputType type)
|
||||
|
||||
RDCEraseEl(m_RenderData);
|
||||
|
||||
m_PixelContext.wndHandle = 0;
|
||||
m_PixelContext.outputID = 0;
|
||||
m_PixelContext.texture = ResourceId();
|
||||
m_PixelContext.depthMode = false;
|
||||
@@ -55,8 +88,9 @@ ReplayOutput::ReplayOutput(ReplayRenderer *parent, void *w, OutputType type)
|
||||
|
||||
m_Config.m_Type = type;
|
||||
|
||||
if(w)
|
||||
m_MainOutput.outputID = m_pDevice->MakeOutputWindow(w, type == eOutputType_MeshDisplay);
|
||||
if(system != eWindowingSystem_Unknown)
|
||||
m_MainOutput.outputID =
|
||||
m_pDevice->MakeOutputWindow(system, data, type == eOutputType_MeshDisplay);
|
||||
else
|
||||
m_MainOutput.outputID = 0;
|
||||
m_MainOutput.texture = ResourceId();
|
||||
@@ -179,10 +213,9 @@ bool ReplayOutput::ClearThumbnails()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayOutput::SetPixelContext(void *wnd)
|
||||
bool ReplayOutput::SetPixelContext(WindowingSystem system, void *data)
|
||||
{
|
||||
m_PixelContext.wndHandle = wnd;
|
||||
m_PixelContext.outputID = m_pDevice->MakeOutputWindow(m_PixelContext.wndHandle, false);
|
||||
m_PixelContext.outputID = m_pDevice->MakeOutputWindow(system, data, false);
|
||||
m_PixelContext.texture = ResourceId();
|
||||
m_PixelContext.depthMode = false;
|
||||
|
||||
@@ -191,11 +224,12 @@ bool ReplayOutput::SetPixelContext(void *wnd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayOutput::AddThumbnail(void *wnd, ResourceId texID, FormatComponentType typeHint)
|
||||
bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId texID,
|
||||
FormatComponentType typeHint)
|
||||
{
|
||||
OutputPair p;
|
||||
|
||||
RDCASSERT(wnd);
|
||||
RDCASSERT(data);
|
||||
|
||||
bool depthMode = false;
|
||||
|
||||
@@ -211,7 +245,7 @@ bool ReplayOutput::AddThumbnail(void *wnd, ResourceId texID, FormatComponentType
|
||||
|
||||
for(size_t i = 0; i < m_Thumbnails.size(); i++)
|
||||
{
|
||||
if(m_Thumbnails[i].wndHandle == wnd)
|
||||
if(m_Thumbnails[i].wndHandle == GetHandle(system, data))
|
||||
{
|
||||
m_Thumbnails[i].texture = texID;
|
||||
|
||||
@@ -225,8 +259,8 @@ bool ReplayOutput::AddThumbnail(void *wnd, ResourceId texID, FormatComponentType
|
||||
}
|
||||
}
|
||||
|
||||
p.wndHandle = wnd;
|
||||
p.outputID = m_pDevice->MakeOutputWindow(p.wndHandle, false);
|
||||
p.wndHandle = GetHandle(system, data);
|
||||
p.outputID = m_pDevice->MakeOutputWindow(system, data, false);
|
||||
p.texture = texID;
|
||||
p.depthMode = depthMode;
|
||||
p.typeHint = typeHint;
|
||||
@@ -700,10 +734,11 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_ClearThumbnails(Replay
|
||||
return output->ClearThumbnails();
|
||||
}
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_AddThumbnail(ReplayOutput *output,
|
||||
void *wnd, ResourceId texID,
|
||||
WindowingSystem system,
|
||||
void *data, ResourceId texID,
|
||||
FormatComponentType typeHint)
|
||||
{
|
||||
return output->AddThumbnail(wnd, texID, typeHint);
|
||||
return output->AddThumbnail(system, data, texID, typeHint);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_Display(ReplayOutput *output)
|
||||
@@ -712,9 +747,10 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_Display(ReplayOutput *
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContext(ReplayOutput *output,
|
||||
void *wnd)
|
||||
WindowingSystem system,
|
||||
void *data)
|
||||
{
|
||||
return output->SetPixelContext(wnd);
|
||||
return output->SetPixelContext(system, data);
|
||||
}
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
ReplayOutput_SetPixelContextLocation(ReplayOutput *output, uint32_t x, uint32_t y)
|
||||
|
||||
@@ -1415,9 +1415,15 @@ bool ReplayRenderer::GetCBufferVariableContents(ResourceId shader, const char *e
|
||||
return true;
|
||||
}
|
||||
|
||||
ReplayOutput *ReplayRenderer::CreateOutput(void *wndhandle, OutputType type)
|
||||
void ReplayRenderer::GetSupportedWindowSystems(rdctype::array<WindowingSystem> *systems)
|
||||
{
|
||||
ReplayOutput *out = new ReplayOutput(this, wndhandle, type);
|
||||
if(systems)
|
||||
*systems = m_pDevice->GetSupportedWindowSystems();
|
||||
}
|
||||
|
||||
ReplayOutput *ReplayRenderer::CreateOutput(WindowingSystem system, void *data, OutputType type)
|
||||
{
|
||||
ReplayOutput *out = new ReplayOutput(this, system, data, type);
|
||||
|
||||
m_Outputs.push_back(out);
|
||||
|
||||
@@ -1668,11 +1674,16 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetAPIProperties(Repla
|
||||
*props = rend->GetAPIProperties();
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API ReplayOutput *RENDERDOC_CC ReplayRenderer_CreateOutput(ReplayRenderer *rend,
|
||||
void *handle,
|
||||
OutputType type)
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetSupportedWindowSystems(
|
||||
ReplayRenderer *rend, rdctype::array<WindowingSystem> *systems)
|
||||
{
|
||||
return rend->CreateOutput(handle, type);
|
||||
rend->GetSupportedWindowSystems(systems);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API ReplayOutput *RENDERDOC_CC ReplayRenderer_CreateOutput(
|
||||
ReplayRenderer *rend, WindowingSystem system, void *data, OutputType type)
|
||||
{
|
||||
return rend->CreateOutput(system, data, type);
|
||||
}
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_Shutdown(ReplayRenderer *rend)
|
||||
{
|
||||
|
||||
@@ -43,12 +43,13 @@ public:
|
||||
bool SetMeshDisplay(const MeshDisplay &o);
|
||||
|
||||
bool ClearThumbnails();
|
||||
bool AddThumbnail(void *wnd, ResourceId texID, FormatComponentType typeHint);
|
||||
bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID,
|
||||
FormatComponentType typeHint);
|
||||
|
||||
bool Display();
|
||||
|
||||
OutputType GetType() { return m_Config.m_Type; }
|
||||
bool SetPixelContext(void *wnd);
|
||||
bool SetPixelContext(WindowingSystem system, void *data);
|
||||
bool SetPixelContextLocation(uint32_t x, uint32_t y);
|
||||
void DisablePixelContext();
|
||||
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
uint32_t PickVertex(uint32_t eventID, uint32_t x, uint32_t y);
|
||||
|
||||
private:
|
||||
ReplayOutput(ReplayRenderer *parent, void *w, OutputType type);
|
||||
ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, OutputType type);
|
||||
virtual ~ReplayOutput();
|
||||
|
||||
void SetFrameEvent(int eventID);
|
||||
@@ -82,7 +83,7 @@ private:
|
||||
{
|
||||
ResourceId texture;
|
||||
bool depthMode;
|
||||
void *wndHandle;
|
||||
uint64_t wndHandle;
|
||||
FormatComponentType typeHint;
|
||||
uint64_t outputID;
|
||||
|
||||
@@ -191,7 +192,9 @@ public:
|
||||
ResourceId buffer, uint64_t offs,
|
||||
rdctype::array<ShaderVariable> *vars);
|
||||
|
||||
ReplayOutput *CreateOutput(void *handle, OutputType type);
|
||||
void GetSupportedWindowSystems(rdctype::array<WindowingSystem> *systems);
|
||||
|
||||
ReplayOutput *CreateOutput(WindowingSystem, void *data, OutputType type);
|
||||
|
||||
void ShutdownOutput(ReplayOutput *output);
|
||||
void Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user