mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-29 16:39:15 +00:00
language feature: Extension Members: Ryujinx.Graphics.GAL.Format
This commit is contained in:
@@ -176,7 +176,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
||||
ulong vbSize = GetVertexBufferSize(address, endAddress.Pack(), vbStride, _indexed, instanced, _firstVertex, _count);
|
||||
|
||||
ulong attributeOffset = (ulong)vertexAttrib.UnpackOffset();
|
||||
int componentSize = format.GetScalarSize();
|
||||
int componentSize = format.ScalarSize;
|
||||
|
||||
address += attributeOffset;
|
||||
|
||||
|
||||
@@ -849,8 +849,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
FormatInfo dsFormat = _state.State.RtDepthStencilState.Format.Convert();
|
||||
|
||||
bool hasDepth = dsFormat.Format.HasDepth();
|
||||
bool hasStencil = dsFormat.Format.HasStencil();
|
||||
bool hasDepth = dsFormat.Format.HasDepth;
|
||||
bool hasStencil = dsFormat.Format.HasStencil;
|
||||
|
||||
if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff)))
|
||||
{
|
||||
|
||||
@@ -297,7 +297,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
Format format = colorState.Format.Convert().Format;
|
||||
|
||||
AttributeType type = format.IsInteger() ? (format.IsSint() ? AttributeType.Sint : AttributeType.Uint) : AttributeType.Float;
|
||||
AttributeType type = format.IsInt
|
||||
? (format.IsSignedInt ? AttributeType.Sint : AttributeType.Uint)
|
||||
: AttributeType.Float;
|
||||
|
||||
if (type != fragmentOutputTypesSpan[index])
|
||||
{
|
||||
|
||||
@@ -534,7 +534,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
if (!_context.Capabilities.SupportsBgraFormat)
|
||||
{
|
||||
_context.SupportBufferUpdater.SetRenderTargetIsBgra(index, color.Format.IsBgr());
|
||||
_context.SupportBufferUpdater.SetRenderTargetIsBgra(index, color.Format.IsBgr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
// as copies between depth and color formats are not allowed.
|
||||
// For depth blit, the destination texture format should always match exactly.
|
||||
|
||||
if (srcTexture.Format.IsDepthOrStencil())
|
||||
if (srcTexture.Format.IsDepthOrStencil)
|
||||
{
|
||||
dstCopyTextureFormat = srcTexture.Info.FormatInfo;
|
||||
}
|
||||
|
||||
@@ -662,7 +662,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
bool found = _textureFormats.TryGetValue((TextureFormat)encoded, out format);
|
||||
|
||||
if (found && isPacked && !format.Format.IsDepthOrStencil())
|
||||
if (found && isPacked && !format.Format.IsDepthOrStencil)
|
||||
{
|
||||
// If the packed flag is set, then the components of the pixel are tightly packed into the
|
||||
// GPU registers on the shader.
|
||||
|
||||
@@ -643,7 +643,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// The decompression is slow, so we want to avoid it as much as possible.
|
||||
// This does a byte-by-byte check and skips the update if the data is equal in this case.
|
||||
// This improves the speed on applications that overwrites ASTC data without changing anything.
|
||||
if (Info.FormatInfo.Format.IsAstc() && !_context.Capabilities.SupportsAstcCompression)
|
||||
if (Info.FormatInfo.Format.IsAstc && !_context.Capabilities.SupportsAstcCompression)
|
||||
{
|
||||
if (_updateCount < ByteComparisonSwitchThreshold)
|
||||
{
|
||||
@@ -792,7 +792,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// Handle compressed cases not supported by the host:
|
||||
// - ASTC is usually not supported on desktop cards.
|
||||
// - BC4/BC5 is not supported on 3D textures.
|
||||
if (!_context.Capabilities.SupportsAstcCompression && Format.IsAstc())
|
||||
if (!_context.Capabilities.SupportsAstcCompression && Format.IsAstc)
|
||||
{
|
||||
using (result)
|
||||
{
|
||||
@@ -823,7 +823,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return decoded;
|
||||
}
|
||||
}
|
||||
else if (!_context.Capabilities.SupportsEtc2Compression && Format.IsEtc2())
|
||||
else if (!_context.Capabilities.SupportsEtc2Compression && Format.IsEtc2)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
@@ -924,7 +924,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_context.Capabilities.Supports5BitComponentFormat && Format.Is16BitPacked())
|
||||
else if (!_context.Capabilities.Supports5BitComponentFormat && Format.Is16BitPacked)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
int widthAlignment = (info.IsLinear ? Constants.StrideAlignment : Constants.GobAlignment) / info.FormatInfo.BytesPerPixel;
|
||||
|
||||
if (!(info.FormatInfo.Format.IsDepthOrStencil() || info.FormatInfo.Components == 1))
|
||||
if (!(info.FormatInfo.Format.IsDepthOrStencil || info.FormatInfo.Components == 1))
|
||||
{
|
||||
// Discount square textures that aren't depth-stencil like. (excludes game textures, cubemap faces, most 3D texture LUT, texture atlas)
|
||||
// Detect if the texture is possibly square. Widths may be aligned, so to remove the uncertainty we align both the width and height.
|
||||
|
||||
@@ -75,13 +75,14 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
if (!caps.SupportsAstcCompression)
|
||||
{
|
||||
if (info.FormatInfo.Format.IsAstcUnorm())
|
||||
if (info.FormatInfo.Format.IsAstcUnorm)
|
||||
{
|
||||
return GraphicsConfig.EnableTextureRecompression
|
||||
? new FormatInfo(Format.Bc7Unorm, 4, 4, 16, 4)
|
||||
: new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
}
|
||||
else if (info.FormatInfo.Format.IsAstcSrgb())
|
||||
|
||||
if (info.FormatInfo.Format.IsAstcSrgb)
|
||||
{
|
||||
return GraphicsConfig.EnableTextureRecompression
|
||||
? new FormatInfo(Format.Bc7Srgb, 4, 4, 16, 4)
|
||||
@@ -151,9 +152,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
}
|
||||
}
|
||||
else if (!caps.Supports5BitComponentFormat && info.FormatInfo.Format.Is16BitPacked())
|
||||
else if (!caps.Supports5BitComponentFormat && info.FormatInfo.Format.Is16BitPacked)
|
||||
{
|
||||
return new FormatInfo(info.FormatInfo.Format.IsBgr() ? Format.B8G8R8A8Unorm : Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
return new FormatInfo(info.FormatInfo.Format.IsBgr ? Format.B8G8R8A8Unorm : Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
}
|
||||
|
||||
return info.FormatInfo;
|
||||
@@ -644,7 +645,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
FormatInfo lhsFormat = lhs.FormatInfo;
|
||||
FormatInfo rhsFormat = rhs.FormatInfo;
|
||||
|
||||
if (lhsFormat.Format.IsDepthOrStencil() || rhsFormat.Format.IsDepthOrStencil())
|
||||
if (lhsFormat.Format.IsDepthOrStencil || rhsFormat.Format.IsDepthOrStencil)
|
||||
{
|
||||
bool forSampler = flags.HasFlag(TextureSearchFlags.ForSampler);
|
||||
bool depthAlias = flags.HasFlag(TextureSearchFlags.DepthAlias);
|
||||
|
||||
@@ -660,7 +660,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
swizzleB,
|
||||
swizzleA);
|
||||
|
||||
if (formatInfo.Format.IsDepthOrStencil())
|
||||
if (formatInfo.Format.IsDepthOrStencil)
|
||||
{
|
||||
swizzleR = SwizzleComponent.Red;
|
||||
swizzleG = SwizzleComponent.Red;
|
||||
|
||||
Reference in New Issue
Block a user