Commit Graph

931 Commits

Author SHA1 Message Date
John Kessenich
2572b19e94 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.
2016-09-19 23:12:48 -06:00
John Kessenich
6b71c400f8 HLSL: Remove extraneous built-in member decorations for IO structs used in non-IO situations. 2016-09-19 22:16:09 -06:00
John Kessenich
86f7138706 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.
2016-09-19 20:29:45 -06:00
John Kessenich
6fccb3cd75 Non-functional: Sweep through the stack for consistent with "main" and entry point.
Partially addresses issue #513.
2016-09-19 16:01:41 -06:00
John Kessenich
28b28140bb HLSL: Fix assert: ensure flattened shadow is EvqTemporary. 2016-09-19 00:19:49 -06:00
John Kessenich
5159d4f1af HLSL: Intercept flatten aggregates passed to a function input, and copy member-by-member. 2016-09-19 00:06:19 -06:00
John Kessenich
d2ce838a58 HLSL: Handle flatten for reads from flatten structs and parameter passing. 2016-09-16 20:24:14 -06:00
John Kessenich
34e7ee79bb HLSL: Improve setting and testing of interpolation qualifiers.
Notably, use of 'linear' on a non-input could mark it as an input.
2016-09-16 18:05:44 -06:00
John Kessenich
d21baed6bc HLSL: Flatten whole-struct assigns and returns when targeting flattened I/O structs. 2016-09-16 03:20:03 -06:00
John Kessenich
f8e494c18c 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.
2016-09-16 01:52:14 -06:00
John Kessenich
7dc630f3da 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.
2016-09-16 01:44:43 -06:00
Rex Xu
64b9743ce0 SPV: Support simultaneous l-value swizzle and dynamic component selection. 2016-09-14 14:43:55 +08:00
John Kessenich
deb4940c17 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.
2016-09-12 11:55:47 -06:00
John Kessenich
b3e24e4359 SPV: Fix issue #506: generalize struct deep copy to include arrays. 2016-09-11 12:33:43 -06:00
John Kessenich
cd0a78a0d9 HLSL: Flatten vertex input and fragment output structures.
Vulkan can't handle structures into the vertex stage or out
of the fragment stage.
2016-09-10 11:09:24 -06:00
steve-lunarg
297ae211f1 WIP: HLSL: Treat HLSL rows as GLSL columns.
WIP: HLSL: EOpGenMul arg reversal
2016-09-09 12:02:42 -06:00
John Kessenich
4bfb32e17b Merge branch 'bugfix2' of https://github.com/amdrexu/glslang into amdrexu-bugfix2 2016-09-09 10:46:10 -06:00
Rex Xu
c9f349234f SPV: Use OpBitcast to implement 4 pack/unpack built-in functions. 2016-09-09 17:50:07 +08:00
Rex Xu
99c4dd16db Preprocessor: UINT_MAX is translated to constant incorrectly. 2016-09-09 17:06:15 +08:00
John Kessenich
cfd7ce87cd HLSL: Support register(..., spaceN) for setting the descriptor set.
This was suggested in issue #454.
2016-09-05 16:03:45 -06:00
John Kessenich
e3218e270e HLSL: Accept layout(...) also as a post-decl. Issue #454. 2016-09-05 14:37:03 -06:00
John Kessenich
b804de605c HLSL: Track binding numbers to struct instances; fixes issue #496. 2016-09-05 12:19:18 -06:00
Rex Xu
64bcfdb632 Parser: Add 64-bit type conversion for specialization constant. 2016-09-05 22:20:28 +08:00
John Kessenich
7d01bd6f0b HLSL: Handle swizzles on vectors of size 1. Addresses issue #453. 2016-09-02 22:21:25 -06:00
John Kessenich
841db35bb3 HLSL: Fix issue #442, smear and truncate shape conversions for == and !=. 2016-09-02 21:12:23 -06:00
John Kessenich
07350f3382 HLSL: Handle "fake" entry points, by undoing their built-in variable declarations. 2016-09-02 20:24:07 -06:00
John Kessenich
9e079535a0 HLSL: Handle greater/less depth modes. Fixes issue #489. 2016-09-02 20:05:52 -06:00
John Kessenich
a305166ea4 HLSL: Error if funcion with return type doesn't return a value. 2016-09-02 19:13:36 -06:00
John Kessenich
1a4b775cd5 HLSL: Correct line numbers for function definitions. 2016-09-02 19:05:24 -06:00
John Kessenich
4bf7155051 SPV: Flatten structs for copy when they are GLSL type aliases.
Addresses issue #304 and issue #307 by replacing unmatched type OpStores with
per-member copies. Covers assignment statements and most argument passing, but
does not yet cover r-value-based argument passing.
2016-09-02 16:35:01 -06:00
John Kessenich
f2b7f3353b SPV: Tighten up number of struct-types declared based on decoration.
Takes some pressure off of issue #304.
Structures don't inherit locations and then explicitly decorate
members with them, so removed this reason to have another instance
of a structure type.
2016-09-01 17:05:23 -06:00
John Kessenich
5e56423046 Front-ends: Remove now defunct afterEOF and related, use scanner's instead.
Code using atEndOfFile was dead, instead do something useful with
the scanners atEndOfInput().  This allows a better error message
for early termination of cascading errors.
2016-08-31 13:46:50 -06:00
John Kessenich
830b0cc98b HLSL: Start location numbering with the entry-point return value.
Also, increment location numbers by the size of the objects.
2016-08-29 18:10:47 -06:00
John Kessenich
a05d8b5604 HLSL: Remove recent change to put locations on SV_TARGET*.
This put locations on members of structures, which is not allowed
in either AST or SPIR-V.

This was caught by asserts in the debug build.
2016-08-29 16:49:39 -06:00
John Kessenich
510d83b384 HLSL: Create test results for the previous commits. 2016-08-29 16:34:12 -06:00
John Kessenich
6a70eb7161 HLSL: Emulate write-to-output on return-from-entry-point, for return value.
This fixes issue #487 and #480.
It also correctly handles output parameters from the entry point.
2016-08-28 20:13:07 -06:00
John Kessenich
f00c245a5f Merge pull request #473 from steve-lunarg/remapper-tests
SPV Remapper: add remapper test framework
2016-08-26 11:32:54 -06:00
John Kessenich
e3f2c8f98a HLSL: Include shape-changing conversions in overloaded signature selection.
This also enables vecN -> vec1 shape conversions for all places doing shape
conversions.

For signature selection, makes shape changes worse than any other comparison
when deciding what conversions are better than others.
2016-08-25 23:57:39 -06:00
John Kessenich
90dd70f752 HLSL: Allow arbitrary baseType -> baseType conversion of calling arguments.
This also puts a stake in the ground as to which is better when selection
from multiple signatures.
2016-08-25 10:51:29 -06:00
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
LoopDawg
3ef7852ef6 HLSL: Add SampleLevel method 2016-07-21 15:02:30 -06:00
LoopDawg
f245101954 HLSL: Add texture Load method & decomposition 2016-07-21 09:42:35 -06:00
LoopDawg
a78b02941b HLSL: Add SampleCmp and SampleCmpLevelZero texture methods 2016-07-20 09:57:03 -06:00
John Kessenich
934855a642 Fix issue #382: Detect implicitly-sized atomic_uint arrays. 2016-07-19 15:50:58 -06:00
John Kessenich
f2cfe27021 Fix issue #388.
Protect more against error recovery of bad built-in variable redeclarations.
2016-07-19 15:13:47 -06:00
John Kessenich
31a51becd2 Fix issue #391: input stack underflow on too few macro arguments. 2016-07-19 14:32:52 -06:00
LoopDawg
5d58faecc0 HLSL: Add tx.GetDimensions method (uint returns only) 2016-07-18 16:40:21 -06:00
LoopDawg
a2b7991497 HLSL: Add SampleBias and SampleGrad, and associated tests 2016-07-15 11:38:49 -06:00
John Kessenich
51e74b17bf Merge pull request #385 from steve-lunarg/inout-qualifiers
HLSL: add in/out/inout qualifiers
2016-07-13 15:42:48 -06:00
LoopDawg
92aff54632 HLSL: add offset Sample() form and arrayed texture support 2016-07-13 11:58:56 -06:00
LoopDawg
9249c709b0 HLSL: add in/out/inout qualifiers. 2016-07-12 20:50:34 -06:00
LoopDawg
4886f69734 HLSL: Sampler/texture declarations, method syntax, partial Sample method 2016-07-12 15:57:46 -06:00
John Kessenich
d8509b3367 Front-end: Implement compile-time constant folding for any() and all(). 2016-07-12 01:27:48 -06:00
John Kessenich
a86836ede2 Front-end: Fix known crashes by early exit on error (issue #29, issue #34, issue #35).
Added -C option to request cascading errors.  By default, will exit early,
to avoid all error-recovery-based crashes.

This works by simulating end-of-file in input on first error, so no
need for exception handling, or stack unwinding, or any complex error
checking/handling to get out of the stack.
2016-07-09 14:53:11 -06:00
John Kessenich
b501a7501c Front end: Fix issue #374: put a limit on how big a type name can get. 2016-07-08 14:49:48 -06:00
John Kessenich
78a4557621 SPV: Fix issue #376; declare Geometry capability for fragment use of gl_Layer. 2016-07-08 14:05:15 -06:00
John Kessenich
91e4aa5900 SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.
Includes adding test cases to verify the differences.
2016-07-07 19:27:15 -06:00
John Kessenich
2d0cc786f3 SPV: Turn on atomic-storage functionality for SPIR-V.
This is used by OpenGL, but not Vulkan.
Includes:
 - atomicCounter, atomicIncrement, atomicCounterDecrement
 - atomic_uint layout-offset checking
 - AtomicStorage capability
2016-07-07 17:40:35 -06:00
John Kessenich
5e69ec683d HLSL: Add typedef grammar and production. 2016-07-05 00:02:40 -06:00
John Kessenich
d5ed0b6982 HLSL: Mostly non-functional: simplify, rationalize, and generalize the declaration grammar. 2016-07-04 18:35:51 -06:00
John Kessenich
073542416c HLSL: Grammar: Recognize { } style initializers for composites. 2016-07-01 19:58:06 -06:00
John Kessenich
b0a63f578a HLSL: Correctly identify which variables are global storage class. 2016-07-01 19:35:53 -06:00
John Kessenich
532543c1c4 HLSL: Grammar: Make comma-separated declaration lists work. 2016-07-01 19:10:01 -06:00
LoopDawg
6daaa4fadf HLSL: Add template style constructors for vector & matrix types 2016-07-01 13:59:36 -06:00
John Kessenich
d02dc5d05a HLSL: Implement switch/case/default. 2016-07-01 00:04:11 -06:00
John Kessenich
2f47bc9781 SPV: Don't decorate locations within an array, it doesn't make sense.
This fixes issue #360.
2016-06-30 22:00:09 -06:00
John Kessenich
f5dcdf0123 Front-end: Don't lower precision of bit operations taking highp inputs.
See issue #350 for detail.  This may be an ESSL specification issue.
2016-06-30 16:46:24 -06:00
LoopDawg
e903ab5f04 HLSL: Change intrinsics tests to not use overloaded entry points 2016-06-30 14:13:03 -06:00
Rex Xu
c884b4a47f SPV: Certain decorations are missing for structure-typed in/out variables. 2016-06-30 13:11:36 +08:00
John Kessenich
187254b92c Merge pull request #357 from steve-lunarg/intrinsics
HLSL: Add asdouble, fma, & mad intrinsics
2016-06-29 10:50:33 -06:00
John Kessenich
7c8b743599 Merge pull request #267 from antiagainst/rm-test-dup
Remove duplicated tests from the runtests script.
2016-06-29 10:47:47 -06:00
John Kessenich
bc17b0a96a Front-end: Add missing rule for function-return implicit type conversion check.
Basic (component) type conversion was done, but checking that the composite
was correct was not being done.

Fixes issue #353.
2016-06-28 23:56:31 -06:00
Lei Zhang
48e296b18c Remove duplicated tests from the runtests script. 2016-06-28 17:54:07 -04:00
LoopDawg
1b7fd0f7b7 Add asdouble, fma, & mad intrinsics and change profile to allow doubles when parsing prototypes 2016-06-28 15:38:38 -06:00
John Kessenich
e5a807276f Merge pull request #349 from steve-lunarg/intrinsics
HLSL: Add lerp, fix sincos ret, add ret type tests, non-square mats, tx semantics
2016-06-28 15:34:11 -06:00
John Kessenich
22bca551a8 Merge pull request #354 from yavn/fix_off_by_one_limit_check
Front-end: allow max size built-in arrays like gl_ClipDistance
2016-06-28 13:24:18 -06:00
John Kessenich
5bc4d9a26f HLSL: Airplane work: break/continue/discard grammar, and decls for for/if/while. 2016-06-27 21:12:07 -06:00
Maciej Jesionowski
bbbcb5b2eb Front-end: allow max size built-in arrays like gl_ClipDistance
Fixed off-by-one error with gl_MaxClipDistances and similar limits.
2016-06-27 12:44:15 +02:00
LoopDawg
4624a02e21 Add lerp, fix sincos return type, ret type tests, non-square mats, HLSL->AST tx semantics 2016-06-21 10:10:48 -06:00
LoopDawg
6e72fddaa2 Add HLSL memory barrier intrinsics, fix dst, add lit & EvaluateAttributeSnapped 2016-06-20 09:53:59 -06:00
John Kessenich
19b92fff7e HLSL: Basic array grammar. 2016-06-19 11:50:34 -06:00
John Kessenich
93a162a857 HLSL: Handle "." for structure dereference and swizzle. 2016-06-17 17:16:27 -06:00
John Kessenich
5aa59e2044 HLSL: Map parameter qualifiers from generic to function-specific and entry-point specific. 2016-06-17 15:52:46 -06:00
John Kessenich
c3387d33ee HLSL: Support semantics in function parameter declarations. 2016-06-17 14:21:02 -06:00
John Kessenich
21f1286f57 Front-end: Implement GL_EXT_shader_non_constant_global_initializers.
This lets ES shaders use non-constant initializers for non-constant globals.
2016-06-17 12:43:31 -06:00
John Kessenich
b901ade058 SPV: Non-functional: Condense SPV-related versioning, and rationalize all uses. 2016-06-16 23:31:29 -06:00
John Kessenich
65336488a8 SPV: projective texturing: move the project coordinate.
SPV doesn't allow gaps in the components of the texturing coordinate.
It also removes the shadow reference.
So, close up the components so all used components are together.
2016-06-16 14:06:26 -06:00
John Kessenich
76d4dfcd51 SPV non-functional: minor readability improvements for texturing. 2016-06-16 12:43:23 -06:00
John Kessenich
ac666e7368 Front-end ESSL: require precision declarations for images. 2016-06-14 22:12:20 -06:00
John Kessenich
9000bd5eb6 Front-end: Make ES floatBitsToInt/intBitsToFloat/etc. all be highp. 2016-06-14 20:38:58 -06:00
John Kessenich
c51287d744 SPV: Update to spec. decisions (and issue #205) for barrier().
A barrier (ESSL/GLSL) or OpControlBarrier when in a tessellation control
shader also means doing memory synchronization for output variables.
2016-06-14 19:50:26 -06:00
LoopDawg
589107095c Implement atomic ops, bit conversions, fix fwidth stage mask, fix saturate dest modifier. 2016-06-13 20:50:36 -06:00
John Kessenich
cd784bc561 Merge pull request #337 from steve-lunarg/intrinsics
HLSL: Add decompositions for some intrinsics.
2016-06-13 08:54:45 -06:00
John Kessenich
630dd7da43 HLSL: Flesh out misc. declaration grammar: semantics/registers/annotations/precise/etc.
Details within these bear even more fleshing out, but would like to have
that driven by actual need.
2016-06-12 23:54:31 -06:00
John Kessenich
e6e7494e2a HLSL: Implement basic "struct" grammar. 2016-06-12 23:54:31 -06:00
LoopDawg
592860cae5 Add decompositions for some HLSL intrinsics. 2016-06-10 17:11:18 -06:00
John Kessenich
41ebc42926 Merge pull request #335 from jekstrand/sampler-params
SPV: Fix pointer address spaces for sampler function parameters
2016-06-09 20:42:23 -06:00
John Kessenich
077e052a8f HLSL: Implement proper nesting of symbol-table scopes and identifier searching. 2016-06-09 02:03:46 -06:00
John Kessenich
71351de879 HLSL: Add all int/float/bool/uint matrix types, void for functions, and a few others. 2016-06-09 01:33:10 -06:00
Jason Ekstrand
ed15ef1a5b GlslangToSpv: Pass the pointer directly into the client function for opaque types
For opaque types such as samplers, images, and atomic counters, we want to
reference the actual object in the child function.  For a long time, we
used a shadow variable and made a copy of the image/sampler.  In 76d0ac1a,
this was changed to not shadow samplers.  However, this didn't cover all
opaque types and it also didn't get the pointer storage classes right.
This commit fixes both of these issues.

Fixes #324
2016-06-08 17:22:46 -07:00
David Neto
a901ffed40 Defer capability decl for ClipDistance, CullDistance, PointSize until actual use
The compiler will mark struct members with those builtins, but won't
declare the capability until that member is accessed by some executable
instruction.

Test changes:
- spv.430.vert: was missing ClipDistance capability.
- spv.precise.tese: remove TessellationPointSize capability.
2016-06-08 09:30:04 -04:00
John Kessenich
80cb324ff6 Front-end: Fix issue #146: which versions allow double in/out. 2016-06-05 18:52:05 -06:00
John Kessenich
133253b6ee Front-end: Fix issue #147: ensure layout(index=N) has N in [0,1]. 2016-06-05 17:25:34 -06:00
John Kessenich
119f8f6906 HLSL: Flesh out the loop grammar and productions. 2016-06-05 15:44:07 -06:00
John Kessenich
0d2b6de45b HLSL: Attribute grammar and if-else grammar/productions. 2016-06-05 12:32:18 -06:00
John Kessenich
1cc1a2813e HLSL: 1) Implement lookahead buffers/stacks for token advance/recede, 2) use it for cast operation.
The grammar now accepts type casts, like "(int)x", but that
has to be disambiguated from "(a + b)", needed deeper lookahead
and backing up than what existed so far.
2016-06-03 16:57:53 -06:00
LoopDawg
643fcb5b43 Add negative intrinsics tests 2016-06-03 16:28:57 -06:00
LoopDawg
ef764a24b2 Fix for empty statement segfault. 2016-06-03 10:57:03 -06:00
LoopDawg
4b67732c13 Initial implementation of direct-mapped subset of HLSL intrinsics with type subset.
This checkin implements about half of the HLSL intrinsics for a subset of their
entire type support (but a useful subset).  The uncommented lines in
TBuiltInParseablesHlsl::identifyBuiltIns shows which are connected.
2016-06-03 08:28:29 -06:00
John Kessenich
a5c33d6ffb SPV: Fix issue #320: Fetch needs to extract the image.
GLSL takes a traditional sampler, but SPIR-V wants just the
sampled image, not the combined sampler and image.
2016-06-02 23:47:29 -06:00
John Kessenich
548c3adecd Front-end: Complete GL_ARB_compute_shader, previous commit was missing new barriers.
This amends the previous commit, which ommitted barriers in version 420 for compute shader.
2016-05-30 19:38:39 -06:00
John Kessenich
d94c003fb7 Front-end: Complete GL_ARB_compute_shader implementation.
Core compute shaders were working, but the extension wasn't implemented.
2016-05-30 19:29:40 -06:00
John Kessenich
0f5e3ad23c Fix issue #313: Catch internal attempts to modify built-in symbols that don't exist.
Also beefed up support for running compute shaders is #version 420, but this
work is only partially done.
2016-05-29 18:24:31 -06:00
John Kessenich
7d8141987c Merge pull request #309 from jekstrand/sampler-params
SPV: Don't shadow sampler parameters when performing function calls
2016-05-25 17:35:54 -06:00
Jason Ekstrand
76d0ac1a6f SPV: Don't shadow sampler parameters when performing function calls
Fixes #179
2016-05-25 13:49:47 -07:00
Thomas Perl
7bfd08d21c Check for linking multiple ES shaders to the same stage 2016-05-25 09:26:43 +02:00
Thomas Perl
0bb546f8ae Fix test case for the "empty" linker test case
The test result should only give one error about linking
ES and non-ES shading language compilation units:

 - empty.frag: No version info, interpreted as 100, ES
 - empty2.frag: No version info, interpreted as 100, ES
 - empty3.frag: Version declared as 110, non-ES

Previously, because the new intermediate is always created
without version/profile information, there would be two
linker errors:

 1.) When merging the new intermediate with empty.frag
 2.) When merging (new intermediate + empty.frag + empty2.frag) with empty3.frag

Now, there is only one error; as the error with merging the
new intermediate with empty.frag has been removed.
2016-05-24 13:24:24 +02:00
Thomas Perl
63d4794e8e Add test case: Link 2 ESSL fragment shader units 2016-05-24 13:15:01 +02:00
John Kessenich
d82c906378 Vulkan: Finish semantics for what creates spec-const-semantics.
Note: This required adding a new test mode to see the AST for vulkan tests.
This also required reworking some deeper parts of type creation, regarding
when storage qualification and constness is deduced bottom-up or dictated
top-down.
2016-05-23 23:10:18 -06:00
Rex Xu
bbceed7be3 SPV: Fix an issue of interpolation decoration.
GLSL interpolation qualifiers and auxiliary storage qualifiers are not
mutually exclusive. So when they are translated to SPIR-V decorations, two
independent utility methods should be employed to do this job.
2016-05-21 09:45:47 +08:00
John Kessenich
2921e0c54a KHR_vulkan_glsl: name mangle distinguish pure textures.
Fixes issue #252.
2016-05-20 16:59:27 -06:00
John Kessenich
22e0d41448 SPV: Don't put locations on OpTypeStruct. Related to Issue #291. 2016-05-20 15:40:53 -06:00
John Kessenich
eee0c73432 Merge pull request #297 from antiagainst/config-tests
Test compiling shaders with given resource limits using GTest.
2016-05-20 13:46:31 -06:00
John Kessenich
0133c1233e HLSL: Add more matrix types to the grammar. 2016-05-20 12:17:26 -06:00
John Kessenich
8d72f1a2c4 Full stack: distinguish between a scalar and a vector of size 1.
There have been GLSL extensions considering this, and HLSL does it.
This is a fully backward compatible change that allows this distinction.
2016-05-20 12:14:39 -06:00
John Kessenich
823fc65644 SPV: Don't emit memory barrier for ESSL barrier(), but still do for GLSL barrier().
Addresses issue #205.
Current open Khronos bug for finalizing this.
2016-05-19 18:26:42 -06:00
Lei Zhang
1b141728a6 Test compiling shaders with given resource limits using GTest. 2016-05-19 14:18:21 -04:00
John Kessenich
b5cfd79f0a Merge pull request #288 from thp/attribute-reflection
Reflection: Add support for querying vertex attributes in reflection API
2016-05-19 10:13:08 -06:00
Thomas Perl
bef7428dfd Update test cases for vertex attribute reflection 2016-05-19 09:30:29 +02:00
John Kessenich
9349108d06 Merge pull request #295 from amdrexu/bugfix
Parser: Redeclaration of gl_CullDistance is disallowed mistakenly.
2016-05-19 00:00:54 -06:00
Rex Xu
3d9165fde4 Parser: Redeclaration of gl_CullDistance is disallowed mistakenly. 2016-05-19 12:26:27 +08:00
scygan
2c86427640 Fix missing location decoration for structures put directly on input/output interfaces
Spec for decorating the OpVariable:
	"The remaining variables listed by OpEntryPoint with the Input or Output storage class form the user-defined variable interface. These variables must be identified with a Location decoration"

Spec for decorating struct type:
	"The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration).
	If it is a not a Block, then the structure type must have a Location decoration"
2016-05-18 18:22:21 +02:00
John Kessenich
6e0985dd9d Merge branch 'struct_member_decorations' of https://github.com/scyganINTEL/glslang into scyganINTEL-struct_member_decorations 2016-05-17 10:03:37 -06:00
Rex Xu
c1992e5e57 SPV: Correct an issue in createUnaryMatrixOperation().
Type of the source is not necessarily the same as that of the destination.
2016-05-17 18:57:18 +08:00
John Kessenich
ebb505355d SPV: Don't add clip/cull distance capabilities unless used.
These capabalities were added on declaration of the members, but
that is considered too aggressive, as those members are automatically
declared in some shaders that don't use them.  Now, actual access
is needed to make the capabalities be declared.
2016-05-16 19:32:59 -06:00
John Kessenich
e5f29393da Tests: Add a set of gtest-file-based HLSL tests. 2016-05-16 17:39:50 -06:00
John Kessenich
7a27de6dd1 Merge pull request #253 from amdrexu/bugfix2
SPV: Handle matrix's OpFConvert vector by vector.
2016-05-16 16:49:20 -06:00
Rex Xu
62dda787c7 Parser: Add missing vector relational functions for double type. 2016-05-14 14:21:16 +08:00
Rex Xu
73e3ce78f4 SPV: Handle matrix's OpFConvert vector by vector. 2016-05-14 09:20:52 +08:00
John Kessenich
4678ca9dac HLSL: Add function call syntax and AST building. 2016-05-13 09:33:42 -06:00
John Kessenich
36962c7ab7 Merge pull request #276 from amdrexu/bugfix
Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes.
2016-05-12 14:22:56 -06:00
Rex Xu
5839031759 SPV: Add capability ImageGatherExtended if necessary. 2016-05-11 16:38:50 +08:00
Rex Xu
827b23b8a1 Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes. 2016-05-11 15:50:41 +08:00
John Kessenich
3357d870e4 Merge pull request #222 from Qining/support-precise
Full stack: Support *precise* qualifier
2016-05-09 20:18:33 -06:00
John Kessenich
7b3096a93d Merge pull request #270 from scyganINTEL/bitfield_buildins
Use proper precision qualifiers for bitfield build-in functions on ES
2016-05-09 20:17:40 -06:00
GregF
5bdf49cdc8 fix check for non-positive array size 2016-05-09 17:07:04 -06:00
scygan
9c56d84b73 Use proper precision qualifiers for bitfield build-in functions on ES
This change causes ES shaders to precision qualifiers for build-in functions as defined in ESSL spec. It especially mattersfor functions that are defined as highp or taking a highp.

Fixes vulkanCTS dEQP-VK.glsl.builtin.function.integer.bitfieldreverse.*, where bitfieldReverse() retval was wrongly marked as RelaxedPrecision.

Note: floatBitsToInt/floatBitsToUInt precision is also broken, but in different way - so it is not addressed here.
2016-05-09 17:51:25 +02:00
qining
5bec2b5619 integer type operation should not be noContraction 2016-05-09 10:46:40 -04:00
qining
0c96db5a4c add a test for matrix, fix a variable name 2016-05-09 10:46:40 -04:00
qining
1a0d93f416 Fix the test of precise output function parameter
Rebase to 5cc344d8ce and update the
expected test result.
2016-05-09 10:46:40 -04:00
qining
9220dbb078 Precise and noContraction propagation
Reimplement the whole workflow to make that: precise'ness of struct
    members won't spread to other non-precise members of the same struct
    instance.

    Approach:
    1. Build the map from symbols to their defining nodes. And for each
    object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
    accesschain path. Different AST nodes that indicating a same object
    should have the same accesschain path.

    2. Along the building phase in step 1, collect the initial set of
    'precise' (AST qualifier: 'noContraction') objects' accesschain paths.

    3. Start with the initial set of 'precise' accesschain paths, use it as
    a worklist, do as the following steps until the worklist is empty:

        1) Pop an accesschain path from worklist.
        2) Get the symbol part from the accesschain path.
        3) Find the defining nodes of that symbol.
        4) For each defining node, check whether it is defining a 'precise'
        object, or its assignee has nested 'precise' object. Get the
        incremental path from assignee to its nested 'precise' object (if
        any).
        5) Traverse the right side of the defining node, obtain the
        accesschain paths of the corresponding involved 'precise' objects.
        Update the worklist with those new objects' accesschain paths.
        Label involved operations with 'noContraction'.

    In each step, whenever we find the parent object of an nested object is
    'precise' (has 'noContraction' qualifier), we let the nested object
    inherit the 'precise'ness from its parent object.
2016-05-09 10:46:40 -04:00
scygan
8add151c4b SPIR-V do not decorate: members of plain structs with location; non-top level members with interp.
This fixes some vulkanCTS tests that use struct arrays as a member of in/out interface blocks.

From Vulkan spec:
"If it is a not a Block, then the structure type must have a Location decoration. Its members are assigned consecutive locations in their declaration order, with the first member assigned to the location specified for the structure type. >>>>> The members, and their nested types, must not themselves have Location decorations <<<<"

From SPIR-V spec:
"When applied to structure-type members, the Decorations Noperspective, Flat, Patch, Centroid, and Sample can only be applied to the top-level members of the structure type. (Nested objects' types cannot be structures whose members are decorated with these decorations.)"
2016-05-06 16:54:54 +02:00
John Kessenich
baa9fa5df7 Merge branch 'feature2' of https://github.com/amdrexu/glslang into amdrexu-feature2 2016-05-05 16:32:39 -06:00
John Kessenich
5cc344d8ce Front-End: precise: capture noContraction on output parameter declarations. 2016-05-05 13:36:55 -06:00
John Kessenich
c8a5676025 Merge branch 'feature' of https://github.com/amdrexu/glslang into amdrexu-feature 2016-05-05 12:04:22 -06:00
Lei Zhang
17535f7d55 Create a new logger class for all messages w.r.t. SPIR-V build. 2016-05-05 10:15:06 -04:00
Rex Xu
338b185a2b Implement the extension GL_ARB_shader_group_vote. 2016-05-05 20:38:33 +08:00
Rex Xu
574ab04caa Implement the extension GL_ARB_shader_ballot
Add new built-in variables and functions to the parser (SPIR-V tokens are missing).
2016-05-05 19:02:35 +08:00
John Kessenich
3c1e08057e Front-end precise: Propagate noContraction up the AST when dereferencing structs.
This should be the last commit in this sequence to form the base of the work
in pull request #222.
2016-05-04 13:29:21 -06:00
John Kessenich
17f0786418 Parser: Precise: Recognize 'precise', tag types, and do related semantic checking.
This partly overlaps pull request #222, we have divided the work on this one.
2016-05-04 12:54:56 -06:00
John Kessenich
34fb036a9c HLSL: Add (almost) full expression grammar: Binary, unary (pre/post-fix), assign, ... 2016-05-03 23:33:00 -06:00
John Kessenich
e512cd943e Vulkan: Add the #define VULKAN 100 when compiled for Vulkan.
Note this requires test-based piecing together of the preamble string,
so it changed to being a std::string to make it easier to do.

This closes issue #254.
2016-05-03 21:18:59 -06:00
John Kessenich
af459216a1 Correct precision qualification on built-in functions.
This is a replacement commit for pull request #238.

This is a design change, followed by implementation change that
A) fixes the changes caused by the design change, and
B) fixes some cases that were originally incorrect.

The design change is to not give built-in functions default precision qualification.
This is to allow the rule that the precision of some built-in functions adopt their
precision qualification from the calling arguments.  This is A above.

A consequence of this design change is that all built-ins that are supposed to have
an explicit precision qualifier must now be declared that way.  So, a lot more
built-in declarations now have precision qualifiers, just to keep things the same.
This is B above.
2016-05-03 19:34:00 -06:00
Rex Xu
8ff43de891 Implement the extension GL_ARB_gpu_shader_int64
- Add new keyword int64_t/uint64_t/i64vec/u64vec.
- Support 64-bit integer literals (dec/hex/oct).
- Support built-in operators for 64-bit integer type.
- Add implicit and explicit type conversion for 64-bit integer type.
- Add new built-in functions defined in this extension.
2016-04-30 13:34:34 +08:00
qining
94a89d51f3 add .err file for eof_missing test 2016-04-27 10:22:22 -04:00
qining
19647a32b9 Fix the infinite loop when an input file lacks EOF
The input scanner can be trapped in an infinite loop if the given input
file does not have EOF (and is not ended with a 'whitespace').

The problem is caused by unget(), which keeps rolling back the scanner
pointer without hitting an EOF at the end of the file. This makes getch()
function keep returning the last character of the file and never ends,
and the effect of advance() is always counteracted by unget().
2016-04-27 10:05:57 -04:00
Rex Xu
c7d3656dde SPV: Use OpLogicalEqual/OpLogicalNotEqual for boolean type comparison. 2016-04-27 08:15:37 +08:00
qining
1f2820a3d3 fix the problem that spec constant composite instruction being used when only front-end constants are used in the constructor 2016-04-14 18:34:27 -04:00
qining
27e04a004d Fix spec const construtor for matrix and vector
Fix issue: #237

1. The code generated for matrix constructor should 1) build column
vectors first, 2) build matrix with the vectors.

2. When there is only one scalar type constituent in vector's
constructor, we should populate the constituent to fill all the slots in
the vector. As for matrix, the single constituent should be populated to
the diagonal positions (top-left to bottom-right diagonal).

remove createSpvConstantFromConstSubTree()
2016-04-14 17:52:57 -04:00
qining
189b2033a4 Refine the code and address comments 2016-04-12 23:19:28 -04:00
qining
e24aa5edbb SpecOp bool->uint/int and uint<->int conversion
Bool -> uint/int with OpSpecConstantOp OpSelect instruction.

uint <-> int conversion with OpSpecConstantOp OpIAdd instruction.

Note, implicit conversion: `const uint = an_int_spec_constant` is not
supported. Explicit type casting is required: `const uint =
uint(an_int_spec_constant)`
2016-04-12 22:01:55 -04:00
John Kessenich
78a6b78810 Front-end: Get the right set of nodes marked as spec-const.
This is according to the expected KHR_vulkan_glsl without floating point.
So, floating-point spec-const operations no longer work, and that's
reflected in the tests.
2016-04-06 13:32:44 -06:00
qining
75d1d80109 add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol() 2016-04-06 14:42:01 -04:00
qining
408876600f Turn on SpecConstantOpMode based on node qualifier
Move SpecConstantOpModeGuard from makeSpvConstantFromConstSubTree() to
visitbinary() and visitunary(). Checking if the visiting node is a spec
constants, if so, turn on the SpecConstantOpMode, otherwise, stay in the
normal mode.
2016-04-06 12:56:31 -04:00
qining
4c9126153d fix the wrong generated code when a non-constant array is declared with its size derived from spec constant operations 2016-04-06 12:51:50 -04:00
John Kessenich
aa0298bfde Merge pull request #220 from Qining/fix-built-in-spec-constants
Handle built-in constants redeclared with a specialization constant id.
2016-04-04 15:43:58 -06:00
qining
4f4bb81cd9 Built-in values declared as specialization constant
Support declaring built-in values as spec constants.

Refine the code in createSpvConstant().
2016-04-04 11:10:41 -04:00
John Kessenich
1c7e70763b Merge branch 'master' into hlsl-frontend 2016-04-03 20:36:48 -06:00
John Kessenich
a42533eca1 Merge pull request #190 from antiagainst/gtest
Add Google Test as the new test framework
2016-03-31 12:31:45 -06:00
John Kessenich
af59197ba4 Merge pull request #214 from amdrexu/bugfix
Parser: Update array size of gl_ClipDistance/gl_CullDistance in gl_in[].
2016-03-31 12:28:47 -06:00
qining
5c61d8e0f9 fix format; remove unnecessary parameters; rename some spec op mode guard class; remove support of float point comparison and composite type comparison; update the tests. 2016-03-31 13:57:28 -04:00
Lei Zhang
414eb60482 Link in Google Test framework.
The existing test harness is a homemade shell script. All the tests
and the expected results are written in plain text files. The harness
just reads in a test, invoke the glslangValidator binary on it, and
compare the result with the golden file. All tests are kinda
integration tests.

This patch add Google Test as an external project, which provides a
new harness for reading shader source files, compile to SPIR-V, and
then compare with the expected output.
2016-03-31 10:31:30 -04:00
qining
135452061a Spec Constant Operations
Approach:
Add a flag in `Builder` to indicate 'spec constant mode' and 'normal
mode'. When the builder is in 'normal mode', nothing changed. When the
builder is in 'spec constant mode', binary, unary and other instruction
creation rountines will be redirected to `createSpecConstantOp()` to
create instrution at module level with `OpSpecConstantOp <original
opcode> <operands>`.

'spec constant mode' should be enabled if and only if we are creating
spec constants. So a flager setter/recover guard is added when handling
binary/unary nodes in `createSpvConstantsFromConstSubTree()`.

Note when handling spec constants which are represented as ConstantUnion
Node, we should not use `OpSpecConstantOp` to initialize the composite
constant, so builder is set to 'normal mode'.

Tests:
Tests are added in Test/spv.specConstantOperations.vert, including:

1) Arithmetic, shift opeations for both scalar and composite type spec constants.
2) Size conversion from/to float and double for both scalar and vector.
3) Bitwise and/or/xor for both scalar and vector.
4) Unary negate/not for both scalar and vector.
5) Vector swizzles.
6) Comparisons for scalars.
7) == and != for composite type spec constants

Issues:
1) To implement == and != for composite type spec constants, the Spec needs
to allow OpAll, OpAny, OpFOrdEqual, OpFUnordEqual, OpOrdNotEqual,
OpFUnordNotEqual. Currently none of them are allowed in the Spec.
2016-03-30 16:18:26 -04:00
Rex Xu
cb0e471ad4 Parser: Update array size of gl_ClipDistance/gl_CullDistance in gl_in[]. 2016-03-27 08:47:43 +08:00
qining
0840838d17 Support specialization composite constants
Fix issue #163, support creation and reference of composite type
specialization constants.

e.g.:
```
layout(constant_id = 200) const float myfloat = 1.25;
layout(constant_id = 201) const int myint = 14;
struct structtype {
  float f;
  int i;
};
const structtype outer_struct_var = {myfloat, myint};
void main(){}
```
generated code (use glslangValidator):
```
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 12

                              Capability Shader
               1:             ExtInstImport  "GLSL.std.450"
                              MemoryModel Logical GLSL450
                              EntryPoint Vertex 4  "main"
                              Source GLSL 450
                              Name 4  "main"
                              Name 10  "structtype"
                              MemberName 10(structtype) 0  "f"
                              MemberName 10(structtype) 1  "i"
                              Decorate 7 SpecId 200
                              Decorate 9 SpecId 201
               2:             TypeVoid
               3:             TypeFunction 2
               6:             TypeFloat 32
               7:    6(float) SpecConstant 1067450368
               8:             TypeInt 32 1
               9:      8(int) SpecConstant 14
  10(structtype):             TypeStruct 6(float) 8(int)
              11:10(structtype) SpecConstantComposite 7 9
         4(main):           2 Function None 3
               5:             Label
                              Return
                              FunctionEnd
```

Rname two function names to match their functionalities.
1) Rename `GlslangToSpvTraverser::createSpvSpecConstant()` to
`createSpvConstant()`;
2) Rename `GlslangToSpvTraverser::createSpvConstant()` to
`createSpvConstantFromConstUnionArray()`

Add function `GlslangToSpvTraverser::createSpvConstantFromSubTree()` to
handle constant creation from sub trees (e.g.: specialization constants).

Related PR: #208
2016-03-24 18:04:00 -04:00
John Kessenich
7cc0e2896e Front-end infrastructure: Encapsulate semantic-level questions/actions about const/temp.
Much about const or temp is mechanical, about actual declaration,
while much is semantic, about something higher level.  This commit
checks every use everywhere, and for the high-level ones, substitutes
an encapsulated version instead.
2016-03-20 00:46:02 -06:00
Rex Xu
644c21025d Parser: Type promotion for operator modulus(%) is missing. 2016-03-18 16:26:23 +08:00
Rex Xu
d715adc0f2 SPV: Implement boolean selection for mix().
Use OpSelect to implement boolean selection of mix(). FMix is applicable
to linear blending of mix().
2016-03-15 18:19:26 +08:00
John Kessenich
5f934b039a HLSL: Accept basic funtion definitions. (Not yet mapping input/output for entry point.) 2016-03-13 17:58:25 -06:00
John Kessenich
d016be19fb HLSL: Hook up constructor expressions through the AST. 2016-03-13 11:24:20 -06:00
John Kessenich
87142c71fb HLSL: Add basic declaration syntax and AST generation. 2016-03-12 21:40:38 -07:00
John Kessenich
e01a9bc8c0 HLSL: Plumb in HLSL parse context and keywords, and most basic HLSL parser and test. 2016-03-12 21:40:08 -07:00
Dejan Mircevski
2677d918f1 Test dead-decoration removal. 2016-03-11 12:06:41 -05:00
Lei Zhang
24e4bc99ac Fix array out of bounds bug in processing if-else-endif macros.
If we are not inside an if macro, we cannot simply decrease
elsetracker.

Fixes https://github.com/KhronosGroup/glslang/issues/29.
2016-03-09 15:11:56 -05:00
John Kessenich
f7497e289b SPV: Issue #180: push_constants don't have descriptor sets. 2016-03-08 21:43:14 -07:00
John Kessenich
2107c76a08 Merge pull request #192 from Qining/enable-adding-multiviewport-capability
SPV: Declare MultiViewport capability.
2016-03-07 21:22:54 -07:00
qining
be4f52a484 Run regression tests, update spv.420.geom.out so capability MultiViewport is declared 2016-03-07 23:05:59 -05:00
John Kessenich
3c5b1e6b31 Merge pull request #168 from amdrexu/feature2
SPV: Add support for memory qualifiers.
2016-03-06 15:45:11 -07:00
John Kessenich
1250c9e1bd Merge pull request #165 from amdrexu/feature
SPV: Support the new OpCode - OpImageSparseRead
2016-03-06 15:43:01 -07:00
John Kessenich
f2d8a5c53f SPV: Use heuristic to avoid geometry multi-streams when possible. 2016-03-03 22:29:11 -07:00
John Kessenich
2ac71dfb78 Merge pull request #187 from amdrexu/bugfix
SPV: Continue to fix the issue of bool -> uint32
2016-03-03 21:59:21 -07:00