diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/glsl_emit_context.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/glsl_emit_context.cpp | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp index 1de017e76..bb7f1a0fd 100644 --- a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp @@ -211,27 +211,6 @@ std::string_view OutputPrimitive(OutputTopology topology) { throw InvalidArgument("Invalid output topology {}", topology); } -void SetupLegacyOutPerVertex(EmitContext& ctx, std::string& header) { - if (!ctx.info.stores.Legacy()) { - return; - } - if (ctx.info.stores.FixedFunctionTexture()) { - header += "vec4 gl_TexCoord[8];"; - } - if (ctx.info.stores.AnyComponent(IR::Attribute::ColorFrontDiffuseR)) { - header += "vec4 gl_FrontColor;"; - } - if (ctx.info.stores.AnyComponent(IR::Attribute::ColorFrontSpecularR)) { - header += "vec4 gl_FrontSecondaryColor;"; - } - if (ctx.info.stores.AnyComponent(IR::Attribute::ColorBackDiffuseR)) { - header += "vec4 gl_BackColor;"; - } - if (ctx.info.stores.AnyComponent(IR::Attribute::ColorBackSpecularR)) { - header += "vec4 gl_BackSecondaryColor;"; - } -} - void SetupOutPerVertex(EmitContext& ctx, std::string& header) { if (!StoresPerVertexAttributes(ctx.stage)) { return; @@ -250,7 +229,6 @@ void SetupOutPerVertex(EmitContext& ctx, std::string& header) { ctx.profile.support_viewport_index_layer_non_geometry && ctx.stage != Stage::Geometry) { header += "int gl_ViewportIndex;"; } - SetupLegacyOutPerVertex(ctx, header); header += "};"; if (ctx.info.stores[IR::Attribute::ViewportIndex] && ctx.stage == Stage::Geometry) { header += "out int gl_ViewportIndex;"; @@ -282,21 +260,6 @@ void SetupInPerVertex(EmitContext& ctx, std::string& header) { } header += "}gl_in[gl_MaxPatchVertices];"; } - -void SetupLegacyInPerFragment(EmitContext& ctx, std::string& header) { - if (!ctx.info.loads.Legacy()) { - return; - } - header += "in gl_PerFragment{"; - if (ctx.info.loads.FixedFunctionTexture()) { - header += "vec4 gl_TexCoord[8];"; - } - if (ctx.info.loads.AnyComponent(IR::Attribute::ColorFrontDiffuseR)) { - header += "vec4 gl_Color;"; - } - header += "};"; -} - } // Anonymous namespace EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_, @@ -361,7 +324,6 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile } SetupOutPerVertex(*this, header); SetupInPerVertex(*this, header); - SetupLegacyInPerFragment(*this, header); for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { if (!info.loads.Generic(index) || !runtime_info.previous_stage_stores.Generic(index)) { @@ -466,9 +428,10 @@ void EmitContext::DefineConstantBuffers(Bindings& bindings) { return; } for (const auto& desc : info.constant_buffer_descriptors) { - header += fmt::format( - "layout(std140,binding={}) uniform {}_cbuf_{}{{vec4 {}_cbuf{}[{}];}};", - bindings.uniform_buffer, stage_name, desc.index, stage_name, desc.index, 4 * 1024); + const auto cbuf_type{profile.has_gl_cbuf_ftou_bug ? "uvec4" : "vec4"}; + header += fmt::format("layout(std140,binding={}) uniform {}_cbuf_{}{{{} {}_cbuf{}[{}];}};", + bindings.uniform_buffer, stage_name, desc.index, cbuf_type, + stage_name, desc.index, 4 * 1024); bindings.uniform_buffer += desc.count; } } |