mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-01 08:48:35 +00:00
VideoBackends: Use vertex shader depth range if ztexture is used.
This commit is contained in:
parent
bde8126913
commit
a15555fe03
8 changed files with 69 additions and 60 deletions
|
@ -940,3 +940,30 @@ void Renderer::DumpFrameToImage(const FrameDumpConfig& config)
|
|||
TextureToPng(config.data, config.stride, filename, config.width, config.height, false);
|
||||
m_frame_dump_image_counter++;
|
||||
}
|
||||
|
||||
bool Renderer::UseVertexDepthRange() const
|
||||
{
|
||||
// We can't compute the depth range in the vertex shader if we don't support depth clamp.
|
||||
if (!g_ActiveConfig.backend_info.bSupportsDepthClamp)
|
||||
return false;
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsOversizedDepthRanges)
|
||||
{
|
||||
// We support oversized depth ranges, but we need a full depth range if a ztexture is used.
|
||||
return bpmem.ztex2.type != ZTEXTURE_DISABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need a full depth range if a ztexture is used.
|
||||
if (bpmem.ztex2.type != ZTEXTURE_DISABLE)
|
||||
return true;
|
||||
|
||||
// If an inverted depth range is unsupported, we also need to check if the range is inverted.
|
||||
if (!g_ActiveConfig.backend_info.bSupportsReversedDepthRange && xfmem.viewport.zRange < 0.0f)
|
||||
return true;
|
||||
|
||||
// If an oversized depth range or a ztexture is used, we need to calculate the depth range
|
||||
// in the vertex shader.
|
||||
return fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue