platform/upstream/glslang.git
7 years agoHLSL: allow "sample" as a valid identifier.
steve-lunarg [Wed, 16 Nov 2016 20:22:11 +0000 (13:22 -0700)]
HLSL: allow "sample" as a valid identifier.

HLSL has keywords for various interpolation modifiers such as "linear",
"centroid", "sample", etc.  Of these, "sample" appears to be special,
as it is also accepted as an identifier string, where the others are not.

This PR adds this ability, so the construct "int sample = 42;" no longer
produces a compilation error.

New test = hlsl.identifier.sample.frag

7 years agoTest results: Fix incorrect test result caused by parallel development. Issue #594.
John Kessenich [Tue, 15 Nov 2016 04:22:05 +0000 (21:22 -0700)]
Test results: Fix incorrect test result caused by parallel development. Issue #594.

7 years agoMerge pull request #576 from steve-lunarg/uav-registers
John Kessenich [Mon, 14 Nov 2016 16:39:46 +0000 (09:39 -0700)]
Merge pull request #576 from steve-lunarg/uav-registers

Add UAV (image) binding offset and HLSL register class support

7 years agoMerge pull request #592 from ChrisGautier/barrier-wg
John Kessenich [Mon, 14 Nov 2016 16:37:34 +0000 (09:37 -0700)]
Merge pull request #592 from ChrisGautier/barrier-wg

SPV: The execution scope for barriers should be Workgroup.

7 years agoGLSL: The execution scope for barriers should be Workgroup.
chrgau01@arm.com [Mon, 14 Nov 2016 09:10:05 +0000 (10:10 +0100)]
GLSL: The execution scope for barriers should be Workgroup.

7 years agoMerge pull request #583 from null77/fix-unref-warning
John Kessenich [Mon, 14 Nov 2016 05:04:04 +0000 (22:04 -0700)]
Merge pull request #583 from null77/fix-unref-warning

SPV: Fix unreferenced variable warning with AMD_EXTENSIONS disabled.

7 years agoMerge pull request #589 from steve-lunarg/vec1-promotion-fix
John Kessenich [Mon, 14 Nov 2016 05:01:54 +0000 (22:01 -0700)]
Merge pull request #589 from steve-lunarg/vec1-promotion-fix

HLSL: allow promotion from 1-vector types to scalars, e.g, float<-float1

7 years agoHLSL: allow promotion from 1-vector types to scalars, e.g, float<-float1
steve-lunarg [Fri, 11 Nov 2016 22:37:10 +0000 (15:37 -0700)]
HLSL: allow promotion from 1-vector types to scalars, e.g, float<-float1

Previously, an error was thrown when assigning a float1 to a scalar float,
or similar for other basic types.  This allows that.

Also, this allows calling functions accepting scalars with float1 params,
so for example sin(float1) will work.  This is a minor change in
HlslParseContext::findFunction().

7 years agoMerge pull request #584 from steve-lunarg/attribute-expressions
John Kessenich [Fri, 11 Nov 2016 18:27:12 +0000 (11:27 -0700)]
Merge pull request #584 from steve-lunarg/attribute-expressions

HLSL: Allow expressions in attributes

7 years agoHLSL: Allow expressions in attributes
steve-lunarg [Fri, 11 Nov 2016 15:17:44 +0000 (08:17 -0700)]
HLSL: Allow expressions in attributes

For example:

[numthreads(2+2, 2*3, (1+FOO)*BAR)]

This will result in a thread count (4, 6, 8).

7 years agoFix unrefenced variable warning with AMD_EXTENSIONS disabled.
Jamie Madill [Wed, 9 Nov 2016 18:49:24 +0000 (13:49 -0500)]
Fix unrefenced variable warning with AMD_EXTENSIONS disabled.

7 years agoWhole stack: Fix stale types in the AST linker object nodes, fixing #557.
John Kessenich [Sat, 5 Nov 2016 16:15:53 +0000 (10:15 -0600)]
Whole stack: Fix stale types in the AST linker object nodes, fixing #557.

Rationalizes the entire tracking of the linker object nodes, effecting
GLSL, HLSL, and SPIR-V, to allow tracked objects to be fully edited before
their type snapshot for linker objects.

Should only effect things when the rest of the AST contained no reference to
the symbol, because normal AST nodes were not stale. Also will only effect such
objects when their types were edited.

7 years agoAdd UAV (image) binding offset and HLSL register support
steve-lunarg [Tue, 1 Nov 2016 16:31:42 +0000 (10:31 -0600)]
Add UAV (image) binding offset and HLSL register support

This PR adds:

1. The "u" register class for RW* objects.

2. --shift-image-bindings (== --sib), analogous to --shift-texture-bindings etc.

3. Case insensitive reg classes.

4. Tests for above.

7 years agoMerge pull request #575 from steve-lunarg/iomap-warning-fix
John Kessenich [Tue, 1 Nov 2016 15:49:49 +0000 (09:49 -0600)]
Merge pull request #575 from steve-lunarg/iomap-warning-fix

Fix build warnings in iomapper.cpp, re-indent to glslang standard

7 years agoFix build warnings in remapper, re-indent for glslang standard
steve-lunarg [Tue, 1 Nov 2016 14:51:46 +0000 (08:51 -0600)]
Fix build warnings in remapper, re-indent for glslang standard

This has no functional changes.

7 years agoMerge pull request #572 from steve-lunarg/numthreads
John Kessenich [Tue, 1 Nov 2016 06:25:06 +0000 (00:25 -0600)]
Merge pull request #572 from steve-lunarg/numthreads

HLSL: implement numthreads for compute shaders

7 years agoMerge pull request #562 from TiemoJung/io_map_control_publish
John Kessenich [Tue, 1 Nov 2016 06:24:01 +0000 (00:24 -0600)]
Merge pull request #562 from TiemoJung/io_map_control_publish

HLSL -> Spir-V: Resource mapping handler

7 years agoMerge pull request #570 from steve-lunarg/mintypes
John Kessenich [Tue, 1 Nov 2016 06:23:29 +0000 (00:23 -0600)]
Merge pull request #570 from steve-lunarg/mintypes

HLSL: Add min*{float,int,uint} types

7 years agoMerge pull request #574 from dneto0/android-has-no-std-stoi
John Kessenich [Tue, 1 Nov 2016 06:08:40 +0000 (00:08 -0600)]
Merge pull request #574 from dneto0/android-has-no-std-stoi

Use std::atoi instead of std::stoi

7 years agoUse std::atoi instead of std::stoi
David Neto [Mon, 31 Oct 2016 21:02:45 +0000 (17:02 -0400)]
Use std::atoi instead of std::stoi

Some Android cross cross-compilers don't have std::stoi.

E.g. i686-linux-android-g++ from Android NDK r10e don't have std::stoi.

7 years agoHLSL: Add min*{float,int,uint} types
steve-lunarg [Thu, 27 Oct 2016 01:18:55 +0000 (19:18 -0600)]
HLSL: Add min*{float,int,uint} types

These HLSL types are guaranteed to have at least the given number of bits, but may have more.

min{16,10}float is mapped to EbtFloat at medium precision -> SPIRV RelaxedPrecision
min{16,12}int and min16uint are mapped to mediump -> SPIR-V RelaxedPrecision

7 years agoHLSL: implement numthreads for compute shaders
steve-lunarg [Thu, 20 Oct 2016 19:07:10 +0000 (13:07 -0600)]
HLSL: implement numthreads for compute shaders

This PR adds handling of the numthreads attribute for compute shaders, as well as a general
infrastructure for returning attribute values from acceptAttributes, which may be needed in other
cases, e.g, unroll(x), or merely to know if some attribute without params was given.

A map of enum values from TAttributeType to TIntermAggregate nodes is built and returned.  It
can be queried with operator[] on the map.  In the future there may be a need to also handle
strings (e.g, for patchconstantfunc), and those can be easily added into the class if needed.

New test is in hlsl.numthreads.comp.

7 years agoMerge pull request #571 from baldurk/explicit-lambda-returns
John Kessenich [Sat, 29 Oct 2016 01:16:13 +0000 (19:16 -0600)]
Merge pull request #571 from baldurk/explicit-lambda-returns

Add explicit lambda return types, for compilers without C++14 support

7 years agoAdd explicit lambda return types, for compilers without C++14 support
baldurk [Fri, 28 Oct 2016 15:57:25 +0000 (17:57 +0200)]
Add explicit lambda return types, for compilers without C++14 support

7 years agoNew uniform mapping handling
t.jung [Thu, 27 Oct 2016 13:45:02 +0000 (15:45 +0200)]
New uniform mapping handling

- add optional callback to handle mapping of uniform variables in linking phase
- if no resolver is provided, it uses the internal default resolver with all shifts and auto bind settings

Change-Id: Icfe38a9eabe8bfc8f8bb6d8150c06f7ed38bb762

7 years agoMerge pull request #560 from jeremy-lunarg/pragmas
John Kessenich [Thu, 27 Oct 2016 05:02:47 +0000 (23:02 -0600)]
Merge pull request #560 from jeremy-lunarg/pragmas

silence -Wunknown-pragmas warnings on gcc

7 years agoMerge pull request #568 from steve-lunarg/logicalop-fix
John Kessenich [Thu, 27 Oct 2016 05:01:16 +0000 (23:01 -0600)]
Merge pull request #568 from steve-lunarg/logicalop-fix

HLSL: allow component-wise operations for logical || and &&.

7 years agoMerge pull request #567 from steve-lunarg/compare-fix
John Kessenich [Thu, 27 Oct 2016 04:54:35 +0000 (22:54 -0600)]
Merge pull request #567 from steve-lunarg/compare-fix

HLSL: Enable component-wise vector comparisons from operators

7 years agoMerge pull request #561 from jeremy-lunarg/unused
John Kessenich [Thu, 27 Oct 2016 04:51:43 +0000 (22:51 -0600)]
Merge pull request #561 from jeremy-lunarg/unused

GLSL: apply unused variable

7 years agoHLSL: allow component-wise operations for logical || and &&.
steve-lunarg [Wed, 26 Oct 2016 18:42:49 +0000 (12:42 -0600)]
HLSL: allow component-wise operations for logical || and &&.

HLSL || and && can operate component-wise.

7 years agoHLSL: Enable component-wise vector comparisons from operators
steve-lunarg [Fri, 21 Oct 2016 22:43:38 +0000 (16:43 -0600)]
HLSL: Enable component-wise vector comparisons from operators

This PR only changes a few lines of code, but is subtle.

In HLSL, comparison operators (<,>,<=,>=,==,!=) operate component-wise
when given a vector operand.  If a whole vector equality or inequality is
desired, then all() or any() can be used on the resulting bool vector.

This PR enables this change.  Existing shape conversion is used when
one of the two arguments is a vector and one is a scalar.

Some existing HLSL tests had assumed == and != meant vector-wise
instead of component-wise comparisons.  These tests have been changed
to add an explicit any() or all() to the test source.  This verifably
does not change the final SPIR-V binary relative to the old behavior
for == and !=.  The AST does change for the (now explicit, formerly
implicit) any() and all().  Also, a few tests changes where they
previously had the return type wrong, e.g, from a vec < vec comparison
in hlsl.shapeConv.frag.

Promotion of comparison opcodes to vector forms
(EOpEqual->EOpVectorEqual) is handled in promoteBinary(), as is setting
the proper vector type of the result.

EOpVectorEqual and EOpVectorNotEqual are now accepted as either
aggregate or binary nodes, similar to how the other operators are
handled.  Partial support already existed for this: it has been
fleshed out in the printing functions in intermOut.cpp.

There is an existing defect around shape conversion with 1-vectors, but
that is orthogonal to this PR and not addressed by it.

7 years agoMerge pull request #565 from mre4ce/master
John Kessenich [Tue, 25 Oct 2016 06:16:12 +0000 (00:16 -0600)]
Merge pull request #565 from mre4ce/master

Disabled MSVC 2015 compile warnings.

7 years agoWIP: avoid strtok
steve-lunarg [Fri, 21 Oct 2016 05:56:45 +0000 (23:56 -0600)]
WIP: avoid strtok

7 years agoWIP: apply unused variable
Jeremy Hayes [Thu, 20 Oct 2016 22:12:36 +0000 (16:12 -0600)]
WIP: apply unused variable

I happened upon numArgs while hunting for unused variables. I suspect
the intent was to apply it as shown in this patch. However, I am not a
compiler dude. Someone more appropriate should grok this change.

7 years agoupdate
Johannes van Waveren [Fri, 21 Oct 2016 08:30:50 +0000 (17:30 +0900)]
update

7 years agoMerge remote-tracking branch 'upstream/master'
Johannes van Waveren [Fri, 21 Oct 2016 08:21:46 +0000 (17:21 +0900)]
Merge remote-tracking branch 'upstream/master'

7 years agofixed MSVC 2015 compile warnings
Johannes van Waveren [Fri, 21 Oct 2016 08:21:12 +0000 (17:21 +0900)]
fixed MSVC 2015 compile warnings

7 years agoMerge pull request #559 from steve-lunarg/samplecmp-fix
John Kessenich [Fri, 21 Oct 2016 01:22:57 +0000 (19:22 -0600)]
Merge pull request #559 from steve-lunarg/samplecmp-fix

HLSL: fix defect in EOpMethodSampleCmp* texture decomposition

7 years agoMerge pull request #558 from steve-lunarg/image-atomics
John Kessenich [Fri, 21 Oct 2016 01:09:55 +0000 (19:09 -0600)]
Merge pull request #558 from steve-lunarg/image-atomics

HLSL: phase 4 of RWTexture support: add image atomics

7 years agoMerge pull request #555 from steve-lunarg/promotion-fixes
John Kessenich [Fri, 21 Oct 2016 01:07:27 +0000 (19:07 -0600)]
Merge pull request #555 from steve-lunarg/promotion-fixes

HLSL: Fix unary and binary operator type conversion issues

7 years agoMerge pull request #556 from dneto0/guard-amd-enums
John Kessenich [Fri, 21 Oct 2016 01:04:30 +0000 (19:04 -0600)]
Merge pull request #556 from dneto0/guard-amd-enums

SPV: Add missing guard to code that uses AMD extensions

7 years agoHLSL: fix defect in EOpMethodSampleCmp* texture decomposition
steve-lunarg [Thu, 20 Oct 2016 20:50:12 +0000 (14:50 -0600)]
HLSL: fix defect in EOpMethodSampleCmp* texture decomposition

HLSL holds the compare value in a separate intrinsic arg, but the AST wants
a vector including the cmp val, except in the 4-dim coord case, where it
doesn't fit and is in fact a separate AST parameter.  This is awkward but
necessary, given AST semantics.  In the process, a new vector is constructed
for the combined result, but this vector was not being given the correct
TType, so was causing some downstream troubles.

Now it is.  A similar defect existed in OpTextureBias, and has also been
fixed.

7 years agoMove promote methods to TIntermediate class
steve-lunarg [Wed, 19 Oct 2016 18:57:22 +0000 (12:57 -0600)]
Move promote methods to TIntermediate class

A need arose to use capabilities from TIntermediate during
node promotion.  These methods have been moved from virtual
methods on the TIntermUnary and TIntermBinary nodes to methods
on TIntermediate, so it is easy for them construct new nodes
and so on.

This is done as a separate commit to verify that no test results
are changed as a result.

7 years agoHLSL: phase 4 of rwtexture support: add image atomics
steve-lunarg [Wed, 19 Oct 2016 16:15:25 +0000 (10:15 -0600)]
HLSL: phase 4 of rwtexture support: add image atomics

This PR will turn Interlocked* intrinsics using rwtexture or rwbuffer
object as the first parameter into the proper OpImageAtomic* operations.

7 years agoAdd missing guard to code that uses AMD extensions
David Neto [Wed, 19 Oct 2016 14:16:29 +0000 (10:16 -0400)]
Add missing guard to code that uses AMD extensions

Otherwise compilation fails when ENABLED_AMD_EXTENSIONS is off.

7 years agoHLSL: Fix unary and binary operator type conversion issues
steve-lunarg [Sat, 15 Oct 2016 16:29:58 +0000 (10:29 -0600)]
HLSL: Fix unary and binary operator type conversion issues

This fixes defects as follows:

1. handleLvalue could be called on a non-L-value, and it shouldn't be.

2. HLSL allows unary negation on non-bool values.  TUnaryOperator::promote
   can now promote other types (e.g, int, float) to bool for this op.

3. HLSL allows binary logical operations (&&, ||) on arbitrary types, similar
   (2).

4. HLSL allows mod operation on arbitrary types, which will be promoted.
   E.g, int % float -> float % float.

7 years agoHLSL: Turn on tests for groupshared.
John Kessenich [Sun, 16 Oct 2016 18:22:20 +0000 (12:22 -0600)]
HLSL: Turn on tests for groupshared.

7 years agoHLSL: Support SV_Coverage and SV_DispatchThreadId; catch SV_GroupIndex.
John Kessenich [Sun, 16 Oct 2016 18:12:11 +0000 (12:12 -0600)]
HLSL: Support SV_Coverage and SV_DispatchThreadId; catch SV_GroupIndex.

7 years agoBuild: Fix unsigned/signed warning.
John Kessenich [Sun, 16 Oct 2016 17:50:46 +0000 (11:50 -0600)]
Build: Fix unsigned/signed warning.

7 years agoMerge pull request #548 from baldurk/vs2010-compile-fixes
John Kessenich [Sun, 16 Oct 2016 05:09:31 +0000 (23:09 -0600)]
Merge pull request #548 from baldurk/vs2010-compile-fixes

VS2010 compile fixes

7 years agoMerge pull request #551 from steve-lunarg/rwbuffers-fmt
John Kessenich [Sun, 16 Oct 2016 05:03:38 +0000 (23:03 -0600)]
Merge pull request #551 from steve-lunarg/rwbuffers-fmt

HLSL: phase 3 of rwtexture support: add sub-vec4 capabilities

7 years agoMerge pull request #539 from schwa423/linux_global_lock
John Kessenich [Sun, 16 Oct 2016 04:53:46 +0000 (22:53 -0600)]
Merge pull request #539 from schwa423/linux_global_lock

Use pthread_mutex for global lock on Linux.

7 years agoMerge pull request #550 from amdrexu/bugfix
John Kessenich [Sun, 16 Oct 2016 04:49:53 +0000 (22:49 -0600)]
Merge pull request #550 from amdrexu/bugfix

SPV: Add missing extension declarations for certain AMD extensions.

7 years agoMerge pull request #549 from steve-lunarg/multidim-array
John Kessenich [Sun, 16 Oct 2016 04:43:43 +0000 (22:43 -0600)]
Merge pull request #549 from steve-lunarg/multidim-array

HLSL: allow multi-dimensional arrays

7 years agoUse a recursive mutex.
Josh Gargus [Sat, 15 Oct 2016 22:19:59 +0000 (15:19 -0700)]
Use a recursive mutex.

7 years agoHLSL: phase 3c: add option to use Unknown storage format
steve-lunarg [Sat, 15 Oct 2016 00:36:42 +0000 (18:36 -0600)]
HLSL: phase 3c: add option to use Unknown storage format

This uses the Unknown storage format, instead of deducing the
format from the texture declaration type.

7 years agoHLSL: phase 3b: Texture methods remember and return vector size.
steve-lunarg [Fri, 14 Oct 2016 22:40:32 +0000 (16:40 -0600)]
HLSL: phase 3b: Texture methods remember and return vector size.

Also makes a (correct) test change for global -> temp vars.

7 years agoHLSL: phase 3a: Add sub-vec4 rwtexture formats (qualifier.layoutFormat)
steve-lunarg [Mon, 10 Oct 2016 21:24:57 +0000 (15:24 -0600)]
HLSL: phase 3a: Add sub-vec4 rwtexture formats (qualifier.layoutFormat)

This PR sets the TQualifier layoutFormat according to the HLSL image type.
For instance:

  RWTexture1D <float2> g_tTex1df2;

becomes ElfRg32f.  Similar on Buffers, e.g, Buffer<float4> mybuffer;

The return type for image and buffer loads is now taken from the storage format.
Also, the qualifier for the return type is now (properly) a temp, not a global.

7 years agoSPV: Add missing extension declarations for certain AMD extensions.
Rex Xu [Fri, 14 Oct 2016 09:41:45 +0000 (17:41 +0800)]
SPV: Add missing extension declarations for certain AMD extensions.

7 years agoMerge pull request #542 from steve-lunarg/rwbuffers
John Kessenich [Thu, 13 Oct 2016 18:49:56 +0000 (12:49 -0600)]
Merge pull request #542 from steve-lunarg/rwbuffers

HLSL: phase 2: add operator[]

7 years agoMerge pull request #538 from steve-lunarg/iomap-binding-range-err
John Kessenich [Thu, 13 Oct 2016 18:44:16 +0000 (12:44 -0600)]
Merge pull request #538 from steve-lunarg/iomap-binding-range-err

Check for out-of-range bindings during IO mapping.

7 years agoHLSL: allow multi-dimensional arrays
steve-lunarg [Thu, 13 Oct 2016 18:26:18 +0000 (12:26 -0600)]
HLSL: allow multi-dimensional arrays

All the underpinnings are there; this just parses multiple array dimensions
and passes them through to the existing mechanisms.

Also, minor comment fixes, and add a new test for multi-dim arrays.

7 years agoUpdate HexFloat tests to use non-enum class enum values
baldurk [Thu, 13 Oct 2016 18:05:13 +0000 (20:05 +0200)]
Update HexFloat tests to use non-enum class enum values

7 years agoChange negatable_left_shift and negatable_right_shift to inline funcs
baldurk [Thu, 13 Oct 2016 17:39:24 +0000 (19:39 +0200)]
Change negatable_left_shift and negatable_right_shift to inline funcs

* This avoids an internal compile error on VS2010 possibly related to
  std::enable_if use.

7 years agoChange {} constructor brackets to ()
baldurk [Thu, 13 Oct 2016 17:32:37 +0000 (19:32 +0200)]
Change {} constructor brackets to ()

7 years agoChange "using x = y;" to "typedef y x;" statements
baldurk [Thu, 13 Oct 2016 17:31:15 +0000 (19:31 +0200)]
Change "using x = y;" to "typedef y x;" statements

7 years agoExplicitly implement default constructors
baldurk [Thu, 13 Oct 2016 17:30:27 +0000 (19:30 +0200)]
Explicitly implement default constructors

7 years agoAdd std::isnan and std::isinf wrappers for VS2010 that doesn't have them
baldurk [Thu, 13 Oct 2016 17:28:54 +0000 (19:28 +0200)]
Add std::isnan and std::isinf wrappers for VS2010 that doesn't have them

7 years agoChange enum class to plain enum
baldurk [Thu, 13 Oct 2016 17:28:20 +0000 (19:28 +0200)]
Change enum class to plain enum

7 years agoChange constructor to use ()s instead of {}s
baldurk [Thu, 13 Oct 2016 17:25:52 +0000 (19:25 +0200)]
Change constructor to use ()s instead of {}s

7 years agoAdd #include <cstdint> for std::uint32_t usage
baldurk [Thu, 13 Oct 2016 17:24:42 +0000 (19:24 +0200)]
Add #include <cstdint> for std::uint32_t usage

7 years agoAdd strtoull wrapper for VS2010, pointing to MS implementation
baldurk [Thu, 13 Oct 2016 17:24:23 +0000 (19:24 +0200)]
Add strtoull wrapper for VS2010, pointing to MS implementation

7 years agoGive all complex lambdas an explicit return type
baldurk [Thu, 13 Oct 2016 17:23:39 +0000 (19:23 +0200)]
Give all complex lambdas an explicit return type

7 years agoHLSL: phase 2e: introduce lower level addBinaryNode/UnaryNode fns
steve-lunarg [Wed, 12 Oct 2016 18:38:12 +0000 (12:38 -0600)]
HLSL: phase 2e: introduce lower level addBinaryNode/UnaryNode fns

- hlsl.struct.frag variable changed to static, assignment replacd.

- Created new low level functions addBinaryNode and addUnaryNode.  These are
  used by higher level functions such as addAssignment, and do not do any
  argument promotion or conversion of any sort.

- Two functions above are now used in RWTexture lvalue conversions.  Also,
  other direction creations of unary or binary nodes now use them, e.g, addIndex.
  This cleans up some existing code.

- removed handling of EOpVectorTimesScalar from promote()

- removed comment from ParseHelper.cpp

7 years agoHLSL: phase 2d: minor cleanup, & allow operator[] on non-rw textures
steve-lunarg [Mon, 10 Oct 2016 16:00:14 +0000 (10:00 -0600)]
HLSL: phase 2d: minor cleanup, & allow operator[] on non-rw textures

Improve comments.
A few tweaked lines allow [] on non-rw tx.  Add test case for this.
Improve VectorTimesScalar handling.

7 years agoHLSL: phase 2c: use lValueErrorCheck in HLSL FE
steve-lunarg [Sat, 8 Oct 2016 16:54:52 +0000 (10:54 -0600)]
HLSL: phase 2c: use lValueErrorCheck in HLSL FE

This commit splits lValueErrorCheck into machine dependent and independent
parts.  The GLSL form in TParseContext inherits from and invokes the
machine dependent part in TParseContextBase.  The base form checks language
independent things.  This split does not change the set of errors tested
for: the test results are identical.

The new base class interface is now used from the HLSL FE to test lvalues.
There was one test diff due to this, where the test was writing to a uniform.
It still does the same indirections, but does not attempt a uniform write.

7 years agoHLSL: phase 2b: add l-value operator[] for RWTexture/RWBuffer
steve-lunarg [Sat, 8 Oct 2016 01:35:40 +0000 (19:35 -0600)]
HLSL: phase 2b: add l-value operator[] for RWTexture/RWBuffer

This commit adds l-value support for RW texture and buffer objects.
Supported are:

- pre and post inc/decrement
- function out parameters
- op-assignments, such as *=, +-, etc.
- result values from op-assignments.  e.g, val=(MyRwTex[loc] *= 2);

Not supported are:
- Function inout parameters
- multiple post-inc/decrement operators.  E.g, MyRWTex[loc]++++;

7 years agoHLSL: phase 2a: add r-value operator[] for RWTexture/RWBuffer
steve-lunarg [Fri, 7 Oct 2016 02:12:24 +0000 (20:12 -0600)]
HLSL: phase 2a: add r-value operator[] for RWTexture/RWBuffer

This commit adds r-value support for RW textures and buffers.
Supported is:

- Function in parameter conversions
- conversion of rvalue use to imageLoad

7 years agoMerge pull request #546 from yavn/OpImageQueryLod-with-SampledImage
John Kessenich [Wed, 12 Oct 2016 15:05:07 +0000 (09:05 -0600)]
Merge pull request #546 from yavn/OpImageQueryLod-with-SampledImage

SPV: Use SampledImage with OpImageQueryLod

7 years agoSPV: Use SampledImage with OpImageQueryLod
Maciej Jesionowski [Wed, 12 Oct 2016 13:40:37 +0000 (15:40 +0200)]
SPV: Use SampledImage with OpImageQueryLod

Khronos SPIR-V issue #74

7 years agoMerge pull request #543 from slime73/compilerwarnings
John Kessenich [Tue, 11 Oct 2016 21:31:31 +0000 (15:31 -0600)]
Merge pull request #543 from slime73/compilerwarnings

Address some compiler warnings.

7 years agofixup! Address some compiler warnings.
Alex Szpakowski [Tue, 11 Oct 2016 19:16:47 +0000 (16:16 -0300)]
fixup! Address some compiler warnings.

7 years agoMerge pull request #544 from amdrexu/feature
John Kessenich [Tue, 11 Oct 2016 15:29:30 +0000 (09:29 -0600)]
Merge pull request #544 from amdrexu/feature

SPV: Implement extension SPV_KHR_shader_draw_parameters.

7 years agoSPV: Implement extension SPV_KHR_shader_draw_parameters.
Rex Xu [Fri, 22 Jul 2016 10:15:31 +0000 (18:15 +0800)]
SPV: Implement extension SPV_KHR_shader_draw_parameters.

7 years agoMerge pull request #545 from amdrexu/bugfix
John Kessenich [Mon, 10 Oct 2016 15:43:30 +0000 (09:43 -0600)]
Merge pull request #545 from amdrexu/bugfix

Parser: Some function prototypes of interpolateAtXXX are incorrect.

7 years agoParser: Some function prototypes of interpolateAtXXX are incorrect.
Rex Xu [Mon, 10 Oct 2016 07:38:15 +0000 (15:38 +0800)]
Parser: Some function prototypes of interpolateAtXXX are incorrect.

7 years agoAddress some compiler warnings.
Alex Szpakowski [Sun, 9 Oct 2016 01:07:20 +0000 (22:07 -0300)]
Address some compiler warnings.

- Add explicit casts from long to int.
- Comment out method argument names that are unused.
- Always initialize a boolean variable before it's read.

7 years agoSPV: Distinguish between SPV and non-SPV rules for member overlap.
John Kessenich [Fri, 7 Oct 2016 17:50:25 +0000 (11:50 -0600)]
SPV: Distinguish between SPV and non-SPV rules for member overlap.

7 years agoHLSL: Add shape conversions for return values.
John Kessenich [Thu, 6 Oct 2016 22:56:54 +0000 (16:56 -0600)]
HLSL: Add shape conversions for return values.

7 years agoHLSL: Do structure conversion for return type struct-punning on non-entry-point funct...
John Kessenich [Thu, 6 Oct 2016 18:59:51 +0000 (12:59 -0600)]
HLSL: Do structure conversion for return type struct-punning on non-entry-point functions.

7 years agoMerge pull request #540 from steve-lunarg/rwbuffers
John Kessenich [Thu, 6 Oct 2016 17:47:37 +0000 (11:47 -0600)]
Merge pull request #540 from steve-lunarg/rwbuffers

HLSL: phase 1: add RWTexture and RWBuffer

7 years agoHLSL: phase 1: add RWTexture and RWBuffer
steve-lunarg [Tue, 4 Oct 2016 22:58:14 +0000 (16:58 -0600)]
HLSL: phase 1: add RWTexture and RWBuffer

There's a lot to do for RWTexture and RWBuffer, so it will be broken up into
several PRs.  This is #1.

This adds RWTexture and RWBuffer support, with the following limitations:
  * Only 4 component formats supported
  * No operator[] yet

Those will be added in other PRs.

This PR supports declarations and the Load & GetDimensions methods.  New tests are
added.

7 years agoUse pthread_mutex for global lock on Linux.
Josh Gargus [Thu, 6 Oct 2016 01:32:51 +0000 (18:32 -0700)]
Use pthread_mutex for global lock on Linux.

7 years agoMerge pull request #537 from dneto0/pass-cwd-to-gtest
John Kessenich [Wed, 5 Oct 2016 19:57:22 +0000 (13:57 -0600)]
Merge pull request #537 from dneto0/pass-cwd-to-gtest

Gtests can be run on another source tree

7 years agoCheck for out-of-range bindings during IO mapping.
steve-lunarg [Wed, 5 Oct 2016 19:40:13 +0000 (13:40 -0600)]
Check for out-of-range bindings during IO mapping.

7 years agoAllow for larger binding numbers. 65K instead of 255.
John Kessenich [Wed, 5 Oct 2016 18:31:24 +0000 (12:31 -0600)]
Allow for larger binding numbers.  65K instead of 255.

7 years agoGtests can be run on another source tree
David Neto [Wed, 5 Oct 2016 14:25:09 +0000 (10:25 -0400)]
Gtests can be run on another source tree

The gtest executable accepts a --test-root option to specify
a root directory for test files.  It defaults to the Test directory
in the source tree from which the executable is built.

For example, this lets us run test exectuables built with MinGW on Linux
on a Windows machine with its own copy of the source tree.

7 years agoMerge pull request #536 from steve-lunarg/flatten-assign-fix
John Kessenich [Wed, 5 Oct 2016 01:45:18 +0000 (19:45 -0600)]
Merge pull request #536 from steve-lunarg/flatten-assign-fix

HLSL: fix for flattening assignments from non-symbol R-values.

7 years agoHLSL: fix for flattening assignments from non-symbol R-values.
steve-lunarg [Mon, 3 Oct 2016 04:13:22 +0000 (22:13 -0600)]
HLSL: fix for flattening assignments from non-symbol R-values.

If a member-wise assignment from a non-flattened struct to a flattened struct sees a complex R-value
(not a symbol), it now creates a temporary to hold that value, to avoid repeating the R-value.
This avoids, e.g, duplicating a whole function call.  Also, it avoids re-using the AST node, making a
new one for each member inside the member loop.

The latter (re-use of AST node) was also an issue in the GetDimensions intrinsic decomposition,
so this PR fixes that one too.

7 years agoMerge pull request #533 from steve-lunarg/reflection
John Kessenich [Mon, 3 Oct 2016 19:57:32 +0000 (13:57 -0600)]
Merge pull request #533 from steve-lunarg/reflection

add reflection queries to return a TType.  Fix minor issue with inter…