Skip to content

Commit 2a0f996

Browse files
committed
Merge branch 'main' of github.com:microsoft/DirectXShaderCompiler into devshFixes
2 parents 2438c44 + 00cd823 commit 2a0f996

File tree

272 files changed

+8178
-1475
lines changed

Some content is hidden

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

272 files changed

+8178
-1475
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @microsoft/hlsl-release

.github/ISSUE_TEMPLATE/support.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: User support
3+
about: Ask the maintainers a question or for support.
4+
title: ''
5+
labels: ['user-support', 'needs-triage']
6+
assignees: ''
7+
8+
---
9+
10+
**What is the issue you're encountering?**
11+
<!--- Please provide a few sentences describing the issue you encountered. --->
12+
13+
**Steps to Reproduce (if applicable)**
14+
<!--- If you're encountering a problem, please provide a description of how you
15+
got to the state you're in. If possible please provide source and tool command
16+
line options. If the issue reproduces on Compiler Explorer
17+
(https://godbolt.org/) or Shader Playground
18+
(https://shader-playground.timjones.io/) please provide a link. If the source is
19+
split across multiple files, please preprocess into a single file using DXC's
20+
command line `-P -Fi <path>`.--->
21+
22+
23+
**Environment**
24+
- DXC version <!-- replace with the output of 'dxc --version' -->
25+
- Host Operating System <!--- Host operating system and version --->
26+
27+
<!--- If this is a build issue please include CMake version, compiler and
28+
version, and the CMake invocation used to configure your build directory. --->

README.md

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -34,58 +34,7 @@ As an example of community contribution, this project can also target the [SPIR-
3434

3535
## Building Sources
3636

37-
Building DXC requires:
38-
39-
* [Git](http://git-scm.com/downloads).
40-
* [Python](https://www.python.org/downloads/) - version 3.x is required
41-
* [CMake](https://cmake.org/download/) - version >= 3.17.2
42-
* The bundled version with Visual Studio works for Windows.
43-
* The C++ 14 compiler and runtime of your choosing.
44-
* DXC is known to compile with recent versions of GCC, Clang and MSVC.
45-
46-
Building on windows additionally requires:
47-
48-
* [Visual Studio 2019 or later](https://www.visualstudio.com/downloads) - select the following workloads:
49-
* Universal Windows Platform Development
50-
* Desktop Development with C++
51-
* [Windows SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) - version 10.0.18362.0 or newer
52-
* [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) - same version as the SDK
53-
54-
> A new experimental simplified build and test workflow is documented [here](docs/BuildingAndTestingDXC.rst).
55-
56-
57-
Before you build, you will need to have some additional software installed. This is the most straightforward path - see [Building Sources](https://github.com/microsoft/DirectXShaderCompiler/wiki/Building-Sources) on the Wiki for more options, including Visual Studio 2015 and Ninja support.
58-
59-
* [Git](http://git-scm.com/downloads).
60-
* [Python](https://www.python.org/downloads/) - version 3.x is required
61-
* [Visual Studio 2019](https://www.visualstudio.com/downloads) - select the following workloads:
62-
* Universal Windows Platform Development
63-
* Desktop Development with C++
64-
* [Windows SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) - version 10.0.18362.0 or newer
65-
* [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) - same version as the SDK
66-
67-
After cloning the project, you can set up a build environment shortcut by double-clicking the `utils\hct\hctshortcut.js` file. This will create a shortcut on your desktop with a default configuration. If your system doesn't have the requisite association for .js files, this may not work. If so, open a cmd window and invoke: `wscript.exe utils\hct\hctshortcut.js`.
68-
69-
Tests are built using the TAEF framework which is included in the Windows Driver Kit.
70-
71-
To build, run this command on the HLSL Console.
72-
73-
hctbuild
74-
75-
You can also run tests with this command.
76-
77-
hcttest
78-
79-
80-
To see a list of additional commands available, run `hcthelp`
81-
82-
## Running Tests
83-
84-
To run tests, open the HLSL Console and run this command after a successful build.
85-
86-
hcttest
87-
88-
Some tests will run shaders and verify their behavior. These tests also involve a driver that can execute these shaders. See the next section on how this should be currently set up.
37+
See the full documentation for [Building and testing DXC](docs/BuildingAndTestingDXC.rst) for detailed instructions.
8938

9039
## Running Shaders
9140

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ stages:
5353
configuration: Release
5454
CC: clang
5555
CXX: clang++
56-
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_SANITIZER=Address,Undefined -DLLVM_ENABLE_LIBCXX=On -DLLVM_USE_LINKER=lld
56+
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_SANITIZER='Address;Undefined' -DLLVM_ENABLE_LIBCXX=On -DLLVM_USE_LINKER=lld
5757
CHECK_ALL_ENV: ASAN_OPTIONS=alloc_dealloc_mismatch=0
5858
OS: Linux
5959
Linux_Clang_Debug:

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,16 @@ if(LLVM_USE_SANITIZER)
532532
elseif (LLVM_USE_SANITIZER STREQUAL "Address;Undefined" OR
533533
LLVM_USE_SANITIZER STREQUAL "Undefined;Address")
534534
append_common_sanitizer_flags()
535-
append("-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all"
535+
append("-fsanitize=address,undefined -fno-sanitize=vptr,function,alignment -fno-sanitize-recover=all"
536536
CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
537537
else()
538-
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
538+
message(FATAL_ERROR "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
539539
endif()
540540
else()
541541
if (LLVM_USE_SANITIZER STREQUAL "Address")
542542
append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
543543
else()
544-
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
544+
message(FATAL_ERROR "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
545545
endif()
546546
endif()
547547
if (LLVM_USE_SANITIZE_COVERAGE)

docs/BuildingAndTestingDXC.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ generator. In subsequent sections we will describe workflows using Ninja and
2121
Visual Studio. The Ninja workflow should also apply to makefile generators with
2222
minimal adaption.
2323

24+
Prerequisites
25+
-------------
26+
27+
* [Git](http://git-scm.com/downloads).
28+
* [Python](https://www.python.org/downloads/) - version 3.x is required
29+
* [CMake](https://cmake.org/download/) - version >= 3.17.2
30+
* The bundled version with Visual Studio works for Windows.
31+
* The C++ 14 compiler and runtime of your choosing.
32+
* DXC is known to compile with recent versions of GCC, Clang and MSVC.
33+
34+
Building on windows additionally requires:
35+
36+
* [Visual Studio 2019 or later](https://www.visualstudio.com/downloads) - select the following workloads:
37+
* Universal Windows Platform Development
38+
* Desktop Development with C++
39+
* [Windows SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) - version 10.0.18362.0 or newer
40+
* [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) - same version as the SDK
41+
42+
Note: DXC uses submodules for some external dependencies. You must initialize
43+
the submodules in order to build DXC:
44+
45+
.. code-block:: sh
46+
git submodule update --init --recursive
47+
2448
Basic CMake Usage
2549
-----------------
2650

@@ -149,3 +173,33 @@ four commonly used option prefixes:
149173
code coverage reports. With this setting enabled the
150174
``generate-coverage-report`` target is added to the build which produces a
151175
static HTML page with code coverage analysis results.
176+
177+
Legacy Windows Build Tooling
178+
----------------------------
179+
180+
After cloning the project, you can set up a build environment shortcut by
181+
double-clicking the `utils\hct\hctshortcut.js` file. This will create a shortcut
182+
on your desktop with a default configuration. If your system doesn't have the
183+
requisite association for .js files, this may not work. If so, open a cmd window
184+
and invoke: `wscript.exe utils\hct\hctshortcut.js`.
185+
186+
Tests are built using the TAEF framework which is included in the Windows Driver
187+
Kit.
188+
189+
To build, run this command on the HLSL Console.
190+
191+
.. code-block:: sh
192+
193+
hctbuild
194+
195+
You can also run tests with this command.
196+
197+
.. code-block:: sh
198+
199+
hcttest
200+
201+
Some tests will run shaders and verify their behavior. These tests also involve
202+
a driver that can execute these shaders. See the next section on how this should
203+
be currently set up.
204+
205+
To see a list of additional commands available, run `hcthelp`

docs/DXIL.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,14 @@ SM.GSVALIDINPUTPRIMITIVE GS input primitive unrecognized.
32163216
SM.GSVALIDOUTPUTPRIMITIVETOPOLOGY GS output primitive topology unrecognized.
32173217
SM.HSINPUTCONTROLPOINTCOUNTRANGE HS input control point count must be [0..%0]. %1 specified.
32183218
SM.HULLPASSTHRUCONTROLPOINTCOUNTMATCH For pass thru hull shader, input control point count must match output control point count
3219+
SM.INCOMPATIBLECALLINENTRY Features used in internal function calls must be compatible with entry
3220+
SM.INCOMPATIBLEDERIVINCOMPUTESHADERMODEL Derivatives in compute-model shaders require shader model 6.6 and above
3221+
SM.INCOMPATIBLEDERIVLAUNCH Node shaders only support derivatives in broadcasting launch mode
3222+
SM.INCOMPATIBLEOPERATION Operations used in entry function must be compatible with shader stage and other properties
3223+
SM.INCOMPATIBLEREQUIRESGROUP Functions requiring groupshared memory must be called from shaders with a visible group
3224+
SM.INCOMPATIBLESHADERMODEL Functions may only use features available in the current shader model
3225+
SM.INCOMPATIBLESTAGE Functions may only use features available in the entry function's stage
3226+
SM.INCOMPATIBLETHREADGROUPDIM When derivatives are used in compute-model shaders, the thread group dimensions must be compatible
32193227
SM.INSIDETESSFACTORSIZEMATCHDOMAIN InsideTessFactor rows, columns (%0, %1) invalid for domain %2. Expected %3 rows and 1 column.
32203228
SM.INVALIDRESOURCECOMPTYPE Invalid resource return type.
32213229
SM.INVALIDRESOURCEKIND Invalid resources kind.
@@ -3241,7 +3249,7 @@ SM.NOPSOUTPUTIDX Pixel shader output registers are not
32413249
SM.OPCODE Opcode must be defined in target shader model
32423250
SM.OPCODEININVALIDFUNCTION Invalid DXIL opcode usage like StorePatchConstant in patch constant function
32433251
SM.OPERAND Operand must be defined in target shader model.
3244-
SM.OUTPUTCONTROLPOINTCOUNTRANGE output control point count must be [0..%0]. %1 specified.
3252+
SM.OUTPUTCONTROLPOINTCOUNTRANGE output control point count must be [%0..%1]. %2 specified.
32453253
SM.OUTPUTCONTROLPOINTSTOTALSCALARS Total number of scalars across all HS output control points must not exceed .
32463254
SM.PATCHCONSTANTONLYFORHSDS patch constant signature only valid in HS and DS.
32473255
SM.PSCONSISTENTINTERP Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample).
@@ -3382,4 +3390,3 @@ The following work on this specification is still pending:
33823390

33833391
* Consider moving some additional tables and lists into hctdb and cross-reference.
33843392
* Complete the extended documentation for instructions.
3385-

include/dxc/DXIL/DxilConstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const unsigned kMaxClipOrCullDistanceElementCount = 2;
112112
const unsigned kMaxClipOrCullDistanceCount = 2 * 4;
113113
const unsigned kMaxGSOutputVertexCount = 1024;
114114
const unsigned kMaxGSInstanceCount = 32;
115+
const unsigned kMinIAPatchControlPointCount = 1;
115116
const unsigned kMaxIAPatchControlPointCount = 32;
116117
const float kHSMaxTessFactorLowerBound = 1.0f;
117118
const float kHSMaxTessFactorUpperBound = 64.0f;

include/dxc/DXIL/DxilMetadataHelper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ class DxilMDHelper {
332332
// Node Record Type
333333
static const unsigned kDxilNodeRecordSizeTag = 0;
334334
static const unsigned kDxilNodeSVDispatchGridTag = 1;
335+
static const unsigned kDxilNodeRecordAlignmentTag = 2;
335336

336337
// GSState.
337338
static const unsigned kDxilGSStateNumFields = 5;
@@ -624,6 +625,7 @@ class DxilMDHelper {
624625
unsigned &payloadSizeInBytes);
625626

626627
llvm::MDTuple *EmitDxilNodeIOState(const NodeIOProperties &Node);
628+
llvm::MDTuple *EmitDxilNodeRecordType(const NodeRecordType &RecordType);
627629
hlsl::NodeIOProperties LoadDxilNodeIOState(const llvm::MDOperand &MDO);
628630
hlsl::NodeRecordType LoadDxilNodeRecordType(const llvm::MDOperand &MDO);
629631

include/dxc/DXIL/DxilNodeProps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct SVDispatchGrid {
4545
//
4646
struct NodeRecordType {
4747
unsigned size;
48+
unsigned alignment;
4849
SVDispatchGrid SV_DispatchGrid;
4950
};
5051

0 commit comments

Comments
 (0)