Chronos 0.0
A advanced 2D rendering and animation system
Loading...
Searching...
No Matches
object.cpp File Reference
#include "object.hpp"
#include <fstream>
Include dependency graph for object.cpp:

Go to the source code of this file.

Functions

static VkShaderModule createShaderModule (unsigned char *code, int code_size, VkDevice device)
 Creates a shader module from given shader(SPIV) code.
 

Function Documentation

◆ createShaderModule()

static VkShaderModule createShaderModule ( unsigned char *  code,
int  code_size,
VkDevice  device 
)
inlinestatic

Creates a shader module from given shader(SPIV) code.

In order to get std::vector<char>& code from a shader file, use readFile function.

Parameters
codeThe SPIV code to create the shader module from.
deviceThe device to create the shader module on.
Returns
The created shader module.

Definition at line 38 of file object.cpp.

40{
41 VkShaderModuleCreateInfo createInfo {};
42 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
43 createInfo.codeSize = code_size;
44 createInfo.pCode = reinterpret_cast<const uint32_t*>(code);
45 VkShaderModule shaderModule;
46 if (vkCreateShaderModule(device, &createInfo, nullptr, &shaderModule)
47 != VK_SUCCESS) {
48 throw std::runtime_error("Failed to create shader module");
49 }
50 return shaderModule;
51}
Here is the caller graph for this function: