Skip to content

Commit b7a3161

Browse files
Merge branch 'develop' into user/kernel/fix-command-buffer-manager
2 parents 328bbb3 + 2173db0 commit b7a3161

File tree

11 files changed

+70
-277
lines changed

11 files changed

+70
-277
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ if (NOT LAUNCHER_ONLY)
4343
## Setup Dependencies
4444
include(dependencies.cmake)
4545

46+
## Compile Shaders
47+
48+
add_subdirectory (Resources)
49+
4650
# Core engine lib is here
4751
#
4852
add_subdirectory (ZEngine)

Obelisk/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,4 @@ target_link_libraries(${TARGET_NAME} PUBLIC
4949

5050
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
5151

52-
install(TARGETS ${TARGET_NAME}
53-
DESTINATION bin
54-
)
55-
56-
install(DIRECTORY ../Resources/Editor/Settings DESTINATION bin)
57-
58-
install(DIRECTORY ../Resources/Shaders DESTINATION bin)
59-
60-
61-
52+
install(TARGETS ${TARGET_NAME} DESTINATION bin)

Obelisk/EntryPoint.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#include <CLI/CLI.hpp>
2+
#include <Tetragrama/Editor.h>
3+
#include <ZEngine/Applications/GameApplication.h>
24
#include <ZEngine/Core/Memory/MemoryManager.h>
35
#include <ZEngine/EngineConfiguration.h>
4-
#include <ZEngine/Logging/Logger.h>
5-
#include <ZEngine/Applications/GameApplication.h>
66
#include <ZEngine/Helpers/ThreadPool.h>
7-
8-
#include <Tetragrama/Editor.h>
7+
#include <ZEngine/Logging/Logger.h>
98

109
#ifdef ZENGINE_PLATFORM
1110

@@ -28,8 +27,7 @@ int applicationEntryPoint(int argc, char* argv[])
2827

2928
GameApplicationPtr app = nullptr;
3029

31-
32-
CLI::App cli{"ObeliskCLI"};
30+
CLI::App cli{"ObeliskCLI"};
3331
argv = cli.ensure_utf8(argv);
3432

3533
std::string config_file = "";
@@ -39,10 +37,9 @@ int applicationEntryPoint(int argc, char* argv[])
3937

4038
CLI11_PARSE(cli, argc, argv);
4139

42-
4340
if (launch_editor)
4441
{
45-
app = ZPushStructCtor(arena, Tetragrama::Editor);
42+
app = ZPushStructCtor(arena, Tetragrama::Editor);
4643
app->EnableRenderOverlay = true;
4744
}
4845

Resources/CMakeLists.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
set(ShaderPath ${CMAKE_CURRENT_SOURCE_DIR}/Shaders)
2+
set(ShaderOutputPath "${ShaderPath}/Cache")
3+
4+
set(Flags)
5+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
6+
set(Flags "-g")
7+
else()
8+
set(Flags "-Os")
9+
endif()
10+
11+
file (MAKE_DIRECTORY "${ShaderOutputPath}")
12+
13+
file (GLOB VertexShaders CONFIGURE_DEPENDS "${ShaderPath}/*.vert")
14+
file (GLOB FragmentShaders CONFIGURE_DEPENDS "${ShaderPath}/*.frag")
15+
16+
foreach(VertexShader ${VertexShaders})
17+
18+
cmake_path(GET VertexShader STEM shaderfilename)
19+
cmake_path(APPEND_STRING shaderfilename "_vertex.spv" OUTPUT_VARIABLE VertexShaderOutputFileName )
20+
cmake_path(APPEND ShaderOutputPath ${VertexShaderOutputFileName} OUTPUT_VARIABLE VertexShaderOutputPath)
21+
22+
add_custom_target("Compile-${shaderfilename}-vertex" ALL COMMAND glslang-standalone "-I${ShaderPath}" "-V" ${Flags} "-o" "${VertexShaderOutputPath}" "${VertexShader}")
23+
24+
25+
endforeach()
26+
27+
foreach(FragmentShader ${FragmentShaders})
28+
29+
cmake_path(GET FragmentShader STEM shaderfilename)
30+
cmake_path(APPEND_STRING shaderfilename "_fragment.spv" OUTPUT_VARIABLE FragmentShaderOutputFileName )
31+
cmake_path(APPEND ShaderOutputPath ${FragmentShaderOutputFileName} OUTPUT_VARIABLE FragmentShaderOutputPath)
32+
33+
34+
add_custom_target("Compile-${shaderfilename}-fragment" ALL COMMAND glslang-standalone "-I${ShaderPath}" "-V" ${Flags} "-o" "${FragmentShaderOutputPath}" "${FragmentShader}")
35+
36+
endforeach()
37+
38+
install(DIRECTORY Editor/Settings DESTINATION bin)
39+
install(DIRECTORY Shaders/Cache DESTINATION bin/Shaders)
40+
41+
# This helps for debugging and development
42+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
43+
install(DIRECTORY Editor/Settings DESTINATION Obelisk/${CMAKE_BUILD_TYPE})
44+
install(DIRECTORY Shaders/Cache DESTINATION Obelisk/${CMAKE_BUILD_TYPE}/Shaders)
45+
endif()

Resources/Shaders/fragment_common.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ layout(std140, set = 0, binding = 5) readonly buffer MatSB
6161
}
6262
MaterialDataBuffer;
6363

64-
layout(set = 1, binding = 0) uniform sampler2D TextureArray[];
64+
layout(set = 1, binding = 0) uniform Texture2D TextureArray[];
65+
layout(set = 1, binding = 1) uniform sampler LinearWrapSampler;
6566

6667
MaterialData FetchMaterial(uint dataIndex)
6768
{

Scripts/BuildEngine.ps1

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
174174
}
175175
}
176176

177-
178177
if(-Not $LauncherOnly) {
179178

180179
# Run Clang format
181180
if ($RunClangFormat) {
182181
[string]$clangFormatScript = Join-Path $PSScriptRoot -ChildPath "ClangFormat.ps1"
183182
[string[]]$srcDirectories = @(
184183
(Join-Path $repositoryRootPath -ChildPath "ZEngine"),
185-
(Join-Path $repositoryRootPath -ChildPath "Tetragrama")
184+
(Join-Path $repositoryRootPath -ChildPath "Obelisk"),
185+
(Join-Path $repositoryRootPath -ChildPath "Tetragrama"),
186186
(Join-Path $repositoryRootPath -ChildPath "Resources/Shaders")
187187
)
188188

@@ -195,13 +195,6 @@ if(-Not $LauncherOnly) {
195195
}
196196
}
197197

198-
199-
# Run Shader Compilation
200-
foreach ($config in $Configurations) {
201-
$shaderCompileScript = Join-Path $PSScriptRoot -ChildPath "ShaderCompile.ps1"
202-
& pwsh -File $shaderCompileScript -Configuration:$config -ForceRebuild:$true
203-
}
204-
205198
if ($LASTEXITCODE -ne 0) {
206199
Write-Error "Stopped build process..." -ErrorAction Stop
207200
}

Scripts/PostBuild.ps1

Lines changed: 0 additions & 137 deletions
This file was deleted.

Scripts/ShaderCompile.ps1

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)