Generator: Improve more enum naming (IE: D3D11_MESSAGE_ID).

This commit is contained in:
Amer Koleci
2022-09-12 17:19:46 +02:00
parent c5e06e5215
commit 563c4b5e27
5 changed files with 1475 additions and 1183 deletions

View File

@@ -215,6 +215,279 @@ public static class Program
"RootSignatureOnly", "RootSignatureOnly",
"ModuleOnly", "ModuleOnly",
"ValidMask", "ValidMask",
"OutOfMemory",
"MoreData",
"GetPrivateData",
"SetPrivateData",
"ChangingParams",
"InvalidFreeData",
"InvalidIUnknown",
"InvalidFlags",
"InvalidSamples",
"CreateBuffer",
"CreateTexture1D",
"CreateTexture2D",
"CreateTexture3D",
"CreateShaderResourceView",
"CreateRenderTargetView",
"CreateDepthStencilView",
"CreateInputLayout",
"CreateVertexShader",
"CreatePixelShader",
"CreateGeometryShader",
"CreateGeometryShaderWithStreamOutput",
"CreateQuery",
"CreateRasterizerState",
"CreateDepthStencilState",
"CreateBlendState",
"CreateSamplerState",
"CreateQueryOrPredicate",
"TooManyElements",
"InvalidDesc",
"InvalidFormat",
"InvalidResource",
"TooManyObjects",
"UnrecognizedUsage",
"UnrecognizedBindFlags",
"UnrecognizedCPUAccessFlags",
"UnrecognizedMiscFlags",
"UnrecognizedFormat",
"UnexpectedMiscFlags",
"InvalidCPUAccessFlags",
"InvalidBindFlags",
"InvalidInitialData",
"InvalidDimensions",
"InvalidMipLevels",
"InvalidMiscFlags",
"InvalidArg",
"NullDesc",
"InvalidConstantBufferBindings",
"LargeAllocation",
"UnsupportedFormat",
"IncompatibleFormat",
"InvalidSlot",
"InvalidInputSlotClass",
"InvalidShaderBytecode",
"InvalidNumEntries",
"UnexpectedDecl",
"ExpectedDecl",
"InvalidOutputSlot",
"InvalidComponentCount",
"InvalidStartComponentAndComponentCount",
"InvalidGapDefinition",
"InvalidShaderType",
"RepeatedOutput",
"InvalidOutputStreamStride",
"OutputMaskMismatch",
"InvalidFillMode",
"InvalidCullMode",
"InvalidDepthBiasClamp",
"InvalidSlopeScaledDepthBias",
"InvalidFilter",
"InvalidAddressU",
"InvalidAddressV",
"InvalidAddressW",
"InvalidMaxAnisotropy",
"InvalidComparisonFunc",
"InvalidMinLod",
"InvalidMaxLod",
"InvalidQuery",
"InvalidDestinationSubresource",
"GenerateMips",
"CopySubresourceRegion",
"CopySubresource",
"InvalidSource",
"InvalidDestinationState",
"InvalidSourceState",
"InvalidSubresource",
"UpdateSubresource",
"AlreadyMapped",
"InvalidMapType",
"DeviceRemoved",
"NotMapped",
"SetExceptionMode",
"VertexPos",
"IndexPos",
"InstancePos",
"RegisterIndex",
"ComponentType",
"RegisterMask",
"SystemValue",
"NeverWritten",
"AlwaysReads",
"InputLayout",
"ShaderResourceView",
"BlendState",
"GetDesc",
"OMSetRenderTargets",
"IASetVertexBuffers",
"IASetIndexBuffer",
"VSSetShader",
"VSSetShaderResources",
"VSSetConstantBuffers",
"VSSetSamplers",
"GSSetShader",
"GSSetShaderResources",
"GSSetConstantBuffers",
"GSSetSamplers",
"PSSetShader",
"PSSetShaderResources",
"PSSetConstantBuffers",
"PSSetSamplers",
"SOSetTargets",
"IASetInputLayout",
"UnbindDeletingObject",
"RSSetState",
"OMSetBlendState",
"OMSetDepthStencilState",
"SetPredication",
"MissingOutputSignature",
"InvalidDepthWriteMask",
"InvalidDepthFunc",
"InvalidFrontFaceStencilFailOp",
"InvalidFrontFaceStencilZFailOp",
"InvalidFrontFaceStencilPassOp",
"InvalidFrontFaceStencilFunc",
"InvalidBackFaceStencilFailOp",
"InvalidBackFaceStencilZFailOp",
"InvalidBackFaceStencilPassOp",
"InvalidBackFaceStencilFunc",
"InvalidSrcBlend",
"InvalidDestBlend",
"InvalidBlendOp",
"InvalidSrcBlendAlpha",
"InvalidDestBlendAlpha",
"InvalidBlendOpAlpha",
"InvalidRenderTargetWriteMask",
"InvalidBuffer",
"IASetPrimitiveTopology",
"RSSetViewports",
"RSSetScissorRects",
"DenormFlush",
"IAGetVertexBuffers",
"VSGetShaderResources",
"VSGetConstantBuffers",
"VSGetSamplers",
"GSGetShaderResources",
"GSGetConstantBuffers",
"GSGetSamplers",
"PSGetShaderResources",
"PSGetConstantBuffers",
"PSGetSamplers",
"SOGetTargets",
"RSGetViewports",
"RSGetScissorRects",
"InvalidDestinationBox",
"CheckFormatSupport",
"CheckMultisampleQualityLevels",
"SemanticName",
"CreatePredicate",
"CreateCounter",
"OutOfRange",
"NonExclusive",
"CheckCounter",
"CreateResource",
"MirrorOnce",
"InvalidNumStreams",
"InvalidStreamToRasterizer",
"UnexpectedStreams",
"InvalidClassLinkage",
"CommandListFlags",
"CreateDeferredContext",
"FinishDisplayList",
"OnImmediateContext",
"InvalidStream",
"UnexpectedEntries",
"UnexpectedStrides",
"InvalidNumStrides",
"CreateHullShader",
"HSSetShader",
"HSSetShaderResources",
"HSSetConstantBuffers",
"HSSetSamplers",
"HSGetShaderResources",
"HSGetConstantBuffers",
"HSGetSamplers",
"CreateDomainShader",
"DSSetShader",
"DSSetShaderResources",
"DSSetConstantBuffers",
"DSSetSamplers",
"DSGetShaderResources",
"DSGetConstantBuffers",
"DSGetSamplers",
"CreateComputeShader",
"CSSetShader",
"CSSetShaderResources",
"CSSetConstantBuffers",
"CSSetSamplers",
"CSGetShaderResources",
"CSGetConstantBuffers",
"CSGetSamplers",
"DrawIndirect",
"ClassInstance",
"ClassLinkage",
"UnorderedAccessView",
"CreateUnorderedAccessView",
"SetShader",
"DoubleFloatOpsNotSupported",
"OMSetRenderTargetsAndUnorderedAccessViews",
"CSSetUnorderedAccessViews",
"PSSetUnorderedAccessViews",
"CSSetUnorderedAccesss",
"CSGetUnorderedAccesss",
"CreateShaderResesourceView",
"DispatchIndirect",
"InvalidView",
"InvalidOffset",
"LargeOffset",
"CopyStructureCount",
"ClearUnorderedAccessView",
"ClearUnorderedAccessViewFloat",
"OfferResources",
"EnqueueSetEvent",
"VideoDecoder",
"VideoProcessor",
"VideoProcessorEnum",
"DecoderOutputView",
"ProcessorInputView",
"ProcessorOutputView",
"DeviceContextState",
"CreateDeviceContextState",
"UpdateSubresource1",
"CreateVideoDecoder",
"ZeroWidthHeight",
"InvalidBufferSize",
"InvalidBufferUsage",
"InvalidSize",
"DecryptionBlt",
"NullParam",
"InvalidBufferOffsetOrCount",
"ShaderExtensionsNotSupported",
"DoubleExtensionsNotSupported",
"UAVsNotSupported",
"SwapDeviceContextState",
"ClearView",
"NotSupported",
"PreferUpdateSubresource1",
"GetDC",
"InvalidRect",
"InvalidUsage",
"StepRate",
"UpdateTiles",
"UpdateTileMappings",
"CopyTiles",
"CopyTileMappings",
"AuthenticatedChannel",
"ConservativeRasterMode",
"InvalidContextType",
"JpegDecode",
"JpegEncode",
"InvalidScanDataOffset",
"InvalidComponents",
"SourceNot2D",
"DestinationNot2D",
"CreateFence",
}; };
private static readonly HashSet<string> s_preserveCaps = new(StringComparer.OrdinalIgnoreCase) private static readonly HashSet<string> s_preserveCaps = new(StringComparer.OrdinalIgnoreCase)
@@ -230,10 +503,16 @@ public static class Program
"GS", "GS",
"HS", "HS",
"CS", "CS",
"AS", //"AS",
"MS", "MS",
"RS", "RS",
"OM", "OM",
"VB",
"IB",
"1D",
"2D",
"3D",
"MRT",
"D3D", "D3D",
"D3D11", "D3D11",
"D3D12", "D3D12",
@@ -308,6 +587,7 @@ public static class Program
{ "D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS", "T32BitConstants" }, { "D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS", "T32BitConstants" },
{ "NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES", "Count" }, { "NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES", "Count" },
{ "D3D12_MESSAGE_CALLBACK_IGNORE_FILTERS", "IgnoreFilters" }, { "D3D12_MESSAGE_CALLBACK_IGNORE_FILTERS", "IgnoreFilters" },
{ "D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_AS", "AS" },
}; };
private static readonly Dictionary<string, bool> s_generatedEnums = new() private static readonly Dictionary<string, bool> s_generatedEnums = new()
@@ -413,6 +693,13 @@ public static class Program
{ "ID3D11DeviceContext::Map::MapFlags", "D3D11_MAP_FLAG" }, { "ID3D11DeviceContext::Map::MapFlags", "D3D11_MAP_FLAG" },
// D3D12 // D3D12
// Dxc
{ "IDxcValidator::Validate::Flags", "DxcValidatorFlags" },
{ "IDxcValidator2::Validate::Flags", "DxcValidatorFlags" },
{ "IDxcValidator2::ValidateWithDebug::Flags", "DxcValidatorFlags" },
{ "IDxcVersionInfo::GetFlags::pFlags", "DxcVersionInfoFlags" },
{ "IDxcVersionInfo2::GetFlags::pFlags", "DxcVersionInfoFlags" },
}; };
private static readonly HashSet<string> s_visitedEnums = new(); private static readonly HashSet<string> s_visitedEnums = new();
@@ -525,7 +812,7 @@ public static class Program
string typeName = GetTypeName(constant.Type); string typeName = GetTypeName(constant.Type);
if (typeName == "Guid") if (typeName == "Guid")
{ {
WriteGuid(writer, constant.Value.ToString(), constant.Name); WriteGuid(writer, constant.Value!.ToString(), constant.Name);
writer.WriteLine(); writer.WriteLine();
} }
else if (typeName == "HResult") else if (typeName == "HResult")
@@ -1351,8 +1638,10 @@ public static class Program
if (s_mapFunctionParameters.TryGetValue(parameterNameLookup, out string? remapType)) if (s_mapFunctionParameters.TryGetValue(parameterNameLookup, out string? remapType))
{ {
parameterType = GetTypeName($"{writer.Api}.{remapType}"); parameterType = GetTypeName($"{writer.Api}.{remapType}");
if (parameter.Attrs.Any(item => item is string str && str == "Out"))
// TODO: Marshal enum types to base type {
parameterType += "*";
}
} }
else else
{ {

View File

@@ -7,8 +7,10 @@
// </auto-generated> // </auto-generated>
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
#if !NET6_0_OR_GREATER #if !NET6_0_OR_GREATER
using MemoryMarshal = Win32.MemoryMarshal; using MemoryMarshal = Win32.MemoryMarshal;
@@ -1986,9 +1988,9 @@ public unsafe partial struct IDxcValidator
/// <include file='../Direct3D.xml' path='doc/member[@name="IDxcValidator::Validate"]/*' /> /// <include file='../Direct3D.xml' path='doc/member[@name="IDxcValidator::Validate"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(3)] [VtblIndex(3)]
public HResult Validate(IDxcBlob* pShader, uint Flags, IDxcOperationResult** ppResult) public HResult Validate(IDxcBlob* pShader, DxcValidatorFlags Flags, IDxcOperationResult** ppResult)
{ {
return ((delegate* unmanaged[Stdcall]<IDxcValidator*, IDxcBlob*, uint, IDxcOperationResult**, int>)(lpVtbl[3]))((IDxcValidator*)Unsafe.AsPointer(ref this), pShader, Flags, ppResult); return ((delegate* unmanaged[Stdcall]<IDxcValidator*, IDxcBlob*, DxcValidatorFlags, IDxcOperationResult**, int>)(lpVtbl[3]))((IDxcValidator*)Unsafe.AsPointer(ref this), pShader, Flags, ppResult);
} }
} }
@@ -2057,17 +2059,17 @@ public unsafe partial struct IDxcValidator2
/// <inheritdoc cref="IDxcValidator.Validate" /> /// <inheritdoc cref="IDxcValidator.Validate" />
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(3)] [VtblIndex(3)]
public HResult Validate(IDxcBlob* pShader, uint Flags, IDxcOperationResult** ppResult) public HResult Validate(IDxcBlob* pShader, DxcValidatorFlags Flags, IDxcOperationResult** ppResult)
{ {
return ((delegate* unmanaged[Stdcall]<IDxcValidator2*, IDxcBlob*, uint, IDxcOperationResult**, int>)(lpVtbl[3]))((IDxcValidator2*)Unsafe.AsPointer(ref this), pShader, Flags, ppResult); return ((delegate* unmanaged[Stdcall]<IDxcValidator2*, IDxcBlob*, DxcValidatorFlags, IDxcOperationResult**, int>)(lpVtbl[3]))((IDxcValidator2*)Unsafe.AsPointer(ref this), pShader, Flags, ppResult);
} }
/// <include file='../Direct3D.xml' path='doc/member[@name="IDxcValidator2::ValidateWithDebug"]/*' /> /// <include file='../Direct3D.xml' path='doc/member[@name="IDxcValidator2::ValidateWithDebug"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(4)] [VtblIndex(4)]
public HResult ValidateWithDebug(IDxcBlob* pShader, uint Flags, DxcBuffer* pOptDebugBitcode, IDxcOperationResult** ppResult) public HResult ValidateWithDebug(IDxcBlob* pShader, DxcValidatorFlags Flags, DxcBuffer* pOptDebugBitcode, IDxcOperationResult** ppResult)
{ {
return ((delegate* unmanaged[Stdcall]<IDxcValidator2*, IDxcBlob*, uint, DxcBuffer*, IDxcOperationResult**, int>)(lpVtbl[4]))((IDxcValidator2*)Unsafe.AsPointer(ref this), pShader, Flags, pOptDebugBitcode, ppResult); return ((delegate* unmanaged[Stdcall]<IDxcValidator2*, IDxcBlob*, DxcValidatorFlags, DxcBuffer*, IDxcOperationResult**, int>)(lpVtbl[4]))((IDxcValidator2*)Unsafe.AsPointer(ref this), pShader, Flags, pOptDebugBitcode, ppResult);
} }
} }
@@ -2611,9 +2613,9 @@ public unsafe partial struct IDxcVersionInfo
/// <include file='../Direct3D.xml' path='doc/member[@name="IDxcVersionInfo::GetFlags"]/*' /> /// <include file='../Direct3D.xml' path='doc/member[@name="IDxcVersionInfo::GetFlags"]/*' />
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(4)] [VtblIndex(4)]
public HResult GetFlags(uint* pFlags) public HResult GetFlags(DxcVersionInfoFlags* pFlags)
{ {
return ((delegate* unmanaged[Stdcall]<IDxcVersionInfo*, uint*, int>)(lpVtbl[4]))((IDxcVersionInfo*)Unsafe.AsPointer(ref this), pFlags); return ((delegate* unmanaged[Stdcall]<IDxcVersionInfo*, DxcVersionInfoFlags*, int>)(lpVtbl[4]))((IDxcVersionInfo*)Unsafe.AsPointer(ref this), pFlags);
} }
} }
@@ -2690,9 +2692,9 @@ public unsafe partial struct IDxcVersionInfo2
/// <inheritdoc cref="IDxcVersionInfo.GetFlags" /> /// <inheritdoc cref="IDxcVersionInfo.GetFlags" />
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(4)] [VtblIndex(4)]
public HResult GetFlags(uint* pFlags) public HResult GetFlags(DxcVersionInfoFlags* pFlags)
{ {
return ((delegate* unmanaged[Stdcall]<IDxcVersionInfo2*, uint*, int>)(lpVtbl[4]))((IDxcVersionInfo2*)Unsafe.AsPointer(ref this), pFlags); return ((delegate* unmanaged[Stdcall]<IDxcVersionInfo2*, DxcVersionInfoFlags*, int>)(lpVtbl[4]))((IDxcVersionInfo2*)Unsafe.AsPointer(ref this), pFlags);
} }
/// <include file='../Direct3D.xml' path='doc/member[@name="IDxcVersionInfo2::GetCommitInfo"]/*' /> /// <include file='../Direct3D.xml' path='doc/member[@name="IDxcVersionInfo2::GetCommitInfo"]/*' />
@@ -3041,5 +3043,6 @@ public static unsafe partial class Apis
[DllImport("dxcompiler", ExactSpelling = true)] [DllImport("dxcompiler", ExactSpelling = true)]
public static extern HResult DxcCreateInstance2(Com.IMalloc* pMalloc, Guid* rclsid, Guid* riid, void** ppv); public static extern HResult DxcCreateInstance2(Com.IMalloc* pMalloc, Guid* rclsid, Guid* riid, void** ppv);
} }
#endregion Functions #endregion Functions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -155,7 +155,7 @@ public static unsafe class Program
MessageId* hide = stackalloc MessageId[1] MessageId* hide = stackalloc MessageId[1]
{ {
MessageId.SetprivatedataChangingparams, MessageId.SetPrivateDataChangingParams,
}; };
InfoQueueFilter filter = new(); InfoQueueFilter filter = new();