Commit Graph

1766 Commits

Author SHA1 Message Date
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
John Kessenich
21e7e32126 HLSL: Fix merge conflict. 2016-09-29 10:27:57 -06:00
John Kessenich
4e55988a47 HLSL Tests: Tests for previous commit, to make it easier to see what's changing. 2016-09-29 10:25:15 -06:00
John Kessenich
6dbc0a7a33 Support a uniform block to hold global uniform variables.
Used initially just by HLSL, for $Global.  Could be an option
for GLSL -> Vulkan.
2016-09-29 10:25:15 -06:00
John Kessenich
e82061de08 HLSL: Rationalize combination of type arrayness and name arrayness. 2016-09-29 10:25:15 -06:00
John Kessenich
b1672fa0de Merge pull request #525 from steve-lunarg/implicit-size
HLSL: allow implicit size in array declarations
2016-09-27 23:15:22 -06:00
steve-lunarg
265c0618b1 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.
2016-09-27 14:28:26 -06:00
John Kessenich
16a99a3804 Merge pull request #524 from DominikWitczakAMD/517_include_amd_extensions_by_default
#517: Enable AMD extensions by default
2016-09-27 09:48:38 -06:00
Maciej Jesionowski
04b3e8746f SPV: PrimitiveId in frag shader will emit Geometry capability
Using PrimitiveId in a fragment shader requires declaring
an OpCapability with either Geometry or Tessellation.
2016-09-27 10:35:09 +02:00
Dominik Witczak
daff1a2523 #517: Enable AMD extensions by default 2016-09-27 10:30:14 +02:00
John Kessenich
5fc501ff07 Merge pull request #520 from amdrexu/bugfix
SPV: OpGroupBroadcast is unable to handle vector operand.
2016-09-26 17:45:25 -06:00
John Kessenich
f38978edb6 Merge pull request #522 from steve-lunarg/glsl-binding-test
GLSL: Add IO map tests
2016-09-26 17:40:17 -06:00
steve-lunarg
ad0752e8fa 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.
2016-09-26 17:02:44 -06:00
Rex Xu
b707205b0d SPV: OpGroupBroadcast is unable to handle vector operand. 2016-09-26 15:53:40 +08:00
John Kessenich
10f7fc739c HLSL: Reverse what the driver is told about row/column majorness, matching the row-column reversal. 2016-09-25 20:26:03 -06:00
John Kessenich
88712f1a21 Merge pull request #519 from amdrexu/bugfix
SPV: Still have to specify SPIR-V extension for gl_SubGroupSizeARB and gl_SubGroupInvocationARB.
2016-09-23 17:31:31 -06:00