mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-02 05:32:14 +00:00
allocating enough zone memory for 4K videos
This commit is contained in:
parent
68c28996e1
commit
3c25554bde
3 changed files with 24 additions and 13 deletions
|
@ -100,6 +100,8 @@ add: Cinematic Rendering Pipeline CVars
|
|||
1 - 1/4 pixel count, 9 samples total
|
||||
2 - 1/16 pixel count, 25 samples total
|
||||
|
||||
fix: allocating enough memory for 4K screenshots and video captures
|
||||
|
||||
fix: the new demo player now drops zombie snapshots and snapshots from before a server time rewind
|
||||
these problematic snapshots happen right before and after gamestate changes
|
||||
|
||||
|
|
|
@ -52,11 +52,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#define MIN_COMHUNKMEGS_DED 8 // for the dedicated server
|
||||
#define MIN_COMHUNKMEGS 56
|
||||
#define CST_COMZONEMEGS 32
|
||||
#ifdef DEDICATED
|
||||
#define CST_COMZONEMEGS 32
|
||||
#define DEF_COMHUNKMEGS 64
|
||||
#define CST_SMALLZONEMEGS 1
|
||||
#else
|
||||
#define CST_COMZONEMEGS 96
|
||||
#define DEF_COMHUNKMEGS 128
|
||||
#define CST_SMALLZONEMEGS 4
|
||||
#endif
|
||||
|
|
|
@ -874,16 +874,28 @@ namespace RHI
|
|||
return heap;
|
||||
}
|
||||
|
||||
static UINT GetTextureByteCount(ID3D12Resource* texture)
|
||||
static uint32_t GetReadbackTextureByteCount()
|
||||
{
|
||||
const D3D12_RESOURCE_DESC textureDesc = texture->GetDesc();
|
||||
// we base the resolution on the render targets, not the swap chain images
|
||||
// this allows us to e.g. capture videos at 4K while displaying a 720p window
|
||||
D3D12_RESOURCE_DESC textureDesc = {};
|
||||
textureDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
textureDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
textureDesc.Width = glConfig.vidWidth;
|
||||
textureDesc.Height = glConfig.vidHeight;
|
||||
textureDesc.DepthOrArraySize = 1;
|
||||
textureDesc.MipLevels = 1;
|
||||
textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
textureDesc.SampleDesc.Count = 1;
|
||||
textureDesc.SampleDesc.Quality = 0;
|
||||
textureDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
|
||||
textureDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
|
||||
rhi.device->GetCopyableFootprints(&textureDesc, 0, 1, 0, &layout, NULL, NULL, NULL);
|
||||
Q_assert(layout.Footprint.Format == DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||
Q_assert((UINT64)layout.Footprint.Width == textureDesc.Width);
|
||||
Q_assert(layout.Footprint.Height == textureDesc.Height);
|
||||
const uint32_t byteCount = (uint32_t)(layout.Footprint.RowPitch * layout.Footprint.Height);
|
||||
|
||||
return layout.Footprint.RowPitch * layout.Footprint.Height;
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void Fence::Create(UINT64 value, const char* name)
|
||||
|
@ -1170,9 +1182,7 @@ namespace RHI
|
|||
SetDebugName(readbackCommandList, "readback", D3DResourceType::CommandList);
|
||||
D3D(readbackCommandList->Close());
|
||||
|
||||
Texture& texture = rhi.textures.Get(GetSwapChainTexture());
|
||||
Q_assert(texture.desc.format == TextureFormat::RGBA32_UNorm);
|
||||
const uint32_t byteCount = GetTextureByteCount(texture.texture);
|
||||
const uint32_t byteCount = GetReadbackTextureByteCount();
|
||||
BufferDesc desc("readback", byteCount, ResourceStates::CopyDestinationBit);
|
||||
desc.memoryUsage = MemoryUsage::Readback;
|
||||
readbackBuffer = CreateBuffer(desc);
|
||||
|
@ -1190,9 +1200,7 @@ namespace RHI
|
|||
|
||||
void ReadbackManager::ResizeIfNeeded()
|
||||
{
|
||||
Texture& texture = rhi.textures.Get(GetSwapChainTexture());
|
||||
Q_assert(texture.desc.format == TextureFormat::RGBA32_UNorm);
|
||||
const UINT byteCount = GetTextureByteCount(texture.texture);
|
||||
const uint32_t byteCount = GetReadbackTextureByteCount();
|
||||
if(byteCount <= bufferByteCount)
|
||||
{
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue