Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
Antonio Maiorano 91b348912b
Add llvm assertions trap and no strings (#6838)
Add option LLVM_ASSERTIONS_NO_STRINGS
    
When defined, drop the stringized expression, __FILE__, and __FUNCTION__
    strings passed to llvm_assert. This dramatically reduces the binary
    size, which is useful when enabling assertions in a non-debug build.

   Add option LLVM_ASSERTIONS_TRAP
    
When enabled, this forces asserts to always trap. Currently, on Windows
    asserts calls RaiseException, while they trap on non-Windows. This
    option makes the assertion behaviour consistent across platforms.
2024-08-01 15:37:02 -04:00
Antonio Maiorano b6f7ff81e9
Use llvm_assert/assert.h on all platforms, not just Windows (#6815)
This makes it possible to define how assert works on all platforms. The
header was already being included by String.cpp, and was already
designed to work for non-Windows platforms.

Also modify the non-Windows llvm_assert to emit the assertion message to
stderr and trap. We cannot call standard assert as we are overriding it
via include dirs, so there's no way to include the standard one and call
it.
2024-07-29 20:42:09 +00:00
David Neto b18fe87633
Add CMake option DXC_CODEGEN_EXCEPTIONS_TRAP (#6764)
When enabled, any hlsl::Exception thrown during code generation and
optimization will cause the process to trap.


---
edit: I've changed the implementation to generate a trap, instead of
std::abort
2024-07-12 09:41:08 -04:00
Raed Rizqie 0eebec69d4
CMake: Add initial support for MinGW-w64 (#6715) 2024-06-24 15:25:14 -07:00
David Neto 1f8f79688e
CMake: Use find_package(Python3) (#6675)
Fixes the CMake CMP0148 warning at configure time.

find_package(Python3) is supported since CMake 3.12, and DXC requires at
least CMake 3.17
2024-06-20 13:11:49 -04:00
Chris B 98bb80a1ea
Remove Windows C++ redist hack (#6692)
This removes the hack introduced in #6683 to workaround issues in the
GitHub and ADO runner image:
https://github.com/actions/runner-images/issues/10004

Rumor has it the runner images are now fixed... let's see.

Fixes #6674
2024-06-17 16:38:50 -05:00
Chris B 0b9acdb75e
Workaround broken GitHub runner images (#6683)
This PR contains two changes:
1) Moves a pragma to disable a warning, which seems to be required by
the new compiler.
2) Adds a preprocessor define to workaround the crashes caused by the
runner image mismatching C++ runtime versions.

The second change we will want to revert once the runner images are
fixed. The issue tracking the runner images is:

https://github.com/actions/runner-images/issues/10004

Related #6668
2024-06-11 10:02:33 -05:00
Antonio Maiorano 37a082651d
CMake dxc as subproject fixes (#6050)
These changes allow us to use DXC as as CMake subproject (via
add_subdirectory).

Commit comments from each commit:

===

cmake: allow CMAKE_INSTALL_RPATH to be defined in superproject on APPLE
platforms

As on Linux, allow CMAKE_INSTALL_RPATH to be defined in a CMake
superproject.

===

cmake: Allow LLVM_ENABLE_ASSERTIONS=OFF to disable assertions in Debug
builds

Currently, this flag is only used to enable assertions in non-Debug
builds, but is not respected in Debug builds. That is, if set to false,
Debug builds will still assert. This change fixes that.

Note that by default, LLVM_ENABLE_ASSERTIONS is true in Debug builds, so
unless it's explicitly set to false, this is a no-op for most people.

===

cmake: Allow DIRECTX_HEADERS_INCLUDE_DIR to be defined from superproject

Useful for when DXC is included as a subdirectory. In Dawn/Chrome, we
use our own mirror of DirectX-Headers instead of checking out the repo's
submodules, so we need to override this variable.
2023-11-22 14:33:09 -05:00
Xiang Li 89710e5694
[Build] remove VS_STARTUP_PROJECT to avoid require cmake3.4 (#5994)
Since we don't use dndxc as startup project in most cases, just remove
the VS_STARTUP_PROJECT so not need cmake3.4 to build on windows.
2023-11-10 19:37:00 -05:00
Greg Roth 8caace9aa0
Revert mistaken debug changes to hctbuild (#5888)
The previous PR #5881 didn't do what it meant to and had a lot of debug
code due to a mistaken commit. This reverts that commit and restores the
setting of the build type flag
2023-10-18 13:23:48 -07:00
Greg Roth a56078a992
Make hctbuild cmake gen consistent with asserts (#5881)
A slightly complex series of events causes invocations of hctbuild after
the first to enable asserts in release builds. This sets the build type
even when it isn't needed to avoid it.

Because the build type was not being set when generating for visual
studio in hctbuild, when generating the cmake files using CMakeLists, it
would produce an alarming message saying it was defaulting to debug,
but, in fact, since it didn't care for the purposes of sln file
generation, that wasn't actually a problem, just confusing. It did set a
variable to enable asserts, but didn't do this for release variant
builds

The real problem occurs if hctbuild is invoked again, at that point,
instead of defaulting to Debug, it leaves the build type empty because
of another variable set in the cache.

Additionally, since the first invocation enabled asserts, that also
comes from the cache and so code that strips NDEBUG from all build
variants is invoked because the build type is, in fact, not debug, it's
an empty string.
2023-10-17 19:38:47 +00:00
Minmin Gong b157edec90
Fix build on ARM with non-VS generator (#5684)
CMAKE_GENERATOR_PLATFORM is not widely available. For example, Ninja
generator doesn't define it. Use CMAKE_C_COMPILER_ARCHITECTURE_ID to
avoid this problem.
2023-09-19 11:51:38 -04:00
Helena Kotas 50c4c887f1
Add CET Shadow Stack Compatible flag (#5637)
Add CET Shadow Stack Compatible flag when building DXC to safeguard
against ROP/JOP attacks.

Fixes
[#5578](https://github.com/microsoft/DirectXShaderCompiler/issues/5578)
2023-08-31 16:41:28 -07:00
Xiang Li f6a90f07ca
[C++17] Force C++17 when build DXC (#5520)
This is for enable clang-cl build on windows.

The gtest fix is merging from

f66ab00704
to work around 'operator <<' is ambiguous on DefaultPrintNonContainerTo.
2023-08-22 13:20:27 -04:00
Xiang Li 92ee02e9bd
[lit] Make lit the only test runner (#5402)
Remove disable-lit and enable-lit from hctbuild/hcttest.

This is to allow write lit FileCheck shell test.
2023-07-27 20:01:09 +00:00
Chris B 3c06afb989
Update required CMake version to 3.17.2 (#5418)
The SPIR-V-Tools project requires 3.17.2. To simplify our project
dependencies we should just require that everywhere. 3.17.2 was released
in May 2020, so it is now over three years old.

Fixes #2616.
2023-07-25 15:44:49 -05:00
Antonio Maiorano 44f8833938
Add macro to disable usage of allocator overrides (#5296)
Add macro DXC_DISABLE_ALLOCATOR_OVERRIDES which, if defined, will use
the default CRT allocator for new/delete and malloc/realloc/free.

We need this on Chrome for our GN build of DXC, because our component
builds use libc++as a shared library, and we end up with mismatched
new/delete calls between libc++ and these custom overrides.

---------

Co-authored-by: Chris Bieneman <cbieneman@microsoft.com>
2023-07-17 15:27:30 -04:00
Brian Favela 5f931c3f14
Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch (#5380)
The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header
abi-breaking.h, from llvm-config.h. Only headers that are using the
macro are including this new header.

LLVM will define a symbol, either EnableABIBreakingChecks or
DisableABIBreakingChecks depending on the configuration setting for
LLVM_ABI_BREAKING_CHECKS.

The abi-breaking.h header will add weak references to these symbols in
every clients that includes this header. This should ensure that a
mismatch triggers a link failure (or a load time failure for DSO).

On MSVC, the pragma "detect_mismatch" is used instead.

Differential Revision: https://reviews.llvm.org/D26876

llvm-svn: 288082

Co-authored-by: Mehdi Amini <mehdi.amini@apple.com>
2023-06-30 13:15:17 -04:00
Chris B 4f5e4d1b74
Setup `install-distribution` target for DXC (#5154)
* [CMake] Update distribution build for DXC

Building off the LLVM 3.9 changes, this gets the `install-distribution`
target working for DXC with preset parameters that configure the
normal distribution. It also enables the DXC distribution to be built
through Visual Studio builds since DXC has a limited number of
components so it doesn't suffer from the IDE issues that upstream
LLVM & Clang do.

The `hctbuild` tooling has been updated to set a default install
prefix relative to the build directory, and allow overriding with a flag.

Cherry-picked commit details below:

From c90e12fe9fd7eb9fd7b342e7ac0cec971dd3e4db Mon Sep 17 00:00:00 2001
From: Chris Bieneman <beanz@apple.com>
Date: Tue, 23 Feb 2016 20:33:53 +0000
Subject: [PATCH] [CMake] Create an install-distribution target driven by LLVM_DISTRIBUTION_COMPONENTS

The idea here is to provide a customizable install target that only depends on building the things you actually want to install. It relies on each component being installed having an auto-generated install-${component}, which in turn depends only on the target being installed.

This is fundamentally a workaround for the fact that CMake generates build files which have their "install" target depend on the "all" target. This results in "ninja install" building a bunch of unneeded things.

llvm-svn: 261681
2023-04-18 10:09:21 -05:00
Greg Roth 5eb7c77d7c
Move WinAdapter into interface directory (#5066)
Since it is shipped and relied upon, the WinAdapter header belongs in
the release directory. This removes the need to include the Support
directory for building purposes

revises fix to #4918
2023-02-28 10:41:50 -08:00
Greg Roth 00da3abfc5
Correct WinAdapter path assumptions in public headers (#5003)
dxcapi.h and dxcisense.h had inconsistent and unhelpful for release
include paths to find WinAdapter.h. By adding the necessary -I flag,
the include can be found without including the paths

Fixes #4918
2023-02-09 13:27:53 -08:00
Chris B 3ae7054214
Tweaks and fixes to clang build and test configs (#4832)
* Tweaks and fixes to clang build and test configs

* Setup dependencies for check-clang.
* Proprely adjust shlibdir for multi-configuraiton builds.
* Move TAEF platform verification earlier to avoid issues on Linux.
* Adjust TAEF suite config to handle build_mode specialization.
* Remove another DXC_BUILD_ARCH that snuck in.
* Add the intermediate library path as an rpath for unit tests.
* Make ClangUnitTests depend on ClangHLSLTests so taef tests build.
* Add clang-test-depends and test-depends targets.

* Fix spelling error.

Thanks @hekota!
2022-12-01 11:06:42 -06:00
Greg Roth 14a55b7738
[linux] Enable Reflection on *nix platforms (#4810)
Needed for the impending enabling on *nix platforms

* Remove circular dependency from RDAT Dumper

A file included by the source that implemented various ToString
converters of reflection data to strings itself depended on those
declarations, which it only found because of the unique way MSVC
processes templates. By moving the definitions and declarations into
their own header and source files, everyone gets what they need
without ouroborosing.

* Create DirectX-Headers submodule

Creates the DirectX-Headers submodule and adds the needed defines to
allow them to be used. As yet makes no use of these headers

* Improve src dir finding error

The check for the file stream that is meant to represent the filechecked
source file wasn't sufficient to detect a non-existent file. By expanding
the error check, it can produce a helpful message.

Also initialize the failure code so it isn't random

* Enable reflection functionality and testing

This flips the switch, removing or repositioning many ifdefs and
including previously excluded files in the build.

* Actually add the DirectX-Headers submodule

* fix *nix build breaks caused while fixing win breaks :P

* Respond to feedback -- some of it anyway ;)

* simplify cmake file to exclude unneeded src dir

* fix cmake (again)

* Fix GCC template specialization finickiness

What compiler is overly permissive now huh? huh? (or just quick to adopt
new language features?)

* LPCBYTE isn't a thing

Loathe as I am to push one more commit onto this. I don't want to
propagate a misconception. I meant to remove this earlier and caught it
from one final self-review >:(
2022-11-23 19:10:29 -07:00
Chris B fb6b287c23
Remove DXC_BUILD_ARCH variable (#4156)
* Remove DXC_BUILD_ARCH variable

This commit simplifies the cross-targeting build support to not require
specifying the build architecture explicitly. Instead it is derived from
the build tools used in the generation.

I've tested this change locally for Win32, x64 and arm64.

* Special handling for arm64ec

* Bump required CMake to 3.10

CMake 3.10 is very old, but has a feature this PR uses. Raising the
requirement should have no impact on our users.

* Fix build issues caused by changes in CMake 3.10
2022-11-22 09:33:06 -06:00
Chris B 90b2935587
Workarounds for arm64ec build (#4808)
I encountered two issues building arm64ec. First CMake and/or link.exe
seem to have a disagreement about flag ordering and how to handle
`/INCREMENTAL`. This change results in disabling kernel-mode debugging
on arm64ec builds, but it means we can build... so that's a win.

The other issue is that libClangSema has some files that have gotten too
big, so we need `/bigobj` for Sema.
2022-11-22 09:27:16 -06:00
Chris B 3962ff2f80
Bring in code coverage tooling (#4759)
This cherry-picks in a bunch of upstream LLVM changes and has a few small modifications for DXC.

* [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with
-fprofile-instr-generate

This is the first step in supporting PGO data generation via CMake.
I've marked the option as advanced and experimental until it is fleshed
out further.

llvm-svn: 255298

* Add support for collating profiles for use with code coverage

Differential Revision: http://reviews.llvm.org/D20993

llvm-svn: 272599

Patch by: Vedant Kumar <vsk@apple.com>

* [CMake] Add targets for generating coverage reports

This is a pretty small bit of CMake goop to generate code coverage
reports. I always forget the right script invocation and end up
fumbling around too much.

Wouldn't it be great to have targets that "Just Work"?

Well, I thought so.

At present this only really works correctly for LLVM, but I'll extend
it in subsequent patches to work for subprojects.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D109019

* Update prepare-code-coverage.py from llvm/main

Theres's a swath of changes that went in here. Cherry-picking them all
indivudially is not worth it. Contained commits:

8773822c578a [Zequan Wu] [Utils] Add -compilation-dir flag to
prepare-code-coverage-artifact.py
577d59bc679d [Nico Weber] svn propset svn:executable on
utils/prepare-code-coverage-artifact.py
9a10eac663dd [Chris Bieneman] [Coverage] Apply filtered paths to summary
16776315460e [Vedant Kumar] [utils] coverage: Add help text about the
--restrict flag (NFC)
f4df0edf3ea3 [Vedant Kumar] [utils] Add a '--unified-report' option to
the code coverage prep script
7466987cb7ba [Vedant Kumar] [utils] Use print_function in the code
coverage prep script, NFC.
273b6dc3e2f7 [Vedant Kumar] [utils] Add an '--only-merge' option to the
code coverage prep script
547ebad0b984 [Vedant Kumar] [utils] Teach the code coverage prep script
about --restrict
05ee94f1b573 [Vedant Kumar] [utils] Generate html reports with the code
coverage utility script
d9aed82cf7e2 [Vedant Kumar] Add support for collating profiles for use
with code coverage

* HLSL-specific change to coverage reporting

This works around DXC not having a cmake target to run tests by
exposing a new variable which can configure which target gets run to
produce profiles. A similar change will be useful upstream, so I'll add
a change there too.
2022-11-15 12:17:03 -06:00
Chris B eb4d0ec385
Add `LLVM_OPTIMZIE_SANITIZED_BUIDS` option (#4667)
I added this upstream a few years ago so that you can control passing
`-O1` to the compiler when building debug sanitized builds. Without
being able to disable optimizing sanitizer builds it is really tricky to
debug sanitizer failures, but without optimizing the build ASan builds
take _forever_ to run tests which makes them difficult to use.
2022-09-19 10:13:24 -05:00
Natalie Chouinard 20ddfe85f1
[dxil2spv] Remove dxil2spv prototype (#4512)
Revert "[dxil2spv] Print missing runtime errors (#4481)"

This reverts commit 7f8f9acc89.

Revert "[dxil2spv] Command line parsing and output file (#4454)"

This reverts commit 2e49e6809b.

Revert "[dxil2spv] Add additional error checking (#4440)"

This reverts commit 3c1918e21e.

Revert "[dxil2spv] Add FileCheck testing (#4431)"

This reverts commit d6cec44c6f.

Revert "[dxil2spv] Translate DXIL constants to SPIR-V (#4426)"

This reverts commit f00b3c285d.

Revert "[dxil2spv] Translate SV_Position to BuiltIn::Position (#4423)"

This reverts commit b292f9482b.

Revert "[dxil2spv] Translate extractValue and bufferStore (#4404)"

This reverts commit 1d2a68fb3e.

Revert "[dxil2spv] Translate createHandle and bufferLoad (#4389)"

This reverts commit 316b849cfa.

Revert "[dxil2spv] Support shl instruction (#4388)"

This reverts commit 1039a872b7.

Revert "[dxil2spv] Fix build warning (#4371)"

This reverts commit 7ecebb30ef.

Revert "[dxil2spv] Add support for dx.op.threadId (#4354)"

This reverts commit c248a1ee89.

Revert "[dxil2spv] Add initial compute shader support (#4345)"

This reverts commit c701ece61c.

Revert "[dxil2spv] Add error checking to file tests (#4344)"

This reverts commit 9f70135012.

Revert "[dxil2spv] Add passthrough vertex shader and test (#4337)"

This reverts commit c99f5a540e.

Revert "[dxil2spv] SPIR-V validation and related fixes (#4328)"

This reverts commit 495871898e.

Revert "[dxil2spv] Implement simple entry function creation (#4323)"

This reverts commit c29a0c7384.

Revert "[dxil2spv] Read file directly into llvm::MemoryBuffer (#4304)"

This reverts commit aa26bfd052.

Revert "[dxil2spv] Add stage IO variables (#4271)"

This reverts commit 2d5f1863a6.

Revert "[dxil2spv] Add CompilerInstance object (#4229)"

This reverts commit e4cf4867f7.

Revert "[dxil2spv] Add initial testing (#4222)"

This reverts commit c3a61b1cd3.

Revert "[dxil2spv] Construct minimal SPIR-V module (#4216)"

This reverts commit e3da12e19d.

Revert "[dxil2spv] Add basic dxil2spv CI test (#4209)"

This reverts commit 57d4d2b8f1.

Revert "Add initial dxil2spv executable (#4199)"

This reverts commit c45db48d56.
2022-06-16 11:03:52 -04:00
Helena Kotas d3c7fac3c4
Enable control flow guard (#4457) 2022-05-12 23:04:29 -04:00
Natalie Chouinard c45db48d56
Add initial dxil2spv executable (#4199)
Parses files containing DXIL (IR or bitcode) to an LLVM module.
2022-01-26 14:55:19 -05:00
Chris B 6cf0a6f7df
Automate generating of intrinsic code (#4001)
* Automate generating of intrinsic code

This change removes generated code for HLSL and DXIL intrinsics and
sets up the build system so that it will generate the code and
automatically regenerate it on changes to any of the generation scripts
or input files.

* Covering the last few generated files

* Move namespace priting into hctgen

I somehow missed that the open namespace was in manual code and the
close was in the generated code...

* Fix pix passes generator

* Work around missing autocrlf on Windows checkout

*shakes fist* AppVeyor...

* Actually pass through --force-lf
2021-11-02 13:43:47 -05:00
Chris B 3d17803bad
Enable building LLVM testing tools (#4023)
* Enable building LLVM testing tools

This gets a bunch of the LLVM testing tools building, which allows us
to run the LIT tests (which have a lot of failures)

* Fixing broken Linux and Windows builds

* Removing a change that snuck in.
2021-10-21 11:31:31 -05:00
Chris B 0a0ed9f50b
Make it possible to enable building LLVM & Clang unit tests (#4020)
* Changes to get LLVM unit tests building

This change gets the LLVM unit tests building again and running through
LIT via the `check-llvm-unit` target.

This change does not have the tests passing! Subsequent changes will
get the unit tests passing. This change also disables some tests where
the LLVM code is no longer used and making those tests work will
require substantial effort.

* Changes to get Clang unit tests building

This change gets the Clang unit tests building again and running
through LIT via the `check-clang-unit` target.

This change does not have the tests passing! Subsequent changes will
get the unit tests passing. This change also disables some tests where
the Clang code is no longer used and making those tests work will
require substantial effort.

* A few extra Windows fixes

This adds some missing APIs to the Windows Filesystem code and adds an
option to hctbuild to enable building the LLVM & Clang unit tests.

* Disable libClangFormat tests

These tests are a bit gnarly to repair... unless we really start using
the format library we probably just want to disable these tests.
2021-10-20 12:32:45 -05:00
Chris B 4ca3a04252
Restore LLVM Testing Infrastructure (#4012)
* Restore lit and googletest sources from LLVM 3.7.0

This commit just re-adds sources that were removed somewhere along the
way.

* Pull in googletest & googlemock from LLVM 4.0

Googlemock was introduced in LLVM 4.0, and is used by SPIR-V's tests.
This pulls in the LLVM 4.0 version of GoogleTest and GoogleMock to
replace the external submodules.

LLVM's version of GoolgeTest and GoogleMock have some minor extensions
to work better with LIT for error reporting and producing cleaner test
output.

* Remove external googletest

* Fix lit to handle comment in gtest names

This fix came into LLVM with the updated googletest in a977582dead2

* Ignore raw_fd_ostream errors when not closing

There's some odditites with the changes in the filesystem code that
cause this to error sometimes in unit tests. Until we can dedicate time
to looking into the filesystem code, just swallow that error...

* Fix bot failure

Missed an option change.

* Fixing MSVC build failure

* A cleaner build fix

This should address issues with VS 2019 in a cleaner way.

* Fix build
2021-10-19 15:24:11 -05:00
Helena Kotas e621158fbf
Disable regeneration target for official builds as they always run a full clean build. (#3725)
This should eliminate the race-condition issue with "Cannot restore timestamp".
2021-04-29 19:13:30 -07:00
Helena Kotas e09223cc49
Enable debugging from kernel mode (#3637) 2021-03-26 20:46:56 -07:00
Minmin Gong a5365731f0
Change HLSL_DISABLE_DEBUG_ITERATORS to more natural HLSL_ENABLE_DEBUG_ITERATORS and flip the default value (#2885) 2020-05-14 10:29:56 -05:00
Minmin Gong 318e625924
Add an option to turn on/off debug iterators (#2879)
Add option to turn on/off debug iterators for more performant or more helpful debug builds
2020-05-13 11:00:35 -07:00
Helena Kotas 3049f4541b
CMake customization and bug fixes (#2874)
Add new options to hctbuild that enable passing in additional arguments to cmake invocation
and also cmake customization hooks that will be included at the beginning and end of DXC's CMakeLists.txt.

Rework library search in FindD3D12.cmake and add one more library to look for.

Fix case in FindDiaSDK.cmake - fixes a cmake warning.
2020-05-11 12:23:20 -07:00
Helena Kotas b053bfbaae
Add option to hctbuild.cmd to skip building dxilconv.dll and related tools (#2739) 2020-03-03 17:25:12 -08:00
Greg Roth de35705c77
Separate generation of DXC macro version info (#2681)
The original generation of HLSL macros containing version information
used the same generated header file as the RC file. This was fine except
when building in xbtools where the version information in the RC is
overridden to match the GDK.

To maintain the DXC macros as communicating the version of the DXC
component to better enable workarounds based on that information, the
same generator script is used, but the header file is separate and
doesn't abide by the fixed version location provided via cmake defines.
This way it will always contain DXC information while the RC file can
continue to contain the version information as it did before.

To allow for the case where the headers are not the same, a preliminary
version.gen file is created according to the dxc version requirements
and copied to the dxc header. In most cases, it is copied to the RC
header as well. When an explicit path is specified for the fixed
version, the DXC version uses the "offficial" generated header and the
RC file gets the version specified by the file in the given location.

Reverts the changes to the target_version_vertex.hlsl test since it
should always succeed now.
2020-02-14 17:26:49 -07:00
Greg Roth d9242790d4
Add HLSL macros with version information (#2665)
* Add HLSL macros with version information

Adds three sets of version information as defined macros available
to the shader.

The DXC version is included as __DXC_VERSION_{MAJOR|MINOR|RELEASE|COMMITS}
The values of these are set at compile time and derived from version.inc
RELEASE and COMMITS information varies according to the criteria
described in gen_version.py.

The HLSL Version is included as __HLSL_VERSION. It may be taken from
the -HV argument with which dxc was invoked, derived from other
arguments, or the default.

The shader target stage and version information is taken from the
-T argument with which dxc was invoked. For the stage, defined
constants representing each stage are defined at compile time that
correspond to the enum values used internally. The shader stage
specified by -T is determined at runtime and set to the corresponding
enum value. The major and minor versions are similarly derived from
the -T argument at runtime.

The runtime defines are set in InitializeStandardPredefinedMacros()
This allows them to be set just once and the same way for any way
that dxc is invoked including testing.

This makes some changes to how the version.inc file is generated and
found in cmake files in order to generate it regardless of the need
for a .rc resource file as it was before.

A series of hlsl tests are added that test for the defines presence
and values in order to add versus subtract with checks for the adds.
Since many of the defines are determined by arguments at runtime, a
few different tests were needed, but as much consolidation as possible
was done to reduce the number of individual test runs.
2020-01-30 16:54:59 -07:00
Helena Kotas 91e57feaf0
Fix hctbuild -fv build break (#2662) 2020-01-24 12:31:01 -08:00
Minmin Gong 513276e846 Fix the HLSL_VERSION_LOCATION when build DXC in a parent project (#2480) 2019-09-23 09:47:38 -07:00
Helena Kotas 5edbabb2b1
Generate new version for each DX Compiler build (#2200)
Added generating of new version for each DX Compiler build. 

There are 3 kinds of version:
1. **Official build**
Built by using `hctbuild -official`. The version is based on the current DXIL version, latest official release and a number of commits since then. The format is `dxil_major.dxil_minor.release_no.commit_count`. For example a current official version would be something like `1.5.1905.42`. The latest release information is read from `utils\version\latest-release.json`. The `1905` corresponds to `dxil-2019-05-16` release branch and `42` is the number of commits since that release branch was created. For master branch the `commit_count` will be incremented by 10000 to distinguish it from stabilized official release branch builds. So the current official version of master would be someting like `1.5.1905.10042`.

2. **Dev build**
Build by using `hctbuild` with no other version-related option. The format is `dxil_major.dxil_minor.0.commit_count` where commit_count is the number of total commits since the beginning of the project.

3. **Fixed version build**
Build by using `hctbuild -fv`. Enables overriding of the version information. The fixed version is read from `utils\version\version.inc`. Location of the version file can be overriden by `-fvloc` option on `hctbuild`.

In addition to the numbered version the product version string on the binaries will also include branch name and last commit sha - `"1.5.1905.10042 (master, 47e31c8a)"`. This product version string is included in `dxc -?` output.
2019-06-28 15:16:34 -07:00
Jaebaek Seo dd183fec9f
Force cmake to use python3 (#2187)
Force cmake to use python3
2019-05-15 09:56:11 -04:00
Lei Zhang 3987db0fa8
[spirv] Do not build tests by default and hook up with ctest (#1394)
This way we can just run ctest to invoke the tests, instead of
remembering the binary and its parameters.
2018-06-29 12:46:07 -04:00
Lei Zhang 94ec193042
Add IDxcVersionInfo2 for querying Git commit info (#1304)
This will give users a way to know the commit from which a DXC
library/binary was built from, so that they can compare different
libraries/binaries and report bugs easily.

dxc.exe now also prints the commit info using this new interface
method. It uses the following format:

  (dev;<commit-count>-<commit-hash>)
2018-06-20 11:35:48 -04:00
Ehsan 37c35f2f6e
[linux-port] Update CMake files. prepare for Linux. (#1312)
This CL makes changes to CMake files in order to:
1- disable things that are not supported on non-Windows platforms.
2- make cross-platform compilation possible.

It also brings back LLVM's config.guess (mirrors:
https://github.com/llvm-mirror/llvm/blob/master/cmake/config.guess)
2018-05-29 15:19:37 -04:00
Ehsan 090d3680f9
Fix cmake for non-appveyor buildbot environments. (#1297) 2018-05-18 10:50:33 -04:00