mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 01:10:07 +00:00
renderer_vulkan: Separate glsl->spirv compilation to CompileGLSLtoSPIRV
Allows other library code to compile GLSL to SPRIV intermediately before creating a shader-module
This commit is contained in:
parent
21bfc043f0
commit
d24722ba96
@ -158,7 +158,14 @@ bool InitializeCompiler() {
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
vk::ShaderModule Compile(std::string_view code, vk::ShaderStageFlagBits stage, vk::Device device) {
|
||||
/**
|
||||
* @brief Compiles GLSL into SPIRV
|
||||
* @param code The string containing GLSL code.
|
||||
* @param stage The pipeline stage the shader will be used in.
|
||||
* @param device The vulkan device handle.
|
||||
*/
|
||||
std::vector<u32> CompileGLSLtoSPIRV(std::string_view code, vk::ShaderStageFlagBits stage,
|
||||
vk::Device device) {
|
||||
if (!InitializeCompiler()) {
|
||||
return {};
|
||||
}
|
||||
@ -212,7 +219,11 @@ vk::ShaderModule Compile(std::string_view code, vk::ShaderStageFlagBits stage, v
|
||||
LOG_INFO(Render_Vulkan, "SPIR-V conversion messages: {}", spv_messages);
|
||||
}
|
||||
|
||||
return CompileSPV(out_code, device);
|
||||
return out_code;
|
||||
}
|
||||
|
||||
vk::ShaderModule Compile(std::string_view code, vk::ShaderStageFlagBits stage, vk::Device device) {
|
||||
return CompileSPV(CompileGLSLtoSPIRV(code, stage, device), device);
|
||||
}
|
||||
|
||||
vk::ShaderModule CompileSPV(std::span<const u32> code, vk::Device device) {
|
||||
|
@ -10,6 +10,15 @@
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
/**
|
||||
* @brief Compiles GLSL into SPIRV
|
||||
* @param code The string containing GLSL code.
|
||||
* @param stage The pipeline stage the shader will be used in.
|
||||
* @param device The vulkan device handle.
|
||||
*/
|
||||
std::vector<u32> CompileGLSLtoSPIRV(std::string_view code, vk::ShaderStageFlagBits stage,
|
||||
vk::Device device);
|
||||
|
||||
/**
|
||||
* @brief Creates a vulkan shader module from GLSL by converting it to SPIR-V using glslang.
|
||||
* @param code The string containing GLSL code.
|
||||
|
Loading…
Reference in New Issue
Block a user