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

1157 Коммитов

Автор SHA1 Сообщение Дата
Young Kim a43147de94
Add validation for Quad operations against non pixel shaders (#986) 2018-01-16 10:33:47 -08:00
Young Kim e18b9a9a0b
Update comment for linear search on intrinsic lookup (#993) 2018-01-16 10:03:00 -08:00
Lei Zhang 79f4da1500
[spirv] Support float[1] as the type of SV_InsideTessFactor (#1003)
Some developers use float[1] instead of float as the type for
SV_InsideTessFactor when input topology is "tri".
2018-01-16 12:54:52 -05:00
Lei Zhang 4b2cbf2167
[spirv] Legalization: associated counters in implicit objects (#1002)
An implicit object is translated into the first argument to the
method call. If the implicit object is of struct type and its
fields have associated counters, we need to assign its associated
counters accordingly like other normal arguments.

For each such method, we generate associated counters for its
implicit object. At a call site, we assign the associated counters
from the real object to the ones associated with the method implict
object.

Also refreshed SPIRV-Tools
2018-01-15 17:10:28 -05:00
Ehsan fb8eac6c83
[spirv] Better handling of ternary and binary ops. (#995)
* [spirv] Better handling of ternary and binary ops.

This change does type handling more properly and removes a hack
regarding binary ops. Also fixes the way ternary ops provide hints about
usage of literal types.
2018-01-15 15:10:41 -05:00
Lei Zhang 690b44ec16
[spirv] Legalization: associated counter in nested structs (#1001)
This commit supports assigning nested structs as a whole,
which means to go over all fields' associated counters and
assign to the corresponding fields. The front end parsing
and semantic analysis should guarantee the type matching.
2018-01-15 14:19:56 -05:00
Lei Zhang 6f6c600ebc
[spirv] Legalization: associated counter in structs (#997)
For structs containing RW/Append/Consume structured buffers, to
properly track aliasing and use the correct associated counter
for each buffer after legalization, we need to create temporary
counter variables for all struct fields that are RW/Append/Consume
structured buffers and assign them accordingly if the corresponding
buffer field is updated.

Because of structs, now we have four forms an alias RW/Append/
Consume structured buffer can be in:

* 1 (AssocCounter#1). A stand-alone variable,
* 2 (AssocCounter#2). A struct field,
* 3 (AssocCounter#3). A struct containing alias fields,
* 4 (AssocCounter#4). A nested struct containing alias fields.

For AssocCounter#3 and AssocCounter#4, it means we need to update
all fields' associated counters.

This commit only handles the first three forms.
2018-01-15 11:49:14 -05:00
Lei Zhang 9c8ab68f55
[spirv] Fix lvalue/rvalue handling (#994)
* Loading the pointer from an alias variable turns the evaluation
  info into lavalue again.
* loadIfGLValue() should suppress the immediate LValueToRValue
  implicit cast.
2018-01-12 15:13:45 -05:00
Lei Zhang 1525a56558
[spirv] Forbid using buffers as initializers and code refactoring (#992)
* Counter variable emission is merged into getTypeForPotentialAliasVar
* Changed to use DeclaratorDecl instead of ValueDecl for some methods
* collectArrayStructIndices is extended to suppor raw index
2018-01-12 10:31:35 -05:00
Ehsan 4fd4c66cb9
[spirv] Handle all types for ternary op (#989)
HLSL ternary operator allows scalar, vector, and matrix arguments.
The SPIR-V CodeGen used to use OpSelect which only works on scalars and
vectors.
2018-01-10 15:47:39 -05:00
Ehsan 72d4fcc4e0
[spirv] Fix cast function when src type is literal (#988) 2018-01-10 13:11:52 -05:00
Lei Zhang 6b2ad7fafb
[spirv] Fix array of non-matrix with -Zpr (#984)
Previously we will return defaultRowMajor as long as the type
is an array. That will hit an assertion failure in translateType()
for arrays of non-matrices.

Also refreshed SPIRV-Tools
2018-01-10 10:27:12 -05:00
Ehsan 7ad893a79e
[spirv] Better handling of ConditionalOperator. (#983)
Also improved the literal type hints.
2018-01-10 10:26:12 -05:00
Ehsan 231619361a
[spirv] Ignore const-ness when comparing types. (#985) 2018-01-10 10:15:45 -05:00
Thomas Raoux e1dea871c5 Add Intel support info to Hardware support section (#987) 2018-01-10 07:09:21 -08:00
Lei Zhang 582c3813d6
[spirv] Legalization: indexing StructuredBuffer containing array (#982)
We need to call loadIfAliasVar() to set the correct storage class
and layout rule for the pointer type.
2018-01-09 15:26:27 -05:00
Young Kim 48b0002927
Clean up Execution Test (#933)
- Fix warnings for implicit type conversions
 - Block tests for 6.2 if driver does not support 6.2
2018-01-09 12:18:58 -08:00
Lei Zhang 4e01373037
[spirv] Fix extra OpLoad when using images on lhs of assignment (#981)
When using a storage image on the lhs of a compound assignment,
we need to load the image and do the calculation with rhs first
before actually assigning back to the storage image again. That
load won't result in an OpAccessChain, actually it will result
in a rvalue.
2018-01-09 13:41:21 -05:00
Lei Zhang ca1df7b35c
[spirv] Fix vector swizzling on RWBuffer/RWTexture elements (#979)
For such vector swizzling, we cannot get the pointer and use OpStore
like normal vectors. Instead we should use OpImageWrite.
2018-01-09 11:22:38 -05:00
Lei Zhang 7ef612d3a4
[spirv] Fix out/inout vector parameter assignment (#978)
Some entities, if passed as arguments to out/inout vector parameters,
will need more complicated scheme for assignment.
2018-01-09 10:53:42 -05:00
Lei Zhang faf46e28be
[spirv] Fix bugs and re-enable CCP optimization pass (#977) 2018-01-08 17:37:31 -05:00
Lei Zhang 4c190e74f0
[spirv] Fix method call on temporary struct containing aliases (#976)
A temporary struct object containing alias fields are already
a rvalue. We should avoid loading it again in the CodeGen.
2018-01-08 14:56:39 -05:00
Lei Zhang 02bc6fae08
[spirv] Legalization: validate with relaxed logical pointer (#975)
We still want to make sure that the generated raw SPIR-V does not
have other validation errors except for allocating variables
containing pointers and returning pointers.
2018-01-08 14:08:48 -05:00
Lei Zhang 415e190a8b
[spirv] Legalization: support structured/byte buffer in structs (#970)
We need to change the type of these struct fields to have an extra
level of pointer.

A local resource always has void as its layout rule (because local
resource is not in the Uniform storage class). So in the TypeTranslator,
when we are trying to translate a structured/byte buffer resource that
has void layout rule, we know it must be a local resource. Then we
apply an extra level of pointer to it. Because of TypeTranslator is
recursive, that automatically handles both stand-alone local resources
and the ones in structs. 

In the SPIRVEmitter, we need to have a way to tell whether a resource
is a local resource or not because if it is a local resource, we need to
OpLoad once to get the pointer to the aliased-to global resource.
That's why we have the containsAlias field in SpirvEvalInfo. We set it to
true in getTypeForPotentialAliasVar() for local resources. And do an
extra OpLoad to get the pointer in SPIRVEmitter if it is true.
2018-01-08 11:47:55 -05:00
Lei Zhang f9d613b795
[spirv] Add support for -fvk-invert-y (#967)
This is to accommodate Vulkan's coordinate system, which is different
from DX's.
2018-01-08 11:42:47 -05:00
Lei Zhang 0b76ed720f
[spirv] -fcgl does not imply -Vd anymore (#974) 2018-01-08 11:26:50 -05:00
Lei Zhang 46c0e3cf2f
[spirv] Use temporary variable for method call on static variable (#973)
Static variables are in the Private storage class but all methods
are generated to take pointers of the Function storage class. So
to call a method on a static variable, we need first create a
temporary variable initialized with the contents of the static
variable. After the method call, we also need to write the contents
back to the static variable in case there are side effects.
2018-01-08 10:52:11 -05:00
Sebastian Tafuri 1eaf553cfb [spirv] Respect default matrix order set from command line(#961) 2018-01-05 22:49:46 -05:00
Marcelo Lopez Ruiz 784173740a
adds support for specifying UI size on command line (#950) 2018-01-05 18:09:41 -08:00
Lei Zhang 2387f691e2
[spirv] Pull in bug fixes and disable CCP in optimization (#971) 2018-01-05 20:21:13 -05:00
Ehsan eeab612da9
[spirv] 16-bit and 64-bit int, uint, and float. (#966)
* [spirv] 16-bit and 64-bit int, uint, and float.

* Added Int64, Uint64, Int16, Uint16.
* Added 16-bit float constants.
* Get the -enable-16bit-types cmd option.
* Add tests for constant Int64/Uint64/Int16/etc.
2018-01-05 16:52:15 -05:00
Lei Zhang 273e2a45af
[spirv] Fix static variable init from different storage class (#969)
If the initializer is in a different storage class, we sometimes
need to decompose it and assign basic components recursively.

Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/968
2018-01-05 10:59:47 -05:00
Young Kim 1d48a06455
Add validation to check unknown function attributes (#963) 2018-01-04 17:01:10 -08:00
Xiang Li 08fbc64c2a
Insert store for incoming value of phi after insert load for phi use. (#964) 2018-01-04 16:14:01 -08:00
Lei Zhang 842749dae7
[spirv] Adjust legalization detection checks (#965)
Instead of checking whether the function signature contains
some opaque types, we check in storeValue(). Since all function
argument evaluation and value return calls storeValue().
2018-01-04 17:21:18 -05:00
Lei Zhang 7ff9ae75e8
[spirv] Refresh dependencies and fix ldexp() translation (#962)
We cannot use GLSL extended instruction Ldexp for ldexp() since
they have different type requirements on the exponent parameter.
2018-01-04 14:34:36 -05:00
Ehsan 5f0b2c7dc1
[spirv] Update the handling of literal types. (#954)
* [spirv] Update the handling of literal types.

Try to figure out what is the intended usage for a literal type (e.g.
'literal int' or 'literal float').

Provide a hint to the TypeTranslator and translateAP{Int|Float} methods
so they better reflect the usage of literal types.
2018-01-04 13:35:56 -05:00
Lei Zhang b3c7bb1a47
[spirv] Validate generated SPIR-V and support -Vd to disable (#955) 2018-01-04 11:59:03 -05:00
Lei Zhang 578b0df014
[spirv] Support embedded struct definition in cbuffer/tbuffer (#953)
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/952
2018-01-03 11:54:03 -05:00
Lei Zhang d39c94c56f
[spirv] Emit warning for packoffset (#951)
We do not support packoffset right now. Emit warning and ignore it.
2018-01-03 10:13:04 -05:00
Lei Zhang 4bee20cac9
[spirv] Legalization: use CCP and enable on HS/DS/GS (#948) 2017-12-21 16:20:52 -05:00
Ehsan 6887b565f4
[spirv] Fix the return type of OpSelect. (#947) 2017-12-21 13:40:42 -05:00
Lei Zhang dfa66b6b9a
[spirv] Refresh SPIRV-Tools and update legalization pass recipe (#946) 2017-12-21 10:44:56 -05:00
Ehsan 5362b3597b
[spirv] Handle GetDimension methods w/ float args. (#944) 2017-12-21 10:20:46 -05:00
Lei Zhang f9b53ba663
[spirv] Emit fatal error for failing to find counter variable (#939) 2017-12-20 20:35:58 -05:00
Lei Zhang 420e638d87
[spirv] Fix ConstantBuffer/TextureBuffer assignment (#929)
Assigning a ConstantBuffer<T> to a T is indeed a copy.
2017-12-20 20:31:55 -05:00
Lei Zhang a269cf44fe
[spirv] Emit counter variables for alias structured/byte buffers (#923)
Also handled updating counter variable aliases in assignment and
function calls.
2017-12-20 20:27:57 -05:00
Lei Zhang eaa3e8e26f
[spirv] Emit alias structured/byte buffer as pointer to pointer (#918)
This is to aid legalization passes to do their work.

For non-external variables of the following types

* (RW)StructuredBuffer
* (RW)ByteAddressBuffer
* AppendStructuredBuffer
* ConsumeStructuredBuffer

An extra level of pointer is applied. We use this extra level of
pointer to indicate that they are aliases. Loads and stores of
these alias variables will get the pointers of the aliased-to-
variables.

Associated counters is not handled in this commit.
2017-12-20 20:23:10 -05:00
Lei Zhang cf39455abf
[spirv] Update doc about variable storage classes (#945) 2017-12-20 18:34:25 -05:00
Lei Zhang 9316ec211f
[spirv] Test atomic intrinsics on primitive types in CS (#943)
Interlocked*() can only be performed on int or uint typed resources
and shared memory variables.
2017-12-20 16:18:06 -05:00