platform/upstream/glslang.git
7 years agoBuild: Fix linux
Jeremy Hayes [Tue, 6 Jun 2017 18:03:54 +0000 (12:03 -0600)]
Build: Fix linux

I believe this is a repeat of 12d6936.

7 years agoHLSL: Fix #919: for-init-statement is arbitrary declaration or expression.
John Kessenich [Tue, 6 Jun 2017 17:37:33 +0000 (11:37 -0600)]
HLSL: Fix #919: for-init-statement is arbitrary declaration or expression.

Unlike "if (XXX)" and "while (XXX)", with "for (YYY...", the YYY can be
more kinds of statements than the XXX.

7 years agoGLSL: replace general missing functionality with specific messages.
John Kessenich [Mon, 5 Jun 2017 22:42:33 +0000 (16:42 -0600)]
GLSL: replace general missing functionality with specific messages.

7 years agoMerge pull request #912 from amdrexu/feature
John Kessenich [Mon, 5 Jun 2017 15:08:12 +0000 (09:08 -0600)]
Merge pull request #912 from amdrexu/feature

Implement the extension GL_AMD_texture_gather_bias_lod

7 years agoImplement the extension GL_AMD_texture_gather_bias_lod
Rex Xu [Thu, 17 Nov 2016 09:47:59 +0000 (17:47 +0800)]
Implement the extension GL_AMD_texture_gather_bias_lod

7 years agoGLSL: Fix bug setting component=0 for an auto-location assignment.
John Kessenich [Sun, 4 Jun 2017 19:17:20 +0000 (13:17 -0600)]
GLSL: Fix bug setting component=0 for an auto-location assignment.

Setting component=0 is later taken to mean the shader did so, which
is not always legal. It should instead set the component as not set
by the shader.

7 years agoGLSL: Error when using location on an arrayed block.
John Kessenich [Sun, 4 Jun 2017 19:05:50 +0000 (13:05 -0600)]
GLSL: Error when using location on an arrayed block.

This implements a recent change to the GLSL specification to enforce
this ill-defined situation.

7 years agoMerge pull request #899 from antiagainst/rm-empty-cpps
John Kessenich [Sat, 3 Jun 2017 21:29:06 +0000 (15:29 -0600)]
Merge pull request #899 from antiagainst/rm-empty-cpps

Remove empty cpp files

7 years agoMerge pull request #915 from LoopDawg/subvec4-intrinsic
John Kessenich [Sat, 3 Jun 2017 21:28:11 +0000 (15:28 -0600)]
Merge pull request #915 from LoopDawg/subvec4-intrinsic

HLSL: add test coverage for sub-vec4 texture intrinsics

7 years agoMerge pull request #905 from KhronosGroup/flatten-opaque-structs
John Kessenich [Sat, 3 Jun 2017 00:48:26 +0000 (18:48 -0600)]
Merge pull request #905 from KhronosGroup/flatten-opaque-structs

SPV: When passing structs of opaque types, flatten and pass the membe…

7 years agoHLSL: Convert run-time sampler assignments to compile-time aliases.
John Kessenich [Fri, 2 Jun 2017 22:28:39 +0000 (16:28 -0600)]
HLSL: Convert run-time sampler assignments to compile-time aliases.

For "s.m = t", a sampler member assigned a sampler, make t an alias
for s.m, and when s.m is flattened, it will flatten to the alias t.
Normally, assignments to samplers are disallowed.

7 years agoSPV: When passing structs of opaque types, flatten and pass the members instead.
John Kessenich [Fri, 26 May 2017 06:01:36 +0000 (00:01 -0600)]
SPV: When passing structs of opaque types, flatten and pass the members instead.

This avoids either A) needing uniformConstant struct, or
B) initializing a struct with opaque members, as writing them is not
allowed.

7 years agoHLSL: iomapper: Fix #914. Tolerate user aliasing of bindings.
John Kessenich [Fri, 2 Jun 2017 00:16:33 +0000 (18:16 -0600)]
HLSL: iomapper: Fix #914. Tolerate user aliasing of bindings.

Because it is valid in HLSL to alias bindings:
A) remove validation that aliasing is not done
B) make the algorithms tolerate aliasing

7 years agoHLSL: add test coverage for sub-vec4 texture intrinsics
LoopDawg [Thu, 1 Jun 2017 19:10:25 +0000 (13:10 -0600)]
HLSL: add test coverage for sub-vec4 texture intrinsics

This changes no functional code.  There was a bit of a testing hole
in that textures templatized on sub-vec4 types were not being exercised
with any intrinsics.  This adds some basic sanity coverage of that case.

7 years agoMerge pull request #907 from KhronosGroup/include
John Kessenich [Thu, 1 Jun 2017 18:37:52 +0000 (12:37 -0600)]
Merge pull request #907 from KhronosGroup/include

HLSL: Add an Includer to handle #include for local HLSL paths.

7 years agoMerge pull request #913 from amdrexu/bugfix
John Kessenich [Thu, 1 Jun 2017 18:36:21 +0000 (12:36 -0600)]
Merge pull request #913 from amdrexu/bugfix

Parser: Add missing codes for float16

7 years agoHLSL: Add an Includer to handle #include.
John Kessenich [Mon, 22 May 2017 21:00:42 +0000 (15:00 -0600)]
HLSL: Add an Includer to handle #include.

7 years agoParser: Add missing codes for float16
Rex Xu [Thu, 1 Jun 2017 11:58:54 +0000 (19:58 +0800)]
Parser: Add missing codes for float16

7 years agoMerge pull request #911 from KhronosGroup/debug-info
John Kessenich [Thu, 1 Jun 2017 04:47:28 +0000 (22:47 -0600)]
Merge pull request #911 from KhronosGroup/debug-info

SPV: Add OpSource shader source code and file name.

7 years agoSPV: Debug output: Include OpLine information for execution path.
John Kessenich [Thu, 1 Jun 2017 00:50:53 +0000 (18:50 -0600)]
SPV: Debug output: Include OpLine information for execution path.

Note that declaratives are not handled, only procedurals.

7 years agoSPV: Add OpSource shader source code and file name.
John Kessenich [Wed, 31 May 2017 23:11:16 +0000 (17:11 -0600)]
SPV: Add OpSource shader source code and file name.

7 years agoMerge pull request #856 from TiemoJung/texture_upgrade
John Kessenich [Mon, 29 May 2017 17:40:43 +0000 (11:40 -0600)]
Merge pull request #856 from TiemoJung/texture_upgrade

Pure Texture to Sampled Texture Transform

7 years agoPure Texture to Sampled Texture Transform
t.jung [Tue, 25 Apr 2017 21:31:03 +0000 (23:31 +0200)]
Pure Texture to Sampled Texture Transform

Adds a transformation step to the post processing step.
Two modes are available:
1) keep
- Keeps samplers, textures and sampled textures as is
2) transform pure texture into sampled texture and remove pure samplers
- removes all pure samplers
- transforms all pure textures into its sampled counter part

Change-Id: If54972e8052961db66c23f4b7e719d363cf6edbd

7 years agoMerge pull request #901 from LoopDawg/imat-construct
John Kessenich [Thu, 25 May 2017 05:12:58 +0000 (23:12 -0600)]
Merge pull request #901 from LoopDawg/imat-construct

HLSL: Add imat, umat, and bmat constructors

7 years agoSPV: Fix #904: Correctly check for built-in block redeclations for location check.
John Kessenich [Thu, 25 May 2017 05:10:28 +0000 (23:10 -0600)]
SPV: Fix #904: Correctly check for built-in block redeclations for location check.

7 years agoHLSL: Fix #903: Don't short-circuit && or ||.
John Kessenich [Wed, 24 May 2017 22:44:47 +0000 (16:44 -0600)]
HLSL: Fix #903: Don't short-circuit && or ||.

7 years agoHLSL: Fix #902: Incorrect protection against zero arguments.
John Kessenich [Wed, 24 May 2017 22:02:56 +0000 (16:02 -0600)]
HLSL: Fix #902: Incorrect protection against zero arguments.

7 years agoHLSL: Add imat, umat, and bmat constructors
LoopDawg [Sun, 21 May 2017 03:40:27 +0000 (21:40 -0600)]
HLSL: Add imat, umat, and bmat constructors

Fixes #894

7 years agoFix #373: Implicitly make gl_FragColor a location=0 output.
John Kessenich [Sat, 20 May 2017 19:23:25 +0000 (13:23 -0600)]
Fix #373: Implicitly make gl_FragColor a location=0 output.

7 years agoSPV: Correctly enforce 'location' presence on in/out blocks.
John Kessenich [Sat, 20 May 2017 18:14:13 +0000 (12:14 -0600)]
SPV: Correctly enforce 'location' presence on in/out blocks.

Blocks have this on members, not the object.

7 years agoMerge pull request #900 from LoopDawg/tx-overloads
John Kessenich [Sat, 20 May 2017 17:33:54 +0000 (11:33 -0600)]
Merge pull request #900 from LoopDawg/tx-overloads

HLSL: allow name mangling based on texture template type

7 years agoMore non-determinism fixed.
John Kessenich [Sat, 20 May 2017 05:44:51 +0000 (23:44 -0600)]
More non-determinism fixed.

7 years agoFix C++ portability, non-deterministic order of argument evaluation.
John Kessenich [Sat, 20 May 2017 05:29:50 +0000 (23:29 -0600)]
Fix C++ portability, non-deterministic order of argument evaluation.

7 years agoFix #857: Convert uniform int to local bool for struct alias assignment.
John Kessenich [Sat, 20 May 2017 05:00:13 +0000 (23:00 -0600)]
Fix #857: Convert uniform int to local bool for struct alias assignment.

This was done for one direction, but not both directions, so this commit
picks up the other direction.

7 years agoHLSL: Don't do logical short-circuits when the operands are bool-vectors.
John Kessenich [Sat, 20 May 2017 02:19:00 +0000 (20:19 -0600)]
HLSL: Don't do logical short-circuits when the operands are bool-vectors.

This seems a bit ill-defined, and was generating code that made OpPhi of two
operands that were Boolean vectors result in a scalar bool.

7 years agoHLSL: allow name mangling based on texture template type
LoopDawg [Thu, 18 May 2017 23:43:08 +0000 (17:43 -0600)]
HLSL: allow name mangling based on texture template type

Name mangling did not account for the vector size in the template type of a texture.
This adds that.  The mangle is as it ever was for the vec4 case, which leaves
all GLSL behavior and most HLSL behavior uneffected.  For vec1-3 the size is added
to the mangle.

Current limitation: textures cannot presently be templatized on structured types,
so this works only for vectors of basic types.

Fixes #895.

7 years agoRemove empty cpp files
Lei Zhang [Fri, 19 May 2017 20:59:24 +0000 (16:59 -0400)]
Remove empty cpp files

This solves ranlib warnings on MacOS.

7 years agoMerge pull request #896 from KhronosGroup/spv-location
John Kessenich [Fri, 19 May 2017 03:12:04 +0000 (21:12 -0600)]
Merge pull request #896 from KhronosGroup/spv-location

SPV: Give error on not assigning locations to I/O when generating SPIR-V.

7 years agoMerge pull request #897 from LoopDawg/remap-specconstop-fix.2
John Kessenich [Fri, 19 May 2017 00:19:12 +0000 (18:19 -0600)]
Merge pull request #897 from LoopDawg/remap-specconstop-fix.2

Remapper: handle embedded opcode in OpSpecConstantOp

7 years agoRemapper: handle embedded opcode in OpSpecConstantOp
LoopDawg [Thu, 18 May 2017 22:13:04 +0000 (16:13 -0600)]
Remapper: handle embedded opcode in OpSpecConstantOp

OpSpecConstantOp contains an embedded opcode which is given as a literal
argument to the OpSpecConstantOp.  The subsequent arguments are as the
embedded op would expect, which may be a mixture of IDs and literals.  This
adds support for that to the remapper binary parser.  Upon seeing such an
embedded op, the parser flips over to parsing the argument list as
appropriate for that opcode.

Fixes #882.

7 years agoSPV: Give error on not assigning locations to I/O.
John Kessenich [Thu, 18 May 2017 00:28:19 +0000 (18:28 -0600)]
SPV: Give error on not assigning locations to I/O.

Also, provides an option to auto-assign locations.
Existing tests use this option, to avoid the error message,
however, it is not fully implemented yet.

7 years agoMerge pull request #860 from steve-lunarg/sb-counter-args.2
John Kessenich [Wed, 17 May 2017 16:55:22 +0000 (10:55 -0600)]
Merge pull request #860 from steve-lunarg/sb-counter-args.2

HLSL: add ability to pass struct buffers with counters to fns

7 years agoMerge pull request #893 from KhronosGroup/member-call
John Kessenich [Wed, 17 May 2017 15:25:57 +0000 (09:25 -0600)]
Merge pull request #893 from KhronosGroup/member-call

HLSL: Implement member functions calling member functions.

Fixes #883.

7 years agoWIP: HLSL: add ability to pass struct buffers with counters to fns
steve-lunarg [Thu, 27 Apr 2017 17:22:32 +0000 (11:22 -0600)]
WIP: HLSL: add ability to pass struct buffers with counters to fns

This modifies function parameter passing to pass the counter
buffer associated with a struct buffer to a function as a
hidden parameter.  Similarly function declarations will have
hidden parameters added to accept the associated counter buffers.

There is a limitation: if a SB type may or may not have an associated
counter, passing it as a function parameter will assume that it does, and
the counter will appear in the linkage whether or not there is a counter
method used on the object.

7 years agoHLSL: Implement member functions calling member functions.
John Kessenich [Wed, 17 May 2017 05:16:26 +0000 (23:16 -0600)]
HLSL: Implement member functions calling member functions.

7 years agoMerge pull request #852 from steve-lunarg/declared-builtin
John Kessenich [Tue, 16 May 2017 16:38:32 +0000 (10:38 -0600)]
Merge pull request #852 from steve-lunarg/declared-builtin

track declared builtin type

7 years agoWIP: track declared builtin type [proposal]
steve-lunarg [Mon, 24 Apr 2017 01:44:28 +0000 (19:44 -0600)]
WIP: track declared builtin type [proposal]

Marking as WIP since it might deserve discussion or at least explicit consideration.

During type sanitization, the TQualifier's TBuiltInVariable type is lost.  However,
sometimes it's needed downstream.  There were already two methods in use to track
it through to places it was needed: one in the TParameter, and one in a map in the
HlslParseContext used for structured buffers.

The latter was going to be insufficient when SB types with counters are passed to
user functions, and it's proving awkward to track the data to where it's needed.
This PR holds a proposal: track the original declared builtin type in the TType,
so it's trivially available where needed.

This lets the other two mechanisms be removed (and they are in this PR).  There's a
side benefit of not losing certain types of information before the reflection interface.

This PR is only that proposal, so it changes no test results.  If it's acceptable,
I'll use it for the last piece of SB counter functionality.

7 years agoMerge pull request #890 from LoopDawg/mip-operator
John Kessenich [Mon, 15 May 2017 15:39:15 +0000 (09:39 -0600)]
Merge pull request #890 from LoopDawg/mip-operator

HLSL: add .mips[][] operator for texture types

7 years agoHLSL: add .mips[][] operator for texture types
LoopDawg [Fri, 12 May 2017 23:14:31 +0000 (17:14 -0600)]
HLSL: add .mips[][] operator for texture types

This implements mytex.mips[mip][coord] for texture types.  There is
some error testing, but not comprehensive.  The constructs can be
nested, e.g in this case the inner .mips is parsed before the completion
of the outer [][] operator.

   tx.mips[tx.mips[a][b].x][c]

7 years agoMerge pull request #889 from antiagainst/travis-android
John Kessenich [Sat, 13 May 2017 22:03:12 +0000 (16:03 -0600)]
Merge pull request #889 from antiagainst/travis-android

Check Android build on Travis CI

7 years agoCheck Android build on Travis CI.
Lei Zhang [Sat, 13 May 2017 18:26:30 +0000 (14:26 -0400)]
Check Android build on Travis CI.

Also stop requiring sudo privilege so that we can use containers
for testing.

7 years agoMerge pull request #888 from LoopDawg/geometry-stage-mix
John Kessenich [Sat, 13 May 2017 18:54:08 +0000 (12:54 -0600)]
Merge pull request #888 from LoopDawg/geometry-stage-mix

HLSL: allow GS-specific methods in non-GS stages

7 years agoHLSL: allow GS-specific methods in other stages
LoopDawg [Sat, 13 May 2017 15:20:11 +0000 (09:20 -0600)]
HLSL: allow GS-specific methods in other stages

Using GS methods such as Append() in non-GS stages should be ignored, but was
creating errors due to the lack of a stream output symbol for the non-GS stage.

7 years agoHLSL: Fix #884: Use promoted children, not pre-promoted, in completing binary nodes.
John Kessenich [Fri, 12 May 2017 21:25:41 +0000 (15:25 -0600)]
HLSL: Fix #884: Use promoted children, not pre-promoted, in completing binary nodes.

7 years agoMerge pull request #886 from antiagainst/unordered-set
John Kessenich [Fri, 12 May 2017 20:53:06 +0000 (14:53 -0600)]
Merge pull request #886 from antiagainst/unordered-set

Use unordered_set in ReadableOrderTraverser.

7 years agoUse unordered_set in ReadableOrderTraverser.
Lei Zhang [Fri, 12 May 2017 00:46:01 +0000 (20:46 -0400)]
Use unordered_set in ReadableOrderTraverser.

Previously we are using unordered_map to map to bool, which can
be simplified with unordered_set.

7 years agoMerge pull request #880 from aras-p/master
John Kessenich [Wed, 10 May 2017 17:11:44 +0000 (11:11 -0600)]
Merge pull request #880 from aras-p/master

Fix for lumped/unity/batch builds

7 years agoMerge pull request #874 from xlpiao/DescriptorSet-and-Binding
John Kessenich [Wed, 10 May 2017 17:10:53 +0000 (11:10 -0600)]
Merge pull request #874 from xlpiao/DescriptorSet-and-Binding

HLSL: Manually configure descriptor set and binding number for resources

7 years ago[lumped builds] Add include guards (#pragma once) to header files that did not have...
Aras Pranckevicius [Wed, 10 May 2017 13:58:38 +0000 (16:58 +0300)]
[lumped builds] Add include guards (#pragma once) to header files that did not have any.

The codebase seems to use both “#pragma once“ approach, and “#ifndef / #define” approach,
so I picked pragma once as that one is less typing & less brittle.

When glslang is built with some other build system and lumped/unity builds are used,
without the include guards some headers would get included multiple times, leading to duplicate
declaration errors.

7 years ago[lumped builds] Only define _CRT_SECURE_NO_WARNINGS if it’s not defined yet.
Aras Pranckevicius [Wed, 10 May 2017 13:52:50 +0000 (16:52 +0300)]
[lumped builds] Only define _CRT_SECURE_NO_WARNINGS if it’s not defined yet.
When glslang is built with some other build system and lumped/unity builds are used,
without the checks this would get “macro is being redefined” warnings/errors.

7 years agoHLSL: Manually configure descriptor set and binding number for resources
Hyangran Park [Tue, 2 May 2017 07:27:29 +0000 (16:27 +0900)]
HLSL: Manually configure descriptor set and binding number for resources

7 years agoBuild fix: Make string assignment simpler to avoid some compiler issues.
John Kessenich [Wed, 10 May 2017 05:30:56 +0000 (23:30 -0600)]
Build fix: Make string assignment simpler to avoid some compiler issues.

Included changing related parameters to const.
Should fix complaints with previous commit. See issue #879.

7 years agoBuild: Fix portability in previous commit.
John Kessenich [Mon, 8 May 2017 06:47:48 +0000 (00:47 -0600)]
Build: Fix portability in previous commit.

7 years agoSPV: Support texelFetch() on a textureBuffer (no sampler).
John Kessenich [Mon, 8 May 2017 06:12:28 +0000 (00:12 -0600)]
SPV: Support texelFetch() on a textureBuffer (no sampler).

Fixes Vulkan Khronos-internal issue 770.

7 years agoSPV: Emit extension for using StorageClassStorageBuffer.
John Kessenich [Fri, 5 May 2017 11:09:58 +0000 (05:09 -0600)]
SPV: Emit extension for using StorageClassStorageBuffer.

7 years agoMerge pull request #878 from steve-lunarg/unroll-hint
John Kessenich [Thu, 4 May 2017 20:06:02 +0000 (23:06 +0300)]
Merge pull request #878 from steve-lunarg/unroll-hint

HLSL: implement [unroll] and [loop] attributes

7 years agoHLSL: implement [unroll] and [loop] attributes
steve-lunarg [Wed, 3 May 2017 02:14:50 +0000 (20:14 -0600)]
HLSL: implement [unroll] and [loop] attributes

This adds infrastructure suitable for any front end to create SPIR-V loop
control flags.  The only current front end doing so is HLSL.

[unroll] turns into spv::LoopControlUnrollMask
[loop] turns into spv::LoopControlDontUnrollMask
no specification means spv::LoopControlMaskNone

7 years agoMerge pull request #877 from steve-lunarg/warn-fix1
John Kessenich [Wed, 3 May 2017 05:40:15 +0000 (08:40 +0300)]
Merge pull request #877 from steve-lunarg/warn-fix1

Fix iomapper build warnings

7 years agoFix iomapper build warnings
steve-lunarg [Wed, 3 May 2017 00:59:55 +0000 (18:59 -0600)]
Fix iomapper build warnings

7 years agoMerge pull request #873 from steve-lunarg/gathercmp
John Kessenich [Tue, 2 May 2017 19:38:14 +0000 (22:38 +0300)]
Merge pull request #873 from steve-lunarg/gathercmp

HLSL: Implement missing GatherCmp method

7 years agoHLSL: Implement missing GatherCmp
steve-lunarg [Tue, 2 May 2017 03:59:34 +0000 (21:59 -0600)]
HLSL: Implement missing GatherCmp

7 years agoMerge pull request #870 from SoapGentoo/cmake-fixes
John Kessenich [Sun, 30 Apr 2017 20:02:23 +0000 (14:02 -0600)]
Merge pull request #870 from SoapGentoo/cmake-fixes

Modernise CMake #2

7 years agoModernise CMake #2
David Seifert [Sat, 29 Apr 2017 08:57:36 +0000 (10:57 +0200)]
Modernise CMake #2

This reverts commit cfc69d95afed34e1ba1371df0ddb56f2f491a5cb.
* Change CMAKE_INSTALL_PREFIX default on Windows in order
  to prevent permission denied errors when trying to install
  to "Program Files".

7 years agoMerge pull request #869 from KhronosGroup/revert-828-fixes
John Kessenich [Sat, 29 Apr 2017 04:13:35 +0000 (22:13 -0600)]
Merge pull request #869 from KhronosGroup/revert-828-fixes

Revert "Modernise CMake"

7 years agoRevert "Modernise CMake"
John Kessenich [Sat, 29 Apr 2017 04:04:24 +0000 (22:04 -0600)]
Revert "Modernise CMake"

7 years agoMerge pull request #828 from SoapGentoo/fixes
John Kessenich [Sat, 29 Apr 2017 03:50:19 +0000 (21:50 -0600)]
Merge pull request #828 from SoapGentoo/fixes

Modernise CMake

7 years agoMake test suite optional by using CTest
David Seifert [Fri, 28 Apr 2017 20:46:52 +0000 (22:46 +0200)]
Make test suite optional by using CTest

7 years agoModernise CMake
David Seifert [Fri, 28 Apr 2017 20:46:52 +0000 (22:46 +0200)]
Modernise CMake

* Use `GNUInstallDirs` in order to respect GNU conventions.
  This is especially important for multi-arch/multi-lib setups.
* Specify position independent mode building properly, without
  using the historic hack of adding `-fPIC` as a definition.
  This makes the build system more portable.
* Only detect C++ (and not C) to slightly speed up configuring.
* Specify C++11 mode using modern CMake idioms.
* Fix some whitespace issues.

7 years agoMerge pull request #868 from TiemoJung/two_pass_io_remap
John Kessenich [Fri, 28 Apr 2017 15:15:51 +0000 (09:15 -0600)]
Merge pull request #868 from TiemoJung/two_pass_io_remap

Notification phase for io remapper

7 years agoMerge pull request #867 from steve-lunarg/emptyinit
John Kessenich [Fri, 28 Apr 2017 15:09:51 +0000 (09:09 -0600)]
Merge pull request #867 from steve-lunarg/emptyinit

HLSL: Allow empty struct initializers

7 years agoNotification phase for io remapper
t.jung [Fri, 28 Apr 2017 13:54:57 +0000 (15:54 +0200)]
Notification phase for io remapper

Adds a notification phase to the io remapper.
The idea behind this is to give the user a
chance to group uniforms and/or in/out variables
for a better pipeline layout sharing for vulkan.

Change-Id: I7492421085a4156ed3534f01d906ab390d73a623

7 years agoHLSL: Allow empty struct initializers
steve-lunarg [Fri, 28 Apr 2017 00:22:52 +0000 (18:22 -0600)]
HLSL: Allow empty struct initializers

Review request: does this harm GLSL in any way?

7 years agoHLSL: Turn on hlsl-offsets by default for HLSL-source shaders.
John Kessenich [Thu, 27 Apr 2017 21:18:46 +0000 (15:18 -0600)]
HLSL: Turn on hlsl-offsets by default for HLSL-source shaders.

7 years agoMerge pull request #859 from steve-lunarg/sampleposition
John Kessenich [Thu, 27 Apr 2017 07:36:52 +0000 (01:36 -0600)]
Merge pull request #859 from steve-lunarg/sampleposition

HLSL: add standard sample position return form of GetSamplePosition m…

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 #855 from steve-lunarg/constantbuffer
John Kessenich [Tue, 25 Apr 2017 22:05:03 +0000 (16:05 -0600)]
Merge pull request #855 from steve-lunarg/constantbuffer

HLSL: Add ConstantBuffer<T> syntax

7 years agoHLSL: Add ConstantBuffer<T> syntax
steve-lunarg [Tue, 25 Apr 2017 15:30:28 +0000 (09:30 -0600)]
HLSL: Add ConstantBuffer<T> syntax

Note: multi-dimension arrays of ConstantBuffer objects will go through uniform flattening.

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.