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

Function VulkanReloadProgram

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

Source from the content-addressed store, hash-verified

3691 }
3692
3693 static bool VulkanReloadProgram(HContext _context, HProgram _program, ShaderDesc* ddf)
3694 {
3695 ShaderDesc::Shader* ddf_vp = 0x0;
3696 ShaderDesc::Shader* ddf_fp = 0x0;
3697 ShaderDesc::Shader* ddf_cp = 0x0;
3698
3699 if (!GetShaderProgram(_context, ddf, &ddf_vp, &ddf_fp, &ddf_cp))
3700 {
3701 return 0;
3702 }
3703
3704 VulkanContext* context = (VulkanContext*) _context;
3705 VulkanProgram* program = (VulkanProgram*) _program;
3706
3707 if (ddf_cp)
3708 {
3709 if (!ReloadShader(context, program->m_ComputeModule, ddf_cp, VK_SHADER_STAGE_COMPUTE_BIT))
3710 return false;
3711
3712 DestroyProgram(_context, program);
3713 CreateShaderMeta(&ddf->m_Reflection, &program->m_BaseProgram.m_ShaderMeta);
3714 CreateComputeProgram(context, program, program->m_ComputeModule);
3715 }
3716 else
3717 {
3718 if (!ReloadShader(context, program->m_VertexModule, ddf_vp, VK_SHADER_STAGE_VERTEX_BIT))
3719 return false;
3720 if (!ReloadShader(context, program->m_FragmentModule, ddf_fp, VK_SHADER_STAGE_FRAGMENT_BIT))
3721 return false;
3722
3723 DestroyProgram(_context, program);
3724 CreateShaderMeta(&ddf->m_Reflection, &program->m_BaseProgram.m_ShaderMeta);
3725 CreateGraphicsProgram(context, program, program->m_VertexModule, program->m_FragmentModule);
3726 }
3727
3728 return true;
3729 }
3730
3731 static bool VulkanIsShaderLanguageSupported(HContext _context, ShaderDesc::Language language, ShaderDesc::ShaderType shader_type)
3732 {

Callers

nothing calls this directly

Calls 6

GetShaderProgramFunction · 0.85
CreateShaderMetaFunction · 0.85
CreateComputeProgramFunction · 0.85
CreateGraphicsProgramFunction · 0.85
ReloadShaderFunction · 0.70
DestroyProgramFunction · 0.70

Tested by

no test coverage detected