diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-10-20 07:16:38 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-10-20 07:19:30 +0200 |
commit | 3ec795d95ef0b265526dc922fef7be816270c3cf (patch) | |
tree | 30e2cffde9a7d285396937888fb33f162c902401 | |
parent | Merge pull request #1501 from ReinUsesLisp/half-float (diff) | |
download | yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar.gz yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar.bz2 yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar.lz yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar.xz yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.tar.zst yuzu-3ec795d95ef0b265526dc922fef7be816270c3cf.zip |
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 13 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 7 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.h | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index e050b063a..a427353e9 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -30,8 +30,6 @@ using Tegra::Shader::SubOp; constexpr u32 PROGRAM_END = MAX_PROGRAM_CODE_LENGTH; constexpr u32 PROGRAM_HEADER_SIZE = sizeof(Tegra::Shader::Header); -enum : u32 { POSITION_VARYING_LOCATION = 0, GENERIC_VARYING_START_LOCATION = 1 }; - constexpr u32 MAX_GEOMETRY_BUFFERS = 6; constexpr u32 MAX_ATTRIBUTES = 0x100; // Size in vec4s, this value is untested @@ -591,13 +589,6 @@ private: /// Generates declarations for input attributes. void GenerateInputAttrs() { - if (stage != Maxwell3D::Regs::ShaderStage::Vertex) { - const std::string attr = - stage == Maxwell3D::Regs::ShaderStage::Geometry ? "gs_position[]" : "position"; - declarations.AddLine("layout (location = " + std::to_string(POSITION_VARYING_LOCATION) + - ") in vec4 " + attr + ';'); - } - for (const auto element : declr_input_attribute) { // TODO(bunnei): Use proper number of elements for these u32 idx = @@ -620,10 +611,6 @@ private: /// Generates declarations for output attributes. void GenerateOutputAttrs() { - if (stage != Maxwell3D::Regs::ShaderStage::Fragment) { - declarations.AddLine("layout (location = " + std::to_string(POSITION_VARYING_LOCATION) + - ") out vec4 position;"); - } for (const auto& index : declr_output_attribute) { // TODO(bunnei): Use proper number of elements for these const u32 idx = static_cast<u32>(index) - diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 1e5eb32df..ecbc9d8ed 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -23,6 +23,8 @@ out gl_PerVertex { vec4 gl_Position; }; +layout (location = 0) out vec4 position; + layout(std140) uniform vs_config { vec4 viewport_flip; uvec4 instance_id; @@ -96,6 +98,9 @@ out gl_PerVertex { vec4 gl_Position; }; +layout (location = 0) in vec4 gs_position[]; +layout (location = 0) out vec4 position; + layout (std140) uniform gs_config { vec4 viewport_flip; uvec4 instance_id; @@ -131,6 +136,8 @@ layout(location = 5) out vec4 FragColor5; layout(location = 6) out vec4 FragColor6; layout(location = 7) out vec4 FragColor7; +layout (location = 0) in vec4 position; + layout (std140) uniform fs_config { vec4 viewport_flip; uvec4 instance_id; diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h index 79596087a..520b9d4e3 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.h +++ b/src/video_core/renderer_opengl/gl_shader_gen.h @@ -16,6 +16,8 @@ namespace OpenGL::GLShader { constexpr std::size_t MAX_PROGRAM_CODE_LENGTH{0x1000}; using ProgramCode = std::vector<u64>; +enum : u32 { POSITION_VARYING_LOCATION = 0, GENERIC_VARYING_START_LOCATION = 1 }; + class ConstBufferEntry { using Maxwell = Tegra::Engines::Maxwell3D::Regs; |