From b9608d6e0b70e7ce077acf38d8b181353474dfec Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 00:34:59 +0200 Subject: [PATCH 01/62] Added implementation for ID3D12FunctionReflection::GetDesc1 --- lib/HLSL/DxilContainerReflection.cpp | 160 +++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 091d65c414..6210b9a159 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -724,6 +724,7 @@ CInvalidFunctionParameter g_InvalidFunctionParameter; class CInvalidFunction final : public ID3D12FunctionReflection { STDMETHOD(GetDesc)(D3D12_FUNCTION_DESC *pDesc) { return E_FAIL; } + STDMETHOD(GetDesc1)(D3D12_FUNCTION_DESC1 *pDesc) { return E_FAIL; } STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex) (UINT BufferIndex) { return &g_InvalidSRConstantBuffer; } @@ -2814,6 +2815,7 @@ class CFunctionReflection final : public ID3D12FunctionReflection { // ID3D12FunctionReflection STDMETHOD(GetDesc)(D3D12_FUNCTION_DESC *pDesc); + STDMETHOD(GetDesc1)(D3D12_FUNCTION_DESC1 *pDesc); // BufferIndex relative to used constant buffers here STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex) @@ -2909,6 +2911,164 @@ HRESULT CFunctionReflection::GetDesc(D3D12_FUNCTION_DESC *pDesc) { return S_OK; } +HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { + DXASSERT_NOMSG(m_pLibraryReflection); + IFR(ZeroMemoryToOut(pDesc)); + + const ShaderModel *pSM = + m_pLibraryReflection->m_pDxilModule->GetShaderModel(); + DXIL::ShaderKind kind = DXIL::ShaderKind::Library; + if (m_pProps) { + kind = m_pProps->shaderKind; + } + + D3D12_COMPUTE_SHADER_DESC computeDesc = { + m_pProps->WaveSize.Min, + m_pProps->WaveSize.Max, + m_pProps->WaveSize.Preferred, + m_pProps->numThreads[0], + m_pProps->numThreads[1], + m_pProps->numThreads[2] + }; + + switch (kind) { + + case ShaderKind::Pixel: + pDesc->ShaderType = D3D12_SHVER_PIXEL_SHADER; + pDesc->PixelShader.EarlyDepthStencil = m_pProps->ShaderProps.PS.EarlyDepthStencil; + break; + + case ShaderKind::Vertex: + pDesc->ShaderType = D3D12_SHVER_VERTEX_SHADER; + break; + + case ShaderKind::Geometry: + pDesc->ShaderType = D3D12_SHVER_GEOMETRY_SHADER; + pDesc->GeometryShader = D3D12_GEOMETRY_SHADER_DESC{ + (D3D12_PRIMITIVE) m_pProps->ShaderProps.GS.inputPrimitive, + m_pProps->ShaderProps.GS.maxVertexCount, + m_pProps->ShaderProps.GS.instanceCount, + { + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[0], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[1], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[2], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[3] + } + }; + break; + + case ShaderKind::Hull: + pDesc->ShaderType = D3D12_SHVER_HULL_SHADER; + pDesc->HullShader = D3D12_HULL_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.HS.domain, + (D3D12_TESSELLATOR_PARTITIONING) m_pProps->ShaderProps.HS.partition, + (D3D12_TESSELLATOR_OUTPUT_PRIMITIVE) m_pProps->ShaderProps.HS.outputPrimitive, + m_pProps->ShaderProps.HS.inputControlPoints, + m_pProps->ShaderProps.HS.outputControlPoints, + m_pProps->ShaderProps.HS.maxTessFactor + }; + break; + + case ShaderKind::Domain: + pDesc->ShaderType = D3D12_SHVER_DOMAIN_SHADER; + pDesc->DomainShader = D3D12_DOMAIN_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.DS.domain, + m_pProps->ShaderProps.DS.inputControlPoints + }; + break; + + case ShaderKind::Compute: + pDesc->ShaderType = D3D12_SHVER_COMPUTE_SHADER; + pDesc->ComputeShader = computeDesc; + break; + + case ShaderKind::RayGeneration: + pDesc->ShaderType = D3D12_SHVER_RAY_GENERATION_SHADER; + break; + + case ShaderKind::Intersection: + pDesc->ShaderType = D3D12_SHVER_INTERSECTION_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; + + case ShaderKind::AnyHit: + pDesc->ShaderType = D3D12_SHVER_ANY_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; + + case ShaderKind::ClosestHit: + pDesc->ShaderType = D3D12_SHVER_CLOSEST_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; + + case ShaderKind::Miss: + pDesc->ShaderType = D3D12_SHVER_MISS_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; + + case ShaderKind::Callable: + pDesc->ShaderType = D3D12_SHVER_CALLABLE_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; + + case ShaderKind::Mesh: + pDesc->ShaderType = D3D12_SHVER_MESH_SHADER; + pDesc->MeshShader = D3D12_MESH_SHADER_DESC{ + m_pProps->ShaderProps.MS.payloadSizeInBytes, + m_pProps->ShaderProps.MS.maxVertexCount, + m_pProps->ShaderProps.MS.maxPrimitiveCount, + (D3D12_MESH_OUTPUT_TOPOLOGY) m_pProps->ShaderProps.MS.outputTopology, + }; + break; + + case ShaderKind::Amplification: + pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; + pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ + m_pProps->ShaderProps.AS.payloadSizeInBytes + }; + break; + + case ShaderKind::Node: + pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; + pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ + computeDesc, + (D3D12_NODE_OVERRIDES_TYPE) m_pProps->Node.LaunchType, + m_pProps->Node.IsProgramEntry, + m_pProps->Node.LocalRootArgumentsTableIndex, + { + m_pProps->Node.DispatchGrid[0], + m_pProps->Node.DispatchGrid[1], + m_pProps->Node.DispatchGrid[2], + }, + { + m_pProps->Node.MaxDispatchGrid[0], + m_pProps->Node.MaxDispatchGrid[1], + m_pProps->Node.MaxDispatchGrid[2], + }, + m_pProps->Node.MaxRecursionDepth + }; + break; + + } + + return S_OK; +} + // BufferIndex is relative to used constant buffers here ID3D12ShaderReflectionConstantBuffer * CFunctionReflection::GetConstantBufferByIndex(UINT BufferIndex) { From 41ba55cbdaae0de8a89be9953f567dc27ad638ac Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 00:53:24 +0200 Subject: [PATCH 02/62] Removed unused variable --- lib/HLSL/DxilContainerReflection.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 6210b9a159..708d955671 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2915,8 +2915,6 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { DXASSERT_NOMSG(m_pLibraryReflection); IFR(ZeroMemoryToOut(pDesc)); - const ShaderModel *pSM = - m_pLibraryReflection->m_pDxilModule->GetShaderModel(); DXIL::ShaderKind kind = DXIL::ShaderKind::Library; if (m_pProps) { kind = m_pProps->shaderKind; From 365edc2a81a040e55b8ee0e31cf8f750d73d1f35 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 14:42:10 +0200 Subject: [PATCH 03/62] Added versioning to function reflection and library reflection --- lib/HLSL/DxilContainerReflection.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 708d955671..de750a6938 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -269,7 +269,7 @@ class DxilShaderReflection : public DxilModuleReflection, class CFunctionReflection; class DxilLibraryReflection : public DxilModuleReflection, - public ID3D12LibraryReflection { + public ID3D12LibraryReflection1 { private: DXC_MICROCOM_TM_REF_FIELDS() @@ -289,7 +289,7 @@ class DxilLibraryReflection : public DxilModuleReflection, DXC_MICROCOM_TM_CTOR(DxilLibraryReflection) HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) noexcept override { - return DoBasicQueryInterface(this, iid, ppvObject); + return DoBasicQueryInterface(this, iid, ppvObject); } HRESULT Load(const DxilProgramHeader *pProgramHeader, @@ -300,6 +300,9 @@ class DxilLibraryReflection : public DxilModuleReflection, STDMETHOD_(ID3D12FunctionReflection *, GetFunctionByIndex) (INT FunctionIndex) override; + + STDMETHOD_(ID3D12FunctionReflection1 *, GetFunctionByIndex1) + (INT FunctionIndex) override; }; namespace hlsl { @@ -722,7 +725,7 @@ class CInvalidFunctionParameter final }; CInvalidFunctionParameter g_InvalidFunctionParameter; -class CInvalidFunction final : public ID3D12FunctionReflection { +class CInvalidFunction final : public ID3D12FunctionReflection1 { STDMETHOD(GetDesc)(D3D12_FUNCTION_DESC *pDesc) { return E_FAIL; } STDMETHOD(GetDesc1)(D3D12_FUNCTION_DESC1 *pDesc) { return E_FAIL; } @@ -2782,7 +2785,7 @@ UINT64 DxilShaderReflection::GetRequiresFlags() noexcept { // ID3D12FunctionReflection -class CFunctionReflection final : public ID3D12FunctionReflection { +class CFunctionReflection final : public ID3D12FunctionReflection1 { protected: DxilLibraryReflection *m_pLibraryReflection = nullptr; const Function *m_pFunction; @@ -3249,3 +3252,10 @@ DxilLibraryReflection::GetFunctionByIndex(INT FunctionIndex) { return &g_InvalidFunction; return m_FunctionVector[FunctionIndex]; } + +ID3D12FunctionReflection1 * +DxilLibraryReflection::GetFunctionByIndex1(INT FunctionIndex) { + if ((UINT)FunctionIndex >= m_FunctionVector.size()) + return &g_InvalidFunction; + return m_FunctionVector[FunctionIndex]; +} From 32db08b4ae52720ff39c482f4c04d6868b6340bc Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 15:27:38 +0200 Subject: [PATCH 04/62] Fixed missing ID3D12LibraryReflection check --- lib/HLSL/DxilContainerReflection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index de750a6938..ee8a2f50fa 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -335,6 +335,7 @@ HRESULT CreateDxilLibraryReflection(const DxilProgramHeader *pProgramHeader, if (!ppvObject) return E_INVALIDARG; if (!IsEqualIID(__uuidof(ID3D12LibraryReflection), iid) && + !IsEqualIID(__uuidof(ID3D12LibraryReflection1), iid) && !IsEqualIID(__uuidof(IUnknown), iid)) return E_NOINTERFACE; CComPtr pReflection = From 5d26589e34a30d620c0c6bdff2d61d183224cf01 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 15:44:12 +0200 Subject: [PATCH 05/62] Fixed QueryInterface in DxilLibraryReflection --- lib/HLSL/DxilContainerReflection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index ee8a2f50fa..ded96654e1 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -289,7 +289,9 @@ class DxilLibraryReflection : public DxilModuleReflection, DXC_MICROCOM_TM_CTOR(DxilLibraryReflection) HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) noexcept override { - return DoBasicQueryInterface(this, iid, ppvObject); + return DoBasicQueryInterface(this, iid, + ppvObject); } HRESULT Load(const DxilProgramHeader *pProgramHeader, From a42939f181118e045ec7c8d8796039e69c622375 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 23:34:39 +0200 Subject: [PATCH 06/62] Implemented GetInputNode/GetOutputNode, changed formatting a bit, added some missing node information to the implementation.: --- lib/HLSL/DxilContainerReflection.cpp | 345 +++++++++++++++++---------- 1 file changed, 223 insertions(+), 122 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index ded96654e1..6568d0fb4c 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -732,6 +732,9 @@ class CInvalidFunction final : public ID3D12FunctionReflection1 { STDMETHOD(GetDesc)(D3D12_FUNCTION_DESC *pDesc) { return E_FAIL; } STDMETHOD(GetDesc1)(D3D12_FUNCTION_DESC1 *pDesc) { return E_FAIL; } + STDMETHOD(GetInputNode)(UINT i, D3D12_NODE_DESC *pDesc) { return E_FAIL; } + STDMETHOD(GetOutputNode)(UINT i, D3D12_NODE_DESC *pDesc) { return E_FAIL; } + STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex) (UINT BufferIndex) { return &g_InvalidSRConstantBuffer; } STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByName) @@ -2823,6 +2826,9 @@ class CFunctionReflection final : public ID3D12FunctionReflection1 { STDMETHOD(GetDesc)(D3D12_FUNCTION_DESC *pDesc); STDMETHOD(GetDesc1)(D3D12_FUNCTION_DESC1 *pDesc); + STDMETHOD(GetInputNode)(UINT i, D3D12_NODE_DESC *pDesc); + STDMETHOD(GetOutputNode)(UINT i, D3D12_NODE_DESC *pDesc); + // BufferIndex relative to used constant buffers here STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex) (UINT BufferIndex); @@ -2927,152 +2933,247 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { } D3D12_COMPUTE_SHADER_DESC computeDesc = { - m_pProps->WaveSize.Min, - m_pProps->WaveSize.Max, - m_pProps->WaveSize.Preferred, - m_pProps->numThreads[0], - m_pProps->numThreads[1], - m_pProps->numThreads[2] + m_pProps->WaveSize.Min, + m_pProps->WaveSize.Max, + m_pProps->WaveSize.Preferred, + m_pProps->numThreads[0], + m_pProps->numThreads[1], + m_pProps->numThreads[2] }; + pDesc->RootSignatureSize = (UINT) m_pProps->serializedRootSignature.size(); + pDesc->RootSignaturePtr = m_pProps->serializedRootSignature.data(); + switch (kind) { - case ShaderKind::Pixel: - pDesc->ShaderType = D3D12_SHVER_PIXEL_SHADER; - pDesc->PixelShader.EarlyDepthStencil = m_pProps->ShaderProps.PS.EarlyDepthStencil; - break; + case ShaderKind::Pixel: + pDesc->ShaderType = D3D12_SHVER_PIXEL_SHADER; + pDesc->PixelShader.EarlyDepthStencil = m_pProps->ShaderProps.PS.EarlyDepthStencil; + break; - case ShaderKind::Vertex: - pDesc->ShaderType = D3D12_SHVER_VERTEX_SHADER; - break; + case ShaderKind::Vertex: + pDesc->ShaderType = D3D12_SHVER_VERTEX_SHADER; + break; - case ShaderKind::Geometry: - pDesc->ShaderType = D3D12_SHVER_GEOMETRY_SHADER; - pDesc->GeometryShader = D3D12_GEOMETRY_SHADER_DESC{ - (D3D12_PRIMITIVE) m_pProps->ShaderProps.GS.inputPrimitive, - m_pProps->ShaderProps.GS.maxVertexCount, - m_pProps->ShaderProps.GS.instanceCount, - { - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[0], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[1], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[2], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[3] - } - }; - break; + case ShaderKind::Geometry: + pDesc->ShaderType = D3D12_SHVER_GEOMETRY_SHADER; + pDesc->GeometryShader = D3D12_GEOMETRY_SHADER_DESC{ + (D3D12_PRIMITIVE) m_pProps->ShaderProps.GS.inputPrimitive, + m_pProps->ShaderProps.GS.maxVertexCount, + m_pProps->ShaderProps.GS.instanceCount, + { + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[0], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[1], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[2], + (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[3] + } + }; + break; - case ShaderKind::Hull: - pDesc->ShaderType = D3D12_SHVER_HULL_SHADER; - pDesc->HullShader = D3D12_HULL_SHADER_DESC{ - (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.HS.domain, - (D3D12_TESSELLATOR_PARTITIONING) m_pProps->ShaderProps.HS.partition, - (D3D12_TESSELLATOR_OUTPUT_PRIMITIVE) m_pProps->ShaderProps.HS.outputPrimitive, - m_pProps->ShaderProps.HS.inputControlPoints, - m_pProps->ShaderProps.HS.outputControlPoints, - m_pProps->ShaderProps.HS.maxTessFactor - }; - break; + case ShaderKind::Hull: + pDesc->ShaderType = D3D12_SHVER_HULL_SHADER; + pDesc->HullShader = D3D12_HULL_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.HS.domain, + (D3D12_TESSELLATOR_PARTITIONING) m_pProps->ShaderProps.HS.partition, + (D3D12_TESSELLATOR_OUTPUT_PRIMITIVE) m_pProps->ShaderProps.HS.outputPrimitive, + m_pProps->ShaderProps.HS.inputControlPoints, + m_pProps->ShaderProps.HS.outputControlPoints, + m_pProps->ShaderProps.HS.maxTessFactor + }; + break; - case ShaderKind::Domain: - pDesc->ShaderType = D3D12_SHVER_DOMAIN_SHADER; - pDesc->DomainShader = D3D12_DOMAIN_SHADER_DESC{ - (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.DS.domain, - m_pProps->ShaderProps.DS.inputControlPoints - }; - break; + case ShaderKind::Domain: + pDesc->ShaderType = D3D12_SHVER_DOMAIN_SHADER; + pDesc->DomainShader = D3D12_DOMAIN_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.DS.domain, + m_pProps->ShaderProps.DS.inputControlPoints + }; + break; - case ShaderKind::Compute: - pDesc->ShaderType = D3D12_SHVER_COMPUTE_SHADER; - pDesc->ComputeShader = computeDesc; - break; + case ShaderKind::Compute: + pDesc->ShaderType = D3D12_SHVER_COMPUTE_SHADER; + pDesc->ComputeShader = computeDesc; + break; - case ShaderKind::RayGeneration: - pDesc->ShaderType = D3D12_SHVER_RAY_GENERATION_SHADER; - break; + case ShaderKind::RayGeneration: + pDesc->ShaderType = D3D12_SHVER_RAY_GENERATION_SHADER; + break; - case ShaderKind::Intersection: - pDesc->ShaderType = D3D12_SHVER_INTERSECTION_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ - m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + case ShaderKind::Intersection: + pDesc->ShaderType = D3D12_SHVER_INTERSECTION_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; - case ShaderKind::AnyHit: - pDesc->ShaderType = D3D12_SHVER_ANY_HIT_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ - m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + case ShaderKind::AnyHit: + pDesc->ShaderType = D3D12_SHVER_ANY_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; - case ShaderKind::ClosestHit: - pDesc->ShaderType = D3D12_SHVER_CLOSEST_HIT_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ - m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + case ShaderKind::ClosestHit: + pDesc->ShaderType = D3D12_SHVER_CLOSEST_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; - case ShaderKind::Miss: - pDesc->ShaderType = D3D12_SHVER_MISS_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ - m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + case ShaderKind::Miss: + pDesc->ShaderType = D3D12_SHVER_MISS_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; - case ShaderKind::Callable: - pDesc->ShaderType = D3D12_SHVER_CALLABLE_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ - m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + case ShaderKind::Callable: + pDesc->ShaderType = D3D12_SHVER_CALLABLE_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + m_pProps->ShaderProps.Ray.paramSizeInBytes, + m_pProps->ShaderProps.Ray.attributeSizeInBytes + }; + break; - case ShaderKind::Mesh: - pDesc->ShaderType = D3D12_SHVER_MESH_SHADER; - pDesc->MeshShader = D3D12_MESH_SHADER_DESC{ - m_pProps->ShaderProps.MS.payloadSizeInBytes, - m_pProps->ShaderProps.MS.maxVertexCount, - m_pProps->ShaderProps.MS.maxPrimitiveCount, - (D3D12_MESH_OUTPUT_TOPOLOGY) m_pProps->ShaderProps.MS.outputTopology, - }; - break; + case ShaderKind::Mesh: + pDesc->ShaderType = D3D12_SHVER_MESH_SHADER; + pDesc->MeshShader = D3D12_MESH_SHADER_DESC{ + m_pProps->ShaderProps.MS.payloadSizeInBytes, + m_pProps->ShaderProps.MS.maxVertexCount, + m_pProps->ShaderProps.MS.maxPrimitiveCount, + (D3D12_MESH_OUTPUT_TOPOLOGY) m_pProps->ShaderProps.MS.outputTopology, + }; + break; - case ShaderKind::Amplification: - pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; - pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ - m_pProps->ShaderProps.AS.payloadSizeInBytes - }; - break; + case ShaderKind::Amplification: + pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; + pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ + m_pProps->ShaderProps.AS.payloadSizeInBytes + }; + break; - case ShaderKind::Node: - pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; - pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ - computeDesc, - (D3D12_NODE_OVERRIDES_TYPE) m_pProps->Node.LaunchType, - m_pProps->Node.IsProgramEntry, - m_pProps->Node.LocalRootArgumentsTableIndex, - { - m_pProps->Node.DispatchGrid[0], - m_pProps->Node.DispatchGrid[1], - m_pProps->Node.DispatchGrid[2], - }, - { - m_pProps->Node.MaxDispatchGrid[0], - m_pProps->Node.MaxDispatchGrid[1], - m_pProps->Node.MaxDispatchGrid[2], - }, - m_pProps->Node.MaxRecursionDepth - }; - break; + case ShaderKind::Node: + pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; + pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ + computeDesc, + (D3D12_NODE_OVERRIDES_TYPE) m_pProps->Node.LaunchType, + m_pProps->Node.IsProgramEntry, + m_pProps->Node.LocalRootArgumentsTableIndex, + { + m_pProps->Node.DispatchGrid[0], + m_pProps->Node.DispatchGrid[1], + m_pProps->Node.DispatchGrid[2], + }, + { + m_pProps->Node.MaxDispatchGrid[0], + m_pProps->Node.MaxDispatchGrid[1], + m_pProps->Node.MaxDispatchGrid[2], + }, + m_pProps->Node.MaxRecursionDepth, + D3D12_NODE_ID_DESC{ + m_pProps->NodeShaderID.Name.c_str(), + m_pProps->NodeShaderID.Index + }, + D3D12_NODE_ID_DESC{ + m_pProps->NodeShaderSharedInput.Name.c_str(), + m_pProps->NodeShaderSharedInput.Index + }, + (UINT) m_pProps->InputNodes.size(), + (UINT) m_pProps->OutputNodes.size() + }; + break; } return S_OK; } +HRESULT CFunctionReflection::GetInputNode(UINT i, D3D12_NODE_DESC *pDesc) { + DXASSERT_NOMSG(m_pLibraryReflection); + IFR(ZeroMemoryToOut(pDesc)); + + DXIL::ShaderKind kind = DXIL::ShaderKind::Library; + if (m_pProps) { + kind = m_pProps->shaderKind; + } + + if (kind != ShaderKind::Node) + return E_INVALIDARG; + + if (i >= m_pProps->InputNodes.size()) + return E_BOUNDS; + + NodeIOProperties prop = m_pProps->InputNodes[i]; + + *pDesc = D3D12_NODE_DESC{ + (D3D12_NODE_IO_FLAGS) (uint32_t) prop.Flags, + D3D12_NODE_RECORD_TYPE_DESC{ + prop.RecordType.size, + prop.RecordType.alignment, + D3D12_DISPATCH_GRID_DESC{ + prop.RecordType.SV_DispatchGrid.ByteOffset, + (D3D12_DISPATCH_COMPONENT_TYPE) prop.RecordType.SV_DispatchGrid.ComponentType, + prop.RecordType.SV_DispatchGrid.NumComponents, + } + }, + D3D12_NODE_ID_DESC{ + prop.OutputID.Name.c_str(), + prop.OutputID.Index + }, + prop.MaxRecords, + prop.MaxRecordsSharedWith, + prop.OutputArraySize, + prop.AllowSparseNodes + }; + + return S_OK; +} + +HRESULT CFunctionReflection::GetOutputNode(UINT i, D3D12_NODE_DESC *pDesc) { + DXASSERT_NOMSG(m_pLibraryReflection); + IFR(ZeroMemoryToOut(pDesc)); + + DXIL::ShaderKind kind = DXIL::ShaderKind::Library; + if (m_pProps) { + kind = m_pProps->shaderKind; + } + + if (kind != ShaderKind::Node) + return E_INVALIDARG; + + if (i >= m_pProps->OutputNodes.size()) + return E_BOUNDS; + + NodeIOProperties prop = m_pProps->OutputNodes[i]; + + *pDesc = D3D12_NODE_DESC{ + (D3D12_NODE_IO_FLAGS) (uint32_t) prop.Flags, + D3D12_NODE_RECORD_TYPE_DESC{ + prop.RecordType.size, + prop.RecordType.alignment, + D3D12_DISPATCH_GRID_DESC{ + prop.RecordType.SV_DispatchGrid.ByteOffset, + (D3D12_DISPATCH_COMPONENT_TYPE) prop.RecordType.SV_DispatchGrid.ComponentType, + prop.RecordType.SV_DispatchGrid.NumComponents, + } + }, + D3D12_NODE_ID_DESC{ + prop.OutputID.Name.c_str(), + prop.OutputID.Index + }, + prop.MaxRecords, + prop.MaxRecordsSharedWith, + prop.OutputArraySize, + prop.AllowSparseNodes + }; + + return S_OK; +} + // BufferIndex is relative to used constant buffers here ID3D12ShaderReflectionConstantBuffer * CFunctionReflection::GetConstantBufferByIndex(UINT BufferIndex) { From 52aa9d9faf323252a8b9c8f97cff4c679734dd72 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 26 Jul 2024 23:51:02 +0200 Subject: [PATCH 07/62] Added safety check to CFunctionReflection::GetDesc1 and renamed D3D12_NODE_OVERRIDES_TYPE to ..._LAUNCH_TYPE --- lib/HLSL/DxilContainerReflection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 6568d0fb4c..dc8e4a247e 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2931,6 +2931,10 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { if (m_pProps) { kind = m_pProps->shaderKind; } + + else { + return E_FAIL; + } D3D12_COMPUTE_SHADER_DESC computeDesc = { m_pProps->WaveSize.Min, @@ -3060,7 +3064,7 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ computeDesc, - (D3D12_NODE_OVERRIDES_TYPE) m_pProps->Node.LaunchType, + (D3D12_NODE_LAUNCH_TYPE) m_pProps->Node.LaunchType, m_pProps->Node.IsProgramEntry, m_pProps->Node.LocalRootArgumentsTableIndex, { From 7e39b816e2c129d058dd7b8ded3a27b5360fdc0b Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 27 Jul 2024 00:12:16 +0200 Subject: [PATCH 08/62] Formatted with clang-format --- lib/HLSL/DxilContainerReflection.cpp | 296 ++++++++++++--------------- 1 file changed, 135 insertions(+), 161 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index dc8e4a247e..369b2e1023 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -290,8 +290,7 @@ class DxilLibraryReflection : public DxilModuleReflection, HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) noexcept override { return DoBasicQueryInterface(this, iid, - ppvObject); + ID3D12LibraryReflection>(this, iid, ppvObject); } HRESULT Load(const DxilProgramHeader *pProgramHeader, @@ -2935,162 +2934,147 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { else { return E_FAIL; } - + D3D12_COMPUTE_SHADER_DESC computeDesc = { - m_pProps->WaveSize.Min, - m_pProps->WaveSize.Max, - m_pProps->WaveSize.Preferred, - m_pProps->numThreads[0], - m_pProps->numThreads[1], - m_pProps->numThreads[2] - }; - - pDesc->RootSignatureSize = (UINT) m_pProps->serializedRootSignature.size(); + m_pProps->WaveSize.Min, m_pProps->WaveSize.Max, + m_pProps->WaveSize.Preferred, m_pProps->numThreads[0], + m_pProps->numThreads[1], m_pProps->numThreads[2]}; + + pDesc->RootSignatureSize = (UINT)m_pProps->serializedRootSignature.size(); pDesc->RootSignaturePtr = m_pProps->serializedRootSignature.data(); switch (kind) { - case ShaderKind::Pixel: - pDesc->ShaderType = D3D12_SHVER_PIXEL_SHADER; - pDesc->PixelShader.EarlyDepthStencil = m_pProps->ShaderProps.PS.EarlyDepthStencil; - break; + case ShaderKind::Pixel: + pDesc->ShaderType = D3D12_SHVER_PIXEL_SHADER; + pDesc->PixelShader.EarlyDepthStencil = + m_pProps->ShaderProps.PS.EarlyDepthStencil; + break; - case ShaderKind::Vertex: - pDesc->ShaderType = D3D12_SHVER_VERTEX_SHADER; - break; + case ShaderKind::Vertex: + pDesc->ShaderType = D3D12_SHVER_VERTEX_SHADER; + break; - case ShaderKind::Geometry: - pDesc->ShaderType = D3D12_SHVER_GEOMETRY_SHADER; - pDesc->GeometryShader = D3D12_GEOMETRY_SHADER_DESC{ - (D3D12_PRIMITIVE) m_pProps->ShaderProps.GS.inputPrimitive, + case ShaderKind::Geometry: + pDesc->ShaderType = D3D12_SHVER_GEOMETRY_SHADER; + pDesc->GeometryShader = D3D12_GEOMETRY_SHADER_DESC{ + (D3D12_PRIMITIVE)m_pProps->ShaderProps.GS.inputPrimitive, m_pProps->ShaderProps.GS.maxVertexCount, m_pProps->ShaderProps.GS.instanceCount, - { - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[0], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[1], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[2], - (D3D12_PRIMITIVE_TOPOLOGY) m_pProps->ShaderProps.GS.streamPrimitiveTopologies[3] - } - }; - break; + {(D3D12_PRIMITIVE_TOPOLOGY) + m_pProps->ShaderProps.GS.streamPrimitiveTopologies[0], + (D3D12_PRIMITIVE_TOPOLOGY) + m_pProps->ShaderProps.GS.streamPrimitiveTopologies[1], + (D3D12_PRIMITIVE_TOPOLOGY) + m_pProps->ShaderProps.GS.streamPrimitiveTopologies[2], + (D3D12_PRIMITIVE_TOPOLOGY) + m_pProps->ShaderProps.GS.streamPrimitiveTopologies[3]}}; + break; - case ShaderKind::Hull: - pDesc->ShaderType = D3D12_SHVER_HULL_SHADER; - pDesc->HullShader = D3D12_HULL_SHADER_DESC{ - (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.HS.domain, - (D3D12_TESSELLATOR_PARTITIONING) m_pProps->ShaderProps.HS.partition, - (D3D12_TESSELLATOR_OUTPUT_PRIMITIVE) m_pProps->ShaderProps.HS.outputPrimitive, + case ShaderKind::Hull: + pDesc->ShaderType = D3D12_SHVER_HULL_SHADER; + pDesc->HullShader = D3D12_HULL_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN)m_pProps->ShaderProps.HS.domain, + (D3D12_TESSELLATOR_PARTITIONING)m_pProps->ShaderProps.HS.partition, + (D3D12_TESSELLATOR_OUTPUT_PRIMITIVE) + m_pProps->ShaderProps.HS.outputPrimitive, m_pProps->ShaderProps.HS.inputControlPoints, m_pProps->ShaderProps.HS.outputControlPoints, - m_pProps->ShaderProps.HS.maxTessFactor - }; - break; + m_pProps->ShaderProps.HS.maxTessFactor}; + break; - case ShaderKind::Domain: - pDesc->ShaderType = D3D12_SHVER_DOMAIN_SHADER; - pDesc->DomainShader = D3D12_DOMAIN_SHADER_DESC{ - (D3D12_TESSELLATOR_DOMAIN) m_pProps->ShaderProps.DS.domain, - m_pProps->ShaderProps.DS.inputControlPoints - }; - break; + case ShaderKind::Domain: + pDesc->ShaderType = D3D12_SHVER_DOMAIN_SHADER; + pDesc->DomainShader = D3D12_DOMAIN_SHADER_DESC{ + (D3D12_TESSELLATOR_DOMAIN)m_pProps->ShaderProps.DS.domain, + m_pProps->ShaderProps.DS.inputControlPoints}; + break; - case ShaderKind::Compute: - pDesc->ShaderType = D3D12_SHVER_COMPUTE_SHADER; - pDesc->ComputeShader = computeDesc; - break; + case ShaderKind::Compute: + pDesc->ShaderType = D3D12_SHVER_COMPUTE_SHADER; + pDesc->ComputeShader = computeDesc; + break; - case ShaderKind::RayGeneration: - pDesc->ShaderType = D3D12_SHVER_RAY_GENERATION_SHADER; - break; + case ShaderKind::RayGeneration: + pDesc->ShaderType = D3D12_SHVER_RAY_GENERATION_SHADER; + break; - case ShaderKind::Intersection: - pDesc->ShaderType = D3D12_SHVER_INTERSECTION_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + case ShaderKind::Intersection: + pDesc->ShaderType = D3D12_SHVER_INTERSECTION_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + m_pProps->ShaderProps.Ray.attributeSizeInBytes}; + break; - case ShaderKind::AnyHit: - pDesc->ShaderType = D3D12_SHVER_ANY_HIT_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + case ShaderKind::AnyHit: + pDesc->ShaderType = D3D12_SHVER_ANY_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + m_pProps->ShaderProps.Ray.attributeSizeInBytes}; + break; - case ShaderKind::ClosestHit: - pDesc->ShaderType = D3D12_SHVER_CLOSEST_HIT_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + case ShaderKind::ClosestHit: + pDesc->ShaderType = D3D12_SHVER_CLOSEST_HIT_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + m_pProps->ShaderProps.Ray.attributeSizeInBytes}; + break; - case ShaderKind::Miss: - pDesc->ShaderType = D3D12_SHVER_MISS_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + case ShaderKind::Miss: + pDesc->ShaderType = D3D12_SHVER_MISS_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + m_pProps->ShaderProps.Ray.attributeSizeInBytes}; + break; - case ShaderKind::Callable: - pDesc->ShaderType = D3D12_SHVER_CALLABLE_SHADER; - pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ + case ShaderKind::Callable: + pDesc->ShaderType = D3D12_SHVER_CALLABLE_SHADER; + pDesc->RaytracingShader = D3D12_RAYTRACING_SHADER_DESC{ m_pProps->ShaderProps.Ray.paramSizeInBytes, - m_pProps->ShaderProps.Ray.attributeSizeInBytes - }; - break; + m_pProps->ShaderProps.Ray.attributeSizeInBytes}; + break; - case ShaderKind::Mesh: - pDesc->ShaderType = D3D12_SHVER_MESH_SHADER; - pDesc->MeshShader = D3D12_MESH_SHADER_DESC{ + case ShaderKind::Mesh: + pDesc->ShaderType = D3D12_SHVER_MESH_SHADER; + pDesc->MeshShader = D3D12_MESH_SHADER_DESC{ m_pProps->ShaderProps.MS.payloadSizeInBytes, m_pProps->ShaderProps.MS.maxVertexCount, m_pProps->ShaderProps.MS.maxPrimitiveCount, - (D3D12_MESH_OUTPUT_TOPOLOGY) m_pProps->ShaderProps.MS.outputTopology, - }; - break; + (D3D12_MESH_OUTPUT_TOPOLOGY)m_pProps->ShaderProps.MS.outputTopology, + }; + break; - case ShaderKind::Amplification: - pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; - pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ - m_pProps->ShaderProps.AS.payloadSizeInBytes - }; - break; + case ShaderKind::Amplification: + pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; + pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ + m_pProps->ShaderProps.AS.payloadSizeInBytes}; + break; - case ShaderKind::Node: - pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; - pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ + case ShaderKind::Node: + pDesc->ShaderType = D3D12_SHVER_NODE_SHADER; + pDesc->NodeShader = D3D12_NODE_SHADER_DESC{ computeDesc, - (D3D12_NODE_LAUNCH_TYPE) m_pProps->Node.LaunchType, + (D3D12_NODE_LAUNCH_TYPE)m_pProps->Node.LaunchType, m_pProps->Node.IsProgramEntry, m_pProps->Node.LocalRootArgumentsTableIndex, { - m_pProps->Node.DispatchGrid[0], - m_pProps->Node.DispatchGrid[1], - m_pProps->Node.DispatchGrid[2], + m_pProps->Node.DispatchGrid[0], + m_pProps->Node.DispatchGrid[1], + m_pProps->Node.DispatchGrid[2], }, { - m_pProps->Node.MaxDispatchGrid[0], - m_pProps->Node.MaxDispatchGrid[1], - m_pProps->Node.MaxDispatchGrid[2], + m_pProps->Node.MaxDispatchGrid[0], + m_pProps->Node.MaxDispatchGrid[1], + m_pProps->Node.MaxDispatchGrid[2], }, m_pProps->Node.MaxRecursionDepth, - D3D12_NODE_ID_DESC{ - m_pProps->NodeShaderID.Name.c_str(), - m_pProps->NodeShaderID.Index - }, - D3D12_NODE_ID_DESC{ - m_pProps->NodeShaderSharedInput.Name.c_str(), - m_pProps->NodeShaderSharedInput.Index - }, - (UINT) m_pProps->InputNodes.size(), - (UINT) m_pProps->OutputNodes.size() - }; - break; - + D3D12_NODE_ID_DESC{m_pProps->NodeShaderID.Name.c_str(), + m_pProps->NodeShaderID.Index}, + D3D12_NODE_ID_DESC{m_pProps->NodeShaderSharedInput.Name.c_str(), + m_pProps->NodeShaderSharedInput.Index}, + (UINT)m_pProps->InputNodes.size(), + (UINT)m_pProps->OutputNodes.size()}; + break; } return S_OK; @@ -3110,29 +3094,24 @@ HRESULT CFunctionReflection::GetInputNode(UINT i, D3D12_NODE_DESC *pDesc) { if (i >= m_pProps->InputNodes.size()) return E_BOUNDS; - + NodeIOProperties prop = m_pProps->InputNodes[i]; - + *pDesc = D3D12_NODE_DESC{ - (D3D12_NODE_IO_FLAGS) (uint32_t) prop.Flags, - D3D12_NODE_RECORD_TYPE_DESC{ - prop.RecordType.size, - prop.RecordType.alignment, - D3D12_DISPATCH_GRID_DESC{ - prop.RecordType.SV_DispatchGrid.ByteOffset, - (D3D12_DISPATCH_COMPONENT_TYPE) prop.RecordType.SV_DispatchGrid.ComponentType, - prop.RecordType.SV_DispatchGrid.NumComponents, - } - }, - D3D12_NODE_ID_DESC{ - prop.OutputID.Name.c_str(), - prop.OutputID.Index - }, - prop.MaxRecords, - prop.MaxRecordsSharedWith, - prop.OutputArraySize, - prop.AllowSparseNodes - }; + (D3D12_NODE_IO_FLAGS)(uint32_t)prop.Flags, + D3D12_NODE_RECORD_TYPE_DESC{ + prop.RecordType.size, prop.RecordType.alignment, + D3D12_DISPATCH_GRID_DESC{ + prop.RecordType.SV_DispatchGrid.ByteOffset, + (D3D12_DISPATCH_COMPONENT_TYPE) + prop.RecordType.SV_DispatchGrid.ComponentType, + prop.RecordType.SV_DispatchGrid.NumComponents, + }}, + D3D12_NODE_ID_DESC{prop.OutputID.Name.c_str(), prop.OutputID.Index}, + prop.MaxRecords, + prop.MaxRecordsSharedWith, + prop.OutputArraySize, + prop.AllowSparseNodes}; return S_OK; } @@ -3151,29 +3130,24 @@ HRESULT CFunctionReflection::GetOutputNode(UINT i, D3D12_NODE_DESC *pDesc) { if (i >= m_pProps->OutputNodes.size()) return E_BOUNDS; - + NodeIOProperties prop = m_pProps->OutputNodes[i]; - + *pDesc = D3D12_NODE_DESC{ - (D3D12_NODE_IO_FLAGS) (uint32_t) prop.Flags, - D3D12_NODE_RECORD_TYPE_DESC{ - prop.RecordType.size, - prop.RecordType.alignment, - D3D12_DISPATCH_GRID_DESC{ - prop.RecordType.SV_DispatchGrid.ByteOffset, - (D3D12_DISPATCH_COMPONENT_TYPE) prop.RecordType.SV_DispatchGrid.ComponentType, - prop.RecordType.SV_DispatchGrid.NumComponents, - } - }, - D3D12_NODE_ID_DESC{ - prop.OutputID.Name.c_str(), - prop.OutputID.Index - }, - prop.MaxRecords, - prop.MaxRecordsSharedWith, - prop.OutputArraySize, - prop.AllowSparseNodes - }; + (D3D12_NODE_IO_FLAGS)(uint32_t)prop.Flags, + D3D12_NODE_RECORD_TYPE_DESC{ + prop.RecordType.size, prop.RecordType.alignment, + D3D12_DISPATCH_GRID_DESC{ + prop.RecordType.SV_DispatchGrid.ByteOffset, + (D3D12_DISPATCH_COMPONENT_TYPE) + prop.RecordType.SV_DispatchGrid.ComponentType, + prop.RecordType.SV_DispatchGrid.NumComponents, + }}, + D3D12_NODE_ID_DESC{prop.OutputID.Name.c_str(), prop.OutputID.Index}, + prop.MaxRecords, + prop.MaxRecordsSharedWith, + prop.OutputArraySize, + prop.AllowSparseNodes}; return S_OK; } From 0a78e0f58592a67b7fc9642c3fb47c2effc4baed Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 31 Jul 2024 14:50:07 +0200 Subject: [PATCH 09/62] Update to latest DirectX-Headers --- external/DirectX-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 980971e835..b180ff840c 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 980971e835876dc0cde415e8f9bc646e64667bf7 +Subproject commit b180ff840c2d2b7c3212e90a842c9551b1330d5e From 98140658ebe5c1eceaf7c6f4b2deb1973c1b6b37 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 31 Jul 2024 22:01:06 +0200 Subject: [PATCH 10/62] DirectX-Headers is now required on Windows too, since otherwise it's not really possible to change things in DirectX-Headers without a Windows SDK update... Removed stupid hacks in dxexp.cpp, which were there because d3d12.h comes from the windows SDK. Now that DirectX-Headers is required, d3d12.h comes from the DirectX-Headers, meaning that the structs & enums that were hardcoded are now not needed anymore. It can now happily use the same headers without relying on specific windows SDKs :) --- CMakeLists.txt | 7 +- external/CMakeLists.txt | 12 ++- include/dxc/Support/D3DReflection.h | 2 +- tools/dxexp/dxexp.cpp | 124 ---------------------------- 4 files changed, 12 insertions(+), 133 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 913d772126..263b3cb400 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -688,7 +688,12 @@ list(APPEND LLVM_COMMON_DEPENDS HCTGen) if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) + +if(NOT WIN32) + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) +else() + include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) +endif() # HLSL - Change End diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index a8b2638e3d..b56bc1d2ab 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -9,13 +9,11 @@ endif (NOT HLSL_ENABLE_DEBUG_ITERATORS) # Need DirectX-Headers module if not on windows if (NOT DIRECTX_HEADER_INCLUDE_DIR) - if (NOT WIN32) - if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") - set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) - else() - message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") - endif() - endif (NOT WIN32) + if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") + set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) + else() + message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") + endif() endif(NOT DIRECTX_HEADER_INCLUDE_DIR) # Enabling SPIR-V codegen requires SPIRV-Headers for spirv.hpp and diff --git a/include/dxc/Support/D3DReflection.h b/include/dxc/Support/D3DReflection.h index aeb004c7bb..4e5c0684b3 100644 --- a/include/dxc/Support/D3DReflection.h +++ b/include/dxc/Support/D3DReflection.h @@ -22,5 +22,5 @@ #undef interface #pragma GCC diagnostic pop #else -#include +#include "d3d12shader.h" #endif diff --git a/tools/dxexp/dxexp.cpp b/tools/dxexp/dxexp.cpp index 4787200318..6a389e9202 100644 --- a/tools/dxexp/dxexp.cpp +++ b/tools/dxexp/dxexp.cpp @@ -42,150 +42,26 @@ static HRESULT AtlCheck(HRESULT hr) { return hr; } -// Not defined in Creators Update version of d3d12.h: -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS2 -#define D3D12_FEATURE_D3D12_OPTIONS3 ((D3D12_FEATURE)21) -typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS { - D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, - D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = - (1 << D3D12_COMMAND_LIST_TYPE_DIRECT), - D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = - (1 << D3D12_COMMAND_LIST_TYPE_BUNDLE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = - (1 << D3D12_COMMAND_LIST_TYPE_COMPUTE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5) -} D3D12_COMMAND_LIST_SUPPORT_FLAGS; - -typedef enum D3D12_VIEW_INSTANCING_TIER { - D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, - D3D12_VIEW_INSTANCING_TIER_1 = 1, - D3D12_VIEW_INSTANCING_TIER_2 = 2, - D3D12_VIEW_INSTANCING_TIER_3 = 3 -} D3D12_VIEW_INSTANCING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 { - BOOL CopyQueueTimestampQueriesSupported; - BOOL CastingFullyTypedFormatSupported; - DWORD WriteBufferImmediateSupportFlags; - D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; - BOOL BarycentricsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS3; -#endif - #ifndef NTDDI_WIN10_RS3 #define NTDDI_WIN10_RS3 0x0A000004 #endif -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3 -#define D3D12_FEATURE_D3D12_OPTIONS4 ((D3D12_FEATURE)23) -typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER { - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0, - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1, -} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 { - BOOL ReservedBufferPlacementSupported; - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; - BOOL Native16BitShaderOpsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS4; -#endif - #ifndef NTDDI_WIN10_RS4 #define NTDDI_WIN10_RS4 0x0A000005 #endif -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS4 -#define D3D12_FEATURE_D3D12_OPTIONS5 ((D3D12_FEATURE)27) -typedef enum D3D12_RENDER_PASS_TIER { - D3D12_RENDER_PASS_TIER_0 = 0, - D3D12_RENDER_PASS_TIER_1 = 1, - D3D12_RENDER_PASS_TIER_2 = 2 -} D3D12_RENDER_PASS_TIER; - -typedef enum D3D12_RAYTRACING_TIER { - D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, - D3D12_RAYTRACING_TIER_1_0 = 10 D3D12_RAYTRACING_TIER_1_1 = 11 -} D3D12_RAYTRACING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 { - BOOL SRVOnlyTiledResourceTier3; - D3D12_RENDER_PASS_TIER RenderPassesTier; - D3D12_RAYTRACING_TIER RaytracingTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS5; -#endif - #ifndef NTDDI_WIN10_VB #define NTDDI_WIN10_VB 0x0A000008 #endif -#if WDK_NTDDI_VERSION < NTDDI_WIN10_VB -#define D3D12_FEATURE_D3D12_OPTIONS7 ((D3D12_FEATURE)32) - -typedef enum D3D12_MESH_SHADER_TIER { - D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, - D3D12_MESH_SHADER_TIER_1 = 10 -} D3D12_MESH_SHADER_TIER; - -typedef enum D3D12_SAMPLER_FEEDBACK_TIER { - D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, - D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, - D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 -} D3D12_SAMPLER_FEEDBACK_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 { - D3D12_MESH_SHADER_TIER MeshShaderTier; - D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS7; -#endif - #ifndef NTDDI_WIN10_FE #define NTDDI_WIN10_FE 0x0A00000A #endif -#if WDK_NTDDI_VERSION < NTDDI_WIN10_FE -#define D3D12_FEATURE_D3D12_OPTIONS9 ((D3D12_FEATURE)37) - -typedef enum D3D12_WAVE_MMA_TIER { - D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, - D3D12_WAVE_MMA_TIER_1_0 = 10 -} D3D12_WAVE_MMA_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 { - BOOL MeshShaderPipelineStatsSupported; - BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; - BOOL AtomicInt64OnTypedResourceSupported; - BOOL AtomicInt64OnGroupSharedSupported; - BOOL DerivativesInMeshAndAmplificationShadersSupported; - D3D12_WAVE_MMA_TIER WaveMMATier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS9; -#endif - #ifndef NTDDI_WIN10_NI #define NTDDI_WIN10_NI 0x0A00000C #endif -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_NI -#define D3D12_FEATURE_D3D12_OPTIONS14 ((D3D12_FEATURE)43) -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 { - BOOL AdvancedTextureOpsSupported; - BOOL WriteableMSAATexturesSupported; - BOOL IndependentFrontAndBackStencilRefMaskSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS14; -#endif - -#pragma warning(disable : 4063) -#define D3D12_RAYTRACING_TIER_1_1 ((D3D12_RAYTRACING_TIER)11) -#define D3D_SHADER_MODEL_6_1 ((D3D_SHADER_MODEL)0x61) -#define D3D_SHADER_MODEL_6_2 ((D3D_SHADER_MODEL)0x62) -#define D3D_SHADER_MODEL_6_3 ((D3D_SHADER_MODEL)0x63) -#define D3D_SHADER_MODEL_6_4 ((D3D_SHADER_MODEL)0x64) -#define D3D_SHADER_MODEL_6_5 ((D3D_SHADER_MODEL)0x65) -#define D3D_SHADER_MODEL_6_6 ((D3D_SHADER_MODEL)0x66) -#define D3D_SHADER_MODEL_6_7 ((D3D_SHADER_MODEL)0x67) -#define D3D_SHADER_MODEL_6_8 ((D3D_SHADER_MODEL)0x68) - #define DXEXP_HIGHEST_SHADER_MODEL D3D_SHADER_MODEL_6_8 static const char *BoolToStrJson(bool value) { From a0bb8b9460ae3f2a74a11091b002474b6cad2460 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 19:26:26 +0200 Subject: [PATCH 11/62] Implemented GetWaveSize for DxilContainerReflection.cpp --- external/DirectX-Headers | 2 +- lib/HLSL/DxilContainerReflection.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 980971e835..aa7d10e967 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 980971e835876dc0cde415e8f9bc646e64667bf7 +Subproject commit aa7d10e967f14ef8641503a022f4608da2e5f5a5 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 369b2e1023..25feeb020f 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -264,6 +264,10 @@ class DxilShaderReflection : public DxilModuleReflection, GetThreadGroupSize(UINT *pSizeX, UINT *pSizeY, UINT *pSizeZ) noexcept override; + STDMETHODIMP_(BOOL) + GetWaveSize(UINT *pWavePreferred, UINT *pWaveMin, + UINT *pWaveMax) noexcept override; + STDMETHODIMP_(UINT64) GetRequiresFlags(THIS) noexcept override; }; @@ -2776,6 +2780,21 @@ UINT DxilShaderReflection::GetThreadGroupSize(UINT *pSizeX, UINT *pSizeY, return x * y * z; } +BOOL DxilShaderReflection::GetWaveSize(UINT *pWavePreferred, UINT *pWaveMin, + UINT *pWaveMax) noexcept { + if (!m_pDxilModule->GetShaderModel()->IsCS()) { + AssignToOutOpt(0u, pWavePreferred); + AssignToOutOpt(0u, pWaveMin); + AssignToOutOpt(0u, pWaveMax); + return false; + } + DxilWaveSize waveSize = m_pDxilModule->GetWaveSize(); + AssignToOutOpt(waveSize.Preferred, pWavePreferred); + AssignToOutOpt(waveSize.Min, pWaveMin); + AssignToOutOpt(waveSize.Max, pWaveMax); + return true; +} + UINT64 DxilShaderReflection::GetRequiresFlags() noexcept { UINT64 result = m_pDxilModule->m_ShaderFlags.GetFeatureInfo(); // FeatureInfo flags are identical, with the exception of a collision between: From 2b92066354e689170cff9cb5ea66f0ea42eb80e9 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 19:36:18 +0200 Subject: [PATCH 12/62] WSL Stubs shouldn't be included by default anymore for linux, since directx headers have their own way of handling with it --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 263b3cb400..e17e67eaab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -689,11 +689,7 @@ if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -if(NOT WIN32) - include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) -else() - include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) -endif() +include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) # HLSL - Change End From 666dfaeaea4230fea9a4bd8486c947cb86a48c54 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 19:37:37 +0200 Subject: [PATCH 13/62] Fixed formatting issue --- external/SPIRV-Tools | 2 +- lib/HLSL/DxilContainerReflection.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/SPIRV-Tools b/external/SPIRV-Tools index 0cfe9e7219..65ecc5c6c1 160000 --- a/external/SPIRV-Tools +++ b/external/SPIRV-Tools @@ -1 +1 @@ -Subproject commit 0cfe9e7219148716dfd30b37f4d21753f098707a +Subproject commit 65ecc5c6c1a3dad2c0b19a83f0d87f243421f933 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 25feeb020f..aaa49129e4 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -266,7 +266,7 @@ class DxilShaderReflection : public DxilModuleReflection, STDMETHODIMP_(BOOL) GetWaveSize(UINT *pWavePreferred, UINT *pWaveMin, - UINT *pWaveMax) noexcept override; + UINT *pWaveMax) noexcept override; STDMETHODIMP_(UINT64) GetRequiresFlags(THIS) noexcept override; }; From 8be0aaefe6433fa7a47e885b23ae542c9f965722 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 19:46:24 +0200 Subject: [PATCH 14/62] Apparently WSL stubs were not the issue on the remote --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e17e67eaab..263b3cb400 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -689,7 +689,11 @@ if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) +if(NOT WIN32) + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) +else() + include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) +endif() # HLSL - Change End From 895f80ad6f7259c0897554c512f541330302947e Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 20:27:06 +0200 Subject: [PATCH 15/62] Changed ID3D12ShaderReflection to ID3D12ShaderReflection1 and implemented it in QueryInterface --- external/DirectX-Headers | 2 +- lib/HLSL/DxilContainerReflection.cpp | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index aa7d10e967..80dfa9fd45 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit aa7d10e967f14ef8641503a022f4608da2e5f5a5 +Subproject commit 80dfa9fd451138eb3ffdd540c3cbebd966c34034 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index aaa49129e4..c8372a76ba 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -161,7 +161,7 @@ class DxilModuleReflection { }; class DxilShaderReflection : public DxilModuleReflection, - public ID3D12ShaderReflection { + public ID3D12ShaderReflection1 { private: DXC_MICROCOM_TM_REF_FIELDS() std::vector m_InputSignature; @@ -183,7 +183,8 @@ class DxilShaderReflection : public DxilModuleReflection, void SetPublicAPI(PublicAPI value) { m_PublicAPI = value; } static PublicAPI IIDToAPI(REFIID iid) { PublicAPI api = PublicAPI::Invalid; - if (IsEqualIID(__uuidof(ID3D12ShaderReflection), iid)) + if (IsEqualIID(__uuidof(ID3D12ShaderReflection), iid) || + IsEqualIID(__uuidof(ID3D12ShaderReflection1), iid)) api = PublicAPI::D3D12; else if (IsEqualIID(IID_ID3D11ShaderReflection_43, iid)) api = PublicAPI::D3D11_43; @@ -198,22 +199,30 @@ class DxilShaderReflection : public DxilModuleReflection, HRESULT hr = E_NOINTERFACE; // There is non-standard handling of QueryInterface: - // - although everything uses the same vtable as ID3D12ShaderReflection, + // - although d3d11 and older d3d12 use the same vtable as ID3D12ShaderReflection, // there are differences in behavior depending on the API version, and // there are 3 of these - it's not just d3d11 vs d3d12. + // - This changed in latest d3d12 when ID3D12ShaderReflection1 was introduced to be non-breaking. // - when the object is created the API version is fixed // - from that point on, this object can only be QI'd for the matching API // version. PublicAPI api = IIDToAPI(iid); - if (api == m_PublicAPI) { - *ppvObject = static_cast(this); - this->AddRef(); + + if (IsEqualIID(__uuidof(ID3D12ShaderReflection1), iid)) { + *ppvObject = static_cast(this); + hr = S_OK; + } + else if (api == m_PublicAPI) { + *ppvObject = static_cast(this); hr = S_OK; } else if (IsEqualIID(__uuidof(IUnknown), iid)) { *ppvObject = static_cast(this); - this->AddRef(); hr = S_OK; } + + if (hr == S_OK) + this->AddRef(); + return hr; } From 5676799d71103566b1cfe6b694f083514bdae7e4 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 20:40:23 +0200 Subject: [PATCH 16/62] Reformat to align to styleguide --- lib/HLSL/DxilContainerReflection.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index c8372a76ba..8623d182fb 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -199,21 +199,22 @@ class DxilShaderReflection : public DxilModuleReflection, HRESULT hr = E_NOINTERFACE; // There is non-standard handling of QueryInterface: - // - although d3d11 and older d3d12 use the same vtable as ID3D12ShaderReflection, + // - although d3d11 and older d3d12 use the same vtable as + // ID3D12ShaderReflection, // there are differences in behavior depending on the API version, and // there are 3 of these - it's not just d3d11 vs d3d12. - // - This changed in latest d3d12 when ID3D12ShaderReflection1 was introduced to be non-breaking. + // - This changed in latest d3d12 when ID3D12ShaderReflection1 was + // introduced to be non-breaking. // - when the object is created the API version is fixed // - from that point on, this object can only be QI'd for the matching API // version. PublicAPI api = IIDToAPI(iid); if (IsEqualIID(__uuidof(ID3D12ShaderReflection1), iid)) { - *ppvObject = static_cast(this); + *ppvObject = static_cast(this); hr = S_OK; - } - else if (api == m_PublicAPI) { - *ppvObject = static_cast(this); + } else if (api == m_PublicAPI) { + *ppvObject = static_cast(this); hr = S_OK; } else if (IsEqualIID(__uuidof(IUnknown), iid)) { *ppvObject = static_cast(this); From 6bc299eab38256507356b8f91730fc1727dcb108 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Mon, 5 Aug 2024 21:31:44 +0200 Subject: [PATCH 17/62] Amplification and mesh shaders have thread count too --- external/DirectX-Headers | 2 +- lib/HLSL/DxilContainerReflection.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 80dfa9fd45..3a96f3456e 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 80dfa9fd451138eb3ffdd540c3cbebd966c34034 +Subproject commit 3a96f3456ef01d9a2c9f3cc1272e511045d3b7c2 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 8623d182fb..e81ee78208 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -3070,13 +3070,23 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { m_pProps->ShaderProps.MS.maxVertexCount, m_pProps->ShaderProps.MS.maxPrimitiveCount, (D3D12_MESH_OUTPUT_TOPOLOGY)m_pProps->ShaderProps.MS.outputTopology, + { + m_pProps->numThreads[0], + m_pProps->numThreads[1], + m_pProps->numThreads[2] + } }; break; case ShaderKind::Amplification: pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ - m_pProps->ShaderProps.AS.payloadSizeInBytes}; + m_pProps->ShaderProps.AS.payloadSizeInBytes, + { + m_pProps->numThreads[0], + m_pProps->numThreads[1], + m_pProps->numThreads[2] + }}; break; case ShaderKind::Node: From 8b97460738d505e6e24f9e03f42d598bb1c76ac2 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 11:46:15 +0200 Subject: [PATCH 18/62] Fixed formatting --- external/DirectX-Headers | 2 +- lib/HLSL/DxilContainerReflection.cpp | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 3a96f3456e..fb6a5a3776 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 3a96f3456ef01d9a2c9f3cc1272e511045d3b7c2 +Subproject commit fb6a5a3776872a6874e658c66fb38280db31a215 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index e81ee78208..ef1cce0840 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -3070,23 +3070,16 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { m_pProps->ShaderProps.MS.maxVertexCount, m_pProps->ShaderProps.MS.maxPrimitiveCount, (D3D12_MESH_OUTPUT_TOPOLOGY)m_pProps->ShaderProps.MS.outputTopology, - { - m_pProps->numThreads[0], - m_pProps->numThreads[1], - m_pProps->numThreads[2] - } - }; + {m_pProps->numThreads[0], m_pProps->numThreads[1], + m_pProps->numThreads[2]}}; break; case ShaderKind::Amplification: pDesc->ShaderType = D3D12_SHVER_AMPLIFICATION_SHADER; pDesc->AmplificationShader = D3D12_AMPLIFICATION_SHADER_DESC{ m_pProps->ShaderProps.AS.payloadSizeInBytes, - { - m_pProps->numThreads[0], - m_pProps->numThreads[1], - m_pProps->numThreads[2] - }}; + {m_pProps->numThreads[0], m_pProps->numThreads[1], + m_pProps->numThreads[2]}}; break; case ShaderKind::Node: From 2109491ef1c2dcbadab03db1dabbd787b4d423ae Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 14:14:14 +0200 Subject: [PATCH 19/62] Added support for viewing descs in dxa. --- include/dxc/Test/D3DReflectionDumper.h | 12 ++ include/dxc/Test/D3DReflectionStrings.h | 2 + lib/DxilContainer/D3DReflectionDumper.cpp | 207 +++++++++++++++++++++ lib/DxilContainer/D3DReflectionStrings.cpp | 56 ++++++ tools/clang/tools/dxa/dxa.cpp | 2 +- 5 files changed, 278 insertions(+), 1 deletion(-) diff --git a/include/dxc/Test/D3DReflectionDumper.h b/include/dxc/Test/D3DReflectionDumper.h index 9ecd7f5b62..e14cb068f9 100644 --- a/include/dxc/Test/D3DReflectionDumper.h +++ b/include/dxc/Test/D3DReflectionDumper.h @@ -38,10 +38,20 @@ class D3DReflectionDumper : public DumpContext { void Dump(D3D12_SHADER_BUFFER_DESC &Desc); void Dump(D3D12_SHADER_INPUT_BIND_DESC &resDesc); void Dump(D3D12_SIGNATURE_PARAMETER_DESC &elDesc); + void Dump(D3D12_NODE_SHADER_DESC &Desc); + void Dump(D3D12_HULL_SHADER_DESC &Desc); + void Dump(D3D12_COMPUTE_SHADER_DESC &Desc); + void Dump(D3D12_MESH_SHADER_DESC &Desc); + void Dump(D3D12_GEOMETRY_SHADER_DESC &Desc); + void Dump(D3D12_DOMAIN_SHADER_DESC &Desc); + void Dump(D3D12_NODE_ID_DESC &Desc, const char *name); + void Dump(D3D12_NODE_DESC &Desc); void Dump(D3D12_SHADER_DESC &Desc); void Dump(D3D12_FUNCTION_DESC &Desc); void Dump(D3D12_LIBRARY_DESC &Desc); + void Dump(D3D12_FUNCTION_DESC1 &Desc); + void Dump(ID3D12ShaderReflectionType *pType); void Dump(ID3D12ShaderReflectionVariable *pVar); @@ -49,7 +59,9 @@ class D3DReflectionDumper : public DumpContext { void Dump(ID3D12ShaderReflection *pShaderReflection); void Dump(ID3D12FunctionReflection *pFunctionReflection); + void Dump(ID3D12FunctionReflection1 *pFunctionReflection); void Dump(ID3D12LibraryReflection *pLibraryReflection); + void Dump(ID3D12LibraryReflection1 *pLibraryReflection); }; } // namespace dump diff --git a/include/dxc/Test/D3DReflectionStrings.h b/include/dxc/Test/D3DReflectionStrings.h index 5e97ac9f4f..4a60727eca 100644 --- a/include/dxc/Test/D3DReflectionStrings.h +++ b/include/dxc/Test/D3DReflectionStrings.h @@ -39,6 +39,8 @@ LPCSTR ToString(D3D_PARAMETER_FLAGS Flag); LPCSTR ToString(D3D_NAME Name); LPCSTR ToString(D3D_REGISTER_COMPONENT_TYPE CompTy); LPCSTR ToString(D3D_MIN_PRECISION MinPrec); +LPCSTR ToString(D3D12_NODE_LAUNCH_TYPE NodeLaunchType); +LPCSTR ToString(D3D12_DISPATCH_COMPONENT_TYPE DispatchComponentType); LPCSTR CompMaskToString(unsigned CompMask); // These macros declare the ToString functions for DXC types diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 1dc5dc4533..e5cbc91486 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -73,6 +73,9 @@ void D3DReflectionDumper::DumpShaderVersion(UINT Version) { case (UINT)hlsl::DXIL::ShaderKind::Amplification: szType = "Amplification"; break; + case (UINT)hlsl::DXIL::ShaderKind::Node: + szType = "Node"; + break; case (UINT)hlsl::DXIL::ShaderKind::Invalid: szType = "Invalid"; break; @@ -145,6 +148,111 @@ void D3DReflectionDumper::Dump(D3D12_SIGNATURE_PARAMETER_DESC &elDesc) { DumpEnum("MinPrecision", elDesc.MinPrecision); Dedent(); } +void D3DReflectionDumper::Dump(D3D12_NODE_SHADER_DESC &Desc) { + WriteLn("D3D12_NODE_SHADER_DESC:"); + Indent(); + Dump(Desc.ComputeDesc); + DumpEnum("LaunchType", Desc.LaunchType); + WriteLn("IsProgramEntry: ", Desc.IsProgramEntry ? "TRUE" : "FALSE"); + WriteLn("LocalRootArgumentsTableIndex: ", std::dec, Desc.LocalRootArgumentsTableIndex); + WriteLn("DispatchGrid[0]: ", std::dec, Desc.DispatchGrid[0]); + WriteLn("DispatchGrid[1]: ", std::dec, Desc.DispatchGrid[1]); + WriteLn("DispatchGrid[2]: ", std::dec, Desc.DispatchGrid[2]); + WriteLn("MaxDispatchGrid[0]: ", std::dec, Desc.MaxDispatchGrid[0]); + WriteLn("MaxDispatchGrid[1]: ", std::dec, Desc.MaxDispatchGrid[1]); + WriteLn("MaxDispatchGrid[2]: ", std::dec, Desc.MaxDispatchGrid[2]); + WriteLn("MaxRecursionDepth: ", std::dec, Desc.MaxRecursionDepth); + Dump(Desc.ShaderId, "ShaderId"); + Dump(Desc.ShaderId, "ShaderSharedInput"); + WriteLn("InputNodes: ", std::dec, Desc.InputNodes); + WriteLn("OutputNodes: ", std::dec, Desc.OutputNodes); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_HULL_SHADER_DESC &Desc) { + WriteLn("D3D12_HULL_SHADER_DESC:"); + Indent(); + DumpEnum("Domain", Desc.Domain); + DumpEnum("Partition", Desc.Partition); + DumpEnum("OutputPrimitive", Desc.OutputPrimitive); + WriteLn("InputControlPoints: ", std::dec, Desc.InputControlPoints); + WriteLn("OutputControlPoints: ", std::dec, Desc.OutputControlPoints); + WriteLn("MaxTessFactor: ", Desc.MaxTessFactor); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_COMPUTE_SHADER_DESC &Desc) { + WriteLn("D3D12_COMPUTE_SHADER_DESC:"); + Indent(); + if (Desc.WaveSizeMin | Desc.WaveSizeMax | Desc.WaveSizePreferred) + WriteLn("WaveSize: min: ", std::dec, Desc.WaveSizeMin, + ", max: ", Desc.WaveSizeMax, + ", preferred: ", Desc.WaveSizePreferred); + WriteLn("NumThreads: ", std::dec, Desc.NumThreads[0], ", ", + Desc.NumThreads[1], ", ", Desc.NumThreads[2]); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_MESH_SHADER_DESC &Desc) { + WriteLn("D3D12_MESH_SHADER_DESC:"); + Indent(); + WriteLn("PayloadSize: ", std::dec, Desc.PayloadSize); + WriteLn("MaxVertexCount: ", std::dec, Desc.MaxVertexCount); + WriteLn("MaxPrimitiveCount: ", std::dec, Desc.MaxPrimitiveCount); + WriteLn("OutputTopology: ", + Desc.OutputTopology == D3D12_MESH_OUTPUT_TOPOLOGY_LINE ? "Line" + : "Triangle"); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_GEOMETRY_SHADER_DESC &Desc) { + WriteLn("D3D12_GEOMETRY_SHADER_DESC:"); + Indent(); + DumpEnum("InputPrimitive", Desc.InputPrimitive); + WriteLn("MaxVertexCount: ", std::dec, Desc.MaxVertexCount); + WriteLn("InstanceCount: ", std::dec, Desc.InstanceCount); + DumpEnum("StreamPrimitiveTopologies[0]", Desc.StreamPrimitiveTopologies[0]); + DumpEnum("StreamPrimitiveTopologies[1]", Desc.StreamPrimitiveTopologies[1]); + DumpEnum("StreamPrimitiveTopologies[2]", Desc.StreamPrimitiveTopologies[2]); + DumpEnum("StreamPrimitiveTopologies[3]", Desc.StreamPrimitiveTopologies[3]); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_DOMAIN_SHADER_DESC &Desc) { + WriteLn("D3D12_DOMAIN_SHADER_DESC:"); + Indent(); + DumpEnum("Domain", Desc.Domain); + WriteLn("InputControlPoints: ", std::dec, Desc.InputControlPoints); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_NODE_ID_DESC &Desc, const char *name) { + WriteLn("D3D12_NODE_ID_DESC:"); + Indent(); + WriteLn("Name: ", Desc.Name); + WriteLn("ID: ", std::dec, Desc.ID); + Dedent(); +} +void D3DReflectionDumper::Dump(D3D12_NODE_DESC &Desc) { + WriteLn("D3D12_NODE_DESC:"); + Indent(); + WriteLn("Flags: ", std::hex, std::showbase, Desc.Flags); + + WriteLn("Type:"); + Indent(); + WriteLn("Size", std::dec, Desc.Type.Size); + WriteLn("Alignment", std::dec, Desc.Type.Alignment); + + WriteLn("DispatchGrid:"); + Indent(); + WriteLn("ByteOffset", std::dec, Desc.Type.DispatchGrid.ByteOffset); + DumpEnum("ComponentType", Desc.Type.DispatchGrid.ComponentType); + WriteLn("NumComponents, std::dec", Desc.Type.DispatchGrid.NumComponents); + Dedent(); + + Dedent(); + + Dump(Desc.OutputID, "OutputID"); + WriteLn("MaxRecords: ", std::dec, Desc.MaxRecords); + WriteLn("MaxRecordsSharedWith: ", std::dec, Desc.MaxRecordsSharedWith); + WriteLn("OutputArraySize: ", std::dec, Desc.OutputArraySize); + WriteLn("AllowSparseNodes: ", Desc.AllowSparseNodes ? "TRUE" : "FALSE"); + Dedent(); +} void D3DReflectionDumper::Dump(D3D12_SHADER_DESC &Desc) { WriteLn("D3D12_SHADER_DESC:"); Indent(); @@ -217,6 +325,51 @@ void D3DReflectionDumper::Dump(D3D12_FUNCTION_DESC &Desc) { WriteLn("HasReturn: ", Desc.HasReturn ? "TRUE" : "FALSE"); Dedent(); } +void D3DReflectionDumper::Dump(D3D12_FUNCTION_DESC1 &Desc) { + WriteLn("D3D12_FUNCTION_DESC1: "); + Indent(); + WriteLn("RootSignatureSize: ", std::dec, Desc.RootSignatureSize); + switch (Desc.ShaderType) { + case D3D12_SHVER_NODE_SHADER: + Dump(Desc.NodeShader); + break; + case D3D12_SHVER_HULL_SHADER: + Dump(Desc.HullShader); + break; + case D3D12_SHVER_COMPUTE_SHADER: + Dump(Desc.ComputeShader); + break; + case D3D12_SHVER_MESH_SHADER: + Dump(Desc.MeshShader); + break; + case D3D12_SHVER_GEOMETRY_SHADER: + Dump(Desc.GeometryShader); + break; + case D3D12_SHVER_DOMAIN_SHADER: + Dump(Desc.DomainShader); + break; + case D3D12_SHVER_AMPLIFICATION_SHADER: + WriteLn("PayloadSize: ", std::dec, + Desc.AmplificationShader.PayloadSize); + break; + case D3D12_SHVER_PIXEL_SHADER: + WriteLn("EarlyDepthStencil: ", + Desc.PixelShader.EarlyDepthStencil ? "TRUE" : "FALSE"); + break; + case D3D12_SHVER_CALLABLE_SHADER: + case D3D12_SHVER_INTERSECTION_SHADER: + case D3D12_SHVER_ANY_HIT_SHADER: + case D3D12_SHVER_CLOSEST_HIT_SHADER: + WriteLn("AttributeSize: ", std::dec, + Desc.RaytracingShader.AttributeSize); + // fallthrough + case D3D12_SHVER_MISS_SHADER: + WriteLn("ParamPayloadSize: ", std::dec, + Desc.RaytracingShader.ParamPayloadSize); + break; + } + Dedent(); +} void D3DReflectionDumper::Dump(D3D12_LIBRARY_DESC &Desc) { WriteLn("D3D12_LIBRARY_DESC:"); Indent(); @@ -468,6 +621,41 @@ void D3DReflectionDumper::Dump(ID3D12FunctionReflection *pFunctionReflection) { Dedent(); } +void D3DReflectionDumper::Dump(ID3D12FunctionReflection1 *pFunctionReflection) { + WriteLn("ID3D12FunctionReflection1:"); + Indent(); + D3D12_FUNCTION_DESC1 Desc; + if (!pFunctionReflection || FAILED(pFunctionReflection->GetDesc1(&Desc))) { + Failure("GetDesc1"); + Dedent(); + return; + } + Dump(Desc); + if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && Desc.NodeShader.InputNodes) { + WriteLn("Input Nodes:"); + Indent(); + for (UINT i = 0; i < Desc.NodeShader.InputNodes; i++) { + D3D12_NODE_DESC pND{}; + if(FAILED(pFunctionReflection->GetInputNode(i, &pND))) + Failure("GetInputNode", m_LastName); + else Dump(pND); + } + Dedent(); + } + if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && Desc.NodeShader.OutputNodes) { + WriteLn("Output Nodes:"); + Indent(); + for (UINT i = 0; i < Desc.NodeShader.OutputNodes; i++) { + D3D12_NODE_DESC pND{}; + if(FAILED(pFunctionReflection->GetOutputNode(i, &pND))) + Failure("GetOutputNode", m_LastName); + else Dump(pND); + } + Dedent(); + } + Dedent(); +} + void D3DReflectionDumper::Dump(ID3D12LibraryReflection *pLibraryReflection) { WriteLn("ID3D12LibraryReflection:"); Indent(); @@ -485,5 +673,24 @@ void D3DReflectionDumper::Dump(ID3D12LibraryReflection *pLibraryReflection) { Dedent(); } +void D3DReflectionDumper::Dump(ID3D12LibraryReflection1 *pLibraryReflection) { + WriteLn("ID3D12LibraryReflection1:"); + Indent(); + D3D12_LIBRARY_DESC Desc; + if (!pLibraryReflection || FAILED(pLibraryReflection->GetDesc(&Desc))) { + Failure("GetDesc"); + Dedent(); + return; + } + Dump(Desc); + if (Desc.FunctionCount) { + for (UINT uFunc = 0; uFunc < Desc.FunctionCount; uFunc++) { + Dump(pLibraryReflection->GetFunctionByIndex((INT)uFunc)); + Dump(pLibraryReflection->GetFunctionByIndex1((INT)uFunc)); + } + } + Dedent(); +} + } // namespace dump } // namespace hlsl diff --git a/lib/DxilContainer/D3DReflectionStrings.cpp b/lib/DxilContainer/D3DReflectionStrings.cpp index 03387b22ed..426cd7f136 100644 --- a/lib/DxilContainer/D3DReflectionStrings.cpp +++ b/lib/DxilContainer/D3DReflectionStrings.cpp @@ -674,6 +674,62 @@ LPCSTR ToString(D3D_MIN_PRECISION MinPrec) { return nullptr; } +LPCSTR ToString(D3D12_NODE_LAUNCH_TYPE NodeLaunchType) { + switch (NodeLaunchType) { + case D3D12_NODE_LAUNCH_TYPE_NONE: + return "D3D12_NODE_LAUNCH_TYPE_NONE"; + case D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH: + return "D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH"; + case D3D12_NODE_LAUNCH_TYPE_COALESCING_LAUNCH: + return "D3D12_NODE_LAUNCH_TYPE_COALESCING_LAUNCH"; + case D3D12_NODE_LAUNCH_TYPE_THREAD_LAUNCH: + return "D3D12_NODE_LAUNCH_TYPE_THREAD_LAUNCH"; + } + return nullptr; +} + +LPCSTR ToString(D3D12_DISPATCH_COMPONENT_TYPE DispatchComponentType) { + switch (DispatchComponentType) { + case D3D12_DISPATCH_COMPONENT_TYPE_I1: + return "D3D12_DISPATCH_COMPONENT_TYPE_I1"; + case D3D12_DISPATCH_COMPONENT_TYPE_I16: + return "D3D12_DISPATCH_COMPONENT_TYPE_I16"; + case D3D12_DISPATCH_COMPONENT_TYPE_U16: + return "D3D12_DISPATCH_COMPONENT_TYPE_U16"; + case D3D12_DISPATCH_COMPONENT_TYPE_I32: + return "D3D12_DISPATCH_COMPONENT_TYPE_I32"; + case D3D12_DISPATCH_COMPONENT_TYPE_U32: + return "D3D12_DISPATCH_COMPONENT_TYPE_U32"; + case D3D12_DISPATCH_COMPONENT_TYPE_I64: + return "D3D12_DISPATCH_COMPONENT_TYPE_I64"; + case D3D12_DISPATCH_COMPONENT_TYPE_U64: + return "D3D12_DISPATCH_COMPONENT_TYPE_U64"; + case D3D12_DISPATCH_COMPONENT_TYPE_F16: + return "D3D12_DISPATCH_COMPONENT_TYPE_F16"; + case D3D12_DISPATCH_COMPONENT_TYPE_F32: + return "D3D12_DISPATCH_COMPONENT_TYPE_F32"; + case D3D12_DISPATCH_COMPONENT_TYPE_F64: + return "D3D12_DISPATCH_COMPONENT_TYPE_F64"; + case D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F16: + return "D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F16"; + case D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F16: + return "D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F16"; + case D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F32: + return "D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F32"; + case D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F32: + return "D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F32"; + case D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F64: + return "D3D12_DISPATCH_COMPONENT_TYPE_SNORM_F64"; + case D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F64: + return "D3D12_DISPATCH_COMPONENT_TYPE_UNORM_F64"; + case D3D12_DISPATCH_COMPONENT_TYPE_PACKED_S8X32: + return "D3D12_DISPATCH_COMPONENT_TYPE_PACKED_S8X32"; + case D3D12_DISPATCH_COMPONENT_TYPE_PACKED_U8X32: + return "D3D12_DISPATCH_COMPONENT_TYPE_PACKED_U8X32"; + } + return nullptr; +} + LPCSTR CompMaskToString(unsigned CompMask) { static const LPCSTR masks[16] = { "----", "x---", "-y--", "xy--", "--z-", "x-z-", "-yz-", "xyz-", diff --git a/tools/clang/tools/dxa/dxa.cpp b/tools/clang/tools/dxa/dxa.cpp index 2bffe1da3a..3ff1abaaa6 100644 --- a/tools/clang/tools/dxa/dxa.cpp +++ b/tools/clang/tools/dxa/dxa.cpp @@ -419,7 +419,7 @@ void DxaContext::DumpReflection() { hlsl::dump::D3DReflectionDumper dumper(ss); CComPtr pShaderReflection; - CComPtr pLibraryReflection; + CComPtr pLibraryReflection; for (uint32_t i = 0; i < partCount; ++i) { uint32_t kind; IFT(pReflection->GetPartKind(i, &kind)); From ea62c4b75c58b9e669e7020015ff0f98d4a483b5 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 14:26:08 +0200 Subject: [PATCH 20/62] Exposed compute shader WaveSizeMin/Max/Preferred and mesh/amplification shaders numthreads to dxa. --- include/dxc/Test/D3DReflectionDumper.h | 1 + lib/DxilContainer/D3DReflectionDumper.cpp | 27 +++++++++++++++++++++++ tools/clang/tools/dxa/dxa.cpp | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/dxc/Test/D3DReflectionDumper.h b/include/dxc/Test/D3DReflectionDumper.h index e14cb068f9..bc125682a5 100644 --- a/include/dxc/Test/D3DReflectionDumper.h +++ b/include/dxc/Test/D3DReflectionDumper.h @@ -58,6 +58,7 @@ class D3DReflectionDumper : public DumpContext { void Dump(ID3D12ShaderReflectionConstantBuffer *pCBReflection); void Dump(ID3D12ShaderReflection *pShaderReflection); + void Dump(ID3D12ShaderReflection1 *pShaderReflection); void Dump(ID3D12FunctionReflection *pFunctionReflection); void Dump(ID3D12FunctionReflection1 *pFunctionReflection); void Dump(ID3D12LibraryReflection *pLibraryReflection); diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index e5cbc91486..b06d7da065 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -199,6 +199,8 @@ void D3DReflectionDumper::Dump(D3D12_MESH_SHADER_DESC &Desc) { WriteLn("OutputTopology: ", Desc.OutputTopology == D3D12_MESH_OUTPUT_TOPOLOGY_LINE ? "Line" : "Triangle"); + WriteLn("NumThreads: ", std::dec, Desc.NumThreads[0], ", ", + Desc.NumThreads[1], ", ", Desc.NumThreads[2]); Dedent(); } void D3DReflectionDumper::Dump(D3D12_GEOMETRY_SHADER_DESC &Desc) { @@ -351,6 +353,9 @@ void D3DReflectionDumper::Dump(D3D12_FUNCTION_DESC1 &Desc) { case D3D12_SHVER_AMPLIFICATION_SHADER: WriteLn("PayloadSize: ", std::dec, Desc.AmplificationShader.PayloadSize); + WriteLn("NumThreads: ", std::dec, Desc.AmplificationShader.NumThreads[0], + ", ", Desc.AmplificationShader.NumThreads[1], ", ", + Desc.AmplificationShader.NumThreads[2]); break; case D3D12_SHVER_PIXEL_SHADER: WriteLn("EarlyDepthStencil: ", @@ -561,6 +566,28 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection) { // TODO Dedent(); } +void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { + + ID3D12ShaderReflection *shaderRefl0 = nullptr; + if (FAILED(pShaderReflection->QueryInterface(IID_PPV_ARGS(&shaderRefl0)))) { + Failure("QueryInterface ID3D12ShaderReflection"); + return; + } + + Dump(shaderRefl0); + + UINT waveSizePreferred = 0, waveSizeMin = 0, waveSizeMax = 0; + + if (!pShaderReflection->GetWaveSize(&waveSizePreferred, &waveSizeMin, &waveSizeMax)) + return; + + WriteLn("ID3D12ShaderReflection1:"); + Indent(); + WriteLn("WaveSizePreferred: ", waveSizePreferred); + WriteLn("WaveSizeMin: ", waveSizeMin); + WriteLn("WaveSizeMax: ", waveSizeMax); + Dedent(); +} void D3DReflectionDumper::Dump(ID3D12FunctionReflection *pFunctionReflection) { WriteLn("ID3D12FunctionReflection:"); diff --git a/tools/clang/tools/dxa/dxa.cpp b/tools/clang/tools/dxa/dxa.cpp index 3ff1abaaa6..4ad5bbf527 100644 --- a/tools/clang/tools/dxa/dxa.cpp +++ b/tools/clang/tools/dxa/dxa.cpp @@ -418,7 +418,7 @@ void DxaContext::DumpReflection() { std::ostringstream ss; hlsl::dump::D3DReflectionDumper dumper(ss); - CComPtr pShaderReflection; + CComPtr pShaderReflection; CComPtr pLibraryReflection; for (uint32_t i = 0; i < partCount; ++i) { uint32_t kind; From 530970c81138d2a7298a8708141e3a91eb7b3a8e Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 14:28:34 +0200 Subject: [PATCH 21/62] Formatting --- lib/DxilContainer/D3DReflectionDumper.cpp | 100 +++++++++++----------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index b06d7da065..1358e0bd74 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -154,7 +154,8 @@ void D3DReflectionDumper::Dump(D3D12_NODE_SHADER_DESC &Desc) { Dump(Desc.ComputeDesc); DumpEnum("LaunchType", Desc.LaunchType); WriteLn("IsProgramEntry: ", Desc.IsProgramEntry ? "TRUE" : "FALSE"); - WriteLn("LocalRootArgumentsTableIndex: ", std::dec, Desc.LocalRootArgumentsTableIndex); + WriteLn("LocalRootArgumentsTableIndex: ", std::dec, + Desc.LocalRootArgumentsTableIndex); WriteLn("DispatchGrid[0]: ", std::dec, Desc.DispatchGrid[0]); WriteLn("DispatchGrid[1]: ", std::dec, Desc.DispatchGrid[1]); WriteLn("DispatchGrid[2]: ", std::dec, Desc.DispatchGrid[2]); @@ -332,46 +333,44 @@ void D3DReflectionDumper::Dump(D3D12_FUNCTION_DESC1 &Desc) { Indent(); WriteLn("RootSignatureSize: ", std::dec, Desc.RootSignatureSize); switch (Desc.ShaderType) { - case D3D12_SHVER_NODE_SHADER: - Dump(Desc.NodeShader); - break; - case D3D12_SHVER_HULL_SHADER: - Dump(Desc.HullShader); - break; - case D3D12_SHVER_COMPUTE_SHADER: - Dump(Desc.ComputeShader); - break; - case D3D12_SHVER_MESH_SHADER: - Dump(Desc.MeshShader); - break; - case D3D12_SHVER_GEOMETRY_SHADER: - Dump(Desc.GeometryShader); - break; - case D3D12_SHVER_DOMAIN_SHADER: - Dump(Desc.DomainShader); - break; - case D3D12_SHVER_AMPLIFICATION_SHADER: - WriteLn("PayloadSize: ", std::dec, - Desc.AmplificationShader.PayloadSize); - WriteLn("NumThreads: ", std::dec, Desc.AmplificationShader.NumThreads[0], - ", ", Desc.AmplificationShader.NumThreads[1], ", ", - Desc.AmplificationShader.NumThreads[2]); - break; - case D3D12_SHVER_PIXEL_SHADER: - WriteLn("EarlyDepthStencil: ", - Desc.PixelShader.EarlyDepthStencil ? "TRUE" : "FALSE"); - break; - case D3D12_SHVER_CALLABLE_SHADER: - case D3D12_SHVER_INTERSECTION_SHADER: - case D3D12_SHVER_ANY_HIT_SHADER: - case D3D12_SHVER_CLOSEST_HIT_SHADER: - WriteLn("AttributeSize: ", std::dec, - Desc.RaytracingShader.AttributeSize); - // fallthrough - case D3D12_SHVER_MISS_SHADER: - WriteLn("ParamPayloadSize: ", std::dec, - Desc.RaytracingShader.ParamPayloadSize); - break; + case D3D12_SHVER_NODE_SHADER: + Dump(Desc.NodeShader); + break; + case D3D12_SHVER_HULL_SHADER: + Dump(Desc.HullShader); + break; + case D3D12_SHVER_COMPUTE_SHADER: + Dump(Desc.ComputeShader); + break; + case D3D12_SHVER_MESH_SHADER: + Dump(Desc.MeshShader); + break; + case D3D12_SHVER_GEOMETRY_SHADER: + Dump(Desc.GeometryShader); + break; + case D3D12_SHVER_DOMAIN_SHADER: + Dump(Desc.DomainShader); + break; + case D3D12_SHVER_AMPLIFICATION_SHADER: + WriteLn("PayloadSize: ", std::dec, Desc.AmplificationShader.PayloadSize); + WriteLn("NumThreads: ", std::dec, Desc.AmplificationShader.NumThreads[0], + ", ", Desc.AmplificationShader.NumThreads[1], ", ", + Desc.AmplificationShader.NumThreads[2]); + break; + case D3D12_SHVER_PIXEL_SHADER: + WriteLn("EarlyDepthStencil: ", + Desc.PixelShader.EarlyDepthStencil ? "TRUE" : "FALSE"); + break; + case D3D12_SHVER_CALLABLE_SHADER: + case D3D12_SHVER_INTERSECTION_SHADER: + case D3D12_SHVER_ANY_HIT_SHADER: + case D3D12_SHVER_CLOSEST_HIT_SHADER: + WriteLn("AttributeSize: ", std::dec, Desc.RaytracingShader.AttributeSize); + // fallthrough + case D3D12_SHVER_MISS_SHADER: + WriteLn("ParamPayloadSize: ", std::dec, + Desc.RaytracingShader.ParamPayloadSize); + break; } Dedent(); } @@ -578,7 +577,8 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { UINT waveSizePreferred = 0, waveSizeMin = 0, waveSizeMax = 0; - if (!pShaderReflection->GetWaveSize(&waveSizePreferred, &waveSizeMin, &waveSizeMax)) + if (!pShaderReflection->GetWaveSize(&waveSizePreferred, &waveSizeMin, + &waveSizeMax)) return; WriteLn("ID3D12ShaderReflection1:"); @@ -658,25 +658,29 @@ void D3DReflectionDumper::Dump(ID3D12FunctionReflection1 *pFunctionReflection) { return; } Dump(Desc); - if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && Desc.NodeShader.InputNodes) { + if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && + Desc.NodeShader.InputNodes) { WriteLn("Input Nodes:"); Indent(); for (UINT i = 0; i < Desc.NodeShader.InputNodes; i++) { D3D12_NODE_DESC pND{}; - if(FAILED(pFunctionReflection->GetInputNode(i, &pND))) + if (FAILED(pFunctionReflection->GetInputNode(i, &pND))) Failure("GetInputNode", m_LastName); - else Dump(pND); + else + Dump(pND); } Dedent(); } - if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && Desc.NodeShader.OutputNodes) { + if (Desc.ShaderType == D3D12_SHVER_NODE_SHADER && + Desc.NodeShader.OutputNodes) { WriteLn("Output Nodes:"); Indent(); for (UINT i = 0; i < Desc.NodeShader.OutputNodes; i++) { D3D12_NODE_DESC pND{}; - if(FAILED(pFunctionReflection->GetOutputNode(i, &pND))) + if (FAILED(pFunctionReflection->GetOutputNode(i, &pND))) Failure("GetOutputNode", m_LastName); - else Dump(pND); + else + Dump(pND); } Dedent(); } From 3d777a01f81aac2fcea80629b2ea7201c0ab2c2a Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 15:49:43 +0200 Subject: [PATCH 22/62] Made sure guids are taken from DirectX-Headers d3d12.h rather than elsewhere. And removed duplicate definition from ExecutionTest.cpp --- .../unittests/HLSLExec/ExecutionTest.cpp | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index 0479926606..515b7c8537 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -44,12 +44,14 @@ #include "dxc/Support/FileIOHelper.h" #include "dxc/Support/Unicode.h" +#define INITGUID +#include "d3d12.h" + // -// d3d12.h and dxgi1_4.h are included in the Windows 10 SDK +// dxgi1_4.h is included in the Windows 10 SDK // https://msdn.microsoft.com/en-us/library/windows/desktop/dn899120(v=vs.85).aspx // https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk // -#include #include #include #include "dxc/Support/d3dx12.h" @@ -84,30 +86,6 @@ static const GUID D3D12ExperimentalShaderModelsID = typedef HRESULT(WINAPI *D3D12GetInterfaceFn)(REFCLSID rclsid, REFIID riid, void **ppvDebug); -#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__ -// Copied from AgilitySDK D3D12.h to programmatically enable when in developer -// mode. -#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__ - -EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D12SDKConfiguration = { - 0xe9eb5314, - 0x33aa, - 0x42b2, - {0xa7, 0x18, 0xd7, 0x7f, 0x58, 0xb1, 0xf1, 0xc7}}; -EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { - 0x7cda6aca, - 0xa03e, - 0x49c8, - {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; - -MIDL_INTERFACE("e9eb5314-33aa-42b2-a718-d77f58b1f1c7") -ID3D12SDKConfiguration : public IUnknown { -public: - virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, - LPCSTR SDKPath) = 0; -}; -#endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ - using namespace DirectX; using namespace hlsl_test; From 2457465cd217e6e1bafb986f5d018ee8602225ad Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 20:37:39 +0200 Subject: [PATCH 23/62] Undid breaking changes. WIP --- CMakeLists.txt | 7 +- external/CMakeLists.txt | 12 +- external/SPIRV-Tools | 2 +- include/dxc/Support/D3DReflection.h | 2 +- .../unittests/HLSLExec/ExecutionTest.cpp | 30 ++++- tools/dxexp/dxexp.cpp | 124 ++++++++++++++++++ 6 files changed, 160 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f4719dd6b..8f7db99784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -689,12 +689,7 @@ list(APPEND LLVM_COMMON_DEPENDS HCTGen) if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() - -if(NOT WIN32) - include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) -else() - include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) -endif() +include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) # HLSL - Change End diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index b56bc1d2ab..3a4e66a8a1 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -9,11 +9,13 @@ endif (NOT HLSL_ENABLE_DEBUG_ITERATORS) # Need DirectX-Headers module if not on windows if (NOT DIRECTX_HEADER_INCLUDE_DIR) - if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") - set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) - else() - message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") - endif() + if (NOT WIN32) + if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") + set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) + else() + message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") + endif() + endif (NOT WIN32) endif(NOT DIRECTX_HEADER_INCLUDE_DIR) # Enabling SPIR-V codegen requires SPIRV-Headers for spirv.hpp and diff --git a/external/SPIRV-Tools b/external/SPIRV-Tools index 65ecc5c6c1..626dfbff49 160000 --- a/external/SPIRV-Tools +++ b/external/SPIRV-Tools @@ -1 +1 @@ -Subproject commit 65ecc5c6c1a3dad2c0b19a83f0d87f243421f933 +Subproject commit 626dfbff49b53a5d054d4437d3bf3aa9ef85a6ee diff --git a/include/dxc/Support/D3DReflection.h b/include/dxc/Support/D3DReflection.h index 4e5c0684b3..aeb004c7bb 100644 --- a/include/dxc/Support/D3DReflection.h +++ b/include/dxc/Support/D3DReflection.h @@ -22,5 +22,5 @@ #undef interface #pragma GCC diagnostic pop #else -#include "d3d12shader.h" +#include #endif diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index f2e8029d64..f22e99e467 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -44,14 +44,12 @@ #include "dxc/Support/FileIOHelper.h" #include "dxc/Support/Unicode.h" -#define INITGUID -#include "d3d12.h" - // -// dxgi1_4.h is included in the Windows 10 SDK +// d3d12.h and dxgi1_4.h are included in the Windows 10 SDK // https://msdn.microsoft.com/en-us/library/windows/desktop/dn899120(v=vs.85).aspx // https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk // +#include #include #include #include "dxc/Support/d3dx12.h" @@ -86,6 +84,30 @@ static const GUID D3D12ExperimentalShaderModelsID = typedef HRESULT(WINAPI *D3D12GetInterfaceFn)(REFCLSID rclsid, REFIID riid, void **ppvDebug); +#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__ +// Copied from AgilitySDK D3D12.h to programmatically enable when in developer +// mode. +#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__ + +EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D12SDKConfiguration = { + 0xe9eb5314, + 0x33aa, + 0x42b2, + {0xa7, 0x18, 0xd7, 0x7f, 0x58, 0xb1, 0xf1, 0xc7}}; +EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { + 0x7cda6aca, + 0xa03e, + 0x49c8, + {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; + +MIDL_INTERFACE("e9eb5314-33aa-42b2-a718-d77f58b1f1c7") +ID3D12SDKConfiguration : public IUnknown { +public: + virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, + LPCSTR SDKPath) = 0; +}; +#endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ + using namespace DirectX; using namespace hlsl_test; diff --git a/tools/dxexp/dxexp.cpp b/tools/dxexp/dxexp.cpp index 6a389e9202..4787200318 100644 --- a/tools/dxexp/dxexp.cpp +++ b/tools/dxexp/dxexp.cpp @@ -42,26 +42,150 @@ static HRESULT AtlCheck(HRESULT hr) { return hr; } +// Not defined in Creators Update version of d3d12.h: +#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS2 +#define D3D12_FEATURE_D3D12_OPTIONS3 ((D3D12_FEATURE)21) +typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS { + D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, + D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = + (1 << D3D12_COMMAND_LIST_TYPE_DIRECT), + D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = + (1 << D3D12_COMMAND_LIST_TYPE_BUNDLE), + D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = + (1 << D3D12_COMMAND_LIST_TYPE_COMPUTE), + D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY), + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4), + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5) +} D3D12_COMMAND_LIST_SUPPORT_FLAGS; + +typedef enum D3D12_VIEW_INSTANCING_TIER { + D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, + D3D12_VIEW_INSTANCING_TIER_1 = 1, + D3D12_VIEW_INSTANCING_TIER_2 = 2, + D3D12_VIEW_INSTANCING_TIER_3 = 3 +} D3D12_VIEW_INSTANCING_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 { + BOOL CopyQueueTimestampQueriesSupported; + BOOL CastingFullyTypedFormatSupported; + DWORD WriteBufferImmediateSupportFlags; + D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; + BOOL BarycentricsSupported; +} D3D12_FEATURE_DATA_D3D12_OPTIONS3; +#endif + #ifndef NTDDI_WIN10_RS3 #define NTDDI_WIN10_RS3 0x0A000004 #endif +#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3 +#define D3D12_FEATURE_D3D12_OPTIONS4 ((D3D12_FEATURE)23) +typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER { + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0, + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1, +} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 { + BOOL ReservedBufferPlacementSupported; + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; + BOOL Native16BitShaderOpsSupported; +} D3D12_FEATURE_DATA_D3D12_OPTIONS4; +#endif + #ifndef NTDDI_WIN10_RS4 #define NTDDI_WIN10_RS4 0x0A000005 #endif +#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS4 +#define D3D12_FEATURE_D3D12_OPTIONS5 ((D3D12_FEATURE)27) +typedef enum D3D12_RENDER_PASS_TIER { + D3D12_RENDER_PASS_TIER_0 = 0, + D3D12_RENDER_PASS_TIER_1 = 1, + D3D12_RENDER_PASS_TIER_2 = 2 +} D3D12_RENDER_PASS_TIER; + +typedef enum D3D12_RAYTRACING_TIER { + D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, + D3D12_RAYTRACING_TIER_1_0 = 10 D3D12_RAYTRACING_TIER_1_1 = 11 +} D3D12_RAYTRACING_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 { + BOOL SRVOnlyTiledResourceTier3; + D3D12_RENDER_PASS_TIER RenderPassesTier; + D3D12_RAYTRACING_TIER RaytracingTier; +} D3D12_FEATURE_DATA_D3D12_OPTIONS5; +#endif + #ifndef NTDDI_WIN10_VB #define NTDDI_WIN10_VB 0x0A000008 #endif +#if WDK_NTDDI_VERSION < NTDDI_WIN10_VB +#define D3D12_FEATURE_D3D12_OPTIONS7 ((D3D12_FEATURE)32) + +typedef enum D3D12_MESH_SHADER_TIER { + D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, + D3D12_MESH_SHADER_TIER_1 = 10 +} D3D12_MESH_SHADER_TIER; + +typedef enum D3D12_SAMPLER_FEEDBACK_TIER { + D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, + D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, + D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 +} D3D12_SAMPLER_FEEDBACK_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 { + D3D12_MESH_SHADER_TIER MeshShaderTier; + D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; +} D3D12_FEATURE_DATA_D3D12_OPTIONS7; +#endif + #ifndef NTDDI_WIN10_FE #define NTDDI_WIN10_FE 0x0A00000A #endif +#if WDK_NTDDI_VERSION < NTDDI_WIN10_FE +#define D3D12_FEATURE_D3D12_OPTIONS9 ((D3D12_FEATURE)37) + +typedef enum D3D12_WAVE_MMA_TIER { + D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, + D3D12_WAVE_MMA_TIER_1_0 = 10 +} D3D12_WAVE_MMA_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 { + BOOL MeshShaderPipelineStatsSupported; + BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; + BOOL AtomicInt64OnTypedResourceSupported; + BOOL AtomicInt64OnGroupSharedSupported; + BOOL DerivativesInMeshAndAmplificationShadersSupported; + D3D12_WAVE_MMA_TIER WaveMMATier; +} D3D12_FEATURE_DATA_D3D12_OPTIONS9; +#endif + #ifndef NTDDI_WIN10_NI #define NTDDI_WIN10_NI 0x0A00000C #endif +#if WDK_NTDDI_VERSION <= NTDDI_WIN10_NI +#define D3D12_FEATURE_D3D12_OPTIONS14 ((D3D12_FEATURE)43) +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 { + BOOL AdvancedTextureOpsSupported; + BOOL WriteableMSAATexturesSupported; + BOOL IndependentFrontAndBackStencilRefMaskSupported; +} D3D12_FEATURE_DATA_D3D12_OPTIONS14; +#endif + +#pragma warning(disable : 4063) +#define D3D12_RAYTRACING_TIER_1_1 ((D3D12_RAYTRACING_TIER)11) +#define D3D_SHADER_MODEL_6_1 ((D3D_SHADER_MODEL)0x61) +#define D3D_SHADER_MODEL_6_2 ((D3D_SHADER_MODEL)0x62) +#define D3D_SHADER_MODEL_6_3 ((D3D_SHADER_MODEL)0x63) +#define D3D_SHADER_MODEL_6_4 ((D3D_SHADER_MODEL)0x64) +#define D3D_SHADER_MODEL_6_5 ((D3D_SHADER_MODEL)0x65) +#define D3D_SHADER_MODEL_6_6 ((D3D_SHADER_MODEL)0x66) +#define D3D_SHADER_MODEL_6_7 ((D3D_SHADER_MODEL)0x67) +#define D3D_SHADER_MODEL_6_8 ((D3D_SHADER_MODEL)0x68) + #define DXEXP_HIGHEST_SHADER_MODEL D3D_SHADER_MODEL_6_8 static const char *BoolToStrJson(bool value) { From 5a60043bdda29e08f8359b7a246ea458a70f5ac3 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 22:27:51 +0200 Subject: [PATCH 24/62] Added predeclarations for LibraryReflection1 and ShaderReflection1. Unified typedefs between DXC and DirectX-Headers. Warning: This might need extra caution, as these sizes were mismatching before! unsigned long aka ULONG is 64-bit on linux but was treated as the same as on windows? --- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 90 +++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 16a4ece497..c9c764639a 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 16a4ece497644fd3ede9aab0d732d5243f397c33 +Subproject commit c9c764639a388c3cb61976c2966f93f926a71fe7 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index b8c6646871..1dd1ab743c 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -234,12 +234,13 @@ #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) #define FAILED(hr) (((HRESULT)(hr)) < 0) -#define DXC_FAILED(hr) (((HRESULT)(hr)) < 0) #define HRESULT_FROM_WIN32(x) \ (HRESULT)(x) <= 0 ? (HRESULT)(x) \ : (HRESULT)(((x) & 0x0000FFFF) | (7 << 16) | 0x80000000) +#define DXC_FAILED(hr) (((HRESULT)(hr)) < 0) + //===----------------------------------------------------------------------===// // // Begin: Disable SAL Annotations @@ -296,53 +297,65 @@ #ifdef __cplusplus -typedef unsigned char BYTE, UINT8; -typedef unsigned char *LPBYTE; - -typedef BYTE BOOLEAN; +// Note: using fixed-width here to match Windows widths +// Specifically this is different for 'long' vs 'LONG' +typedef uint8_t UINT8; +typedef int8_t INT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint32_t UINT32, UINT, ULONG, DWORD, WINBOOL; +typedef int32_t INT32, INT, LONG; +typedef uint64_t UINT64, ULONG_PTR; +typedef int64_t INT64, LONG_PTR; +typedef void VOID, *HANDLE, *RPC_IF_HANDLE, *LPVOID; +typedef const void *LPCVOID; +typedef size_t SIZE_T; +typedef float FLOAT; +typedef double DOUBLE; +typedef unsigned char BYTE; +typedef int HWND; +typedef int PALETTEENTRY; +typedef int HDC; +typedef uint16_t WORD; +typedef void* PVOID; +typedef char BOOLEAN; +typedef uint64_t ULONGLONG; +typedef uint16_t USHORT, *PUSHORT; +typedef int64_t LONGLONG, *PLONGLONG; +typedef int64_t LONG_PTR, *PLONG_PTR; +typedef int64_t LONG64, *PLONG64; +typedef uint64_t ULONG64, *PULONG64; +typedef wchar_t WCHAR, *PWSTR; +typedef uint8_t UCHAR, *PUCHAR; +typedef uint64_t ULONG_PTR, *PULONG_PTR; +typedef uint64_t UINT_PTR, *PUINT_PTR; +typedef int64_t INT_PTR, *PINT_PTR; + +// Note: WCHAR is not the same between Windows and Linux, to enable +// string manipulation APIs to work with resulting strings. +// APIs to D3D/DXCore will work on Linux wchars, but beware with +// interactions directly with the Windows kernel. +typedef char CHAR, *PSTR, *LPSTR, TCHAR, *PTSTR; +typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR; +typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR; +typedef const wchar_t *LPCWSTR, *PCWSTR; + +typedef BYTE *LPBYTE; typedef BOOLEAN *PBOOLEAN; typedef bool BOOL; typedef BOOL *LPBOOL; -typedef int INT; -typedef long LONG; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef long long LONGLONG; -typedef long long LONG_PTR; -typedef unsigned long long ULONG_PTR; -typedef unsigned long long ULONGLONG; - -typedef uint16_t WORD; -typedef uint32_t DWORD; typedef DWORD *LPDWORD; -typedef uint32_t UINT32; -typedef uint64_t UINT64; - -typedef signed char INT8, *PINT8; -typedef signed int INT32, *PINT32; - -typedef size_t SIZE_T; -typedef const char *LPCSTR; -typedef const char *PCSTR; +typedef INT8 *PINT8; +typedef INT32 *PINT32; typedef int errno_t; -typedef wchar_t WCHAR; -typedef wchar_t *LPWSTR; -typedef wchar_t *PWCHAR; -typedef const wchar_t *LPCWSTR; -typedef const wchar_t *PCWSTR; - typedef WCHAR OLECHAR; typedef OLECHAR *BSTR; typedef OLECHAR *LPOLESTR; -typedef char *LPSTR; - -typedef void *LPVOID; -typedef const void *LPCVOID; typedef std::nullptr_t nullptr_t; @@ -350,9 +363,6 @@ typedef signed int HRESULT; //===--------------------- Handle Types -----------------------------------===// -typedef void *HANDLE; -typedef void *RPC_IF_HANDLE; - #define DECLARE_HANDLE(name) \ struct name##__ { \ int unused; \ @@ -627,8 +637,12 @@ struct IStream : public ISequentialStream { // They still need the __uuidof() though CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, "8E349D19-54DB-4A56-9DC9-119D87BDB804") +CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection1, + "07692220-8721-4514-BFFE-969BB33196B6") CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, "5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") +CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection1, + "9C886958-23F1-4126-B294-FCF3DA13E7C6") //===--------------------- COM Pointer Types ------------------------------===// From 9eca17a143c12d0e6106d9d14c88ef71a7499330 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 23:06:14 +0200 Subject: [PATCH 25/62] Windows: wsl stubs aren't needed. Now requiring DirectX-Headers to ensure latest d3d12.h & d3d12shader.h. Fixed compile issue on gcc/clang due to missing {} in GetDesc1. Removed duplicate definitions in dxexp.cpp. Fixed formatting issue. --- CMakeLists.txt | 6 +- include/dxc/Support/D3DReflection.h | 2 +- include/dxc/WinAdapter.h | 2 +- include/dxc/config.h | 4 + lib/HLSL/DxilContainerReflection.cpp | 4 +- tools/dxexp/dxexp.cpp | 144 --------------------------- 6 files changed, 13 insertions(+), 149 deletions(-) create mode 100644 include/dxc/config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f7db99784..d9c49bfc1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -689,7 +689,11 @@ list(APPEND LLVM_COMMON_DEPENDS HCTGen) if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) +if(NOT WIN32) + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) +else() + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx) +endif() # HLSL - Change End diff --git a/include/dxc/Support/D3DReflection.h b/include/dxc/Support/D3DReflection.h index aeb004c7bb..4e5c0684b3 100644 --- a/include/dxc/Support/D3DReflection.h +++ b/include/dxc/Support/D3DReflection.h @@ -22,5 +22,5 @@ #undef interface #pragma GCC diagnostic pop #else -#include +#include "d3d12shader.h" #endif diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 1dd1ab743c..9095ad3341 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -317,7 +317,7 @@ typedef int HWND; typedef int PALETTEENTRY; typedef int HDC; typedef uint16_t WORD; -typedef void* PVOID; +typedef void *PVOID; typedef char BOOLEAN; typedef uint64_t ULONGLONG; typedef uint16_t USHORT, *PUSHORT; diff --git a/include/dxc/config.h b/include/dxc/config.h new file mode 100644 index 0000000000..c7dce25e33 --- /dev/null +++ b/include/dxc/config.h @@ -0,0 +1,4 @@ +/* Disable overriding memory allocators. */ +/* #undef DXC_DISABLE_ALLOCATOR_OVERRIDES */ +/* Generate a trap if an hlsl::Exception is thrown during code generation */ +/* #undef DXC_CODEGEN_EXCEPTIONS_TRAP */ diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index ef1cce0840..62d38e0e28 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2966,8 +2966,8 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { D3D12_COMPUTE_SHADER_DESC computeDesc = { m_pProps->WaveSize.Min, m_pProps->WaveSize.Max, - m_pProps->WaveSize.Preferred, m_pProps->numThreads[0], - m_pProps->numThreads[1], m_pProps->numThreads[2]}; + m_pProps->WaveSize.Preferred, {m_pProps->numThreads[0], + m_pProps->numThreads[1], m_pProps->numThreads[2]}}; pDesc->RootSignatureSize = (UINT)m_pProps->serializedRootSignature.size(); pDesc->RootSignaturePtr = m_pProps->serializedRootSignature.data(); diff --git a/tools/dxexp/dxexp.cpp b/tools/dxexp/dxexp.cpp index 4787200318..5ae24fbde9 100644 --- a/tools/dxexp/dxexp.cpp +++ b/tools/dxexp/dxexp.cpp @@ -42,150 +42,6 @@ static HRESULT AtlCheck(HRESULT hr) { return hr; } -// Not defined in Creators Update version of d3d12.h: -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS2 -#define D3D12_FEATURE_D3D12_OPTIONS3 ((D3D12_FEATURE)21) -typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS { - D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, - D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = - (1 << D3D12_COMMAND_LIST_TYPE_DIRECT), - D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = - (1 << D3D12_COMMAND_LIST_TYPE_BUNDLE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = - (1 << D3D12_COMMAND_LIST_TYPE_COMPUTE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5) -} D3D12_COMMAND_LIST_SUPPORT_FLAGS; - -typedef enum D3D12_VIEW_INSTANCING_TIER { - D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, - D3D12_VIEW_INSTANCING_TIER_1 = 1, - D3D12_VIEW_INSTANCING_TIER_2 = 2, - D3D12_VIEW_INSTANCING_TIER_3 = 3 -} D3D12_VIEW_INSTANCING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 { - BOOL CopyQueueTimestampQueriesSupported; - BOOL CastingFullyTypedFormatSupported; - DWORD WriteBufferImmediateSupportFlags; - D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; - BOOL BarycentricsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS3; -#endif - -#ifndef NTDDI_WIN10_RS3 -#define NTDDI_WIN10_RS3 0x0A000004 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3 -#define D3D12_FEATURE_D3D12_OPTIONS4 ((D3D12_FEATURE)23) -typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER { - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0, - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1, -} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 { - BOOL ReservedBufferPlacementSupported; - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; - BOOL Native16BitShaderOpsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS4; -#endif - -#ifndef NTDDI_WIN10_RS4 -#define NTDDI_WIN10_RS4 0x0A000005 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS4 -#define D3D12_FEATURE_D3D12_OPTIONS5 ((D3D12_FEATURE)27) -typedef enum D3D12_RENDER_PASS_TIER { - D3D12_RENDER_PASS_TIER_0 = 0, - D3D12_RENDER_PASS_TIER_1 = 1, - D3D12_RENDER_PASS_TIER_2 = 2 -} D3D12_RENDER_PASS_TIER; - -typedef enum D3D12_RAYTRACING_TIER { - D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, - D3D12_RAYTRACING_TIER_1_0 = 10 D3D12_RAYTRACING_TIER_1_1 = 11 -} D3D12_RAYTRACING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 { - BOOL SRVOnlyTiledResourceTier3; - D3D12_RENDER_PASS_TIER RenderPassesTier; - D3D12_RAYTRACING_TIER RaytracingTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS5; -#endif - -#ifndef NTDDI_WIN10_VB -#define NTDDI_WIN10_VB 0x0A000008 -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_VB -#define D3D12_FEATURE_D3D12_OPTIONS7 ((D3D12_FEATURE)32) - -typedef enum D3D12_MESH_SHADER_TIER { - D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, - D3D12_MESH_SHADER_TIER_1 = 10 -} D3D12_MESH_SHADER_TIER; - -typedef enum D3D12_SAMPLER_FEEDBACK_TIER { - D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, - D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, - D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 -} D3D12_SAMPLER_FEEDBACK_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 { - D3D12_MESH_SHADER_TIER MeshShaderTier; - D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS7; -#endif - -#ifndef NTDDI_WIN10_FE -#define NTDDI_WIN10_FE 0x0A00000A -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_FE -#define D3D12_FEATURE_D3D12_OPTIONS9 ((D3D12_FEATURE)37) - -typedef enum D3D12_WAVE_MMA_TIER { - D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, - D3D12_WAVE_MMA_TIER_1_0 = 10 -} D3D12_WAVE_MMA_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 { - BOOL MeshShaderPipelineStatsSupported; - BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; - BOOL AtomicInt64OnTypedResourceSupported; - BOOL AtomicInt64OnGroupSharedSupported; - BOOL DerivativesInMeshAndAmplificationShadersSupported; - D3D12_WAVE_MMA_TIER WaveMMATier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS9; -#endif - -#ifndef NTDDI_WIN10_NI -#define NTDDI_WIN10_NI 0x0A00000C -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_NI -#define D3D12_FEATURE_D3D12_OPTIONS14 ((D3D12_FEATURE)43) -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 { - BOOL AdvancedTextureOpsSupported; - BOOL WriteableMSAATexturesSupported; - BOOL IndependentFrontAndBackStencilRefMaskSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS14; -#endif - -#pragma warning(disable : 4063) -#define D3D12_RAYTRACING_TIER_1_1 ((D3D12_RAYTRACING_TIER)11) -#define D3D_SHADER_MODEL_6_1 ((D3D_SHADER_MODEL)0x61) -#define D3D_SHADER_MODEL_6_2 ((D3D_SHADER_MODEL)0x62) -#define D3D_SHADER_MODEL_6_3 ((D3D_SHADER_MODEL)0x63) -#define D3D_SHADER_MODEL_6_4 ((D3D_SHADER_MODEL)0x64) -#define D3D_SHADER_MODEL_6_5 ((D3D_SHADER_MODEL)0x65) -#define D3D_SHADER_MODEL_6_6 ((D3D_SHADER_MODEL)0x66) -#define D3D_SHADER_MODEL_6_7 ((D3D_SHADER_MODEL)0x67) -#define D3D_SHADER_MODEL_6_8 ((D3D_SHADER_MODEL)0x68) - #define DXEXP_HIGHEST_SHADER_MODEL D3D_SHADER_MODEL_6_8 static const char *BoolToStrJson(bool value) { From c88a1a68953cecb67ef54e0ef3b3db0165f54841 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 7 Aug 2024 23:07:21 +0200 Subject: [PATCH 26/62] DirectX-Headers is now always required and removed config file --- external/CMakeLists.txt | 12 +++++------- include/dxc/config.h | 4 ---- 2 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 include/dxc/config.h diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 3a4e66a8a1..b56bc1d2ab 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -9,13 +9,11 @@ endif (NOT HLSL_ENABLE_DEBUG_ITERATORS) # Need DirectX-Headers module if not on windows if (NOT DIRECTX_HEADER_INCLUDE_DIR) - if (NOT WIN32) - if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") - set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) - else() - message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") - endif() - endif (NOT WIN32) + if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") + set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) + else() + message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") + endif() endif(NOT DIRECTX_HEADER_INCLUDE_DIR) # Enabling SPIR-V codegen requires SPIRV-Headers for spirv.hpp and diff --git a/include/dxc/config.h b/include/dxc/config.h deleted file mode 100644 index c7dce25e33..0000000000 --- a/include/dxc/config.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Disable overriding memory allocators. */ -/* #undef DXC_DISABLE_ALLOCATOR_OVERRIDES */ -/* Generate a trap if an hlsl::Exception is thrown during code generation */ -/* #undef DXC_CODEGEN_EXCEPTIONS_TRAP */ From a702d2c3cb00a562783ef84df7360b9514a37ebc Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 00:15:28 +0200 Subject: [PATCH 27/62] Fixed compile issue due to missing [[fallthrough]]; Fixed duplicate d3d12 definition --- lib/DxilContainer/D3DReflectionDumper.cpp | 2 +- .../unittests/HLSLExec/ExecutionTest.cpp | 24 ------------------- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 1358e0bd74..7e1e597845 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -366,7 +366,7 @@ void D3DReflectionDumper::Dump(D3D12_FUNCTION_DESC1 &Desc) { case D3D12_SHVER_ANY_HIT_SHADER: case D3D12_SHVER_CLOSEST_HIT_SHADER: WriteLn("AttributeSize: ", std::dec, Desc.RaytracingShader.AttributeSize); - // fallthrough + [[fallthrough]]; case D3D12_SHVER_MISS_SHADER: WriteLn("ParamPayloadSize: ", std::dec, Desc.RaytracingShader.ParamPayloadSize); diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index f22e99e467..3a5f7aca49 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -84,30 +84,6 @@ static const GUID D3D12ExperimentalShaderModelsID = typedef HRESULT(WINAPI *D3D12GetInterfaceFn)(REFCLSID rclsid, REFIID riid, void **ppvDebug); -#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__ -// Copied from AgilitySDK D3D12.h to programmatically enable when in developer -// mode. -#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__ - -EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D12SDKConfiguration = { - 0xe9eb5314, - 0x33aa, - 0x42b2, - {0xa7, 0x18, 0xd7, 0x7f, 0x58, 0xb1, 0xf1, 0xc7}}; -EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { - 0x7cda6aca, - 0xa03e, - 0x49c8, - {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; - -MIDL_INTERFACE("e9eb5314-33aa-42b2-a718-d77f58b1f1c7") -ID3D12SDKConfiguration : public IUnknown { -public: - virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, - LPCSTR SDKPath) = 0; -}; -#endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ - using namespace DirectX; using namespace hlsl_test; From 0a87922e14033ca855edbe1e0a646e622a8d0d28 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 00:42:16 +0200 Subject: [PATCH 28/62] Update dependency, should resolve build issue on unix --- external/DirectX-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index c9c764639a..e8e8634297 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit c9c764639a388c3cb61976c2966f93f926a71fe7 +Subproject commit e8e8634297bbe7ad09f6f10a1abdd864fbc83f99 From 506a167717f406aef12cb4d8231c1b0ad48dddb8 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 19:56:55 +0200 Subject: [PATCH 29/62] Update dependency, should hopefully fix build errors --- external/DirectX-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index e8e8634297..ba694809a1 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit e8e8634297bbe7ad09f6f10a1abdd864fbc83f99 +Subproject commit ba694809a1dca35de492b8f6b657397595e57e0a From 988ada162ad9ecae35f830353c6d3d64fa6f55bc Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 20:18:08 +0200 Subject: [PATCH 30/62] Formatting. Also fixed unit test that relied on the ShaderKind of 'Node' not being translatable, even though now it is. --- lib/HLSL/DxilContainerReflection.cpp | 10 ++++++---- .../d3dreflect/empty_broadcasting_nodes.hlsl | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 62d38e0e28..4611264a1e 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2964,10 +2964,12 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { return E_FAIL; } - D3D12_COMPUTE_SHADER_DESC computeDesc = { - m_pProps->WaveSize.Min, m_pProps->WaveSize.Max, - m_pProps->WaveSize.Preferred, {m_pProps->numThreads[0], - m_pProps->numThreads[1], m_pProps->numThreads[2]}}; + D3D12_COMPUTE_SHADER_DESC computeDesc = {m_pProps->WaveSize.Min, + m_pProps->WaveSize.Max, + m_pProps->WaveSize.Preferred, + {m_pProps->numThreads[0], + m_pProps->numThreads[1], + m_pProps->numThreads[2]}}; pDesc->RootSignatureSize = (UINT)m_pProps->serializedRootSignature.size(); pDesc->RootSignaturePtr = m_pProps->serializedRootSignature.data(); diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl index 5889e69281..92a61720a0 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl @@ -296,7 +296,7 @@ // CHECK: FunctionCount: 1 // CHECK: ID3D12FunctionReflection: // CHECK: D3D12_FUNCTION_DESC: Name: depth18part0_wg_63_nodes_seed_255 -// CHECK: Shader Version: 6.8 +// CHECK: Shader Version: Node 6.8 // CHECK: Creator: // CHECK: Flags: 0 // CHECK: RequiredFeatureFlags: 0 From 7c45598aa675af4d785233a29a1b94b86b49fc7c Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 21:23:11 +0200 Subject: [PATCH 31/62] Hopefully fixed windows build --- tools/clang/unittests/HLSLExec/ExecutionTest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index 3a5f7aca49..f2e8029d64 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -44,12 +44,14 @@ #include "dxc/Support/FileIOHelper.h" #include "dxc/Support/Unicode.h" +#define INITGUID +#include "d3d12.h" + // -// d3d12.h and dxgi1_4.h are included in the Windows 10 SDK +// dxgi1_4.h is included in the Windows 10 SDK // https://msdn.microsoft.com/en-us/library/windows/desktop/dn899120(v=vs.85).aspx // https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk // -#include #include #include #include "dxc/Support/d3dx12.h" From 32ac5ec70b868162afec41bfa9f4e354127faab7 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 21:58:50 +0200 Subject: [PATCH 32/62] Seems like ExecutionTest.cpp still has an issue with finding GUIDs that are clearly defined by d3d12.h. If it's not the location of the INITGUID it must be picking the wrong d3d12.h --- tools/clang/unittests/HLSLExec/ExecutionTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index f2e8029d64..604b478d0e 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -15,6 +15,8 @@ // *** THIS FILE CANNOT TAKE ANY LLVM DEPENDENCIES *** // +#define INITGUID + // clang-format off // Includes on Windows are highly order dependent. #include @@ -43,8 +45,6 @@ #include "dxc/Test/HlslTestUtils.h" #include "dxc/Support/FileIOHelper.h" #include "dxc/Support/Unicode.h" - -#define INITGUID #include "d3d12.h" // From 6defb75eb044c6cbf2c13d28b2fd022726089519 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 22:38:01 +0200 Subject: [PATCH 33/62] Maybe d3d12.h is the only one that can be used with INITGUID --- tools/clang/unittests/HLSLExec/ExecutionTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index 604b478d0e..76a56eed61 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -16,6 +16,8 @@ // *** THIS FILE CANNOT TAKE ANY LLVM DEPENDENCIES *** // #define INITGUID +#include "d3d12.h" +#undef INITGUID // clang-format off // Includes on Windows are highly order dependent. @@ -45,7 +47,6 @@ #include "dxc/Test/HlslTestUtils.h" #include "dxc/Support/FileIOHelper.h" #include "dxc/Support/Unicode.h" -#include "d3d12.h" // // dxgi1_4.h is included in the Windows 10 SDK From fe507da5d6ad4310002d907ef11d69653d0dda77 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 8 Aug 2024 23:14:58 +0200 Subject: [PATCH 34/62] Undid removal of definition of ID3D12SDKConfiguration UUIDs, which are apparently also needed even if d3d12 is defined. Defining GUID creation bugs everything out, so just doing it like this --- .../unittests/HLSLExec/ExecutionTest.cpp | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index 76a56eed61..bae5e1039c 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -15,10 +15,6 @@ // *** THIS FILE CANNOT TAKE ANY LLVM DEPENDENCIES *** // -#define INITGUID -#include "d3d12.h" -#undef INITGUID - // clang-format off // Includes on Windows are highly order dependent. #include @@ -49,10 +45,11 @@ #include "dxc/Support/Unicode.h" // -// dxgi1_4.h is included in the Windows 10 SDK +// d3d12.h and dxgi1_4.h are included in the Windows 10 SDK // https://msdn.microsoft.com/en-us/library/windows/desktop/dn899120(v=vs.85).aspx // https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk // +#include #include #include #include "dxc/Support/d3dx12.h" @@ -87,6 +84,37 @@ static const GUID D3D12ExperimentalShaderModelsID = typedef HRESULT(WINAPI *D3D12GetInterfaceFn)(REFCLSID rclsid, REFIID riid, void **ppvDebug); +#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__ +// Copied from AgilitySDK D3D12.h to programmatically enable when in developer +// mode. +#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__ + +EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D12SDKConfiguration = { + 0xe9eb5314, + 0x33aa, + 0x42b2, + {0xa7, 0x18, 0xd7, 0x7f, 0x58, 0xb1, 0xf1, 0xc7}}; +EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { + 0x7cda6aca, + 0xa03e, + 0x49c8, + {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; + +MIDL_INTERFACE("e9eb5314-33aa-42b2-a718-d77f58b1f1c7") +ID3D12SDKConfiguration : public IUnknown { +public: + virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, + LPCSTR SDKPath) = 0; +}; + +#elif defined(_WIN32) +EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { + 0x7cda6aca, + 0xa03e, + 0x49c8, + {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; +#endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ + using namespace DirectX; using namespace hlsl_test; From 248ce588a5569bb24ee607947a85b0f7c688988f Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 00:19:58 +0200 Subject: [PATCH 35/62] Fix memory leak that somehow was only detected on linux but only on release mode?? --- lib/DxilContainer/D3DReflectionDumper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 7e1e597845..55477769fe 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -574,6 +574,7 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { } Dump(shaderRefl0); + shaderRefl0->Release(); UINT waveSizePreferred = 0, waveSizeMin = 0, waveSizeMax = 0; From ac6c505442760bc9488c02237910ba3c8f878593 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 20:30:08 +0200 Subject: [PATCH 36/62] dxc/WinAdapter.h now extends DirectX-Headers/WSL's winAdapter.h, to avoid conflicts and allow the latest DirectX-Headers to be used rather than a 2 year outdated one. Unified lots of types; all fixed int types now align properly between windows and unix (more importantly; between the two winadapters). Removed duplicate defines and type definitions. Replaced CROSS_PLATFORM_UUIDOF with __CRT_UUID_DECL so that it can use the uuid macro from wsl. Fixed type incompatiblity of a LPBOOL which really refered to a bool* (BOOL is 32-bit according to WSL). --- CMakeLists.txt | 11 +- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 234 +++++++++------------------------- include/dxc/dxcapi.h | 85 +++++++----- include/dxc/dxcapi.internal.h | 31 ++--- include/dxc/dxcisense.h | 50 +++++--- include/dxc/dxctools.h | 6 +- lib/DxcSupport/Unicode.cpp | 4 +- 8 files changed, 176 insertions(+), 247 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f7db99784..87c76abdf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,6 +671,12 @@ if(LLVM_INCLUDE_TESTS AND WIN32) add_definitions(/DMSFT_SUPPORTS_CHILD_PROCESSES) endif() +if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") + add_subdirectory(external) # SPIRV change +endif() +include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) + + # Put this before tblgen. Else we have a circular dependence. add_subdirectory(lib/Support) add_subdirectory(lib/MSSupport) # HLSL Change @@ -686,11 +692,6 @@ add_subdirectory(include/dxc) # really depend on anything else in the build it is safe. list(APPEND LLVM_COMMON_DEPENDS HCTGen) -if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") - add_subdirectory(external) # SPIRV change -endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) - # HLSL - Change End add_subdirectory(lib) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 980971e835..8cd1ddf8ed 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 980971e835876dc0cde415e8f9bc646e64667bf7 +Subproject commit 8cd1ddf8edecc3410df223104f936f6a3badf3e6 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index b8c6646871..918d99b0ff 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,6 +33,8 @@ #include #endif // __cplusplus +#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc + #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows //===----------------------------------------------------------------------===// @@ -40,7 +42,6 @@ // Begin: Macro Definitions // //===----------------------------------------------------------------------===// -#define C_ASSERT(expr) static_assert((expr), "") #define ATLASSERT assert #define CoTaskMemAlloc malloc @@ -48,8 +49,6 @@ #define ARRAYSIZE(array) (sizeof(array) / sizeof(array[0])) -#define _countof(a) (sizeof(a) / sizeof(*(a))) - // If it is GCC, there is no UUID support and we must emulate it. #ifndef __clang__ #define __EMULATE_UUID 1 @@ -68,11 +67,6 @@ #define STDMETHODCALLTYPE #define STDMETHODIMP_(type) type STDMETHODCALLTYPE #define STDMETHODIMP STDMETHODIMP_(HRESULT) -#define STDMETHOD_(type, name) virtual STDMETHODIMP_(type) name -#define STDMETHOD(name) STDMETHOD_(HRESULT, name) -#define EXTERN_C extern "C" - -#define UNREFERENCED_PARAMETER(P) (void)(P) #define RtlEqualMemory(Destination, Source, Length) \ (!memcmp((Destination), (Source), (Length))) @@ -88,9 +82,6 @@ #define FillMemory RtlFillMemory #define ZeroMemory RtlZeroMemory -#define FALSE 0 -#define TRUE 1 - // We ignore the code page completely on Linux. #define GetConsoleOutputCP() 0 @@ -216,24 +207,9 @@ //===--------------------- HRESULT Related Macros -------------------------===// -#define S_OK ((HRESULT)0L) -#define S_FALSE ((HRESULT)1L) - -#define E_ABORT (HRESULT)0x80004004 -#define E_ACCESSDENIED (HRESULT)0x80070005 #define E_BOUNDS (HRESULT)0x8000000B -#define E_FAIL (HRESULT)0x80004005 -#define E_HANDLE (HRESULT)0x80070006 -#define E_INVALIDARG (HRESULT)0x80070057 -#define E_NOINTERFACE (HRESULT)0x80004002 -#define E_NOTIMPL (HRESULT)0x80004001 #define E_NOT_VALID_STATE (HRESULT)0x8007139F -#define E_OUTOFMEMORY (HRESULT)0x8007000E -#define E_POINTER (HRESULT)0x80004003 -#define E_UNEXPECTED (HRESULT)0x8000FFFF -#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) -#define FAILED(hr) (((HRESULT)(hr)) < 0) #define DXC_FAILED(hr) (((HRESULT)(hr)) < 0) #define HRESULT_FROM_WIN32(x) \ @@ -245,16 +221,7 @@ // Begin: Disable SAL Annotations // //===----------------------------------------------------------------------===// -#define _In_ -#define _In_z_ -#define _In_opt_ -#define _In_opt_count_(size) -#define _In_opt_z_ -#define _In_count_(size) -#define _In_bytecount_(size) - -#define _Out_ -#define _Out_opt_ + #define _Outptr_ #define _Outptr_opt_ #define _Outptr_result_z_ @@ -264,15 +231,6 @@ #define _Outptr_result_buffer_maybenull_(ptr) #define _Outptr_result_buffer_(ptr) -#define _COM_Outptr_ -#define _COM_Outptr_opt_ -#define _COM_Outptr_result_maybenull_ -#define _COM_Outptr_opt_result_maybenull_ - -#define THIS_ -#define THIS -#define PURE = 0 - #define _Maybenull_ #define __debugbreak() @@ -296,53 +254,64 @@ #ifdef __cplusplus -typedef unsigned char BYTE, UINT8; -typedef unsigned char *LPBYTE; - -typedef BYTE BOOLEAN; +// Note: using fixed-width here to match Windows widths +// Specifically this is different for 'long' vs 'LONG' +typedef uint8_t UINT8; +typedef int8_t INT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint32_t UINT32, UINT, ULONG, DWORD, WINBOOL, BOOL; +typedef int32_t INT32, INT, LONG; +typedef uint64_t UINT64, ULONG_PTR; +typedef int64_t INT64, LONG_PTR; +typedef void VOID, *HANDLE, *RPC_IF_HANDLE, *LPVOID; +typedef const void *LPCVOID; +typedef size_t SIZE_T; +typedef float FLOAT; +typedef double DOUBLE; +typedef unsigned char BYTE; +typedef int HWND; +typedef int PALETTEENTRY; +typedef int HDC; +typedef uint16_t WORD; +typedef void *PVOID; +typedef char BOOLEAN; +typedef uint64_t ULONGLONG; +typedef uint16_t USHORT, *PUSHORT; +typedef int64_t LONGLONG, *PLONGLONG; +typedef int64_t LONG_PTR, *PLONG_PTR; +typedef int64_t LONG64, *PLONG64; +typedef uint64_t ULONG64, *PULONG64; +typedef wchar_t WCHAR, *PWSTR; +typedef uint8_t UCHAR, *PUCHAR; +typedef uint64_t ULONG_PTR, *PULONG_PTR; +typedef uint64_t UINT_PTR, *PUINT_PTR; +typedef int64_t INT_PTR, *PINT_PTR; + +// Note: WCHAR is not the same between Windows and Linux, to enable +// string manipulation APIs to work with resulting strings. +// APIs to D3D/DXCore will work on Linux wchars, but beware with +// interactions directly with the Windows kernel. +typedef char CHAR, *PSTR, *LPSTR, TCHAR, *PTSTR; +typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR; +typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR; +typedef const wchar_t *LPCWSTR, *PCWSTR; + +typedef BYTE *LPBYTE; typedef BOOLEAN *PBOOLEAN; -typedef bool BOOL; typedef BOOL *LPBOOL; -typedef int INT; -typedef long LONG; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef long long LONGLONG; -typedef long long LONG_PTR; -typedef unsigned long long ULONG_PTR; -typedef unsigned long long ULONGLONG; - -typedef uint16_t WORD; -typedef uint32_t DWORD; typedef DWORD *LPDWORD; -typedef uint32_t UINT32; -typedef uint64_t UINT64; - -typedef signed char INT8, *PINT8; -typedef signed int INT32, *PINT32; - -typedef size_t SIZE_T; -typedef const char *LPCSTR; -typedef const char *PCSTR; +typedef INT8 *PINT8; +typedef INT32 *PINT32; typedef int errno_t; -typedef wchar_t WCHAR; -typedef wchar_t *LPWSTR; -typedef wchar_t *PWCHAR; -typedef const wchar_t *LPCWSTR; -typedef const wchar_t *PCWSTR; - typedef WCHAR OLECHAR; typedef OLECHAR *BSTR; typedef OLECHAR *LPOLESTR; -typedef char *LPSTR; - -typedef void *LPVOID; -typedef const void *LPCVOID; typedef std::nullptr_t nullptr_t; @@ -368,45 +337,11 @@ typedef void *HMODULE; //===--------------------- ID Types and Macros for COM --------------------===// -#ifdef __EMULATE_UUID -struct GUID -#else // __EMULATE_UUID -// These specific definitions are required by clang -fms-extensions. -typedef struct _GUID -#endif // __EMULATE_UUID -{ - uint32_t Data1; - uint16_t Data2; - uint16_t Data3; - uint8_t Data4[8]; -} -#ifdef __EMULATE_UUID -; -#else // __EMULATE_UUID -GUID; -#endif // __EMULATE_UUID -typedef GUID CLSID; typedef const GUID &REFGUID; typedef const GUID &REFCLSID; -typedef GUID IID; typedef IID *LPIID; typedef const IID &REFIID; -inline bool IsEqualGUID(REFGUID rguid1, REFGUID rguid2) { - // Optimization: - if (&rguid1 == &rguid2) - return true; - - return !memcmp(&rguid1, &rguid2, sizeof(GUID)); -} - -inline bool operator==(REFGUID guidOne, REFGUID guidOther) { - return !!IsEqualGUID(guidOne, guidOther); -} - -inline bool operator!=(REFGUID guidOne, REFGUID guidOther) { - return !(guidOne == guidOther); -} inline bool IsEqualIID(REFIID riid1, REFIID riid2) { return IsEqualGUID(riid1, riid2); @@ -450,26 +385,6 @@ typedef struct _WIN32_FIND_DATAW { WCHAR cAlternateFileName[14]; } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; -typedef union _LARGE_INTEGER { - struct { - DWORD LowPart; - DWORD HighPart; - } u; - LONGLONG QuadPart; -} LARGE_INTEGER; - -typedef LARGE_INTEGER *PLARGE_INTEGER; - -typedef union _ULARGE_INTEGER { - struct { - DWORD LowPart; - DWORD HighPart; - } u; - ULONGLONG QuadPart; -} ULARGE_INTEGER; - -typedef ULARGE_INTEGER *PULARGE_INTEGER; - typedef struct tagSTATSTG { LPOLESTR pwcsName; DWORD type; @@ -539,11 +454,6 @@ template inline GUID __emulated_uuidof(); return _IID; \ } -#define __uuidof(T) __emulated_uuidof::type>() - -#define IID_PPV_ARGS(ppType) \ - __uuidof(decltype(**(ppType))), reinterpret_cast(ppType) - #else // __EMULATE_UUID #ifndef CROSS_PLATFORM_UUIDOF @@ -552,38 +462,16 @@ template inline GUID __emulated_uuidof(); struct __declspec(uuid(spec)) interface; #endif -template inline void **IID_PPV_ARGS_Helper(T **pp) { - return reinterpret_cast(pp); -} -#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType) - #endif // __EMULATE_UUID -// Needed for d3d headers, but fail to create actual interfaces -#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}} -#define DECLSPEC_UUID(x) -#define MIDL_INTERFACE(x) struct DECLSPEC_UUID(x) -#define DECLARE_INTERFACE(iface) struct iface -#define DECLARE_INTERFACE_(iface, parent) DECLARE_INTERFACE(iface) : parent - //===--------------------- COM Interfaces ---------------------------------===// -CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046") -struct IUnknown { - IUnknown(){}; - virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) = 0; - virtual ULONG AddRef() = 0; - virtual ULONG Release() = 0; - template HRESULT QueryInterface(Q **pp) { - return QueryInterface(__uuidof(Q), (void **)pp); - } -}; - -CROSS_PLATFORM_UUIDOF(INoMarshal, "ECC8691B-C1DB-4DC0-855E-65F6C551AF49") +struct INoMarshal; +__CRT_UUID_DECL(INoMarshal, 0xECC8691B, 0xC1DB, 0x4DC0, 0x85, 0x5E, 0x65, 0xF6, 0xC5, 0x51, 0xAF, 0x49) struct INoMarshal : public IUnknown {}; -CROSS_PLATFORM_UUIDOF(IMalloc, "00000002-0000-0000-C000-000000000046") +struct IMalloc; +__CRT_UUID_DECL(IMalloc, 0x00000002, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) struct IMalloc : public IUnknown { virtual void *Alloc(SIZE_T size) = 0; virtual void *Realloc(void *ptr, SIZE_T size) = 0; @@ -593,13 +481,15 @@ struct IMalloc : public IUnknown { virtual void HeapMinimize(void) = 0; }; -CROSS_PLATFORM_UUIDOF(ISequentialStream, "0C733A30-2A1C-11CE-ADE5-00AA0044773D") +struct ISequentialStream; +__CRT_UUID_DECL(ISequentialStream, 0x0C733A30, 0x2A1C, 0x11CE, 0xAD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D) struct ISequentialStream : public IUnknown { virtual HRESULT Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; virtual HRESULT Write(const void *pv, ULONG cb, ULONG *pcbWritten) = 0; }; -CROSS_PLATFORM_UUIDOF(IStream, "0000000c-0000-0000-C000-000000000046") +struct IStream; +__CRT_UUID_DECL(IStream, 0x0000000c, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) struct IStream : public ISequentialStream { virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) = 0; @@ -625,10 +515,12 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though -CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, - "8E349D19-54DB-4A56-9DC9-119D87BDB804") -CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, - "5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") + +struct ID3D12LibraryReflection; +struct ID3D12ShaderReflection; + +__CRT_UUID_DECL(ID3D12LibraryReflection, 0x8E349D19, 0x54DB, 0x4A56, 0x9D, 0xC9, 0x11, 0x9D, 0x87, 0xBD, 0xB8, 0x04) +__CRT_UUID_DECL(ID3D12ShaderReflection, 0x5A58797D, 0xA72C, 0x478D, 0x8B, 0xA2, 0xEF, 0xC6, 0xB0, 0xEF, 0xE8, 0x8E) //===--------------------- COM Pointer Types ------------------------------===// diff --git a/include/dxc/dxcapi.h b/include/dxc/dxcapi.h index 95cc56a049..ae1bd6df46 100644 --- a/include/dxc/dxcapi.h +++ b/include/dxc/dxcapi.h @@ -144,7 +144,8 @@ typedef struct DxcShaderHash { #define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" #define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" -CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") +struct IDxcBlob; +__CRT_UUID_DECL(IDxcBlob, 0x8BA5FB08, 0x5195, 0x40e2, 0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02) /// \brief A sized buffer that can be passed in and out of DXC APIs. /// /// This is an alias of ID3D10Blob and ID3DBlob. @@ -157,7 +158,8 @@ struct IDxcBlob : public IUnknown { virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") +struct IDxcBlobEncoding; +__CRT_UUID_DECL(IDxcBlobEncoding, 0x7241d424, 0x2646, 0x4191, 0x97, 0xc0, 0x98, 0xe9, 0x6e, 0x42, 0xfc, 0x68) /// \brief A blob that might have a known encoding. struct IDxcBlobEncoding : public IDxcBlob { public: @@ -174,7 +176,8 @@ struct IDxcBlobEncoding : public IDxcBlob { _Out_ UINT32 *pCodePage) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobWide, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") +struct IDxcBlobWide; +__CRT_UUID_DECL(IDxcBlobWide, 0xA3F84EAB, 0x0FAA, 0x497E, 0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84) /// \brief A blob containing a null-terminated wide string. /// /// This uses the native wide character encoding (utf16 on Windows, utf32 on @@ -197,7 +200,8 @@ struct IDxcBlobWide : public IDxcBlobEncoding { virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") +struct IDxcBlobUtf8; +__CRT_UUID_DECL(IDxcBlobUtf8, 0x3DA636C9, 0xBA71, 0x4024, 0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B) /// \brief A blob containing a UTF-8 encoded string. /// /// The value returned by GetBufferSize() is the size of the buffer, in bytes, @@ -221,8 +225,8 @@ struct IDxcBlobUtf8 : public IDxcBlobEncoding { typedef IDxcBlobWide IDxcBlobUtf16; #endif -CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, - "7f61fc7d-950d-467f-b3e3-3c02fb49187c") +struct IDxcIncludeHandler; +__CRT_UUID_DECL(IDxcIncludeHandler, 0x7f61fc7d, 0x950d, 0x467f, 0xb3, 0xe3, 0x3c, 0x02, 0xfb, 0x49, 0x18, 0x7c) /// \brief Interface for handling include directives. /// /// This interface can be implemented to customize handling of include @@ -263,7 +267,8 @@ struct DxcDefine { _Maybenull_ LPCWSTR Value; ///< Optional value for the define. }; -CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") +struct IDxcCompilerArgs; +__CRT_UUID_DECL(IDxcCompilerArgs, 0x73EFFE2A, 0x70DC, 0x45F8, 0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D) /// \brief Interface for managing arguments passed to DXC. /// /// Use IDxcUtils::BuildArguments to create an instance of this interface. @@ -306,7 +311,8 @@ struct IDxcCompilerArgs : public IUnknown { // Legacy Interfaces ///////////////////////// -CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") +struct IDxcLibrary; +__CRT_UUID_DECL(IDxcLibrary, 0xe5204dc7, 0xd18c, 0x4c3c, 0xbd, 0xfb, 0x85, 0x16, 0x73, 0x98, 0x0f, 0xe7) /// \deprecated IDxcUtils replaces IDxcLibrary; please use IDxcUtils insted. struct IDxcLibrary : public IUnknown { /// \deprecated @@ -364,8 +370,8 @@ struct IDxcLibrary : public IUnknown { #endif }; -CROSS_PLATFORM_UUIDOF(IDxcOperationResult, - "CEDB484A-D4E9-445A-B991-CA21CA157DC2") +struct IDxcOperationResult; +__CRT_UUID_DECL(IDxcOperationResult, 0xCEDB484A, 0xD4E9, 0x445A, 0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2) /// \brief The results of a DXC operation. /// /// Note: IDxcResult replaces IDxcOperationResult and should be used wherever @@ -391,7 +397,8 @@ struct IDxcOperationResult : public IUnknown { GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") +struct IDxcCompiler; +__CRT_UUID_DECL(IDxcCompiler, 0x8c210bf3, 0x011f, 0x4422, 0x8d, 0x70, 0x6f, 0x9a, 0xcb, 0x8d, 0xb6, 0x17) /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler : public IUnknown { /// \brief Compile a single entry point to the target shader model. @@ -444,7 +451,8 @@ struct IDxcCompiler : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") +struct IDxcCompiler2; +__CRT_UUID_DECL(IDxcCompiler2, 0xA005A9D9, 0xB8BB, 0x4594, 0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37) /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler2 : public IDxcCompiler { /// \brief Compile a single entry point to the target shader model with debug @@ -474,7 +482,8 @@ struct IDxcCompiler2 : public IDxcCompiler { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") +struct IDxcLinker; +__CRT_UUID_DECL(IDxcLinker, 0xF1B5BE2A, 0x62DD, 0x4327, 0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6) /// \brief DXC linker interface. /// /// Use DxcCreateInstance with CLSID_DxcLinker to obtain an instance of this @@ -507,7 +516,8 @@ struct IDxcLinker : public IUnknown { // Latest interfaces. Please use these. //////////////////////// -CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") +struct IDxcUtils; +__CRT_UUID_DECL(IDxcUtils, 0x4605C4CB, 0x2019, 0x492A, 0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F) /// \brief Various utility functions for DXC. /// /// Use DxcCreateInstance with CLSID_DxcUtils to obtain an instance of this @@ -752,7 +762,8 @@ typedef enum DXC_OUT_KIND { static_assert(DXC_OUT_NUM_ENUMS == DXC_OUT_LAST + 1, "DXC_OUT_* Enum added and last value not updated."); -CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") +struct IDxcResult; +__CRT_UUID_DECL(IDxcResult, 0x58346CDA, 0xDDE7, 0x4497, 0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59) /// \brief Result of a DXC operation. /// /// DXC operations may have multiple outputs, such as a shader object and @@ -796,7 +807,8 @@ struct IDxcResult : public IDxcOperationResult { #define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" #define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" -CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") +struct IDxcExtraOutputs; +__CRT_UUID_DECL(IDxcExtraOutputs, 0x319b37a2, 0xa5c2, 0x494a, 0xa5, 0xde, 0x48, 0x01, 0xb2, 0xfa, 0xf9, 0x89) /// \brief Additional outputs from a DXC operation. /// /// This can be used to obtain outputs that don't have an explicit DXC_OUT_KIND. @@ -826,7 +838,8 @@ struct IDxcExtraOutputs : public IUnknown { _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") +struct IDxcCompiler3; +__CRT_UUID_DECL(IDxcCompiler3, 0x228B4687, 0x5A6A, 0x4730, 0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54) /// \brief Interface to the DirectX Shader Compiler. /// /// Use DxcCreateInstance with CLSID_DxcCompiler to obtain an instance of this @@ -872,7 +885,8 @@ static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; static const UINT32 DxcValidatorFlags_ModuleOnly = 4; static const UINT32 DxcValidatorFlags_ValidMask = 0x7; -CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") +struct IDxcValidator; +__CRT_UUID_DECL(IDxcValidator, 0xA6E82BD2, 0x1FD7, 0x4826, 0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A) /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -886,7 +900,8 @@ struct IDxcValidator : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcValidator2, "458e1fd1-b1b2-4750-a6e1-9c10f03bed92") +struct IDxcValidator2; +__CRT_UUID_DECL(IDxcValidator2, 0x458e1fd1, 0xb1b2, 0x4750, 0xa6, 0xe1, 0x9c, 0x10, 0xf0, 0x3b, 0xed, 0x92) /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -902,8 +917,8 @@ struct IDxcValidator2 : public IDxcValidator { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, - "334b1f50-2292-4b35-99a1-25588d8c17fe") +struct IDxcContainerBuilder; +__CRT_UUID_DECL(IDxcContainerBuilder, 0x334b1f50, 0x2292, 0x4b35, 0x99, 0xa1, 0x25, 0x58, 0x8d, 0x8c, 0x17, 0xfe) /// \brief Interface to DXC container builder. /// /// Use DxcCreateInstance with CLSID_DxcContainerBuilder to obtain an instance @@ -936,7 +951,8 @@ struct IDxcContainerBuilder : public IUnknown { SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") +struct IDxcAssembler; +__CRT_UUID_DECL(IDxcAssembler, 0x091f7a26, 0x1c1f, 0x4948, 0x90, 0x4b, 0xe6, 0xe3, 0xa8, 0xa7, 0x71, 0xd5) /// \brief Interface to DxcAssembler. /// /// Use DxcCreateInstance with CLSID_DxcAssembler to obtain an instance of this. @@ -949,8 +965,8 @@ struct IDxcAssembler : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, - "d2c21b26-8350-4bdc-976a-331ce6f4c54c") +struct IDxcContainerReflection; +__CRT_UUID_DECL(IDxcContainerReflection, 0xd2c21b26, 0x8350, 0x4bdc, 0x97, 0x6a, 0x33, 0x1c, 0xe6, 0xf4, 0xc5, 0x4c) /// \brief Interface to DxcContainerReflection. /// /// Use DxcCreateInstance with CLSID_DxcContainerReflection to obtain an @@ -1024,7 +1040,8 @@ struct IDxcContainerReflection : public IUnknown { void **ppvObject) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") +struct IDxcOptimizerPass; +__CRT_UUID_DECL(IDxcOptimizerPass, 0xAE2CD79F, 0xCC22, 0x453F, 0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C) /// \brief An optimizer pass. /// /// Instances of this can be obtained via IDxcOptimizer::GetAvailablePass. @@ -1040,7 +1057,8 @@ struct IDxcOptimizerPass : public IUnknown { GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") +struct IDxcOptimizer; +__CRT_UUID_DECL(IDxcOptimizer, 0x25740E2E, 0x9CBA, 0x401B, 0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70) /// \brief Interface to DxcOptimizer. /// /// Use DxcCreateInstance with CLSID_DxcOptimizer to obtain an instance of this. @@ -1060,7 +1078,8 @@ static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG static const UINT32 DxcVersionInfoFlags_Internal = 2; // Internal Validator (non-signing) -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") +struct IDxcVersionInfo; +__CRT_UUID_DECL(IDxcVersionInfo, 0xb04f5b50, 0x2059, 0x4f12, 0xa8, 0xff, 0xa1, 0xe0, 0xcd, 0xe1, 0xcc, 0x7e) /// \brief PDB Version information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain an instance of this. @@ -1070,7 +1089,8 @@ struct IDxcVersionInfo : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") +struct IDxcVersionInfo2; +__CRT_UUID_DECL(IDxcVersionInfo2, 0xfb6904c4, 0x42f0, 0x4b62, 0x9c, 0x46, 0x98, 0x3a, 0xf7, 0xda, 0x7c, 0x83) /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1083,7 +1103,8 @@ struct IDxcVersionInfo2 : public IDxcVersionInfo { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo3, "5e13e843-9d25-473c-9ad2-03b2d0b44b1e") +struct IDxcVersionInfo3; +__CRT_UUID_DECL(IDxcVersionInfo3, 0x5e13e843, 0x9d25, 0x473c, 0x9a, 0xd2, 0x03, 0xb2, 0xd0, 0xb4, 0x4b, 0x1e) /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1101,7 +1122,8 @@ struct DxcArgPair { const WCHAR *pValue; }; -CROSS_PLATFORM_UUIDOF(IDxcPdbUtils, "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D") +struct IDxcPdbUtils; +__CRT_UUID_DECL(IDxcPdbUtils, 0xE6C9647E, 0x9D6A, 0x4C3B, 0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D) /// \deprecated Please use IDxcPdbUtils2 instead. struct IDxcPdbUtils : public IUnknown { virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; @@ -1158,7 +1180,8 @@ struct IDxcPdbUtils : public IUnknown { OverrideRootSignature(_In_ const WCHAR *pRootSignature) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcPdbUtils2, "4315D938-F369-4F93-95A2-252017CC3807") +struct IDxcPdbUtils2; +__CRT_UUID_DECL(IDxcPdbUtils2, 0x4315D938, 0xF369, 0x4F93, 0x95, 0xA2, 0x25, 0x20, 0x17, 0xCC, 0x38, 0x07) /// \brief DxcPdbUtils interface. /// /// Use DxcCreateInstance with CLSID_DxcPdbUtils to create an instance of this. diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index b0f9a467a4..986428f655 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -173,8 +173,8 @@ struct HLSL_INTRINSIC { /////////////////////////////////////////////////////////////////////////////// // Interfaces. -CROSS_PLATFORM_UUIDOF(IDxcIntrinsicTable, - "f0d4da3f-f863-4660-b8b4-dfd94ded6215") +struct IDxcIntrinsicTable; +__CRT_UUID_DECL(IDxcIntrinsicTable, 0xf0d4da3f, 0xf863, 0x4660, 0xb8, 0xb4, 0xdf, 0xd9, 0x4d, 0xed, 0x62, 0x15) struct IDxcIntrinsicTable : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetTableName(LPCSTR *pTableName) = 0; @@ -202,8 +202,8 @@ struct IDxcIntrinsicTable : public IUnknown { UINT *pDxilOpcode) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSemanticDefineValidator, - "1d063e4f-515a-4d57-a12a-431f6a44cfb9") +struct IDxcSemanticDefineValidator; +__CRT_UUID_DECL(IDxcSemanticDefineValidator, 0x1d063e4f, 0x515a, 0x4d57, 0xa1, 0x2a, 0x43, 0x1f, 0x6a, 0x44, 0xcf, 0xb9) struct IDxcSemanticDefineValidator : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetSemanticDefineWarningsAndErrors( @@ -211,8 +211,8 @@ struct IDxcSemanticDefineValidator : public IUnknown { IDxcBlobEncoding **ppErrorBlob) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions, - "282a56b4-3f56-4360-98c7-9ea04a752272") +struct IDxcLangExtensions; +__CRT_UUID_DECL(IDxcLangExtensions, 0x282a56b4, 0x3f56, 0x4360, 0x98, 0xc7, 0x9e, 0xa0, 0x4a, 0x75, 0x22, 0x72) struct IDxcLangExtensions : public IUnknown { public: /// @@ -240,15 +240,15 @@ struct IDxcLangExtensions : public IUnknown { SetSemanticDefineMetaDataName(LPCSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions2, - "2490C368-89EE-4491-A4B2-C6547B6C9381") +struct IDxcLangExtensions2; +__CRT_UUID_DECL(IDxcLangExtensions2, 0x2490C368, 0x89EE, 0x4491, 0xA4, 0xB2, 0xC6, 0x54, 0x7B, 0x6C, 0x93, 0x81) struct IDxcLangExtensions2 : public IDxcLangExtensions { public: virtual HRESULT STDMETHODCALLTYPE SetTargetTriple(LPCSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions3, - "A1B19880-FB1F-4920-9BC5-50356483BAC1") +struct IDxcLangExtensions3; +__CRT_UUID_DECL(IDxcLangExtensions3, 0xA1B19880, 0xFB1F, 0x4920, 0x9B, 0xC5, 0x50, 0x35, 0x64, 0x83, 0xBA, 0xC1) struct IDxcLangExtensions3 : public IDxcLangExtensions2 { public: /// Registers a semantic define which cannot be overriden using the flag @@ -257,7 +257,8 @@ struct IDxcLangExtensions3 : public IDxcLangExtensions2 { RegisterNonOptSemanticDefine(LPCWSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSystemAccess, "454b764f-3549-475b-958c-a7a6fcd05fbc") +struct IDxcSystemAccess; +__CRT_UUID_DECL(IDxcSystemAccess, 0x454b764f, 0x3549, 0x475b, 0x95, 0x8c, 0xa7, 0xa6, 0xfc, 0xd0, 0x5f, 0xbc) struct IDxcSystemAccess : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE EnumFiles(LPCWSTR fileName, @@ -313,16 +314,16 @@ struct IDxcSystemAccess : public IUnknown { unsigned *columnCount) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerEventsHandler, - "e991ca8d-2045-413c-a8b8-788b2c06e14d") +struct IDxcContainerEventsHandler; +__CRT_UUID_DECL(IDxcContainerEventsHandler, 0xe991ca8d, 0x2045, 0x413c, 0xa8, 0xb8, 0x78, 0x8b, 0x2c, 0x06, 0xe1, 0x4d) struct IDxcContainerEventsHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnDxilContainerBuilt(IDxcBlob *pSource, IDxcBlob **ppTarget) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerEvent, - "0cfc5058-342b-4ff2-83f7-04c12aad3d01") +struct IDxcContainerEvent; +__CRT_UUID_DECL(IDxcContainerEvent, 0x0cfc5058, 0x342b, 0x4ff2, 0x83, 0xf7, 0x04, 0xc1, 0x2a, 0xad, 0x3d, 0x01) struct IDxcContainerEvent : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE RegisterDxilContainerEventHandler( diff --git a/include/dxc/dxcisense.h b/include/dxc/dxcisense.h index 661de1680a..6161146f7f 100644 --- a/include/dxc/dxcisense.h +++ b/include/dxc/dxcisense.h @@ -662,7 +662,8 @@ struct IDxcCodeCompleteResults; struct IDxcCompletionResult; struct IDxcCompletionString; -CROSS_PLATFORM_UUIDOF(IDxcCursor, "1467b985-288d-4d2a-80c1-ef89c42c40bc") +struct IDxcCursor; +__CRT_UUID_DECL(IDxcCursor, 0x1467b985, 0x288d, 0x4d2a, 0x80, 0xc1, 0xef, 0x89, 0xc4, 0x2c, 0x40, 0xbc) struct IDxcCursor : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetExtent(_Outptr_result_nullonfailure_ IDxcSourceRange **pRange) = 0; @@ -728,7 +729,8 @@ struct IDxcCursor : public IUnknown { _Outptr_result_maybenull_ IDxcCursor **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcDiagnostic, "4f76b234-3659-4d33-99b0-3b0db994b564") +struct IDxcDiagnostic; +__CRT_UUID_DECL(IDxcDiagnostic, 0x4f76b234, 0x3659, 0x4d33, 0x99, 0xb0, 0x3b, 0x0d, 0xb9, 0x94, 0xb5, 0x64) struct IDxcDiagnostic : public IUnknown { virtual HRESULT STDMETHODCALLTYPE FormatDiagnostic(DxcDiagnosticDisplayOptions options, @@ -752,7 +754,8 @@ struct IDxcDiagnostic : public IUnknown { _Outptr_result_maybenull_ LPSTR *pText) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcFile, "bb2fca9e-1478-47ba-b08c-2c502ada4895") +struct IDxcFile; +__CRT_UUID_DECL(IDxcFile, 0xbb2fca9e, 0x1478, 0x47ba, 0xb0, 0x8c, 0x2c, 0x50, 0x2a, 0xda, 0x48, 0x95) struct IDxcFile : public IUnknown { /// Gets the file name for this file. virtual HRESULT STDMETHODCALLTYPE @@ -763,7 +766,8 @@ struct IDxcFile : public IUnknown { _Out_ BOOL *pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcInclusion, "0c364d65-df44-4412-888e-4e552fc5e3d6") +struct IDxcInclusion; +__CRT_UUID_DECL(IDxcInclusion, 0x0c364d65, 0xdf44, 0x4412, 0x88, 0x8e, 0x4e, 0x55, 0x2f, 0xc5, 0xe3, 0xd6) struct IDxcInclusion : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetIncludedFile(_Outptr_result_nullonfailure_ IDxcFile **pResult) = 0; @@ -773,7 +777,8 @@ struct IDxcInclusion : public IUnknown { _Outptr_result_nullonfailure_ IDxcSourceLocation **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcIntelliSense, "b1f99513-46d6-4112-8169-dd0d6053f17d") +struct IDxcIntelliSense; +__CRT_UUID_DECL(IDxcIntelliSense, 0xb1f99513, 0x46d6, 0x4112, 0x81, 0x69, 0xdd, 0x0d, 0x60, 0x53, 0xf1, 0x7d) struct IDxcIntelliSense : public IUnknown { virtual HRESULT STDMETHODCALLTYPE CreateIndex(_Outptr_result_nullonfailure_ IDxcIndex **index) = 0; @@ -793,7 +798,8 @@ struct IDxcIntelliSense : public IUnknown { _Outptr_result_nullonfailure_ IDxcUnsavedFile **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcIndex, "937824a0-7f5a-4815-9ba7-7fc0424f4173") +struct IDxcIndex; +__CRT_UUID_DECL(IDxcIndex, 0x937824a0, 0x7f5a, 0x4815, 0x9b, 0xa7, 0x7f, 0xc0, 0x42, 0x4f, 0x41, 0x73) struct IDxcIndex : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetGlobalOptions(DxcGlobalOptions options) = 0; @@ -808,8 +814,8 @@ struct IDxcIndex : public IUnknown { _Out_ IDxcTranslationUnit **pTranslationUnit) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSourceLocation, - "8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf") +struct IDxcSourceLocation; +__CRT_UUID_DECL(IDxcSourceLocation, 0x8e7ddf1c, 0xd7d3, 0x4d69, 0xb2, 0x86, 0x85, 0xfc, 0xcb, 0xa1, 0xe0, 0xcf) struct IDxcSourceLocation : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcSourceLocation *other, _Out_ BOOL *pResult) = 0; @@ -822,7 +828,8 @@ struct IDxcSourceLocation : public IUnknown { _Out_opt_ unsigned *pCol) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSourceRange, "f1359b36-a53f-4e81-b514-b6b84122a13f") +struct IDxcSourceRange; +__CRT_UUID_DECL(IDxcSourceRange, 0xf1359b36, 0xa53f, 0x4e81, 0xb5, 0x14, 0xb6, 0xb8, 0x41, 0x22, 0xa1, 0x3f) struct IDxcSourceRange : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -833,7 +840,8 @@ struct IDxcSourceRange : public IUnknown { _Out_ unsigned *endOffset) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcToken, "7f90b9ff-a275-4932-97d8-3cfd234482a2") +struct IDxcToken; +__CRT_UUID_DECL(IDxcToken, 0x7f90b9ff, 0xa275, 0x4932, 0x97, 0xd8, 0x3c, 0xfd, 0x23, 0x44, 0x82, 0xa2) struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTokenKind *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -843,8 +851,8 @@ struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Out_ LPSTR *pValue) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcTranslationUnit, - "9677dee0-c0e5-46a1-8b40-3db3168be63d") +struct IDxcTranslationUnit; +__CRT_UUID_DECL(IDxcTranslationUnit, 0x9677dee0, 0xc0e5, 0x46a1, 0x8b, 0x40, 0x3d, 0xb3, 0x16, 0x8b, 0xe6, 0x3d) struct IDxcTranslationUnit : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursor(_Out_ IDxcCursor **pCursor) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -892,7 +900,8 @@ struct IDxcTranslationUnit : public IUnknown { _Outptr_result_nullonfailure_ IDxcCodeCompleteResults **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcType, "2ec912fd-b144-4a15-ad0d-1c5439c81e46") +struct IDxcType; +__CRT_UUID_DECL(IDxcType, 0x2ec912fd, 0xb144, 0x4a15, 0xad, 0x0d, 0x1c, 0x54, 0x39, 0xc8, 0x1e, 0x46) struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_z_ LPSTR *pResult) = 0; @@ -901,7 +910,8 @@ struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTypeKind *pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcUnsavedFile, "8ec00f98-07d0-4e60-9d7c-5a50b5b0017f") +struct IDxcUnsavedFile; +__CRT_UUID_DECL(IDxcUnsavedFile, 0x8ec00f98, 0x07d0, 0x4e60, 0x9d, 0x7c, 0x5a, 0x50, 0xb5, 0xb0, 0x01, 0x7f) struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_z_ LPSTR *pFileName) = 0; @@ -910,8 +920,8 @@ struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetLength(_Out_ unsigned *pLength) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCodeCompleteResults, - "1E06466A-FD8B-45F3-A78F-8A3F76EBB552") +struct IDxcCodeCompleteResults; +__CRT_UUID_DECL(IDxcCodeCompleteResults, 0x1E06466A, 0xFD8B, 0x45F3, 0xA7, 0x8F, 0x8A, 0x3F, 0x76, 0xEB, 0xB5, 0x52) struct IDxcCodeCompleteResults : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumResults(_Out_ unsigned *pResult) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -919,8 +929,8 @@ struct IDxcCodeCompleteResults : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionResult **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompletionResult, - "943C0588-22D0-4784-86FC-701F802AC2B6") +struct IDxcCompletionResult; +__CRT_UUID_DECL(IDxcCompletionResult, 0x943C0588, 0x22D0, 0x4784, 0x86, 0xFC, 0x70, 0x1F, 0x80, 0x2A, 0xC2, 0xB6) struct IDxcCompletionResult : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursorKind(_Out_ DxcCursorKind *pResult) = 0; @@ -928,8 +938,8 @@ struct IDxcCompletionResult : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionString **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompletionString, - "06B51E0F-A605-4C69-A110-CD6E14B58EEC") +struct IDxcCompletionString; +__CRT_UUID_DECL(IDxcCompletionString, 0x06B51E0F, 0xA605, 0x4C69, 0xA1, 0x10, 0xCD, 0x6E, 0x14, 0xB5, 0x8E, 0xEC) struct IDxcCompletionString : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumCompletionChunks(_Out_ unsigned *pResult) = 0; diff --git a/include/dxc/dxctools.h b/include/dxc/dxctools.h index bfdc0d86f7..4a7cfaa92b 100644 --- a/include/dxc/dxctools.h +++ b/include/dxc/dxctools.h @@ -22,7 +22,8 @@ enum RewriterOptionMask { KeepUserMacro = 8, }; -CROSS_PLATFORM_UUIDOF(IDxcRewriter, "c012115b-8893-4eb9-9c5a-111456ea1c45") +struct IDxcRewriter; +__CRT_UUID_DECL(IDxcRewriter, 0xc012115b, 0x8893, 0x4eb9, 0x9c, 0x5a, 0x11, 0x14, 0x56, 0xea, 0x1c, 0x45) struct IDxcRewriter : public IUnknown { virtual HRESULT STDMETHODCALLTYPE RemoveUnusedGlobals( @@ -55,7 +56,8 @@ CLSID_SCOPE const CLSID 0x40b3, {0x96, 0x8d, 0x93, 0xe1, 0x24, 0x73, 0x4d, 0xa4}}; -CROSS_PLATFORM_UUIDOF(IDxcRewriter2, "261afca1-0609-4ec6-a77f-d98c7035194e") +struct IDxcRewriter2; +__CRT_UUID_DECL(IDxcRewriter2, 0x261afca1, 0x0609, 0x4ec6, 0xa7, 0x7f, 0xd9, 0x8c, 0x70, 0x35, 0x19, 0x4e) struct IDxcRewriter2 : public IDxcRewriter { virtual HRESULT STDMETHODCALLTYPE RewriteWithOptions( diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index 1481ae27ff..ad9cc4453e 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -133,8 +133,8 @@ namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, DWORD flags, std::string *pValue, bool *lossy) { - BOOL usedDefaultChar; - LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; + bool usedDefaultChar; + bool *pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) *lossy = false; From 903325e58db82439349cddd03a2ba1531c46a291 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 21:56:39 +0200 Subject: [PATCH 37/62] Restored most headers to what they used to be by adding the same definition that DirectX-Headers uses to define GUIDs so that either implementation of __uuidof can find the GUID. --- include/dxc/WinAdapter.h | 32 ++++++++----- include/dxc/dxcapi.h | 85 +++++++++++++---------------------- include/dxc/dxcapi.internal.h | 33 +++++++------- include/dxc/dxcisense.h | 50 +++++++++------------ include/dxc/dxctools.h | 6 +-- lib/DxcSupport/Unicode.cpp | 4 +- 6 files changed, 93 insertions(+), 117 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 918d99b0ff..a851695f29 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -453,6 +453,20 @@ template inline GUID __emulated_uuidof(); static const IID _IID = guid_from_string(spec); \ return _IID; \ } + extern "C++" \ + { \ + template <> \ + inline const GUID &__wsl_stub_uuidof() \ + { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> \ + inline const GUID &__wsl_stub_uuidof() \ + { \ + return __wsl_stub_uuidof(); \ + } \ + } #else // __EMULATE_UUID @@ -466,12 +480,10 @@ template inline GUID __emulated_uuidof(); //===--------------------- COM Interfaces ---------------------------------===// -struct INoMarshal; -__CRT_UUID_DECL(INoMarshal, 0xECC8691B, 0xC1DB, 0x4DC0, 0x85, 0x5E, 0x65, 0xF6, 0xC5, 0x51, 0xAF, 0x49) +CROSS_PLATFORM_UUIDOF(INoMarshal, "ECC8691B-C1DB-4DC0-855E-65F6C551AF49") struct INoMarshal : public IUnknown {}; -struct IMalloc; -__CRT_UUID_DECL(IMalloc, 0x00000002, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) +CROSS_PLATFORM_UUIDOF(IMalloc, "00000002-0000-0000-C000-000000000046") struct IMalloc : public IUnknown { virtual void *Alloc(SIZE_T size) = 0; virtual void *Realloc(void *ptr, SIZE_T size) = 0; @@ -481,15 +493,13 @@ struct IMalloc : public IUnknown { virtual void HeapMinimize(void) = 0; }; -struct ISequentialStream; -__CRT_UUID_DECL(ISequentialStream, 0x0C733A30, 0x2A1C, 0x11CE, 0xAD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D) +CROSS_PLATFORM_UUIDOF(ISequentialStream, "0C733A30-2A1C-11CE-ADE5-00AA0044773D") struct ISequentialStream : public IUnknown { virtual HRESULT Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; virtual HRESULT Write(const void *pv, ULONG cb, ULONG *pcbWritten) = 0; }; -struct IStream; -__CRT_UUID_DECL(IStream, 0x0000000c, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) +CROSS_PLATFORM_UUIDOF(IStream, "0000000c-0000-0000-C000-000000000046") struct IStream : public ISequentialStream { virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) = 0; @@ -519,8 +529,10 @@ struct IStream : public ISequentialStream { struct ID3D12LibraryReflection; struct ID3D12ShaderReflection; -__CRT_UUID_DECL(ID3D12LibraryReflection, 0x8E349D19, 0x54DB, 0x4A56, 0x9D, 0xC9, 0x11, 0x9D, 0x87, 0xBD, 0xB8, 0x04) -__CRT_UUID_DECL(ID3D12ShaderReflection, 0x5A58797D, 0xA72C, 0x478D, 0x8B, 0xA2, 0xEF, 0xC6, 0xB0, 0xEF, 0xE8, 0x8E) +CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, + "8E349D19-54DB-4A56-9DC9-119D87BDB804") +CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, + "5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") //===--------------------- COM Pointer Types ------------------------------===// diff --git a/include/dxc/dxcapi.h b/include/dxc/dxcapi.h index ae1bd6df46..95cc56a049 100644 --- a/include/dxc/dxcapi.h +++ b/include/dxc/dxcapi.h @@ -144,8 +144,7 @@ typedef struct DxcShaderHash { #define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" #define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" -struct IDxcBlob; -__CRT_UUID_DECL(IDxcBlob, 0x8BA5FB08, 0x5195, 0x40e2, 0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02) +CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") /// \brief A sized buffer that can be passed in and out of DXC APIs. /// /// This is an alias of ID3D10Blob and ID3DBlob. @@ -158,8 +157,7 @@ struct IDxcBlob : public IUnknown { virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; }; -struct IDxcBlobEncoding; -__CRT_UUID_DECL(IDxcBlobEncoding, 0x7241d424, 0x2646, 0x4191, 0x97, 0xc0, 0x98, 0xe9, 0x6e, 0x42, 0xfc, 0x68) +CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") /// \brief A blob that might have a known encoding. struct IDxcBlobEncoding : public IDxcBlob { public: @@ -176,8 +174,7 @@ struct IDxcBlobEncoding : public IDxcBlob { _Out_ UINT32 *pCodePage) = 0; }; -struct IDxcBlobWide; -__CRT_UUID_DECL(IDxcBlobWide, 0xA3F84EAB, 0x0FAA, 0x497E, 0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84) +CROSS_PLATFORM_UUIDOF(IDxcBlobWide, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") /// \brief A blob containing a null-terminated wide string. /// /// This uses the native wide character encoding (utf16 on Windows, utf32 on @@ -200,8 +197,7 @@ struct IDxcBlobWide : public IDxcBlobEncoding { virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; }; -struct IDxcBlobUtf8; -__CRT_UUID_DECL(IDxcBlobUtf8, 0x3DA636C9, 0xBA71, 0x4024, 0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B) +CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") /// \brief A blob containing a UTF-8 encoded string. /// /// The value returned by GetBufferSize() is the size of the buffer, in bytes, @@ -225,8 +221,8 @@ struct IDxcBlobUtf8 : public IDxcBlobEncoding { typedef IDxcBlobWide IDxcBlobUtf16; #endif -struct IDxcIncludeHandler; -__CRT_UUID_DECL(IDxcIncludeHandler, 0x7f61fc7d, 0x950d, 0x467f, 0xb3, 0xe3, 0x3c, 0x02, 0xfb, 0x49, 0x18, 0x7c) +CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, + "7f61fc7d-950d-467f-b3e3-3c02fb49187c") /// \brief Interface for handling include directives. /// /// This interface can be implemented to customize handling of include @@ -267,8 +263,7 @@ struct DxcDefine { _Maybenull_ LPCWSTR Value; ///< Optional value for the define. }; -struct IDxcCompilerArgs; -__CRT_UUID_DECL(IDxcCompilerArgs, 0x73EFFE2A, 0x70DC, 0x45F8, 0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D) +CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") /// \brief Interface for managing arguments passed to DXC. /// /// Use IDxcUtils::BuildArguments to create an instance of this interface. @@ -311,8 +306,7 @@ struct IDxcCompilerArgs : public IUnknown { // Legacy Interfaces ///////////////////////// -struct IDxcLibrary; -__CRT_UUID_DECL(IDxcLibrary, 0xe5204dc7, 0xd18c, 0x4c3c, 0xbd, 0xfb, 0x85, 0x16, 0x73, 0x98, 0x0f, 0xe7) +CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") /// \deprecated IDxcUtils replaces IDxcLibrary; please use IDxcUtils insted. struct IDxcLibrary : public IUnknown { /// \deprecated @@ -370,8 +364,8 @@ struct IDxcLibrary : public IUnknown { #endif }; -struct IDxcOperationResult; -__CRT_UUID_DECL(IDxcOperationResult, 0xCEDB484A, 0xD4E9, 0x445A, 0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2) +CROSS_PLATFORM_UUIDOF(IDxcOperationResult, + "CEDB484A-D4E9-445A-B991-CA21CA157DC2") /// \brief The results of a DXC operation. /// /// Note: IDxcResult replaces IDxcOperationResult and should be used wherever @@ -397,8 +391,7 @@ struct IDxcOperationResult : public IUnknown { GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; }; -struct IDxcCompiler; -__CRT_UUID_DECL(IDxcCompiler, 0x8c210bf3, 0x011f, 0x4422, 0x8d, 0x70, 0x6f, 0x9a, 0xcb, 0x8d, 0xb6, 0x17) +CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler : public IUnknown { /// \brief Compile a single entry point to the target shader model. @@ -451,8 +444,7 @@ struct IDxcCompiler : public IUnknown { ) = 0; }; -struct IDxcCompiler2; -__CRT_UUID_DECL(IDxcCompiler2, 0xA005A9D9, 0xB8BB, 0x4594, 0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37) +CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler2 : public IDxcCompiler { /// \brief Compile a single entry point to the target shader model with debug @@ -482,8 +474,7 @@ struct IDxcCompiler2 : public IDxcCompiler { ) = 0; }; -struct IDxcLinker; -__CRT_UUID_DECL(IDxcLinker, 0xF1B5BE2A, 0x62DD, 0x4327, 0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6) +CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") /// \brief DXC linker interface. /// /// Use DxcCreateInstance with CLSID_DxcLinker to obtain an instance of this @@ -516,8 +507,7 @@ struct IDxcLinker : public IUnknown { // Latest interfaces. Please use these. //////////////////////// -struct IDxcUtils; -__CRT_UUID_DECL(IDxcUtils, 0x4605C4CB, 0x2019, 0x492A, 0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F) +CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") /// \brief Various utility functions for DXC. /// /// Use DxcCreateInstance with CLSID_DxcUtils to obtain an instance of this @@ -762,8 +752,7 @@ typedef enum DXC_OUT_KIND { static_assert(DXC_OUT_NUM_ENUMS == DXC_OUT_LAST + 1, "DXC_OUT_* Enum added and last value not updated."); -struct IDxcResult; -__CRT_UUID_DECL(IDxcResult, 0x58346CDA, 0xDDE7, 0x4497, 0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59) +CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") /// \brief Result of a DXC operation. /// /// DXC operations may have multiple outputs, such as a shader object and @@ -807,8 +796,7 @@ struct IDxcResult : public IDxcOperationResult { #define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" #define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" -struct IDxcExtraOutputs; -__CRT_UUID_DECL(IDxcExtraOutputs, 0x319b37a2, 0xa5c2, 0x494a, 0xa5, 0xde, 0x48, 0x01, 0xb2, 0xfa, 0xf9, 0x89) +CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") /// \brief Additional outputs from a DXC operation. /// /// This can be used to obtain outputs that don't have an explicit DXC_OUT_KIND. @@ -838,8 +826,7 @@ struct IDxcExtraOutputs : public IUnknown { _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; }; -struct IDxcCompiler3; -__CRT_UUID_DECL(IDxcCompiler3, 0x228B4687, 0x5A6A, 0x4730, 0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54) +CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") /// \brief Interface to the DirectX Shader Compiler. /// /// Use DxcCreateInstance with CLSID_DxcCompiler to obtain an instance of this @@ -885,8 +872,7 @@ static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; static const UINT32 DxcValidatorFlags_ModuleOnly = 4; static const UINT32 DxcValidatorFlags_ValidMask = 0x7; -struct IDxcValidator; -__CRT_UUID_DECL(IDxcValidator, 0xA6E82BD2, 0x1FD7, 0x4826, 0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A) +CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -900,8 +886,7 @@ struct IDxcValidator : public IUnknown { ) = 0; }; -struct IDxcValidator2; -__CRT_UUID_DECL(IDxcValidator2, 0x458e1fd1, 0xb1b2, 0x4750, 0xa6, 0xe1, 0x9c, 0x10, 0xf0, 0x3b, 0xed, 0x92) +CROSS_PLATFORM_UUIDOF(IDxcValidator2, "458e1fd1-b1b2-4750-a6e1-9c10f03bed92") /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -917,8 +902,8 @@ struct IDxcValidator2 : public IDxcValidator { ) = 0; }; -struct IDxcContainerBuilder; -__CRT_UUID_DECL(IDxcContainerBuilder, 0x334b1f50, 0x2292, 0x4b35, 0x99, 0xa1, 0x25, 0x58, 0x8d, 0x8c, 0x17, 0xfe) +CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, + "334b1f50-2292-4b35-99a1-25588d8c17fe") /// \brief Interface to DXC container builder. /// /// Use DxcCreateInstance with CLSID_DxcContainerBuilder to obtain an instance @@ -951,8 +936,7 @@ struct IDxcContainerBuilder : public IUnknown { SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; }; -struct IDxcAssembler; -__CRT_UUID_DECL(IDxcAssembler, 0x091f7a26, 0x1c1f, 0x4948, 0x90, 0x4b, 0xe6, 0xe3, 0xa8, 0xa7, 0x71, 0xd5) +CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") /// \brief Interface to DxcAssembler. /// /// Use DxcCreateInstance with CLSID_DxcAssembler to obtain an instance of this. @@ -965,8 +949,8 @@ struct IDxcAssembler : public IUnknown { ) = 0; }; -struct IDxcContainerReflection; -__CRT_UUID_DECL(IDxcContainerReflection, 0xd2c21b26, 0x8350, 0x4bdc, 0x97, 0x6a, 0x33, 0x1c, 0xe6, 0xf4, 0xc5, 0x4c) +CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, + "d2c21b26-8350-4bdc-976a-331ce6f4c54c") /// \brief Interface to DxcContainerReflection. /// /// Use DxcCreateInstance with CLSID_DxcContainerReflection to obtain an @@ -1040,8 +1024,7 @@ struct IDxcContainerReflection : public IUnknown { void **ppvObject) = 0; }; -struct IDxcOptimizerPass; -__CRT_UUID_DECL(IDxcOptimizerPass, 0xAE2CD79F, 0xCC22, 0x453F, 0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C) +CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") /// \brief An optimizer pass. /// /// Instances of this can be obtained via IDxcOptimizer::GetAvailablePass. @@ -1057,8 +1040,7 @@ struct IDxcOptimizerPass : public IUnknown { GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; }; -struct IDxcOptimizer; -__CRT_UUID_DECL(IDxcOptimizer, 0x25740E2E, 0x9CBA, 0x401B, 0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70) +CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") /// \brief Interface to DxcOptimizer. /// /// Use DxcCreateInstance with CLSID_DxcOptimizer to obtain an instance of this. @@ -1078,8 +1060,7 @@ static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG static const UINT32 DxcVersionInfoFlags_Internal = 2; // Internal Validator (non-signing) -struct IDxcVersionInfo; -__CRT_UUID_DECL(IDxcVersionInfo, 0xb04f5b50, 0x2059, 0x4f12, 0xa8, 0xff, 0xa1, 0xe0, 0xcd, 0xe1, 0xcc, 0x7e) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") /// \brief PDB Version information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain an instance of this. @@ -1089,8 +1070,7 @@ struct IDxcVersionInfo : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; }; -struct IDxcVersionInfo2; -__CRT_UUID_DECL(IDxcVersionInfo2, 0xfb6904c4, 0x42f0, 0x4b62, 0x9c, 0x46, 0x98, 0x3a, 0xf7, 0xda, 0x7c, 0x83) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1103,8 +1083,7 @@ struct IDxcVersionInfo2 : public IDxcVersionInfo { ) = 0; }; -struct IDxcVersionInfo3; -__CRT_UUID_DECL(IDxcVersionInfo3, 0x5e13e843, 0x9d25, 0x473c, 0x9a, 0xd2, 0x03, 0xb2, 0xd0, 0xb4, 0x4b, 0x1e) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo3, "5e13e843-9d25-473c-9ad2-03b2d0b44b1e") /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1122,8 +1101,7 @@ struct DxcArgPair { const WCHAR *pValue; }; -struct IDxcPdbUtils; -__CRT_UUID_DECL(IDxcPdbUtils, 0xE6C9647E, 0x9D6A, 0x4C3B, 0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D) +CROSS_PLATFORM_UUIDOF(IDxcPdbUtils, "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D") /// \deprecated Please use IDxcPdbUtils2 instead. struct IDxcPdbUtils : public IUnknown { virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; @@ -1180,8 +1158,7 @@ struct IDxcPdbUtils : public IUnknown { OverrideRootSignature(_In_ const WCHAR *pRootSignature) = 0; }; -struct IDxcPdbUtils2; -__CRT_UUID_DECL(IDxcPdbUtils2, 0x4315D938, 0xF369, 0x4F93, 0x95, 0xA2, 0x25, 0x20, 0x17, 0xCC, 0x38, 0x07) +CROSS_PLATFORM_UUIDOF(IDxcPdbUtils2, "4315D938-F369-4F93-95A2-252017CC3807") /// \brief DxcPdbUtils interface. /// /// Use DxcCreateInstance with CLSID_DxcPdbUtils to create an instance of this. diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 986428f655..45ed19d500 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -138,7 +138,7 @@ static const BYTE IA_SPECIAL_SLOTS = 4; struct HLSL_INTRINSIC_ARGUMENT { LPCSTR - pName; // Name of the argument; the first argument has the function name. + pName; // Name of the argument; the first argument has the function name. UINT64 qwUsage; // A combination of // AR_QUAL_IN|AR_QUAL_OUT|AR_QUAL_COLMAJOR|AR_QUAL_ROWMAJOR in // parameter tables; other values possible elsewhere. @@ -173,8 +173,8 @@ struct HLSL_INTRINSIC { /////////////////////////////////////////////////////////////////////////////// // Interfaces. -struct IDxcIntrinsicTable; -__CRT_UUID_DECL(IDxcIntrinsicTable, 0xf0d4da3f, 0xf863, 0x4660, 0xb8, 0xb4, 0xdf, 0xd9, 0x4d, 0xed, 0x62, 0x15) +CROSS_PLATFORM_UUIDOF(IDxcIntrinsicTable, + "f0d4da3f-f863-4660-b8b4-dfd94ded6215") struct IDxcIntrinsicTable : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetTableName(LPCSTR *pTableName) = 0; @@ -202,8 +202,8 @@ struct IDxcIntrinsicTable : public IUnknown { UINT *pDxilOpcode) = 0; }; -struct IDxcSemanticDefineValidator; -__CRT_UUID_DECL(IDxcSemanticDefineValidator, 0x1d063e4f, 0x515a, 0x4d57, 0xa1, 0x2a, 0x43, 0x1f, 0x6a, 0x44, 0xcf, 0xb9) +CROSS_PLATFORM_UUIDOF(IDxcSemanticDefineValidator, + "1d063e4f-515a-4d57-a12a-431f6a44cfb9") struct IDxcSemanticDefineValidator : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetSemanticDefineWarningsAndErrors( @@ -211,8 +211,8 @@ struct IDxcSemanticDefineValidator : public IUnknown { IDxcBlobEncoding **ppErrorBlob) = 0; }; -struct IDxcLangExtensions; -__CRT_UUID_DECL(IDxcLangExtensions, 0x282a56b4, 0x3f56, 0x4360, 0x98, 0xc7, 0x9e, 0xa0, 0x4a, 0x75, 0x22, 0x72) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions, + "282a56b4-3f56-4360-98c7-9ea04a752272") struct IDxcLangExtensions : public IUnknown { public: /// @@ -240,15 +240,15 @@ struct IDxcLangExtensions : public IUnknown { SetSemanticDefineMetaDataName(LPCSTR name) = 0; }; -struct IDxcLangExtensions2; -__CRT_UUID_DECL(IDxcLangExtensions2, 0x2490C368, 0x89EE, 0x4491, 0xA4, 0xB2, 0xC6, 0x54, 0x7B, 0x6C, 0x93, 0x81) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions2, + "2490C368-89EE-4491-A4B2-C6547B6C9381") struct IDxcLangExtensions2 : public IDxcLangExtensions { public: virtual HRESULT STDMETHODCALLTYPE SetTargetTriple(LPCSTR name) = 0; }; -struct IDxcLangExtensions3; -__CRT_UUID_DECL(IDxcLangExtensions3, 0xA1B19880, 0xFB1F, 0x4920, 0x9B, 0xC5, 0x50, 0x35, 0x64, 0x83, 0xBA, 0xC1) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions3, + "A1B19880-FB1F-4920-9BC5-50356483BAC1") struct IDxcLangExtensions3 : public IDxcLangExtensions2 { public: /// Registers a semantic define which cannot be overriden using the flag @@ -257,8 +257,7 @@ struct IDxcLangExtensions3 : public IDxcLangExtensions2 { RegisterNonOptSemanticDefine(LPCWSTR name) = 0; }; -struct IDxcSystemAccess; -__CRT_UUID_DECL(IDxcSystemAccess, 0x454b764f, 0x3549, 0x475b, 0x95, 0x8c, 0xa7, 0xa6, 0xfc, 0xd0, 0x5f, 0xbc) +CROSS_PLATFORM_UUIDOF(IDxcSystemAccess, "454b764f-3549-475b-958c-a7a6fcd05fbc") struct IDxcSystemAccess : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE EnumFiles(LPCWSTR fileName, @@ -314,16 +313,16 @@ struct IDxcSystemAccess : public IUnknown { unsigned *columnCount) = 0; }; -struct IDxcContainerEventsHandler; -__CRT_UUID_DECL(IDxcContainerEventsHandler, 0xe991ca8d, 0x2045, 0x413c, 0xa8, 0xb8, 0x78, 0x8b, 0x2c, 0x06, 0xe1, 0x4d) +CROSS_PLATFORM_UUIDOF(IDxcContainerEventsHandler, + "e991ca8d-2045-413c-a8b8-788b2c06e14d") struct IDxcContainerEventsHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnDxilContainerBuilt(IDxcBlob *pSource, IDxcBlob **ppTarget) = 0; }; -struct IDxcContainerEvent; -__CRT_UUID_DECL(IDxcContainerEvent, 0x0cfc5058, 0x342b, 0x4ff2, 0x83, 0xf7, 0x04, 0xc1, 0x2a, 0xad, 0x3d, 0x01) +CROSS_PLATFORM_UUIDOF(IDxcContainerEvent, + "0cfc5058-342b-4ff2-83f7-04c12aad3d01") struct IDxcContainerEvent : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE RegisterDxilContainerEventHandler( diff --git a/include/dxc/dxcisense.h b/include/dxc/dxcisense.h index 6161146f7f..661de1680a 100644 --- a/include/dxc/dxcisense.h +++ b/include/dxc/dxcisense.h @@ -662,8 +662,7 @@ struct IDxcCodeCompleteResults; struct IDxcCompletionResult; struct IDxcCompletionString; -struct IDxcCursor; -__CRT_UUID_DECL(IDxcCursor, 0x1467b985, 0x288d, 0x4d2a, 0x80, 0xc1, 0xef, 0x89, 0xc4, 0x2c, 0x40, 0xbc) +CROSS_PLATFORM_UUIDOF(IDxcCursor, "1467b985-288d-4d2a-80c1-ef89c42c40bc") struct IDxcCursor : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetExtent(_Outptr_result_nullonfailure_ IDxcSourceRange **pRange) = 0; @@ -729,8 +728,7 @@ struct IDxcCursor : public IUnknown { _Outptr_result_maybenull_ IDxcCursor **pResult) = 0; }; -struct IDxcDiagnostic; -__CRT_UUID_DECL(IDxcDiagnostic, 0x4f76b234, 0x3659, 0x4d33, 0x99, 0xb0, 0x3b, 0x0d, 0xb9, 0x94, 0xb5, 0x64) +CROSS_PLATFORM_UUIDOF(IDxcDiagnostic, "4f76b234-3659-4d33-99b0-3b0db994b564") struct IDxcDiagnostic : public IUnknown { virtual HRESULT STDMETHODCALLTYPE FormatDiagnostic(DxcDiagnosticDisplayOptions options, @@ -754,8 +752,7 @@ struct IDxcDiagnostic : public IUnknown { _Outptr_result_maybenull_ LPSTR *pText) = 0; }; -struct IDxcFile; -__CRT_UUID_DECL(IDxcFile, 0xbb2fca9e, 0x1478, 0x47ba, 0xb0, 0x8c, 0x2c, 0x50, 0x2a, 0xda, 0x48, 0x95) +CROSS_PLATFORM_UUIDOF(IDxcFile, "bb2fca9e-1478-47ba-b08c-2c502ada4895") struct IDxcFile : public IUnknown { /// Gets the file name for this file. virtual HRESULT STDMETHODCALLTYPE @@ -766,8 +763,7 @@ struct IDxcFile : public IUnknown { _Out_ BOOL *pResult) = 0; }; -struct IDxcInclusion; -__CRT_UUID_DECL(IDxcInclusion, 0x0c364d65, 0xdf44, 0x4412, 0x88, 0x8e, 0x4e, 0x55, 0x2f, 0xc5, 0xe3, 0xd6) +CROSS_PLATFORM_UUIDOF(IDxcInclusion, "0c364d65-df44-4412-888e-4e552fc5e3d6") struct IDxcInclusion : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetIncludedFile(_Outptr_result_nullonfailure_ IDxcFile **pResult) = 0; @@ -777,8 +773,7 @@ struct IDxcInclusion : public IUnknown { _Outptr_result_nullonfailure_ IDxcSourceLocation **pResult) = 0; }; -struct IDxcIntelliSense; -__CRT_UUID_DECL(IDxcIntelliSense, 0xb1f99513, 0x46d6, 0x4112, 0x81, 0x69, 0xdd, 0x0d, 0x60, 0x53, 0xf1, 0x7d) +CROSS_PLATFORM_UUIDOF(IDxcIntelliSense, "b1f99513-46d6-4112-8169-dd0d6053f17d") struct IDxcIntelliSense : public IUnknown { virtual HRESULT STDMETHODCALLTYPE CreateIndex(_Outptr_result_nullonfailure_ IDxcIndex **index) = 0; @@ -798,8 +793,7 @@ struct IDxcIntelliSense : public IUnknown { _Outptr_result_nullonfailure_ IDxcUnsavedFile **pResult) = 0; }; -struct IDxcIndex; -__CRT_UUID_DECL(IDxcIndex, 0x937824a0, 0x7f5a, 0x4815, 0x9b, 0xa7, 0x7f, 0xc0, 0x42, 0x4f, 0x41, 0x73) +CROSS_PLATFORM_UUIDOF(IDxcIndex, "937824a0-7f5a-4815-9ba7-7fc0424f4173") struct IDxcIndex : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetGlobalOptions(DxcGlobalOptions options) = 0; @@ -814,8 +808,8 @@ struct IDxcIndex : public IUnknown { _Out_ IDxcTranslationUnit **pTranslationUnit) = 0; }; -struct IDxcSourceLocation; -__CRT_UUID_DECL(IDxcSourceLocation, 0x8e7ddf1c, 0xd7d3, 0x4d69, 0xb2, 0x86, 0x85, 0xfc, 0xcb, 0xa1, 0xe0, 0xcf) +CROSS_PLATFORM_UUIDOF(IDxcSourceLocation, + "8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf") struct IDxcSourceLocation : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcSourceLocation *other, _Out_ BOOL *pResult) = 0; @@ -828,8 +822,7 @@ struct IDxcSourceLocation : public IUnknown { _Out_opt_ unsigned *pCol) = 0; }; -struct IDxcSourceRange; -__CRT_UUID_DECL(IDxcSourceRange, 0xf1359b36, 0xa53f, 0x4e81, 0xb5, 0x14, 0xb6, 0xb8, 0x41, 0x22, 0xa1, 0x3f) +CROSS_PLATFORM_UUIDOF(IDxcSourceRange, "f1359b36-a53f-4e81-b514-b6b84122a13f") struct IDxcSourceRange : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -840,8 +833,7 @@ struct IDxcSourceRange : public IUnknown { _Out_ unsigned *endOffset) = 0; }; -struct IDxcToken; -__CRT_UUID_DECL(IDxcToken, 0x7f90b9ff, 0xa275, 0x4932, 0x97, 0xd8, 0x3c, 0xfd, 0x23, 0x44, 0x82, 0xa2) +CROSS_PLATFORM_UUIDOF(IDxcToken, "7f90b9ff-a275-4932-97d8-3cfd234482a2") struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTokenKind *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -851,8 +843,8 @@ struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Out_ LPSTR *pValue) = 0; }; -struct IDxcTranslationUnit; -__CRT_UUID_DECL(IDxcTranslationUnit, 0x9677dee0, 0xc0e5, 0x46a1, 0x8b, 0x40, 0x3d, 0xb3, 0x16, 0x8b, 0xe6, 0x3d) +CROSS_PLATFORM_UUIDOF(IDxcTranslationUnit, + "9677dee0-c0e5-46a1-8b40-3db3168be63d") struct IDxcTranslationUnit : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursor(_Out_ IDxcCursor **pCursor) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -900,8 +892,7 @@ struct IDxcTranslationUnit : public IUnknown { _Outptr_result_nullonfailure_ IDxcCodeCompleteResults **pResult) = 0; }; -struct IDxcType; -__CRT_UUID_DECL(IDxcType, 0x2ec912fd, 0xb144, 0x4a15, 0xad, 0x0d, 0x1c, 0x54, 0x39, 0xc8, 0x1e, 0x46) +CROSS_PLATFORM_UUIDOF(IDxcType, "2ec912fd-b144-4a15-ad0d-1c5439c81e46") struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_z_ LPSTR *pResult) = 0; @@ -910,8 +901,7 @@ struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTypeKind *pResult) = 0; }; -struct IDxcUnsavedFile; -__CRT_UUID_DECL(IDxcUnsavedFile, 0x8ec00f98, 0x07d0, 0x4e60, 0x9d, 0x7c, 0x5a, 0x50, 0xb5, 0xb0, 0x01, 0x7f) +CROSS_PLATFORM_UUIDOF(IDxcUnsavedFile, "8ec00f98-07d0-4e60-9d7c-5a50b5b0017f") struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_z_ LPSTR *pFileName) = 0; @@ -920,8 +910,8 @@ struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetLength(_Out_ unsigned *pLength) = 0; }; -struct IDxcCodeCompleteResults; -__CRT_UUID_DECL(IDxcCodeCompleteResults, 0x1E06466A, 0xFD8B, 0x45F3, 0xA7, 0x8F, 0x8A, 0x3F, 0x76, 0xEB, 0xB5, 0x52) +CROSS_PLATFORM_UUIDOF(IDxcCodeCompleteResults, + "1E06466A-FD8B-45F3-A78F-8A3F76EBB552") struct IDxcCodeCompleteResults : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumResults(_Out_ unsigned *pResult) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -929,8 +919,8 @@ struct IDxcCodeCompleteResults : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionResult **pResult) = 0; }; -struct IDxcCompletionResult; -__CRT_UUID_DECL(IDxcCompletionResult, 0x943C0588, 0x22D0, 0x4784, 0x86, 0xFC, 0x70, 0x1F, 0x80, 0x2A, 0xC2, 0xB6) +CROSS_PLATFORM_UUIDOF(IDxcCompletionResult, + "943C0588-22D0-4784-86FC-701F802AC2B6") struct IDxcCompletionResult : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursorKind(_Out_ DxcCursorKind *pResult) = 0; @@ -938,8 +928,8 @@ struct IDxcCompletionResult : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionString **pResult) = 0; }; -struct IDxcCompletionString; -__CRT_UUID_DECL(IDxcCompletionString, 0x06B51E0F, 0xA605, 0x4C69, 0xA1, 0x10, 0xCD, 0x6E, 0x14, 0xB5, 0x8E, 0xEC) +CROSS_PLATFORM_UUIDOF(IDxcCompletionString, + "06B51E0F-A605-4C69-A110-CD6E14B58EEC") struct IDxcCompletionString : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumCompletionChunks(_Out_ unsigned *pResult) = 0; diff --git a/include/dxc/dxctools.h b/include/dxc/dxctools.h index 4a7cfaa92b..bfdc0d86f7 100644 --- a/include/dxc/dxctools.h +++ b/include/dxc/dxctools.h @@ -22,8 +22,7 @@ enum RewriterOptionMask { KeepUserMacro = 8, }; -struct IDxcRewriter; -__CRT_UUID_DECL(IDxcRewriter, 0xc012115b, 0x8893, 0x4eb9, 0x9c, 0x5a, 0x11, 0x14, 0x56, 0xea, 0x1c, 0x45) +CROSS_PLATFORM_UUIDOF(IDxcRewriter, "c012115b-8893-4eb9-9c5a-111456ea1c45") struct IDxcRewriter : public IUnknown { virtual HRESULT STDMETHODCALLTYPE RemoveUnusedGlobals( @@ -56,8 +55,7 @@ CLSID_SCOPE const CLSID 0x40b3, {0x96, 0x8d, 0x93, 0xe1, 0x24, 0x73, 0x4d, 0xa4}}; -struct IDxcRewriter2; -__CRT_UUID_DECL(IDxcRewriter2, 0x261afca1, 0x0609, 0x4ec6, 0xa7, 0x7f, 0xd9, 0x8c, 0x70, 0x35, 0x19, 0x4e) +CROSS_PLATFORM_UUIDOF(IDxcRewriter2, "261afca1-0609-4ec6-a77f-d98c7035194e") struct IDxcRewriter2 : public IDxcRewriter { virtual HRESULT STDMETHODCALLTYPE RewriteWithOptions( diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index ad9cc4453e..1481ae27ff 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -133,8 +133,8 @@ namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, DWORD flags, std::string *pValue, bool *lossy) { - bool usedDefaultChar; - bool *pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; + BOOL usedDefaultChar; + LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) *lossy = false; From ae5c6871490d238d6b7715f8934c28148376b2c2 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:05:31 +0200 Subject: [PATCH 38/62] Fixed BOOL issues and compile issues on linux --- include/dxc/Support/Unicode.h | 10 +++++----- include/dxc/WinAdapter.h | 6 +++--- lib/DxcSupport/Unicode.cpp | 12 ++++++------ lib/DxcSupport/dxcapi.use.cpp | 2 +- projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp | 2 +- tools/clang/tools/dxr/dxr.cpp | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index 64e3abccd8..2437cff38a 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -30,7 +30,7 @@ int WideCharToMultiByte(uint32_t CodePage, uint32_t dwFlags, const wchar_t *lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, const char *lpDefaultChar = nullptr, - bool *lpUsedDefaultChar = nullptr); + LPBOOL lpUsedDefaultChar = nullptr); #endif // _WIN32 namespace Unicode { @@ -54,14 +54,14 @@ typedef char acp_char; typedef char ccp_char; bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, - bool *lossy); + LPBOOL lossy); -bool UTF8ToConsoleString(const char *text, std::string *pValue, bool *lossy); +bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy); bool WideToConsoleString(const wchar_t *text, size_t textLen, - std::string *pValue, bool *lossy); + std::string *pValue, LPBOOL lossy); -bool WideToConsoleString(const wchar_t *text, std::string *pValue, bool *lossy); +bool WideToConsoleString(const wchar_t *text, std::string *pValue, LPBOOL lossy); bool UTF8ToWideString(const char *pUTF8, std::wstring *pWide); diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index a851695f29..121f574fae 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -452,7 +452,7 @@ template inline GUID __emulated_uuidof(); template <> inline GUID __emulated_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ - } + } \ extern "C++" \ { \ template <> \ @@ -462,9 +462,9 @@ template inline GUID __emulated_uuidof(); return _IID; \ } \ template <> \ - inline const GUID &__wsl_stub_uuidof() \ + inline const GUID &__wsl_stub_uuidof() \ { \ - return __wsl_stub_uuidof(); \ + return __wsl_stub_uuidof(); \ } \ } diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index 1481ae27ff..be4bcfa005 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -79,7 +79,7 @@ int WideCharToMultiByte(uint32_t /*CodePage*/, uint32_t /*dwFlags*/, const wchar_t *lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, const char * /*lpDefaultChar*/, - bool *lpUsedDefaultChar) { + LPBOOL lpUsedDefaultChar) { if (lpUsedDefaultChar) { *lpUsedDefaultChar = FALSE; } @@ -132,7 +132,7 @@ int WideCharToMultiByte(uint32_t /*CodePage*/, uint32_t /*dwFlags*/, namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, - DWORD flags, std::string *pValue, bool *lossy) { + DWORD flags, std::string *pValue, LPBOOL lossy) { BOOL usedDefaultChar; LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) @@ -204,7 +204,7 @@ std::wstring UTF8ToWideStringOrThrow(const char *pUTF8) { } bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, - bool *lossy) { + LPBOOL lossy) { DXASSERT_NOMSG(text != nullptr); DXASSERT_NOMSG(pValue != nullptr); std::wstring text16; @@ -216,12 +216,12 @@ bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, return WideToConsoleString(text16.c_str(), text16.length(), pValue, lossy); } -bool UTF8ToConsoleString(const char *text, std::string *pValue, bool *lossy) { +bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy) { return UTF8ToConsoleString(text, strlen(text), pValue, lossy); } bool WideToConsoleString(const wchar_t *text, size_t textLen, - std::string *pValue, bool *lossy) { + std::string *pValue, LPBOOL lossy) { DXASSERT_NOMSG(text != nullptr); DXASSERT_NOMSG(pValue != nullptr); UINT cp = GetConsoleOutputCP(); @@ -229,7 +229,7 @@ bool WideToConsoleString(const wchar_t *text, size_t textLen, } bool WideToConsoleString(const wchar_t *text, std::string *pValue, - bool *lossy) { + LPBOOL lossy) { return WideToConsoleString(text, wcslen(text), pValue, lossy); } diff --git a/lib/DxcSupport/dxcapi.use.cpp b/lib/DxcSupport/dxcapi.use.cpp index 399259ef87..7628b51f35 100644 --- a/lib/DxcSupport/dxcapi.use.cpp +++ b/lib/DxcSupport/dxcapi.use.cpp @@ -114,7 +114,7 @@ static void WriteWideNullTermToConsole(const wchar_t *pText, DWORD streamType) { return; } - bool lossy; // Note: even if there was loss, print anyway + BOOL lossy; // Note: even if there was loss, print anyway std::string consoleMessage; Unicode::WideToConsoleString(pText, &consoleMessage, &lossy); if (streamType == STD_OUTPUT_HANDLE) { diff --git a/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp b/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp index c485709c57..ac50370052 100644 --- a/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp +++ b/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp @@ -373,7 +373,7 @@ int __cdecl wmain(int argc, wchar_t **argv) { } std::string textMessage; - bool lossy; + BOOL lossy; if (!Unicode::UTF8ToConsoleString(pMsg, &textMessage, &lossy) || lossy) { // Do a direct assignment as a last-ditch effort and print out as UTF-8. textMessage = pMsg; diff --git a/tools/clang/tools/dxr/dxr.cpp b/tools/clang/tools/dxr/dxr.cpp index e64a050ffc..3268864a43 100644 --- a/tools/clang/tools/dxr/dxr.cpp +++ b/tools/clang/tools/dxr/dxr.cpp @@ -171,7 +171,7 @@ int main(int argc, const char **argv) { } std::string textMessage; - bool lossy; + BOOL lossy; if (!Unicode::UTF8ToConsoleString(msg, &textMessage, &lossy) || lossy) { // Do a direct assignment as a last-ditch effort and print out as UTF-8. textMessage = msg; From dc19327ea85b08c17afb85b8f17eb4cf7536d6c0 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:14:29 +0200 Subject: [PATCH 39/62] Fixed windows build --- include/dxc/Support/Unicode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index 2437cff38a..fd3ed345c4 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -14,6 +14,7 @@ #include #ifdef _WIN32 +typedef int* LPBOOL; #include #else // MultiByteToWideChar which is a Windows-specific method. From 631d446629c1438c34b2bcf932cfa47b9d3293c3 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:15:54 +0200 Subject: [PATCH 40/62] Clean up for PR --- include/dxc/WinAdapter.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 121f574fae..c21e4e17a5 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -526,9 +526,6 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though -struct ID3D12LibraryReflection; -struct ID3D12ShaderReflection; - CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, "8E349D19-54DB-4A56-9DC9-119D87BDB804") CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, From 6e41fafadb2ddb19c6574312d204d8a8a6488966 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:17:35 +0200 Subject: [PATCH 41/62] Undid some changes for PR --- include/dxc/WinAdapter.h | 1 - include/dxc/dxcapi.internal.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index c21e4e17a5..07f0eceda8 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -525,7 +525,6 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though - CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, "8E349D19-54DB-4A56-9DC9-119D87BDB804") CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 45ed19d500..b0f9a467a4 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -138,7 +138,7 @@ static const BYTE IA_SPECIAL_SLOTS = 4; struct HLSL_INTRINSIC_ARGUMENT { LPCSTR - pName; // Name of the argument; the first argument has the function name. + pName; // Name of the argument; the first argument has the function name. UINT64 qwUsage; // A combination of // AR_QUAL_IN|AR_QUAL_OUT|AR_QUAL_COLMAJOR|AR_QUAL_ROWMAJOR in // parameter tables; other values possible elsewhere. From 18a489416fa4ca410473e0a09345306a271ee262 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:34:20 +0200 Subject: [PATCH 42/62] DirectX-Headers is now required for windows --- CMakeLists.txt | 7 +++++-- external/CMakeLists.txt | 12 +++++------- include/dxc/Support/D3DReflection.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c76abdf6..71c73c359f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,8 +674,11 @@ endif() if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) - +if(WIN32) + include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) +else() + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) +endif() # Put this before tblgen. Else we have a circular dependence. add_subdirectory(lib/Support) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index a8b2638e3d..b56bc1d2ab 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -9,13 +9,11 @@ endif (NOT HLSL_ENABLE_DEBUG_ITERATORS) # Need DirectX-Headers module if not on windows if (NOT DIRECTX_HEADER_INCLUDE_DIR) - if (NOT WIN32) - if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") - set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) - else() - message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") - endif() - endif (NOT WIN32) + if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") + set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) + else() + message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") + endif() endif(NOT DIRECTX_HEADER_INCLUDE_DIR) # Enabling SPIR-V codegen requires SPIRV-Headers for spirv.hpp and diff --git a/include/dxc/Support/D3DReflection.h b/include/dxc/Support/D3DReflection.h index aeb004c7bb..4e5c0684b3 100644 --- a/include/dxc/Support/D3DReflection.h +++ b/include/dxc/Support/D3DReflection.h @@ -22,5 +22,5 @@ #undef interface #pragma GCC diagnostic pop #else -#include +#include "d3d12shader.h" #endif From d1d195a179c0bbab925296e172900e15ad0fcae5 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:38:20 +0200 Subject: [PATCH 43/62] Formatting --- include/dxc/Support/Unicode.h | 5 +++-- include/dxc/WinAdapter.h | 25 ++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index fd3ed345c4..3f9442c1cd 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -14,7 +14,7 @@ #include #ifdef _WIN32 -typedef int* LPBOOL; +typedef int *LPBOOL; #include #else // MultiByteToWideChar which is a Windows-specific method. @@ -62,7 +62,8 @@ bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy); bool WideToConsoleString(const wchar_t *text, size_t textLen, std::string *pValue, LPBOOL lossy); -bool WideToConsoleString(const wchar_t *text, std::string *pValue, LPBOOL lossy); +bool WideToConsoleString(const wchar_t *text, std::string *pValue, + LPBOOL lossy); bool UTF8ToWideString(const char *pUTF8, std::wstring *pWide); diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 07f0eceda8..5e62911b13 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc +#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows @@ -453,20 +453,15 @@ template inline GUID __emulated_uuidof(); static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - extern "C++" \ - { \ - template <> \ - inline const GUID &__wsl_stub_uuidof() \ - { \ - static const IID _IID = guid_from_string(spec); \ - return _IID; \ - } \ - template <> \ - inline const GUID &__wsl_stub_uuidof() \ - { \ - return __wsl_stub_uuidof(); \ - } \ - } + extern "C++" { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ + } \ + } #else // __EMULATE_UUID From d82e56d5ccef6226f27c8513b15dc996a09f12df Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:53:14 +0200 Subject: [PATCH 44/62] Some compilers don't seem to like missing endline at the end of a file. Also don't like an include named winadapter.h in a file named WinAdapter.h --- CMakeLists.txt | 2 +- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c76abdf6..498c70e263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,7 +674,7 @@ endif() if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) +include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/directx) # Put this before tblgen. Else we have a circular dependence. diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 8cd1ddf8ed..bd5368b966 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 8cd1ddf8edecc3410df223104f936f6a3badf3e6 +Subproject commit bd5368b966c41efe6406b22b01a8cab11c24d3b2 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 121f574fae..3beffe3363 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc +#include "../winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows From 7883cda4683cdd0c10379067cb6045352c4cbbd3 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:03:49 +0200 Subject: [PATCH 45/62] Clang still needs __wsl_stub_uuidof, even though it has builtin support. Added CLSID_D3D12SDKConfiguration for older Windows sdks --- include/dxc/WinAdapter.h | 14 +++++++++++++- tools/clang/unittests/HLSLExec/ExecutionTest.cpp | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 2c7e07ff5d..fff6859f63 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -465,7 +465,19 @@ template inline GUID __emulated_uuidof(); #else // __EMULATE_UUID -#ifndef CROSS_PLATFORM_UUIDOF +#ifndef _WIN32 +#define CROSS_PLATFORM_UUIDOF(interface, spec) \ + struct __declspec(uuid(spec)) interface; \ + extern "C++" { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ + } \ + } +#elif !defined(CROSS_PLATFORM_UUIDOF) // Warning: This macro exists in dxcapi.h as well #define CROSS_PLATFORM_UUIDOF(interface, spec) \ struct __declspec(uuid(spec)) interface; diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index f22e99e467..af0f40d659 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -106,6 +106,12 @@ ID3D12SDKConfiguration : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, LPCSTR SDKPath) = 0; }; +#elif defined(_WIN32) +EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { + 0x7cda6aca, + 0xa03e, + 0x49c8, + {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; #endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ using namespace DirectX; From 15d406c3240df505059cad75393d780630ab801d Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:04:37 +0200 Subject: [PATCH 46/62] Formatting --- include/dxc/WinAdapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index fff6859f63..646ddcd211 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "../winadapter.h" //To avoid duplicates, some things are defined by WSL, some by dxc +#include "../winadapter.h" //To avoid duplicates, some things are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows From 21a522589302723269dfc9a4258700369c0a8c9f Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:15:03 +0200 Subject: [PATCH 47/62] Clang didn't have guid_from_string yet --- include/dxc/WinAdapter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 646ddcd211..1372309c49 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -407,8 +407,6 @@ enum tagSTATFLAG { //===--------------------- UUID Related Macros ----------------------------===// -#ifdef __EMULATE_UUID - // The following macros are defined to facilitate the lack of 'uuid' on Linux. constexpr uint8_t nybble_from_hex(char c) { @@ -445,6 +443,8 @@ constexpr GUID guid_from_string(const char str[37]) { byte_from_hexstr(str + 32), byte_from_hexstr(str + 34)}}; } +#ifdef __EMULATE_UUID + template inline GUID __emulated_uuidof(); #define CROSS_PLATFORM_UUIDOF(interface, spec) \ From e0272d7aa3f171c762630cf0f928dd3ab5694069 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:51:24 +0200 Subject: [PATCH 48/62] Removed duplicate defintions, since now d3d12.h from DirectX-Headers is included --- tools/dxexp/dxexp.cpp | 144 ------------------------------------------ 1 file changed, 144 deletions(-) diff --git a/tools/dxexp/dxexp.cpp b/tools/dxexp/dxexp.cpp index 4787200318..5ae24fbde9 100644 --- a/tools/dxexp/dxexp.cpp +++ b/tools/dxexp/dxexp.cpp @@ -42,150 +42,6 @@ static HRESULT AtlCheck(HRESULT hr) { return hr; } -// Not defined in Creators Update version of d3d12.h: -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS2 -#define D3D12_FEATURE_D3D12_OPTIONS3 ((D3D12_FEATURE)21) -typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS { - D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, - D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = - (1 << D3D12_COMMAND_LIST_TYPE_DIRECT), - D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = - (1 << D3D12_COMMAND_LIST_TYPE_BUNDLE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = - (1 << D3D12_COMMAND_LIST_TYPE_COMPUTE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5) -} D3D12_COMMAND_LIST_SUPPORT_FLAGS; - -typedef enum D3D12_VIEW_INSTANCING_TIER { - D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, - D3D12_VIEW_INSTANCING_TIER_1 = 1, - D3D12_VIEW_INSTANCING_TIER_2 = 2, - D3D12_VIEW_INSTANCING_TIER_3 = 3 -} D3D12_VIEW_INSTANCING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 { - BOOL CopyQueueTimestampQueriesSupported; - BOOL CastingFullyTypedFormatSupported; - DWORD WriteBufferImmediateSupportFlags; - D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; - BOOL BarycentricsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS3; -#endif - -#ifndef NTDDI_WIN10_RS3 -#define NTDDI_WIN10_RS3 0x0A000004 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3 -#define D3D12_FEATURE_D3D12_OPTIONS4 ((D3D12_FEATURE)23) -typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER { - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0, - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1, -} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 { - BOOL ReservedBufferPlacementSupported; - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; - BOOL Native16BitShaderOpsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS4; -#endif - -#ifndef NTDDI_WIN10_RS4 -#define NTDDI_WIN10_RS4 0x0A000005 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS4 -#define D3D12_FEATURE_D3D12_OPTIONS5 ((D3D12_FEATURE)27) -typedef enum D3D12_RENDER_PASS_TIER { - D3D12_RENDER_PASS_TIER_0 = 0, - D3D12_RENDER_PASS_TIER_1 = 1, - D3D12_RENDER_PASS_TIER_2 = 2 -} D3D12_RENDER_PASS_TIER; - -typedef enum D3D12_RAYTRACING_TIER { - D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, - D3D12_RAYTRACING_TIER_1_0 = 10 D3D12_RAYTRACING_TIER_1_1 = 11 -} D3D12_RAYTRACING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 { - BOOL SRVOnlyTiledResourceTier3; - D3D12_RENDER_PASS_TIER RenderPassesTier; - D3D12_RAYTRACING_TIER RaytracingTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS5; -#endif - -#ifndef NTDDI_WIN10_VB -#define NTDDI_WIN10_VB 0x0A000008 -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_VB -#define D3D12_FEATURE_D3D12_OPTIONS7 ((D3D12_FEATURE)32) - -typedef enum D3D12_MESH_SHADER_TIER { - D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, - D3D12_MESH_SHADER_TIER_1 = 10 -} D3D12_MESH_SHADER_TIER; - -typedef enum D3D12_SAMPLER_FEEDBACK_TIER { - D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, - D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, - D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 -} D3D12_SAMPLER_FEEDBACK_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 { - D3D12_MESH_SHADER_TIER MeshShaderTier; - D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS7; -#endif - -#ifndef NTDDI_WIN10_FE -#define NTDDI_WIN10_FE 0x0A00000A -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_FE -#define D3D12_FEATURE_D3D12_OPTIONS9 ((D3D12_FEATURE)37) - -typedef enum D3D12_WAVE_MMA_TIER { - D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, - D3D12_WAVE_MMA_TIER_1_0 = 10 -} D3D12_WAVE_MMA_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 { - BOOL MeshShaderPipelineStatsSupported; - BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; - BOOL AtomicInt64OnTypedResourceSupported; - BOOL AtomicInt64OnGroupSharedSupported; - BOOL DerivativesInMeshAndAmplificationShadersSupported; - D3D12_WAVE_MMA_TIER WaveMMATier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS9; -#endif - -#ifndef NTDDI_WIN10_NI -#define NTDDI_WIN10_NI 0x0A00000C -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_NI -#define D3D12_FEATURE_D3D12_OPTIONS14 ((D3D12_FEATURE)43) -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 { - BOOL AdvancedTextureOpsSupported; - BOOL WriteableMSAATexturesSupported; - BOOL IndependentFrontAndBackStencilRefMaskSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS14; -#endif - -#pragma warning(disable : 4063) -#define D3D12_RAYTRACING_TIER_1_1 ((D3D12_RAYTRACING_TIER)11) -#define D3D_SHADER_MODEL_6_1 ((D3D_SHADER_MODEL)0x61) -#define D3D_SHADER_MODEL_6_2 ((D3D_SHADER_MODEL)0x62) -#define D3D_SHADER_MODEL_6_3 ((D3D_SHADER_MODEL)0x63) -#define D3D_SHADER_MODEL_6_4 ((D3D_SHADER_MODEL)0x64) -#define D3D_SHADER_MODEL_6_5 ((D3D_SHADER_MODEL)0x65) -#define D3D_SHADER_MODEL_6_6 ((D3D_SHADER_MODEL)0x66) -#define D3D_SHADER_MODEL_6_7 ((D3D_SHADER_MODEL)0x67) -#define D3D_SHADER_MODEL_6_8 ((D3D_SHADER_MODEL)0x68) - #define DXEXP_HIGHEST_SHADER_MODEL D3D_SHADER_MODEL_6_8 static const char *BoolToStrJson(bool value) { From 0d91e5664b29231eeea3935317ae6d3adec42e5b Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 11:33:12 +0200 Subject: [PATCH 49/62] DirectX-Headers wasn't properly up to date --- external/DirectX-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index bd5368b966..353d37a095 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit bd5368b966c41efe6406b22b01a8cab11c24d3b2 +Subproject commit 353d37a09512cc737c9c08d3dfda8a0e632d0bcd From e000305e71779d7d918ec275d65ce84852a85c0c Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 12:06:48 +0200 Subject: [PATCH 50/62] Fixed issue with failed merge in DirectX-Headers --- external/DirectX-Headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 353d37a095..6a21463c59 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 353d37a09512cc737c9c08d3dfda8a0e632d0bcd +Subproject commit 6a21463c59c2170dfa3195c92a1f19d8f268a4b9 From 043225579200a3cbe4cee919e500af3d8ab890aa Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 13:34:04 +0200 Subject: [PATCH 51/62] Fixed build if interface is defined by winadapter --- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 28 ++++++++++++++-------------- tools/clang/include/clang/AST/Attr.h | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 6a21463c59..dc27951f84 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 6a21463c59c2170dfa3195c92a1f19d8f268a4b9 +Subproject commit dc27951f840703d8edfe6e2907bfff6410fe68eb diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 38f7796811..10796baec7 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -444,42 +444,42 @@ constexpr GUID guid_from_string(const char str[37]) { #ifdef __EMULATE_UUID -template inline GUID __emulated_uuidof(); +template inline GUID __emulated_uuidof(); -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct interface; \ - template <> inline GUID __emulated_uuidof() { \ +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct interfce; \ + template <> inline GUID __emulated_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ extern "C++" { \ - template <> inline const GUID &__wsl_stub_uuidof() { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - template <> inline const GUID &__wsl_stub_uuidof() { \ - return __wsl_stub_uuidof(); \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ } \ } #else // __EMULATE_UUID #ifndef _WIN32 -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct __declspec(uuid(spec)) interface; \ +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct __declspec(uuid(spec)) interfce; \ extern "C++" { \ - template <> inline const GUID &__wsl_stub_uuidof() { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - template <> inline const GUID &__wsl_stub_uuidof() { \ - return __wsl_stub_uuidof(); \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ } \ } #elif !defined(CROSS_PLATFORM_UUIDOF) // Warning: This macro exists in dxcapi.h as well -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct __declspec(uuid(spec)) interface; +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct __declspec(uuid(spec)) interfce; #endif #endif // __EMULATE_UUID diff --git a/tools/clang/include/clang/AST/Attr.h b/tools/clang/include/clang/AST/Attr.h index 4e282d68b7..8abc524ba7 100644 --- a/tools/clang/include/clang/AST/Attr.h +++ b/tools/clang/include/clang/AST/Attr.h @@ -149,6 +149,7 @@ class InheritableParamAttr : public InheritableAttr { } }; +#undef interface #include "clang/AST/Attrs.inc" inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, From 042ed57a358c2deeb3369324c9751df6ab5f8dee Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 16:00:15 +0200 Subject: [PATCH 52/62] Merge upstream back into branch --- tools/clang/tools/dxcvalidator/dxcvalidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang/tools/dxcvalidator/dxcvalidator.cpp b/tools/clang/tools/dxcvalidator/dxcvalidator.cpp index b8b71ece62..c7975c9c8f 100644 --- a/tools/clang/tools/dxcvalidator/dxcvalidator.cpp +++ b/tools/clang/tools/dxcvalidator/dxcvalidator.cpp @@ -52,7 +52,7 @@ static void HashAndUpdateOrCopy(uint32_t Flags, IDxcBlob *Shader, } else { CComPtr HashedBlobStream; IFT(CreateMemoryStream(DxcGetThreadMallocNoRef(), &HashedBlobStream)); - unsigned long CB; + ULONG CB; IFT(HashedBlobStream->Write(Shader->GetBufferPointer(), Shader->GetBufferSize(), &CB)); HashAndUpdate((DxilContainerHeader *)HashedBlobStream->GetPtr()); From 4faa40c0527a055fe0b275221def55f643e26eaa Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 21:40:24 +0200 Subject: [PATCH 53/62] Added unit tests by modifying existing unit tests to include reflection info (where it makes sense). Only unit tests that provide unique scenarios have been touched. Fixed some misformatting in D3DReflectionDumper. Apparently m_pProps can be NULL, so made it S_OK instead of E_FAIL. Fixed problem with GetInputNode/GetOutputNode where it returned a string pointer of a C++ struct which implictly copied due to not being const&. --- lib/DxilContainer/D3DReflectionDumper.cpp | 14 +- lib/HLSL/DxilContainerReflection.cpp | 6 +- .../d3dreflect/amp-groupshared.hlsl | 5 + .../d3dreflect/comp-groupshared.hlsl | 5 + .../d3dreflect/empty_broadcasting_nodes.hlsl | 55 ++++ .../d3dreflect/empty_thread_nodes.hlsl | 71 +++++ .../d3dreflect/lib_hs_export1.hlsl | 139 +++++++- .../d3dreflect/mesh-groupshared.hlsl | 9 + .../node-record-alignment-16bit.hlsl | 301 ++++++++++++++++++ .../d3dreflect/rdat_mintarget/sm63_dxr.hlsl | 159 +++++++++ .../d3dreflect/rdat_mintarget/sm65_ms_as.hlsl | 51 +++ .../rdat_mintarget/sm68_barriers.hlsl | 292 +++++++++++++++++ .../wavesize-compute-node-rdat.hlsl | 67 +++- 13 files changed, 1160 insertions(+), 14 deletions(-) diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 55477769fe..1cfb8fd153 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -224,7 +224,7 @@ void D3DReflectionDumper::Dump(D3D12_DOMAIN_SHADER_DESC &Desc) { Dedent(); } void D3DReflectionDumper::Dump(D3D12_NODE_ID_DESC &Desc, const char *name) { - WriteLn("D3D12_NODE_ID_DESC:"); + WriteLn("D3D12_NODE_ID_DESC: (", name, ")"); Indent(); WriteLn("Name: ", Desc.Name); WriteLn("ID: ", std::dec, Desc.ID); @@ -237,19 +237,21 @@ void D3DReflectionDumper::Dump(D3D12_NODE_DESC &Desc) { WriteLn("Type:"); Indent(); - WriteLn("Size", std::dec, Desc.Type.Size); - WriteLn("Alignment", std::dec, Desc.Type.Alignment); + WriteLn("Size: ", std::dec, Desc.Type.Size); + WriteLn("Alignment: ", std::dec, Desc.Type.Alignment); WriteLn("DispatchGrid:"); Indent(); - WriteLn("ByteOffset", std::dec, Desc.Type.DispatchGrid.ByteOffset); + WriteLn("ByteOffset: ", std::dec, Desc.Type.DispatchGrid.ByteOffset); DumpEnum("ComponentType", Desc.Type.DispatchGrid.ComponentType); - WriteLn("NumComponents, std::dec", Desc.Type.DispatchGrid.NumComponents); + WriteLn("NumComponents: ", std::dec, Desc.Type.DispatchGrid.NumComponents); Dedent(); Dedent(); - Dump(Desc.OutputID, "OutputID"); + if (Desc.Flags & D3D12_NODE_IO_FLAGS_OUTPUT) + Dump(Desc.OutputID, "OutputID"); + WriteLn("MaxRecords: ", std::dec, Desc.MaxRecords); WriteLn("MaxRecordsSharedWith: ", std::dec, Desc.MaxRecordsSharedWith); WriteLn("OutputArraySize: ", std::dec, Desc.OutputArraySize); diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 4611264a1e..69b6ae3174 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2961,7 +2961,7 @@ HRESULT CFunctionReflection::GetDesc1(D3D12_FUNCTION_DESC1 *pDesc) { } else { - return E_FAIL; + return S_OK; } D3D12_COMPUTE_SHADER_DESC computeDesc = {m_pProps->WaveSize.Min, @@ -3129,7 +3129,7 @@ HRESULT CFunctionReflection::GetInputNode(UINT i, D3D12_NODE_DESC *pDesc) { if (i >= m_pProps->InputNodes.size()) return E_BOUNDS; - NodeIOProperties prop = m_pProps->InputNodes[i]; + const NodeIOProperties &prop = m_pProps->InputNodes[i]; *pDesc = D3D12_NODE_DESC{ (D3D12_NODE_IO_FLAGS)(uint32_t)prop.Flags, @@ -3165,7 +3165,7 @@ HRESULT CFunctionReflection::GetOutputNode(UINT i, D3D12_NODE_DESC *pDesc) { if (i >= m_pProps->OutputNodes.size()) return E_BOUNDS; - NodeIOProperties prop = m_pProps->OutputNodes[i]; + const NodeIOProperties &prop = m_pProps->OutputNodes[i]; *pDesc = D3D12_NODE_DESC{ (D3D12_NODE_IO_FLAGS)(uint32_t)prop.Flags, diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl index ce31f7f033..096bbd3dd8 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl @@ -81,6 +81,11 @@ // CHECK: Dimension: D3D_SRV_DIMENSION_BUFFER // CHECK: NumSamples (or stride): 4294967295 // CHECK: uFlags: (D3D_SIF_TEXTURE_COMPONENT_0 | D3D_SIF_TEXTURE_COMPONENT_1) +// CHECK:ID3D12LibraryReflection1: +// CHECK: D3D12_LIBRARY_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: PayloadSize: 16 +// CHECK: NumThreads: 4, 1, 1 struct MeshPayload { diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl index 8d17d3da83..6bc81d61be 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl @@ -110,6 +110,11 @@ // CHECK: Dimension: D3D_SRV_DIMENSION_BUFFER // CHECK: NumSamples (or stride): 4294967295 // CHECK: uFlags: 0 +// CHECK:ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_COMPUTE_SHADER_DESC: +// CHECK: NumThreads: 64, 2, 2 struct Foo { int a[2]; diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl index 92a61720a0..7f1522cb22 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl @@ -304,6 +304,61 @@ // CHECK: BoundResources: 0 // CHECK: FunctionParameterCount: 0 // CHECK: HasReturn: FALSE +// CHECK:ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_NODE_SHADER_DESC: +// CHECK: D3D12_COMPUTE_SHADER_DESC: +// CHECK: NumThreads: 25, 4, 1 +// CHECK: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +// CHECK: IsProgramEntry: FALSE +// CHECK: LocalRootArgumentsTableIndex: -1 +// CHECK: DispatchGrid[0]: 2 +// CHECK: DispatchGrid[1]: 8 +// CHECK: DispatchGrid[2]: 10 +// CHECK: MaxDispatchGrid[0]: 0 +// CHECK: MaxDispatchGrid[1]: 0 +// CHECK: MaxDispatchGrid[2]: 0 +// CHECK: MaxRecursionDepth: 0 +// CHECK: D3D12_NODE_ID_DESC: (ShaderId) +// CHECK: Name: depth18part0_wg_63_nodes_seed_255 +// CHECK: ID: 0 +// CHECK: D3D12_NODE_ID_DESC: (ShaderSharedInput) +// CHECK: Name: depth18part0_wg_63_nodes_seed_255 +// CHECK: ID: 0 +// CHECK: InputNodes: 1 +// CHECK: OutputNodes: 1 +// CHECK: Input Nodes: +// CHECK: D3D12_NODE_DESC: +// CHECK: Flags: 0x61 +// CHECK: Type: +// CHECK: Size: 8 +// CHECK: Alignment: 4 +// CHECK: DispatchGrid: +// CHECK: ByteOffset: 0 +// CHECK: ComponentType: +// CHECK: NumComponents: 0 +// CHECK: MaxRecords: 0 +// CHECK: MaxRecordsSharedWith: -1 +// CHECK: OutputArraySize: 0 +// CHECK: AllowSparseNodes: FALSE +// CHECK: Output Nodes: +// CHECK: D3D12_NODE_DESC: +// CHECK: Flags: 0x16 +// CHECK: Type: +// CHECK: Size: 20 +// CHECK: Alignment: 4 +// CHECK: DispatchGrid: +// CHECK: ByteOffset: 8 +// CHECK: ComponentType: D3D12_DISPATCH_COMPONENT_TYPE_U32 +// CHECK: NumComponents: 3 +// CHECK: D3D12_NODE_ID_DESC: (OutputID) +// CHECK: Name: OutputyMcOutputFace +// CHECK: ID: 0 +// CHECK: MaxRecords: 47 +// CHECK: MaxRecordsSharedWith: -1 +// CHECK: OutputArraySize: 2 +// CHECK: AllowSparseNodes: TRUE struct rec0 { diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl index 00ce9f2f55..2a9feb3aa9 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl @@ -335,6 +335,77 @@ // CHECK: BoundResources: 0 // CHECK: FunctionParameterCount: 0 // CHECK: HasReturn: FALSE +// CHECK:ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_NODE_SHADER_DESC: +// CHECK: D3D12_COMPUTE_SHADER_DESC: +// CHECK: NumThreads: 1, 1, 1 +// CHECK: LaunchType: D3D12_NODE_LAUNCH_TYPE_THREAD_LAUNCH +// CHECK: IsProgramEntry: FALSE +// CHECK: LocalRootArgumentsTableIndex: 2 +// CHECK: DispatchGrid[0]: 0 +// CHECK: DispatchGrid[1]: 0 +// CHECK: DispatchGrid[2]: 0 +// CHECK: MaxDispatchGrid[0]: 0 +// CHECK: MaxDispatchGrid[1]: 0 +// CHECK: MaxDispatchGrid[2]: 0 +// CHECK: MaxRecursionDepth: 0 +// CHECK: D3D12_NODE_ID_DESC: (ShaderId) +// CHECK: Name: Input2Output +// CHECK: ID: 0 +// CHECK: D3D12_NODE_ID_DESC: (ShaderSharedInput) +// CHECK: Name: Input2Output +// CHECK: ID: 0 +// CHECK: InputNodes: 1 +// CHECK: OutputNodes: 2 +// CHECK: Input Nodes: +// CHECK: D3D12_NODE_DESC: +// CHECK: Flags: 0x25 +// CHECK: Type: +// CHECK: Size: 8 +// CHECK: Alignment: 4 +// CHECK: DispatchGrid: +// CHECK: ByteOffset: 0 +// CHECK: ComponentType: +// CHECK: NumComponents: 0 +// CHECK: MaxRecords: 0 +// CHECK: MaxRecordsSharedWith: -1 +// CHECK: OutputArraySize: 0 +// CHECK: AllowSparseNodes: FALSE +// CHECK: Output Nodes: +// CHECK: D3D12_NODE_DESC: +// CHECK: Flags: 0x106 +// CHECK: Type: +// CHECK: Size: 8 +// CHECK: Alignment: 4 +// CHECK: DispatchGrid: +// CHECK: ByteOffset: 0 +// CHECK: ComponentType: +// CHECK: NumComponents: 0 +// CHECK: D3D12_NODE_ID_DESC: (OutputID) +// CHECK: Name: Output1 +// CHECK: ID: 0 +// CHECK: MaxRecords: 0 +// CHECK: MaxRecordsSharedWith: 1 +// CHECK: OutputArraySize: 0 +// CHECK: AllowSparseNodes: FALSE +// CHECK: D3D12_NODE_DESC: +// CHECK: Flags: 0x6 +// CHECK: Type: +// CHECK: Size: 8 +// CHECK: Alignment: 4 +// CHECK: DispatchGrid: +// CHECK: ByteOffset: 0 +// CHECK: ComponentType: +// CHECK: NumComponents: 0 +// CHECK: D3D12_NODE_ID_DESC: (OutputID) +// CHECK: Name: Output2ID +// CHECK: ID: 1 +// CHECK: MaxRecords: 5 +// CHECK: MaxRecordsSharedWith: -1 +// CHECK: OutputArraySize: 0 +// CHECK: AllowSparseNodes: FALSE struct rec0 { diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export1.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export1.hlsl index 14d9eee2a1..c183872ced 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export1.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export1.hlsl @@ -1,9 +1,142 @@ // RUN: %dxc -auto-binding-space 13 -T lib_6_3 -exports HSMain1;HSMain2;HSMain3 %s | %D3DReflect %s | FileCheck %s // This version of HSPerPatchFunc1 should not be exported -// CHECK: ID3D12FunctionReflection: -// CHECK-NOT: D3D12_FUNCTION_DESC: Name: \01?HSPerPatchFunc1{{[@$?.A-Za-z0-9_]+InputPatch[@$?.A-Za-z0-9_]+}} -// CHECK-NOT: D3D_SRV_DIMENSION_BUFFER +// CHECK: ID3D12LibraryReflection1: +// CHECK: D3D12_LIBRARY_DESC: +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: FunctionCount: 8 +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: \01?HSMain1@@YAXIV?$InputPatch@UPSSceneIn@@$02@@@Z +// CHECK: Shader Version: Library 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: EarlyDepthStencil: FALSE +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: \01?HSMain2@@YAXIV?$InputPatch@UPSSceneIn@@$03@@@Z +// CHECK: Shader Version: Library 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: EarlyDepthStencil: FALSE +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: \01?HSMain3@@YAXIV?$InputPatch@UPSSceneIn@@$02@@@Z +// CHECK: Shader Version: Library 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: EarlyDepthStencil: FALSE +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: \01?HSPerPatchFunc1@@YA?AUHSPerPatchData@@XZ +// CHECK: Shader Version: Library 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: EarlyDepthStencil: FALSE +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: \01?HSPerPatchFunc2@@YA?AUHSPerPatchDataQuad@@V?$InputPatch@UPSSceneIn@@$03@@@Z +// CHECK: Shader Version: Library 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: EarlyDepthStencil: FALSE +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: HSMain1 +// CHECK: Shader Version: Hull 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_HULL_SHADER_DESC: +// CHECK: Domain: D3D_TESSELLATOR_DOMAIN_TRI +// CHECK: Partition: D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD +// CHECK: OutputPrimitive: D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW +// CHECK: InputControlPoints: 3 +// CHECK: OutputControlPoints: 3 +// CHECK: MaxTessFactor: 64 +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: HSMain2 +// CHECK: Shader Version: Hull 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_HULL_SHADER_DESC: +// CHECK: Domain: D3D_TESSELLATOR_DOMAIN_QUAD +// CHECK: Partition: D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD +// CHECK: OutputPrimitive: D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW +// CHECK: InputControlPoints: 4 +// CHECK: OutputControlPoints: 4 +// CHECK: MaxTessFactor: 64 +// CHECK: ID3D12FunctionReflection: +// CHECK: D3D12_FUNCTION_DESC: Name: HSMain3 +// CHECK: Shader Version: Hull 6.3 +// CHECK: Creator: +// CHECK: Flags: 0 +// CHECK: RequiredFeatureFlags: 0 +// CHECK: ConstantBuffers: 0 +// CHECK: BoundResources: 0 +// CHECK: FunctionParameterCount: 0 +// CHECK: HasReturn: FALSE +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_HULL_SHADER_DESC: +// CHECK: Domain: D3D_TESSELLATOR_DOMAIN_TRI +// CHECK: Partition: D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD +// CHECK: OutputPrimitive: D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW +// CHECK: InputControlPoints: 3 +// CHECK: OutputControlPoints: 3 +// CHECK: MaxTessFactor: 64 +// CHECK-NOT:ID3D12FunctionReflection: Buffer T_unused; diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl index adca28b6d6..011b8f4539 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl @@ -160,6 +160,15 @@ // CHECK: BoundResources: 0 // CHECK: FunctionParameterCount: 0 // CHECK: HasReturn: FALSE +// CHECK:ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: D3D12_MESH_SHADER_DESC: +// CHECK: PayloadSize: 36 +// CHECK: MaxVertexCount: 32 +// CHECK: MaxPrimitiveCount: 16 +// CHECK: OutputTopology: Triangle +// CHECK: NumThreads: 32, 1, 1 #define MAX_VERT 32 #define MAX_PRIM 16 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl index dc092c8d2c..4a174234cd 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl @@ -42,3 +42,304 @@ TEST_TYPE(node_min16float, min16float) // RDAT-LABEL: UnmangledName: "node_min16int" // RDAT: RecordAlignmentInBytes: 2 TEST_TYPE(node_min16int, min16int) + +//RDAT:ID3D12LibraryReflection1: +//RDAT: D3D12_LIBRARY_DESC: +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: FunctionCount: 5 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_float16 +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x40000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_float16 +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_float16 +//RDAT: ID: 0 +//RDAT: InputNodes: 1 +//RDAT: OutputNodes: 0 +//RDAT: Input Nodes: +//RDAT: D3D12_NODE_DESC: +//RDAT: Flags: 0x61 +//RDAT: Type: +//RDAT: Size: 6 +//RDAT: Alignment: 2 +//RDAT: DispatchGrid: +//RDAT: ByteOffset: 0 +//RDAT: ComponentType: +//RDAT: NumComponents: 0 +//RDAT: MaxRecords: 0 +//RDAT: MaxRecordsSharedWith: -1 +//RDAT: OutputArraySize: 0 +//RDAT: AllowSparseNodes: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_half +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x40000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_half +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_half +//RDAT: ID: 0 +//RDAT: InputNodes: 1 +//RDAT: OutputNodes: 0 +//RDAT: Input Nodes: +//RDAT: D3D12_NODE_DESC: +//RDAT: Flags: 0x61 +//RDAT: Type: +//RDAT: Size: 6 +//RDAT: Alignment: 2 +//RDAT: DispatchGrid: +//RDAT: ByteOffset: 0 +//RDAT: ComponentType: +//RDAT: NumComponents: 0 +//RDAT: MaxRecords: 0 +//RDAT: MaxRecordsSharedWith: -1 +//RDAT: OutputArraySize: 0 +//RDAT: AllowSparseNodes: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_int16 +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x40000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_int16 +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_int16 +//RDAT: ID: 0 +//RDAT: InputNodes: 1 +//RDAT: OutputNodes: 0 +//RDAT: Input Nodes: +//RDAT: D3D12_NODE_DESC: +//RDAT: Flags: 0x61 +//RDAT: Type: +//RDAT: Size: 6 +//RDAT: Alignment: 2 +//RDAT: DispatchGrid: +//RDAT: ByteOffset: 0 +//RDAT: ComponentType: +//RDAT: NumComponents: 0 +//RDAT: MaxRecords: 0 +//RDAT: MaxRecordsSharedWith: -1 +//RDAT: OutputArraySize: 0 +//RDAT: AllowSparseNodes: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_min16float +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x40000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_min16float +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_min16float +//RDAT: ID: 0 +//RDAT: InputNodes: 1 +//RDAT: OutputNodes: 0 +//RDAT: Input Nodes: +//RDAT: D3D12_NODE_DESC: +//RDAT: Flags: 0x61 +//RDAT: Type: +//RDAT: Size: 6 +//RDAT: Alignment: 2 +//RDAT: DispatchGrid: +//RDAT: ByteOffset: 0 +//RDAT: ComponentType: +//RDAT: NumComponents: 0 +//RDAT: MaxRecords: 0 +//RDAT: MaxRecordsSharedWith: -1 +//RDAT: OutputArraySize: 0 +//RDAT: AllowSparseNodes: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_min16int +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x40000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_min16int +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_min16int +//RDAT: ID: 0 +//RDAT: InputNodes: 1 +//RDAT: OutputNodes: 0 +//RDAT: Input Nodes: +//RDAT: D3D12_NODE_DESC: +//RDAT: Flags: 0x61 +//RDAT: Type: +//RDAT: Size: 6 +//RDAT: Alignment: 2 +//RDAT: DispatchGrid: +//RDAT: ByteOffset: 0 +//RDAT: ComponentType: +//RDAT: NumComponents: 0 +//RDAT: MaxRecords: 0 +//RDAT: MaxRecordsSharedWith: -1 +//RDAT: OutputArraySize: 0 +//RDAT: AllowSparseNodes: FALSE diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl index 612cb85321..bffcd7e384 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl @@ -94,3 +94,162 @@ void miss(inout MyPayload payload : SV_RayPayload) { void callable(inout MyPayload param) { BAB.Store(0, 0); } + +// RDAT: ID3D12LibraryReflection1: +// RDAT: D3D12_LIBRARY_DESC: +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: FunctionCount: 6 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?anyhit@@YAXUMyPayload@@UBuiltInTriangleIntersectionAttributes@@@Z +// RDAT: Shader Version: AnyHit 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: AttributeSize: 8 +// RDAT: ParamPayloadSize: 8 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?callable@@YAXUMyPayload@@@Z +// RDAT: Shader Version: Callable 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: AttributeSize: 0 +// RDAT: ParamPayloadSize: 8 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?closesthit@@YAXUMyPayload@@UBuiltInTriangleIntersectionAttributes@@@Z +// RDAT: Shader Version: ClosestHit 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: AttributeSize: 8 +// RDAT: ParamPayloadSize: 8 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?intersection@@YAXXZ +// RDAT: Shader Version: Intersection 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: AttributeSize: 0 +// RDAT: ParamPayloadSize: 0 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?miss@@YAXUMyPayload@@@Z +// RDAT: Shader Version: Miss 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: ParamPayloadSize: 8 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: \01?raygen@@YAXXZ +// RDAT: Shader Version: RayGeneration 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl index d39ea55a9a..f6faa5dfd3 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl @@ -67,3 +67,54 @@ groupshared Vertex pld; void amplification(uint3 DTid : SV_DispatchThreadID) { DispatchMesh(1, 1, 1, pld); } + +// RDAT: ID3D12LibraryReflection1: +// RDAT: D3D12_LIBRARY_DESC: +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: FunctionCount: 2 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: amplification +// RDAT: Shader Version: Amplification 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0x20000000000 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 0 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: PayloadSize: 16 +// RDAT: NumThreads: 8, 8, 1 +// RDAT: ID3D12FunctionReflection: +// RDAT: D3D12_FUNCTION_DESC: Name: mesh +// RDAT: Shader Version: Mesh 6.8 +// RDAT: Creator: +// RDAT: Flags: 0 +// RDAT: RequiredFeatureFlags: 0 +// RDAT: ConstantBuffers: 0 +// RDAT: BoundResources: 1 +// RDAT: FunctionParameterCount: 0 +// RDAT: HasReturn: FALSE +// RDAT: Bound Resources: +// RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +// RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +// RDAT: uID: 0 +// RDAT: BindCount: 1 +// RDAT: BindPoint: 1 +// RDAT: Space: 0 +// RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +// RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +// RDAT: NumSamples (or stride): 0 +// RDAT: uFlags: 0 +// RDAT: ID3D12FunctionReflection1: +// RDAT: D3D12_FUNCTION_DESC1: +// RDAT: RootSignatureSize: 0 +// RDAT: D3D12_MESH_SHADER_DESC: +// RDAT: PayloadSize: 0 +// RDAT: MaxVertexCount: 0 +// RDAT: MaxPrimitiveCount: 0 +// RDAT: OutputTopology: Triangle +// RDAT: NumThreads: 1, 1, 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm68_barriers.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm68_barriers.hlsl index 35c5e81c83..29d7750d52 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm68_barriers.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm68_barriers.hlsl @@ -132,3 +132,295 @@ void node_barrier_node_group_in_call() { fn_barrier_node_group1(); BAB.Store(0, 0); } + +//RDAT:ID3D12LibraryReflection1: +//RDAT: D3D12_LIBRARY_DESC: +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: FunctionCount: 10 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_device1@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_device2@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_group1@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x20000000000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_group2@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x20000000000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_node1@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: \01?fn_barrier_node_group1@@YAXXZ +//RDAT: Shader Version: Library 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x20000000000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: EarlyDepthStencil: FALSE +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_barrier +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x20000000000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_barrier +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_barrier +//RDAT: ID: 0 +//RDAT: InputNodes: 0 +//RDAT: OutputNodes: 0 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_barrier_device_in_call +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_barrier_device_in_call +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_barrier_device_in_call +//RDAT: ID: 0 +//RDAT: InputNodes: 0 +//RDAT: OutputNodes: 0 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_barrier_node_group_in_call +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0x20000000000 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_barrier_node_group_in_call +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_barrier_node_group_in_call +//RDAT: ID: 0 +//RDAT: InputNodes: 0 +//RDAT: OutputNodes: 0 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node_barrier_node_in_call +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 1 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: Bound Resources: +//RDAT: D3D12_SHADER_INPUT_BIND_DESC: Name: BAB +//RDAT: Type: D3D_SIT_UAV_RWBYTEADDRESS +//RDAT: uID: 0 +//RDAT: BindCount: 1 +//RDAT: BindPoint: 1 +//RDAT: Space: 0 +//RDAT: ReturnType: D3D_RETURN_TYPE_MIXED +//RDAT: Dimension: D3D_SRV_DIMENSION_BUFFER +//RDAT: NumSamples (or stride): 0 +//RDAT: uFlags: 0 +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT: NumThreads: 1, 1, 1 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node_barrier_node_in_call +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node_barrier_node_in_call +//RDAT: ID: 0 +//RDAT: InputNodes: 0 +//RDAT: OutputNodes: 0 \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl index 7b265f909c..33edf8034c 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl @@ -1,6 +1,6 @@ // RUN: %dxc -T lib_6_8 -DNODE %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT1 // RUN: %dxc -T lib_6_8 -DNODE -DRANGE=,64 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT2 -// RUN: %dxc -T lib_6_8 -DNODE -DRANGE=,64,32 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT2 +// RUN: %dxc -T lib_6_8 -DNODE -DRANGE=,64,32 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT3 // RDAT has no min/max wave count until SM 6.8 @@ -9,12 +9,14 @@ // RDAT: MinimumExpectedWaveLaneCount: 16 // RDAT1: MaximumExpectedWaveLaneCount: 16 // RDAT2: MaximumExpectedWaveLaneCount: 64 +// RDAT3: MaximumExpectedWaveLaneCount: 64 // RDAT-LABEL: <1:RuntimeDataFunctionInfo{{.}}> = { // RDAT: Name: "node" // RDAT: MinimumExpectedWaveLaneCount: 16 // RDAT1: MaximumExpectedWaveLaneCount: 16 // RDAT2: MaximumExpectedWaveLaneCount: 64 +// RDAT3: MaximumExpectedWaveLaneCount: 64 #ifndef RANGE #define RANGE @@ -33,4 +35,65 @@ void main() { [NodeDispatchGrid(1,1,1)] [WaveSize(16 RANGE)] void node() { } -#endif \ No newline at end of file +#endif + +//RDAT:ID3D12LibraryReflection1: +//RDAT: D3D12_LIBRARY_DESC: +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: FunctionCount: 2 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: main +//RDAT: Shader Version: Compute 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT1: WaveSize: min: 16, max: 0, preferred: 0 +//RDAT2: WaveSize: min: 16, max: 64, preferred: 0 +//RDAT2: WaveSize: min: 16, max: 64, preferred: 32 +//RDAT: NumThreads: 1, 1, 8 +//RDAT: ID3D12FunctionReflection: +//RDAT: D3D12_FUNCTION_DESC: Name: node +//RDAT: Shader Version: Node 6.8 +//RDAT: Creator: +//RDAT: Flags: 0 +//RDAT: RequiredFeatureFlags: 0 +//RDAT: ConstantBuffers: 0 +//RDAT: BoundResources: 0 +//RDAT: FunctionParameterCount: 0 +//RDAT: HasReturn: FALSE +//RDAT: ID3D12FunctionReflection1: +//RDAT: D3D12_FUNCTION_DESC1: +//RDAT: RootSignatureSize: 0 +//RDAT: D3D12_NODE_SHADER_DESC: +//RDAT: D3D12_COMPUTE_SHADER_DESC: +//RDAT1: WaveSize: min: 16, max: 0, preferred: 0 +//RDAT2: WaveSize: min: 16, max: 64, preferred: 0 +//RDAT2: WaveSize: min: 16, max: 64, preferred: 32 +//RDAT: NumThreads: 1, 1, 8 +//RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH +//RDAT: IsProgramEntry: FALSE +//RDAT: LocalRootArgumentsTableIndex: -1 +//RDAT: DispatchGrid[0]: 1 +//RDAT: DispatchGrid[1]: 1 +//RDAT: DispatchGrid[2]: 1 +//RDAT: MaxDispatchGrid[0]: 0 +//RDAT: MaxDispatchGrid[1]: 0 +//RDAT: MaxDispatchGrid[2]: 0 +//RDAT: MaxRecursionDepth: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderId) +//RDAT: Name: node +//RDAT: ID: 0 +//RDAT: D3D12_NODE_ID_DESC: (ShaderSharedInput) +//RDAT: Name: node +//RDAT: ID: 0 +//RDAT: InputNodes: 0 +//RDAT: OutputNodes: 0 \ No newline at end of file From 74e793da54408e76c2fe3f4f1fa0ee1d3673abe1 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 23:10:26 +0200 Subject: [PATCH 54/62] Apparently even though DXA runs fine, the file checker uses something else. Changed it to use ShaderReflection1 and LibraryReflection1 --- tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp b/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp index 2c75d45e5e..c24accde53 100644 --- a/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp +++ b/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp @@ -790,8 +790,8 @@ FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, CComPtr pSource; CComPtr pAssembler; CComPtr pResult; - CComPtr pShaderReflection; - CComPtr pLibraryReflection; + CComPtr pShaderReflection; + CComPtr pLibraryReflection; CComPtr containerReflection; uint32_t partCount; CComPtr pContainerBlob; From 98774b8f66275f0d59996d4efa820a0c6e8bbc2e Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 22 Aug 2024 00:00:20 +0200 Subject: [PATCH 55/62] Fixed a few tests; replaced LibraryReflection with LibraryReflection1 in checks, same for ShaderReflection1. Also fixed the RDAT3 in wavesize-compute-node-rdat.hlsl --- tools/clang/test/DXC/dxa_tests.test | 2 +- .../test/HLSLFileCheck/d3dreflect/ConstantBuffer-16bit.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/TextureBuffer-16bit.hlsl | 2 +- .../clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/anon_struct.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/cb_array.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/cbuf-usage-phi.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-16bit.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/cbuffer-struct-16bit.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/cbuffer_default_val.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/clip-dist-refl.hlsl | 2 +- .../clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl | 2 +- .../HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/empty_struct2.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/lib_cb_matrix_array.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports1.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports2.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports3.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports4.hlsl | 2 +- .../HLSLFileCheck/d3dreflect/lib_exports_nocollision.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export2.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/lib_requires_flags.hlsl | 2 +- .../clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/raytracing_traceray.hlsl | 2 +- .../d3dreflect/raytracing_traceray_readback.hlsl | 2 +- .../d3dreflect/rdat_mintarget/sm66_derivatives.hlsl | 2 +- .../d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6.ll | 2 +- .../sm66_derivatives_lib_6_6_decl_intrin_first.ll | 2 +- .../d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7.ll | 2 +- .../sm66_derivatives_lib_6_7_decl_intrin_first.ll | 2 +- .../d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8.ll | 2 +- .../sm66_derivatives_lib_6_8_decl_intrin_first.ll | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/reflect-lib-1.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/sig-array.hlsl | 2 +- .../d3dreflect/structured_buffer_getdim_stride.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-16bit.hlsl | 2 +- .../test/HLSLFileCheck/d3dreflect/tbuffer-struct-16bit.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer.hlsl | 2 +- tools/clang/test/HLSLFileCheck/d3dreflect/texture2dms.hlsl | 2 +- .../hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl | 4 ++-- .../hlsl/objects/FeedbackTexture/feedback-reflect.hlsl | 2 +- 43 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/clang/test/DXC/dxa_tests.test b/tools/clang/test/DXC/dxa_tests.test index 655155941b..345a6af2c2 100644 --- a/tools/clang/test/DXC/dxa_tests.test +++ b/tools/clang/test/DXC/dxa_tests.test @@ -36,7 +36,7 @@ // REBUILD:define void @main() // RUN: %dxa %t.dxa.cso -dumpreflection | FileCheck %s --check-prefix=REFLECTION -// REFLECTION: ID3D12ShaderReflection: +// REFLECTION: ID3D12ShaderReflection1: // REFLECTION-NEXT: D3D12_SHADER_DESC: // REFLECTION-NEXT: Shader Version: Vertex 6.0 // REFLECTION-NEXT: Creator: dxc diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/ConstantBuffer-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/ConstantBuffer-16bit.hlsl index b990febaf8..b79e6287ed 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/ConstantBuffer-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/ConstantBuffer-16bit.hlsl @@ -39,7 +39,7 @@ float main(int i : A) : SV_TARGET return CBS.b + CBS.mf1 + CBS.h2.y + CBS.f16_3.z + (float)(CBS.d * CBS.i64 + CBS.u64) + CBS.u16 * CBS.i16.x; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/TextureBuffer-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/TextureBuffer-16bit.hlsl index 95fa345a2c..7fb6739eea 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/TextureBuffer-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/TextureBuffer-16bit.hlsl @@ -39,7 +39,7 @@ float main(int i : A) : SV_TARGET return TBS.b + TBS.mf1 + TBS.h2.y + TBS.f16_3.z + (float)(TBS.d * TBS.i64 + TBS.u64) + TBS.u16 * TBS.i16.x; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl index 096bbd3dd8..11596e41d6 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl @@ -58,7 +58,7 @@ // CHECK: PayloadSizeInBytes: 16 // CHECK: } // CHECK: } -// CHECK:ID3D12LibraryReflection: +// CHECK:ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Flags: 0 // CHECK: FunctionCount: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/anon_struct.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/anon_struct.hlsl index e6ffa5aade..c597d2a63c 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/anon_struct.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/anon_struct.hlsl @@ -9,7 +9,7 @@ float main(int N : A, int C : B) : SV_TARGET { return CB.X; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: D3D12_SHADER_DESC: // CHECK: Shader Version: Pixel // CHECK: ConstantBuffers: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/cb_array.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/cb_array.hlsl index b55b2196f1..84c2d54444 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/cb_array.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/cb_array.hlsl @@ -7,7 +7,7 @@ float main(int i : A) : SV_TARGET return A[i] + A[i+1] + A[i+2] ; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: D3D12_SHADER_DESC: // CHECK: Shader Version: Pixel // CHECK: ConstantBuffers: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuf-usage-phi.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuf-usage-phi.hlsl index 52863954a7..ac7de483c3 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuf-usage-phi.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuf-usage-phi.hlsl @@ -28,7 +28,7 @@ float4 main() : SV_Target { } // {{$}} is used to prevent match to 0x -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: Flags: 0{{$}} // CHECK: ConstantBuffers: 2 // CHECK: BoundResources: 2 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-16bit.hlsl index 7c148970a9..c7d8d59250 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-16bit.hlsl @@ -37,7 +37,7 @@ float main(int i : A) : SV_TARGET return b + mf1 + h2.y + f16_3.z + (float)(d * i64 + u64) + u16 * i16.x; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-struct-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-struct-16bit.hlsl index ffd698e4b0..5966acba5d 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-struct-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer-struct-16bit.hlsl @@ -42,7 +42,7 @@ float main(int i : A) : SV_TARGET return CBS.b + CBS.mf1 + CBS.h2.y + CBS.f16_3.z + (float)(CBS.d * CBS.i64 + CBS.u64) + CBS.u16 * CBS.i16.x; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer_default_val.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer_default_val.hlsl index d32427bd80..44311dba68 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer_default_val.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/cbuffer_default_val.hlsl @@ -9,7 +9,7 @@ float main() : SV_TARGET } // Default value unsupported for now: -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: D3D12_SHADER_DESC: // CHECK: Shader Version: Pixel // CHECK: ConstantBuffers: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/clip-dist-refl.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/clip-dist-refl.hlsl index 9b4b375b91..cf3fc37814 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/clip-dist-refl.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/clip-dist-refl.hlsl @@ -1,6 +1,6 @@ // RUN: %dxc -E MainVp -T vs_6_0 %s | %D3DReflect %s | FileCheck %s -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: OutputParameters: 2 void MainVp (out float4 rw_sv_clipdistance : SV_ClipDistance, diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl index 6bc81d61be..69171bd3af 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl @@ -75,7 +75,7 @@ // CHECK: GroupSharedBytesUsed: 16 // CHECK: } // CHECK: } -// CHECK:ID3D12LibraryReflection: +// CHECK:ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Creator: // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl index 7f1522cb22..fbcc5a108f 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl @@ -289,7 +289,7 @@ // CHECK: } // CHECK: } // CHECK: } -// CHECK:ID3D12LibraryReflection: +// CHECK:ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Creator: // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_struct2.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_struct2.hlsl index 4de6434f9d..f8b25623bc 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_struct2.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_struct2.hlsl @@ -26,7 +26,7 @@ cbuffer Params_cbuffer2 : register(b1) { float4 main(float4 pos : POSITION) : SV_POSITION { return foo + bar; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: D3D12_SHADER_DESC: // CHECK: Shader Version: Vertex // CHECK: ConstantBuffers: 2 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl index 2a9feb3aa9..4d7148169d 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl @@ -321,7 +321,7 @@ // CHECK: } // CHECK: } // CHECK: } -// CHECK:ID3D12LibraryReflection: +// CHECK:ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // FIXME: Creator: // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_cb_matrix_array.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_cb_matrix_array.hlsl index 664e3ee8c6..9568eebfd5 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_cb_matrix_array.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_cb_matrix_array.hlsl @@ -22,7 +22,7 @@ void RayGenShader() g_Output[LaunchIndex] = Color * m0[0][0] * m1[0][0] * VectorArray[1] * FloatArray[2]; } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: FunctionCount: 1 // CHECK-NEXT: ID3D12FunctionReflection: // CHECK-NEXT: D3D12_FUNCTION_DESC: Name: \01?RayGenShader{{[@$?.A-Za-z0-9_]+}} diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports1.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports1.hlsl index 920649748e..d41080e73a 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports1.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports1.hlsl @@ -149,7 +149,7 @@ float4 PSMain(int idx : INDEX) : SV_Target { // CHECK: } // CHECK: } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 3 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports2.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports2.hlsl index 81d8f35777..5c24aa4176 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports2.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports2.hlsl @@ -161,7 +161,7 @@ void RayGen() { // CHECK: } // CHECK: } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 4 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports3.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports3.hlsl index 4004e5ffd1..975494b0f6 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports3.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports3.hlsl @@ -202,7 +202,7 @@ float4 PSMain(int idx : INDEX) : SV_Target { // CHECK: } // CHECK: } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 6 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports4.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports4.hlsl index 05922ebf08..02a1d9c1bf 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports4.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports4.hlsl @@ -18,7 +18,7 @@ float4 PSMain(int idx : INDEX) : SV_Target { } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 4 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports_nocollision.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports_nocollision.hlsl index c3db7f12e1..f22aee81c0 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports_nocollision.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_exports_nocollision.hlsl @@ -32,7 +32,7 @@ void RayGen() { // No Collision here between differently mangled functions, or to non-exported functions. -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 4 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl index c4c2f9b034..7776bac5b3 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl @@ -7,7 +7,7 @@ // Make sure CB usage is correct. #if 0 -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK-NEXT: D3D12_LIBRARY_DESC: // CHECK: Flags: 0 // CHECK-NEXT: FunctionCount: 2 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export2.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export2.hlsl index 02cb75ec2b..a63ab33022 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export2.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_hs_export2.hlsl @@ -273,7 +273,7 @@ HSPerPatchData HSPerPatchFunc1() // CHECK: } // CHECK: } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 5 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_requires_flags.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_requires_flags.hlsl index 55bc780f65..d726b43d49 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_requires_flags.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_requires_flags.hlsl @@ -16,7 +16,7 @@ float4 PSMain(float4 In : IN, out float Depth : SV_Depth) : SV_Target { return In; } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: FunctionCount: 3 // CHECK-LABEL: D3D12_FUNCTION_DESC: Name: \01?DoubleMAD{{[@$?.A-Za-z0-9_]+}} // CHECK: RequiredFeatureFlags: 0x1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl index 011b8f4539..328e233914 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/mesh-groupshared.hlsl @@ -146,7 +146,7 @@ // CHECK: MeshOutputTopology: 2 // CHECK: } // CHECK: } -// CHECK:ID3D12LibraryReflection: +// CHECK:ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Creator: // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray.hlsl index dd63e0b426..1bac11c2f4 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray.hlsl @@ -24,7 +24,7 @@ float4 emit(inout float2 f2, RayDesc Ray:R, inout Payload p ) { -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Flags: 0 // CHECK: FunctionCount: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray_readback.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray_readback.hlsl index 47e1e3400f..d4ff7d3bf0 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray_readback.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/raytracing_traceray_readback.hlsl @@ -32,7 +32,7 @@ void RayGenTestMain() } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: Flags: 0 // CHECK: FunctionCount: 1 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives.hlsl index 253989af8f..d5a3361285 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives.hlsl @@ -125,7 +125,7 @@ void deriv_in_pixel(float2 uv : TEXCOORD) { // Make sure function-level derivative flag isn't in RequiredFeatureFlags, // and make sure mesh shader sets required flag. -// RDAT-LABEL: ID3D12LibraryReflection: +// RDAT-LABEL: ID3D12LibraryReflection1: // RDAT-LABEL: D3D12_FUNCTION_DESC: Name: // RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6.ll index bc29a4d81b..6874e36a2e 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6.ll @@ -185,7 +185,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6_decl_intrin_first.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6_decl_intrin_first.ll index dfea24ddef..b683b22cc4 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6_decl_intrin_first.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_6_decl_intrin_first.ll @@ -189,7 +189,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7.ll index 8905307336..0c42db4459 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7.ll @@ -185,7 +185,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7_decl_intrin_first.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7_decl_intrin_first.ll index 2395bffec3..7e350140e6 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7_decl_intrin_first.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_7_decl_intrin_first.ll @@ -189,7 +189,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8.ll index 9b38694ac3..0e0baed68f 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8.ll @@ -185,7 +185,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8_decl_intrin_first.ll b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8_decl_intrin_first.ll index 01ab7229e3..c9d389adbc 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8_decl_intrin_first.ll +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_derivatives_lib_6_8_decl_intrin_first.ll @@ -189,7 +189,7 @@ attributes #3 = { nounwind readonly } ; Make sure function-level derivative flag isn't in RequiredFeatureFlags, ; and make sure mesh shader sets required flag. -; RDAT-LABEL: ID3D12LibraryReflection: +; RDAT-LABEL: ID3D12LibraryReflection1: ; RDAT-LABEL: D3D12_FUNCTION_DESC: Name: ; RDAT-SAME: deriv_in_func diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/reflect-lib-1.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/reflect-lib-1.hlsl index f09ad71082..bcc90422d3 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/reflect-lib-1.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/reflect-lib-1.hlsl @@ -15,7 +15,7 @@ float function1(float x, min12int i) { float4 function2(float4 x : POSITION) : SV_Position { return x + cbval1 + cbval3.x; } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 3 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/sig-array.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/sig-array.hlsl index f457de8985..28283c4cc9 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/sig-array.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/sig-array.hlsl @@ -1,6 +1,6 @@ // RUN: %dxc -E VSMain -T vs_6_0 %s | %D3DReflect %s | FileCheck %s -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: D3D12_SHADER_DESC: // CHECK: Shader Version: Vertex 6.0 // CHECK: ConstantBuffers: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/structured_buffer_getdim_stride.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/structured_buffer_getdim_stride.hlsl index 205b00a5ef..7a8ebf89d0 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/structured_buffer_getdim_stride.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/structured_buffer_getdim_stride.hlsl @@ -12,7 +12,7 @@ uint UseBuf(int2 idx) { return g_buffer[idx.x][idx.y].b; } -// CHECK: ID3D12LibraryReflection: +// CHECK: ID3D12LibraryReflection1: // CHECK: D3D12_LIBRARY_DESC: // CHECK: FunctionCount: 1 // CHECK: ID3D12FunctionReflection: diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-16bit.hlsl index f1a46d2d61..0abaee4a05 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-16bit.hlsl @@ -50,7 +50,7 @@ float main(int i : A) : SV_TARGET return b + mf1 + h2.y + f16_3.z + (float)(d * i64 + u64) + u16 * i16.x + f16c + fused; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-struct-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-struct-16bit.hlsl index f0180490ea..f46925012d 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-struct-16bit.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer-struct-16bit.hlsl @@ -42,7 +42,7 @@ float main(int i : A) : SV_TARGET return TBS.b + TBS.mf1 + TBS.h2.y + TBS.f16_3.z + (float)(TBS.d * TBS.i64 + TBS.u64) + TBS.u16 * TBS.i16.x; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer.hlsl index 8854387251..be7f77d211 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/tbuffer.hlsl @@ -47,7 +47,7 @@ float main(int i : A) : SV_TARGET return b + mi.y + a + mf * mu; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel // CHECK: Flags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/texture2dms.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/texture2dms.hlsl index 016bdb23b2..4358e341cb 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/texture2dms.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/texture2dms.hlsl @@ -22,7 +22,7 @@ float4 main(uint4 color : COLOR) : SV_TARGET ; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK: Bound Resources: // CHECK: D3D12_SHADER_INPUT_BIND_DESC: Name: msTexture // CHECK-NEXT: Type: D3D_SIT_TEXTURE diff --git a/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl index 33edf8034c..3f740ffb7c 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/entry/attributes/wavesize-compute-node-rdat.hlsl @@ -58,7 +58,7 @@ void node() { } //RDAT: D3D12_COMPUTE_SHADER_DESC: //RDAT1: WaveSize: min: 16, max: 0, preferred: 0 //RDAT2: WaveSize: min: 16, max: 64, preferred: 0 -//RDAT2: WaveSize: min: 16, max: 64, preferred: 32 +//RDAT3: WaveSize: min: 16, max: 64, preferred: 32 //RDAT: NumThreads: 1, 1, 8 //RDAT: ID3D12FunctionReflection: //RDAT: D3D12_FUNCTION_DESC: Name: node @@ -77,7 +77,7 @@ void node() { } //RDAT: D3D12_COMPUTE_SHADER_DESC: //RDAT1: WaveSize: min: 16, max: 0, preferred: 0 //RDAT2: WaveSize: min: 16, max: 64, preferred: 0 -//RDAT2: WaveSize: min: 16, max: 64, preferred: 32 +//RDAT3: WaveSize: min: 16, max: 64, preferred: 32 //RDAT: NumThreads: 1, 1, 8 //RDAT: LaunchType: D3D12_NODE_LAUNCH_TYPE_BROADCASTING_LAUNCH //RDAT: IsProgramEntry: FALSE diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/FeedbackTexture/feedback-reflect.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/FeedbackTexture/feedback-reflect.hlsl index 27334a3dfb..e41ce6d33e 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/FeedbackTexture/feedback-reflect.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/objects/FeedbackTexture/feedback-reflect.hlsl @@ -30,7 +30,7 @@ float main() : SV_Target return 0; } -// CHECK: ID3D12ShaderReflection: +// CHECK: ID3D12ShaderReflection1: // CHECK-NEXT: D3D12_SHADER_DESC: // CHECK-NEXT: Shader Version: Pixel 6.5 // CHECK: Flags: 0 From 4d33ef8cb4d2cfc951deb48cc3e0d2d343967eba Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 22 Aug 2024 20:13:51 +0200 Subject: [PATCH 56/62] Fixed unit tests hopefully --- include/dxc/Test/D3DReflectionDumper.h | 2 +- lib/DxilContainer/D3DReflectionDumper.cpp | 29 ++++++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/include/dxc/Test/D3DReflectionDumper.h b/include/dxc/Test/D3DReflectionDumper.h index bc125682a5..5db3eab92e 100644 --- a/include/dxc/Test/D3DReflectionDumper.h +++ b/include/dxc/Test/D3DReflectionDumper.h @@ -57,7 +57,7 @@ class D3DReflectionDumper : public DumpContext { void Dump(ID3D12ShaderReflectionConstantBuffer *pCBReflection); - void Dump(ID3D12ShaderReflection *pShaderReflection); + void Dump(ID3D12ShaderReflection *pShaderReflection, BOOL printHeader = false); void Dump(ID3D12ShaderReflection1 *pShaderReflection); void Dump(ID3D12FunctionReflection *pFunctionReflection); void Dump(ID3D12FunctionReflection1 *pFunctionReflection); diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 1cfb8fd153..738a1c1b20 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -462,13 +462,19 @@ void D3DReflectionDumper::Dump( Dedent(); } -void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection) { - WriteLn("ID3D12ShaderReflection:"); - Indent(); +void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection, BOOL printHeader) { + + if(printHeader) { + WriteLn("ID3D12ShaderReflection:"); + Indent(); + } + D3D12_SHADER_DESC Desc; if (!pShaderReflection || FAILED(pShaderReflection->GetDesc(&Desc))) { Failure("GetDesc"); - Dedent(); + if(printHeader) { + Dedent(); + } return; } Dump(Desc); @@ -565,7 +571,9 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection) { Dedent(); } // TODO - Dedent(); + if(printHeader) { + Dedent(); + } } void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { @@ -574,18 +582,21 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { Failure("QueryInterface ID3D12ShaderReflection"); return; } + + WriteLn("ID3D12LibraryReflection1:"); + Indent(); - Dump(shaderRefl0); + Dump(shaderRefl0, false); shaderRefl0->Release(); UINT waveSizePreferred = 0, waveSizeMin = 0, waveSizeMax = 0; if (!pShaderReflection->GetWaveSize(&waveSizePreferred, &waveSizeMin, - &waveSizeMax)) + &waveSizeMax)) { + Dedent(); return; + } - WriteLn("ID3D12ShaderReflection1:"); - Indent(); WriteLn("WaveSizePreferred: ", waveSizePreferred); WriteLn("WaveSizeMin: ", waveSizeMin); WriteLn("WaveSizeMax: ", waveSizeMax); From 828e48e21e7bacf196e05fc10399353ce9325cd2 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 22 Aug 2024 20:52:29 +0200 Subject: [PATCH 57/62] Redid formatting and fixed a mistake --- include/dxc/Test/D3DReflectionDumper.h | 3 ++- lib/DxilContainer/D3DReflectionDumper.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/dxc/Test/D3DReflectionDumper.h b/include/dxc/Test/D3DReflectionDumper.h index 5db3eab92e..5f86e18424 100644 --- a/include/dxc/Test/D3DReflectionDumper.h +++ b/include/dxc/Test/D3DReflectionDumper.h @@ -57,7 +57,8 @@ class D3DReflectionDumper : public DumpContext { void Dump(ID3D12ShaderReflectionConstantBuffer *pCBReflection); - void Dump(ID3D12ShaderReflection *pShaderReflection, BOOL printHeader = false); + void Dump(ID3D12ShaderReflection *pShaderReflection, + BOOL printHeader = false); void Dump(ID3D12ShaderReflection1 *pShaderReflection); void Dump(ID3D12FunctionReflection *pFunctionReflection); void Dump(ID3D12FunctionReflection1 *pFunctionReflection); diff --git a/lib/DxilContainer/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp index 738a1c1b20..b73b965407 100644 --- a/lib/DxilContainer/D3DReflectionDumper.cpp +++ b/lib/DxilContainer/D3DReflectionDumper.cpp @@ -462,9 +462,10 @@ void D3DReflectionDumper::Dump( Dedent(); } -void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection, BOOL printHeader) { +void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection, + BOOL printHeader) { - if(printHeader) { + if (printHeader) { WriteLn("ID3D12ShaderReflection:"); Indent(); } @@ -472,7 +473,7 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection, BOOL p D3D12_SHADER_DESC Desc; if (!pShaderReflection || FAILED(pShaderReflection->GetDesc(&Desc))) { Failure("GetDesc"); - if(printHeader) { + if (printHeader) { Dedent(); } return; @@ -571,7 +572,7 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection *pShaderReflection, BOOL p Dedent(); } // TODO - if(printHeader) { + if (printHeader) { Dedent(); } } @@ -582,8 +583,8 @@ void D3DReflectionDumper::Dump(ID3D12ShaderReflection1 *pShaderReflection) { Failure("QueryInterface ID3D12ShaderReflection"); return; } - - WriteLn("ID3D12LibraryReflection1:"); + + WriteLn("ID3D12ShaderReflection1:"); Indent(); Dump(shaderRefl0, false); From 4c81c8cc67f96d6399f8a9c7bf03e598dfe75c98 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 22 Aug 2024 21:28:21 +0200 Subject: [PATCH 58/62] Fixed the last remaining unit tests --- .../d3dreflect/amp-groupshared.hlsl | 10 +++++----- .../HLSLFileCheck/d3dreflect/lib_global.hlsl | 8 ++++++++ .../d3dreflect/rdat_mintarget/sm63_dxr.hlsl | 18 ++++++++++++------ .../d3dreflect/rdat_mintarget/sm65_ms_as.hlsl | 6 ++++-- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl index 11596e41d6..d9e1737a60 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/amp-groupshared.hlsl @@ -81,11 +81,11 @@ // CHECK: Dimension: D3D_SRV_DIMENSION_BUFFER // CHECK: NumSamples (or stride): 4294967295 // CHECK: uFlags: (D3D_SIF_TEXTURE_COMPONENT_0 | D3D_SIF_TEXTURE_COMPONENT_1) -// CHECK:ID3D12LibraryReflection1: -// CHECK: D3D12_LIBRARY_DESC1: -// CHECK: RootSignatureSize: 0 -// CHECK: PayloadSize: 16 -// CHECK: NumThreads: 4, 1, 1 +// CHECK: ID3D12FunctionReflection1: +// CHECK: D3D12_FUNCTION_DESC1: +// CHECK: RootSignatureSize: 0 +// CHECK: PayloadSize: 16 +// CHECK: NumThreads: 4, 1, 1 struct MeshPayload { diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl index 7776bac5b3..82aec98ba2 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/lib_global.hlsl @@ -180,6 +180,10 @@ // CHECK-NEXT: Dimension: D3D_SRV_DIMENSION_BUFFER // CHECK-NEXT: NumSamples (or stride): 72 // CHECK-NEXT: uFlags: 0 +// CHECK-NEXT: ID3D12FunctionReflection1: +// CHECK-NEXT: D3D12_FUNCTION_DESC1: +// CHECK-NEXT: RootSignatureSize: 0 +// CHECK-NEXT: EarlyDepthStencil: FALSE // CHECK-NEXT: ID3D12FunctionReflection: // CHECK-NEXT: D3D12_FUNCTION_DESC: Name: test // CHECK-NEXT: Shader Version: Pixel @@ -369,6 +373,10 @@ // CHECK-NEXT: Dimension: D3D_SRV_DIMENSION_BUFFER // CHECK-NEXT: NumSamples (or stride): 72 // CHECK-NEXT: uFlags: 0 +// CHECK-NEXT: ID3D12FunctionReflection1: +// CHECK-NEXT: D3D12_FUNCTION_DESC1: +// CHECK-NEXT: RootSignatureSize: 0 +// CHECK-NEXT: EarlyDepthStencil: FALSE #endif Texture2D g_txDiffuse; diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl index bffcd7e384..a9fc044827 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl @@ -102,7 +102,8 @@ void callable(inout MyPayload param) { // RDAT: FunctionCount: 6 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?anyhit@@YAXUMyPayload@@UBuiltInTriangleIntersectionAttributes@@@Z -// RDAT: Shader Version: AnyHit 6.8 +// RDAT18: Shader Version: AnyHit 6.8 +// RDAT17: Shader Version: AnyHit 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 @@ -128,7 +129,8 @@ void callable(inout MyPayload param) { // RDAT: ParamPayloadSize: 8 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?callable@@YAXUMyPayload@@@Z -// RDAT: Shader Version: Callable 6.8 +// RDAT18: Shader Version: Callable 6.8 +// RDAT17: Shader Version: Callable 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 @@ -154,7 +156,8 @@ void callable(inout MyPayload param) { // RDAT: ParamPayloadSize: 8 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?closesthit@@YAXUMyPayload@@UBuiltInTriangleIntersectionAttributes@@@Z -// RDAT: Shader Version: ClosestHit 6.8 +// RDAT18: Shader Version: ClosestHit 6.8 +// RDAT17: Shader Version: ClosestHit 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 @@ -180,7 +183,8 @@ void callable(inout MyPayload param) { // RDAT: ParamPayloadSize: 8 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?intersection@@YAXXZ -// RDAT: Shader Version: Intersection 6.8 +// RDAT18: Shader Version: Intersection 6.8 +// RDAT17: Shader Version: Intersection 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 @@ -206,7 +210,8 @@ void callable(inout MyPayload param) { // RDAT: ParamPayloadSize: 0 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?miss@@YAXUMyPayload@@@Z -// RDAT: Shader Version: Miss 6.8 +// RDAT18: Shader Version: Miss 6.8 +// RDAT17: Shader Version: Miss 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 @@ -231,7 +236,8 @@ void callable(inout MyPayload param) { // RDAT: ParamPayloadSize: 8 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: \01?raygen@@YAXXZ -// RDAT: Shader Version: RayGeneration 6.8 +// RDAT18: Shader Version: RayGeneration 6.8 +// RDAT17: Shader Version: RayGeneration 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl index f6faa5dfd3..8ffcade6cc 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl @@ -75,7 +75,8 @@ void amplification(uint3 DTid : SV_DispatchThreadID) { // RDAT: FunctionCount: 2 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: amplification -// RDAT: Shader Version: Amplification 6.8 +// RDAT18: Shader Version: Amplification 6.8 +// RDAT17: Shader Version: Amplification 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0x20000000000 @@ -90,7 +91,8 @@ void amplification(uint3 DTid : SV_DispatchThreadID) { // RDAT: NumThreads: 8, 8, 1 // RDAT: ID3D12FunctionReflection: // RDAT: D3D12_FUNCTION_DESC: Name: mesh -// RDAT: Shader Version: Mesh 6.8 +// RDAT18: Shader Version: Mesh 6.8 +// RDAT17: Shader Version: Mesh 6.7 // RDAT: Creator: // RDAT: Flags: 0 // RDAT: RequiredFeatureFlags: 0 From 7ed694465c5fe374e50fd7292f16779b3e43ffb6 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 22 Aug 2024 22:21:28 +0200 Subject: [PATCH 59/62] Apparently the featureflag with SM6.8 isn't set for SM6.7 when sm65_ms_as.hlsl is compiled as lib_6_8 --- .../HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl index 8ffcade6cc..a913c43381 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl @@ -79,7 +79,8 @@ void amplification(uint3 DTid : SV_DispatchThreadID) { // RDAT17: Shader Version: Amplification 6.7 // RDAT: Creator: // RDAT: Flags: 0 -// RDAT: RequiredFeatureFlags: 0x20000000000 +// RDAT18: RequiredFeatureFlags: 0x20000000000 +// RDAT17: RequiredFeatureFlags: 0 // RDAT: ConstantBuffers: 0 // RDAT: BoundResources: 0 // RDAT: FunctionParameterCount: 0 From e24d9888d62efe13028436da81b15100a32b9c4b Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sun, 15 Dec 2024 23:39:00 +0100 Subject: [PATCH 60/62] Implemented GetRequiresFlags --- external/DirectX-Headers | 2 +- lib/HLSL/DxilContainerReflection.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index dc27951f84..6eac2d2a19 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit dc27951f840703d8edfe6e2907bfff6410fe68eb +Subproject commit 6eac2d2a197668fa4a8b236ab837b1f8f1b19417 diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index 69b6ae3174..d0573d829d 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -766,6 +766,8 @@ class CInvalidFunction final : public ID3D12FunctionReflection1 { // Use D3D_RETURN_PARAMETER_INDEX to get description of the return value. STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter) (INT ParameterIndex) { return &g_InvalidFunctionParameter; } + + STDMETHOD_(UINT64, GetRequiresFlags)() { return 0; } }; CInvalidFunction g_InvalidFunction; @@ -2874,6 +2876,8 @@ class CFunctionReflection final : public ID3D12FunctionReflection1 { // Use D3D_RETURN_PARAMETER_INDEX to get description of the return value. STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter) (INT ParameterIndex) { return &g_InvalidFunctionParameter; } + + STDMETHOD_(UINT64, GetRequiresFlags)() { return m_FeatureFlags; } }; HRESULT CFunctionReflection::GetDesc(D3D12_FUNCTION_DESC *pDesc) { From 7a8742c743e2080a895162d135e52d2e35e870c8 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Thu, 3 Jul 2025 00:18:26 +0200 Subject: [PATCH 61/62] Fix invalid value in ms_SemanticInterpretationTable; it disallows SV_PrimitiveID from Vertex->Geometry shaders (GSVIn) even though according to the spec it should be allowed. This breaks existing shaders but only if they're compiled as lib file (compiling it with gs_ is fine). This is because the value in this table is NA, which results in the semantic becoming invalid and down the road that results in this error: "Semantic 'SV_PrimitiveID' is invalid as gs Input." --- docs/DXIL.rst | 2 +- include/dxc/DXIL/DxilSigPoint.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 6cca862d64..c9b0722c5f 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -699,7 +699,7 @@ ClipDistance Arb ClipCull NA NA ClipCull CullDistance Arb ClipCull NA NA ClipCull ClipCull Arb Arb ClipCull ClipCull ClipCull NA ClipCull ClipCull NA NA NA ClipCull NA NA OutputControlPointID NA NA NA NotInSig NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA DomainLocation NA NA NA NA NA NA NA NotInSig NA NA NA NA NA NA NA NA NA NA NA NA -PrimitiveID NA NA NotInSig NotInSig NA NA NA NotInSig NA NA NA Shadow SGV SGV NA NA NA NA SV NA +PrimitiveID NA NA NotInSig NotInSig NA NA NA NotInSig NA NA SGV Shadow SGV SGV NA NA NA NA SV NA GSInstanceID NA NA NA NA NA NA NA NA NA NA NA NotInSig NA NA NA NA NA NA NA NA SampleIndex NA NA NA NA NA NA NA NA NA NA NA NA NA Shadow _41 NA NA NA NA NA NA IsFrontFace NA NA NA NA NA NA NA NA NA NA NA NA SGV SGV NA NA NA NA NA NA diff --git a/include/dxc/DXIL/DxilSigPoint.inl b/include/dxc/DXIL/DxilSigPoint.inl index 650eae5fe0..22f2438058 100644 --- a/include/dxc/DXIL/DxilSigPoint.inl +++ b/include/dxc/DXIL/DxilSigPoint.inl @@ -87,7 +87,7 @@ const SigPoint SigPoint::ms_SigPoints[kNumSigPointRecords] = { ROW(DomainLocation, NA, NA, NA, NA, NA, NA, NA, NotInSig, NA, NA, NA, NA, \ NA, NA, NA, NA, NA, NA, NA, NA) \ ROW(PrimitiveID, NA, NA, NotInSig, NotInSig, NA, NA, NA, NotInSig, NA, NA, \ - NA, Shadow, SGV, SGV, NA, NA, NA, NA, SV, NA) \ + SGV, Shadow, SGV, SGV, NA, NA, NA, NA, SV, NA) \ ROW(GSInstanceID, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NotInSig, NA, \ NA, NA, NA, NA, NA, NA, NA) \ ROW(SampleIndex, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, \ From 25b65893bddbd0a36a4ba4b1763653eac38d1048 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 16 Jul 2025 15:18:17 +0200 Subject: [PATCH 62/62] Applied clang format again --- lib/HLSL/DxilContainerReflection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/HLSL/DxilContainerReflection.cpp b/lib/HLSL/DxilContainerReflection.cpp index d0573d829d..08f150990b 100644 --- a/lib/HLSL/DxilContainerReflection.cpp +++ b/lib/HLSL/DxilContainerReflection.cpp @@ -2876,7 +2876,7 @@ class CFunctionReflection final : public ID3D12FunctionReflection1 { // Use D3D_RETURN_PARAMETER_INDEX to get description of the return value. STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter) (INT ParameterIndex) { return &g_InvalidFunctionParameter; } - + STDMETHOD_(UINT64, GetRequiresFlags)() { return m_FeatureFlags; } };