summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_shader_gen.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-11-19 01:38:15 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-11-23 01:28:49 +0100
commit180417c51438e2c97b800f4b19e621dbc8288493 (patch)
treef9b6d755d10c80a0bef5cda6a2254a0a497f93a2 /src/video_core/renderer_opengl/gl_shader_gen.cpp
parentvideo_core: Unify ProgramType and ShaderStage into ShaderType (diff)
downloadyuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar.gz
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar.bz2
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar.lz
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar.xz
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.tar.zst
yuzu-180417c51438e2c97b800f4b19e621dbc8288493.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_gen.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 2f601d550..296817efc 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -2,9 +2,13 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <string>
+
#include <fmt/format.h>
+
#include "video_core/engines/maxwell_3d.h"
#include "video_core/engines/shader_type.h"
+#include "video_core/renderer_opengl/gl_device.h"
#include "video_core/renderer_opengl/gl_shader_decompiler.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/shader/shader_ir.h"
@@ -20,12 +24,13 @@ using VideoCommon::Shader::ShaderIR;
std::string GenerateVertexShader(const Device& device, const ShaderIR& ir, const ShaderIR* ir_b) {
std::string out = GetCommonDeclarations();
- out += R"(
-layout (std140, binding = EMULATION_UBO_BINDING) uniform vs_config {
+ out += fmt::format(R"(
+layout (std140, binding = {}) uniform vs_config {{
float y_direction;
-};
+}};
-)";
+)",
+ EmulationUniformBlockBinding);
out += Decompile(device, ir, ShaderType::Vertex, "vertex");
if (ir_b) {
out += Decompile(device, *ir_b, ShaderType::Vertex, "vertex_b");
@@ -44,12 +49,13 @@ void main() {
std::string GenerateGeometryShader(const Device& device, const ShaderIR& ir) {
std::string out = GetCommonDeclarations();
- out += R"(
-layout (std140, binding = EMULATION_UBO_BINDING) uniform gs_config {
+ out += fmt::format(R"(
+layout (std140, binding = {}) uniform gs_config {{
float y_direction;
-};
+}};
-)";
+)",
+ EmulationUniformBlockBinding);
out += Decompile(device, ir, ShaderType::Geometry, "geometry");
out += R"(
@@ -62,7 +68,7 @@ void main() {
std::string GenerateFragmentShader(const Device& device, const ShaderIR& ir) {
std::string out = GetCommonDeclarations();
- out += R"(
+ out += fmt::format(R"(
layout (location = 0) out vec4 FragColor0;
layout (location = 1) out vec4 FragColor1;
layout (location = 2) out vec4 FragColor2;
@@ -72,11 +78,12 @@ layout (location = 5) out vec4 FragColor5;
layout (location = 6) out vec4 FragColor6;
layout (location = 7) out vec4 FragColor7;
-layout (std140, binding = EMULATION_UBO_BINDING) uniform fs_config {
+layout (std140, binding = {}) uniform fs_config {{
float y_direction;
-};
+}};
-)";
+)",
+ EmulationUniformBlockBinding);
out += Decompile(device, ir, ShaderType::Fragment, "fragment");
out += R"(