2022-05-04 05:40:59 +00:00
|
|
|
// Copyright 2022 Dolphin Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <optional>
|
|
|
|
#include <string_view>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-05-25 04:12:47 +00:00
|
|
|
#include "ShaderLang.h"
|
|
|
|
|
2022-05-04 05:40:59 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2022-05-25 04:12:47 +00:00
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2022-05-04 05:40:59 +00:00
|
|
|
|
|
|
|
namespace SPIRV
|
|
|
|
{
|
|
|
|
// SPIR-V compiled code type
|
|
|
|
using CodeType = u32;
|
|
|
|
using CodeVector = std::vector<CodeType>;
|
|
|
|
|
|
|
|
// Compile a vertex shader to SPIR-V.
|
2022-05-25 04:12:47 +00:00
|
|
|
std::optional<CodeVector> CompileVertexShader(std::string_view source_code, APIType api_type,
|
|
|
|
glslang::EShTargetLanguageVersion language_version);
|
2022-05-04 05:40:59 +00:00
|
|
|
|
|
|
|
// Compile a geometry shader to SPIR-V.
|
2022-05-25 04:12:47 +00:00
|
|
|
std::optional<CodeVector> CompileGeometryShader(std::string_view source_code, APIType api_type,
|
|
|
|
glslang::EShTargetLanguageVersion language_version);
|
2022-05-04 05:40:59 +00:00
|
|
|
|
|
|
|
// Compile a fragment shader to SPIR-V.
|
2022-05-25 04:12:47 +00:00
|
|
|
std::optional<CodeVector> CompileFragmentShader(std::string_view source_code, APIType api_type,
|
|
|
|
glslang::EShTargetLanguageVersion language_version);
|
2022-05-04 05:40:59 +00:00
|
|
|
|
|
|
|
// Compile a compute shader to SPIR-V.
|
2022-05-25 04:12:47 +00:00
|
|
|
std::optional<CodeVector> CompileComputeShader(std::string_view source_code, APIType api_type,
|
|
|
|
glslang::EShTargetLanguageVersion language_version);
|
2022-05-04 05:40:59 +00:00
|
|
|
} // namespace SPIRV
|