summaryrefslogtreecommitdiffstats
path: root/source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch')
-rw-r--r--source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch279
1 files changed, 0 insertions, 279 deletions
diff --git a/source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch b/source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch
deleted file mode 100644
index 088c976d6..000000000
--- a/source/x/vulkan-sdk/DirectXShaderCompiler-dump-reflection.patch
+++ /dev/null
@@ -1,279 +0,0 @@
-From daf1386161cd6912fbd358f13d74e81466edab8b Mon Sep 17 00:00:00 2001
-From: Xiang Li <python3kgae@outlook.com>
-Date: Wed, 24 May 2023 13:13:36 -0400
-Subject: [PATCH] [dxa] Add option to dump reflection (#5232)
-
-* [dxa] Add option to dump reflection
-
-New option -dumpreflection is added to dump reflection data.
-This is to support %D3DReflect test in lit.
-
-* Move Reflection dump to DxilContainer.
----
- lib/DxilContainer/CMakeLists.txt | 3 +
- .../DxilContainer}/D3DReflectionDumper.cpp | 0
- .../DxilContainer}/D3DReflectionStrings.cpp | 0
- .../DxilContainer}/RDATDumper.cpp | 0
- tools/clang/test/DXC/dxa_tests.test | 73 +++++++++++++++++++
- tools/clang/tools/dxa/CMakeLists.txt | 1 -
- tools/clang/tools/dxa/dxa.cpp | 72 +++++++++++++++++-
- .../unittests/HLSLTestLib/CMakeLists.txt | 3 -
- utils/hct/hcttestcmds.cmd | 7 ++
- 9 files changed, 153 insertions(+), 6 deletions(-)
- rename {tools/clang/unittests/HLSLTestLib => lib/DxilContainer}/D3DReflectionDumper.cpp (100%)
- rename {tools/clang/unittests/HLSLTestLib => lib/DxilContainer}/D3DReflectionStrings.cpp (100%)
- rename {tools/clang/unittests/HLSLTestLib => lib/DxilContainer}/RDATDumper.cpp (100%)
-
-diff --git a/lib/DxilContainer/CMakeLists.txt b/lib/DxilContainer/CMakeLists.txt
-index f0ab344d23..a6369a36e6 100644
---- a/lib/DxilContainer/CMakeLists.txt
-+++ b/lib/DxilContainer/CMakeLists.txt
-@@ -1,12 +1,15 @@
- # Copyright (C) Microsoft Corporation. All rights reserved.
- # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
- add_llvm_library(LLVMDxilContainer
-+ D3DReflectionDumper.cpp
-+ D3DReflectionStrings.cpp
- DxilContainer.cpp
- DxilContainerAssembler.cpp
- DxilContainerReader.cpp
- DxcContainerBuilder.cpp
- DxilRDATBuilder.cpp
- DxilRuntimeReflection.cpp
-+ RDATDumper.cpp
- RDATDxilSubobjects.cpp
-
- ADDITIONAL_HEADER_DIRS
-diff --git a/tools/clang/unittests/HLSLTestLib/D3DReflectionDumper.cpp b/lib/DxilContainer/D3DReflectionDumper.cpp
-similarity index 100%
-rename from tools/clang/unittests/HLSLTestLib/D3DReflectionDumper.cpp
-rename to lib/DxilContainer/D3DReflectionDumper.cpp
-diff --git a/tools/clang/unittests/HLSLTestLib/D3DReflectionStrings.cpp b/lib/DxilContainer/D3DReflectionStrings.cpp
-similarity index 100%
-rename from tools/clang/unittests/HLSLTestLib/D3DReflectionStrings.cpp
-rename to lib/DxilContainer/D3DReflectionStrings.cpp
-diff --git a/tools/clang/unittests/HLSLTestLib/RDATDumper.cpp b/lib/DxilContainer/RDATDumper.cpp
-similarity index 100%
-rename from tools/clang/unittests/HLSLTestLib/RDATDumper.cpp
-rename to lib/DxilContainer/RDATDumper.cpp
-diff --git a/tools/clang/test/DXC/dxa_tests.test b/tools/clang/test/DXC/dxa_tests.test
-index a7d8ee5bad..655155941b 100644
---- a/tools/clang/test/DXC/dxa_tests.test
-+++ b/tools/clang/test/DXC/dxa_tests.test
-@@ -34,3 +34,76 @@
- // RUN: %dxc -dumpbin %t.rebuilt-container2.cso | FileCheck %s --check-prefix=REBUILD
-
- // REBUILD:define void @main()
-+
-+// RUN: %dxa %t.dxa.cso -dumpreflection | FileCheck %s --check-prefix=REFLECTION
-+// REFLECTION: ID3D12ShaderReflection:
-+// REFLECTION-NEXT: D3D12_SHADER_DESC:
-+// REFLECTION-NEXT: Shader Version: Vertex 6.0
-+// REFLECTION-NEXT: Creator: dxc
-+// REFLECTION-NEXT: Flags: 0
-+// REFLECTION-NEXT: ConstantBuffers: 1
-+// REFLECTION-NEXT: BoundResources: 1
-+// REFLECTION-NEXT: InputParameters: 0
-+// REFLECTION-NEXT: OutputParameters: 1
-+// REFLECTION-NEXT: InstructionCount: 10
-+// REFLECTION-NEXT: TempArrayCount: 0
-+// REFLECTION-NEXT: DynamicFlowControlCount: 0
-+// REFLECTION-NEXT: ArrayInstructionCount: 0
-+// REFLECTION-NEXT: TextureNormalInstructions: 0
-+// REFLECTION-NEXT: TextureLoadInstructions: 0
-+// REFLECTION-NEXT: TextureCompInstructions: 0
-+// REFLECTION-NEXT: TextureBiasInstructions: 0
-+// REFLECTION-NEXT: TextureGradientInstructions: 0
-+// REFLECTION-NEXT: FloatInstructionCount: 1
-+// REFLECTION-NEXT: IntInstructionCount: 1
-+// REFLECTION-NEXT: UintInstructionCount: 0
-+// REFLECTION-NEXT: CutInstructionCount: 0
-+// REFLECTION-NEXT: EmitInstructionCount: 0
-+// REFLECTION-NEXT: cBarrierInstructions: 0
-+// REFLECTION-NEXT: cInterlockedInstructions: 0
-+// REFLECTION-NEXT: cTextureStoreInstructions: 0
-+// REFLECTION-NEXT: OutputParameter Elements: 1
-+// REFLECTION-NEXT: D3D12_SIGNATURE_PARAMETER_DESC: SemanticName: SV_POSITION SemanticIndex: 0
-+// REFLECTION-NEXT: Register: 0
-+// REFLECTION-NEXT: SystemValueType: D3D_NAME_POSITION
-+// REFLECTION-NEXT: ComponentType: D3D_REGISTER_COMPONENT_FLOAT32
-+// REFLECTION-NEXT: Mask: xyzw (15)
-+// REFLECTION-NEXT: ReadWriteMask: ---- (0) (AlwaysReads/NeverWrites)
-+// REFLECTION-NEXT: Stream: 0
-+// REFLECTION-NEXT: MinPrecision: D3D_MIN_PRECISION_DEFAULT
-+// REFLECTION-NEXT: Constant Buffers:
-+// REFLECTION-NEXT: ID3D12ShaderReflectionConstantBuffer:
-+// REFLECTION-NEXT: D3D12_SHADER_BUFFER_DESC: Name: $Globals
-+// REFLECTION-NEXT: Type: D3D_CT_CBUFFER
-+// REFLECTION-NEXT: Size: 16
-+// REFLECTION-NEXT: uFlags: 0
-+// REFLECTION-NEXT: Num Variables: 1
-+// REFLECTION-NEXT: {
-+// REFLECTION-NEXT: ID3D12ShaderReflectionVariable:
-+// REFLECTION-NEXT: D3D12_SHADER_VARIABLE_DESC: Name: g
-+// REFLECTION-NEXT: Size: 4
-+// REFLECTION-NEXT: StartOffset: 0
-+// REFLECTION-NEXT: uFlags: (D3D_SVF_USED)
-+// REFLECTION-NEXT: DefaultValue: <nullptr>
-+// REFLECTION-NEXT: ID3D12ShaderReflectionType:
-+// REFLECTION-NEXT: D3D12_SHADER_TYPE_DESC: Name: int
-+// REFLECTION-NEXT: Class: D3D_SVC_SCALAR
-+// REFLECTION-NEXT: Type: D3D_SVT_INT
-+// REFLECTION-NEXT: Elements: 0
-+// REFLECTION-NEXT: Rows: 1
-+// REFLECTION-NEXT: Columns: 1
-+// REFLECTION-NEXT: Members: 0
-+// REFLECTION-NEXT: Offset: 0
-+// REFLECTION-NEXT: CBuffer: $Globals
-+// REFLECTION-NEXT: }
-+// REFLECTION-NEXT: Bound Resources:
-+// REFLECTION-NEXT: D3D12_SHADER_INPUT_BIND_DESC: Name: $Globals
-+// REFLECTION-NEXT: Type: D3D_SIT_CBUFFER
-+// REFLECTION-NEXT: uID: 0
-+// REFLECTION-NEXT: BindCount: 1
-+// REFLECTION-NEXT: BindPoint: 0
-+// REFLECTION-NEXT: Space: 0
-+// REFLECTION-NEXT: ReturnType: <unknown: 0>
-+// REFLECTION-NEXT: Dimension: D3D_SRV_DIMENSION_UNKNOWN
-+// REFLECTION-NEXT: NumSamples (or stride): 0
-+// REFLECTION-NEXT: uFlags: (D3D_SIF_USERPACKED)
-diff --git a/tools/clang/tools/dxa/CMakeLists.txt b/tools/clang/tools/dxa/CMakeLists.txt
-index 391ac8b062..33e61ca121 100644
---- a/tools/clang/tools/dxa/CMakeLists.txt
-+++ b/tools/clang/tools/dxa/CMakeLists.txt
-@@ -23,7 +23,6 @@ add_clang_executable(dxa
-
- target_link_libraries(dxa
- dxcompiler
-- HLSLTestLib
- )
-
- set_target_properties(dxa PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
-diff --git a/tools/clang/tools/dxa/dxa.cpp b/tools/clang/tools/dxa/dxa.cpp
-index dd3a0e64c4..cf9339afdc 100644
---- a/tools/clang/tools/dxa/dxa.cpp
-+++ b/tools/clang/tools/dxa/dxa.cpp
-@@ -19,6 +19,7 @@
- #include "dxc/DxilContainer/DxilContainer.h"
- #include "dxc/DxilRootSignature/DxilRootSignature.h"
- #include "dxc/Test/RDATDumper.h"
-+#include "dxc/Test/D3DReflectionDumper.h"
-
- #include "llvm/Support/CommandLine.h"
- #include "llvm/Support//MSFileSystem.h"
-@@ -63,6 +64,10 @@ static cl::opt<bool> DumpRDAT("dumprdat",
- cl::desc("Dump RDAT"),
- cl::init(false));
-
-+static cl::opt<bool> DumpReflection("dumpreflection",
-+ cl::desc("Dump reflection"),
-+ cl::init(false));
-+
- class DxaContext {
-
- private:
-@@ -80,6 +85,7 @@ class DxaContext {
- void ListParts();
- void DumpRS();
- void DumpRDAT();
-+ void DumpReflection();
- };
-
- void DxaContext::Assemble() {
-@@ -378,6 +384,66 @@ void DxaContext::DumpRDAT() {
- printf("%s", ss.str().c_str());
- }
-
-+void DxaContext::DumpReflection() {
-+ CComPtr<IDxcBlobEncoding> pSource;
-+ ReadFileIntoBlob(m_dxcSupport, StringRefWide(InputFilename), &pSource);
-+
-+ CComPtr<IDxcContainerReflection> pReflection;
-+ IFT(m_dxcSupport.CreateInstance(CLSID_DxcContainerReflection, &pReflection));
-+ IFT(pReflection->Load(pSource));
-+
-+ UINT32 partCount;
-+ IFT(pReflection->GetPartCount(&partCount));
-+
-+ bool blobFound = false;
-+ std::ostringstream ss;
-+ hlsl::dump::D3DReflectionDumper dumper(ss);
-+
-+ CComPtr<ID3D12ShaderReflection> pShaderReflection;
-+ CComPtr<ID3D12LibraryReflection> pLibraryReflection;
-+ for (uint32_t i = 0; i < partCount; ++i) {
-+ uint32_t kind;
-+ IFT(pReflection->GetPartKind(i, &kind));
-+ if (kind == (uint32_t)hlsl::DxilFourCC::DFCC_DXIL) {
-+ blobFound = true;
-+ CComPtr<IDxcBlob> pPart;
-+ IFT(pReflection->GetPartContent(i, &pPart));
-+ const hlsl::DxilProgramHeader *pProgramHeader =
-+ reinterpret_cast<const hlsl::DxilProgramHeader*>(pPart->GetBufferPointer());
-+ IFT(IsValidDxilProgramHeader(pProgramHeader, (uint32_t)pPart->GetBufferSize()));
-+ hlsl::DXIL::ShaderKind SK = hlsl::GetVersionShaderType(pProgramHeader->ProgramVersion);
-+ if (SK == hlsl::DXIL::ShaderKind::Library) {
-+ IFT(pReflection->GetPartReflection(i,
-+ IID_PPV_ARGS(&pLibraryReflection)));
-+
-+ } else {
-+ IFT(pReflection->GetPartReflection(i,
-+ IID_PPV_ARGS(&pShaderReflection)));
-+ }
-+ break;
-+ } else if (kind == (uint32_t)hlsl::DxilFourCC::DFCC_RuntimeData) {
-+ CComPtr<IDxcBlob> pPart;
-+ IFT(pReflection->GetPartContent(i, &pPart));
-+ hlsl::RDAT::DxilRuntimeData rdat(pPart->GetBufferPointer(),
-+ pPart->GetBufferSize());
-+ hlsl::dump::DumpContext d(ss);
-+ DumpRuntimeData(rdat, d);
-+ }
-+ }
-+
-+ if (!blobFound) {
-+ printf("Unable to find DXIL part");
-+ return;
-+ } else if (pShaderReflection) {
-+ dumper.Dump(pShaderReflection);
-+ } else if (pLibraryReflection) {
-+ dumper.Dump(pLibraryReflection);
-+ }
-+
-+ ss.flush();
-+ printf("%s", ss.str().c_str());
-+}
-+
- using namespace hlsl::options;
-
- #ifdef _WIN32
-@@ -439,8 +505,10 @@ int main(int argc, const char **argv) {
- } else if (DumpRDAT) {
- pStage = "Dump RDAT";
- context.DumpRDAT();
-- }
-- else {
-+ } else if (DumpReflection) {
-+ pStage = "Dump Reflection";
-+ context.DumpReflection();
-+ } else {
- pStage = "Assembling";
- context.Assemble();
- }
-diff --git a/tools/clang/unittests/HLSLTestLib/CMakeLists.txt b/tools/clang/unittests/HLSLTestLib/CMakeLists.txt
-index 0dc937617c..2ade2b3138 100644
---- a/tools/clang/unittests/HLSLTestLib/CMakeLists.txt
-+++ b/tools/clang/unittests/HLSLTestLib/CMakeLists.txt
-@@ -8,12 +8,9 @@ include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)
- endif(WIN32)
-
- add_clang_library(HLSLTestLib
-- D3DReflectionDumper.cpp
-- D3DReflectionStrings.cpp
- DxcTestUtils.cpp
- FileCheckerTest.cpp
- FileCheckForTest.cpp
-- RDATDumper.cpp
- )
-
- add_dependencies(HLSLTestLib TablegenHLSLOptions)