mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
VideoVulkan/ShaderCompiler: Use a std::optional instead of bool+out variable
Now that we utilize C++17, we can simply return an optional containing the code instead of using an out variable and a boolean result, essentially combining them into one. This provides a much more straightforward interface.
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
@ -19,16 +20,16 @@ using SPIRVCodeType = u32;
|
||||
using SPIRVCodeVector = std::vector<SPIRVCodeType>;
|
||||
|
||||
// Compile a vertex shader to SPIR-V.
|
||||
bool CompileVertexShader(SPIRVCodeVector* out_code, std::string_view source_code);
|
||||
std::optional<SPIRVCodeVector> CompileVertexShader(std::string_view source_code);
|
||||
|
||||
// Compile a geometry shader to SPIR-V.
|
||||
bool CompileGeometryShader(SPIRVCodeVector* out_code, std::string_view source_code);
|
||||
std::optional<SPIRVCodeVector> CompileGeometryShader(std::string_view source_code);
|
||||
|
||||
// Compile a fragment shader to SPIR-V.
|
||||
bool CompileFragmentShader(SPIRVCodeVector* out_code, std::string_view source_code);
|
||||
std::optional<SPIRVCodeVector> CompileFragmentShader(std::string_view source_code);
|
||||
|
||||
// Compile a compute shader to SPIR-V.
|
||||
bool CompileComputeShader(SPIRVCodeVector* out_code, std::string_view source_code);
|
||||
std::optional<SPIRVCodeVector> CompileComputeShader(std::string_view source_code);
|
||||
|
||||
} // namespace ShaderCompiler
|
||||
} // namespace Vulkan
|
||||
|
Reference in New Issue
Block a user