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
|
1 - 1/4 pixel count, 9 samples total
|
||||||
2 - 1/16 pixel count, 25 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
|
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
|
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_DED 8 // for the dedicated server
|
||||||
#define MIN_COMHUNKMEGS 56
|
#define MIN_COMHUNKMEGS 56
|
||||||
#define CST_COMZONEMEGS 32
|
|
||||||
#ifdef DEDICATED
|
#ifdef DEDICATED
|
||||||
|
#define CST_COMZONEMEGS 32
|
||||||
#define DEF_COMHUNKMEGS 64
|
#define DEF_COMHUNKMEGS 64
|
||||||
#define CST_SMALLZONEMEGS 1
|
#define CST_SMALLZONEMEGS 1
|
||||||
#else
|
#else
|
||||||
|
#define CST_COMZONEMEGS 96
|
||||||
#define DEF_COMHUNKMEGS 128
|
#define DEF_COMHUNKMEGS 128
|
||||||
#define CST_SMALLZONEMEGS 4
|
#define CST_SMALLZONEMEGS 4
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -874,16 +874,28 @@ namespace RHI
|
||||||
return heap;
|
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;
|
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
|
||||||
rhi.device->GetCopyableFootprints(&textureDesc, 0, 1, 0, &layout, NULL, NULL, NULL);
|
rhi.device->GetCopyableFootprints(&textureDesc, 0, 1, 0, &layout, NULL, NULL, NULL);
|
||||||
Q_assert(layout.Footprint.Format == DXGI_FORMAT_R8G8B8A8_UNORM);
|
const uint32_t byteCount = (uint32_t)(layout.Footprint.RowPitch * layout.Footprint.Height);
|
||||||
Q_assert((UINT64)layout.Footprint.Width == textureDesc.Width);
|
|
||||||
Q_assert(layout.Footprint.Height == textureDesc.Height);
|
|
||||||
|
|
||||||
return layout.Footprint.RowPitch * layout.Footprint.Height;
|
return byteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fence::Create(UINT64 value, const char* name)
|
void Fence::Create(UINT64 value, const char* name)
|
||||||
|
@ -1170,9 +1182,7 @@ namespace RHI
|
||||||
SetDebugName(readbackCommandList, "readback", D3DResourceType::CommandList);
|
SetDebugName(readbackCommandList, "readback", D3DResourceType::CommandList);
|
||||||
D3D(readbackCommandList->Close());
|
D3D(readbackCommandList->Close());
|
||||||
|
|
||||||
Texture& texture = rhi.textures.Get(GetSwapChainTexture());
|
const uint32_t byteCount = GetReadbackTextureByteCount();
|
||||||
Q_assert(texture.desc.format == TextureFormat::RGBA32_UNorm);
|
|
||||||
const uint32_t byteCount = GetTextureByteCount(texture.texture);
|
|
||||||
BufferDesc desc("readback", byteCount, ResourceStates::CopyDestinationBit);
|
BufferDesc desc("readback", byteCount, ResourceStates::CopyDestinationBit);
|
||||||
desc.memoryUsage = MemoryUsage::Readback;
|
desc.memoryUsage = MemoryUsage::Readback;
|
||||||
readbackBuffer = CreateBuffer(desc);
|
readbackBuffer = CreateBuffer(desc);
|
||||||
|
@ -1190,9 +1200,7 @@ namespace RHI
|
||||||
|
|
||||||
void ReadbackManager::ResizeIfNeeded()
|
void ReadbackManager::ResizeIfNeeded()
|
||||||
{
|
{
|
||||||
Texture& texture = rhi.textures.Get(GetSwapChainTexture());
|
const uint32_t byteCount = GetReadbackTextureByteCount();
|
||||||
Q_assert(texture.desc.format == TextureFormat::RGBA32_UNorm);
|
|
||||||
const UINT byteCount = GetTextureByteCount(texture.texture);
|
|
||||||
if(byteCount <= bufferByteCount)
|
if(byteCount <= bufferByteCount)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue