Cleanup unused code from Renderer. Add "persistent" flag to readable depth buffers in the HWDepth deferred renderpaths. This is required to fix a D3D11 bug leading to garbled display with multiple rendertexture views that use readable depth. Closes #2082.

This commit is contained in:
Lasse Öörni 2017-08-20 21:43:18 +03:00
Родитель 3a85655248
Коммит de18c72ce7
5 изменённых файлов: 5 добавлений и 19 удалений

Просмотреть файл

@ -1047,8 +1047,9 @@ Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int m
screenBufferAllocations_[searchKey] = 0;
// Reuse depth-stencil buffers whenever the size matches, instead of allocating new
// Unless persistency specified
unsigned allocations = screenBufferAllocations_[searchKey];
if (!depthStencil)
if (!depthStencil || persistentKey)
++screenBufferAllocations_[searchKey];
if (allocations >= screenBuffers_[searchKey].Size())
@ -1386,17 +1387,6 @@ bool Renderer::ResizeInstancingBuffer(unsigned numInstances)
return true;
}
void Renderer::SaveScreenBufferAllocations()
{
savedScreenBufferAllocations_ = screenBufferAllocations_;
}
void Renderer::RestoreScreenBufferAllocations()
{
screenBufferAllocations_ = savedScreenBufferAllocations_;
}
void Renderer::OptimizeLightByScissor(Light* light, Camera* camera)
{
if (light && light->GetLightType() != LIGHT_DIRECTIONAL)

Просмотреть файл

@ -415,10 +415,6 @@ public:
void SetCullMode(CullMode mode, Camera* camera);
/// Ensure sufficient size of the instancing vertex buffer. Return true if successful.
bool ResizeInstancingBuffer(unsigned numInstances);
/// Save the screen buffer allocation status. Called by View.
void SaveScreenBufferAllocations();
/// Restore the screen buffer allocation status. Called by View.
void RestoreScreenBufferAllocations();
/// Optimize a light by scissor rectangle.
void OptimizeLightByScissor(Light* light, Camera* camera);
/// Optimize a light by marking it to the stencil buffer and setting a stencil test.

Просмотреть файл

@ -1,7 +1,7 @@
<renderpath>
<rendertarget name="albedo" sizedivisor="1 1" format="rgba" />
<rendertarget name="normal" sizedivisor="1 1" format="rgba" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" persistent="true" />
<command type="clear" color="fog" depth="1.0" stencil="0" depthstencil="depth" />
<command type="clear" color="0 0 0 0" output="albedo" depthstencil="depth" />
<command type="scenepass" pass="deferred" marktostencil="true" vertexlights="true" metadata="gbuffer" depthstencil="depth">

Просмотреть файл

@ -2,7 +2,7 @@
<rendertarget name="specular" sizedivisor="1 1" format="rgba16f" />
<rendertarget name="albedo" sizedivisor="1 1" format="rgba16f" />
<rendertarget name="normal" sizedivisor="1 1" format="rgba16f" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" persistent="true" />
<command type="clear" color="0 0 0 0" depth="1.0" stencil="0" depthstencil="depth" />
<command type="clear" color="0 0 0 0" output="albedo" depthstencil="depth"/>
<command type="clear" color="0 0 0 0" output="specular" depthstencil="depth" />

Просмотреть файл

@ -1,7 +1,7 @@
<renderpath>
<rendertarget name="light" sizedivisor="1 1" format="rgba" />
<rendertarget name="normal" sizedivisor="1 1" format="rgba" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" />
<rendertarget name="depth" sizedivisor="1 1" format="readabledepth" persistent="true" />
<command type="clear" color="fog" depth="1.0" stencil="0" depthstencil="depth" />
<command type="scenepass" pass="prepass" marktostencil="true" metadata="gbuffer" output="normal" depthstencil="depth" />
<command type="clear" color="0 0 0 0" output="light" depthstencil="depth" />