// SPDX-FileCopyrightText: 2023 Connor McLaughlin // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) #pragma once #include "common/types.h" #include #include #include #include #include enum class GPUShaderStage : u8; namespace SPIRVCompiler { enum CompileOptions { DebugInfo = (1 << 0), VulkanRules = (1 << 1), }; // SPIR-V compiled code type using SPIRVCodeType = u32; using SPIRVCodeVector = std::vector; // Compile a vertex shader to SPIR-V. std::optional CompileVertexShader(std::string_view source_code, u32 options); // Compile a fragment shader to SPIR-V. std::optional CompileFragmentShader(std::string_view source_code, u32 options); // Compile a geometry shader to SPIR-V. std::optional CompileGeometryShader(std::string_view source_code, u32 options); // Compile a compute shader to SPIR-V. std::optional CompileComputeShader(std::string_view source_code, u32 options); std::optional CompileShader(GPUShaderStage stage, std::string_view source_code, u32 options); #ifdef __APPLE__ // Converts a SPIR-V shader into MSL. std::optional CompileSPIRVToMSL(GPUShaderStage stage, std::span spv); #endif } // namespace SPIRVCompiler