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

1564 Коммитов

Автор SHA1 Сообщение Дата
Lei Zhang 0c68569f59
[spirv] Clean up SPIR-V types (#1366) 2018-06-21 16:05:56 -04:00
Lei Zhang 16f2ff2294
[appveyor] Clone the whole history (#1365)
Right now we have a mechanism to version rolling build. It depends
on the Git history and will count number of commits. So we need
the full history.
2018-06-21 14:22:09 -04:00
Greg Roth a415125b2c [spirv] Fix counter_binding precedence and test (#1363)
A missing `else` made it possible for a resource variable with a
corresponding counter variable that was defined with both
vk::binding and :register, each indicating a different descriptor
set to have the main variable assigned the set indicated by
vk::binding while the counter went to the set indicated by the register

Adds a new test for this and other such conditions.
2018-06-21 14:17:35 -04:00
Greg Roth ae615d47a8 [linux-port] Eliminate warnings on release builds (#1361)
A number of warnings unique to release buildsi persist. Some of these
same errors were fixed earlier for debug builds.

DXASSERT_LOCALVAR still took a variadic macro on release builds.
Fixes 85 clang warnings

Expressions used only as conditionals for asserts were not properly
dummied out with (void) cast.
Fixes 7 clang warnings

Variables used only in asserts dummied out.
Fixes 27 clang warnings

Potential uninitilized uses of variables assigned in switches/ifs.
fixes 5 clang warnings

put braces around empty else statements
11 gcc warnings
2018-06-21 10:46:30 -04:00
Tex Riddell 76c5562a8e Fix AV in TranslateHLSubscript for typed buffer with struct element 2018-06-21 01:01:13 -07:00
Tex Riddell 41ed85892d Remove unused OP::ComputeMinShaderModelAndMask for function 2018-06-21 00:59:56 -07:00
Tex Riddell ee550a4b53 Add shader mask and min SM to RDAT
- add OP::GetMinShaderModelAndMask to compute mask and min SM
- account for ops that can be translated during linking
- update PS ops that could be allowed in library functions
- update min SM with newer optional feature flags
2018-06-20 21:40:28 -07:00
Ehsan 0f4f2e5946
[linux-port] Handling of target triple. (#1359) 2018-06-20 15:33:28 -04:00
Ehsan 287f19b195
[spirv] Properly initialize and cleanup for tests. (#1360) 2018-06-20 15:25:19 -04:00
Xiang_Li (XBox) 4ade2fccc0 Merged PR 92: Enable ValidateResourceDxilOp for lib profile.
Enable ValidateResourceDxilOp for lib profile.
2018-06-20 18:53:19 +00: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
Lei Zhang c7fe4cb0af
[spirv] Fix accessing (RW)Buffer sub-element using [][] (#1354)
Accessing sub-elements in (RW)Buffer with adjacent array subscript
operators was falsely translated into an OpAccessChain with two
indices. Instead, we need to perform OpImage* on the (RW)Buffer
object and then do single-index OpAccessChain.
2018-06-19 20:06:42 -04:00
Lei Zhang e142881084
[spirv] Update external dependencies (#1355) 2018-06-19 20:04:22 -04:00
Ehsan 5bf6dd1840
[linux-port] Minor changes towards cross-platform compilation. (#1352) 2018-06-19 10:36:53 -04:00
Vishal Sharma 523b74e251
Propagate /no-warnings flag (#1349)
* Propagate /no-warnings flag

* With these changes, warnings are not shown when /no-warnings flag is used and they get printed when /no-warnings flag is not used. The exact behavior is mirrored when a user decides to output warnings and errors to an output file by using /Fe flag.
2018-06-18 12:40:37 -07:00
Lei Zhang 15bf7f587e
Use CreateFileW instead of CreateFile2 (#1301)
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1265
2018-06-18 15:08:45 -04:00
Ehsan 180ea63ba0
[linux-port] Introduce Windows "adapter" headers (#1314)
In this CL, we have introduced the "WinAdapter.h" header file.

This file includes declarations and definitions that will enable compilation of the code base on non-Windows platforms. These include:

* Disabling SAL annotations for non-Windows platforms.
* Defining some Windows-specifc macros that are not defined on other platforms.
* Defining Windows-specific types that are used throughout the codebase for non-Windows platforms.

This file is currently not complete. As we go forward, we will add more classes/structs/type definitions to this file for specific purposes. The contents of this file is completely disabled (#ifdef'd away) for Windows, and do not affect Windows compilation in any way.  For the most part, this is our way of enabling compilation of the codebase on non-Windows platforms without making invasive changes to the existing cpp files, and without hindering any future development. Moreover, I have added the #include of this file for all the locations that will need it for successful Linux compilation.
2018-06-17 11:31:21 -04:00
Greg Roth 168aad3b41 [spirv] Multiplex ModuleBuilder decorations (#1351)
ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.
2018-06-17 08:05:08 -04:00
Greg Roth 5481aca58f [linux-port] Remove unused from HLSL code (#1315)
Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.
2018-06-17 08:03:25 -04:00
Greg Roth fdc414caa0 Fix warning on windows release builds (#1350)
A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.

This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.
2018-06-16 10:05:45 +08:00
Tex Riddell 0e300d856a Merged PR 94: Fix regressions with half, entry props/sigs and UseMinPrecision flag
Fix Half:
- Override printing policy based on HLSL instead of enabling
  LangOptions::Half, which enables keyword and changes behavior.

Fix entry props/sigs/UseMinPrecision:
- Make sure entry/signature data is available once SetShaderModel() is
  called for shader targets (not for library).
- Add bUseMinPrecision flag to SetShaderModel() since the global switch
  is needed at that point.
- Remove SetUseMinPrecision() since it should be set in SetShaderModel()
  and should not be changed.
- Modify DxilModule loading to initialize UseMinPrecision flag correctly
  for entry signatures, and fix signature copy constructor.
- Remove DxilModule level entry property duplicates, use the
  DxilFunctionProps instead, except where useful (GS stream mask),
  and make sure these are always available/in-sync.
- Fix various code accessing properties that don't match target
- Fix various ordering issues causing bugs in properties
- Don't duplicate functions to strip them of parameters when they have
  already been stripped (linker hits this).

Also: Fix per-thread file system in opt.exe for testing
2018-06-13 02:17:46 +00:00
Tex Riddell c25719477e Fix per-thread file system in opt.exe for testing 2018-06-12 19:14:20 -07:00
Tex Riddell 9a2a731b7b Fix regressions with entry props/sigs and UseMinPrecision flag
- Make sure entry/signature data is available once SetShaderModel() is
  called for shader targets (not for library).
- Add bUseMinPrecision flag to SetShaderModel() since the global switch
  is needed at that point.
- Remove SetUseMinPrecision() since it should be set in SetShaderModel()
  and should not be changed.
- Modify DxilModule loading to initialize UseMinPrecision flag correctly
  for entry signatures, and fix signature copy constructor.
- Remove DxilModule level entry property duplicates, use the
  DxilFunctionProps instead, except where useful (GS stream mask),
  and make sure these are always available/in-sync.
- Fix various code accessing properties that don't match target
- Fix various ordering issues causing bugs in properties
- Don't duplicate functions to strip them of parameters when they have
  already been stripped (linker hits this).
2018-06-12 15:29:39 -07:00
Ehsan eb37d4ae2b
[spirv] Update SPIRV-Tools. (#1348) 2018-06-12 15:00:48 -04:00
Tex Riddell 9ca6962311 Fix half regression due to LangOpts change for half printing
- Override printing policy based on HLSL instead of enabling
  LangOptions::Half, which enables keyword and changes behavior.
2018-06-11 23:06:25 -07:00
Tex Riddell 103d33ef5d Merged PR 91: CG: Fix matrix component type name by using printing policy
CG: Fix matrix component type name by using printing policy
2018-06-11 17:42:30 +00:00
Helena Kotas c3587a82fb
Update to VS 2017 and CMake 3.11.2 (#1347)
* Change build to prefer VS 2017

* Update supported cmake version

* Remove -vs2017 from appveyor.yml
2018-06-08 17:36:55 -07:00
Tex Riddell d37f956c70 Merged PR 86: Finalize OpCode changes for Dxil 1.3 / SM 6.3
Finalize OpCode changes for Dxil 1.3 / SM 6.3

- Rename CreateHandleFromResourceStructForLib to CreateHandleForLib
- Add PrimitiveIndex
- Add final NumOp[Codes|Classes]_Dxil_1_3 values
- Fix legal shader stage set for PrimitiveID
2018-06-09 00:22:19 +00:00
Greg Roth ccbb0ec117 [linux-port] Add missing case statements (#1346)
When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.
2018-06-08 20:19:52 -04:00
Xiang_Li (XBox) d09e2746aa Merged PR 90: Enable 64bit rawBufferLoad/Store.
Enable 64bit rawBufferLoad/Store.
Also fix 16bit offset for buffer matrix load/store.
And flat copy on matrix array with different major.
2018-06-08 23:42:16 +00:00
Tex Riddell a7807585ea Merge branch 'rtmaster' into dxil-update 2018-06-08 15:52:04 -07:00
Tex Riddell d90b00713c Merged PR 87: Fix matrix orientation and unorm/snorm detection in codegen. 2018-06-08 22:50:53 +00:00
Helena Kotas 7fd91d777f
Modify build script and environment to support ARM64 build (#1308)
hctstart.cmd and hctbuild.cmd now support ARM64 builds.

Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.

Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.
2018-06-08 13:06:48 -07:00
Greg Roth 6121df782a [linux-port] Correct problematic initializations (#1321)
Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.

Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings
2018-06-08 07:19:20 +08:00
Greg Roth 0ba5e55bf3 [linux-port] Use cross-platform TLS methods (#1338)
LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.

Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.
2018-06-07 13:32:57 -04:00
Greg Roth a88cc5d133 [linux-port] de-const variables not used as const (#1331)
pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings
2018-06-07 13:04:20 -04:00
Greg Roth a89e4e48f1 [linux-port] Casts for compares and assigns (#1328)
Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.

Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.

Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.

One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.
2018-06-07 12:49:02 -04:00
Ehsan b102541771
[spirv] Append must load lvalues before appending (#1345)
The AppendStructuredBuffer's Append method was not checking for lvalues.
2018-06-07 08:32:52 -04:00
Xiang_Li (XBox) 2adce9a983 Merged PR 80: Merge EntrySignature and FunctionProps together.
Merge EntrySignature and FunctionProps together.
2018-06-07 02:04:03 +00:00
Tex Riddell a078a0ab44 Merged PR 85: Don't validate external user defined functions as if they are Dxil Ops
Don't validate external user defined functions as if they are Dxil Ops
2018-06-07 00:16:46 +00:00
Tex Riddell c37d554d1e Merged PR 83: Integration fixes.
Integration fixes.

- Remove unused constructor from FunctionTableReader
- Remove hlsl::Exception dependency from DxilRuntimeReflection.inl
- Fix field size sizeof(RuntimeDataFunctionInfo) in legacy loader
- Add __cdecl to raw_ostream::operator<<(...) for ios_base change
- Move string constant definitions to from CGHLSLMS to DxilModule, since
  they are required by HLSL.lib, and that shouldn't depend on clang CodeGen.
2018-06-06 01:05:40 +00:00
Xiang_Li (XBox) ae93061ee8 Merged PR 84: Implement MatrixBitcastLowerPass for link matrix type.
Implement MatrixBitcastLowerPass for link matrix type.
2018-06-06 00:56:37 +00:00
Greg Roth b9f2c78314 [linux-port] Evade unused in LLVM code (#1327)
Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.
2018-06-05 14:07:51 -04:00
Greg Roth e5ec4ca0db [linux-port] Replace tests of never null addresses (#1318)
Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes

The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.
2018-06-05 13:54:01 -04:00
Chas. Boyd 04d656105a
Update README.md 2018-06-04 13:21:14 -07:00
Greg Roth f8fa9c92a0 [linux-port] disable covered-switch-default warning (#1332)
Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.

However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings
2018-06-04 05:53:02 +08:00
Greg Roth a6f857371d [linux-port] Unused variables in conditionals (#1336)
A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.
2018-06-02 11:23:51 -04:00
Greg Roth d975f150b7 [linux-port] Correct conditional groupings (#1326)
Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.

Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.

Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.
2018-06-02 04:19:14 -04:00
Greg Roth 4aa0f706c8 [linux-port] Fix spirv test warnings (#1337)
clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.

Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.
2018-06-02 04:16:29 -04:00
Xiang_Li (XBox) 4491b6230b Merged PR 82: Fix matrix array as parameter for external function.
Fix matrix array as parameter for external function.
2018-06-02 02:45:59 +00:00