platform/upstream/glslang.git
7 years agoHLSL: add standard sample position return form of GetSamplePosition method
steve-lunarg [Wed, 26 Apr 2017 14:31:56 +0000 (08:31 -0600)]
HLSL: add standard sample position return form of GetSamplePosition method

Multisample textures support a GetSamplePosition() method intended to query
positions given a sample index.  This cannot be truly implemented in SPIR-V,
but #753 requested returning standard positions for the 1..16 cases, which
this PR adds.  Anything besides that returns (0,0).  If the standard positions
are not used, this will be wrong.

This should be revisited when there is a real query available.

7 years agoMerge pull request #851 from dgkoch/dgkoch_build_fixes3
John Kessenich [Sat, 22 Apr 2017 15:54:34 +0000 (09:54 -0600)]
Merge pull request #851 from dgkoch/dgkoch_build_fixes3

Fix Android build errors

7 years agoFix Android build errors
Daniel Koch [Fri, 21 Apr 2017 20:16:43 +0000 (16:16 -0400)]
Fix Android build errors

glslang/MachineIndependent/iomapper.cpp:207:9: error: field 'resolver' will be initialized after field 'stage' [-Werror,-Wreorder]
      : resolver(r)
        ^
glslang/MachineIndependent/iomapper.cpp:263:9: error: field 'resolver' will be initialized after field 'stage' [-Werror,-Wreorder]
      : resolver(r)
        ^
hlsl/hlslParseHelper.cpp:70:5: error: field 'gsStreamOutput' will be initialized after field 'inputPatch' [-Werror,-Wreorder]
    gsStreamOutput(nullptr),
    ^

7 years agoMerge pull request #849 from steve-lunarg/samplercmp-errmsg
John Kessenich [Fri, 21 Apr 2017 17:27:24 +0000 (11:27 -0600)]
Merge pull request #849 from steve-lunarg/samplercmp-errmsg

HLSL: add error for expected comparison sampler in SampleCmp* ops

7 years agoHLSL: add error for expected comparison sampler in SampleCmp* ops
steve-lunarg [Fri, 21 Apr 2017 15:54:53 +0000 (09:54 -0600)]
HLSL: add error for expected comparison sampler in SampleCmp* ops

This adds an error message if a non-comparison sampler is used with
comparison sampling methods.  There's no functional change for correct shaders.

7 years agoHLSL: Fix #846: support mixed ternary types.
John Kessenich [Fri, 21 Apr 2017 03:32:16 +0000 (21:32 -0600)]
HLSL: Fix #846: support mixed ternary types.

Vector conditions properly convert the true/false expression types to same
width vector as the condition.

Scalar conditions make the true/false expressions convert to each other.

7 years agoMerge pull request #847 from steve-lunarg/sb-param-fix
John Kessenich [Fri, 21 Apr 2017 02:36:06 +0000 (20:36 -0600)]
Merge pull request #847 from steve-lunarg/sb-param-fix

HLSL: fix for byte address buffers in fn parmeters

7 years agoMerge pull request #842 from steve-lunarg/sb-cast
John Kessenich [Fri, 21 Apr 2017 02:35:09 +0000 (20:35 -0600)]
Merge pull request #842 from steve-lunarg/sb-cast

HLSL: cast non-int types to uint on Load/Store indexes

7 years agoMerge pull request #840 from steve-lunarg/iomap-hlsl
John Kessenich [Fri, 21 Apr 2017 02:34:12 +0000 (20:34 -0600)]
Merge pull request #840 from steve-lunarg/iomap-hlsl

HLSL: hlsl register class iomapping

7 years agoHLSL: fix for byte address buffers in fn parmeters
steve-lunarg [Thu, 20 Apr 2017 22:37:14 +0000 (16:37 -0600)]
HLSL: fix for byte address buffers in fn parmeters

Byte address buffers were failing to detect that they were byte address
buffers when used as fn parameters.

Note: this detection is a little awkward, and could be simplified if
it was easy to obtain the declared builtin type for an object.

7 years agoHLSL: add readonly qualifier to tbuffer, so they end up as SRV
steve-lunarg [Thu, 20 Apr 2017 19:16:23 +0000 (13:16 -0600)]
HLSL: add readonly qualifier to tbuffer, so they end up as SRV

7 years agoWIP: HLSL: hlsl register class iomapping
steve-lunarg [Tue, 18 Apr 2017 18:18:01 +0000 (12:18 -0600)]
WIP: HLSL: hlsl register class iomapping

Adds --hlsl-iomap option to perform IO mapping in HLSL register space.

--shift-cbuffer-binding is now a synonym for --shift-ubo-binding.

The idea way to do this seems to be passing in a dedicated IO resolver, but
that would require more intrusive restructuring, so maybe best for its
own PR.

The TDefaultHlslIoResolver class and the former TDefaultIoResolver class
share quite a bit of mechanism in a common base class.

TODO: tbuffers are landing in the wrong register class, which needs some
investigation.  They're either wrong upstream, or the detection in the
resolver is wrong.

7 years agoGLSL: Fix #822: Improve information given for syntax errors.
John Kessenich [Thu, 20 Apr 2017 18:21:53 +0000 (12:21 -0600)]
GLSL: Fix #822: Improve information given for syntax errors.

Also, fixed one test file that didn't have its syntax error as the last line.

7 years agoHLSL: Fix #96: Support do-while loop substatements with no curly braces.
John Kessenich [Thu, 20 Apr 2017 17:08:24 +0000 (11:08 -0600)]
HLSL: Fix #96: Support do-while loop substatements with no curly braces.

7 years agoHLSL: cast non-int types to uint on Load/Store indexes
steve-lunarg [Thu, 20 Apr 2017 15:00:56 +0000 (09:00 -0600)]
HLSL: cast non-int types to uint on Load/Store indexes

Some texture and SB operations can take non-integer indexes, which should be
cast to integers before use if they are not already.  This adds makeIntegerIndex()
for the purpose.  Int types are left alone.

(This was done before for operator[], but needs to apply to some other things
too, hence its extraction into common function now)

7 years agoSPV: Support test #pragma for generating the StorageBuffer storage class.
John Kessenich [Thu, 20 Apr 2017 00:34:49 +0000 (18:34 -0600)]
SPV: Support test #pragma for generating the StorageBuffer storage class.

Longer term, this storage class should be generated based on the mode
of compilation.

7 years agoMerge pull request #835 from steve-lunarg/sb-counters
John Kessenich [Wed, 19 Apr 2017 23:42:22 +0000 (17:42 -0600)]
Merge pull request #835 from steve-lunarg/sb-counters

HLSL: structuredbuffer counter functionality

7 years agoHLSL: vector shape conversions for all ops: Fix #839. Fix #653. Fix #631.
John Kessenich [Wed, 19 Apr 2017 03:07:05 +0000 (21:07 -0600)]
HLSL: vector shape conversions for all ops: Fix #839. Fix #653. Fix #631.

7 years agoHLSL: Address #839: avoid crash by distinguishing between bad argument and no argument.
John Kessenich [Tue, 18 Apr 2017 20:47:33 +0000 (14:47 -0600)]
HLSL: Address #839: avoid crash by distinguishing between bad argument and no argument.

7 years agoWIP: HLSL: add refection queries for structuredbuffer counter blocks
steve-lunarg [Sat, 15 Apr 2017 14:18:16 +0000 (08:18 -0600)]
WIP: HLSL: add refection queries for structuredbuffer counter blocks

This adds TProgram::getUniformBlockCounterIndex(int index), which returns the
index the block of the counter buffer associated with the block of the passed in
index, if any, or -1 if none.

7 years agoWIP: HLSL: add Append/ConsumeBuffer support
steve-lunarg [Fri, 14 Apr 2017 00:42:58 +0000 (18:42 -0600)]
WIP: HLSL: add Append/ConsumeBuffer support

7 years agoWIP: HLSL: structuredbuffer counter functionality
steve-lunarg [Mon, 10 Apr 2017 14:19:21 +0000 (08:19 -0600)]
WIP: HLSL: structuredbuffer counter functionality

This is WIP, heavy on the IP part.  There's not yet enough to use in real workloads.

Currently present:

* Creation of separate counter buffers for structured buffer types needing them.
* IncrementCounter / DecrementCounter methods
* Postprocess to remove unused counter buffers from linkage
* Associated counter buffers are given @count suffix (invalid as a user identifier)

Not yet present:

* reflection queries to obtain bindings for counter buffers
* Append/Consume buffers
* Ability to use SB references passed as fn parameters

7 years agoSPV Non-functional: fix ordering causing problems with another branch.
John Kessenich [Thu, 13 Apr 2017 23:08:11 +0000 (17:08 -0600)]
SPV Non-functional: fix ordering causing problems with another branch.

7 years agoHLSL: Fix #770: implicitly convert bool operands to numeric operators.
John Kessenich [Thu, 13 Apr 2017 04:37:32 +0000 (22:37 -0600)]
HLSL: Fix #770: implicitly convert bool operands to numeric operators.

7 years agoHLSL: Fix #834: Report #version is an illegal command.
John Kessenich [Wed, 12 Apr 2017 23:24:34 +0000 (17:24 -0600)]
HLSL: Fix #834: Report #version is an illegal command.

7 years agoHLSL: Fix #758: Support character literals (except for numeric escape sequences).
John Kessenich [Wed, 12 Apr 2017 22:31:15 +0000 (16:31 -0600)]
HLSL: Fix #758: Support character literals (except for numeric escape sequences).

7 years agoHLSL: Fix #803: Add shape conversions to the constant-initializer path.
John Kessenich [Wed, 12 Apr 2017 20:56:52 +0000 (14:56 -0600)]
HLSL: Fix #803: Add shape conversions to the constant-initializer path.

7 years agoMerge pull request #833 from KhronosGroup/hlsl-inf-syntax
John Kessenich [Wed, 12 Apr 2017 20:20:31 +0000 (14:20 -0600)]
Merge pull request #833 from KhronosGroup/hlsl-inf-syntax

HLSL: Fix #672: Support 1.#INF and -1.#INF syntax.

7 years agoHLSL: Support 1.#INF and -1.#INF syntax.
John Kessenich [Wed, 12 Apr 2017 19:26:57 +0000 (13:26 -0600)]
HLSL: Support 1.#INF and -1.#INF syntax.

7 years agoHLSL: Fix boolean conversion bug and add more tests for ?:.
John Kessenich [Wed, 12 Apr 2017 02:17:23 +0000 (20:17 -0600)]
HLSL: Fix boolean conversion bug and add more tests for ?:.

Null-conversion needs the right sized vectors to kick out with matching types.

7 years agoHLSL: Support vector 'cond ? :' -> EOpMix -> OpSelect.
John Kessenich [Wed, 12 Apr 2017 01:45:00 +0000 (19:45 -0600)]
HLSL: Support vector 'cond ? :' -> EOpMix -> OpSelect.

7 years agoHLSL: Non-functional: add vector ? : tests.
John Kessenich [Tue, 11 Apr 2017 23:30:08 +0000 (17:30 -0600)]
HLSL: Non-functional: add vector ? : tests.

7 years agoHLSL: Fix #832: don't require terminating semicolon for cbuffer/tbuffer.
John Kessenich [Tue, 11 Apr 2017 15:51:32 +0000 (09:51 -0600)]
HLSL: Fix #832: don't require terminating semicolon for cbuffer/tbuffer.

7 years agoMerge pull request #831 from steve-lunarg/isfinite
John Kessenich [Mon, 10 Apr 2017 17:59:52 +0000 (11:59 -0600)]
Merge pull request #831 from steve-lunarg/isfinite

HLSL: fix return type for isfinite

7 years agoHLSL: fix return type for isfinite
steve-lunarg [Mon, 10 Apr 2017 14:27:34 +0000 (08:27 -0600)]
HLSL: fix return type for isfinite

The prior decomposition of isfinite was not setting the return type on the
sequence node.  (Sequence was used because there's an internal temporary
to avoid the complex rvalue problem).

7 years agoMerge pull request #827 from amdrexu/feature4
John Kessenich [Sat, 8 Apr 2017 16:03:45 +0000 (10:03 -0600)]
Merge pull request #827 from amdrexu/feature4

Implement the extension SPV_KHR_16bit_storage

7 years agoNon-functional: Fix typos in comments.
John Kessenich [Fri, 7 Apr 2017 21:40:30 +0000 (15:40 -0600)]
Non-functional: Fix typos in comments.

7 years agoHLSL: Emit the OpSource HLSL instruction for HLSL, using new headers.
John Kessenich [Fri, 7 Apr 2017 21:33:08 +0000 (15:33 -0600)]
HLSL: Emit the OpSource HLSL instruction for HLSL, using new headers.

7 years agoMerge pull request #825 from steve-lunarg/index-cast
John Kessenich [Fri, 7 Apr 2017 16:16:54 +0000 (10:16 -0600)]
Merge pull request #825 from steve-lunarg/index-cast

HLSL: cast bracket dereference index to int type if not.

7 years agoImplement the extension SPV_KHR_16bit_storage
Rex Xu [Fri, 7 Apr 2017 15:22:33 +0000 (23:22 +0800)]
Implement the extension SPV_KHR_16bit_storage

7 years agoHLSL: cast bracket dereference index to int type if not.
steve-lunarg [Fri, 7 Apr 2017 02:22:20 +0000 (20:22 -0600)]
HLSL: cast bracket dereference index to int type if not.

HLSL can index arrays using operator[] with non-integer types, and
inserts a conversion to a uint if needed.

7 years agoSPV: Move to latest public headers.
John Kessenich [Thu, 6 Apr 2017 23:21:58 +0000 (17:21 -0600)]
SPV: Move to latest public headers.

7 years agoMerge pull request #823 from steve-lunarg/tess-coord-size
John Kessenich [Thu, 6 Apr 2017 00:11:31 +0000 (18:11 -0600)]
Merge pull request #823 from steve-lunarg/tess-coord-size

HLSL: allow non-vec3 tessellation coordinate declarations

7 years agoSPV: Fix #807: use --hlsl-offsets to allow hlsl-style offsets in a buffer.
John Kessenich [Wed, 5 Apr 2017 23:38:20 +0000 (17:38 -0600)]
SPV: Fix #807: use --hlsl-offsets to allow hlsl-style offsets in a buffer.

Corresponds to the EShMsgHlslOffsets flag in messages.
Works for both GLSL and HLSL.

7 years agoHLSL: allow non-vec3 tessellation coordinate declarations
steve-lunarg [Wed, 5 Apr 2017 17:03:02 +0000 (11:03 -0600)]
HLSL: allow non-vec3 tessellation coordinate declarations

HLSL requires vec2 tessellation coordinate declarations in some cases
(e.g, isoline topology), where SPIR-V requires the TessCoord qualified
builtin to be a vec3 in all cases.  This alters the IO form of the
variable to be a vec3, which will be copied to the shader's declared
type if needed.  This is not a validation; the shader type must be correct.

7 years agoMerge branch 'jantlo-cpp11-feat'
John Kessenich [Tue, 4 Apr 2017 21:37:45 +0000 (15:37 -0600)]
Merge branch 'jantlo-cpp11-feat'

7 years agoMerge branch 'cpp11-feat' of https://github.com/jantlo/glslang into jantlo-cpp11...
John Kessenich [Tue, 4 Apr 2017 21:37:18 +0000 (15:37 -0600)]
Merge branch 'cpp11-feat' of https://github.com/jantlo/glslang into jantlo-cpp11-feat

7 years agoThis refactor the StandAlone and WorkList files in order to use more
Juan Lopez [Sun, 2 Apr 2017 21:04:00 +0000 (23:04 +0200)]
This refactor the StandAlone and WorkList files in order to use more
C++11 features remove the dependencies from OS specific code. Changes:

- Making WorkList class to have its own mutex instead of the OS specific
global one. The new mutex is the one from std library. The OS specific
code is also removed.

- Using the C++11 std library to handle threads in StandAlone
application
and enabling concurrent processing on non-windows platforms.

- converting the global variable Worklist into local variable workList.

7 years agoPP: Fix #783: Catch end-of-argument expansion in token pasting.
John Kessenich [Tue, 4 Apr 2017 18:28:20 +0000 (12:28 -0600)]
PP: Fix #783: Catch end-of-argument expansion in token pasting.

7 years agoHLSL: Fix #805: Support cast of scalars to structures.
John Kessenich [Tue, 4 Apr 2017 17:47:42 +0000 (11:47 -0600)]
HLSL: Fix #805: Support cast of scalars to structures.

Somewhat complex due to recognizing a general scalar, but not
replicating it for each member to avoid side effects.

7 years agoMerge pull request #817 from steve-lunarg/isfinite
John Kessenich [Tue, 4 Apr 2017 04:32:35 +0000 (22:32 -0600)]
Merge pull request #817 from steve-lunarg/isfinite

HLSL: Decompose OpIsFinite to avoid capability restrictions

7 years agoHLSL: Non-functional: rationalize making constructors.
John Kessenich [Tue, 4 Apr 2017 03:48:37 +0000 (21:48 -0600)]
HLSL: Non-functional: rationalize making constructors.

Improves foundation for adding scalar casts.

Makes handle/make names more sane, better commented, uses more
precise subclass typing, and removes mutual recursion between
converting initializer lists and making constructors.

7 years agoMerge pull request #812 from steve-lunarg/PatchIO
John Kessenich [Tue, 4 Apr 2017 04:02:30 +0000 (22:02 -0600)]
Merge pull request #812 from steve-lunarg/PatchIO

HLSL: Support InputPatch variables in patch constant functions

7 years agoDecompose OpIsFinite to avoid capability restrictions
steve-lunarg [Tue, 4 Apr 2017 02:05:21 +0000 (20:05 -0600)]
Decompose OpIsFinite to avoid capability restrictions

OpIsFinite is not available everywhere: decompose isfinite
to !isinf && !isnan.

7 years agoWIP: HLSL: Support InputPatch variables in patch constant functions
steve-lunarg [Sat, 1 Apr 2017 21:34:48 +0000 (15:34 -0600)]
WIP: HLSL: Support InputPatch variables in patch constant functions

Previously, patch constant functions only accepted OutputPatch.  This
adds InputPatch support, via a pseudo-builtin variable type, so that
the patch can be tracked clear through from the qualifier.

7 years agoMerge pull request #808 from steve-lunarg/gs-ep-wrap-fix
John Kessenich [Mon, 3 Apr 2017 22:58:14 +0000 (16:58 -0600)]
Merge pull request #808 from steve-lunarg/gs-ep-wrap-fix

HLSL: fix GS to work with EP wrapping

7 years agoHLSL: fix GS implementation for EP wrapping
steve-lunarg [Thu, 30 Mar 2017 02:01:13 +0000 (20:01 -0600)]
HLSL: fix GS implementation for EP wrapping

The prior implementation of GS did not work with the new EP wrapping architecture.
This fixes it: the Append() method now looks up the actual output rather
than the internal sanitized temporary type, and writes to that.

7 years agoFix #287: pin down the io-array size before checking for out of range index.
John Kessenich [Mon, 3 Apr 2017 20:29:20 +0000 (14:29 -0600)]
Fix #287: pin down the io-array size before checking for out of range index.

7 years agoMerge pull request #815 from steve-lunarg/tess-ds-pcf-order
John Kessenich [Mon, 3 Apr 2017 19:20:08 +0000 (13:20 -0600)]
Merge pull request #815 from steve-lunarg/tess-ds-pcf-order

HLSL: handle PCF input to DS in arbitrary argument position

7 years agoHLSL: handle PCF input to DS in arbitrary argument position
steve-lunarg [Mon, 3 Apr 2017 15:27:53 +0000 (09:27 -0600)]
HLSL: handle PCF input to DS in arbitrary argument position

In the hull shader, the PCF output does not participate in an argument list,
so has no defined ordering.  It is always put at the end of the linkage.  That
means the DS input reading PCF data must be be at the end of the DS linkage
as well, no matter where it may appear in the argument list.  This change
makes sure that happens.

The detection is by looking for arguments that contain tessellation factor
builtins, even as a struct member.  The whole struct is taken as the PCF output
if any members are so qualified.

7 years agoMerge pull request #814 from steve-lunarg/contains
John Kessenich [Mon, 3 Apr 2017 16:07:47 +0000 (10:07 -0600)]
Merge pull request #814 from steve-lunarg/contains

Refactor TType::contains* methods (nonfunctional)

7 years agoRefactor TType::contains* methods (nonfunctional)
steve-lunarg [Sun, 2 Apr 2017 23:27:39 +0000 (17:27 -0600)]
Refactor TType::contains* methods (nonfunctional)

There were many (~8) different places in TType which all knew how to traverse
the struct/type hierarchy.  There's a need to add another, but I didn't
want to duplicate the traversal code again.  This is a small refactoring
which passes a predicate to a single traverse-and-test method.  That also
shortens all the containsSomething() methods from 9 lines of body to 1.

There are no test differences: it's nonfunctional.

7 years agoMerge pull request #811 from steve-lunarg/combine-test
John Kessenich [Sat, 1 Apr 2017 17:07:31 +0000 (11:07 -0600)]
Merge pull request #811 from steve-lunarg/combine-test

HLSL: set combined flag false for Buffer<>

7 years agoWIP: HLSL: force uncombined flag off for Buffer<>
steve-lunarg [Fri, 31 Mar 2017 23:40:09 +0000 (17:40 -0600)]
WIP: HLSL: force uncombined flag off for Buffer<>

7 years agoRevert "Merge pull request #779 from steve-lunarg/buffer-unsampled-fix"
John Kessenich [Fri, 31 Mar 2017 20:39:30 +0000 (14:39 -0600)]
Revert "Merge pull request #779 from steve-lunarg/buffer-unsampled-fix"

This reverts commit 1dd65ca3983d3c361e66fbf788f050177f596d3a, reversing
changes made to 4960baaf663b18a6e0a58edb9073158ef7331930.

7 years agoMerge pull request #774 from steve-lunarg/tess-ctrlpt-pcf
John Kessenich [Fri, 31 Mar 2017 19:37:52 +0000 (13:37 -0600)]
Merge pull request #774 from steve-lunarg/tess-ctrlpt-pcf

HLSL: support per control point patch const fn invocation

7 years agoMerge pull request #810 from steve-lunarg/clip-crash-fix
John Kessenich [Fri, 31 Mar 2017 19:34:55 +0000 (13:34 -0600)]
Merge pull request #810 from steve-lunarg/clip-crash-fix

HLSL: Fix #804: crash on empty sequence node passed to intrinsic expansions

7 years agoHLSL: fix crash on empty sequence node passed to intrinsic expansions
steve-lunarg [Fri, 31 Mar 2017 18:47:34 +0000 (12:47 -0600)]
HLSL: fix crash on empty sequence node passed to intrinsic expansions

7 years agoHLSL: pass tessellation execution modes through to SPIR-V
steve-lunarg [Thu, 23 Mar 2017 17:56:07 +0000 (11:56 -0600)]
HLSL: pass tessellation execution modes through to SPIR-V

The SPIR-V generator had assumed tessellation modes such as
primitive type and vertex order would only appear in tess eval
(domain) shaders.  SPIR-V allows either, and HLSL allows and
possibly requires them to be in the hull shader.

This change:

1. Passes them through for either tessellation stage, and,

2. Does not set up defaults in the domain stage for HLSl compilation,
to avoid conflicting definitions.

7 years agoMerge pull request #797 from steve-lunarg/scalar-length
John Kessenich [Fri, 31 Mar 2017 15:26:47 +0000 (09:26 -0600)]
Merge pull request #797 from steve-lunarg/scalar-length

HLSL: allow length() on scalars

7 years agoHLSL: Fix #802: Preserve promoted child under ! operator.
John Kessenich [Fri, 31 Mar 2017 05:32:21 +0000 (23:32 -0600)]
HLSL: Fix #802: Preserve promoted child under ! operator.

7 years agoHLSL: Implicit bool conversions for conditional expressions and related.
John Kessenich [Fri, 31 Mar 2017 04:09:30 +0000 (22:09 -0600)]
HLSL: Implicit bool conversions for conditional expressions and related.

Covers if(cond), while(cond), do-while(cond), for(;cond;), and (cond ? :).
Fixes #778.

7 years agoHLSL: Add namespace grammar and some basic semantics.
John Kessenich [Thu, 30 Mar 2017 22:22:26 +0000 (16:22 -0600)]
HLSL: Add namespace grammar and some basic semantics.

Unknown how extensive the semantics need to be yet. Need real
feedback from workloads. This is just done as part of unifying it
with the class/struct namespaces and grammar productions.

7 years agoHLSL: HS return is arrayed to match SPIR-V semantics
steve-lunarg [Thu, 23 Mar 2017 00:39:25 +0000 (18:39 -0600)]
HLSL: HS return is arrayed to match SPIR-V semantics

HLSL HS outputs a per ctrl point value, and the DS reads an array
of that type.  (It also has a per patch frequency).  The per-ctrl-pt
frequency is arrayed on just one side, as opposed to SPIR-V which
is arrayed on both.  To match semantics, the compiler creates an
array behind the scenes and indexes it by invocation ID, assigning
the HS return value to it.

7 years agoHLSL: strip off array dimension when assign locations of arrayed IO.
steve-lunarg [Sun, 19 Mar 2017 04:24:14 +0000 (22:24 -0600)]
HLSL: strip off array dimension when assign locations of arrayed IO.

7 years agoHLSL: require tessellation factors to be fixed size arrays
steve-lunarg [Sat, 18 Mar 2017 00:51:05 +0000 (18:51 -0600)]
HLSL: require tessellation factors to be fixed size arrays

SPIR-V requires that tessellation factor arrays be size 4 (outer) or 2 (inner).
HLSL allows other sizes such as 3, or even scalars.  This commit converts
between them by forcing the IO types to be the SPIR-V size, and allowing
copies between the internal and IO types to handle these cases.

7 years agoHLSL: support per control point patch const fn invocation
steve-lunarg [Tue, 14 Mar 2017 23:37:10 +0000 (17:37 -0600)]
HLSL: support per control point patch const fn invocation

This PR emulates per control point inputs to patch constant functions.
Without either an extension to look across SIMD lanes or a dedicated
stage, the emulation must use separate invocations of the wrapped
entry point to obtain the per control point values.  This is provided
since shaders are wanting this functionality now, but such an extension
is not yet available.

Entry point arguments qualified as an invocation ID are replaced by the
current control point number when calling the wrapped entry point.  There
is no particular optimization for the case of the entry point not having
such an input but the PCF still accepting ctrl pt frequency data.  It'll
work, but anyway makes no so much sense.

The wrapped entry point must return the per control point data by value.
At this time it is not supported as an output parameter.

7 years agoFix #809: smear scalar condition in OpSelect for selecting vector operands.
John Kessenich [Thu, 30 Mar 2017 16:09:28 +0000 (10:09 -0600)]
Fix #809: smear scalar condition in OpSelect for selecting vector operands.

7 years agoNon-functional: Round of adding 'const', related to more efficient getFullNamespaceNa...
John Kessenich [Wed, 29 Mar 2017 05:43:10 +0000 (23:43 -0600)]
Non-functional: Round of adding 'const', related to more efficient getFullNamespaceName().

7 years agoMerge pull request #801 from amdrexu/bugfix
John Kessenich [Wed, 29 Mar 2017 16:04:30 +0000 (10:04 -0600)]
Merge pull request #801 from amdrexu/bugfix

HLSL: Fix an issue of frexp().

7 years agoMerge pull request #806 from amdrexu/bugfix2
John Kessenich [Wed, 29 Mar 2017 15:59:28 +0000 (09:59 -0600)]
Merge pull request #806 from amdrexu/bugfix2

Don't emit NV-specific interface members if NV extensions are disabled.

7 years agoDon't emit NV-specific interface members if NV extensions are disabled.
Rex Xu [Wed, 29 Mar 2017 15:01:36 +0000 (23:01 +0800)]
Don't emit NV-specific interface members if NV extensions are disabled.

7 years agoHLSL: Fix an issue of frexp().
Rex Xu [Wed, 29 Mar 2017 09:12:40 +0000 (17:12 +0800)]
HLSL: Fix an issue of frexp().

The "exp" parameter is floating-point type in HLSL intrinsic while it is
integer type in GLSL built-in function.

7 years agoHLSL: Move frexp() to a separate test file.
Rex Xu [Wed, 29 Mar 2017 09:04:58 +0000 (17:04 +0800)]
HLSL: Move frexp() to a separate test file.

7 years agoFix #800 (mostly): set of Linux warnings.
John Kessenich [Tue, 28 Mar 2017 15:52:38 +0000 (09:52 -0600)]
Fix #800 (mostly): set of Linux warnings.

7 years agoTests: strengthen the value of test for NV members.
John Kessenich [Sat, 25 Mar 2017 00:57:50 +0000 (18:57 -0600)]
Tests: strengthen the value of test for NV members.

7 years agoFix #790: Don't emit NV-specific interface members unless enabled by extension.
John Kessenich [Sat, 25 Mar 2017 00:38:16 +0000 (18:38 -0600)]
Fix #790: Don't emit NV-specific interface members unless enabled by extension.

7 years agoHLSL: allow length() on scalars
steve-lunarg [Fri, 24 Mar 2017 16:12:53 +0000 (10:12 -0600)]
HLSL: allow length() on scalars

7 years agoMerge pull request #796 from steve-lunarg/emptystruct-return-fix
John Kessenich [Fri, 24 Mar 2017 15:11:00 +0000 (09:11 -0600)]
Merge pull request #796 from steve-lunarg/emptystruct-return-fix

HLSL: fix crash on empty struct return from entry point

7 years agoHLSL: fix crash on empty struct return from entry point
steve-lunarg [Fri, 24 Mar 2017 14:56:37 +0000 (08:56 -0600)]
HLSL: fix crash on empty struct return from entry point

7 years agoTests: Update test results.
John Kessenich [Thu, 23 Mar 2017 20:52:38 +0000 (14:52 -0600)]
Tests: Update test results.

7 years agoHLSL: Allow use of $Global members in between function calls.
John Kessenich [Thu, 23 Mar 2017 05:21:34 +0000 (23:21 -0600)]
HLSL: Allow use of $Global members in between function calls.

This allows global initializers to use $Global members.

7 years agoHLSL: Implement 'this' keyword.
John Kessenich [Wed, 22 Mar 2017 17:38:22 +0000 (11:38 -0600)]
HLSL: Implement 'this' keyword.

7 years agoHLSL: non-static member functions: track and find active anonymous 'this' scopes...
John Kessenich [Wed, 22 Mar 2017 05:56:40 +0000 (23:56 -0600)]
HLSL: non-static member functions: track and find active anonymous 'this' scopes and members.

Thanks to @steve-lunarg for his input and discussions on handling member functions.

7 years agoHLSL: Non-functional: the symbol field of a token was in practice unused; remove it.
John Kessenich [Wed, 22 Mar 2017 00:35:04 +0000 (18:35 -0600)]
HLSL: Non-functional: the symbol field of a token was in practice unused; remove it.

Another precurser to getting member non-static functions working.

7 years agoMerge pull request #782 from steve-lunarg/builtin-methods-prefix
John Kessenich [Mon, 20 Mar 2017 05:49:55 +0000 (23:49 -0600)]
Merge pull request #782 from steve-lunarg/builtin-methods-prefix

HLSL: use prefix for builtin functions names to avoid namespace colliā€¦

7 years agoMerge pull request #779 from steve-lunarg/buffer-unsampled-fix
John Kessenich [Mon, 20 Mar 2017 05:46:03 +0000 (23:46 -0600)]
Merge pull request #779 from steve-lunarg/buffer-unsampled-fix

HLSL: Buffer types should be unsampled.

7 years agoHLSL: use prefix for builtin functions names to avoid namespace collisions
steve-lunarg [Mon, 20 Mar 2017 00:12:37 +0000 (18:12 -0600)]
HLSL: use prefix for builtin functions names to avoid namespace collisions

It would have been possible for globally scoped user functions to collide
with builtin method names.  This adds a prefix to avoid polluting the
namespace.

Ideally this would be an invalid character to use in user identifiers, but
as that requires changing the scanner, for the moment it's an unlikely yet
valid prefix.

7 years agoHLSL: Basic turn on of non-static member functions.
John Kessenich [Mon, 20 Mar 2017 00:09:59 +0000 (18:09 -0600)]
HLSL: Basic turn on of non-static member functions.

Still need: pass by reference in SPIR-V and symbol-table level
for accessing 'this' members from member functions.

7 years agoHLSL: Add implicit-this tracking to TFunction.
John Kessenich [Sun, 19 Mar 2017 19:10:28 +0000 (13:10 -0600)]
HLSL: Add implicit-this tracking to TFunction.