Spirv.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2022 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <cstddef>
  5. #include <optional>
  6. #include <string_view>
  7. #include <vector>
  8. #include "ShaderLang.h"
  9. #include "Common/CommonTypes.h"
  10. #include "VideoCommon/VideoCommon.h"
  11. namespace SPIRV
  12. {
  13. // SPIR-V compiled code type
  14. using CodeType = u32;
  15. using CodeVector = std::vector<CodeType>;
  16. // Compile a vertex shader to SPIR-V.
  17. std::optional<CodeVector> CompileVertexShader(std::string_view source_code, APIType api_type,
  18. glslang::EShTargetLanguageVersion language_version);
  19. // Compile a geometry shader to SPIR-V.
  20. std::optional<CodeVector> CompileGeometryShader(std::string_view source_code, APIType api_type,
  21. glslang::EShTargetLanguageVersion language_version);
  22. // Compile a fragment shader to SPIR-V.
  23. std::optional<CodeVector> CompileFragmentShader(std::string_view source_code, APIType api_type,
  24. glslang::EShTargetLanguageVersion language_version);
  25. // Compile a compute shader to SPIR-V.
  26. std::optional<CodeVector> CompileComputeShader(std::string_view source_code, APIType api_type,
  27. glslang::EShTargetLanguageVersion language_version);
  28. } // namespace SPIRV