forked from Mirror/Ryujinx
Add capability for BGRA formats (#3011)
This commit is contained in:
parent
60f7cba30a
commit
0e59573f2b
5 changed files with 17 additions and 1 deletions
|
@ -6,6 +6,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public bool HasVectorIndexingBug { get; }
|
public bool HasVectorIndexingBug { get; }
|
||||||
|
|
||||||
public bool SupportsAstcCompression { get; }
|
public bool SupportsAstcCompression { get; }
|
||||||
|
public bool SupportsBgraFormat { get; }
|
||||||
public bool SupportsR4G4Format { get; }
|
public bool SupportsR4G4Format { get; }
|
||||||
public bool SupportsFragmentShaderInterlock { get; }
|
public bool SupportsFragmentShaderInterlock { get; }
|
||||||
public bool SupportsFragmentShaderOrderingIntel { get; }
|
public bool SupportsFragmentShaderOrderingIntel { get; }
|
||||||
|
@ -25,6 +26,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
bool hasFrontFacingBug,
|
bool hasFrontFacingBug,
|
||||||
bool hasVectorIndexingBug,
|
bool hasVectorIndexingBug,
|
||||||
bool supportsAstcCompression,
|
bool supportsAstcCompression,
|
||||||
|
bool supportsBgraFormat,
|
||||||
bool supportsR4G4Format,
|
bool supportsR4G4Format,
|
||||||
bool supportsFragmentShaderInterlock,
|
bool supportsFragmentShaderInterlock,
|
||||||
bool supportsFragmentShaderOrderingIntel,
|
bool supportsFragmentShaderOrderingIntel,
|
||||||
|
@ -42,6 +44,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
HasFrontFacingBug = hasFrontFacingBug;
|
HasFrontFacingBug = hasFrontFacingBug;
|
||||||
HasVectorIndexingBug = hasVectorIndexingBug;
|
HasVectorIndexingBug = hasVectorIndexingBug;
|
||||||
SupportsAstcCompression = supportsAstcCompression;
|
SupportsAstcCompression = supportsAstcCompression;
|
||||||
|
SupportsBgraFormat = supportsBgraFormat;
|
||||||
SupportsR4G4Format = supportsR4G4Format;
|
SupportsR4G4Format = supportsR4G4Format;
|
||||||
SupportsFragmentShaderInterlock = supportsFragmentShaderInterlock;
|
SupportsFragmentShaderInterlock = supportsFragmentShaderInterlock;
|
||||||
SupportsFragmentShaderOrderingIntel = supportsFragmentShaderOrderingIntel;
|
SupportsFragmentShaderOrderingIntel = supportsFragmentShaderOrderingIntel;
|
||||||
|
|
|
@ -36,6 +36,12 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <returns>Host storage buffer alignment in bytes</returns>
|
/// <returns>Host storage buffer alignment in bytes</returns>
|
||||||
public int QueryHostStorageBufferOffsetAlignment() => _context.Capabilities.StorageBufferOffsetAlignment;
|
public int QueryHostStorageBufferOffsetAlignment() => _context.Capabilities.StorageBufferOffsetAlignment;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host support for texture formats with BGRA component order (such as BGRA8).
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if BGRA formats are supported, false otherwise</returns>
|
||||||
|
public bool QueryHostSupportsBgraFormat() => _context.Capabilities.SupportsBgraFormat;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queries host support for fragment shader ordering critical sections on the shader code.
|
/// Queries host support for fragment shader ordering critical sections on the shader code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -104,6 +104,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
hasFrontFacingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.IntelWindows,
|
hasFrontFacingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.IntelWindows,
|
||||||
hasVectorIndexingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.AmdWindows,
|
hasVectorIndexingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.AmdWindows,
|
||||||
supportsAstcCompression: HwCapabilities.SupportsAstcCompression,
|
supportsAstcCompression: HwCapabilities.SupportsAstcCompression,
|
||||||
|
supportsBgraFormat: false,
|
||||||
supportsR4G4Format: false,
|
supportsR4G4Format: false,
|
||||||
supportsFragmentShaderInterlock: HwCapabilities.SupportsFragmentShaderInterlock,
|
supportsFragmentShaderInterlock: HwCapabilities.SupportsFragmentShaderInterlock,
|
||||||
supportsFragmentShaderOrderingIntel: HwCapabilities.SupportsFragmentShaderOrdering,
|
supportsFragmentShaderOrderingIntel: HwCapabilities.SupportsFragmentShaderOrdering,
|
||||||
|
|
|
@ -61,6 +61,11 @@ namespace Ryujinx.Graphics.Shader
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueryHostSupportsBgraFormat()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool QueryHostSupportsFragmentShaderInterlock()
|
bool QueryHostSupportsFragmentShaderInterlock()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -167,6 +167,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
this.Copy(dest, src);
|
this.Copy(dest, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool supportsBgra = Config.GpuAccessor.QueryHostSupportsBgraFormat();
|
||||||
int regIndexBase = 0;
|
int regIndexBase = 0;
|
||||||
|
|
||||||
for (int rtIndex = 0; rtIndex < 8; rtIndex++)
|
for (int rtIndex = 0; rtIndex < 8; rtIndex++)
|
||||||
|
@ -185,7 +186,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
Operand src = Register(regIndexBase + component, RegisterType.Gpr);
|
Operand src = Register(regIndexBase + component, RegisterType.Gpr);
|
||||||
|
|
||||||
// Perform B <-> R swap if needed, for BGRA formats (not supported on OpenGL).
|
// Perform B <-> R swap if needed, for BGRA formats (not supported on OpenGL).
|
||||||
if (component == 0 || component == 2)
|
if (!supportsBgra && (component == 0 || component == 2))
|
||||||
{
|
{
|
||||||
Operand isBgra = Attribute(AttributeConsts.FragmentOutputIsBgraBase + rtIndex * 4);
|
Operand isBgra = Attribute(AttributeConsts.FragmentOutputIsBgraBase + rtIndex * 4);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue