diff --git a/Directory.Build.props b/Directory.Build.props index d43fcc3..f8e8bc2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,7 +14,7 @@ true $(MSBuildThisFileDirectory)NuGet.config - 1.9.7 + 1.9.8 true diff --git a/src/Generator/Program.cs b/src/Generator/Program.cs index 7916050..b995bf1 100644 --- a/src/Generator/Program.cs +++ b/src/Generator/Program.cs @@ -208,6 +208,11 @@ public static class Program { "PROTECTEDRESOURCESESSION", "ProtectedResourceSession" }, { "METACOMMAND", "MetaCommand" }, { "SCHEDULINGGROUP", "SchedulingGroup" }, + { "INCR", "Increment" }, + { "DECR", "Decrement" }, + { "SAT", "Saturate" }, + { "INV", "Inverse" }, + { "REV", "Reverse" }, }; private static readonly HashSet s_partRenamesSet = new(StringComparer.OrdinalIgnoreCase) @@ -762,7 +767,6 @@ public static class Program "XNA", }; - private static readonly Dictionary s_knownTypesPrefixes = new() { { "DXGI_COLOR_SPACE_TYPE", "DXGI_COLOR_SPACE" }, diff --git a/src/Vortice.Win32.Graphics.Direct2D/Generated/Graphics.Direct2D.Enums.cs b/src/Vortice.Win32.Graphics.Direct2D/Generated/Graphics.Direct2D.Enums.cs index 0143d78..813d126 100644 --- a/src/Vortice.Win32.Graphics.Direct2D/Generated/Graphics.Direct2D.Enums.cs +++ b/src/Vortice.Win32.Graphics.Direct2D/Generated/Graphics.Direct2D.Enums.cs @@ -2089,7 +2089,7 @@ public enum BlendOperation : uint Subtract = 2, /// /// D2D1_BLEND_OPERATION_REV_SUBTRACT - RevSubtract = 3, + ReverseSubtract = 3, /// /// D2D1_BLEND_OPERATION_MIN Min = 4, @@ -2113,34 +2113,34 @@ public enum Blend : uint SrcColor = 3, /// /// D2D1_BLEND_INV_SRC_COLOR - InvSrcColor = 4, + InverseSrcColor = 4, /// /// D2D1_BLEND_SRC_ALPHA SrcAlpha = 5, /// /// D2D1_BLEND_INV_SRC_ALPHA - InvSrcAlpha = 6, + InverseSrcAlpha = 6, /// /// D2D1_BLEND_DEST_ALPHA DestAlpha = 7, /// /// D2D1_BLEND_INV_DEST_ALPHA - InvDestAlpha = 8, + InverseDestAlpha = 8, /// /// D2D1_BLEND_DEST_COLOR DestColor = 9, /// /// D2D1_BLEND_INV_DEST_COLOR - InvDestColor = 10, + InverseDestColor = 10, /// /// D2D1_BLEND_SRC_ALPHA_SAT - SrcAlphaSat = 11, + SrcAlphaSaturate = 11, /// /// D2D1_BLEND_BLEND_FACTOR BlendFactor = 14, /// /// D2D1_BLEND_INV_BLEND_FACTOR - InvBlendFactor = 15, + InverseBlendFactor = 15, } /// diff --git a/src/Vortice.Win32.Graphics.Direct3D11/Apis.cs b/src/Vortice.Win32.Graphics.Direct3D11/Apis.cs index 160f3ac..cf00f3a 100644 --- a/src/Vortice.Win32.Graphics.Direct3D11/Apis.cs +++ b/src/Vortice.Win32.Graphics.Direct3D11/Apis.cs @@ -72,4 +72,51 @@ public static unsafe partial class Apis ppImmediateContext); } } + + public static Filter EncodeBasicFilter(FilterType min, FilterType mag, FilterType mip, FilterReductionType reduction) + { + return (Filter)((((uint)min & D3D11_FILTER_TYPE_MASK) << unchecked((int)D3D11_MIN_FILTER_SHIFT)) + | (((uint)mag & D3D11_FILTER_TYPE_MASK) << unchecked((int)D3D11_MAG_FILTER_SHIFT)) + | (((uint)mip & D3D11_FILTER_TYPE_MASK) << unchecked((int)D3D11_MIP_FILTER_SHIFT)) + | (((uint)reduction & D3D11_FILTER_REDUCTION_TYPE_MASK) << unchecked((int)D3D11_FILTER_REDUCTION_TYPE_SHIFT))); + } + + public static Filter EncodeAnisotropicFilter(FilterReductionType reduction) + { + return (Filter)(D3D11_ANISOTROPIC_FILTERING_BIT + | (int)EncodeBasicFilter(FilterType.Linear, FilterType.Linear, FilterType.Linear, reduction)); + } + + public static FilterType DecodeMinFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D11_MIN_FILTER_SHIFT)) & D3D11_FILTER_TYPE_MASK); + } + + public static FilterType DecodeMagFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D11_MAG_FILTER_SHIFT)) & D3D11_FILTER_TYPE_MASK); + } + + public static FilterType DecodeMipFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D11_MIP_FILTER_SHIFT)) & D3D11_FILTER_TYPE_MASK); + } + + public static FilterReductionType DecodeFilterReduction(Filter D3D11Filter) + { + return (FilterReductionType)(((uint)D3D11Filter >> unchecked((int)D3D11_FILTER_REDUCTION_TYPE_SHIFT)) & D3D11_FILTER_REDUCTION_TYPE_MASK); + } + + public static bool DecodeisComparisonFilter(Filter D3D11Filter) + { + return DecodeFilterReduction(D3D11Filter) == FilterReductionType.Comparison; + } + + public static bool DecodeIsAnisotropicFilter(Filter D3D11Filter) + { + return (((int)D3D11Filter & D3D11_ANISOTROPIC_FILTERING_BIT) != 0) + && (FilterType.Linear == DecodeMinFilter(D3D11Filter)) + && (FilterType.Linear == DecodeMagFilter(D3D11Filter)) + && (FilterType.Linear == DecodeMipFilter(D3D11Filter)); + } } diff --git a/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription.cs b/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription.cs index 7e8f37c..ecc6559 100644 --- a/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription.cs +++ b/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription.cs @@ -15,7 +15,7 @@ public unsafe partial struct BlendDescription /// /// A built-in description with settings for alpha blend, that is blending the source and destination data using alpha. /// - public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InvSrcAlpha); + public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InverseSrcAlpha); /// /// A built-in description with settings for additive blend, that is adding the destination data to the source data without using alpha. @@ -25,7 +25,7 @@ public unsafe partial struct BlendDescription /// /// A built-in description with settings for blending with non-premultipled alpha, that is blending source and destination data using alpha while assuming the color data contains no alpha information. /// - public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha); + public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InverseSrcAlpha); /// /// Initializes a new instance of the struct. diff --git a/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription1.cs b/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription1.cs index 6273585..c48f3eb 100644 --- a/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription1.cs +++ b/src/Vortice.Win32.Graphics.Direct3D11/BlendDescription1.cs @@ -15,7 +15,7 @@ public unsafe partial struct BlendDescription1 /// /// A built-in description with settings for alpha blend, that is blending the source and destination data using alpha. /// - public static readonly BlendDescription1 AlphaBlend = new(Blend.One, Blend.InvSrcAlpha); + public static readonly BlendDescription1 AlphaBlend = new(Blend.One, Blend.InverseSrcAlpha); /// /// A built-in description with settings for additive blend, that is adding the destination data to the source data without using alpha. @@ -25,7 +25,7 @@ public unsafe partial struct BlendDescription1 /// /// A built-in description with settings for blending with non-premultipled alpha, that is blending source and destination data using alpha while assuming the color data contains no alpha information. /// - public static readonly BlendDescription1 NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha); + public static readonly BlendDescription1 NonPremultiplied = new(Blend.SrcAlpha, Blend.InverseSrcAlpha); /// /// Initializes a new instance of the struct. diff --git a/src/Vortice.Win32.Graphics.Direct3D11/Generated/Graphics.Direct3D11.Enums.cs b/src/Vortice.Win32.Graphics.Direct3D11/Generated/Graphics.Direct3D11.Enums.cs index 17a5b14..493a586 100644 --- a/src/Vortice.Win32.Graphics.Direct3D11/Generated/Graphics.Direct3D11.Enums.cs +++ b/src/Vortice.Win32.Graphics.Direct3D11/Generated/Graphics.Direct3D11.Enums.cs @@ -405,19 +405,19 @@ public enum StencilOperation : int Replace = 3, /// /// D3D11_STENCIL_OP_INCR_SAT - IncrSat = 4, + IncrementSaturate = 4, /// /// D3D11_STENCIL_OP_DECR_SAT - DecrSat = 5, + DecrementSaturate = 5, /// /// D3D11_STENCIL_OP_INVERT Invert = 6, /// /// D3D11_STENCIL_OP_INCR - Incr = 7, + Increment = 7, /// /// D3D11_STENCIL_OP_DECR - Decr = 8, + Decrement = 8, } /// @@ -435,46 +435,46 @@ public enum Blend : int SrcColor = 3, /// /// D3D11_BLEND_INV_SRC_COLOR - InvSrcColor = 4, + InverseSrcColor = 4, /// /// D3D11_BLEND_SRC_ALPHA SrcAlpha = 5, /// /// D3D11_BLEND_INV_SRC_ALPHA - InvSrcAlpha = 6, + InverseSrcAlpha = 6, /// /// D3D11_BLEND_DEST_ALPHA DestAlpha = 7, /// /// D3D11_BLEND_INV_DEST_ALPHA - InvDestAlpha = 8, + InverseDestAlpha = 8, /// /// D3D11_BLEND_DEST_COLOR DestColor = 9, /// /// D3D11_BLEND_INV_DEST_COLOR - InvDestColor = 10, + InverseDestColor = 10, /// /// D3D11_BLEND_SRC_ALPHA_SAT - SrcAlphaSat = 11, + SrcAlphaSaturate = 11, /// /// D3D11_BLEND_BLEND_FACTOR BlendFactor = 14, /// /// D3D11_BLEND_INV_BLEND_FACTOR - InvBlendFactor = 15, + InverseBlendFactor = 15, /// /// D3D11_BLEND_SRC1_COLOR Src1Color = 16, /// /// D3D11_BLEND_INV_SRC1_COLOR - InvSrc1Color = 17, + InverseSrc1Color = 17, /// /// D3D11_BLEND_SRC1_ALPHA Src1Alpha = 18, /// /// D3D11_BLEND_INV_SRC1_ALPHA - InvSrc1Alpha = 19, + InverseSrc1Alpha = 19, } /// @@ -489,7 +489,7 @@ public enum BlendOperation : int Subtract = 2, /// /// D3D11_BLEND_OP_REV_SUBTRACT - RevSubtract = 3, + ReverseSubtract = 3, /// /// D3D11_BLEND_OP_MIN Min = 4, diff --git a/src/Vortice.Win32.Graphics.Direct3D12/Apis.cs b/src/Vortice.Win32.Graphics.Direct3D12/Apis.cs index 897346b..115d5cf 100644 --- a/src/Vortice.Win32.Graphics.Direct3D12/Apis.cs +++ b/src/Vortice.Win32.Graphics.Direct3D12/Apis.cs @@ -511,4 +511,51 @@ public static unsafe partial class Apis return HResult.InvalidArg; } + + public static Filter EncodeBasicFilter(FilterType min, FilterType mag, FilterType mip, FilterReductionType reduction) + { + return (Filter)((((uint)min & D3D12_FILTER_TYPE_MASK) << unchecked((int)D3D12_MIN_FILTER_SHIFT)) + | (((uint)mag & D3D12_FILTER_TYPE_MASK) << unchecked((int)D3D12_MAG_FILTER_SHIFT)) + | (((uint)mip & D3D12_FILTER_TYPE_MASK) << unchecked((int)D3D12_MIP_FILTER_SHIFT)) + | (((uint)reduction & D3D12_FILTER_REDUCTION_TYPE_MASK) << unchecked((int)D3D12_FILTER_REDUCTION_TYPE_SHIFT))); + } + + public static Filter EncodeAnisotropicFilter(FilterReductionType reduction) + { + return (Filter)(D3D12_ANISOTROPIC_FILTERING_BIT + | (int)EncodeBasicFilter(FilterType.Linear, FilterType.Linear, FilterType.Linear, reduction)); + } + + public static FilterType DecodeMinFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D12_MIN_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + } + + public static FilterType DecodeMagFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D12_MAG_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + } + + public static FilterType DecodeMipFilter(Filter D3D11Filter) + { + return (FilterType)(((uint)D3D11Filter >> unchecked((int)D3D12_MIP_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + } + + public static FilterReductionType DecodeFilterReduction(Filter D3D11Filter) + { + return (FilterReductionType)(((uint)D3D11Filter >> unchecked((int)D3D12_FILTER_REDUCTION_TYPE_SHIFT)) & D3D12_FILTER_REDUCTION_TYPE_MASK); + } + + public static bool DecodeisComparisonFilter(Filter D3D11Filter) + { + return DecodeFilterReduction(D3D11Filter) == FilterReductionType.Comparison; + } + + public static bool DecodeIsAnisotropicFilter(Filter D3D11Filter) + { + return (((int)D3D11Filter & D3D12_ANISOTROPIC_FILTERING_BIT) != 0) + && (FilterType.Linear == DecodeMinFilter(D3D11Filter)) + && (FilterType.Linear == DecodeMagFilter(D3D11Filter)) + && (FilterType.Linear == DecodeMipFilter(D3D11Filter)); + } } diff --git a/src/Vortice.Win32.Graphics.Direct3D12/BlendDescription.cs b/src/Vortice.Win32.Graphics.Direct3D12/BlendDescription.cs index c240557..8d9e94a 100644 --- a/src/Vortice.Win32.Graphics.Direct3D12/BlendDescription.cs +++ b/src/Vortice.Win32.Graphics.Direct3D12/BlendDescription.cs @@ -15,7 +15,7 @@ public unsafe partial struct BlendDescription /// /// A built-in description with settings for alpha blend, that is blending the source and destination data using alpha. /// - public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InvSrcAlpha); + public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InverseSrcAlpha); /// /// A built-in description with settings for additive blend, that is adding the destination data to the source data without using alpha. @@ -25,7 +25,7 @@ public unsafe partial struct BlendDescription /// /// A built-in description with settings for blending with non-premultipled alpha, that is blending source and destination data using alpha while assuming the color data contains no alpha information. /// - public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha); + public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InverseSrcAlpha); /// /// Initializes a new instance of the struct. diff --git a/src/Vortice.Win32.Graphics.Direct3D12/Generated/Graphics.Direct3D12.Enums.cs b/src/Vortice.Win32.Graphics.Direct3D12/Generated/Graphics.Direct3D12.Enums.cs index 89b55f3..9bfec68 100644 --- a/src/Vortice.Win32.Graphics.Direct3D12/Generated/Graphics.Direct3D12.Enums.cs +++ b/src/Vortice.Win32.Graphics.Direct3D12/Generated/Graphics.Direct3D12.Enums.cs @@ -181,19 +181,19 @@ public enum StencilOperation : int Replace = 3, /// /// D3D12_STENCIL_OP_INCR_SAT - IncrSat = 4, + IncrementSaturate = 4, /// /// D3D12_STENCIL_OP_DECR_SAT - DecrSat = 5, + DecrementSaturate = 5, /// /// D3D12_STENCIL_OP_INVERT Invert = 6, /// /// D3D12_STENCIL_OP_INCR - Incr = 7, + Increment = 7, /// /// D3D12_STENCIL_OP_DECR - Decr = 8, + Decrement = 8, } /// @@ -211,46 +211,46 @@ public enum Blend : int SrcColor = 3, /// /// D3D12_BLEND_INV_SRC_COLOR - InvSrcColor = 4, + InverseSrcColor = 4, /// /// D3D12_BLEND_SRC_ALPHA SrcAlpha = 5, /// /// D3D12_BLEND_INV_SRC_ALPHA - InvSrcAlpha = 6, + InverseSrcAlpha = 6, /// /// D3D12_BLEND_DEST_ALPHA DestAlpha = 7, /// /// D3D12_BLEND_INV_DEST_ALPHA - InvDestAlpha = 8, + InverseDestAlpha = 8, /// /// D3D12_BLEND_DEST_COLOR DestColor = 9, /// /// D3D12_BLEND_INV_DEST_COLOR - InvDestColor = 10, + InverseDestColor = 10, /// /// D3D12_BLEND_SRC_ALPHA_SAT - SrcAlphaSat = 11, + SrcAlphaSaturate = 11, /// /// D3D12_BLEND_BLEND_FACTOR BlendFactor = 14, /// /// D3D12_BLEND_INV_BLEND_FACTOR - InvBlendFactor = 15, + InverseBlendFactor = 15, /// /// D3D12_BLEND_SRC1_COLOR Src1Color = 16, /// /// D3D12_BLEND_INV_SRC1_COLOR - InvSrc1Color = 17, + InverseSrc1Color = 17, /// /// D3D12_BLEND_SRC1_ALPHA Src1Alpha = 18, /// /// D3D12_BLEND_INV_SRC1_ALPHA - InvSrc1Alpha = 19, + InverseSrc1Alpha = 19, } /// @@ -265,7 +265,7 @@ public enum BlendOperation : int Subtract = 2, /// /// D3D12_BLEND_OP_REV_SUBTRACT - RevSubtract = 3, + ReverseSubtract = 3, /// /// D3D12_BLEND_OP_MIN Min = 4,