Commit Graph

144 Commits

Author SHA1 Message Date
John Kessenich
97068d8b30
Merge pull request #1465 from otakuto/remove-execute-permissions
Remove execute permissions
2018-08-31 08:14:47 -07:00
John Kessenich
31aa3d6019 SPV: only declare the pure 8/16-bit capabilities when needed.
Only when operations stray outside the 8/16-bit storage-capabilities
are the general (pure 8/16-bit) capabilities needed.
2018-08-16 15:54:21 -06:00
John Kessenich
149afc3930 SPV: More corrections of <id> versus "immediate" operands. 2018-08-14 13:31:43 -06:00
John Kessenich
228e964bcc SPV: Correct SPIR-V operands for <id> versus immediate. 2018-08-13 21:37:59 -06:00
otakuto
d03da06ac1 Remove execute permissions 2018-08-07 03:16:20 +09:00
John Kessenich
f04c51b3bd Non-Functional: Add postprocess as more robust way to add capabilities
When capabilities are needed for specific SPIR-V instructions, it is
fragile to do so based on GLSL/AST usage; it should be based on actual
instructions they got translated to.
2018-08-03 15:56:12 -06:00
John Kessenich
5a7321eb03 Merge branch 'master' of https://github.com/zeux/glslang into zeux-master 2018-07-20 17:11:44 -06:00
Arseny Kapoulkine
112e2858cf SPIRV: Simplify matrix->matrix constructor
When constructing a matrix from another matrix with smaller dimensions,
there's no need to extract the scalars out of columns and rebuild the
resulting matrix from scalars - instead, we can just construct shorter
vectors with OpShuffle and combine them to the final result.

This keeps the common casts such as mat3(mat4) in vector registers,
which may improve performance for some GPUs, and cleans up output of
translation tools like SPIRV-Cross.

Fixes #1412.
2018-07-05 15:55:12 -07:00
John Kessenich
ba018e6762 SPV: Fix #1399 emit ImageGatherExtended when using ConstOffsets operand 2018-06-05 08:53:36 -06:00
John Kessenich
5611c6d27b GLSL/SPV: Implement SPV_EXT_descriptor_indexing and GL_EXT_nonuniform_qualifier 2018-04-05 11:25:02 -06:00
John Kessenich
ead8622484 Non-functional. Rationalizations enabling future generalizations:
- Use much simpler method to update implicit array sizes.
  The previous overly complicated method was error prone.
- Rationalize all use of unsized arrays.
- Combine decorations when generating SPIR-V, to simplify
  adding extensions.
2018-03-28 18:01:20 -06:00
John Kessenich
97e35420a6 Non-functional: always return value from makeFpConstant().
Should fix #1308.
2018-03-22 23:44:11 -06:00
John Kessenich
5d610ee1dc Implement SPV_GOOGLE_hlsl_functionality1.
Enabled via -fhlsl_functionality1
2018-03-16 20:21:44 -06:00
John Kessenich
cb32c54466
Merge pull request #1289 from Igalia/igalia/dmat-scalar-division
Use the correct type for the constant for matrix/scalar division
2018-03-15 23:49:59 -06:00
Daniel Koch
bfe0952118 Fix build several build errors
glslang/SPIRV/SpvBuilder.cpp:2533:27: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
        for (int c = 0; c < accessChain.swizzle.size(); ++c)
                        ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

glslang/hlsl/hlslParseHelper.cpp:69:5: error: field 'cullDistanceInput' will be initialized after field 'clipDistanceOutput' [-Werror,-Wreorder]
    cullDistanceInput(nullptr),
    ^
1 error generated.

glslang/glslang/MachineIndependent/attribute.cpp:85:16: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (argNum >= args->getSequence().size())
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
2018-03-13 17:06:51 -04:00
Neil Roberts
eddb1318ae Use the correct type for the constant for matrix/scalar division
When a matrix is divided by a scalar it tries to take the reciprocal
of the scalar to convert the operation into a multiply. However it was
always doing this by making a 32-bit constant. If the scalar is a
double then this would end up making an FDiv instruction with
different types in the operands.

This patch adds a helper method called makeFpConstant which makes a
floating-point constant of the given type. The code to take the
reciprocal now uses it to make the same type as the result.

Fixes https://github.com/KhronosGroup/glslang/issues/1278
2018-03-13 13:50:56 +01:00
John Kessenich
ac3707921e Revert the commits that change OpArrayLength type and bumped the version number.
Now, version 5.* is all connected to making the uint type, which doesn't quite work.
Generator versions 4 and 6 do not do this.
2018-03-07 11:48:25 -07:00
John Kessenich
66011cb2c2 SPV: Implement Vulkan 1.1 features and extensions. 2018-03-06 16:12:04 -07:00
Rex Xu
e518772dc9 SPV: The result type of OpArrayLength should be UINT 2018-03-03 22:06:27 +08:00
Rex Xu
1e5d7b0b27 Implement the extension GL_AMD_gpu_shader_half_float_fetch
- Support new opaque types: f16sampler*, f16image*, f16subpassInput*.
- Add new built-in GLSL texture/image functions.
2018-03-02 16:48:03 +08:00
John Kessenich
46413d5780 SPV: Fix #1258: cache constant structs by id, not opcode.
Constants were generally cached by type opcode, but all structures share the
same type opcode (OpTypeStruct), so they need to be cached by type id.
2018-02-26 19:35:39 -07:00
John Kessenich
57f6a016f0 SPV: Complete OpModuleProcessed implementation, enabled by have 1.2 headers. 2018-02-22 19:36:18 -07:00
John Kessenich
5c3eed542d SPV: Create more access chains addressing a few swizzling issues.
- Fixes #1233
- Treats local bools like anything else
- more consistently deals with a dynamic component selection
2018-02-06 07:24:12 -07:00
John Kessenich
a2858d9bdd GLSL: Implement GL_EXT_control_flow_attributes.
See https://github.com/KhronosGroup/GLSL/pull/11.
2018-02-01 00:55:08 -07:00
John Kessenich
2b5ea9f851 SPV Version: Emit the requested SPIR-V version, not the header version.
Fixes #1236.
2018-01-31 18:41:59 -07:00
John Kessenich
43f5b27321 Non-Functional: Use OpModuleProcessed from the unified header. 2018-01-31 18:06:44 -07:00
John Kessenich
7a9db71f46 SPV: Don't emit StorageImageMultisample capability for subpass images. 2017-10-20 10:56:50 -06:00
John Kessenich
2a27116cae SPV reflection: Add OpModuleProcessed for compile options. 2017-08-25 11:48:02 -06:00
John Kessenich
260f50616a SPV: Correct selection of storage-image capabilities. Fixes #986.
Code was reflecting an old historical use of sampled as a SPIR-V
2-valued operand, instead of its current 3 values.
2017-08-14 22:10:00 -06:00
John Kessenich
fad6297206 SPV: Non-functional: support lists of decorations per parameter. 2017-07-18 02:46:59 -06:00
Rex Xu
57e65929e4 HLSL: Translate directive [flatten] and [branch] to SPV control mask. 2017-07-06 11:31:33 +08:00
John Kessenich
e485c7af58 SPV: Debug output: Include OpLine information for execution path.
Note that declaratives are not handled, only procedurals.
2017-05-31 18:50:53 -06:00
John Kessenich
121853f4df SPV: Add OpSource shader source code and file name. 2017-05-31 17:14:15 -06:00
steve-lunarg
0b5c2ae70e Preserve signedness in SPV image query ops
The AST->SPIRV translation of image queries was dropping signedness,
causing some validation troubles.
2017-03-10 12:51:59 -07:00
steve-lunarg
5da1f038d8 HLSL: implement 4 (of 6) structuredbuffer types
This is a partial implemention of structurebuffers supporting:

* structured buffer types of:
*   StructuredBuffer
*   RWStructuredBuffer
*   ByteAddressBuffer
*   RWByteAddressBuffer

* Atomic operations on RWByteAddressBuffer

* Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type)

* globallycoherent flag

But NOT yet supporting:

* AppendStructuredBuffer / ConsumeStructuredBuffer types
* IncrementCounter/DecrementCounter methods

Please note: the stride returned by GetDimensions is as calculated by glslang for std430,
and may not match other environments in all cases.
2017-02-21 15:51:49 -07:00
John Kessenich
0302bdf04a SPV: Fix #723: construct vectors from matrices. 2017-02-17 19:06:21 -07:00
Vlad Ivanov
689490fd4d SpvBuilder: add const specifier to vector reference arguments 2017-01-26 20:46:42 +03:00
Rex Xu
430ef40ab4 Implement new revision of extension GL_AMD_shader_ballot
- Add support for invocation functions with "InclusiveScan" and
  "ExclusiveScan" modes.
- Add support for invocation functions taking int64/uint64/doube/float16
  as inout data types.
2017-01-19 12:09:51 +08:00
John Kessenich
927608b393 Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
John Kessenich
ecba76fe73 Non-Functional: Whitespace, comments, replace accidentally deleted comment.
- fixed ParseHelper.cpp newlines (crlf -> lf)
- removed trailing white space in most source files
- fix some spelling issues
- extra blank lines
- tabs to spaces
- replace #include comment about no location
2017-01-06 11:24:14 -07:00
John Kessenich
1e275c8486 HLSL: More robust handling of bad shader input, catching a few more things. 2016-12-14 17:02:32 -07:00
John Kessenich
517fe7a6ad Non-functional: Rename some entry-point variables to entryPoint, not main. 2016-11-26 13:31:47 -07:00
baldurk
033d3ef22c Change enum class to plain enum 2016-10-13 19:28:20 +02: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
Rex Xu
5159664475 SPV: Implement the extension SPV_KHR_shader_ballot 2016-09-22 16:05:07 +08: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
66ec80e01b Build: C++ headers: Replace PR #366 with a more directed version. 2016-08-05 14:04:23 -06: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