Improve generation.

This commit is contained in:
Amer Koleci
2022-12-30 09:28:01 +01:00
parent ad6909ef04
commit c2a59c7720
10 changed files with 139 additions and 41 deletions

View File

@@ -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));
}
}

View File

@@ -15,7 +15,7 @@ public unsafe partial struct BlendDescription
/// <summary>
/// A built-in description with settings for alpha blend, that is blending the source and destination data using alpha.
/// </summary>
public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InvSrcAlpha);
public static readonly BlendDescription AlphaBlend = new(Blend.One, Blend.InverseSrcAlpha);
/// <summary>
/// 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
/// <summary>
/// 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.
/// </summary>
public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha);
public static readonly BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InverseSrcAlpha);
/// <summary>
/// Initializes a new instance of the <see cref="BlendDescription"/> struct.

View File

@@ -15,7 +15,7 @@ public unsafe partial struct BlendDescription1
/// <summary>
/// A built-in description with settings for alpha blend, that is blending the source and destination data using alpha.
/// </summary>
public static readonly BlendDescription1 AlphaBlend = new(Blend.One, Blend.InvSrcAlpha);
public static readonly BlendDescription1 AlphaBlend = new(Blend.One, Blend.InverseSrcAlpha);
/// <summary>
/// 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
/// <summary>
/// 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.
/// </summary>
public static readonly BlendDescription1 NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha);
public static readonly BlendDescription1 NonPremultiplied = new(Blend.SrcAlpha, Blend.InverseSrcAlpha);
/// <summary>
/// Initializes a new instance of the <see cref="BlendDescription1"/> struct.

View File

@@ -405,19 +405,19 @@ public enum StencilOperation : int
Replace = 3,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_INCR_SAT"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_INCR_SAT</unmanaged>
IncrSat = 4,
IncrementSaturate = 4,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_DECR_SAT"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_DECR_SAT</unmanaged>
DecrSat = 5,
DecrementSaturate = 5,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_INVERT"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_INVERT</unmanaged>
Invert = 6,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_INCR"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_INCR</unmanaged>
Incr = 7,
Increment = 7,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_DECR"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_DECR</unmanaged>
Decr = 8,
Decrement = 8,
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND"]/*' />
@@ -435,46 +435,46 @@ public enum Blend : int
SrcColor = 3,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_SRC_COLOR"]/*' />
/// <unmanaged>D3D11_BLEND_INV_SRC_COLOR</unmanaged>
InvSrcColor = 4,
InverseSrcColor = 4,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_SRC_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_SRC_ALPHA</unmanaged>
SrcAlpha = 5,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_SRC_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_INV_SRC_ALPHA</unmanaged>
InvSrcAlpha = 6,
InverseSrcAlpha = 6,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_DEST_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_DEST_ALPHA</unmanaged>
DestAlpha = 7,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_DEST_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_INV_DEST_ALPHA</unmanaged>
InvDestAlpha = 8,
InverseDestAlpha = 8,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_DEST_COLOR"]/*' />
/// <unmanaged>D3D11_BLEND_DEST_COLOR</unmanaged>
DestColor = 9,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_DEST_COLOR"]/*' />
/// <unmanaged>D3D11_BLEND_INV_DEST_COLOR</unmanaged>
InvDestColor = 10,
InverseDestColor = 10,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_SRC_ALPHA_SAT"]/*' />
/// <unmanaged>D3D11_BLEND_SRC_ALPHA_SAT</unmanaged>
SrcAlphaSat = 11,
SrcAlphaSaturate = 11,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_BLEND_FACTOR"]/*' />
/// <unmanaged>D3D11_BLEND_BLEND_FACTOR</unmanaged>
BlendFactor = 14,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_BLEND_FACTOR"]/*' />
/// <unmanaged>D3D11_BLEND_INV_BLEND_FACTOR</unmanaged>
InvBlendFactor = 15,
InverseBlendFactor = 15,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_SRC1_COLOR"]/*' />
/// <unmanaged>D3D11_BLEND_SRC1_COLOR</unmanaged>
Src1Color = 16,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_SRC1_COLOR"]/*' />
/// <unmanaged>D3D11_BLEND_INV_SRC1_COLOR</unmanaged>
InvSrc1Color = 17,
InverseSrc1Color = 17,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_SRC1_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_SRC1_ALPHA</unmanaged>
Src1Alpha = 18,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND::D3D11_BLEND_INV_SRC1_ALPHA"]/*' />
/// <unmanaged>D3D11_BLEND_INV_SRC1_ALPHA</unmanaged>
InvSrc1Alpha = 19,
InverseSrc1Alpha = 19,
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND_OP"]/*' />
@@ -489,7 +489,7 @@ public enum BlendOperation : int
Subtract = 2,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND_OP::D3D11_BLEND_OP_REV_SUBTRACT"]/*' />
/// <unmanaged>D3D11_BLEND_OP_REV_SUBTRACT</unmanaged>
RevSubtract = 3,
ReverseSubtract = 3,
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND_OP::D3D11_BLEND_OP_MIN"]/*' />
/// <unmanaged>D3D11_BLEND_OP_MIN</unmanaged>
Min = 4,