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

78 Коммитов

Автор SHA1 Сообщение Дата
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 c8184d216c [linux-port] Dummy access to unused variables (#1325)
Simply including a variable as the entirity of an expression is
insufficient to silence warnings for gcc and clang. The variable
is not reported as unused, which is the intent, but the expression
result is reported in a warning as unused. By casting that
expression as (void), both warnings are silenced.
Fixes 110 clang and 40 gcc warnings.
2018-06-01 19:44:16 -04:00
Ehsan e6d169dcf1
[linux-port] Avoid using enum class as set key. (#178) (#1288)
Using an enum class as the key of an unordered_set is supported starting
C++14.

The two possible solutions are: a) provide a hash function b) cast to
unsigned. Given the usage here, it latter is a simpler fix.
2018-05-16 13:04:16 -04:00
Greg Roth d9738f8889 [linux-port] Fix template ambiguities (#1277)
Templated iterators often have a dependent scope, which annoys
some compilers because they can't tell if the typename evaluates
to a type or a variable name. This adds typename keywords to
remove the ambiguity in removeResources.

Additionally, the std toupper function can't be found for the sake
of the templated call to std::transform in ValidateSignature
function. By adding :: to clarify it, the template can be evaluated.
2018-05-12 07:52:00 -04:00
Greg Roth d27307905c Make correct/consistent include capitalization (#1269)
Several #included files were capitalized incorrectly in the case of
files pertaining to the project, or inconsistently in the case of
Windows headers which are typically only relevant where capitalization
doesn't matter. In spite of that, consistent capitalization can be
useful for cross platform stubbing purposes.

This corrects capitalization of a few Dxil* headers and forces
capitalization of Windows-specific headers to be consistent with
the overwhelming majority of other cases.

No functional change, just cross-platform facilitation
2018-05-10 10:47:52 -07:00
Lei Zhang c82edd6c5f
Change SAL __override to C++11 override (#1212) 2018-04-26 15:18:56 -04:00
Young Kim 2af98c8a43
Bump up version number. (#1066)
bump up version to SM6.3 and DXIL1.3
2018-02-12 13:27:48 -08:00
Young Kim a43147de94
Add validation for Quad operations against non pixel shaders (#986) 2018-01-16 10:33:47 -08:00
Young Kim 1d48a06455
Add validation to check unknown function attributes (#963) 2018-01-04 17:01:10 -08:00
Xiang Li b816c124f1
Support resource select for lib profile. (#940) 2017-12-20 10:47:29 -08:00
Xiang Li 4f7016af53
Support isfrontface as uint. (#919) 2017-12-13 20:41:51 -08:00
Young Kim 3cad152a90
Template argument for byteaddressbuffer load store (#804)
This change removes new Load variations (LoadHalf, LoadFloat, etc) for RWByteAddressBuffer/ByteAddressBuffer methods and add templated Load intrinsics. This templated Load only works on scalar or vector types, and its variations (Load2, Load3, Load4, etc) do not work with templates and work as it did before (only storing uints). For Store operation, you can store any scalar or vector types of up to 16 bytes, while prior to 2018 Store only supported storing uint scalar.
2017-11-15 18:47:12 -08:00
Young Kim 2c140f795c
RawBufferLoad and new methods for ByteAddressBuffer (#762)
This change is an extension of float16 support. We are adding LoadHalf, LoadFloat, and LoadDouble method to byte address buffer so that users can access data from byte address buffer by these types. Also starting shader model 6.2, we are mapping byte address buffer and structure buffer load/store operations to RawBufferLoad/Store to differentiate raw buffer load from typed buffer load. Unlike BufferLoad for typed buffers, RawBufferLoad for min precision types will not have its min precision values as its return types, but their actual scalar size in buffer (i.e rawBufferLoad.i32 for min16int and rawBufferLoad.f32 for min16float). RawBufferLoad/Store contains additional parameters, where mask was required for correct status behavior for CheckAccessFullyMapped, and alignment is for relative alignment for future potential benefit for backend.
2017-11-07 18:15:19 -08:00
Young Kim 8c55bbbe6d
Denorm to function attribute (#764)
- Denorm mode to function attribute not function annotation
- Adding validation rule for fp32-denorm-mode



* Fix from comments
2017-11-06 18:09:14 -08:00
Xiang Li d8cefeb1ba
Make sure status only used by CheckAccessFullyMapped. (#763)
* Make sure status only used by CheckAccessFullyMapped.
2017-11-03 18:12:15 -07:00
Young Kim ce9d6267a5 DataLayout String and ConstantBuffer Offset Fix (#727)
This change is to update correct target data layout for DXIL. Now that we have a scalar type of size less than dwords, we need to correctly print string data layout to determine non-packed structure layout.

This change also fixes alignments issues with ConstantBuffer as it was having different CG path from cbuffer.
2017-10-26 14:51:50 -07:00
Young Kim 40369a5884 Structure alignment Change (#721)
Structure buffer alignment change for float16. Starting in shader model 6.2, the structure will match that of #pragma pack(8) alignment in C++

Removing padding for structure buffer. We will not have any padding in HLSL structure since load/store operation already handles offset as if padding exist in #pragma pack(8) mode in C++

Disable legacy alignment for non precision mode as it was only needed for min precision
2017-10-20 13:51:42 -07:00
Young Kim 223a885613 Group Signature Elements by Element Width (#610)
This change is to enforce the new constraint on signature packing: pack signature elements by data width. Before we introduce fp16 type, every element was assumed to reserve 32 bits. Since we are introducing a new 16 bit data type, we need a new way to enforce signature rules.

After discussions we decided that it would be nice to pack elements based on data width. However, we are still enforcing the rule that each row contains up to 4 elements, regardless of the size. This way, depending on the hardware support drivers can optimize packing signatures, while on DXIL level we maintain the assumption that there are 4 elements per row. We are also still constraining on the total number of rows to be 32 for now. This can be changed in the future if people find this limit to be an issue.
2017-09-06 11:04:33 -07:00
Young Kim b89c21d25b Fp16 constant buffer and shader flag (#575)
This change is to support fp16 on constant buffer.
We are still keeping a row pitch of 4 dwords. So we can fit up to 8 halfs in one row.
Dword data types will be aligned to dword address space for efficiency. We are also introducing new flags "use native low precision" if we have low precision type present and /no-min-precision option is enabled.
2017-08-21 15:06:45 -07:00
Xiang Li 3f866d5e70 Use lazy load for linking. (#527) 2017-08-07 12:14:24 -07:00
Young Kim 55667043c3 Support denorm option (#446)
This change is to support preserve denorm operations. We do this by creating dxc options and propagate them all the way to dxil metadata so that drivers can see how it should handle floats.
Currently we support three modes: any(default), preserve, and ftz

Denorm option will be of per function flag. We store this information at function annotation metadata. This means that for DXIL 1.2 we have a new structure for function annotation. The change in structure is documented on DXIL.rst
2017-07-27 10:08:14 -07:00
Xiang Li c1973d761c Code Cleanup. (#475)
Add default for switch to avoid warnings.
2017-07-26 21:35:02 -07:00
Xiang Li 96c9c0597c Code cleanup. (#469)
1. Move DxilEmitMetadata out of DxilGenerationPass.cpp
2. Move helper function out of HLModule.
2017-07-26 11:02:20 -07:00
Young Kim 4d325c78b4 Update shader model 6.2 (#435)
1. Update shader model 6.2
2. update DXIL version to 1.2 and its tests
3. Allow noalias and alias_scope metadata per instruction for validator 1.2
2017-07-19 22:00:31 -07:00
Marcelo Lopez Ruiz d5bb3089cf Add support for custom allocators (#390)
Supporting a custom allocator for dxcompiler.
Adds recovery for exceptions and out-of-memory handling.
Add custom allocator support to linker.
Fix for release-only test failure.
Removes assertion about presence of command-line option registration
2017-07-06 16:45:48 -07:00
Xiang Li e380b8e915 Add dxcutil to share code. (#350) 2017-06-12 18:00:39 -07:00
Tex Riddell 877bc18366 DxilValidation accept more legal component types in signatures (#305)
- Fixes SV_Position must be float4 #89
- Needs additional testing and comparison of flexibility with fxc.
2017-05-17 14:35:45 -07:00
Tex Riddell c7212ee216 Refactor DxilSignatureAllocator to remove DxilSignature dependencies 2017-05-16 20:13:03 -07:00
Tex Riddell c95244404a Copy ViewID state to PSV data and select PSV version based on validator (#291)
* Make validator version a first-class citizen of DxilModule

* Add validator version checks to DxilContainerAssembler
- eliminates need to check validator version in dxcompilerobj.cpp

* Copy dynamic index mask and ViewID state to PSV data
- Make const version of DxilViewIDState::GetSerialized() that just returns serialized state
2017-05-12 14:27:22 -07:00
Young Kim f66e8083d6 Allow two SV_Barycentrics (#282)
unlike other system value semantics, pixel shader is allowed to declare at most two input attributes with SV_Barycentrics, with one declaration uses perspective interpolation type while other one uses noperspective interpolation type.
2017-05-09 18:59:30 -07:00
Marcelo Lopez Ruiz ad76d814a4 Debug name part implementation (#264)
* Add documentation with source-level debugging with HLSL and DXIL.
* Fix trailing underscore in generate .rst documentation.
* Add container support for debug name part.
* Bump validator version to 1.1.
* Implement debug stripping in dxc, including /Fd dir-named behavior.
* Implement IDxcCompiler2 and CompileWithDebug.
2017-05-09 18:32:48 -07:00
Tex Riddell da5f98bb95 Updates to DxcValidator and DxcCompiler wrt. versioning/flags (#269)
Make DxcCreateInstance load validator from dxil.dll when available
Add DxcVersionInfoFlags_Internal flag to indicate internal validator
Add DxcValidatorFlags_ModuleOnly to indicate absense of full container for validation, requiring explicit use. This will not succeed when using dxil.dll validator.
Bump Validator version
Implement IDxcVersionInfo in DxcCompiler to indicate DXIL highest version supported and debug flag for compiler separately from validator
Refactor version detection code for tests, adding dxil and validator versions
Make SystemValueTest version aware
Add version check to AttributeAtVertex and SV_Barycentrics tests.
Fix line endings for HlslTestUtils.h
2017-05-04 22:18:57 -07:00
Young Kim 13cf7d466c Update barycentric with new spec (#265)
1. Adding SV_Barycentric and removing barycentric intrinsics/dxilops
2. GetAttributeAtVertex only thakes no_interpolation attribute
3. SV_Barycentric can take any interpolation modifier except nointerpolation
4. SV_Barycentric can only have float3 type
2017-05-03 17:07:02 -07:00
Tex Riddell c0d3163ee3 Dxil versioned OpCode/Class counts, and other dxil versioning fixes (#263) 2017-05-02 14:42:05 -07:00
Tex Riddell bd6c105e9b Add ViewID slot validation for PSIn (#254) 2017-05-01 17:54:33 -07:00
Tex Riddell a581927370 Add SV_ViewID support (#251)
- Add SV_ViewID loaded from intrinsic in Dxil,
  for input to all graphics shader stages
- hctdb: rename shader_models to shader_stages,
  add shader_model for min required shader model
- Validator: validate dxil version required for shader model
- DxilModule: Add GetDxilVersion
- Set Barycentric intrinsics to SM 6.1
- Update SystemValueTest for SM 6.1
2017-04-27 14:17:31 -07:00
Young Kim 108b897f40 Barycentric init (#250)
This change is the initial step to support Barycentric coordinates for shader model 6.1 / DXIL 1.1
 - Add GetBarycentrics, GetAttributeAtVertex intrinsics and their corresponding dxil ops
 - Lowering intrinsics to dxil ops
 - Adding codegen tests for these operations
2017-04-26 12:29:48 -07:00
Marcelo Lopez Ruiz 843be2528a Close #62: strange error output on recursive function calls (#150)
* Traverse call graph to report recursive calls in the front-end.
* Emit function declarations only as needed.
* Fix extra echo output in hctbuild help.
* Remove unused test case.
2017-03-28 00:12:55 +01:00
Xiang Li 9ea3e5f44b Enable SampleCmpLevelZero for all shader profiles. 2017-02-10 11:43:30 -08:00
Tex Riddell b8594d7ddc Fix build break from automatic merge. 2017-02-09 19:03:47 -08:00
Tex Riddell a6433c18f8 Merge pull request #76 from tex3d/integration
Integrate validation, dxc option, and other changes
2017-02-09 17:33:45 -08:00
Xiang Li cb0ba446c1 Fix validation bugs. (#10) 2017-02-07 22:18:10 -08:00
Tex Riddell 627763e563 Add tests and fix bugs with container and root signature validation (#5)
* Fix ValidateDxilBitcode PSV generation for Root Signature validation.
- also fix validation for empty patch constant signature.
* Test container and root signature validation.
* Fix DXASSERT when PC in/out patch sig mismatch HS.
2017-02-07 16:57:07 -08:00
Tex Riddell f6d4581fc6 Merge branch 'integration' into val 2017-02-07 13:03:53 -08:00
Tex Riddell 74049c5852 Integrate: Fix to CATCH_CPP_ASSIGN_HRESULT and validation of named metadata 2017-02-07 13:02:37 -08:00
Xiang Li 5091d4f189 Add default for switch to avoid warnings. (#70) 2017-02-07 11:34:34 -08:00
Tex Riddell a3e0b5828d ContainerAssembler and Validation fixes.
- zero DxilProgramSignatureElement to prevent garbage in signature
- rewrite bitcode when stripping root signature
- use correct part when reading debug module in ValidateDxilContainer
- report general error message when signature validation fails
2017-02-03 19:04:02 -08:00
Xiang Li 7b998429f3 Disable race condition check (#3)
* Write thread group uniform value will not cause race condition.

* Only report race condition when know the data is not uniform.

* Disable race condition check.
2017-02-03 15:37:57 -08:00
Tex Riddell 0647154af0 Move Signature metadata to named node and some other cleanup. 2017-02-03 14:28:21 -08:00
Tex Riddell 2444ae3b10 Add DxcValidatorFlags_RootSignatureOnly. 2017-02-03 12:28:57 -08:00