SpiecsEngine
 
Loading...
Searching...
No Matches
VulkanFunctions.h
Go to the documentation of this file.
1/**
2* @file VulkanFunctions.h.
3* @brief The VulkanFunctions Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9
10namespace Spices {
11
12/**
13* @brief Macro for declare function pointer variable in VulkanFunctions.
14*/
15#define VK_FUNCTION_POINTER(function)
16 PFN_##function function;
17
18/**
19* @brief Macro for explain function pointer variable in VulkanFunctions::Init.
20*/
21#define EXPLAIN_VK_FUNCTION_POINTER(function)
22 function = reinterpret_cast<PFN_##function>(vkGetInstanceProcAddr(instance, #function));
23
24 /**
25 * @brief Vulkan Function Pointers Collection.
26 * It holds all function pointer which need get manually.
27 */
29 {
30 /**
31 * @brief Init All Vulkan Function Pointer.
32 * @param[in] instance VkInstance.
33 */
34 void Init(VkInstance instance);
35
36 /**
37 * @brief Debug Functions.
38 */
39 VK_FUNCTION_POINTER(vkCreateDebugUtilsMessengerEXT )
40 VK_FUNCTION_POINTER(vkDestroyDebugUtilsMessengerEXT )
41
42 /**
43 * @brief DebugUtils Function.
44 */
45 VK_FUNCTION_POINTER(vkCmdBeginDebugUtilsLabelEXT )
46 VK_FUNCTION_POINTER(vkCmdEndDebugUtilsLabelEXT )
47 VK_FUNCTION_POINTER(vkCmdInsertDebugUtilsLabelEXT )
48
49 VK_FUNCTION_POINTER(vkQueueBeginDebugUtilsLabelEXT )
50 VK_FUNCTION_POINTER(vkQueueEndDebugUtilsLabelEXT )
51 VK_FUNCTION_POINTER(vkQueueInsertDebugUtilsLabelEXT )
52
53 VK_FUNCTION_POINTER(vkSetDebugUtilsObjectNameEXT )
54 VK_FUNCTION_POINTER(vkSetDebugUtilsObjectTagEXT )
55
56 /**
57 * @brief RayTracing Function.
58 */
59 VK_FUNCTION_POINTER(vkGetRayTracingShaderGroupHandlesKHR )
60 VK_FUNCTION_POINTER(vkCmdTraceRaysKHR )
61 VK_FUNCTION_POINTER(vkCreateRayTracingPipelinesKHR )
62 VK_FUNCTION_POINTER(vkCreateAccelerationStructureKHR )
63 VK_FUNCTION_POINTER(vkDestroyAccelerationStructureKHR )
64 VK_FUNCTION_POINTER(vkCmdBuildAccelerationStructuresKHR )
65 VK_FUNCTION_POINTER(vkCopyAccelerationStructureKHR )
66 VK_FUNCTION_POINTER(vkGetAccelerationStructureDeviceAddressKHR )
67 VK_FUNCTION_POINTER(vkCmdWriteAccelerationStructuresPropertiesKHR )
68 VK_FUNCTION_POINTER(vkGetAccelerationStructureBuildSizesKHR )
69 VK_FUNCTION_POINTER(vkCmdCopyAccelerationStructureKHR )
70
71 /**
72 * @brief Mesh Shader Function.
73 */
74 VK_FUNCTION_POINTER(vkCmdDrawMeshTasksEXT )
75
76 /**
77 * @brief DGC Function.
78 */
79 VK_FUNCTION_POINTER(vkCreateIndirectCommandsLayoutNV )
80 VK_FUNCTION_POINTER(vkDestroyIndirectCommandsLayoutNV )
81 VK_FUNCTION_POINTER(vkCmdExecuteGeneratedCommandsNV )
82 VK_FUNCTION_POINTER(vkGetGeneratedCommandsMemoryRequirementsNV )
83 VK_FUNCTION_POINTER(vkCmdPreprocessGeneratedCommandsNV )
84
85 /**
86 * @brief Aftermath Function.
87 */
88 VK_FUNCTION_POINTER(vkCmdSetCheckpointNV )
89
90 /**
91 * @brief Tracy Vulkan Context Collect Function
92 */
93 VK_FUNCTION_POINTER(vkGetPhysicalDeviceCalibrateableTimeDomainsEXT )
94 VK_FUNCTION_POINTER(vkGetCalibratedTimestampsEXT )
95 VK_FUNCTION_POINTER(vkResetQueryPool )
96
97 /**
98 * @brief Copy data to image from host directly.
99 */
100 VK_FUNCTION_POINTER(vkCopyMemoryToImageEXT )
101 VK_FUNCTION_POINTER(vkCopyImageToMemoryEXT )
102 };
103}
#define ASSERT(expr)
Assert macro.
Definition Core.h:29
int main()
Main Function.
Definition EntryPoint.h:15
#define PROCESS_INSTANCE_ENTRY
Macros of modify Process instance state.
#define PROCESS_INSTANCE_EXIT
#define Update_F(item)
Definition MeshPack.h:92
std::string AftermathErrorMessage(GFSDK_Aftermath_Result result)
Helper for checking Nsight Aftermath failures.
bool operator<(const GFSDK_Aftermath_ShaderDebugInfoIdentifier &lhs, const GFSDK_Aftermath_ShaderDebugInfoIdentifier &rhs)
Helper for comparing GFSDK_Aftermath_ShaderDebugInfoIdentifier.
#define SPICES_PROFILE_ZONE
#define VK_FUNCTION_POINTER(function)
Macro for declare function pointer variable in VulkanFunctions.
Application(const Application &)=delete
Copy Constructor Function.
virtual ~Application()
Destructor Function.
Application & operator=(const Application &)=delete
Copy Assignment Operation.
Application()
Constructor Function.
static void Run()
Run Our World.
Application Class. Our Engine Start here.
Definition Application.h:20
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
Definition MeshPack.cpp:359
uint32_t m_Columns
How much cols number we use.
Definition MeshPack.h:486
uint32_t m_Rows
How much rows number we use.
Definition MeshPack.h:481
CubePack(uint32_t rows=2, uint32_t columns=2, bool instanced=true)
Constructor Function. Init member variables.
Definition MeshPack.h:456
virtual ~CubePack() override=default
Destructor Function.
CubePack Class. This class defines box type mesh pack.
Definition MeshPack.h:446
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
Definition MeshPack.cpp:551
virtual ~FilePack() override=default
Destructor Function.
FilePack(const std::string &filePath, bool instanced=true)
Constructor Function. Init member variables.
Definition MeshPack.h:551
std::string m_Path
The mesh file path in disk.
Definition MeshPack.h:575
FilePack Class. This class defines file type mesh pack.
Definition MeshPack.h:542
static void CrashDumpDescriptionCallback(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription, void *pUserData)
GPU crash dump description callback.
static void Init()
Create single instance of this class.
static constexpr unsigned int c_MarkerFrameHistory
keep four frames worth of marker history.
void WriteShaderDebugInformationToFile(GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier, const void *pShaderDebugInfo, const uint32_t shaderDebugInfoSize) const
Helper for writing shader debug information to a file.
void SetMarker(uint64_t &markerId, const std::string &info)
Set Marker.
MarkerMap m_MarkerMap
App-managed marker tracking.
void OnShaderLookup(const GFSDK_Aftermath_ShaderBinaryHash &shaderHash, PFN_GFSDK_Aftermath_SetData setShaderBinary) const
Handler for shader lookup callbacks. This is used by the JSON decoder for mapping shader instruction ...
void SetFrameCut(uint64_t frameCut)
Set FrameCut.
static void OnDescription(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addDescription)
Handler for GPU crash dump description callbacks.
virtual ~GpuCrashTracker()
Destructor Function.
static void ShaderSourceDebugInfoLookupCallback(const GFSDK_Aftermath_ShaderDebugName *pShaderDebugName, PFN_GFSDK_Aftermath_SetData setShaderBinary, void *pUserData)
Shader source debug info lookup callback.
static void AftermathDeviceLostCheck()
Aftermath handle device lost function.
void OnResolveMarker(const void *pMarkerData, const uint32_t markerDataSize, void **ppResolvedMarkerData, uint32_t *pResolvedMarkerDataSize)
Handler for app-managed marker resolve callback.
std::mutex m_Mutex
For thread-safe access of GPU crash tracker state.
static std::unique_ptr< GpuCrashTracker > m_GpuCrashTracker
GpuCrashTracker single instance.
static void ShaderDebugInfoCallback(const void *pShaderDebugInfo, const uint32_t shaderDebugInfoSize, void *pUserData)
Shader debug information callback.
bool m_Initialized
Is the GPU crash dump tracker initialized?
std::array< std::map< uint64_t, std::string >, c_MarkerFrameHistory > MarkerMap
static void ShaderDebugInfoLookupCallback(const GFSDK_Aftermath_ShaderDebugInfoIdentifier *pIdentifier, PFN_GFSDK_Aftermath_SetData setShaderDebugInfo, void *pUserData)
Shader debug information lookup callback.
void OnCrashDump(const void *pGpuCrashDump, const uint32_t gpuCrashDumpSize)
Handler for GPU crash dump callbacks from Nsight Aftermath.
void OnShaderDebugInfo(const void *pShaderDebugInfo, const uint32_t shaderDebugInfoSize)
Handler for shader debug information callbacks.
void Initialize()
Initialize the GPU crash dump tracker.
static void GpuCrashDumpCallback(const void *pGpuCrashDump, const uint32_t gpuCrashDumpSize, void *pUserData)
GPU crash dump callback.
static GpuCrashTracker & Get()
Get single instance of this class.
ShaderDataBase m_ShaderDataBase
The mock shader database.
ShaderDataBase & GetShaderDataBase()
Get ShaderDataBase.
void OnShaderSourceDebugInfoLookup(const GFSDK_Aftermath_ShaderDebugName &shaderDebugName, PFN_GFSDK_Aftermath_SetData setShaderBinary) const
Handler for shader source debug info lookup callbacks. This is used by the JSON decoder for mapping s...
void WriteGpuCrashDumpToFile(const void *pGpuCrashDump, const uint32_t gpuCrashDumpSize)
Helper for writing a GPU crash dump to a file.
static void ResolveMarkerCallback(const void *pMarkerData, const uint32_t markerDataSize, void *pUserData, void **ppResolvedMarkerData, uint32_t *pResolvedMarkerDataSize)
App-managed marker resolve callback.
void OnShaderDebugInfoLookup(const GFSDK_Aftermath_ShaderDebugInfoIdentifier &identifier, PFN_GFSDK_Aftermath_SetData setShaderDebugInfo) const
Handler for shader debug information lookup callbacks. This is used by the JSON decoder for mapping s...
static void ShaderLookupCallback(const GFSDK_Aftermath_ShaderBinaryHash *pShaderHash, PFN_GFSDK_Aftermath_SetData setShaderBinary, void *pUserData)
Shader lookup callback.
Implements GPU crash dump tracking using the Nsight Aftermath API.
static std::vector< VkVertexInputAttributeDescription > GetAttributeDescriptions()
Get VkVertexInputAttributeDescription for IA.
Definition Vertex.cpp:25
static std::vector< VkVertexInputBindingDescription > GetBindingDescriptions()
Get VkVertexInputBindingDescription for IA.
Definition Vertex.cpp:12
static std::vector< VkVertexInputAttributeDescription > GetSlateAttributeDescriptions()
Get Slate VkVertexInputAttributeDescription for IA.
Definition Vertex.cpp:60
static std::vector< VkVertexInputBindingDescription > GetSlateBindingDescriptions()
Get Slate VkVertexInputBindingDescription for IA.
Definition Vertex.cpp:39
static std::shared_ptr< spdlog::logger > s_ClientLogger
Game Stage Logger.
Definition Log.h:80
static bool m_IsInitialized
Definition Log.h:28
static std::shared_ptr< spdlog::logger > s_CoreLogger
Engine Stage Logger.
Definition Log.h:75
static void Init()
Init Log.
Definition Log.cpp:24
static std::shared_ptr< spdlog::logger > & GetCoreLogger()
Get Engine Stage Logger.
Definition Log.h:46
static std::shared_ptr< spdlog::logger > & GetClientLogger()
Get Game Stage Logger.
Definition Log.h:52
static void PostHandle(format_string_t< Args... > fmt, Args &&...args)
Post handle with log message.
Definition Log.h:84
static void ShutDown()
Shutdown Log.
Definition Log.cpp:82
static bool SaveDefaultMaterial()
Test function.
static bool Load(const std::string &fileName, Material *outMaterial)
Public called API, it is entrance.
static bool LoadFromSASSET(const std::string &fileName, Material *outMaterial)
Load data from a .sasset file.
static bool LoadFromMaterial(const std::string &fileName, Material *outMaterial)
Load data from a .material file.
This enum defines tree types of material file.
Wrapper of material render options.
void BuildMaterial(bool isAutoRegistry=true)
This interface need to be overwritten by specific material. It defines how we build texture and descr...
Definition Material.cpp:136
void PushToTextureParams(const std::string &name, const TextureParam &texture)
Push item to ShaderPath.
Definition Material.cpp:101
const std::vector< std::string > & GetShaderPath(const std::string &stage)
Get material shader path.
Definition Material.cpp:76
scl::linked_unordered_map< std::string, ConstantParams > m_ConstantParams
Constant parameters. Key: parameter name, Value: parameter value.
Definition Material.h:226
T GetDefaultConstantParams(const std::string &name)
Get default material constant parameter.
Definition Material.h:261
bool m_AlreadyBuild
True if this material already build a buffer.
Definition Material.h:252
const std::unordered_map< std::string, std::vector< std::string > > & GetShaderPath() const
Get material shader path.
Definition Material.h:111
void UpdateMaterial()
Update material data to buffer.
Definition Material.cpp:369
std::unordered_map< std::string, std::vector< std::string > > m_Shaders
Shader path Key: shader usage, Value: shader file name.
Definition Material.h:212
void Deserialize()
Deserialize the data from a disk file(.material) to this class.
Definition Material.cpp:63
void PushToShaderPath(const std::string &name, const std::string &shader)
Push item to ShaderPath.
Definition Material.cpp:91
std::unordered_map< std::string, std::vector< std::string > > m_DefaultShaders
Definition Material.h:213
void PushToConstParams(const std::string &name, const ConstantParam &param)
Push item to ConstParams.
Definition Material.cpp:111
uint64_t GetMaterialParamsAddress() const
Get material parameter address on GPU.
Definition Material.cpp:120
const std::string & GetName() const
Get Material Path.
Definition Material.h:98
scl::runtime_memory_block m_Buffermemoryblocks
m_Buffers's c++ data container. Key: set, Value: scl::runtime_memory_block.
Definition Material.h:232
Material()=default
Constructor Function.
scl::linked_unordered_map< std::string, TextureParam > m_DefaultTextureParams
Definition Material.h:220
bool GetIsDrawWindow() const
Get boolean of whether draw a material window.
Definition Material.h:170
void SetIsDrawWindow(bool isDrawWindow)
Set boolean of whether draw a material window.
Definition Material.h:176
scl::linked_unordered_map< std::string, TextureParam > & GetTextureParams()
Get material texture parameters.
Definition Material.h:117
void SetName(const std::string &path)
Set material path.
Definition Material.h:129
bool m_IsDrawWindow
True if this material needs to draw a window.
Definition Material.h:247
scl::linked_unordered_map< std::string, ConstantParams > & GetConstantParams()
Get material constant parameters.
Definition Material.h:123
Material(const std::string &materialPath)
Constructor Function. Deserialize immediately. Usually call it.
Definition Material.cpp:20
scl::linked_unordered_map< std::string, TextureParam > m_TextureParams
Texture parameters. Key: parameter name, Value: parameter value.
Definition Material.h:219
std::mutex m_Mutex
Mutex of this material.
Definition Material.h:257
virtual ~Material()
Destructor Function.
Definition Material.cpp:33
std::unique_ptr< VulkanBuffer > m_MaterialParameterBuffer
Definition Material.h:237
MaterialProperties m_Properties
Properties of render options.
Definition Material.h:242
std::string m_MaterialPath
Definition Material.h:206
void Serialize()
Serialize this class data to a disk file(.material).
Definition Material.cpp:53
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
MeshLoader Class. This class only defines static function for load data from mesh file.
Definition MeshLoader.h:48
AccelKHR m_Accel
This meshPack blas accel.
Definition MeshPack.h:368
UUID GetUUID() const
Get mesh pack UUID.
Definition MeshPack.h:235
std::optional< std::atomic_uint32_t > m_ShaderGroupHandle
specific shader group handle. Used in IndirectDGCPipeline.
Definition MeshPack.h:353
void SetHitShaderHandle(uint32_t handle)
Set hit shader Handle.
Definition MeshPack.h:212
std::string m_MeshPackName
MeshPack Name.
Definition MeshPack.h:321
uint32_t GetNTasks() const
Get NTasks.
Definition MeshPack.h:265
void OnDraw(const VkCommandBuffer &commandBuffer) const
Draw indexed.
Definition MeshPack.cpp:96
virtual bool OnCreatePack(bool isCreateBuffer=true)
This interface is used for build specific mesh pack data.
Definition MeshPack.cpp:119
MeshResource m_MeshResource
Mesh Resources.
Definition MeshPack.h:331
uint32_t GetShaderGroupHandle() const
Get ShaderGroup Handle, which accessed by gdc buffer.
Definition MeshPack.cpp:180
std::optional< std::atomic_uint32_t > m_HitShaderHandle
specific hit shader handle. Used in RayTracing Pipeline.
Definition MeshPack.h:347
void OnDrawMeshTasks(const VkCommandBuffer &commandBuffer) const
Draw Mesh Tasks.
Definition MeshPack.cpp:112
VkDrawMeshTasksIndirectCommandNV m_MeshTaskIndirectDrawCommand
Draw Command.
Definition MeshPack.h:383
MeshDesc & GetMeshDesc()
Get Mesh Description.
Definition MeshPack.h:271
const std::string & GetPackType() const
Get Pack Type.
Definition MeshPack.h:283
uint32_t GetHitShaderHandle() const
Get Hit Shader Handle, which accessed by ray gen shader.
Definition MeshPack.cpp:165
MeshPack(const std::string &name, bool instanced)
Constructor Function.
Definition MeshPack.cpp:78
bool HasBlasAccel()
Is this meshPack has a valid blas.
Definition MeshPack.cpp:251
std::string m_PackType
specific mesh pack type.
Definition MeshPack.h:363
void CreateBuffer()
Create Vertices buffer anf Indices buffer.
Definition MeshPack.cpp:278
VulkanRayTracing::BlasInput MeshPackToVkGeometryKHR()
Convert MeshPack into the ray tracing geometry used to build the BLAS.
Definition MeshPack.cpp:195
std::atomic_bool m_IsRequiredAccel
True if required accel by BLAS Build.
Definition MeshPack.h:373
void OnBind(const VkCommandBuffer &commandBuffer) const
Bind VBO and EBO.
Definition MeshPack.cpp:86
MeshDesc m_Desc
Mesh Description.
Definition MeshPack.h:358
std::shared_ptr< Material > GetMaterial()
Get material in this class.
Definition MeshPack.h:206
const VkDrawMeshTasksIndirectCommandNV & GetDrawCommand() const
Get Draw Command.
Definition MeshPack.h:277
void SetMaterial(std::shared_ptr< Material > material)
Set specific material for this class.
Definition MeshPack.cpp:155
MeshPack & operator=(const MeshPack &)=delete
Copy Constructor Function.
void SetShaderGroupHandle(uint32_t handle)
Set hit shader Handle.
Definition MeshPack.h:218
const MeshResource & GetResource() const
Get Resource.
Definition MeshPack.h:307
std::shared_ptr< Material > m_Material
specific material pointer.
Definition MeshPack.h:341
void SetMaterial(const std::string &materialPath)
Set specific material for this class.
Definition MeshPack.cpp:145
uint32_t m_NTasks
Task Shader Work Group Size.
Definition MeshPack.h:336
virtual ~MeshPack()=default
Destructor Function.
UUID m_UUID
UUID for mesh pack.
Definition MeshPack.h:378
const std::vector< Meshlet > & GetMeshlets() const
Get Meshlets array.
Definition MeshPack.h:259
MeshPack(const MeshPack &)=delete
Copy Constructor Function.
bool m_Instanced
If this mesh pack needs instanced.
Definition MeshPack.h:326
AccelKHR & GetAccel()
Get this accel.
Definition MeshPack.cpp:261
MeshPack Class. This class defines some basic behaves and variables. This class need to be inherited ...
Definition MeshPack.h:156
Class for provide functions of process Meshpack.
uint32_t m_Columns
How much cols number we use.
Definition MeshPack.h:437
uint32_t m_Rows
How much rows number we use.
Definition MeshPack.h:432
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
Definition MeshPack.cpp:315
PlanePack(uint32_t rows=2, uint32_t columns=2, bool instanced=true)
Constructor Function. Init member variables.
Definition MeshPack.h:407
virtual ~PlanePack() override=default
Destructor Function.
PlanePack Class. This class defines plane type mesh pack.
Definition MeshPack.h:397
SpherePack(uint32_t rows=15, uint32_t columns=24, bool instanced=true)
Constructor Function. Init member variables.
Definition MeshPack.h:504
uint32_t m_Rows
How much rows number we use.
Definition MeshPack.h:529
virtual ~SpherePack() override=default
Destructor Function.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
Definition MeshPack.cpp:563
uint32_t m_Columns
How much cols number we use.
Definition MeshPack.h:534
SpherePack Class. This class defines sphere type mesh pack.
Definition MeshPack.h:494
Texture2DCube Class. This class defines the basic behaves of Texture2DCube.
Texture2D(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
Definition Texture2D.cpp:15
Texture2D(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
Definition Texture2D.cpp:93
virtual ~Texture2D() override=default
Destructor Function.
Texture2D()=default
Constructor Function.
Texture2D Class. This class defines the basic behaves of texture2D.
Definition Texture2D.h:20
static void Load(const std::string &fileName, Texture2DCube *outTexture)
Load image to a Texture2DCube object.
static void Load(const std::string &fileName, Texture2D *outTexture)
Load image to a Texture2D object.
static bool LoadSrc(const std::string &fileName, const std::string &it, Texture2D *outTexture, bool isCreateCompressTexture=true)
Function of load a src file.
static bool SearchFile(const std::string &fileName, std::function< void(const std::string &)> binF, std::function< void(const std::string &)> srcF)
Search texture file and load.
static bool LoadBin(const std::string &fileName, const std::string &it, Texture2D *outTexture)
Function of load a ktx file.
TextureLoader Class. This class only defines static function for load data from image file.
virtual ~Texture()=default
Destructor Function.
std::string m_ResourcePath
Texture's path in disk.
Definition Texture.h:74
Texture(const std::string &path)
Constructor Function. Init class variable. Usually call it.
Definition Texture.h:47
Texture()=default
Constructor Function.
std::shared_ptr< T > GetResource()
Get Specific resource, usually is a wrapper of VulkanImage.
Definition Texture.h:78
std::any m_Resource
Texture's resource, coule be any kind of type.
Definition Texture.h:68
Texture Class. This class defines the basic behaves of texture. When we add an new Texture,...
Definition Texture.h:33
float m_FrameTime
time step(s) during frames.
Definition TimeStep.h:85
std::chrono::steady_clock::time_point m_StartTime
Engine Start time.
Definition TimeStep.h:75
void Flush()
Refresh time in each engine loop.
Definition TimeStep.cpp:26
const float & ft() const
Get time step during frames.
Definition TimeStep.h:51
TimeStep(const TimeStep &)=delete
Copy Constructor Function.
const uint64_t & fs() const
Get frames count.
Definition TimeStep.h:63
TimeStep()
Constructor Function.
Definition TimeStep.cpp:12
virtual ~TimeStep()=default
Destructor Function.
std::chrono::steady_clock::time_point m_LastTime
Last frame time.
Definition TimeStep.h:80
float m_GameTime
time step(s) since Engine Start.
Definition TimeStep.h:90
uint64_t m_Frames
Frames since Engine Start.
Definition TimeStep.h:95
TimeStep & operator=(const TimeStep &)=delete
Copy Assignment Operation.
const float & gt() const
Get time step since Engine Start.
Definition TimeStep.h:57
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
static TracyGPUContext & Get()
Get this Single Instance.
static std::shared_ptr< TracyGPUContext > m_TracyGPUContext
This Single Instance.
virtual ~TracyGPUContext()=default
Destructor Function.
tracy::VkCtx * m_Context
Tracy Vulkan Context.
TracyGPUContext(VulkanState &state)
Constructor Function.
VulkanState & m_VulkanState
VulkanState.
tracy::VkCtx *& GetContext()
Get Context.
static void CreateInstance(VulkanState &state)
Create this Single Instance.
Wapper of Tracy GPU collect features.
UUID()
Constructor Function.
Definition UUID.cpp:18
uint64_t m_UUID
UUID.
Definition UUID.h:52
UUID(uint64_t uuid)
Constructor Function.
Definition UUID.cpp:22
UUID(const UUID &)=default
Destructor Function.
std::string ToString()
Transform UUID to String.
Definition UUID.cpp:26
operator uint64_t() const
Operator Function.
Definition UUID.h:39
This class helps to generate a uuid for one resource.
Definition UUID.h:16
This Class is a Wrapper of VulkanBuffer.
static void EndLabel(VkCommandBuffer cmdBuffer)
End Record Commands with a Label.
static void BeginLabel(VkCommandBuffer cmdBuffer, const std::string &caption, glm::vec4 color=glm::vec4(1.0f))
Start Record Commands with a Label.
static void BeginQueueLabel(VkQueue queue, const std::string &caption, glm::vec4 color=glm::vec4(1.0f))
Start Record Queue with a Label.
static void SetObjectName(VkObjectType type, uint64_t handle, VkDevice &device, const std::string &caption)
Set Vulkan Object with a name, which can be captured.
static void InsertQueueLabel(VkQueue queue, const std::string &caption, glm::vec4 color=glm::vec4(1.0f))
Insert Record Queue with a Label.
static void SetObjectTag(VkObjectType type, uint64_t handle, VkDevice &device, const std::vector< char * > &captions)
Set Vulkan Object with tags, which can be captured.
static void InsertLabel(VkCommandBuffer cmdBuffer, const std::string &caption, glm::vec4 color=glm::vec4(1.0f))
Insert Record Commands with a Label.
static void EndQueueLabel(VkQueue queue)
End Record Queue with a Label.
This Class Defines static function for helping vulkan debug.
VulkanObject(const VulkanObject &)=delete
Copy Constructor Function.
virtual ~VulkanObject()=default
Destructor Function. We destroy pipeline layout here.
VulkanObject & operator=(const VulkanObject &)=delete
Copy Assignment Operation.
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
VulkanObject(VulkanState &vulkanState)
Constructor Function. Init member variables.
VulkanObject Class. This class defines the basic behaves of VulkanObject. When we create an new Vulka...
VkPipelineShaderStageCreateInfo GetShaderStageCreateInfo() const
virtual ~VulkanShaderModule() override
Destructor Function.
std::string GetShaderPath(const std::string &name, const std::string &shaderType)
Get shader path string.
VkShaderModule m_ShaderModule
The VkShaderModule this class handled.
VkShaderModule & Get()
Get VkShaderModule this class handled.
VulkanShaderModule(VulkanState &vulkanState, const std::string &shaderName, const std::string &shaderStage)
Constructor Function. Create VkShaderModule.
VulkanShaderModule(VulkanState &vulkanState, const std::string &shaderName, const ShaderStage &shaderStage, const std::vector< uint8_t > &spirv, const std::string &fullPath)
Constructor Function. Create VkShaderModule.
This Class is a Wrapper of VkShaderModule.
static void CreateMeshEntity(World *world, const std::string &name, const std::shared_ptr< Mesh > &mesh, std::function< void(Entity &)> onAdded=nullptr)
Create Entity with MeshComponent. Lightweight for game thread.
static void CreateMeshEntity(World *world, const std::string &name, std::function< std::shared_ptr< Mesh >()> onMeshCreated, std::function< void(Entity &)> onAdded=nullptr)
Create Entity with a Basic MeshComponent Async.
World Functions Class.
WorldMarkFlags GetMarker() const
Get WorldMarkFlags this frame.
Definition World.h:119
void ViewComponent(const std::vector< uint32_t > &ranges, uint32_t floor, uint32_t ceil, F &&fn)
View all component in this world in ranges.
Definition World.h:309
uint32_t WorldMarkFlags
Definition World.h:53
void Mark(WorldMarkFlags flags)
Mark WorldMarkFlags with flags.
Definition World.h:125
Entity CreateEntity(const std::string &name="None")
Create a new empty entity in this world.
Definition World.cpp:13
void OnComponentAdded(Entity *entity, T &component)
Called On any Component Added to this world.
Definition World.h:386
void ReserMark()
Reset WorldMarkFlags to Clean.
Definition World.h:130
void ViewRoot(F &&fn)
View all root in this world.
Definition World.h:329
Entity CreateEmptyEntity(UUID uuid)
Definition World.cpp:85
Entity CreateEntityWithUUID(UUID uuid, const std::string &name="None")
Create a new empty entity with a uuid in this world.
Definition World.cpp:20
void ViewComponent(F &&fn)
View all component in this world.
Definition World.h:276
void ViewComponent(const std::vector< uint32_t > &ranges, F &&fn)
View all component in this world in ranges.
Definition World.h:293
virtual void OnDeactivate()=0
This interface defines the specific world behaves after on activated.
virtual ~World()=default
Destructor Function.
Entity QueryEntitybyID(uint32_t id)
Get World Entity by id(entt::entity).
Definition World.cpp:41
virtual void OnPreActivate()=0
This interface define the specific world behaves before on activated.
entt::registry m_Registry
This variable handles all entity.
Definition World.h:250
std::shared_mutex m_Mutex
Mutex for world.
Definition World.h:245
void DestroyEntity(Entity &entity)
Destroy a entity from this world.
Definition World.cpp:31
T & GetComponent(entt::entity e)
Get Component owned by this entity.
Definition World.h:353
@ FrushStableFrame
Definition World.h:48
@ MeshAddedToWorld
Definition World.h:47
@ NeedUpdateTLAS
Definition World.h:49
void RemoveComponent(entt::entity e)
Remove Component owned from this entity.
Definition World.h:366
WorldMarkFlags m_Marker
World State this frame.
Definition World.h:272
entt::registry & GetRegistry()
Get Registry variable.
Definition World.h:106
void RemoveFromRoot(Entity &entity)
Remove a entity from this world root.
Definition World.cpp:58
virtual void OnActivate(TimeStep &ts)=0
This interface define the specific world behaves on activated.
void AddToRoot(Entity &entity)
Add a entity to this world root.
Definition World.cpp:67
World()=default
Constructor Function.
std::unordered_map< UUID, entt::entity > m_RootEntityMap
This variable is a cache. @noto Not in use now.
Definition World.h:257
bool IsRootEntity(Entity &entity)
Determine if a entity is in root.
Definition World.cpp:76
void ClearMarkerWithBits(WorldMarkFlags flags)
Clear WorldMarkFlags with flags.
Definition World.cpp:48
bool HasComponent(entt::entity e)
If Component is owned by this entity or not.
Definition World.h:376
T & AddComponent(entt::entity e, Args &&... args)
Template Function. Used for add specific component to entity.
Definition World.h:343
World Class. This class defines the basic behaves of World. When we create an new world,...
Definition World.h:41
The container combines hashmap and list together. Used in the case that we want iter a hashmap in ord...
The container is wrapper of a continue memory block. Used in Material::BuildMaterial(),...
ShaderStage
enum of shader stage.
static const char * memoryPoolNames[3]
MemoryPool's name.
Definition Core.h:43
TextureType
The enum of all Texture Type.
Definition Texture.h:20
std::shared_ptr< World > CreateWorld()
extern WorldCreation definition in Game.
Definition EntryPoint.cpp:6
static void HandleVkResult(VkResult result)
Handle VkResult Function.
Definition VulkanUtils.h:39
constexpr uint32_t MaxFrameInFlight
Max In Flight Frame. 2 buffers are enough in this program.
Definition VulkanUtils.h:22
std::string to_string(const GFSDK_Aftermath_ShaderDebugInfoIdentifier &identifier)
Convert GFSDK_Aftermath_ShaderDebugInfoIdentifier to string.
std::string to_string(GFSDK_Aftermath_Result result)
Convert GFSDK_Aftermath_Result to string.
std::string to_hex_string(T n)
Convert T to hex string.
AccelStructure Wrapper.
Definition Attribute.h:17
MeshResource's item template.
Definition Attribute.h:28
std::string paramType
Definition Material.h:38
This struct's data is defined from .material file.
Definition Material.h:37
ConstantParam value
Definition Material.h:47
ConstantParam max
Definition Material.h:54
ConstantParam defaultValue
Definition Material.h:48
ConstantParam min
Definition Material.h:51
This struct's data is defined from .material file.
Definition Material.h:46
uint32_t prev
datas.
Definition Vertex.h:223
EdgePoint(uint32_t prev, uint32_t self, uint32_t next)
Constructor Function.
Definition Vertex.h:205
uint32_t next
Definition Vertex.h:225
bool valid()
Determine whether this edge point is valid.
Definition Vertex.h:215
EdgePoint()
Constructor Function.
Definition Vertex.h:193
uint32_t self
Definition Vertex.h:224
EdgePoint Class. This class defines what EdgePoint data.
Definition Vertex.h:187
Edge()=default
Constructor Function.
bool operator==(const Edge &other) const
Destructor Function. @attemtion Why Destructor causes bug here.
Definition Vertex.h:117
Edge(uint32_t f, uint32_t s)
Constructor Function.
Definition Vertex.h:99
bool operator<(const Edge &other) const
Less Operation.
Definition Vertex.h:127
Edge Class. This class defines what Edge data.
Definition Vertex.h:86
bool operator<(const HalfEdge &other) const
Less Operation.
Definition Vertex.h:177
HalfEdge()=default
Constructor Function.
bool operator==(const HalfEdge &other) const
Destructor Function. @attemtion Why Destructor causes bug here.
Definition Vertex.h:168
HalfEdge(uint32_t f, uint32_t s)
Constructor Function.
Definition Vertex.h:150
HalfEdge Class. This class defines what HalfEdge data.
Definition Vertex.h:137
uint32_t meshletOffset
Definition MeshPack.h:31
uint32_t nMeshlets
Definition MeshPack.h:32
uint32_t nPrimitives
Definition MeshPack.h:30
uint32_t primVertexOffset
Definition MeshPack.h:29
Lod Data.
Definition MeshPack.h:28
MeshDesc()
Constructor Function.
Definition MeshPack.cpp:29
MeshDesc Copy() const
Copy a MeshDesc from this.
Definition MeshPack.cpp:61
uint64_t GetBufferAddress() const
Get m_Buffer's Address.
Definition MeshPack.cpp:71
Add Construction Functions to SpicesShader::MeshDesc.
Definition MeshPack.h:90
MeshResource()=default
Constructor Function.
TexCoords texCoords
Definition MeshPack.h:71
Positions positions
Declare value.
Definition MeshPack.h:68
PrimitiveVertices primitiveVertices
Definition MeshPack.h:74
PrimitiveLocations primitiveLocations
Definition MeshPack.h:75
PrimitivePoints primitivePoints
Definition MeshPack.h:73
virtual ~MeshResource()=default
Destructor Function.
void CreateBuffer(const std::string &name)
Create MeshResource Buffers.
Definition MeshPack.cpp:14
Mesh Resources Data.
Definition MeshPack.h:39
void FromMeshopt(const meshopt_Meshlet &m, const meshopt_Bounds &bounds)
Destructor Function. @attemtion Why Destructor causes bug here.
Definition Vertex.cpp:85
Meshlet()=default
Constructor Function.
Meshlet Class. This class defines what Meshlet data.
Definition Vertex.h:58
This struct defines the data used to create a texture2d. From render pass.
static constexpr char const * name
Define a named category tag type.
static constexpr char const * name
Define a custom domain tag type.
static constexpr char const * message
Define a registered string tag type.
std::string texturePath
Definition Material.h:29
std::string textureType
Definition Material.h:28
This struct's data is defined from .material file.
Definition Material.h:27
void Init(VkInstance instance)
Init All Vulkan Function Pointer.
Vulkan Function Pointers Collection. It holds all function pointer which need get manually.
VulkanState(const VulkanState &)=delete
Copy Constructor Function.
VkSwapchainKHR m_SwapChain
VkCommandPool m_GraphicCommandPool
std::array< VkSemaphore, MaxFrameInFlight > m_ComputeQueueSemaphore
VmaAllocator m_VmaAllocator
Definition VulkanUtils.h:97
std::array< VkImage, MaxFrameInFlight > m_SwapChainImages
std::array< VkImageView, MaxFrameInFlight > m_SwapChainImageViews
std::array< VkSemaphore, MaxFrameInFlight > m_GraphicQueueSemaphore
std::array< VkFence, MaxFrameInFlight > m_ComputeFence
std::array< VkSampler, MaxFrameInFlight > m_SwapChainImageSamplers
uint32_t m_ComputeQueueFamily
std::array< VkCommandBuffer, MaxFrameInFlight > m_GraphicCommandBuffer
VulkanFunctions m_VkFunc
Definition VulkanUtils.h:98
GLFWwindow * m_Windows
Definition VulkanUtils.h:92
VkInstance m_Instance
Definition VulkanUtils.h:93
uint32_t m_GraphicQueueFamily
VulkanState()=default
Constructor Function.
std::array< VkSemaphore, MaxFrameInFlight > m_GraphicImageSemaphore
VkSurfaceKHR m_Surface
Definition VulkanUtils.h:94
std::array< VkCommandBuffer, MaxFrameInFlight > m_ComputeCommandBuffer
VkPhysicalDevice m_PhysicalDevice
Definition VulkanUtils.h:95
VkCommandPool m_ComputeCommandPool
std::array< VkFence, MaxFrameInFlight > m_GraphicFence
VulkanState & operator=(const VulkanState &)=delete
Copy Assignment Operation.
This struct contains all Vulkan object in used global.
Definition VulkanUtils.h:74
size_t operator()(Spices::EdgePoint const &edgeP) const
Definition Vertex.h:255
size_t operator()(Spices::Edge const &edge) const
Definition Vertex.h:236
size_t operator()(Spices::HalfEdge const &edge) const
Definition Vertex.h:246
std::size_t operator()(const Spices::UUID &uuid) const noexcept
Definition UUID.h:62