diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-04-04 14:43:58 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 14:43:58 -0300 |
commit | 04bd87ed5a06d35f1e19d7af89e5d9d58a29f6ac (patch) | |
tree | b24f63c0d35de40f62ddf03d205c7e4f99071f0f /Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs | |
parent | 5158cdb308790e58d7e441ed127286ac1ef5ef69 (diff) |
Fix shader textureSize with multisample and buffer textures (#3240)1.1.86
* Fix shader textureSize with multisample and buffer textures
* Replace out param with tuple return value
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index 164de7bb..6805f2fa 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -756,27 +756,34 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions string samplerName = OperandManager.GetSamplerName(context.Config.Stage, texOp, indexExpr); - int lodSrcIndex = isBindless || isIndexed ? 1 : 0; - - IAstNode lod = operation.GetSource(lodSrcIndex); - - string lodExpr = GetSoureExpr(context, lod, GetSrcVarType(operation.Inst, lodSrcIndex)); - if (texOp.Index == 3) { return $"textureQueryLevels({samplerName})"; } else { - string texCall = $"textureSize({samplerName}, {lodExpr}){GetMask(texOp.Index)}"; + (TextureDescriptor descriptor, int descriptorIndex) = context.FindTextureDescriptor(texOp); + bool hasLod = !descriptor.Type.HasFlag(SamplerType.Multisample) && descriptor.Type != SamplerType.TextureBuffer; + string texCall; + + if (hasLod) + { + int lodSrcIndex = isBindless || isIndexed ? 1 : 0; + IAstNode lod = operation.GetSource(lodSrcIndex); + string lodExpr = GetSoureExpr(context, lod, GetSrcVarType(operation.Inst, lodSrcIndex)); + + texCall = $"textureSize({samplerName}, {lodExpr}){GetMask(texOp.Index)}"; + } + else + { + texCall = $"textureSize({samplerName}){GetMask(texOp.Index)}"; + } if (context.Config.Stage.SupportsRenderScale() && !isBindless && !isIndexed) { - int index = context.FindTextureDescriptorIndex(texOp); - - texCall = "Helper_TextureSizeUnscale(" + texCall + ", " + index + ")"; + texCall = $"Helper_TextureSizeUnscale({texCall}, {descriptorIndex})"; } return texCall; |