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
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
644c21025d
Parser: Type promotion for operator modulus(%) is missing.
2016-03-18 16:26:23 +08: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
5f934b039a
HLSL: Accept basic funtion definitions. (Not yet mapping input/output for entry point.)
2016-03-13 17:58:25 -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
Dejan Mircevski
2677d918f1
Test dead-decoration removal.
2016-03-11 12:06:41 -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
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
Brian Salomon
5dc8a76265
Fix line endings in Test/100.conf.
2016-03-03 12:12:07 -05: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
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
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
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
32cfd49b68
SPV: RelaxedPrecision: Plumb this through the full AST->SPV translator.
2016-02-02 13:55:29 -07:00
John Kessenich
9218759ebb
SPV: Address superset of issue #151 : missing OpCapability instructions.
...
This commit adds:
CapabilityGeometryPointSize
CapabilityTessellationPointSize
CapabilityClipDistance
CapabilityCullDistance
CapabilityMultiViewport
CapabilityTransformFeedback
CapabilityGeometryStreams
CapabilityDerivativeControl
CapabilityInterpolationFunction
2016-02-01 13:45:25 -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
4889167430
SPV: Use a more accurate MemorySemanticsAllMemory mask.
2016-01-22 10:15:03 -07:00
John Kessenich
cd26144d24
SPV: the OpImageTexelPointer sample 0 should be <id> of 0, not literal 0.
2016-01-22 09:54:12 -07:00
John Kessenich
7b9fa25bad
SPV: Add recursive distrubition of 'location' across structure members.
2016-01-21 18:56:57 -07:00
John Kessenich
7a53f76d38
SPV: Add unary-matrix operations, operating at vector level.
2016-01-20 11:19:27 -07:00
Dejan Mircevski
2ab5a373d9
Add Test/spv.for-complex-condition.vert.
2016-01-20 11:54:11 -05:00
Dejan Mircevski
213bbbe4a7
Split loop header from condition testing for for/while loops.
2016-01-20 11:51:43 -05:00
Dejan Mircevski
ed55bcd9f8
Don't remove SPIR-V blocks before codegen.
...
A removed block releases its instructions, so Module::idToInstruction
suddenly contains dangling references. The original motivation for
block removal was to skip some unreachable blocks, but that's already
achieved by InReadableOrder.cpp.
Also updated stale comments.
2016-01-19 21:18:14 -05:00
Dejan Mircevski
f3c63cc359
Move continue-block to after all branches.
2016-01-19 16:56:45 -05:00
Dejan Mircevski
e7f6cac1bd
Merge branch 'topo' into loopgen-after-readable-order
2016-01-19 16:47:41 -05:00
Dejan Mircevski
38d039d063
Rework inReadableOrder() as a recursive descent.
...
Add a test for unreachable merge block.
Update test results with the new order: mainly delaying merge blocks and
removing unreachable ones.
2016-01-19 10:14:50 -05:00
Dejan Mircevski
baa55a1591
Add spv.branch-return.vert and fix inReadableOrder().
2016-01-19 10:11:34 -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
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
e95fa5e095
Tests: Update to match previous pull request.
2016-01-13 19:04:19 -07:00