Commit Graph

1023 Commits

Author SHA1 Message Date
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
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
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
6cc7674b6d Merge pull request #199 from dekimir/test-dead-decors
SPV test: Test dead-decoration removal.
2016-03-11 12:34:02 -07:00
Dejan Mircevski
2677d918f1 Test dead-decoration removal. 2016-03-11 12:06:41 -05:00
John Kessenich
5639f3aca5 Merge pull request #195 from Qining/remove-decoration-on-undef-IDs
SPV: Remove decoration of undefined IDs
2016-03-10 09:51:22 -07:00
qining
95aa52737d Change to traditional 'for' loop 2016-03-09 21:40:41 -05:00
John Kessenich
663cbcdcf8 Merge pull request #194 from google/if-macro
Preprocessor: Fix array out of bounds bug in processing if-else-endif macros.
2016-03-09 19:07:41 -07:00
qining
da39733f28 Remove decoration of undefined IDs
Fix issue #185 by removing OpDecorate instructions whose target IDs are
defined in unreachable blocks and thus not dumped in the generated
SPIR-V code.
2016-03-09 19:54:03 -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
qining
3d7b89a872 Enable adding capability: MultiViewport
Fix issue #191:
https://github.com/KhronosGroup/glslang/issues/191
2016-03-07 21:32:15 -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
84ecb413ac Infrastructure: Tweak CMake for 31c294cea8, 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
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
John Kessenich
be0fa3c4c0 Merge pull request #188 from bsalomon/master
Fix line endings in Test/100.conf
2016-03-03 21:57:51 -07:00
Brian Salomon
5dc8a76265 Fix line endings in Test/100.conf. 2016-03-03 12:12:07 -05:00