Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Panzerfaust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if (APPLE)
set (RUNTIME_IDENTIFIER -r $<IF:$<BOOL:${MACOSX_ARCHITECTURE_ARM64}>,osx-arm64,osx-x64>)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set (RUNTIME_IDENTIFIER -r win-x64)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (RUNTIME_IDENTIFIER -r linux-x64)
endif ()

set (CUSTOM_TARGET_NAME ${CSPROJ})
Expand Down
18 changes: 18 additions & 0 deletions Panzerfaust/Panzerfaust.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ApplicationIcon>./Assets/avalonia-logo.ico</ApplicationIcon>
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('Windows')) == 'true'">..\Result.Windows.x64.MultiConfig</BaseOutputPath>
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('OSX')) == 'true'">..\Result.Darwin.x64.$(Configuration)</BaseOutputPath>
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('Linux')) == 'true'">..\Result.Linux.x64.$(Configuration)</BaseOutputPath>
<Platforms>x64;arm64</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform('Windows')) == 'true' AND '$(Configuration)' == 'Debug' ">
Expand Down Expand Up @@ -56,6 +57,23 @@
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
<DefineConstants>TRACE;__MACOS__</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(RuntimeIdentifier)' == 'linux-x64' AND '$(Configuration)' == 'Debug' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
<DefineConstants>TRACE;DEBUG;__LINUX__</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(RuntimeIdentifier)' == 'linux-x64' AND '$(Configuration)' == 'Release' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
<DefineConstants>TRACE;__LINUX__</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
Expand Down
12 changes: 11 additions & 1 deletion Panzerfaust/Service/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ public async Task StartAsync(string path)
};

var engineProcess = Process.Start(processStartInfo);
bool processIdle = engineProcess.WaitForInputIdle();
bool processIdle = false;
if (OperatingSystem.IsWindows())
{
processIdle = engineProcess.WaitForInputIdle(3000);
}
else
{
await Task.Delay(500);
processIdle = true;
}


if (processIdle) { return; }
else
Expand Down
5 changes: 3 additions & 2 deletions Scripts/PostBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ param (
[string[]] $SystemName = 'Windows',

[Parameter(HelpMessage="Architecture type to build, default to x64")]
[ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64')]
[ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64','linux-x64')]
[string[]] $Architectures = 'win-x64',

[Parameter(HelpMessage="Configuration type to build, default to Debug")]
Expand Down Expand Up @@ -103,7 +103,8 @@ $ContentsToProcess = @(
}
}
"Linux" {
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
@{ From = "$OuputBuildDirectory\Tetragrama"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
@{ From = "$OuputBuildDirectory\Tetragrama"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
}
Default {
throw 'This system is not supported'
Expand Down
9 changes: 8 additions & 1 deletion Scripts/Shared.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ function Find-GlslangValidator () {
if ($IsMacOS) {
Join-Path -Path $shaderCCompilerPath -ChildPath "\bin\glslangValidator" # On macOS, the pipeline build might pick up this option...
}
if ($IsLinux) {
Join-Path -Path $shaderCCompilerPath -ChildPath "\bin\glslangValidator"
}
)

foreach ($GlslangValidatorProgram in $GlslangValidatorCandidates) {
Expand Down Expand Up @@ -197,6 +200,10 @@ function Find-ClangFormat () {
if ($IsWindows) {
Join-Path -Path $env:ProgramFiles -ChildPath 'LLVM\bin\clang-format.exe'
}
if ($IsLinux) {
'/usr/bin/clang-format'
'/usr/local/bin/clang-format'
}
)

foreach ($candidate in $candidates) {
Expand Down Expand Up @@ -225,7 +232,7 @@ function Setup-ShaderCCompilerTool () {
$outputFile = Join-Path -Path $repositoryToolPath -ChildPath "ShaderCCompiler$outputFileExtension"
Write-Host "Downloading Shader Compiler Tools..."

$shaderCToolUrl = IF($IsWindows) {$repoConfiguration.Requirements.ShaderC.Windows.Url} Elseif($IsMacOS) {$repoConfiguration.Requirements.ShaderC.macOS.Url}
$shaderCToolUrl = IF($IsWindows) {$repoConfiguration.Requirements.ShaderC.Windows.Url} Elseif($IsMacOS) {$repoConfiguration.Requirements.ShaderC.macOS.Url} Elseif($IsLinux) {$repoConfiguration.Requirements.ShaderC.Linux.Url}
Invoke-WebRequest -Uri $shaderCToolUrl -OutFile $outputFile

# Extract contents
Expand Down
2 changes: 1 addition & 1 deletion Tetragrama/EntryPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int applicationEntryPoint(int argc, char* argv[])
MemoryManager manager = {};
MemoryConfiguration config = {.DefaultSize = ZGiga(2u)};
manager.Initialize(config);
auto arena = &(manager.ArenaAllocator);
auto arena = &(manager.Allocator);

LoggerConfiguration logger_cfg = {};
Logger::Initialize(arena, logger_cfg);
Expand Down
6 changes: 3 additions & 3 deletions ZEngine/ZEngine/Core/Memory/MemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ namespace ZEngine::Core::Memory
{
void Initialize(const MemoryConfiguration& config)
{
this->ArenaAllocator.Initialize(config.DefaultSize);
this->Allocator.Initialize(config.DefaultSize);
}

void Shutdowm()
{
ArenaAllocator.Shutdown();
Allocator.Shutdown();
}

ArenaAllocator ArenaAllocator = {};
ArenaAllocator Allocator = {};
};
} // namespace ZEngine::Core::Memory
38 changes: 19 additions & 19 deletions ZEngine/ZEngine/Hardwares/VulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ namespace ZEngine::Hardwares
* Creating VMA Allocators
*/
VmaAllocatorCreateInfo vma_allocator_create_info = {.physicalDevice = PhysicalDevice, .device = LogicalDevice, .instance = Instance, .vulkanApiVersion = VK_API_VERSION_1_3};
ZENGINE_VALIDATE_ASSERT(vmaCreateAllocator(&vma_allocator_create_info, &VmaAllocator) == VK_SUCCESS, "Failed to create VMA Allocator")
ZENGINE_VALIDATE_ASSERT(vmaCreateAllocator(&vma_allocator_create_info, &Allocator) == VK_SUCCESS, "Failed to create VMA Allocator")

m_buffer_manager.Initialize(this);
EnqueuedCommandbuffers.init(Arena, m_buffer_manager.TotalCommandBufferCount, m_buffer_manager.TotalCommandBufferCount);
Expand Down Expand Up @@ -451,7 +451,7 @@ namespace ZEngine::Hardwares

void VulkanDevice::Dispose()
{
vmaDestroyAllocator(VmaAllocator);
vmaDestroyAllocator(Allocator);

if (__destroyDebugMessengerPtr)
{
Expand Down Expand Up @@ -667,7 +667,7 @@ namespace ZEngine::Hardwares
}

BufferView& buffer = DirtyBuffers[handle];
vmaDestroyBuffer(VmaAllocator, buffer.Handle, buffer.Allocation);
vmaDestroyBuffer(Allocator, buffer.Handle, buffer.Allocation);
DirtyBuffers.Remove(handle);
}
}
Expand All @@ -688,7 +688,7 @@ namespace ZEngine::Hardwares

vkDestroyImageView(LogicalDevice, buffer.ViewHandle, nullptr);
vkDestroySampler(LogicalDevice, buffer.Sampler, nullptr);
vmaDestroyImage(VmaAllocator, buffer.Handle, buffer.Allocation);
vmaDestroyImage(Allocator, buffer.Handle, buffer.Allocation);

DirtyBufferImages.Remove(handle);
}
Expand All @@ -699,9 +699,9 @@ namespace ZEngine::Hardwares
void* mapped_memory;
if (data)
{
ZENGINE_VALIDATE_ASSERT(vmaMapMemory(VmaAllocator, buffer.Allocation, &mapped_memory) == VK_SUCCESS, "Failed to map memory")
ZENGINE_VALIDATE_ASSERT(vmaMapMemory(Allocator, buffer.Allocation, &mapped_memory) == VK_SUCCESS, "Failed to map memory")
ZENGINE_VALIDATE_ASSERT(Helpers::secure_memcpy(mapped_memory, data_size, data, data_size) == Helpers::MEMORY_OP_SUCCESS, "Failed to perform memory copy operation")
vmaUnmapMemory(VmaAllocator, buffer.Allocation);
vmaUnmapMemory(Allocator, buffer.Allocation);
}
}

Expand All @@ -718,13 +718,13 @@ namespace ZEngine::Hardwares
allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
allocation_create_info.flags = vma_create_flags;

ZENGINE_VALIDATE_ASSERT(vmaCreateBuffer(VmaAllocator, &buffer_create_info, &allocation_create_info, &(buffer_view.Handle), &(buffer_view.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer");
ZENGINE_VALIDATE_ASSERT(vmaCreateBuffer(Allocator, &buffer_create_info, &allocation_create_info, &(buffer_view.Handle), &(buffer_view.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer");

/*
* Zeroing the buffer
*/
VmaAllocationInfo allocation_info = {};
vmaGetAllocationInfo(VmaAllocator, buffer_view.Allocation, &allocation_info);
vmaGetAllocationInfo(Allocator, buffer_view.Allocation, &allocation_info);
Helpers::secure_memset(allocation_info.pMappedData, 0, byte_size, byte_size);

// Metadata info
Expand Down Expand Up @@ -844,7 +844,7 @@ namespace ZEngine::Hardwares
allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
allocation_create_info.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;

ZENGINE_VALIDATE_ASSERT(vmaCreateImage(VmaAllocator, &image_create_info, &allocation_create_info, &(buffer_image.Handle), &(buffer_image.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer");
ZENGINE_VALIDATE_ASSERT(vmaCreateImage(Allocator, &image_create_info, &allocation_create_info, &(buffer_image.Handle), &(buffer_image.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer");

buffer_image.ViewHandle = CreateImageView(buffer_image.Handle, image_format, image_view_type, image_aspect_flag, layer_count);
buffer_image.Sampler = CreateImageSampler();
Expand Down Expand Up @@ -1404,7 +1404,7 @@ namespace ZEngine::Hardwares
BufferView& buffer = DirtyBuffers[handle];
if (buffer && buffer.FrameIndex == CurrentFrameIndex)
{
vmaDestroyBuffer(VmaAllocator, buffer.Handle, buffer.Allocation);
vmaDestroyBuffer(Allocator, buffer.Handle, buffer.Allocation);
buffer.Handle = VK_NULL_HANDLE;
buffer.Allocation = VK_NULL_HANDLE;
DirtyBuffers.Remove(handle);
Expand All @@ -1430,7 +1430,7 @@ namespace ZEngine::Hardwares
{
vkDestroyImageView(LogicalDevice, buffer.ViewHandle, nullptr);
vkDestroySampler(LogicalDevice, buffer.Sampler, nullptr);
vmaDestroyImage(VmaAllocator, buffer.Handle, buffer.Allocation);
vmaDestroyImage(Allocator, buffer.Handle, buffer.Allocation);
buffer.Handle = VK_NULL_HANDLE;
buffer.Allocation = VK_NULL_HANDLE;
DirtyBufferImages.Remove(handle);
Expand Down Expand Up @@ -2092,7 +2092,7 @@ namespace ZEngine::Hardwares
m_current_offset = 0;
m_total_size = size;
Buffer = CreateBuffer();
vmaSetAllocationName(m_device->VmaAllocator, Buffer.Allocation, debug_name);
vmaSetAllocationName(m_device->Allocator, Buffer.Allocation, debug_name);
}
}

Expand All @@ -2117,12 +2117,12 @@ namespace ZEngine::Hardwares
}

VkMemoryPropertyFlags mem_prop_flags;
vmaGetAllocationMemoryProperties(m_device->VmaAllocator, Buffer.Allocation, &mem_prop_flags);
vmaGetAllocationMemoryProperties(m_device->Allocator, Buffer.Allocation, &mem_prop_flags);

if (mem_prop_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
{
VmaAllocationInfo allocation_info = {};
vmaGetAllocationInfo(m_device->VmaAllocator, Buffer.Allocation, &allocation_info);
vmaGetAllocationInfo(m_device->Allocator, Buffer.Allocation, &allocation_info);
if (allocation_info.pMappedData)
{
auto mapped_buf = reinterpret_cast<uint8_t*>(allocation_info.pMappedData);
Expand All @@ -2134,12 +2134,12 @@ namespace ZEngine::Hardwares
BufferView staging_buffer = m_device->CreateBuffer(static_cast<VkDeviceSize>(byte_size), VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);

VmaAllocationInfo allocation_info = {};
vmaGetAllocationInfo(m_device->VmaAllocator, staging_buffer.Allocation, &allocation_info);
vmaGetAllocationInfo(m_device->Allocator, staging_buffer.Allocation, &allocation_info);

if (allocation_info.pMappedData)
{
ZENGINE_VALIDATE_ASSERT(Helpers::secure_memset(allocation_info.pMappedData, value, allocation_info.size, byte_size) == Helpers::MEMORY_OP_SUCCESS, "Failed to perform memory copy operation")
ZENGINE_VALIDATE_ASSERT(vmaFlushAllocation(m_device->VmaAllocator, staging_buffer.Allocation, 0, byte_size) == VK_SUCCESS, "Failed to flush allocation")
ZENGINE_VALIDATE_ASSERT(vmaFlushAllocation(m_device->Allocator, staging_buffer.Allocation, 0, byte_size) == VK_SUCCESS, "Failed to flush allocation")
m_device->CopyBuffer(staging_buffer, Buffer, byte_size, 0u, offset);
}

Expand All @@ -2163,11 +2163,11 @@ namespace ZEngine::Hardwares
}

VkMemoryPropertyFlags mem_prop_flags;
vmaGetAllocationMemoryProperties(m_device->VmaAllocator, Buffer.Allocation, &mem_prop_flags);
vmaGetAllocationMemoryProperties(m_device->Allocator, Buffer.Allocation, &mem_prop_flags);

if (mem_prop_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
{
ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocator, data, Buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation")
ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->Allocator, data, Buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation")

VkAccessFlags dst_access_mask = VK_ACCESS_NONE;
VkPipelineStageFlags dst_pipeline_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
Expand Down Expand Up @@ -2218,7 +2218,7 @@ namespace ZEngine::Hardwares
{
BufferView staging_buffer = m_device->CreateBuffer(static_cast<VkDeviceSize>(byte_size), VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT);

ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocator, data, staging_buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation")
ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->Allocator, data, staging_buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation")

m_device->CopyBuffer(staging_buffer, Buffer, byte_size, 0u, offset);

Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/Hardwares/VulkanDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ namespace ZEngine::Hardwares
VkPhysicalDeviceFeatures PhysicalDeviceFeature = {};
VkPhysicalDeviceMemoryProperties PhysicalDeviceMemoryProperties = {};
VkSwapchainKHR SwapchainHandle = VK_NULL_HANDLE;
VmaAllocator VmaAllocator = nullptr;
VmaAllocator Allocator = nullptr;
Core::Containers::Array<VkFormat> DefaultDepthFormats = {};
Rendering::Renderers::RenderPasses::Attachment* SwapchainAttachment = {};
Core::Containers::Array<VkImageView> SwapchainImageViews = {};
Expand Down
2 changes: 1 addition & 1 deletion ZEngine/ZEngine/Helpers/IntrusivePtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace ZEngine::Helpers
IntrusivePtr(IntrusivePtr&& other) noexcept : m_ptr(other.detach()) {}

template <class U, typename = std::enable_if_t<std::convertible_to<U*, T*>>>
IntrusivePtr(const IntrusivePtr<U>& other) noexcept(noexcept(T::IncrementRefCount(m_ptr))) : m_ptr(other.get())
IntrusivePtr(const IntrusivePtr<U>& other) noexcept(noexcept(T::IncrementRefCount(other.get()))) : m_ptr(other.get())
{
T::IncrementRefCount(m_ptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ZEngine::Rendering::Renderers::Pipelines
{
Device = device;
Specification = std::move(spec);
auto shader_handle = Device->CompileShader(Specification.ShaderSpecification);
auto shader_handle = Device->CompileShader(Specification.ShaderSpec);
if (!shader_handle)
{
ZENGINE_CORE_ERROR("")
Expand Down
4 changes: 2 additions & 2 deletions ZEngine/ZEngine/Rendering/Renderers/RenderGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ namespace ZEngine::Rendering::Renderers
}
if (m_resource_map[name].Type != RenderGraphResourceType::ATTACHMENT)
{
ZENGINE_CORE_WARN("{} isn't a valid Attachement Resource", name)
// ZENGINE_CORE_WARN("{} isn't a valid Attachement Resource", name)
}

auto handle = m_resource_map[name].ResourceInfo.TextureHandle;
Expand All @@ -506,7 +506,7 @@ namespace ZEngine::Rendering::Renderers
}
if (m_resource_map[name].Type != RenderGraphResourceType::TEXTURE)
{
ZENGINE_CORE_WARN("{} isn't a valid Texture Resource", name)
// ZENGINE_CORE_WARN("{} isn't a valid Texture Resource", name)
}

auto handle = m_resource_map[name].ResourceInfo.TextureHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,13 @@ namespace ZEngine::Rendering::Renderers::RenderPasses

RenderPassBuilder& RenderPassBuilder::SetShaderOverloadMaxSet(uint32_t count)
{
m_spec.PipelineSpecification.ShaderSpecification.OverloadMaxSet = count;
m_spec.PipelineSpecification.ShaderSpec.OverloadMaxSet = count;
return *this;
}

RenderPassBuilder& RenderPassBuilder::SetOverloadPoolSize(uint32_t count)
{
m_spec.PipelineSpecification.ShaderSpecification.OverloadPoolSize = count;
m_spec.PipelineSpecification.ShaderSpec.OverloadPoolSize = count;
return *this;
}

Expand Down Expand Up @@ -450,7 +450,7 @@ namespace ZEngine::Rendering::Renderers::RenderPasses

RenderPassBuilder& RenderPassBuilder::UseShader(std::string_view name)
{
m_spec.PipelineSpecification.ShaderSpecification.Name = name.data();
m_spec.PipelineSpecification.ShaderSpec.Name = name.data();
return *this;
}

Expand Down
Loading
Loading