platform/upstream/glslang.git
7 years agoHLSL: handle split InputPatch templat type in patch constant functions
LoopDawg [Wed, 13 Sep 2017 14:44:39 +0000 (08:44 -0600)]
HLSL: handle split InputPatch templat type in patch constant functions

InputPatch parameters to patch constant functions were not using the
internal (temporary) variable type.  That could cause validation errors
if the input patch had a mixture of builtins and user qualified members.

This uses the entry point's internal form.

There is currently a limitation: if an InputPatch is used in a PCF,
it must also have appeared in the main entry point's parameter list.
That is not a limitation of HLSL.  Currently that situation is detected
and an "implemented" error results.  The limitation can be addressed,
but isn't yet in the current form of the PR.

7 years agoHLSL: allow mixed user & builtin members in hull shader output structure
LoopDawg [Sun, 10 Sep 2017 15:46:55 +0000 (09:46 -0600)]
HLSL: allow mixed user & builtin members in hull shader output structure

Hull shaders have an implicitly arrayed output.  This is handled by creating an arrayed form of the
provided output type, and writing to the element of it indexed by InvocationID.

The implicit indirection into that array was causing some troubles when copying to a split
structure.  handleAssign was able to handle simple symbol lvalues, but not an lvalue composed
of an indirection into an array.

7 years agoGLSL: Make gl_Layer and gl_ViewportIndex always be outside blocks.
John Kessenich [Wed, 13 Sep 2017 19:22:50 +0000 (13:22 -0600)]
GLSL: Make gl_Layer and gl_ViewportIndex always be outside blocks.

There was some ambiguity/contradiction in this behavior, and
Khronos decided glslang should always have these outside blocks,
rather than have stage/vendor/target variations.

7 years agoMerge pull request #1056 from KhronosGroup/glsl-entrypoint-rename
John Kessenich [Tue, 12 Sep 2017 16:53:05 +0000 (10:53 -0600)]
Merge pull request #1056 from KhronosGroup/glsl-entrypoint-rename

GLSL: Promote HLSL entry-point renaming code to be used by GLSL as well.

7 years agoGLSL: Promote HLSL entry-point renaming code to be used by GLSL as well.
John Kessenich [Tue, 12 Sep 2017 03:48:19 +0000 (21:48 -0600)]
GLSL: Promote HLSL entry-point renaming code to be used by GLSL as well.

Fixes #1045.

7 years agoMerge pull request #1050 from amdrexu/feature
John Kessenich [Tue, 12 Sep 2017 15:09:37 +0000 (09:09 -0600)]
Merge pull request #1050 from amdrexu/feature

Implement the extension GL_AMD_shader_fragment_mask

7 years agoMerge pull request #1055 from KhronosGroup/strdup
John Kessenich [Tue, 12 Sep 2017 04:04:59 +0000 (22:04 -0600)]
Merge pull request #1055 from KhronosGroup/strdup

Build: Fix strdup -> _strdup warnings.

7 years agoBuild: Fix strdup -> _strdup warnings.
John Kessenich [Tue, 12 Sep 2017 03:27:23 +0000 (21:27 -0600)]
Build: Fix strdup -> _strdup warnings.

7 years agoBuild: Fix build warnings.
John Kessenich [Tue, 12 Sep 2017 02:39:54 +0000 (20:39 -0600)]
Build: Fix build warnings.

7 years agoFix #1043: set all scan string-locations to have bias, not just the first one.
John Kessenich [Tue, 12 Sep 2017 02:35:49 +0000 (20:35 -0600)]
Fix #1043: set all scan string-locations to have bias, not just the first one.

7 years agoNon-functional: Make usage for entry points more consistent.
John Kessenich [Tue, 12 Sep 2017 02:13:49 +0000 (20:13 -0600)]
Non-functional: Make usage for entry points more consistent.

7 years agoMerge pull request #1053 from mchock-nv/mchock-nv-fix-lambda
John Kessenich [Tue, 12 Sep 2017 01:33:11 +0000 (19:33 -0600)]
Merge pull request #1053 from mchock-nv/mchock-nv-fix-lambda

Delete unused 'this' capture

7 years agoAddress #1052: Have language-level exits of case statements.
John Kessenich [Tue, 12 Sep 2017 01:25:17 +0000 (19:25 -0600)]
Address #1052: Have language-level exits of case statements.

7 years agoDelete unused 'this' capture
mchock-nv [Mon, 11 Sep 2017 22:20:52 +0000 (15:20 -0700)]
Delete unused 'this' capture

Remove an unused 'this' entry from a lambda capture list.

This cleans up a unused-lambda-capture warning.

7 years agoImplement the extension GL_AMD_shader_fragment_mask
amhagan [Tue, 13 Jun 2017 20:53:02 +0000 (16:53 -0400)]
Implement the extension GL_AMD_shader_fragment_mask

7 years agoMerge pull request #1047 from svenstaro/add-stdin-option
John Kessenich [Fri, 8 Sep 2017 03:02:37 +0000 (20:02 -0700)]
Merge pull request #1047 from svenstaro/add-stdin-option

Add stdin option (fixes #598)

7 years agoAdd --stdin
Sven-Hendrik Haase [Sat, 2 Sep 2017 17:34:54 +0000 (19:34 +0200)]
Add --stdin

7 years agoMerge pull request #1048 from LoopDawg/opaque-type-fix
John Kessenich [Thu, 7 Sep 2017 04:50:20 +0000 (21:50 -0700)]
Merge pull request #1048 from LoopDawg/opaque-type-fix

Fix lvalue test in SPIR-V generation

7 years agoFix lvalue check in SPIR-V generation
LoopDawg [Wed, 6 Sep 2017 20:59:06 +0000 (14:59 -0600)]
Fix lvalue check in SPIR-V generation

There were several locations in TGlslangToSpvTraverser::handleUserFunctionCall testing for
whether a fn argument should be in the lvalue or rvalue array.  They must get the same
result for indexing sanity, but had slightly different logic.

They're now forced into the same test.

7 years agoMerge pull request #1042 from LoopDawg/warning-fix-2
John Kessenich [Fri, 1 Sep 2017 05:46:56 +0000 (23:46 -0600)]
Merge pull request #1042 from LoopDawg/warning-fix-2

WIP: Linux build warning fix

7 years agoMerge pull request #1039 from amdrexu/bugfix
John Kessenich [Fri, 1 Sep 2017 05:36:09 +0000 (23:36 -0600)]
Merge pull request #1039 from amdrexu/bugfix

Fix issues of GL_ARB_viewport_layer_array

7 years agoLinux build warning fix
LoopDawg [Thu, 31 Aug 2017 19:44:34 +0000 (13:44 -0600)]
Linux build warning fix

* Remove complaint about unused function parameter in resolveUniformLocation()
* Remove complaint about defined but not used variable in spvIR.h

7 years agoFix issues of GL_ARB_viewport_layer_array
Rex Xu [Thu, 31 Aug 2017 07:14:49 +0000 (15:14 +0800)]
Fix issues of GL_ARB_viewport_layer_array

7 years agoMerge pull request #1037 from LoopDawg/clip-cull-geom
John Kessenich [Thu, 31 Aug 2017 18:36:06 +0000 (12:36 -0600)]
Merge pull request #1037 from LoopDawg/clip-cull-geom

HLSL: add geometry stage support for clip/cull distance

7 years agoHLSL: add geometry stage support for clip/cull distance
LoopDawg [Mon, 28 Aug 2017 20:02:19 +0000 (14:02 -0600)]
HLSL: add geometry stage support for clip/cull distance

Changes:

(1) Allow clip/cull builtins as both input and output in the same shader stage.  Previously,
not enough data was tracked to handle this.

(2) Handle the extra array dimension in GS inputs.  The synthesized external variable can
now be created with the extra array dimension if needed, and the form conversion code is
able to handle it as well.

For example, both of these GS inputs would result in the same synthesized external type:

    triangle in float4 clip[3] : SV_ClipDistance

    triangle in float2 clip[3][2] : SV_ClipDistance

In the second case, the inner array dimension packs with the 2-vector of floats into an array[4],
which there is an array[3] of due to the triangle geometry.

7 years agoMerge pull request #1031 from xxxbxxx/for-upstream-2
John Kessenich [Tue, 29 Aug 2017 18:41:55 +0000 (12:41 -0600)]
Merge pull request #1031 from xxxbxxx/for-upstream-2

HLSL: fix preprocessor concatenation behaviour.

7 years agoBuild: Fix #1036: size_t warning.
John Kessenich [Tue, 29 Aug 2017 18:36:09 +0000 (12:36 -0600)]
Build: Fix #1036: size_t warning.

7 years agoHLSL: fix preprocessor concatenation behaviour.
xavier [Thu, 24 Aug 2017 06:28:57 +0000 (08:28 +0200)]
HLSL: fix preprocessor concatenation behaviour.

Fix #772.

7 years agoMerge pull request #1035 from LoopDawg/clip-cull-type-fix
John Kessenich [Mon, 28 Aug 2017 22:07:55 +0000 (16:07 -0600)]
Merge pull request #1035 from LoopDawg/clip-cull-type-fix

HLSL: (minor) fix type on clip/cull index result

7 years agoHLSL: fix type on clip/cull index result
LoopDawg [Mon, 28 Aug 2017 20:05:41 +0000 (14:05 -0600)]
HLSL: fix type on clip/cull index result

While adding geometry stage support for clip/cull, it transpired that the
existing clip/cull support was not setting the type of the result of indexing
into the clup/cull variable.  That's a defect independent of the geometry
support, so to simplify the geometry PR, this is addressed separately.

It doesn't appear to change the generated SPIR-V, but that's probably down to
something else tolerating a bad input.

7 years agoSPV: Add auto location mapping of non-opaque non-block uniform variables.
John Kessenich [Sat, 26 Aug 2017 21:47:25 +0000 (15:47 -0600)]
SPV: Add auto location mapping of non-opaque non-block uniform variables.

Fix #1019.

7 years agoBuild: Attempt better support for VS 2012.
John Kessenich [Sat, 26 Aug 2017 03:09:15 +0000 (21:09 -0600)]
Build: Attempt better support for VS 2012.

Fix #1020. Fix #1021. Fix #1022.

7 years agoMerge pull request #1014 from KhronosGroup/SPV_EXT_shader_viewport_index_layer
John Kessenich [Fri, 25 Aug 2017 19:33:16 +0000 (13:33 -0600)]
Merge pull request #1014 from KhronosGroup/SPV_EXT_shader_viewport_index_layer

SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer.

7 years agoMerge pull request #1034 from KhronosGroup/module-processes
John Kessenich [Fri, 25 Aug 2017 19:05:54 +0000 (13:05 -0600)]
Merge pull request #1034 from KhronosGroup/module-processes

SPV reflection: Add OpModuleProcessed for compile options.

7 years agoSPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer.
John Kessenich [Fri, 11 Aug 2017 19:07:17 +0000 (13:07 -0600)]
SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer.

7 years agoSPV reflection: Add OpModuleProcessed for compile options.
John Kessenich [Fri, 21 Jul 2017 02:00:36 +0000 (20:00 -0600)]
SPV reflection: Add OpModuleProcessed for compile options.

7 years agoMerge pull request #1028 from LoopDawg/clip-cull-input
John Kessenich [Thu, 24 Aug 2017 18:15:00 +0000 (12:15 -0600)]
Merge pull request #1028 from LoopDawg/clip-cull-input

HLSL: handle clip and cull distance input builtin type conversion

7 years agoHLSL: handle clip and cull distance input builtin type conversion
LoopDawg [Wed, 23 Aug 2017 18:34:42 +0000 (12:34 -0600)]
HLSL: handle clip and cull distance input builtin type conversion

HLSL allows a range of types for clip and cull distances.  There are
three dimensions, including arrayness, vectorness, and semantic ID.
SPIR-V requires clip and cull distance be a single array of floats in
all cases.

This code provides input side conversion between the SPIR-V form and
the HLSL form.  (Output conversion was added in PR #947 and #997).

This PR extends HlslParseContext::assignClipCullDistance to cope with
the input side conversion.  Not as much changed as appears: there was
also a lot of renaming to reflect the fact that the code now handles
either direction.

Currently, non-{frag,vert} stages are not handled, and are explicitly
rejected.

Fixes #1026.

7 years agoMerge pull request #1029 from amdrexu/feature2
John Kessenich [Thu, 24 Aug 2017 05:13:19 +0000 (23:13 -0600)]
Merge pull request #1029 from amdrexu/feature2

Implement extension GL_AMD_shader_image_load_store_lod

7 years agoMerge pull request #1025 from amdrexu/feature
John Kessenich [Wed, 23 Aug 2017 23:58:31 +0000 (17:58 -0600)]
Merge pull request #1025 from amdrexu/feature

SPV: Implement extension SPV_EXT_shader_stencil_export

7 years agoImplement extension GL_AMD_shader_image_load_store_lod
Rex Xu [Wed, 5 Jul 2017 09:23:28 +0000 (17:23 +0800)]
Implement extension GL_AMD_shader_image_load_store_lod

7 years agoSPV: Implement extension SPV_EXT_shader_stencil_export
Rex Xu [Wed, 23 Aug 2017 15:24:42 +0000 (23:24 +0800)]
SPV: Implement extension SPV_EXT_shader_stencil_export

7 years agoHLSL: Fix #1027.
John Kessenich [Wed, 23 Aug 2017 20:33:31 +0000 (14:33 -0600)]
HLSL: Fix #1027.

7 years agoHLSL: Fix #1018: Give an error for mismatched return type.
John Kessenich [Sat, 19 Aug 2017 23:29:44 +0000 (17:29 -0600)]
HLSL: Fix #1018: Give an error for mismatched return type.

7 years agoMerge pull request #1017 from LoopDawg/texture-struct-return.1
John Kessenich [Sat, 19 Aug 2017 22:00:26 +0000 (16:00 -0600)]
Merge pull request #1017 from LoopDawg/texture-struct-return.1

HLSL: add methods to handle user structures in texture template type.

7 years agoBuild: Fix build when NV_EXTENSIONS is not enabled.
John Kessenich [Sat, 19 Aug 2017 21:54:49 +0000 (15:54 -0600)]
Build: Fix build when NV_EXTENSIONS is not enabled.

7 years agoSPV: Fix #1016: Don't allow non-GLSL-extension protected Layer and ViewportIndex...
John Kessenich [Fri, 18 Aug 2017 05:49:39 +0000 (23:49 -0600)]
SPV: Fix #1016: Don't allow non-GLSL-extension protected Layer and ViewportIndex members.

7 years agoHLSL: add methods to track user structure in texture return type.
LoopDawg [Mon, 31 Jul 2017 19:41:42 +0000 (13:41 -0600)]
HLSL: add methods to track user structure in texture return type.

Some languages allow a restricted set of user structure types returned from texture sampling
operations.  Restrictions include the total vector size of all components may not exceed 4,
and the basic types of all members must be identical.

This adds underpinnings for that ability.  Because storing a whole TType or even a simple
TTypeList in the TSampler would be expensive, the structure definition is held in a
table outside the TType.  The TSampler contains a small bitfield index, currently 4 bits
to support up to 15 separate texture template structure types, but that can be adjusted
up or down.  Vector returns are handled as before.

There are abstraction methods accepting and returning a TType (such as may have been parsed
from a grammar).  The new methods will accept a texture template type and set the
sampler to the structure if possible, checking a range of error conditions such as whether
the total structure vector components exceed 4, or whether their basic types differe, or
whether the struct contains non-vector-or-scalar members.  Another query returns the
appropriate TType for the sampler.

High level summary of design:

In the TSampler, this holds an index into the texture structure return type table:

    unsigned int structReturnIndex : structReturnIndexBits;

These are the methods to set or get the return type from the TSampler.  They work for vector or structure returns, and potentially could be expanded to handle other things (small arrays?) if ever needed.

    bool setTextureReturnType(TSampler& sampler, const TType& retType, const TSourceLoc& loc);
    void getTextureReturnType(const TSampler& sampler, const TType& retType, const TSourceLoc& loc) const;

The ``convertReturn`` lambda in ``HlslParseContext::decomposeSampleMethods`` is greatly expanded to know how to copy a vec4 sample return to whatever the structure type should be.  This is a little awkward since it involves introducing a comma expression to return the proper aggregate value after a set of memberwise copies.

7 years agoHLSL: Add fall-back for opaque initializers to just generate long-term expected code.
John Kessenich [Tue, 15 Aug 2017 16:18:32 +0000 (10:18 -0600)]
HLSL: Add fall-back for opaque initializers to just generate long-term expected code.

This generated code needs an optimization pass to eliminate the assignments
to the opaque members.

7 years agoMerge pull request #1013 from KhronosGroup/flatten-nonarrayed
John Kessenich [Tue, 15 Aug 2017 04:16:36 +0000 (13:16 +0900)]
Merge pull request #1013 from KhronosGroup/flatten-nonarrayed

HLSL: Flatten structs for all non-arrayed I/O interfaces.

7 years agoSPV: Correct selection of storage-image capabilities. Fixes #986.
John Kessenich [Tue, 15 Aug 2017 04:10:00 +0000 (22:10 -0600)]
SPV: Correct selection of storage-image capabilities. Fixes #986.

Code was reflecting an old historical use of sampled as a SPIR-V
2-valued operand, instead of its current 3 values.

7 years agoHLSL: Flatten structs for all non-arrayed I/O interfaces.
John Kessenich [Fri, 11 Aug 2017 06:17:26 +0000 (00:17 -0600)]
HLSL: Flatten structs for all non-arrayed I/O interfaces.

7 years agoHLSL: Make fresh array sizes for TessLevelOuter and TessLevelInner arrays.
John Kessenich [Fri, 11 Aug 2017 06:14:46 +0000 (00:14 -0600)]
HLSL: Make fresh array sizes for TessLevelOuter and TessLevelInner arrays.

This prevents potentional sharing from inadvertently affecting other arrays.

7 years agoHLSL Test: Expand test, adding a user-patch-constant signature.
John Kessenich [Thu, 10 Aug 2017 17:41:11 +0000 (11:41 -0600)]
HLSL Test: Expand test, adding a user-patch-constant signature.

7 years agoHLSL: Move debug naming to a simpler, more consistent, scheme.
John Kessenich [Wed, 9 Aug 2017 20:29:29 +0000 (14:29 -0600)]
HLSL: Move debug naming to a simpler, more consistent, scheme.

This will help in expanding flattening and reducing splitting.

7 years agoHLSL: Include built-in processing for vertex input and fragment output flattening.
John Kessenich [Wed, 9 Aug 2017 02:02:21 +0000 (20:02 -0600)]
HLSL: Include built-in processing for vertex input and fragment output flattening.

7 years agoNon-functional HLSL: Factor out built-ins from splitting and related simplifications.
John Kessenich [Tue, 8 Aug 2017 05:40:05 +0000 (23:40 -0600)]
Non-functional HLSL: Factor out built-ins from splitting and related simplifications.

7 years agoMerge pull request #1011 from LoopDawg/pragma-pack-matrix
John Kessenich [Mon, 7 Aug 2017 21:35:29 +0000 (06:35 +0900)]
Merge pull request #1011 from LoopDawg/pragma-pack-matrix

HLSL: implement #pragma pack_matrix(layout)

7 years agoHLSL: implement #pragma pack_matrix(layout)
LoopDawg [Mon, 7 Aug 2017 18:08:50 +0000 (12:08 -0600)]
HLSL: implement #pragma pack_matrix(layout)

This adds support for #pragma pack_matrix() to the HLSL front end.

The pragma sets the default matrix layout for subsequent unqualified matrices
in structs or buffers. Explicit qualification overrides the pragma value. Matrix
layout is not permitted at the structure level in HLSL, so only leaves which are
matrix types can be so qualified.

Note that due to the semantic (not layout) difference in first matrix indirections
between HLSL and SPIR-V, the sense of row and column major are flipped.  That's
independent of this PR: just a factor to note.  A column_major qualifier appears
as a RowMajor member decoration in SPIR-V modules, and vice versa.

7 years agoHLSL: Correct which things flattening tracks for linkage, based on caller, not type.
John Kessenich [Mon, 7 Aug 2017 01:42:42 +0000 (19:42 -0600)]
HLSL: Correct which things flattening tracks for linkage, based on caller, not type.

Includes related trackLinkage() code removal and name improvements.

7 years agoMerge pull request #1010 from LoopDawg/mat-rowcol-fix-1
John Kessenich [Sat, 5 Aug 2017 18:03:05 +0000 (03:03 +0900)]
Merge pull request #1010 from LoopDawg/mat-rowcol-fix-1

HLSL: fix qualifier propagation from user struct types to block defin…

7 years agoHLSL: fix qualifier propagation from user struct types to block definitions.
LoopDawg [Fri, 4 Aug 2017 21:40:53 +0000 (15:40 -0600)]
HLSL: fix qualifier propagation from user struct types to block definitions.

The HLSL FE tracks four versions of a declared type to avoid losing information, since it
is not (at type-decl time) known how the type will be used downstream.  If such a type
was used in a cbuffer declaration, the cbuffer type's members should have been using
the uniform form of the original user structure type, but were not.

This would manifest as matrix qualifiers (and other things, such as pack offsets) on user struct
members going missing in the SPIR-V module if the struct type was a member of a cbuffer, like so:

    struct MyBuffer
    {
        row_major float4x4 mat1;
        column_major float4x4 mat2;
    };

    cbuffer Example
    {
        MyBuffer g_MyBuffer;
    };

Fixes: #789

7 years agoHLSL: Correct use of isPerVertexBuiltIn() to be isClipOrCullDistance().
John Kessenich [Fri, 4 Aug 2017 19:51:54 +0000 (13:51 -0600)]
HLSL: Correct use of isPerVertexBuiltIn() to be isClipOrCullDistance().

This allows removal of isPerVertexBuiltIn(). It also leads to
removal of addInterstageIoToLinkage(), which is no longer needed.

Includes related name improvements.

7 years agoHLSL: Test change: Geometry shaders can't return values from main.
John Kessenich [Fri, 4 Aug 2017 19:41:32 +0000 (13:41 -0600)]
HLSL: Test change: Geometry shaders can't return values from main.

7 years agoHLSL: Flatten more I/O: non-arrayed user-only structures.
John Kessenich [Fri, 4 Aug 2017 18:04:44 +0000 (12:04 -0600)]
HLSL: Flatten more I/O: non-arrayed user-only structures.

The goal is to flatten all I/O, but there are multiple categories and
steps to complete, likely including a final unification of splitting
and flattening.

7 years agoHLSL: Stop including empty structures in the I/O interface. Fix #785.
John Kessenich [Fri, 4 Aug 2017 00:41:48 +0000 (18:41 -0600)]
HLSL: Stop including empty structures in the I/O interface. Fix #785.

7 years agoNon-functional: HLSL: Simplify I/O logic for splitting.
John Kessenich [Wed, 2 Aug 2017 23:08:43 +0000 (17:08 -0600)]
Non-functional: HLSL: Simplify I/O logic for splitting.

7 years agoMerge pull request #1006 from KhronosGroup/4.60
John Kessenich [Tue, 1 Aug 2017 17:11:52 +0000 (02:11 +0900)]
Merge pull request #1006 from KhronosGroup/4.60

GLSL: Add GLSL 4.60 features

7 years agoGLSL 4.6: Implement shader group vote.
John Kessenich [Mon, 24 Jul 2017 05:31:44 +0000 (23:31 -0600)]
GLSL 4.6: Implement shader group vote.

7 years agoGLSL 4.6: Implement draw parameters.
John Kessenich [Mon, 24 Jul 2017 05:11:41 +0000 (23:11 -0600)]
GLSL 4.6: Implement draw parameters.

7 years agoGLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops.
John Kessenich [Sun, 23 Jul 2017 22:08:26 +0000 (16:08 -0600)]
GLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops.

7 years agoGLSL: Initiate version GLSL 460, including accept extraneous semicolons.
John Kessenich [Sun, 23 Jul 2017 20:44:59 +0000 (14:44 -0600)]
GLSL: Initiate version GLSL 460, including accept extraneous semicolons.

7 years agoHLSL Tests: Fix two tests to be valid under FXC.
John Kessenich [Mon, 31 Jul 2017 07:19:26 +0000 (01:19 -0600)]
HLSL Tests: Fix two tests to be valid under FXC.

7 years agoNon-functional: HLSL further simplications to base I/O flattening on.
John Kessenich [Mon, 31 Jul 2017 05:39:48 +0000 (23:39 -0600)]
Non-functional: HLSL further simplications to base I/O flattening on.

7 years agoNon-functional: HLSL: clean up dead code for splitting.
John Kessenich [Sun, 30 Jul 2017 22:54:02 +0000 (16:54 -0600)]
Non-functional: HLSL: clean up dead code for splitting.

Most of this was obsoleted by entry-point wrapping.
Some other is just unnecessary.
Also, includes some spelling/name improvements.

This is to help lay ground work for flattening user I/O.

7 years agoMerge pull request #1005 from LoopDawg/remove-unused
John Kessenich [Sat, 29 Jul 2017 21:23:11 +0000 (06:23 +0900)]
Merge pull request #1005 from LoopDawg/remove-unused

HLSL: Non-functional: warning fix + remove unused member

7 years agoHLSL: Non-functional: warning fix, remove unused member.
LoopDawg [Sat, 29 Jul 2017 00:41:53 +0000 (18:41 -0600)]
HLSL: Non-functional: warning fix, remove unused member.

Two non-functional changes:

1. Remove flattenLevel, which is unneeded since at or around d1be7545c6a23657587dfe3bc4b149c91290a66f.

2. Fix build warining about unused variable in executeInitializer.

7 years agoGLSL reflection: Fix #985: reflect runtime sized arrays having no constant index.
John Kessenich [Fri, 28 Jul 2017 23:33:58 +0000 (17:33 -0600)]
GLSL reflection: Fix #985: reflect runtime sized arrays having no constant index.

7 years agoNonfunctional: Add reflect test case, and fix long lines in reflection code.
John Kessenich [Fri, 28 Jul 2017 23:32:27 +0000 (17:32 -0600)]
Nonfunctional: Add reflect test case, and fix long lines in reflection code.

7 years agoNonfunctional: Shorten some lines to the coding standard, to retrigger failed test...
John Kessenich [Fri, 28 Jul 2017 22:20:13 +0000 (16:20 -0600)]
Nonfunctional: Shorten some lines to the coding standard, to retrigger failed test run.

7 years agoMerge pull request #1002 from amdrexu/bugfix
John Kessenich [Thu, 27 Jul 2017 16:35:42 +0000 (01:35 +0900)]
Merge pull request #1002 from amdrexu/bugfix

SPV: Memory qualifiers should decorate top-level block members

7 years agoSPV: Memory qualifiers should decorate top-level block members
Rex Xu [Thu, 27 Jul 2017 06:33:16 +0000 (14:33 +0800)]
SPV: Memory qualifiers should decorate top-level block members

7 years agoMerge pull request #997 from LoopDawg/clipcull-semantic
John Kessenich [Wed, 26 Jul 2017 23:38:03 +0000 (08:38 +0900)]
Merge pull request #997 from LoopDawg/clipcull-semantic

HLSL: handle multiple clip/cull semantic IDs

7 years agoHLSL: handle multiple clip/cull semantic IDs
LoopDawg [Wed, 5 Jul 2017 17:33:06 +0000 (11:33 -0600)]
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).

7 years agoSPV: Update to latest 1.0 headers, removing redundancies in GLSL.ext.AMD.h.
John Kessenich [Wed, 26 Jul 2017 03:03:29 +0000 (21:03 -0600)]
SPV: Update to latest 1.0 headers, removing redundancies in GLSL.ext.AMD.h.

7 years agoMerge pull request #1000 from LoopDawg/samplecmpzero-cubearray-fix
John Kessenich [Tue, 25 Jul 2017 07:36:17 +0000 (16:36 +0900)]
Merge pull request #1000 from LoopDawg/samplecmpzero-cubearray-fix

Fix dref explicit LOD form of sample with cube texture arrays

7 years agoFix dref explicit LOD form of sample with cube texture arrays
LoopDawg [Tue, 25 Jul 2017 00:45:37 +0000 (18:45 -0600)]
Fix dref explicit LOD form of sample with cube texture arrays

The dref parameter was being used as the LOD.  Now it it's properly the dref.

7 years agoGLSL: Implement version 320 for ES.
John Kessenich [Sun, 23 Jul 2017 19:54:15 +0000 (13:54 -0600)]
GLSL: Implement version 320 for ES.

7 years agoGLSL: Add version-number checking.
John Kessenich [Sun, 23 Jul 2017 17:49:42 +0000 (11:49 -0600)]
GLSL: Add version-number checking.

7 years agoSPV/OpenGL: Require locations on non-opaque uniform variables.
John Kessenich [Fri, 21 Jul 2017 19:36:33 +0000 (13:36 -0600)]
SPV/OpenGL: Require locations on non-opaque uniform variables.

7 years agoMerge pull request #991 from LoopDawg/resource-set-binding-fix
John Kessenich [Fri, 21 Jul 2017 16:59:42 +0000 (01:59 +0900)]
Merge pull request #991 from LoopDawg/resource-set-binding-fix

HLSL: Fix crash with --resource-set-binding [n] (global form, not per-register form)

7 years agoReflection: Fix #977: Expose getBinding(), use in new getUniformBinding().
John Kessenich [Thu, 20 Jul 2017 22:44:17 +0000 (16:44 -0600)]
Reflection: Fix #977: Expose getBinding(), use in new getUniformBinding().

7 years agoFix crash with --resource-set-binding [n] (common set form, not per-register form)
LoopDawg [Fri, 14 Jul 2017 21:15:47 +0000 (15:15 -0600)]
Fix crash with --resource-set-binding [n] (common set form, not per-register form)

--resource-set-binding has a mode which allows per-register assignments of
bindings and descriptor sets on the command line, and another accepting a
single descriptor set value to assign to all variables.

The former worked, but the latter would crash when assigning the values.
This fixes it, and makes the former case a bit more robust against premature
termination of the pre-register values, which must come in (regname,set,binding)
triples.

This also allows the form "--resource-set-binding stage setnum", which was
mentioned in the usage message, but did not parse.

The operation of the per-register form of this option is unchanged.

7 years agoMerge pull request #996 from KhronosGroup/decorate-parameters
John Kessenich [Tue, 18 Jul 2017 09:51:02 +0000 (03:51 -0600)]
Merge pull request #996 from KhronosGroup/decorate-parameters

SPV: Decorate parameters

7 years agoSPV: Fix #995: Include memory decorations on parameters.
John Kessenich [Tue, 18 Jul 2017 08:58:06 +0000 (02:58 -0600)]
SPV: Fix #995: Include memory decorations on parameters.

7 years agoSPV: Non-functional: support lists of decorations per parameter.
John Kessenich [Tue, 18 Jul 2017 08:35:46 +0000 (02:35 -0600)]
SPV: Non-functional: support lists of decorations per parameter.

7 years agoMerge pull request #994 from KhronosGroup/opaque-init
John Kessenich [Sun, 16 Jul 2017 12:01:38 +0000 (06:01 -0600)]
Merge pull request #994 from KhronosGroup/opaque-init

HLSL: Fix #980: flatten opaque initializers to use aliases.

7 years agoFix #980: flatten opaque initializers to use aliases.
John Kessenich [Sun, 16 Jul 2017 11:46:13 +0000 (05:46 -0600)]
Fix #980: flatten opaque initializers to use aliases.

7 years agoMerge pull request #992 from polarina/null-deref-fix
John Kessenich [Sun, 16 Jul 2017 07:16:55 +0000 (01:16 -0600)]
Merge pull request #992 from polarina/null-deref-fix

Fix NULL pointer dereference in TParseContext::builtInOpCheck

7 years agoFix NULL pointer dereference in TParseContext::builtInOpCheck
Gabríel Arthúr Pétursson [Sat, 15 Jul 2017 15:21:12 +0000 (15:21 +0000)]
Fix NULL pointer dereference in TParseContext::builtInOpCheck