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",
"ModuleOnly",
"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)
@@ -230,10 +503,16 @@ public static class Program
"GS",
"HS",
"CS",
"AS",
//"AS",
"MS",
"RS",
"OM",
"VB",
"IB",
"1D",
"2D",
"3D",
"MRT",
"D3D",
"D3D11",
"D3D12",
@@ -308,6 +587,7 @@ public static class Program
{ "D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS", "T32BitConstants" },
{ "NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES", "Count" },
{ "D3D12_MESSAGE_CALLBACK_IGNORE_FILTERS", "IgnoreFilters" },
{ "D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_AS", "AS" },
};
private static readonly Dictionary<string, bool> s_generatedEnums = new()
@@ -413,6 +693,13 @@ public static class Program
{ "ID3D11DeviceContext::Map::MapFlags", "D3D11_MAP_FLAG" },
// 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();
@@ -525,7 +812,7 @@ public static class Program
string typeName = GetTypeName(constant.Type);
if (typeName == "Guid")
{
WriteGuid(writer, constant.Value.ToString(), constant.Name);
WriteGuid(writer, constant.Value!.ToString(), constant.Name);
writer.WriteLine();
}
else if (typeName == "HResult")
@@ -1351,8 +1638,10 @@ public static class Program
if (s_mapFunctionParameters.TryGetValue(parameterNameLookup, out string? remapType))
{
parameterType = GetTypeName($"{writer.Api}.{remapType}");
// TODO: Marshal enum types to base type
if (parameter.Attrs.Any(item => item is string str && str == "Out"))
{
parameterType += "*";
}
}
else
{