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
9c2f1c7bc0
Merge branch 'master' of github.com:KhronosGroup/glslang
2016-04-03 14:06:53 -06:00
John Kessenich
79845ad8e7
Merge pull request #217 from baldurk/vs2010-compile-fixes
...
VS2010 compile fixes
2016-04-03 14:06:22 -06:00
John Kessenich
bb5743ea8e
Merge pull request #219 from 1ace/master
...
Fix spelling mistakes
2016-04-03 14:05:37 -06:00
Eric Engestrom
6a6d6dda95
fix spelling mistakes
2016-04-03 01:17:13 +01:00
John Kessenich
f0bcb0aaf4
Comment: fix comment from gtest check in.
2016-04-02 13:09:14 -06:00
baldurk
bd9f8351f4
Specify explicit return type on lambda function
2016-04-02 13:38:42 +02:00
baldurk
0dfbe3f90d
Change {parameter} lists into explicit std::vector temporaries
2016-04-02 13:38:28 +02: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
John Kessenich
3dad506ac6
Merge pull request #215 from Qining/spec-constants-operations
...
SPV: Spec Constant Operations
2016-03-31 12:22:14 -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
Dejan Mircevski
5797975686
Merge branch 'master' of github.com:KhronosGroup/glslang into clang-format
2016-03-26 15:59:00 -04:00
Dejan Mircevski
24c6bb308d
Put braces on new line after if/for/switch/case.
2016-03-26 15:53:12 -04:00
John Kessenich
c3869fee41
Merge pull request #211 from Qining/spec-constants-composite
...
SPV: Support specialization composite constants.
2016-03-25 13:17:27 -06: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
28001b1cbb
Merge pull request #212 from amdrexu/bugfix
...
VS2012: Fix a build issue in parser.
2016-03-22 08:56:20 -06:00
Rex Xu
4e8bf59778
Parser: Fix a build issue (VS2012).
2016-03-22 15:42:07 +08:00
John Kessenich
5ace09a75b
Merge pull request #210 from AWoloszyn/fix-compilation
...
Fixed compilation issue introduced by my last commit
2016-03-21 14:06:55 -06: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
John Kessenich
2cc221ade3
Merge pull request #209 from amdrexu/bugfix
...
Parser: Type promotion for operator modulus(%) is missing.
2016-03-18 14:42:07 -06:00
Rex Xu
644c21025d
Parser: Type promotion for operator modulus(%) is missing.
2016-03-18 16:26:23 +08:00
John Kessenich
b1dece2737
Merge pull request #203 from dneto0/wip-mingw
...
Support Linux-to-Windows cross compile via MinGW
2016-03-16 14:08:30 -06:00
David Neto
ed5fd5d846
Support compilation via MinGW
...
Change-Id: Ie52f0b1b2b20948c6f4b3cb5474537d36a5a3385
2016-03-16 15:41:31 -04:00
John Kessenich
2de792c574
Merge pull request #204 from amdrexu/bugfix
...
SPV: Implement boolean selection for mix().
2016-03-15 09:14:27 -06: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
aecd497c96
HLSL: Abstract accepting an identifier.
2016-03-14 10:46:34 -06:00
John Kessenich
078d7f24bd
HLSL: Simplify appearances a bit to make easier to read.
2016-03-14 10:02:11 -06: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
48882ef5a8
HLSL: Get correct set of reserved words.
2016-03-13 12:22:00 -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
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
John Kessenich
6cc7674b6d
Merge pull request #199 from dekimir/test-dead-decors
...
SPV test: Test dead-decoration removal.
2016-03-11 12:34:02 -07:00