Commit Graph

295 Commits

Author SHA1 Message Date
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