Generator: Handle nested parent types and bring Direct3D12 to life.

This commit is contained in:
Amer Koleci
2022-09-07 12:33:20 +02:00
parent 05b829f36d
commit 12560e39cb
9 changed files with 47249 additions and 92 deletions

View File

@@ -18,6 +18,7 @@ public class ApiDataType
public string Name { get; set; }
public string TargetKind { get; set; }
public string Api { get; set; }
public string[] Parents { get; set; }
// Kind == Array
public ApiDataArrayShape Shape { get; set; }

View File

@@ -15,7 +15,8 @@ public static class Program
"Graphics.Dxgi.Common.json",
"Graphics.Dxgi.json",
"Graphics.Direct3D.json",
"Graphics.Direct3D11.json"
"Graphics.Direct3D11.json",
"Graphics.Direct3D12.json",
};
private static readonly Dictionary<string, string> s_csNameMappings = new()
@@ -196,6 +197,7 @@ public static class Program
"D3D",
"D3D10",
"D3D11",
"D3D12",
};
private static readonly HashSet<string> s_ignoredParts = new(StringComparer.OrdinalIgnoreCase)
@@ -771,6 +773,10 @@ public static class Program
{
fieldValueName = "Buffer";
}
else if (structType.Name == "D3D12_NODE_MASK")
{
fieldValueName = "Mask";
}
string fieldTypeName = GetTypeName(field.Type);
@@ -814,7 +820,9 @@ public static class Program
using (writer.PushBlock($"public unsafe struct {fieldValueName}__FixedBuffer"))
{
for (int i = 0; i < field.Type.Shape.Size; i++)
int arraySize = field.Type.Shape != null ? field.Type.Shape.Size : 1;
for (int i = 0; i < arraySize; i++)
{
writer.WriteLine($"public {fieldTypeName} e{i};");
}
@@ -835,7 +843,7 @@ public static class Program
writer.WriteLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]");
using (writer.PushBlock($"public Span<{fieldTypeName}> AsSpan()"))
{
writer.WriteLine($"return MemoryMarshal.CreateSpan(ref e0, {field.Type.Shape.Size});");
writer.WriteLine($"return MemoryMarshal.CreateSpan(ref e0, {arraySize});");
}
}
}
@@ -877,6 +885,8 @@ public static class Program
{
ApiStructField parentMemberAccess = structType.Fields.First(item => item.Type.Name == nestedTypeToGenerate.Name);
string fieldTypeName = GetTypeName(field.Type);
fieldTypeName = NormalizeTypeName(writer.Api, fieldTypeName);
string fieldName = GetPrettyFieldName(field.Name, structPrefix);
writer.WriteLine("[UnscopedRef]");
@@ -895,7 +905,18 @@ public static class Program
}
else
{
using (writer.PushBlock($"public ref {fieldTypeName} {fieldName}"))
if (fieldName == "pGeometryDescs")
{
}
string unsafePrefix = string.Empty;
if (fieldTypeName.EndsWith("*"))
{
unsafePrefix += "unsafe ";
}
using (writer.PushBlock($"public {unsafePrefix}ref {fieldTypeName} {fieldName}"))
{
writer.WriteLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]");
using (writer.PushBlock("get"))
@@ -903,7 +924,15 @@ public static class Program
writer.WriteLineUndindented("#if NET7_0_OR_GREATER");
writer.WriteLine($"return ref {parentMemberAccess.Name}.{fieldName};");
writer.WriteLineUndindented("#else");
if (fieldTypeName.EndsWith("*"))
{
writer.WriteLine($"return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).{parentMemberAccess.Name}.{fieldName};");
}
else
{
writer.WriteLine($"return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref {parentMemberAccess.Name}.{fieldName}, 1));");
}
writer.WriteLineUndindented("#endif");
}
}
@@ -1277,15 +1306,21 @@ public static class Program
{
sb.Append(partRemap!);
}
else if (part.StartsWith("DESC", StringComparison.OrdinalIgnoreCase))
else if (part == "DESC")
{
sb.Append("Description");
string numericPart = part.Replace("DESC", string.Empty);
if (string.IsNullOrEmpty(numericPart) == false &&
int.TryParse(numericPart, out int numericValue))
{
sb.Append(numericValue);
}
else if (part == "DESC1")
{
sb.Append("Description1");
}
else if (part == "DESC2")
{
sb.Append("Description2");
}
else if (part == "DESC3")
{
sb.Append("Description3");
}
else
{
@@ -1487,7 +1522,14 @@ public static class Program
{
if (dataType.Kind == "ApiRef")
{
string typeName = GetTypeName($"{dataType.Api}.{dataType.Name}");
string apiName = dataType.Api;
if (dataType.Parents?.Length > 0)
{
apiName += ".";
apiName += string.Join(".", dataType.Parents);
}
string typeName = GetTypeName($"{apiName}.{dataType.Name}");
return asPointer ? typeName + "*" : typeName;
}
else if (dataType.Kind == "Array")

View File

@@ -241,6 +241,17 @@ public unsafe struct ComPtr<T> : IDisposable
return (T**)Unsafe.AsPointer(ref Unsafe.AsRef(in this));
}
/// <summary>
/// Gets the address of the current <see cref="ComPtr{T}"/> instance as a raw <see langword="void"/> double pointer.
/// </summary>
/// <returns>The raw pointer to the input <see cref="ComPtr{T}"/> instance.</returns>
/// <remarks>This method is only valid when the current <see cref="ComPtr{T}"/> instance is on the stack or pinned.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void** GetVoidAddressOf()
{
return (void**)Unsafe.AsPointer(ref Unsafe.AsRef(in this));
}
/// <summary>Gets the address of the current <see cref="ComPtr{T}"/> instance as a raw <typeparamref name="T"/> double pointer.</summary>
/// <returns>The raw pointer to the current <see cref="ComPtr{T}"/> instance.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@@ -11394,7 +11394,7 @@
<para>
Microsoft Docs: <see href="https://docs.microsoft.com/windows/win32/api//d3d11shader/nf-d3d11shader-id3d11shaderreflection-getminfeaturelevel" />
</para>
<param name="unnamedParam1">
<param name="pLevel">
A pointer to one of the enumerated values in <a href="https://docs.microsoft.com/windows/desktop/api/d3dcommon/ne-d3dcommon-d3d_feature_level">D3D_FEATURE_LEVEL</a>, which represents the minimum feature level.
</param>
</summary>
@@ -13721,7 +13721,7 @@
<member name="ID3D11ShaderTrace::GetInitialRegisterContents">
<summary>
<para>Retrieves the initial contents of the specified input register.</para>
<para>
<para name="pRegister">
Microsoft Docs: <see href="https://docs.microsoft.com/windows/win32/api//d3d11shadertracing/nf-d3d11shadertracing-id3d11shadertrace-getinitialregistercontents" />
</para>
<param name="pValue">

File diff suppressed because it is too large Load Diff

View File

@@ -7743,7 +7743,7 @@ public partial struct ShaderResourceViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferSrv Buffer
public ref BufferSrv Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7757,7 +7757,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dSrv Texture1D
public ref Tex1dSrv Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7771,7 +7771,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArraySrv Texture1DArray
public ref Tex1dArraySrv Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7785,7 +7785,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dSrv Texture2D
public ref Tex2dSrv Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7799,7 +7799,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArraySrv Texture2DArray
public ref Tex2dArraySrv Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7813,7 +7813,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsSrv Texture2DMS
public ref Tex2dmsSrv Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7827,7 +7827,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsArraySrv Texture2DMSArray
public ref Tex2dmsArraySrv Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7841,7 +7841,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dSrv Texture3D
public ref Tex3dSrv Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7855,7 +7855,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.TexcubeSrv TextureCube
public ref TexcubeSrv TextureCube
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7869,7 +7869,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.TexcubeArraySrv TextureCubeArray
public ref TexcubeArraySrv TextureCubeArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -7883,7 +7883,7 @@ public partial struct ShaderResourceViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.BufferExtendedSrv BufferEx
public ref BufferExtendedSrv BufferEx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8129,7 +8129,7 @@ public partial struct RenderTargetViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferRtv Buffer
public ref BufferRtv Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8143,7 +8143,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dRtv Texture1D
public ref Tex1dRtv Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8157,7 +8157,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArrayRtv Texture1DArray
public ref Tex1dArrayRtv Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8171,7 +8171,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dRtv Texture2D
public ref Tex2dRtv Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8185,7 +8185,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayRtv Texture2DArray
public ref Tex2dArrayRtv Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8199,7 +8199,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsRtv Texture2DMS
public ref Tex2dmsRtv Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8213,7 +8213,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsArrayRtv Texture2DMSArray
public ref Tex2dmsArrayRtv Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8227,7 +8227,7 @@ public partial struct RenderTargetViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dRtv Texture3D
public ref Tex3dRtv Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8358,7 +8358,7 @@ public partial struct DepthStencilViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dDsv Texture1D
public ref Tex1dDsv Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8372,7 +8372,7 @@ public partial struct DepthStencilViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArrayDsv Texture1DArray
public ref Tex1dArrayDsv Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8386,7 +8386,7 @@ public partial struct DepthStencilViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dDsv Texture2D
public ref Tex2dDsv Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8400,7 +8400,7 @@ public partial struct DepthStencilViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayDsv Texture2DArray
public ref Tex2dArrayDsv Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8414,7 +8414,7 @@ public partial struct DepthStencilViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsDsv Texture2DMS
public ref Tex2dmsDsv Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8428,7 +8428,7 @@ public partial struct DepthStencilViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsArrayDsv Texture2DMSArray
public ref Tex2dmsArrayDsv Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8557,7 +8557,7 @@ public partial struct UnorderedAccessViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferUav Buffer
public ref BufferUav Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8571,7 +8571,7 @@ public partial struct UnorderedAccessViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dUav Texture1D
public ref Tex1dUav Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8585,7 +8585,7 @@ public partial struct UnorderedAccessViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArrayUav Texture1DArray
public ref Tex1dArrayUav Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8599,7 +8599,7 @@ public partial struct UnorderedAccessViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dUav Texture2D
public ref Tex2dUav Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8613,7 +8613,7 @@ public partial struct UnorderedAccessViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayUav Texture2DArray
public ref Tex2dArrayUav Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -8627,7 +8627,7 @@ public partial struct UnorderedAccessViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dUav Texture3D
public ref Tex3dUav Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -9437,7 +9437,7 @@ public partial struct VideoColor
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.VideoColorYcbcra YCbCr
public ref VideoColorYcbcra YCbCr
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -9451,7 +9451,7 @@ public partial struct VideoColor
}
[UnscopedRef]
public ref Graphics.Direct3D11.VideoColorRgba RGBA
public ref VideoColorRgba RGBA
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -9938,7 +9938,7 @@ public partial struct VideoDecoderOutputViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dVdov Texture2D
public ref Tex2dVdov Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -9986,7 +9986,7 @@ public partial struct VideoProcessorInputViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dVpiv Texture2D
public ref Tex2dVpiv Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10042,7 +10042,7 @@ public partial struct VideoProcessorOutputViewDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dVpov Texture2D
public ref Tex2dVpov Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10056,7 +10056,7 @@ public partial struct VideoProcessorOutputViewDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayVpov Texture2DArray
public ref Tex2dArrayVpov Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10648,7 +10648,7 @@ public partial struct ShaderResourceViewDescription1
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferSrv Buffer
public ref BufferSrv Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10662,7 +10662,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dSrv Texture1D
public ref Tex1dSrv Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10676,7 +10676,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArraySrv Texture1DArray
public ref Tex1dArraySrv Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10690,7 +10690,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dSrv1 Texture2D
public ref Tex2dSrv1 Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10704,7 +10704,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArraySrv1 Texture2DArray
public ref Tex2dArraySrv1 Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10718,7 +10718,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsSrv Texture2DMS
public ref Tex2dmsSrv Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10732,7 +10732,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsArraySrv Texture2DMSArray
public ref Tex2dmsArraySrv Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10746,7 +10746,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dSrv Texture3D
public ref Tex3dSrv Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10760,7 +10760,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.TexcubeSrv TextureCube
public ref TexcubeSrv TextureCube
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10774,7 +10774,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.TexcubeArraySrv TextureCubeArray
public ref TexcubeArraySrv TextureCubeArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10788,7 +10788,7 @@ public partial struct ShaderResourceViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.BufferExtendedSrv BufferEx
public ref BufferExtendedSrv BufferEx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10893,7 +10893,7 @@ public partial struct RenderTargetViewDescription1
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferRtv Buffer
public ref BufferRtv Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10907,7 +10907,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dRtv Texture1D
public ref Tex1dRtv Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10921,7 +10921,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArrayRtv Texture1DArray
public ref Tex1dArrayRtv Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10935,7 +10935,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dRtv1 Texture2D
public ref Tex2dRtv1 Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10949,7 +10949,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayRtv1 Texture2DArray
public ref Tex2dArrayRtv1 Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10963,7 +10963,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsRtv Texture2DMS
public ref Tex2dmsRtv Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10977,7 +10977,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dmsArrayRtv Texture2DMSArray
public ref Tex2dmsArrayRtv Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -10991,7 +10991,7 @@ public partial struct RenderTargetViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dRtv Texture3D
public ref Tex3dRtv Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11084,7 +11084,7 @@ public partial struct UnorderedAccessViewDescription1
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.BufferUav Buffer
public ref BufferUav Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11098,7 +11098,7 @@ public partial struct UnorderedAccessViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dUav Texture1D
public ref Tex1dUav Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11112,7 +11112,7 @@ public partial struct UnorderedAccessViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex1dArrayUav Texture1DArray
public ref Tex1dArrayUav Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11126,7 +11126,7 @@ public partial struct UnorderedAccessViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dUav1 Texture2D
public ref Tex2dUav1 Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11140,7 +11140,7 @@ public partial struct UnorderedAccessViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex2dArrayUav1 Texture2DArray
public ref Tex2dArrayUav1 Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11154,7 +11154,7 @@ public partial struct UnorderedAccessViewDescription1
}
[UnscopedRef]
public ref Graphics.Direct3D11.Tex3dUav Texture3D
public ref Tex3dUav Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11765,7 +11765,7 @@ public partial struct ShaderTraceDescription
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref Graphics.Direct3D11.VertexShaderTraceDescription VertexShaderTraceDesc
public ref VertexShaderTraceDescription VertexShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11779,7 +11779,7 @@ public partial struct ShaderTraceDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.HullShaderTraceDescription HullShaderTraceDesc
public ref HullShaderTraceDescription HullShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11793,7 +11793,7 @@ public partial struct ShaderTraceDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.DomainShaderTraceDescription DomainShaderTraceDesc
public ref DomainShaderTraceDescription DomainShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11807,7 +11807,7 @@ public partial struct ShaderTraceDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.GeometryShaderTraceDescription GeometryShaderTraceDesc
public ref GeometryShaderTraceDescription GeometryShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11821,7 +11821,7 @@ public partial struct ShaderTraceDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.PixelShaderTraceDescription PixelShaderTraceDesc
public ref PixelShaderTraceDescription PixelShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
@@ -11835,7 +11835,7 @@ public partial struct ShaderTraceDescription
}
[UnscopedRef]
public ref Graphics.Direct3D11.ComputeShaderTraceDescription ComputeShaderTraceDesc
public ref ComputeShaderTraceDescription ComputeShaderTraceDesc
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Direct3D12;
public partial struct DepthStencilValue
{
public DepthStencilValue(float depth, byte stencil)
{
Depth = depth;
Stencil = stencil;
}
}

View File

@@ -1,6 +1,7 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using System;
using System.Runtime.CompilerServices;
namespace Win32;
@@ -8,7 +9,7 @@ namespace Win32;
/// <summary>
/// A locally unique identifier for a graphics device.
/// </summary>
public readonly struct Luid : IEquatable<Luid>
public struct Luid : IEquatable<Luid>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
@@ -16,20 +17,20 @@ public readonly struct Luid : IEquatable<Luid>
/// <summary>
/// The low bits of the luid.
/// </summary>
private readonly uint _lowPart;
public uint LowPart;
/// <summary>
/// The high bits of the luid.
/// </summary>
private readonly int _highPart;
public int HighPart;
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Luid other)
{
return
_lowPart == other._lowPart &&
_highPart == other._highPart;
LowPart == other.LowPart &&
HighPart == other.HighPart;
}
/// <inheritdoc/>
@@ -42,26 +43,45 @@ public readonly struct Luid : IEquatable<Luid>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode()
{
return HashCode.Combine(_lowPart, _highPart);
return HashCode.Combine(LowPart, HighPart);
}
/// <inheritdoc/>
public override string ToString()
{
return (((long)this._highPart) << 32 | this._lowPart).ToString();
return (((long)HighPart) << 32 | LowPart).ToString();
}
public long ToInt64()
{
LargeInterger val = new();
val.Anonymous.LowPart = LowPart;
val.Anonymous.HighPart = HighPart;
return val.QuadPart;
}
public static Luid FromInt64(long Int64)
{
LargeInterger val = new();
val.QuadPart = Int64;
Luid luid = new();
luid.LowPart = val.Anonymous.LowPart;
luid.HighPart = val.Anonymous.HighPart;
return luid;
}
#if NET6_0_OR_GREATER
/// <inheritdoc/>
public string ToString(string? format, IFormatProvider? formatProvider)
{
return (((long)_highPart) << 32 | _lowPart).ToString(format, formatProvider);
return (((long)HighPart) << 32 | LowPart).ToString(format, formatProvider);
}
/// <inheritdoc/>
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
{
return (((long)_highPart) << 32 | _lowPart).TryFormat(destination, out charsWritten, format, provider);
return (((long)HighPart) << 32 | LowPart).TryFormat(destination, out charsWritten, format, provider);
}
#endif