language feature: Extension Members: Graphics related, enums

This commit is contained in:
GreemDev
2025-07-02 02:04:47 -05:00
parent e23213d290
commit ac98ade572
24 changed files with 250 additions and 248 deletions

View File

@@ -20,20 +20,18 @@ namespace Ryujinx.Graphics.Shader
static class AttributeTypeExtensions
{
public static AggregateType ToAggregateType(this AttributeType type)
extension(AttributeType type)
{
return (type & ~AttributeType.AnyPacked) switch
public AggregateType Aggregate =>
(type & ~AttributeType.AnyPacked) switch
{
AttributeType.Float => AggregateType.FP32,
AttributeType.Sint => AggregateType.S32,
AttributeType.Uint => AggregateType.U32,
_ => throw new ArgumentException($"Invalid attribute type \"{type}\"."),
};
}
public static AggregateType ToAggregateType(this AttributeType type, bool supportsScaledFormats)
{
return (type & ~AttributeType.AnyPacked) switch
public AggregateType AsAggregate(bool supportsScaledFormats) => (type & ~AttributeType.AnyPacked) switch
{
AttributeType.Float => AggregateType.FP32,
AttributeType.Sint => AggregateType.S32,