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

764 Коммитов

Автор SHA1 Сообщение Дата
Lei Zhang ae8c5febf7
[spirv] Turn on legalization for invalid opcode (#1058)
Certain opcodes are not available in non-pixel stages.
Call the pass to replace them.
2018-02-06 15:32:53 -05:00
Jeff Noyle bd399a59f4
Remove no-longer-needed stream-out and RTV tracking (#1053)
* Remove no-longer-needed stream-out and RTV tracking

* restore similar enum to match PIX to reduce confusion
2018-02-05 16:44:59 -08:00
Lei Zhang 1f1ea2b7f5
[spirv] Avoid getting constant zero for static resources (#1056)
For static resources not explicitly initialized, we cannot initialize
them since there are no meaningful zero values. Just do nothing.

Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/1055
2018-02-05 17:00:27 -05:00
Lei Zhang 240a5d8e7f
[spirv] Wrap global matrix variables in structs (#1050)
According to HLSL doc, "variables that are placed in the global scope
are added implicitly to the $Global cbuffer, using the same packing
method that is used for cbuffers."

But we emit all global variables as stand-alone SPIR-V variables.
This causes issues for matrix variables since we cannot annotate
them with majorness decoration anymore.

Wrap global matrix variables in a struct to solve the problem.
2018-02-02 12:44:48 -05:00
Lei Zhang 7a86911302
[spirv] Add support for casting from derived to base (#1052)
This is for the explicit (Base)derived kind of cast.
2018-02-02 12:41:33 -05:00
Lei Zhang 67770e37d4
[spirv] Use invalid instruction replacement legalization pass (#1051) 2018-02-02 12:20:34 -05:00
Lei Zhang 9503f80c18
Carry BasePath within CK_HLSLDerivedToBase casts (#1047)
This will enable us to trace back the whole base chain.
2018-02-02 08:26:39 -05:00
Lei Zhang cb47cfd0af
[spirv] Initialize isSpecConstant_ in SpirvEvalInfo (#1049) 2018-02-01 16:12:01 -05:00
Lei Zhang eefa2ffa88
Add missing entry for HLSLDerivedToBase in getCastKindName() (#1045) 2018-01-31 17:21:53 -05:00
Tex Riddell acf2bc48d9
Set !dx.valver in Linker (#1031) 2018-01-31 13:45:54 -08:00
Lei Zhang 88b02078a1
[spirv] Accept array types for PS stage input variables (#1044)
We need to check the element types of PS input variables to
properly apply interpolation decorations. Previously the method
used to query element type does not support array types, which
caused an assertion eventually.
2018-01-31 12:31:15 -05:00
Lei Zhang a7aaccef9f
[spirv] Support OO inheritance in GS stage IOs (#1043)
We have special handling of the extra level of arrayness and
different code path for emitting vertices in GS.
2018-01-31 11:33:00 -05:00
Ehsan d47339e142
[spirv] Handle literal float type in getValueOne() (#1040) 2018-01-31 10:25:38 -05:00
Young Kim 6f2aaa6ab3
Preserve denorms for frc on half inputs, and fix sqrt(-denorm) for float (#1042) 2018-01-30 16:52:58 -08:00
Lei Zhang 902b1ee3c1
[spirv] Handle OO inheritance in stage IOs (#1041)
We need to go over all base classes and handle stage IOs inside
them too.
2018-01-30 19:33:13 -05:00
Young Kim 1e97116e9f
Fix countbits, reversebits, firstbitlow intrinsics for int16 types (#1037)
Fix countbits, reversebits, firstbitlow intrinsics for int16 types
2018-01-30 14:29:10 -08:00
Young Kim d5d3d8d49a
Fix Shader Model 6.2 tests (#1036)
Fixing a bunch of SM 6.2 Tests
- BinaryHalfOp tests reading input2 instead of input1
- Fixed converting signed zero from float to float16
- Fixed compiler options for float16 min,max test
- Fixed expected results for following float16 operations
- cos(0), sin(314), sin(-314)
- frc(-7.39)
- rsqrt(65504)
- int16 subtraction
- int16 unsigned multiplication
- sqrt, rsqrt, round_pi, round_ni, fmad treat denorm as it is
2018-01-30 14:28:49 -08:00
Lei Zhang e9120a1594
[spirv] Add support for OO inheritance (#1039)
An field will be created at the very beginning of the struct
for the base class.
2018-01-30 15:50:42 -05:00
Lei Zhang d90f31f177
[spirv] Support assigning arrays as a whole (#1038)
For array wholesale assignments, the rhs will be wrapped in a
FlatConversion implicit cast. This cast can be ignored since it
does not affect CodeGen.
2018-01-30 14:09:26 -05:00
Lei Zhang d81941c4cb
[spirv] Majorness decoration for *StructuredBuffer<matrix> (#1035) 2018-01-29 16:53:46 -08:00
Ehsan e6f6fd91a1
[spirv] Provide literal type hint in cast function (#1034) 2018-01-29 16:58:34 -05:00
Lei Zhang 2876f84356
[spirv] Treat (non-)literal the same to avoid unnecessary cast (#1030) 2018-01-29 11:13: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
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