diff options
| author | 2018-12-24 21:28:44 -0300 | |
|---|---|---|
| committer | 2019-01-15 17:54:53 -0300 | |
| commit | dbed6c64853aa80c0462dcda8582d49a99f6ee29 (patch) | |
| tree | bc6b61489d565117bdab4704933e959e522c93b8 /src | |
| parent | shader_decode: Fixup WriteLogicOperation zero comparison (diff) | |
| download | yuzu-dbed6c64853aa80c0462dcda8582d49a99f6ee29.tar.gz yuzu-dbed6c64853aa80c0462dcda8582d49a99f6ee29.tar.xz yuzu-dbed6c64853aa80c0462dcda8582d49a99f6ee29.zip | |
glsl_decompiler: Fixup geometry shaders
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/shader/glsl_decompiler.cpp | 26 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 743a9c90e..9fb2f9ace 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp | |||
| @@ -84,11 +84,7 @@ ProgramResult GenerateGeometryShader(const ShaderSetup& setup) { | |||
| 84 | out += "#extension GL_ARB_separate_shader_objects : enable\n"; | 84 | out += "#extension GL_ARB_separate_shader_objects : enable\n"; |
| 85 | out += GetCommonDeclarations(); | 85 | out += GetCommonDeclarations(); |
| 86 | 86 | ||
| 87 | out += R"(out gl_PerVertex { | 87 | out += R"(layout (location = 0) in vec4 gs_position[]; |
| 88 | vec4 gl_Position; | ||
| 89 | }; | ||
| 90 | |||
| 91 | layout (location = 0) in vec4 gs_position[]; | ||
| 92 | layout (location = 0) out vec4 position; | 88 | layout (location = 0) out vec4 position; |
| 93 | 89 | ||
| 94 | layout (std140) uniform gs_config { | 90 | layout (std140) uniform gs_config { |
diff --git a/src/video_core/shader/glsl_decompiler.cpp b/src/video_core/shader/glsl_decompiler.cpp index 2ee8cefab..381be0e56 100644 --- a/src/video_core/shader/glsl_decompiler.cpp +++ b/src/video_core/shader/glsl_decompiler.cpp | |||
| @@ -207,6 +207,22 @@ private: | |||
| 207 | if (stage != ShaderStage::Vertex) | 207 | if (stage != ShaderStage::Vertex) |
| 208 | return; | 208 | return; |
| 209 | 209 | ||
| 210 | DeclareVertexRedeclarations(); | ||
| 211 | } | ||
| 212 | |||
| 213 | void DeclareGeometry() { | ||
| 214 | if (stage != ShaderStage::Geometry) | ||
| 215 | return; | ||
| 216 | |||
| 217 | const auto topology = GetTopologyName(header.common3.output_topology); | ||
| 218 | const auto max_vertices = std::to_string(header.common4.max_output_vertices); | ||
| 219 | code.AddLine("layout (" + topology + ", max_vertices = " + max_vertices + ") out;"); | ||
| 220 | code.AddNewLine(); | ||
| 221 | |||
| 222 | DeclareVertexRedeclarations(); | ||
| 223 | } | ||
| 224 | |||
| 225 | void DeclareVertexRedeclarations() { | ||
| 210 | bool clip_distances_declared = false; | 226 | bool clip_distances_declared = false; |
| 211 | 227 | ||
| 212 | code.AddLine("out gl_PerVertex {"); | 228 | code.AddLine("out gl_PerVertex {"); |
| @@ -229,16 +245,6 @@ private: | |||
| 229 | code.AddNewLine(); | 245 | code.AddNewLine(); |
| 230 | } | 246 | } |
| 231 | 247 | ||
| 232 | void DeclareGeometry() { | ||
| 233 | if (stage != ShaderStage::Geometry) | ||
| 234 | return; | ||
| 235 | |||
| 236 | const auto topology = GetTopologyName(header.common3.output_topology); | ||
| 237 | const auto max_vertices = std::to_string(header.common4.max_output_vertices); | ||
| 238 | code.AddLine("layout (" + topology + ", max_vertices = " + max_vertices + ") out;"); | ||
| 239 | code.AddNewLine(); | ||
| 240 | } | ||
| 241 | |||
| 242 | void DeclareRegisters() { | 248 | void DeclareRegisters() { |
| 243 | const auto& registers = ir.GetRegisters(); | 249 | const auto& registers = ir.GetRegisters(); |
| 244 | for (const u32 gpr : registers) { | 250 | for (const u32 gpr : registers) { |