From e15247fbc41d0f96fced6db3c914edc0d8bb98e2 Mon Sep 17 00:00:00 2001 From: gdk Date: Tue, 29 Mar 2022 19:00:44 -0300 Subject: [PATCH] Replace out param with tuple return value --- Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs | 8 +++----- .../CodeGen/Glsl/Instructions/InstGenMemory.cs | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs index 10e4e76c5..825347497 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs @@ -70,7 +70,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl AppendLine("}" + suffix); } - public TextureDescriptor FindTextureDescriptor(AstTextureOperation texOp, out int descriptorIndex) + public (TextureDescriptor, int) FindTextureDescriptor(AstTextureOperation texOp) { TextureDescriptor[] descriptors = Config.GetTextureDescriptors(); @@ -82,13 +82,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl descriptor.HandleIndex == texOp.Handle && descriptor.Format == texOp.Format) { - descriptorIndex = i; - return descriptor; + return (descriptor, i); } } - descriptorIndex = -1; - return default; + return (default, -1); } private static int FindDescriptorIndex(TextureDescriptor[] array, AstTextureOperation texOp) diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index b5df54d0e..6805f2faa 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -762,8 +762,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions } else { - SamplerType declarationType = context.FindTextureDescriptor(texOp, out int descriptorIndex).Type; - bool hasLod = !declarationType.HasFlag(SamplerType.Multisample) && declarationType != SamplerType.TextureBuffer; + (TextureDescriptor descriptor, int descriptorIndex) = context.FindTextureDescriptor(texOp); + bool hasLod = !descriptor.Type.HasFlag(SamplerType.Multisample) && descriptor.Type != SamplerType.TextureBuffer; string texCall; if (hasLod)