Commit Graph

103 Commits

Author SHA1 Message Date
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
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
76d4dfcd51 SPV non-functional: minor readability improvements for texturing. 2016-06-16 12:43:23 -06:00
iostrows
af7f1c8f24 Fix double matrix creation 2016-06-01 16:40:00 +02:00
Rex Xu
5839031759 SPV: Add capability ImageGatherExtended if necessary. 2016-05-11 16:38:50 +08:00
John Kessenich
d3d3ce7160 Comments only. 2016-05-06 13:06:11 -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
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
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
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
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
52d08596ec Merge pull request #175 from rdb/master
Fix compilation issues with MSVC 2010
2016-02-27 21:29:14 -07:00
baldurk
227e026dbf MSVC warning fix - conversion from size_t to int, possible loss of data 2016-02-25 21:19:49 +01: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
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
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
32cfd49b68 SPV: RelaxedPrecision: Plumb this through the full AST->SPV translator. 2016-02-02 13:55:29 -07:00
Mark Adams
d5ac538e23 Fix two new Windows build warnings/errors 2016-02-01 19:13:06 -08: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
e7f6cac1bd Merge branch 'topo' into loopgen-after-readable-order 2016-01-19 16:47:41 -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