Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS2022 support #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions BuildAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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)
Expand All @@ -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))
Expand All @@ -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\""
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions CI/AzurePipelines/ContinuousBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions External/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.")
Expand Down
10 changes: 7 additions & 3 deletions External/DirectXShaderCompiler.cmake
Original file line number Diff line number Diff line change
@@ -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})

Expand Down Expand Up @@ -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"
Expand All @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion External/SPIRV-Cross.cmake
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion External/SPIRV-Header.cmake
Original file line number Diff line number Diff line change
@@ -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})

Expand Down
16 changes: 13 additions & 3 deletions External/SPIRV-Tools.cmake
Original file line number Diff line number Diff line change
@@ -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 "")
Expand Down
67 changes: 26 additions & 41 deletions Source/Tests/Data/Expected/CalcLight+Diffuse.Debug.dxilasm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
;
Expand Down Expand Up @@ -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)
;
; }
;
Expand All @@ -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

Expand Down Expand Up @@ -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}
67 changes: 26 additions & 41 deletions Source/Tests/Data/Expected/CalcLight+Diffuse.Release.dxilasm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
;
Expand Down Expand Up @@ -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)
;
; }
;
Expand All @@ -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

Expand Down Expand Up @@ -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}
Loading