Commit Graph

428 Commits

Author SHA1 Message Date
John Kessenich
7015bd658e Web: Remove/rationalize a set of *_EXTENSIONS, using GLSLANG_WEB.
Focus was on the front end (not SPIR-V), minus the grammar.
Reduces #ifdef count by around 320 and makes the web build 270K smaller,
which is about 90% the  target size.

The grammar and scanner will be another step, as will the SPIR-V backend.
This makes heavy use of methods #ifdef'd to return false as a global way
of turning off code, relying on C++ DCE to do the rest.
2019-08-20 23:21:55 -06:00
John Kessenich
4b4b41a634 HLSL: Fix #1815: Don't constant fold spec-constant array indexing. 2019-07-03 01:28:51 -06:00
John Kessenich
5cb2fa2ad2 Fix #1759: Check for specialization constants when literals required. 2019-05-03 08:40:35 -06:00
Dan Sinclair
0560138e66 Fixup leak of TString
In decomposeIntrinsic a new TString was being allocated and passed into
a TVariable. That string was leaking. This CL converts the new TString
to call NewPoolTString to allocate from the TString pool.
2019-02-20 16:40:13 -05:00
John Kessenich
567396b6b4 Whitespace: Fix some tabs->spaces, mostly to retriggered failed bots. 2019-02-11 03:43:12 -07:00
Rex Xu
eaf31ab98c Add 8-bit/16-bit transform feedback support for future use 2019-02-03 23:31:32 +08:00
John Kessenich
544c039d26 HLSL: Fix #1679: Add HLSL earlydepthstencil -> SPV EarlyFragmentTests. 2019-01-28 22:19:43 -07:00
John Kessenich
d9cee59afa
Merge pull request #1626 from KhronosGroup/extension-support
Infrastructure: Generalize and broaden per-variable extension checking.
2019-01-23 12:05:22 -08:00
Hodgman
0bb89f5809 HLSL: Protect against some crashes 2019-01-21 18:21:11 -08:00
John Kessenich
493dee0ade
Merge pull request #1656 from amdrexu/bugfix
Fix xfb_stride incorrectness(#1654)
2019-01-17 21:53:34 -07:00
John Kessenich
d9739794e9
Merge pull request #1662 from dneto0/fix-leak2
HLSL: Avoid leaking a shadow sampler struct
2019-01-17 06:29:41 +07:00
David Neto
edadbed6fb HLSL: Avoid leaking a shadow sampler struct 2019-01-16 17:04:58 -05:00
David Neto
806e0573da Avoid leaking name for counter buffer 2019-01-16 10:44:31 -05:00
John Kessenich
b2395e9ddf HLSL: Fix #1655; use "" for nullptr file names. Needs test cases. 2019-01-16 16:07:51 +07:00
Rex Xu
75c5603ada Fix xfb_stride incorrectness(#1654)
Add int64 support in XFB. Change containsDouble to contains64BitType. Make
it more general.
2019-01-14 12:02:58 +08:00
John Kessenich
28be4543cd Infrastructure: Generalize and broaden per-variable extension checking. 2019-01-09 22:21:22 +07:00
John Kessenich
b23d232ec5 Licensing. Fixes #958. Add licenes file and update copyrights. 2018-12-14 10:47:35 -07:00
Rémi Verschelde
ebfd91a719 Remove Unix executable permission from text files 2018-12-10 10:49:16 +01:00
John Kessenich
bd1c1831d5 Manually merge ClemensRognerSD-dx9-sampler and resolve conflicts. 2018-12-07 18:38:26 -07:00
greg-lunarg
5d43c4aac7 SPV: Fix #1575, fix #1593: Support HLSL #line
SPIR-V OpLines now contain filenames from HLSL-style #lines.
2018-12-07 17:36:33 -07:00
John Kessenich
e3b76ed608 Merge branch 'scalar_block_layout' of https://github.com/jeffbolznv/glslang into jeffbolznv-scalar_block_layout 2018-11-16 09:57:33 -07:00
Jeff Bolz
7da39ed968 Implement GL_EXT_scalar_block_layout 2018-11-14 09:30:53 -06:00
t.jung
31cd98c7b2 HLSL: implemented c register handling
Adjusted a test not to use c register for
a structured buffer, they are supposed to
use t registers

Added comments with hints for what are the
register types are used for.
2018-11-14 13:12:12 +01:00
Alejandro Piñeiro
af8c1bdb16 ParseHelper: assign xfb_offset for struct members too
If the out variable is a struct type, with a xfb_offset explicitly
assigned, the members need to get their xfb_offset assigned. This is
specially relevant, as we cannot use layout qualifiers on struct
members.
2018-10-31 10:34:44 +01:00
John Kessenich
086febc448 PP: Fix #155: Don't give error on HLSL PP-only parsing. 2018-10-25 12:43:02 -06:00
otakuto
d03da06ac1 Remove execute permissions 2018-08-07 03:16:20 +09:00
John Kessenich
7d4c9a07b5 GLSL: Construct shadow texture from non-shadow sampler.
Tracks https://github.com/KhronosGroup/GLSL/pull/22.
2018-07-23 15:59:09 -06:00
John Kessenich
cf6bd066b9 HLSL: Fix #1432: Globally initialize local static variables. 2018-07-11 01:09:14 -06:00
John Kessenich
dccfeedfc3 HLSL: Fix #1423: implement CalculateLevelOfDetailUnclamped().
(If there is a bias issue, we need to discover what it is.)
2018-07-02 18:53:19 -06:00
LoopDawg
c59916710e HLSL: allow self-type cast (as no-op passthrough)
Previously, casting an object of a struct type to an identical type
would produce an error.  This PR allows this case.

As a side-effect of the change, several self-type casts in existing
tests go away.  For example:

    0:10          Construct float ( temp float)
    0:10            'f' ( in float)

becomes this (without the unneeded constructor op):

    0:10          'f' ( in float)

For vector or array types this can result in somewhat less overall code.

Fixes: #1218
2018-05-17 13:03:12 -06:00
LoopDawg
4e6d3eaf5d HLSL: require coverage mask to be arrayed output.
SPIR-V requires the coverage mask to be an array of integers, but HLSL
allows scalar integers.  This adds the requisite type conversion and
wrapped entry point handling.

Fixes: #1202
2018-05-16 13:58:10 -06:00
John Kessenich
cfb05ec702
Merge pull request #1379 from LoopDawg/groupid-fix
HLSL: various SPIR-V compute shader IDs must be 3-vectors of integers
2018-05-16 10:36:16 -06:00
LoopDawg
91a8178efb HLSL: various SPIR-V compute shader IDs must be a 3-vector of integers.
This PR forces the external definition of SV_GroupID variables to 3-vectors.
The conversion process between the shader-declared type and the external type
happens in wrapped main IO variable conversion.

The same applies to SV_DispatchThreadID and SV_GroupThreadID.

Fixes: #1371
2018-05-16 06:48:02 -06:00
LoopDawg
1326b8c754 HLSL: Allow stream output Append() method after entry point.
Append() method is special: unlike most outputs, it does not copy
some temporary data to a symbol in the entry point epilogue, but
rather uses an emit builtin after each write to the output stream.

This had been handled by remembering the special output symbol for
the stream as it was declared in the shader entry point before
symbol sanitization.  However the prior code was too simple and
only handled cases where the Append() method happened after the
entry point, so that the output symbol had been seen.

This PR adds a patching step so that the Append()s may appear in
any order WRT the entry point.  They are patched in an epilogue,
whereupon it is guaranteed in a well formed shader that we have
seen the appropriate declaration.

Fixes #1217.
2018-05-15 15:13:09 -06:00
John Kessenich
c034c5a8a2 HLSL/SPV: Declare DepthReplacing for shaders declaring SV_Depth* outputs. 2018-04-13 18:36:58 -06:00
danginsburg
95c87b657c Fix issue #1350 - set the node type to match the atomic TIntermAggregate node type so that AtomicSMin/Max is not generated with a result type of void. 2018-04-12 16:46:04 -04:00
John Kessenich
461ea09943 Non-functional: Fix tabs. 2018-04-11 00:03:47 -06:00
John Kessenich
6ae18707f9 HLSL: Fix #1332: consistently use uint for counter buf typing. 2018-04-10 11:59:33 -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
GregF
fb03a55e0f Only print legalization warning if optimizer disabled 2018-03-29 13:17:54 -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
859b0342b8 Types: Fix #1290: Rationalize and correct "mixed" style array dimensioning.
There a couple functional problems, which when reduced down also led to
some good simplifications and rationalization.  So, this commit:
 - corrects "mixed" functionality: int[A] f[B] -> f[B][A]
 - correct multi-identifier decls: int[A] f[B], g[C] -> f and g are independently sized.
 - increases symmetry between different places in the code that do this
 - makes fewer ways to do the same thing; several methods are just gone now
 - makes more clear when something is copied or shared
2018-03-26 00:38:53 -06:00
John Kessenich
5d610ee1dc Implement SPV_GOOGLE_hlsl_functionality1.
Enabled via -fhlsl_functionality1
2018-03-16 20:21:44 -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
Rex Xu
a00e51b5b2 HLSL: Correct some mistakes for min16 types
- Add missing constructor ops to support float16/int16/uint16 types
- Allow half float literals
- Correct two errors of double literal parse in HLSL: extension check and
  postfix
2018-03-12 23:15:11 +08:00
John Kessenich
a51525059f
Merge pull request #1269 from bkaradzic/master
Fixed GCC+Clang errors and warnings on Linux and OSX.
2018-03-07 14:31:57 -07:00
John Kessenich
66011cb2c2 SPV: Implement Vulkan 1.1 features and extensions. 2018-03-06 16:12:04 -07:00
John Kessenich
b2ae1d0521 Revert "Merge pull request #1274 from greg-lunarg/legal2"
This reverts commit 2c65069ecd, reversing
changes made to fa9b465b92.
2018-03-06 14:50:41 -07:00
GregF
fd50f6a4c3 Legalization: Omit legalization warning when spirv-opt is linked. 2018-03-06 13:00:08 -07:00
Branimir Karadžić
1de8e54d66 Fixed GCC+Clang errors and warnings on Linux and OSX. 2018-03-03 13:04:12 -08:00