glslang-zig/glslang/MachineIndependent
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
..
preprocessor Implement extension GL_AMD_gpu_shader_int16 2017-06-09 17:11:23 +08:00
Constant.cpp Implement extension GL_AMD_gpu_shader_int16 2017-06-09 17:11:23 +08:00
gl_types.h [lumped builds] Add include guards (#pragma once) to header files that did not have any. 2017-05-10 16:58:38 +03:00
glslang.y GLSL: Initiate version GLSL 460, including accept extraneous semicolons. 2017-07-31 03:00:04 -06:00
glslang_tab.cpp GLSL: Initiate version GLSL 460, including accept extraneous semicolons. 2017-07-31 03:00:04 -06:00
glslang_tab.cpp.h Merge branch 'amdrexu-feature' 2017-06-09 12:52:21 -06:00
InfoSink.cpp Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
Initialize.cpp GLSL 4.6: Implement shader group vote. 2017-07-31 03:00:04 -06:00
Initialize.h Build fix: Make string assignment simpler to avoid some compiler issues. 2017-05-09 23:30:56 -06:00
Intermediate.cpp HLSL: Translate directive [flatten] and [branch] to SPV control mask. 2017-07-06 11:31:33 +08:00
intermOut.cpp GLSL 4.6: Implement atomic counter ops and SPV_KHR_shader_atomic_counter_ops. 2017-07-31 03:00:04 -06:00
IntermTraverse.cpp Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
iomapper.cpp Non-functional HLSL: Factor out built-ins from splitting and related simplifications. 2017-08-08 17:32:38 -06:00
iomapper.h Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
limits.cpp Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
linkValidate.cpp Implement SPV_KHR_post_depth_coverage 2017-07-05 12:27:15 -07:00
LiveTraverser.h [lumped builds] Add include guards (#pragma once) to header files that did not have any. 2017-05-10 16:58:38 +03:00
localintermediate.h HLSL: Translate directive [flatten] and [branch] to SPV control mask. 2017-07-06 11:31:33 +08:00
parseConst.cpp HLSL: Allow empty struct initializers 2017-04-27 18:22:52 -06:00
ParseContextBase.cpp Non-functional: Round of adding 'const', related to more efficient getFullNamespaceName(). 2017-03-30 10:16:22 -06:00
ParseHelper.cpp GLSL: Implement version 320 for ES. 2017-07-23 13:54:15 -06:00
ParseHelper.h SPV/OpenGL: Require locations on non-opaque uniform variables. 2017-07-21 13:37:46 -06:00
parseVersions.h Implement extension GL_AMD_gpu_shader_int16 2017-06-09 17:11:23 +08:00
PoolAlloc.cpp Memory/constructor/warning clean-up. Addresses issue #705. 2017-02-02 14:55:02 -07:00
propagateNoContraction.cpp HLSL: Add EOpMatrixSwizzle, selectively decomposed to other ops, for issue #670. 2017-01-13 12:35:01 -07:00
propagateNoContraction.h [lumped builds] Add include guards (#pragma once) to header files that did not have any. 2017-05-10 16:58:38 +03:00
reflection.cpp GLSL reflection: Fix #985: reflect runtime sized arrays having no constant index. 2017-07-28 17:37:31 -06:00
reflection.h Reflection: Fix #977: Expose getBinding(), use in new getUniformBinding(). 2017-07-20 16:44:17 -06:00
RemoveTree.cpp Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
RemoveTree.h [lumped builds] Add include guards (#pragma once) to header files that did not have any. 2017-05-10 16:58:38 +03:00
Scan.cpp GLSL: Implement version 320 for ES. 2017-07-23 13:54:15 -06:00
Scan.h Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
ScanContext.h [lumped builds] Add include guards (#pragma once) to header files that did not have any. 2017-05-10 16:58:38 +03:00
ShaderLang.cpp GLSL: Initiate version GLSL 460, including accept extraneous semicolons. 2017-07-31 03:00:04 -06:00
SymbolTable.cpp HLSL: add methods to track user structure in texture return type. 2017-08-15 16:40:21 -06:00
SymbolTable.h HLSL: Implement member functions calling member functions. 2017-05-17 02:20:34 -06:00
Versions.cpp Implement SPV_KHR_post_depth_coverage 2017-07-05 12:27:15 -07:00
Versions.h Implement SPV_KHR_post_depth_coverage 2017-07-05 12:27:15 -07:00