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

This commit is contained in:
2025-07-05 14:19:52 +03:00
286 changed files with 4528 additions and 1308 deletions

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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();

View File

@@ -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)