Commit Graph

692 Commits

Author SHA1 Message Date
steve-lunarg
a8456415b8 WIP: SPV Remapper: add remapper test framework 2016-08-25 10:46:51 -06:00
steve-lunarg
36e87d0871 HLSL: add precise keyword 2016-08-25 08:48:54 -06:00
John Kessenich
fcc0aa3b64 HLSL: Switch to generic selector, but using GLSL #version 400 rules.
Next step is to modify for HLSL rules.
2016-08-24 18:34:43 -06:00
John Kessenich
ab89bbe702 Merge branch 'overloaded-400' of github.com:KhronosGroup/glslang 2016-08-23 18:30:20 -06:00
John Kessenich
32c169dbdf Front-end: Warn for likely missed change in default precisions.
This is part of the change to have desktop shaders respect precision
qualifiers on Vulkan, but since the defaults are all highp, and that's
different from ES fragment shaders, detect likely cases and warn about
them (but being careful to not be too noisy if it's unlikely to be a
problem).
2016-08-23 18:13:08 -06:00
John Kessenich
54571c2519 Vulkan: Have desktop shaders respect precision qualifiers.
Sets highp defaults for the appropriate types, for all stages,
and turns on precision qualifiers for non-ES shaders.  Required
fixing some qualifier orders for desktop built-in declarations
for pre-420 shaders.
2016-08-23 18:12:25 -06:00
steve-lunarg
efe9724795 HLSL: Add EHTokStringConstant, so that string attributes may be parsed 2016-08-22 17:13:17 -06:00
John Kessenich
370234888d Front-end: Add a function selector under implicit type conversion.
Use the new function selector for #version 400 and above,
parameterized for the GLSL #version 400 selection rules.

This can be used for both GLSL and HLSL, and other languages
as well.
2016-08-21 14:26:27 -06:00
John Kessenich
b9e39120b4 HLSL: Partially address issue #463: accept GLSL layout(...).
This includes all "per variable" layout qualifiers, but the
key ones mattering and tested for now are:
  set=
  binding=
  constant_id=
  push_constant
2016-08-17 17:38:45 -06:00
Dan Baker
2c646b7afa Updating tests, sadly every single HLSL test needs updating becuase of the language identifier 2016-08-15 16:25:55 -04:00
steve-lunarg
61da5e41f7 HLSL: Put intrinsics in symbol table for all stages 2016-08-11 07:29:30 -06:00
steve-lunarg
c4a1307403 HLSL: add implicit promotions for assignments and function returns. 2016-08-09 13:48:47 -06:00
John Kessenich
426542ba57 Front-end: Fix issue #443: dvec3 uses only 2 components of second location. 2016-08-08 15:34:00 -06:00
John Kessenich
34177cd778 Tests: Test base case for fixing issue #443. 2016-08-08 15:29:25 -06:00
John Kessenich
4583b61e20 HLSL: Smear scalars to match vectors for relational operations.
Yield a vector relational compare and a vector result.
2016-08-07 19:14:22 -06:00
John Kessenich
bbd1b0ef76 Tests: Add some location-decoration tests, to aid PR #422. 2016-08-05 15:19:46 -06:00
John Kessenich
9f9bad09b4 PP: Add missing atoms that effect -E mode.
When preprocessing only, some tokens were emitted as <bad token>.
This fixes them to preserve their original content.

This supplants PR #182, with a correction and test results.
2016-08-04 22:46:19 -06:00
steve-lunarg
7dfcf4d1ad HLSL: Add GatherRed/Green/Blue/Alpha methods, inc 4-offset forms 2016-08-03 13:34:39 -06:00
steve-lunarg
cb88de5e5e HLSL: allow semicolons between global scope declarations. 2016-08-03 07:08:06 -06:00
John Kessenich
f6640761c4 Front-end: Implement 2nd task of issue #400; precision of result and operation.
From the ES spec + Bugzilla 15931 and GL_KHR_vulkan_glsl:
- Update precision qualifiers for all built-in function prototypes.
- Implement the new algorithm used to distinguish built-in function
  operation precisions from result precisions.
Also add tracking of separate result and operation precisions, and
use that in generating SPIR-V.
(SPIR-V cares about precision of operation, while the front-end
cares about precision of result, for propagation.)
2016-08-02 21:48:02 -06:00
John Kessenich
1176530bf5 SPV: Prevent issue #415 with better semantic checking. 2016-07-31 12:39:46 -06:00
John Kessenich
11e1a073f3 PP: Fix issue #407; handle empty identifier.
The sequence

  #define m()
  int m"

creates a token of no length (a string of 0 size).  Protect
against a string of 0 size as well as the existing protect
against a null string.
2016-07-30 13:39:52 -06:00
John Kessenich
7208473c69 PP: Non-functional; fix typos and blank spaces. 2016-07-30 13:25:33 -06:00
John Kessenich
73d4fb5bc5 PP: Fix issue #408: # as last character in macro.
This would look ahead for a second #, for token pasting, and if not
found, backup one token.  This is fine, unless at the end of line,
which would backup the #, rather than the look ahead.
2016-07-30 12:41:35 -06:00
steve-lunarg
fe5a3ff2f3 HLSL: allow trailing commas in initializer lists & scalar initialization 2016-07-30 10:47:33 -06:00
John Kessenich
b38f071605 HLSL: Add back in the [subcomponent] part of a 'register' decl. 2016-07-30 10:30:51 -06:00
steve-lunarg
5964c64b2a HLSL: Fix a grammar error related to constructors in parenthetical expressions 2016-07-30 08:09:09 -06:00
John Kessenich
ff13213547 Front-ends GLSL/HLSL: Fix initializer lists for structs of one member.
Single member structs initialized with an initializer list had
an incorrect argument for constructor emulation.
2016-07-29 18:29:06 -06:00
John Kessenich
96e9f47cbb HLSL: Implement the register production. 2016-07-29 14:28:39 -06:00
John Kessenich
82d6baf86f HLSL: Implement packoffset production. 2016-07-29 13:03:50 -06:00
John Kessenich
64076ed7e9 HLSL: Fix binary-expression associativity and termination issue. 2016-07-28 21:48:25 -06:00
John Kessenich
fea226ba43 HLSL: Add shape conversions for scalar -> vector assigments.
Also, this allows turning on the error check for a failed assigment
when parsing.

This makes 39 HLSL tests have a working assignment that was previously
silently dropped, due to lack of this functionality.
2016-07-28 18:41:20 -06:00
John Kessenich
c552aece83 Merge pull request #417 from steve-lunarg/buffers
HLSL: add Buffer support for Load method
2016-07-28 16:56:39 -06:00
John Kessenich
c21badf2a1 Merge pull request #419 from steve-lunarg/lerp-fix
HLSL: add missing vec,vec,scalar form of lerp(), + test
2016-07-28 16:56:25 -06:00
steve-lunarg
2de329112b HLSL: allow uint literals, and add test for numeric suffixes 2016-07-28 14:49:48 -06:00
steve-lunarg
cf57c04401 HLSL: add missing vec,vec,scalar form of lerp(), + test 2016-07-28 13:23:22 -06:00
steve-lunarg
d53f717fd3 HLSL: add Buffer support for Load method 2016-07-27 15:57:31 -06:00
John Kessenich
414f735443 Front-end: Fix issue #409, check for implicitly-sized binding arrays. 2016-07-27 14:55:06 -06:00
steve-lunarg
68f2c144e3 HLSL: Add CalculateLevelOfDetail, and unimplemented errors for *Unclamped and GetSamplePosition 2016-07-27 10:46:33 -06:00
John Kessenich
00957f8110 HLSL: Implement ?: grammar productions.
Missing are implicit conversions between int/bool/etc.
2016-07-27 10:39:57 -06:00
steve-lunarg
1e19d90043 HLSL: add 2DMS texture formats, and matching Load / GetDimensions support 2016-07-27 07:37:21 -06:00
John Kessenich
8c8505c604 SPV: For AST interpolateAt* ops consuming a swizzle, invert the order.
Apply the interpolation first, then apply the swizzle to the result,
the inverse of the order requested by the AST.  This fixes issue #411.
2016-07-26 12:53:54 -06:00
John Kessenich
731cd83ef6 Merge pull request #405 from steve-lunarg/samplers
HLSL: Add gather, improve proto generator machine for upcoming 2DMS/S…
2016-07-26 09:40:46 -06:00
John Kessenich
64723c20b5 Merge pull request #406 from steve-lunarg/pp_line
HLSL: enable #line extension by default for HLSL source.
2016-07-26 09:39:48 -06:00
John Kessenich
3d157c510f HLSL: cbuffer and tbuffer grammar and production. 2016-07-25 16:05:33 -06:00
LoopDawg
6256146ef3 HLSL: enable #line extension by default for HLSL source. 2016-07-23 10:45:00 -06:00
LoopDawg
a2f3d285a8 HLSL: Add gather, improve proto generator machine for upcoming 2DMS/Shadow 2016-07-22 12:46:11 -06:00
John Kessenich
630e1bc636 Merge pull request #402 from steve-lunarg/samplers
HLSL: Add SampleLevel method
2016-07-21 15:47:27 -06:00
John Kessenich
c8f6903b1d Front-end: Fix default layout(component) widths and correct for doubles.
Replaces PR #372.
2016-07-21 15:43:00 -06:00
John Kessenich
5c08ecb419 Tests: line-number change only: make room for more component tests. 2016-07-21 15:39:23 -06:00