Commit Graph

931 Commits

Author SHA1 Message Date
John Kessenich
7a44a31dee SPV: Address #759: make ViewIndex and DeviceIndex by 'in', not 'uniform'. 2017-03-13 15:43:26 -06:00
Rex Xu
d41a696c30 HLSL: Additional channel value for textureGatherXXX().
When mapping HLSL gather intrinsics to GLSL textureGatherXXX() built-in
function, the channel selection value is only valid for non-shadow samplers.
2017-03-13 17:07:18 +08:00
John Kessenich
c04c6a4067 Merge pull request #762 from LukasBanana/master
Added 'GL_core_profile' and 'GL_compatibility_profile' to macro expansion
2017-03-11 14:16:58 -07:00
John Kessenich
54ee28f4d0 HLSL: Add scoping operator, accept static member functions, and support calling them. 2017-03-11 14:13:00 -07:00
Lukas Hermanns
1fbc6e6ca1 Added 'GL_core_profile' and 'GL_compatibility_profile' macro definition to preamble.
Added version check (version >= 150) for GL_(core/compatibility)_profile macros.

Added GL_core_profile standard macro check to "150.vert" test file.

Fixed version check for GL_core_profile macros, and removed bad token character from 150.vert test.

Updated 150.vert.out test base-result with google-test suite.
2017-03-11 12:34:46 +01:00
John Kessenich
523e20dc02 PP: Recognize the '::' token, and translate appropriately to GLSL/HLSL token. 2017-03-10 18:03:43 -07:00
steve-lunarg
0b5c2ae70e Preserve signedness in SPV image query ops
The AST->SPIRV translation of image queries was dropping signedness,
causing some validation troubles.
2017-03-10 12:51:59 -07:00
steve-lunarg
4198b8bfc4 WIP: HLSL: preserve empty structures after splitting 2017-03-09 19:10:57 -07:00
John Kessenich
6e1d50a7a2 HLSL: Accept SV_Cull/ClipDistanceN, by refactoring the way semantics are mapped. 2017-03-09 14:37:32 -07:00
steve-lunarg
d00b026111 Enable GatherCmpRed. Green/Blue/Alpha cannot be supported.
This implements GatherCmpRed in terms of OpImageDrefGather.

There appears to be no way to implement the Green/Blue/Apha forms: see #673.
2017-03-09 08:59:45 -07:00
steve-lunarg
3ce4536ac8 HLSL: use LOD form of ImageQuerySize when needed.
The non-LOD form of image size query is prohibited in certain cases:
see the OpImageQuerySize and OpImageQuerySizeLod sections of the SPIR-V
spec for details.  Sometimes we were generating the non-LOD form when
we should have been using the LOD form.  Sometimes the LOD form is required
even if the underlying HLSL query did not supply a MIP level itself,
in which case level 0 is now queried.
2017-03-07 19:30:25 -07:00
John Kessenich
057df2935a HLSL: Fix #754: recognize type casts in if-statements separately from declarations. 2017-03-06 18:18:37 -07:00
steve-lunarg
40efe5cee8 WIP: HLSL: Fix ordering defect if global SB decl after fn param
This change propagates the storage qualifier from the buffer object to its contained
array type so that isStructBufferType() realizes it is one.  That propagation was
happening before only for global variable declarations, so compilation defects would
result if the use of a function parameter happened before a global declaration.

This fixes that case, whether or not there ever is a global declaration, and
regardless of the relative order.

This changes the hlsl.structbuffer.fn.frag test to exercise the alternate order.

There are no differences to generated SPIR-V for the cases which successfully compiled before.
2017-03-06 12:08:41 -07:00
John Kessenich
33f85b6e59 SPV: Allow push constant buffers to not have an instance name. 2017-03-06 08:51:35 -07:00
John Kessenich
789086a820 HLSL: Test for issue #699. 2017-03-03 18:19:03 -07:00
John Kessenich
322cb1922e Merge pull request #750 from dgkoch/rename_KHX_to_EXT
Rename KHX_multiview/device_group to EXT_multiview/device to match the released specs
2017-03-03 17:23:53 -07:00
John Kessenich
27ffb29908 HLSL: Add 'class' keyword as (so far) synonym for 'struct'. 2017-03-03 17:01:01 -07:00
Daniel Koch
efc972799d Rename KHX to EXT to match the released specs
GL_KHX_multiview and GL_KHX_device_group don't exist,
they were released as GL_EXT_multiview and GL_EXT_device_group.
2017-03-03 18:40:48 -05:00
John Kessenich
854fe24786 HLSL: Fix #747: accept 'struct' in front of previously user-defined type name. 2017-03-02 14:30:59 -07:00
John Kessenich
0479437a5c SPV: Fix #739: OpSelect can only operate on scalars and vectors. 2017-03-01 13:49:11 -07:00
John Kessenich
3494d71cfa PP: Fix issue #738: don't assert on characters within a string. 2017-02-28 19:39:51 -07:00
John Kessenich
fb22b69fc6 PP: Partially address issue #738: handle premature end of argument when token pasting. 2017-02-28 18:06:39 -07:00
John Kessenich
45c1b5b980 Merge pull request #742 from steve-lunarg/f16tof32-typefix
HLSL: small fix for index type in f16tof32 opcode
2017-02-28 16:18:24 -07:00
steve-lunarg
fdbfb65ec7 HLSL: small fix for index type in f16tof32 opcode
The f16tof32 opcode was indexing a vector with a float 0, rather
than an int 0.  It may have made no functional difference due to the
identical bit pattern, but code looking at the type could be
confused.
2017-02-28 14:15:32 -07:00
John Kessenich
5a042c0686 GLSL: Fix #741: rationalize per-block vs. per-member offset checking. 2017-02-28 14:13:48 -07:00
John Kessenich
69a2c69649 Merge pull request #736 from steve-lunarg/structbuffer-params
HLSL: add structuredbuffer pass by reference in fn params
2017-02-28 13:10:51 -07:00
John Kessenich
b67b4a7072 PP: Address #737: accept 'h'/'H' floating-point suffix more broadly. 2017-02-28 12:58:11 -07:00
steve-lunarg
86b510efd1 WIP: HLSL: add f16tof32 and f32tof16 decompositions. 2017-02-27 15:19:49 -07:00
John Kessenich
6c8aaacd28 SPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.
These correspond to SPV_KHR_device_group and SPV_KHR_multiview.
Also, bring tests up to date with Khronos internals, and some misc. related changes.
2017-02-27 01:20:51 -07:00
steve-lunarg
dd8287a109 WIP: HLSL: add structuredbuffer pass by reference in fn params
This PR adds the ability to pass structuredbuffer types by reference
as function parameters.

It also changes the representation of structuredbuffers from anonymous
blocks with named members, to named blocks with pseudonymous members.
That should not be an externally visible change.
2017-02-26 11:13:42 -07:00
John Kessenich
4a57dced66 SPV: Handle nested opaque types as function parameters. 2017-02-24 19:22:54 -07:00
John Kessenich
7491234713 Merge pull request #734 from steve-lunarg/ssbo-reflection
Add reflection queries for thread local size.  Add ssbo auto-binding.
2017-02-22 17:12:09 -07:00
steve-lunarg
932bb5cc4e Add reflection queries for thread local size and ssbo auto-binding
New command line option --shift-ssbo-binding mirrors --shift-ubo-binding, etc.

New reflection query getLocalSize(int dim) queries local size, e.g, CS threads.
2017-02-22 09:40:28 -07:00
Rex Xu
3e783f9b49 SPV: Unexpected declarations of capabilities from NV extensions. 2017-02-22 16:44:48 +08:00
steve-lunarg
5da1f038d8 HLSL: implement 4 (of 6) structuredbuffer types
This is a partial implemention of structurebuffers supporting:

* structured buffer types of:
*   StructuredBuffer
*   RWStructuredBuffer
*   ByteAddressBuffer
*   RWByteAddressBuffer

* Atomic operations on RWByteAddressBuffer

* Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type)

* globallycoherent flag

But NOT yet supporting:

* AppendStructuredBuffer / ConsumeStructuredBuffer types
* IncrementCounter/DecrementCounter methods

Please note: the stride returned by GetDimensions is as calculated by glslang for std430,
and may not match other environments in all cases.
2017-02-21 15:51:49 -07:00
John Kessenich
0302bdf04a SPV: Fix #723: construct vectors from matrices. 2017-02-17 19:06:21 -07:00
John Kessenich
36852b838d Merge pull request #727 from jekstrand/image-load-formatted
Implement GL_EXT_shader_image_load_formatted
2017-02-17 17:40:26 -07:00
Jason Ekstrand
f44d89a398 Implement GL_EXT_shader_image_load_formatted 2017-02-17 13:36:25 -08:00
Maciej Jesionowski
5227b6decb Fix mismatched doc string for SPV_KHR_subgroup_vote
Text for opcodes OpSubgroupAllKHR and OpSubgroupAnyKHR was swapped.
2017-02-17 13:45:29 +01:00
chaoc
df3956c50f Implement NVX_multiview_per_view_attributes 2017-02-14 15:04:33 -08:00
John Kessenich
7225a1cb1e Support align/offset for all versions GLSL/ESSL targeting SPIR-V. 2017-02-13 09:09:04 -07:00
John Kessenich
e4e8f7b7a3 Merge pull request #722 from steve-lunarg/tessellation
Add basic HS/DS implementation.
2017-02-10 18:10:46 -07:00
steve-lunarg
858c928ac7 Add basic HS/DS implementation.
This obsoletes WIP PR #704, which was built on the pre entry point wrapping master.  New version
here uses entry point wrapping.

This is a limited implementation of tessellation shaders.  In particular, the following are not functional,
and will be added as separate stages to reduce the size of each PR.

* patchconstantfunctions accepting per-control-point input values, such as
  const OutputPatch <hs_out_t, 3> cpv are not implemented.

* patchconstantfunctions whose signature requires an aggregate input type such as
  a structure containing builtin variables.  Code to synthesize such calls is not
  yet present.

These restrictions will be relaxed as soon as possible.  Simple cases can compile now: see for example
Test/hulsl.hull.1.tesc - e.g, writing to inner and outer tessellation factors.

PCF invocation is synthesized as an entry point epilogue protected behind a barrier and a test on
invocation ID == 0.  If there is an existing invocation ID variable it will be used, otherwise one is
added to the linkage.  The PCF and the shader EP interfaces are unioned and builtins appearing in
the PCF but not the EP are also added to the linkage and synthesized as shader inputs.
Parameter matching to (eventually arbitrary) PCF signatures is by builtin variable type.  Any user
variables in the PCF signature will result in an error.  Overloaded PCF functions will also result in
an error.

[domain()], [partitioning()], [outputtopology()], [outputcontrolpoints()], and [patchconstantfunction()]
attributes to the shader entry point are in place, with the exception of the Pow2 partitioning mode.
2017-02-10 16:59:09 -07:00
John Kessenich
b49bb2ca5c PP, nonfunctional: Remove crufty bit-twiddling of tokens. 2017-02-10 13:03:40 -07:00
John Kessenich
8e711b84bd Fix issue #708: token pasting within macro argument expansion. 2017-02-10 10:07:03 -07:00
John Kessenich
8e6c6cef6a SPV: Implement specialization constants for ?:. 2017-02-08 17:07:07 -07:00
John Kessenich
433e9ff896 SPV: Emit OpSelect when a selection node is simple enough.
Also, ensures it has a type, no disallowed side effects,
or performance trade offs.
2017-02-08 17:03:13 -07:00
John Kessenich
dd40260b63 HLSL: don't do a deepCopy() for typedef, as we still want to share the type graph.
This enables the IO type mapping to work transparently for typedefs.
2017-02-08 13:59:30 -07:00
John Kessenich
65ee230f1c HLSL: Add tests and refine what decorations are passed through per stage/in/out. 2017-02-06 23:13:16 -07:00
John Kessenich
bf47286fe7 HLSL: Move to fine-grained control for defining input/output/uniform IO types. 2017-02-06 23:13:16 -07:00