John Kessenich [Tue, 11 Oct 2016 21:31:31 +0000 (15:31 -0600)]
Merge pull request #543 from slime73/compilerwarnings
Address some compiler warnings.
Alex Szpakowski [Tue, 11 Oct 2016 19:16:47 +0000 (16:16 -0300)]
fixup! Address some compiler warnings.
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.
Rex Xu [Fri, 22 Jul 2016 10:15:31 +0000 (18:15 +0800)]
SPV: Implement extension SPV_KHR_shader_draw_parameters.
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.
Rex Xu [Mon, 10 Oct 2016 07:38:15 +0000 (15:38 +0800)]
Parser: Some function prototypes of interpolateAtXXX are incorrect.
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.
John Kessenich [Fri, 7 Oct 2016 17:50:25 +0000 (11:50 -0600)]
SPV: Distinguish between SPV and non-SPV rules for member overlap.
John Kessenich [Thu, 6 Oct 2016 22:56:54 +0000 (16:56 -0600)]
HLSL: Add shape conversions for return values.
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.
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
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.
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
John Kessenich [Wed, 5 Oct 2016 18:31:24 +0000 (12:31 -0600)]
Allow for larger binding numbers. 65K instead of 255.
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.
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.
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.
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…
steve-lunarg [Wed, 21 Sep 2016 20:19:40 +0000 (14:19 -0600)]
add reflection queries to return a TType. Fix minor issue with interface names.
- Add new queries: TProgram::getUniformTType and getUniformBlockTType,
which return a const TType*, or nullptr on a bad index. These are valid for
any source language.
- Interface name for HLSL cbuffers is taken from the (only) available declaration name,
whereas before it was always an empty string, which caused some troubles with reflection
mapping them all to the same index slot. This also makes it appear in the SPIR-V binary
instead of an empty string.
- Print the binding as part of the reflection textual dump.
- TType::clone becomes const. Needed to call it from a const method, and anyway it doesn't
change the object it's called on.
- Because the TObjectReflection constructor is called with a TType *reference* (not pointer)
so that it's guaranteed to pass in a type, and the "badReflection" value should use a nullptr
there, that now has a dedicated static method to obtain the bad value. It uses a private
constructor, so external users can't create one with a nullptr type.
John Kessenich [Sun, 2 Oct 2016 00:44:38 +0000 (18:44 -0600)]
Non-functional: Rationalizing parse helper hierarchy, step 3 (effected editable symbols and IO resize).
John Kessenich [Sun, 2 Oct 2016 00:07:57 +0000 (18:07 -0600)]
Non-functional: Rationalizing parse helper hierarchy, step 2 (effected error messaging and cascading errors).
John Kessenich [Sat, 1 Oct 2016 23:47:40 +0000 (17:47 -0600)]
Non-functional: Rationalizing parse helper hierarchy, step 1 (effected memory of HLSL keyword map).
John Kessenich [Sat, 1 Oct 2016 23:17:55 +0000 (17:17 -0600)]
HLSL: Line numbers only: Set locations (line numbers) on synthesized flattening code.
John Kessenich [Sat, 1 Oct 2016 23:11:21 +0000 (17:11 -0600)]
HLSL: Handle flattened I/O structs passed to function *out* parameters.
John Kessenich [Sat, 1 Oct 2016 19:30:37 +0000 (13:30 -0600)]
Non-functional: Better use of .isParamOutput() and some other methods.
John Kessenich [Sat, 1 Oct 2016 18:36:19 +0000 (12:36 -0600)]
Fix typo in error message.
John Kessenich [Sat, 1 Oct 2016 18:35:01 +0000 (12:35 -0600)]
Non-functional: Use isOpaque() instead of compare against EbtSampler.
John Kessenich [Sat, 1 Oct 2016 18:00:51 +0000 (12:00 -0600)]
Merge pull request #532 from steve-lunarg/automap-offsets
Change binding auto-map to use provided offsets.
steve-lunarg [Sat, 1 Oct 2016 17:27:43 +0000 (11:27 -0600)]
Change binding auto-map to use provided offsets.
Previously, the binding auto-mapping facility was free to use any unused
binding. This change makes auto-bindings use the same offset value as
explicit bindings.
John Kessenich [Sat, 1 Oct 2016 17:40:27 +0000 (11:40 -0600)]
Merge pull request #527 from steve-lunarg/array-flattening-fix
HLSL: Restrict uniform array flattening to sampler and texture arrays
John Kessenich [Sat, 1 Oct 2016 17:38:18 +0000 (11:38 -0600)]
Merge pull request #521 from yavn/frag-shader-primitive-id-capability
SPV: PrimitiveId in frag shader will emit OpCapability
John Kessenich [Sat, 1 Oct 2016 17:37:09 +0000 (11:37 -0600)]
Merge pull request #531 from steve-lunarg/add-autobinding-test
HLSL: Add a test for buffer auto-binding assignment.
steve-lunarg [Fri, 30 Sep 2016 20:26:34 +0000 (14:26 -0600)]
Add a test for buffer auto-binding assignment.
John Kessenich [Fri, 30 Sep 2016 15:54:17 +0000 (09:54 -0600)]
Merge pull request #523 from amdrexu/feature2
Parser: Implement extension GL_AMD_gpu_shader_half_float.
Rex Xu [Fri, 29 Jul 2016 08:00:05 +0000 (16:00 +0800)]
Parser: Implement extension GL_AMD_gpu_shader_half_float.
- Add built-in types: float16_t, f16vec, f16mat.
- Add support of half float constant: hf, HF.
- Extend built-in floating-point operators: +, -, *, /, ++, --, +=, -=,
*=, /=, ==, !=, >=, <=, >, <.
- Add support of type conversions: float16_t -> XXX, XXX -> float16_t.
- Add new built-in functions.
John Kessenich [Fri, 30 Sep 2016 05:58:30 +0000 (23:58 -0600)]
Add amend ability for anonymous blocks, so they can grow between function bodies.
John Kessenich [Thu, 29 Sep 2016 23:39:01 +0000 (17:39 -0600)]
Merge pull request #530 from annygakh/master
Updated README.md
Anny [Thu, 29 Sep 2016 23:29:58 +0000 (16:29 -0700)]
Updated README.md
Added an alternative link for cloning the repo in the build instructions
steve-lunarg [Thu, 29 Sep 2016 14:43:22 +0000 (08:43 -0600)]
Restrict uniform array flattening to sampler and texture arrays.
Previously the uniform array flattening feature would trigger on loose
uniform arrays of any basic type (e.g, floats). This PR restricts it
to sampler and texture arrays. Other arrays would end up in their own
uniform block (anonymous or otherwise). (Atomic counter arrays might be an
exception, but those are not currently flattened).
John Kessenich [Thu, 29 Sep 2016 16:27:57 +0000 (10:27 -0600)]
HLSL: Fix merge conflict.
John Kessenich [Wed, 28 Sep 2016 05:09:32 +0000 (23:09 -0600)]
HLSL Tests: Tests for previous commit, to make it easier to see what's changing.
John Kessenich [Wed, 28 Sep 2016 01:13:05 +0000 (19:13 -0600)]
Support a uniform block to hold global uniform variables.
Used initially just by HLSL, for $Global. Could be an option
for GLSL -> Vulkan.
John Kessenich [Tue, 27 Sep 2016 20:38:57 +0000 (14:38 -0600)]
HLSL: Rationalize combination of type arrayness and name arrayness.
John Kessenich [Wed, 28 Sep 2016 05:15:22 +0000 (23:15 -0600)]
Merge pull request #525 from steve-lunarg/implicit-size
HLSL: allow implicit size in array declarations
steve-lunarg [Tue, 27 Sep 2016 16:57:35 +0000 (10:57 -0600)]
HLSL: allow implicit array sizing.
In HLSL array sizes need not be provided explicitly in all circumstances.
For example, this is valid (note no number between the [ ]):
// no explicit array size
uniform float g_array[] = { 1, 2, 3, 4, 5 };
This PR does not attempt to validate most invalid cases.
A new test is added to verify the resulting linker objects.
John Kessenich [Tue, 27 Sep 2016 15:48:38 +0000 (09:48 -0600)]
Merge pull request #524 from DominikWitczakAMD/517_include_amd_extensions_by_default
#517: Enable AMD extensions by default
Maciej Jesionowski [Mon, 26 Sep 2016 14:49:09 +0000 (16:49 +0200)]
SPV: PrimitiveId in frag shader will emit Geometry capability
Using PrimitiveId in a fragment shader requires declaring
an OpCapability with either Geometry or Tessellation.
Dominik Witczak [Tue, 27 Sep 2016 07:51:34 +0000 (09:51 +0200)]
#517: Enable AMD extensions by default
John Kessenich [Mon, 26 Sep 2016 23:45:25 +0000 (17:45 -0600)]
Merge pull request #520 from amdrexu/bugfix
SPV: OpGroupBroadcast is unable to handle vector operand.
John Kessenich [Mon, 26 Sep 2016 23:40:17 +0000 (17:40 -0600)]
Merge pull request #522 from steve-lunarg/glsl-binding-test
GLSL: Add IO map tests
steve-lunarg [Mon, 26 Sep 2016 23:02:44 +0000 (17:02 -0600)]
GLSL: Add binding map tests
This PR adds a GLSL equivalent to the HLSL binding mapping tests for offsets and auto-numbering.
The shaders are as equivalent as possible. The bindings of the base results match exactly
between the two.
Rex Xu [Mon, 26 Sep 2016 07:53:40 +0000 (15:53 +0800)]
SPV: OpGroupBroadcast is unable to handle vector operand.
John Kessenich [Mon, 26 Sep 2016 02:25:06 +0000 (20:25 -0600)]
HLSL: Reverse what the driver is told about row/column majorness, matching the row-column reversal.
John Kessenich [Fri, 23 Sep 2016 23:31:31 +0000 (17:31 -0600)]
Merge pull request #519 from amdrexu/bugfix
SPV: Still have to specify SPIR-V extension for gl_SubGroupSizeARB and gl_SubGroupInvocationARB.
Rex Xu [Fri, 23 Sep 2016 14:13:43 +0000 (22:13 +0800)]
SPV: Still have to specify SPIR-V extension for gl_SubGroupSizeARB and gl_SubGroupInvocationARB.
John Kessenich [Fri, 23 Sep 2016 03:52:44 +0000 (21:52 -0600)]
Merge pull request #518 from steve-lunarg/flatten-fix
Fix defects in uniform array flattening
steve-lunarg [Thu, 22 Sep 2016 20:35:23 +0000 (14:35 -0600)]
Fix defects in uniform array flattening
Fix for two defects as follows:
- The IO mapping traverser was not setting inVisit, and would skip some AST nodes.
Depending on the order of nodes, this could have prevented the binding from
showing up in the generated SPIR-V.
- If a uniform array was flattened, each of the flattened scalars from the array
is still a (now-scalar) uniform. It was being converted to a temporary.
John Kessenich [Thu, 22 Sep 2016 16:54:18 +0000 (10:54 -0600)]
Merge pull request #516 from amdrexu/feature3
SPV: Implement the extension SPV_KHR_shader_ballot
John Kessenich [Thu, 22 Sep 2016 16:01:37 +0000 (10:01 -0600)]
HLSL: Merge pull request #515 from steve-lunarg/flatten-uniform-array
HLSL: Flatten uniform arrays
steve-lunarg [Fri, 16 Sep 2016 19:26:37 +0000 (13:26 -0600)]
Flatten uniform arrays
This checkin adds a --flatten-uniform-arrays option which can break
uniform arrays of samplers, textures, or UBOs up into individual
scalars named (e.g) myarray[0], myarray[1], etc. These appear as
individual linkage objects.
Code notes:
- shouldFlatten internally calls shouldFlattenIO, and shouldFlattenUniform,
but is the only flattening query directly called.
- flattenVariable will handle structs or arrays (but not yet arrayed structs;
this is tested an an error is generated).
- There's some error checking around unhandled situations. E.g, flattening
uniform arrays with initializer lists is not implemented.
- This piggybacks on as much of the existing mechanism for struct flattening
as it can. E.g, it uses the same flattenMap, and the same
flattenAccess() method.
- handleAssign() has been generalized to cope with either structs or arrays.
- Extended test infrastructure to test flattening ability.
Rex Xu [Wed, 21 Sep 2016 10:56:12 +0000 (18:56 +0800)]
SPV: Implement the extension SPV_KHR_shader_ballot
John Kessenich [Wed, 21 Sep 2016 23:50:12 +0000 (17:50 -0600)]
HLSL: Fix result type of passing a flattened-aggregate to a function.
John Kessenich [Wed, 21 Sep 2016 14:57:31 +0000 (08:57 -0600)]
Merge pull request #514 from steve-lunarg/binding-map-3
HLSL: Add location offsets per resource type
steve-lunarg [Wed, 7 Sep 2016 21:20:19 +0000 (15:20 -0600)]
HLSL: Add location offsets per resource type
This PR adds the ability to offset sampler, texture, and UBO bindings
from provided base bindings, and to auto-number bindings that are not
provided with explicit register numbers. The mechanism works as
follows:
- Offsets may be given on the command line for all stages, or
individually for one or more single stages, in which case the
offset will be auto-selected according to the stage being
compiled. There is also an API to set them. The new command line
options are --shift-sampler-binding, --shift-texture-binding, and
--shift-UBO-binding.
- Uniforms which are not given explicit bindings in the source code
are auto-numbered if and only if they are in live code as
determined by the algorithm used to build the reflection
database, and the --auto-map-bindings option is given. This auto-numbering
avoids using any binding slots which were explicitly provided in
the code, whether or not that explicit use was live. E.g, "uniform
Texture1D foo : register(t3);" with --shift-texture-binding 10 will
reserve binding 13, whether or not foo is used in live code.
- Shorter synonyms for the command line options are available. See
the --help output.
The testing infrastructure is slightly extended to allow use of the
binding offset API, and two new tests spv.register.(no)autoassign.frag are
added for comparing the resulting SPIR-V.
John Kessenich [Tue, 20 Sep 2016 19:22:58 +0000 (13:22 -0600)]
HLSL: Move to correct parsing of annotations, improving all annotations and recent string grammar.
John Kessenich [Tue, 20 Sep 2016 05:12:48 +0000 (23:12 -0600)]
HLSL: Turn on reflection, with basic test file, to catch regressions.
This is not a claim that reflection is working right, only a way to
see it is occurring and catch any regression.
John Kessenich [Tue, 20 Sep 2016 04:16:09 +0000 (22:16 -0600)]
HLSL: Remove extraneous built-in member decorations for IO structs used in non-IO situations.
John Kessenich [Tue, 20 Sep 2016 02:23:18 +0000 (20:23 -0600)]
HLSL: Add string basic type and recognize string declaration grammar.
This includes the "< decl ; decl ; >" syntax which has its own namespace.
This functionality is not implemented, just silently accepted.
John Kessenich [Tue, 20 Sep 2016 00:09:30 +0000 (18:09 -0600)]
Track separate entry-point names and mangled names...
... and use each in the correct way at consumption sites.
This completes issue #513.
John Kessenich [Mon, 19 Sep 2016 23:19:25 +0000 (17:19 -0600)]
Merge pull request #512 from steve-lunarg/liveness-traverser
Refactor TLiveTraverser from the former reflection traverser, for fut…
steve-lunarg [Mon, 19 Sep 2016 21:35:12 +0000 (15:35 -0600)]
Refactor TLiveTraverser from the former reflection traverser, for future use in binding mapping.
This PR factors out the code that knows how to walk just the live parts of the AST.
The traverser in reflect.cpp is renamed to TReflectionTraverser, and inherits from
TLiveTraverser, which will also be used by a future binding offset PR.
The code is now smart about the entry point name (no longer hardcoded to "main").
There is an option to traverse all code (live+dead), because a consumer of the
class may wish to use it for both purposes without wanting a whole separate
class hierarchy.
John Kessenich [Mon, 19 Sep 2016 22:01:41 +0000 (16:01 -0600)]
Non-functional: Sweep through the stack for consistent with "main" and entry point.
Partially addresses issue #513.
John Kessenich [Mon, 19 Sep 2016 20:56:55 +0000 (14:56 -0600)]
HLSL: Change the final syntax-error printf to go to the infoLog.
Fixes issue #510.
John Kessenich [Mon, 19 Sep 2016 06:19:49 +0000 (00:19 -0600)]
HLSL: Fix assert: ensure flattened shadow is EvqTemporary.
John Kessenich [Mon, 19 Sep 2016 06:06:19 +0000 (00:06 -0600)]
HLSL: Intercept flatten aggregates passed to a function input, and copy member-by-member.
John Kessenich [Mon, 19 Sep 2016 05:10:22 +0000 (23:10 -0600)]
HLSL: Non-functional; make flatten semantics be about aggregates, not just structures.
John Kessenich [Sat, 17 Sep 2016 03:16:04 +0000 (21:16 -0600)]
HLSL: Fix bug in previous checkin when non-flattened objects are not simple l-values.
John Kessenich [Sat, 17 Sep 2016 01:44:00 +0000 (19:44 -0600)]
HLSL: Handle flatten for reads from flatten structs and parameter passing.
John Kessenich [Fri, 16 Sep 2016 23:10:39 +0000 (17:10 -0600)]
HLSL: Improve setting and testing of interpolation qualifiers.
Notably, use of 'linear' on a non-input could mark it as an input.
John Kessenich [Fri, 16 Sep 2016 09:05:12 +0000 (03:05 -0600)]
HLSL: Flatten whole-struct assigns and returns when targeting flattened I/O structs.
John Kessenich [Fri, 16 Sep 2016 07:52:14 +0000 (01:52 -0600)]
HLSL: Flatten all input/output structs, regardless of stage.
This is needed because an output structure can contain embedded built-ins
(like SV_Position) which should not get locations assigned.
John Kessenich [Fri, 16 Sep 2016 07:44:43 +0000 (01:44 -0600)]
HLSL: Flatten a return struct from an entry point and assign locations after flattening.
Locations now get assigned in order, but skipping built-ins, which can be
done post flattening.
John Kessenich [Fri, 16 Sep 2016 04:49:31 +0000 (22:49 -0600)]
HLSL: return correct error when HLSL parsing fails.
At least partially addresses issue #510.
John Kessenich [Fri, 16 Sep 2016 04:41:37 +0000 (22:41 -0600)]
Merge pull request #508 from amdrexu/bugfix
SPV: Support simultaneous l-value swizzle and dynamic component selection.
Rex Xu [Wed, 14 Sep 2016 06:43:21 +0000 (14:43 +0800)]
SPV: Support simultaneous l-value swizzle and dynamic component selection.
John Kessenich [Mon, 12 Sep 2016 17:55:47 +0000 (11:55 -0600)]
HLSL: Register all entry-point in/out as part of the interface.
This makes the interface be invariant, whether or not individual
variables are used.
John Kessenich [Sun, 11 Sep 2016 18:33:43 +0000 (12:33 -0600)]
SPV: Fix issue #506: generalize struct deep copy to include arrays.
John Kessenich [Fri, 9 Sep 2016 22:32:09 +0000 (16:32 -0600)]
HLSL: Flatten vertex input and fragment output structures.
Vulkan can't handle structures into the vertex stage or out
of the fragment stage.
John Kessenich [Fri, 9 Sep 2016 20:00:27 +0000 (14:00 -0600)]
Merge pull request #505 from steve-lunarg/rowmajor-fix-2a
HLSL: alias HLSL matrix-row-column onto AST matrix-column-row
steve-lunarg [Wed, 24 Aug 2016 20:36:13 +0000 (14:36 -0600)]
WIP: HLSL: Treat HLSL rows as GLSL columns.
WIP: HLSL: EOpGenMul arg reversal
John Kessenich [Fri, 9 Sep 2016 17:43:11 +0000 (11:43 -0600)]
HLSL: Report an error if SPIR-V for Vulkan wasn't selected.
John Kessenich [Fri, 9 Sep 2016 16:46:43 +0000 (10:46 -0600)]
Merge branch 'amdrexu-bugfix2'
John Kessenich [Fri, 9 Sep 2016 16:46:10 +0000 (10:46 -0600)]
Merge branch 'bugfix2' of https://github.com/amdrexu/glslang into amdrexu-bugfix2
John Kessenich [Fri, 9 Sep 2016 16:41:16 +0000 (10:41 -0600)]
Merge pull request #503 from amdrexu/feature3
SPV: Use OpBitcast to implement 4 pack/unpack built-in functions.
Rex Xu [Fri, 9 Sep 2016 09:50:07 +0000 (17:50 +0800)]
SPV: Use OpBitcast to implement 4 pack/unpack built-in functions.
Rex Xu [Tue, 6 Sep 2016 05:46:12 +0000 (13:46 +0800)]
Preprocessor: UINT_MAX is translated to constant incorrectly.
John Kessenich [Mon, 5 Sep 2016 22:03:12 +0000 (16:03 -0600)]
HLSL: Support register(..., spaceN) for setting the descriptor set.
This was suggested in issue #454.
John Kessenich [Mon, 5 Sep 2016 20:37:03 +0000 (14:37 -0600)]
HLSL: Accept layout(...) also as a post-decl. Issue #454.
John Kessenich [Mon, 5 Sep 2016 18:40:06 +0000 (12:40 -0600)]
HLSL Non-Functional: Move to more robust capturing of postDecls into a qualifier.
This will prevent a possible future defect of thinking the type can be changed,
where there is a code path today that would drop that change.
John Kessenich [Mon, 5 Sep 2016 18:19:18 +0000 (12:19 -0600)]
HLSL: Track binding numbers to struct instances; fixes issue #496.