Rex Xu
17ff343bf4
SPV: Add missing extension declarations for certain AMD extensions.
2016-10-14 17:41:45 +08:00
baldurk
021dbb4cd4
Change negatable_left_shift and negatable_right_shift to inline funcs
...
* This avoids an internal compile error on VS2010 possibly related to
std::enable_if use.
2016-10-13 19:39:24 +02:00
baldurk
cabba60abf
Change {} constructor brackets to ()
2016-10-13 19:32:37 +02:00
baldurk
7cac9e7245
Change "using x = y;" to "typedef y x;" statements
2016-10-13 19:31:15 +02:00
baldurk
a227d27227
Explicitly implement default constructors
2016-10-13 19:30:27 +02:00
baldurk
1a65fc269c
Add std::isnan and std::isinf wrappers for VS2010 that doesn't have them
2016-10-13 19:28:54 +02:00
baldurk
033d3ef22c
Change enum class to plain enum
2016-10-13 19:28:20 +02:00
baldurk
ff160f15ef
Add #include <cstdint> for std::uint32_t usage
2016-10-13 19:24:42 +02:00
Maciej Jesionowski
7208a974aa
SPV: Use SampledImage with OpImageQueryLod
...
Khronos SPIR-V issue #74
2016-10-12 16:16:24 +02:00
Rex Xu
f3b27471f8
SPV: Implement extension SPV_KHR_shader_draw_parameters.
2016-10-11 14:40:35 +08:00
John Kessenich
ed33e05762
HLSL: Do structure conversion for return type struct-punning on non-entry-point functions.
2016-10-06 13:06:13 -06:00
John Kessenich
074ced3e00
Merge pull request #521 from yavn/frag-shader-primitive-id-capability
...
SPV: PrimitiveId in frag shader will emit OpCapability
2016-10-01 11:38:18 -06:00
Rex Xu
c9e3c3c941
Parser: Implement extension GL_AMD_gpu_shader_half_float.
...
- Add built-in types: float16_t, f16vec, f16mat.
- Add support of half float constant: hf, HF.
- Extend built-in floating-point operators: +, -, *, /, ++, --, +=, -=,
*=, /=, ==, !=, >=, <=, >, <.
- Add support of type conversions: float16_t -> XXX, XXX -> float16_t.
- Add new built-in functions.
2016-09-30 16:13:06 +08:00
Maciej Jesionowski
04b3e8746f
SPV: PrimitiveId in frag shader will emit Geometry capability
...
Using PrimitiveId in a fragment shader requires declaring
an OpCapability with either Geometry or Tessellation.
2016-09-27 10:35:09 +02:00
Rex Xu
b707205b0d
SPV: OpGroupBroadcast is unable to handle vector operand.
2016-09-26 15:53:40 +08:00
Rex Xu
36876e6408
SPV: Still have to specify SPIR-V extension for gl_SubGroupSizeARB and gl_SubGroupInvocationARB.
2016-09-23 22:13:43 +08:00
Rex Xu
5159664475
SPV: Implement the extension SPV_KHR_shader_ballot
2016-09-22 16:05:07 +08:00
John Kessenich
eee9d536bc
Track separate entry-point names and mangled names...
...
... and use each in the correct way at consumption sites.
This completes issue #513 .
2016-09-19 18:09:30 -06:00
John Kessenich
6fccb3cd75
Non-functional: Sweep through the stack for consistent with "main" and entry point.
...
Partially addresses issue #513 .
2016-09-19 16:01:41 -06:00
Rex Xu
64b9743ce0
SPV: Support simultaneous l-value swizzle and dynamic component selection.
2016-09-14 14:43:55 +08:00
John Kessenich
b3e24e4359
SPV: Fix issue #506 : generalize struct deep copy to include arrays.
2016-09-11 12:33:43 -06:00
Rex Xu
c9f349234f
SPV: Use OpBitcast to implement 4 pack/unpack built-in functions.
2016-09-09 17:50:07 +08:00
Rex Xu
64bcfdb632
Parser: Add 64-bit type conversion for specialization constant.
2016-09-05 22:20:28 +08:00
John Kessenich
4bf7155051
SPV: Flatten structs for copy when they are GLSL type aliases.
...
Addresses issue #304 and issue #307 by replacing unmatched type OpStores with
per-member copies. Covers assignment statements and most argument passing, but
does not yet cover r-value-based argument passing.
2016-09-02 16:35:01 -06:00
John Kessenich
f2b7f3353b
SPV: Tighten up number of struct-types declared based on decoration.
...
Takes some pressure off of issue #304 .
Structures don't inherit locations and then explicitly decorate
members with them, so removed this reason to have another instance
of a structure type.
2016-09-01 17:05:23 -06:00
steve-lunarg
a8456415b8
WIP: SPV Remapper: add remapper test framework
2016-08-25 10:46:51 -06:00
Rex Xu
2bbbe0621d
SPV: Some group invocation operations should be applied to scalars.
2016-08-23 15:41:05 +08:00
steve-lunarg
811d9f4cad
WIP: SPIRV remapper: allow 64 bit literals in OperandVariableLiteralId class iteration
2016-08-17 08:33:49 -06:00
Dan Baker
55d5f2d4df
HLSL: Changing SPIRV source language to unkown
2016-08-15 16:05:45 -04:00
David Neto
b86e8b629a
Revert "Merge pull request #456 from steve-lunarg/remapper-literal64"
...
This reverts commit ad08b30f69
, reversing
changes made to 28660bb580
.
This backs out the pull request
https://github.com/KhronosGroup/glslang/pull/456 because it introduced
several internal errors even on code that only uses 32-bit numeric
types.
2016-08-12 16:49:58 -04:00
steve-lunarg
b249f2fc24
SPIRV: allow 64 bit literals in OperandVariableLiteralId class iteration.
2016-08-12 09:53:31 -06:00
John Kessenich
2c6038ecf1
Merge branch 'cpp-headers'
2016-08-11 10:01:13 -06:00
John Kessenich
4583b61e20
HLSL: Smear scalars to match vectors for relational operations.
...
Yield a vector relational compare and a vector result.
2016-08-07 19:14:22 -06:00
John Kessenich
267590d452
Whitespace: Nonfunctional: fix inconsistent white space, esp. no tabs.
2016-08-05 17:34:34 -06:00
John Kessenich
66ec80e01b
Build: C++ headers: Replace PR #366 with a more directed version.
2016-08-05 14:04:23 -06:00
John Kessenich
f6640761c4
Front-end: Implement 2nd task of issue #400 ; precision of result and operation.
...
From the ES spec + Bugzilla 15931 and GL_KHR_vulkan_glsl:
- Update precision qualifiers for all built-in function prototypes.
- Implement the new algorithm used to distinguish built-in function
operation precisions from result precisions.
Also add tracking of separate result and operation precisions, and
use that in generating SPIR-V.
(SPIR-V cares about precision of operation, while the front-end
cares about precision of result, for propagation.)
2016-08-02 21:48:02 -06:00
John Kessenich
1176530bf5
SPV: Prevent issue #415 with better semantic checking.
2016-07-31 12:39:46 -06:00
Rex Xu
ce31aea0d0
SPV: Fix an issue of ++/-- for dvec/dmat.
2016-07-29 16:13:04 +08:00
John Kessenich
8c8505c604
SPV: For AST interpolateAt* ops consuming a swizzle, invert the order.
...
Apply the interpolation first, then apply the swizzle to the result,
the inverse of the order requested by the AST. This fixes issue #411 .
2016-07-26 12:53:54 -06:00
Pyry Haulos
b93e3a3957
Remap Scope and MemorySemantics IDs in SPIRV remapper
...
Scope and MemorySemantics operands contain IDs as well and may need
remapping.
2016-07-22 09:57:28 -07:00
Rex Xu
9d93a2370d
Implement 4 AMD-specific extensions.
...
- Support GL_AMD_shader_ballot (SPV_AMD_shader_ballot).
- Support GL_AMD_shader_trinary_minmax (SPV_AMD_shader_trinary_minmax).
- Support GL_AMD_shader_explicit_vertex_parameter
(SPV_AMD_shader_explicit_vertex_parameter).
- Support GL_AMD_gcn_shader (SPV_AMD_gcn_shader).
2016-07-20 16:18:05 +08:00
John Kessenich
4016e38bea
Build: Switch to Rev. 6 of headers, removing "BadValue" enum stuff.
...
Note: Technically, this is glslang's modified private copy of official headers.
Official headers will appear in other places, like
https://github.com/KhronosGroup/SPIRV-Headers .
2016-07-15 11:55:34 -06:00
John Kessenich
7f349c73db
Build: Remove causes of pedantic warnings. Addresses issue #352 and PR #242 .
2016-07-08 22:09:10 -06:00
John Kessenich
c45dddae5f
Merge pull request #314 from mre4ce/master
...
Added -x option to save SPIR-V as 32-bit hexadecimal numbers to a text file.
2016-07-08 15:26:27 -06:00
John Kessenich
78a4557621
SPV: Fix issue #376 ; declare Geometry capability for fragment use of gl_Layer.
2016-07-08 14:05:15 -06:00
John Kessenich
91e4aa5900
SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.
...
Includes adding test cases to verify the differences.
2016-07-07 19:27:15 -06:00
John Kessenich
2d0cc786f3
SPV: Turn on atomic-storage functionality for SPIR-V.
...
This is used by OpenGL, but not Vulkan.
Includes:
- atomicCounter, atomicIncrement, atomicCounterDecrement
- atomic_uint layout-offset checking
- AtomicStorage capability
2016-07-07 17:40:35 -06:00
John Kessenich
2f47bc9781
SPV: Don't decorate locations within an array, it doesn't make sense.
...
This fixes issue #360 .
2016-06-30 22:00:09 -06:00
John Kessenich
6090df0fa3
SPV: Non-functional: break up big function into three smaller ones.
...
Also, improve variable names. This grew to be overly hard to understand.
2016-06-30 21:28:33 -06:00
Rex Xu
c884b4a47f
SPV: Certain decorations are missing for structure-typed in/out variables.
2016-06-30 13:11:36 +08:00
LoopDawg
6e72fddaa2
Add HLSL memory barrier intrinsics, fix dst, add lit & EvaluateAttributeSnapped
2016-06-20 09:53:59 -06:00
John Kessenich
5aa59e2044
HLSL: Map parameter qualifiers from generic to function-specific and entry-point specific.
2016-06-17 15:52:46 -06:00
John Kessenich
65336488a8
SPV: projective texturing: move the project coordinate.
...
SPV doesn't allow gaps in the components of the texturing coordinate.
It also removes the shadow reference.
So, close up the components so all used components are together.
2016-06-16 14:06:26 -06:00
John Kessenich
76d4dfcd51
SPV non-functional: minor readability improvements for texturing.
2016-06-16 12:43:23 -06:00
John Kessenich
c51287d744
SPV: Update to spec. decisions (and issue #205 ) for barrier().
...
A barrier (ESSL/GLSL) or OpControlBarrier when in a tessellation control
shader also means doing memory synchronization for output variables.
2016-06-14 19:50:26 -06:00
LoopDawg
592860cae5
Add decompositions for some HLSL intrinsics.
2016-06-10 17:11:18 -06:00
Jason Ekstrand
ed15ef1a5b
GlslangToSpv: Pass the pointer directly into the client function for opaque types
...
For opaque types such as samplers, images, and atomic counters, we want to
reference the actual object in the child function. For a long time, we
used a shadow variable and made a copy of the image/sampler. In 76d0ac1a
,
this was changed to not shadow samplers. However, this didn't cover all
opaque types and it also didn't get the pointer storage classes right.
This commit fixes both of these issues.
Fixes #324
2016-06-08 17:22:46 -07:00
Jason Ekstrand
c24cc29d37
GlslangToSpv: Properly handle opaque types in TranslateStorageClass
2016-06-08 17:05:19 -07:00
David Neto
a901ffed40
Defer capability decl for ClipDistance, CullDistance, PointSize until actual use
...
The compiler will mark struct members with those builtins, but won't
declare the capability until that member is accessed by some executable
instruction.
Test changes:
- spv.430.vert: was missing ClipDistance capability.
- spv.precise.tese: remove TessellationPointSize capability.
2016-06-08 09:30:04 -04:00
GregF
39d5e711a7
remapper: do not eliminate interface variables in dce by default
...
this is done by counting op_entrypoint as a use/def
2016-06-03 09:57:57 -06:00
John Kessenich
a5c33d6ffb
SPV: Fix issue #320 : Fetch needs to extract the image.
...
GLSL takes a traditional sampler, but SPIR-V wants just the
sampled image, not the combined sampler and image.
2016-06-02 23:47:29 -06:00
iostrows
af7f1c8f24
Fix double matrix creation
2016-06-01 16:40:00 +02:00
John Kessenich
d94c003fb7
Front-end: Complete GL_ARB_compute_shader implementation.
...
Core compute shaders were working, but the extension wasn't implemented.
2016-05-30 19:29:40 -06:00
Johannes van Waveren
ecb0f3b75b
Added -x option to save SPIR-V as 32-bit hexadecimal numbers to a text file.
2016-05-27 12:55:53 -05:00
Jason Ekstrand
76d0ac1a6f
SPV: Don't shadow sampler parameters when performing function calls
...
Fixes #179
2016-05-25 13:49:47 -07:00
Rex Xu
bbceed7be3
SPV: Fix an issue of interpolation decoration.
...
GLSL interpolation qualifiers and auxiliary storage qualifiers are not
mutually exclusive. So when they are translated to SPIR-V decorations, two
independent utility methods should be employed to do this job.
2016-05-21 09:45:47 +08:00
John Kessenich
22e0d41448
SPV: Don't put locations on OpTypeStruct. Related to Issue #291 .
2016-05-20 15:40:53 -06:00
John Kessenich
8d72f1a2c4
Full stack: distinguish between a scalar and a vector of size 1.
...
There have been GLSL extensions considering this, and HLSL does it.
This is a fully backward compatible change that allows this distinction.
2016-05-20 12:14:39 -06:00
John Kessenich
823fc65644
SPV: Don't emit memory barrier for ESSL barrier(), but still do for GLSL barrier().
...
Addresses issue #205 .
Current open Khronos bug for finalizing this.
2016-05-19 18:26:42 -06:00
scygan
2c86427640
Fix missing location decoration for structures put directly on input/output interfaces
...
Spec for decorating the OpVariable:
"The remaining variables listed by OpEntryPoint with the Input or Output storage class form the user-defined variable interface. These variables must be identified with a Location decoration"
Spec for decorating struct type:
"The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration).
If it is a not a Block, then the structure type must have a Location decoration"
2016-05-18 18:22:21 +02:00
John Kessenich
9af54c3337
Non-functional: Fix some comments English and brace formatting in recent merges.
2016-05-17 10:24:00 -06:00
John Kessenich
6e0985dd9d
Merge branch 'struct_member_decorations' of https://github.com/scyganINTEL/glslang into scyganINTEL-struct_member_decorations
2016-05-17 10:03:37 -06:00
Rex Xu
c1992e5e57
SPV: Correct an issue in createUnaryMatrixOperation().
...
Type of the source is not necessarily the same as that of the destination.
2016-05-17 18:57:18 +08:00
John Kessenich
bedde872b6
Merge pull request #285 from baldurk/vs2010-fixes
...
VS2010 compilation fixes
2016-05-17 00:31:36 -06:00
John Kessenich
ebb505355d
SPV: Don't add clip/cull distance capabilities unless used.
...
These capabalities were added on declaration of the members, but
that is considered too aggressive, as those members are automatically
declared in some shaders that don't use them. Now, actual access
is needed to make the capabalities be declared.
2016-05-16 19:32:59 -06:00
baldurk
ab44ba757e
[VS2010] Remove use of ranged-for loops
2016-05-17 01:20:30 +02:00
baldurk
c1d81cb171
[VS2010] Remove use of "= default" and "= delete"
2016-05-17 01:20:25 +02:00
Rex Xu
73e3ce78f4
SPV: Handle matrix's OpFConvert vector by vector.
2016-05-14 09:20:52 +08:00
Rex Xu
5839031759
SPV: Add capability ImageGatherExtended if necessary.
2016-05-11 16:38:50 +08:00
Lei Zhang
cb3236d9f9
Use std::string for TBD/missing functionality reporting.
...
We can have multiple instances of the same string, so comparing
const char* is not guaranteed working.
Fixed the failure on VS 2013 with Debug build.
2016-05-10 10:52:32 -04:00
qining
25262b3fd9
Resolve comments
...
1. Sink adding noContraction decoration to createBinaryOperation() and
createUnaryOperation().
2. Fix comments.
3. Remove the #define of my delimiter, use global constant char.
2016-05-09 10:46:40 -04:00
qining
9220dbb078
Precise and noContraction propagation
...
Reimplement the whole workflow to make that: precise'ness of struct
members won't spread to other non-precise members of the same struct
instance.
Approach:
1. Build the map from symbols to their defining nodes. And for each
object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
accesschain path. Different AST nodes that indicating a same object
should have the same accesschain path.
2. Along the building phase in step 1, collect the initial set of
'precise' (AST qualifier: 'noContraction') objects' accesschain paths.
3. Start with the initial set of 'precise' accesschain paths, use it as
a worklist, do as the following steps until the worklist is empty:
1) Pop an accesschain path from worklist.
2) Get the symbol part from the accesschain path.
3) Find the defining nodes of that symbol.
4) For each defining node, check whether it is defining a 'precise'
object, or its assignee has nested 'precise' object. Get the
incremental path from assignee to its nested 'precise' object (if
any).
5) Traverse the right side of the defining node, obtain the
accesschain paths of the corresponding involved 'precise' objects.
Update the worklist with those new objects' accesschain paths.
Label involved operations with 'noContraction'.
In each step, whenever we find the parent object of an nested object is
'precise' (has 'noContraction' qualifier), we let the nested object
inherit the 'precise'ness from its parent object.
2016-05-09 10:46:40 -04:00
John Kessenich
d3d3ce7160
Comments only.
2016-05-06 13:06:11 -06:00
scygan
8add151c4b
SPIR-V do not decorate: members of plain structs with location; non-top level members with interp.
...
This fixes some vulkanCTS tests that use struct arrays as a member of in/out interface blocks.
From Vulkan spec:
"If it is a not a Block, then the structure type must have a Location decoration. Its members are assigned consecutive locations in their declaration order, with the first member assigned to the location specified for the structure type. >>>>> The members, and their nested types, must not themselves have Location decorations <<<<"
From SPIR-V spec:
"When applied to structure-type members, the Decorations Noperspective, Flat, Patch, Centroid, and Sample can only be applied to the top-level members of the structure type. (Nested objects' types cannot be structures whose members are decorated with these decorations.)"
2016-05-06 16:54:54 +02:00
John Kessenich
91cef52f63
SPV: Non-functional: modularize createInvocationsOperation() from the previous commit.
2016-05-05 16:45:40 -06:00
John Kessenich
baa9fa5df7
Merge branch 'feature2' of https://github.com/amdrexu/glslang into amdrexu-feature2
2016-05-05 16:32:39 -06:00
John Kessenich
e2d06dbf60
Merge pull request #268 from AWoloszyn/update-cmake
...
CMake: Updated to better organize folders and options.
2016-05-05 13:46:36 -06:00
Andrew Woloszyn
db0eaf9887
Updated cmake to better organize folders and options.
...
This adds solution folders that properly group gtest/glslang/hlsl.
This also marks gtest options as advanced so they don't show up
in cmake-gui by default.
2016-05-05 14:45:53 -04:00
John Kessenich
c8a5676025
Merge branch 'feature' of https://github.com/amdrexu/glslang into amdrexu-feature
2016-05-05 12:04:22 -06:00
Lei Zhang
17535f7d55
Create a new logger class for all messages w.r.t. SPIR-V build.
2016-05-05 10:15:06 -04:00
Lei Zhang
09caf12bec
Avoid printing to stdout directly in library functions.
...
Previously GlslangToSpv() reported missing/TBD functionalities
by directly writing to stdout using printf. That could cause
problems to callers of GlslangToSpv(). This patch cleans up
the error reporting logic in GlslangToSpv(), TGlslangToSpvTraverser,
and spv::Builder a little bit to use ostringstream.
Also fixed the usage of GlslangToSpv() in GTest fixtures to
capture warnings/errors reported when translating AST to SPIR-V.
2016-05-05 10:15:06 -04:00
Rex Xu
338b185a2b
Implement the extension GL_ARB_shader_group_vote.
2016-05-05 20:38:33 +08:00
Rex Xu
574ab04caa
Implement the extension GL_ARB_shader_ballot
...
Add new built-in variables and functions to the parser (SPIR-V tokens are missing).
2016-05-05 19:02:35 +08:00
Lei Zhang
3f460532cc
Remove duplicated cmake_minimum_required() calls.
2016-05-04 17:01:36 -04:00
Rex Xu
8ff43de891
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.
2016-04-30 13:34:34 +08:00
Rex Xu
c7d3656dde
SPV: Use OpLogicalEqual/OpLogicalNotEqual for boolean type comparison.
2016-04-27 08:15:37 +08:00
qining
1f2820a3d3
fix the problem that spec constant composite instruction being used when only front-end constants are used in the constructor
2016-04-14 18:34:27 -04:00
qining
27e04a004d
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()
2016-04-14 17:52:57 -04:00
qining
189b2033a4
Refine the code and address comments
2016-04-12 23:19:28 -04:00
qining
e24aa5edbb
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)`
2016-04-12 22:01:55 -04:00
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
103bef9d74
.
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
Csaba Osztrogonác
f947debf70
Fix typo in an include guard.
2016-02-05 07:40:35 -08:00
John Kessenich
32cfd49b68
SPV: RelaxedPrecision: Plumb this through the full AST->SPV translator.
2016-02-02 13:55:29 -07:00
John Kessenich
26bd6a313d
Merge pull request #155 from mgadams/resultid_warnings
...
Build: Fix two new Windows build warnings/errors
2016-02-02 09:14:38 -07:00
Mark Adams
d5ac538e23
Fix two new Windows build warnings/errors
2016-02-01 19:13:06 -08:00
GregF
8548bab1fa
spirv-remap: Fixed strings not at end of operands, fixed L/S defect
...
Also added new op classes.
2016-02-01 16:44:57 -07:00
GregF
036a7944e5
spirv-remap: assert on unhandled OperandClass
2016-02-01 16:13:21 -07:00
GregF
796e15ad27
spirv-remap: inhibit loadstore opt if variable ref'd by other instructions
2016-02-01 16:12:48 -07:00
GregF
3bb040b71b
spirv-remap: handle OperandImageOperands during remap
2016-02-01 16:12:00 -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
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
John Kessenich
dd1c223561
Merge pull request #138 from dekimir/fix-old-msvc
...
Fix #137 by avoiding a C++11 feature.
2016-01-20 10:46:40 -07:00
Dejan Mircevski
213bbbe4a7
Split loop header from condition testing for for/while loops.
2016-01-20 11:51:43 -05:00
Dejan Mircevski
97605c86fd
Fix #137 by avoiding a C++11 feature.
...
Apparently, older MSVC versions don't support brace-initializers for
function arguments.
Thanks @baldurk for a suggestion on his branch.
2016-01-20 10:25:28 -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
159b59faa7
Reformat to better match existing style.
2016-01-19 14:52:31 -05:00
Dejan Mircevski
cce6a8acaf
(C) Google
2016-01-19 14:50:12 -05:00
Dejan Mircevski
34bc6c3896
Explicitly initialize Instruction::block.
2016-01-19 14:08:32 -05:00
Dejan Mircevski
a7e734962e
Remove a redundant check before visit(succ).
2016-01-19 11:49:37 -05:00
Dejan Mircevski
57bbde4a99
Add copyright, remove unused #includes.
2016-01-19 11:44:53 -05:00
Dejan Mircevski
fa242904b0
Make Instruction::getBlock() const.
2016-01-19 11:31:55 -05:00
Dejan Mircevski
377f0cab26
Fix merge issues.
2016-01-19 10:17:33 -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
9c591487ad
Fix spv.branch-return.vert.
2016-01-19 10:11:34 -05:00
Dejan Mircevski
baa55a1591
Add spv.branch-return.vert and fix inReadableOrder().
2016-01-19 10:11:34 -05:00
Dejan Mircevski
44bfb0d0cd
Implement inReadableOrder().
2016-01-19 10:11:34 -05:00
Dejan Mircevski
454796e008
Call addPredecessor() on OpSwitch blocks.
2016-01-19 10:10:15 -05:00
Dejan Mircevski
5fe789b4af
Add Block::successors.
2016-01-19 10:10:15 -05:00
John Kessenich
3e9add360d
Merge pull request #133 from AWoloszyn/spirv-memory
...
Free memory associated with SPIR-V generation and the pragmaTable.
2016-01-18 10:48:07 -07:00
Andrew Woloszyn
b7946d16bb
Free memory associated with SPIR-V generation.
2016-01-18 10:29:41 -05: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
Dejan Mircevski
dba2826328
Merge branch 'master' of github.com:google/glslang into loopgen
...
Change-Id: Ie8236430bb9e30a9be2e0c1573c42183c2f4d0d4
2016-01-11 16:26:18 -05:00
Dejan Mircevski
832c65c33b
Fix back-branch target for do-while loops.
...
To ensure back branches always go to a header block, create a header
block even for !testFirst loops. Then unify common code between the
testFirst/!testFirst cases.
Generate the header-block code first, so update golden files.
Realize that certain infinite loops generate invalid SPIR-V, so put a
TODO to instead abort code generation in such cases.
Change-Id: I1e173c8f73daad186cfc666b7d72bd563ed7665d
2016-01-11 15:57:11 -05:00
Dejan Mircevski
c8fbbab419
Update .out files with new loop SPIR-V.
...
Also update breakForLoop and call builder.closeLoop() in code
generation.
Remove dead code.
Change-Id: Ic8ce5b208530f8787989ef45a2efa405f1b45310
2016-01-11 14:48:36 -05:00
Dejan Mircevski
7819bee82c
Switch loops stack to use LoopBlocks.
...
Also remove dead code.
Change-Id: I2c0177d8cab48b7d6f9442715aecb7951597f3c8
2016-01-11 09:35:22 -05:00
Dejan Mircevski
e537b8b488
Fix unreachable-block removal.
...
Add a test for loop without a condition.
Change-Id: Idd7fc462218a84b1e745207e2975a3f2897d30a0
2016-01-10 19:37:00 -05:00
Dejan Mircevski
9c6734c8df
First cut at new loop codegen.
...
Change-Id: Id3bdf8b7a5606e7ce5d856ef225d5ddbe59a584b
2016-01-10 12:15:13 -05:00
Mark Adams
364c21c8c0
Fix several build warnings/error encountered with VS2013
...
This also fixes the newlines for spirv.hpp to be consistent with the rest of the files.
2016-01-06 13:41:02 -05:00
Rex Xu
48edadfd24
Parser & SPV: Implement two extensions regarding GLSL sparse texture.
...
Implement extension "GL_ARB_sparse_texture2".
Implement extension "GL_ARB_sparse_texture_clamp".
2016-01-05 16:07:02 +08:00
John Kessenich
e23c9849c2
SPV: Handle type punning in createCompositeCompare().
2016-01-04 23:59:09 -07:00
John Kessenich
f8842e55c0
SPV: Don't do stride decorations for arrays of arrays of blocks.
2016-01-04 19:22:56 -07:00
John Kessenich
c9e0a42b92
SPV: Handle stride decorations for arrays of arrays, and using multiple type instances when strides are used.
2015-12-29 21:27:24 -07:00
John Kessenich
4998789d4e
SPV: Fix array strides by explicitly computing them in the getBaseAlignment() algorithm.
2015-12-29 19:20:55 -07:00
John Kessenich
e0b6cad44f
SPV: Generalize multiple struct-type instances for interpolation/invariant qualifiers.
2015-12-24 10:30:13 -07:00
John Kessenich
50e57560a1
SPV: Don't make MissingFunctionality() exit anymore.
2015-12-21 21:21:11 -07:00
John Kessenich
2211835b4d
SPV: Implement composite comparisons (reductions across hierchical compare).
2015-12-21 20:54:09 -07:00
John Kessenich
59420fd356
SPV: Move to deterministic results for OpEntryPoint, for test stability across platforms.
2015-12-21 11:45:34 -07:00
John Kessenich
7ba6341a05
SPV: Make OpEntryPoint I/O list include all static uses.
...
Before, it was only including explicit interface, sufficient for IO-Block-declared
oriented interface, but not sufficient for all modes GLSL might be used with
SPIR-V.
Two things are accomplished now:
1) each id will appear exactly once
2) the OpEntryPoint list will union static use with declarations
2015-12-20 17:37:07 -07:00
John Kessenich
3ac051e41d
SPV: recursively propagate row/col majorness through nested structures.
...
This includes doing structure uniqueness modulo majorness, for shared nested structures.
2015-12-20 12:25:21 -07:00
John Kessenich
f85e806e44
SPV: Nested layouts: Recursively send around the top-level std140 or std430 packing.
...
This also distinguishes between the same struct included in multiple parent packings.
2015-12-19 15:21:38 -07:00
John Kessenich
b62e693f74
Merge pull request #118 from amdrexu/bugfix
...
SPV: Fix an issue related with imageStore() for 2DMS.
2015-12-19 11:20:25 -07:00
John Kessenich
b6d7fa91a1
Merge pull request #117 from amdrexu/feature
...
SPV: Implement GLSL built-in bitcast functions.
2015-12-19 11:08:02 -07:00
John Kessenich
61c47a951b
Constant folding: Correct result type of non-square matrix folding.
...
This also made the function easier to read by identifying
left and right operands more clearly.
2015-12-16 15:50:25 -07:00
Rex Xu
7beb44190f
SPV: Fix an issue related with imageStore() for 2DMS.
2015-12-15 17:52:45 +08:00
Rex Xu
cbc426ee62
SPV: Implement GLSL built-in bitcast functions.
2015-12-15 16:03:10 +08:00
John Kessenich
e7c83cfb8c
SPV GLSL.std.450: Add needed smear operations for min, max, clamp, mix, step, and smoothstep.
2015-12-13 13:34:37 -07:00
John Kessenich
6feb4989fe
SPV texturing: Use comp. 2 as the 3rd comp. for Dref in ImageSampleProjDrefImplicitLod.
2015-12-13 12:23:33 -07:00
John Kessenich
04bb8a01d6
SPV: Implement all matrix operators {+,-,*,/} for {matrix,scalar,vector}.
2015-12-12 12:28:14 -07:00
John Kessenich
76f7139789
SPV: Modify last merge: Have promoteScalar() generate the correct vectorType.
2015-12-09 19:08:42 -07:00
Rex Xu
e723b45bca
SPV: Scalar smear operation should use type of the scalar to make the
...
expected vector type when the provided vector type is incompatible with
the scalar.
2015-12-09 16:05:06 +08:00
John Kessenich
e00e72ded1
SPV: Protect getStorageClass() with a test that the thing is pointer.
2015-12-08 20:48:49 -07:00
John Kessenich
33661450c7
SPV: Implement OpImage functionality (emit before query).
2015-12-08 19:32:47 -07:00
Rex Xu
7a26c176ce
SPV: Implement GLSL interpolation built-in functions.
2015-12-08 17:40:11 +08:00
David Neto
8d63a3d35a
Avoid read past end of operands vector for EOpFrexp
...
When emitting SPIR-V code for frexp, avoid access
beyond the end of the operands vector. When constructing
the OpExtInst, construct a new arguments vector instead of
modifying the existing operands vector. In the case of OpFrexp,
well need that last operand later on to generate the store.
Fixes https://github.com/KhronosGroup/glslang/issues/110
Change-Id: Ibc380fadf5e600ac491932e9ecef7afe2d72fd7f
2015-12-07 16:24:31 -05:00
John Kessenich
2359bd0a1d
SPV: Fix extra operands when using the "struct" form of a built-in taking an 'out' param.
2015-12-06 19:29:11 -07:00
John Kessenich
e721f49dbd
SPV: Distinguish between std140 and std430 layouts, and correctly use alignments as the base for strides.
2015-12-06 19:17:49 -07:00
Rex Xu
71519fe70b
SPV: Fix an issue related with using CubeArrayShadow for texture()
2015-11-22 21:43:05 +08:00
baldurk
08dee03d18
Remove include_directories from CMakeLists, to enforce relative includes
...
* This also moves bison generated files into the source tree, so that
include of glslang_tab.cpp.h and includes from glslang_tab.cpp work
the same way.
2015-11-16 18:05:18 +01:00
baldurk
e915da4aee
Remove unnecessary include path relative to root
2015-11-16 18:05:18 +01:00
John Kessenich
55e7d11ce8
SPIR-V: Move from Version .99 Rev 31 to Version 1.0, Rev 2.
2015-11-15 22:31:41 -07:00
Mark Adams
c11e95f6e5
Various build fixes when using newer GCC versions with warnings enabled
...
Encountered with GCC-4.7.3 in a build environment where warnings are enabled
and treated as errors.
2015-10-26 12:38:46 -04:00
John Kessenich
7c1aa1026e
SPV: Implement short circuiting of && and || when emitting SPIR-V.
2015-10-15 13:50:48 -06:00
John Kessenich
da581a2b95
GL_ARB_shader_draw_parameters: From @amdrexu, implement extension.
2015-10-14 14:10:30 -06:00
John Kessenich
e690332c3c
SPV: Add modes for spacing, depth, depth replacing, winding, and point mode.
2015-10-13 16:29:02 -06:00
John Kessenich
f685df8c16
Add comment that was missed in previous commit.
2015-10-13 10:55:08 -06:00
John Kessenich
716312771c
SPV constants and constOffsets completion: isConstant() and disassembler to see results.
...
Expand to full isConstant() implementation.
Fix disassembler to generate texture look-up masks.
2015-10-13 10:45:22 -06:00
Rex Xu
86e608133c
Generate correct image operand mask for Offset and ConstOffset( #77 )
2015-10-11 19:37:48 +08:00
John Kessenich
ee21fc9081
SPV: Fix missing 'Member' operand to OpArrayLength.
2015-09-21 21:50:29 -06:00
John Kessenich
142d7780a4
SPV 31: Remove obsolete and unused ../SPIRV/GLSL450Lib.h.
2015-09-21 10:39:20 -06:00
John Kessenich
ff4f04dd0e
Merge pull request #75 from google/fix-vs2013-debug
...
SPV non-determinism: Fixed subtle issue that causes tests to fail in VS2013 in some configs.
2015-09-21 10:00:42 -06:00
John Kessenich
f82c661462
SPV: Remove old Rev. 30 header spirv.h (glslang has been using Rev. 31 spirv.hpp).
2015-09-21 08:59:47 -06:00
Andrew Woloszyn
2d83ab2f57
Fixed subtle issue that causes tests to fail in VS2013 in some configs.
...
Depending on specific optimization settings VS2013 will sometimes
execute the operands to
new Instruction(builder.getUniqueId(), builder.makeBoolType(), OpPhi)
left-to-right, and sometimes right-to-left. Since makeBoolType can
also call getUniqueId(), the IDs to the OpPhi can sometimes be swapped.
This guarantees an explicit ordering of the Ids so that tests work
reliably.
2015-09-18 16:12:03 -04:00
John Kessenich
b56a26ab4d
SPV: Generate the LocalSize Execution Mode for compute shaders.
2015-09-16 16:04:05 -06:00
John Kessenich
56bab0483a
SPV: Minor corrections to previous big merge for images and atomics.
2015-09-16 11:42:16 -06:00
Rex Xu
6b86d496c2
Add new test case for image functions and fix issues caught by this test
2015-09-16 17:48:22 +08:00
Rex Xu
bba5c80957
Merge master branch from upstream
2015-09-16 13:20:37 +08:00
Rex Xu
04db3f5aa4
Fix issues from review comments and those relevant to texelFetch
2015-09-16 11:44:02 +08:00
John Kessenich
3e60a6ff13
SPV OpAtomicCompareSwap: Generate correct operand order and number of operands.
2015-09-14 22:45:16 -06:00
John Kessenich
7355eebb18
SPV legacy texturing: Smear result of Op*Dref* up to a vector to match
...
the expectations of old GLSL shadow*() lookups.
2015-09-14 22:08:12 -06:00
John Kessenich
e770b3e6cf
SPV return from main: Simplify a legacy design such returns are not jumps to exit block.
...
Structured control-flow rules allow leaving the middle of a construct through
a return, but not through a jump to a block that does a return.
Addresses issue #58 .
2015-09-14 21:08:58 -06:00
Rex Xu
30f9258d5e
Merge master branch from upstream
2015-09-14 10:38:56 +08:00
John Kessenich
fa668dad99
SPV: Reduce spurious type generation by removing intermediate types in the middle of access chains.
...
This generally simplifies access chain generation, with far fewer type conversions.
It is particularly important to future SPIR-V changes where there is less aggregate
type uniqueness due to carrying different layout information with the type.
2015-09-13 14:46:30 -06:00
John Kessenich
c9a808319a
SPV arrays: Add support for runtime-sized array types and arrays of arrays.
...
This includes run-time block.member.length() (OpArrayLength).
2015-09-13 10:18:19 -06:00
John Kessenich
a06bd527ca
SPV: Correct generation of transparent offsets for implicitly assigned offsets.
2015-09-11 15:15:23 -06:00
John Kessenich
31ed4830d1
SPV: Only decorate array and matrix strides for transparent types requiring explicit layouts.
2015-09-09 17:51:38 -06:00
John Kessenich
0487d550d1
Merge pull request #69 from jekstrand/texel-fetch
...
SPIR-V: Add support for texelFetch
2015-09-09 16:33:45 -06:00
Rex Xu
fc6189197d
SPIRV: Add the support of missing image functions #72
2015-09-09 16:42:49 +08:00
Rex Xu
d4782c10d4
SPIRV: Token layout of OpAtomicXXX instructions is incorrect #70
2015-09-06 16:30:11 +08:00
Jason Ekstrand
18b9fbd742
SPIRV: Add support for texelFetch
...
There's nothing really special about texelFetch other than the opcode and
some restrictions so adding it is pretty trivial.
2015-09-05 14:17:24 -07:00
Jason Ekstrand
54aedf1f66
SPIRV: Decorate matrices and arrays with their strides
2015-09-05 09:50:58 -07:00
John Kessenich
78258d3d40
Fix misspelled EOpFrexp and EOpLdexp.
2015-08-19 17:30:12 -06:00
John Kessenich
fc51d284aa
Backward incompatible: Turn on PureOperatorBuiltins: use only enum-based built-in functions in the AST.
...
If this breaks your AST consumer, best is to modify it to test
against the enum values instead of doing string comparisons on
built-in function names. This is the reason the change was made.
If you need the old behavior, you should be able to get it back by changing
PureOperatorBuiltins to be false instead of true. This path will work for
a while, but is marked deprecated.
Also, the old behavior is tagged as release 2.4.
2015-08-19 13:43:25 -06:00
Andrew Woloszyn
8b64fa5474
Fixes for compiling glslang on Android.
...
Primarily fix is due to Android not supporting std::to_string().
2015-08-17 11:39:38 -04:00
John Kessenich
f99b7dde08
Merge pull request #54 from mknejp/master
...
SPIR-V: Return undefined values from implicit returns instead of dummy
2015-08-11 14:25:20 -06:00
Steve
3573f2e029
Add missing OpTypeSampledImage to prevent unknown type error from SPVRemapper.
2015-08-11 09:20:14 -06:00
Miro Knejp
28f9b1c28d
SPIR-V: Return undefined values from implicit returns instead of dummy
...
Previously if a non-void function implictly returned, a dummy variable
was created as return value. Now instead it returns the result of the
OpUndef instruction. This better conveys the presence of undefined
behavior to SPIR-V consuming tools (and humans).
It also saves one ID per occurrence...
2015-08-11 03:26:46 +02:00
John Kessenich
65c78a0b62
Array of array: Implement the core functionality: types, constructors, operations.
...
There will be subsequent commits to refine semantics, esp. version-specific semantics,
as well as I/O functionality and restrictions.
Note: I'm getting white-space differences in the preprocessor test results,
which I'm not checking in. I think they need to be tagged as binary or something.
2015-08-10 17:08:55 -06:00
John Kessenich
6726cccc91
Add new SPIR-V 31 files.
2015-08-06 22:59:24 -06:00
John Kessenich
5e4b1242bf
Move to revision 31 of SPIR-V.
2015-08-06 22:55:01 -06:00
John Kessenich
306695360d
Fixes to 8f1684b7bb
, merge pull request 52.
2015-08-06 22:02:24 -06:00
baldurk
d7c5ead6a1
Compile fixes for gcc -Wall
2015-08-05 21:04:23 +02:00
John Kessenich
61d7d7ad73
Revisioning: Include GLSL.std.450 version. Also, the revision.h script now includes redirection to revision.h.
2015-08-03 12:04:56 -06:00
John Kessenich
426394d0c8
AST -> SPV: Add basic atomic_uint and atomic*() built-in function functionality.
2015-07-23 10:22:48 -06:00
John Kessenich
c040e76c58
Portability: Remove unneeded "= default" to work with older compilers.
2015-07-22 15:25:59 -06:00
David Neto
3e6a33cedf
spv::Builder::Loop constructor inits all members.
...
After construction, the Loop is effectively const.
This perturbs the IDs in SPIR-V tests because the body block
is created before generating any of the loop code, rather than
only when the body is first referenced.
2015-07-22 12:24:21 -04:00
John Kessenich
96f4911351
SPV: Make previous commit compile with MSVC 2012.
2015-07-20 22:34:49 -06:00
John Kessenich
37e8337958
Merge pull request #22 from google/structured-do-while
...
Generate correctly structured do-while loops.
2015-07-20 22:14:38 -06:00
John Kessenich
2f273369e4
Performance: Simple upgrade/cleanup of stl c++11 containers (10% perf. increase).
2015-07-19 12:03:51 -06:00
David Neto
c22f37cfb4
Generate correctly structured do-while loops.
...
The loop test is always emitted before the loop body.
For do-while loops, use a phi node to track whether we're
on the first loop iteration, and only check the loop test
on the second and subsequent iterations.
For do-while loops, the loop test branch no longer occurs
at the top of the loop, so it must get its own selection
merge instruction.
A block can't be the target of more than one merge instruction.
So when the loop test executes after the body (as in do-while in GLSL)
we need to introduce a dummy block to be the target of the selection
merge just before the loop test conditional branch.
The other arm of the branch exits the loop and hence is the
"break block" exception in the structured control flow rules.
2015-07-17 17:51:51 -04:00
Steve
465a14666a
Comment out some dead assignments per suggestion from static analysis tools.
...
Code is left in as comments for clarity to humans.
2015-07-15 14:34:35 -06:00
John Kessenich
9e55f633bc
Include specification revision as part of the version string.
2015-07-15 10:03:39 -06:00
John Kessenich
eebb20511f
Merge pull request #11 from baldurk/size-t-int-warning-fixes
...
Fix warnings compiling on x64 with size_t to int casts
2015-07-14 12:25:55 -06:00
John Kessenich
f98ee23415
Fix incorrect used of snprintf()
2015-07-12 19:39:51 -06:00
John Kessenich
68d78fd31e
Updated command-line options, adding -o for saving binaries, -G for OpenGL SPIR-V validation, -v etc.
...
Old uses should still work as they did before.
Also encapsulated use of these flags during parsing, for the parse context.
Added SPIR-V version to -v.
2015-07-12 19:28:10 -06:00
baldurk
d76692dfb8
on x64, size_t is 64-bit and int is 32-bit, so needs an explicit cast
2015-07-12 11:32:58 +02:00
John Kessenich
1f654e1603
Merge pull request #4 from baldurk/relative-include-paths
...
include by relative path, so root doesn't need to be in the search path
2015-07-11 16:41:38 -06:00
Andre Weissflog
a5ade51363
Fix most clang warnings
...
- member initializing order in some constructors
- missing default branches in switch-case
- uninitialized variable if switch-case default (uncritical because
program would exit)
- && and || brace warnings in if()
2015-07-11 14:45:57 +02:00
baldurk
42169c5fee
include by relative path, so root doesn't need to be in the search path
2015-07-08 15:27:29 +02:00
John Kessenich
e0603a441e
Front-end: move to rational internal array-of-array interfaces and design. (A-of-A is not yet implemented though.)
2015-07-06 21:00:03 -06:00
John Kessenich
ec43d0abec
glslang -> SPIR-V: smear scalars for integer (scalar * vector). OpVectorTimesScalar is only for floats.
2015-07-04 17:17:31 -06:00
Felix Kaaman
61deffd92a
Fix include directive depending on root folder name
2015-07-02 15:25:23 +02:00
John Kessenich
140f3df134
Final round for line endings.
2015-06-26 16:58:36 -06:00
John Kessenich
e5e0f6e37a
glslang -> SPV: swap arguments as needed for OpVectorTimesScalar and OpMatrixTimesScalar, and check for correct types for those as well as OpMatrixTimesVector, OpVectorTimesMatrix, and OpMatrixTimesMatrix.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31486 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-13 00:48:48 +00:00
John Kessenich
8d64d44c3f
glslang -> SPV: fix degenerate switch topologies (bug 14118).
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31485 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-12 22:34:37 +00:00
John Kessenich
fae38ee277
glslang portability: Fixed a slew of OSX compilation warnings (but not all).
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31469 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-10 23:23:12 +00:00
John Kessenich
79eaa91e6f
glslang portability: Resolve OSX errors, some other OS warnings.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31468 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-10 22:05:48 +00:00
John Kessenich
3ef22f2139
SPV compressor: Fixes a possible asserts. Attribution: spvremapper@lunarg.com
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31451 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-06-09 02:01:53 +00:00
John Kessenich
06e1d0b434
glslang -> SPV: Improvements in swizzles on access chains: Bug 14007 (wrong type), simplications, tests, support mixed swizzle with dynamic component selection.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31277 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-22 21:57:58 +00:00
John Kessenich
6b3fd19d89
glslang -> SPV: add decorations for built-ins that are inside blocks.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31266 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-22 01:53:15 +00:00
John Kessenich
ea543986f9
glslang -> SPV: translate the source profile to the SPV source language.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31265 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-22 01:21:31 +00:00
John Kessenich
e61ed59726
glsl -> SPV: fix OpVectorInsertDynamic result type bug.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31262 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-22 00:58:41 +00:00
John Kessenich
3a13a0c71b
Correct some English spellings of SPIR-V.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31237 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-20 16:13:01 +00:00
John Kessenich
01685c3ff8
SPV compression: Final check-in enabling this on MSVC 2012. All compression submissions from Steve (spvremapper@lunarg.com).
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31236 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-20 16:04:17 +00:00
John Kessenich
3c4a276282
SPIR-V compression: Requires rerunning CMake. Adds a standalone tool for running the SPV compression.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31232 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-19 21:07:04 +00:00
John Kessenich
40e391184c
glslang -> SPV: Use the new TBuiltInVariable instead of string compares to get the type of SPV built in. Also fixed gl_FragData and gl_PrimitiveIDIn.
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31226 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-18 23:25:32 +00:00
John Kessenich
ca3457f1a7
glslang: Fix a few more warnings, and see it using nullptr causes anyone problems (testing c++11 portability).
...
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31218 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2015-05-18 01:59:45 +00:00