platform/upstream/glslang.git
7 years agoAdded 'GL_core_profile' and 'GL_compatibility_profile' macro definition to preamble.
Lukas Hermanns [Fri, 10 Mar 2017 19:45:20 +0000 (20:45 +0100)]
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.

7 years agoMerge pull request #761 from baldurk/vs2010-compile-fixes
John Kessenich [Thu, 9 Mar 2017 18:28:21 +0000 (11:28 -0700)]
Merge pull request #761 from baldurk/vs2010-compile-fixes

Compile fixes for VS2010

7 years agoMerge pull request #760 from steve-lunarg/gathercmpred
John Kessenich [Thu, 9 Mar 2017 18:13:31 +0000 (11:13 -0700)]
Merge pull request #760 from steve-lunarg/gathercmpred

HLSL: Enable GatherCmpRed.  Green/Blue/Alpha cannot be supported.

7 years agoCompile fixes for VS2010
baldurk [Thu, 9 Mar 2017 17:48:59 +0000 (17:48 +0000)]
Compile fixes for VS2010

* Removed range-based for
* Added explicit return type to non-trivial lambda
* Added explicit scope for tInterstageIoData

7 years agoEnable GatherCmpRed. Green/Blue/Alpha cannot be supported.
steve-lunarg [Thu, 9 Mar 2017 15:59:45 +0000 (08:59 -0700)]
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.

7 years agoHLSL: Non-functional: Remove dead .length() code.
John Kessenich [Thu, 9 Mar 2017 04:16:35 +0000 (21:16 -0700)]
HLSL: Non-functional: Remove dead .length() code.

7 years agoHLSL: Non-functional: Drive existing method recognition by syntax, not by name.
John Kessenich [Thu, 9 Mar 2017 03:09:03 +0000 (20:09 -0700)]
HLSL: Non-functional: Drive existing method recognition by syntax, not by name.

This (and previous commit) is a better foundation to build real methods on.

7 years agoHLSL: Non-functional: Don't process function name/parameters before expected a functi...
John Kessenich [Thu, 9 Mar 2017 01:53:51 +0000 (18:53 -0700)]
HLSL: Non-functional: Don't process function name/parameters before expected a function declaration.

7 years agoMerge pull request #756 from steve-lunarg/getdimensions-fix
John Kessenich [Wed, 8 Mar 2017 03:57:49 +0000 (20:57 -0700)]
Merge pull request #756 from steve-lunarg/getdimensions-fix

HLSL: use LOD form of ImageQuerySize when needed.

7 years agoHLSL: Grammar: Generalize accepting a declaration to accept an aggregate of subtrees.
John Kessenich [Wed, 8 Mar 2017 03:44:09 +0000 (20:44 -0700)]
HLSL: Grammar: Generalize accepting a declaration to accept an aggregate of subtrees.

This is slightly cleaner today for entry-point wrapping, which sometimes made
two subtrees for a function definition instead of just one subtree.  It will be
critical though for recognizing a struct with multiple member functions.

7 years agoHLSL: use LOD form of ImageQuerySize when needed.
steve-lunarg [Wed, 8 Mar 2017 02:30:25 +0000 (19:30 -0700)]
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.

7 years agoHLSL: Fix #754: recognize type casts in if-statements separately from declarations.
John Kessenich [Tue, 7 Mar 2017 01:18:37 +0000 (18:18 -0700)]
HLSL: Fix #754: recognize type casts in if-statements separately from declarations.

7 years agoMerge pull request #755 from steve-lunarg/sb-orderfix
John Kessenich [Tue, 7 Mar 2017 00:56:56 +0000 (17:56 -0700)]
Merge pull request #755 from steve-lunarg/sb-orderfix

HLSL: Fix ordering defect if global SB decl after fn param

7 years agoWIP: HLSL: Fix ordering defect if global SB decl after fn param
steve-lunarg [Mon, 6 Mar 2017 19:01:44 +0000 (12:01 -0700)]
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.

7 years agoSPV: Allow push constant buffers to not have an instance name.
John Kessenich [Mon, 6 Mar 2017 15:51:35 +0000 (08:51 -0700)]
SPV: Allow push constant buffers to not have an instance name.

7 years agoHLSL: Test for issue #699.
John Kessenich [Sat, 4 Mar 2017 01:18:23 +0000 (18:18 -0700)]
HLSL: Test for issue #699.

7 years agoMerge pull request #750 from dgkoch/rename_KHX_to_EXT
John Kessenich [Sat, 4 Mar 2017 00:23:53 +0000 (17:23 -0700)]
Merge pull request #750 from dgkoch/rename_KHX_to_EXT

Rename KHX_multiview/device_group to EXT_multiview/device to match the released specs

7 years agoHLSL: Add 'class' keyword as (so far) synonym for 'struct'.
John Kessenich [Sat, 4 Mar 2017 00:01:01 +0000 (17:01 -0700)]
HLSL: Add 'class' keyword as (so far) synonym for 'struct'.

7 years agoRename KHX to EXT to match the released specs
Daniel Koch [Fri, 3 Mar 2017 23:40:48 +0000 (18:40 -0500)]
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.

7 years agoMerge pull request #748 from dgkoch/dgkoch_build_fixes2
John Kessenich [Fri, 3 Mar 2017 16:20:43 +0000 (09:20 -0700)]
Merge pull request #748 from dgkoch/dgkoch_build_fixes2

More build fixes

7 years agoMore build fixes
Daniel Koch [Fri, 3 Mar 2017 15:34:07 +0000 (10:34 -0500)]
More build fixes

Fix another build warning on some platforms

Use an explicit cast from size_t to int to avoid warning.

7 years agoHLSL: Fix #747: accept 'struct' in front of previously user-defined type name.
John Kessenich [Thu, 2 Mar 2017 21:30:59 +0000 (14:30 -0700)]
HLSL: Fix #747: accept 'struct' in front of previously user-defined type name.

7 years agoSPV: Fix #739: OpSelect can only operate on scalars and vectors.
John Kessenich [Wed, 1 Mar 2017 20:49:11 +0000 (13:49 -0700)]
SPV: Fix #739: OpSelect can only operate on scalars and vectors.

7 years agoMerge pull request #744 from realitix/sanitize_sh_link
John Kessenich [Wed, 1 Mar 2017 20:17:24 +0000 (13:17 -0700)]
Merge pull request #744 from realitix/sanitize_sh_link

Sanitize ShaderLang.h

7 years agoMerge pull request #746 from dgkoch/dgkoch_build_fixes
John Kessenich [Wed, 1 Mar 2017 20:14:51 +0000 (13:14 -0700)]
Merge pull request #746 from dgkoch/dgkoch_build_fixes

Fix build warnings on some platforms

7 years agoBuild: Another fix for issue #718: implement the hidden methods of tFinalize.
John Kessenich [Wed, 1 Mar 2017 20:12:26 +0000 (13:12 -0700)]
Build: Another fix for issue #718: implement the hidden methods of tFinalize.

7 years agoFix build warnings on some platforms
Daniel Koch [Tue, 28 Feb 2017 14:01:43 +0000 (09:01 -0500)]
Fix build warnings on some platforms

Use an explicit cast from size_t to int to avoid errors like the following:
glslang\glslang\MachineIndependent\preprocessor\Pp.cpp(1053) : error C2220: warning treated as error - no 'object' file generated
glslang\glslang\MachineIndependent\preprocessor\Pp.cpp(1053) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data

affects Pp.cpp, hlslParseHelper.cpp.

Initialize local variable to get rid of warningsa about potentially
uninitialized variables:
glslang\hlsl\hlslparsehelper.cpp(3667) : error C2220: warning treated as error - no 'object' file generated
glslang\hlsl\hlslparsehelper.cpp(3667) : warning C4701: potentially uninitialized local variable 'builtIn' used

affects hlslParseHelper.cpp

7 years agoSanitize ShaderLang.h
Jean-Sebastien Bevilacqua [Wed, 1 Mar 2017 08:23:14 +0000 (09:23 +0100)]
Sanitize ShaderLang.h

ShaderLang.h contains declaration for `ShLink` function which is never
defined.

See this grep output:

$grep -Hrn 'ShLink'
glslang/Public/ShaderLang.h:206:SH_IMPORT_EXPORT int ShLink(
glslang/Public/ShaderLang.h:214:SH_IMPORT_EXPORT int ShLinkExt(
glslang/MachineIndependent/ShaderLang.cpp:1268:int ShLinkExt(

7 years agoPP: Fix issue #738: don't assert on characters within a string.
John Kessenich [Wed, 1 Mar 2017 01:39:20 +0000 (18:39 -0700)]
PP: Fix issue #738: don't assert on characters within a string.

7 years agoPP: Partially address issue #738: handle premature end of argument when token pasting.
John Kessenich [Wed, 1 Mar 2017 01:04:47 +0000 (18:04 -0700)]
PP: Partially address issue #738: handle premature end of argument when token pasting.

7 years agoMerge pull request #742 from steve-lunarg/f16tof32-typefix
John Kessenich [Tue, 28 Feb 2017 23:18:24 +0000 (16:18 -0700)]
Merge pull request #742 from steve-lunarg/f16tof32-typefix

HLSL: small fix for index type in f16tof32 opcode

7 years agoHLSL: small fix for index type in f16tof32 opcode
steve-lunarg [Tue, 28 Feb 2017 21:14:14 +0000 (14:14 -0700)]
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.

7 years agoGLSL: Fix #741: rationalize per-block vs. per-member offset checking.
John Kessenich [Tue, 28 Feb 2017 21:10:00 +0000 (14:10 -0700)]
GLSL: Fix #741: rationalize per-block vs. per-member offset checking.

7 years agoMerge pull request #736 from steve-lunarg/structbuffer-params
John Kessenich [Tue, 28 Feb 2017 20:10:51 +0000 (13:10 -0700)]
Merge pull request #736 from steve-lunarg/structbuffer-params

HLSL: add structuredbuffer pass by reference in fn params

7 years agoPP: Address #737: accept 'h'/'H' floating-point suffix more broadly.
John Kessenich [Tue, 28 Feb 2017 19:40:40 +0000 (12:40 -0700)]
PP: Address #737: accept 'h'/'H' floating-point suffix more broadly.

7 years agoMerge pull request #740 from steve-lunarg/f16tof32
John Kessenich [Tue, 28 Feb 2017 16:54:38 +0000 (09:54 -0700)]
Merge pull request #740 from steve-lunarg/f16tof32

HLSL: add f16tof32 and f32tof16 decompositions.

7 years agoWIP: HLSL: add f16tof32 and f32tof16 decompositions.
steve-lunarg [Mon, 27 Feb 2017 20:09:32 +0000 (13:09 -0700)]
WIP: HLSL: add f16tof32 and f32tof16 decompositions.

7 years agoSPV: Update SPV header to official Rev. 10 of 1.0, and fix the consequences of doing so.
John Kessenich [Mon, 27 Feb 2017 08:50:28 +0000 (01:50 -0700)]
SPV: Update SPV header to official Rev. 10 of 1.0, and fix the consequences of doing so.

7 years agoSPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.
John Kessenich [Mon, 27 Feb 2017 08:20:51 +0000 (01:20 -0700)]
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.

7 years agoWIP: HLSL: add structuredbuffer pass by reference in fn params
steve-lunarg [Fri, 24 Feb 2017 01:04:12 +0000 (18:04 -0700)]
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.

7 years agoSPV: Handle nested opaque types as function parameters.
John Kessenich [Sat, 25 Feb 2017 02:15:46 +0000 (19:15 -0700)]
SPV: Handle nested opaque types as function parameters.

7 years agoMerge pull request #734 from steve-lunarg/ssbo-reflection
John Kessenich [Thu, 23 Feb 2017 00:12:09 +0000 (17:12 -0700)]
Merge pull request #734 from steve-lunarg/ssbo-reflection

Add reflection queries for thread local size.  Add ssbo auto-binding.

7 years agoMerge pull request #733 from amdrexu/bugfix
John Kessenich [Thu, 23 Feb 2017 00:11:00 +0000 (17:11 -0700)]
Merge pull request #733 from amdrexu/bugfix

SPV: Unexpected declarations of capabilities from NV extensions.

7 years agoAdd reflection queries for thread local size and ssbo auto-binding
steve-lunarg [Wed, 22 Feb 2017 00:19:08 +0000 (17:19 -0700)]
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.

7 years agoSPV: Unexpected declarations of capabilities from NV extensions.
Rex Xu [Wed, 22 Feb 2017 08:44:48 +0000 (16:44 +0800)]
SPV: Unexpected declarations of capabilities from NV extensions.

7 years agoMerge pull request #725 from steve-lunarg/structurebuffer
John Kessenich [Wed, 22 Feb 2017 00:01:37 +0000 (17:01 -0700)]
Merge pull request #725 from steve-lunarg/structurebuffer

HLSL: implement 4 (of 6) structuredbuffer types

7 years agoHLSL: implement 4 (of 6) structuredbuffer types
steve-lunarg [Mon, 13 Feb 2017 00:50:28 +0000 (17:50 -0700)]
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.

7 years agoMerge pull request #732 from dneto0/fix-overrides
John Kessenich [Tue, 21 Feb 2017 20:09:05 +0000 (13:09 -0700)]
Merge pull request #732 from dneto0/fix-overrides

Add override where needed by clang++

7 years agoAdd override where needed by clang++
David Neto [Tue, 21 Feb 2017 19:41:15 +0000 (14:41 -0500)]
Add override where needed by clang++

Otherwise we get an error when we have both
-Werror and -Winconsistent-missing-override.
This is required for building with NDK r14 betas

7 years agoFix issue #676: emit error message on failure to open spv file.
John Kessenich [Sat, 18 Feb 2017 16:45:40 +0000 (09:45 -0700)]
Fix issue #676: emit error message on failure to open spv file.

7 years agoSPV: Fix #723: construct vectors from matrices.
John Kessenich [Sat, 18 Feb 2017 02:06:21 +0000 (19:06 -0700)]
SPV: Fix #723: construct vectors from matrices.

7 years agoMerge pull request #727 from jekstrand/image-load-formatted
John Kessenich [Sat, 18 Feb 2017 00:40:26 +0000 (17:40 -0700)]
Merge pull request #727 from jekstrand/image-load-formatted

Implement GL_EXT_shader_image_load_formatted

7 years agoMerge pull request #729 from gwihlidal/master
John Kessenich [Sat, 18 Feb 2017 00:39:32 +0000 (17:39 -0700)]
Merge pull request #729 from gwihlidal/master

HLSL - Support for SV_GroupIndex

7 years agoImplement GL_EXT_shader_image_load_formatted
Jason Ekstrand [Fri, 17 Feb 2017 04:35:17 +0000 (20:35 -0800)]
Implement GL_EXT_shader_image_load_formatted

7 years agoWarning fixes
Graham Wihlidal [Fri, 17 Feb 2017 18:05:14 +0000 (19:05 +0100)]
Warning fixes

7 years agoHLSL - Support for SV_GroupIndex
Graham Wihlidal [Fri, 17 Feb 2017 18:03:25 +0000 (19:03 +0100)]
HLSL - Support for SV_GroupIndex

7 years agoMerge pull request #1 from KhronosGroup/master
Graham Wihlidal [Fri, 17 Feb 2017 17:41:31 +0000 (18:41 +0100)]
Merge pull request #1 from KhronosGroup/master

Update from master

7 years agoMerge pull request #720 from flaviobortot/master
John Kessenich [Fri, 17 Feb 2017 16:34:08 +0000 (09:34 -0700)]
Merge pull request #720 from flaviobortot/master

Added --vn option to generate a C header file containing a variable a…

7 years agoMerge pull request #728 from MaciejJesionowskiAMD/fix-mismatched-subgroup-vote-string
John Kessenich [Fri, 17 Feb 2017 16:11:41 +0000 (09:11 -0700)]
Merge pull request #728 from MaciejJesionowskiAMD/fix-mismatched-subgroup-vote-string

Fix mismatched doc string for SPV_KHR_subgroup_vote

7 years agoFix mismatched doc string for SPV_KHR_subgroup_vote
Maciej Jesionowski [Fri, 17 Feb 2017 12:45:08 +0000 (13:45 +0100)]
Fix mismatched doc string for SPV_KHR_subgroup_vote

Text for opcodes OpSubgroupAllKHR and OpSubgroupAnyKHR was swapped.

7 years agoMerge pull request #724 from chaoc/master
John Kessenich [Wed, 15 Feb 2017 23:41:52 +0000 (16:41 -0700)]
Merge pull request #724 from chaoc/master

Implement NVX_multiview_per_view_attributes

7 years agoRemoved tabs and replaced with spaces. Changed layout for "else if"
Flavio [Wed, 15 Feb 2017 22:29:33 +0000 (14:29 -0800)]
Removed tabs and replaced with spaces. Changed layout for "else if"

7 years agoImplement NVX_multiview_per_view_attributes
chaoc [Tue, 14 Feb 2017 22:52:34 +0000 (14:52 -0800)]
Implement NVX_multiview_per_view_attributes

7 years agoSupport align/offset for all versions GLSL/ESSL targeting SPIR-V.
John Kessenich [Mon, 13 Feb 2017 16:09:04 +0000 (09:09 -0700)]
Support align/offset for all versions GLSL/ESSL targeting SPIR-V.

7 years agoMerge pull request #722 from steve-lunarg/tessellation
John Kessenich [Sat, 11 Feb 2017 01:10:46 +0000 (18:10 -0700)]
Merge pull request #722 from steve-lunarg/tessellation

Add basic HS/DS implementation.

7 years agoPP, nonfunctional: Properly encapsulate a TokenStream.
John Kessenich [Sat, 11 Feb 2017 01:03:01 +0000 (18:03 -0700)]
PP, nonfunctional: Properly encapsulate a TokenStream.

7 years agoAdd basic HS/DS implementation.
steve-lunarg [Sat, 7 Jan 2017 15:54:10 +0000 (08:54 -0700)]
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.

7 years agoPP, nonfunctional: Remove crufty bit-twiddling of tokens.
John Kessenich [Fri, 10 Feb 2017 19:56:05 +0000 (12:56 -0700)]
PP, nonfunctional: Remove crufty bit-twiddling of tokens.

7 years agoFix issue #708: token pasting within macro argument expansion.
John Kessenich [Fri, 10 Feb 2017 17:04:16 +0000 (10:04 -0700)]
Fix issue #708: token pasting within macro argument expansion.

7 years agoMerge pull request #707 from KhronosGroup/emit-opSelect
John Kessenich [Thu, 9 Feb 2017 00:33:11 +0000 (17:33 -0700)]
Merge pull request #707 from KhronosGroup/emit-opSelect

SPV: Emit op select

7 years agoAddress issue #718. Should change which warning is generated, hopefully to a better...
John Kessenich [Thu, 9 Feb 2017 00:31:03 +0000 (17:31 -0700)]
Address issue #718. Should change which warning is generated, hopefully to a better one.

7 years agoSPV: Implement specialization constants for ?:.
John Kessenich [Sun, 29 Jan 2017 02:29:42 +0000 (19:29 -0700)]
SPV: Implement specialization constants for ?:.

7 years agoSPV: Emit OpSelect when a selection node is simple enough.
John Kessenich [Fri, 27 Jan 2017 03:31:11 +0000 (20:31 -0700)]
SPV: Emit OpSelect when a selection node is simple enough.

Also, ensures it has a type, no disallowed side effects,
or performance trade offs.

7 years agoMerge pull request #685 from KhronosGroup/wrap-entry-point
John Kessenich [Thu, 9 Feb 2017 00:01:44 +0000 (17:01 -0700)]
Merge pull request #685 from KhronosGroup/wrap-entry-point

HLSL: Wrap entry-point; needed to write 'in' args, and support 'inout' args

7 years agoHLSL: don't do a deepCopy() for typedef, as we still want to share the type graph.
John Kessenich [Wed, 8 Feb 2017 20:59:30 +0000 (13:59 -0700)]
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.

7 years agoHLSL: Add tests and refine what decorations are passed through per stage/in/out.
John Kessenich [Tue, 7 Feb 2017 01:44:52 +0000 (18:44 -0700)]
HLSL: Add tests and refine what decorations are passed through per stage/in/out.

7 years agoHLSL: Move to fine-grained control for defining input/output/uniform IO types.
John Kessenich [Mon, 6 Feb 2017 03:27:30 +0000 (20:27 -0700)]
HLSL: Move to fine-grained control for defining input/output/uniform IO types.

7 years agoHLSL: Build IO types bottom up, as parsed, and cache the original (IO).
John Kessenich [Sat, 4 Feb 2017 00:57:55 +0000 (17:57 -0700)]
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.

7 years agoHLSL: Have loose uniforms also go through the makeTypeNonIo() path.
John Kessenich [Fri, 3 Feb 2017 21:06:36 +0000 (14:06 -0700)]
HLSL: Have loose uniforms also go through the makeTypeNonIo() path.

7 years agoHLSL: remove pervertex output blocks
steve-lunarg [Fri, 3 Feb 2017 20:37:54 +0000 (13:37 -0700)]
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.

7 years agoBuild: Fix Linux for older compiler: Use TMap instead of TUndorderedMap.
John Kessenich [Fri, 3 Feb 2017 18:21:24 +0000 (11:21 -0700)]
Build: Fix Linux for older compiler: Use TMap instead of TUndorderedMap.

7 years agoHLSL: fix copies between arrays of structs of builtins, and arrayed builtins.
steve-lunarg [Thu, 2 Feb 2017 23:32:02 +0000 (16:32 -0700)]
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.

7 years agoHLSL: Make the entry-point shadow function have non-IO params and return.
John Kessenich [Thu, 2 Feb 2017 01:09:17 +0000 (18:09 -0700)]
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.

7 years agoHLSL: Type sanitization: create non-IO types for var decl and fn param/ret
steve-lunarg [Wed, 25 Jan 2017 17:03:17 +0000 (10:03 -0700)]
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.

7 years agoAST: Have type deepCopy() preserve type graphs as graphs.
John Kessenich [Wed, 1 Feb 2017 20:14:03 +0000 (13:14 -0700)]
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.

7 years agoHLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.
John Kessenich [Thu, 19 Jan 2017 22:41:47 +0000 (15:41 -0700)]
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

7 years agoAdded --vn option to generate a C header file containing a variable assigned to the...
Flavio [Mon, 6 Feb 2017 19:46:35 +0000 (11:46 -0800)]
Added --vn option to generate a C header file containing a variable assigned to the hex representation of the shader. This is a standard feature on Microsoft's HLSL compiler and it allows developers to include pre-compiled shaders directly into the code. This option enables "Hex output", so it is NOT required to specify -x as well. The output file name is preserved, so no ".h" extension is added. If you want the output file to have ".h" extension then you have to specify it on the output file name. The generated header file uses the "#pragma once" pragma to avoid multiple inclusions.

7 years agoResolve issue #700: allow initializers on struct members.
John Kessenich [Thu, 2 Feb 2017 22:16:20 +0000 (15:16 -0700)]
Resolve issue #700: allow initializers on struct members.

7 years agoMemory/constructor/warning clean-up. Addresses issue #705.
John Kessenich [Thu, 2 Feb 2017 21:55:02 +0000 (14:55 -0700)]
Memory/constructor/warning clean-up. Addresses issue #705.

7 years agoMerge pull request #711 from eoma/fix-friendly-specialization-name
John Kessenich [Thu, 2 Feb 2017 21:26:06 +0000 (14:26 -0700)]
Merge pull request #711 from eoma/fix-friendly-specialization-name

SPV: Emit names of specialization constants, fixes #710

7 years agoSPV: Emit names of specialization constants
Endre Oma [Tue, 31 Jan 2017 20:08:19 +0000 (21:08 +0100)]
SPV: Emit names of specialization constants

7 years agoMerge pull request #706 from Ralith/install-headers
John Kessenich [Mon, 30 Jan 2017 03:44:31 +0000 (20:44 -0700)]
Merge pull request #706 from Ralith/install-headers

Install headers

7 years agoInstall headers
Benjamin Saunders [Mon, 30 Jan 2017 01:45:12 +0000 (17:45 -0800)]
Install headers

This enables the vulkan loader to be built against an installed glslang.

7 years agoFix bug from PR #678: NV_EXTENSIONS deleted implicit array sizing.
John Kessenich [Fri, 27 Jan 2017 05:03:57 +0000 (22:03 -0700)]
Fix bug from PR #678: NV_EXTENSIONS deleted implicit array sizing.

7 years agoFix issue #693. Ternary operator on void type.
John Kessenich [Thu, 26 Jan 2017 22:48:27 +0000 (15:48 -0700)]
Fix issue #693. Ternary operator on void type.

7 years agoMerge pull request #690 from ligfx/proper_dependencies
John Kessenich [Thu, 26 Jan 2017 22:13:27 +0000 (15:13 -0700)]
Merge pull request #690 from ligfx/proper_dependencies

CMake: add target_link_libraries internally

7 years agoREADME: point to HLSL status issues
John Kessenich [Thu, 26 Jan 2017 19:12:36 +0000 (12:12 -0700)]
README: point to HLSL status issues

7 years agoMerge pull request #702 from resetnow/master
John Kessenich [Thu, 26 Jan 2017 18:51:31 +0000 (11:51 -0700)]
Merge pull request #702 from resetnow/master

SpvBuilder: add const specifier to vector reference arguments

7 years agoSpvBuilder: add const specifier to vector reference arguments
Vlad Ivanov [Thu, 26 Jan 2017 17:46:02 +0000 (20:46 +0300)]
SpvBuilder: add const specifier to vector reference arguments

7 years agoMerge pull request #694 from mtavenrath/fix_origin_link
John Kessenich [Thu, 26 Jan 2017 17:39:54 +0000 (10:39 -0700)]
Merge pull request #694 from mtavenrath/fix_origin_link

Use correct OriginUpperLeft when linking more than one shader.