baldurk
3cb57d3731
Fix warning about losing information, use size_t instead of int
2016-04-09 13:11:49 +02:00
John Kessenich
6e620c4674
Nonfunctional: Remove stray ';' and fix Google Test sentence in README.
2016-04-07 09:10:47 -06: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
qining
75d1d80109
add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol()
2016-04-06 14:42:01 -04:00
qining
408876600f
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.
2016-04-06 12:56:31 -04:00
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
79845ad8e7
Merge pull request #217 from baldurk/vs2010-compile-fixes
...
VS2010 compile fixes
2016-04-03 14:06:22 -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
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
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
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
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
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
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
qining
95aa52737d
Change to traditional 'for' loop
2016-03-09 21:40:41 -05: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
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
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
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
Rex Xu
b4fd8d10f0
SPV: Continue to fix the issue of bool -> uint32
...
For short-circuit operator (&& and ||), the conversion is missing.
2016-03-03 14:38:51 +08:00
John Kessenich
32fb11daa9
Merge pull request #173 from amdrexu/bugfix
...
SPV: Fix an issue caused by bool-to-uint32 conversion.
2016-02-27 21:37:17 -07: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
9cc6cd3ef4
GCC warning fix - unhandled enums in switch statement
2016-02-25 21:20:53 +01:00
baldurk
227e026dbf
MSVC warning fix - conversion from size_t to int, possible loss of data
2016-02-25 21:19:49 +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
Rex Xu
2725323bba
SPV: Fix an issue caused by bool-to-uint32 conversion.
...
This issue is related with the commit
103bef9d74d768f0690ed53f52681baead384d1e.
2016-02-24 12:27:10 +08:00
Jack Andersen
52e61acf26
SPV: Ensure Parameterize is called during Disassemble
2016-02-23 12:03:21 -10: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
Rex Xu
1da878f6d1
SPV: Add support for memory qualifiers.
2016-02-21 21:02:08 +08:00
John Kessenich
0967748fbc
SPV: Fix 'location' inheritance bug.
2016-02-19 12:21:50 -07:00
Rex Xu
5eafa472d3
SPV: Support the new OpCode - OpImageSparseRead
2016-02-19 22:24:03 +08:00
John Kessenich
6c292d3ba7
SPV: Implement Vulkan version of GLSL (KHR_vulkan_glsl).
2016-02-15 21:46:55 -07:00
John Kessenich
019f08fcd8
SPV: Fix issue #159 : use ExplicitLod forms for non-fragment stages.
2016-02-15 15:40:42 -07:00
John Kessenich
5d0fa9781b
SPV Capabilities: StorageImageExtendedFormats, StorageImageReadWithoutFormat, and StorageImageWriteWithoutFormat.
2016-02-15 11:57:00 -07:00
John Kessenich
5e80113939
SPV Capabilities: SampleRateShading, SparseResidency, MinLod, and ImageQuery.
2016-02-15 11:09:46 -07:00
John Kessenich
b0364dcc3e
SPV Capabilities: Image types.
...
SampledBuffer
ImageBuffer
Sampled1D
Image1D
SampledCubeArray
ImageCubeArray
SampledRect
ImageRect
InputAttachment
ImageMSArray
StorageImageMultisample
2016-02-14 17:37:30 -07:00
John Kessenich
3c52207e8a
SPV capabilities: Add int16, int64, float16, and float64.
2016-02-14 17:11:15 -07:00
John Kessenich
103bef9d74
SPV: Handle GLSL bool loads from a uniform buffer as a conversion from int -> bool.
...
SPIR-V bool is abstract; it has no bit pattern for storage with transparent memory.
OpenGL's convention is a bool in a uniform buffer is 32-bit int with non-0 being 'true'.
2016-02-08 21:41:30 -07:00