Commit Graph

2296 Commits

Author SHA1 Message Date
John Kessenich
d9bd97d054 Build: Fix strdup -> _strdup warnings. 2017-09-11 21:56:09 -06:00
John Kessenich
b3ca4045c5 Build: Fix build warnings. 2017-09-11 20:39:54 -06:00
John Kessenich
5002c26b5e Fix #1043: set all scan string-locations to have bias, not just the first one. 2017-09-11 20:35:49 -06:00
John Kessenich
a25530cc18 Non-functional: Make usage for entry points more consistent. 2017-09-11 20:13:49 -06:00
John Kessenich
e22c11fd0a Merge pull request #1053 from mchock-nv/mchock-nv-fix-lambda
Delete unused 'this' capture
2017-09-11 19:33:11 -06:00
John Kessenich
ea1ea974eb Address #1052: Have language-level exits of case statements. 2017-09-11 19:25:17 -06:00
mchock-nv
933c10cd4b Delete unused 'this' capture
Remove an unused 'this' entry from a lambda capture list.

This cleans up a unused-lambda-capture warning.
2017-09-11 15:20:52 -07:00
John Kessenich
d004e5ca4c Merge pull request #1047 from svenstaro/add-stdin-option
Add stdin option (fixes #598)
2017-09-07 20:02:37 -07:00
Sven-Hendrik Haase
0dd1285cb6 Add --stdin 2017-09-07 20:35:40 +02:00
John Kessenich
8688e3fb77 Merge pull request #1048 from LoopDawg/opaque-type-fix
Fix lvalue test in SPIR-V generation
2017-09-06 21:50:20 -07:00
LoopDawg
76117921b9 Fix lvalue check in SPIR-V generation
There were several locations in TGlslangToSpvTraverser::handleUserFunctionCall testing for
whether a fn argument should be in the lvalue or rvalue array.  They must get the same
result for indexing sanity, but had slightly different logic.

They're now forced into the same test.
2017-09-06 15:04:52 -06:00
John Kessenich
3a21c88050 Merge pull request #1042 from LoopDawg/warning-fix-2
WIP: Linux build warning fix
2017-08-31 23:46:56 -06:00
John Kessenich
43f682f652 Merge pull request #1039 from amdrexu/bugfix
Fix issues of GL_ARB_viewport_layer_array
2017-08-31 23:36:09 -06:00
LoopDawg
2baa774259 Linux build warning fix
* Remove complaint about unused function parameter in resolveUniformLocation()
* Remove complaint about defined but not used variable in spvIR.h
2017-08-31 18:09:58 -06:00
Rex Xu
2a305f6531 Fix issues of GL_ARB_viewport_layer_array 2017-09-01 06:54:19 +08:00
John Kessenich
75e057f980 Merge pull request #1037 from LoopDawg/clip-cull-geom
HLSL: add geometry stage support for clip/cull distance
2017-08-31 12:36:06 -06:00
LoopDawg
5e5b12e931 HLSL: add geometry stage support for clip/cull distance
Changes:

(1) Allow clip/cull builtins as both input and output in the same shader stage.  Previously,
not enough data was tracked to handle this.

(2) Handle the extra array dimension in GS inputs.  The synthesized external variable can
now be created with the extra array dimension if needed, and the form conversion code is
able to handle it as well.

For example, both of these GS inputs would result in the same synthesized external type:

    triangle in float4 clip[3] : SV_ClipDistance

    triangle in float2 clip[3][2] : SV_ClipDistance

In the second case, the inner array dimension packs with the 2-vector of floats into an array[4],
which there is an array[3] of due to the triangle geometry.
2017-08-31 10:37:46 -06:00
John Kessenich
a459fc8142 Merge pull request #1031 from xxxbxxx/for-upstream-2
HLSL: fix preprocessor concatenation behaviour.
2017-08-29 12:41:55 -06:00
John Kessenich
4e2f05da41 Build: Fix #1036: size_t warning. 2017-08-29 12:36:09 -06:00
xavier
eb71cdd5bb HLSL: fix preprocessor concatenation behaviour.
Fix #772.
2017-08-29 00:35:01 +02:00
John Kessenich
ea0c1643ab Merge pull request #1035 from LoopDawg/clip-cull-type-fix
HLSL: (minor) fix type on clip/cull index result
2017-08-28 16:07:55 -06:00
LoopDawg
d6f4d9b48c HLSL: fix type on clip/cull index result
While adding geometry stage support for clip/cull, it transpired that the
existing clip/cull support was not setting the type of the result of indexing
into the clup/cull variable.  That's a defect independent of the geometry
support, so to simplify the geometry PR, this is addressed separately.

It doesn't appear to change the generated SPIR-V, but that's probably down to
something else tolerating a bad input.
2017-08-28 14:05:41 -06:00
John Kessenich
82e95a3aa5 SPV: Add auto location mapping of non-opaque non-block uniform variables.
Fix #1019.
2017-08-26 15:47:25 -06:00
John Kessenich
8268a35504 Build: Attempt better support for VS 2012.
Fix #1020. Fix #1021. Fix #1022.
2017-08-25 21:35:37 -06:00
John Kessenich
74c5f711b4 Merge pull request #1014 from KhronosGroup/SPV_EXT_shader_viewport_index_layer
SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer.
2017-08-25 13:33:16 -06:00
John Kessenich
35343cb84d Merge pull request #1034 from KhronosGroup/module-processes
SPV reflection: Add OpModuleProcessed for compile options.
2017-08-25 13:05:54 -06:00
John Kessenich
b41bff69d2 SPV: 1st pass implementation of SPV_EXT_shader_viewport_index_layer. 2017-08-25 13:04:39 -06:00
John Kessenich
2a27116cae SPV reflection: Add OpModuleProcessed for compile options. 2017-08-25 11:48:02 -06:00
John Kessenich
1f312f9078 Merge pull request #1028 from LoopDawg/clip-cull-input
HLSL: handle clip and cull distance input builtin type conversion
2017-08-24 12:15:00 -06:00
LoopDawg
e2cda3c2d7 HLSL: handle clip and cull distance input builtin type conversion
HLSL allows a range of types for clip and cull distances.  There are
three dimensions, including arrayness, vectorness, and semantic ID.
SPIR-V requires clip and cull distance be a single array of floats in
all cases.

This code provides input side conversion between the SPIR-V form and
the HLSL form.  (Output conversion was added in PR #947 and #997).

This PR extends HlslParseContext::assignClipCullDistance to cope with
the input side conversion.  Not as much changed as appears: there was
also a lot of renaming to reflect the fact that the code now handles
either direction.

Currently, non-{frag,vert} stages are not handled, and are explicitly
rejected.

Fixes #1026.
2017-08-24 08:35:40 -06:00
John Kessenich
fc3436941e Merge pull request #1029 from amdrexu/feature2
Implement extension GL_AMD_shader_image_load_store_lod
2017-08-23 23:13:19 -06:00
John Kessenich
00b3e384a3 Merge pull request #1025 from amdrexu/feature
SPV: Implement extension SPV_EXT_shader_stencil_export
2017-08-23 17:58:31 -06:00
Rex Xu
129799a709 Implement extension GL_AMD_shader_image_load_store_lod 2017-08-24 06:56:39 +08:00
Rex Xu
e8fdd79f2e SPV: Implement extension SPV_EXT_shader_stencil_export 2017-08-24 06:26:15 +08:00
John Kessenich
3d1b709676 HLSL: Fix #1027. 2017-08-23 14:33:31 -06:00
John Kessenich
778806a692 HLSL: Fix #1018: Give an error for mismatched return type. 2017-08-19 17:29:44 -06:00
John Kessenich
b207daa5d3 Merge pull request #1017 from LoopDawg/texture-struct-return.1
HLSL: add methods to handle user structures in texture template type.
2017-08-19 16:00:26 -06:00
John Kessenich
786e8795ee Build: Fix build when NV_EXTENSIONS is not enabled. 2017-08-19 15:54:49 -06:00
John Kessenich
d6be6da031 SPV: Fix #1016: Don't allow non-GLSL-extension protected Layer and ViewportIndex members. 2017-08-17 23:49:39 -06:00
LoopDawg
5ee05891cf HLSL: add methods to track user structure in texture return type.
Some languages allow a restricted set of user structure types returned from texture sampling
operations.  Restrictions include the total vector size of all components may not exceed 4,
and the basic types of all members must be identical.

This adds underpinnings for that ability.  Because storing a whole TType or even a simple
TTypeList in the TSampler would be expensive, the structure definition is held in a
table outside the TType.  The TSampler contains a small bitfield index, currently 4 bits
to support up to 15 separate texture template structure types, but that can be adjusted
up or down.  Vector returns are handled as before.

There are abstraction methods accepting and returning a TType (such as may have been parsed
from a grammar).  The new methods will accept a texture template type and set the
sampler to the structure if possible, checking a range of error conditions such as whether
the total structure vector components exceed 4, or whether their basic types differe, or
whether the struct contains non-vector-or-scalar members.  Another query returns the
appropriate TType for the sampler.

High level summary of design:

In the TSampler, this holds an index into the texture structure return type table:

    unsigned int structReturnIndex : structReturnIndexBits;

These are the methods to set or get the return type from the TSampler.  They work for vector or structure returns, and potentially could be expanded to handle other things (small arrays?) if ever needed.

    bool setTextureReturnType(TSampler& sampler, const TType& retType, const TSourceLoc& loc);
    void getTextureReturnType(const TSampler& sampler, const TType& retType, const TSourceLoc& loc) const;

The ``convertReturn`` lambda in ``HlslParseContext::decomposeSampleMethods`` is greatly expanded to know how to copy a vec4 sample return to whatever the structure type should be.  This is a little awkward since it involves introducing a comma expression to return the proper aggregate value after a set of memberwise copies.
2017-08-15 16:40:21 -06:00
John Kessenich
03e63fa805 HLSL: Add fall-back for opaque initializers to just generate long-term expected code.
This generated code needs an optimization pass to eliminate the assignments
to the opaque members.
2017-08-15 10:18:32 -06:00
John Kessenich
25495fdfa7 Merge pull request #1013 from KhronosGroup/flatten-nonarrayed
HLSL: Flatten structs for all non-arrayed I/O interfaces.
2017-08-15 13:16:36 +09:00
John Kessenich
260f50616a SPV: Correct selection of storage-image capabilities. Fixes #986.
Code was reflecting an old historical use of sampled as a SPIR-V
2-valued operand, instead of its current 3 values.
2017-08-14 22:10:00 -06:00
John Kessenich
e29ff3cd65 HLSL: Flatten structs for all non-arrayed I/O interfaces. 2017-08-11 00:17:26 -06:00
John Kessenich
01109546d8 HLSL: Make fresh array sizes for TessLevelOuter and TessLevelInner arrays.
This prevents potentional sharing from inadvertently affecting other arrays.
2017-08-11 00:14:46 -06:00
John Kessenich
4baebea8d6 HLSL Test: Expand test, adding a user-patch-constant signature. 2017-08-10 11:41:11 -06:00
John Kessenich
e516d4335f HLSL: Move debug naming to a simpler, more consistent, scheme.
This will help in expanding flattening and reducing splitting.
2017-08-09 14:29:29 -06:00
John Kessenich
3322dd8f99 HLSL: Include built-in processing for vertex input and fragment output flattening. 2017-08-09 11:03:49 -06:00
John Kessenich
ecd08bc36c Non-functional HLSL: Factor out built-ins from splitting and related simplifications. 2017-08-08 17:32:38 -06:00
John Kessenich
eaed06823a Merge pull request #1011 from LoopDawg/pragma-pack-matrix
HLSL: implement #pragma pack_matrix(layout)
2017-08-08 06:35:29 +09:00