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

91 Коммитов

Автор SHA1 Сообщение Дата
Lei Zhang 5c4ca12efc
[spirv] Update doc and SPIRV-Tools (#1088)
Add explanation of legalization, optimization, validation in doc.
2018-02-21 14:12:01 -05:00
Lei Zhang 4221a698e1
[spirv] Support WaveGetLaneCount() and WaveGetLaneIndex() (#1077)
They are translated into SPIR-V builtin varibles. The translation
requires the SPV_KHR_shader_ballot extension.
2018-02-21 10:34:01 -05:00
Ehsan 774e85eb20 [spirv] Add initial support for non-fp matrices (#1057)
This is the support for non-floating-point matrices,
which are emulated using arrays of vectors because
SPIR-V does not allow non-floating-point matrices.

* Initial support for non-fp matrix
* Add support for non-fp matrix in all()
* Conversion of float matrix to int matrix
* support for modf returning an int matrix
* Add tests for non-fp matrix access
* Mixed arithmetic for non-fp matrices
* Support non-fp matrix in flat conversion
* Non-fp matrix in asint/asuint/asfloat
* Mul of non-fp Matrix with Vector/Scalar
* Add tests for non-fp matrix cast

TODO: Layout decoration of non-fp matrices
TODO: Majorness of non-fp matrices
2018-02-12 15:33:41 -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
Ehsan d7e95a7f3c
[spirv] Explain reasoning of matrix representation (#1048) 2018-02-01 15:21:17 -05: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
Lei Zhang 4cbada6181
[spirv] Translate SubpassInput(MS) and their methods (#1013) 2018-01-22 10:45:56 -05: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 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
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 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 cf39455abf
[spirv] Update doc about variable storage classes (#945) 2017-12-20 18:34:25 -05:00
Ehsan fc52dbced0
[spirv] Document missing pow2 partitioning feature. (#937)
* [spirv] Document missing pow2 partitioning feature.
* Provide more accurate location for attributes.
2017-12-19 13:37:48 -05:00
Ehsan cb4e570b82
[spirv] warn {row|col}_major on standalone matrix. (#935) 2017-12-18 16:48:16 -05:00
Ehsan 1d4509f35d
[spirv] Support Load methods that take Status arg. (#905) 2017-12-12 17:38:30 -05:00
Ehsan 679b7c80c7
[spirv] Support CheckAccessFullyMapped intrinsic. (#897) 2017-12-11 14:02:21 -05:00
Lei Zhang 5de265fddb
[spirv] Add support for ignoring unused resources (#875)
Added a new command line option -fvk-ignore-unused-resources
to avoid emitting SPIR-V code for resources defined but not statically
referenced by the call tree of the entry point in question.
2017-12-05 12:21:55 -05:00
Lei Zhang 53f3f69b36
[spirv] Add mechanism for Vulkan-specific builtins (#805)
[[vk::builtin("...")]] is introduced to support Vulkan-specific
builtins.

There are two supported in this commit:

* gl_PointSize
* gl_HelperInvocation

Validating the usages of these two builtins is left for anther
commit.
2017-11-25 17:32:39 -08:00
Lei Zhang 9745b0d55c
[spirv] Add support for SV_Barycentrics (#837)
The translation is done using  SPIR-V Extension
SPV_AMD_shader_explicit_vertex_parameter.
2017-11-22 18:16:48 -05:00
Lei Zhang d1f1665865
[spirv] Add support for SV_ViewID (#836)
Also error out on seeing unknown patch constant function parameter.
2017-11-22 18:16:15 -05:00
Ehsan 06aadc4789
[spirv] CheckAccessFullyMapped unsupported error (#824) 2017-11-20 08:45:43 -05:00
Lei Zhang 4a4d1134ef
[spirv] Emit unsupported error for some intrinsics (#797)
* abort
* GetRenderTargetSampleCount
* GetRenderTargetSamplePosition
* GatherCmpGreen
* GatherCmpBlue
* GatherCmpAlpha
* GetSamplePosition
* CalculateLevelOfDetailUnclamped
2017-11-16 14:23:03 -05:00
Lei Zhang 83e23e6954
[spirv] Add support for SV_Coverage (#800)
Also emit an error for SV_InnerCoverage.
2017-11-15 12:02:27 -05:00
Ehsan 576a805117
[spirv] Translate intrinsic dst function. (#801) 2017-11-15 10:14:24 -05:00
Lei Zhang 6788ebea4a
[spirv] Add support for [[vk::push_constant]] (#791)
[[vk::push_constant]] can be attached to a global variable of
struct type to put that variable in the PushConstant storage
class.

PushConstant should be of OpTypeStruct type with std430 layout.
2017-11-15 08:14:22 -05:00
Ehsan b32bc384a3
[spirv] Translate intrinsic D3DCOLORtoUBYTE4. (#799) 2017-11-14 11:09:51 -05:00
Lei Zhang 0d462693b5
[spirv] Add support for SV_ViewportIndex (#796) 2017-11-14 10:56:53 -05:00
Lei Zhang e9a2c759b5
[spirv] Support SV_RenderTargetArrayIndex and SV_StencilRef (#789) 2017-11-13 14:44:04 -05:00
Ehsan 4d97841e33
[spirv] Translate *MemoryBarrier* intrinsics. (#790)
* Translation of GroupMemoryBarrier(WithGroupSync)
* Translation of DeviceMemoryBarrier(WithGroupSync)
* Translation of AllMemoryBarrier(WithGroupSync)
2017-11-13 14:08:13 -05:00
Lei Zhang e40535653f
[spirv] Emit Invocations execution mode in GS (#793)
OpExecutionMode Invocations n should be emitted for [instance(n)]
on GS. n defaults to 1.
2017-11-13 10:43:31 -05:00
Ehsan 4bd93f66a3
[spirv] tbuffer and TextureBuffer support. (#787) 2017-11-10 17:07:43 -05:00
Lei Zhang a579b3eaef
[spirv] Add support for f16tof32() and f32tof16() (#786)
Fixes https://github.com/Microsoft/DirectXShaderCompiler/issues/785
2017-11-10 12:31:52 -05:00
Lei Zhang 68ef628bd9
[spirv] Complete the support for SV semantics in all stages (#775)
Covers the following SVs for all their legal SigPoints:

* SV_Position
* SV_ClipDistance
* SV_CullDistance
* SV_VertexID
* SV_InstanceID
* SV_Depth
* SV_DepthGreaterEqual
* SV_DepthLessEqual
* SV_OutputControlPointID
* SV_DomainLocation
* SV_GSInstanceID
* SV_IsFrontFace
* SV_DispatchTreadID
* SV_GroupID
* SV_GroupThreadID
* SV_GroupIndex
* SV_TessFactor
* SV_InsideTessFactor
* SV_PrimitiveID
* SV_SampleIndex
2017-11-10 11:47:50 -05:00
Lei Zhang 37eade8495
[spirv] Add support for basic geometry shader (#772)
This commit supports .Append() and .RestartStrip() method calls
on stream-output objects, which will be translated into SPIR-V
OpEmitVertex and OpEndPrimitive, respectively.

For each .Append() call, all affected stage output variables
will be flushed.
2017-11-08 11:41:43 -05:00
Lei Zhang 87d66c9d09
[spirv] Add doc and tests for snorm/unorm float type (#773) 2017-11-08 10:49:32 -05:00
Lei Zhang dc3d2c7921
[spirv] Require ClipDistance/CullDistance capability on use (#769)
Declaring but not using (reading/writing) ClipDistance/CullDistance
does not require the ClipDistance/CullDistance capability.
2017-11-07 15:17:13 -05:00
Lei Zhang 734266277b
[spirv] Change vertex processing stages to emit gl_PerVertex (#757)
As per the Vulkan spec requirement:

  Any variable decorated with Position must be declared as a
  four-component vector of 32-bit floating-point values.

But for HS/DS/GS, we actually have an extra arrayness. If we
generate a stand-alone Postion builtin variable, it will be
an array of float4, which does not comply with the spec.

Similary for the type requirements on ClipDistance and
CullDistance.

The spec could have an problem on this issue, but the GLSL way
is to emit a gl_PerVertex that contains Position, ClipDistance,
and CullDistance. That satisfies the current Vulkan spec.

This commit converts VS output, HS/DS input and output, GS
input to emit the gl_PerVertex struct. It also splits arrays
of structs into arrays of the fields for HS/DS/GS input/output.

ClipDistance/CullDistance is also supported in this commit,
which requires quite some non-trivial handling.
2017-11-07 09:56:10 -05:00
Ehsan 97aab11faf
[spirv] Translate intrinsic asdouble and asuint. (#758) 2017-11-03 05:38:08 -07:00
Ehsan 4b7fab259f
[spirv] Add support for HLSLMatrixTruncationCast (#753) 2017-11-03 05:37:46 -07:00
Ehsan c5dc49a7fd
[spirv] Translate intrinsic Lit function. (#744) 2017-10-31 10:14:56 -04:00
Ehsan 6d8bf3e34a [spirv] Support GS output stream types. (#736) 2017-10-26 14:02:40 -04:00
Ehsan 96c5c0ad17 [spirv] Execution modes for GS primitive types. (#734) 2017-10-25 16:02:23 -04:00
Ehsan 0d9cfd2b3a [spirv] Translate maxvertexcount attribute for GS. (#732) 2017-10-25 09:25:38 -04:00
Lei Zhang ffe7692c75 [spirv] Update SPIR-V rst doc (#733) 2017-10-24 14:32:38 -04:00
Lei Zhang 108f1658d2 [spirv] Add support for [[vk::counter_binding(X)]] (#730)
A new attribute [[vk::counter_binding(X)]] can be used to specify
the binding number for associated counters for RW/append/consume
structured buffers.

Also added support for .IncrementCounter() and .DecrementCounter()
for RWStructuredBuffer.

Also fixed the type error of OpAtomicI{Add|Sub}.
2017-10-24 10:51:50 -04:00
Lei Zhang 5686ccf2c4 [spirv] Allow the same binding number for combined image sampler (#729)
Vulkan combined image sampler is logically considered a sampled
image and a sampler bound together.
2017-10-23 11:57:40 -07:00
Lei Zhang 8702f97dff [spirv] Add support for four register number shifting options (#720)
Added the following four command line options to shift register
number for Vulkan:

* -fvk-b-shift
* -fvk-t-shift
* -fvk-s-shift
* -fvk-u-shift

These options are used to avoid assigning the same binding
number to more than one resources.
2017-10-20 19:37:11 -07:00
Lei Zhang 9cb179024b [spirv] Add support for struct/class static members (#714)
These static members are translated into SPIR-V variables of
the Private storage class.
2017-10-17 07:46:08 -07:00
Ehsan 2fa7a957a0 [spirv] Add translation for intrinsic rcp. (#713)
Also includes creating 64-bit float constants that are needed for
reciprocating a 64-bit float.
2017-10-17 08:53:00 -04:00
Ehsan 78ac89a6f8 [spirv] Documentation of hull shader translation. (#702) 2017-10-16 15:47:29 -04:00