diff options
| author | 2021-07-15 18:37:24 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:40 -0400 | |
| commit | 79d26842611107e784cae0dc63b6111fc0c7d5fb (patch) | |
| tree | b0f88a7e37c1d8edd35e394ba2f98be435414bf2 /src/shader_recompiler/backend/glsl/emit_context.cpp | |
| parent | renderer_opengl: Use ARB_separate_shader_objects (diff) | |
| download | yuzu-79d26842611107e784cae0dc63b6111fc0c7d5fb.tar.gz yuzu-79d26842611107e784cae0dc63b6111fc0c7d5fb.tar.xz yuzu-79d26842611107e784cae0dc63b6111fc0c7d5fb.zip | |
glsl: Update TessellationControl gl_in
Adheres to GL_ARB_separate_shader_objects requirements
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index e08d2d2eb..4e6f2c0fe 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -257,6 +257,32 @@ void SetupOutPerVertex(EmitContext& ctx, std::string& header) { | |||
| 257 | } | 257 | } |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | void SetupInPerVertex(EmitContext& ctx, std::string& header) { | ||
| 261 | // Currently only required for TessellationControl to adhere to | ||
| 262 | // ARB_separate_shader_objects requirements | ||
| 263 | if (ctx.stage != Stage::TessellationControl) { | ||
| 264 | return; | ||
| 265 | } | ||
| 266 | const bool loads_position{ctx.info.loads.AnyComponent(IR::Attribute::PositionX)}; | ||
| 267 | const bool loads_point_size{ctx.info.loads[IR::Attribute::PointSize]}; | ||
| 268 | const bool loads_clip_distance{ctx.info.loads.ClipDistances()}; | ||
| 269 | const bool loads_per_vertex{loads_position || loads_point_size || loads_clip_distance}; | ||
| 270 | if (!loads_per_vertex) { | ||
| 271 | return; | ||
| 272 | } | ||
| 273 | header += "in gl_PerVertex{"; | ||
| 274 | if (loads_position) { | ||
| 275 | header += "vec4 gl_Position;"; | ||
| 276 | } | ||
| 277 | if (loads_point_size) { | ||
| 278 | header += "float gl_PointSize;"; | ||
| 279 | } | ||
| 280 | if (loads_clip_distance) { | ||
| 281 | header += "float gl_ClipDistance[];"; | ||
| 282 | } | ||
| 283 | header += "}gl_in[gl_MaxPatchVertices];"; | ||
| 284 | } | ||
| 285 | |||
| 260 | void SetupLegacyInPerFragment(EmitContext& ctx, std::string& header) { | 286 | void SetupLegacyInPerFragment(EmitContext& ctx, std::string& header) { |
| 261 | if (!ctx.info.loads.Legacy()) { | 287 | if (!ctx.info.loads.Legacy()) { |
| 262 | return; | 288 | return; |
| @@ -334,6 +360,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 334 | break; | 360 | break; |
| 335 | } | 361 | } |
| 336 | SetupOutPerVertex(*this, header); | 362 | SetupOutPerVertex(*this, header); |
| 363 | SetupInPerVertex(*this, header); | ||
| 337 | SetupLegacyInPerFragment(*this, header); | 364 | SetupLegacyInPerFragment(*this, header); |
| 338 | 365 | ||
| 339 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { | 366 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { |
| @@ -375,6 +402,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 375 | } | 402 | } |
| 376 | 403 | ||
| 377 | void EmitContext::SetupExtensions() { | 404 | void EmitContext::SetupExtensions() { |
| 405 | header += "#extension GL_ARB_separate_shader_objects : enable\n"; | ||
| 378 | if (info.uses_shadow_lod && profile.support_gl_texture_shadow_lod) { | 406 | if (info.uses_shadow_lod && profile.support_gl_texture_shadow_lod) { |
| 379 | header += "#extension GL_EXT_texture_shadow_lod : enable\n"; | 407 | header += "#extension GL_EXT_texture_shadow_lod : enable\n"; |
| 380 | } | 408 | } |