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
Eric Engestrom
6a6d6dda95
fix spelling mistakes
2016-04-03 01:17:13 +01: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
Rex Xu
4e8bf59778
Parser: Fix a build issue (VS2012).
2016-03-22 15:42:07 +08:00
Andrew Woloszyn
272afd2d0a
Fixed compilation issue introduced by my last commit
2016-03-21 16:05:47 -04:00
John Kessenich
56368b68ed
Merge pull request #198 from AWoloszyn/update-includer
...
Updated the includer interface to allow relative includes.
2016-03-21 13:23:20 -06:00
John Kessenich
ddb65a46f7
Front-end: Propagate spec-constness up through aggregate constructors.
2016-03-21 12:55:00 -06:00
Andrew Woloszyn
a132af5b78
Updated the includer interface to allow relative includes.
...
This plumbs both the current file path and the include depth
back up to the includer. This allows the includer to properly
support relative paths.
This also replaces the string copy that was done during include
with a zero-copy method of accomplishing the same thing. This
prevents extra copies of entire files.
2016-03-21 10:19:45 -04: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
Rex Xu
644c21025d
Parser: Type promotion for operator modulus(%) is missing.
2016-03-18 16:26:23 +08:00
David Neto
ed5fd5d846
Support compilation via MinGW
...
Change-Id: Ie52f0b1b2b20948c6f4b3cb5474537d36a5a3385
2016-03-16 15:41:31 -04: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
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
66e2faf844
Support multiple source languages, adding HLSL as an option.
2016-03-12 18:34:36 -07:00
John Kessenich
4d65ee31a6
Generalize "main" to a settable entry point name.
2016-03-12 18:17:47 -07: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
84ecb413ac
Infrastructure: Tweak CMake for 31c294cea86ae0115820f2a02c5a33cfca662a26, removal of bison.
2016-03-06 15:37:56 -07:00
John Kessenich
31c294cea8
Merge pull request #122 from baldurk/remove-bison-binary
...
Remove bison binary
2016-03-06 15:14:46 -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
8e3f4c2d66
Syntax: correct spelling of rgb10_a2ui.
2016-03-01 08:43:17 -07:00
baldurk
395b7dd3f5
Remove custom command for bison, it fails if bison is not found
2016-02-28 09:15:31 +01:00
baldurk
530690e442
Commit bison-generated files from Windows GNU Bison 2.7
2016-02-28 09:15:31 +01:00
John Kessenich
52d08596ec
Merge pull request #175 from rdb/master
...
Fix compilation issues with MSVC 2010
2016-02-27 21:29:14 -07:00
baldurk
1be2ffa7cd
GCC/Clang warning fix - unsigned/signed mismatch in comparison
2016-02-25 21:47:14 +01:00
John Kessenich
5184353326
Merge pull request #174 from mgadams/alias_proto_warnings
...
Fix warnings/errors for strict aliasing & function prototypes
2016-02-24 21:43:59 -07:00
rdb
32084e889d
Fix compilation issues with MSVC 2010
...
(mostly by eliminating use of range-based for loops and std::tie)
2016-02-23 22:17:38 +01:00
Mark Adams
18b637f9dc
Fix warnings/errors for strict aliasing & function prototypes
...
This fixes various issues related to gcc's strict-aliasing warning
by using unions. It also handles various cases hit with
gcc's missing-declarations warning.
2016-02-23 12:17:11 -05:00
Hubert Jarosz
6df2cdbb8a
fix #171 - error: ‘isinf’ was not declared in this scope
...
glslang/MachineIndependent/intermOut.cpp used `isinf`,
but it's in `std` namespace, so should use `std::isinf`.
2016-02-23 01:32:37 +01:00
John Kessenich
0967748fbc
SPV: Fix 'location' inheritance bug.
2016-02-19 12:21:50 -07:00
John Kessenich
5047c6f7a7
SPV: Fix Linux build warning.
2016-02-18 19:47:33 -07:00
Lei Zhang
4fe1efa1a9
Error out if bison is not found on non-Windows operating systems.
...
We cannot just default to use tools/bison.exe when it is not on
Windows.
2016-02-18 06:18:05 -05:00
John Kessenich
6c292d3ba7
SPV: Implement Vulkan version of GLSL (KHR_vulkan_glsl).
2016-02-15 21:46:55 -07:00
John Kessenich
ba5685a332
Semantics: Map noise*() to an operator for PureOperatorBuiltins mode.
...
Fixes issue #157 .
2016-02-02 15:59:12 -07:00
John Kessenich
9df51caba9
Fix front-end bug: Constant folding of array-of-struct index op.
...
If a constant object was both an array and a structure, and was
indexed with a constant, the arrayness was ignored and the wrong
subconstant selected. This fixes that.
2016-02-01 11:57:33 -07:00
John Kessenich
f6eae2a54a
SPV: Require desktop 140 or ES 310 or above.
2016-01-22 17:47:22 -07:00
John Kessenich
4bfeed5fe8
Semantics: Spec. changing to reflect reality of int/uint conversion for |^&.
...
This effects 4.x, where int/uint conversions are done, but not earlier.
2016-01-22 15:40:24 -07:00
John Kessenich
28ad350b35
Memory: remove a part of the last merge request that causes crashes in multi-threaded mode.
2016-01-18 11:10:40 -07:00
John Kessenich
3e9add360d
Merge pull request #133 from AWoloszyn/spirv-memory
...
Free memory associated with SPIR-V generation and the pragmaTable.
2016-01-18 10:48:07 -07:00
Andrew Woloszyn
b7946d16bb
Free memory associated with SPIR-V generation.
2016-01-18 10:29:41 -05:00
John Kessenich
712ecb96a2
Doubles: Add all the missing built-in double-based prototypes.
2016-01-16 20:37:43 -07:00
John Kessenich
c57b2a97fa
Memory/Perf: For link-mode, isolate file I/O so API can be looped over.
...
Separating file I/O from compile/link lets the compile/link be done
repeatedly in a loop for testing and measuring of performance and
memory footprint, including seeing memory growth over time for
functional-level memory-leak testing.
While the older compile-only mode already had this functionality,
and typically showed no memory leaks, SPIR-V uses the link path,
has pending "TODO" for memory freeing, and this shows several
kilobytes of leaking per compile-link. Most likely, pending
merge request 131 will address much of this.
2016-01-16 15:30:03 -07:00
John Kessenich
68f1431a55
Merge pull request #121 from amdrexu/feature
...
Parser & SPV: Implement two extensions regarding GLSL sparse texture.
2016-01-15 00:52:18 -07:00
John Kessenich
863aa667f3
Merge pull request #129 from AWoloszyn/fix-noop-strcpy
...
Preprocessor: Removed strcpy that copied a value to itself.
2016-01-13 19:12:50 -07:00