Skip to content

Commit

Permalink
Fixed bad rendering using pixel shaders and prevents use tone mapping…
Browse files Browse the repository at this point in the history
… when HDR is active
  • Loading branch information
thexai committed Dec 25, 2019
1 parent 0d6d586 commit 5048d02
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bool COutputShader::Create(bool useLUT, bool useDithering, int ditherDepth, bool
{
m_useLut = useLUT;
m_ditherDepth = ditherDepth;
m_toneMapping = toneMapping;
m_toneMapping = toneMapping && !DX::DeviceResources::Get()->Is10BitSwapchain();

CWinShader::CreateVertexBuffer(4, sizeof(Vertex));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ CRect CRendererDXVA::ApplyTransforms(const CRect& destRect) const
bool CRendererDXVA::UseToneMapping() const
{
// use mapping only if processor doesn't support HDR10
return !m_processor->HasHDR10Support() && __super::UseToneMapping();
// and is not 10 bit swapchain (HDR to SDR conversion)
return !m_processor->HasHDR10Support() && !DX::DeviceResources::Get()->Is10BitSwapchain() &&
__super::UseToneMapping();
}

void CRendererDXVA::FillBuffersSet(CRenderBuffer* (&buffers)[8])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void CRendererShaders::UpdateVideoFilters()
if (!m_colorShader)
{
m_colorShader = std::make_unique<CYUV2RGBShader>();
if (!m_colorShader->Create(m_format, AVCOL_PRI_BT709, m_srcPrimaries))
if (!m_colorShader->Create(m_format, m_srcPrimaries, m_srcPrimaries))
{
// we are in a big trouble
CLog::LogF(LOGERROR, "unable to create YUV->RGB shader, rendering is not possible");
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/builtins/GUIBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,6 @@ CBuiltins::CommandMap CGUIBuiltins::GetOperations() const
{"setstereomode", {"Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, anaglyph_yellow_blue, monoscopic)", 1, SetStereoMode}},
{"takescreenshot", {"Takes a Screenshot", 0, Screenshot}},
{"toggledirtyregionvisualization", {"Enables/disables dirty-region visualization", 0, ToggleDirty}},
{"windowshdrswitch", {"Enables/disables Windows HDR and restart Kodi", 0, WindowsHDRSwitch}}
{"windowshdrswitch", {"Toggles Windows HDR On/Off and restarts Kodi", 0, WindowsHDRSwitch}}
};
}
1 change: 0 additions & 1 deletion xbmc/rendering/dx/DeviceResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,6 @@ bool DX::DeviceResources::IsDisplayHDREnabled()
hdr10.MaxMasteringLuminance = static_cast<uint32_t>(FACTOR_2 * od.MaxLuminance);
hdr10.MinMasteringLuminance = static_cast<uint32_t>(FACTOR_2 * od.MinLuminance);
hdr10.MaxContentLightLevel = static_cast<uint16_t>(od.MaxFullFrameLuminance);
hdr10.MaxFrameAverageLightLevel = static_cast<uint16_t>(od.MaxFullFrameLuminance);
}
else if (od.MaxLuminance >= 400.0)
{
Expand Down

0 comments on commit 5048d02

Please sign in to comment.