mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add pixel context view
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
#include <QTimer>
|
||||
#include "Windows/MainWindow.h"
|
||||
|
||||
#if defined(RENDERDOC_PLATFORM_LINUX)
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
||||
Core::Core(QString paramFilename, QString remoteHost, uint32_t remoteIdent, bool temp)
|
||||
{
|
||||
m_LogLoaded = false;
|
||||
@@ -90,6 +97,29 @@ void Core::LoadLogfile(int proxyRenderer, QString replayHost, QString logFile, b
|
||||
|
||||
postloadProgress = 0.4f;
|
||||
|
||||
r->GetSupportedWindowSystems(&m_WinSystems);
|
||||
|
||||
#if defined(RENDERDOC_PLATFORM_WIN32)
|
||||
m_CurWinSystem = eWindowingSystem_Win32;
|
||||
#elif defined(RENDERDOC_PLATFORM_LINUX)
|
||||
m_CurWinSystem = eWindowingSystem_Xlib;
|
||||
|
||||
// prefer XCB, if supported
|
||||
for(int32_t i = 0; i < m_WinSystems.count; i++)
|
||||
{
|
||||
if(m_WinSystems[i] == eWindowingSystem_XCB)
|
||||
{
|
||||
m_CurWinSystem = eWindowingSystem_XCB;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_CurWinSystem == eWindowingSystem_XCB)
|
||||
m_XCBConnection = QX11Info::connection();
|
||||
else
|
||||
m_X11Display = QX11Info::display();
|
||||
#endif
|
||||
|
||||
r->GetBuffers(&m_BufferList);
|
||||
for(int i = 0; i < m_BufferList.count; i++)
|
||||
m_Buffers[m_BufferList[i].ID] = &m_BufferList[i];
|
||||
@@ -152,6 +182,32 @@ void Core::SetEventID(ILogViewerForm *exclude, uint32_t eventID)
|
||||
}
|
||||
}
|
||||
|
||||
void *Core::FillWindowingData(WId widget)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
|
||||
return (void *)widget;
|
||||
|
||||
#elif defined(RENDERDOC_PLATFORM_LINUX)
|
||||
|
||||
static XCBWindowData xcb = {
|
||||
m_X11Connection, (xcb_window_t)widget,
|
||||
};
|
||||
|
||||
static XlibWindowData xlib = {m_X11Display, (Drawable)widget};
|
||||
|
||||
if(m_CurWinSystem == eWindowingSystem_XCB)
|
||||
return &xcb;
|
||||
else
|
||||
return &xlib;
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown platform"
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void GUIInvoke::call(const std::function<void()> &f)
|
||||
{
|
||||
if(qApp->thread() == QThread::currentThread())
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QtWidgets/QWidget>
|
||||
#include "RenderManager.h"
|
||||
|
||||
struct ILogViewerForm
|
||||
@@ -95,6 +96,9 @@ public:
|
||||
DebugMessages.push_back(msgs[i]);
|
||||
}
|
||||
|
||||
WindowingSystem m_CurWinSystem;
|
||||
void *FillWindowingData(WId widget);
|
||||
|
||||
D3D11PipelineState CurD3D11PipelineState;
|
||||
GLPipelineState CurGLPipelineState;
|
||||
VulkanPipelineState CurVulkanPipelineState;
|
||||
@@ -140,6 +144,13 @@ private:
|
||||
QMap<ResourceId, FetchBuffer *> m_Buffers;
|
||||
rdctype::array<FetchBuffer> m_BufferList;
|
||||
|
||||
rdctype::array<WindowingSystem> m_WinSystems;
|
||||
|
||||
#if defined(RENDERDOC_PLATFORM_LINUX)
|
||||
xcb_connection_t *m_XCBConnection;
|
||||
Display *m_X11Display;
|
||||
#endif
|
||||
|
||||
// Windows
|
||||
MainWindow *m_MainWindow;
|
||||
};
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
#if defined(__linux__)
|
||||
#define RENDERDOC_WINDOWING_XLIB 1
|
||||
#define RENDERDOC_WINDOWING_XCB 1
|
||||
#endif
|
||||
|
||||
#include "TextureViewer.h"
|
||||
#include "Code/Core.h"
|
||||
#include "FlowLayout.h"
|
||||
#include "ui_TextureViewer.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
||||
struct Formatter
|
||||
{
|
||||
static QString Format(float f) { return QString::number(f); }
|
||||
@@ -968,55 +957,15 @@ void TextureViewer::on_renderVScroll_valueChanged(int position)
|
||||
|
||||
void TextureViewer::OnLogfileLoaded()
|
||||
{
|
||||
#if defined(WIN32)
|
||||
WId renderID = ui->render->winId();
|
||||
WId contextID = ui->pixelContext->winId();
|
||||
|
||||
WindowingSystem system = eWindowingSystem_Win32;
|
||||
HWND wnd = (HWND)ui->render->winId();
|
||||
m_Core->Renderer()->BlockInvoke([renderID, contextID, this](IReplayRenderer *r) {
|
||||
m_Output = r->CreateOutput(m_Core->m_CurWinSystem, m_Core->FillWindowingData(renderID),
|
||||
eOutputType_TexDisplay);
|
||||
|
||||
#elif defined(__linux__)
|
||||
m_Output->SetPixelContext(m_Core->m_CurWinSystem, m_Core->FillWindowingData(contextID));
|
||||
|
||||
XCBWindowData xcb = {
|
||||
QX11Info::connection(), (xcb_window_t)ui->render->winId(),
|
||||
};
|
||||
|
||||
XlibWindowData xlib = {QX11Info::display(), (Drawable)ui->render->winId()};
|
||||
|
||||
rdctype::array<WindowingSystem> systems;
|
||||
m_Core->Renderer()->BlockInvoke(
|
||||
[&systems](IReplayRenderer *r) { r->GetSupportedWindowSystems(&systems); });
|
||||
|
||||
WindowingSystem system = eWindowingSystem_Unknown;
|
||||
void *wnd = NULL;
|
||||
|
||||
// prefer XCB
|
||||
for(int32_t i = 0; i < systems.count; i++)
|
||||
{
|
||||
if(systems[i] == eWindowingSystem_XCB)
|
||||
{
|
||||
system = eWindowingSystem_XCB;
|
||||
wnd = &xcb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(int32_t i = 0; wnd == NULL && i < systems.count; i++)
|
||||
{
|
||||
if(systems[i] == eWindowingSystem_Xlib)
|
||||
{
|
||||
system = eWindowingSystem_Xlib;
|
||||
wnd = &xlib;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown platform"
|
||||
|
||||
#endif
|
||||
|
||||
m_Core->Renderer()->BlockInvoke([system, wnd, this](IReplayRenderer *r) {
|
||||
m_Output = r->CreateOutput(system, wnd, eOutputType_TexDisplay);
|
||||
ui->render->SetOutput(m_Core, m_Output);
|
||||
|
||||
OutputConfig c = {eOutputType_TexDisplay};
|
||||
|
||||
Reference in New Issue
Block a user