1825 Commits

Author SHA1 Message Date
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
8e711b84bd Fix issue #708: token pasting within macro argument expansion. 2017-02-10 10:07:03 -07:00
John Kessenich
0793988697 Merge pull request #707 from KhronosGroup/emit-opSelect
SPV: Emit op select
2017-02-08 17:33:10 -07:00
John Kessenich
f8d0d8c2b8 Address issue #718. Should change which warning is generated, hopefully to a better one. 2017-02-08 17:31: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
509177d136 Merge pull request #685 from KhronosGroup/wrap-entry-point
HLSL: Wrap entry-point; needed to write 'in' args, and support 'inout' args
2017-02-08 17:01:44 -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
John Kessenich
727b374fd3 HLSL: Build IO types bottom up, as parsed, and cache the original (IO).
Previously, this was done recursively, per object, and the nonIO version
was cached. This reverses both those approaches.
2017-02-06 23:00:51 -07:00
John Kessenich
88c4464df5 HLSL: Have loose uniforms also go through the makeTypeNonIo() path. 2017-02-06 23:00:51 -07:00
steve-lunarg
2c5ab9c8fc HLSL: remove pervertex output blocks
This removes pervertex output blocks, in favor of using only
loose variables.  The pervertex blocks are not required and were
only partly implemented, and were adding some complication.

This change goes with wrap-entry-point.
2017-02-06 23:00:51 -07:00
John Kessenich
fbb58a4e0b Build: Fix Linux for older compiler: Use TMap instead of TUndorderedMap. 2017-02-06 23:00:51 -07:00
steve-lunarg
ec712ebea1 HLSL: fix copies between arrays of structs of builtins, and arrayed builtins.
Structs are split to remove builtin members to create valid SPIR-V.  In this
process, an outer structure array dimension may be propegated onto the
now-removed builtin variables.  For example, a mystruct[3].position ->
position[3].  The copy between the split and unsplit forms would handle
this in some cases, but not if the array dimension was at different levels
of aggregate.

It now does this, but may not handle arbitrary composite types.  Unclear if
that has any semantic meaning for builtins though.
2017-02-06 23:00:51 -07:00
John Kessenich
abd8dca86d HLSL: Make the entry-point shadow function have non-IO params and return.
This also removes an no longer needed makeTemporary() and rationalizes
makeTypeNonIo()'s interface.
2017-02-06 22:58:32 -07:00
steve-lunarg
5d3023af03 HLSL: Type sanitization: create non-IO types for var decl and fn param/ret
This introduces parallel types for IO-type containing aggregates used as
non-entry point function parameters or return types, or declared as variables.
Further uses of the same original type will share the same sanitized deep
structure.

This is intended to be used with the wrap-entry-point branch.
2017-02-06 22:58:32 -07:00
John Kessenich
0fe106afd2 AST: Have type deepCopy() preserve type graphs as graphs.
Previously, a type graph would turn into a type tree. That is,
a deep node that is shared would have multiple copies made.

This is important when creating IO and non-IO versions of deep types.
2017-02-06 22:58:32 -07:00
John Kessenich
02467d8d94 HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.
This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
2017-02-06 22:58:32 -07:00
John Kessenich
18adbdbbb8 Resolve issue #700: allow initializers on struct members. 2017-02-02 15:16:20 -07:00
John Kessenich
32fd5d26e3 Memory/constructor/warning clean-up. Addresses issue #705. 2017-02-02 14:55:02 -07:00
John Kessenich
f1aeac8944 Merge pull request #711 from eoma/fix-friendly-specialization-name
SPV: Emit names of specialization constants, fixes #710
2017-02-02 14:26:06 -07:00
Endre Oma
ad58d45437 SPV: Emit names of specialization constants 2017-01-31 21:16:17 +01:00
John Kessenich
7e134cdfbe Merge pull request #706 from Ralith/install-headers
Install headers
2017-01-29 20:44:31 -07:00
Benjamin Saunders
5a074532af Install headers
This enables the vulkan loader to be built against an installed glslang.
2017-01-29 17:46:44 -08:00
John Kessenich
62c3e400cf Fix bug from PR #678: NV_EXTENSIONS deleted implicit array sizing. 2017-01-26 22:03:57 -07:00
John Kessenich
82e0e58993 Fix issue #693. Ternary operator on void type. 2017-01-26 15:50:10 -07:00
John Kessenich
c0904c15c2 Merge pull request #690 from ligfx/proper_dependencies
CMake: add target_link_libraries internally
2017-01-26 15:13:27 -07:00
John Kessenich
2918a2ef15 README: point to HLSL status issues 2017-01-26 12:12:36 -07:00
John Kessenich
24ed24dd0a Merge pull request #702 from resetnow/master
SpvBuilder: add const specifier to vector reference arguments
2017-01-26 11:51:31 -07:00
Vlad Ivanov
689490fd4d SpvBuilder: add const specifier to vector reference arguments 2017-01-26 20:46:42 +03:00
John Kessenich
72754864c1 Merge pull request #694 from mtavenrath/fix_origin_link
Use correct OriginUpperLeft when linking more than one shader.
2017-01-26 10:39:54 -07:00
Markus Tavenrath
7b89e75213 Use correct OriginUpperLeft when linking more than one shader. 2017-01-25 12:11:16 -08:00
John Kessenich
047a6a49ef Merge pull request #696 from amdrexu/bugfix2
Semantics: Texture clamp functions are available for fragment shader only
2017-01-24 10:58:21 -07:00
John Kessenich
ab9e5e9f90 Merge pull request #695 from amdrexu/bugfix
Fix a CMakeLists issue
2017-01-24 10:57:54 -07:00
Rex Xu
00d54b4440 Semantics: Texture clamp functions are available for fragment shader only. 2017-01-24 14:36:10 +08:00
Rex Xu
c708f98081 Fix a CMakeLists issue 2017-01-24 14:24:21 +08:00
John Kessenich
2043da90df Merge pull request #692 from hrydgard/no-nvextensions-build-fix
Fix build if NV_EXTENSIONS is not set
2017-01-23 12:34:15 -07:00
Henrik Rydgard
bec5fc898a Fix build if NV_EXTENSIONS is not set 2017-01-23 16:27:08 +01:00
John Kessenich
64b010f390 Merge pull request #678 from chaoc/stereo_view_rendering
support SPV_NV_viewport_array2 and SPV_NV_stereo_view_rendering
2017-01-21 12:05:47 -07:00
Michael Maltese
6077a19ba3 CMake: add target_link_libraries internally
Makes it easier to include glslang in a larger CMake project---instead
of having to call `target_link_libraries(glslang OSDependent OGLCompiler
HLSL)`, for example, you only need to call
`target_link_libraries(glslang)` and it will pull in the helpers it
needs.

This is also better in terms of cleaning up the "public interface",
of sorts, for building glslang: end-users probably shouldn't need to
know or be explicitly dependent on internal targets.
2017-01-21 10:59:15 -08:00
chaoc
771d89fc36 support SPV_NV_viewport_array2 and SPV_NV_stereo_view_rendering 2017-01-20 16:48:26 -08:00
John Kessenich
52fceb08f4 Merge pull request #689 from mikew-lunarg/master
Fix for not-handled-in-switch warnings
2017-01-20 17:10:29 -07:00
Mike Weiblen
4e9e400ec6 Fix for not-handled-in-switch warnings
Added default to the switch() for AMD_EXTENSIONS to avoid a spew
of warning messages.
2017-01-20 13:39:30 -07:00
John Kessenich
c37f8d6b7e Merge pull request #683 from rdb/master
Fix compilation with MSVC 2010
2017-01-20 13:21:42 -07:00
rdb
a2f0e0e791 Fix compilation with MSVC 2010 2017-01-20 20:51:25 +01:00
John Kessenich
22f25d80c6 Merge pull request #682 from steve-lunarg/split-copy-fix
HLSL: fix dereferencing when copying split structures with arrays
2017-01-19 16:56:06 -07:00
John Kessenich
d3aea5edaf Merge pull request #679 from ashwinkolhe/akolhe_spv_khr_subgroup_vote
Implement SPV_KHR_subgroup_vote
2017-01-19 16:16:49 -07:00
John Kessenich
7dccb1519b SPV: Merge pull request #675 from amdrexu/feature
SPV: Implement new revision of extension GL_AMD_shader_ballot
2017-01-19 16:14:28 -07:00
John Kessenich
e48b8d74e2 Infrastructure: remove potential memory leaks. 2017-01-19 15:30:56 -07:00