Partial TextureQuerySamples

This commit is contained in:
Isaac Marovitz 2023-10-09 11:16:33 -04:00
parent e8e7e1b009
commit 7cd5d6aca9
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
2 changed files with 20 additions and 1 deletions

View File

@ -138,7 +138,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
case Instruction.TextureSample:
return TextureSample(context, operation);
case Instruction.TextureQuerySamples:
return "|| TEXTURE QUERY SIZE ||";
return TextureQuerySamples(context, operation);
case Instruction.TextureQuerySize:
return TextureQuerySize(context, operation);
case Instruction.VectorExtract:

View File

@ -269,6 +269,25 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
return swizzle;
}
public static string TextureQuerySamples(CodeGenContext context, AstOperation operation)
{
AstTextureOperation texOp = (AstTextureOperation)operation;
bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0;
// TODO: Bindless texture support. For now we just return 0.
if (isBindless)
{
return NumberFormatter.FormatInt(0);
}
string textureName = "texture";
string texCall = textureName + ".";
texCall += $"get_num_samples()";
return texCall;
}
public static string TextureQuerySize(CodeGenContext context, AstOperation operation)
{
AstTextureOperation texOp = (AstTextureOperation)operation;