Commit Graph

1731 Commits

Author SHA1 Message Date
baldurk
75c3bf68e9 Add strtoull wrapper for VS2010, pointing to MS implementation 2016-10-13 19:24:23 +02:00
baldurk
54a28de4a9 Give all complex lambdas an explicit return type 2016-10-13 19:23:39 +02:00
steve-lunarg
b3da8a9cb3 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
2016-10-12 12:39:44 -06:00
steve-lunarg
07830e805b 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.
2016-10-12 12:39:44 -06:00
steve-lunarg
0de16da2c0 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.
2016-10-12 12:39:44 -06:00
steve-lunarg
90707966ea 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]++++;
2016-10-12 12:39:44 -06:00
steve-lunarg
6b43d274e7 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
2016-10-12 12:39:44 -06:00
John Kessenich
e3aa654c4b Merge pull request #546 from yavn/OpImageQueryLod-with-SampledImage
SPV: Use SampledImage with OpImageQueryLod
2016-10-12 09:05:07 -06:00
Maciej Jesionowski
7208a974aa SPV: Use SampledImage with OpImageQueryLod
Khronos SPIR-V issue #74
2016-10-12 16:16:24 +02:00
John Kessenich
631f223b1b Merge pull request #543 from slime73/compilerwarnings
Address some compiler warnings.
2016-10-11 15:31:31 -06:00
Alex Szpakowski
f887785990 fixup! Address some compiler warnings. 2016-10-11 16:16:47 -03:00
John Kessenich
6d6b19dc5f Merge pull request #544 from amdrexu/feature
SPV: Implement extension SPV_KHR_shader_draw_parameters.
2016-10-11 09:29:30 -06:00
Rex Xu
f3b27471f8 SPV: Implement extension SPV_KHR_shader_draw_parameters. 2016-10-11 14:40:35 +08:00
John Kessenich
dd2fc1f3d8 Merge pull request #545 from amdrexu/bugfix
Parser: Some function prototypes of interpolateAtXXX are incorrect.
2016-10-10 09:43:30 -06:00
Rex Xu
4c25709f45 Parser: Some function prototypes of interpolateAtXXX are incorrect. 2016-10-10 16:55:04 +08:00
Alex Szpakowski
49ad2b72a1 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.
2016-10-08 22:07:20 -03:00
John Kessenich
19bdf90eba SPV: Distinguish between SPV and non-SPV rules for member overlap. 2016-10-07 11:50:25 -06:00
John Kessenich
087a454af2 HLSL: Add shape conversions for return values. 2016-10-06 16:56:54 -06:00
John Kessenich
ed33e05762 HLSL: Do structure conversion for return type struct-punning on non-entry-point functions. 2016-10-06 13:06:13 -06:00
John Kessenich
7a7217c81b Merge pull request #540 from steve-lunarg/rwbuffers
HLSL: phase 1: add RWTexture and RWBuffer
2016-10-06 11:47:37 -06:00
steve-lunarg
bb0183f817 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.
2016-10-06 10:51:52 -06:00
Josh Gargus
87a83d6841 Use pthread_mutex for global lock on Linux. 2016-10-05 18:32:51 -07:00
John Kessenich
9065ed83b8 Merge pull request #537 from dneto0/pass-cwd-to-gtest
Gtests can be run on another source tree
2016-10-05 13:57:22 -06:00
steve-lunarg
9ae34742cf Check for out-of-range bindings during IO mapping. 2016-10-05 13:42:42 -06:00
John Kessenich
c056adcddd Allow for larger binding numbers. 65K instead of 255. 2016-10-05 12:31:24 -06:00
David Neto
1d3a966106 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.
2016-10-05 10:28:32 -04:00
John Kessenich
196b6e24f6 Merge pull request #536 from steve-lunarg/flatten-assign-fix
HLSL: fix for flattening assignments from non-symbol R-values.
2016-10-04 19:45:18 -06:00
steve-lunarg
2199c2404b 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.
2016-10-04 17:07:45 -06:00
John Kessenich
ce5d4afc7f Merge pull request #533 from steve-lunarg/reflection
add reflection queries to return a TType.  Fix minor issue with inter…
2016-10-03 13:57:32 -06:00
steve-lunarg
8ffc36aecc 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.
2016-10-02 16:57:58 -06:00
John Kessenich
de97fe0ad4 Non-functional: Rationalizing parse helper hierarchy, step 3 (effected editable symbols and IO resize). 2016-10-01 18:44:38 -06:00
John Kessenich
a2a5dd474e Non-functional: Rationalizing parse helper hierarchy, step 2 (effected error messaging and cascading errors). 2016-10-01 18:07:57 -06:00
John Kessenich
273060c2d3 Non-functional: Rationalizing parse helper hierarchy, step 1 (effected memory of HLSL keyword map). 2016-10-01 17:47:40 -06:00
John Kessenich
a08c929d8e HLSL: Line numbers only: Set locations (line numbers) on synthesized flattening code. 2016-10-01 17:17:55 -06:00
John Kessenich
d8fe2ca8e5 HLSL: Handle flattened I/O structs passed to function *out* parameters. 2016-10-01 17:11:21 -06:00
John Kessenich
c86d38bb2b Non-functional: Better use of .isParamOutput() and some other methods. 2016-10-01 13:30:37 -06:00
John Kessenich
ba56e23e8a Fix typo in error message. 2016-10-01 12:36:19 -06:00
John Kessenich
f571d0c037 Non-functional: Use isOpaque() instead of compare against EbtSampler. 2016-10-01 12:35:01 -06:00
John Kessenich
47e6fa1cad Merge pull request #532 from steve-lunarg/automap-offsets
Change binding auto-map to use provided offsets.
2016-10-01 12:00:51 -06:00
steve-lunarg
088c59d7ea 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.
2016-10-01 11:40:43 -06:00
John Kessenich
d4f48b8a5a Merge pull request #527 from steve-lunarg/array-flattening-fix
HLSL: Restrict uniform array flattening to sampler and texture arrays
2016-10-01 11:40:27 -06:00
John Kessenich
074ced3e00 Merge pull request #521 from yavn/frag-shader-primitive-id-capability
SPV: PrimitiveId in frag shader will emit OpCapability
2016-10-01 11:38:18 -06:00
John Kessenich
a6f3b416de Merge pull request #531 from steve-lunarg/add-autobinding-test
HLSL: Add a test for buffer auto-binding assignment.
2016-10-01 11:37:09 -06:00
steve-lunarg
e4fe8b5c44 Add a test for buffer auto-binding assignment. 2016-09-30 14:26:34 -06:00
John Kessenich
3e47f5f7c8 Merge pull request #523 from amdrexu/feature2
Parser: Implement extension GL_AMD_gpu_shader_half_float.
2016-09-30 09:54:17 -06:00
Rex Xu
c9e3c3c941 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.
2016-09-30 16:13:06 +08:00
John Kessenich
df98cc26d5 Add amend ability for anonymous blocks, so they can grow between function bodies. 2016-09-29 23:59:26 -06:00
John Kessenich
16738a3632 Merge pull request #530 from annygakh/master
Updated README.md
2016-09-29 17:39:01 -06:00
Anny
0b3b6e17bd Updated README.md
Added an alternative link for cloning the repo in the build instructions
2016-09-29 16:29:58 -07:00
steve-lunarg
bc9b7656b7 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).
2016-09-29 14:01:25 -06:00