mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Fix brush colors in pixel history view
The shader output brush colors were displaying the tex before color instead of the shader output color. Updated the linear -> sRGB formula to match what DirectX does.
This commit is contained in:
committed by
Baldur Karlsson
parent
4b2d753521
commit
c4caf64464
@@ -320,9 +320,16 @@ public:
|
||||
if(col == 2)
|
||||
{
|
||||
if(isEvent(index))
|
||||
{
|
||||
return backgroundBrush(getMods(index).first().preMod);
|
||||
}
|
||||
else
|
||||
return backgroundBrush(getMod(index).preMod);
|
||||
{
|
||||
const PixelModification &mod = getMod(index);
|
||||
if(mod.directShaderWrite)
|
||||
return backgroundBrush(mod.preMod);
|
||||
return backgroundBrush(mod.shaderOut);
|
||||
}
|
||||
}
|
||||
else if(col == 4)
|
||||
{
|
||||
@@ -476,13 +483,16 @@ private:
|
||||
if(m_IsDepth)
|
||||
r = g = b = qBound(0.0f, (val.depth - m_Display.rangeMin) / rangesize, 1.0f);
|
||||
|
||||
// Convert from linear color to sRGB
|
||||
{
|
||||
r = (float)powf(r, 1.0f / 2.2f);
|
||||
g = (float)powf(g, 1.0f / 2.2f);
|
||||
b = (float)powf(b, 1.0f / 2.2f);
|
||||
r = (r <= 0.0031308f) ? r * 12.92f : 1.055f * (float)powf(r, 1.0f / 2.4f) - 0.055f;
|
||||
g = (g <= 0.0031308f) ? g * 12.92f : 1.055f * (float)powf(g, 1.0f / 2.4f) - 0.055f;
|
||||
b = (b <= 0.0031308f) ? b * 12.92f : 1.055f * (float)powf(b, 1.0f / 2.4f) - 0.055f;
|
||||
}
|
||||
|
||||
return QBrush(QColor::fromRgb((int)(255.0f * r), (int)(255.0f * g), (int)(255.0f * b)));
|
||||
// Round to nearest value in [0,255]
|
||||
return QBrush(QColor::fromRgb((int)(255.0f * r + 0.5f), (int)(255.0f * g + 0.5f),
|
||||
(int)(255.0f * b + 0.5f)));
|
||||
}
|
||||
|
||||
QString modString(const ModificationValue &val, int forceComps = 0) const
|
||||
|
||||
Reference in New Issue
Block a user