From aba72b3230f4190d5533afab6869faa9e72ce50c Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Mon, 15 Nov 2021 19:55:47 -0800 Subject: [PATCH 1/4] [CI] Fix the CI error on macOS --- CI/AzurePipelines/ContinuousBuild.yml | 6 ++++++ azure-pipelines.yml | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CI/AzurePipelines/ContinuousBuild.yml b/CI/AzurePipelines/ContinuousBuild.yml index bd39b452..a9c2c69c 100644 --- a/CI/AzurePipelines/ContinuousBuild.yml +++ b/CI/AzurePipelines/ContinuousBuild.yml @@ -7,6 +7,12 @@ steps: git config --global user.name "Dummy Name" displayName: 'Config git' +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.x' + addToPath: true + architecture: 'x64' + - task: PythonScript@0 displayName: 'Build' inputs: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1bfe7deb..fb8bde0d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -251,14 +251,13 @@ stages: - job: macOS_10_clang pool: - vmImage: macOS 10.14 + vmImage: macOS-10.15 variables: compiler: clang9 combination: 'osx-$(compiler)-$(platform)-$(configuration)' buildFolder: 'Build/ninja-$(combination)' installCommand: | - brew update brew install ninja testCommand: './$(buildFolder)/Bin/ShaderConductorTest' artifactBinaries: | From d969a7ea15bcd29f023feb1527adcaa0e0ec8f88 Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Sat, 20 Nov 2021 16:22:17 -0800 Subject: [PATCH 2/4] [Engineering] VS2022 support --- BuildAll.py | 22 +++- External/CMakeLists.txt | 4 + External/DirectXShaderCompiler.cmake | 10 +- External/SPIRV-Cross.cmake | 4 +- External/SPIRV-Header.cmake | 2 +- External/SPIRV-Tools.cmake | 16 ++- .../Expected/CalcLight+Diffuse.Debug.dxilasm | 67 ++++------ .../CalcLight+Diffuse.Release.dxilasm | 67 ++++------ .../CalcLight+DiffuseSpecular.Debug.dxilasm | 67 ++++------ .../CalcLight+DiffuseSpecular.Release.dxilasm | 115 ++++++++---------- .../Expected/DetailTessellation_HS.300.essl | 18 +-- .../Expected/DetailTessellation_HS.300.glsl | 18 +-- .../Expected/DetailTessellation_HS.310.essl | 18 +-- .../Expected/DetailTessellation_HS.410.glsl | 18 +-- .../Data/Expected/DetailTessellation_HS.msl | 12 +- .../Transform_VS_ColumnMajor.300.glsl | 4 +- azure-pipelines.yml | 39 ++++++ 17 files changed, 257 insertions(+), 244 deletions(-) diff --git a/BuildAll.py b/BuildAll.py index 9af0521d..384f45a3 100644 --- a/BuildAll.py +++ b/BuildAll.py @@ -64,6 +64,9 @@ def FindVS2017OrUpFolder(programFilesFolder, vsVersion, vsName): LogError("Could NOT find VS%s.\n" % vsName) return "" +def FindVS2022Folder(programFilesFolder): + return FindVS2017OrUpFolder(programFilesFolder, 17, "2022") + def FindVS2019Folder(programFilesFolder): return FindVS2017OrUpFolder(programFilesFolder, 16, "2019") @@ -132,7 +135,9 @@ def Build(hostPlatform, hostArch, buildSys, compiler, arch, configuration, tblge batCmd = BatchCommand(hostPlatform) if hostPlatform == "win": programFilesFolder = FindProgramFilesFolder() - if (buildSys == "vs2019") or ((buildSys == "ninja") and (compiler == "vc142")): + if (buildSys == "vs2022") or ((buildSys == "ninja") and (compiler == "vc143")): + vsFolder = FindVS2022Folder(programFilesFolder) + elif (buildSys == "vs2019") or ((buildSys == "ninja") and (compiler == "vc142")): vsFolder = FindVS2019Folder(programFilesFolder) elif (buildSys == "vs2017") or ((buildSys == "ninja") and (compiler == "vc141")): vsFolder = FindVS2017Folder(programFilesFolder) @@ -153,10 +158,13 @@ def Build(hostPlatform, hostArch, buildSys, compiler, arch, configuration, tblge else: LogError("Unsupported architecture.\n") vcToolset = "" - if (buildSys == "vs2019") and (compiler == "vc141"): + if (buildSys == "vs2022") and (compiler == "vc142"): + vcOption += " -vcvars_ver=14.2" + vcToolset = "v142," + elif ((buildSys == "vs2022") or (buildSys == "vs2019")) and (compiler == "vc141"): vcOption += " -vcvars_ver=14.1" vcToolset = "v141," - elif ((buildSys == "vs2019") or (buildSys == "vs2017")) and (compiler == "vc140"): + elif ((buildSys == "vs2022") or (buildSys == "vs2019") or (buildSys == "vs2017")) and (compiler == "vc140"): vcOption += " -vcvars_ver=14.0" vcToolset = "v140," batCmd.AddCommand("@call \"%sVCVARSALL.BAT\" %s" % (vsFolder, vcOption)) @@ -176,7 +184,9 @@ def Build(hostPlatform, hostArch, buildSys, compiler, arch, configuration, tblge else: batCmd.AddCommand("ninja -j%d" % parallel) else: - if buildSys == "vs2019": + if buildSys == "vs2022": + generator = "\"Visual Studio 17\"" + elif buildSys == "vs2019": generator = "\"Visual Studio 16\"" elif buildSys == "vs2017": generator = "\"Visual Studio 15\"" @@ -240,7 +250,9 @@ def Build(hostPlatform, hostArch, buildSys, compiler, arch, configuration, tblge if (argc > 2): compiler = sys.argv[2] else: - if buildSys == "vs2019": + if buildSys == "vs2022": + compiler = "vc143" + elif buildSys == "vs2019": compiler = "vc142" elif buildSys == "vs2017": compiler = "vc141" diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt index 5490b9bf..ff4ab557 100644 --- a/External/CMakeLists.txt +++ b/External/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +if(NOT EXISTS ${git_executable}) + unset(git_executable CACHE) +endif() + find_program(git_executable NAMES git git.exe git.cmd) if(NOT git_executable) message(FATAL_ERROR "Failed to find git.") diff --git a/External/DirectXShaderCompiler.cmake b/External/DirectXShaderCompiler.cmake index 467de97c..1013bba2 100644 --- a/External/DirectXShaderCompiler.cmake +++ b/External/DirectXShaderCompiler.cmake @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -set(DirectXShaderCompiler_REV "634a23537df7e85512437a4976f9bf9fcd095e18") +set(DirectXShaderCompiler_REV "cc50c79df1272a358fbf8b16e85dc6a9e5bc2ead") UpdateExternalLib("DirectXShaderCompiler" "https://github.com/Microsoft/DirectXShaderCompiler.git" ${DirectXShaderCompiler_REV}) @@ -40,6 +40,7 @@ endif() set(SPIRV_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE) + add_subdirectory(DirectXShaderCompiler EXCLUDE_FROM_ALL) foreach(target "clang" "dxc" @@ -53,9 +54,12 @@ foreach(target "ClangDiagnosticAnalysis" "ClangDiagnosticAST" "ClangDiagnosticComment" "ClangDiagnosticCommon" "ClangDiagnosticDriver" "ClangDiagnosticFrontend" "ClangDiagnosticGroups" "ClangDiagnosticIndexName" "ClangDiagnosticLex" "ClangDiagnosticParse" "ClangDiagnosticSema" "ClangDiagnosticSerialization" "ClangStmtNodes" - "LLVMAnalysis" "LLVMAsmParser" "LLVMBitReader" "LLVMBitWriter" "LLVMCore" "LLVMDxcSupport" "LLVMDXIL" "LLVMDxilContainer" + "DxcDisassembler" "DxcOptimizer" "DxilConstants" "DxilCounters" "DxilDocs" "DxilInstructions" "DxilIntrinsicTables" + "DxilMetadata" "DxilOperations" "DxilPIXPasses" "DxilShaderModel" "DxilShaderModelInc" "DxilSigPoint" "DxilValidation" "DxilValidationInc" + "HCTGen" "HLSLIntrinsicOp" "HLSLOptions" + "LLVMAnalysis" "LLVMAsmParser" "LLVMBitReader" "LLVMBitWriter" "LLVMCore" "LLVMDxcBindingTable" "LLVMDxcSupport" "LLVMDXIL" "LLVMDxilContainer" "LLVMDxilPIXPasses" "LLVMDxilRootSignature" "LLVMDxrFallback" "LLVMHLSL" "LLVMInstCombine" "LLVMipa" "LLVMipo" "LLVMIRReader" - "LLVMLinker" "LLVMLTO" "LLVMMSSupport" "LLVMOption" "LLVMPasses" "LLVMPassPrinters" "LLVMProfileData" "LLVMScalarOpts" "LLVMSupport" + "LLVMLinker" "LLVMMiniz" "LLVMMSSupport" "LLVMOption" "LLVMPasses" "LLVMPassPrinters" "LLVMProfileData" "LLVMScalarOpts" "LLVMSupport" "LLVMTableGen" "LLVMTarget" "LLVMTransformUtils" "LLVMVectorize" "ClangDriverOptions" "DxcEtw" "intrinsics_gen" "TablegenHLSLOptions" "clang-tblgen" "llvm-tblgen" "hlsl_dxcversion_autogen" "hlsl_version_autogen") diff --git a/External/SPIRV-Cross.cmake b/External/SPIRV-Cross.cmake index 1307d152..d3eaa5e7 100644 --- a/External/SPIRV-Cross.cmake +++ b/External/SPIRV-Cross.cmake @@ -1,10 +1,12 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -set(SPIRV_Cross_REV "8891bd35120ca91c252a66ccfdc3f9a9d03c70cd") +set(SPIRV_Cross_REV "37dfb3f45f4fc47c841f81e618c602f6f3de0f17") UpdateExternalLib("SPIRV-Cross" "https://github.com/KhronosGroup/SPIRV-Cross.git" ${SPIRV_Cross_REV}) +set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE) + add_subdirectory(SPIRV-Cross EXCLUDE_FROM_ALL) foreach(target "spirv-cross" "spirv-cross-core" "spirv-cross-cpp" "spirv-cross-glsl" "spirv-cross-hlsl" "spirv-cross-msl" "spirv-cross-reflect" diff --git a/External/SPIRV-Header.cmake b/External/SPIRV-Header.cmake index 364e26b9..d8115f8e 100644 --- a/External/SPIRV-Header.cmake +++ b/External/SPIRV-Header.cmake @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -set(SPIRV_Headers_REV "3fdabd0da2932c276b25b9b4a988ba134eba1aa6") +set(SPIRV_Headers_REV "29817199b7069bac971e5365d180295d4b077ebe") UpdateExternalLib("SPIRV-Headers" "https://github.com/KhronosGroup/SPIRV-Headers.git" ${SPIRV_Headers_REV}) diff --git a/External/SPIRV-Tools.cmake b/External/SPIRV-Tools.cmake index a5e0c2cf..e1523c2c 100644 --- a/External/SPIRV-Tools.cmake +++ b/External/SPIRV-Tools.cmake @@ -1,19 +1,29 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -set(SPIRV_Tools_REV "c341f7a6cd441d05ca1347ee39f2f03f32225c59") +set(SPIRV_Tools_REV "1589720e1065bd163fb8e812f268413b13755f7c") UpdateExternalLib("SPIRV-Tools" "https://github.com/KhronosGroup/SPIRV-Tools.git" ${SPIRV_Tools_REV}) set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) add_subdirectory(SPIRV-Tools EXCLUDE_FROM_ALL) + +if(MSVC) + target_compile_options(SPIRV-Tools-static + PRIVATE + /wd4819 + ) +endif() + foreach(target "core_tables" "enum_string_mapping" "extinst_tables" "spirv-tools-pkg-config" "spirv-tools-shared-pkg-config" "spirv-tools-build-version" "spirv-tools-header-DebugInfo" "SPIRV-Tools-link" "SPIRV-Tools-shared" - "spirv-tools-header-OpenCLDebugInfo100" "spirv-tools-vimsyntax" "spv-tools-cldi100" "spv-tools-clspvreflection" "spv-tools-debuginfo" "spv-tools-spv-amd-gs" - "spv-tools-spv-amd-sb" "spv-tools-spv-amd-sevp" "spv-tools-spv-amd-stm") + "spirv-tools-header-OpenCLDebugInfo100" "spirv-tools-header-NonSemanticShaderDebugInfo100" + "spirv-tools-vimsyntax" "spv-tools-cldi100" "spv-tools-shdi100" "spv-tools-clspvreflection" + "spv-tools-debuginfo" "spv-tools-spv-amd-gs" "spv-tools-spv-amd-sb" "spv-tools-spv-amd-sevp" + "spv-tools-spv-amd-stm") get_target_property(vsFolder ${target} FOLDER) if(NOT vsFolder) set(vsFolder "") diff --git a/Source/Tests/Data/Expected/CalcLight+Diffuse.Debug.dxilasm b/Source/Tests/Data/Expected/CalcLight+Diffuse.Debug.dxilasm index 29184df7..cfb8cf4a 100644 --- a/Source/Tests/Data/Expected/CalcLight+Diffuse.Debug.dxilasm +++ b/Source/Tests/Data/Expected/CalcLight+Diffuse.Debug.dxilasm @@ -15,8 +15,8 @@ ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader debug name: d81432b398a9151e6a076b6b827882eb.pdb -; shader hash: d81432b398a9151e6a076b6b827882eb +; shader debug name: 1c9ff017e8c534734cdc26123d89517a.pdb +; shader hash: 1c9ff017e8c534734cdc26123d89517a ; ; Pipeline Runtime Information: ; @@ -45,14 +45,7 @@ ; cbuffer cbPS ; { ; -; struct cbPS -; { -; -; float3 diffColor; ; Offset: 0 -; float3 specColor; ; Offset: 16 -; float shininess; ; Offset: 28 -; -; } cbPS; ; Offset: 0 Size: 32 +; [32 x i8] (type annotation not present) ; ; } ; @@ -75,12 +68,9 @@ ; target triple = "dxil-ms-dx" -%cbPS = type { <3 x float>, <3 x float>, float } %dx.types.CBufRet.f32 = type { float, float, float, float } %dx.types.Handle = type { i8* } -@cbPS = external constant %cbPS - ; Function Attrs: nounwind readnone declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32) #0 @@ -135,37 +125,32 @@ attributes #2 = { nounwind } !dx.valver = !{!2} !dx.shaderModel = !{!3} !dx.resources = !{!4} -!dx.typeAnnotations = !{!7, !12} -!dx.viewIdState = !{!16} -!dx.entryPoints = !{!17} +!dx.typeAnnotations = !{!7} +!dx.viewIdState = !{!11} +!dx.entryPoints = !{!12} !0 = !{!"clang version 3.7 (tags/RELEASE_370/final)"} !1 = !{i32 1, i32 0} -!2 = !{i32 1, i32 6} +!2 = !{i32 1, i32 7} !3 = !{!"ps", i32 6, i32 0} !4 = !{null, null, !5, null} !5 = !{!6} -!6 = !{i32 0, %cbPS* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} -!7 = !{i32 0, %cbPS undef, !8} -!8 = !{i32 32, !9, !10, !11} -!9 = !{i32 6, !"diffColor", i32 3, i32 0, i32 7, i32 9} -!10 = !{i32 6, !"specColor", i32 3, i32 16, i32 7, i32 9} -!11 = !{i32 6, !"shininess", i32 3, i32 28, i32 7, i32 9} -!12 = !{i32 1, void ()* @main, !13} -!13 = !{!14} -!14 = !{i32 0, !15, !15} -!15 = !{} -!16 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 0, i32 0, i32 0]} -!17 = !{void ()* @main, !"main", !18, !4, null} -!18 = !{!19, !27, null} -!19 = !{!20, !22, !24, !25} -!20 = !{i32 0, !"SV_Position", i8 9, i8 3, !21, i8 4, i32 1, i8 4, i32 0, i8 0, null} -!21 = !{i32 0} -!22 = !{i32 1, !"NORMAL", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 1, i8 0, !23} -!23 = !{i32 3, i32 7} -!24 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 2, i8 0, !23} -!25 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !26, i8 2, i32 1, i8 3, i32 3, i8 0, null} -!26 = !{i32 1} -!27 = !{!28} -!28 = !{i32 0, !"SV_Target", i8 9, i8 16, !21, i8 0, i32 1, i8 4, i32 0, i8 0, !29} -!29 = !{i32 3, i32 15} +!6 = !{i32 0, %dx.types.Handle* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} +!7 = !{i32 1, void ()* @main, !8} +!8 = !{!9} +!9 = !{i32 0, !10, !10} +!10 = !{} +!11 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 0, i32 0, i32 0]} +!12 = !{void ()* @main, !"main", !13, !4, null} +!13 = !{!14, !22, null} +!14 = !{!15, !17, !19, !20} +!15 = !{i32 0, !"SV_Position", i8 9, i8 3, !16, i8 4, i32 1, i8 4, i32 0, i8 0, null} +!16 = !{i32 0} +!17 = !{i32 1, !"NORMAL", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 1, i8 0, !18} +!18 = !{i32 3, i32 7} +!19 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 2, i8 0, !18} +!20 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 3, i8 0, null} +!21 = !{i32 1} +!22 = !{!23} +!23 = !{i32 0, !"SV_Target", i8 9, i8 16, !16, i8 0, i32 1, i8 4, i32 0, i8 0, !24} +!24 = !{i32 3, i32 15} diff --git a/Source/Tests/Data/Expected/CalcLight+Diffuse.Release.dxilasm b/Source/Tests/Data/Expected/CalcLight+Diffuse.Release.dxilasm index 4bdfb903..d11ad679 100644 --- a/Source/Tests/Data/Expected/CalcLight+Diffuse.Release.dxilasm +++ b/Source/Tests/Data/Expected/CalcLight+Diffuse.Release.dxilasm @@ -15,8 +15,8 @@ ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader debug name: ad90c6ff56d81fd333e64a2bf70453fc.pdb -; shader hash: ad90c6ff56d81fd333e64a2bf70453fc +; shader debug name: c247268630a3fe54e4153ff9c6dc82e1.pdb +; shader hash: c247268630a3fe54e4153ff9c6dc82e1 ; ; Pipeline Runtime Information: ; @@ -45,14 +45,7 @@ ; cbuffer cbPS ; { ; -; struct cbPS -; { -; -; float3 diffColor; ; Offset: 0 -; float3 specColor; ; Offset: 16 -; float shininess; ; Offset: 28 -; -; } cbPS; ; Offset: 0 Size: 32 +; [32 x i8] (type annotation not present) ; ; } ; @@ -75,12 +68,9 @@ ; target triple = "dxil-ms-dx" -%cbPS = type { <3 x float>, <3 x float>, float } %dx.types.CBufRet.f32 = type { float, float, float, float } %dx.types.Handle = type { i8* } -@cbPS = external constant %cbPS - ; Function Attrs: nounwind readnone declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32) #0 @@ -134,37 +124,32 @@ attributes #2 = { nounwind } !dx.valver = !{!2} !dx.shaderModel = !{!3} !dx.resources = !{!4} -!dx.typeAnnotations = !{!7, !12} -!dx.viewIdState = !{!16} -!dx.entryPoints = !{!17} +!dx.typeAnnotations = !{!7} +!dx.viewIdState = !{!11} +!dx.entryPoints = !{!12} !0 = !{!"clang version 3.7 (tags/RELEASE_370/final)"} !1 = !{i32 1, i32 0} -!2 = !{i32 1, i32 6} +!2 = !{i32 1, i32 7} !3 = !{!"ps", i32 6, i32 0} !4 = !{null, null, !5, null} !5 = !{!6} -!6 = !{i32 0, %cbPS* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} -!7 = !{i32 0, %cbPS undef, !8} -!8 = !{i32 32, !9, !10, !11} -!9 = !{i32 6, !"diffColor", i32 3, i32 0, i32 7, i32 9} -!10 = !{i32 6, !"specColor", i32 3, i32 16, i32 7, i32 9} -!11 = !{i32 6, !"shininess", i32 3, i32 28, i32 7, i32 9} -!12 = !{i32 1, void ()* @main, !13} -!13 = !{!14} -!14 = !{i32 0, !15, !15} -!15 = !{} -!16 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 0, i32 0, i32 0]} -!17 = !{void ()* @main, !"main", !18, !4, null} -!18 = !{!19, !27, null} -!19 = !{!20, !22, !24, !25} -!20 = !{i32 0, !"SV_Position", i8 9, i8 3, !21, i8 4, i32 1, i8 4, i32 0, i8 0, null} -!21 = !{i32 0} -!22 = !{i32 1, !"NORMAL", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 1, i8 0, !23} -!23 = !{i32 3, i32 7} -!24 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 2, i8 0, !23} -!25 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !26, i8 2, i32 1, i8 3, i32 3, i8 0, null} -!26 = !{i32 1} -!27 = !{!28} -!28 = !{i32 0, !"SV_Target", i8 9, i8 16, !21, i8 0, i32 1, i8 4, i32 0, i8 0, !29} -!29 = !{i32 3, i32 15} +!6 = !{i32 0, %dx.types.Handle* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} +!7 = !{i32 1, void ()* @main, !8} +!8 = !{!9} +!9 = !{i32 0, !10, !10} +!10 = !{} +!11 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 0, i32 0, i32 0]} +!12 = !{void ()* @main, !"main", !13, !4, null} +!13 = !{!14, !22, null} +!14 = !{!15, !17, !19, !20} +!15 = !{i32 0, !"SV_Position", i8 9, i8 3, !16, i8 4, i32 1, i8 4, i32 0, i8 0, null} +!16 = !{i32 0} +!17 = !{i32 1, !"NORMAL", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 1, i8 0, !18} +!18 = !{i32 3, i32 7} +!19 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 2, i8 0, !18} +!20 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 3, i8 0, null} +!21 = !{i32 1} +!22 = !{!23} +!23 = !{i32 0, !"SV_Target", i8 9, i8 16, !16, i8 0, i32 1, i8 4, i32 0, i8 0, !24} +!24 = !{i32 3, i32 15} diff --git a/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Debug.dxilasm b/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Debug.dxilasm index 0c66a2b1..859ddbd5 100644 --- a/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Debug.dxilasm +++ b/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Debug.dxilasm @@ -15,8 +15,8 @@ ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader debug name: 65620ef187dc1e38cb91d8208665ef7d.pdb -; shader hash: 65620ef187dc1e38cb91d8208665ef7d +; shader debug name: 25518f9e3687a943487e772bc4f7808c.pdb +; shader hash: 25518f9e3687a943487e772bc4f7808c ; ; Pipeline Runtime Information: ; @@ -45,14 +45,7 @@ ; cbuffer cbPS ; { ; -; struct cbPS -; { -; -; float3 diffColor; ; Offset: 0 -; float3 specColor; ; Offset: 16 -; float shininess; ; Offset: 28 -; -; } cbPS; ; Offset: 0 Size: 32 +; [32 x i8] (type annotation not present) ; ; } ; @@ -75,12 +68,9 @@ ; target triple = "dxil-ms-dx" -%cbPS = type { <3 x float>, <3 x float>, float } %dx.types.CBufRet.f32 = type { float, float, float, float } %dx.types.Handle = type { i8* } -@cbPS = external constant %cbPS - ; Function Attrs: nounwind readnone declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32) #0 @@ -181,37 +171,32 @@ attributes #2 = { nounwind } !dx.valver = !{!2} !dx.shaderModel = !{!3} !dx.resources = !{!4} -!dx.typeAnnotations = !{!7, !12} -!dx.viewIdState = !{!16} -!dx.entryPoints = !{!17} +!dx.typeAnnotations = !{!7} +!dx.viewIdState = !{!11} +!dx.entryPoints = !{!12} !0 = !{!"clang version 3.7 (tags/RELEASE_370/final)"} !1 = !{i32 1, i32 0} -!2 = !{i32 1, i32 6} +!2 = !{i32 1, i32 7} !3 = !{!"ps", i32 6, i32 0} !4 = !{null, null, !5, null} !5 = !{!6} -!6 = !{i32 0, %cbPS* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} -!7 = !{i32 0, %cbPS undef, !8} -!8 = !{i32 32, !9, !10, !11} -!9 = !{i32 6, !"diffColor", i32 3, i32 0, i32 7, i32 9} -!10 = !{i32 6, !"specColor", i32 3, i32 16, i32 7, i32 9} -!11 = !{i32 6, !"shininess", i32 3, i32 28, i32 7, i32 9} -!12 = !{i32 1, void ()* @main, !13} -!13 = !{!14} -!14 = !{i32 0, !15, !15} -!15 = !{} -!16 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7]} -!17 = !{void ()* @main, !"main", !18, !4, null} -!18 = !{!19, !27, null} -!19 = !{!20, !22, !24, !25} -!20 = !{i32 0, !"SV_Position", i8 9, i8 3, !21, i8 4, i32 1, i8 4, i32 0, i8 0, null} -!21 = !{i32 0} -!22 = !{i32 1, !"NORMAL", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 1, i8 0, !23} -!23 = !{i32 3, i32 7} -!24 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 2, i8 0, !23} -!25 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !26, i8 2, i32 1, i8 3, i32 3, i8 0, !23} -!26 = !{i32 1} -!27 = !{!28} -!28 = !{i32 0, !"SV_Target", i8 9, i8 16, !21, i8 0, i32 1, i8 4, i32 0, i8 0, !29} -!29 = !{i32 3, i32 15} +!6 = !{i32 0, %dx.types.Handle* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} +!7 = !{i32 1, void ()* @main, !8} +!8 = !{!9} +!9 = !{i32 0, !10, !10} +!10 = !{} +!11 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7]} +!12 = !{void ()* @main, !"main", !13, !4, null} +!13 = !{!14, !22, null} +!14 = !{!15, !17, !19, !20} +!15 = !{i32 0, !"SV_Position", i8 9, i8 3, !16, i8 4, i32 1, i8 4, i32 0, i8 0, null} +!16 = !{i32 0} +!17 = !{i32 1, !"NORMAL", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 1, i8 0, !18} +!18 = !{i32 3, i32 7} +!19 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 2, i8 0, !18} +!20 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 3, i8 0, !18} +!21 = !{i32 1} +!22 = !{!23} +!23 = !{i32 0, !"SV_Target", i8 9, i8 16, !16, i8 0, i32 1, i8 4, i32 0, i8 0, !24} +!24 = !{i32 3, i32 15} diff --git a/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Release.dxilasm b/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Release.dxilasm index fde43471..08f95c29 100644 --- a/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Release.dxilasm +++ b/Source/Tests/Data/Expected/CalcLight+DiffuseSpecular.Release.dxilasm @@ -15,8 +15,8 @@ ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader debug name: 7f14de892298c5aa041b655c7a09b6e5.pdb -; shader hash: 7f14de892298c5aa041b655c7a09b6e5 +; shader debug name: 98d2b1bcd83bf049601636cc5a9e1e37.pdb +; shader hash: 98d2b1bcd83bf049601636cc5a9e1e37 ; ; Pipeline Runtime Information: ; @@ -45,14 +45,7 @@ ; cbuffer cbPS ; { ; -; struct cbPS -; { -; -; float3 diffColor; ; Offset: 0 -; float3 specColor; ; Offset: 16 -; float shininess; ; Offset: 28 -; -; } cbPS; ; Offset: 0 Size: 32 +; [32 x i8] (type annotation not present) ; ; } ; @@ -75,12 +68,9 @@ ; target triple = "dxil-ms-dx" -%cbPS = type { <3 x float>, <3 x float>, float } %dx.types.CBufRet.f32 = type { float, float, float, float } %dx.types.Handle = type { i8* } -@cbPS = external constant %cbPS - ; Function Attrs: nounwind readnone declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32) #0 @@ -132,35 +122,35 @@ define void @main() { %.i06.i = fcmp fast ogt float %12, 0.000000e+00 %.i17.i = fcmp fast ogt float %13, 0.000000e+00 %.i28.i = fcmp fast ogt float %14, 0.000000e+00 - %.i010.i = fsub fast float 1.000000e+00, %12 - %.i112.i = fsub fast float 1.000000e+00, %13 - %.i214.i = fsub fast float 1.000000e+00, %14 + %.i09.i = fsub fast float 1.000000e+00, %12 + %.i110.i = fsub fast float 1.000000e+00, %13 + %.i211.i = fsub fast float 1.000000e+00, %14 %24 = fsub fast float 1.000000e+00, %Saturate.i %Log.i = call float @dx.op.unary.f32(i32 23, float %24) #2 ; Log(value) %25 = fmul fast float %Log.i, 5.000000e+00 %Exp.i = call float @dx.op.unary.f32(i32 21, float %25) #2 ; Exp(value) - %.i015.i = fmul fast float %Exp.i, %.i010.i - %.i116.i = fmul fast float %Exp.i, %.i112.i - %.i217.i = fmul fast float %Exp.i, %.i214.i - %.i019.i = fadd fast float %.i015.i, %12 - %.i121.i = fadd fast float %.i116.i, %13 - %.i223.i = fadd fast float %.i217.i, %14 - %26 = select i1 %.i06.i, float %.i019.i, float 0.000000e+00 - %27 = select i1 %.i17.i, float %.i121.i, float 0.000000e+00 - %28 = select i1 %.i28.i, float %.i223.i, float 0.000000e+00 - %.i024.i = fmul fast float %.i0.i, %26 - %.i125.i = fmul fast float %.i0.i, %27 - %.i226.i = fmul fast float %.i0.i, %28 - %.i027.i = fadd fast float %.i024.i, %16 - %.i128.i = fadd fast float %.i125.i, %17 - %.i229.i = fadd fast float %.i226.i, %18 + %.i012.i = fmul fast float %Exp.i, %.i09.i + %.i113.i = fmul fast float %Exp.i, %.i110.i + %.i214.i = fmul fast float %Exp.i, %.i211.i + %.i015.i = fadd fast float %.i012.i, %12 + %.i116.i = fadd fast float %.i113.i, %13 + %.i217.i = fadd fast float %.i214.i, %14 + %26 = select i1 %.i06.i, float %.i015.i, float 0.000000e+00 + %27 = select i1 %.i17.i, float %.i116.i, float 0.000000e+00 + %28 = select i1 %.i28.i, float %.i217.i, float 0.000000e+00 + %.i018.i = fmul fast float %.i0.i, %26 + %.i119.i = fmul fast float %.i0.i, %27 + %.i220.i = fmul fast float %.i0.i, %28 + %.i021.i = fadd fast float %.i018.i, %16 + %.i122.i = fadd fast float %.i119.i, %17 + %.i223.i = fadd fast float %.i220.i, %18 %29 = call float @dx.op.dot3.f32(i32 55, float %7, float %8, float %9, float %4, float %5, float %6) #2 ; Dot3(ax,ay,az,bx,by,bz) - %.i030.i = fmul fast float %.i027.i, %29 - %.i131.i = fmul fast float %.i128.i, %29 - %.i232.i = fmul fast float %.i229.i, %29 - %FMax3.i = call float @dx.op.binary.f32(i32 35, float %.i030.i, float 0.000000e+00) #2 ; FMax(a,b) - %FMax4.i = call float @dx.op.binary.f32(i32 35, float %.i131.i, float 0.000000e+00) #2 ; FMax(a,b) - %FMax5.i = call float @dx.op.binary.f32(i32 35, float %.i232.i, float 0.000000e+00) #2 ; FMax(a,b) + %.i024.i = fmul fast float %.i021.i, %29 + %.i125.i = fmul fast float %.i122.i, %29 + %.i226.i = fmul fast float %.i223.i, %29 + %FMax3.i = call float @dx.op.binary.f32(i32 35, float %.i024.i, float 0.000000e+00) #2 ; FMax(a,b) + %FMax4.i = call float @dx.op.binary.f32(i32 35, float %.i125.i, float 0.000000e+00) #2 ; FMax(a,b) + %FMax5.i = call float @dx.op.binary.f32(i32 35, float %.i226.i, float 0.000000e+00) #2 ; FMax(a,b) call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float %FMax3.i) ; StoreOutput(outputSigId,rowIndex,colIndex,value) call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 1, float %FMax4.i) ; StoreOutput(outputSigId,rowIndex,colIndex,value) call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 2, float %FMax5.i) ; StoreOutput(outputSigId,rowIndex,colIndex,value) @@ -180,37 +170,32 @@ attributes #2 = { nounwind } !dx.valver = !{!2} !dx.shaderModel = !{!3} !dx.resources = !{!4} -!dx.typeAnnotations = !{!7, !12} -!dx.viewIdState = !{!16} -!dx.entryPoints = !{!17} +!dx.typeAnnotations = !{!7} +!dx.viewIdState = !{!11} +!dx.entryPoints = !{!12} !0 = !{!"clang version 3.7 (tags/RELEASE_370/final)"} !1 = !{i32 1, i32 0} -!2 = !{i32 1, i32 6} +!2 = !{i32 1, i32 7} !3 = !{!"ps", i32 6, i32 0} !4 = !{null, null, !5, null} !5 = !{!6} -!6 = !{i32 0, %cbPS* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} -!7 = !{i32 0, %cbPS undef, !8} -!8 = !{i32 32, !9, !10, !11} -!9 = !{i32 6, !"diffColor", i32 3, i32 0, i32 7, i32 9} -!10 = !{i32 6, !"specColor", i32 3, i32 16, i32 7, i32 9} -!11 = !{i32 6, !"shininess", i32 3, i32 28, i32 7, i32 9} -!12 = !{i32 1, void ()* @main, !13} -!13 = !{!14} -!14 = !{i32 0, !15, !15} -!15 = !{} -!16 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7]} -!17 = !{void ()* @main, !"main", !18, !4, null} -!18 = !{!19, !27, null} -!19 = !{!20, !22, !24, !25} -!20 = !{i32 0, !"SV_Position", i8 9, i8 3, !21, i8 4, i32 1, i8 4, i32 0, i8 0, null} -!21 = !{i32 0} -!22 = !{i32 1, !"NORMAL", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 1, i8 0, !23} -!23 = !{i32 3, i32 7} -!24 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 2, i8 0, !23} -!25 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !26, i8 2, i32 1, i8 3, i32 3, i8 0, !23} -!26 = !{i32 1} -!27 = !{!28} -!28 = !{i32 0, !"SV_Target", i8 9, i8 16, !21, i8 0, i32 1, i8 4, i32 0, i8 0, !29} -!29 = !{i32 3, i32 15} +!6 = !{i32 0, %dx.types.Handle* undef, !"cbPS", i32 0, i32 0, i32 1, i32 32, null} +!7 = !{i32 1, void ()* @main, !8} +!8 = !{!9} +!9 = !{i32 0, !10, !10} +!10 = !{} +!11 = !{[17 x i32] [i32 15, i32 4, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7, i32 0, i32 7, i32 7, i32 7]} +!12 = !{void ()* @main, !"main", !13, !4, null} +!13 = !{!14, !22, null} +!14 = !{!15, !17, !19, !20} +!15 = !{i32 0, !"SV_Position", i8 9, i8 3, !16, i8 4, i32 1, i8 4, i32 0, i8 0, null} +!16 = !{i32 0} +!17 = !{i32 1, !"NORMAL", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 1, i8 0, !18} +!18 = !{i32 3, i32 7} +!19 = !{i32 2, !"TEXCOORD", i8 9, i8 0, !16, i8 2, i32 1, i8 3, i32 2, i8 0, !18} +!20 = !{i32 3, !"TEXCOORD", i8 9, i8 0, !21, i8 2, i32 1, i8 3, i32 3, i8 0, !18} +!21 = !{i32 1} +!22 = !{!23} +!23 = !{i32 0, !"SV_Target", i8 9, i8 16, !16, i8 0, i32 1, i8 4, i32 0, i8 0, !24} +!24 = !{i32 3, i32 15} diff --git a/Source/Tests/Data/Expected/DetailTessellation_HS.300.essl b/Source/Tests/Data/Expected/DetailTessellation_HS.300.essl index e171e8f9..6a52f4d2 100644 --- a/Source/Tests/Data/Expected/DetailTessellation_HS.300.essl +++ b/Source/Tests/Data/Expected/DetailTessellation_HS.300.essl @@ -26,27 +26,27 @@ out vec3 out_var_LIGHTVECTORTS[3]; void main() { - vec3 _58_unrolled[3]; + vec3 _59_unrolled[3]; for (int i = 0; i < int(3); i++) { - _58_unrolled[i] = in_var_WORLDPOS[i]; + _59_unrolled[i] = in_var_WORLDPOS[i]; } - vec3 _59_unrolled[3]; + vec3 _60_unrolled[3]; for (int i = 0; i < int(3); i++) { - _59_unrolled[i] = in_var_NORMAL[i]; + _60_unrolled[i] = in_var_NORMAL[i]; } - vec2 _60_unrolled[3]; + vec2 _61_unrolled[3]; for (int i = 0; i < int(3); i++) { - _60_unrolled[i] = in_var_TEXCOORD0[i]; + _61_unrolled[i] = in_var_TEXCOORD0[i]; } - vec3 _61_unrolled[3]; + vec3 _62_unrolled[3]; for (int i = 0; i < int(3); i++) { - _61_unrolled[i] = in_var_LIGHTVECTORTS[i]; + _62_unrolled[i] = in_var_LIGHTVECTORTS[i]; } - VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_58_unrolled[0], _59_unrolled[0], _60_unrolled[0], _61_unrolled[0]), VS_OUTPUT_HS_INPUT(_58_unrolled[1], _59_unrolled[1], _60_unrolled[1], _61_unrolled[1]), VS_OUTPUT_HS_INPUT(_58_unrolled[2], _59_unrolled[2], _60_unrolled[2], _61_unrolled[2])); + VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_59_unrolled[0], _60_unrolled[0], _61_unrolled[0], _62_unrolled[0]), VS_OUTPUT_HS_INPUT(_59_unrolled[1], _60_unrolled[1], _61_unrolled[1], _62_unrolled[1]), VS_OUTPUT_HS_INPUT(_59_unrolled[2], _60_unrolled[2], _61_unrolled[2], _62_unrolled[2])); out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos; out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal; out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord; diff --git a/Source/Tests/Data/Expected/DetailTessellation_HS.300.glsl b/Source/Tests/Data/Expected/DetailTessellation_HS.300.glsl index 63408365..af83a326 100644 --- a/Source/Tests/Data/Expected/DetailTessellation_HS.300.glsl +++ b/Source/Tests/Data/Expected/DetailTessellation_HS.300.glsl @@ -27,27 +27,27 @@ layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3]; void main() { - vec3 _58_unrolled[3]; + vec3 _59_unrolled[3]; for (int i = 0; i < int(3); i++) { - _58_unrolled[i] = in_var_WORLDPOS[i]; + _59_unrolled[i] = in_var_WORLDPOS[i]; } - vec3 _59_unrolled[3]; + vec3 _60_unrolled[3]; for (int i = 0; i < int(3); i++) { - _59_unrolled[i] = in_var_NORMAL[i]; + _60_unrolled[i] = in_var_NORMAL[i]; } - vec2 _60_unrolled[3]; + vec2 _61_unrolled[3]; for (int i = 0; i < int(3); i++) { - _60_unrolled[i] = in_var_TEXCOORD0[i]; + _61_unrolled[i] = in_var_TEXCOORD0[i]; } - vec3 _61_unrolled[3]; + vec3 _62_unrolled[3]; for (int i = 0; i < int(3); i++) { - _61_unrolled[i] = in_var_LIGHTVECTORTS[i]; + _62_unrolled[i] = in_var_LIGHTVECTORTS[i]; } - VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_58_unrolled[0], _59_unrolled[0], _60_unrolled[0], _61_unrolled[0]), VS_OUTPUT_HS_INPUT(_58_unrolled[1], _59_unrolled[1], _60_unrolled[1], _61_unrolled[1]), VS_OUTPUT_HS_INPUT(_58_unrolled[2], _59_unrolled[2], _60_unrolled[2], _61_unrolled[2])); + VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_59_unrolled[0], _60_unrolled[0], _61_unrolled[0], _62_unrolled[0]), VS_OUTPUT_HS_INPUT(_59_unrolled[1], _60_unrolled[1], _61_unrolled[1], _62_unrolled[1]), VS_OUTPUT_HS_INPUT(_59_unrolled[2], _60_unrolled[2], _61_unrolled[2], _62_unrolled[2])); out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos; out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal; out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord; diff --git a/Source/Tests/Data/Expected/DetailTessellation_HS.310.essl b/Source/Tests/Data/Expected/DetailTessellation_HS.310.essl index 9e012501..5fdb913d 100644 --- a/Source/Tests/Data/Expected/DetailTessellation_HS.310.essl +++ b/Source/Tests/Data/Expected/DetailTessellation_HS.310.essl @@ -26,27 +26,27 @@ layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3]; void main() { - vec3 _58_unrolled[3]; + vec3 _59_unrolled[3]; for (int i = 0; i < int(3); i++) { - _58_unrolled[i] = in_var_WORLDPOS[i]; + _59_unrolled[i] = in_var_WORLDPOS[i]; } - vec3 _59_unrolled[3]; + vec3 _60_unrolled[3]; for (int i = 0; i < int(3); i++) { - _59_unrolled[i] = in_var_NORMAL[i]; + _60_unrolled[i] = in_var_NORMAL[i]; } - vec2 _60_unrolled[3]; + vec2 _61_unrolled[3]; for (int i = 0; i < int(3); i++) { - _60_unrolled[i] = in_var_TEXCOORD0[i]; + _61_unrolled[i] = in_var_TEXCOORD0[i]; } - vec3 _61_unrolled[3]; + vec3 _62_unrolled[3]; for (int i = 0; i < int(3); i++) { - _61_unrolled[i] = in_var_LIGHTVECTORTS[i]; + _62_unrolled[i] = in_var_LIGHTVECTORTS[i]; } - VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_58_unrolled[0], _59_unrolled[0], _60_unrolled[0], _61_unrolled[0]), VS_OUTPUT_HS_INPUT(_58_unrolled[1], _59_unrolled[1], _60_unrolled[1], _61_unrolled[1]), VS_OUTPUT_HS_INPUT(_58_unrolled[2], _59_unrolled[2], _60_unrolled[2], _61_unrolled[2])); + VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_59_unrolled[0], _60_unrolled[0], _61_unrolled[0], _62_unrolled[0]), VS_OUTPUT_HS_INPUT(_59_unrolled[1], _60_unrolled[1], _61_unrolled[1], _62_unrolled[1]), VS_OUTPUT_HS_INPUT(_59_unrolled[2], _60_unrolled[2], _61_unrolled[2], _62_unrolled[2])); out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos; out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal; out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord; diff --git a/Source/Tests/Data/Expected/DetailTessellation_HS.410.glsl b/Source/Tests/Data/Expected/DetailTessellation_HS.410.glsl index 7a4865b1..f0e031d3 100644 --- a/Source/Tests/Data/Expected/DetailTessellation_HS.410.glsl +++ b/Source/Tests/Data/Expected/DetailTessellation_HS.410.glsl @@ -25,27 +25,27 @@ layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3]; void main() { - vec3 _58_unrolled[3]; + vec3 _59_unrolled[3]; for (int i = 0; i < int(3); i++) { - _58_unrolled[i] = in_var_WORLDPOS[i]; + _59_unrolled[i] = in_var_WORLDPOS[i]; } - vec3 _59_unrolled[3]; + vec3 _60_unrolled[3]; for (int i = 0; i < int(3); i++) { - _59_unrolled[i] = in_var_NORMAL[i]; + _60_unrolled[i] = in_var_NORMAL[i]; } - vec2 _60_unrolled[3]; + vec2 _61_unrolled[3]; for (int i = 0; i < int(3); i++) { - _60_unrolled[i] = in_var_TEXCOORD0[i]; + _61_unrolled[i] = in_var_TEXCOORD0[i]; } - vec3 _61_unrolled[3]; + vec3 _62_unrolled[3]; for (int i = 0; i < int(3); i++) { - _61_unrolled[i] = in_var_LIGHTVECTORTS[i]; + _62_unrolled[i] = in_var_LIGHTVECTORTS[i]; } - VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_58_unrolled[0], _59_unrolled[0], _60_unrolled[0], _61_unrolled[0]), VS_OUTPUT_HS_INPUT(_58_unrolled[1], _59_unrolled[1], _60_unrolled[1], _61_unrolled[1]), VS_OUTPUT_HS_INPUT(_58_unrolled[2], _59_unrolled[2], _60_unrolled[2], _61_unrolled[2])); + VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(_59_unrolled[0], _60_unrolled[0], _61_unrolled[0], _62_unrolled[0]), VS_OUTPUT_HS_INPUT(_59_unrolled[1], _60_unrolled[1], _61_unrolled[1], _62_unrolled[1]), VS_OUTPUT_HS_INPUT(_59_unrolled[2], _60_unrolled[2], _61_unrolled[2], _62_unrolled[2])); out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos; out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal; out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord; diff --git a/Source/Tests/Data/Expected/DetailTessellation_HS.msl b/Source/Tests/Data/Expected/DetailTessellation_HS.msl index ae523267..826e8dcd 100644 --- a/Source/Tests/Data/Expected/DetailTessellation_HS.msl +++ b/Source/Tests/Data/Expected/DetailTessellation_HS.msl @@ -81,13 +81,13 @@ kernel void main0(main0_in in [[stage_in]], constant type_cbMain& cbMain [[buffe threadgroup_barrier(mem_flags::mem_threadgroup); if (gl_InvocationID >= 3) return; - spvUnsafeArray _58 = spvUnsafeArray({ gl_in[0].in_var_WORLDPOS, gl_in[1].in_var_WORLDPOS, gl_in[2].in_var_WORLDPOS }); - spvUnsafeArray _59 = spvUnsafeArray({ gl_in[0].in_var_NORMAL, gl_in[1].in_var_NORMAL, gl_in[2].in_var_NORMAL }); - spvUnsafeArray _60 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0, gl_in[1].in_var_TEXCOORD0, gl_in[2].in_var_TEXCOORD0 }); - spvUnsafeArray _61 = spvUnsafeArray({ gl_in[0].in_var_LIGHTVECTORTS, gl_in[1].in_var_LIGHTVECTORTS, gl_in[2].in_var_LIGHTVECTORTS }); - spvUnsafeArray _77 = spvUnsafeArray({ VS_OUTPUT_HS_INPUT{ _58[0], _59[0], _60[0], _61[0] }, VS_OUTPUT_HS_INPUT{ _58[1], _59[1], _60[1], _61[1] }, VS_OUTPUT_HS_INPUT{ _58[2], _59[2], _60[2], _61[2] } }); + spvUnsafeArray _59 = spvUnsafeArray({ gl_in[0].in_var_WORLDPOS, gl_in[1].in_var_WORLDPOS, gl_in[2].in_var_WORLDPOS }); + spvUnsafeArray _60 = spvUnsafeArray({ gl_in[0].in_var_NORMAL, gl_in[1].in_var_NORMAL, gl_in[2].in_var_NORMAL }); + spvUnsafeArray _61 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0, gl_in[1].in_var_TEXCOORD0, gl_in[2].in_var_TEXCOORD0 }); + spvUnsafeArray _62 = spvUnsafeArray({ gl_in[0].in_var_LIGHTVECTORTS, gl_in[1].in_var_LIGHTVECTORTS, gl_in[2].in_var_LIGHTVECTORTS }); + spvUnsafeArray _78 = spvUnsafeArray({ VS_OUTPUT_HS_INPUT{ _59[0], _60[0], _61[0], _62[0] }, VS_OUTPUT_HS_INPUT{ _59[1], _60[1], _61[1], _62[1] }, VS_OUTPUT_HS_INPUT{ _59[2], _60[2], _61[2], _62[2] } }); spvUnsafeArray param_var_inputPatch; - param_var_inputPatch = _77; + param_var_inputPatch = _78; gl_out[gl_InvocationID].out_var_WORLDPOS = param_var_inputPatch[gl_InvocationID].worldPos; gl_out[gl_InvocationID].out_var_NORMAL = param_var_inputPatch[gl_InvocationID].normal; gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_inputPatch[gl_InvocationID].texCoord; diff --git a/Source/Tests/Data/Expected/Transform_VS_ColumnMajor.300.glsl b/Source/Tests/Data/Expected/Transform_VS_ColumnMajor.300.glsl index ebd8cc28..86ef1136 100644 --- a/Source/Tests/Data/Expected/Transform_VS_ColumnMajor.300.glsl +++ b/Source/Tests/Data/Expected/Transform_VS_ColumnMajor.300.glsl @@ -13,8 +13,10 @@ layout(std140) uniform type_cbVS in vec4 in_var_POSITION; +mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; } + void main() { - gl_Position = cbVS.wvp * in_var_POSITION; + gl_Position = spvWorkaroundRowMajor(cbVS.wvp) * in_var_POSITION; } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fb8bde0d..28cbb5b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -153,6 +153,45 @@ stages: steps: - template: CI/AzurePipelines/ContinuousBuild.yml + - job: Windows_vc143_x64 + pool: + vmImage: windows-2022 + + variables: + compiler: vc143 + combination: 'win-$(compiler)-$(platform)-$(configuration)' + buildFolder: 'Build/ninja-$(combination)' + installCommand: 'choco install ninja' + testCommand: './$(buildFolder)/Bin/ShaderConductorTest.exe' + artifactBinaries: | + Bin/ShaderConductor.dll + Bin/ShaderConductorCmd.exe + Bin/dxcompiler.dll + Lib/ShaderConductor.lib + + steps: + - template: CI/AzurePipelines/ContinuousBuild.yml + + - job: Windows_vc143_arm64 + pool: + vmImage: windows-2022 + + variables: + compiler: vc143 + platform: arm64 + combination: 'win-$(compiler)-$(platform)-$(configuration)' + buildFolder: 'Build/ninja-$(combination)' + installCommand: 'choco install ninja' + testCommand: '' + artifactBinaries: | + Bin/ShaderConductor.dll + Bin/ShaderConductorCmd.exe + Bin/dxcompiler.dll + Lib/ShaderConductor.lib + + steps: + - template: CI/AzurePipelines/ContinuousBuild.yml + - job: Linux_gcc7 pool: vmImage: Ubuntu-18.04 From 7c3ed56e33af981e661fbde458f00f4b77453f58 Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Sat, 20 Nov 2021 11:41:51 -0800 Subject: [PATCH 3/4] [Test] Add test coverage for struct in cbuffer --- Source/Tests/Data/Expected/Fluid_CS.300.glsl | 15 ++++++++++----- Source/Tests/Data/Expected/Fluid_CS.310.essl | 15 ++++++++++----- Source/Tests/Data/Expected/Fluid_CS.410.glsl | 15 ++++++++++----- Source/Tests/Data/Expected/Fluid_CS.50.hlsl | 15 ++++++++++----- Source/Tests/Data/Expected/Fluid_CS.msl | 13 +++++++++---- Source/Tests/Data/Input/Fluid_CS.hlsl | 15 ++++++++++----- 6 files changed, 59 insertions(+), 29 deletions(-) diff --git a/Source/Tests/Data/Expected/Fluid_CS.300.glsl b/Source/Tests/Data/Expected/Fluid_CS.300.glsl index 973990d2..3e55cb32 100644 --- a/Source/Tests/Data/Expected/Fluid_CS.300.glsl +++ b/Source/Tests/Data/Expected/Fluid_CS.300.glsl @@ -3,6 +3,13 @@ #extension GL_ARB_separate_shader_objects : require layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; +struct Scene +{ + float wallStiffness; + vec4 gravity; + vec3 planes[4]; +}; + struct Particle { vec2 position; @@ -17,9 +24,7 @@ struct ParticleForces layout(std140) uniform type_cbSimulationConstants { float timeStep; - float wallStiffness; - vec4 gravity; - vec3 planes[4]; + Scene scene; } cbSimulationConstants; layout(std430) buffer type_RWStructuredBuffer_Particle @@ -43,8 +48,8 @@ void main() vec2 _54 = particlesRO._m0[gl_GlobalInvocationID.x].velocity; vec2 _56 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration; vec3 _59 = vec3(_52, 1.0); - float _67 = -cbSimulationConstants.wallStiffness; - vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.planes[0u].xy * (min(dot(_59, cbSimulationConstants.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.planes[1u].xy * (min(dot(_59, cbSimulationConstants.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.planes[2u].xy * (min(dot(_59, cbSimulationConstants.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.planes[3u].xy * (min(dot(_59, cbSimulationConstants.planes[3u]), 0.0) * _67))) + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep); + float _67 = -cbSimulationConstants.scene.wallStiffness; + vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.scene.planes[0u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[1u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[2u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[3u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[3u]), 0.0) * _67))) + cbSimulationConstants.scene.gravity.xy) * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].position = _52 + (_102 * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].velocity = _102; } diff --git a/Source/Tests/Data/Expected/Fluid_CS.310.essl b/Source/Tests/Data/Expected/Fluid_CS.310.essl index 15cf2619..134b8c86 100644 --- a/Source/Tests/Data/Expected/Fluid_CS.310.essl +++ b/Source/Tests/Data/Expected/Fluid_CS.310.essl @@ -1,6 +1,13 @@ #version 310 es layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; +struct Scene +{ + float wallStiffness; + vec4 gravity; + vec3 planes[4]; +}; + struct Particle { vec2 position; @@ -15,9 +22,7 @@ struct ParticleForces layout(binding = 0, std140) uniform type_cbSimulationConstants { float timeStep; - float wallStiffness; - vec4 gravity; - vec3 planes[4]; + Scene scene; } cbSimulationConstants; layout(binding = 0, std430) buffer type_RWStructuredBuffer_Particle @@ -41,8 +46,8 @@ void main() vec2 _54 = particlesRO._m0[gl_GlobalInvocationID.x].velocity; vec2 _56 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration; vec3 _59 = vec3(_52, 1.0); - float _67 = -cbSimulationConstants.wallStiffness; - vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.planes[0u].xy * (min(dot(_59, cbSimulationConstants.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.planes[1u].xy * (min(dot(_59, cbSimulationConstants.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.planes[2u].xy * (min(dot(_59, cbSimulationConstants.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.planes[3u].xy * (min(dot(_59, cbSimulationConstants.planes[3u]), 0.0) * _67))) + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep); + float _67 = -cbSimulationConstants.scene.wallStiffness; + vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.scene.planes[0u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[1u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[2u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[3u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[3u]), 0.0) * _67))) + cbSimulationConstants.scene.gravity.xy) * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].position = _52 + (_102 * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].velocity = _102; } diff --git a/Source/Tests/Data/Expected/Fluid_CS.410.glsl b/Source/Tests/Data/Expected/Fluid_CS.410.glsl index ad246a45..3dea9b7a 100644 --- a/Source/Tests/Data/Expected/Fluid_CS.410.glsl +++ b/Source/Tests/Data/Expected/Fluid_CS.410.glsl @@ -2,6 +2,13 @@ #extension GL_ARB_compute_shader : require layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in; +struct Scene +{ + float wallStiffness; + vec4 gravity; + vec3 planes[4]; +}; + struct Particle { vec2 position; @@ -16,9 +23,7 @@ struct ParticleForces layout(std140) uniform type_cbSimulationConstants { float timeStep; - float wallStiffness; - vec4 gravity; - vec3 planes[4]; + Scene scene; } cbSimulationConstants; layout(std430) buffer type_RWStructuredBuffer_Particle @@ -42,8 +47,8 @@ void main() vec2 _54 = particlesRO._m0[gl_GlobalInvocationID.x].velocity; vec2 _56 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration; vec3 _59 = vec3(_52, 1.0); - float _67 = -cbSimulationConstants.wallStiffness; - vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.planes[0u].xy * (min(dot(_59, cbSimulationConstants.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.planes[1u].xy * (min(dot(_59, cbSimulationConstants.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.planes[2u].xy * (min(dot(_59, cbSimulationConstants.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.planes[3u].xy * (min(dot(_59, cbSimulationConstants.planes[3u]), 0.0) * _67))) + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep); + float _67 = -cbSimulationConstants.scene.wallStiffness; + vec2 _102 = _54 + ((((((_56 + (cbSimulationConstants.scene.planes[0u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[1u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[2u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[3u].xy * (min(dot(_59, cbSimulationConstants.scene.planes[3u]), 0.0) * _67))) + cbSimulationConstants.scene.gravity.xy) * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].position = _52 + (_102 * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].velocity = _102; } diff --git a/Source/Tests/Data/Expected/Fluid_CS.50.hlsl b/Source/Tests/Data/Expected/Fluid_CS.50.hlsl index 5d0456fb..6c773c5f 100644 --- a/Source/Tests/Data/Expected/Fluid_CS.50.hlsl +++ b/Source/Tests/Data/Expected/Fluid_CS.50.hlsl @@ -1,3 +1,10 @@ +struct Scene +{ + float wallStiffness; + float4 gravity; + float3 planes[4]; +}; + struct Particle { float2 position; @@ -12,9 +19,7 @@ struct ParticleForces cbuffer type_cbSimulationConstants : register(b0) { float cbSimulationConstants_timeStep : packoffset(c0); - float cbSimulationConstants_wallStiffness : packoffset(c0.y); - float4 cbSimulationConstants_gravity : packoffset(c1); - float3 cbSimulationConstants_planes[4] : packoffset(c2); + Scene cbSimulationConstants_scene : packoffset(c1); }; RWByteAddressBuffer particlesRW : register(u0); @@ -33,8 +38,8 @@ void comp_main() float2 _54 = asfloat(particlesRO.Load2(gl_GlobalInvocationID.x * 16 + 8)); float2 _56 = asfloat(particlesForcesRO.Load2(gl_GlobalInvocationID.x * 8 + 0)); float3 _59 = float3(_52, 1.0f); - float _67 = -cbSimulationConstants_wallStiffness; - float2 _102 = _54 + ((((((_56 + (cbSimulationConstants_planes[0u].xy * (min(dot(_59, cbSimulationConstants_planes[0u]), 0.0f) * _67))) + (cbSimulationConstants_planes[1u].xy * (min(dot(_59, cbSimulationConstants_planes[1u]), 0.0f) * _67))) + (cbSimulationConstants_planes[2u].xy * (min(dot(_59, cbSimulationConstants_planes[2u]), 0.0f) * _67))) + (cbSimulationConstants_planes[3u].xy * (min(dot(_59, cbSimulationConstants_planes[3u]), 0.0f) * _67))) + cbSimulationConstants_gravity.xy) * cbSimulationConstants_timeStep); + float _67 = -cbSimulationConstants_scene.wallStiffness; + float2 _102 = _54 + ((((((_56 + (cbSimulationConstants_scene.planes[0u].xy * (min(dot(_59, cbSimulationConstants_scene.planes[0u]), 0.0f) * _67))) + (cbSimulationConstants_scene.planes[1u].xy * (min(dot(_59, cbSimulationConstants_scene.planes[1u]), 0.0f) * _67))) + (cbSimulationConstants_scene.planes[2u].xy * (min(dot(_59, cbSimulationConstants_scene.planes[2u]), 0.0f) * _67))) + (cbSimulationConstants_scene.planes[3u].xy * (min(dot(_59, cbSimulationConstants_scene.planes[3u]), 0.0f) * _67))) + cbSimulationConstants_scene.gravity.xy) * cbSimulationConstants_timeStep); particlesRW.Store2(gl_GlobalInvocationID.x * 16 + 0, asuint(_52 + (_102 * cbSimulationConstants_timeStep))); particlesRW.Store2(gl_GlobalInvocationID.x * 16 + 8, asuint(_102)); } diff --git a/Source/Tests/Data/Expected/Fluid_CS.msl b/Source/Tests/Data/Expected/Fluid_CS.msl index 02457339..a30857ed 100644 --- a/Source/Tests/Data/Expected/Fluid_CS.msl +++ b/Source/Tests/Data/Expected/Fluid_CS.msl @@ -3,14 +3,19 @@ using namespace metal; -struct type_cbSimulationConstants +struct Scene { - float timeStep; float wallStiffness; float4 gravity; float3 planes[4]; }; +struct type_cbSimulationConstants +{ + float timeStep; + Scene scene; +}; + struct Particle { float2 position; @@ -43,8 +48,8 @@ kernel void main0(constant type_cbSimulationConstants& cbSimulationConstants [[b float2 _54 = particlesRO._m0[gl_GlobalInvocationID.x].velocity; float2 _56 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration; float3 _59 = float3(_52, 1.0); - float _67 = -cbSimulationConstants.wallStiffness; - float2 _102 = _54 + ((((((_56 + (cbSimulationConstants.planes[0u].xy * (fast::min(dot(_59, cbSimulationConstants.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.planes[1u].xy * (fast::min(dot(_59, cbSimulationConstants.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.planes[2u].xy * (fast::min(dot(_59, cbSimulationConstants.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.planes[3u].xy * (fast::min(dot(_59, cbSimulationConstants.planes[3u]), 0.0) * _67))) + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep); + float _67 = -cbSimulationConstants.scene.wallStiffness; + float2 _102 = _54 + ((((((_56 + (cbSimulationConstants.scene.planes[0u].xy * (fast::min(dot(_59, cbSimulationConstants.scene.planes[0u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[1u].xy * (fast::min(dot(_59, cbSimulationConstants.scene.planes[1u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[2u].xy * (fast::min(dot(_59, cbSimulationConstants.scene.planes[2u]), 0.0) * _67))) + (cbSimulationConstants.scene.planes[3u].xy * (fast::min(dot(_59, cbSimulationConstants.scene.planes[3u]), 0.0) * _67))) + cbSimulationConstants.scene.gravity.xy) * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].position = _52 + (_102 * cbSimulationConstants.timeStep); particlesRW._m0[gl_GlobalInvocationID.x].velocity = _102; } diff --git a/Source/Tests/Data/Input/Fluid_CS.hlsl b/Source/Tests/Data/Input/Fluid_CS.hlsl index eb5ca57b..7bb07441 100644 --- a/Source/Tests/Data/Input/Fluid_CS.hlsl +++ b/Source/Tests/Data/Input/Fluid_CS.hlsl @@ -12,15 +12,20 @@ struct ParticleForces float2 acceleration; }; -cbuffer cbSimulationConstants : register(b0) +struct Scene { - float timeStep; float wallStiffness; float4 gravity; float3 planes[4]; }; +cbuffer cbSimulationConstants : register(b0) +{ + float timeStep; + Scene scene; +}; + RWStructuredBuffer particlesRW : register(u0); StructuredBuffer particlesRO : register(t0); @@ -38,11 +43,11 @@ void main(uint3 dtid : SV_DispatchThreadID, uint gi : SV_GroupIndex) [unroll] for (uint i = 0 ; i < 4 ; ++i) { - float dist = dot(float3(position, 1), planes[i]); - acceleration += min(dist, 0) * -wallStiffness * planes[i].xy; + float dist = dot(float3(position, 1), scene.planes[i]); + acceleration += min(dist, 0) * -scene.wallStiffness * scene.planes[i].xy; } - acceleration += gravity.xy; + acceleration += scene.gravity.xy; velocity += timeStep * acceleration; position += timeStep * velocity; From 1832c1812fd75a9db9e2094933a6f94db208b04a Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Sat, 20 Nov 2021 12:31:52 -0800 Subject: [PATCH 4/4] [Test] Refactor test code --- Source/Tests/CMakeLists.txt | 10 ++- Source/Tests/Common.cpp | 88 +++++++++++++++++++ Source/Tests/Common.hpp | 40 +++++++++ ...ConductorTest.cpp => CrossCompileTest.cpp} | 57 +----------- 4 files changed, 138 insertions(+), 57 deletions(-) create mode 100644 Source/Tests/Common.cpp create mode 100644 Source/Tests/Common.hpp rename Source/Tests/{ShaderConductorTest.cpp => CrossCompileTest.cpp} (92%) diff --git a/Source/Tests/CMakeLists.txt b/Source/Tests/CMakeLists.txt index c3dff849..efdc05cc 100644 --- a/Source/Tests/CMakeLists.txt +++ b/Source/Tests/CMakeLists.txt @@ -3,8 +3,13 @@ set(EXE_NAME ShaderConductorTest) +set(HEADER_FILES + Common.hpp +) + set(SOURCE_FILES - ShaderConductorTest.cpp + Common.cpp + CrossCompileTest.cpp ) set(DATA_INC_FILES @@ -38,11 +43,12 @@ set_source_files_properties(${DATA_FILES} PROPERTIES VS_TOOL_OVERRIDE "None" ) +source_group("Header Files" FILES ${HEADER_FILES}) source_group("Source Files" FILES ${SOURCE_FILES}) source_group("Data Files\\Input" FILES ${DATA_FILES}) source_group("Data Files\\Input\\Inc" FILES ${DATA_INC_FILES}) -add_executable(${EXE_NAME} ${SOURCE_FILES} ${DATA_FILES} ${DATA_INC_FILES}) +add_executable(${EXE_NAME} ${HEADER_FILES} ${SOURCE_FILES} ${DATA_FILES} ${DATA_INC_FILES}) target_compile_definitions(${EXE_NAME} PRIVATE diff --git a/Source/Tests/Common.cpp b/Source/Tests/Common.cpp new file mode 100644 index 00000000..e85c6fa7 --- /dev/null +++ b/Source/Tests/Common.cpp @@ -0,0 +1,88 @@ +/* + * ShaderConductor + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE + * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "Common.hpp" + +#include + +#include +#include +#include + +namespace ShaderConductor +{ + std::vector LoadFile(const std::string& name, bool isText) + { + std::vector ret; + std::ios_base::openmode mode = std::ios_base::in; + if (!isText) + { + mode |= std::ios_base::binary; + } + std::ifstream file(name, mode); + if (file) + { + file.seekg(0, std::ios::end); + ret.resize(static_cast(file.tellg())); + file.seekg(0, std::ios::beg); + file.read(reinterpret_cast(ret.data()), ret.size()); + ret.resize(static_cast(file.gcount())); + } + return ret; + } + + void CompareWithExpected(const std::vector& actual, bool isText, const std::string& compareName) + { + std::vector expected = LoadFile(TEST_DATA_DIR "Expected/" + compareName, isText); + if (expected != actual) + { + if (!actual.empty()) + { + std::ios_base::openmode mode = std::ios_base::out; + if (!isText) + { + mode |= std::ios_base::binary; + } + std::ofstream actualFile(TEST_DATA_DIR "Result/" + compareName, mode); + actualFile.write(reinterpret_cast(actual.data()), actual.size()); + } + } + + EXPECT_EQ(std::string(expected.begin(), expected.end()), std::string(actual.begin(), actual.end())); + } +} // namespace ShaderConductor + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + + int retVal = RUN_ALL_TESTS(); + if (retVal != 0) + { + getchar(); + } + + return retVal; +} diff --git a/Source/Tests/Common.hpp b/Source/Tests/Common.hpp new file mode 100644 index 00000000..d5876af8 --- /dev/null +++ b/Source/Tests/Common.hpp @@ -0,0 +1,40 @@ +/* + * ShaderConductor + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE + * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef SHADER_CONDUCTOR_TEST_COMMON_HPP +#define SHADER_CONDUCTOR_TEST_COMMON_HPP + +#pragma once + +#include +#include + +namespace ShaderConductor +{ + std::vector LoadFile(const std::string& name, bool isText); + void CompareWithExpected(const std::vector& actual, bool isText, const std::string& compareName); +} // namespace ShaderConductor + +#endif diff --git a/Source/Tests/ShaderConductorTest.cpp b/Source/Tests/CrossCompileTest.cpp similarity index 92% rename from Source/Tests/ShaderConductorTest.cpp rename to Source/Tests/CrossCompileTest.cpp index e5763529..0e6ad830 100644 --- a/Source/Tests/ShaderConductorTest.cpp +++ b/Source/Tests/CrossCompileTest.cpp @@ -25,10 +25,10 @@ #include +#include "Common.hpp" + #include -#include -#include #include #include #include @@ -37,46 +37,6 @@ using namespace ShaderConductor; namespace { - std::vector LoadFile(const std::string& name, bool isText) - { - std::vector ret; - std::ios_base::openmode mode = std::ios_base::in; - if (!isText) - { - mode |= std::ios_base::binary; - } - std::ifstream file(name, mode); - if (file) - { - file.seekg(0, std::ios::end); - ret.resize(static_cast(file.tellg())); - file.seekg(0, std::ios::beg); - file.read(reinterpret_cast(ret.data()), ret.size()); - ret.resize(static_cast(file.gcount())); - } - return ret; - } - - void CompareWithExpected(const std::vector& actual, bool isText, const std::string& compareName) - { - std::vector expected = LoadFile(TEST_DATA_DIR "Expected/" + compareName, isText); - if (expected != actual) - { - if (!actual.empty()) - { - std::ios_base::openmode mode = std::ios_base::out; - if (!isText) - { - mode |= std::ios_base::binary; - } - std::ofstream actualFile(TEST_DATA_DIR "Result/" + compareName, mode); - actualFile.write(reinterpret_cast(actual.data()), actual.size()); - } - } - - EXPECT_EQ(std::string(expected.begin(), expected.end()), std::string(actual.begin(), actual.end())); - } - void HlslToAnyTest(const std::string& name, const Compiler::SourceDesc& source, const Compiler::Options& options, const std::vector& targets, const std::vector& expectSuccessFlags) { @@ -642,16 +602,3 @@ namespace } } } // namespace - -int main(int argc, char** argv) -{ - testing::InitGoogleTest(&argc, argv); - - int retVal = RUN_ALL_TESTS(); - if (retVal != 0) - { - getchar(); - } - - return retVal; -}