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

1694 Коммитов

Автор SHA1 Сообщение Дата
Tristan Labelle 8226092fd7
Change in-memory representation of bool vectors to use i32's (#1742)
This change fixes an inconsistency between scalar and vector bools, where the formers were stored as i32s in memory (as opposed to i1s in registers) while the latter remained <n x i1>s. This lead to a number of crashes in more complex bool scenarios where scalar and vector element types were expected to match.

The solution is to extend Clang's strategy for scalar bools to vector of bools. Clang relies on three key functions to deal with differences between register and memory type representations which are special-cased for bools and now also for bool vectors. Several HLSL code additions did not properly leverage those functions and this was addressed wherever possible, in some cases removing the need for special cases for bools.

To deal with matrices, a similar concept of register/memory representation was introduced in the matrix lowering code and the lowering passes were updated accordingly.
2018-12-03 13:28:22 -08:00
Vishal Sharma 545bf5e0c5
Skip inserting redundant phi nodes on struct type (#1748) 2018-11-29 15:34:00 -08:00
Tristan Labelle 7fcbdb1969
Prevent texture of structs/matrices/arrays, and don't crash (#1744)
* Add a diagnostic error for non-scalar/vector texel types
* Harden semantic analysis logic against unexpected types
2018-11-29 10:34:16 -08:00
Tristan Labelle e812caab39
Fix CompileWhenNoMemThenOOM test failure (#1747)
Workaround a regression in the VC++ STL implementation causing the std::bad_alloc to happen in a nothrow context, and re-enabled the test on appveyor.
2018-11-29 09:40:19 -08:00
Ehsan 883ce4a32c
[spirv] Support non-fp MAD intrinsic function. (#1730) 2018-11-28 10:31:48 -05:00
Steven Perron d91935d19d Remove use of `NoSerializeHeapMalloc` mem manager. (#1729)
It was done to improve the compile time, but it does not seem to be
better.  The use of `HEAP_NO_SERIALIZE` turns off the
low-fragmenataion-heap, which is what we want for this application.

See https://github.com/Microsoft/DirectXShaderCompiler/pull/1712 for a
discussion.
2018-11-26 16:33:07 -05:00
Ehsan c12f1ae8f2
[spirv] Fix Linux/macOS build. (#1735)
Fixed ternary op ambiguity.
2018-11-26 08:41:45 -05:00
Ehsan 3a3d16435f
[spirv] '++' and '--' for RWTextures/RWBuffers. (#1731) 2018-11-22 09:04:00 -05:00
Tristan Labelle ac18ec5819
Fix row_major being lost through typedefs. (#1723)
The code attempted to cast a QualType to an AttributedType, which would fail if it was in fact a TypedefType. Better use the existing helper function we have.
2018-11-21 08:01:42 -08:00
Minmin Gong c443f019e6 Skip external libraries if they are already included in parent project (#1728) 2018-11-21 07:22:07 -05:00
Helena Kotas 707acef0b4
Barycentric test update; Add RawBuffer Load/Store HLK test entries (#1727)
Add ExecutionTest / HLK test entries for testing RawBuffer Load/Store
Modify HLSL for Barycentric test
2018-11-20 15:20:01 -08:00
Tristan Labelle 0b3c24d00c
Mark built-in types as 'final' to prevent inheritance. (#1726) 2018-11-20 14:08:22 -08:00
Tristan Labelle 685b2afa84
Added support for pre-SM5.1 resource allocation algorithm (#1687)
Added front-end `-flegacy-resource-reservation` to control behavior (added automatically for SM <= 5.0)
Added an error for unbounded resources used with `-flegacy-resource-reservation`
Added a mechanism for `DxilModule` to preserve intermediate options during its passes but not in the final DXIL
Changed `HLModule` to not remove unreferenced `DxilResources` but rather make their symbol UndefValue
Fixed assumptions of `DxilResources` having a valid `GlobalVariable`
Added reserved resource range gather pass before elimination of unused resources (if SM <= 5.0)
Changed resource allocation to account for reserved ranges
2018-11-20 12:01:08 -08:00
Lei Zhang 7a2a95e36c
[spirv] Add support for VK_EXT_scalar_block_layout (#1716)
Ref: https://github.com/KhronosGroup/Vulkan-Docs/issues/854
2018-11-20 11:24:57 -05:00
Tristan Labelle e9dac9bd79
Fix implicit unique_ptr to bool conversion error when compiling with GCC. (#1720) 2018-11-19 16:19:19 -08:00
Tristan Labelle 2ae1365f91
Add an error when bitfields are used. (#1719) 2018-11-19 15:46:50 -08:00
Vishal Sharma 1329fa7da3
Fix crash when casting structs with identical layout (#1718) 2018-11-19 13:41:24 -08:00
Young Kim a5af158629 Support for barycentric tests. Note that this is not the complete implementation as there will be tiers introduced for barycentrics support for preserving provoking vertex.
The current test only tests SV_Barycentrics value.
2018-11-19 11:12:25 -08:00
Tristan Labelle 80ee93547a
Fix assert following reflection changes. (#1717)
DxilModule::GetTessellatorPartitioning didn't follow the model of other methods of returning Undefined when it does not apply to the shader stage and would assert.
2018-11-16 17:05:16 -08:00
Tex Riddell 147eddb112
Disable quick-test/d3dreflect/lib_hs_export1.hlsl (#1680)
- this test, along with lib_hs_shaders_only.hlsl indicate a flaky bug
  in the compiler that still needs investigation.
2018-11-16 11:57:10 -08:00
Tristan Labelle d34f1dcd1b
Changed cbuffer-promoted global vars to have external linkage as to not have initializers (#1713)
Per LLVM rules, globals must be initialized unless they have external linkage. It makes sense to consider constant buffer values as having external linkage, since they are "linked in" by the application, so this change:
* Changes CBuffer globals to have external linkage and no initializer
* Fixes a few cases not handling the lack of initializers properly
* Fixes some tests which were testing for initialization
* Added a test for non-initialization of cbuffer-promoted globals
2018-11-16 09:47:16 -08:00
Tristan Labelle 7e2dda708a
Fixed crash when static methods are used. (#1714)
We were unconditionally trying to manipulate the `this` pointer.
Also added a simple test.
2018-11-16 08:09:19 -08:00
Tristan Labelle 02260b1a8b
Better support for D3D12_SHADER_DESC reflection. (#1704)
Implemented filling out fields related to shader stage properties.
2018-11-15 15:52:22 -08:00
Tristan Labelle a69864789d
Fix crash when assigning to global matrix in compat mode (#1709)
* An earlier bitcast instruction would create an unused GEP instruction referencing the matrix, which the matrix lowering code couldn't handle. Removed that GEP.
* A special case for single-index matrix access was probably meant to catch `m._11` and assumed a value type of float, but it also applied to the first subscript of `m[0][0]`, which returns `floatn`, hence a crash due to mismatched types. The condition was updated to test for non-vector values.
2018-11-15 10:21:43 -08:00
Tristan Labelle cfdf78c9c8
Fixed disassembler structured buffer layout output and added tests. (#1708) 2018-11-15 08:50:40 -08:00
Tex Riddell 9b75d0fc6d
Fix subobject raw bytes storage; don't point into RDAT for reflection (#1710)
* Fix subobject raw bytes storage; don't point into RDAT for reflection

DxilSubobject:
- combine string and raw bytes storage in m_BytesStorage
- use StringRef as key, since memcmp is used with explicit length

DxilRuntimeReflection:
- add m_BytesMap for local unique copy of raw bytes in RDAT
  to prevent pointing into RDAT blob for root sig
- clean up some insertion patterns

* Rename Get[SubobjectString/RawBytes] to Intern[String/RawBytes]
2018-11-14 20:36:52 -08:00
Helena Kotas 12efa402cf
Update hctstart.cmd to be able to find CMake from VS Professional and Enterprise (#1699) 2018-11-14 19:57:01 -08:00
Tex Riddell 92b779d40a
Fix missing hitgroup type in DxilRuntimeReflection (#1707) 2018-11-13 15:43:13 -08:00
Tex Riddell fbe1371aae
Fix Validation for RDAT and other issues with Subobjects (#1706)
- re-serialize module when changed by removing either subobjects or
  root signature metadata
- improve error detection/handling for loading/creating subobjects
- load subobjects from RDAT if not in DxilModule for RDAT comparison
- fix subobjects missing from desc in DxilRuntimeReflection
- default ReducibilityAnalysis to pass so it doesn't fail when no
  functions are present
- report error on subobject if validator (< 1.4) will not accept
  them, so they will not be captured
- container validation for required/disallowed parts for libraries
2018-11-13 14:49:32 -08:00
Tristan Labelle 7a18290e77
Set default floating-point environment at compiler boundaries (#1703)
Restore floating-point environment at compiler boundaries, and add a test for this.
2018-11-13 11:51:25 -08:00
Shoeb Patel 9bcb3a5b81 Updated comment to fix typo (#1637) 2018-11-13 11:06:23 -08:00
Tex Riddell bbf1b89f18
DxilSubobjectDesc: Reorder Name/Kind for runtime alignment (#1696) 2018-11-12 16:53:33 -08:00
Tristan Labelle 4d83bb4cce
Added a test for gather/load of textures of 16-bit types. (#1689)
Fixes #739
2018-11-12 11:47:08 -08:00
Lei Zhang de62ed4fe3 [spirv] Allow aliasing builtin variables (#1691)
This behavior is supported by FXC.

Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1690
2018-11-11 14:01:28 -05:00
Helena Kotas d75f96aabb
HitGroup subobject changes (#1688)
- Replace HitGroup subobject by TriangleHitGroup and ProcedurePrimitiveHitGroup
- Add internal HitGroupType enum that maps to D3D12_HIT_GROUP_TYPE
- Add corresponding HitGroupType field to metadata, RDAT and reflection
2018-11-09 17:50:04 -08:00
Tristan Labelle 90ed5a43a4
Remove unsupported /O4 option from help text. (#1662) 2018-11-08 14:16:24 -08:00
Xiang Li 7ecfd0ad2a
Add D3DPreprocess to d3dcompiler_dxc_bridge. (#1681)
* Add D3DPreprocess to d3dcompiler_dxc_bridge.

* Avoid throw in D3DCompile and D3DPreprocess.
2018-11-08 10:33:58 -08:00
Tristan Labelle d47cbb6579
Fixed [unroll] being interpreted as [unroll(1)]. (#1669) 2018-11-08 10:32:32 -08:00
Lei Zhang ee00dc18d6
[spirv] Add half as allowed (RW)Buffer element type (#1678)
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1672
2018-11-07 17:26:35 -07:00
Helena Kotas 2a7c520fcb
Fix memory allocation issues (#1679)
- DxilModule was not freed
- PragmaMatrixHandler was freed twice when the compiler execution was aborted
  prematurely by an exception
- Improve diagnostic tracing in CompilerTest::CompileWhenNoMemThenOOM
2018-11-07 12:51:37 -08:00
Lei Zhang 740b6701af
[spirv] Add support for casting involving vector decomposition (#1677)
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1673
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1675
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1676
2018-11-06 13:34:16 -07:00
Tex Riddell 45028ac8e5
Fix ViewportOrRTArrayIndex feature bit compat with validator 1.3 (#1664) 2018-11-05 18:10:57 -08:00
Tristan Labelle 1a527de97c
Added support for custom include paths when compiling with /P (#1666)
The include paths were not piped as preprocessor command args. Includes a test.

Fixes #1636
2018-11-05 13:20:26 -08:00
Tristan Labelle 182067cafd
Changed default compilation options to honor #line directives and added tests. (#1665) 2018-11-05 10:12:49 -08:00
Helena Kotas b7d1c195c5
Add root signature flags (#1663)
* Add root signature flags

- Add LOCAL_ROOT_SIGNATURE flag in RootFlags
- Add DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS flag in DescriptorTable
- New DxilRootSignatureCompilationFlags argument on Compile/ParseRootSignature
  to specify whether the root signature is local or global.

* Fix root signature flag issues, add cmd test for root sig from define
2018-11-02 23:52:32 -07:00
Helena Kotas b77a577f5b
Subobject tests (#1657)
Add error on empty root signature value or subobject to export association.
2018-11-02 13:52:57 -07:00
Tex Riddell b418716256 BUILD (disabled opt.exe): fix opt.cpp include path 2018-11-02 12:21:50 -07:00
Tex Riddell cc388c1721
Use CHECK-DAG on validation test when error order may be different (#1659) 2018-11-01 19:37:00 -07:00
Xiang Li 238e6a4f41
Disable eliminate output dynamic indexing for HS. (#1655)
* Disable eliminate output dynamic indexing for HS.

* Fix build warning and remove test.
2018-11-01 18:51:27 -07:00
Helena Kotas bfbe9fab38 Reorder RDAT sections back to previous order (#1658) 2018-11-01 17:26:36 -07:00