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.
* 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.
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.
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.
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.
Also added the translation for `loop` and `unroll` attributes.
Similar to for loops, the current implementation does not support
early exits, or early returns.
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.
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.
* 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
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.
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.