|
@@ -756,27 +756,34 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|
|
|
|
|
|
|
string samplerName = OperandManager.GetSamplerName(context.Config.Stage, texOp, indexExpr);
|
|
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)
|
|
if (texOp.Index == 3)
|
|
|
{
|
|
{
|
|
|
return $"textureQueryLevels({samplerName})";
|
|
return $"textureQueryLevels({samplerName})";
|
|
|
}
|
|
}
|
|
|
else
|
|
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() &&
|
|
if (context.Config.Stage.SupportsRenderScale() &&
|
|
|
!isBindless &&
|
|
!isBindless &&
|
|
|
!isIndexed)
|
|
!isIndexed)
|
|
|
{
|
|
{
|
|
|
- int index = context.FindTextureDescriptorIndex(texOp);
|
|
|
|
|
-
|
|
|
|
|
- texCall = "Helper_TextureSizeUnscale(" + texCall + ", " + index + ")";
|
|
|
|
|
|
|
+ texCall = $"Helper_TextureSizeUnscale({texCall}, {descriptorIndex})";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return texCall;
|
|
return texCall;
|