mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
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 SupportsAstcCompression { get; }
|
||||
public bool SupportsBgraFormat { get; }
|
||||
public bool SupportsR4G4Format { get; }
|
||||
public bool SupportsFragmentShaderInterlock { get; }
|
||||
public bool SupportsFragmentShaderOrderingIntel { get; }
|
||||
|
@ -25,6 +26,7 @@ namespace Ryujinx.Graphics.GAL
|
|||
bool hasFrontFacingBug,
|
||||
bool hasVectorIndexingBug,
|
||||
bool supportsAstcCompression,
|
||||
bool supportsBgraFormat,
|
||||
bool supportsR4G4Format,
|
||||
bool supportsFragmentShaderInterlock,
|
||||
bool supportsFragmentShaderOrderingIntel,
|
||||
|
@ -42,6 +44,7 @@ namespace Ryujinx.Graphics.GAL
|
|||
HasFrontFacingBug = hasFrontFacingBug;
|
||||
HasVectorIndexingBug = hasVectorIndexingBug;
|
||||
SupportsAstcCompression = supportsAstcCompression;
|
||||
SupportsBgraFormat = supportsBgraFormat;
|
||||
SupportsR4G4Format = supportsR4G4Format;
|
||||
SupportsFragmentShaderInterlock = supportsFragmentShaderInterlock;
|
||||
SupportsFragmentShaderOrderingIntel = supportsFragmentShaderOrderingIntel;
|
||||
|
|
|
@ -36,6 +36,12 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
/// <returns>Host storage buffer alignment in bytes</returns>
|
||||
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>
|
||||
/// Queries host support for fragment shader ordering critical sections on the shader code.
|
||||
/// </summary>
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
hasFrontFacingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.IntelWindows,
|
||||
hasVectorIndexingBug: HwCapabilities.Vendor == HwCapabilities.GpuVendor.AmdWindows,
|
||||
supportsAstcCompression: HwCapabilities.SupportsAstcCompression,
|
||||
supportsBgraFormat: false,
|
||||
supportsR4G4Format: false,
|
||||
supportsFragmentShaderInterlock: HwCapabilities.SupportsFragmentShaderInterlock,
|
||||
supportsFragmentShaderOrderingIntel: HwCapabilities.SupportsFragmentShaderOrdering,
|
||||
|
|
|
@ -61,6 +61,11 @@ namespace Ryujinx.Graphics.Shader
|
|||
return 16;
|
||||
}
|
||||
|
||||
bool QueryHostSupportsBgraFormat()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QueryHostSupportsFragmentShaderInterlock()
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -167,6 +167,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
this.Copy(dest, src);
|
||||
}
|
||||
|
||||
bool supportsBgra = Config.GpuAccessor.QueryHostSupportsBgraFormat();
|
||||
int regIndexBase = 0;
|
||||
|
||||
for (int rtIndex = 0; rtIndex < 8; rtIndex++)
|
||||
|
@ -185,7 +186,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
Operand src = Register(regIndexBase + component, RegisterType.Gpr);
|
||||
|
||||
// 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue