Commit Graph

1681 Commits

Author SHA1 Message Date
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
e19e68d431 Merge pull request #571 from baldurk/explicit-lambda-returns
Add explicit lambda return types, for compilers without C++14 support
2016-10-28 19:16:13 -06:00
baldurk
ca73570447 Add explicit lambda return types, for compilers without C++14 support 2016-10-28 17:57:25 +02:00
t.jung
c2016a52d2 New uniform mapping handling
- add optional callback to handle mapping of uniform variables in linking phase
- if no resolver is provided, it uses the internal default resolver with all shifts and auto bind settings

Change-Id: Icfe38a9eabe8bfc8f8bb6d8150c06f7ed38bb762
2016-10-28 15:43:14 +02:00
John Kessenich
9507885537 Merge pull request #560 from jeremy-lunarg/pragmas
silence -Wunknown-pragmas warnings on gcc
2016-10-26 23:02:47 -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
John Kessenich
aba444005f Merge pull request #567 from steve-lunarg/compare-fix
HLSL: Enable component-wise vector comparisons from operators
2016-10-26 22:54:35 -06:00
John Kessenich
850ac0628d Merge pull request #561 from jeremy-lunarg/unused
GLSL: apply unused variable
2016-10-26 22:51:43 -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
0d628c179d Merge pull request #565 from mre4ce/master
Disabled MSVC 2015 compile warnings.
2016-10-25 00:16:12 -06:00
steve-lunarg
4e3dd2087c WIP: avoid strtok 2016-10-21 14:51:43 -06:00
Jeremy Hayes
c8e60e28b7 WIP: apply unused variable
I happened upon numArgs while hunting for unused variables. I suspect
the intent was to apply it as shown in this patch. However, I am not a
compiler dude. Someone more appropriate should grok this change.
2016-10-21 14:48:46 -06:00
Johannes van Waveren
d1300753f7 update 2016-10-21 17:30:50 +09:00
Johannes van Waveren
2f4c832d47 Merge remote-tracking branch 'upstream/master' 2016-10-21 17:21:46 +09:00
Johannes van Waveren
8e1e717cae fixed MSVC 2015 compile warnings 2016-10-21 17:21:12 +09:00
John Kessenich
3fc1543794 Merge pull request #559 from steve-lunarg/samplecmp-fix
HLSL: fix defect in EOpMethodSampleCmp* texture decomposition
2016-10-20 19:22:57 -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
John Kessenich
921d315f3c Merge pull request #555 from steve-lunarg/promotion-fixes
HLSL: Fix unary and binary operator type conversion issues
2016-10-20 19:07:27 -06:00
John Kessenich
720e89b314 Merge pull request #556 from dneto0/guard-amd-enums
SPV: Add missing guard to code that uses AMD extensions
2016-10-20 19:04:30 -06:00
steve-lunarg
6b596682c9 HLSL: fix defect in EOpMethodSampleCmp* texture decomposition
HLSL holds the compare value in a separate intrinsic arg, but the AST wants
a vector including the cmp val, except in the 4-dim coord case, where it
doesn't fit and is in fact a separate AST parameter.  This is awkward but
necessary, given AST semantics.  In the process, a new vector is constructed
for the combined result, but this vector was not being given the correct
TType, so was causing some downstream troubles.

Now it is.  A similar defect existed in OpTextureBias, and has also been
fixed.
2016-10-20 14:50:12 -06:00
steve-lunarg
6cb1637f37 Move promote methods to TIntermediate class
A need arose to use capabilities from TIntermediate during
node promotion.  These methods have been moved from virtual
methods on the TIntermUnary and TIntermBinary nodes to methods
on TIntermediate, so it is easy for them construct new nodes
and so on.

This is done as a separate commit to verify that no test results
are changed as a result.
2016-10-19 12:57:22 -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
David Neto
bb5c02fd23 Add missing guard to code that uses AMD extensions
Otherwise compilation fails when ENABLED_AMD_EXTENSIONS is off.
2016-10-19 10:17:25 -04: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
5d45eadedc HLSL: Turn on tests for groupshared. 2016-10-16 12:22:20 -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
4a3467933e Build: Fix unsigned/signed warning. 2016-10-16 11:50:46 -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
c658497846 Merge pull request #539 from schwa423/linux_global_lock
Use pthread_mutex for global lock on Linux.
2016-10-15 22:53:46 -06:00
John Kessenich
1b6daa0401 Merge pull request #550 from amdrexu/bugfix
SPV: Add missing extension declarations for certain AMD extensions.
2016-10-15 22:49:53 -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
Josh Gargus
425af5f6b0 Use a recursive mutex. 2016-10-15 15:19:59 -07:00
steve-lunarg
cce8d48bcc HLSL: phase 3c: add option to use Unknown storage format
This uses the Unknown storage format, instead of deducing the
format from the texture declaration type.
2016-10-14 18:50:37 -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
Rex Xu
17ff343bf4 SPV: Add missing extension declarations for certain AMD extensions. 2016-10-14 17:41:45 +08: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
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
31d5d48812 Change constructor to use ()s instead of {}s 2016-10-13 19:25:52 +02:00
baldurk
ff160f15ef Add #include <cstdint> for std::uint32_t usage 2016-10-13 19:24:42 +02:00