Skip to content

Commit 4621c70

Browse files
committed
Merge branch 'devshFixes' of github.com:Devsh-Graphics-Programming/DirectXShaderCompiler into devshFixes_clang_19_1_1
2 parents 49b89ae + 5ab4d36 commit 4621c70

File tree

290 files changed

+30171
-7513
lines changed

Some content is hidden

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

290 files changed

+30171
-7513
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @microsoft/hlsl-release
1+
# Uncomment the next line in release branches after ask-mode begins
2+
# * @microsoft/hlsl-release

.github/workflows/clang-format-checker.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@ jobs:
1313
pull-requests: write
1414
steps:
1515
- name: Fetch LLVM sources
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
with:
18-
fetch-depth: 2
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- name: Checkout through merge base
21+
uses: rmacklin/fetch-through-merge-base@bfe4d03a86f9afa52bc1a70e9814fc92a07f7b75 # v0.3.0
22+
with:
23+
base_ref: ${{ github.event.pull_request.base.ref }}
24+
head_ref: ${{ github.event.pull_request.head.sha }}
25+
deepen_length: 500
1926

2027
- name: Get changed files
2128
id: changed-files
22-
uses: tj-actions/changed-files@v41
29+
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
2330
with:
2431
separator: ","
25-
fetch_depth: 100 # Fetches only the last 10 commits
32+
skip_initial_fetch: true
2633

2734
- name: "Listed files"
2835
env:

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
timeout-minutes: 240
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030
with:
3131
submodules: true
3232
- name: Setup Pages
33-
uses: actions/configure-pages@v2
33+
uses: actions/configure-pages@v5
3434
- name: Install dependencies
3535
run: sudo apt install -y ninja-build
3636
- name: Configure
@@ -44,7 +44,7 @@ jobs:
4444
- name: Force artifact permissions
4545
run: chmod -c -R +rX ${{github.workspace}}/build/report
4646
- name: Upload artifact
47-
uses: actions/upload-pages-artifact@v1
47+
uses: actions/upload-pages-artifact@v3
4848
with:
4949
path: ${{github.workspace}}/build/report
5050

@@ -60,4 +60,4 @@ jobs:
6060
steps:
6161
- name: Deploy to GitHub Pages
6262
id: deployment
63-
uses: actions/deploy-pages@v1
63+
uses: actions/deploy-pages@v4

CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ if(POLICY CMP0022)
1919
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
2020
endif()
2121

22-
if (POLICY CMP0051)
23-
# CMake 3.1 and higher include generator expressions of the form
24-
# $<TARGETLIB:obj> in the SOURCES property. These need to be
25-
# stripped everywhere that access the SOURCES property, so we just
26-
# defer to the OLD behavior of not including generator expressions
27-
# in the output for now.
28-
cmake_policy(SET CMP0051 OLD)
29-
endif()
30-
3122
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
3223
set(cmake_3_2_USES_TERMINAL)
3324
else()
@@ -696,6 +687,8 @@ add_subdirectory(include/dxc)
696687
# really depend on anything else in the build it is safe.
697688
list(APPEND LLVM_COMMON_DEPENDS HCTGen)
698689

690+
add_subdirectory(utils/hct)
691+
699692
if(EXISTS "${LLVM_MAIN_SRC_DIR}/external")
700693
add_subdirectory(external) # SPIRV change
701694
endif()
@@ -779,9 +772,7 @@ if (LLVM_INCLUDE_DOCS)
779772
add_subdirectory(docs)
780773
endif()
781774

782-
if (LLVM_BUILD_DOCS)
783-
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
784-
endif()
775+
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
785776

786777
add_subdirectory(cmake/modules)
787778

CONTRIBUTING.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,32 @@ Before submitting a feature or substantial code contribution please discuss it w
4040

4141
### Coding guidelines
4242

43-
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.
43+
The coding, style, and general engineering guidelines follow those described in the [LLVM Coding Standards](docs/CodingStandards.rst). For additional guidelines in code specific to HLSL, see the [HLSL Changes](docs/HLSLChanges.rst) docs.
4444

4545
DXC has adopted a clang-format requirement for all incoming changes to C and C++ files. 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.
4646

47+
#### Applying LLVM Standards
48+
49+
All new code contributed to DXC should follow the LLVM coding standards.
50+
51+
Note that the LLVM Coding Standards have a golden rule:
52+
53+
> **If you are extending, enhancing, or bug fixing already implemented code, use the style that is already being used so that the source is uniform and easy to follow.**
54+
55+
The golden rule should continue to be applied to places where DXC is self-consistent. A good example is DXC's common use of `PascalCase` instead of `camelCase` for APIs in some parts of the HLSL implementation. In any place where DXC is not self-consistent new code should follow the LLVM Coding Standard.
56+
57+
A good secondary rule to follow is:
58+
59+
> **When in doubt, follow LLVM.**
60+
61+
Adopting LLVM's coding standards provides a consistent set of rules and guidelines to hold all contributions to. This allows patch authors to clearly understand the expectations placed on contributions, and allows reviewers to have a bar to measure contributions against. Aligning with LLVM by default ensures the path of least resistance for everyone.
62+
63+
Since many of the LLVM Coding Standards are not enforced automatically we rely on code reviews to provide feedback and ensure contributions align with the expected coding standards. Since we rely on reviewers for enforcement and humans make mistakes, please keep in mind:
64+
65+
> **Code review is a conversation.**
66+
67+
It is completely reasonable for a patch author to question feedback and provide additional context about why something was done the way it was. Reviewers often see narrow slices in diffs rather than the full context of a file or part of the compiler, so they may not always provide perfect feedback. This is especially true with the application of the "golden rule" since it depends on understanding a wider context.
68+
4769
### Documenting Pull Requests
4870

4971
Pull request descriptions should have the following format:

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ Development kits containing only the dxc.exe driver app, the dxcompiler.dll, and
3434

3535
As an example of community contribution, this project can also target the [SPIR-V](https://www.khronos.org/registry/spir-v/) intermediate representation. Please see the [doc](docs/SPIR-V.rst) for how HLSL features are mapped to SPIR-V, and the [wiki](https://github.com/microsoft/DirectXShaderCompiler/wiki/SPIR%E2%80%90V-CodeGen) page for how to build, use, and contribute to the SPIR-V CodeGen.
3636

37+
### Metal CodeGen
38+
39+
When built from source DXC can utilize the [Metal Shader
40+
Converter](https://developer.apple.com/metal/shader-converter/) if it is
41+
available during build and configuration time. This allows DXC to generate Metal
42+
shader libraries directly using the `-metal` flag.
43+
44+
Note: DXC cannot currently disassemble Metal shaders so the `-Fc` flag cannot be
45+
used in conjunction with the `-Fo` flag.
46+
3747
## Building Sources
3848

3949
See the full documentation for [Building and testing DXC](docs/BuildingAndTestingDXC.rst) for detailed instructions.

cmake/config-ix.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,12 @@ else()
568568
endif()
569569

570570
string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}")
571+
572+
# HLSL Change Begin - Metal IR Converter
573+
find_package(MetalIRConverter)
574+
if (METAL_IRCONVERTER_FOUND)
575+
set(ENABLE_METAL_CODEGEN On)
576+
message(STATUS "Enabling Metal Support")
577+
add_definitions(-DENABLE_METAL_CODEGEN)
578+
endif()
579+
# HLSL Change End - Metal IR Converter
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
find_path(METAL_IRCONVERTER_INCLUDE_DIR metal_irconverter.h
2+
HINTS /usr/local/include/metal_irconverter
3+
DOC "Path to metal IR converter headers"
4+
)
5+
6+
find_library(METAL_IRCONVERTER_LIB NAMES metalirconverter
7+
PATH_SUFFIXES lib
8+
)
9+
10+
include(FindPackageHandleStandardArgs)
11+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(METAL_IRCONVERTER
12+
REQUIRED_VARS METAL_IRCONVERTER_LIB METAL_IRCONVERTER_INCLUDE_DIR)
13+
14+
message(STATUS "Metal IR Converter Include Dir: ${METAL_IRCONVERTER_INCLUDE_DIR}")
15+
message(STATUS "Metal IR Converter Library: ${METAL_IRCONVERTER_LIB}")
16+
mark_as_advanced(METAL_IRCONVERTER_LIB METAL_IRCONVERTER_INCLUDE_DIR)

0 commit comments

Comments
 (0)