Fixing vulkan

This commit is contained in:
Dynamitos
2024-04-23 08:11:44 +02:00
parent 8ea9c34ed4
commit 89571e5298
33 changed files with 217 additions and 926 deletions
-244
View File
@@ -1,244 +0,0 @@
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...
View File
+1
View File
@@ -32,6 +32,7 @@ bld/
[Oo]bj/
[Ll]og/
vcpkg_installed/
build/
# Visual Studio 2015/2017 cache/options directory
.vs/
-36
View File
@@ -1,36 +0,0 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/src/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.20348.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe",
"cppStandard": "c++20",
"intelliSenseMode": "windows-msvc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
},
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/src/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "/usr/bin/clang",
"cppStandard": "c++20",
"intelliSenseMode": "macos-clang-arm64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
+6 -6
View File
@@ -8,10 +8,10 @@
"name": "Editor",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/bin/Editor.exe",
"program": "${workspaceRoot}/build/Editor.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/bin",
"cwd": "${workspaceRoot}/build",
"console": "internalConsole",
"environment": [],
"symbolSearchPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x64",
@@ -28,10 +28,10 @@
"name": "Editor (Mac)",
"type": "lldb",
"request": "launch",
"program": "${workspaceRoot}/bin/Editor",
"program": "${workspaceRoot}/build/Editor",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/bin",
"cwd": "${workspaceRoot}/build",
"environment": [
{
"name": "VK_LAYER_PATH",
@@ -49,10 +49,10 @@
"name": "Editor (Linux)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/bin/Editor",
"program": "${workspaceRoot}/build/Editor",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/bin",
"cwd": "${workspaceRoot}/build",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
+1 -141
View File
@@ -1,144 +1,5 @@
{
"telemetry.enableTelemetry": false,
"cmake.cmakePath": "cmake",
"cmake.buildDirectory": "${workspaceFolder}/bin",
"files.associations": {
"*.h": "cpp",
"*.ush": "hlsl",
"*.slang": "hlsl",
"*.pl": "prolog",
"xstring": "cpp",
"list": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xmemory": "cpp",
"xtree": "cpp",
"type_traits": "cpp",
"vector": "cpp",
"*.rh": "cpp",
"memory": "cpp",
"*.ipp": "cpp",
"iostream": "cpp",
"initializer_list": "cpp",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"map": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"set": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"valarray": "cpp",
"xfacet": "cpp",
"xlocale": "cpp",
"xlocinfo": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"xutility": "cpp",
"filesystem": "cpp",
"bitset": "cpp",
"complex": "cpp",
"csignal": "cpp",
"deque": "cpp",
"locale": "cpp",
"optional": "cpp",
"typeindex": "cpp",
"variant": "cpp",
"xlocbuf": "cpp",
"xlocmes": "cpp",
"codecvt": "cpp",
"regex": "cpp",
"strstream": "cpp",
"resumable": "cpp",
"future": "cpp",
"cstdarg": "cpp",
"cwctype": "cpp",
"queue": "cpp",
"random": "cpp",
"shared_mutex": "cpp",
"unordered_set": "cpp",
"csetjmp": "cpp",
"memory_resource": "cpp",
"*.inc": "cpp",
"any": "cpp",
"bit": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"compare": "cpp",
"execution": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"scoped_allocator": "cpp",
"stack": "cpp",
"coroutine": "cpp",
"*.tcc": "cpp",
"stop_token": "cpp",
"span": "cpp",
"charconv": "cpp",
"format": "cpp",
"semaphore": "cpp",
"netfwd": "cpp",
"string_view": "cpp",
"rope": "cpp",
"slist": "cpp",
"numbers": "cpp",
"barrier": "cpp",
"latch": "cpp",
"ranges": "cpp",
"source_location": "cpp",
"syncstream": "cpp",
"stdfloat": "cpp",
"__bit_reference": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__verbose_abort": "cpp"
},
"cmake.skipConfigureIfCachePresent": false,
"cmake.configureArgs": [
"-Wno-dev"
@@ -163,6 +24,5 @@
"lldb.displayFormat": "auto",
"lldb.showDisassembly": "auto",
"lldb.dereferencePointers": true,
"lldb.consoleMode": "commands",
"cmake.generator": "Xcode",
"lldb.consoleMode": "commands"
}
+9 -15
View File
@@ -28,15 +28,16 @@ project (Seele)
include(cmake/SuperBuild.cmake)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build)
#Workaround for vs, because it places artifacts into an additional subfolder
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/build)
find_package(Vulkan REQUIRED)
find_package(assimp CONFIG REQUIRED)
@@ -49,7 +50,6 @@ find_package(Ktx CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(glslang CONFIG REQUIRED)
if(UNIX)
find_package(Threads REQUIRED)
@@ -75,11 +75,7 @@ target_link_libraries(Engine PUBLIC crcpp)
target_link_libraries(Engine PUBLIC fmt::fmt)
target_link_libraries(Engine PUBLIC GPUOpen::VulkanMemoryAllocator)
target_link_libraries(Engine PUBLIC slang)
target_link_libraries(Engine PUBLIC glslang::glslang)
if(APPLE)
target_include_directories(Engine PUBLIC /usr/local/include)
target_link_directories(Engine PUBLIC /usr/local/lib)
target_link_libraries(Engine PUBLIC metalirconverter)
target_link_libraries(Engine PUBLIC metal)
SET(CMAKE_OSX_DEPLOYMENT_TARGET 14.3)
endif()
@@ -152,8 +148,6 @@ install(
Editor
Engine
crcpp
metal
slang
EXPORT
EngineTargets
FILE_SET HEADERS
+27 -30
View File
@@ -2,37 +2,34 @@ include (ExternalProject)
#--------------SLang------------------------------
set(SLANG_ROOT ${EXTERNAL_ROOT}/slang)
#add_library(shader-slang SHARED IMPORTED)
#if(WIN32)
# add_library(shader-slang-glslang SHARED IMPORTED)
# set(SLANG_ROOT ${EXTERNAL_ROOT}/slang/bin/windows-x64/release/)
# set_target_properties(shader-slang-glslang PROPERTIES IMPORTED_LOCATION ${SLANG_ROOT}/bin/slang-glslang.dll)
# set_target_properties(shader-slang-glslang PROPERTIES IMPORTED_IMPLIB ${SLANG_ROOT}/lib/slang.lib)
# set_target_properties(shader-slang PROPERTIES IMPORTED_LOCATION ${SLANG_ROOT}/bin/slang.dll)
# set_target_properties(shader-slang PROPERTIES IMPORTED_IMPLIB ${SLANG_ROOT}/lib/slang.lib)
# target_link_libraries(shader-slang INTERFACE shader-slang-glslang)
# install(FILES
# ${SLANG_ROOT}/bin/slang-glslang.dll
# ${SLANG_ROOT}/bin/slang.dll
# DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
# install(FILES
# ${SLANG_ROOT}/lib/slang.lib
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
#elseif(APPLE)
# set(BINARY_ROOT ${SLANG_ROOT}/bin/macosx-aarch64/release/)
# set_target_properties(shader-slang PROPERTIES IMPORTED_LOCATION ${BINARY_ROOT}/libslang.dylib)
# install(FILES
# ${BINARY_ROOT}/libslang.dylib
# DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
#endif()
#target_include_directories(shader-slang INTERFACE
# $<BUILD_INTERFACE:${SLANG_ROOT}/>
# $<INSTALL_INTERFACE:include>
#)
add_library(slang SHARED IMPORTED)
if(WIN32)
add_library(slang-glslang SHARED IMPORTED)
set(SLANG_ROOT ${EXTERNAL_ROOT}/slang/bin/windows-x64/release/)
set_target_properties(slang-glslang PROPERTIES IMPORTED_LOCATION ${SLANG_ROOT}slang-glslang.dll)
set_target_properties(slang-glslang PROPERTIES IMPORTED_IMPLIB ${SLANG_ROOT}slang.lib)
set_target_properties(slang PROPERTIES IMPORTED_LOCATION ${SLANG_ROOT}slang.dll)
set_target_properties(slang PROPERTIES IMPORTED_IMPLIB ${SLANG_ROOT}slang.lib)
target_link_libraries(slang INTERFACE slang-glslang)
install(FILES
${SLANG_ROOT}slang-glslang.dll
${SLANG_ROOT}slang.dll
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES
${SLANG_ROOT}slang.lib
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
elseif(APPLE)
set(BINARY_ROOT ${SLANG_ROOT}/bin/macosx-aarch64/release/)
set_target_properties(slang PROPERTIES IMPORTED_LOCATION ${BINARY_ROOT}/libslang.dylib)
install(FILES
${BINARY_ROOT}/libslang.dylib
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()
target_include_directories(slang INTERFACE
$<BUILD_INTERFACE:${EXTERNAL_ROOT}/slang>
$<INSTALL_INTERFACE:include>
)
add_subdirectory(${SLANG_ROOT})
target_compile_definitions(compiler-core PUBLIC SLANG_ENABLE_DXIL_SUPPORT=1)
#--------------CRC++------------------------------
add_library(crcpp INTERFACE)
-1
View File
@@ -1 +0,0 @@
bin/compile_commands.json
+1 -1
+8 -180
View File
@@ -5,12 +5,14 @@
#include "Asset/MeshLoader.h"
#include "Asset/TextureLoader.h"
#include "Graphics/Initializer.h"
#ifdef __APPLE__
#include "Graphics/Metal/Graphics.h"
#else
#include "Graphics/Vulkan/Graphics.h"
#endif
#include "Graphics/StaticMeshVertexData.h"
#include "Graphics/Vulkan/Graphics.h"
#include "Window/InspectorView.h"
#include "Window/PlayView.h"
#include "Window/SceneView.h"
#include "Window/WindowManager.h"
#include <fmt/core.h>
@@ -21,6 +23,7 @@ using namespace Seele::Editor;
static Gfx::OGraphics graphics;
int main() {
std::string gameName = "MeshShadingDemo";
#ifdef WIN32
std::filesystem::path outputPath = "C:/Users/Dynamitos/MeshShadingDemoGame";
std::filesystem::path sourcePath = "C:/Users/Dynamitos/MeshShadingDemo";
@@ -34,7 +37,6 @@ int main() {
std::filesystem::path sourcePath = "/home/dynamitos/MeshShadingDemo";
std::filesystem::path binaryPath = sourcePath / "cmake" / "libMeshShadingDemo.so";
#endif
std::string gameName = "MeshShadingDemo";
std::filesystem::path cmakePath = outputPath / "cmake";
#ifdef __APPLE__
@@ -52,178 +54,12 @@ int main() {
AssetImporter::importFont(FontImportArgs{
.filePath = "./fonts/Calibri.ttf",
});
// AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "old_resources/models/arena.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "old_resources/models/frog.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "old_resources/models/train.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/bird.fbx",
// });
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/cube.fbx",
});
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/flameThrower.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/player.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/shotgun.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/track.fbx",
// });
// AssetImporter::importMesh(MeshImportArgs{
// .filePath= sourcePath / "old_resources/models/zombie.fbx",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Dirt.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/DirtGrass.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Grass.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Ice.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Lava.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Obsidian.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Rocks.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Sand.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Water.png",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/Wood.png",
// });
//
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level0/blendMap.png",
// .importPath = "level0",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level0/heightMap.png",
// .importPath = "level0",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level0/trackMap.png",
// .importPath = "level0",
// });
// AssetImporter::importMaterial(MaterialImportArgs{
// .filePath= sourcePath / "old_resources/shaders/TerrainMaterial.json",
// .importPath = "level0",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level1/blendMap.png",
// .importPath = "level1",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level1/heightMap.png",
// .importPath = "level1",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level1/trackMap.png",
// .importPath = "level1",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level2/blendMap.png",
// .importPath = "level2",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level2/heightMap.png",
// .importPath = "level2",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level2/trackMap.png",
// .importPath = "level2",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level3/blendMap.png",
// .importPath = "level3",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level3/heightMap.png",
// .importPath = "level3",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level3/trackMap.png",
// .importPath = "level3",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level4/blendMap.png",
// .importPath = "level4",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level4/heightMap.png",
// .importPath = "level4",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level4/trackMap.png",
// .importPath = "level4",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level5/blendMap.png",
// .importPath = "level5",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level5/heightMap.png",
// .importPath = "level5",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level5/trackMap.png",
// .importPath = "level5",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level6/blendMap.png",
// .importPath = "level6",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level6/heightMap.png",
// .importPath = "level6",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level6/trackMap.png",
// .importPath = "level6",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level7/blendMap.png",
// .importPath = "level7",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level7/heightMap.png",
// .importPath = "level7",
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/textures/level7/trackMap.png",
// .importPath = "level7",
// });
//
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/skyboxes/FS000_Day_01.png",
// .type = TextureImportType::TEXTURE_CUBEMAP,
// });
// AssetImporter::importTexture(TextureImportArgs{
// .filePath= sourcePath / "old_resources/skyboxes/FS000_Night_01.png",
// .type = TextureImportType::TEXTURE_CUBEMAP,
// });
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.blend"
});
WindowCreateInfo mainWindowInfo;
mainWindowInfo.title = "SeeleEngine";
mainWindowInfo.width = 1920;
@@ -237,14 +73,6 @@ int main() {
sceneViewInfo.dimensions.offset.y = 0;
sceneViewInfo.numSamples = Gfx::SE_SAMPLE_COUNT_1_BIT;
OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string());
// ViewportCreateInfo inspectorViewInfo;
// inspectorViewInfo.dimensions.size.x = 640;
// inspectorViewInfo.dimensions.size.y = 720;
// inspectorViewInfo.dimensions.offset.x = 640;
// inspectorViewInfo.dimensions.offset.y = 0;
// PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
// window->addView(inspectorView);
sceneView->setFocused();
while (windowManager->isActive()) {
+5 -5
View File
@@ -323,15 +323,15 @@ void AssetRegistry::saveAsset(PAsset asset, uint64 identifier, const std::filesy
std::string path = (folderPath / name).replace_extension("asset").string();
auto assetStream = createWriteStream(std::move(path), std::ios::binary);
ArchiveBuffer assetBuffer(graphics);
ArchiveBuffer buffer(graphics);
// write identifier
Serialization::save(assetBuffer, identifier);
Serialization::save(buffer, identifier);
// write name
Serialization::save(assetBuffer, name);
Serialization::save(buffer, name);
// write folder
Serialization::save(assetBuffer, folderPath.string());
Serialization::save(buffer, folderPath.string());
// write asset data
asset->save(assetBuffer);
asset->save(buffer);
assetBuffer.writeToStream(assetStream);
}
+2 -1
View File
@@ -67,6 +67,7 @@ public:
bool operator<(PDescriptorSet other);
constexpr PDescriptorLayout getLayout() const { return layout; }
constexpr const std::string& getName() const { return layout->getName(); }
protected:
PDescriptorLayout layout;
@@ -83,7 +84,7 @@ public:
void addPushConstants(const SePushConstantRange& pushConstants);
constexpr uint32 getHash() const { return layoutHash; }
constexpr const Map<std::string, PDescriptorLayout>& getLayouts() const { return descriptorSetLayouts; }
constexpr uint32 findParameter(const std::string& name) const { return parameterMapping[name]; }
constexpr uint32 findParameter(const std::string& param) const { return parameterMapping[param]; }
void addMapping(Map<std::string, uint32> mapping);
constexpr std::string getName() const {return name;};
+1 -1
View File
@@ -118,9 +118,9 @@ struct ShaderBufferCreateInfo
DECLARE_NAME_REF(Gfx, PipelineLayout)
struct ShaderCreateInfo
{
std::string name; // Debug info
std::string mainModule;
Array<std::string> additionalModules;
std::string name; // Debug info
std::string entryPoint;
Array<Pair<const char*, const char*>> typeParameter;
Map<const char*, const char*> defines;
+1 -1
View File
@@ -124,9 +124,9 @@ void DebugPass::createRenderPass()
pipelineLayout->create();
ShaderCreateInfo createInfo = {
.name = "DebugVertex",
.mainModule = "Debug",
.additionalModules = { "Debug" },
.name = "DebugVertex",
.entryPoint = "vertexMain",
};
vertexShader = graphics->createVertexShader(createInfo);
@@ -133,8 +133,8 @@ void LightCullingPass::publishOutputs()
ShaderCreateInfo createInfo = {
.name = "Culling",
.additionalModules = {"LightCulling"},
.mainModule = "LightCulling",
.additionalModules = {"LightCulling"},
.entryPoint = "cullLights",
.rootSignature = cullingLayout,
};
@@ -226,8 +226,8 @@ void LightCullingPass::setupFrustums()
frustumLayout->create();
ShaderCreateInfo createInfo = {
.name = "Frustum",
.additionalModules = {"ComputeFrustums"},
.mainModule = "ComputeFrustums",
.additionalModules = {"ComputeFrustums"},
.entryPoint = "computeFrustums",
.rootSignature = frustumLayout,
};
@@ -111,9 +111,9 @@ void SkyboxRenderPass::createRenderPass()
});
ShaderCreateInfo createInfo = {
.name = "SkyboxVertex",
.mainModule = "Skybox",
.additionalModules = {"Skybox"},
.name = "SkyboxVertex",
.entryPoint = "vertexMain",
};
vertexShader = graphics->createVertexShader(createInfo);
+2 -2
View File
@@ -139,7 +139,7 @@ void UIPass::createRenderPass()
descriptorSet->updateSampler(1, backgroundSampler);
descriptorSet->writeChanges();
Gfx::OPipelineLayout pipelineLayout = graphics->createPipelineLayout();
pipelineLayout = graphics->createPipelineLayout();
pipelineLayout->addDescriptorLayout(descriptorLayout);
pipelineLayout->create();
@@ -153,7 +153,7 @@ void UIPass::createRenderPass()
pipelineInfo.vertexShader = vertexShader;
pipelineInfo.fragmentShader = fragmentShader;
pipelineInfo.renderPass = renderPass;
pipelineInfo.pipelineLayout = std::move(pipelineLayout);
pipelineInfo.pipelineLayout = pipelineLayout;
pipelineInfo.rasterizationState.cullMode = Gfx::SE_CULL_MODE_NONE;
pipelineInfo.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
+102 -169
View File
@@ -13,56 +13,22 @@ struct PendingBuffer {
bool writeOnly;
};
static Map<Vulkan::Buffer *, PendingBuffer> pendingBuffers;
static Map<Vulkan::Buffer*, PendingBuffer> pendingBuffers;
Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage,
Gfx::QueueType &queueType, bool dynamic, std::string name)
: graphics(graphics), currentBuffer(0), size(size), owner(queueType),
name(name) {
Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::QueueType& queueType, bool dynamic,
std::string name)
: graphics(graphics), currentBuffer(0), size(size), owner(queueType), usage(usage), name(name) {
if (dynamic) {
numBuffers = Gfx::numFramesBuffered;
} else {
numBuffers = 1;
}
VkBufferCreateInfo info = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr,
.size = size,
.usage = usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
};
VmaAllocationCreateInfo allocInfo = {
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT |
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
};
for (uint32 i = 0; i < numBuffers; ++i) {
vmaCreateBuffer(graphics->getAllocator(), &info, &allocInfo,
&buffers[i].buffer, &buffers[i].allocation,
&buffers[i].info);
vmaGetAllocationMemoryProperties(graphics->getAllocator(),
buffers[i].allocation,
&buffers[i].properties);
// std::cout << "Create buffer " << std::hex << (uint64)buffers[i].buffer <<
// std::dec;
if (!name.empty()) {
VkDebugUtilsObjectNameInfoEXT nameInfo = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.pNext = nullptr,
.objectType = VK_OBJECT_TYPE_BUFFER,
.objectHandle = (uint64)buffers[i].buffer,
.pObjectName = this->name.c_str()};
graphics->vkSetDebugUtilsObjectNameEXT(&nameInfo);
// std::cout << ": " << name;
}
// std::cout << std::endl;
}
createBuffer();
}
Buffer::~Buffer() {
for (uint32 i = 0; i < numBuffers; ++i) {
graphics->getDestructionManager()->queueBuffer(
graphics->getQueueCommands(owner)->getCommands(), buffers[i].buffer,
graphics->getDestructionManager()->queueBuffer(graphics->getQueueCommands(owner)->getCommands(), buffers[i].buffer,
buffers[i].allocation);
}
}
@@ -112,16 +78,12 @@ void Buffer::executeOwnershipBarrier(Gfx::QueueType newOwner) {
dynamicBarriers[i] = barrier;
dynamicBarriers[i].buffer = buffers[i].buffer;
}
vkCmdPipelineBarrier(srcCommand, srcStage, srcStage, 0, 0, nullptr,
numBuffers, dynamicBarriers, 0, nullptr);
vkCmdPipelineBarrier(dstCommand, dstStage, dstStage, 0, 0, nullptr,
numBuffers, dynamicBarriers, 0, nullptr);
vkCmdPipelineBarrier(srcCommand, srcStage, srcStage, 0, 0, nullptr, numBuffers, dynamicBarriers, 0, nullptr);
vkCmdPipelineBarrier(dstCommand, dstStage, dstStage, 0, 0, nullptr, numBuffers, dynamicBarriers, 0, nullptr);
sourcePool->submitCommands();
}
void Buffer::executePipelineBarrier(VkAccessFlags srcAccess,
VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess,
void Buffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage, VkAccessFlags dstAccess,
VkPipelineStageFlags dstStage) {
PCommand commandBuffer = graphics->getQueueCommands(owner)->getCommands();
VkBufferMemoryBarrier barrier = {
@@ -139,15 +101,15 @@ void Buffer::executePipelineBarrier(VkAccessFlags srcAccess,
dynamicBarriers[i] = barrier;
dynamicBarriers[i].buffer = buffers[i].buffer;
}
vkCmdPipelineBarrier(commandBuffer->getHandle(), srcStage, dstStage, 0, 0,
nullptr, numBuffers, dynamicBarriers, 0, nullptr);
vkCmdPipelineBarrier(commandBuffer->getHandle(), srcStage, dstStage, 0, 0, nullptr, numBuffers, dynamicBarriers, 0,
nullptr);
}
void *Buffer::map(bool writeOnly) { return mapRegion(0, size, writeOnly); }
void *Buffer::mapRegion(uint64 regionOffset, uint64 regionSize,
bool writeOnly) {
void *data = nullptr;
void* Buffer::map(bool writeOnly) { return mapRegion(0, size, writeOnly); }
void* Buffer::mapRegion(uint64 regionOffset, uint64 regionSize, bool writeOnly) {
void* data = nullptr;
PendingBuffer pending;
pending.writeOnly = writeOnly;
@@ -155,10 +117,8 @@ void *Buffer::mapRegion(uint64 regionOffset, uint64 regionSize,
pending.offset = regionOffset;
pending.size = regionSize;
if (writeOnly) {
if (buffers[currentBuffer].properties &
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
VK_CHECK(vmaMapMemory(graphics->getAllocator(),
buffers[currentBuffer].allocation, &data));
if (buffers[currentBuffer].properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
VK_CHECK(vmaMapMemory(graphics->getAllocator(), buffers[currentBuffer].allocation, &data));
} else {
VkBufferCreateInfo stagingInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
@@ -172,8 +132,7 @@ void *Buffer::mapRegion(uint64 regionOffset, uint64 regionSize,
.usage = VMA_MEMORY_USAGE_AUTO,
.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
};
VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo,
&allocInfo, &pending.stagingBuffer,
VK_CHECK(vmaCreateBuffer(graphics->getAllocator(), &stagingInfo, &allocInfo, &pending.stagingBuffer,
&pending.allocation, nullptr));
vmaMapMemory(graphics->getAllocator(), pending.allocation, &data);
}
@@ -189,15 +148,12 @@ void *Buffer::mapRegion(uint64 regionOffset, uint64 regionSize,
void Buffer::unmap() {
auto found = pendingBuffers.find(this);
if (found != pendingBuffers.end()) {
PendingBuffer &pending = found->value;
PendingBuffer& pending = found->value;
if (pending.writeOnly) {
if (buffers[currentBuffer].properties &
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
vmaUnmapMemory(graphics->getAllocator(),
buffers[currentBuffer].allocation);
if (buffers[currentBuffer].properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
vmaUnmapMemory(graphics->getAllocator(), buffers[currentBuffer].allocation);
} else {
vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0,
VK_WHOLE_SIZE);
vmaFlushAllocation(graphics->getAllocator(), pending.allocation, 0, VK_WHOLE_SIZE);
vmaUnmapMemory(graphics->getAllocator(), pending.allocation);
PCommand command = graphics->getQueueCommands(owner)->getCommands();
VkCommandBuffer cmdHandle = command->getHandle();
@@ -218,11 +174,9 @@ void Buffer::unmap() {
.offset = 0,
.size = size,
};
vkCmdPipelineBarrier(cmdHandle, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 1,
&barrier, 0, nullptr);
vkCmdCopyBuffer(cmdHandle, pending.stagingBuffer,
buffers[currentBuffer].buffer, 1, &region);
vkCmdPipelineBarrier(cmdHandle, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0,
nullptr, 1, &barrier, 0, nullptr);
vkCmdCopyBuffer(cmdHandle, pending.stagingBuffer, buffers[currentBuffer].buffer, 1, &region);
barrier = {
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
.pNext = nullptr,
@@ -234,27 +188,49 @@ void Buffer::unmap() {
.offset = 0,
.size = size,
};
vkCmdPipelineBarrier(cmdHandle, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, nullptr,
1, &barrier, 0, nullptr);
graphics->getDestructionManager()->queueBuffer(
command, pending.stagingBuffer, pending.allocation);
vkCmdPipelineBarrier(cmdHandle, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0,
nullptr, 1, &barrier, 0, nullptr);
graphics->getDestructionManager()->queueBuffer(command, pending.stagingBuffer, pending.allocation);
}
}
// requestOwnershipTransfer(pending.prevQueue);
pendingBuffers.erase(this);
}
}
UniformBuffer::UniformBuffer(PGraphics graphics,
const UniformBufferCreateInfo &createInfo)
void Buffer::createBuffer()
{
VkBufferCreateInfo info = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr,
.size = size,
.usage = usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
};
VmaAllocationCreateInfo allocInfo = {
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT |
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
};
buffers.add();
vmaCreateBuffer(graphics->getAllocator(), &info, &allocInfo, &buffers.back().buffer, &buffers.back().allocation,
&buffers.back().info);
vmaGetAllocationMemoryProperties(graphics->getAllocator(), buffers.back().allocation, &buffers.back().properties);
if (!name.empty()) {
VkDebugUtilsObjectNameInfoEXT nameInfo = { .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.pNext = nullptr,
.objectType = VK_OBJECT_TYPE_BUFFER,
.objectHandle = (uint64)buffers.back().buffer,
.pObjectName = this->name.c_str() };
graphics->vkSetDebugUtilsObjectNameEXT(&nameInfo);
}
}
UniformBuffer::UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo& createInfo)
: Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.sourceData),
Vulkan::Buffer(graphics, createInfo.sourceData.size,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, currentOwner,
Vulkan::Buffer(graphics, createInfo.sourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, currentOwner,
createInfo.dynamic, createInfo.name) {
if (createInfo.sourceData.data != nullptr) {
void *data = map();
void* data = map();
std::memcpy(data, createInfo.sourceData.data, createInfo.sourceData.size);
unmap();
}
@@ -262,19 +238,17 @@ UniformBuffer::UniformBuffer(PGraphics graphics,
UniformBuffer::~UniformBuffer() {}
bool UniformBuffer::updateContents(const DataSource &sourceData) {
bool UniformBuffer::updateContents(const DataSource& sourceData) {
if (!Gfx::UniformBuffer::updateContents(sourceData)) {
// no update was performed, skip
return false;
}
void *data = map();
void* data = map();
std::memcpy(data, sourceData.data, sourceData.size);
unmap();
return true;
}
void UniformBuffer::beginFrame() { Vulkan::Buffer::advanceBuffer(); }
void UniformBuffer::requestOwnershipTransfer(Gfx::QueueType newOwner) {
Gfx::QueueOwnedResource::transferOwnership(newOwner);
}
@@ -283,31 +257,21 @@ void UniformBuffer::executeOwnershipBarrier(Gfx::QueueType newOwner) {
Vulkan::Buffer::executeOwnershipBarrier(newOwner);
}
void UniformBuffer::executePipelineBarrier(VkAccessFlags srcAccess,
VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess,
VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess,
dstStage);
void UniformBuffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess, dstStage);
}
VkAccessFlags UniformBuffer::getSourceAccessMask() {
return VK_ACCESS_MEMORY_WRITE_BIT;
}
VkAccessFlags UniformBuffer::getSourceAccessMask() { return VK_ACCESS_MEMORY_WRITE_BIT; }
VkAccessFlags UniformBuffer::getDestAccessMask() {
return VK_ACCESS_UNIFORM_READ_BIT;
}
VkAccessFlags UniformBuffer::getDestAccessMask() { return VK_ACCESS_UNIFORM_READ_BIT; }
ShaderBuffer::ShaderBuffer(PGraphics graphics,
const ShaderBufferCreateInfo &sourceData)
: Gfx::ShaderBuffer(graphics->getFamilyMapping(), sourceData.numElements,
sourceData.sourceData),
Vulkan::Buffer(graphics, sourceData.sourceData.size,
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, currentOwner,
ShaderBuffer::ShaderBuffer(PGraphics graphics, const ShaderBufferCreateInfo& sourceData)
: Gfx::ShaderBuffer(graphics->getFamilyMapping(), sourceData.numElements, sourceData.sourceData),
Vulkan::Buffer(graphics, sourceData.sourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, currentOwner,
sourceData.dynamic, sourceData.name) {
if (sourceData.sourceData.data != nullptr) {
void *data = map();
void* data = map();
std::memcpy(data, sourceData.sourceData.data, sourceData.sourceData.size);
unmap();
}
@@ -315,18 +279,16 @@ ShaderBuffer::ShaderBuffer(PGraphics graphics,
ShaderBuffer::~ShaderBuffer() {}
bool ShaderBuffer::updateContents(const DataSource &sourceData) {
bool ShaderBuffer::updateContents(const DataSource& sourceData) {
assert(sourceData.size <= getSize());
Gfx::ShaderBuffer::updateContents(sourceData);
// We always want to update, as the contents could be different on the GPU
void *data = map();
void* data = map();
std::memcpy(data, sourceData.data, sourceData.size);
unmap();
return true;
}
void ShaderBuffer::beginFrame() { Vulkan::Buffer::advanceBuffer(); }
void ShaderBuffer::requestOwnershipTransfer(Gfx::QueueType newOwner) {
Gfx::QueueOwnedResource::transferOwnership(newOwner);
}
@@ -335,31 +297,22 @@ void ShaderBuffer::executeOwnershipBarrier(Gfx::QueueType newOwner) {
Vulkan::Buffer::executeOwnershipBarrier(newOwner);
}
void ShaderBuffer::executePipelineBarrier(VkAccessFlags srcAccess,
VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess,
VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess,
dstStage);
void ShaderBuffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess, dstStage);
}
VkAccessFlags ShaderBuffer::getSourceAccessMask() {
return VK_ACCESS_MEMORY_WRITE_BIT;
}
VkAccessFlags ShaderBuffer::getSourceAccessMask() { return VK_ACCESS_MEMORY_WRITE_BIT; }
VkAccessFlags ShaderBuffer::getDestAccessMask() {
return VK_ACCESS_MEMORY_READ_BIT;
}
VkAccessFlags ShaderBuffer::getDestAccessMask() { return VK_ACCESS_MEMORY_READ_BIT; }
VertexBuffer::VertexBuffer(PGraphics graphics,
const VertexBufferCreateInfo &sourceData)
: Gfx::VertexBuffer(graphics->getFamilyMapping(), sourceData.numVertices,
sourceData.vertexSize, sourceData.sourceData.owner),
Vulkan::Buffer(graphics, sourceData.sourceData.size,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, currentOwner, false,
VertexBuffer::VertexBuffer(PGraphics graphics, const VertexBufferCreateInfo& sourceData)
: Gfx::VertexBuffer(graphics->getFamilyMapping(), sourceData.numVertices, sourceData.vertexSize,
sourceData.sourceData.owner),
Vulkan::Buffer(graphics, sourceData.sourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, currentOwner, false,
sourceData.name) {
if (sourceData.sourceData.data != nullptr) {
void *data = map();
void* data = map();
std::memcpy(data, sourceData.sourceData.data, sourceData.sourceData.size);
unmap();
}
@@ -368,20 +321,18 @@ VertexBuffer::VertexBuffer(PGraphics graphics,
VertexBuffer::~VertexBuffer() {}
void VertexBuffer::updateRegion(DataSource update) {
void *data = mapRegion(update.offset, update.size);
void* data = mapRegion(update.offset, update.size);
std::memcpy(data, update.data, update.size);
unmap();
}
void VertexBuffer::download(Array<uint8> &buffer) {
void *data = map(false);
void VertexBuffer::download(Array<uint8>& buffer) {
void* data = map(false);
buffer.resize(size);
std::memcpy(buffer.data(), data, size);
unmap();
}
void VertexBuffer::beginFrame() { Vulkan::Buffer::advanceBuffer(); }
void VertexBuffer::requestOwnershipTransfer(Gfx::QueueType newOwner) {
Gfx::QueueOwnedResource::transferOwnership(newOwner);
}
@@ -390,31 +341,22 @@ void VertexBuffer::executeOwnershipBarrier(Gfx::QueueType newOwner) {
Vulkan::Buffer::executeOwnershipBarrier(newOwner);
}
void VertexBuffer::executePipelineBarrier(VkAccessFlags srcAccess,
VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess,
VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess,
dstStage);
void VertexBuffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess, dstStage);
}
VkAccessFlags VertexBuffer::getSourceAccessMask() {
return VK_ACCESS_MEMORY_WRITE_BIT;
}
VkAccessFlags VertexBuffer::getSourceAccessMask() { return VK_ACCESS_MEMORY_WRITE_BIT; }
VkAccessFlags VertexBuffer::getDestAccessMask() {
return VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
}
VkAccessFlags VertexBuffer::getDestAccessMask() { return VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT; }
IndexBuffer::IndexBuffer(PGraphics graphics,
const IndexBufferCreateInfo &sourceData)
: Gfx::IndexBuffer(graphics->getFamilyMapping(), sourceData.sourceData.size,
sourceData.indexType, sourceData.sourceData.owner),
Vulkan::Buffer(graphics, sourceData.sourceData.size,
VK_BUFFER_USAGE_INDEX_BUFFER_BIT, currentOwner, false,
IndexBuffer::IndexBuffer(PGraphics graphics, const IndexBufferCreateInfo& sourceData)
: Gfx::IndexBuffer(graphics->getFamilyMapping(), sourceData.sourceData.size, sourceData.indexType,
sourceData.sourceData.owner),
Vulkan::Buffer(graphics, sourceData.sourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, currentOwner, false,
sourceData.name) {
if (sourceData.sourceData.data != nullptr) {
void *data = map();
void* data = map();
std::memcpy(data, sourceData.sourceData.data, sourceData.sourceData.size);
unmap();
}
@@ -422,15 +364,13 @@ IndexBuffer::IndexBuffer(PGraphics graphics,
IndexBuffer::~IndexBuffer() {}
void IndexBuffer::download(Array<uint8> &buffer) {
void *data = map(false);
void IndexBuffer::download(Array<uint8>& buffer) {
void* data = map(false);
buffer.resize(size);
std::memcpy(buffer.data(), data, size);
unmap();
}
void IndexBuffer::beginFrame() { Vulkan::Buffer::advanceBuffer(); }
void IndexBuffer::requestOwnershipTransfer(Gfx::QueueType newOwner) {
Gfx::QueueOwnedResource::transferOwnership(newOwner);
}
@@ -439,18 +379,11 @@ void IndexBuffer::executeOwnershipBarrier(Gfx::QueueType newOwner) {
Vulkan::Buffer::executeOwnershipBarrier(newOwner);
}
void IndexBuffer::executePipelineBarrier(VkAccessFlags srcAccess,
VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess,
VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess,
dstStage);
void IndexBuffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineStageFlags srcStage,
VkAccessFlags dstAccess, VkPipelineStageFlags dstStage) {
Vulkan::Buffer::executePipelineBarrier(srcAccess, srcStage, dstAccess, dstStage);
}
VkAccessFlags IndexBuffer::getSourceAccessMask() {
return VK_ACCESS_MEMORY_WRITE_BIT;
}
VkAccessFlags IndexBuffer::getSourceAccessMask() { return VK_ACCESS_MEMORY_WRITE_BIT; }
VkAccessFlags IndexBuffer::getDestAccessMask() {
return VK_ACCESS_INDEX_READ_BIT;
}
VkAccessFlags IndexBuffer::getDestAccessMask() { return VK_ACCESS_INDEX_READ_BIT; }
+4
View File
@@ -4,6 +4,8 @@
namespace Seele {
namespace Vulkan {
DECLARE_REF(Command)
DECLARE_REF(Fence)
class Buffer {
public:
Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage,
@@ -28,8 +30,10 @@ protected:
uint64 size;
Gfx::QueueType &owner;
Array<BufferAllocation> buffers;
VkBufferUsageFlags usage;
uint32 numBuffers;
std::string name;
void createBuffer();
void executeOwnershipBarrier(Gfx::QueueType newOwner);
void executePipelineBarrier(VkAccessFlags srcAccess,
+10 -10
View File
@@ -279,7 +279,7 @@ void RenderCommand::bindDescriptor(Gfx::PDescriptorSet descriptorSet)
descriptor->bind();
VkDescriptorSet setHandle = descriptor->getHandle();
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getLayout(), descriptorSet->getSetIndex(), 1, &setHandle, 0, nullptr);
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getLayout(), pipeline->getPipelineLayout()->findParameter(descriptorSet->getName()), 1, &setHandle, 0, nullptr);
}
void RenderCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorSets)
{
@@ -292,7 +292,7 @@ void RenderCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorS
descriptorSet->bind();
boundDescriptors.add(descriptorSet.getHandle());
sets[descriptorSet->getSetIndex()] = descriptorSet->getHandle();
sets[pipeline->getPipelineLayout()->findParameter(descriptorSet->getName())] = descriptorSet->getHandle();
}
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getLayout(), 0, (uint32)descriptorSets.size(), sets, 0, nullptr);
delete[] sets;
@@ -416,7 +416,7 @@ void ComputeCommand::bindDescriptor(Gfx::PDescriptorSet descriptorSet)
descriptor->bind();
VkDescriptorSet setHandle = descriptor->getHandle();
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(), descriptorSet->getSetIndex(), 1, &setHandle, 0, nullptr);
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(), pipeline->getPipelineLayout()->findParameter(descriptorSet->getName()), 1, &setHandle, 0, nullptr);
}
void ComputeCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorSets)
@@ -431,7 +431,7 @@ void ComputeCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptor
//std::cout << "Binding descriptor " << descriptorSet->getHandle() << " to cmd " << handle << std::endl;
boundDescriptors.add(descriptorSet.getHandle());
sets[descriptorSet->getSetIndex()] = descriptorSet->getHandle();
sets[pipeline->getPipelineLayout()->findParameter(descriptorSet->getName())] = descriptorSet->getHandle();
}
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(), 0, (uint32)descriptorSets.size(), sets, 0, nullptr);
delete[] sets;
@@ -469,9 +469,9 @@ CommandPool::CommandPool(PGraphics graphics, PQueue queue)
CommandPool::~CommandPool()
{
vkDeviceWaitIdle(graphics->getDevice());
for (auto& command : allocatedBuffers)
for (auto& cmd : allocatedBuffers)
{
command->checkFence();
cmd->checkFence();
}
allocatedRenderCommands.clear();
allocatedComputeCommands.clear();
@@ -487,17 +487,17 @@ PCommand CommandPool::getCommands()
}
void CommandPool::cacheCommands(Array<ORenderCommand> commands)
{
for(auto&& command : commands)
for(auto&& cmd : commands)
{
allocatedRenderCommands.add(std::move(command));
allocatedRenderCommands.add(std::move(cmd));
}
}
void CommandPool::cacheCommands(Array<OComputeCommand> commands)
{
for(auto&& command : commands)
for(auto&& cmd : commands)
{
allocatedComputeCommands.add(std::move(command));
allocatedComputeCommands.add(std::move(cmd));
}
}
+12 -19
View File
@@ -73,18 +73,13 @@ public:
virtual void setViewport(Gfx::PViewport viewport) override;
virtual void bindPipeline(Gfx::PGraphicsPipeline pipeline) override;
virtual void bindDescriptor(Gfx::PDescriptorSet descriptorSet) override;
virtual void
bindDescriptor(const Array<Gfx::PDescriptorSet> &descriptorSets) override;
virtual void
bindVertexBuffer(const Array<Gfx::PVertexBuffer> &buffers) override;
virtual void bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorSets) override;
virtual void bindVertexBuffer(const Array<Gfx::PVertexBuffer>& buffers) override;
virtual void bindIndexBuffer(Gfx::PIndexBuffer indexBuffer) override;
virtual void pushConstants(Gfx::PPipelineLayout layout,
Gfx::SeShaderStageFlags stage, uint32 offset,
uint32 size, const void *data) override;
virtual void draw(uint32 vertexCount, uint32 instanceCount, int32 firstVertex,
uint32 firstInstance) override;
virtual void drawIndexed(uint32 indexCount, uint32 instanceCount,
int32 firstIndex, uint32 vertexOffset,
virtual void pushConstants(Gfx::PPipelineLayout layout, Gfx::SeShaderStageFlags stage, uint32 offset, uint32 size,
const void* data) override;
virtual void draw(uint32 vertexCount, uint32 instanceCount, int32 firstVertex, uint32 firstInstance) override;
virtual void drawIndexed(uint32 indexCount, uint32 instanceCount, int32 firstIndex, uint32 vertexOffset,
uint32 firstInstance) override;
virtual void drawMesh(uint32 groupX, uint32 groupY, uint32 groupZ) override;
@@ -113,12 +108,10 @@ public:
bool isReady();
virtual void bindPipeline(Gfx::PComputePipeline pipeline) override;
virtual void bindDescriptor(Gfx::PDescriptorSet set) override;
virtual void bindDescriptor(const Array<Gfx::PDescriptorSet> &sets) override;
virtual void pushConstants(Gfx::PPipelineLayout layout,
Gfx::SeShaderStageFlags stage, uint32 offset,
uint32 size, const void *data) override;
virtual void dispatch(uint32 threadX, uint32 threadY,
uint32 threadZ) override;
virtual void bindDescriptor(const Array<Gfx::PDescriptorSet>& sets) override;
virtual void pushConstants(Gfx::PPipelineLayout layout, Gfx::SeShaderStageFlags stage, uint32 offset, uint32 size,
const void* data) override;
virtual void dispatch(uint32 threadX, uint32 threadY, uint32 threadZ) override;
private:
PComputePipeline pipeline;
@@ -141,8 +134,8 @@ public:
PCommand getCommands();
void cacheCommands(Array<ORenderCommand> commands);
void cacheCommands(Array<OComputeCommand> commands);
ORenderCommand createRenderCommand(const std::string &name);
OComputeCommand createComputeCommand(const std::string &name);
ORenderCommand createRenderCommand(const std::string& name);
OComputeCommand createComputeCommand(const std::string& name);
constexpr VkCommandPool getHandle() const { return commandPool; }
void submitCommands(PSemaphore signalSemaphore = nullptr);
+6 -10
View File
@@ -161,6 +161,7 @@ void DescriptorPool::reset() {
DescriptorSet::DescriptorSet(PGraphics graphics, PDescriptorPool owner)
: Gfx::DescriptorSet(owner->getLayout()), setHandle(VK_NULL_HANDLE), graphics(graphics), owner(owner), bindCount(0),
currentlyInUse(false) {}
DescriptorSet::~DescriptorSet() {}
void DescriptorSet::updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer) {
@@ -315,8 +316,8 @@ void DescriptorSet::writeChanges() {
}
}
PipelineLayout::PipelineLayout(PGraphics graphics, Gfx::PPipelineLayout baseLayout)
: Gfx::PipelineLayout(baseLayout), graphics(graphics), layoutHandle(VK_NULL_HANDLE) {}
PipelineLayout::PipelineLayout(PGraphics graphics, const std::string& name, Gfx::PPipelineLayout baseLayout)
: Gfx::PipelineLayout(name, baseLayout), graphics(graphics), layoutHandle(VK_NULL_HANDLE) {}
PipelineLayout::~PipelineLayout() {}
@@ -324,15 +325,10 @@ Map<uint32, VkPipelineLayout> cachedLayouts;
void PipelineLayout::create() {
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
for (size_t i = 0; i < descriptorSetLayouts.size(); ++i) {
// There could be unused descriptor set indices
if (descriptorSetLayouts[i] == nullptr) {
vulkanDescriptorLayouts[i] = VK_NULL_HANDLE;
continue;
}
PDescriptorLayout layout = descriptorSetLayouts[i].cast<DescriptorLayout>();
for (auto [name, desc] : descriptorSetLayouts) {
PDescriptorLayout layout = desc.cast<DescriptorLayout>();
layout->create();
vulkanDescriptorLayouts[i] = layout->getHandle();
vulkanDescriptorLayouts[parameterMapping[layout->getName()]] = layout->getHandle();
}
Array<VkPushConstantRange> vkPushConstants(pushConstants.size());
+1 -1
View File
@@ -84,7 +84,7 @@ DEFINE_REF(DescriptorSet)
class PipelineLayout : public Gfx::PipelineLayout {
public:
PipelineLayout(PGraphics graphics, Gfx::PPipelineLayout baseLayout);
PipelineLayout(PGraphics graphics, const std::string& name, Gfx::PPipelineLayout baseLayout);
virtual ~PipelineLayout();
virtual void create();
constexpr VkPipelineLayout getHandle() const { return layoutHandle; }
-36
View File
@@ -102,24 +102,6 @@ VkShaderStageFlagBits Seele::Vulkan::cast(const Seele::Gfx::SeShaderStageFlagBit
return VK_SHADER_STAGE_ALL_GRAPHICS;
case SE_SHADER_STAGE_ALL:
return VK_SHADER_STAGE_ALL;
#ifdef USE_EXTENSIONS
case SE_SHADER_STAGE_RAYGEN_BIT_NV:
return VK_SHADER_STAGE_RAYGEN_BIT_NV;
case SE_SHADER_STAGE_ANY_HIT_BIT_NV:
return VK_SHADER_STAGE_ANY_HIT_BIT_NV;
case SE_SHADER_STAGE_CLOSEST_HIT_BIT_NV:
return VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV;
case SE_SHADER_STAGE_MISS_BIT_NV:
return VK_SHADER_STAGE_MISS_BIT_NV;
case SE_SHADER_STAGE_INTERSECTION_BIT_NV:
return VK_SHADER_STAGE_INTERSECTION_BIT_NV;
case SE_SHADER_STAGE_CALLABLE_BIT_NV:
return VK_SHADER_STAGE_CALLABLE_BIT_NV;
case SE_SHADER_STAGE_TASK_BIT_NV:
return VK_SHADER_STAGE_TASK_BIT_NV;
case SE_SHADER_STAGE_MESH_BIT_NV:
return VK_SHADER_STAGE_MESH_BIT_NV;
#endif
default: throw std::logic_error("Not implemented");
}
@@ -145,24 +127,6 @@ Seele::Gfx::SeShaderStageFlagBits Seele::Vulkan::cast(const VkShaderStageFlagBit
return SE_SHADER_STAGE_ALL_GRAPHICS;
case VK_SHADER_STAGE_ALL:
return SE_SHADER_STAGE_ALL;
#ifdef USE_EXTENSIONS
case VK_SHADER_STAGE_RAYGEN_BIT_NV:
return SE_SHADER_STAGE_RAYGEN_BIT_NV;
case VK_SHADER_STAGE_ANY_HIT_BIT_NV:
return SE_SHADER_STAGE_ANY_HIT_BIT_NV;
case VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV:
return SE_SHADER_STAGE_CLOSEST_HIT_BIT_NV;
case VK_SHADER_STAGE_MISS_BIT_NV:
return SE_SHADER_STAGE_MISS_BIT_NV;
case VK_SHADER_STAGE_INTERSECTION_BIT_NV:
return SE_SHADER_STAGE_INTERSECTION_BIT_NV;
case VK_SHADER_STAGE_CALLABLE_BIT_NV:
return SE_SHADER_STAGE_CALLABLE_BIT_NV;
case VK_SHADER_STAGE_TASK_BIT_NV:
return SE_SHADER_STAGE_TASK_BIT_NV;
case VK_SHADER_STAGE_MESH_BIT_NV:
return SE_SHADER_STAGE_MESH_BIT_NV;
#endif
default: throw std::logic_error("Not implemented");
}
+2 -2
View File
@@ -247,9 +247,9 @@ Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name)
return new DescriptorLayout(this, name);
}
Gfx::OPipelineLayout Graphics::createPipelineLayout(Gfx::PPipelineLayout baseLayout)
Gfx::OPipelineLayout Graphics::createPipelineLayout(const std::string& name, Gfx::PPipelineLayout baseLayout)
{
return new PipelineLayout(this, baseLayout);
return new PipelineLayout(this, name, baseLayout);
}
Gfx::OVertexInput Graphics::createVertexInput(VertexInputStateCreateInfo createInfo)
+2 -2
View File
@@ -14,7 +14,7 @@ VertexInput::~VertexInput()
{
}
GraphicsPipeline::GraphicsPipeline(PGraphics graphics, VkPipeline handle, Gfx::OPipelineLayout pipelineLayout)
GraphicsPipeline::GraphicsPipeline(PGraphics graphics, VkPipeline handle, Gfx::PPipelineLayout pipelineLayout)
: Gfx::GraphicsPipeline(std::move(pipelineLayout))
, graphics(graphics)
, pipeline(handle)
@@ -35,7 +35,7 @@ VkPipelineLayout GraphicsPipeline::getLayout() const
return Gfx::PPipelineLayout(layout).cast<PipelineLayout>()->getHandle();
}
ComputePipeline::ComputePipeline(PGraphics graphics, VkPipeline handle, Gfx::OPipelineLayout pipelineLayout)
ComputePipeline::ComputePipeline(PGraphics graphics, VkPipeline handle, Gfx::PPipelineLayout pipelineLayout)
: Gfx::ComputePipeline(std::move(pipelineLayout))
, graphics(graphics)
, pipeline(handle)
+2 -2
View File
@@ -18,7 +18,7 @@ DECLARE_REF(Graphics)
class GraphicsPipeline : public Gfx::GraphicsPipeline
{
public:
GraphicsPipeline(PGraphics graphics, VkPipeline handle, Gfx::OPipelineLayout pipelineLayout);
GraphicsPipeline(PGraphics graphics, VkPipeline handle, Gfx::PPipelineLayout pipelineLayout);
virtual ~GraphicsPipeline();
void bind(VkCommandBuffer handle);
VkPipelineLayout getLayout() const;
@@ -30,7 +30,7 @@ DEFINE_REF(GraphicsPipeline)
class ComputePipeline : public Gfx::ComputePipeline
{
public:
ComputePipeline(PGraphics graphics, VkPipeline handle, Gfx::OPipelineLayout pipelineLayout);
ComputePipeline(PGraphics graphics, VkPipeline handle, Gfx::PPipelineLayout pipelineLayout);
virtual ~ComputePipeline();
void bind(VkCommandBuffer handle);
VkPipelineLayout getLayout() const;
+3 -3
View File
@@ -252,7 +252,7 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
int64 delta = std::chrono::duration_cast<std::chrono::microseconds>(endTime - beginTime).count();
std::cout << "Gfx creation time: " << delta << std::endl;
OGraphicsPipeline pipeline = new GraphicsPipeline(graphics, pipelineHandle, std::move(gfxInfo.pipelineLayout));
OGraphicsPipeline pipeline = new GraphicsPipeline(graphics, pipelineHandle, gfxInfo.pipelineLayout);
PGraphicsPipeline result = pipeline;
graphicsPipelines[hash] = std::move(pipeline);
return result;
@@ -423,7 +423,7 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo gfxI
int64 delta = std::chrono::duration_cast<std::chrono::microseconds>(endTime - beginTime).count();
std::cout << "Gfx creation time: " << delta << std::endl;
OGraphicsPipeline pipeline = new GraphicsPipeline(graphics, pipelineHandle, std::move(gfxInfo.pipelineLayout));
OGraphicsPipeline pipeline = new GraphicsPipeline(graphics, pipelineHandle, gfxInfo.pipelineLayout);
PGraphicsPipeline result = pipeline;
graphicsPipelines[hash] = std::move(pipeline);
return result;
@@ -462,7 +462,7 @@ PComputePipeline PipelineCache::createPipeline(Gfx::ComputePipelineCreateInfo co
int64 delta = std::chrono::duration_cast<std::chrono::microseconds>(endTime - beginTime).count();
std::cout << "Compute creation time: " << delta << std::endl;
OComputePipeline pipeline = new ComputePipeline(graphics, pipelineHandle, std::move(computeInfo.pipelineLayout));
OComputePipeline pipeline = new ComputePipeline(graphics, pipelineHandle, computeInfo.pipelineLayout);
PComputePipeline result = pipeline;
graphicsPipelines[hash] = std::move(pipeline);
return result;
+3 -1
View File
@@ -30,7 +30,9 @@ uint32 Seele::Vulkan::Shader::getShaderHash() const
void Shader::create(const ShaderCreateInfo& createInfo)
{
Slang::ComPtr<slang::IBlob> kernelBlob = generateShader(createInfo, SLANG_SPIRV);
Map<std::string, uint32> paramMapping;
Slang::ComPtr<slang::IBlob> kernelBlob = generateShader(createInfo, SLANG_SPIRV, paramMapping);
const_cast<Gfx::PipelineLayout*>(createInfo.rootSignature.getHandle())->addMapping(paramMapping);
VkShaderModuleCreateInfo moduleInfo =
{
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
+1
View File
@@ -143,6 +143,7 @@ void Window::endFrame()
VK_CHECK(r);
}
currentSemaphoreIndex = (currentSemaphoreIndex + 1) % Gfx::numFramesBuffered;
graphics->waitDeviceIdle();
}
void Window::onWindowCloseEvent()
-1
View File
@@ -1,5 +1,4 @@
#include "slang-compile.h"
#include <slang-com-ptr.h>
#include <slang.h>
#include "Containers/Array.h"
#include <fmt/core.h>
+1 -2
View File
@@ -12,7 +12,6 @@
"fmt",
"gtest",
"vulkan-memory-allocator",
"shader-slang",
"glslang"
"shader-slang"
]
}