Merge remote-tracking branch 'origin/1.11' into work
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
This commit is contained in:
@@ -267,7 +267,7 @@ void GPUContextDX11::SetRenderTarget(GPUTextureView* depthBuffer, const Span<GPU
|
||||
auto depthBufferDX11 = static_cast<GPUTextureViewDX11*>(depthBuffer);
|
||||
ID3D11DepthStencilView* dsv = depthBufferDX11 ? depthBufferDX11->DSV() : nullptr;
|
||||
|
||||
ID3D11RenderTargetView* rtvs[GPU_MAX_RT_BINDED];
|
||||
__declspec(align(16)) ID3D11RenderTargetView* rtvs[GPU_MAX_RT_BINDED];
|
||||
for (int32 i = 0; i < rts.Length(); i++)
|
||||
{
|
||||
auto rtDX11 = reinterpret_cast<GPUTextureViewDX11*>(rts[i]);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
#if !USE_EDITOR && PLATFORM_WINDOWS
|
||||
#include "Engine/Core/Config/PlatformSettings.h"
|
||||
@@ -764,7 +765,7 @@ void GPUDeviceDX11::DrawEnd()
|
||||
{
|
||||
GPUDeviceDX::DrawEnd();
|
||||
|
||||
#if GPU_ENABLE_DIAGNOSTICS
|
||||
#if GPU_ENABLE_DIAGNOSTICS && LOG_ENABLE
|
||||
// Flush debug messages queue
|
||||
ComPtr<ID3D11InfoQueue> infoQueue;
|
||||
VALIDATE_DIRECTX_CALL(_device->QueryInterface(IID_PPV_ARGS(&infoQueue)));
|
||||
@@ -810,16 +811,19 @@ void GPUDeviceDX11::DrawEnd()
|
||||
|
||||
GPUTexture* GPUDeviceDX11::CreateTexture(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsTextures);
|
||||
return New<GPUTextureDX11>(this, name);
|
||||
}
|
||||
|
||||
GPUShader* GPUDeviceDX11::CreateShader(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUShaderDX11>(this, name);
|
||||
}
|
||||
|
||||
GPUPipelineState* GPUDeviceDX11::CreatePipelineState()
|
||||
{
|
||||
PROFILE_MEM(GraphicsCommands);
|
||||
return New<GPUPipelineStateDX11>(this);
|
||||
}
|
||||
|
||||
@@ -830,6 +834,7 @@ GPUTimerQuery* GPUDeviceDX11::CreateTimerQuery()
|
||||
|
||||
GPUBuffer* GPUDeviceDX11::CreateBuffer(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsBuffers);
|
||||
return New<GPUBufferDX11>(this, name);
|
||||
}
|
||||
|
||||
@@ -850,6 +855,7 @@ GPUSwapChain* GPUDeviceDX11::CreateSwapChain(Window* window)
|
||||
|
||||
GPUConstantBuffer* GPUDeviceDX11::CreateConstantBuffer(uint32 size, const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
ID3D11Buffer* buffer = nullptr;
|
||||
uint32 memorySize = 0;
|
||||
if (size)
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
#if GRAPHICS_API_DIRECTX11
|
||||
|
||||
#include "GPUSwapChainDX11.h"
|
||||
#include "GPUContextDX11.h"
|
||||
#include "Engine/Platform/Window.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
|
||||
#include "GPUContextDX11.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
GPUSwapChainDX11::GPUSwapChainDX11(GPUDeviceDX11* device, Window* window)
|
||||
: GPUResourceDX11(device, StringView::Empty)
|
||||
@@ -60,9 +62,11 @@ void GPUSwapChainDX11::OnReleaseGPU()
|
||||
#endif
|
||||
|
||||
// Release data
|
||||
PROFILE_MEM_DEC(Graphics, _memoryUsage);
|
||||
releaseBackBuffer();
|
||||
DX_SAFE_RELEASE_CHECK(_swapChain, 0);
|
||||
_width = _height = 0;
|
||||
_memoryUsage = 0;
|
||||
}
|
||||
|
||||
ID3D11Resource* GPUSwapChainDX11::GetResource()
|
||||
@@ -137,6 +141,9 @@ GPUTextureView* GPUSwapChainDX11::GetBackBufferView()
|
||||
|
||||
void GPUSwapChainDX11::Present(bool vsync)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
|
||||
// Present frame
|
||||
ASSERT(_swapChain);
|
||||
UINT presentFlags = 0;
|
||||
@@ -262,6 +269,7 @@ bool GPUSwapChainDX11::Resize(int32 width, int32 height)
|
||||
_width = width;
|
||||
_height = height;
|
||||
_memoryUsage = RenderTools::CalculateTextureMemoryUsage(_format, _width, _height, 1) * swapChainDesc.BufferCount;
|
||||
PROFILE_MEM_INC(Graphics, _memoryUsage);
|
||||
|
||||
getBackBuffer();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "GPUDeviceDX12.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
|
||||
FenceDX12::FenceDX12(GPUDeviceDX12* device)
|
||||
: _currentValue(1)
|
||||
@@ -64,12 +65,12 @@ void FenceDX12::WaitCPU(uint64 value)
|
||||
{
|
||||
if (IsFenceComplete(value))
|
||||
return;
|
||||
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
ScopeLock lock(_locker);
|
||||
|
||||
_fence->SetEventOnCompletion(value, _event);
|
||||
WaitForSingleObject(_event, INFINITE);
|
||||
|
||||
_lastCompletedValue = _fence->GetCompletedValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Engine/Threading/Threading.h"
|
||||
|
||||
#define DX12_ENABLE_RESOURCE_BARRIERS_BATCHING 1
|
||||
#define DX12_ENABLE_RESOURCE_BARRIERS_DEBUGGING 0
|
||||
#define DX12_ENABLE_RESOURCE_BARRIERS_DEBUGGING (0 && LOG_ENABLE)
|
||||
|
||||
inline bool operator!=(const D3D12_VERTEX_BUFFER_VIEW& l, const D3D12_VERTEX_BUFFER_VIEW& r)
|
||||
{
|
||||
@@ -977,7 +977,7 @@ void GPUContextDX12::BindVB(const Span<GPUBuffer*>& vertexBuffers, const uint32*
|
||||
{
|
||||
ASSERT(vertexBuffers.Length() >= 0 && vertexBuffers.Length() <= GPU_MAX_VB_BINDED);
|
||||
bool vbEdited = _vbCount != vertexBuffers.Length();
|
||||
D3D12_VERTEX_BUFFER_VIEW views[GPU_MAX_VB_BINDED];
|
||||
__declspec(align(16)) D3D12_VERTEX_BUFFER_VIEW views[GPU_MAX_VB_BINDED];
|
||||
for (int32 i = 0; i < vertexBuffers.Length(); i++)
|
||||
{
|
||||
const auto vbDX12 = static_cast<GPUBufferDX12*>(vertexBuffers[i]);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Config/PlatformSettings.h"
|
||||
#include "UploadBufferDX12.h"
|
||||
@@ -833,16 +834,19 @@ void GPUDeviceDX12::WaitForGPU()
|
||||
|
||||
GPUTexture* GPUDeviceDX12::CreateTexture(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsTextures);
|
||||
return New<GPUTextureDX12>(this, name);
|
||||
}
|
||||
|
||||
GPUShader* GPUDeviceDX12::CreateShader(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUShaderDX12>(this, name);
|
||||
}
|
||||
|
||||
GPUPipelineState* GPUDeviceDX12::CreatePipelineState()
|
||||
{
|
||||
PROFILE_MEM(GraphicsCommands);
|
||||
return New<GPUPipelineStateDX12>(this);
|
||||
}
|
||||
|
||||
@@ -853,6 +857,7 @@ GPUTimerQuery* GPUDeviceDX12::CreateTimerQuery()
|
||||
|
||||
GPUBuffer* GPUDeviceDX12::CreateBuffer(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsBuffers);
|
||||
return New<GPUBufferDX12>(this, name);
|
||||
}
|
||||
|
||||
@@ -873,6 +878,7 @@ GPUSwapChain* GPUDeviceDX12::CreateSwapChain(Window* window)
|
||||
|
||||
GPUConstantBuffer* GPUDeviceDX12::CreateConstantBuffer(uint32 size, const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUConstantBufferDX12>(this, size, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "GPUContextDX12.h"
|
||||
#include "../IncludeDirectXHeaders.h"
|
||||
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
void BackBufferDX12::Setup(GPUSwapChainDX12* window, ID3D12Resource* backbuffer)
|
||||
{
|
||||
@@ -71,6 +73,7 @@ void GPUSwapChainDX12::OnReleaseGPU()
|
||||
#endif
|
||||
|
||||
// Release data
|
||||
PROFILE_MEM_DEC(Graphics, _memoryUsage);
|
||||
releaseBackBuffer();
|
||||
_backBuffers.Resize(0);
|
||||
if (_swapChain)
|
||||
@@ -79,6 +82,7 @@ void GPUSwapChainDX12::OnReleaseGPU()
|
||||
_swapChain = nullptr;
|
||||
}
|
||||
_width = _height = 0;
|
||||
_memoryUsage = 0;
|
||||
}
|
||||
|
||||
void GPUSwapChainDX12::releaseBackBuffer()
|
||||
@@ -244,6 +248,7 @@ bool GPUSwapChainDX12::Resize(int32 width, int32 height)
|
||||
_width = width;
|
||||
_height = height;
|
||||
_memoryUsage = RenderTools::CalculateTextureMemoryUsage(_format, _width, _height, 1) * swapChainDesc.BufferCount;
|
||||
PROFILE_MEM_INC(Graphics, _memoryUsage);
|
||||
|
||||
getBackBuffer();
|
||||
#endif
|
||||
@@ -360,6 +365,8 @@ void GPUSwapChainDX12::End(RenderTask* task)
|
||||
|
||||
void GPUSwapChainDX12::Present(bool vsync)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
#if PLATFORM_XBOX_SCARLETT || PLATFORM_XBOX_ONE
|
||||
ID3D12Resource* backBuffer = _backBuffers[_currentFrameIndex].GetResource();
|
||||
D3D12XBOX_PRESENT_PLANE_PARAMETERS planeParameters = {};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "GPUTextureDX12.h"
|
||||
#include "GPUContextDX12.h"
|
||||
#include "../RenderToolsDX.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
UploadBufferDX12::UploadBufferDX12(GPUDeviceDX12* device)
|
||||
: _device(device)
|
||||
@@ -235,6 +236,7 @@ UploadBufferPageDX12::UploadBufferPageDX12(GPUDeviceDX12* device, uint64 size)
|
||||
initResource(resource, D3D12_RESOURCE_STATE_GENERIC_READ, 1);
|
||||
DX_SET_DEBUG_NAME(_resource, GPUResourceDX12::GetName());
|
||||
_memoryUsage = size;
|
||||
PROFILE_MEM_INC(GraphicsCommands, _memoryUsage);
|
||||
GPUAddress = _resource->GetGPUVirtualAddress();
|
||||
|
||||
// Map buffer
|
||||
@@ -243,6 +245,8 @@ UploadBufferPageDX12::UploadBufferPageDX12(GPUDeviceDX12* device, uint64 size)
|
||||
|
||||
void UploadBufferPageDX12::OnReleaseGPU()
|
||||
{
|
||||
PROFILE_MEM_DEC(GraphicsCommands, _memoryUsage);
|
||||
|
||||
// Unmap
|
||||
if (_resource && CPUAddress)
|
||||
{
|
||||
|
||||
@@ -387,10 +387,14 @@ void RenderToolsDX::LogD3DResult(HRESULT result, const char* file, uint32 line,
|
||||
if (removedReason == DXGI_ERROR_DEVICE_HUNG)
|
||||
errorType = FatalErrorType::GPUHang;
|
||||
}
|
||||
else if (fatal)
|
||||
errorType = FatalErrorType::Unknown;
|
||||
if (errorType != FatalErrorType::None)
|
||||
Platform::Fatal(msg, nullptr, errorType);
|
||||
#if LOG_ENABLE
|
||||
else
|
||||
Log::Logger::Write(fatal ? LogType::Fatal : LogType::Error, msg);
|
||||
Log::Logger::Write(LogType::Error, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
LPCSTR RenderToolsDX::GetVertexInputSemantic(VertexElement::Types type, UINT& semanticIndex)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "GPUVertexLayoutNull.h"
|
||||
#include "GPUSwapChainNull.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Graphics/Async/GPUTasksManager.h"
|
||||
|
||||
GPUDeviceNull::GPUDeviceNull()
|
||||
@@ -145,16 +146,19 @@ void GPUDeviceNull::WaitForGPU()
|
||||
|
||||
GPUTexture* GPUDeviceNull::CreateTexture(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsTextures);
|
||||
return New<GPUTextureNull>();
|
||||
}
|
||||
|
||||
GPUShader* GPUDeviceNull::CreateShader(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUShaderNull>();
|
||||
}
|
||||
|
||||
GPUPipelineState* GPUDeviceNull::CreatePipelineState()
|
||||
{
|
||||
PROFILE_MEM(GraphicsCommands);
|
||||
return New<GPUPipelineStateNull>();
|
||||
}
|
||||
|
||||
@@ -165,6 +169,7 @@ GPUTimerQuery* GPUDeviceNull::CreateTimerQuery()
|
||||
|
||||
GPUBuffer* GPUDeviceNull::CreateBuffer(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsBuffers);
|
||||
return New<GPUBufferNull>();
|
||||
}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ DescriptorPoolSetContainerVulkan* DescriptorPoolsManagerVulkan::AcquirePoolSetCo
|
||||
ScopeLock lock(_locker);
|
||||
for (auto* poolSet : _poolSets)
|
||||
{
|
||||
if (poolSet->Refs == 0 && Engine::FrameCount - poolSet->LastFrameUsed > VULKAN_RESOURCE_DELETE_SAFE_FRAMES_COUNT)
|
||||
if (poolSet->Refs == 0 && Engine::FrameCount != poolSet->LastFrameUsed)
|
||||
{
|
||||
poolSet->LastFrameUsed = Engine::FrameCount;
|
||||
poolSet->Reset();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "Engine/Utilities/StringConverter.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Scripting/Enums.h"
|
||||
|
||||
@@ -229,9 +230,13 @@ static VKAPI_ATTR VkBool32 VKAPI_PTR DebugUtilsCallback(VkDebugUtilsMessageSever
|
||||
|
||||
const String message(callbackData->pMessage);
|
||||
if (callbackData->pMessageIdName)
|
||||
{
|
||||
LOG(Info, "[Vulkan] {0} {1}:{2}({3}) {4}", type, severity, callbackData->messageIdNumber, String(callbackData->pMessageIdName), message);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Info, "[Vulkan] {0} {1}:{2} {3}", type, severity, callbackData->messageIdNumber, message);
|
||||
}
|
||||
|
||||
#if BUILD_DEBUG
|
||||
if (auto* context = (GPUContextVulkan*)GPUDevice::Instance->GetMainContext())
|
||||
@@ -2089,22 +2094,26 @@ void GPUDeviceVulkan::WaitForGPU()
|
||||
if (Device != VK_NULL_HANDLE)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
VALIDATE_VULKAN_RESULT(vkDeviceWaitIdle(Device));
|
||||
}
|
||||
}
|
||||
|
||||
GPUTexture* GPUDeviceVulkan::CreateTexture(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsTextures);
|
||||
return New<GPUTextureVulkan>(this, name);
|
||||
}
|
||||
|
||||
GPUShader* GPUDeviceVulkan::CreateShader(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUShaderVulkan>(this, name);
|
||||
}
|
||||
|
||||
GPUPipelineState* GPUDeviceVulkan::CreatePipelineState()
|
||||
{
|
||||
PROFILE_MEM(GraphicsCommands);
|
||||
return New<GPUPipelineStateVulkan>(this);
|
||||
}
|
||||
|
||||
@@ -2115,6 +2124,7 @@ GPUTimerQuery* GPUDeviceVulkan::CreateTimerQuery()
|
||||
|
||||
GPUBuffer* GPUDeviceVulkan::CreateBuffer(const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsBuffers);
|
||||
return New<GPUBufferVulkan>(this, name);
|
||||
}
|
||||
|
||||
@@ -2135,6 +2145,7 @@ GPUSwapChain* GPUDeviceVulkan::CreateSwapChain(Window* window)
|
||||
|
||||
GPUConstantBuffer* GPUDeviceVulkan::CreateConstantBuffer(uint32 size, const StringView& name)
|
||||
{
|
||||
PROFILE_MEM(GraphicsShaders);
|
||||
return New<GPUConstantBufferVulkan>(this, size);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Engine/Core/Types/DataContainer.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
#if PLATFORM_DESKTOP
|
||||
#define VULKAN_UNIFORM_RING_BUFFER_SIZE (24 * 1024 * 1024)
|
||||
@@ -41,6 +42,7 @@ UniformBufferUploaderVulkan::UniformBufferUploaderVulkan(GPUDeviceVulkan* device
|
||||
VkResult result = vmaCreateBuffer(_device->Allocator, &bufferInfo, &allocInfo, &_buffer, &_allocation, nullptr);
|
||||
LOG_VULKAN_RESULT(result);
|
||||
_memoryUsage = bufferInfo.size;
|
||||
PROFILE_MEM_INC(GraphicsCommands, _memoryUsage);
|
||||
|
||||
// Map buffer
|
||||
result = vmaMapMemory(_device->Allocator, _allocation, (void**)&_mapped);
|
||||
@@ -87,6 +89,7 @@ void UniformBufferUploaderVulkan::OnReleaseGPU()
|
||||
{
|
||||
if (_allocation != VK_NULL_HANDLE)
|
||||
{
|
||||
PROFILE_MEM_DEC(GraphicsCommands, _memoryUsage);
|
||||
if (_mapped)
|
||||
{
|
||||
vmaUnmapMemory(_device->Allocator, _allocation);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Engine/Graphics/GPULimits.h"
|
||||
#include "Engine/Scripting/Enums.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
|
||||
void BackBufferVulkan::Setup(GPUSwapChainVulkan* window, VkImage backbuffer, PixelFormat format, VkExtent3D extent)
|
||||
{
|
||||
@@ -61,6 +62,7 @@ void GPUSwapChainVulkan::OnReleaseGPU()
|
||||
ReleaseBackBuffer();
|
||||
|
||||
// Release data
|
||||
PROFILE_MEM_DEC(Graphics, _memoryUsage);
|
||||
_currentImageIndex = -1;
|
||||
_semaphoreIndex = 0;
|
||||
_acquiredImageIndex = -1;
|
||||
@@ -76,6 +78,7 @@ void GPUSwapChainVulkan::OnReleaseGPU()
|
||||
_surface = VK_NULL_HANDLE;
|
||||
}
|
||||
_width = _height = 0;
|
||||
_memoryUsage = 0;
|
||||
}
|
||||
|
||||
bool GPUSwapChainVulkan::IsFullscreen()
|
||||
@@ -423,6 +426,7 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height)
|
||||
|
||||
// Estimate memory usage
|
||||
_memoryUsage = 1024 + RenderTools::CalculateTextureMemoryUsage(_format, _width, _height, 1) * _backBuffers.Count();
|
||||
PROFILE_MEM_INC(Graphics, _memoryUsage);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -560,6 +564,7 @@ void GPUSwapChainVulkan::Present(bool vsync)
|
||||
if (_acquiredImageIndex == -1)
|
||||
return;
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
|
||||
// Ensure that backbuffer has been acquired before presenting it to the window
|
||||
const auto backBuffer = (GPUTextureViewVulkan*)GetBackBufferView();
|
||||
|
||||
@@ -248,10 +248,14 @@ void RenderToolsVulkan::LogVkResult(VkResult result, const char* file, uint32 li
|
||||
errorType = FatalErrorType::GPUHang;
|
||||
else if (result == VK_ERROR_DEVICE_LOST || result == VK_ERROR_SURFACE_LOST_KHR || result == VK_ERROR_MEMORY_MAP_FAILED)
|
||||
errorType = FatalErrorType::GPUCrash;
|
||||
else if (fatal)
|
||||
errorType = FatalErrorType::Unknown;
|
||||
if (errorType != FatalErrorType::None)
|
||||
Platform::Fatal(msg, nullptr, errorType);
|
||||
#if LOG_ENABLE
|
||||
else
|
||||
Log::Logger::Write(fatal ? LogType::Fatal : LogType::Error, msg);
|
||||
Log::Logger::Write(LogType::Error, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RenderToolsVulkan::HasExtension(const Array<const char*>& extensions, const char* name)
|
||||
|
||||
Reference in New Issue
Block a user