Commit Graph

283 Commits

Author SHA1 Message Date
John Kessenich
934d11b6db GLSL 4.6: Implement shader group vote. 2017-07-31 03:00:04 -06:00
John Kessenich
941f3bbd7a GLSL 4.6: Implement draw parameters. 2017-07-31 03:00:04 -06:00
John Kessenich
0d0c6d38f0 GLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops. 2017-07-31 03:00:04 -06:00
John Kessenich
de16e52b25 GLSL: Initiate version GLSL 460, including accept extraneous semicolons. 2017-07-31 03:00:04 -06:00
LoopDawg
307b6507b3 HLSL: handle multiple clip/cull semantic IDs
HLSL allows several variables to be declared.  There are packing rules involved:
e.g, a float3 and a float1 can be packed into a single array[4], while for a
float3 and another float3, the second one will skip the third array entry to
avoid straddling

This is implements that ability.  Because there can be multiple variables involved,
and the final output array will often be a different type altogether (to fuse
the values into a single destination), a new variable is synthesized, unlike the prior
clip/cull support which used the declared variable.  The new variable name is
taken from one of the declared ones, so the old tests are unchanged.

Several new tests are added to test various packing scenarios.

Only two semantic IDs are supported: 0, and 1, per HLSL rules.  This is
encapsulated in

     static const int maxClipCullRegs = 2;

and the algorithm (probably :) ) generalizes to larger values, although there
are a few issues around how HLSL would pack (e.g, would 4 scalars be packed into
a single HLSL float4 out reg?  Probably, and this algorithm assumes so).
2017-07-26 11:18:09 -06:00
John Kessenich
53863a3a90 GLSL: Implement version 320 for ES. 2017-07-23 13:54:15 -06:00
John Kessenich
9353f1afab GLSL: Add version-number checking. 2017-07-23 11:49:42 -06:00
John Kessenich
0e392aa92e Merge pull request #996 from KhronosGroup/decorate-parameters
SPV: Decorate parameters
2017-07-18 03:51:02 -06:00
John Kessenich
961cd35b73 SPV: Fix #995: Include memory decorations on parameters. 2017-07-18 03:07:43 -06:00
John Kessenich
0e6e2ffd9c Fix #980: flatten opaque initializers to use aliases. 2017-07-16 05:46:13 -06:00
LoopDawg
0fca0bafaf WIP: HLSL: support global const initializers from non-constant rvalues
Semantic test left over from other source languages is removed, since this is permitted by HLSL.
Also, to support the functionality, a targeted test is performed for this case and it is
turned into a EvqGlobal qualifier to create an AST initialization segment when needed.

Constness is now propagated up aggregate chains during initializer construction.  This
handles hierarchical cases such as the distinction between:

    static const float2 a[2] = { { 1, 2 }, { 3, 4} };

vs

    static const float2 a[2] = { { 1, 2 }, { cbuffer_member, 4} };

The first of which can use a first class constant initalization, and the second cannot.
2017-07-11 13:41:39 -06:00
John Kessenich
9645f78293 Merge pull request #965 from chaoc/spv-khr-post-depth-coverage
Implement SPV_KHR_post_depth_coverage
2017-07-05 14:48:19 -06:00
chaoc
c120452754 Implement SPV_KHR_post_depth_coverage
Added support for both extension GL_ARB_post_depth_coverage and GL_EXT_post_depth_coverage.
2017-07-05 12:27:15 -07:00
d3x0r
57a2b22d34 Update CMakeLists.txt 2017-07-04 05:59:03 -07:00
David Srbecký
0fbe02c6a0 Implement extensions GL_OVR_multiview and GL_OVR_multiview2
They are almost identical to the already supported GL_EXT_multiview
2017-06-30 19:11:56 +01:00
Rex Xu
37cdceed41 Implement extension GL_ARB_shader_stencil_export 2017-06-29 17:50:46 +08:00
John Kessenich
89f8d1e64f HLSL: Fix #942: Map SV_TargetN to SPV Location N. 2017-06-27 15:17:38 -06:00
John Kessenich
fe6689c6c4 HLSL: support point mode. 2017-06-26 17:52:22 -06:00
LoopDawg
c44b95fdec WIP: HLSL: handle clip/cull distance array semantic matching
In HLSL, there are three (TODO: ??) dimensions of clip and cull
distance values:

  * The semantic's value N, ala SV_ClipDistanceN.
  * The array demension, if the value is an array.
  * The vector element, if the value is a vector or array of vectors.

In SPIR-V, clip and cull distance are arrays of scalar floats, always.

This PR currently ignores the semantic N axis, and handles the other
two axes by sequentially copying each vector element of each array member
into sequential floats in the output array.

Fixes: #946
2017-06-23 13:06:53 -06:00
John Kessenich
4329d555ad HLSL: Broaden solution for #940, editing integer input for 'flat'. 2017-06-21 01:35:57 -06:00
LoopDawg
e2713125b9 HLSL: fix several issues in mat construction from scalars
This fixes:

1. A compilation error when assigning scalars to matricies

2. A semantic error in matrix construction from scalars.  This was
initializing the diagonal, where HLSL semantics require the scalar be
replicated to every matrix element.

3. Functions accepting mats can be called with scalars, which will
be shape-converted to the matrix type.  This was previously failing
to match the function signature.

NOTE: this does not yet handle complex scalars (a function call,
say) used to construct matricies.  That'll be added when the
node replicator service is available.  For now, there's an assert.

There's one new test (hlsl.scalar2matrix.frag).  An existing test
lsl.type.half.frag changes, because of (2) above, and a negative
test error message changes due to (3) above.

Fixes #923.
2017-06-14 14:11:18 -06:00
John Kessenich
82ae8c31e0 HLSL: Fix #924: Convert between two different arrays with cast. 2017-06-13 23:13:10 -06:00
Rex Xu
cabbb788b4 Implement extension GL_AMD_gpu_shader_int16
- Add int16 types (int16_t, uint16_t, i16vec, u16vec).
- Add int16 support to GLSL operators.
- Add int16 type conversions (to int16, from int16).
- Add int16 built-in functions.
2017-06-09 17:11:23 +08:00
John Kessenich
4d5bcd3162 HLSL: Allow macro expansions to create the 'defined' operator. 2017-06-08 17:12:56 -06:00
Rex Xu
225e0fcadd Implement the extension GL_AMD_texture_gather_bias_lod 2017-06-05 16:41:06 +08:00
John Kessenich
0b94a31ee9 Merge pull request #915 from LoopDawg/subvec4-intrinsic
HLSL: add test coverage for sub-vec4 texture intrinsics
2017-06-03 15:28:11 -06:00
John Kessenich
f31507421b HLSL: Convert run-time sampler assignments to compile-time aliases.
For "s.m = t", a sampler member assigned a sampler, make t an alias
for s.m, and when s.m is flattened, it will flatten to the alias t.
Normally, assignments to samplers are disallowed.
2017-06-02 18:27:21 -06:00
John Kessenich
750c2d07f7 SPV: When passing structs of opaque types, flatten and pass the members instead.
This avoids either A) needing uniformConstant struct, or
B) initializing a struct with opaque members, as writing them is not
allowed.
2017-06-01 18:49:04 -06:00
John Kessenich
d66c5b1299 HLSL: iomapper: Fix #914. Tolerate user aliasing of bindings.
Because it is valid in HLSL to alias bindings:
A) remove validation that aliasing is not done
B) make the algorithms tolerate aliasing
2017-06-01 18:16:33 -06:00
LoopDawg
a696fd1a44 HLSL: add test coverage for sub-vec4 texture intrinsics
This changes no functional code.  There was a bit of a testing hole
in that textures templatized on sub-vec4 types were not being exercised
with any intrinsics.  This adds some basic sanity coverage of that case.
2017-06-01 13:28:12 -06:00
t.jung
baf570efa5 Pure Texture to Sampled Texture Transform
Adds a transformation step to the post processing step.
Two modes are available:
1) keep
- Keeps samplers, textures and sampled textures as is
2) transform pure texture into sampled texture and remove pure samplers
- removes all pure samplers
- transforms all pure textures into its sampled counter part

Change-Id: If54972e8052961db66c23f4b7e719d363cf6edbd
2017-05-29 18:29:45 +02:00
John Kessenich
d6af18f621 Merge pull request #901 from LoopDawg/imat-construct
HLSL: Add imat, umat, and bmat constructors
2017-05-24 23:12:58 -06:00
John Kessenich
6e2295d340 HLSL: Fix #902: Incorrect protection against zero arguments. 2017-05-24 16:02:56 -06:00
LoopDawg
174ccb8f1d HLSL: Add imat, umat, and bmat constructors
Fixes #894
2017-05-20 21:54:16 -06:00
LoopDawg
132a28aac4 HLSL: allow name mangling based on texture template type
Name mangling did not account for the vector size in the template type of a texture.
This adds that.  The mangle is as it ever was for the vec4 case, which leaves
all GLSL behavior and most HLSL behavior uneffected.  For vec1-3 the size is added
to the mangle.

Current limitation: textures cannot presently be templatized on structured types,
so this works only for vectors of basic types.

Fixes #895.
2017-05-19 20:12:50 -06:00
John Kessenich
ab0847ef01 Merge pull request #896 from KhronosGroup/spv-location
SPV: Give error on not assigning locations to I/O when generating SPIR-V.
2017-05-18 21:12:04 -06:00
LoopDawg
65c2eed65d Remapper: handle embedded opcode in OpSpecConstantOp
OpSpecConstantOp contains an embedded opcode which is given as a literal
argument to the OpSpecConstantOp.  The subsequent arguments are as the
embedded op would expect, which may be a mixture of IDs and literals.  This
adds support for that to the remapper binary parser.  Upon seeing such an
embedded op, the parser flips over to parsing the argument list as
appropriate for that opcode.

Fixes #882.
2017-05-18 16:13:04 -06:00
John Kessenich
71facdf435 SPV: Give error on not assigning locations to I/O.
Also, provides an option to auto-assign locations.
Existing tests use this option, to avoid the error message,
however, it is not fully implemented yet.
2017-05-18 15:07:05 -06:00
John Kessenich
24e895b4a3 Merge pull request #860 from steve-lunarg/sb-counter-args.2
HLSL: add ability to pass struct buffers with counters to fns
2017-05-17 10:55:22 -06:00
steve-lunarg
2bb1f39fa7 WIP: HLSL: add ability to pass struct buffers with counters to fns
This modifies function parameter passing to pass the counter
buffer associated with a struct buffer to a function as a
hidden parameter.  Similarly function declarations will have
hidden parameters added to accept the associated counter buffers.

There is a limitation: if a SB type may or may not have an associated
counter, passing it as a function parameter will assume that it does, and
the counter will appear in the linkage whether or not there is a counter
method used on the object.
2017-05-17 09:18:53 -06:00
John Kessenich
0a2a0cd3a4 HLSL: Implement member functions calling member functions. 2017-05-17 02:20:34 -06:00
LoopDawg
726bf96a72 HLSL: add .mips[][] operator for texture types
This implements mytex.mips[mip][coord] for texture types.  There is
some error testing, but not comprehensive.  The constructs can be
nested, e.g in this case the inner .mips is parsed before the completion
of the outer [][] operator.

   tx.mips[tx.mips[a][b].x][c]
2017-05-15 09:13:58 -06:00
LoopDawg
c6510a33ff HLSL: allow GS-specific methods in other stages
Using GS methods such as Append() in non-GS stages should be ignored, but was
creating errors due to the lack of a stream output symbol for the non-GS stage.
2017-05-13 09:20:11 -06:00
John Kessenich
02c4728a83 Merge pull request #874 from xlpiao/DescriptorSet-and-Binding
HLSL: Manually configure descriptor set and binding number for resources
2017-05-10 11:10:53 -06:00
Hyangran Park
36dc82908f HLSL: Manually configure descriptor set and binding number for resources 2017-05-10 16:50:18 +09:00
John Kessenich
c10191d132 SPV: Support texelFetch() on a textureBuffer (no sampler).
Fixes Vulkan Khronos-internal issue 770.
2017-05-08 00:12:28 -06:00
steve-lunarg
f1709e7146 HLSL: implement [unroll] and [loop] attributes
This adds infrastructure suitable for any front end to create SPIR-V loop
control flags.  The only current front end doing so is HLSL.

[unroll] turns into spv::LoopControlUnrollMask
[loop] turns into spv::LoopControlDontUnrollMask
no specification means spv::LoopControlMaskNone
2017-05-03 13:44:40 -06:00
David Seifert
22afc38b55 Modernise CMake #2
This reverts commit cfc69d95af.
* Change CMAKE_INSTALL_PREFIX default on Windows in order
  to prevent permission denied errors when trying to install
  to "Program Files".
2017-04-29 11:23:15 +02:00
John Kessenich
cfc69d95af Revert "Modernise CMake" 2017-04-28 22:04:24 -06:00
David Seifert
8f824265ea Make test suite optional by using CTest 2017-04-28 22:46:52 +02:00