2
3
4
5
11#include <unordered_map>
12#include <shared_mutex>
18
19
20
21
22 template<
typename K,
typename V>
28
29
33
34
38
39
43
44
50
51
57
58
62
63
64
65
69
70
74
75
76
80
81
82
83
87
88
89
90
94
95
96
97
101
102
103
107
108
109
114
115
116
121
122
123
124
125
129
130
131
132
133
137
138
139
143
144
145
149
150
151
155 template<
typename K,
typename V>
158 std::shared_lock<std::shared_mutex> lock(m_Mutex);
160 return m_Keys.size() == m_Map.size();
163 template<
typename K,
typename V>
166 std::unique_lock<std::shared_mutex> lock(m_Mutex);
173 template<
typename K,
typename V>
176 return m_Size.load();
179 template<
typename K,
typename V>
184 std::unique_lock<std::shared_mutex> lock(m_Mutex);
188 m_Keys.push_back(key);
196 template<
typename K,
typename V>
201 std::shared_lock<std::shared_mutex> lock(m_Mutex);
211 template<
typename K,
typename V>
214 std::shared_lock<std::shared_mutex> lock(m_Mutex);
216 if (m_Map.find(key) != m_Map.end())
226 template<
typename K,
typename V>
229 std::unique_lock<std::shared_mutex> lock(m_Mutex);
231 auto it = m_Map.find(key);
232 if (it != m_Map.end())
241 template<
typename K,
typename V>
245 std::shared_lock<std::shared_mutex> lock(m_Mutex);
247 for (
const K& key : m_Keys)
250
251
252
253
254
255 if(fn(key, m_Map[key]))
break;
259 template <
typename K,
typename V>
260 template <
typename F>
263 std::shared_lock<std::shared_mutex> lock(m_Mutex);
265 for (
const K& key : m_Keys)
268
269
270
271
272
273 if(fn(key, m_Map[key]))
break;
277 template<
typename K,
typename V>
281
282
285 std::shared_lock<std::shared_mutex> lock(m_Mutex);
288
289
290 if (key == m_Keys.front())
return nullptr;
293
294
295 for (
auto it = m_Keys.begin(); it != m_Keys.end(); ++it)
299 return &(*std::prev(it));
306 template<
typename K,
typename V>
310
311
314 std::shared_lock<std::shared_mutex> lock(m_Mutex);
317
318
319 if (key == m_Keys.back())
return nullptr;
322
323
324 for (
auto it = m_Keys.begin(); it != m_Keys.end(); ++it)
328 return &(*std::next(it));
335 template<
typename K,
typename V>
338 std::shared_lock<std::shared_mutex> lock(m_Mutex);
340 if (size() == 0)
return nullptr;
342 return &m_Map[m_Keys.front()];
345 template<
typename K,
typename V>
348 std::shared_lock<std::shared_mutex> lock(m_Mutex);
350 if (size() == 0)
return nullptr;
352 return &m_Map[m_Keys.back()];
355 template<
typename K,
typename V>
358 std::shared_lock<std::shared_mutex> lock(m_Mutex);
360 if (size() == 0)
return nullptr;
362 return &m_Keys.back();
#define ASSERT(expr)
Assert macro.
#define PROCESS_INSTANCE_ENTRY
Macros of modify Process instance state.
#define PROCESS_INSTANCE_EXIT
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.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
uint32_t m_Columns
How much cols number we use.
uint32_t m_Rows
How much rows number we use.
CubePack(uint32_t rows=2, uint32_t columns=2, bool instanced=true)
Constructor Function. Init member variables.
virtual ~CubePack() override=default
Destructor Function.
CubePack Class. This class defines box type mesh pack.
Entity Class. This class defines the specific behaves of Entity.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
virtual ~FilePack() override=default
Destructor Function.
FilePack(const std::string &filePath, bool instanced=true)
Constructor Function. Init member variables.
std::string m_Path
The mesh file path in disk.
FilePack Class. This class defines file type mesh pack.
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.
GpuCrashTracker()
Constructor Function.
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.
uint32_t m_FrameCut
Frame Count cut.
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::shared_ptr< spdlog::logger > s_ClientLogger
Game Stage Logger.
static bool m_IsInitialized
static std::shared_ptr< spdlog::logger > s_CoreLogger
Engine Stage Logger.
static void Init()
Init Log.
static std::shared_ptr< spdlog::logger > & GetCoreLogger()
Get Engine Stage Logger.
static std::shared_ptr< spdlog::logger > & GetClientLogger()
Get Game Stage Logger.
static void PostHandle(format_string_t< Args... > fmt, Args &&...args)
Post handle with log message.
static void ShutDown()
Shutdown Log.
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...
void PushToTextureParams(const std::string &name, const TextureParam &texture)
Push item to ShaderPath.
const std::vector< std::string > & GetShaderPath(const std::string &stage)
Get material shader path.
scl::linked_unordered_map< std::string, ConstantParams > m_ConstantParams
Constant parameters. Key: parameter name, Value: parameter value.
T GetDefaultConstantParams(const std::string &name)
Get default material constant parameter.
bool m_AlreadyBuild
True if this material already build a buffer.
const std::unordered_map< std::string, std::vector< std::string > > & GetShaderPath() const
Get material shader path.
void UpdateMaterial()
Update material data to buffer.
std::unordered_map< std::string, std::vector< std::string > > m_Shaders
Shader path Key: shader usage, Value: shader file name.
void Deserialize()
Deserialize the data from a disk file(.material) to this class.
void PushToShaderPath(const std::string &name, const std::string &shader)
Push item to ShaderPath.
std::unordered_map< std::string, std::vector< std::string > > m_DefaultShaders
void PushToConstParams(const std::string &name, const ConstantParam ¶m)
Push item to ConstParams.
uint64_t GetMaterialParamsAddress() const
Get material parameter address on GPU.
const std::string & GetName() const
Get Material Path.
scl::runtime_memory_block m_Buffermemoryblocks
m_Buffers's c++ data container. Key: set, Value: scl::runtime_memory_block.
Material()=default
Constructor Function.
scl::linked_unordered_map< std::string, TextureParam > m_DefaultTextureParams
bool GetIsDrawWindow() const
Get boolean of whether draw a material window.
void SetIsDrawWindow(bool isDrawWindow)
Set boolean of whether draw a material window.
scl::linked_unordered_map< std::string, TextureParam > & GetTextureParams()
Get material texture parameters.
void SetName(const std::string &path)
Set material path.
bool m_IsDrawWindow
True if this material needs to draw a window.
scl::linked_unordered_map< std::string, ConstantParams > & GetConstantParams()
Get material constant parameters.
Material(const std::string &materialPath)
Constructor Function. Deserialize immediately. Usually call it.
scl::linked_unordered_map< std::string, TextureParam > m_TextureParams
Texture parameters. Key: parameter name, Value: parameter value.
std::mutex m_Mutex
Mutex of this material.
virtual ~Material()
Destructor Function.
std::unique_ptr< VulkanBuffer > m_MaterialParameterBuffer
MaterialProperties m_Properties
Properties of render options.
std::string m_MaterialPath
void Serialize()
Serialize this class data to a disk file(.material).
Material Class. This class contains a branch of parameter and shader, also descriptor.
MeshLoader Class. This class only defines static function for load data from mesh file.
AccelKHR m_Accel
This meshPack blas accel.
UUID GetUUID() const
Get mesh pack UUID.
std::optional< std::atomic_uint32_t > m_ShaderGroupHandle
specific shader group handle. Used in IndirectDGCPipeline.
void SetHitShaderHandle(uint32_t handle)
Set hit shader Handle.
std::string m_MeshPackName
MeshPack Name.
uint32_t GetNTasks() const
Get NTasks.
void OnDraw(const VkCommandBuffer &commandBuffer) const
Draw indexed.
virtual bool OnCreatePack(bool isCreateBuffer=true)
This interface is used for build specific mesh pack data.
MeshResource m_MeshResource
Mesh Resources.
uint32_t GetShaderGroupHandle() const
Get ShaderGroup Handle, which accessed by gdc buffer.
std::optional< std::atomic_uint32_t > m_HitShaderHandle
specific hit shader handle. Used in RayTracing Pipeline.
void OnDrawMeshTasks(const VkCommandBuffer &commandBuffer) const
Draw Mesh Tasks.
VkDrawMeshTasksIndirectCommandNV m_MeshTaskIndirectDrawCommand
Draw Command.
MeshDesc & GetMeshDesc()
Get Mesh Description.
const std::string & GetPackType() const
Get Pack Type.
uint32_t GetHitShaderHandle() const
Get Hit Shader Handle, which accessed by ray gen shader.
MeshPack(const std::string &name, bool instanced)
Constructor Function.
bool HasBlasAccel()
Is this meshPack has a valid blas.
std::string m_PackType
specific mesh pack type.
void CreateBuffer()
Create Vertices buffer anf Indices buffer.
VulkanRayTracing::BlasInput MeshPackToVkGeometryKHR()
Convert MeshPack into the ray tracing geometry used to build the BLAS.
std::atomic_bool m_IsRequiredAccel
True if required accel by BLAS Build.
void OnBind(const VkCommandBuffer &commandBuffer) const
Bind VBO and EBO.
MeshDesc m_Desc
Mesh Description.
std::shared_ptr< Material > GetMaterial()
Get material in this class.
const VkDrawMeshTasksIndirectCommandNV & GetDrawCommand() const
Get Draw Command.
void SetMaterial(std::shared_ptr< Material > material)
Set specific material for this class.
MeshPack & operator=(const MeshPack &)=delete
Copy Constructor Function.
void SetShaderGroupHandle(uint32_t handle)
Set hit shader Handle.
const MeshResource & GetResource() const
Get Resource.
std::shared_ptr< Material > m_Material
specific material pointer.
void SetMaterial(const std::string &materialPath)
Set specific material for this class.
uint32_t m_NTasks
Task Shader Work Group Size.
virtual ~MeshPack()=default
Destructor Function.
UUID m_UUID
UUID for mesh pack.
const std::vector< Meshlet > & GetMeshlets() const
Get Meshlets array.
MeshPack(const MeshPack &)=delete
Copy Constructor Function.
bool m_Instanced
If this mesh pack needs instanced.
AccelKHR & GetAccel()
Get this accel.
MeshPack Class. This class defines some basic behaves and variables. This class need to be inherited ...
Class for provide functions of process Meshpack.
uint32_t m_Columns
How much cols number we use.
uint32_t m_Rows
How much rows number we use.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
PlanePack(uint32_t rows=2, uint32_t columns=2, bool instanced=true)
Constructor Function. Init member variables.
virtual ~PlanePack() override=default
Destructor Function.
PlanePack Class. This class defines plane type mesh pack.
static VkShaderStageFlagBits ToFlagBits(ShaderStage stage)
Convert ShaderStage to VkShaderStageFlagBits.
static std::string ToString(ShaderStage stage)
Convert ShaderStage to String.
static shaderc_shader_kind ToShaderCKind(ShaderStage stage)
Convert ShaderStage to shaderc_shader_kind.
static ShaderStage ToStage(std::string stage)
Convert String to ShaderStage.
SpherePack(uint32_t rows=15, uint32_t columns=24, bool instanced=true)
Constructor Function. Init member variables.
uint32_t m_Rows
How much rows number we use.
virtual ~SpherePack() override=default
Destructor Function.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific mesh pack data.
uint32_t m_Columns
How much cols number we use.
SpherePack Class. This class defines sphere type mesh pack.
Texture2DCube Class. This class defines the basic behaves of Texture2DCube.
Texture2D(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
Texture2D(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
virtual ~Texture2D() override=default
Destructor Function.
Texture2D()=default
Constructor Function.
Texture2D Class. This class defines the basic behaves of texture2D.
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.
Texture(const std::string &path)
Constructor Function. Init class variable. Usually call it.
Texture()=default
Constructor Function.
std::shared_ptr< T > GetResource()
Get Specific resource, usually is a wrapper of VulkanImage.
std::any m_Resource
Texture's resource, coule be any kind of type.
Texture Class. This class defines the basic behaves of texture. When we add an new Texture,...
float m_FrameTime
time step(s) during frames.
std::chrono::steady_clock::time_point m_StartTime
Engine Start time.
void Flush()
Refresh time in each engine loop.
const float & ft() const
Get time step during frames.
TimeStep(const TimeStep &)=delete
Copy Constructor Function.
const uint64_t & fs() const
Get frames count.
TimeStep()
Constructor Function.
virtual ~TimeStep()=default
Destructor Function.
std::chrono::steady_clock::time_point m_LastTime
Last frame time.
float m_GameTime
time step(s) since Engine Start.
uint64_t m_Frames
Frames since Engine Start.
TimeStep & operator=(const TimeStep &)=delete
Copy Assignment Operation.
const float & gt() const
Get time step since Engine Start.
This Class handles our engine time step during frames. Global Unique.
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.
UUID(uint64_t uuid)
Constructor Function.
UUID(const UUID &)=default
Destructor Function.
std::string ToString()
Transform UUID to String.
operator uint64_t() const
Operator Function.
This class helps to generate a uuid for one resource.
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.
ShaderStage m_ShaderStage
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.
WorldMarkFlags GetMarker() const
Get WorldMarkFlags this frame.
void ViewComponent(const std::vector< uint32_t > &ranges, uint32_t floor, uint32_t ceil, F &&fn)
View all component in this world in ranges.
void Mark(WorldMarkFlags flags)
Mark WorldMarkFlags with flags.
Entity CreateEntity(const std::string &name="None")
Create a new empty entity in this world.
void OnComponentAdded(Entity *entity, T &component)
Called On any Component Added to this world.
void ReserMark()
Reset WorldMarkFlags to Clean.
void ViewRoot(F &&fn)
View all root in this world.
Entity CreateEmptyEntity(UUID uuid)
Entity CreateEntityWithUUID(UUID uuid, const std::string &name="None")
Create a new empty entity with a uuid in this world.
void ViewComponent(F &&fn)
View all component in this world.
void ViewComponent(const std::vector< uint32_t > &ranges, F &&fn)
View all component in this world in ranges.
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).
virtual void OnPreActivate()=0
This interface define the specific world behaves before on activated.
entt::registry m_Registry
This variable handles all entity.
std::shared_mutex m_Mutex
Mutex for world.
void DestroyEntity(Entity &entity)
Destroy a entity from this world.
T & GetComponent(entt::entity e)
Get Component owned by this entity.
void RemoveComponent(entt::entity e)
Remove Component owned from this entity.
WorldMarkFlags m_Marker
World State this frame.
entt::registry & GetRegistry()
Get Registry variable.
void RemoveFromRoot(Entity &entity)
Remove a entity from this world root.
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.
World()=default
Constructor Function.
std::unordered_map< UUID, entt::entity > m_RootEntityMap
This variable is a cache. @noto Not in use now.
bool IsRootEntity(Entity &entity)
Determine if a entity is in root.
void ClearMarkerWithBits(WorldMarkFlags flags)
Clear WorldMarkFlags with flags.
bool HasComponent(entt::entity e)
If Component is owned by this entity or not.
T & AddComponent(entt::entity e, Args &&... args)
Template Function. Used for add specific component to entity.
World Class. This class defines the basic behaves of World. When we create an new world,...
void erase(const K &key)
Remove a element inside the container if founded by key.
V * find_value(const K &key)
Find the value by key.
void clear()
Clear this container's data.
V * prev_value(const K &key)
Get the previous element by the key.
std::shared_mutex m_Mutex
Mutex for this container.
void for_each(F &&fn)
Iter the container in order.
linked_unordered_map()
Constructor Function.
std::unordered_map< K, V > m_Map
void push_back(const K &key, const V &value)
Add a element to this container.
V * end()
Get the end element of this container.
bool has_key(const K &key)
Determine whether the key is in the container.
size_t size()
The container's element size.
void for_each(F &fn)
Iter the container in order.
std::list< K > m_Keys
The container keeps iter in order.
virtual ~linked_unordered_map()=default
Destructor Function.
std::atomic_int m_Size
This container size.
bool has_equal_size()
Determine whether the container's element size is same.
V * next_value(const K &key)
Get the next element by the key.
V * first()
Get the first element of this container.
The container combines hashmap and list together. Used in the case that we want iter a hashmap in ord...
size_t bytes_
The bytes of the continue memory block handled.
bool has_value(const std::string &name)
Determine is item inside this container.
void for_each(const std::function< bool(const std::string &name, void *pt)> &fn) const
Iter the object_ and call explain_element() to filling data.
std::unordered_map< std::string, size_t > object_
The data information of the continue memory block handled. Data: parameter name - parameter position ...
void build()
Malloc a memory to begin_.
void add_element(const std::string &name, const std::string &type)
Add a element to object_, means a memory block will be occupied with given param type.
size_t item_location(const std::string &name)
Get item location in blocks.
size_t get_bytes() const
Get the bytes_.
virtual ~runtime_memory_block()
Destructor Function.
size_t size() const
Get the size of object_.
void * begin_
The begin pointer of the continue memory block handled.
void explain_element(const std::string &name, const T &value)
Fill in a memory with given data.
runtime_memory_block()=default
Constructor Function.
void * get_addr() const
Get the begin_.
T & get_value(const std::string &name)
Get value that explained by name.
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.
glm::mat4 OtrhographicMatrix(float left, float right, float top, float bottom, float nearPlane, float farPlane)
Calculate Otrhographic Matrix.
glm::mat4 PerspectiveMatrixInverseZ(float fov, float nearPlane, float aspectRatio)
Calculate Perspective Matrix(reverse z version).
glm::mat4 PerspectiveMatrix(float fov, float nearPlane, float farPlane, float aspectRatio)
Calculate Perspective Matrix.
bool DecomposeTransform(const glm::mat4 &transform, glm::vec3 &outTranslation, glm::vec3 &outRotation, glm::vec3 &outScale)
Decompose matrix to split SRT transform.
TextureType
The enum of all Texture Type.
std::shared_ptr< World > CreateWorld()
extern WorldCreation definition in Game.
static void HandleVkResult(VkResult result)
Handle VkResult Function.
constexpr uint32_t MaxFrameInFlight
Max In Flight Frame. 2 buffers are enough in this program.
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.
MeshResource's item template.
This struct's data is defined from .material file.
ConstantParam defaultValue
This struct's data is defined from .material file.
EdgePoint(uint32_t prev, uint32_t self, uint32_t next)
Constructor Function.
bool valid()
Determine whether this edge point is valid.
EdgePoint()
Constructor Function.
EdgePoint Class. This class defines what EdgePoint data.
Edge()=default
Constructor Function.
bool operator==(const Edge &other) const
Destructor Function. @attemtion Why Destructor causes bug here.
Edge(uint32_t f, uint32_t s)
Constructor Function.
bool operator<(const Edge &other) const
Less Operation.
Edge Class. This class defines what Edge data.
bool operator<(const HalfEdge &other) const
Less Operation.
HalfEdge()=default
Constructor Function.
bool operator==(const HalfEdge &other) const
Destructor Function. @attemtion Why Destructor causes bug here.
HalfEdge(uint32_t f, uint32_t s)
Constructor Function.
HalfEdge Class. This class defines what HalfEdge data.
uint32_t primVertexOffset
MeshDesc()
Constructor Function.
MeshDesc Copy() const
Copy a MeshDesc from this.
uint64_t GetBufferAddress() const
Get m_Buffer's Address.
Add Construction Functions to SpicesShader::MeshDesc.
MeshResource()=default
Constructor Function.
Positions positions
Declare value.
PrimitiveVertices primitiveVertices
PrimitiveLocations primitiveLocations
PrimitivePoints primitivePoints
virtual ~MeshResource()=default
Destructor Function.
void CreateBuffer(const std::string &name)
Create MeshResource Buffers.
void FromMeshopt(const meshopt_Meshlet &m, const meshopt_Bounds &bounds)
Destructor Function. @attemtion Why Destructor causes bug here.
Meshlet()=default
Constructor Function.
Meshlet Class. This class defines what Meshlet data.
This struct defines the data used to create a texture2d. From render pass.
static constexpr char const * name
static constexpr uint32_t id
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.
String2()=default
Constructor Function.
std::string x
x component.
std::string y
y component.
virtual ~String2()=default
Destructor Function.
String2(const std::string &str0, const std::string &str1)
Constructor Function.
bool operator==(const String2 &other) const
equal operation.
This struct's data is defined from .material file.
UInt2()=default
Constructor Function.
bool operator==(const UInt2 &other) const
equal operation.
virtual ~UInt2()=default
Destructor Function.
UInt2(const uint32_t &x, const uint32_t &y)
Constructor Function.
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
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
uint32_t m_GraphicQueueFamily
VulkanState()=default
Constructor Function.
std::array< VkSemaphore, MaxFrameInFlight > m_GraphicImageSemaphore
std::array< VkCommandBuffer, MaxFrameInFlight > m_ComputeCommandBuffer
VkPhysicalDevice m_PhysicalDevice
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.
size_t operator()(Spices::EdgePoint const &edgeP) const
size_t operator()(Spices::Edge const &edge) const
size_t operator()(Spices::HalfEdge const &edge) const
size_t operator()(Spices::String2 const &info) const noexcept
size_t operator()(Spices::UInt2 const &info) const noexcept
std::size_t operator()(const Spices::UUID &uuid) const noexcept