MCPcopy Create free account
hub / github.com/defold/defold / VulkanNewProgram

Function VulkanNewProgram

engine/graphics/src/vulkan/graphics_vulkan.cpp:3662–3691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3660 }
3661
3662 static HProgram VulkanNewProgram(HContext _context, ShaderDesc* ddf, char* error_buffer, uint32_t error_buffer_size)
3663 {
3664 ShaderDesc::Shader* ddf_vp = 0x0;
3665 ShaderDesc::Shader* ddf_fp = 0x0;
3666 ShaderDesc::Shader* ddf_cp = 0x0;
3667
3668 if (!GetShaderProgram(_context, ddf, &ddf_vp, &ddf_fp, &ddf_cp))
3669 {
3670 return 0;
3671 }
3672
3673 VulkanContext* context = (VulkanContext*) _context;
3674 VulkanProgram* program = new VulkanProgram;
3675
3676 CreateShaderMeta(&ddf->m_Reflection, &program->m_BaseProgram.m_ShaderMeta);
3677
3678 if (ddf_cp)
3679 {
3680 ShaderModule* module_cp = NewShaderModule(context, &program->m_BaseProgram.m_ShaderMeta, ddf_cp, VK_SHADER_STAGE_COMPUTE_BIT, error_buffer, error_buffer_size);
3681 CreateComputeProgram(context, program, module_cp);
3682 }
3683 else
3684 {
3685 ShaderModule* vertex_module = NewShaderModule(context, &program->m_BaseProgram.m_ShaderMeta, ddf_vp, VK_SHADER_STAGE_VERTEX_BIT, error_buffer, error_buffer_size);
3686 ShaderModule* fragment_module = NewShaderModule(context, &program->m_BaseProgram.m_ShaderMeta, ddf_fp, VK_SHADER_STAGE_FRAGMENT_BIT, error_buffer, error_buffer_size);
3687 CreateGraphicsProgram((VulkanContext*) context, program, vertex_module, fragment_module);
3688 }
3689
3690 return (HProgram) program;
3691 }
3692
3693 static bool VulkanReloadProgram(HContext _context, HProgram _program, ShaderDesc* ddf)
3694 {

Callers

nothing calls this directly

Calls 5

GetShaderProgramFunction · 0.85
CreateShaderMetaFunction · 0.85
NewShaderModuleFunction · 0.85
CreateComputeProgramFunction · 0.85
CreateGraphicsProgramFunction · 0.85

Tested by

no test coverage detected