Fix Non-Float Textures + Image Read + FSI Buffers
Fixes Mario Party Superstars
This commit is contained in:
parent
d5e19a70bd
commit
c77f3b90a9
3 changed files with 13 additions and 7 deletions
|
@ -222,7 +222,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
BufferDefinition buffer = buffers[i];
|
BufferDefinition buffer = buffers[i];
|
||||||
|
|
||||||
var needsPadding = buffer.Layout == BufferLayout.Std140;
|
var needsPadding = buffer.Layout == BufferLayout.Std140;
|
||||||
string fsiSuffix = constant && fsi ? " [[raster_order_group(0)]]" : "";
|
string fsiSuffix = !constant && fsi ? " [[raster_order_group(0)]]" : "";
|
||||||
|
|
||||||
bufferDec[i] = $"{addressSpace} {Defaults.StructPrefix}_{buffer.Name}* {buffer.Name}{fsiSuffix};";
|
bufferDec[i] = $"{addressSpace} {Defaults.StructPrefix}_{buffer.Name}* {buffer.Name}{fsiSuffix};";
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
{
|
{
|
||||||
if (texture.Type != SamplerType.None)
|
if (texture.Type != SamplerType.None)
|
||||||
{
|
{
|
||||||
var textureTypeName = texture.Type.ToMslTextureType();
|
var textureTypeName = texture.Type.ToMslTextureType(texture.Format.GetComponentType());
|
||||||
|
|
||||||
if (texture.ArrayLength > 1)
|
if (texture.ArrayLength > 1)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
{
|
{
|
||||||
TextureDefinition image = images[i];
|
TextureDefinition image = images[i];
|
||||||
|
|
||||||
var imageTypeName = image.Type.ToMslTextureType(true);
|
var imageTypeName = image.Type.ToMslTextureType(image.Format.GetComponentType(), true);
|
||||||
if (image.ArrayLength > 1)
|
if (image.ArrayLength > 1)
|
||||||
{
|
{
|
||||||
imageTypeName = $"array<{imageTypeName}, {image.ArrayLength}>";
|
imageTypeName = $"array<{imageTypeName}, {image.ArrayLength}>";
|
||||||
|
|
|
@ -251,10 +251,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
_ => string.Empty,
|
_ => string.Empty,
|
||||||
};
|
};
|
||||||
|
|
||||||
texCallBuilder.Append($"{prefix}4({string.Join(", ", cElems)})");
|
texCallBuilder.Append($"{prefix}4({string.Join(", ", cElems)}), ");
|
||||||
}
|
}
|
||||||
|
|
||||||
texCallBuilder.Append(", ");
|
|
||||||
texCallBuilder.Append(coordsBuilder);
|
texCallBuilder.Append(coordsBuilder);
|
||||||
|
|
||||||
if (texOp.Inst == Instruction.ImageAtomic)
|
if (texOp.Inst == Instruction.ImageAtomic)
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace Ryujinx.Graphics.Shader
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToMslTextureType(this SamplerType type, bool image = false)
|
public static string ToMslTextureType(this SamplerType type, AggregateType aggregateType, bool image = false)
|
||||||
{
|
{
|
||||||
string typeName;
|
string typeName;
|
||||||
|
|
||||||
|
@ -192,7 +192,14 @@ namespace Ryujinx.Graphics.Shader
|
||||||
typeName += "_array";
|
typeName += "_array";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $"{typeName}<float{(image ? ", access::read_write" : "")}>";
|
var format = aggregateType switch
|
||||||
|
{
|
||||||
|
AggregateType.S32 => "int",
|
||||||
|
AggregateType.U32 => "uint",
|
||||||
|
_ => "float"
|
||||||
|
};
|
||||||
|
|
||||||
|
return $"{typeName}<{format}{(image ? ", access::read_write" : "")}>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue