Skip to content

Commit

Permalink
Merge pull request #2 from microsoft/master
Browse files Browse the repository at this point in the history
Merge with master
  • Loading branch information
Darkstep79 authored Jun 22, 2020
2 parents 1a9c662 + bce85df commit 6e0c3a1
Show file tree
Hide file tree
Showing 593 changed files with 28,128 additions and 6,669 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ os:
- osx

# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
sudo: required
dist: trusty

env:
Expand Down Expand Up @@ -76,3 +75,6 @@ script:
- ./bin/dxc -T ps_6_0 -Fo passthru-ps.spv ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv -spirv
- ./bin/clang-spirv-tests --spirv-test-root ../tools/clang/test/CodeGenSPIRV/
- ./bin/clang-hlsl-tests --HlslDataDir $PWD/../tools/clang/test/HLSL/

# TODO: Bundle Linux/macOS build artifacts and upload them to a cloud storage
# so users can download and use quickly.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
cmake_minimum_required(VERSION 2.8.12.2)

if (NOT "${DXC_CMAKE_BEGINS_INCLUDE}" STREQUAL "")
include(${DXC_CMAKE_BEGINS_INCLUDE})
endif()

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Debug")
set(CMAKE_BUILD_TYPE "Debug")
Expand Down Expand Up @@ -87,6 +91,9 @@ option(HLSL_ENABLE_FIXED_VER "Reads version information from a file." OFF) # HLS

option(HLSL_ENABLE_ANALYZE "Enables compiler analysis during compilation." OFF) # HLSL Change
option(HLSL_OPTIONAL_PROJS_IN_DEFAULT "Include optional projects in default build target." OFF) # HLSL Change
option(HLSL_BUILD_DXILCONV "Include DXBC to DXIL converter and tools." ON) # HLSL Change

option(HLSL_ENABLE_DEBUG_ITERATORS "Disable debug iterators for faster debug and to remove some additional allocations with improper noexcept attribution" OFF) # HLSL Change

# HLSL Change Starts - support commit querying
option(HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO "Supports querying Git commit info." ON)
Expand Down Expand Up @@ -736,3 +743,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()
endif()

if (NOT "${DXC_CMAKE_ENDS_INCLUDE}" STREQUAL "")
include(${DXC_CMAKE_ENDS_INCLUDE})
endif()
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# DirectX Shader Compiler

[![Build status](https://ci.appveyor.com/api/projects/status/oaf66n7w30xbrg38/branch/master?svg=true)](https://ci.appveyor.com/project/antiagainst/directxshadercompiler/branch/master)
[![Build Status](https://travis-ci.org/Microsoft/DirectXShaderCompiler.svg?branch=master)](https://travis-ci.org/Microsoft/DirectXShaderCompiler)
[![Build Status](https://travis-ci.org/microsoft/DirectXShaderCompiler.svg?branch=master)](https://travis-ci.org/microsoft/DirectXShaderCompiler)

The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.

For more information, see the [Wiki](https://github.com/Microsoft/DirectXShaderCompiler/wiki).
For more information, see the [Wiki](https://github.com/microsoft/DirectXShaderCompiler/wiki).

## Features and Goals

Expand All @@ -17,6 +17,8 @@ At the moment, the DirectX HLSL Compiler provides the following components:

- dxcompiler.dll, a DLL providing a componentized compiler, assembler, disassembler, and validator

- dxilconv.dll, a DLL providing a converter from DXBC (older shader bytecode format)

- various other tools based on the above components

The Microsoft Windows SDK releases include a supported version of the compiler and validator.
Expand All @@ -29,23 +31,27 @@ Binary packages containing the output of this project are available from appveyo

### SPIR-V CodeGen

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.
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.

## Building Sources

Note: Instead of building manually, you can download the artifacts built by Appveyor for the latest master branch at [here](https://ci.appveyor.com/project/antiagainst/directxshadercompiler/branch/master/artifacts).

Note: If you intend to build from sources on Linux/macOS, follow [these instructions](docs/DxcOnUnix.rst).

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.
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.

* [Git](http://git-scm.com/downloads).
* [Visual Studio 2017](https://www.visualstudio.com/downloads). Select the following workloads: Universal Windows Platform Development and Desktop Development with C++.
* [Python](https://www.python.org/downloads/). Version 3.x is required.
* [Python](https://www.python.org/downloads/) - version 3.x is required
* [Visual Studio 2017](https://www.visualstudio.com/downloads) - select the following workloads:
* Universal Windows Platform Development
* Desktop Development with C++
* [Windows SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) - version 10.0.18362.0 or newer
* [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) - same version as the SDK

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.

Tests are built using the TAEF framework. Unless you have the Windows Driver Kit installed, you should run the script at `utils\hct\hctgettaef.py` from your build environment before you start building to download and unzip it as an external dependency. You should only need to do this once.
Tests are built using the TAEF framework which is included in the Windows Driver Kit.

To build, run this command on the HLSL Console.

Expand All @@ -68,7 +74,7 @@ Some tests will run shaders and verify their behavior. These tests also involve

## Running Shaders

To run shaders compiled as DXIL, you will need support from the operating system as well as from the driver for your graphics adapter. Windows 10 Creators Update is the first version to support DXIL shaders. See the [Wiki](https://github.com/Microsoft/DirectXShaderCompiler/wiki/Running-Shaders) for information on using experimental support or the software adapter.
To run shaders compiled as DXIL, you will need support from the operating system as well as from the driver for your graphics adapter. Windows 10 Creators Update is the first version to support DXIL shaders. See the [Wiki](https://github.com/microsoft/DirectXShaderCompiler/wiki/Running-Shaders) for information on using experimental support or the software adapter.

### Hardware Support

Expand Down
52 changes: 43 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,75 @@
version: 1.0.{build}

image: Visual Studio 2017
image:
- Visual Studio 2017
- Ubuntu

platform: x64
configuration: Release

clone_folder: c:\projects\DirectXShaderCompiler

environment:
APPVEYOR_YML_DISABLE_PS_LINUX: true
HLSL_SRC_DIR: c:\projects\DirectXShaderCompiler
HLSL_BLD_DIR: c:\projects\DirectXShaderCompiler\build
ARTIFACTS_ZIP_NAME: dxc-artifacts.zip
ARTIFACTS_DIR_NAME: dxc-artifacts
ARTIFACTS_ZIP_NAME_WINDOWS: $(ARTIFACTS_DIR_NAME).zip
ARTIFACTS_ZIP_NAME_LINUX: $(ARTIFACTS_DIR_NAME).tar.gz

clone_folder: c:\projects\DirectXShaderCompiler

artifacts:
- path: build\$(configuration)\$(ARTIFACTS_ZIP_NAME_WINDOWS)

# The clone folder and artifacts path is different for the Ubuntu image.
for:
-
matrix:
only:
- image: Ubuntu
clone_folder: /home/appveyor/projects/DirectXShaderCompiler
artifacts:
- path: build/$(ARTIFACTS_ZIP_NAME_LINUX)

install:
- cmd: git submodule update --init
- git submodule update --init
- cmd: set PATH=C:\ninja;C:\Python36;%PATH%

before_build:
- cmd: call utils\hct\hctstart %HLSL_SRC_DIR% %HLSL_BLD_DIR%

build_script:
- cmd: call utils\hct\hctbuild -%PLATFORM% -%CONFIGURATION% -spirvtest
- sh: mkdir build && cd build
- sh: cmake .. -GNinja $(cat ../utils/cmake-predefined-config-params) -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- sh: ninja

test_script:
- ps: utils\appveyor\appveyor_test.ps1
- cmd: call utils\hct\hcttest -rel spirv_only
- sh: ./bin/dxc --help
- sh: ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.dxil ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.spv ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv -spirv
- sh: ./bin/clang-spirv-tests --spirv-test-root ../tools/clang/test/CodeGenSPIRV/
- sh: ./bin/clang-hlsl-tests --HlslDataDir $PWD/../tools/clang/test/HLSL/

after_test:
# Collect artifacts for Windows
- cmd: cd build\%CONFIGURATION%
- cmd: echo %APPVEYOR_REPO_COMMIT% > GIT-COMMIT.txt
- cmd: xcopy "%HLSL_SRC_DIR%\include\dxc" include\dxc /s /i /y
- cmd: 7z a %ARTIFACTS_ZIP_NAME% include lib\d*.lib bin\d*.exe bin\d*.dll bin\d*.pdb bin\HLSLHost.exe GIT-COMMIT.txt

artifacts:
- path: build\$(configuration)\$(ARTIFACTS_ZIP_NAME)
- cmd: 7z a %ARTIFACTS_ZIP_NAME_WINDOWS% include lib\d*.lib bin\d*.exe bin\d*.dll bin\d*.pdb bin\HLSLHost.exe GIT-COMMIT.txt
# Collect artifacts for Linux
- sh: mkdir "${ARTIFACTS_DIR_NAME}" && cd "${ARTIFACTS_DIR_NAME}" && mkdir bin && mkdir lib && mkdir include && cd ..
- sh: cp lib/libdxcompiler.so* "${ARTIFACTS_DIR_NAME}"/lib/
- sh: cp bin/dxc "${ARTIFACTS_DIR_NAME}"/bin/
- sh: cp -r ../include/dxc "${ARTIFACTS_DIR_NAME}"/include
- sh: echo "${APPVEYOR_REPO_COMMIT}" > "${ARTIFACTS_DIR_NAME}"/GIT-COMMIT.txt
- sh: tar -czvf "${ARTIFACTS_ZIP_NAME_LINUX}" "${ARTIFACTS_DIR_NAME}"

notifications:
- provider: GitHubPullRequest
on_build_success: true
on_build_failure: true
on_build_status_changed: true

4 changes: 3 additions & 1 deletion cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ function(llvm_update_compile_flags name)
# This is just the default exception handling on Linux
endif (MSVC)
endif (LLVM_ENABLE_EH)
add_definitions(/D_ITERATOR_DEBUG_LEVEL=0)
if (NOT HLSL_ENABLE_DEBUG_ITERATORS)
add_definitions(/D_ITERATOR_DEBUG_LEVEL=0)
endif (NOT HLSL_ENABLE_DEBUG_ITERATORS)
# HLSL Changes End

# Assume that;
Expand Down
40 changes: 15 additions & 25 deletions cmake/modules/FindD3D12.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,28 @@ find_path(DXGI_INCLUDE_DIR # Set variable DXGI_INCLUDE_DIR
DOC "path to WIN10 SDK header files"
HINTS
)
set(D3D12_INCLUDE_DIRS ${D3D12_INCLUDE_DIR} ${DXGI_INCLUDE_DIR})

if ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
find_library(D3D12_LIBRARY NAMES d3d12.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64 )
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM")
find_library(D3D12_LIBRARY NAMES d3d12.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm )
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
find_library(D3D12_LIBRARY NAMES d3d12.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64 )
elseif ("${DXC_BUILD_ARCH}" STREQUAL "Win32" )
find_library(D3D12_LIBRARY NAMES d3d12.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86 )
endif ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
# Find D3D libraries
set(D3D12_LIB_NAMES d3d12.lib dxgi.lib d3dcompiler.lib)

if ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
find_library(DXGI_LIBRARY NAMES dxgi.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64 )
set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64)
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM")
find_library(DXGI_LIBRARY NAMES dxgi.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm )
set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm)
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
find_library(DXGI_LIBRARY NAMES dxgi.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64 )
set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64)
elseif ("${DXC_BUILD_ARCH}" STREQUAL "Win32" )
find_library(DXGI_LIBRARY NAMES dxgi.lib
HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86 )
endif ("${DXC_BUILD_ARCH}" STREQUAL "x64" )

set(D3D12_LIBRARIES ${D3D12_LIBRARY} ${DXGI_LIBRARY})
set(D3D12_INCLUDE_DIRS ${D3D12_INCLUDE_DIR} ${DXGI_INCLUDE_DIR})
set(D3D12_HINTS_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86)
else ("${DXC_BUILD_ARCH}" STREQUAL "x64")
message(FATAL_ERROR "Cannot match platform.")
endif ("${DXC_BUILD_ARCH}" STREQUAL "x64")

set(D3D12_LIBRARIES)
foreach (D3D12_LIB_NAME ${D3D12_LIB_NAMES})
find_library(${D3D12_LIB_NAME}_LOC NAMES ${D3D12_LIB_NAME} HINTS ${D3D12_HINTS_PATH})
set(D3D12_LIBRARIES ${D3D12_LIBRARIES} ${${D3D12_LIB_NAME}_LOC})
endforeach(D3D12_LIB_NAME)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set D3D12_FOUND to TRUE
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindDiaSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ set(DIASDK_INCLUDE_DIRS ${DIASDK_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set DIASDK_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(DIASDK DEFAULT_MSG
find_package_handle_standard_args(DiaSDK DEFAULT_MSG
DIASDK_LIBRARIES DIASDK_INCLUDE_DIR)

mark_as_advanced(DIASDK_INCLUDE_DIRS DIASDK_LIBRARIES)
5 changes: 5 additions & 0 deletions cmake/modules/FindTAEF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ find_path(TAEF_INCLUDE_DIR # Set variable TAEF_INCLUDE_DIR
HINTS "${CMAKE_SOURCE_DIR}/external/taef/build/Include"
HINTS "${WINDOWS_KIT_10_PATH}/Testing/Development/inc"
HINTS "${WINDOWS_KIT_81_PATH}/Testing/Development/inc"
HINTS "$ENV{TAEF_PATH}/../../../Include"
HINTS "$ENV{TAEF_PATH}/../../../Development/inc"
DOC "path to TAEF header files"
HINTS
)
Expand Down Expand Up @@ -68,6 +70,9 @@ elseif(EXISTS "${WINDOWS_KIT_10_PATH}/Testing/Runtimes/TAEF/x86/te.exe"
elseif(EXISTS "${WINDOWS_KIT_81_PATH}/Testing/Runtimes/TAEF/x86/te.exe"
AND EXISTS "${WINDOWS_KIT_81_PATH}/Testing/Runtimes/TAEF/x64/te.exe")
set(TAEF_BIN_DIR "${WINDOWS_KIT_81_PATH}/Testing/Runtimes/TAEF")
elseif(EXISTS "${TAEF_PATH}/te.exe")
set(TAEF_BIN_DIR "${TAEF_PATH}/..")
message("TAEF_BIN_DIR=${TAEF_BIN_DIR}")
elseif(EXISTS "${WINDOWS_KIT_10_PATH}")
message(ERROR "Unable to find TAEF binaries under Windows 10 SDK.")
elseif(EXISTS "${WINDOWS_KIT_81_PATH}")
Expand Down
Loading

0 comments on commit 6e0c3a1

Please sign in to comment.