[D3D12] Remove TODO for initial EDRAM clear since Windows clears allocations anyway

This commit is contained in:
Triang3l 2019-04-09 19:45:35 +03:00
parent 959b8ef19e
commit 4e8e75c549
2 changed files with 6 additions and 7 deletions

View File

@ -113,12 +113,16 @@ bool RenderTargetCache::Initialize(const TextureCache* texture_cache) {
auto device = provider->GetDevice(); auto device = provider->GetDevice();
// Create the buffer for reinterpreting EDRAM contents. // Create the buffer for reinterpreting EDRAM contents.
// No need to clear it in the first frame, memory is zeroed out when allocated
// on Windows.
D3D12_RESOURCE_DESC edram_buffer_desc; D3D12_RESOURCE_DESC edram_buffer_desc;
ui::d3d12::util::FillBufferResourceDesc( ui::d3d12::util::FillBufferResourceDesc(
edram_buffer_desc, GetEDRAMBufferSize(), edram_buffer_desc, GetEDRAMBufferSize(),
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
// The first operation will be a clear. // The first operation will likely be drawing with ROV or a load without ROV.
edram_buffer_state_ = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; edram_buffer_state_ = command_processor_->IsROVUsedForEDRAM()
? D3D12_RESOURCE_STATE_UNORDERED_ACCESS
: D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
if (FAILED(device->CreateCommittedResource( if (FAILED(device->CreateCommittedResource(
&ui::d3d12::util::kHeapPropertiesDefault, D3D12_HEAP_FLAG_NONE, &ui::d3d12::util::kHeapPropertiesDefault, D3D12_HEAP_FLAG_NONE,
&edram_buffer_desc, edram_buffer_state_, nullptr, &edram_buffer_desc, edram_buffer_state_, nullptr,
@ -127,7 +131,6 @@ bool RenderTargetCache::Initialize(const TextureCache* texture_cache) {
Shutdown(); Shutdown();
return false; return false;
} }
edram_buffer_cleared_ = false;
// Create non-shader-visible descriptors of the EDRAM buffer for copying. // Create non-shader-visible descriptors of the EDRAM buffer for copying.
D3D12_DESCRIPTOR_HEAP_DESC edram_buffer_descriptor_heap_desc; D3D12_DESCRIPTOR_HEAP_DESC edram_buffer_descriptor_heap_desc;
@ -437,9 +440,6 @@ void RenderTargetCache::ClearCache() {
void RenderTargetCache::BeginFrame() { void RenderTargetCache::BeginFrame() {
ClearBindings(); ClearBindings();
// TODO(Triang3l): Clear the EDRAM buffer if this is the first frame for a
// stable D24F==D32F comparison.
} }
bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) { bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {

View File

@ -511,7 +511,6 @@ class RenderTargetCache {
// The EDRAM buffer allowing color and depth data to be reinterpreted. // The EDRAM buffer allowing color and depth data to be reinterpreted.
ID3D12Resource* edram_buffer_ = nullptr; ID3D12Resource* edram_buffer_ = nullptr;
D3D12_RESOURCE_STATES edram_buffer_state_; D3D12_RESOURCE_STATES edram_buffer_state_;
bool edram_buffer_cleared_;
// Non-shader-visible descriptor heap containing pre-created SRV and UAV // Non-shader-visible descriptor heap containing pre-created SRV and UAV
// descriptors of the EDRAM buffer, for faster binding (via copying rather // descriptors of the EDRAM buffer, for faster binding (via copying rather