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

594 Коммитов

Автор SHA1 Сообщение Дата
Lei Zhang 6fd778c14a [spirv] Update SPIR-V.rst doc (#558)
* Restructured sections
* Explained how HLSL semantics are handled
* Highlighted source code
2017-08-14 09:32:43 -07:00
Lei Zhang d98d66564a [spirv] Converted to generate wrapper for entry function (#557)
Previously for an entry function, we decompose its parameters and
return value and create stage input/output/builtin variables from
them directly. This is fine for simple shaders, but it will have
problems for shaders using structs to group stage variables.
Accessing paramters and return values (using operator. and return)
needs special handling for entry functions, which is nasty.

With the wrapper function, we can handle entry functions just like
normal functions. Stage variable handling are all done in the
wrapper funtion.
2017-08-11 16:08:27 -07:00
Xiang Li 8c4f2db67e Add -NoLineDirectives to ignore #line. (#550) 2017-08-11 14:55:45 -07:00
Tex Riddell 2cf2a5cc39 Add D3DReadFileToBlob to bridge (#545)
* Add D3DReadFileToBlob to bridge
* Support default include handler for D3DCompiler bridge.
* Fix include handling for D3D_COMPILE_STANDARD_FILE_INCLUDE
* Only upgrade target if less than 6.0 to allow 6.1 through bridge.
2017-08-11 11:05:56 -07:00
Young Kim 04adcdbfc2 Change resource bindings for OutOfBounds test (#552) 2017-08-11 10:52:11 -07:00
Young Kim 56b7aaf0d9 Fix saturate test to tolerate preserving denorm. (#549) 2017-08-11 10:51:58 -07:00
Tex Riddell be2bb20cde Fix #277 - ignore semantics on resources and samplers during codegen (#544) 2017-08-11 09:56:18 -07:00
Lei Zhang 1e6d05ac59 [spirv] Add test for struct accessing and assignment (#551) 2017-08-11 09:16:27 -07:00
Lei Zhang 35138b401c [spirv] More support for matrices and structs in init lists (#548)
Now we can decompose matrices appeared in init lists. Also we can
decompose and construct structs from init lists.
2017-08-11 09:15:59 -07:00
Ehsan 9d7db791eb [spirv] Translate intrinsic HLSL mul() function (#547) 2017-08-11 09:15:03 -07:00
Ehsan 546597d994 [spirv] Handle early return and discard statements (#546) 2017-08-10 14:33:39 -07:00
Young Kim eacdff2a5c Support FP16 (#471)
This change is the initial step for supporting fp16.

Support half type with /no-min-precision option. This switch can be moved to other master switch in the future as we refine our spec for half support. 
min16float will be treated as half with warnings.
Fix compiler test to take additional arguments, and fix regression tests.
TODO: we need to make decisions on what triggers low precision instead of min precision. Also need to change signature packing and constant buffers for half.
2017-08-10 10:19:43 -07:00
Ehsan 2c10bad1ea [spirv] Support continue and break statements (#543) 2017-08-10 09:56:23 -07:00
Lei Zhang b529d22725 [spirv] Add tests for struct types and emit struct debug names (#542) 2017-08-10 09:54:51 -07:00
Lei Zhang 1da87c6aaf [spirv] Handle static global and local variables (#541)
These variables should be using the Private storage class.
And local static variables should be initialized once.
2017-08-09 15:31:20 -07:00
Lei Zhang c7622ec618 [spirv] Sanitize scalar/vector/matrix type probing methods (#540)
Make the type probing methods in TypeTranslator much more clear
as for their responsibilities.
2017-08-09 15:30:29 -07:00
Ehsan 0a04055996 [spirv] Translation of do-while loops (#539) 2017-08-09 15:29:41 -07:00
Lei Zhang aef18a9966 [spirv] Derive storage class properly from original variables (#538)
We now compute and store decl storage class in DeclResultIdMapper.
Querying is done using RecursiveASTVisitor to check DeclRefExpr,
FunctionDecl, ParmVarDecl, and FieldDecl for normal and remapped
Decls.

Fixed various hard coded storage class in SPIRVEmitter.
2017-08-09 11:55:45 -07:00
Ehsan ff65329ee2 [spirv] Translate more instrinsic functions (#537)
Using GLSL 450 extended instruction set to translate some HLSL
intrinsic functions.
2017-08-09 09:43:27 -07:00
Lei Zhang c5a2da0275 [spirv] Handle variable definitions in if statements (#536)
Also use BinaryOperator methods to test compound assignment and
add tests for typedefs.
2017-08-09 09:24:06 -07:00
Lei Zhang d153fe8e96 [spirv] Support several SV semantics in VS and PS (#534)
Includes: SV_Position, SV_Target, SV_VertexID, SV_InstanceID,
and SV_Depth.

Also use existing DXIL classes for stage variables. There already
exist classes for semantics and SigPoints. Reuse them to create a
StageVar class for holding information about stage variables.
2017-08-08 22:20:00 -07:00
Ehsan b5043877bc [spirv] Support matrices in any, all, asfloat, asint, asuint (#533) 2017-08-08 22:19:14 -07:00
Ehsan ec9cfae3b6 [spirv] Translation of while loops (#532)
Also added the translation for `loop` and `unroll` attributes.

Similar to for loops, the current implementation does not support
early exits, or early returns.
2017-08-08 22:18:51 -07:00
Lei Zhang 378c2224b8 [spirv] Emit OpLogical{|Not}Equal for boolean comparison (#526) 2017-08-08 13:18:50 -07:00
Lei Zhang 76796801b8 [spirv] Optimize floating point matrix scaling codegen (#525)
SPIR-V has a specific OpMatrixTimesScalar for scaling floating
point matrices.
2017-08-08 13:18:26 -07:00
Lei Zhang 50517e7f34 [spirv] Create hlsl::ShaderModel out of shader model string (#524)
Previously we parse the string by ourselves.
2017-08-08 13:18:03 -07:00
Lei Zhang e4db8bda97 [spirv] Revise to provide more initializer list support (#523)
Initializer lists are flexible in HLSL to the extent that as long
as the total number elements is correct, it will be accepted.
To support such flexibility, we need to conduct composite
extraction/construction and proper casting when necessary.

A new dedicated class is introduced for handling initializer lists.
It is built on top of the SPIRVEmitter class. It holds the logic
for correct initializer list handling and calls into SPIRVEmitter
for normal translating tasks. So is in a sense higher level than
the SPIRVEmitter class.

Also extended cast methods and vector type probing functions to
support ExtVectorType since we need to construct ExtVectorType
when handling initializer lists.
2017-08-08 13:17:39 -07:00
Lei Zhang c5832094a6 Allow const evaluating vector initializer lists in the frontend (#522)
Initializer lists in HLSL are very flexible; the front end right
now doesn't handle their const evaluation to the full. This change
only turns on one specific case: intializing vectors.
2017-08-08 09:02:22 -07:00
Young Kim efbd4ae3a7 Fix float literal type conversions. (#531) 2017-08-07 16:42:17 -07:00
Xiang Li e5c0e5ffaa Merge DivergenceAnalysis from llvm3.8. (#528) 2017-08-07 12:14:46 -07:00
Xiang Li 3f866d5e70 Use lazy load for linking. (#527) 2017-08-07 12:14:24 -07:00
Marcelo Lopez Ruiz 669635dec7 Fix dense map grow case with exceptions (#529)
This fixes the OOM test that was failing under Release configuration.
2017-08-05 21:47:10 -07:00
Lei Zhang 1f608e380b [spirv] refactoring for better code structure (#521)
* Moved BlockReadableOrder.h, DeclResultIdMapper.h, and
  TypeTranslator.h into lib/SPIRV so that they are lib
  internal headers
* Extracted the SPIRVEmitter class into its own files

No logic change at all in this commit
2017-08-04 13:51:25 -07:00
Xiang Li eb0894c913 Support static const field with initializer (#520)
* Support static const field of struct.
* Revert "Revert "Add nodup attribute for barrier.""

This reverts commit e435f63b02.
2017-08-04 13:40:31 -07:00
Lei Zhang 32872ab4d2 [spirv] Translate operator[] for vector and matrix types (#519)
A temporary variable will be created if we are indexing into
a rvalue vector/matrix. This is because we can have variables
as indices, which mandates the use of OpAccessChain. And
OpAccessChain requires a variable that can be loaded or stored.
2017-08-04 09:15:46 -07:00
Young Kim 93af33644e Treat min10float and min12int as min16float and min16int in AST (#509)
Currently we had separate built in types for min10float and min12int types that will be promoted to min16float and min16int during codegen time. There can be a potential problem with this such as redefinition of functions with min10float or min16float as function parameters, but Sema cannot recognize their redefinitions. This change is to fix so that we promote these lower min precision types to higher min precision types on AST level so that we can easily handle errors.
2017-08-03 23:50:57 -07:00
Xiang Li b213c2fc43 Add test to make sure LoopUnswitchPass is disabled. 2017-08-03 23:14:22 -07:00
Xiang Li b1479680bb Disable LoopUnswitchPass. 2017-08-03 23:14:22 -07:00
Xiang Li e435f63b02 Revert "Add nodup attribute for barrier."
This reverts commit 30b7f5cd4d.
2017-08-03 23:14:22 -07:00
Xiang Li 524697bf66 Ignore __restrict when check overload. 2017-08-03 23:14:22 -07:00
Xiang Li 00351f3f94 Add nodup attribute for barrier. 2017-08-03 23:14:22 -07:00
Xiang Li 27c4d72141 Fix build error. 2017-08-03 14:24:14 -07:00
Xiang Li aa5a84fba5 Fix bug error caused by DXASSERT. 2017-08-03 14:24:14 -07:00
Xiang Li 5d23e2c3d3 Allow select resource for library profile. 2017-08-03 14:24:14 -07:00
Xiang Li 459b5998a4 Support same resource declared in different lib.
1. Add debug code in CompileFromBlob to help debug in release build.
2. Add dxl to help debug linker.
3. Check type match for resource when link.
2017-08-03 14:24:14 -07:00
Ehsan de4bdebdc6 [spirv] Translate switch statements using if statements (#517) 2017-08-03 11:20:17 -07:00
Lei Zhang 9a2c5cc89d [spirv] Add support for matrix swizzling (#514)
This PR handles two formats for indexing matrices: _mXX and _XX.
The operator[] format will be handled in the next PR.
2017-08-03 10:35:57 -07:00
Lei Zhang 660ab29b70 [spirv] Add support for matrix splatting (#513) 2017-08-03 10:35:25 -07:00
Lei Zhang d6c810d23d [spirv] Support ++ and -- for floating point matrices (#512) 2017-08-03 10:34:59 -07:00
Marcelo Lopez Ruiz 12ea827851 Clean up tabs in dndxc and host render window (#510) 2017-08-03 08:52:33 -07:00