mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-01 04:10:58 +00:00
Make display rendering colours theme-aware.
* In particular this removes hard-coded checkerboard colours that don't look right on dark themes.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
// types in the RenderDoc core interface are already wrapped, and Qt types must either be manually
|
||||
// converted directly to python, or interfaced with PySide, otherwise we get into the situation
|
||||
// where pyside and SWIG have independent incompatible wrappers of Qt types
|
||||
#include <QColor>
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
@@ -632,6 +632,7 @@ int Formatter::m_minFigures = 2, Formatter::m_maxFigures = 5, Formatter::m_expNe
|
||||
double Formatter::m_expNegValue = 0.00001; // 10^(-5)
|
||||
double Formatter::m_expPosValue = 10000000.0; // 10^7
|
||||
QFont *Formatter::m_Font = NULL;
|
||||
QColor Formatter::m_DarkChecker, Formatter::m_LightChecker;
|
||||
|
||||
void Formatter::setParams(const PersistantConfig &config)
|
||||
{
|
||||
@@ -647,6 +648,11 @@ void Formatter::setParams(const PersistantConfig &config)
|
||||
m_Font = new QFont();
|
||||
*m_Font =
|
||||
config.Font_PreferMonospaced ? QFontDatabase::systemFont(QFontDatabase::FixedFont) : QFont();
|
||||
|
||||
m_DarkChecker = QApplication::palette().color(QPalette::Mid);
|
||||
m_LightChecker = m_DarkChecker.lighter(150);
|
||||
|
||||
RENDERDOC_SetColors(m_DarkChecker, m_LightChecker, IsDarkTheme());
|
||||
}
|
||||
|
||||
void Formatter::shutdown()
|
||||
@@ -1082,6 +1088,15 @@ QString GetSystemUsername()
|
||||
return username;
|
||||
}
|
||||
|
||||
bool IsDarkTheme()
|
||||
{
|
||||
float baseLum = getLuminance(QApplication::palette().color(QPalette::Base));
|
||||
float textLum = getLuminance(QApplication::palette().color(QPalette::Text));
|
||||
|
||||
// if the base is dark than the text, then it's a light-on-dark theme (aka dark theme)
|
||||
return (baseLum < textLum);
|
||||
}
|
||||
|
||||
float getLuminance(const QColor &col)
|
||||
{
|
||||
return (float)(0.2126 * qPow(col.redF(), 2.2) + 0.7152 * qPow(col.greenF(), 2.2) +
|
||||
|
||||
@@ -677,10 +677,13 @@ struct Formatter
|
||||
}
|
||||
static QString Format(int32_t i, bool hex = false) { return QString::number(i); }
|
||||
static const QFont &PreferredFont() { return *m_Font; }
|
||||
static const QColor DarkCheckerColor() { return m_DarkChecker; }
|
||||
static const QColor LightCheckerColor() { return m_LightChecker; }
|
||||
private:
|
||||
static int m_minFigures, m_maxFigures, m_expNegCutoff, m_expPosCutoff;
|
||||
static double m_expNegValue, m_expPosValue;
|
||||
static QFont *m_Font;
|
||||
static QColor m_DarkChecker, m_LightChecker;
|
||||
};
|
||||
|
||||
bool SaveToJSON(QVariantMap &data, QIODevice &f, const char *magicIdentifier, uint32_t magicVersion);
|
||||
@@ -899,5 +902,7 @@ void setEnabledMultiple(const QList<QWidget *> &widgets, bool enabled);
|
||||
|
||||
QString GetSystemUsername();
|
||||
|
||||
bool IsDarkTheme();
|
||||
|
||||
float getLuminance(const QColor &col);
|
||||
QColor contrastingColor(const QColor &col, const QColor &defaultCol);
|
||||
|
||||
@@ -164,17 +164,7 @@ int main(int argc, char *argv[])
|
||||
.arg(configFilename));
|
||||
}
|
||||
|
||||
config.SetupFormatting();
|
||||
|
||||
bool isDarkTheme = false;
|
||||
|
||||
{
|
||||
float baseLum = getLuminance(application.palette().color(QPalette::Base));
|
||||
float textLum = getLuminance(application.palette().color(QPalette::Text));
|
||||
|
||||
// if the base is dark than the text, then it's a light-on-dark theme (aka dark theme)
|
||||
isDarkTheme = (baseLum < textLum);
|
||||
}
|
||||
bool isDarkTheme = IsDarkTheme();
|
||||
|
||||
bool styleSet = config.SetStyle();
|
||||
|
||||
@@ -186,6 +176,8 @@ int main(int argc, char *argv[])
|
||||
config.SetStyle();
|
||||
}
|
||||
|
||||
config.SetupFormatting();
|
||||
|
||||
Resources::Initialise();
|
||||
|
||||
GUIInvoke::init();
|
||||
|
||||
@@ -2629,8 +2629,7 @@ void BufferViewer::Reset()
|
||||
QObject::connect(ui->render, &CustomPaintWidget::mouseWheel, this,
|
||||
&BufferViewer::render_mouseWheel);
|
||||
|
||||
ui->render->setColours(QColor::fromRgbF(0.57f, 0.57f, 0.57f, 1.0f),
|
||||
QColor::fromRgbF(0.81f, 0.81f, 0.81f, 1.0f));
|
||||
ui->render->setColours(Formatter::DarkCheckerColor(), Formatter::LightCheckerColor());
|
||||
}
|
||||
|
||||
void BufferViewer::ClearModels()
|
||||
|
||||
@@ -450,7 +450,11 @@ void SettingsDialog::on_UIStyle_currentIndexChanged(int index)
|
||||
m_Ctx.Config().UIStyle = newStyle;
|
||||
|
||||
if(ret == QMessageBox::Yes)
|
||||
{
|
||||
m_Ctx.Config().SetStyle();
|
||||
|
||||
m_Ctx.Config().SetupFormatting();
|
||||
}
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
@@ -2460,8 +2460,7 @@ void TextureViewer::UI_RecreatePanels()
|
||||
ui->pixelcontextgrid->addWidget(pixelContext, 0, 0, 1, 2);
|
||||
}
|
||||
|
||||
ui->render->setColours(darkBack, lightBack);
|
||||
ui->pixelContext->setColours(darkBack, lightBack);
|
||||
updateBackgroundColors();
|
||||
|
||||
QObject::connect(ui->render, &CustomPaintWidget::clicked, this, &TextureViewer::render_mouseClick);
|
||||
QObject::connect(ui->render, &CustomPaintWidget::mouseMove, this, &TextureViewer::render_mouseMove);
|
||||
@@ -2474,6 +2473,20 @@ void TextureViewer::UI_RecreatePanels()
|
||||
&TextureViewer::render_keyPress);
|
||||
}
|
||||
|
||||
void TextureViewer::updateBackgroundColors()
|
||||
{
|
||||
if(backCol.isValid())
|
||||
{
|
||||
ui->render->setColours(backCol, backCol);
|
||||
ui->pixelContext->setColours(backCol, backCol);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->render->setColours(Formatter::DarkCheckerColor(), Formatter::LightCheckerColor());
|
||||
ui->pixelContext->setColours(Formatter::DarkCheckerColor(), Formatter::LightCheckerColor());
|
||||
}
|
||||
}
|
||||
|
||||
void TextureViewer::OnLogfileLoaded()
|
||||
{
|
||||
Reset();
|
||||
@@ -2489,10 +2502,9 @@ void TextureViewer::OnLogfileLoaded()
|
||||
|
||||
model->reset(TextureListItemModel::String, QString(), m_Ctx);
|
||||
|
||||
m_TexDisplay.darkBackgroundColor =
|
||||
FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f);
|
||||
m_TexDisplay.lightBackgroundColor =
|
||||
FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f);
|
||||
m_TexDisplay.backgroundColor =
|
||||
backCol.isValid() ? FloatVector(backCol.redF(), backCol.greenF(), backCol.blueF(), 1.0f)
|
||||
: FloatVector();
|
||||
|
||||
m_Ctx.Replay().BlockInvoke([renderID, contextID, this](IReplayController *r) {
|
||||
m_Output = r->CreateOutput(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(renderID),
|
||||
@@ -2522,10 +2534,9 @@ void TextureViewer::Reset()
|
||||
m_CachedTexture = NULL;
|
||||
|
||||
memset(&m_TexDisplay, 0, sizeof(m_TexDisplay));
|
||||
m_TexDisplay.darkBackgroundColor =
|
||||
FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f);
|
||||
m_TexDisplay.lightBackgroundColor =
|
||||
FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f);
|
||||
m_TexDisplay.backgroundColor =
|
||||
backCol.isValid() ? FloatVector(backCol.redF(), backCol.greenF(), backCol.blueF(), 1.0f)
|
||||
: FloatVector();
|
||||
|
||||
m_Output = NULL;
|
||||
|
||||
@@ -2716,8 +2727,8 @@ QVariant TextureViewer::persistData()
|
||||
{
|
||||
QVariantMap state = ui->dockarea->saveState();
|
||||
|
||||
state[lit("darkBack")] = darkBack;
|
||||
state[lit("lightBack")] = lightBack;
|
||||
state[lit("backCol")] = backCol;
|
||||
state[lit("checker")] = !backCol.isValid();
|
||||
|
||||
return state;
|
||||
}
|
||||
@@ -2726,27 +2737,19 @@ void TextureViewer::setPersistData(const QVariant &persistData)
|
||||
{
|
||||
QVariantMap state = persistData.toMap();
|
||||
|
||||
darkBack = state[lit("darkBack")].value<QColor>();
|
||||
lightBack = state[lit("lightBack")].value<QColor>();
|
||||
backCol = state[lit("backCol")].value<QColor>();
|
||||
bool checker = state[lit("checker")].value<bool>();
|
||||
|
||||
if(darkBack != lightBack)
|
||||
{
|
||||
ui->backcolorPick->setChecked(false);
|
||||
ui->checkerBack->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->backcolorPick->setChecked(true);
|
||||
ui->checkerBack->setChecked(false);
|
||||
}
|
||||
if(checker)
|
||||
backCol = QColor();
|
||||
|
||||
m_TexDisplay.darkBackgroundColor =
|
||||
FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f);
|
||||
m_TexDisplay.lightBackgroundColor =
|
||||
FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f);
|
||||
ui->backcolorPick->setChecked(!checker);
|
||||
ui->checkerBack->setChecked(checker);
|
||||
|
||||
ui->render->setColours(darkBack, lightBack);
|
||||
ui->pixelContext->setColours(darkBack, lightBack);
|
||||
m_TexDisplay.backgroundColor =
|
||||
checker ? FloatVector() : FloatVector(backCol.redF(), backCol.greenF(), backCol.blueF(), 1.0f);
|
||||
|
||||
updateBackgroundColors();
|
||||
|
||||
ui->dockarea->restoreState(state);
|
||||
|
||||
@@ -2928,7 +2931,7 @@ void TextureViewer::range_rangeUpdated()
|
||||
if(m_Output == NULL)
|
||||
{
|
||||
ui->render->update();
|
||||
ui->pixelcontextgrid->update();
|
||||
ui->pixelContext->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3107,13 +3110,11 @@ void TextureViewer::on_backcolorPick_clicked()
|
||||
return;
|
||||
|
||||
col = col.toRgb();
|
||||
m_TexDisplay.darkBackgroundColor = m_TexDisplay.lightBackgroundColor =
|
||||
FloatVector(col.redF(), col.greenF(), col.blueF(), 1.0f);
|
||||
m_TexDisplay.backgroundColor = FloatVector(col.redF(), col.greenF(), col.blueF(), 1.0f);
|
||||
|
||||
darkBack = lightBack = col;
|
||||
backCol = col;
|
||||
|
||||
ui->render->setColours(darkBack, lightBack);
|
||||
ui->pixelContext->setColours(darkBack, lightBack);
|
||||
updateBackgroundColors();
|
||||
|
||||
ui->backcolorPick->setChecked(true);
|
||||
ui->checkerBack->setChecked(false);
|
||||
@@ -3123,7 +3124,7 @@ void TextureViewer::on_backcolorPick_clicked()
|
||||
if(m_Output == NULL)
|
||||
{
|
||||
ui->render->update();
|
||||
ui->pixelcontextgrid->update();
|
||||
ui->pixelContext->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3132,26 +3133,18 @@ void TextureViewer::on_checkerBack_clicked()
|
||||
ui->checkerBack->setChecked(true);
|
||||
ui->backcolorPick->setChecked(false);
|
||||
|
||||
m_TexDisplay.lightBackgroundColor = FloatVector(0.81f, 0.81f, 0.81f, 1.0f);
|
||||
m_TexDisplay.darkBackgroundColor = FloatVector(0.57f, 0.57f, 0.57f, 1.0f);
|
||||
backCol = QColor();
|
||||
|
||||
darkBack = QColor::fromRgb(int(m_TexDisplay.darkBackgroundColor.x * 255.0f),
|
||||
int(m_TexDisplay.darkBackgroundColor.y * 255.0f),
|
||||
int(m_TexDisplay.darkBackgroundColor.z * 255.0f));
|
||||
m_TexDisplay.backgroundColor = FloatVector();
|
||||
|
||||
lightBack = QColor::fromRgb(int(m_TexDisplay.lightBackgroundColor.x * 255.0f),
|
||||
int(m_TexDisplay.lightBackgroundColor.y * 255.0f),
|
||||
int(m_TexDisplay.lightBackgroundColor.z * 255.0f));
|
||||
|
||||
ui->render->setColours(darkBack, lightBack);
|
||||
ui->pixelContext->setColours(darkBack, lightBack);
|
||||
updateBackgroundColors();
|
||||
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
|
||||
if(m_Output == NULL)
|
||||
{
|
||||
ui->render->update();
|
||||
ui->pixelcontextgrid->update();
|
||||
ui->pixelContext->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3365,7 +3358,7 @@ void TextureViewer::on_saveTex_clicked()
|
||||
|
||||
config.comp.blackPoint = m_TexDisplay.rangemin;
|
||||
config.comp.whitePoint = m_TexDisplay.rangemax;
|
||||
config.alphaCol = m_TexDisplay.lightBackgroundColor;
|
||||
config.alphaCol = m_TexDisplay.backgroundColor;
|
||||
config.alpha = m_TexDisplay.Alpha ? AlphaMapping::BlendToCheckerboard : AlphaMapping::Discard;
|
||||
if(m_TexDisplay.Alpha && !ui->checkerBack->isChecked())
|
||||
config.alpha = AlphaMapping::BlendToColor;
|
||||
|
||||
@@ -241,6 +241,8 @@ private:
|
||||
void AutoFitRange();
|
||||
void rangePoint_Update();
|
||||
|
||||
void updateBackgroundColors();
|
||||
|
||||
bool currentTextureIsLocked() { return m_LockedId != ResourceId(); }
|
||||
void setFitToWindow(bool checked);
|
||||
|
||||
@@ -282,8 +284,7 @@ private:
|
||||
PixelValue m_CurPixelValue;
|
||||
PixelValue m_CurHoverValue;
|
||||
|
||||
QColor darkBack;
|
||||
QColor lightBack;
|
||||
QColor backCol;
|
||||
|
||||
int m_HighWaterStatusLength = 0;
|
||||
int m_PrevFirstArraySlice = -1;
|
||||
|
||||
@@ -201,8 +201,7 @@ If only one channel is selected, it will be rendered in grayscale
|
||||
bool Blue;
|
||||
|
||||
DOCUMENT(R"(``True`` if the alpha channel should be visible. If enabled with any of RGB, the
|
||||
texture will be blended to a checkerboard of :data:`lightBackgroundColor` and
|
||||
:data:`darkBackgroundColor`.
|
||||
texture will be blended to the background color or checkerboard.
|
||||
|
||||
If only one channel is selected, it will be rendered in grayscale
|
||||
)");
|
||||
@@ -252,10 +251,11 @@ the input texture in cases where it isn't easy to directly fetch the input textu
|
||||
DOCUMENT("The offset to pan in the Y axis.");
|
||||
float offy;
|
||||
|
||||
DOCUMENT("The light background colour to use in the checkerboard behind the texture display.");
|
||||
FloatVector lightBackgroundColor;
|
||||
DOCUMENT("The dark background colour to use in the checkerboard behind the texture display.");
|
||||
FloatVector darkBackgroundColor;
|
||||
DOCUMENT(R"(The background colour to use behind the texture display.
|
||||
|
||||
If set to (0, 0, 0, 0) the global checkerboard colors are used.
|
||||
)");
|
||||
FloatVector backgroundColor;
|
||||
|
||||
DOCUMENT("Selects a :class:`DebugOverlay` to draw over the top of the texture.");
|
||||
DebugOverlay overlay;
|
||||
@@ -392,14 +392,12 @@ written
|
||||
DOCUMENT(R"(Controls handling of alpha channel, mostly relevant for file formats that without
|
||||
alpha.
|
||||
|
||||
It is an :class:`AlphaMapping` that controls what behaviour to use. :data:`alphaCol` and
|
||||
:data:`alphaColSecondary` may be used depending on the behaviour that it selects.
|
||||
It is an :class:`AlphaMapping` that controls what behaviour to use.
|
||||
)");
|
||||
AlphaMapping alpha;
|
||||
DOCUMENT("The primary color to use in conjunction with :data:`alpha`.");
|
||||
FloatVector alphaCol = FloatVector(0.81f, 0.81f, 0.81f, 1.0f);
|
||||
DOCUMENT("The secondary color to use in conjunction with :data:`alpha`.");
|
||||
FloatVector alphaColSecondary = FloatVector(0.57f, 0.57f, 0.57f, 1.0f);
|
||||
|
||||
DOCUMENT("The background color if :data:`alpha` is set to :data:`AlphaMapping.BlendToColor`");
|
||||
FloatVector alphaCol;
|
||||
|
||||
DOCUMENT("The quality to use when saving to a ``JPG`` file. Valid values are between 1 and 100.");
|
||||
int jpegQuality = 90;
|
||||
|
||||
@@ -32,6 +32,11 @@ struct FloatVector
|
||||
{
|
||||
FloatVector() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) {}
|
||||
FloatVector(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}
|
||||
#if defined(RENDERDOC_QT_COMPAT)
|
||||
FloatVector(const QColor &col) : x(col.redF()), y(col.greenF()), z(col.blueF()), w(col.alphaF())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
DOCUMENT("The x component.");
|
||||
float x;
|
||||
DOCUMENT("The y component.");
|
||||
|
||||
@@ -1579,6 +1579,11 @@ DOCUMENT("Internal function for setting a config setting.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetConfigSetting(const char *name,
|
||||
const char *value);
|
||||
|
||||
DOCUMENT("Internal function for setting UI theme colors.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetColors(FloatVector darkChecker,
|
||||
FloatVector lightChecker,
|
||||
bool darkTheme);
|
||||
|
||||
DOCUMENT("Internal function for fetching friendly android names.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_GetAndroidFriendlyName(const rdctype::str &device,
|
||||
rdctype::str &friendly);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "api/replay/renderdoc_replay.h"
|
||||
#include "common/threading.h"
|
||||
#include "common/timing.h"
|
||||
#include "maths/vec.h"
|
||||
#include "os/os_specific.h"
|
||||
|
||||
using std::string;
|
||||
@@ -272,6 +273,12 @@ public:
|
||||
m_VulkanInstall(systemLevel);
|
||||
}
|
||||
|
||||
Vec4f LightCheckerboardColor() { return m_LightChecker; }
|
||||
Vec4f DarkCheckerboardColor() { return m_DarkChecker; }
|
||||
void SetLightCheckerboardColor(const Vec4f &col) { m_LightChecker = col; }
|
||||
void SetDarkCheckerboardColor(const Vec4f &col) { m_DarkChecker = col; }
|
||||
bool IsDarkTheme() { return m_DarkTheme; }
|
||||
void SetDarkTheme(bool dark) { m_DarkTheme = dark; }
|
||||
ReplayStatus CreateReplayDriver(RDCDriver driverType, const char *logfile, IReplayDriver **driver);
|
||||
ReplayStatus CreateRemoteDriver(RDCDriver driverType, const char *logfile, IRemoteDriver **driver);
|
||||
|
||||
@@ -426,6 +433,10 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
Vec4f m_LightChecker = Vec4f(0.81f, 0.81f, 0.81f, 1.0f);
|
||||
Vec4f m_DarkChecker = Vec4f(0.57f, 0.57f, 0.57f, 1.0f);
|
||||
bool m_DarkTheme = false;
|
||||
|
||||
int m_CapturesActive;
|
||||
|
||||
map<DeviceWnd, FrameCap> m_WindowFrameCapturers;
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
{
|
||||
m_Proxy->GetOutputWindowDimensions(id, w, h);
|
||||
}
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
m_Proxy->ClearOutputWindowColor(id, col);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
void BindOutputWindow(uint64_t id, bool depth) { m_Proxy->BindOutputWindow(id, depth); }
|
||||
bool IsOutputWindowVisible(uint64_t id) { return m_Proxy->IsOutputWindowVisible(id); }
|
||||
void FlipOutputWindow(uint64_t id) { m_Proxy->FlipOutputWindow(id); }
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark) { m_Proxy->RenderCheckerboard(light, dark); }
|
||||
void RenderCheckerboard() { m_Proxy->RenderCheckerboard(); }
|
||||
void RenderHighlightBox(float w, float h, float scale)
|
||||
{
|
||||
m_Proxy->RenderHighlightBox(w, h, scale);
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
if(m_Proxy)
|
||||
return m_Proxy->GetOutputWindowDimensions(id, w, h);
|
||||
}
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
if(m_Proxy)
|
||||
return m_Proxy->ClearOutputWindowColor(id, col);
|
||||
@@ -180,10 +180,10 @@ public:
|
||||
return m_Proxy->FlipOutputWindow(id);
|
||||
}
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void RenderCheckerboard()
|
||||
{
|
||||
if(m_Proxy)
|
||||
return m_Proxy->RenderCheckerboard(light, dark);
|
||||
return m_Proxy->RenderCheckerboard();
|
||||
}
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale)
|
||||
|
||||
@@ -3405,7 +3405,7 @@ ResourceId D3D11DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te
|
||||
disp.CustomShader = shader;
|
||||
disp.texid = texid;
|
||||
disp.typeHint = typeHint;
|
||||
disp.lightBackgroundColor = disp.darkBackgroundColor = FloatVector(0, 0, 0, 0);
|
||||
disp.backgroundColor = FloatVector(0, 0, 0, 1.0);
|
||||
disp.HDRMul = -1.0f;
|
||||
disp.linearDisplayAsGamma = false;
|
||||
disp.mip = mip;
|
||||
|
||||
@@ -1688,12 +1688,12 @@ void D3D11DebugManager::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32
|
||||
h = m_OutputWindows[id].height;
|
||||
}
|
||||
|
||||
void D3D11DebugManager::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void D3D11DebugManager::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
if(id == 0 || m_OutputWindows.find(id) == m_OutputWindows.end())
|
||||
return;
|
||||
|
||||
m_pImmediateContext->ClearRenderTargetView(m_OutputWindows[id].rtv, col);
|
||||
m_pImmediateContext->ClearRenderTargetView(m_OutputWindows[id].rtv, &col.x);
|
||||
}
|
||||
|
||||
void D3D11DebugManager::ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil)
|
||||
@@ -3756,7 +3756,7 @@ void D3D11DebugManager::RenderHighlightBox(float w, float h, float scale)
|
||||
m_pImmediateContext->Draw(5, 0);
|
||||
}
|
||||
|
||||
void D3D11DebugManager::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void D3D11DebugManager::RenderCheckerboard()
|
||||
{
|
||||
DebugVertexCBuffer vertexData;
|
||||
|
||||
@@ -3779,8 +3779,8 @@ void D3D11DebugManager::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
|
||||
pixelData.AlwaysZero = 0.0f;
|
||||
|
||||
pixelData.Channels = Vec4f(light.x, light.y, light.z, 0.0f);
|
||||
pixelData.WireframeColour = dark;
|
||||
pixelData.Channels = RenderDoc::Inst().LightCheckerboardColor();
|
||||
pixelData.WireframeColour = RenderDoc::Inst().DarkCheckerboardColor();
|
||||
|
||||
FillCBuffer(m_DebugRender.GenericPSCBuffer, &pixelData, sizeof(DebugPixelCBufferData));
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
|
||||
bool RenderTexture(TextureDisplay cfg, bool blendAlpha);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
|
||||
@@ -1405,7 +1405,7 @@ void D3D11Replay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h)
|
||||
m_pDevice->GetDebugManager()->GetOutputWindowDimensions(id, w, h);
|
||||
}
|
||||
|
||||
void D3D11Replay::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void D3D11Replay::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->ClearOutputWindowColor(id, col);
|
||||
}
|
||||
@@ -1542,9 +1542,9 @@ bool D3D11Replay::RenderTexture(TextureDisplay cfg)
|
||||
return m_pDevice->GetDebugManager()->RenderTexture(cfg, true);
|
||||
}
|
||||
|
||||
void D3D11Replay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void D3D11Replay::RenderCheckerboard()
|
||||
{
|
||||
m_pDevice->GetDebugManager()->RenderCheckerboard(light, dark);
|
||||
m_pDevice->GetDebugManager()->RenderCheckerboard();
|
||||
}
|
||||
|
||||
void D3D11Replay::RenderHighlightBox(float w, float h, float scale)
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
|
||||
bool RenderTexture(TextureDisplay cfg);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
|
||||
@@ -2129,14 +2129,14 @@ void D3D12DebugManager::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32
|
||||
h = m_OutputWindows[id].height;
|
||||
}
|
||||
|
||||
void D3D12DebugManager::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void D3D12DebugManager::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
if(id == 0 || m_OutputWindows.find(id) == m_OutputWindows.end())
|
||||
return;
|
||||
|
||||
ID3D12GraphicsCommandList *list = m_WrappedDevice->GetNewList();
|
||||
|
||||
list->ClearRenderTargetView(m_OutputWindows[id].rtv, col, 0, NULL);
|
||||
list->ClearRenderTargetView(m_OutputWindows[id].rtv, &col.x, 0, NULL);
|
||||
|
||||
list->Close();
|
||||
}
|
||||
@@ -5070,7 +5070,7 @@ void D3D12DebugManager::RenderHighlightBox(float w, float h, float scale)
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12DebugManager::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void D3D12DebugManager::RenderCheckerboard()
|
||||
{
|
||||
DebugVertexCBuffer vertexData;
|
||||
|
||||
@@ -5089,8 +5089,8 @@ void D3D12DebugManager::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
|
||||
pixelData.AlwaysZero = 0.0f;
|
||||
|
||||
pixelData.Channels = Vec4f(light.x, light.y, light.z, 0.0f);
|
||||
pixelData.WireframeColour = dark;
|
||||
pixelData.Channels = RenderDoc::Inst().LightCheckerboardColor();
|
||||
pixelData.WireframeColour = RenderDoc::Inst().DarkCheckerboardColor();
|
||||
|
||||
D3D12_GPU_VIRTUAL_ADDRESS vs = UploadConstants(&vertexData, sizeof(DebugVertexCBuffer));
|
||||
D3D12_GPU_VIRTUAL_ADDRESS ps = UploadConstants(&pixelData, sizeof(pixelData));
|
||||
@@ -6869,7 +6869,6 @@ ResourceId D3D12DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te
|
||||
disp.CustomShader = shader;
|
||||
disp.texid = texid;
|
||||
disp.typeHint = typeHint;
|
||||
disp.lightBackgroundColor = disp.darkBackgroundColor = FloatVector(0, 0, 0, 0);
|
||||
disp.HDRMul = -1.0f;
|
||||
disp.linearDisplayAsGamma = false;
|
||||
disp.mip = mip;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
bool RenderTexture(TextureDisplay cfg, bool blendAlpha);
|
||||
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
|
||||
|
||||
|
||||
@@ -1197,9 +1197,9 @@ void D3D12Replay::SavePipelineState()
|
||||
m_PipelineState = state;
|
||||
}
|
||||
|
||||
void D3D12Replay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void D3D12Replay::RenderCheckerboard()
|
||||
{
|
||||
m_pDevice->GetDebugManager()->RenderCheckerboard(light, dark);
|
||||
m_pDevice->GetDebugManager()->RenderCheckerboard();
|
||||
}
|
||||
|
||||
void D3D12Replay::RenderHighlightBox(float w, float h, float scale)
|
||||
@@ -1529,7 +1529,7 @@ void D3D12Replay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h)
|
||||
m_pDevice->GetDebugManager()->GetOutputWindowDimensions(id, w, h);
|
||||
}
|
||||
|
||||
void D3D12Replay::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void D3D12Replay::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->ClearOutputWindowColor(id, col);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
|
||||
bool RenderTexture(TextureDisplay cfg);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
|
||||
@@ -2035,7 +2035,7 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, int flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
void GLReplay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void GLReplay::RenderCheckerboard()
|
||||
{
|
||||
MakeCurrentReplayContext(m_DebugCtx);
|
||||
|
||||
@@ -2052,8 +2052,8 @@ void GLReplay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
Vec4f *ubo = (Vec4f *)gl.glMapBufferRange(eGL_UNIFORM_BUFFER, 0, sizeof(Vec4f) * 2,
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
|
||||
ubo[0] = Vec4f(light.x, light.y, light.z, 1.0f);
|
||||
ubo[1] = Vec4f(dark.x, dark.y, dark.z, 1.0f);
|
||||
ubo[0] = RenderDoc::Inst().LightCheckerboardColor();
|
||||
ubo[1] = RenderDoc::Inst().DarkCheckerboardColor();
|
||||
|
||||
gl.glUnmapBuffer(eGL_UNIFORM_BUFFER);
|
||||
|
||||
|
||||
@@ -331,14 +331,14 @@ void GLReplay::BindOutputWindow(uint64_t id, bool depth)
|
||||
DebugData.outHeight = float(outw.height);
|
||||
}
|
||||
|
||||
void GLReplay::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void GLReplay::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
if(id == 0 || m_OutputWindows.find(id) == m_OutputWindows.end())
|
||||
return;
|
||||
|
||||
MakeCurrentReplayContext(m_DebugCtx);
|
||||
|
||||
m_pDriver->glClearBufferfv(eGL_COLOR, 0, col);
|
||||
m_pDriver->glClearBufferfv(eGL_COLOR, 0, &col.x);
|
||||
}
|
||||
|
||||
void GLReplay::ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil)
|
||||
@@ -2797,7 +2797,6 @@ ResourceId GLReplay::ApplyCustomShader(ResourceId shader, ResourceId texid, uint
|
||||
disp.CustomShader = shader;
|
||||
disp.texid = texid;
|
||||
disp.typeHint = typeHint;
|
||||
disp.lightBackgroundColor = disp.darkBackgroundColor = FloatVector(0, 0, 0, 0);
|
||||
disp.HDRMul = -1.0f;
|
||||
disp.linearDisplayAsGamma = false;
|
||||
disp.mip = mip;
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
bool RenderTexture(TextureDisplay cfg);
|
||||
bool RenderTextureInternal(TextureDisplay cfg, int flags);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
|
||||
@@ -1522,7 +1522,7 @@ void VulkanReplay::CreateTexImageView(VkImageAspectFlags aspectFlags, VkImage li
|
||||
iminfo.view = view;
|
||||
}
|
||||
|
||||
void VulkanReplay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
void VulkanReplay::RenderCheckerboard()
|
||||
{
|
||||
auto it = m_OutputWindows.find(m_ActiveWinID);
|
||||
if(m_ActiveWinID == 0 || it == m_OutputWindows.end())
|
||||
@@ -1548,12 +1548,8 @@ void VulkanReplay::RenderCheckerboard(Vec3f light, Vec3f dark)
|
||||
uint32_t uboOffs = 0;
|
||||
|
||||
Vec4f *data = (Vec4f *)GetDebugManager()->m_CheckerboardUBO.Map(&uboOffs);
|
||||
data[0].x = light.x;
|
||||
data[0].y = light.y;
|
||||
data[0].z = light.z;
|
||||
data[1].x = dark.x;
|
||||
data[1].y = dark.y;
|
||||
data[1].z = dark.z;
|
||||
data[0] = RenderDoc::Inst().LightCheckerboardColor();
|
||||
data[1] = RenderDoc::Inst().DarkCheckerboardColor();
|
||||
GetDebugManager()->m_CheckerboardUBO.Unmap();
|
||||
|
||||
{
|
||||
@@ -2566,7 +2562,7 @@ void VulkanReplay::BindOutputWindow(uint64_t id, bool depth)
|
||||
#endif
|
||||
}
|
||||
|
||||
void VulkanReplay::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
void VulkanReplay::ClearOutputWindowColor(uint64_t id, FloatVector col)
|
||||
{
|
||||
auto it = m_OutputWindows.find(id);
|
||||
if(id == 0 || it == m_OutputWindows.end())
|
||||
@@ -2597,7 +2593,7 @@ void VulkanReplay::ClearOutputWindowColor(uint64_t id, float col[4])
|
||||
DoPipelineBarrier(cmd, 1, &outw.bbBarrier);
|
||||
|
||||
vt->CmdClearColorImage(Unwrap(cmd), Unwrap(outw.bb), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
(VkClearColorValue *)col, 1, &outw.bbBarrier.subresourceRange);
|
||||
(VkClearColorValue *)&col.x, 1, &outw.bbBarrier.subresourceRange);
|
||||
|
||||
outw.bbBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||
outw.bbBarrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
@@ -5108,7 +5104,6 @@ ResourceId VulkanReplay::ApplyCustomShader(ResourceId shader, ResourceId texid,
|
||||
disp.CustomShader = shader;
|
||||
disp.texid = texid;
|
||||
disp.typeHint = typeHint;
|
||||
disp.lightBackgroundColor = disp.darkBackgroundColor = FloatVector(0, 0, 0, 0);
|
||||
disp.HDRMul = -1.0f;
|
||||
disp.linearDisplayAsGamma = false;
|
||||
disp.mip = mip;
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
void DestroyOutputWindow(uint64_t id);
|
||||
bool CheckResizeOutputWindow(uint64_t id);
|
||||
void GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h);
|
||||
void ClearOutputWindowColor(uint64_t id, float col[4]);
|
||||
void ClearOutputWindowColor(uint64_t id, FloatVector col);
|
||||
void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil);
|
||||
void BindOutputWindow(uint64_t id, bool depth);
|
||||
bool IsOutputWindowVisible(uint64_t id);
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
|
||||
bool RenderTexture(TextureDisplay cfg);
|
||||
|
||||
void RenderCheckerboard(Vec3f light, Vec3f dark);
|
||||
void RenderCheckerboard();
|
||||
|
||||
void RenderHighlightBox(float w, float h, float scale);
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ struct Vec4f
|
||||
z = Z;
|
||||
w = W;
|
||||
}
|
||||
operator Vec3f() const { return Vec3f(x, y, z); }
|
||||
float x, y, z, w;
|
||||
};
|
||||
|
||||
|
||||
@@ -186,6 +186,17 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetConfigSetting(const char
|
||||
RenderDoc::Inst().SetConfigSetting(name, value);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetColors(FloatVector darkChecker,
|
||||
FloatVector lightChecker,
|
||||
bool darkTheme)
|
||||
{
|
||||
RenderDoc::Inst().SetDarkCheckerboardColor(
|
||||
Vec4f(darkChecker.x, darkChecker.y, darkChecker.z, darkChecker.w));
|
||||
RenderDoc::Inst().SetLightCheckerboardColor(
|
||||
Vec4f(lightChecker.x, lightChecker.y, lightChecker.z, lightChecker.w));
|
||||
RenderDoc::Inst().SetDarkTheme(darkTheme);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char *log)
|
||||
{
|
||||
if(log)
|
||||
|
||||
@@ -890,11 +890,12 @@ bool ReplayController::SaveTexture(const TextureSave &saveData, const char *path
|
||||
|
||||
if(sd.alpha != AlphaMapping::Discard)
|
||||
{
|
||||
FloatVector col = sd.alphaCol;
|
||||
Vec4f col = Vec4f(sd.alphaCol.x, sd.alphaCol.y, sd.alphaCol.z);
|
||||
if(sd.alpha == AlphaMapping::BlendToCheckerboard)
|
||||
{
|
||||
bool lightSquare = ((x / 64) % 2) == ((y / 64) % 2);
|
||||
col = lightSquare ? sd.alphaCol : sd.alphaColSecondary;
|
||||
col = lightSquare ? RenderDoc::Inst().LightCheckerboardColor()
|
||||
: RenderDoc::Inst().DarkCheckerboardColor();
|
||||
}
|
||||
|
||||
col.x = powf(col.x, 1.0f / 2.2f);
|
||||
|
||||
@@ -68,6 +68,8 @@ private:
|
||||
|
||||
void RefreshOverlay();
|
||||
|
||||
void ClearBackground(uint64_t outputID, const FloatVector &backgroundColor);
|
||||
|
||||
void DisplayContext();
|
||||
void DisplayTex();
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
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;
|
||||
virtual void ClearOutputWindowColor(uint64_t id, float col[4]) = 0;
|
||||
virtual void ClearOutputWindowColor(uint64_t id, FloatVector col) = 0;
|
||||
virtual void ClearOutputWindowDepth(uint64_t id, float depth, uint8_t stencil) = 0;
|
||||
virtual void BindOutputWindow(uint64_t id, bool depth) = 0;
|
||||
virtual bool IsOutputWindowVisible(uint64_t id) = 0;
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) = 0;
|
||||
virtual void FreeCustomShader(ResourceId id) = 0;
|
||||
|
||||
virtual void RenderCheckerboard(Vec3f light, Vec3f dark) = 0;
|
||||
virtual void RenderCheckerboard() = 0;
|
||||
|
||||
virtual void RenderHighlightBox(float w, float h, float scale) = 0;
|
||||
|
||||
|
||||
@@ -486,23 +486,31 @@ void ReplayOutput::DisablePixelContext()
|
||||
DisplayContext();
|
||||
}
|
||||
|
||||
void ReplayOutput::ClearBackground(uint64_t outputID, const FloatVector &backgroundColor)
|
||||
{
|
||||
if(m_RenderData.texDisplay.backgroundColor.x == 0.0f &&
|
||||
m_RenderData.texDisplay.backgroundColor.y == 0.0f &&
|
||||
m_RenderData.texDisplay.backgroundColor.z == 0.0f &&
|
||||
m_RenderData.texDisplay.backgroundColor.w == 0.0f)
|
||||
m_pDevice->RenderCheckerboard();
|
||||
else
|
||||
m_pDevice->ClearOutputWindowColor(outputID, m_RenderData.texDisplay.backgroundColor);
|
||||
}
|
||||
|
||||
void ReplayOutput::DisplayContext()
|
||||
{
|
||||
if(m_PixelContext.outputID == 0)
|
||||
return;
|
||||
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
m_pDevice->BindOutputWindow(m_PixelContext.outputID, false);
|
||||
ClearBackground(m_PixelContext.outputID, m_RenderData.texDisplay.backgroundColor);
|
||||
|
||||
if((m_Type != ReplayOutputType::Texture) || (m_ContextX < 0.0f && m_ContextY < 0.0f) ||
|
||||
(m_RenderData.texDisplay.texid == ResourceId()))
|
||||
{
|
||||
m_pDevice->RenderCheckerboard(Vec3f(0.81f, 0.81f, 0.81f), Vec3f(0.57f, 0.57f, 0.57f));
|
||||
m_pDevice->FlipOutputWindow(m_PixelContext.outputID);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pDevice->ClearOutputWindowColor(m_PixelContext.outputID, color);
|
||||
|
||||
TextureDisplay disp = m_RenderData.texDisplay;
|
||||
disp.rawoutput = false;
|
||||
disp.CustomShader = ResourceId();
|
||||
@@ -574,16 +582,16 @@ void ReplayOutput::Display()
|
||||
if(!m_pDevice->IsOutputWindowVisible(m_Thumbnails[i].outputID))
|
||||
continue;
|
||||
|
||||
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
FloatVector color;
|
||||
|
||||
if(m_Thumbnails[i].texture == ResourceId())
|
||||
{
|
||||
m_pDevice->BindOutputWindow(m_Thumbnails[i].outputID, false);
|
||||
|
||||
color[0] = 0.4f;
|
||||
color.w = 0.4f;
|
||||
m_pDevice->ClearOutputWindowColor(m_Thumbnails[i].outputID, color);
|
||||
|
||||
m_pDevice->RenderCheckerboard(Vec3f(0.6f, 0.6f, 0.7f), Vec3f(0.5f, 0.5f, 0.6f));
|
||||
m_pDevice->RenderCheckerboard();
|
||||
|
||||
m_pDevice->FlipOutputWindow(m_Thumbnails[i].outputID);
|
||||
continue;
|
||||
@@ -613,8 +621,6 @@ void ReplayOutput::Display()
|
||||
disp.rawoutput = false;
|
||||
disp.overlay = DebugOverlay::NoOverlay;
|
||||
|
||||
disp.lightBackgroundColor = disp.darkBackgroundColor = FloatVector();
|
||||
|
||||
if(m_Thumbnails[i].typeHint == CompType::SNorm)
|
||||
disp.rangemin = -1.0f;
|
||||
|
||||
@@ -662,7 +668,7 @@ void ReplayOutput::DisplayTex()
|
||||
return;
|
||||
if(m_RenderData.texDisplay.texid == ResourceId())
|
||||
{
|
||||
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
FloatVector color;
|
||||
m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
|
||||
m_pDevice->ClearOutputWindowColor(m_MainOutput.outputID, color);
|
||||
return;
|
||||
@@ -701,16 +707,12 @@ void ReplayOutput::DisplayTex()
|
||||
texDisplay.sliceFace = 0;
|
||||
}
|
||||
|
||||
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
FloatVector color;
|
||||
|
||||
m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
|
||||
m_pDevice->ClearOutputWindowColor(m_MainOutput.outputID, color);
|
||||
|
||||
m_pDevice->RenderCheckerboard(
|
||||
Vec3f(texDisplay.lightBackgroundColor.x, texDisplay.lightBackgroundColor.y,
|
||||
texDisplay.lightBackgroundColor.z),
|
||||
Vec3f(texDisplay.darkBackgroundColor.x, texDisplay.darkBackgroundColor.y,
|
||||
texDisplay.darkBackgroundColor.z));
|
||||
ClearBackground(m_MainOutput.outputID, texDisplay.backgroundColor);
|
||||
|
||||
m_pDevice->RenderTexture(texDisplay);
|
||||
|
||||
@@ -742,11 +744,11 @@ void ReplayOutput::DisplayMesh()
|
||||
(m_RenderData.meshDisplay.type == MeshDataStage::Unknown) ||
|
||||
!(draw->flags & DrawFlags::Drawcall))
|
||||
{
|
||||
float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
FloatVector color;
|
||||
m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
|
||||
m_pDevice->ClearOutputWindowColor(m_MainOutput.outputID, color);
|
||||
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
|
||||
m_pDevice->RenderCheckerboard(Vec3f(0.81f, 0.81f, 0.81f), Vec3f(0.57f, 0.57f, 0.57f));
|
||||
m_pDevice->RenderCheckerboard();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -761,7 +763,7 @@ void ReplayOutput::DisplayMesh()
|
||||
m_pDevice->BindOutputWindow(m_MainOutput.outputID, true);
|
||||
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
|
||||
|
||||
m_pDevice->RenderCheckerboard(Vec3f(0.81f, 0.81f, 0.81f), Vec3f(0.57f, 0.57f, 0.57f));
|
||||
m_pDevice->RenderCheckerboard();
|
||||
|
||||
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
|
||||
|
||||
@@ -779,13 +781,20 @@ void ReplayOutput::DisplayMesh()
|
||||
// in the pass
|
||||
|
||||
// very slightly dark red
|
||||
const FloatVector drawItself(0.06f, 0.0f, 0.0f, 1.0f);
|
||||
FloatVector drawItself(0.06f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// more desaturated/lighter, but still reddish
|
||||
const FloatVector otherInstances(0.18f, 0.1f, 0.1f, 1.0f);
|
||||
FloatVector otherInstances(0.18f, 0.1f, 0.1f, 1.0f);
|
||||
|
||||
// lighter grey with blue tinge to contrast from main/instance draws
|
||||
const FloatVector passDraws(0.2f, 0.2f, 0.25f, 1.0f);
|
||||
FloatVector passDraws(0.2f, 0.2f, 0.25f, 1.0f);
|
||||
|
||||
if(RenderDoc::Inst().IsDarkTheme())
|
||||
{
|
||||
drawItself = FloatVector(1.0f, 0.8f, 0.8f, 1.0f);
|
||||
otherInstances = FloatVector(0.78f, 0.6f, 0.6f, 1.0f);
|
||||
passDraws = FloatVector(0.4f, 0.4f, 0.45f, 1.0f);
|
||||
}
|
||||
|
||||
if(m_RenderData.meshDisplay.type != MeshDataStage::VSIn)
|
||||
{
|
||||
|
||||
@@ -77,8 +77,6 @@ void DisplayRendererPreview(IReplayController *renderer, uint32_t width, uint32_
|
||||
d.offy = 0.0f;
|
||||
d.sliceFace = 0;
|
||||
d.rawoutput = false;
|
||||
d.lightBackgroundColor = FloatVector(0.81f, 0.81f, 0.81f, 1.0f);
|
||||
d.darkBackgroundColor = FloatVector(0.57f, 0.57f, 0.57f, 1.0f);
|
||||
d.Red = d.Green = d.Blue = true;
|
||||
d.Alpha = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user