Constructor Function. Create VkShaderModule.
Confirm file existence.
Instance a VkShaderModuleCreateInfo.
Add to Aftermath.
Confirm file existence.
Instance a VkShaderModuleCreateInfo.
Add to Aftermath.
21 {
23
27 const std::string filePath =
GetShaderPath(shaderName, shaderStage);
28
32 FileHandle fileHandle = {};
34
35 if (!fileHandle.is_valid)
36 {
37 SPICES_CORE_ERROR("File is not exist.");
38 }
39
44
45 uint64_t fileSize = 0;
47
51 std::vector<char> shaderChar;
52 shaderChar.resize(fileSize);
54
58 VkShaderModuleCreateInfo createInfo{};
59 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
60 createInfo.codeSize = fileSize;
61 createInfo.pCode = reinterpret_cast<const uint32_t*>(shaderChar.data());
62
68
70
74 NSIGHTAFTERMATH_GPUCRASHTRACKER_ADDSHADERBINARY(filePath.c_str())
75 NSIGHTAFTERMATH_GPUCRASHTRACKER_ADDSHADERBINARY_WITHDEBUGINFO(filePath.c_str(), filePath.c_str())
76 }
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
static bool FileLibrary_Size(const FileHandle *handle, uint64_t *out_size)
Calculate The file size.
static bool FileLibrary_Open(const char *path, FileModes mode, bool binary, FileHandle *out_handle)
Open the file using given string.
static void FileLibrary_Close(FileHandle *handle)
Close the file by the file handle.
static bool FileLibrary_Exists(const char *path)
Determine whether the given string is existing a file.
static bool FileLibrary_Read_all_bytes(const FileHandle *handle, char *out_bytes, uint64_t *out_bytes_read)
Read all data form the current file handle pointer.
static ShaderStage ToStage(std::string stage)
Convert String to ShaderStage.
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
VulkanObject(VulkanState &vulkanState)
Constructor Function. Init member variables.
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.
@ FILE_MODE_READ
model : read