John Kessenich [Wed, 24 May 2017 22:02:56 +0000 (16:02 -0600)]
HLSL: Fix #902: Incorrect protection against zero arguments.
John Kessenich [Sat, 20 May 2017 19:23:25 +0000 (13:23 -0600)]
Fix #373: Implicitly make gl_FragColor a location=0 output.
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.
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
John Kessenich [Sat, 20 May 2017 05:44:51 +0000 (23:44 -0600)]
More non-determinism fixed.
John Kessenich [Sat, 20 May 2017 05:29:50 +0000 (23:29 -0600)]
Fix C++ portability, non-deterministic order of argument evaluation.
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.
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.
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.
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.
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
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.
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.
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
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.
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.
John Kessenich [Wed, 17 May 2017 05:16:26 +0000 (23:16 -0600)]
HLSL: Implement member functions calling member functions.
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
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.
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
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]
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
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.
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
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.
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.
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.
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.
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
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
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.
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.
Hyangran Park [Tue, 2 May 2017 07:27:29 +0000 (16:27 +0900)]
HLSL: Manually configure descriptor set and binding number for resources
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.
John Kessenich [Mon, 8 May 2017 06:47:48 +0000 (00:47 -0600)]
Build: Fix portability in previous commit.
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.
John Kessenich [Fri, 5 May 2017 11:09:58 +0000 (05:09 -0600)]
SPV: Emit extension for using StorageClassStorageBuffer.
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
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
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
steve-lunarg [Wed, 3 May 2017 00:59:55 +0000 (18:59 -0600)]
Fix iomapper build warnings
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
steve-lunarg [Tue, 2 May 2017 03:59:34 +0000 (21:59 -0600)]
HLSL: Implement missing GatherCmp
John Kessenich [Sun, 30 Apr 2017 20:02:23 +0000 (14:02 -0600)]
Merge pull request #870 from SoapGentoo/cmake-fixes
Modernise 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".
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"
John Kessenich [Sat, 29 Apr 2017 04:04:24 +0000 (22:04 -0600)]
Revert "Modernise CMake"
John Kessenich [Sat, 29 Apr 2017 03:50:19 +0000 (21:50 -0600)]
Merge pull request #828 from SoapGentoo/fixes
Modernise CMake
David Seifert [Fri, 28 Apr 2017 20:46:52 +0000 (22:46 +0200)]
Make test suite optional by using CTest
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.
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
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
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
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?
John Kessenich [Thu, 27 Apr 2017 21:18:46 +0000 (15:18 -0600)]
HLSL: Turn on hlsl-offsets by default for HLSL-source shaders.
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…
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.
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
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.
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
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),
^
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
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.
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.
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
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
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
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.
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
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.
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.
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.
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)
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.
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
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.
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.
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.
steve-lunarg [Fri, 14 Apr 2017 00:42:58 +0000 (18:42 -0600)]
WIP: HLSL: add Append/ConsumeBuffer support
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
John Kessenich [Thu, 13 Apr 2017 23:08:11 +0000 (17:08 -0600)]
SPV Non-functional: fix ordering causing problems with another branch.
John Kessenich [Thu, 13 Apr 2017 04:37:32 +0000 (22:37 -0600)]
HLSL: Fix #770: implicitly convert bool operands to numeric operators.
John Kessenich [Wed, 12 Apr 2017 23:24:34 +0000 (17:24 -0600)]
HLSL: Fix #834: Report #version is an illegal command.
John Kessenich [Wed, 12 Apr 2017 22:31:15 +0000 (16:31 -0600)]
HLSL: Fix #758: Support character literals (except for numeric escape sequences).
John Kessenich [Wed, 12 Apr 2017 20:56:52 +0000 (14:56 -0600)]
HLSL: Fix #803: Add shape conversions to the constant-initializer path.
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.
John Kessenich [Wed, 12 Apr 2017 19:26:57 +0000 (13:26 -0600)]
HLSL: Support 1.#INF and -1.#INF syntax.
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.
John Kessenich [Wed, 12 Apr 2017 01:45:00 +0000 (19:45 -0600)]
HLSL: Support vector 'cond ? :' -> EOpMix -> OpSelect.
John Kessenich [Tue, 11 Apr 2017 23:30:08 +0000 (17:30 -0600)]
HLSL: Non-functional: add vector ? : tests.
John Kessenich [Tue, 11 Apr 2017 15:51:32 +0000 (09:51 -0600)]
HLSL: Fix #832: don't require terminating semicolon for cbuffer/tbuffer.
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
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).
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
John Kessenich [Fri, 7 Apr 2017 21:40:30 +0000 (15:40 -0600)]
Non-functional: Fix typos in comments.
John Kessenich [Fri, 7 Apr 2017 21:33:08 +0000 (15:33 -0600)]
HLSL: Emit the OpSource HLSL instruction for HLSL, using new headers.
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.
Rex Xu [Fri, 7 Apr 2017 15:22:33 +0000 (23:22 +0800)]
Implement the extension SPV_KHR_16bit_storage
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.
John Kessenich [Thu, 6 Apr 2017 23:21:58 +0000 (17:21 -0600)]
SPV: Move to latest public headers.