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

1034 Коммитов

Автор SHA1 Сообщение Дата
Jeff Noyle 004c681a97
Move PIX options out of DxilGenerationPass.*, use option string properly, reduce header usage (#1022)
* Clean up option usage, includes, and move PIX passes to their own header

* move utils to header

* use radix, pass proper default
2018-01-26 15:43:44 -08:00
Xiang Li 53c54eb8b7
Add IDiaInjectedSource to dndxc. (#1025)
* Add IDiaInjectedSource to dndxc.

* Implement findFileById
2018-01-25 12:24:09 -08:00
Marcelo Lopez Ruiz c8c6ed8128
Adds support for inf literals and for asuint in constant expressions (#1029) 2018-01-25 10:28:09 -08:00
Lei Zhang 1c24fef0bf
[spirv] Consider storage class when creating temporary variable (#1027) 2018-01-24 11:27:48 -08:00
Sebastian Tafuri 0915ae5458 Removed inline from function to solve unresolved link error (#1026) 2018-01-24 08:23:43 -08:00
Ehsan dd487ffec7
[spirv] Use entry point attr to find correct PCF. (#1024) 2018-01-24 10:10:12 -05:00
Ehsan 334c232e8e
Add GetDimensions() method for TextureCube(Array). (#1023) 2018-01-23 13:51:26 -05:00
Lei Zhang c616efef3e
[spirv] Fix neglecting majorness on cbuffer/tbuffer members (#1018)
cbuffers/tbuffers are handled differently than other resource types
becuase their members do not need to be qualified when using.
That is, their members are distinct entities. However, in SPIR-V,
we need to generate one single entity to hold them all for all
members in a cbuffer/tbuffer.

Previously we didn't record the marjorness annotated on each member,
which results in returning the wrong types for members.
2018-01-23 09:16:06 -08:00
Lei Zhang cd275db5b4
[spirv] Handle selecting resources using conditional operator (#1021)
The AST won't have LValueToRValue implicit casts for all three
operands for such cases.
2018-01-23 08:14:00 -08:00
Lei Zhang 37e3ec9ebf
[spirv] OpLoad for lvalue operands of binary operators (#1020)
Some times we won't have proper LValueToRValue implicit cast for
binary operator operands; HLSLVectorElementExpr is one example.
2018-01-23 08:13:44 -08:00
Lei Zhang 05a5fd7759
[spirv] FloatConversion for structs with one single member (#1019)
For a struct T with only one member of type S, (T)<an-instance-of-S>
is allowed and will be interpreted as constructing an instance of
T using the instance of S as its member.
2018-01-23 08:13:20 -08:00
Lei Zhang fe57ed4c9b
[spirv] Handle vector<literal int/float, 1> in type hints (#1017)
isVectorType() only returns true for real vectors with more than
one element.
2018-01-23 08:12:48 -08:00
Lei Zhang 14c3c0d92c
[spirv] Add initial support for specialization constant (#1009)
This commit add support for generating OpSpecConstant* instructions
with SpecId decorations. Spec constants are only allowed to be of
scalar boolean/integer/float types. Using spec constant as the array
size does not work at the moment.
2018-01-22 15:36:14 -05:00
Marcelo Lopez Ruiz 528bcf354c
Fixes #823 - Compile crashes if pSourceName if nullptr/empty (#1011)
Code had a (reasonable) assumption that sources have names, but the
entry point wasn't verifying that. For compat with prior compilers and
the annotation, we choose to support it. Unlikely other implementations,
the name is a simple hard-coded one, instead of varying, to allow for
easier deduping when the output is checked (name is in debug section).
2018-01-22 12:30:09 -08:00
Marcelo Lopez Ruiz a3b3c37720
Fixes #679 - missing scenario with *it is of type FunctionDecl (#1012)
Functions within cbuffers declarations are effectively global functions.
Includes a test case for copying cbuffers that have nested functions.
2018-01-22 12:29:45 -08:00
Lei Zhang b8cccfd521
[spirv] Comine type and constant in SPIRVModule (#1016)
Types and constants are interdependent. Previously we use different
members for storing them, which requires hacks to output types
and constants in the correct order to satisfy their dependencies.
However, with specialization constants, things will be more
complicated. Using the same member to store all of them solves
the problem naturally.
2018-01-22 14:24:52 -05:00
Lei Zhang 878441553f
[spirv] Handle function definitions in cbuffer/tbuffer (#1015)
These function definitions are like normal file-scope ones.
2018-01-22 13:29:35 -05:00
Jeff Noyle a48775cfe3
PIX: adding GS to list of debug targets (#1010)
* Add gs prolog, tests

* update CHECK params to use pattern-matching
2018-01-22 09:14:30 -08:00
Lei Zhang b9f4e84e11
[spirv] Remove spec constants from Constant class (#1014)
Specialization constants are more like variables. Unlike normal
constants, we cannot unify spec constants, even if two of them
have exactly the same arguments. Neither can we replace a spec
constant with its default value (initializer) or folding exprs
containing spec constants.

We can use the SpecId decoration to distinguish spec constants
with the same arguments, but the problem is that not all spec
constants have SpecId decorations. Only those explicitly marked
in the source code have, derived ones do not.

Also, we cannot decorate normal constants. So we can remove the
decoration member in the Constant class.
2018-01-22 10:49:28 -05:00
Lei Zhang 4cbada6181
[spirv] Translate SubpassInput(MS) and their methods (#1013) 2018-01-22 10:45:56 -05:00
Lei Zhang fa1e7cddd0
[spirv] Add SubpassInput(MS) and vk::input_attachment_index (#1000)
Two new Vulkan specific intrinsic resource types, SubpassInput and
SubpassInputMS, are introduced to provide a way to use subpass inputs
in Vulkan. Their signatures:

template<typename T>
class SubpassInput {
  T SubpassLoad();
};

template<typename T>
class SubpassInputMS {
  T SubpassLoad(int sample);
};

T can be a scalar or vector type.

If compiled without ENABLE_SPIRV_CODEGEN, the compiler will report
unknown type name for SubpassInput(MS). If compiled with SPIR-V
CodeGen and trying to use SubpassInput(MS) in DXIL CodeGen, the
compiler will report an error saying the type is Vulkan-specific.

A new Vulkan-specific attribute, vk::input_attachment_index is
introduced to provide a way to set the input attachment index for
SubpassInput(MS) objects.
2018-01-20 17:16:39 -05:00
Jeff Noyle ad3e51b1dd
New pass for PIX "shader access tracking" (#998)
* py changes

* checkpoint

* wrong overloads for a couple ops

* Correct out-of-range checking

* test

* RTV

* Add shader access tracking and reportage of dynamically indexed registers

* Uniquify and encode proper register index!

* remove unncessary noise

* rename a var
2018-01-19 14:47:06 -08:00
Lei Zhang 6af2a123d8
[spirv] Add support for .GetSamplePosition() (#1008)
This only supports .GetSamplePosition() for standard sample
positions, i.e., sample count is 1, 2, 4, 8, or 16. For other
cases, the method will just return float2(0, 0).
2018-01-19 16:00:23 -05:00
Marcelo Lopez Ruiz bf0fdb5bba
Update README.md 2018-01-18 23:08:40 +00:00
Lei Zhang 8ba5715c81
[spirv] Use unified1 grammars and headers in SPIRV-Headers (#1007)
This requires us to regenerate the InstBuilder class and also
manually pin the SPIR-V version as 1.0 instead of relying on
spv::Version.

Also refreshed SPIRV-Tools
2018-01-18 15:14:05 -05:00
Young Kim ccb72b97ef
Fix for CorrectTypo lookup for intrinsics (#1006)
Fix for CorrectTypo lookup for intrinsics.
2018-01-17 10:32:38 -08:00
Young Kim 1e07446f9e
Allow int16 types for any/all intrinsics (#1004) 2018-01-16 14:49:55 -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 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