Rex Xu [Fri, 22 Apr 2016 08:51:45 +0000 (16:51 +0800)]
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.
John Kessenich [Thu, 28 Apr 2016 18:27:47 +0000 (12:27 -0600)]
Merge pull request #228 from Qining/fix-infinite-loop-due-to-eof-missing
Scanner/PP: Fix the infinite loop when an input file lacks EOF
qining [Wed, 27 Apr 2016 14:17:30 +0000 (10:17 -0400)]
add .err file for eof_missing test
qining [Mon, 11 Apr 2016 23:12:17 +0000 (19:12 -0400)]
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().
John Kessenich [Wed, 27 Apr 2016 09:50:05 +0000 (03:50 -0600)]
Merge pull request #251 from amdrexu/bugfix
SPV: Use OpLogicalEqual/OpLogicalNotEqual for boolean type comparison.
Rex Xu [Wed, 27 Apr 2016 00:15:37 +0000 (08:15 +0800)]
SPV: Use OpLogicalEqual/OpLogicalNotEqual for boolean type comparison.
John Kessenich [Fri, 22 Apr 2016 19:38:16 +0000 (13:38 -0600)]
Merge pull request #247 from dneto0/no-mutex
Remove use of std::mutex in gtest code.
David Neto [Thu, 21 Apr 2016 19:46:11 +0000 (15:46 -0400)]
Remove use of std::mutex in gtest code.
Gtest runs in single-threaded mode. So the GlslangInitializer
object in the test code doesn't have to do its own synchronization.
John Kessenich [Mon, 18 Apr 2016 17:23:38 +0000 (11:23 -0600)]
Merge pull request #241 from Qining/fix-spec-const-construct-matrix
SPV: Spec-consts: Fix constructors matrix and vector
qining [Thu, 14 Apr 2016 22:34:27 +0000 (18:34 -0400)]
fix the problem that spec constant composite instruction being used when only front-end constants are used in the constructor
qining [Thu, 14 Apr 2016 20:40:20 +0000 (16:40 -0400)]
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()
John Kessenich [Wed, 13 Apr 2016 03:28:11 +0000 (21:28 -0600)]
Merge pull request #232 from Qining/fix-spec-const-bool-to-int-conversion
SPV: SpecOp bool->uint/int and uint<->int conversion
qining [Wed, 13 Apr 2016 03:16:20 +0000 (23:16 -0400)]
Refine the code and address comments
qining [Thu, 7 Apr 2016 19:40:27 +0000 (15:40 -0400)]
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)`
John Kessenich [Wed, 13 Apr 2016 01:06:33 +0000 (19:06 -0600)]
Merge pull request #231 from dneto0/gtests-link-to-hlsl
Unit test executable should link to libHLSL
John Kessenich [Wed, 13 Apr 2016 00:35:12 +0000 (18:35 -0600)]
SPV for OpenGL: Issue #229: don't allow gl_VertexIndex or gl_InstanceIndex under -G.
David Neto [Tue, 12 Apr 2016 23:54:02 +0000 (19:54 -0400)]
Unit test executable should link to libHLSL
No unit tests exercise it.
John Kessenich [Mon, 11 Apr 2016 16:23:50 +0000 (10:23 -0600)]
Merge pull request #226 from baldurk/warning-fixes
A couple of small warning fixes
baldurk [Sat, 9 Apr 2016 11:07:25 +0000 (13:07 +0200)]
Fix warning about function parameter shadowing class member variable
baldurk [Sat, 9 Apr 2016 11:07:12 +0000 (13:07 +0200)]
Fix warning about losing information, use size_t instead of int
John Kessenich [Thu, 7 Apr 2016 15:10:47 +0000 (09:10 -0600)]
Nonfunctional: Remove stray ';' and fix Google Test sentence in README.
John Kessenich [Thu, 7 Apr 2016 01:03:15 +0000 (19:03 -0600)]
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.
John Kessenich [Wed, 6 Apr 2016 19:32:44 +0000 (13:32 -0600)]
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.
John Kessenich [Wed, 6 Apr 2016 19:14:11 +0000 (13:14 -0600)]
Merge pull request #216 from Qining/fix-non-const-array-size-from-spec-const
SPV: Generate OpSpecConstantOp for all subtrees indicated by the AST.
qining [Wed, 6 Apr 2016 18:42:01 +0000 (14:42 -0400)]
add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol()
qining [Mon, 4 Apr 2016 02:20:42 +0000 (22:20 -0400)]
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.
qining [Fri, 1 Apr 2016 14:35:16 +0000 (10:35 -0400)]
fix the wrong generated code when a non-constant array is declared with its size derived from spec constant operations
John Kessenich [Mon, 4 Apr 2016 21:43:58 +0000 (15:43 -0600)]
Merge pull request #220 from Qining/fix-built-in-spec-constants
Handle built-in constants redeclared with a specialization constant id.
qining [Mon, 4 Apr 2016 03:55:17 +0000 (23:55 -0400)]
Built-in values declared as specialization constant
Support declaring built-in values as spec constants.
Refine the code in createSpvConstant().
John Kessenich [Mon, 4 Apr 2016 02:36:48 +0000 (20:36 -0600)]
Merge branch 'master' into hlsl-frontend
John Kessenich [Sun, 3 Apr 2016 20:06:53 +0000 (14:06 -0600)]
Merge branch 'master' of github.com:KhronosGroup/glslang
John Kessenich [Sun, 3 Apr 2016 20:06:22 +0000 (14:06 -0600)]
Merge pull request #217 from baldurk/vs2010-compile-fixes
VS2010 compile fixes
John Kessenich [Sun, 3 Apr 2016 20:05:37 +0000 (14:05 -0600)]
Merge pull request #219 from 1ace/master
Fix spelling mistakes
Eric Engestrom [Sun, 3 Apr 2016 00:17:13 +0000 (01:17 +0100)]
fix spelling mistakes
John Kessenich [Sat, 2 Apr 2016 19:09:14 +0000 (13:09 -0600)]
Comment: fix comment from gtest check in.
baldurk [Sat, 2 Apr 2016 11:38:42 +0000 (13:38 +0200)]
Specify explicit return type on lambda function
baldurk [Sat, 2 Apr 2016 11:38:28 +0000 (13:38 +0200)]
Change {parameter} lists into explicit std::vector temporaries
John Kessenich [Thu, 31 Mar 2016 18:31:45 +0000 (12:31 -0600)]
Merge pull request #190 from antiagainst/gtest
Add Google Test as the new test framework
John Kessenich [Thu, 31 Mar 2016 18:28:47 +0000 (12:28 -0600)]
Merge pull request #214 from amdrexu/bugfix
Parser: Update array size of gl_ClipDistance/gl_CullDistance in gl_in[].
John Kessenich [Thu, 31 Mar 2016 18:22:14 +0000 (12:22 -0600)]
Merge pull request #215 from Qining/spec-constants-operations
SPV: Spec Constant Operations
qining [Thu, 31 Mar 2016 17:57:28 +0000 (13:57 -0400)]
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.
Lei Zhang [Fri, 4 Mar 2016 21:22:34 +0000 (16:22 -0500)]
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.
qining [Mon, 21 Mar 2016 13:51:37 +0000 (09:51 -0400)]
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.
Rex Xu [Sun, 27 Mar 2016 00:42:23 +0000 (08:42 +0800)]
Parser: Update array size of gl_ClipDistance/gl_CullDistance in gl_in[].
John Kessenich [Fri, 25 Mar 2016 19:17:27 +0000 (13:17 -0600)]
Merge pull request #211 from Qining/spec-constants-composite
SPV: Support specialization composite constants.
qining [Mon, 21 Mar 2016 13:51:37 +0000 (09:51 -0400)]
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
John Kessenich [Tue, 22 Mar 2016 14:56:20 +0000 (08:56 -0600)]
Merge pull request #212 from amdrexu/bugfix
VS2012: Fix a build issue in parser.
Rex Xu [Tue, 22 Mar 2016 07:42:07 +0000 (15:42 +0800)]
Parser: Fix a build issue (VS2012).
John Kessenich [Mon, 21 Mar 2016 20:06:55 +0000 (14:06 -0600)]
Merge pull request #210 from AWoloszyn/fix-compilation
Fixed compilation issue introduced by my last commit
Andrew Woloszyn [Mon, 21 Mar 2016 19:56:31 +0000 (15:56 -0400)]
Fixed compilation issue introduced by my last commit
John Kessenich [Mon, 21 Mar 2016 19:23:20 +0000 (13:23 -0600)]
Merge pull request #198 from AWoloszyn/update-includer
Updated the includer interface to allow relative includes.
John Kessenich [Mon, 21 Mar 2016 18:55:00 +0000 (12:55 -0600)]
Front-end: Propagate spec-constness up through aggregate constructors.
Andrew Woloszyn [Mon, 7 Mar 2016 18:23:09 +0000 (13:23 -0500)]
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.
John Kessenich [Mon, 21 Mar 2016 00:45:23 +0000 (18:45 -0600)]
Front-end: propagate specialization-constness through conversions and swizzles.
John Kessenich [Sun, 20 Mar 2016 22:46:00 +0000 (16:46 -0600)]
Front-end: Add specialization-constant subtrees for const variables/symbols.
John Kessenich [Sun, 20 Mar 2016 06:46:02 +0000 (00:46 -0600)]
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.
John Kessenich [Sun, 20 Mar 2016 00:10:22 +0000 (18:10 -0600)]
Front-end infrastructure: simplify and localize creating symbol nodes, reducing replication.
John Kessenich [Fri, 18 Mar 2016 20:42:07 +0000 (14:42 -0600)]
Merge pull request #209 from amdrexu/bugfix
Parser: Type promotion for operator modulus(%) is missing.
Rex Xu [Fri, 18 Mar 2016 08:26:23 +0000 (16:26 +0800)]
Parser: Type promotion for operator modulus(%) is missing.
John Kessenich [Wed, 16 Mar 2016 20:08:30 +0000 (14:08 -0600)]
Merge pull request #203 from dneto0/wip-mingw
Support Linux-to-Windows cross compile via MinGW
David Neto [Mon, 29 Feb 2016 04:32:44 +0000 (23:32 -0500)]
Support compilation via MinGW
Change-Id: Ie52f0b1b2b20948c6f4b3cb5474537d36a5a3385
John Kessenich [Tue, 15 Mar 2016 15:14:27 +0000 (09:14 -0600)]
Merge pull request #204 from amdrexu/bugfix
SPV: Implement boolean selection for mix().
Rex Xu [Tue, 15 Mar 2016 04:08:31 +0000 (12:08 +0800)]
SPV: Implement boolean selection for mix().
Use OpSelect to implement boolean selection of mix(). FMix is applicable
to linear blending of mix().
John Kessenich [Mon, 14 Mar 2016 16:46:34 +0000 (10:46 -0600)]
HLSL: Abstract accepting an identifier.
John Kessenich [Mon, 14 Mar 2016 16:02:11 +0000 (10:02 -0600)]
HLSL: Simplify appearances a bit to make easier to read.
John Kessenich [Sun, 13 Mar 2016 23:58:25 +0000 (17:58 -0600)]
HLSL: Accept basic funtion definitions. (Not yet mapping input/output for entry point.)
John Kessenich [Sun, 13 Mar 2016 18:22:00 +0000 (12:22 -0600)]
HLSL: Get correct set of reserved words.
John Kessenich [Sun, 13 Mar 2016 17:24:20 +0000 (11:24 -0600)]
HLSL: Hook up constructor expressions through the AST.
John Kessenich [Sun, 13 Mar 2016 03:24:24 +0000 (20:24 -0700)]
HLSL: Add basic declaration syntax and AST generation.
John Kessenich [Sun, 13 Mar 2016 03:11:22 +0000 (20:11 -0700)]
HLSL: Plumb in HLSL parse context and keywords, and most basic HLSL parser and test.
John Kessenich [Sun, 13 Mar 2016 02:08:55 +0000 (19:08 -0700)]
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).
John Kessenich [Sun, 13 Mar 2016 01:34:36 +0000 (18:34 -0700)]
Support multiple source languages, adding HLSL as an option.
John Kessenich [Sun, 13 Mar 2016 01:17:47 +0000 (18:17 -0700)]
Generalize "main" to a settable entry point name.
John Kessenich [Fri, 11 Mar 2016 19:34:02 +0000 (12:34 -0700)]
Merge pull request #199 from dekimir/test-dead-decors
SPV test: Test dead-decoration removal.
Dejan Mircevski [Fri, 11 Mar 2016 17:06:17 +0000 (12:06 -0500)]
Test dead-decoration removal.
John Kessenich [Thu, 10 Mar 2016 16:51:22 +0000 (09:51 -0700)]
Merge pull request #195 from Qining/remove-decoration-on-undef-IDs
SPV: Remove decoration of undefined IDs
qining [Thu, 10 Mar 2016 02:40:41 +0000 (21:40 -0500)]
Change to traditional 'for' loop
John Kessenich [Thu, 10 Mar 2016 02:07:41 +0000 (19:07 -0700)]
Merge pull request #194 from google/if-macro
Preprocessor: Fix array out of bounds bug in processing if-else-endif macros.
qining [Thu, 10 Mar 2016 00:54:03 +0000 (19:54 -0500)]
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.
Lei Zhang [Wed, 9 Mar 2016 19:53:57 +0000 (14:53 -0500)]
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.
John Kessenich [Wed, 9 Mar 2016 04:36:22 +0000 (21:36 -0700)]
SPV: Issue #180: push_constants don't have descriptor sets.
John Kessenich [Tue, 8 Mar 2016 04:22:54 +0000 (21:22 -0700)]
Merge pull request #192 from Qining/enable-adding-multiviewport-capability
SPV: Declare MultiViewport capability.
qining [Tue, 8 Mar 2016 04:05:59 +0000 (23:05 -0500)]
Run regression tests, update spv.420.geom.out so capability MultiViewport is declared
qining [Tue, 8 Mar 2016 02:32:15 +0000 (21:32 -0500)]
Enable adding capability: MultiViewport
Fix issue #191:
https://github.com/KhronosGroup/glslang/issues/191
John Kessenich [Sun, 6 Mar 2016 22:45:11 +0000 (15:45 -0700)]
Merge pull request #168 from amdrexu/feature2
SPV: Add support for memory qualifiers.
John Kessenich [Sun, 6 Mar 2016 22:43:01 +0000 (15:43 -0700)]
Merge pull request #165 from amdrexu/feature
SPV: Support the new OpCode - OpImageSparseRead
John Kessenich [Sun, 6 Mar 2016 22:37:56 +0000 (15:37 -0700)]
Infrastructure: Tweak CMake for
31c294cea86ae0115820f2a02c5a33cfca662a26, removal of bison.
John Kessenich [Sun, 6 Mar 2016 22:14:46 +0000 (15:14 -0700)]
Merge pull request #122 from baldurk/remove-bison-binary
Remove bison binary
John Kessenich [Fri, 4 Mar 2016 05:29:11 +0000 (22:29 -0700)]
SPV: Use heuristic to avoid geometry multi-streams when possible.
John Kessenich [Fri, 4 Mar 2016 04:59:21 +0000 (21:59 -0700)]
Merge pull request #187 from amdrexu/bugfix
SPV: Continue to fix the issue of bool -> uint32
John Kessenich [Fri, 4 Mar 2016 04:57:51 +0000 (21:57 -0700)]
Merge pull request #188 from bsalomon/master
Fix line endings in Test/100.conf
Brian Salomon [Thu, 3 Mar 2016 17:12:07 +0000 (12:12 -0500)]
Fix line endings in Test/100.conf.
Rex Xu [Thu, 3 Mar 2016 06:38:51 +0000 (14:38 +0800)]
SPV: Continue to fix the issue of bool -> uint32
For short-circuit operator (&& and ||), the conversion is missing.
John Kessenich [Tue, 1 Mar 2016 15:43:17 +0000 (08:43 -0700)]
Syntax: correct spelling of rgb10_a2ui.
baldurk [Fri, 1 Jan 2016 00:21:56 +0000 (01:21 +0100)]
Remove custom command for bison, it fails if bison is not found
baldurk [Thu, 31 Dec 2015 23:54:05 +0000 (00:54 +0100)]
Commit bison-generated files from Windows GNU Bison 2.7
baldurk [Thu, 31 Dec 2015 23:31:43 +0000 (00:31 +0100)]
Add a note to README.md about how to build the bison grammar
baldurk [Thu, 31 Dec 2015 23:29:11 +0000 (00:29 +0100)]
Remove bison binaries see issue #103
John Kessenich [Sun, 28 Feb 2016 04:37:17 +0000 (21:37 -0700)]
Merge pull request #173 from amdrexu/bugfix
SPV: Fix an issue caused by bool-to-uint32 conversion.
John Kessenich [Sun, 28 Feb 2016 04:29:14 +0000 (21:29 -0700)]
Merge pull request #175 from rdb/master
Fix compilation issues with MSVC 2010