| 128 | } |
| 129 | |
| 130 | ALResult Tr2ResourceHelper::CreateScratch( Resource& resource, Tr2PrimaryRenderContextAL& renderContext, size_t size ) |
| 131 | { |
| 132 | CComPtr<ID3D12Resource> buffer; |
| 133 | auto scratchHeap = HeapDesc( D3D12_HEAP_TYPE_UPLOAD ); |
| 134 | auto scratchDesc = BufferDesc( size ); |
| 135 | CR_RETURN_HR( renderContext.m_device->CreateCommittedResource( |
| 136 | &scratchHeap, |
| 137 | D3D12_HEAP_FLAG_NONE, |
| 138 | &scratchDesc, |
| 139 | m_strategy == DYNAMIC ? m_defaultState : D3D12_RESOURCE_STATE_GENERIC_READ, |
| 140 | nullptr, |
| 141 | IID_PPV_ARGS( &buffer ) ) ); |
| 142 | |
| 143 | D3D12_RANGE readRange = { 0, 0 }; |
| 144 | CR_RETURN_HR( buffer->Map( 0, &readRange, &resource.cpuAddress ) ); |
| 145 | resource.resource = buffer; |
| 146 | resource.frameIndex = renderContext.GetRecordingFrameNumber(); |
| 147 | resource.gpuAddress = buffer->GetGPUVirtualAddress(); |
| 148 | if( !m_name.empty() ) |
| 149 | { |
| 150 | SetDebugName( buffer, m_name.c_str() ); |
| 151 | } |
| 152 | return S_OK; |
| 153 | } |
| 154 | |
| 155 | ALResult Tr2ResourceHelper::MapForWriting( void*& data, Tr2LockType::Type lockType, Tr2PrimaryRenderContextAL& renderContext ) |
| 156 | { |
nothing calls this directly
no test coverage detected