Skip to content

Commit 0d8a809

Browse files
committed
Merge branch 'main' of github.com:microsoft/DirectXShaderCompiler
2 parents d8ad66e + 6e44415 commit 0d8a809

File tree

1,929 files changed

+127957
-89304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,929 files changed

+127957
-89304
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug Report
3+
about: Report an issue with DXC
4+
title: ''
5+
labels: ['bug', 'needs-triage']
6+
assignees: ''
7+
8+
---
9+
10+
**Description**
11+
<!--- Please provide a few sentences describing the issue you encountered. --->
12+
13+
**Steps to Reproduce**
14+
<!--- Provide a description of how to reproduce the error. If possible please
15+
provide source and tool command line options. If the issue reproduces on
16+
Compiler Explorer (https://godbolt.org/) or Shader Playground
17+
(https://shader-playground.timjones.io/) please provide a link. If the source is
18+
split across multiple files, please preprocess into a single file using DXC's
19+
command line `-P -Fi <path>`. --->
20+
21+
22+
**Actual Behavior**
23+
<!--- Please provide error output or a description of the observed issue. --->
24+
25+
**Environment**
26+
- DXC version <!-- replace with the output of 'dxc --version' -->
27+
- Host Operating System <!--- Host operating system and version --->
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: SPIR-V Bug Report
3+
about: Report an issue with DXC SPIR-V generation
4+
title: '[SPIR-V]'
5+
labels: ['bug', 'spirv', 'needs-triage']
6+
assignees: ''
7+
8+
---
9+
10+
**Description**
11+
<!--- Please provide a few sentences describing the issue you encountered. --->
12+
13+
**Steps to Reproduce**
14+
<!--- Provide a description of how to reproduce the error. If possible please
15+
provide source and tool command line options. If the issue reproduces on
16+
Compiler Explorer (https://godbolt.org/) or Shader Playground
17+
(https://shader-playground.timjones.io/) please provide a link. If the source is
18+
split across multiple files, please preprocess into a single file using DXC's
19+
command line `-P -Fi <path>`. --->
20+
21+
22+
**Actual Behavior**
23+
<!--- Please provide error output or a description of the observed issue. --->
24+
25+
**Environment**
26+
- DXC version <!-- replace with the output of 'dxc --version' -->
27+
- Host Operating System <!--- Host operating system and version --->
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[Feature Request]'
5+
labels: ['enhancement', 'needs-triage']
6+
assignees: ''
7+
8+
---
9+
10+
<!--- If this is a language feature request please file the issue against the
11+
hlsl-specs repository: https://github.com/microsoft/hlsl-specs/issues/new --->
12+
13+
**Is your feature request related to a problem? Please describe.**
14+
Describe the problem that led you to request this feature in as much detail as you can.
15+
16+
**Describe the solution you'd like**
17+
A clear and concise description of what you want to happen.
18+
19+
**Describe alternatives you've considered**
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
**Additional context**
23+
Add any other context or screenshots about the feature request here.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Check code formatting"
2+
on: pull_request_target
3+
permissions:
4+
pull-requests: write
5+
6+
jobs:
7+
code_formatter:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Fetch LLVM sources
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 2
14+
15+
- name: Get changed files
16+
id: changed-files
17+
uses: tj-actions/changed-files@v39
18+
with:
19+
separator: ","
20+
fetch_depth: 100 # Fetches only the last 10 commits
21+
22+
- name: "Listed files"
23+
run: |
24+
echo "Formatting files:"
25+
echo "${{ steps.changed-files.outputs.all_changed_files }}"
26+
27+
- name: Install clang-format
28+
uses: aminya/setup-cpp@v1
29+
with:
30+
clangformat: 17.0.1
31+
32+
- name: Setup Python env
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: '3.11'
36+
cache: 'pip'
37+
cache-dependency-path: 'utils/git/requirements_formatting.txt'
38+
39+
- name: Install python dependencies
40+
run: pip install -r utils/git/requirements_formatting.txt
41+
42+
- name: Run code formatter
43+
env:
44+
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
45+
START_REV: ${{ github.event.pull_request.base.sha }}
46+
END_REV: ${{ github.event.pull_request.head.sha }}
47+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
48+
run: |
49+
python utils/git/code-format-helper.py \
50+
--token ${{ secrets.GITHUB_TOKEN }} \
51+
--issue-number $GITHUB_PR_NUMBER \
52+
--start-rev $START_REV \
53+
--end-rev $END_REV \
54+
--changed-files "$CHANGED_FILES"

.github/workflows/coverage-gh-pages.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
# Build job
2323
build:
2424
runs-on: ubuntu-latest
25+
if: github.repository == 'microsoft/DirectXShaderCompiler'
2526
timeout-minutes: 240
2627
steps:
2728
- name: Checkout
@@ -33,13 +34,15 @@ jobs:
3334
- name: Install dependencies
3435
run: sudo apt install -y ninja-build
3536
- name: Configure
36-
run: cmake -B build -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_USE_LIT=On -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
37+
run: cmake -B build -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
3738
- name: Build
3839
run: ninja -C build test-depends
3940
- name: Test
4041
run: ninja -C build check-all
4142
- name: Generate Report
4243
run: ninja -C build generate-coverage-report
44+
- name: Force artifact permissions
45+
run: chmod -c -R +rX ${{github.workspace}}/build/report
4346
- name: Upload artifact
4447
uses: actions/upload-pages-artifact@v1
4548
with:
@@ -52,6 +55,7 @@ jobs:
5255
name: github-pages
5356
url: ${{ steps.deployment.outputs.page_url }}
5457
runs-on: ubuntu-latest
58+
if: github.repository == 'microsoft/DirectXShaderCompiler'
5559
needs: build
5660
steps:
5761
- name: Deploy to GitHub Pages
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: 'PR description checker'
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- edited
7+
- reopened
8+
- labeled
9+
- unlabeled
10+
jobs:
11+
check-pr-description:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: jadrol/[email protected]
16+
id: description-checker
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.vs/launch.vs.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# See docs/CMake.html for instructions about how to build LLVM with CMake.
2-
cmake_minimum_required(VERSION 3.10) # HLSL Change - Require CMake 3.10.
2+
cmake_minimum_required(VERSION 3.17.2) # HLSL Change - Require CMake 3.17.2.
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
36

47
if (NOT "${DXC_CMAKE_BEGINS_INCLUDE}" STREQUAL "")
58
include(${DXC_CMAKE_BEGINS_INCLUDE})
@@ -101,6 +104,9 @@ if ( HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO )
101104
add_definitions(-DSUPPORT_QUERY_GIT_COMMIT_INFO)
102105
endif()
103106

107+
option(DXC_DISABLE_ALLOCATOR_OVERRIDES "Disable usage of allocator overrides" OFF)
108+
mark_as_advanced(DXC_DISABLE_ALLOCATOR_OVERRIDES)
109+
104110
# adjust link option to enable debugging from kernel mode; not compatible with incremental linking
105111
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND WIN32 AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC")
106112
add_link_options(/DEBUGTYPE:CV,FIXUP,PDATA /INCREMENTAL:NO)
@@ -112,6 +118,11 @@ add_compile_options(/guard:cf)
112118
add_link_options(/guard:cf)
113119
endif(WIN32)
114120

121+
# Enable CET Shadow Stack
122+
if(WIN32 AND NOT (CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*"))
123+
add_link_options(/CETCOMPAT)
124+
endif()
125+
115126
# HLSL Change Ends
116127

117128
# HLSL Change Starts - set flag for Appveyor CI
@@ -388,6 +399,8 @@ option(LLVM_BUILD_TESTS
388399
"Build LLVM unit tests. If OFF, just generate build targets." OFF)
389400
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
390401

402+
option(HLSL_INCLUDE_TESTS "Generate build targets for the HLSL unit tests." ON)
403+
391404
option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF)
392405
option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON)
393406
option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OFF)
@@ -564,6 +577,9 @@ configure_file(
564577
configure_file(
565578
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake
566579
${LLVM_INCLUDE_DIR}/llvm/Config/llvm-config.h)
580+
configure_file(
581+
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/abi-breaking.h.cmake
582+
${LLVM_INCLUDE_DIR}/llvm/Config/abi-breaking.h)
567583
configure_file(
568584
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake
569585
${LLVM_INCLUDE_DIR}/llvm/Support/DataTypes.h)
@@ -788,6 +804,26 @@ endif()
788804

789805
include(CoverageReport)
790806

807+
# HLSL Change begin - Set default distribution value.
808+
set(LLVM_DISTRIBUTION_COMPONENTS "dxc;dxcompiler;dxc-headers" CACHE STRING "")
809+
# HLSL Change end - Set default distribution value.
810+
811+
# This must be at the end of the LLVM root CMakeLists file because it must run
812+
# after all targets are created.
813+
if(LLVM_DISTRIBUTION_COMPONENTS)
814+
# HLSL Change - Deleted restriction for non-IDE builds. This works with Visual
815+
# Studio for DXC because of the limited number of targets.
816+
817+
add_custom_target(install-distribution)
818+
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
819+
if(TARGET install-${target})
820+
add_dependencies(install-distribution install-${target})
821+
else()
822+
message(FATAL_ERROR "Specified distribution component '${target}' doesn't have an install target")
823+
endif()
824+
endforeach()
825+
endif()
826+
791827
# Disable regeneration target for official builds as they always fun a full clean build.
792828
# This should eliminate the race-condition issue with "Cannot restore timestamp".
793829
if (HLSL_OFFICIAL_BUILD)

CMakeSettings.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "x64-Release",
5+
"generator": "Ninja",
6+
"configurationType": "RelWithDebInfo",
7+
"buildRoot": "${projectDir}\\out\\build\\${name}",
8+
"installRoot": "${projectDir}\\out\\install\\${name}",
9+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
10+
"buildCommandArgs": "-v",
11+
"ctestCommandArgs": "",
12+
"inheritEnvironments": [ "msvc_x64_x64" ]
13+
},
14+
{
15+
"name": "x64-Debug",
16+
"generator": "Ninja",
17+
"configurationType": "Debug",
18+
"buildRoot": "${projectDir}\\out\\build\\${name}",
19+
"installRoot": "${projectDir}\\out\\install\\${name}",
20+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
21+
"buildCommandArgs": "-v",
22+
"ctestCommandArgs": "",
23+
"inheritEnvironments": [ "msvc_x64_x64" ]
24+
},
25+
{
26+
"name": "x64-clang-cl-Release",
27+
"generator": "Ninja",
28+
"configurationType": "RelWithDebInfo",
29+
"buildRoot": "${projectDir}\\out\\build\\${name}",
30+
"installRoot": "${projectDir}\\out\\install\\${name}",
31+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
32+
"buildCommandArgs": "-v",
33+
"ctestCommandArgs": "",
34+
"inheritEnvironments": [ "clang_cl_x64_x64" ]
35+
},
36+
{
37+
"name": "x64-clang-cl-Debug",
38+
"generator": "Ninja",
39+
"configurationType": "Debug",
40+
"buildRoot": "${projectDir}\\out\\build\\${name}",
41+
"installRoot": "${projectDir}\\out\\install\\${name}",
42+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
43+
"buildCommandArgs": "-v",
44+
"ctestCommandArgs": "",
45+
"inheritEnvironments": [ "clang_cl_x64_x64" ]
46+
},
47+
{
48+
"name": "x86-Release",
49+
"generator": "Ninja",
50+
"configurationType": "RelWithDebInfo",
51+
"buildRoot": "${projectDir}\\out\\build\\${name}",
52+
"installRoot": "${projectDir}\\out\\install\\${name}",
53+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
54+
"buildCommandArgs": "-v",
55+
"ctestCommandArgs": "",
56+
"inheritEnvironments": [ "msvc_x86_x64" ]
57+
},
58+
{
59+
"name": "x86-Debug",
60+
"generator": "Ninja",
61+
"configurationType": "Debug",
62+
"buildRoot": "${projectDir}\\out\\build\\${name}",
63+
"installRoot": "${projectDir}\\out\\install\\${name}",
64+
"cmakeCommandArgs": "-C ${projectDir}\\cmake\\caches\\PredefinedParams.cmake -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_LIT_ARGS=\"-v\"",
65+
"buildCommandArgs": "-v",
66+
"ctestCommandArgs": "",
67+
"inheritEnvironments": [ "msvc_x86_x64" ]
68+
}
69+
]
70+
}

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You will need to complete a Contributor License Agreement (CLA) before your pull
3434

3535
You can complete the CLA by going through the steps at the [Contribution License Agreement site](https://cla.microsoft.com). Once we have received the signed CLA, we'll review the request. You will only need to do this once.
3636

37-
Make sure you can build the code. Familiarize yourself with the project workflow and our coding conventions. If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests. The hctcheckin command is your friend.
37+
Make sure you can build the code. Familiarize yourself with the project workflow and our coding conventions. If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests. The hcttest command is your friend.
3838

3939
Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. You might also read these two blogs posts on contributing code: [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza and [Don't "Push" Your Pull Requests](https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik. Note that all code submissions will be rigorously reviewed and tested by the team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.
4040

@@ -44,6 +44,8 @@ Here's a few things you should always do when making changes to the code base:
4444

4545
The coding, style, and general engineering guidelines follow those described in the docs/CodingStandards.rst. For additional guidelines in code specific to HLSL, see the docs/HLSLChanges.rst file.
4646

47+
DXC has adopted a clang-format requirement for all incoming changes. PRs to DXC should have the _changed code_ clang formatted to the LLVM style, and leave the remaining portions of the file unchanged. This can be done using the `git-clang-format` tool or IDE driven workflows. A GitHub action will run on all PRs to validate that the change is properly formatted.
48+
4749
**Commit/Pull Request Format**
4850

4951
```

0 commit comments

Comments
 (0)