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

48 Коммитов

Автор SHA1 Сообщение Дата
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
Ehsan 0888e319e7 [spirv] Intrinsic fwidth & faceforward (#711) 2017-10-16 13:53:08 -04:00
Ehsan 8afee2994c [spirv] Intrinsic ddx and ddy. (#707)
Also:
* ddx_coarse, ddx_fine
* ddy_coarse, ddy_fine
2017-10-16 10:11:29 -04:00
Lei Zhang 2e1ea68d6c [spirv] Add support for texture .GatherCmpRed() method (#700) 2017-10-13 11:21:38 -04:00
Lei Zhang 52372b1186 [spirv] Add support for texture .GatherCmp() method (#697) 2017-10-12 15:35:29 -04:00
Lei Zhang 050755b4d8 [spirv] Add support for .SampleCmp() and .SampleCmpLevelZero() (#689) 2017-10-12 11:34:38 -04:00
Lei Zhang 3a6f80eb1b [spirv] Add support for .GatherRGBA() methods on texture types (#682)
Also extended tests for .Gather() tests to cover scalar element
types and vector element types with less than 4 components.
2017-10-10 15:36:37 -04:00
Lei Zhang 102fe247f1 [spirv] Support RWByteAddressBuffer atomic methods (#678) 2017-10-06 09:59:13 -04:00
Lei Zhang c757514869 [spirv] Tweak binding number assignment scheme (#675)
Now we essentially assign binding numbers to all resources in
three passes: [[vk::binding(...)]], register(...), and then
no annotation.
2017-10-03 11:12:08 -04:00
Lei Zhang 49313dd16e [spirv] Update mapping manual (#665) 2017-09-29 14:56:10 -04:00
Ehsan 58612be9f3 [spirv] More compute shader semantics. (#662)
* SV_GroupID
* SV_GroupIndex
* SV_GroupThreadID
2017-09-28 17:43:18 -04:00
Ehsan a0684306a6 [spirv] GetDimension for ACSBuffer. (#658)
GetDimensions for AppendStructuredBuffer
GetDimensions for ConsumeStructuredBuffer
2017-09-28 12:15:32 -04:00
Ehsan 015bdfd1d7 [spirv] Translate several intrinsic functions. (#654)
* frexp
* countbits
* clip
* ldexp
* lerp
* log10
* mad
* modf
* reversebits
2017-09-28 10:28:46 -04:00
Ehsan 52c27ffbbd [spirv] CalculateLevelOfDetail for Texture types. (#653) 2017-09-27 14:15:32 -04:00
Ehsan 746d8ea5ed [spirv] Update doc for ByteAddressBuffer methods. (#652)
* [spirv] Update doc for ByteAddressBuffer methods.

* Better doc.
2017-09-26 09:19:22 -07:00
Ehsan a62fc13575 [spirv] Translation of several intrinsic functions (#639)
* [spirv] Translation of several intrinsic functions

Translation for the following intrinsic functions:

* Matrix transpose
* smoothstep
* refract
* distance
* isinf
* isnan
* isfinite
* sincos
* saturate
* atan2
* fma
* fmod
* frac
* firstbithigh
* firstbitlow

* Address code review comments.
2017-09-26 09:18:23 -07:00
Ehsan 00b7505afd [spirv] GetDimensions for several types. (#636)
* [spirv] GetDimensions for several types.

GetDimensions function implementation for:
Textures, RWTextures,
Buffers, RWBuffers,
ByteAddressBuffers, RWByteAddressBuffers,
StructuredBuffers, RWStructuredBuffers.

* Address comments.

* Update the doc file.
2017-09-25 09:23:06 -07:00
Lei Zhang 809495a4c2 [spirv] Update mapping manual (#634) 2017-09-20 20:28:22 -07:00
Ehsan 479f1cd9bf [spirv] Support other primitive int/float types. (#628)
* [spirv] Support other primitive int/float types.

* Address comments.
2017-09-20 20:26:07 -07:00
theswiftfox e97dd2a0cd Fix typo in SPIR-V.rst (#612)
HLSL semantic and Vulkan ``Loation`` -> HLSL semantic and Vulkan ``Location``
2017-09-01 13:37:36 -07:00
Ehsan 7a0ae9e90b RWTexture Load() and Texture2DMS(Array) (#609)
* [spirv] OpImageRead can read a vector of any size.

* [spirv] Add support for Load() of RWTexture types.

* [spirv] Texture2DMS and Texture2DMSArray types.

* [spirv] Capability for 1D images without a sampler

* [spirv] Update documentation of Texture2DMS(Array)
2017-08-31 16:10:13 -07:00
Ehsan d5592ce089 [spirv] Add translation of RWTexture... types. (#602)
* [spirv] Add translation of RWTexture... types.
* Update documentation for RWTexture types.
* Fix table formatting in doc.
2017-08-29 14:57:54 -07:00
Lei Zhang bc1301af13 [spirv] Update SPIR-V.rst doc (#596)
Moved logistics and designs to the wiki page. Now the doc is only
for HLSL to SPIR-V mappings.

Also link to the doc and wiki page in the main README.md.
2017-08-25 08:56:42 -07:00
Lei Zhang 0e0e014232 [spirv] Add CL option for stage I/O location assignment order (#578)
A new CL option -fvk-stage-io-order={alpha|decl} is added to
control the order for assigning stage I/O location numbers.
The default is also changed to declaration order (decl) instead
of alphabetical order (alpha).

Also extended testing fixtures to support additional CL options.
2017-08-17 20:59:45 -07:00
Lei Zhang 65d17b4f7c [spirv] Support setting resource binding numbers (#577)
This commit add support for resource binding number assignment via
both the explicit and the implicit way.

The explicit way:

[[vk::binding(X[, Y])]] is introduced, with X denoting the binding
number and the optional Y denoting the set number. If Y is missing,
the set number will be set to 0. This attribute can only be attached
to variables.

The implicit way:

register(xX, spaceY) will be used to deduce the correct set and
binding number for a given resource. X will be used as the binding
number and Y will be used as the set number. Right now we do not
consider the resource type x, which means binding numbers can
overlap given the same X and Y but not x. That is to be addressed
later.
2017-08-17 20:56:48 -07:00
Lei Zhang f284c982c9 [spirv] Support texture and sampler types (#572)
This commit add support for the following types:
* Texture1D, Texture2D, Texture3D, TextureCube
* Texture1DArray, Texture2DArray, TextureCubeArray
* SamplerState, SamplerComparisonState, sampler

Buffer, Texture2DMS, and Texture2DMSArray is not supported yet,
also setting sampler states.

Texture types will be translated OpTypeImage, and sampler types
will be translated into OpTypeSampler.
2017-08-16 21:09:20 -07:00
Lei Zhang a727fc8838 [spirv] Support PS SV_Depth{Greater|Less}Equal and SV_IsFrontFace (#563) 2017-08-14 13:43:05 -07:00
Lei Zhang 6fd778c14a [spirv] Update SPIR-V.rst doc (#558)
* Restructured sections
* Explained how HLSL semantics are handled
* Highlighted source code
2017-08-14 09:32:43 -07:00
Lei Zhang d98d66564a [spirv] Converted to generate wrapper for entry function (#557)
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.
2017-08-11 16:08:27 -07:00
Lei Zhang 1da87c6aaf [spirv] Handle static global and local variables (#541)
These variables should be using the Private storage class.
And local static variables should be initialized once.
2017-08-09 15:31:20 -07:00
Ehsan ff65329ee2 [spirv] Translate more instrinsic functions (#537)
Using GLSL 450 extended instruction set to translate some HLSL
intrinsic functions.
2017-08-09 09:43:27 -07:00
Ehsan ec9cfae3b6 [spirv] Translation of while loops (#532)
Also added the translation for `loop` and `unroll` attributes.

Similar to for loops, the current implementation does not support
early exits, or early returns.
2017-08-08 22:18:51 -07:00
Lei Zhang d3d5dd789d [spirv] Add doc for vector and matrix types (#507) 2017-08-02 16:27:56 -07:00
Lei Zhang 694c35a47e [spirv] Translate vector truncation and splatting (#502)
* [spirv] Translate vector truncation and splatting

* Also added tests for vector<|type|, |count|> format.

* [spirv] Remove duplicated vector splatting tests

Although they appear as binary operator tests, they are essentially
testing vector splatting, which we already have dedicated tests.
2017-08-02 09:38:20 -07:00
Lei Zhang c760e02232 [spirv] Support casting to bool/int/float (vector) values (#500)
* [spirv] Translate casting to bool (vector) values

* Supported converting scalar/vector sint/uint/float values into
  scalar/vector bool values.

* [spirv] Translate casting to int (vector) values

* Supported converting scalar/vector bool/float values into
  scalar/vector sint/uint values.

* [spirv] Translate casting to float (vector) values

* Supported implicit/explicit casting from scalar/vector
  bool/sint/uint into scalar/vector float values
2017-08-01 16:31:25 -07:00
Lei Zhang f38109c154 [spirv] Translate boolean math operators: &&, ||, ?: (#499) 2017-08-01 11:25:32 -07:00
Lei Zhang c8ff1681be [spirv] Support unary operators: ++, --, !, +, - (#497)
* [spirv] Translate prefix/postfix increment/decrement

* [spirv] Translate unary operator !, +, and -
2017-08-01 09:10:48 -07:00
Ehsan e6685a310d [spirv] Translate intrinsic dot product. (#496)
The translation supports dot product of vectors of floats using
SPIR-V's OpDot.

The translation also supports dot product of vectros of integers
using multiplication and addition.
2017-07-31 18:09:02 -07:00
Lei Zhang 399e987298 [spirv] Translate bitwise operators (#495)
* Covers ~, &, |, ^, <<, >>, &=, |=, ^=, <<=, >>=
* For int/uint and vector of int/uint
2017-07-31 16:14:59 -07:00
Lei Zhang 660a367778 [spirv] Vector types, variable initializers, and comparison (#488)
* [spirv] Translate vector types and handle variable initializers

* Translated vector types and operations on vector types
  * +, -, *, /, % on vector <op> vector and vector <op> scalar
  * Prefix increment on vectors
  * < on vector <op> vector and vector <op> scalar
* Covered both constant initializer and variable initializer
* Applied constant modifier to variables

* [spirv] Translate all comparision operators

* Covers <, <=, >, >=, ==, !=
* For both scalars and vectors
* Also update docs about arithmetic and comparison operators
2017-07-31 09:13:45 -07:00
Lei Zhang dc240f47e7 [spirv] Translate non-entry functions and function calls (#487) 2017-07-28 08:59:49 -07:00
Lei Zhang 9cab7fd909 Add doc for SPIR-V codegen (#215) 2017-04-14 18:18:21 -07:00