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
a26a5170a3
Non-functional: Rationalize location and use of mapTypeToConstructor().
2016-07-28 16:56:52 -06:00
John Kessenich
414f735443
Front-end: Fix issue #409 , check for implicitly-sized binding arrays.
2016-07-27 14:55:06 -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
Rex Xu
9d93a2370d
Implement 4 AMD-specific extensions.
...
- Support GL_AMD_shader_ballot (SPV_AMD_shader_ballot).
- Support GL_AMD_shader_trinary_minmax (SPV_AMD_shader_trinary_minmax).
- Support GL_AMD_shader_explicit_vertex_parameter
(SPV_AMD_shader_explicit_vertex_parameter).
- Support GL_AMD_gcn_shader (SPV_AMD_gcn_shader).
2016-07-20 16:18:05 +08: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
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
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
Cort Stratton
85028e1469
When parsing Vulkan GLSL, suggest gl_VertexIndex/gl_InstanceIndex instead of gl_VertexID/gl_InstanceID.
2016-06-30 12:51:10 -07: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
John Kessenich
b10feabc95
Front-end: Non-functional: Move return-value handling from .y to .cpp.
...
This is to make the real change needed in the next commit easier.
2016-06-28 23:54:36 -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
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
ac666e7368
Front-end ESSL: require precision declarations for images.
2016-06-14 22:12:20 -06: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
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
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
3d9165fde4
Parser: Redeclaration of gl_CullDistance is disallowed mistakenly.
2016-05-19 12:26:27 +08:00
Rex Xu
827b23b8a1
Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes.
2016-05-11 15:50:41 +08:00
GregF
5bdf49cdc8
fix check for non-positive array size
2016-05-09 17:07:04 -06:00
John Kessenich
5cc344d8ce
Front-End: precise: capture noContraction on output parameter declarations.
2016-05-05 13:36:55 -06: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
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
John Kessenich
7e3e486344
Memory: Don't use pool memory to store the entry point name in the intermediate representation.
...
This might address issue #221 , which I couldn't reproduce.
2016-04-06 19:03:15 -06: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
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
ddb65a46f7
Front-end: Propagate spec-constness up through aggregate constructors.
2016-03-21 12:55:00 -06:00
John Kessenich
6d2b07dc39
Front-end: propagate specialization-constness through conversions and swizzles.
2016-03-20 18:45:23 -06:00
John Kessenich
a5845766e0
Front-end: Add specialization-constant subtrees for const variables/symbols.
2016-03-20 16:46:00 -06: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
John Kessenich
952543e757
Front-end infrastructure: simplify and localize creating symbol nodes, reducing replication.
2016-03-19 18:10:22 -06:00
John Kessenich
b3dc3acd59
Refactor TParseContext into 3 level inheritance.
...
Adds parseVersions.h as the base TParseVersions for versioning,
and splits the remainder between TParseContextBase (sharable across parsers)
and TParseContext (now the GLSL-specific part).
2016-03-12 19:08:55 -07:00
John Kessenich
4d65ee31a6
Generalize "main" to a settable entry point name.
2016-03-12 18:17:47 -07:00
John Kessenich
f7497e289b
SPV: Issue #180 : push_constants don't have descriptor sets.
2016-03-08 21:43:14 -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
6c292d3ba7
SPV: Implement Vulkan version of GLSL (KHR_vulkan_glsl).
2016-02-15 21:46:55 -07:00
John Kessenich
f6eae2a54a
SPV: Require desktop 140 or ES 310 or above.
2016-01-22 17:47:22 -07:00
John Kessenich
4998789d4e
SPV: Fix array strides by explicitly computing them in the getBaseAlignment() algorithm.
2015-12-29 19:20:55 -07:00
John Kessenich
69d01eadd6
Semantics: Catch nested types containing 'int' with non-'flat' interpolation.
2015-12-22 16:39:07 -07:00
John Kessenich
3ac051e41d
SPV: recursively propagate row/col majorness through nested structures.
...
This includes doing structure uniqueness modulo majorness, for shared nested structures.
2015-12-20 12:25:21 -07:00
John Kessenich
61d9fb9048
Semantics: 'invocations' defaults to 1, not 0.
...
'invocations' was using 0 as the "shader never set" flag and as the
default. Formalize this and explicit set to 1 and link time.
2015-12-13 10:59:17 -07:00