Commit Graph

368 Commits

Author SHA1 Message Date
John Kessenich
82460b5e21 HLSL: Fix #805: Support cast of scalars to structures.
Somewhat complex due to recognizing a general scalar, but not
replicating it for each member to avoid side effects.
2017-04-04 11:49:33 -06:00
John Kessenich
5ce1e4aff8 Merge pull request #817 from steve-lunarg/isfinite
HLSL: Decompose OpIsFinite to avoid capability restrictions
2017-04-03 22:32:35 -06:00
steve-lunarg
13975525d7 Decompose OpIsFinite to avoid capability restrictions
OpIsFinite is not available everywhere: decompose isfinite
to !isinf && !isnan.
2017-04-03 20:05:21 -06:00
steve-lunarg
067eb9b48a WIP: HLSL: Support InputPatch variables in patch constant functions
Previously, patch constant functions only accepted OutputPatch.  This
adds InputPatch support, via a pseudo-builtin variable type, so that
the patch can be tracked clear through from the qualifier.
2017-04-03 19:39:44 -06:00
steve-lunarg
f38cca3ccf HLSL: handle PCF input to DS in arbitrary argument position
In the hull shader, the PCF output does not participate in an argument list,
so has no defined ordering.  It is always put at the end of the linkage.  That
means the DS input reading PCF data must be be at the end of the DS linkage
as well, no matter where it may appear in the argument list.  This change
makes sure that happens.

The detection is by looking for arguments that contain tessellation factor
builtins, even as a struct member.  The whole struct is taken as the PCF output
if any members are so qualified.
2017-04-03 10:14:50 -06:00
John Kessenich
84a30c8bae Merge pull request #774 from steve-lunarg/tess-ctrlpt-pcf
HLSL: support per control point patch const fn invocation
2017-03-31 13:37:52 -06:00
steve-lunarg
db2e3b4169 HLSL: fix crash on empty sequence node passed to intrinsic expansions 2017-03-31 12:47:34 -06:00
steve-lunarg
e741249b72 HLSL: pass tessellation execution modes through to SPIR-V
The SPIR-V generator had assumed tessellation modes such as
primitive type and vertex order would only appear in tess eval
(domain) shaders.  SPIR-V allows either, and HLSL allows and
possibly requires them to be in the hull shader.

This change:

1. Passes them through for either tessellation stage, and,

2. Does not set up defaults in the domain stage for HLSl compilation,
to avoid conflicting definitions.
2017-03-31 11:47:18 -06:00
John Kessenich
9ce76553b8 Merge pull request #797 from steve-lunarg/scalar-length
HLSL: allow length() on scalars
2017-03-31 09:26:47 -06:00
John Kessenich
18958f6cd2 HLSL: Fix #802: Preserve promoted child under ! operator. 2017-03-30 23:32:21 -06:00
John Kessenich
7e997e2612 HLSL: Implicit bool conversions for conditional expressions and related.
Covers if(cond), while(cond), do-while(cond), for(;cond;), and (cond ? :).
Fixes #778.
2017-03-30 22:52:33 -06:00
John Kessenich
8f9fdc986a HLSL: Add namespace grammar and some basic semantics.
Unknown how extensive the semantics need to be yet. Need real
feedback from workloads. This is just done as part of unifying it
with the class/struct namespaces and grammar productions.
2017-03-30 16:30:17 -06:00
steve-lunarg
9cee73e028 HLSL: support per control point patch const fn invocation
This PR emulates per control point inputs to patch constant functions.
Without either an extension to look across SIMD lanes or a dedicated
stage, the emulation must use separate invocations of the wrapped
entry point to obtain the per control point values.  This is provided
since shaders are wanting this functionality now, but such an extension
is not yet available.

Entry point arguments qualified as an invocation ID are replaced by the
current control point number when calling the wrapped entry point.  There
is no particular optimization for the case of the entry point not having
such an input but the PCF still accepting ctrl pt frequency data.  It'll
work, but anyway makes no so much sense.

The wrapped entry point must return the per control point data by value.
At this time it is not supported as an output parameter.
2017-03-30 14:36:56 -06:00
Rex Xu
86e49d1773 HLSL: Move frexp() to a separate test file. 2017-03-29 17:04:58 +08:00
John Kessenich
0e7378446b Fix #790: Don't emit NV-specific interface members unless enabled by extension. 2017-03-24 18:40:40 -06:00
steve-lunarg
1ca04c2bbd HLSL: allow length() on scalars 2017-03-24 10:12:53 -06:00
steve-lunarg
d8e34c5119 HLSL: fix crash on empty struct return from entry point 2017-03-24 08:56:37 -06:00
John Kessenich
7a41f96d10 HLSL: Implement 'this' keyword. 2017-03-22 11:38:22 -06:00
John Kessenich
4960baaf66 HLSL: Basic turn on of non-static member functions.
Still need: pass by reference in SPIR-V and symbol-table level
for accessing 'this' members from member functions.
2017-03-19 18:09:59 -06:00
John Kessenich
54ee28f4d0 HLSL: Add scoping operator, accept static member functions, and support calling them. 2017-03-11 14:13:00 -07:00
John Kessenich
6e1d50a7a2 HLSL: Accept SV_Cull/ClipDistanceN, by refactoring the way semantics are mapped. 2017-03-09 14:37:32 -07:00
steve-lunarg
d00b026111 Enable GatherCmpRed. Green/Blue/Alpha cannot be supported.
This implements GatherCmpRed in terms of OpImageDrefGather.

There appears to be no way to implement the Green/Blue/Apha forms: see #673.
2017-03-09 08:59:45 -07:00
John Kessenich
33f85b6e59 SPV: Allow push constant buffers to not have an instance name. 2017-03-06 08:51:35 -07:00
John Kessenich
854fe24786 HLSL: Fix #747: accept 'struct' in front of previously user-defined type name. 2017-03-02 14:30:59 -07:00
John Kessenich
69a2c69649 Merge pull request #736 from steve-lunarg/structbuffer-params
HLSL: add structuredbuffer pass by reference in fn params
2017-02-28 13:10:51 -07:00
steve-lunarg
86b510efd1 WIP: HLSL: add f16tof32 and f32tof16 decompositions. 2017-02-27 15:19:49 -07:00
John Kessenich
6c8aaacd28 SPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.
These correspond to SPV_KHR_device_group and SPV_KHR_multiview.
Also, bring tests up to date with Khronos internals, and some misc. related changes.
2017-02-27 01:20:51 -07:00
steve-lunarg
dd8287a109 WIP: HLSL: add structuredbuffer pass by reference in fn params
This PR adds the ability to pass structuredbuffer types by reference
as function parameters.

It also changes the representation of structuredbuffers from anonymous
blocks with named members, to named blocks with pseudonymous members.
That should not be an externally visible change.
2017-02-26 11:13:42 -07:00
John Kessenich
4a57dced66 SPV: Handle nested opaque types as function parameters. 2017-02-24 19:22:54 -07:00
steve-lunarg
932bb5cc4e Add reflection queries for thread local size and ssbo auto-binding
New command line option --shift-ssbo-binding mirrors --shift-ubo-binding, etc.

New reflection query getLocalSize(int dim) queries local size, e.g, CS threads.
2017-02-22 09:40:28 -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
chaoc
df3956c50f Implement NVX_multiview_per_view_attributes 2017-02-14 15:04:33 -08:00
steve-lunarg
858c928ac7 Add basic HS/DS implementation.
This obsoletes WIP PR #704, which was built on the pre entry point wrapping master.  New version
here uses entry point wrapping.

This is a limited implementation of tessellation shaders.  In particular, the following are not functional,
and will be added as separate stages to reduce the size of each PR.

* patchconstantfunctions accepting per-control-point input values, such as
  const OutputPatch <hs_out_t, 3> cpv are not implemented.

* patchconstantfunctions whose signature requires an aggregate input type such as
  a structure containing builtin variables.  Code to synthesize such calls is not
  yet present.

These restrictions will be relaxed as soon as possible.  Simple cases can compile now: see for example
Test/hulsl.hull.1.tesc - e.g, writing to inner and outer tessellation factors.

PCF invocation is synthesized as an entry point epilogue protected behind a barrier and a test on
invocation ID == 0.  If there is an existing invocation ID variable it will be used, otherwise one is
added to the linkage.  The PCF and the shader EP interfaces are unioned and builtins appearing in
the PCF but not the EP are also added to the linkage and synthesized as shader inputs.
Parameter matching to (eventually arbitrary) PCF signatures is by builtin variable type.  Any user
variables in the PCF signature will result in an error.  Overloaded PCF functions will also result in
an error.

[domain()], [partitioning()], [outputtopology()], [outputcontrolpoints()], and [patchconstantfunction()]
attributes to the shader entry point are in place, with the exception of the Pow2 partitioning mode.
2017-02-10 16:59:09 -07:00
John Kessenich
65ee230f1c HLSL: Add tests and refine what decorations are passed through per stage/in/out. 2017-02-06 23:13:16 -07:00
steve-lunarg
ec712ebea1 HLSL: fix copies between arrays of structs of builtins, and arrayed builtins.
Structs are split to remove builtin members to create valid SPIR-V.  In this
process, an outer structure array dimension may be propegated onto the
now-removed builtin variables.  For example, a mystruct[3].position ->
position[3].  The copy between the split and unsplit forms would handle
this in some cases, but not if the array dimension was at different levels
of aggregate.

It now does this, but may not handle arbitrary composite types.  Unclear if
that has any semantic meaning for builtins though.
2017-02-06 23:00:51 -07:00
John Kessenich
0fe106afd2 AST: Have type deepCopy() preserve type graphs as graphs.
Previously, a type graph would turn into a type tree. That is,
a deep node that is shared would have multiple copies made.

This is important when creating IO and non-IO versions of deep types.
2017-02-06 22:58:32 -07:00
John Kessenich
02467d8d94 HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.
This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
2017-02-06 22:58:32 -07:00
Markus Tavenrath
7b89e75213 Use correct OriginUpperLeft when linking more than one shader. 2017-01-25 12:11:16 -08:00
chaoc
771d89fc36 support SPV_NV_viewport_array2 and SPV_NV_stereo_view_rendering 2017-01-20 16:48:26 -08:00
John Kessenich
22f25d80c6 Merge pull request #682 from steve-lunarg/split-copy-fix
HLSL: fix dereferencing when copying split structures with arrays
2017-01-19 16:56:06 -07:00
steve-lunarg
65cdff9a54 HLSL: fix dereferencing when copying split structures with arrays
When copying split types with mixtures of user variables and buitins,
where the builtins are extracted, there is a parallel structures traversal.
The traversal was not obtaining the derefenced types in the array case.
2017-01-19 15:18:00 -07: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
001dfa1c5c HLSL: matrix swizzle (_12, _m23) syntax, partial semantics.
This partially addressess issue #670, for when the matrix swizzle
degenerates to a component or column: m[c], m[c][r] (where HLSL
swaps rows and columns for user's view).

An error message is given for the arbitrary cases not covered.

These cases will work for arbitrary use of l-values.

Future work will handle more arbitrary swizzles, which might
not work as arbitrary l-values.
2017-01-12 16:51:18 -07:00
John Kessenich
dc1a8196cf Infrastructure: Support standard build with ENABLE_HLSL set to off. 2017-01-11 14:50:16 -07:00
John Kessenich
facde2c804 PP #include: address PR feedback. 2017-01-06 16:48:18 -07:00
John Kessenich
63204c2501 External interface change: PP: Full <> and "" semantics for the Includer.
Any previous use would only be for "", which would probably mean changing

    include(...)  -> includeLocal(...)

See comments about includeLocal() being an additional search over
includeSystem(), not a superset search.

This also removed ForbidIncluder, as
 - the message in ForbidIncluder was redundant: error results were
   already returned to the caller, which then gives the error it
   wants to
 - there is a trivial default implementation that a subclass can
   override any subset of (I still like abstract base classes though)
 - trying to get less implementation out of the interface file anyway
2017-01-06 15:08:54 -07:00
John Kessenich
acb9076a27 Merge pull request #650 from steve-lunarg/lvalue-swizzle-fix
HLSL: allow destination swizzles when writing RWTexture/RWBuffer
2017-01-05 10:40:14 -07:00
John Kessenich
bf9a2f30c9 Merge pull request #648 from steve-lunarg/type-identifiers
HLSL: allow type keywords as identifiers, and add half type
2017-01-04 14:07:34 -07:00
John Kessenich
ddfbbe26f2 Merge pull request #632 from steve-lunarg/structure-splitting
HLSL: inter-stage structure splitting.
2017-01-04 11:41:36 -07:00
John Kessenich
5abd308e71 Merge pull request #659 from steve-lunarg/d3dcolortoubyte4
Add D3DCOLORtoUBYTE4 decomposition
2017-01-03 15:34:33 -07:00
John Kessenich
c4ed950057 Merge pull request #647 from steve-lunarg/default-fn-params
HLSL: default function parameters
2017-01-03 15:30:05 -07:00
steve-lunarg
7ea7ff4cd4 Add EOpD3DCOLORtoUBYTE4 decomposition 2017-01-03 14:42:18 -07:00
steve-lunarg
cd6829ba81 HLSL: allow destination swizzles when writing RWTexture/RWBuffer objects.
Reads and write syntax to UAV objects is turned into EOpImageLoad/Store
operations.  This translation did not support destination swizzles,
for example, "mybuffer[tc].zyx = 3;", so such statements would fail to
compile.  Now they work.

Parial updates are explicitly prohibited.

New test: hlsl.rw.swizzle.frag
2017-01-03 10:31:09 -07:00
John Kessenich
faa720f14c PP: Fix issue #426, recover from bad-source macro expansion. 2017-01-02 17:56:08 -07:00
steve-lunarg
26d3145334 HLSL default function parameters
This PR adds support for default function parameters in the following cases:

1. Simple constants, such as void fn(int x, float myparam = 3)
2. Expressions that can be const folded, such a ... myparam = sin(some_const)
3. Initializer lists that can be const folded, such as ... float2 myparam = {1,2}

New tests are added: hlsl.params.default.frag and hlsl.params.default.err.frag
(for testing error situations, such as ambiguity or non-const-foldable).

In order to avoid sampler method ambiguity, the hlsl better() lambda now
considers sampler matches.  Previously, all sampler types looked identical
since only the basic type of EbtSampler was considered.
2016-12-29 12:15:48 -07:00
steve-lunarg
5ca85ad9de HLSL: allow scalar type keywords as identifiers, and add half type support.
HLSL allows type keywords to also be identifiers, so a sequence such as "float half = 3" is
valid, or more bizzarely, something like "float.float = int.uint + bool;"

There are places this is not supported.  E.g, it's permitted for struct members, but not struct
names or functions.  Also, vector or matrix types such as "float3" are not permitted as
identifiers.

This PR adds that support, as well as support for the "half" type.  In production shaders,
this was seen with variables named "half".  The PR attempts to support this without breaking
useful grammar errors such as "; expected" at the end of unterminated statements, so it errs
on that side at the possible expense of failing to accept valid constructs containing a type
keyword identifier.  If others are discovered, they can be added.

Also, half is now accepted as a valid type, alongside the min*float types.
2016-12-27 11:26:45 -07:00
steve-lunarg
132d331870 HLSL: struct splitting: assignments of hierarchical split types
This commit adds support for copying nested hierarchical types of split
types.  E.g, a struct of a struct containing both user and builtin interstage
IO variables.

When copying split types, if any subtree does NOT contain builtin interstage
IO, we can copy the whole subtree with one assignment, which saves a bunch
of AST verbosity for memberwise copies of that subtree.
2016-12-26 20:17:13 -07:00
steve-lunarg
a2e7531057 HLSL: inter-stage structure splitting.
This adds structure splitting, which among other things will enable GS support where input structs
are passed, and thus become input arrays of structs in the GS inputs.  That is a common GS case.

The salient points of this PR are:

* Structure splitting has been changed from "always between stages" to "only into the VS and out of
  the PS".  It had previously happened between stages because it's not legal to pass a struct
  containing a builtin IO variable.

* Structs passed between stages are now split into a struct containing ONLY user types, and a
  collection of loose builtin IO variables, if any.  The user-part is passed as a normal struct
  between stages, which is valid SPIR-V now that the builtin IO is removed.

* Internal to the shader, a sanitized struct (with IO qualifiers removed) is used, so that e.g,
  functions can work unmodified.

* If a builtin IO such as Position occurs in an arrayed struct, for example as an input to a GS,
  the array reference is moved to the split-off loose variable, which is given the array dimension
  itself.

When passing things around inside the shader, such as over a function call, the the original type
is used in a sanitized form that removes the builtIn qualifications and makes them temporaries.
This means internal function calls do not have to change.  However, the type when returned from
the shader will be member-wise copied from the internal sanitized one to the external type.
The sanitized type is used in variable declarations.

When copying split types and unsplit, if a sub-struct contains only user variables, it is copied
as a single entity to avoid more AST verbosity.

Above strategy arrived at with talks with @johnkslang.

This is a big complex change.  I'm inclined to leave it as a WIP until it can get some exposure to
real world cases.
2016-12-26 10:11:15 -07:00
chaoc
6e5acae144 Add support for SPV_NV_geometry_shader_passthrough 2016-12-20 13:28:52 -08:00
chaoc
0ad6a4e60d Add support for SPV_NV_sample_mask_override_coverage 2016-12-19 16:29:34 -08:00
John Kessenich
d485e0b710 PP: Implement token pasting for PP identifiers.
Implement token pasting as per the C++ specification, within the current
style of the PP code.
Non-identifiers (turning 12 ## 10 into the numeral 1210) is not yet covered;
they should be a simple incremental change built on this one.
Addresses issue #255.
2016-12-19 09:19:43 -07:00
John Kessenich
906cc21816 Linker: Eliminate uncalled functions, because they can be ill-defined.
Fixes issue #610. Also provides a testing option to keep uncalled functions.
2016-12-09 19:22:20 -07:00
John Kessenich
6a60c2f9ea Linker: Walk the call graph to report an error on missing bodies. 2016-12-08 23:22:21 -07:00
John Kessenich
e795cc915c Merge pull request #621 from steve-lunarg/recursive-flattening
HLSL: Recursive composite flattening
2016-12-08 11:18:07 -07:00
steve-lunarg
a2b01a0da8 HLSL: Recursive composite flattening
This PR implements recursive type flattening.  For example, an array of structs of other structs
can be flattened to individual member variables at the shader interface.

This is sufficient for many purposes, e.g, uniforms containing opaque types, but is not sufficient
for geometry shader arrayed inputs.  That will be handled separately with structure splitting,
 which is not implemented by this PR.  In the meantime, that case is detected and triggers an error.

The recursive flattening extends the following three aspects of single-level flattening:

- Flattening of structures to individual members with names such as "foo[0].samp[1]";

- Turning constant references to the nested composite type into a reference to a particular
  flattened member.

- Shadow copies between arrays of flattened members and the nested composite type.

Previous single-level flattening only flattened at the shader interface, and that is unchanged by this PR.
Internally, shadow copies are, such as if the type is passed to a function.

Also, the reasons for flattening are unchanged.  Uniforms containing opaque types, and interface struct
types are flattened.  (The latter will change with structure splitting).

One existing test changes: hlsl.structin.vert, which did in fact contain a nested composite type to be
flattened.

Two new tests are added: hlsl.structarray.flatten.frag, and hlsl.structarray.flatten.geom (currently
issues an error until type splitting is online).

The process of arriving at the individual member from chained postfix expressions is more complex than
it was with one level.  See large-ish comment above HlslParseContext::flatten() for details.
2016-12-07 14:40:01 -07:00
steve-lunarg
05f75142d6 HLSL: opcode specific promotion rules for interlocked ops
PR #577 addresses most but not all of the intrinsic promotion problems.
This PR resolves all known cases in the remainder.

Interlocked ops need special promotion rules because at the time
of function selection, the first argument has not been converted
to a buffer object.  It's just an int or uint, but you don't want
to convert THAT argument, because that implies converting the
buffer object itself.  Rather, you can convert other arguments,
but want to stay in the same "family" of functions.  E.g, if
the first interlocked arg is a uint, use only the uint family,
never the int family, you can convert the other args as you please.

This PR allows making such opcode and arg specific choices by
passing the op and arg to the convertible lambda.  The code in
the new test "hlsl.promote.atomic.frag" would not compile without
this change, but it must compile.

Also, it provides better handling of downconversions (to "worse"
types), which are permitted in HLSL.  The existing method of
selecting upconversions is unchanged, but if that doesn't find
any valid ones, then it will allow downconversions.  In effect
this always uses an upconversion if there is one.
2016-12-07 12:00:32 -07:00
John Kessenich
21b11f4cc1 Merge branch 'intrinsic-promotion' of https://github.com/steve-lunarg/glslang into steve-lunarg-intrinsic-promotion 2016-12-03 13:27:22 -07:00
John Kessenich
98ad485321 HLSL: Support {...} initializer lists that are too short. 2016-11-27 17:39:07 -07:00
steve-lunarg
ef33ec0925 HLSL: add intrinsic function implicit promotions
This PR handles implicit promotions for intrinsics when there is no exact match,
such as for example clamp(int, bool, float).  In this case the int and bool will
be promoted to a float, and the clamp(float, float, float) form used.

These promotions can be mixed with shape conversions, e.g, clamp(int, bool2, float2).

Output conversions are handled either via the existing addOutputArgumentConversion
function, which this PR generalizes to handle either aggregates or unaries, or by
intrinsic decomposition.  If there are methods or intrinsics to be decomposed,
then decomposition is responsible for any output conversions, which turns out to
happen automatically in all current cases.  This can be revisited once inout
conversions are in place.

Some cases of actual ambiguity were fixed in several tests, e.g, spv.register.autoassign.*

Some intrinsics with only uint versions were expanded to signed ints natively, where the
underlying AST and SPIR-V supports that.  E.g, countbits.  This avoids extraneous
conversion nodes.

A new function promoteAggregate is added, and used by findFunction.  This is essentially
a generalization of the "promote 1st or 2nd arg" algorithm in promoteBinary.

The actual selection proceeds in three steps, as described in the comments in
hlslParseContext::findFunction:

1. Attempt an exact match.  If found, use it.
2. If not, obtain the operator from step 1, and promote arguments.
3. Re-select the intrinsic overload from the results of step 2.
2016-11-23 10:36:34 -07:00
John Kessenich
e122f053bb Merge pull request #599 from steve-lunarg/gs
HLSL: Add GS support
2016-11-23 00:29:30 -07:00
John Kessenich
6e848daf45 Merge pull request #596 from steve-lunarg/hlsl-intrinsic-parsing
HLSL: use HLSL parser for HLSL intrinsic prototypes, enable int/bool mats
2016-11-23 00:19:40 -07:00
steve-lunarg
f49cdf4183 WIP: HLSL: Add GS support
This PR adds:

[maxvertexcount(n)] attributes

point/line/triangle/lineadj/triangleadj qualifiers

PointStream/LineStream/TriangleStream templatized types

Append method on above template types

RestartStrip method on above template types.
2016-11-21 18:25:08 -07:00
steve-lunarg
75fd223f03 HLSL: allow "sample" as a valid identifier.
HLSL has keywords for various interpolation modifiers such as "linear",
"centroid", "sample", etc.  Of these, "sample" appears to be special,
as it is also accepted as an identifier string, where the others are not.

This PR adds this ability, so the construct "int sample = 42;" no longer
produces a compilation error.

New test = hlsl.identifier.sample.frag
2016-11-16 13:22:11 -07:00
steve-lunarg
0842dbb39a HLSL: use HLSL parser to parse HLSL intrinsic prototypes, enable int/bool mats
This PR adds a CreateParseContext() fn analogous to CreateBuiltInParseables(),
to create a language specific built in parser.  (This code was present before
but not encapsualted in a fn).  This can now be used to create a source language
specific parser for builtins.

Along with this, the code creating HLSL intrinsic prototypes can now produce
them in HLSL syntax, rather than GLSL syntax.  This relaxes certain prior
restrictions at the parser level.  Lower layers (e.g, SPIR-V) may still have
such restrictions, such as around Nx1 matrices: this code does not impact
that.

This PR also fleshes out matrix types for bools and ints, both of which were
partially in place before.  This was easier than maintaining the restrictions
in the HLSL prototype generator to avoid creating protoypes with those types.

Many tests change because the result type from intrinsics moves from "global"
to "temp".

Several new tests are added for the new types.
2016-11-16 11:19:22 -07:00
John Kessenich
0bf06d3cf5 Merge pull request #576 from steve-lunarg/uav-registers
Add UAV (image) binding offset and HLSL register class support
2016-11-14 09:39:46 -07:00
steve-lunarg
d9cb832f9c HLSL: allow promotion from 1-vector types to scalars, e.g, float<-float1
Previously, an error was thrown when assigning a float1 to a scalar float,
or similar for other basic types.  This allows that.

Also, this allows calling functions accepting scalars with float1 params,
so for example sin(float1) will work.  This is a minor change in
HlslParseContext::findFunction().
2016-11-13 14:44:46 -07:00
steve-lunarg
a22f7dbb71 HLSL: Allow expressions in attributes
For example:

[numthreads(2+2, 2*3, (1+FOO)*BAR)]

This will result in a thread count (4, 6, 8).
2016-11-11 08:23:03 -07:00
John Kessenich
d3f1122a44 Whole stack: Fix stale types in the AST linker object nodes, fixing #557.
Rationalizes the entire tracking of the linker object nodes, effecting
GLSL, HLSL, and SPIR-V, to allow tracked objects to be fully edited before
their type snapshot for linker objects.

Should only effect things when the rest of the AST contained no reference to
the symbol, because normal AST nodes were not stale. Also will only effect such
objects when their types were edited.
2016-11-05 10:22:33 -06:00
steve-lunarg
9088be4c07 Add UAV (image) binding offset and HLSL register support
This PR adds:

1. The "u" register class for RW* objects.

2. --shift-image-bindings (== --sib), analogous to --shift-texture-bindings etc.

3. Case insensitive reg classes.

4. Tests for above.
2016-11-01 14:44:54 -06:00
John Kessenich
89df3c2dcb Merge pull request #572 from steve-lunarg/numthreads
HLSL: implement numthreads for compute shaders
2016-11-01 00:25:06 -06:00
steve-lunarg
3226b0835c HLSL: Add min*{float,int,uint} types
These HLSL types are guaranteed to have at least the given number of bits, but may have more.

min{16,10}float is mapped to EbtFloat at medium precision -> SPIRV RelaxedPrecision
min{16,12}int and min16uint are mapped to mediump -> SPIR-V RelaxedPrecision
2016-10-31 12:46:05 -06:00
steve-lunarg
1868b14435 HLSL: implement numthreads for compute shaders
This PR adds handling of the numthreads attribute for compute shaders, as well as a general
infrastructure for returning attribute values from acceptAttributes, which may be needed in other
cases, e.g, unroll(x), or merely to know if some attribute without params was given.

A map of enum values from TAttributeType to TIntermAggregate nodes is built and returned.  It
can be queried with operator[] on the map.  In the future there may be a need to also handle
strings (e.g, for patchconstantfunc), and those can be easily added into the class if needed.

New test is in hlsl.numthreads.comp.
2016-10-31 09:28:17 -06:00
John Kessenich
51634468da Merge pull request #568 from steve-lunarg/logicalop-fix
HLSL: allow component-wise operations for logical || and &&.
2016-10-26 23:01:16 -06:00
steve-lunarg
27939caa86 HLSL: allow component-wise operations for logical || and &&.
HLSL || and && can operate component-wise.
2016-10-26 12:54:56 -06:00
steve-lunarg
85244d7486 HLSL: Enable component-wise vector comparisons from operators
This PR only changes a few lines of code, but is subtle.

In HLSL, comparison operators (<,>,<=,>=,==,!=) operate component-wise
when given a vector operand.  If a whole vector equality or inequality is
desired, then all() or any() can be used on the resulting bool vector.

This PR enables this change.  Existing shape conversion is used when
one of the two arguments is a vector and one is a scalar.

Some existing HLSL tests had assumed == and != meant vector-wise
instead of component-wise comparisons.  These tests have been changed
to add an explicit any() or all() to the test source.  This verifably
does not change the final SPIR-V binary relative to the old behavior
for == and !=.  The AST does change for the (now explicit, formerly
implicit) any() and all().  Also, a few tests changes where they
previously had the return type wrong, e.g, from a vec < vec comparison
in hlsl.shapeConv.frag.

Promotion of comparison opcodes to vector forms
(EOpEqual->EOpVectorEqual) is handled in promoteBinary(), as is setting
the proper vector type of the result.

EOpVectorEqual and EOpVectorNotEqual are now accepted as either
aggregate or binary nodes, similar to how the other operators are
handled.  Partial support already existed for this: it has been
fleshed out in the printing functions in intermOut.cpp.

There is an existing defect around shape conversion with 1-vectors, but
that is orthogonal to this PR and not addressed by it.
2016-10-26 08:50:10 -06:00
John Kessenich
04e2dc164e Merge pull request #558 from steve-lunarg/image-atomics
HLSL: phase 4 of RWTexture support: add image atomics
2016-10-20 19:09:55 -06:00
steve-lunarg
22322361d6 HLSL: phase 4 of rwtexture support: add image atomics
This PR will turn Interlocked* intrinsics using rwtexture or rwbuffer
object as the first parameter into the proper OpImageAtomic* operations.
2016-10-19 10:25:23 -06:00
steve-lunarg
e5921f1309 HLSL: Fix unary and binary operator type conversion issues
This fixes defects as follows:

1. handleLvalue could be called on a non-L-value, and it shouldn't be.

2. HLSL allows unary negation on non-bool values.  TUnaryOperator::promote
   can now promote other types (e.g, int, float) to bool for this op.

3. HLSL allows binary logical operations (&&, ||) on arbitrary types, similar
   (2).

4. HLSL allows mod operation on arbitrary types, which will be promoted.
   E.g, int % float -> float % float.
2016-10-18 16:56:37 -06:00
John Kessenich
b50fd17acb HLSL: Support SV_Coverage and SV_DispatchThreadId; catch SV_GroupIndex. 2016-10-16 12:12:11 -06:00
John Kessenich
1fabc0f697 Merge pull request #548 from baldurk/vs2010-compile-fixes
VS2010 compile fixes
2016-10-15 23:09:31 -06:00
John Kessenich
bf8a6ef750 Merge pull request #551 from steve-lunarg/rwbuffers-fmt
HLSL: phase 3 of rwtexture support: add sub-vec4 capabilities
2016-10-15 23:03:38 -06:00
John Kessenich
062b239d10 Merge pull request #549 from steve-lunarg/multidim-array
HLSL: allow multi-dimensional arrays
2016-10-15 22:43:43 -06:00
steve-lunarg
8b0227ced9 HLSL: phase 3b: Texture methods remember and return vector size.
Also makes a (correct) test change for global -> temp vars.
2016-10-14 18:44:32 -06:00
steve-lunarg
4f2da27aec HLSL: phase 3a: Add sub-vec4 rwtexture formats (qualifier.layoutFormat)
This PR sets the TQualifier layoutFormat according to the HLSL image type.
For instance:

  RWTexture1D <float2> g_tTex1df2;

becomes ElfRg32f.  Similar on Buffers, e.g, Buffer<float4> mybuffer;

The return type for image and buffer loads is now taken from the storage format.
Also, the qualifier for the return type is now (properly) a temp, not a global.
2016-10-14 18:44:32 -06:00
John Kessenich
f042e407a9 Merge pull request #542 from steve-lunarg/rwbuffers
HLSL: phase 2: add operator[]
2016-10-13 12:49:56 -06:00
John Kessenich
e4ad1bb68a Merge pull request #538 from steve-lunarg/iomap-binding-range-err
Check for out-of-range bindings during IO mapping.
2016-10-13 12:44:16 -06:00
steve-lunarg
7b211a370b HLSL: allow multi-dimensional arrays
All the underpinnings are there; this just parses multiple array dimensions
and passes them through to the existing mechanisms.

Also, minor comment fixes, and add a new test for multi-dim arrays.
2016-10-13 12:32:04 -06:00
baldurk
486d9e44e0 Update HexFloat tests to use non-enum class enum values 2016-10-13 20:05:13 +02:00
steve-lunarg
07830e805b HLSL: phase 2d: minor cleanup, & allow operator[] on non-rw textures
Improve comments.
A few tweaked lines allow [] on non-rw tx.  Add test case for this.
Improve VectorTimesScalar handling.
2016-10-12 12:39:44 -06:00
steve-lunarg
6b43d274e7 HLSL: phase 2a: add r-value operator[] for RWTexture/RWBuffer
This commit adds r-value support for RW textures and buffers.
Supported is:

- Function in parameter conversions
- conversion of rvalue use to imageLoad
2016-10-12 12:39:44 -06:00
Rex Xu
f3b27471f8 SPV: Implement extension SPV_KHR_shader_draw_parameters. 2016-10-11 14:40:35 +08:00
John Kessenich
19bdf90eba SPV: Distinguish between SPV and non-SPV rules for member overlap. 2016-10-07 11:50:25 -06:00
John Kessenich
087a454af2 HLSL: Add shape conversions for return values. 2016-10-06 16:56:54 -06: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
steve-lunarg
bb0183f817 HLSL: phase 1: add RWTexture and RWBuffer
There's a lot to do for RWTexture and RWBuffer, so it will be broken up into
several PRs.  This is #1.

This adds RWTexture and RWBuffer support, with the following limitations:
  * Only 4 component formats supported
  * No operator[] yet

Those will be added in other PRs.

This PR supports declarations and the Load & GetDimensions methods.  New tests are
added.
2016-10-06 10:51:52 -06:00
steve-lunarg
9ae34742cf Check for out-of-range bindings during IO mapping. 2016-10-05 13:42:42 -06:00
David Neto
1d3a966106 Gtests can be run on another source tree
The gtest executable accepts a --test-root option to specify
a root directory for test files.  It defaults to the Test directory
in the source tree from which the executable is built.

For example, this lets us run test exectuables built with MinGW on Linux
on a Windows machine with its own copy of the source tree.
2016-10-05 10:28:32 -04:00
steve-lunarg
2199c2404b HLSL: fix for flattening assignments from non-symbol R-values.
If a member-wise assignment from a non-flattened struct to a flattened struct sees a complex R-value
(not a symbol), it now creates a temporary to hold that value, to avoid repeating the R-value.
This avoids, e.g, duplicating a whole function call.  Also, it avoids re-using the AST node, making a
new one for each member inside the member loop.

The latter (re-use of AST node) was also an issue in the GetDimensions intrinsic decomposition,
so this PR fixes that one too.
2016-10-04 17:07:45 -06:00
John Kessenich
a2a5dd474e Non-functional: Rationalizing parse helper hierarchy, step 2 (effected error messaging and cascading errors). 2016-10-01 18:07:57 -06:00
steve-lunarg
088c59d7ea Change binding auto-map to use provided offsets.
Previously, the binding auto-mapping facility was free to use any unused
binding.  This change makes auto-bindings use the same offset value as
explicit bindings.
2016-10-01 11:40:43 -06:00
steve-lunarg
e4fe8b5c44 Add a test for buffer auto-binding assignment. 2016-09-30 14:26:34 -06:00
John Kessenich
3e47f5f7c8 Merge pull request #523 from amdrexu/feature2
Parser: Implement extension GL_AMD_gpu_shader_half_float.
2016-09-30 09:54:17 -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
John Kessenich
df98cc26d5 Add amend ability for anonymous blocks, so they can grow between function bodies. 2016-09-29 23:59:26 -06:00
steve-lunarg
265c0618b1 HLSL: allow implicit array sizing.
In HLSL array sizes need not be provided explicitly in all circumstances.
For example, this is valid (note no number between the [ ]):

  // no explicit array size
  uniform float g_array[] = { 1, 2, 3, 4, 5 };

This PR does not attempt to validate most invalid cases.

A new test is added to verify the resulting linker objects.
2016-09-27 14:28:26 -06:00
steve-lunarg
ad0752e8fa GLSL: Add binding map tests
This PR adds a GLSL equivalent to the HLSL binding mapping tests for offsets and auto-numbering.
The shaders are as equivalent as possible.  The bindings of the base results match exactly
between the two.
2016-09-26 17:02:44 -06:00
steve-lunarg
cf43e66125 Fix defects in uniform array flattening
Fix for two defects as follows:

- The IO mapping traverser was not setting inVisit, and would skip some AST nodes.
  Depending on the order of nodes, this could have prevented the binding from
  showing up in the generated SPIR-V.

- If a uniform array was flattened, each of the flattened scalars from the array
  is still a (now-scalar) uniform.  It was being converted to a temporary.
2016-09-22 15:58:06 -06:00
steve-lunarg
e0b9debda2 Flatten uniform arrays
This checkin adds a --flatten-uniform-arrays option which can break
uniform arrays of samplers, textures, or UBOs up into individual
scalars named (e.g) myarray[0], myarray[1], etc.  These appear as
individual linkage objects.

Code notes:

- shouldFlatten internally calls shouldFlattenIO, and shouldFlattenUniform,
  but is the only flattening query directly called.

- flattenVariable will handle structs or arrays (but not yet arrayed structs;
  this is tested an an error is generated).

- There's some error checking around unhandled situations.  E.g, flattening
  uniform arrays with initializer lists is not implemented.

- This piggybacks on as much of the existing mechanism for struct flattening
  as it can.  E.g, it uses the same flattenMap, and the same
  flattenAccess() method.

- handleAssign() has been generalized to cope with either structs or arrays.

- Extended test infrastructure to test flattening ability.
2016-09-22 08:47:48 -06:00
steve-lunarg
7f7c2ed780 HLSL: Add location offsets per resource type
This PR adds the ability to offset sampler, texture, and UBO bindings
from provided base bindings, and to auto-number bindings that are not
provided with explicit register numbers. The mechanism works as
follows:

- Offsets may be given on the command line for all stages, or
  individually for one or more single stages, in which case the
  offset will be auto-selected according to the stage being
  compiled. There is also an API to set them. The new command line
  options are --shift-sampler-binding, --shift-texture-binding, and
  --shift-UBO-binding.

- Uniforms which are not given explicit bindings in the source code
  are auto-numbered if and only if they are in live code as
  determined by the algorithm used to build the reflection
  database, and the --auto-map-bindings option is given. This auto-numbering
  avoids using any binding slots which were explicitly provided in
  the code, whether or not that explicit use was live. E.g, "uniform
  Texture1D foo : register(t3);" with --shift-texture-binding 10 will
  reserve binding 13, whether or not foo is used in live code.

- Shorter synonyms for the command line options are available.  See
  the --help output.

The testing infrastructure is slightly extended to allow use of the
binding offset API, and two new tests spv.register.(no)autoassign.frag are
added for comparing the resulting SPIR-V.
2016-09-20 20:31:27 -06:00
John Kessenich
86f7138706 HLSL: Add string basic type and recognize string declaration grammar.
This includes the "< decl ; decl ; >" syntax which has its own namespace.
This functionality is not implemented, just silently accepted.
2016-09-19 20:29:45 -06:00
John Kessenich
d2ce838a58 HLSL: Handle flatten for reads from flatten structs and parameter passing. 2016-09-16 20:24:14 -06:00
John Kessenich
cd0a78a0d9 HLSL: Flatten vertex input and fragment output structures.
Vulkan can't handle structures into the vertex stage or out
of the fragment stage.
2016-09-10 11:09:24 -06:00
steve-lunarg
297ae211f1 WIP: HLSL: Treat HLSL rows as GLSL columns.
WIP: HLSL: EOpGenMul arg reversal
2016-09-09 12:02:42 -06:00
John Kessenich
07350f3382 HLSL: Handle "fake" entry points, by undoing their built-in variable declarations. 2016-09-02 20:24:07 -06:00
John Kessenich
9e079535a0 HLSL: Handle greater/less depth modes. Fixes issue #489. 2016-09-02 20:05:52 -06: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
steve-lunarg
65564a4ad6 Remapper: move remapper tests into the glslangtests executable. 2016-09-02 09:21:12 -06:00
John Kessenich
6a70eb7161 HLSL: Emulate write-to-output on return-from-entry-point, for return value.
This fixes issue #487 and #480.
It also correctly handles output parameters from the entry point.
2016-08-28 20:13:07 -06:00
steve-lunarg
a8456415b8 WIP: SPV Remapper: add remapper test framework 2016-08-25 10:46:51 -06:00
steve-lunarg
36e87d0871 HLSL: add precise keyword 2016-08-25 08:48:54 -06:00
John Kessenich
fcc0aa3b64 HLSL: Switch to generic selector, but using GLSL #version 400 rules.
Next step is to modify for HLSL rules.
2016-08-24 18:34:43 -06:00
steve-lunarg
efe9724795 HLSL: Add EHTokStringConstant, so that string attributes may be parsed 2016-08-22 17:13:17 -06:00
John Kessenich
b9e39120b4 HLSL: Partially address issue #463: accept GLSL layout(...).
This includes all "per variable" layout qualifiers, but the
key ones mattering and tested for now are:
  set=
  binding=
  constant_id=
  push_constant
2016-08-17 17:38:45 -06:00
John Kessenich
2c6038ecf1 Merge branch 'cpp-headers' 2016-08-11 10:01:13 -06:00
John Kessenich
0a6fb85494 Infrastructure: Make shared symbol-table cache complete, delete work around.
Fixes issue #370 and replaces PR #371.
2016-08-09 19:15:17 -06:00
steve-lunarg
c4a1307403 HLSL: add implicit promotions for assignments and function returns. 2016-08-09 13:48:47 -06:00
John Kessenich
66ec80e01b Build: C++ headers: Replace PR #366 with a more directed version. 2016-08-05 14:04:23 -06:00
steve-lunarg
7dfcf4d1ad HLSL: Add GatherRed/Green/Blue/Alpha methods, inc 4-offset forms 2016-08-03 13:34:39 -06:00
steve-lunarg
cb88de5e5e HLSL: allow semicolons between global scope declarations. 2016-08-03 07:08:06 -06:00
John Kessenich
73d4fb5bc5 PP: Fix issue #408: # as last character in macro.
This would look ahead for a second #, for token pasting, and if not
found, backup one token.  This is fine, unless at the end of line,
which would backup the #, rather than the look ahead.
2016-07-30 12:41:35 -06:00
steve-lunarg
fe5a3ff2f3 HLSL: allow trailing commas in initializer lists & scalar initialization 2016-07-30 10:47:33 -06:00
steve-lunarg
5964c64b2a HLSL: Fix a grammar error related to constructors in parenthetical expressions 2016-07-30 08:09:09 -06:00
John Kessenich
fea226ba43 HLSL: Add shape conversions for scalar -> vector assigments.
Also, this allows turning on the error check for a failed assigment
when parsing.

This makes 39 HLSL tests have a working assignment that was previously
silently dropped, due to lack of this functionality.
2016-07-28 18:41:20 -06:00
John Kessenich
c552aece83 Merge pull request #417 from steve-lunarg/buffers
HLSL: add Buffer support for Load method
2016-07-28 16:56:39 -06:00
steve-lunarg
2de329112b HLSL: allow uint literals, and add test for numeric suffixes 2016-07-28 14:49:48 -06:00
steve-lunarg
d53f717fd3 HLSL: add Buffer support for Load method 2016-07-27 15:57:31 -06:00
steve-lunarg
68f2c144e3 HLSL: Add CalculateLevelOfDetail, and unimplemented errors for *Unclamped and GetSamplePosition 2016-07-27 10:46:33 -06:00
John Kessenich
00957f8110 HLSL: Implement ?: grammar productions.
Missing are implicit conversions between int/bool/etc.
2016-07-27 10:39:57 -06:00
steve-lunarg
1e19d90043 HLSL: add 2DMS texture formats, and matching Load / GetDimensions support 2016-07-27 07:37:21 -06: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
John Kessenich
731cd83ef6 Merge pull request #405 from steve-lunarg/samplers
HLSL: Add gather, improve proto generator machine for upcoming 2DMS/S…
2016-07-26 09:40:46 -06:00
John Kessenich
64723c20b5 Merge pull request #406 from steve-lunarg/pp_line
HLSL: enable #line extension by default for HLSL source.
2016-07-26 09:39:48 -06:00
John Kessenich
3d157c510f HLSL: cbuffer and tbuffer grammar and production. 2016-07-25 16:05:33 -06:00
LoopDawg
6256146ef3 HLSL: enable #line extension by default for HLSL source. 2016-07-23 10:45:00 -06:00
LoopDawg
a2f3d285a8 HLSL: Add gather, improve proto generator machine for upcoming 2DMS/Shadow 2016-07-22 12:46:11 -06:00
LoopDawg
3ef7852ef6 HLSL: Add SampleLevel method 2016-07-21 15:02:30 -06:00
LoopDawg
f245101954 HLSL: Add texture Load method & decomposition 2016-07-21 09:42:35 -06:00
LoopDawg
a78b02941b HLSL: Add SampleCmp and SampleCmpLevelZero texture methods 2016-07-20 09:57:03 -06:00
LoopDawg
5d58faecc0 HLSL: Add tx.GetDimensions method (uint returns only) 2016-07-18 16:40:21 -06:00
LoopDawg
a2b7991497 HLSL: Add SampleBias and SampleGrad, and associated tests 2016-07-15 11:38:49 -06:00
John Kessenich
51e74b17bf Merge pull request #385 from steve-lunarg/inout-qualifiers
HLSL: add in/out/inout qualifiers
2016-07-13 15:42:48 -06:00
LoopDawg
92aff54632 HLSL: add offset Sample() form and arrayed texture support 2016-07-13 11:58:56 -06:00
LoopDawg
9249c709b0 HLSL: add in/out/inout qualifiers. 2016-07-12 20:50:34 -06:00
LoopDawg
4886f69734 HLSL: Sampler/texture declarations, method syntax, partial Sample method 2016-07-12 15:57:46 -06:00
John Kessenich
a86836ede2 Front-end: Fix known crashes by early exit on error (issue #29, issue #34, issue #35).
Added -C option to request cascading errors.  By default, will exit early,
to avoid all error-recovery-based crashes.

This works by simulating end-of-file in input on first error, so no
need for exception handling, or stack unwinding, or any complex error
checking/handling to get out of the stack.
2016-07-09 14:53:11 -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
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
5e69ec683d HLSL: Add typedef grammar and production. 2016-07-05 00:02:40 -06:00
John Kessenich
532543c1c4 HLSL: Grammar: Make comma-separated declaration lists work. 2016-07-01 19:10:01 -06:00
LoopDawg
6daaa4fadf HLSL: Add template style constructors for vector & matrix types 2016-07-01 13:59:36 -06:00
John Kessenich
d02dc5d05a HLSL: Implement switch/case/default. 2016-07-01 00:04:11 -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
187254b92c Merge pull request #357 from steve-lunarg/intrinsics
HLSL: Add asdouble, fma, & mad intrinsics
2016-06-29 10:50:33 -06:00
Lei Zhang
48e296b18c Remove duplicated tests from the runtests script. 2016-06-28 17:54:07 -04:00
LoopDawg
1b7fd0f7b7 Add asdouble, fma, & mad intrinsics and change profile to allow doubles when parsing prototypes 2016-06-28 15:38:38 -06:00
John Kessenich
5bc4d9a26f HLSL: Airplane work: break/continue/discard grammar, and decls for for/if/while. 2016-06-27 21:12:07 -06:00
LoopDawg
6e72fddaa2 Add HLSL memory barrier intrinsics, fix dst, add lit & EvaluateAttributeSnapped 2016-06-20 09:53:59 -06:00
John Kessenich
19b92fff7e HLSL: Basic array grammar. 2016-06-19 11:50:34 -06:00
John Kessenich
93a162a857 HLSL: Handle "." for structure dereference and swizzle. 2016-06-17 17:16:27 -06:00
John Kessenich
9000bd5eb6 Front-end: Make ES floatBitsToInt/intBitsToFloat/etc. all be highp. 2016-06-14 20:38:58 -06:00
LoopDawg
589107095c Implement atomic ops, bit conversions, fix fwidth stage mask, fix saturate dest modifier. 2016-06-13 20:50:36 -06:00
John Kessenich
e6e7494e2a HLSL: Implement basic "struct" grammar. 2016-06-12 23:54:31 -06:00
John Kessenich
077e052a8f HLSL: Implement proper nesting of symbol-table scopes and identifier searching. 2016-06-09 02:03:46 -06:00
John Kessenich
71351de879 HLSL: Add all int/float/bool/uint matrix types, void for functions, and a few others. 2016-06-09 01:33:10 -06:00
John Kessenich
80cb324ff6 Front-end: Fix issue #146: which versions allow double in/out. 2016-06-05 18:52:05 -06:00
John Kessenich
119f8f6906 HLSL: Flesh out the loop grammar and productions. 2016-06-05 15:44:07 -06:00
John Kessenich
0d2b6de45b HLSL: Attribute grammar and if-else grammar/productions. 2016-06-05 12:32:18 -06:00
John Kessenich
1cc1a2813e HLSL: 1) Implement lookahead buffers/stacks for token advance/recede, 2) use it for cast operation.
The grammar now accepts type casts, like "(int)x", but that
has to be disambiguated from "(a + b)", needed deeper lookahead
and backing up than what existed so far.
2016-06-03 16:57:53 -06:00
LoopDawg
643fcb5b43 Add negative intrinsics tests 2016-06-03 16:28:57 -06:00
LoopDawg
4b67732c13 Initial implementation of direct-mapped subset of HLSL intrinsics with type subset.
This checkin implements about half of the HLSL intrinsics for a subset of their
entire type support (but a useful subset).  The uncommented lines in
TBuiltInParseablesHlsl::identifyBuiltIns shows which are connected.
2016-06-03 08:28:29 -06:00
David Neto
b37dc0e458 For MinGW, statically link exes against basic runtimes
Avoids the need to ship basic runtimes like libgcc_s_sjlj-1.dll
with the executables.
2016-06-02 14:37:24 -04:00
John Kessenich
0f5e3ad23c Fix issue #313: Catch internal attempts to modify built-in symbols that don't exist.
Also beefed up support for running compute shaders is #version 420, but this
work is only partially done.
2016-05-29 18:24:31 -06:00
Thomas Perl
7bfd08d21c Check for linking multiple ES shaders to the same stage 2016-05-25 09:26:43 +02:00
John Kessenich
d82c906378 Vulkan: Finish semantics for what creates spec-const-semantics.
Note: This required adding a new test mode to see the AST for vulkan tests.
This also required reworking some deeper parts of type creation, regarding
when storage qualification and constness is deduced bottom-up or dictated
top-down.
2016-05-23 23:10:18 -06:00
John Kessenich
eee0c73432 Merge pull request #297 from antiagainst/config-tests
Test compiling shaders with given resource limits using GTest.
2016-05-20 13:46:31 -06:00
John Kessenich
0133c1233e HLSL: Add more matrix types to the grammar. 2016-05-20 12:17:26 -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
Lei Zhang
1b141728a6 Test compiling shaders with given resource limits using GTest. 2016-05-19 14:18:21 -04:00