More goodies and improve function generation to use common code patterns.

This commit is contained in:
Amer Koleci
2022-09-21 14:40:18 +02:00
parent 8de93a6f85
commit 255de8bfc5
62 changed files with 2211 additions and 296 deletions

View File

@@ -19,4 +19,6 @@
</Content>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties win32json_4api_4graphics_1direct3d12_1json__JsonSchema="https://docs.strmprivacy.io/jsonschema/BatchJob.json" /></VisualStudio></ProjectExtensions>
</Project>

View File

@@ -4,6 +4,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection.Metadata;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
@@ -124,7 +126,6 @@ public static class Program
private static readonly Dictionary<string, string> s_partRenames = new()
{
{ "CBUFFER", "CBuffer" },
{ "TBUFFER", "TBuffer" },
{ "NOPERSPECTIVE", "NoPerspective" },
@@ -844,9 +845,21 @@ public static class Program
{ "D3D11_RLDO_FLAGS", "ReportLiveDeviceObjectFlags" },
{ "D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG", "CreateDeviceContextStateFlags" },
{ "D3D11_QUERY", "QueryType" },
{ "D3D11_COMPARISON_FUNC", "ComparisonFunction" },
{ "D3D11_STENCIL_OP", "StencilOperation" },
{ "D3D11_BLEND_OP", "BlendOperation" },
{ "D3D11_LOGIC_OP", "LogicOperation" },
{ "D3D11_DEPTH_STENCILOP_DESC", "DepthStencilOperationDescription" },
// D3D12
{ "D3D12_RLDO_FLAGS", "ReportLiveDeviceObjectFlags" },
{ "D3D12_COMPARISON_FUNC", "ComparisonFunction" },
{ "D3D12_STENCIL_OP", "StencilOperation" },
{ "D3D12_BLEND_OP", "BlendOperation" },
{ "D3D12_LOGIC_OP", "LogicOperation" },
{ "D3D12_PREDICATION_OP", "PredicationOperation" },
{ "D3D12_AUTO_BREADCRUMB_OP", "AutoBreadcrumbOperation" },
{ "D3D12_DEPTH_STENCILOP_DESC", "DepthStencilOperationDescription" },
// D2D1
{ "D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE", "AffineTransform2DInterpolationMode" },
@@ -1369,7 +1382,7 @@ public static class Program
continue;
}
WriteFunction(writer, api, function, string.Empty, false);
WriteFunction(writer, api, function, string.Empty, false, false, true);
writer.WriteLine();
}
}
@@ -1377,15 +1390,18 @@ public static class Program
writer.WriteLine($"#endregion Functions");
}
private static void WriteFunction(
private static string WriteFunction(
CodeWriter writer,
ApiData api,
ApiType function,
string functionName,
bool asCallback)
bool asCallback,
bool asParameter = false,
bool skipUnsafe = false)
{
string returnType = GetTypeName(function.ReturnType);
string functionSuffix = string.Empty;
StringBuilder functionSignature = new();
if (string.IsNullOrEmpty(function.DllImport) == false)
{
@@ -1399,41 +1415,10 @@ public static class Program
int parameterIndex = 0;
foreach (ApiParameter parameter in function.Params)
{
bool asPointer = false;
string parameterType = string.Empty;
if (parameter.Type.Kind == "ApiRef")
{
if (parameter.Type.TargetKind == "FunctionPointer")
{
ApiType functionType = api.Types.First(item => item.Name == parameter.Type.Name && item.Kind == "FunctionPointer");
parameterType = "delegate* unmanaged[Stdcall]<void*, void>";
}
else
{
string fullTypeName = $"{parameter.Type.Api}.{parameter.Type.Name}";
if (!IsPrimitive(parameter.Type) && !IsEnum(fullTypeName))
{
asPointer = true;
}
}
}
if (string.IsNullOrEmpty(parameterType))
{
parameterType = GetTypeName(parameter.Type, asPointer);
}
parameterType = NormalizeTypeName(writer.Api, parameterType);
string parameterName = parameter.Name;
bool isOptional = parameter.Attrs.Any(item => item is string str && str == "Optional");
if (parameter.Attrs.Any(item => item is string str && str == "ComOutPtr"))
{
if (!IsPrimitive(parameter.Type))
{
parameterType += "*";
}
}
GetParameterSignature(api, writer, parameter,
string.Empty,
out string parameterType,
out string parameterName);
argumentBuilder.Append(parameterType);
@@ -1442,11 +1427,6 @@ public static class Program
argumentBuilder.Append(' ').Append(parameterName);
}
if (isOptional == true)
{
//argumentBuilder.Append(" = default");
}
argumentsTypesBuilder.Append(parameterType);
argumentsNameBuilder.Append(parameterName);
@@ -1466,17 +1446,43 @@ public static class Program
functionName = function.Name;
}
writer.Write("public ");
if (!asParameter)
{
writer.Write("public ");
functionSignature.Append("public ");
}
string signature = string.Empty;
if (!skipUnsafe)
{
if (!asParameter || asCallback)
{
signature = "unsafe ";
}
}
if (asCallback)
{
writer.Write($"unsafe delegate* unmanaged[Stdcall]<{argumentsString}, {returnType}> {functionName}");
signature += $"delegate* unmanaged[Stdcall]<{argumentsString}, {returnType}>";
if (!asParameter)
{
signature += $" {functionName}";
}
}
else
{
writer.Write($"{functionSuffix}{returnType} {functionName}({argumentsString})");
signature += $"{functionSuffix}{returnType} {functionName}({argumentsString})";
}
writer.WriteLine(";");
functionSignature.Append(signature);
if (!asParameter)
{
writer.Write(signature);
writer.WriteLine(";");
}
return functionSignature.ToString();
}
private static void GenerateEnum(CodeWriter writer, ApiType enumType, bool autoGenerated)
@@ -1784,7 +1790,7 @@ public static class Program
if (field.Type.TargetKind == "FunctionPointer")
{
ApiType functionType = api.Types.First(item => item.Name == field.Type.Name && item.Kind == "FunctionPointer");
WriteFunction(writer, api, functionType, field.Name, true);
WriteFunction(writer, api, functionType, field.Name, true, false, false);
}
else
{
@@ -2003,14 +2009,6 @@ public static class Program
StringBuilder argumentsNameBuilder = new();
int parameterIndex = 0;
bool allOptional = false;
if (method.Name == "EndDraw")
{
allOptional =
method.Params.All(item => item.Attrs.Any(attr => attr is string str && str == "Optional"));
}
bool useReturnAsParameter = false;
if (returnType != "void" &&
method.ReturnType.TargetKind != "Com" &&
@@ -2044,88 +2042,17 @@ public static class Program
foreach (ApiParameter parameter in method.Params)
{
bool asPointer = false;
string parameterType = string.Empty;
GetParameterSignature(api, writer, parameter,
$"{comType.Name}::{method.Name}",
out string parameterType,
out string parameterName);
if (parameter.Type.Kind == "ApiRef")
{
if (parameter.Type.TargetKind == "FunctionPointer")
{
ApiType functionType = api.Types.First(item => item.Name == parameter.Type.Name && item.Kind == "FunctionPointer");
parameterType = "delegate* unmanaged[Stdcall]<void*, void>";
}
else
{
string fullTypeName = $"{parameter.Type.Api}.{parameter.Type.Name}";
if (!IsPrimitive(parameter.Type) && !IsEnum(fullTypeName))
{
asPointer = true;
}
}
}
argumentBuilder
.Append(parameterType)
.Append(' ')
.Append(parameterName);
if (string.IsNullOrEmpty(parameterType))
{
string parameterNameLookup = $"{comType.Name}::{method.Name}::{parameter.Name}";
if (s_mapFunctionParameters.TryGetValue(parameterNameLookup, out string? remapType))
{
parameterType = GetTypeName($"{writer.Api}.{remapType}");
if (parameter.Attrs.Any(item => item is string str && str == "Out"))
{
parameterType += "*";
}
}
else
{
parameterType = GetTypeName(parameter.Type, asPointer);
}
}
parameterType = NormalizeTypeName(writer.Api, parameterType);
string parameterName = parameter.Name;
bool isOptional = parameter.Attrs.Any(item => item is string str && str == "Optional");
if (parameter.Attrs.Any(item => item is string str && str == "ComOutPtr"))
{
if (!IsPrimitive(parameter.Type))
{
parameterType += "*";
}
}
else if (parameterType.EndsWith("**") == false &&
parameter.Attrs.Any(item => item is string str && (str == "RetVal" || str == "Out")))
{
if (parameter.Type.Child == null)
{
//if (!IsPrimitive(parameter.Type))
//{
// parameterType += "*";
//}
}
else if (parameter.Type.Child.Kind != "ApiRef")
{
if (!IsPrimitive(parameter.Type))
{
parameterType += "*";
}
}
else
{
string apiName = GetApiName(parameter.Type.Child);
string fullTypeName = $"{apiName}.{parameter.Type.Child.Name}";
if (!IsPrimitive(parameter.Type) && !IsStruct(fullTypeName) && !IsEnum(fullTypeName))
{
parameterType += "*";
}
}
}
parameterName = CleanupName(parameterName);
parameterType = NormalizeTypeName(writer.Api, parameterType);
argumentBuilder.Append(parameterType).Append(' ').Append(parameterName);
if (allOptional == true && isOptional == true)
if (method.Name == "EndDraw")
{
argumentBuilder.Append(" = null");
}
@@ -2215,6 +2142,102 @@ public static class Program
s_visitedComTypes.Add($"{writer.Api}.{comType.Name}", methodsToGenerate);
}
private static void GetParameterSignature(
ApiData api,
CodeWriter writer,
ApiParameter parameter,
string memberLookup,
out string parameterType,
out string parameterName)
{
bool asPointer = false;
parameterType = string.Empty;
if (parameter.Type.Kind == "ApiRef")
{
if (parameter.Type.TargetKind == "FunctionPointer")
{
ApiType functionType = api.Types.First(item => item.Name == parameter.Type.Name && item.Kind == "FunctionPointer");
parameterType = WriteFunction(writer, api, functionType, parameter.Name, true, true, true);
}
else
{
string fullTypeName = $"{parameter.Type.Api}.{parameter.Type.Name}";
if (!IsPrimitive(parameter.Type) && !IsEnum(fullTypeName))
{
asPointer = true;
}
}
}
if (string.IsNullOrEmpty(parameterType))
{
if (string.IsNullOrEmpty(memberLookup) == false)
{
string parameterNameLookup = $"{memberLookup}::{parameter.Name}";
if (s_mapFunctionParameters.TryGetValue(parameterNameLookup, out string? remapType))
{
parameterType = GetTypeName($"{writer.Api}.{remapType}");
if (parameter.Attrs.Any(item => item is string str && str == "Out"))
{
parameterType += "*";
}
}
else
{
parameterType = GetTypeName(parameter.Type, asPointer);
}
}
else
{
parameterType = GetTypeName(parameter.Type, asPointer);
}
}
parameterType = NormalizeTypeName(writer.Api, parameterType);
bool isOptional = parameter.Attrs.Any(item => item is string str && str == "Optional");
if (parameter.Attrs.Any(item => item is string str && str == "ComOutPtr"))
{
if (!IsPrimitive(parameter.Type))
{
parameterType += "*";
}
}
else if (parameterType.EndsWith("**") == false &&
parameter.Attrs.Any(item => item is string str && (str == "RetVal" || str == "Out")))
{
if (parameter.Type.Child == null)
{
//if (!IsPrimitive(parameter.Type))
//{
// parameterType += "*";
//}
}
else if (parameter.Type.Child.Kind != "ApiRef")
{
if (!IsPrimitive(parameter.Type))
{
parameterType += "*";
}
}
else
{
string apiName = GetApiName(parameter.Type.Child);
string fullTypeName = $"{apiName}.{parameter.Type.Child.Name}";
if (!IsPrimitive(parameter.Type) && !IsStruct(fullTypeName) && !IsEnum(fullTypeName))
{
parameterType += "*";
}
}
}
parameterType = NormalizeTypeName(writer.Api, parameterType);
parameterName = parameter.Name;
parameterName = CleanupName(parameterName);
}
private static bool ShouldSkipConstant(ApiDataConstant constant)
{
if (constant.Name == "_FACDXGI" ||

View File

@@ -5500,10 +5500,10 @@ public static unsafe partial class Apis
public static extern Bool32 D2D1InvertMatrix(Matrix3x2* matrix);
[DllImport("d2d1", ExactSpelling = true)]
public static extern HResult D2D1CreateDevice(Graphics.Dxgi.IDXGIDevice* dxgiDevice, CreationProperties* creationProperties, ID2D1Device* d2dDevice);
public static extern HResult D2D1CreateDevice(Graphics.Dxgi.IDXGIDevice* dxgiDevice, CreationProperties* creationProperties, ID2D1Device** d2dDevice);
[DllImport("d2d1", ExactSpelling = true)]
public static extern HResult D2D1CreateDeviceContext(Graphics.Dxgi.IDXGISurface* dxgiSurface, CreationProperties* creationProperties, ID2D1DeviceContext* d2dDeviceContext);
public static extern HResult D2D1CreateDeviceContext(Graphics.Dxgi.IDXGISurface* dxgiSurface, CreationProperties* creationProperties, ID2D1DeviceContext** d2dDeviceContext);
[DllImport("d2d1", ExactSpelling = true)]
public static extern Color4 D2D1ConvertColorSpace(ColorSpace sourceColorSpace, ColorSpace destinationColorSpace, Color4* color);

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory1
/// <include file='../../Direct2D.xml' path='doc/member[@name="ID2D1Factory1::RegisterEffectFromStream"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory1*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory1*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <include file='../../Direct2D.xml' path='doc/member[@name="ID2D1Factory1::RegisterEffectFromString"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory1*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory1*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <include file='../../Direct2D.xml' path='doc/member[@name="ID2D1Factory1::UnregisterEffect"]/*' />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory2
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory2*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory2*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory2*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory2*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory2*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory2*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory2*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory2*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory3
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory3*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory3*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory3*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory3*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory3*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory3*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory3*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory3*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory4
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory4*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory4*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory4*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory4*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory4*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory4*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory4*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory4*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory5
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory5*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory5*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory5*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory5*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory5*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory5*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory5*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory5*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory6
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory6*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory6*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory6*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory6*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory6*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory6*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory6*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory6*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -230,17 +230,17 @@ public unsafe partial struct ID2D1Factory7
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(22)]
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromStream(Guid* classId, Com.IStream* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory7*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[22]))((ID2D1Factory7*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory7*, Guid*, Com.IStream*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[22]))((ID2D1Factory7*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.RegisterEffectFromString" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(23)]
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<void*, void> effectFactory)
public HResult RegisterEffectFromString(Guid* classId, ushort* propertyXml, PropertyBinding* bindings, uint bindingsCount, delegate* unmanaged[Stdcall]<IUnknown**, HResult> effectFactory)
{
return ((delegate* unmanaged[Stdcall]<ID2D1Factory7*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<void*, void>, int>)(lpVtbl[23]))((ID2D1Factory7*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
return ((delegate* unmanaged[Stdcall]<ID2D1Factory7*, Guid*, ushort*, PropertyBinding*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HResult>, int>)(lpVtbl[23]))((ID2D1Factory7*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
}
/// <inheritdoc cref="ID2D1Factory1.UnregisterEffect" />

View File

@@ -2289,7 +2289,7 @@ public enum ClearFlags : int
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_COMPARISON_FUNC"]/*' />
/// <unmanaged>D3D11_COMPARISON_FUNC</unmanaged>
public enum ComparisonFunc : int
public enum ComparisonFunction : int
{
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_COMPARISON_FUNC::D3D11_COMPARISON_NEVER"]/*' />
/// <unmanaged>D3D11_COMPARISON_NEVER</unmanaged>
@@ -2331,7 +2331,7 @@ public enum DepthWriteMask : int
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP"]/*' />
/// <unmanaged>D3D11_STENCIL_OP</unmanaged>
public enum StencilOp : int
public enum StencilOperation : int
{
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_STENCIL_OP::D3D11_STENCIL_OP_KEEP"]/*' />
/// <unmanaged>D3D11_STENCIL_OP_KEEP</unmanaged>
@@ -2418,7 +2418,7 @@ public enum Blend : int
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND_OP"]/*' />
/// <unmanaged>D3D11_BLEND_OP</unmanaged>
public enum BlendOp : int
public enum BlendOperation : int
{
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_BLEND_OP::D3D11_BLEND_OP_ADD"]/*' />
/// <unmanaged>D3D11_BLEND_OP_ADD</unmanaged>
@@ -7898,7 +7898,7 @@ public enum CopyFlags : int
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_LOGIC_OP"]/*' />
/// <unmanaged>D3D11_LOGIC_OP</unmanaged>
public enum LogicOp : int
public enum LogicOperation : int
{
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_LOGIC_OP::D3D11_LOGIC_OP_CLEAR"]/*' />
/// <unmanaged>D3D11_LOGIC_OP_CLEAR</unmanaged>
@@ -8544,19 +8544,19 @@ public partial struct Box
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCILOP_DESC"]/*' />
/// <unmanaged>D3D11_DEPTH_STENCILOP_DESC</unmanaged>
public partial struct DepthStencilOpDescription
public partial struct DepthStencilOperationDescription
{
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCILOP_DESC::StencilFailOp"]/*' />
public StencilOp StencilFailOp;
public StencilOperation StencilFailOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCILOP_DESC::StencilDepthFailOp"]/*' />
public StencilOp StencilDepthFailOp;
public StencilOperation StencilDepthFailOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCILOP_DESC::StencilPassOp"]/*' />
public StencilOp StencilPassOp;
public StencilOperation StencilPassOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCILOP_DESC::StencilFunc"]/*' />
public ComparisonFunc StencilFunc;
public ComparisonFunction StencilFunc;
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCIL_DESC"]/*' />
@@ -8570,7 +8570,7 @@ public partial struct DepthStencilDescription
public DepthWriteMask DepthWriteMask;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCIL_DESC::DepthFunc"]/*' />
public ComparisonFunc DepthFunc;
public ComparisonFunction DepthFunc;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCIL_DESC::StencilEnable"]/*' />
public Bool32 StencilEnable;
@@ -8582,10 +8582,10 @@ public partial struct DepthStencilDescription
public byte StencilWriteMask;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCIL_DESC::FrontFace"]/*' />
public DepthStencilOpDescription FrontFace;
public DepthStencilOperationDescription FrontFace;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_DEPTH_STENCIL_DESC::BackFace"]/*' />
public DepthStencilOpDescription BackFace;
public DepthStencilOperationDescription BackFace;
}
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC"]/*' />
@@ -8602,7 +8602,7 @@ public partial struct RenderTargetBlendDescription
public Blend DestBlend;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC::BlendOp"]/*' />
public BlendOp BlendOp;
public BlendOperation BlendOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC::SrcBlendAlpha"]/*' />
public Blend SrcBlendAlpha;
@@ -8611,7 +8611,7 @@ public partial struct RenderTargetBlendDescription
public Blend DestBlendAlpha;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC::BlendOpAlpha"]/*' />
public BlendOp BlendOpAlpha;
public BlendOperation BlendOpAlpha;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC::RenderTargetWriteMask"]/*' />
public ColorWriteEnable RenderTargetWriteMask;
@@ -10026,7 +10026,7 @@ public partial struct SamplerDescription
public uint MaxAnisotropy;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_SAMPLER_DESC::ComparisonFunc"]/*' />
public ComparisonFunc ComparisonFunc;
public ComparisonFunction ComparisonFunc;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_SAMPLER_DESC::BorderColor"]/*' />
public unsafe fixed float BorderColor[4];
@@ -11481,7 +11481,7 @@ public partial struct RenderTargetBlendDescription1
public Blend DestBlend;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC1::BlendOp"]/*' />
public BlendOp BlendOp;
public BlendOperation BlendOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC1::SrcBlendAlpha"]/*' />
public Blend SrcBlendAlpha;
@@ -11490,10 +11490,10 @@ public partial struct RenderTargetBlendDescription1
public Blend DestBlendAlpha;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC1::BlendOpAlpha"]/*' />
public BlendOp BlendOpAlpha;
public BlendOperation BlendOpAlpha;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC1::LogicOp"]/*' />
public LogicOp LogicOp;
public LogicOperation LogicOp;
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_RENDER_TARGET_BLEND_DESC1::RenderTargetWriteMask"]/*' />
public ColorWriteEnable RenderTargetWriteMask;

View File

@@ -831,7 +831,7 @@ public enum CullMode : int
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_COMPARISON_FUNC"]/*' />
/// <unmanaged>D3D12_COMPARISON_FUNC</unmanaged>
public enum ComparisonFunc : int
public enum ComparisonFunction : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_COMPARISON_FUNC::D3D12_COMPARISON_FUNC_NEVER"]/*' />
/// <unmanaged>D3D12_COMPARISON_FUNC_NEVER</unmanaged>
@@ -873,7 +873,7 @@ public enum DepthWriteMask : int
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_STENCIL_OP"]/*' />
/// <unmanaged>D3D12_STENCIL_OP</unmanaged>
public enum StencilOp : int
public enum StencilOperation : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_STENCIL_OP::D3D12_STENCIL_OP_KEEP"]/*' />
/// <unmanaged>D3D12_STENCIL_OP_KEEP</unmanaged>
@@ -960,7 +960,7 @@ public enum Blend : int
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_BLEND_OP"]/*' />
/// <unmanaged>D3D12_BLEND_OP</unmanaged>
public enum BlendOp : int
public enum BlendOperation : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_BLEND_OP::D3D12_BLEND_OP_ADD"]/*' />
/// <unmanaged>D3D12_BLEND_OP_ADD</unmanaged>
@@ -1004,7 +1004,7 @@ public enum ColorWriteEnable : byte
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_LOGIC_OP"]/*' />
/// <unmanaged>D3D12_LOGIC_OP</unmanaged>
public enum LogicOp : int
public enum LogicOperation : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_LOGIC_OP::D3D12_LOGIC_OP_CLEAR"]/*' />
/// <unmanaged>D3D12_LOGIC_OP_CLEAR</unmanaged>
@@ -2854,7 +2854,7 @@ public enum QueryType : int
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_PREDICATION_OP"]/*' />
/// <unmanaged>D3D12_PREDICATION_OP</unmanaged>
public enum PredicationOp : int
public enum PredicationOperation : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_PREDICATION_OP::D3D12_PREDICATION_OP_EQUAL_ZERO"]/*' />
/// <unmanaged>D3D12_PREDICATION_OP_EQUAL_ZERO</unmanaged>
@@ -3495,7 +3495,7 @@ public enum HitKind : int
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_OP"]/*' />
/// <unmanaged>D3D12_AUTO_BREADCRUMB_OP</unmanaged>
public enum AutoBreadcrumbOp : int
public enum AutoBreadcrumbOperation : int
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_OP::D3D12_AUTO_BREADCRUMB_OP_SETMARKER"]/*' />
/// <unmanaged>D3D12_AUTO_BREADCRUMB_OP_SETMARKER</unmanaged>
@@ -7016,19 +7016,19 @@ public partial struct Box
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCILOP_DESC"]/*' />
/// <unmanaged>D3D12_DEPTH_STENCILOP_DESC</unmanaged>
public partial struct DepthStencilOpDescription
public partial struct DepthStencilOperationDescription
{
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCILOP_DESC::StencilFailOp"]/*' />
public StencilOp StencilFailOp;
public StencilOperation StencilFailOp;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCILOP_DESC::StencilDepthFailOp"]/*' />
public StencilOp StencilDepthFailOp;
public StencilOperation StencilDepthFailOp;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCILOP_DESC::StencilPassOp"]/*' />
public StencilOp StencilPassOp;
public StencilOperation StencilPassOp;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCILOP_DESC::StencilFunc"]/*' />
public ComparisonFunc StencilFunc;
public ComparisonFunction StencilFunc;
}
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC"]/*' />
@@ -7042,7 +7042,7 @@ public partial struct DepthStencilDescription
public DepthWriteMask DepthWriteMask;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC::DepthFunc"]/*' />
public ComparisonFunc DepthFunc;
public ComparisonFunction DepthFunc;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC::StencilEnable"]/*' />
public Bool32 StencilEnable;
@@ -7054,10 +7054,10 @@ public partial struct DepthStencilDescription
public byte StencilWriteMask;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC::FrontFace"]/*' />
public DepthStencilOpDescription FrontFace;
public DepthStencilOperationDescription FrontFace;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC::BackFace"]/*' />
public DepthStencilOpDescription BackFace;
public DepthStencilOperationDescription BackFace;
}
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1"]/*' />
@@ -7071,7 +7071,7 @@ public partial struct DepthStencilDescription1
public DepthWriteMask DepthWriteMask;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1::DepthFunc"]/*' />
public ComparisonFunc DepthFunc;
public ComparisonFunction DepthFunc;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1::StencilEnable"]/*' />
public Bool32 StencilEnable;
@@ -7083,10 +7083,10 @@ public partial struct DepthStencilDescription1
public byte StencilWriteMask;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1::FrontFace"]/*' />
public DepthStencilOpDescription FrontFace;
public DepthStencilOperationDescription FrontFace;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1::BackFace"]/*' />
public DepthStencilOpDescription BackFace;
public DepthStencilOperationDescription BackFace;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_DEPTH_STENCIL_DESC1::DepthBoundsTestEnable"]/*' />
public Bool32 DepthBoundsTestEnable;
@@ -7109,7 +7109,7 @@ public partial struct RenderTargetBlendDescription
public Blend DestBlend;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_TARGET_BLEND_DESC::BlendOp"]/*' />
public BlendOp BlendOp;
public BlendOperation BlendOp;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_TARGET_BLEND_DESC::SrcBlendAlpha"]/*' />
public Blend SrcBlendAlpha;
@@ -7118,10 +7118,10 @@ public partial struct RenderTargetBlendDescription
public Blend DestBlendAlpha;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_TARGET_BLEND_DESC::BlendOpAlpha"]/*' />
public BlendOp BlendOpAlpha;
public BlendOperation BlendOpAlpha;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_TARGET_BLEND_DESC::LogicOp"]/*' />
public LogicOp LogicOp;
public LogicOperation LogicOp;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_TARGET_BLEND_DESC::RenderTargetWriteMask"]/*' />
public ColorWriteEnable RenderTargetWriteMask;
@@ -8839,7 +8839,7 @@ public partial struct SamplerDescription
public uint MaxAnisotropy;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_SAMPLER_DESC::ComparisonFunc"]/*' />
public ComparisonFunc ComparisonFunc;
public ComparisonFunction ComparisonFunc;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_SAMPLER_DESC::BorderColor"]/*' />
public unsafe fixed float BorderColor[4];
@@ -9681,7 +9681,7 @@ public partial struct StaticSamplerDescription
public uint MaxAnisotropy;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_STATIC_SAMPLER_DESC::ComparisonFunc"]/*' />
public ComparisonFunc ComparisonFunc;
public ComparisonFunction ComparisonFunc;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_STATIC_SAMPLER_DESC::BorderColor"]/*' />
public StaticBorderColor BorderColor;
@@ -10950,7 +10950,7 @@ public partial struct AutoBreadcrumbNode
public unsafe uint* pLastBreadcrumbValue;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE::pCommandHistory"]/*' />
public unsafe AutoBreadcrumbOp* pCommandHistory;
public unsafe AutoBreadcrumbOperation* pCommandHistory;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE::pNext"]/*' />
public unsafe AutoBreadcrumbNode* pNext;
@@ -10996,7 +10996,7 @@ public partial struct AutoBreadcrumbNode1
public unsafe uint* pLastBreadcrumbValue;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE1::pCommandHistory"]/*' />
public unsafe AutoBreadcrumbOp* pCommandHistory;
public unsafe AutoBreadcrumbOperation* pCommandHistory;
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE1::pNext"]/*' />
public unsafe AutoBreadcrumbNode1* pNext;
@@ -12058,13 +12058,13 @@ public partial struct ParameterDescription
public static unsafe partial class Apis
{
[DllImport("d3d12", ExactSpelling = true)]
public static extern HResult D3D12SerializeRootSignature(RootSignatureDescription* pRootSignature, RootSignatureVersion Version, Graphics.Direct3D.ID3DBlob* ppBlob, Graphics.Direct3D.ID3DBlob* ppErrorBlob);
public static extern HResult D3D12SerializeRootSignature(RootSignatureDescription* pRootSignature, RootSignatureVersion Version, Graphics.Direct3D.ID3DBlob** ppBlob, Graphics.Direct3D.ID3DBlob** ppErrorBlob);
[DllImport("d3d12", ExactSpelling = true)]
public static extern HResult D3D12CreateRootSignatureDeserializer(void* pSrcData, nuint SrcDataSizeInBytes, Guid* pRootSignatureDeserializerInterface, void** ppRootSignatureDeserializer);
[DllImport("d3d12", ExactSpelling = true)]
public static extern HResult D3D12SerializeVersionedRootSignature(VersionedRootSignatureDescription* pRootSignature, Graphics.Direct3D.ID3DBlob* ppBlob, Graphics.Direct3D.ID3DBlob* ppErrorBlob);
public static extern HResult D3D12SerializeVersionedRootSignature(VersionedRootSignatureDescription* pRootSignature, Graphics.Direct3D.ID3DBlob** ppBlob, Graphics.Direct3D.ID3DBlob** ppErrorBlob);
[DllImport("d3d12", ExactSpelling = true)]
public static extern HResult D3D12CreateVersionedRootSignatureDeserializer(void* pSrcData, nuint SrcDataSizeInBytes, Guid* pRootSignatureDeserializerInterface, void** ppRootSignatureDeserializer);

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList
/// <include file='../../Direct3D12.xml' path='doc/member[@name="ID3D12GraphicsCommandList::SetPredication"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <include file='../../Direct3D12.xml' path='doc/member[@name="ID3D12GraphicsCommandList::SetMarker"]/*' />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList1
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList1*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList1*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList1*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList1*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList2
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList2*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList2*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList2*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList2*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList3
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList3*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList3*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList3*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList3*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList4
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList4*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList4*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList4*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList4*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList5
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList5*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList5*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList5*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList5*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -494,9 +494,9 @@ public unsafe partial struct ID3D12GraphicsCommandList6
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetPredication" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(55)]
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOp Operation)
public void SetPredication(ID3D12Resource* pBuffer, ulong AlignedBufferOffset, PredicationOperation Operation)
{
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList6*, ID3D12Resource*, ulong, PredicationOp, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList6*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
((delegate* unmanaged[Stdcall]<ID3D12GraphicsCommandList6*, ID3D12Resource*, ulong, PredicationOperation, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList6*)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
}
/// <inheritdoc cref="ID3D12GraphicsCommandList.SetMarker" />

View File

@@ -358,9 +358,9 @@ public unsafe partial struct ID3D12InfoQueue1
/// <include file='../../Direct3D12.xml' path='doc/member[@name="ID3D12InfoQueue1::RegisterMessageCallback"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(38)]
public HResult RegisterMessageCallback(delegate* unmanaged[Stdcall]<void*, void> CallbackFunc, MessageCallbackFlags CallbackFilterFlags, void* pContext, uint* pCallbackCookie)
public HResult RegisterMessageCallback(delegate* unmanaged[Stdcall]<MessageCategory, MessageSeverity, MessageId, sbyte*, void*, void> CallbackFunc, MessageCallbackFlags CallbackFilterFlags, void* pContext, uint* pCallbackCookie)
{
return ((delegate* unmanaged[Stdcall]<ID3D12InfoQueue1*, delegate* unmanaged[Stdcall]<void*, void>, MessageCallbackFlags, void*, uint*, int>)(lpVtbl[38]))((ID3D12InfoQueue1*)Unsafe.AsPointer(ref this), CallbackFunc, CallbackFilterFlags, pContext, pCallbackCookie);
return ((delegate* unmanaged[Stdcall]<ID3D12InfoQueue1*, delegate* unmanaged[Stdcall]<MessageCategory, MessageSeverity, MessageId, sbyte*, void*, void>, MessageCallbackFlags, void*, uint*, int>)(lpVtbl[38]))((ID3D12InfoQueue1*)Unsafe.AsPointer(ref this), CallbackFunc, CallbackFilterFlags, pContext, pCallbackCookie);
}
/// <include file='../../Direct3D12.xml' path='doc/member[@name="ID3D12InfoQueue1::UnregisterMessageCallback"]/*' />

View File

@@ -7788,13 +7788,13 @@ public partial struct WICMetadataHeader
public static unsafe partial class Apis
{
[DllImport("WindowsCodecs", ExactSpelling = true)]
public static extern HResult WICConvertBitmapSource(Guid* dstFormat, IWICBitmapSource* pISrc, IWICBitmapSource* ppIDst);
public static extern HResult WICConvertBitmapSource(Guid* dstFormat, IWICBitmapSource* pISrc, IWICBitmapSource** ppIDst);
[DllImport("WindowsCodecs", ExactSpelling = true)]
public static extern HResult WICCreateBitmapFromSection(uint width, uint height, Guid* pixelFormat, Handle hSection, uint stride, uint offset, IWICBitmap* ppIBitmap);
public static extern HResult WICCreateBitmapFromSection(uint width, uint height, Guid* pixelFormat, Handle hSection, uint stride, uint offset, IWICBitmap** ppIBitmap);
[DllImport("WindowsCodecs", ExactSpelling = true)]
public static extern HResult WICCreateBitmapFromSectionEx(uint width, uint height, Guid* pixelFormat, Handle hSection, uint stride, uint offset, WICSectionAccessLevel desiredAccessLevel, IWICBitmap* ppIBitmap);
public static extern HResult WICCreateBitmapFromSectionEx(uint width, uint height, Guid* pixelFormat, Handle hSection, uint stride, uint offset, WICSectionAccessLevel desiredAccessLevel, IWICBitmap** ppIBitmap);
[DllImport("WindowsCodecs", ExactSpelling = true)]
public static extern HResult WICMapGuidToShortName(Guid* guid, uint cchName, ushort* wzName, uint* pcchActual);

View File

@@ -78,9 +78,9 @@ public unsafe partial struct IWICBitmapCodecProgressNotification
/// <include file='../../Imaging.xml' path='doc/member[@name="IWICBitmapCodecProgressNotification::RegisterProgressNotification"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(3)]
public HResult RegisterProgressNotification(delegate* unmanaged[Stdcall]<void*, void> pfnProgressNotification, void* pvData, uint dwProgressFlags)
public HResult RegisterProgressNotification(delegate* unmanaged[Stdcall]<void*, uint, WICProgressOperation, double, HResult> pfnProgressNotification, void* pvData, uint dwProgressFlags)
{
return ((delegate* unmanaged[Stdcall]<IWICBitmapCodecProgressNotification*, delegate* unmanaged[Stdcall]<void*, void>, void*, uint, int>)(lpVtbl[3]))((IWICBitmapCodecProgressNotification*)Unsafe.AsPointer(ref this), pfnProgressNotification, pvData, dwProgressFlags);
return ((delegate* unmanaged[Stdcall]<IWICBitmapCodecProgressNotification*, delegate* unmanaged[Stdcall]<void*, uint, WICProgressOperation, double, HResult>, void*, uint, int>)(lpVtbl[3]))((IWICBitmapCodecProgressNotification*)Unsafe.AsPointer(ref this), pfnProgressNotification, pvData, dwProgressFlags);
}
}

View File

@@ -54,10 +54,10 @@ public unsafe partial struct BlendDescription
{
RenderTarget[i].SrcBlend = sourceBlend;
RenderTarget[i].DestBlend = destinationBlend;
RenderTarget[i].BlendOp = BlendOp.Add;
RenderTarget[i].BlendOp = BlendOperation.Add;
RenderTarget[i].SrcBlendAlpha = srcBlendAlpha;
RenderTarget[i].DestBlendAlpha = destBlendAlpha;
RenderTarget[i].BlendOpAlpha = BlendOp.Add;
RenderTarget[i].BlendOpAlpha = BlendOperation.Add;
RenderTarget[i].RenderTargetWriteMask = ColorWriteEnable.All;
RenderTarget[i].BlendEnable = IsBlendEnabled(ref RenderTarget[i]);
}
@@ -65,10 +65,10 @@ public unsafe partial struct BlendDescription
private static bool IsBlendEnabled(ref RenderTargetBlendDescription renderTarget)
{
return renderTarget.BlendOp != BlendOp.Add
return renderTarget.BlendOp != BlendOperation.Add
|| renderTarget.SrcBlend != Blend.One
|| renderTarget.DestBlendAlpha != Blend.Zero
|| renderTarget.BlendOp != BlendOp.Add
|| renderTarget.BlendOp != BlendOperation.Add
|| renderTarget.SrcBlend != Blend.One
|| renderTarget.DestBlend != Blend.Zero;
}

View File

@@ -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 BlendDescription NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha);
public static readonly BlendDescription1 NonPremultiplied = new(Blend.SrcAlpha, Blend.InvSrcAlpha);
/// <summary>
/// Initializes a new instance of the <see cref="BlendDescription1"/> struct.
@@ -54,11 +54,11 @@ public unsafe partial struct BlendDescription1
{
RenderTarget[i].SrcBlend = sourceBlend;
RenderTarget[i].DestBlend = destinationBlend;
RenderTarget[i].BlendOp = BlendOp.Add;
RenderTarget[i].BlendOp = BlendOperation.Add;
RenderTarget[i].SrcBlendAlpha = srcBlendAlpha;
RenderTarget[i].DestBlendAlpha = destBlendAlpha;
RenderTarget[i].BlendOpAlpha = BlendOp.Add;
RenderTarget[i].LogicOp = LogicOp.Noop;
RenderTarget[i].BlendOpAlpha = BlendOperation.Add;
RenderTarget[i].LogicOp = LogicOperation.Noop;
RenderTarget[i].RenderTargetWriteMask = ColorWriteEnable.All;
RenderTarget[i].BlendEnable = IsBlendEnabled(ref RenderTarget[i]);
}
@@ -66,10 +66,10 @@ public unsafe partial struct BlendDescription1
private static bool IsBlendEnabled(ref RenderTargetBlendDescription1 renderTarget)
{
return renderTarget.BlendOp != BlendOp.Add
return renderTarget.BlendOp != BlendOperation.Add
|| renderTarget.SrcBlend != Blend.One
|| renderTarget.DestBlendAlpha != Blend.Zero
|| renderTarget.BlendOp != BlendOp.Add
|| renderTarget.BlendOp != BlendOperation.Add
|| renderTarget.SrcBlend != Blend.One
|| renderTarget.DestBlend != Blend.Zero;
}

View File

@@ -25,12 +25,12 @@ public unsafe partial struct DepthStencilDescription
/// <summary>
/// A built-in description with settings for using a reverse depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription DepthReverseZ = new(true, DepthWriteMask.All, ComparisonFunc.GreaterEqual);
public static readonly DepthStencilDescription DepthReverseZ = new(true, DepthWriteMask.All, ComparisonFunction.GreaterEqual);
/// <summary>
/// A built-in description with settings for enabling a read-only reverse depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription DepthReadReverseZ = new(true, DepthWriteMask.Zero, ComparisonFunc.GreaterEqual);
public static readonly DepthStencilDescription DepthReadReverseZ = new(true, DepthWriteMask.Zero, ComparisonFunction.GreaterEqual);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilDescription"/> struct.
@@ -38,7 +38,10 @@ public unsafe partial struct DepthStencilDescription
/// <param name="depthEnable">Enable depth testing.</param>
/// <param name="depthWriteMask">Identify a portion of the depth-stencil buffer that can be modified by depth data.</param>
/// <param name="depthFunc">A function that compares depth data against existing depth data. </param>
public DepthStencilDescription(bool depthEnable, DepthWriteMask depthWriteMask, ComparisonFunc depthFunc = ComparisonFunc.LessEqual)
public DepthStencilDescription(
bool depthEnable,
DepthWriteMask depthWriteMask,
ComparisonFunction depthFunc = ComparisonFunction.LessEqual)
{
DepthEnable = depthEnable;
DepthWriteMask = depthWriteMask;
@@ -46,8 +49,8 @@ public unsafe partial struct DepthStencilDescription
StencilEnable = false;
StencilReadMask = (byte)D3D11_DEFAULT_STENCIL_READ_MASK;
StencilWriteMask = (byte)D3D11_DEFAULT_STENCIL_WRITE_MASK;
FrontFace = DepthStencilOpDescription.Default;
BackFace = DepthStencilOpDescription.Default;
FrontFace = DepthStencilOperationDescription.Default;
BackFace = DepthStencilOperationDescription.Default;
}
/// <summary>
@@ -70,18 +73,18 @@ public unsafe partial struct DepthStencilDescription
public DepthStencilDescription(
bool depthEnable,
bool depthWriteEnable,
ComparisonFunc depthFunc,
ComparisonFunction depthFunc,
bool stencilEnable,
byte stencilReadMask,
byte stencilWriteMask,
StencilOp frontStencilFailOp,
StencilOp frontStencilDepthFailOp,
StencilOp frontStencilPassOp,
ComparisonFunc frontStencilFunc,
StencilOp backStencilFailOp,
StencilOp backStencilDepthFailOp,
StencilOp backStencilPassOp,
ComparisonFunc backStencilFunc)
StencilOperation frontStencilFailOp,
StencilOperation frontStencilDepthFailOp,
StencilOperation frontStencilPassOp,
ComparisonFunction frontStencilFunc,
StencilOperation backStencilFailOp,
StencilOperation backStencilDepthFailOp,
StencilOperation backStencilPassOp,
ComparisonFunction backStencilFunc)
{
DepthEnable = depthEnable;
DepthWriteMask = depthWriteEnable ? DepthWriteMask.All : DepthWriteMask.Zero;

View File

@@ -1,27 +0,0 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Direct3D11;
public unsafe partial struct DepthStencilOpDescription
{
/// <summary>
/// A built-in description with default values.
/// </summary>
public static readonly DepthStencilOpDescription Default = new(StencilOp.Keep, StencilOp.Keep, StencilOp.Keep, ComparisonFunc.Always);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilOpDescription"/> struct.
/// </summary>
/// <param name="stencilFailOp">A <see cref="StencilOp"/> value that identifies the stencil operation to perform when stencil testing fails.</param>
/// <param name="stencilDepthFailOp">A <see cref="StencilOp"/> value that identifies the stencil operation to perform when stencil testing passes and depth testing fails.</param>
/// <param name="stencilPassOp">A <see cref="StencilOp"/> value that identifies the stencil operation to perform when stencil testing and depth testing both pass.</param>
/// <param name="stencilFunc">A <see cref="ComparisonFunc"/> value that identifies the function that compares stencil data against existing stencil data.</param>
public DepthStencilOpDescription(StencilOp stencilFailOp, StencilOp stencilDepthFailOp, StencilOp stencilPassOp, ComparisonFunc stencilFunc)
{
StencilFailOp = stencilFailOp;
StencilDepthFailOp = stencilDepthFailOp;
StencilPassOp = stencilPassOp;
StencilFunc = stencilFunc;
}
}

View File

@@ -0,0 +1,27 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Win32.Graphics.Direct3D11;
public unsafe partial struct DepthStencilOperationDescription
{
/// <summary>
/// A built-in description with default values.
/// </summary>
public static readonly DepthStencilOperationDescription Default = new(StencilOperation.Keep, StencilOperation.Keep, StencilOperation.Keep, ComparisonFunction.Always);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilOperationDescription"/> struct.
/// </summary>
/// <param name="stencilFailOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing fails.</param>
/// <param name="stencilDepthFailOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing passes and depth testing fails.</param>
/// <param name="stencilPassOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing and depth testing both pass.</param>
/// <param name="stencilFunc">A <see cref="ComparisonFunc"/> value that identifies the function that compares stencil data against existing stencil data.</param>
public DepthStencilOperationDescription(StencilOperation stencilFailOp, StencilOperation stencilDepthFailOp, StencilOperation stencilPassOp, ComparisonFunction stencilFunc)
{
StencilFailOp = stencilFailOp;
StencilDepthFailOp = stencilDepthFailOp;
StencilPassOp = stencilPassOp;
StencilFunc = stencilFunc;
}
}

View File

@@ -1,7 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using System.Xml.Serialization;
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D11;

View File

@@ -1,9 +1,9 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D11.Apis;
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D11;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct SamplerDescription
{
@@ -13,8 +13,8 @@ public unsafe partial struct SamplerDescription
public static readonly SamplerDescription LinearWrap = new(Filter.MinMagMipLinear, TextureAddressMode.Wrap);
public static readonly SamplerDescription LinearClamp = new(Filter.MinMagMipLinear, TextureAddressMode.Clamp);
public static readonly SamplerDescription AnisotropicWrap = new(Filter.Anisotropic, TextureAddressMode.Wrap, 0.0f, D3D11_MAX_MAXANISOTROPY);
public static readonly SamplerDescription AnisotropicClamp = new(Filter.Anisotropic, TextureAddressMode.Clamp, 0.0f, D3D11_MAX_MAXANISOTROPY);
public static readonly SamplerDescription AnisotropicWrap = new(Filter.Anisotropic, TextureAddressMode.Wrap, 0.0f, D3D12_MAX_MAXANISOTROPY);
public static readonly SamplerDescription AnisotropicClamp = new(Filter.Anisotropic, TextureAddressMode.Clamp, 0.0f, D3D12_MAX_MAXANISOTROPY);
/// <summary>
/// Initializes a new instance of the <see cref="SamplerDescription"/> struct.
@@ -36,7 +36,7 @@ public unsafe partial struct SamplerDescription
TextureAddressMode addressW,
float mipLODBias,
uint maxAnisotropy,
ComparisonFunc comparisonFunction,
ComparisonFunction comparisonFunction,
Color4 borderColor,
float minLOD,
float maxLOD)
@@ -75,7 +75,7 @@ public unsafe partial struct SamplerDescription
TextureAddressMode addressW,
float mipLODBias = 0.0f,
uint maxAnisotropy = 1,
ComparisonFunc comparisonFunction = ComparisonFunc.Never,
ComparisonFunction comparisonFunction = ComparisonFunction.Never,
float minLOD = float.MinValue,
float maxLOD = float.MaxValue)
{
@@ -109,7 +109,7 @@ public unsafe partial struct SamplerDescription
TextureAddressMode address,
float mipLODBias = 0.0f,
uint maxAnisotropy = 1,
ComparisonFunc comparisonFunction = ComparisonFunc.Never,
ComparisonFunction comparisonFunction = ComparisonFunction.Never,
float minLOD = float.MinValue,
float maxLOD = float.MaxValue)
{

View File

@@ -1,7 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using System.Xml.Serialization;
using Win32.Graphics.Direct3D;
using Win32.Graphics.Dxgi.Common;

View File

@@ -1,7 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using System.Xml.Serialization;
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D11;

View File

@@ -5,6 +5,7 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Direct3D;
using Win32.Graphics.Dxgi.Common;
using static Win32.Apis;
@@ -381,4 +382,133 @@ public static unsafe partial class Apis
return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pResourceData, pSrcData);
}
public static ID3D12CommandList** CommandListCast([NativeTypeName("ID3D12GraphicsCommandList * const *")] ID3D12GraphicsCommandList** pp)
{
return (ID3D12CommandList**)pp;
}
public static HResult D3D12SerializeVersionedRootSignature(
VersionedRootSignatureDescription* pRootSignatureDesc,
RootSignatureVersion MaxVersion,
ID3DBlob** ppBlob,
ID3DBlob** ppErrorBlob)
{
if (ppErrorBlob != null)
{
*ppErrorBlob = null;
}
switch (MaxVersion)
{
case RootSignatureVersion.V1_0:
switch (pRootSignatureDesc->Version)
{
case RootSignatureVersion.V1_0:
return D3D12SerializeRootSignature(&pRootSignatureDesc->Anonymous.Desc_1_0, RootSignatureVersion.V1_0, ppBlob, ppErrorBlob);
case RootSignatureVersion.V1_1:
{
HResult hr = HResult.Ok;
ref readonly RootSignatureDescription1 desc_1_1 = ref pRootSignatureDesc->Anonymous.Desc_1_1;
nuint ParametersSize = (uint)sizeof(RootParameter) * desc_1_1.NumParameters;
void* pParameters = ((ulong)ParametersSize > 0) ? HeapAlloc(GetProcessHeap(), 0, ParametersSize) : null;
if ((ulong)ParametersSize > 0 && pParameters == null)
{
hr = HResult.OutOfMemory;
}
var pParameters_1_0 = (RootParameter*)pParameters;
if (hr.Success)
{
for (uint n = 0; n < desc_1_1.NumParameters; n++)
{
Debug.Assert((long)ParametersSize == (sizeof(RootParameter) * desc_1_1.NumParameters));
pParameters_1_0[n].ParameterType = desc_1_1.pParameters[n].ParameterType;
pParameters_1_0[n].ShaderVisibility = desc_1_1.pParameters[n].ShaderVisibility;
switch (desc_1_1.pParameters[n].ParameterType)
{
case RootParameterType.T32BitConstants:
pParameters_1_0[n].Anonymous.Constants.Num32BitValues = desc_1_1.pParameters[n].Anonymous.Constants.Num32BitValues;
pParameters_1_0[n].Anonymous.Constants.RegisterSpace = desc_1_1.pParameters[n].Anonymous.Constants.RegisterSpace;
pParameters_1_0[n].Anonymous.Constants.ShaderRegister = desc_1_1.pParameters[n].Anonymous.Constants.ShaderRegister;
break;
case RootParameterType.Cbv:
case RootParameterType.Srv:
case RootParameterType.Uav:
pParameters_1_0[n].Anonymous.Descriptor.RegisterSpace = desc_1_1.pParameters[n].Anonymous.Descriptor.RegisterSpace;
pParameters_1_0[n].Anonymous.Descriptor.ShaderRegister = desc_1_1.pParameters[n].Anonymous.Descriptor.ShaderRegister;
break;
case RootParameterType.DescriptorTable:
ref readonly RootDescriptorTable1 table_1_1 = ref desc_1_1.pParameters[n].Anonymous.DescriptorTable;
nuint DescriptorRangesSize = (uint)sizeof(DescriptorRange) * table_1_1.NumDescriptorRanges;
void* pDescriptorRanges = ((ulong)DescriptorRangesSize > 0 && hr.Success) ? HeapAlloc(GetProcessHeap(), 0, DescriptorRangesSize) : null;
if ((ulong)DescriptorRangesSize > 0 && pDescriptorRanges == null)
{
hr = HResult.OutOfMemory;
}
var pDescriptorRanges_1_0 = (DescriptorRange*)pDescriptorRanges;
if (hr.Success)
{
for (uint x = 0; x < table_1_1.NumDescriptorRanges; x++)
{
Debug.Assert((long)DescriptorRangesSize == (sizeof(DescriptorRange) * table_1_1.NumDescriptorRanges));
pDescriptorRanges_1_0[x].BaseShaderRegister = table_1_1.pDescriptorRanges[x].BaseShaderRegister;
pDescriptorRanges_1_0[x].NumDescriptors = table_1_1.pDescriptorRanges[x].NumDescriptors;
pDescriptorRanges_1_0[x].OffsetInDescriptorsFromTableStart = table_1_1.pDescriptorRanges[x].OffsetInDescriptorsFromTableStart;
pDescriptorRanges_1_0[x].RangeType = table_1_1.pDescriptorRanges[x].RangeType;
pDescriptorRanges_1_0[x].RegisterSpace = table_1_1.pDescriptorRanges[x].RegisterSpace;
}
}
ref RootDescriptorTable table_1_0 = ref pParameters_1_0[n].Anonymous.DescriptorTable;
table_1_0.NumDescriptorRanges = table_1_1.NumDescriptorRanges;
table_1_0.pDescriptorRanges = pDescriptorRanges_1_0;
break;
}
}
}
if (hr.Success)
{
RootSignatureDescription desc_1_0 = new RootSignatureDescription(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, desc_1_1.pStaticSamplers, desc_1_1.Flags);
hr = D3D12SerializeRootSignature(&desc_1_0, RootSignatureVersion.V1_0 , ppBlob, ppErrorBlob);
}
if (pParameters != null)
{
for (uint n = 0; n < desc_1_1.NumParameters; n++)
{
if (desc_1_1.pParameters[n].ParameterType == RootParameterType.DescriptorTable)
{
_ = HeapFree(GetProcessHeap(), 0, (void*)pParameters_1_0[n].Anonymous.DescriptorTable.pDescriptorRanges);
}
}
_ = HeapFree(GetProcessHeap(), 0, pParameters);
}
return hr;
}
}
break;
case RootSignatureVersion.V1_1:
return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
}
return HResult.InvalidArg;
}
}

View File

@@ -0,0 +1,54 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct BlendDescription
{
/// <summary>
/// A built-in description with settings for opaque blend, that is overwriting the source with the destination data.
/// </summary>
public static readonly BlendDescription Opaque = new(Blend.One, Blend.Zero);
/// <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);
/// <summary>
/// A built-in description with settings for additive blend, that is adding the destination data to the source data without using alpha.
/// </summary>
public static readonly BlendDescription Additive = new(Blend.SrcAlpha, Blend.One);
/// <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);
/// <summary>
/// Initializes a new instance of the <see cref="BlendDescription"/> struct.
/// </summary>
/// <param name="srcBlend">The source blend.</param>
/// <param name="destBlend">The destination blend.</param>
public BlendDescription(Blend srcBlend, Blend destBlend)
: this()
{
AlphaToCoverageEnable = false;
IndependentBlendEnable = false;
for (int i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
RenderTarget[i].BlendEnable = srcBlend != Blend.One || destBlend != Blend.Zero;
RenderTarget[i].LogicOp = LogicOperation.Noop;
RenderTarget[i].SrcBlend = srcBlend;
RenderTarget[i].DestBlend = destBlend;
RenderTarget[i].BlendOp = BlendOperation.Add;
RenderTarget[i].SrcBlendAlpha = srcBlend;
RenderTarget[i].DestBlendAlpha = destBlend;
RenderTarget[i].BlendOpAlpha = BlendOperation.Add;
RenderTarget[i].RenderTargetWriteMask = ColorWriteEnable.All;
}
}
}

View File

@@ -0,0 +1,63 @@
// 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 unsafe partial struct CpuDescriptorHandle : IEquatable<CpuDescriptorHandle>
{
public static CpuDescriptorHandle Default => default;
public CpuDescriptorHandle(in CpuDescriptorHandle other, int offsetScaledByIncrementSize)
{
InitOffsetted(out this, other, offsetScaledByIncrementSize);
}
public CpuDescriptorHandle(in CpuDescriptorHandle other, int offsetInDescriptors, uint descriptorIncrementSize)
{
InitOffsetted(out this, other, offsetInDescriptors, descriptorIncrementSize);
}
public CpuDescriptorHandle Offset(int offsetInDescriptors, uint descriptorIncrementSize)
{
ptr = unchecked((nuint)((long)ptr + ((long)offsetInDescriptors * (long)descriptorIncrementSize)));
return this;
}
public CpuDescriptorHandle Offset(int offsetScaledByIncrementSize)
{
ptr = unchecked((nuint)((long)ptr + (long)offsetScaledByIncrementSize));
return this;
}
public static bool operator ==(in CpuDescriptorHandle left, in CpuDescriptorHandle right)
=> (left.ptr == right.ptr);
public static bool operator !=(in CpuDescriptorHandle left, in CpuDescriptorHandle right)
=> (left.ptr != right.ptr);
public void InitOffsetted(in CpuDescriptorHandle @base, int offsetScaledByIncrementSize)
{
InitOffsetted(out this, @base, offsetScaledByIncrementSize);
}
public void InitOffsetted(in CpuDescriptorHandle @base, int offsetInDescriptors, uint descriptorIncrementSize)
{
InitOffsetted(out this, @base, offsetInDescriptors, descriptorIncrementSize);
}
public static void InitOffsetted(out CpuDescriptorHandle handle, in CpuDescriptorHandle @base, int offsetScaledByIncrementSize)
{
handle.ptr = (nuint)((long)@base.ptr + (long)offsetScaledByIncrementSize);
}
public static void InitOffsetted(out CpuDescriptorHandle handle, in CpuDescriptorHandle @base, int offsetInDescriptors, uint descriptorIncrementSize)
{
handle.ptr = (nuint)((long)@base.ptr + ((long)offsetInDescriptors * (long)descriptorIncrementSize));
}
public override bool Equals(object? obj) => (obj is CpuDescriptorHandle other) && Equals(other);
public bool Equals(CpuDescriptorHandle other) => this == other;
public override int GetHashCode() => ptr.GetHashCode();
}

View File

@@ -0,0 +1,63 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct DepthStencilDescription
{
/// <summary>
/// A built-in description with settings for not using a depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription None = new(false, false, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with default settings for using a depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription Default = new(true, true, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with settings for enabling a read-only depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription Read = new(true, false, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with default settings for using a reverse depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription ReverseZ = new(true, true, ComparisonFunction.GreaterEqual);
/// <summary>
/// A built-in description with default settings for using a reverse read-only depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription ReadReverseZ = new(true, false, ComparisonFunction.GreaterEqual);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilDescription"/> struct.
/// </summary>
public DepthStencilDescription(
bool depthEnable,
bool depthWriteEnable,
ComparisonFunction depthFunc,
bool stencilEnable = false,
byte stencilReadMask = (byte)D3D12_DEFAULT_STENCIL_READ_MASK,
byte stencilWriteMask = (byte)D3D12_DEFAULT_STENCIL_WRITE_MASK,
StencilOperation frontStencilFailOp = StencilOperation.Keep,
StencilOperation frontStencilDepthFailOp = StencilOperation.Keep,
StencilOperation frontStencilPassOp = StencilOperation.Keep,
ComparisonFunction frontStencilFunc = ComparisonFunction.Always,
StencilOperation backStencilFailOp = StencilOperation.Keep,
StencilOperation backStencilDepthFailOp = StencilOperation.Keep,
StencilOperation backStencilPassOp = StencilOperation.Keep,
ComparisonFunction backStencilFunc = ComparisonFunction.Always)
{
DepthEnable = depthEnable;
DepthWriteMask = depthWriteEnable ? DepthWriteMask.All : DepthWriteMask.Zero;
DepthFunc = depthFunc;
StencilEnable = stencilEnable;
StencilReadMask = stencilReadMask;
StencilWriteMask = stencilWriteMask;
FrontFace = new(frontStencilFailOp, frontStencilDepthFailOp, frontStencilPassOp, frontStencilFunc);
BackFace = new(backStencilFailOp, backStencilDepthFailOp, backStencilPassOp, backStencilFunc);
}
}

View File

@@ -0,0 +1,65 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct DepthStencilDescription1
{
/// <summary>
/// A built-in description with settings for not using a depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription1 None = new(false, false, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with default settings for using a depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription1 Default = new(true, true, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with settings for enabling a read-only depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription1 Read = new(true, false, ComparisonFunction.LessEqual);
/// <summary>
/// A built-in description with default settings for using a reverse depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription1 ReverseZ = new(true, true, ComparisonFunction.GreaterEqual);
/// <summary>
/// A built-in description with default settings for using a reverse read-only depth stencil buffer.
/// </summary>
public static readonly DepthStencilDescription1 ReadReverseZ = new(true, false, ComparisonFunction.GreaterEqual);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilDescription1"/> struct.
/// </summary>
public DepthStencilDescription1(
bool depthEnable,
bool depthWriteEnable,
ComparisonFunction depthFunc,
bool stencilEnable = false,
byte stencilReadMask = (byte)D3D12_DEFAULT_STENCIL_READ_MASK,
byte stencilWriteMask = (byte)D3D12_DEFAULT_STENCIL_WRITE_MASK,
StencilOperation frontStencilFailOp = StencilOperation.Keep,
StencilOperation frontStencilDepthFailOp = StencilOperation.Keep,
StencilOperation frontStencilPassOp = StencilOperation.Keep,
ComparisonFunction frontStencilFunc = ComparisonFunction.Always,
StencilOperation backStencilFailOp = StencilOperation.Keep,
StencilOperation backStencilDepthFailOp = StencilOperation.Keep,
StencilOperation backStencilPassOp = StencilOperation.Keep,
ComparisonFunction backStencilFunc = ComparisonFunction.Always,
bool depthBoundsTestEnable = false)
{
DepthEnable = depthEnable;
DepthWriteMask = depthWriteEnable ? DepthWriteMask.All : DepthWriteMask.Zero;
DepthFunc = depthFunc;
StencilEnable = stencilEnable;
StencilReadMask = stencilReadMask;
StencilWriteMask = stencilWriteMask;
FrontFace = new(frontStencilFailOp, frontStencilDepthFailOp, frontStencilPassOp, frontStencilFunc);
BackFace = new(backStencilFailOp, backStencilDepthFailOp, backStencilPassOp, backStencilFunc);
DepthBoundsTestEnable = depthBoundsTestEnable;
}
}

View File

@@ -0,0 +1,27 @@
// 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 unsafe partial struct DepthStencilOperationDescription
{
/// <summary>
/// A built-in description with default values.
/// </summary>
public static readonly DepthStencilOperationDescription Default = new(StencilOperation.Keep, StencilOperation.Keep, StencilOperation.Keep, ComparisonFunction.Always);
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilOperationDescription"/> struct.
/// </summary>
/// <param name="stencilFailOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing fails.</param>
/// <param name="stencilDepthFailOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing passes and depth testing fails.</param>
/// <param name="stencilPassOp">A <see cref="StencilOperation"/> value that identifies the stencil operation to perform when stencil testing and depth testing both pass.</param>
/// <param name="stencilFunc">A <see cref="ComparisonFunction"/> value that identifies the function that compares stencil data against existing stencil data.</param>
public DepthStencilOperationDescription(StencilOperation stencilFailOp, StencilOperation stencilDepthFailOp, StencilOperation stencilPassOp, ComparisonFunction stencilFunc)
{
StencilFailOp = stencilFailOp;
StencilDepthFailOp = stencilDepthFailOp;
StencilPassOp = stencilPassOp;
StencilFunc = stencilFunc;
}
}

View File

@@ -0,0 +1,148 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct DepthStencilViewDescription
{
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilViewDescription"/> struct.
/// </summary>
/// <param name="viewDimension">The <see cref="RtvDimension"/></param>
/// <param name="format">The <see cref="Format"/> to use or <see cref="Format.Unknown"/>.</param>
/// <param name="mipSlice">The index of the mipmap level to use mip slice. or first element for <see cref="RtvDimension.Buffer"/>.</param>
/// <param name="firstArraySlice">The index of the first texture to use in an array of textures or NumElements for <see cref="RtvDimension.Buffer"/>, FirstWSlice for <see cref="RtvDimension.Texture3D"/>.</param>
/// <param name="arraySize">Number of textures in the array or WSize for <see cref="RtvDimension.Texture3D"/>.</param>
/// <param name="flags"></param>
public DepthStencilViewDescription(
DsvDimension viewDimension,
Format format = Format.Unknown,
uint mipSlice = 0,
uint firstArraySlice = 0,
uint arraySize = unchecked((uint)-1),
DsvFlags flags = DsvFlags.None)
{
Format = format;
ViewDimension = viewDimension;
Anonymous = default;
Flags = flags;
switch (viewDimension)
{
case DsvDimension.Texture1D:
Texture1D.MipSlice = mipSlice;
break;
case DsvDimension.Texture1DArray:
Texture1DArray.MipSlice = mipSlice;
Texture1DArray.FirstArraySlice = firstArraySlice;
Texture1DArray.ArraySize = arraySize;
break;
case DsvDimension.Texture2D:
Texture2D.MipSlice = mipSlice;
break;
case DsvDimension.Texture2DArray:
Texture2DArray.MipSlice = mipSlice;
Texture2DArray.FirstArraySlice = firstArraySlice;
Texture2DArray.ArraySize = arraySize;
break;
case DsvDimension.Texture2DMs:
break;
case DsvDimension.Texture2DMsArray:
Texture2DMSArray.FirstArraySlice = firstArraySlice;
Texture2DMSArray.ArraySize = arraySize;
break;
default:
break;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="DepthStencilViewDescription"/> struct.
/// </summary>
public DepthStencilViewDescription(
ID3D12Resource* texture,
DsvDimension viewDimension = DsvDimension.Unknown,
Format format = Format.Unknown,
uint mipSlice = 0,
uint firstArraySlice = 0,
uint arraySize = unchecked((uint)-1),
DsvFlags flags = DsvFlags.None)
{
ViewDimension = viewDimension;
if (viewDimension == DsvDimension.Unknown ||
format == Format.Unknown ||
arraySize == unchecked((uint)-1))
{
ResourceDescription resourceDesc = texture->GetDesc();
if (viewDimension == DsvDimension.Unknown)
{
switch (resourceDesc.Dimension)
{
case ResourceDimension.Texture1D:
viewDimension = resourceDesc.DepthOrArraySize > 1 ? DsvDimension.Texture1DArray : DsvDimension.Texture1D;
break;
case ResourceDimension.Texture2D:
if (resourceDesc.SampleDesc.Count > 1)
{
viewDimension = resourceDesc.DepthOrArraySize > 1 ? DsvDimension.Texture2DMsArray : DsvDimension.Texture2DMs;
}
else
{
viewDimension = resourceDesc.DepthOrArraySize > 1 ? DsvDimension.Texture2DArray : DsvDimension.Texture2D;
}
break;
}
}
if (format == Format.Unknown)
{
format = resourceDesc.Format;
}
bool isArray =
viewDimension == DsvDimension.Texture2DArray ||
viewDimension == DsvDimension.Texture2DMsArray;
if (arraySize == unchecked((uint)-1) &&
isArray)
{
arraySize = resourceDesc.ArraySize - firstArraySlice;
}
}
Format = format;
Flags = flags;
Anonymous = default;
switch (viewDimension)
{
case DsvDimension.Texture1D:
Anonymous.Texture1D.MipSlice = mipSlice;
break;
case DsvDimension.Texture1DArray:
Anonymous.Texture1DArray.MipSlice = mipSlice;
Anonymous.Texture1DArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture1DArray.ArraySize = arraySize;
break;
case DsvDimension.Texture2D:
Anonymous.Texture2D.MipSlice = mipSlice;
break;
case DsvDimension.Texture2DArray:
Anonymous.Texture2DArray.MipSlice = mipSlice;
Anonymous.Texture2DArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture2DArray.ArraySize = arraySize;
break;
case DsvDimension.Texture2DMs:
break;
case DsvDimension.Texture2DMsArray:
Anonymous.Texture2DMSArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture2DMSArray.ArraySize = arraySize;
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,64 @@
// 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 unsafe partial struct GpuDescriptorHandle : IEquatable<GpuDescriptorHandle>
{
public static GpuDescriptorHandle Default => default;
public GpuDescriptorHandle(in GpuDescriptorHandle other, int offsetScaledByIncrementSize)
{
InitOffsetted(out this, other, offsetScaledByIncrementSize);
}
public GpuDescriptorHandle(in GpuDescriptorHandle other, int offsetInDescriptors, uint descriptorIncrementSize)
{
InitOffsetted(out this, other, offsetInDescriptors, descriptorIncrementSize);
}
public GpuDescriptorHandle Offset(int offsetInDescriptors, uint descriptorIncrementSize)
{
ptr = (ulong)((long)ptr + ((long)offsetInDescriptors * (long)descriptorIncrementSize));
return this;
}
public GpuDescriptorHandle Offset(int offsetScaledByIncrementSize)
{
ptr = (ulong)((long)ptr + (long)offsetScaledByIncrementSize);
return this;
}
public static bool operator ==(in GpuDescriptorHandle left, in GpuDescriptorHandle right)
=> (left.ptr == right.ptr);
public static bool operator !=(in GpuDescriptorHandle left, in GpuDescriptorHandle right)
=> (left.ptr != right.ptr);
public void InitOffsetted(in GpuDescriptorHandle @base, int offsetScaledByIncrementSize)
{
InitOffsetted(out this, @base, offsetScaledByIncrementSize);
}
public void InitOffsetted(in GpuDescriptorHandle @base, int offsetInDescriptors, uint descriptorIncrementSize)
{
InitOffsetted(out this, @base, offsetInDescriptors, descriptorIncrementSize);
}
public static void InitOffsetted(out GpuDescriptorHandle handle, in GpuDescriptorHandle @base, int offsetScaledByIncrementSize)
{
handle.ptr = (ulong)((long)@base.ptr + (long)offsetScaledByIncrementSize);
}
public static void InitOffsetted(out GpuDescriptorHandle handle, in GpuDescriptorHandle @base, int offsetInDescriptors, uint descriptorIncrementSize)
{
handle.ptr = (ulong)((long)@base.ptr + ((long)offsetInDescriptors * (long)descriptorIncrementSize));
}
public override bool Equals(object? obj) => (obj is GpuDescriptorHandle other) && Equals(other);
public bool Equals(GpuDescriptorHandle other) => this == other;
public override int GetHashCode() => ptr.GetHashCode();
}

View File

@@ -0,0 +1,91 @@
// 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 unsafe partial struct HeapDescription : IEquatable<HeapDescription>
{
public HeapDescription(ulong size,
HeapProperties properties,
ulong alignment = 0,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = size;
Properties = properties;
Alignment = alignment;
Flags = flags;
}
public HeapDescription(ulong size,
HeapType type,
ulong alignment = 0,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = size;
Properties = new HeapProperties(type);
Alignment = alignment;
Flags = flags;
}
public HeapDescription(ulong size,
CpuPageProperty cpuPageProperty,
MemoryPool memoryPoolPreference,
ulong alignment = 0,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = size;
Properties = new HeapProperties(cpuPageProperty, memoryPoolPreference);
Alignment = alignment;
Flags = flags;
}
public HeapDescription(in ResourceAllocationInfo resourceAllocInfo,
HeapProperties properties,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = resourceAllocInfo.SizeInBytes;
Properties = properties;
Alignment = resourceAllocInfo.Alignment;
Flags = flags;
}
public HeapDescription(in ResourceAllocationInfo resourceAllocInfo,
HeapType type,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = resourceAllocInfo.SizeInBytes;
Properties = new HeapProperties(type);
Alignment = resourceAllocInfo.Alignment;
Flags = flags;
}
public HeapDescription(in ResourceAllocationInfo resAllocInfo,
CpuPageProperty cpuPageProperty,
MemoryPool memoryPoolPreference,
HeapFlags flags = HeapFlags.None)
{
SizeInBytes = resAllocInfo.SizeInBytes;
Properties = new HeapProperties(cpuPageProperty, memoryPoolPreference);
Alignment = resAllocInfo.Alignment;
Flags = flags;
}
public bool IsCPUAccessible => Properties.IsCPUAccessible;
public static bool operator ==(in HeapDescription left, in HeapDescription right)
{
return (left.SizeInBytes == right.SizeInBytes)
&& (left.Properties == right.Properties)
&& (left.Alignment == right.Alignment)
&& (left.Flags == right.Flags);
}
public static bool operator !=(in HeapDescription left, in HeapDescription right)
=> !(left == right);
public override bool Equals(object? obj) => (obj is HeapDescription other) && Equals(other);
public bool Equals(HeapDescription other) => this == other;
public override int GetHashCode() => HashCode.Combine(SizeInBytes, Properties, Alignment, Flags);
}

View File

@@ -0,0 +1,56 @@
// 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 HeapProperties : IEquatable<HeapProperties>
{
public HeapProperties(CpuPageProperty cpuPageProperty,
MemoryPool memoryPoolPreference,
uint creationNodeMask = 1,
uint nodeMask = 1)
{
Type = HeapType.Custom;
CPUPageProperty = cpuPageProperty;
MemoryPoolPreference = memoryPoolPreference;
CreationNodeMask = creationNodeMask;
VisibleNodeMask = nodeMask;
}
public HeapProperties(HeapType type, uint creationNodeMask = 1, uint nodeMask = 1)
{
Type = type;
CPUPageProperty = CpuPageProperty.Unknown;
MemoryPoolPreference = MemoryPool.Unknown;
CreationNodeMask = creationNodeMask;
VisibleNodeMask = nodeMask;
}
public bool IsCPUAccessible
{
get
{
return (Type == HeapType.Upload)
|| (Type == HeapType.Readback)
|| ((Type == HeapType.Custom) && ((CPUPageProperty == CpuPageProperty.WriteCombine) || (CPUPageProperty == CpuPageProperty.WriteBack)));
}
}
public static bool operator ==(in HeapProperties left, in HeapProperties right)
{
return (left.Type == right.Type)
&& (left.CPUPageProperty == right.CPUPageProperty)
&& (left.MemoryPoolPreference == right.MemoryPoolPreference)
&& (left.CreationNodeMask == right.CreationNodeMask)
&& (left.VisibleNodeMask == right.VisibleNodeMask);
}
public static bool operator !=(in HeapProperties left, in HeapProperties right)
=> !(left == right);
public override bool Equals(object? obj) => (obj is HeapProperties other) && Equals(other);
public bool Equals(HeapProperties other) => this == other;
public override int GetHashCode() => HashCode.Combine(Type, CPUPageProperty, MemoryPoolPreference, CreationNodeMask, VisibleNodeMask);
}

View File

@@ -0,0 +1,33 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct IndexBufferView
{
/// <summary>
/// Initializes a new instance of the <see cref="IndexBufferView"/> struct.
/// </summary>
/// <param name="bufferLocation">Specifies a gpu virtual address that identifies the address of the buffer.</param>
/// <param name="sizeInBytes">Specifies the size in bytes of the index buffer.</param>
/// <param name="format">Specifies the <see cref="Format"/> for the index-buffer format.</param>
public IndexBufferView(ulong bufferLocation, uint sizeInBytes, Format format)
{
BufferLocation = bufferLocation;
SizeInBytes = sizeInBytes;
Format = format;
}
/// <summary>
/// Initializes a new instance of the <see cref="IndexBufferView"/> struct.
/// </summary>
/// <param name="bufferLocation">Specifies a gpu virtual address that identifies the address of the buffer.</param>
/// <param name="sizeInBytes">Specifies the size in bytes of the index buffer.</param>
/// <param name="is32Bit">Specifies if index buffer is 32 bit or 16 bit sized.</param>
public IndexBufferView(ulong bufferLocation, uint sizeInBytes, bool is32Bit = false)
: this(bufferLocation, sizeInBytes, is32Bit ? Format.R32Uint : Format.R16Uint)
{
}
}

View File

@@ -0,0 +1,68 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
/// <unmanaged>D3DX12_MESH_SHADER_PIPELINE_STATE_DESC</unmanaged>
public unsafe partial struct MeshShaderPipelineStateDescription
{
public ID3D12RootSignature* pRootSignature;
public ShaderBytecode AS;
public ShaderBytecode MS;
public ShaderBytecode PS;
public BlendDescription BlendState;
public uint SampleMask;
public RasterizerDescription RasterizerState;
public DepthStencilDescription1 DepthStencilState;
public PrimitiveTopologyType PrimitiveTopologyType;
public uint NumRenderTargets;
public _RTVFormats_e__FixedBuffer RTVFormats;
public Format DSVFormat;
public SamplerDescription SampleDesc;
public uint NodeMask;
public CachedPipelineState CachedPSO;
public PipelineStateFlags Flags;
public partial struct _RTVFormats_e__FixedBuffer
{
public Format e0;
public Format e1;
public Format e2;
public Format e3;
public Format e4;
public Format e5;
public Format e6;
public Format e7;
[UnscopedRef]
public ref Format this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref AsSpan()[index];
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[UnscopedRef]
public Span<Format> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 8);
}
}

View File

@@ -0,0 +1,36 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct MipRegion : IEquatable<MipRegion>
{
public MipRegion(uint width, uint height, uint depth)
{
Width = width;
Height = height;
Depth = depth;
}
public static bool operator ==(in MipRegion left, in MipRegion right)
{
return
left.Width == right.Width &&
left.Height == right.Height &&
left.Depth == right.Depth;
}
public static bool operator !=(in MipRegion left, in MipRegion right)
=> !(left == right);
public override bool Equals(object? obj) => (obj is MipRegion other) && Equals(other);
public bool Equals(MipRegion other) => this == other;
public override int GetHashCode()
{
return HashCode.Combine(Width, Height, Depth);
}
}

View File

@@ -0,0 +1,15 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public partial struct Range
{
public Range(nuint begin, nuint end)
{
Begin = begin;
End = end;
}
}

View File

@@ -0,0 +1,58 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public partial struct RasterizerDescription
{
/// <summary>
/// A built-in description with settings with settings for not culling any primitives.
/// </summary>
public static readonly RasterizerDescription CullNone = new(FillMode.Solid, CullMode.None);
/// <summary>
/// A built-in description with settings for culling primitives with clockwise winding order.
/// </summary>
public static readonly RasterizerDescription CullClockwise = new(FillMode.Solid, CullMode.Front);
/// <summary>
/// A built-in description with settings for culling primitives with counter-clockwise winding order.
/// </summary>
public static readonly RasterizerDescription CullCounterClockwise = new(FillMode.Solid, CullMode.Back);
/// <summary>
/// A built-in description with settings for not culling any primitives and wireframe fill mode.
/// </summary>
public static readonly RasterizerDescription Wireframe = new(FillMode.Wireframe, CullMode.Back);
/// <summary>
/// Initializes a new instance of the <see cref="RasterizerDescription"/> class.
/// </summary>
public RasterizerDescription(
FillMode fillMode,
CullMode cullMode,
bool frontCounterClockwise = false,
int depthBias = D3D12_DEFAULT_DEPTH_BIAS,
float depthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP,
float slopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
bool depthClipEnable = true,
bool multisampleEnable = true,
bool antialiasedLineEnable = false,
uint forcedSampleCount = 0,
ConservativeRasterizationMode conservativeRaster = ConservativeRasterizationMode.Off)
{
CullMode = cullMode;
FillMode = fillMode;
FrontCounterClockwise = false;
DepthBias = depthBias;
DepthBiasClamp = depthBiasClamp;
SlopeScaledDepthBias = slopeScaledDepthBias;
DepthClipEnable = depthClipEnable;
MultisampleEnable = multisampleEnable;
AntialiasedLineEnable = antialiasedLineEnable;
ForcedSampleCount = forcedSampleCount;
ConservativeRaster = conservativeRaster;
}
}

View File

@@ -0,0 +1,169 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct RenderTargetViewDescription
{
/// <summary>
/// Initializes a new instance of the <see cref="RenderTargetViewDescription"/> struct.
/// </summary>
/// <param name="viewDimension">The <see cref="RtvDimension"/></param>
/// <param name="format">The <see cref="Format"/> to use or <see cref="Format.Unknown"/>.</param>
/// <param name="mipSlice">The index of the mipmap level to use mip slice. or first element for <see cref="RtvDimension.Buffer"/>.</param>
/// <param name="firstArraySlice">The index of the first texture to use in an array of textures or NumElements for <see cref="RtvDimension.Buffer"/>, FirstWSlice for <see cref="RtvDimension.Texture3D"/>.</param>
/// <param name="arraySize">Number of textures in the array or WSize for <see cref="RtvDimension.Texture3D"/>. </param>
public RenderTargetViewDescription(
RtvDimension viewDimension,
Format format = Format.Unknown,
uint mipSlice = 0,
uint firstArraySlice = 0,
uint arraySize = unchecked((uint)-1))
{
Format = format;
ViewDimension = viewDimension;
Anonymous = default;
switch (viewDimension)
{
case RtvDimension.Buffer:
Buffer.FirstElement = mipSlice;
Buffer.NumElements = firstArraySlice;
break;
case RtvDimension.Texture1D:
Texture1D.MipSlice = mipSlice;
break;
case RtvDimension.Texture1DArray:
Texture1DArray.MipSlice = mipSlice;
Texture1DArray.FirstArraySlice = firstArraySlice;
Texture1DArray.ArraySize = arraySize;
break;
case RtvDimension.Texture2D:
Texture2D.MipSlice = mipSlice;
break;
case RtvDimension.Texture2DArray:
Texture2DArray.MipSlice = mipSlice;
Texture2DArray.FirstArraySlice = firstArraySlice;
Texture2DArray.ArraySize = arraySize;
break;
case RtvDimension.Texture2DMs:
break;
case RtvDimension.Texture2DMsArray:
Texture2DMSArray.FirstArraySlice = firstArraySlice;
Texture2DMSArray.ArraySize = arraySize;
break;
case RtvDimension.Texture3D:
Texture3D.MipSlice = mipSlice;
Texture3D.FirstWSlice = firstArraySlice;
Texture3D.WSize = arraySize;
break;
default:
break;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="RenderTargetViewDescription"/> struct.
/// </summary>
public RenderTargetViewDescription(
ID3D12Resource* texture,
RtvDimension viewDimension = RtvDimension.Unknown,
Format format = Format.Unknown,
uint mipSlice = 0,
uint firstArraySlice = 0,
uint arraySize = unchecked((uint)-1),
uint planeSlice = 0)
{
ViewDimension = viewDimension;
if (viewDimension == RtvDimension.Unknown ||
format == Format.Unknown ||
arraySize == unchecked((uint)-1))
{
ResourceDescription resourceDesc = texture->GetDesc();
if (viewDimension == RtvDimension.Unknown)
{
switch (resourceDesc.Dimension)
{
case ResourceDimension.Buffer:
viewDimension = RtvDimension.Buffer;
break;
case ResourceDimension.Texture1D:
viewDimension = resourceDesc.DepthOrArraySize > 1 ? RtvDimension.Texture1DArray : RtvDimension.Texture1D;
break;
case ResourceDimension.Texture2D:
if (resourceDesc.SampleDesc.Count > 1)
{
viewDimension = resourceDesc.DepthOrArraySize > 1 ? RtvDimension.Texture2DMsArray : RtvDimension.Texture2DMs;
}
else
{
viewDimension = resourceDesc.DepthOrArraySize > 1 ? RtvDimension.Texture2DArray : RtvDimension.Texture2D;
}
break;
case ResourceDimension.Texture3D:
viewDimension = RtvDimension.Texture3D;
break;
}
}
if (format == Format.Unknown)
{
format = resourceDesc.Format;
}
bool isArray =
viewDimension == RtvDimension.Texture2DArray ||
viewDimension == RtvDimension.Texture2DMsArray;
if (arraySize == unchecked((uint)-1) &&
isArray)
{
arraySize = resourceDesc.ArraySize - firstArraySlice;
}
}
Format = format;
Anonymous = default;
switch (viewDimension)
{
case RtvDimension.Buffer:
Anonymous.Buffer.FirstElement = firstArraySlice;
Anonymous.Buffer.NumElements = arraySize;
break;
case RtvDimension.Texture1D:
Anonymous.Texture1D.MipSlice = mipSlice;
break;
case RtvDimension.Texture1DArray:
Anonymous.Texture1DArray.MipSlice = mipSlice;
Anonymous.Texture1DArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture1DArray.ArraySize = arraySize;
break;
case RtvDimension.Texture2D:
Anonymous.Texture2D.MipSlice = mipSlice;
Anonymous.Texture2D.PlaneSlice = planeSlice;
break;
case RtvDimension.Texture2DArray:
Anonymous.Texture2DArray.MipSlice = mipSlice;
Anonymous.Texture2DArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture2DArray.ArraySize = arraySize;
Anonymous.Texture2DArray.PlaneSlice = planeSlice;
break;
case RtvDimension.Texture2DMs:
break;
case RtvDimension.Texture2DMsArray:
Anonymous.Texture2DMSArray.FirstArraySlice = firstArraySlice;
Anonymous.Texture2DMSArray.ArraySize = arraySize;
break;
case RtvDimension.Texture3D:
Anonymous.Texture3D.MipSlice = mipSlice;
Anonymous.Texture3D.FirstWSlice = firstArraySlice;
Anonymous.Texture3D.WSize = arraySize;
break;
default:
break;
}
}
}

View File

@@ -156,8 +156,10 @@ public unsafe partial struct ResourceDescription : IEquatable<ResourceDescriptio
&& (left.Flags == right.Flags);
}
public static bool operator !=(in ResourceDescription l, in ResourceDescription r)
=> !(l == r);
public static bool operator !=(in ResourceDescription left, in ResourceDescription right)
{
return !(left == right);
}
public override bool Equals(object? obj) => (obj is ResourceDescription other) && Equals(other);

View File

@@ -0,0 +1,199 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Dxgi.Common;
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct ResourceDescription1 : IEquatable<ResourceDescription1>
{
/// <summary>
/// Initializes a new instance of the <see cref="ResourceDescription1"/> struct.
/// </summary>
public ResourceDescription1(
ResourceDimension dimension,
ulong alignment,
ulong width,
uint height,
ushort depthOrArraySize,
ushort mipLevels,
Format format,
uint sampleCount,
uint sampleQuality,
TextureLayout layout,
ResourceFlags flags,
uint samplerFeedbackMipRegionWidth = 0,
uint samplerFeedbackMipRegionHeight = 0,
uint samplerFeedbackMipRegionDepth = 0)
{
Dimension = dimension;
Alignment = alignment;
Width = width;
Height = height;
DepthOrArraySize = depthOrArraySize;
MipLevels = mipLevels;
Format = format;
SampleDesc = new(sampleCount, sampleQuality);
Layout = layout;
Flags = flags;
SamplerFeedbackMipRegion = new(
samplerFeedbackMipRegionWidth,
samplerFeedbackMipRegionHeight,
samplerFeedbackMipRegionDepth);
}
public static ResourceDescription1 Buffer(in ResourceAllocationInfo resourceAllocInfo, ResourceFlags flags = ResourceFlags.None)
{
return new ResourceDescription1(
ResourceDimension.Buffer,
resourceAllocInfo.Alignment,
resourceAllocInfo.SizeInBytes,
1, 1, 1, Format.Unknown, 1, 0, TextureLayout.RowMajor,
flags,
0, 0, 0);
}
public static ResourceDescription1 Buffer(
ulong sizeInBytes,
ResourceFlags flags = ResourceFlags.None,
ulong alignment = 0)
{
return new ResourceDescription1(
ResourceDimension.Buffer,
alignment,
sizeInBytes,
1, 1, 1,
Format.Unknown, 1, 0, TextureLayout.RowMajor,
flags,
0, 0, 0);
}
public static ResourceDescription Tex1D(Format format,
ulong width,
ushort arraySize = 1,
ushort mipLevels = 0,
ResourceFlags flags = ResourceFlags.None,
TextureLayout layout = TextureLayout.Unknown,
ulong alignment = 0)
{
return new ResourceDescription(ResourceDimension.Texture1D, alignment, width, 1, arraySize, mipLevels, format, 1, 0, layout, flags);
}
public static ResourceDescription1 Tex2D(Format format,
ulong width,
uint height,
ushort arraySize = 1,
ushort mipLevels = 0,
uint sampleCount = 1,
uint sampleQuality = 0,
ResourceFlags flags = ResourceFlags.None,
TextureLayout layout = TextureLayout.Unknown,
ulong alignment = 0,
uint samplerFeedbackMipRegionWidth = 0,
uint samplerFeedbackMipRegionHeight = 0,
uint samplerFeedbackMipRegionDepth = 0)
{
return new ResourceDescription1(ResourceDimension.Texture2D,
alignment,
width,
height,
arraySize,
mipLevels,
format,
sampleCount,
sampleQuality,
layout,
flags,
samplerFeedbackMipRegionWidth,
samplerFeedbackMipRegionHeight,
samplerFeedbackMipRegionDepth);
}
public static ResourceDescription1 Texture3D(Format format,
ulong width,
uint height,
ushort depth,
ushort mipLevels = 0,
ResourceFlags flags = ResourceFlags.None,
TextureLayout layout = TextureLayout.Unknown,
ulong alignment = 0)
{
return new ResourceDescription1(
ResourceDimension.Texture3D,
alignment,
width,
height,
depth,
mipLevels,
format,
1,
0,
layout,
flags,
0, 0, 0);
}
public ushort Depth => ((Dimension == ResourceDimension.Texture3D) ? DepthOrArraySize : (ushort)(1));
public ushort ArraySize => ((Dimension != ResourceDimension.Texture3D) ? DepthOrArraySize : (ushort)(1));
public byte GetPlaneCount(ID3D12Device* pDevice)
{
return D3D12GetFormatPlaneCount(pDevice, Format);
}
public uint GetSubresources(ID3D12Device* pDevice)
{
return MipLevels * (uint)ArraySize * GetPlaneCount(pDevice);
}
public uint CalcSubresource(uint MipSlice, uint ArraySlice, uint PlaneSlice)
{
return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize);
}
public static bool operator ==(in ResourceDescription1 left, in ResourceDescription1 right)
{
return (left.Dimension == right.Dimension)
&& (left.Alignment == right.Alignment)
&& (left.Width == right.Width)
&& (left.Height == right.Height)
&& (left.DepthOrArraySize == right.DepthOrArraySize)
&& (left.MipLevels == right.MipLevels)
&& (left.Format == right.Format)
&& (left.SampleDesc.Count == right.SampleDesc.Count)
&& (left.SampleDesc.Quality == right.SampleDesc.Quality)
&& (left.Layout == right.Layout)
&& (left.Flags == right.Flags)
&& (left.SamplerFeedbackMipRegion == right.SamplerFeedbackMipRegion);
}
public static bool operator !=(in ResourceDescription1 left, in ResourceDescription1 right)
{
return !(left == right);
}
public override bool Equals(object? obj) => (obj is ResourceDescription1 other) && Equals(other);
public bool Equals(ResourceDescription1 other) => this == other;
public override int GetHashCode()
{
var hashCode = new HashCode();
{
hashCode.Add(Dimension);
hashCode.Add(Alignment);
hashCode.Add(Width);
hashCode.Add(Height);
hashCode.Add(DepthOrArraySize);
hashCode.Add(MipLevels);
hashCode.Add(Format);
hashCode.Add(SampleDesc);
hashCode.Add(Layout);
hashCode.Add(Flags);
hashCode.Add(SamplerFeedbackMipRegion);
}
return hashCode.ToHashCode();
}
}

View File

@@ -0,0 +1,28 @@
// 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 unsafe partial struct RootConstants
{
public RootConstants(uint num32BitValues, uint shaderRegister, uint registerSpace = 0)
{
Init(out this, num32BitValues, shaderRegister, registerSpace);
}
public void Init(uint num32BitValues, uint shaderRegister, uint registerSpace = 0)
{
Init(out this, num32BitValues, shaderRegister, registerSpace);
}
public static void Init(
out RootConstants rootConstants,
uint num32BitValues,
uint shaderRegister,
uint registerSpace = 0)
{
rootConstants.Num32BitValues = num32BitValues;
rootConstants.ShaderRegister = shaderRegister;
rootConstants.RegisterSpace = registerSpace;
}
}

View File

@@ -0,0 +1,23 @@
// 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 unsafe partial struct RootDescriptor
{
public RootDescriptor(uint shaderRegister, uint registerSpace = 0)
{
Init(out this, shaderRegister, registerSpace);
}
public void Init(uint shaderRegister, uint registerSpace = 0)
{
Init(out this, shaderRegister, registerSpace);
}
public static void Init(out RootDescriptor table, uint shaderRegister, uint registerSpace = 0)
{
table.ShaderRegister = shaderRegister;
table.RegisterSpace = registerSpace;
}
}

View File

@@ -0,0 +1,27 @@
// 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 unsafe partial struct RootDescriptor1
{
public RootDescriptor1(uint shaderRegister, uint registerSpace = 0, RootDescriptorFlags flags = RootDescriptorFlags.None)
{
Init(out this, shaderRegister, registerSpace, flags);
}
public void Init(uint shaderRegister, uint registerSpace = 0, RootDescriptorFlags flags = RootDescriptorFlags.None)
{
Init(out this, shaderRegister, registerSpace, flags);
}
public static void Init(out RootDescriptor1 table,
uint shaderRegister,
uint registerSpace = 0,
RootDescriptorFlags flags = RootDescriptorFlags.None)
{
table.ShaderRegister = shaderRegister;
table.RegisterSpace = registerSpace;
table.Flags = flags;
}
}

View File

@@ -0,0 +1,24 @@
// 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 unsafe partial struct RootDescriptorTable
{
public RootDescriptorTable(uint numDescriptorRanges, DescriptorRange* descriptorRanges)
{
Init(out this, numDescriptorRanges, descriptorRanges);
}
public void Init(uint numDescriptorRanges, DescriptorRange* descriptorRanges)
{
Init(out this, numDescriptorRanges, descriptorRanges);
}
public static void Init(out RootDescriptorTable rootDescriptorTable,
uint numDescriptorRanges, DescriptorRange* descriptorRanges)
{
rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges;
rootDescriptorTable.pDescriptorRanges = descriptorRanges;
}
}

View File

@@ -0,0 +1,24 @@
// 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 unsafe partial struct RootDescriptorTable1
{
public RootDescriptorTable1(uint numDescriptorRanges, DescriptorRange1* descriptorRanges)
{
Init(out this, numDescriptorRanges, descriptorRanges);
}
public void Init(uint numDescriptorRanges, DescriptorRange1* descriptorRanges)
{
Init(out this, numDescriptorRanges, descriptorRanges);
}
public static void Init(out RootDescriptorTable1 rootDescriptorTable,
uint numDescriptorRanges, DescriptorRange1* descriptorRanges)
{
rootDescriptorTable.NumDescriptorRanges = numDescriptorRanges;
rootDescriptorTable.pDescriptorRanges = descriptorRanges;
}
}

View File

@@ -0,0 +1,114 @@
// 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 unsafe partial struct RootParameter1
{
public static void InitAsDescriptorTable(
out RootParameter1 rootParam,
uint numDescriptorRanges,
DescriptorRange1* pDescriptorRanges,
ShaderVisibility visibility = ShaderVisibility.All)
{
rootParam = default;
rootParam.ParameterType = RootParameterType.DescriptorTable;
rootParam.ShaderVisibility = visibility;
RootDescriptorTable1.Init(out rootParam.Anonymous.DescriptorTable, numDescriptorRanges, pDescriptorRanges);
}
public static void InitAsConstants(
out RootParameter1 rootParam,
uint num32BitValues,
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
rootParam = default;
rootParam.ParameterType = RootParameterType.T32BitConstants;
rootParam.ShaderVisibility = visibility;
RootConstants.Init(out rootParam.Anonymous.Constants, num32BitValues, shaderRegister, registerSpace);
}
public static void InitAsConstantBufferView(
out RootParameter1 rootParam,
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
rootParam = default;
rootParam.ParameterType = RootParameterType.Cbv;
rootParam.ShaderVisibility = visibility;
RootDescriptor1.Init(out rootParam.Anonymous.Descriptor, shaderRegister, registerSpace);
}
public static void InitAsShaderResourceView(
out RootParameter1 rootParam,
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
rootParam = default;
rootParam.ParameterType = RootParameterType.Srv;
rootParam.ShaderVisibility = visibility;
RootDescriptor1.Init(out rootParam.Anonymous.Descriptor, shaderRegister, registerSpace);
}
public static void InitAsUnorderedAccessView(
out RootParameter1 rootParam,
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
rootParam = default;
rootParam.ParameterType = RootParameterType.Uav;
rootParam.ShaderVisibility = visibility;
RootDescriptor1.Init(out rootParam.Anonymous.Descriptor, shaderRegister, registerSpace);
}
public void InitAsDescriptorTable(
uint numDescriptorRanges,
DescriptorRange1* pDescriptorRanges,
ShaderVisibility visibility = ShaderVisibility.All)
{
InitAsDescriptorTable(out this, numDescriptorRanges, pDescriptorRanges, visibility);
}
public void InitAsConstants(
uint num32BitValues,
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
InitAsConstants(out this, num32BitValues, shaderRegister, registerSpace, visibility);
}
public void InitAsConstantBufferView(
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
InitAsConstantBufferView(out this, shaderRegister, registerSpace, visibility);
}
public void InitAsShaderResourceView(
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
InitAsShaderResourceView(out this, shaderRegister, registerSpace, visibility);
}
public void InitAsUnorderedAccessView(
uint shaderRegister,
uint registerSpace = 0,
ShaderVisibility visibility = ShaderVisibility.All)
{
InitAsUnorderedAccessView(out this, shaderRegister, registerSpace, visibility);
}
}

View File

@@ -0,0 +1,36 @@
// 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 unsafe partial struct RootSignatureDescription
{
public RootSignatureDescription(
uint numParameters, RootParameter* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
Init(out this, numParameters, parameters, numStaticSamplers, staticSamplers, flags);
}
public void Init(
uint numParameters, RootParameter* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
Init(out this, numParameters, parameters, numStaticSamplers, staticSamplers, flags);
}
public static void Init(
out RootSignatureDescription desc,
uint numParameters, RootParameter* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
desc.NumParameters = numParameters;
desc.pParameters = parameters;
desc.NumStaticSamplers = numStaticSamplers;
desc.pStaticSamplers = staticSamplers;
desc.Flags = flags;
}
}

View File

@@ -0,0 +1,36 @@
// 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 unsafe partial struct RootSignatureDescription1
{
public RootSignatureDescription1(
uint numParameters, RootParameter1* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
Init(out this, numParameters, parameters, numStaticSamplers, staticSamplers, flags);
}
public void Init(
uint numParameters, RootParameter1* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
Init(out this, numParameters, parameters, numStaticSamplers, staticSamplers, flags);
}
public static void Init(
out RootSignatureDescription1 desc,
uint numParameters, RootParameter1* parameters,
uint numStaticSamplers = 0, StaticSamplerDescription* staticSamplers = null,
RootSignatureFlags flags = RootSignatureFlags.None)
{
desc.NumParameters = numParameters;
desc.pParameters = parameters;
desc.NumStaticSamplers = numStaticSamplers;
desc.pStaticSamplers = staticSamplers;
desc.Flags = flags;
}
}

View File

@@ -0,0 +1,130 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D11.Apis;
namespace Win32.Graphics.Direct3D11;
public unsafe partial struct SamplerDescription
{
public static readonly SamplerDescription PointWrap = new(Filter.MinMagMipPoint, TextureAddressMode.Wrap);
public static readonly SamplerDescription PointClamp = new(Filter.MinMagMipPoint, TextureAddressMode.Clamp);
public static readonly SamplerDescription LinearWrap = new(Filter.MinMagMipLinear, TextureAddressMode.Wrap);
public static readonly SamplerDescription LinearClamp = new(Filter.MinMagMipLinear, TextureAddressMode.Clamp);
public static readonly SamplerDescription AnisotropicWrap = new(Filter.Anisotropic, TextureAddressMode.Wrap, 0.0f, D3D11_MAX_MAXANISOTROPY);
public static readonly SamplerDescription AnisotropicClamp = new(Filter.Anisotropic, TextureAddressMode.Clamp, 0.0f, D3D11_MAX_MAXANISOTROPY);
/// <summary>
/// Initializes a new instance of the <see cref="SamplerDescription"/> struct.
/// </summary>
/// <param name="filter">Filtering method to use when sampling a texture.</param>
/// <param name="addressU">Method to use for resolving a u texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="addressV">Method to use for resolving a v texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="addressW">Method to use for resolving a w texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="mipLODBias">Offset from the calculated mipmap level.</param>
/// <param name="maxAnisotropy">Clamping value used if <see cref="Filter.Anisotropic"/> or <see cref="Filter.ComparisonAnisotropic"/> is specified in Filter. Valid values are between 1 and 16.</param>
/// <param name="comparisonFunction">A function that compares sampled data against existing sampled data. </param>
/// <param name="borderColor">Border color to use if <see cref="TextureAddressMode.Border"/> is specified for AddressU, AddressV, or AddressW.</param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
Filter filter,
TextureAddressMode addressU,
TextureAddressMode addressV,
TextureAddressMode addressW,
float mipLODBias,
uint maxAnisotropy,
ComparisonFunction comparisonFunction,
Color4 borderColor,
float minLOD,
float maxLOD)
{
Filter = filter;
AddressU = addressU;
AddressV = addressV;
AddressW = addressW;
MipLODBias = mipLODBias;
MaxAnisotropy = maxAnisotropy;
ComparisonFunc = comparisonFunction;
BorderColor[0] = borderColor.R;
BorderColor[1] = borderColor.G;
BorderColor[2] = borderColor.B;
BorderColor[3] = borderColor.A;
MinLOD = minLOD;
MaxLOD = maxLOD;
}
/// <summary>
/// Initializes a new instance of the <see cref="SamplerDescription"/> struct.
/// </summary>
/// <param name="filter">Filtering method to use when sampling a texture.</param>
/// <param name="addressU">Method to use for resolving a u texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="addressV">Method to use for resolving a v texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="addressW">Method to use for resolving a w texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="mipLODBias">Offset from the calculated mipmap level.</param>
/// <param name="maxAnisotropy">Clamping value used if <see cref="Filter.Anisotropic"/> or <see cref="Filter.ComparisonAnisotropic"/> is specified in Filter. Valid values are between 1 and 16.</param>
/// <param name="comparisonFunction">A function that compares sampled data against existing sampled data. </param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
Filter filter,
TextureAddressMode addressU,
TextureAddressMode addressV,
TextureAddressMode addressW,
float mipLODBias = 0.0f,
uint maxAnisotropy = 1,
ComparisonFunction comparisonFunction = ComparisonFunction.Never,
float minLOD = float.MinValue,
float maxLOD = float.MaxValue)
{
Filter = filter;
AddressU = addressU;
AddressV = addressV;
AddressW = addressW;
MipLODBias = mipLODBias;
MaxAnisotropy = maxAnisotropy;
ComparisonFunc = comparisonFunction;
BorderColor[0] = 1.0f;
BorderColor[1] = 1.0f;
BorderColor[2] = 1.0f;
BorderColor[3] = 1.0f;
MinLOD = minLOD;
MaxLOD = maxLOD;
}
/// <summary>
/// Initializes a new instance of the <see cref="SamplerDescription"/> struct.
/// </summary>
/// <param name="filter">Filtering method to use when sampling a texture.</param>
/// <param name="address">Method to use for resolving a u, v e w texture coordinate that is outside the 0 to 1 range.</param>
/// <param name="mipLODBias">Offset from the calculated mipmap level.</param>
/// <param name="maxAnisotropy">Clamping value used if <see cref="Filter.Anisotropic"/> or <see cref="Filter.ComparisonAnisotropic"/> is specified in Filter. Valid values are between 1 and 16.</param>
/// <param name="comparisonFunction">A function that compares sampled data against existing sampled data. </param>
/// <param name="minLOD">Lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.</param>
/// <param name="maxLOD">Upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed. This value must be greater than or equal to MinLOD. </param>
public SamplerDescription(
Filter filter,
TextureAddressMode address,
float mipLODBias = 0.0f,
uint maxAnisotropy = 1,
ComparisonFunction comparisonFunction = ComparisonFunction.Never,
float minLOD = float.MinValue,
float maxLOD = float.MaxValue)
{
Filter = filter;
AddressU = address;
AddressV = address;
AddressW = address;
MipLODBias = mipLODBias;
MaxAnisotropy = maxAnisotropy;
ComparisonFunc = comparisonFunction;
BorderColor[0] = 1.0f;
BorderColor[1] = 1.0f;
BorderColor[2] = 1.0f;
BorderColor[3] = 1.0f;
MinLOD = minLOD;
MaxLOD = maxLOD;
}
}

View File

@@ -0,0 +1,22 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using Win32.Graphics.Direct3D;
using Win32.Graphics.Dxgi.Common;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct ShaderBytecode
{
public ShaderBytecode(ID3DBlob* shaderBlob)
{
pShaderBytecode = shaderBlob->GetBufferPointer();
BytecodeLength = shaderBlob->GetBufferSize();
}
public ShaderBytecode(void* shaderBytecode, nuint bytecodeLength)
{
pShaderBytecode = shaderBytecode;
BytecodeLength = bytecodeLength;
}
}

View File

@@ -0,0 +1,65 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
using static Win32.Graphics.Direct3D12.Apis;
namespace Win32.Graphics.Direct3D12;
public unsafe partial struct StaticSamplerDescription
{
/// <summary>
/// Initializes a new instance of the <see cref="StaticSamplerDescription"/> struct.
/// </summary>
/// <param name="shaderVisibility">The shader visibility.</param>
/// <param name="shaderRegister">The shader register.</param>
/// <param name="registerSpace">The register space.</param>
public StaticSamplerDescription(
ShaderVisibility shaderVisibility,
uint shaderRegister,
uint registerSpace)
{
Filter = Filter.MinMagMipLinear;
AddressU = TextureAddressMode.Clamp;
AddressV = TextureAddressMode.Clamp;
AddressW = TextureAddressMode.Clamp;
MipLODBias = 0.0f;
MaxAnisotropy = 1;
ComparisonFunc = ComparisonFunction.Never;
BorderColor = StaticBorderColor.TransparentBlack;
MinLOD = float.MinValue;
MaxLOD = float.MaxValue;
ShaderRegister = shaderRegister;
RegisterSpace = registerSpace;
ShaderVisibility = shaderVisibility;
}
/// <summary>
/// Initializes a new instance of the <see cref="StaticSamplerDescription"/> struct.
/// </summary>
/// <param name="samplerDescription">Sampler description</param>
/// <param name="shaderVisibility">The shader visibility.</param>
/// <param name="shaderRegister">The shader register.</param>
/// <param name="registerSpace">The register space.</param>
public StaticSamplerDescription(
in SamplerDescription samplerDescription,
ShaderVisibility shaderVisibility,
uint shaderRegister,
uint registerSpace,
StaticBorderColor borderColor = StaticBorderColor.OpaqueWhite) : this()
{
ShaderVisibility = shaderVisibility;
ShaderRegister = shaderRegister;
RegisterSpace = registerSpace;
BorderColor = borderColor;
Filter = samplerDescription.Filter;
AddressU = samplerDescription.AddressU;
AddressV = samplerDescription.AddressV;
AddressW = samplerDescription.AddressW;
MinLOD = samplerDescription.MinLOD;
MaxLOD = samplerDescription.MaxLOD;
MipLODBias = samplerDescription.MipLODBias;
MaxAnisotropy = samplerDescription.MaxAnisotropy;
ComparisonFunc = samplerDescription.ComparisonFunc;
}
}

View File

@@ -0,0 +1,20 @@
// 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 unsafe partial struct VertexBufferView
{
/// <summary>
/// Initializes a new instance of the <see cref="VertexBufferView"/> struct.
/// </summary>
/// <param name="bufferLocation">Specifies a gpu virtual address that identifies the address of the buffer.</param>
/// <param name="sizeInBytes">Specifies the size in bytes of the buffer.</param>
/// <param name="strideInBytes">Specifies the size in bytes of each vertex entry.</param>
public VertexBufferView(ulong bufferLocation, uint sizeInBytes, uint strideInBytes)
{
BufferLocation = bufferLocation;
SizeInBytes = sizeInBytes;
StrideInBytes = strideInBytes;
}
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;</TargetFrameworks>
<Description>Windows API low level bindings.</Description>
<VersionPrefix>1.5.5</VersionPrefix>
<VersionPrefix>1.6.0</VersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>