John Kessenich [Sat, 3 Dec 2016 20:29:46 +0000 (13:29 -0700)]
Merge branch 'steve-lunarg-intrinsic-promotion'
John Kessenich [Sat, 3 Dec 2016 20:27:22 +0000 (13:27 -0700)]
Merge branch 'intrinsic-promotion' of https://github.com/steve-lunarg/glslang into steve-lunarg-intrinsic-promotion
John Kessenich [Fri, 2 Dec 2016 06:47:49 +0000 (23:47 -0700)]
Merge pull request #604 from steve-lunarg/entry-rename-2
HLSL: allow renaming of shader entry point when creating SPIR-V
steve-lunarg [Mon, 31 Oct 2016 21:13:43 +0000 (15:13 -0600)]
allow renaming of shader entry point when creating SPIR-V
Use "--source-entrypoint name" on the command line, or the
TShader::setSourceEntryPoint(char*) API.
When the name given to the above interfaces is detected in the
shader source, it will be renamed to the entry point name supplied
to the -e option or the TShader::setEntryPoint() method.
John Kessenich [Mon, 28 Nov 2016 06:00:14 +0000 (23:00 -0700)]
Fix non-Windows build error.
John Kessenich [Mon, 28 Nov 2016 05:51:36 +0000 (22:51 -0700)]
HLSL: Support the constructor idiom "(struct type)0".
This highly leverages the previous commit to handle partial initializers.
John Kessenich [Mon, 28 Nov 2016 00:39:07 +0000 (17:39 -0700)]
HLSL: Support {...} initializer lists that are too short.
John Kessenich [Mon, 28 Nov 2016 00:32:19 +0000 (17:32 -0700)]
Fix crash by returning early from finalCheck() if there is no tree to process.
John Kessenich [Mon, 28 Nov 2016 00:30:14 +0000 (17:30 -0700)]
Non-functional: Change a bunch of 0 to nullptr.
John Kessenich [Mon, 28 Nov 2016 00:26:21 +0000 (17:26 -0700)]
Non-functional: Fix typos.
John Kessenich [Sat, 26 Nov 2016 20:45:18 +0000 (13:45 -0700)]
Warn on HLSL not finding entry point. Issue #588.
John Kessenich [Sat, 26 Nov 2016 20:31:47 +0000 (13:31 -0700)]
Non-functional: Rename some entry-point variables to entryPoint, not main.
John Kessenich [Sat, 26 Nov 2016 20:23:20 +0000 (13:23 -0700)]
Always correctly terminate main. Issue #588, PR #600.
steve-lunarg [Wed, 2 Nov 2016 18:42:34 +0000 (12:42 -0600)]
HLSL: add intrinsic function implicit promotions
This PR handles implicit promotions for intrinsics when there is no exact match,
such as for example clamp(int, bool, float). In this case the int and bool will
be promoted to a float, and the clamp(float, float, float) form used.
These promotions can be mixed with shape conversions, e.g, clamp(int, bool2, float2).
Output conversions are handled either via the existing addOutputArgumentConversion
function, which this PR generalizes to handle either aggregates or unaries, or by
intrinsic decomposition. If there are methods or intrinsics to be decomposed,
then decomposition is responsible for any output conversions, which turns out to
happen automatically in all current cases. This can be revisited once inout
conversions are in place.
Some cases of actual ambiguity were fixed in several tests, e.g, spv.register.autoassign.*
Some intrinsics with only uint versions were expanded to signed ints natively, where the
underlying AST and SPIR-V supports that. E.g, countbits. This avoids extraneous
conversion nodes.
A new function promoteAggregate is added, and used by findFunction. This is essentially
a generalization of the "promote 1st or 2nd arg" algorithm in promoteBinary.
The actual selection proceeds in three steps, as described in the comments in
hlslParseContext::findFunction:
1. Attempt an exact match. If found, use it.
2. If not, obtain the operator from step 1, and promote arguments.
3. Re-select the intrinsic overload from the results of step 2.
John Kessenich [Wed, 23 Nov 2016 07:38:32 +0000 (00:38 -0700)]
Merge pull request #601 from BearishSun/master
A way to query "location" qualifier for vertex attributes, using TProgram reflection API
John Kessenich [Wed, 23 Nov 2016 07:29:30 +0000 (00:29 -0700)]
Merge pull request #599 from steve-lunarg/gs
HLSL: Add GS support
John Kessenich [Wed, 23 Nov 2016 07:19:40 +0000 (00:19 -0700)]
Merge pull request #596 from steve-lunarg/hlsl-intrinsic-parsing
HLSL: use HLSL parser for HLSL intrinsic prototypes, enable int/bool mats
John Kessenich [Wed, 23 Nov 2016 06:33:40 +0000 (23:33 -0700)]
Merge pull request #597 from steve-lunarg/sample-keyword-fix
HLSL: allow "sample" as a valid identifier.
BearishSun [Tue, 22 Nov 2016 08:53:04 +0000 (09:53 +0100)]
Adding a way to retrieve vertex attribute TType using TProgram reflection API (required in order to query location attributes).
steve-lunarg [Thu, 17 Nov 2016 22:04:20 +0000 (15:04 -0700)]
WIP: HLSL: Add GS support
This PR adds:
[maxvertexcount(n)] attributes
point/line/triangle/lineadj/triangleadj qualifiers
PointStream/LineStream/TriangleStream templatized types
Append method on above template types
RestartStrip method on above template types.
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
steve-lunarg [Tue, 15 Nov 2016 17:11:04 +0000 (10:11 -0700)]
HLSL: use HLSL parser to parse HLSL intrinsic prototypes, enable int/bool mats
This PR adds a CreateParseContext() fn analogous to CreateBuiltInParseables(),
to create a language specific built in parser. (This code was present before
but not encapsualted in a fn). This can now be used to create a source language
specific parser for builtins.
Along with this, the code creating HLSL intrinsic prototypes can now produce
them in HLSL syntax, rather than GLSL syntax. This relaxes certain prior
restrictions at the parser level. Lower layers (e.g, SPIR-V) may still have
such restrictions, such as around Nx1 matrices: this code does not impact
that.
This PR also fleshes out matrix types for bools and ints, both of which were
partially in place before. This was easier than maintaining the restrictions
in the HLSL prototype generator to avoid creating protoypes with those types.
Many tests change because the result type from intrinsics moves from "global"
to "temp".
Several new tests are added for the new types.
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.
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
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.
chrgau01@arm.com [Mon, 14 Nov 2016 09:10:05 +0000 (10:10 +0100)]
GLSL: The execution scope for barriers should be Workgroup.
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.
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
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().
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
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).
Jamie Madill [Wed, 9 Nov 2016 18:49:24 +0000 (13:49 -0500)]
Fix unrefenced variable warning with AMD_EXTENSIONS disabled.
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.
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.
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
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.
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
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
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
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
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.
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
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.
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
baldurk [Fri, 28 Oct 2016 15:57:25 +0000 (17:57 +0200)]
Add explicit lambda return types, for compilers without C++14 support
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
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
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 &&.
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
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
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.
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.
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.
steve-lunarg [Fri, 21 Oct 2016 05:56:45 +0000 (23:56 -0600)]
WIP: avoid strtok
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.
Johannes van Waveren [Fri, 21 Oct 2016 08:30:50 +0000 (17:30 +0900)]
update
Johannes van Waveren [Fri, 21 Oct 2016 08:21:46 +0000 (17:21 +0900)]
Merge remote-tracking branch 'upstream/master'
Johannes van Waveren [Fri, 21 Oct 2016 08:21:12 +0000 (17:21 +0900)]
fixed MSVC 2015 compile warnings
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
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
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
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
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.
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.
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.
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.
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.
John Kessenich [Sun, 16 Oct 2016 18:22:20 +0000 (12:22 -0600)]
HLSL: Turn on tests for groupshared.
John Kessenich [Sun, 16 Oct 2016 18:12:11 +0000 (12:12 -0600)]
HLSL: Support SV_Coverage and SV_DispatchThreadId; catch SV_GroupIndex.
John Kessenich [Sun, 16 Oct 2016 17:50:46 +0000 (11:50 -0600)]
Build: Fix unsigned/signed warning.
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
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
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.
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.
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
Josh Gargus [Sat, 15 Oct 2016 22:19:59 +0000 (15:19 -0700)]
Use a recursive mutex.
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.
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.
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.
Rex Xu [Fri, 14 Oct 2016 09:41:45 +0000 (17:41 +0800)]
SPV: Add missing extension declarations for certain AMD extensions.
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[]
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.
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.
baldurk [Thu, 13 Oct 2016 18:05:13 +0000 (20:05 +0200)]
Update HexFloat tests to use non-enum class enum values
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.
baldurk [Thu, 13 Oct 2016 17:32:37 +0000 (19:32 +0200)]
Change {} constructor brackets to ()
baldurk [Thu, 13 Oct 2016 17:31:15 +0000 (19:31 +0200)]
Change "using x = y;" to "typedef y x;" statements
baldurk [Thu, 13 Oct 2016 17:30:27 +0000 (19:30 +0200)]
Explicitly implement default constructors
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
baldurk [Thu, 13 Oct 2016 17:28:20 +0000 (19:28 +0200)]
Change enum class to plain enum
baldurk [Thu, 13 Oct 2016 17:25:52 +0000 (19:25 +0200)]
Change constructor to use ()s instead of {}s
baldurk [Thu, 13 Oct 2016 17:24:42 +0000 (19:24 +0200)]
Add #include <cstdint> for std::uint32_t usage
baldurk [Thu, 13 Oct 2016 17:24:23 +0000 (19:24 +0200)]
Add strtoull wrapper for VS2010, pointing to MS implementation
baldurk [Thu, 13 Oct 2016 17:23:39 +0000 (19:23 +0200)]
Give all complex lambdas an explicit return type
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
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.
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.
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]++++;
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
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