2018-03-20 01:55:14 +01:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-04-15 09:32:12 +02:00
|
|
|
#include <vector>
|
2018-08-23 23:30:27 +02:00
|
|
|
|
2018-04-07 10:51:42 +02:00
|
|
|
#include "common/common_types.h"
|
2018-12-26 05:57:14 +01:00
|
|
|
#include "video_core/renderer_opengl/gl_shader_decompiler.h"
|
2018-12-21 02:29:15 +01:00
|
|
|
#include "video_core/shader/shader_ir.h"
|
2018-03-20 01:55:14 +01:00
|
|
|
|
2019-04-10 23:03:52 +02:00
|
|
|
namespace OpenGL {
|
|
|
|
class Device;
|
|
|
|
}
|
|
|
|
|
2018-08-21 10:18:27 +02:00
|
|
|
namespace OpenGL::GLShader {
|
2018-03-20 01:55:14 +01:00
|
|
|
|
2018-12-21 02:29:15 +01:00
|
|
|
using VideoCommon::Shader::ProgramCode;
|
2018-04-15 09:32:12 +02:00
|
|
|
|
2018-04-07 10:51:42 +02:00
|
|
|
struct ShaderSetup {
|
2018-08-22 23:01:14 +02:00
|
|
|
explicit ShaderSetup(ProgramCode program_code) {
|
2018-08-22 21:43:52 +02:00
|
|
|
program.code = std::move(program_code);
|
2018-07-13 04:25:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct {
|
|
|
|
ProgramCode code;
|
|
|
|
ProgramCode code_b; // Used for dual vertex shaders
|
2018-12-09 22:33:10 +01:00
|
|
|
u64 unique_identifier;
|
2018-07-13 04:25:03 +02:00
|
|
|
} program;
|
2018-04-07 10:51:42 +02:00
|
|
|
|
2018-07-13 04:25:03 +02:00
|
|
|
/// Used in scenarios where we have a dual vertex shaders
|
2019-01-31 20:44:11 +01:00
|
|
|
void SetProgramB(ProgramCode program_b) {
|
2018-08-22 21:43:52 +02:00
|
|
|
program.code_b = std::move(program_b);
|
2018-07-13 04:25:03 +02:00
|
|
|
has_program_b = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsDualProgram() const {
|
|
|
|
return has_program_b;
|
|
|
|
}
|
|
|
|
|
2018-04-07 10:51:42 +02:00
|
|
|
private:
|
2018-07-13 04:25:03 +02:00
|
|
|
bool has_program_b{};
|
2018-03-20 01:55:14 +01:00
|
|
|
};
|
|
|
|
|
2019-04-10 23:03:52 +02:00
|
|
|
/// Generates the GLSL vertex shader program source code for the given VS program
|
|
|
|
ProgramResult GenerateVertexShader(const Device& device, const ShaderSetup& setup);
|
|
|
|
|
|
|
|
/// Generates the GLSL geometry shader program source code for the given GS program
|
|
|
|
ProgramResult GenerateGeometryShader(const Device& device, const ShaderSetup& setup);
|
|
|
|
|
|
|
|
/// Generates the GLSL fragment shader program source code for the given FS program
|
|
|
|
ProgramResult GenerateFragmentShader(const Device& device, const ShaderSetup& setup);
|
2018-03-20 01:55:14 +01:00
|
|
|
|
2018-08-21 10:18:27 +02:00
|
|
|
} // namespace OpenGL::GLShader
|