This factored computeTypeLocationSize() out of needing the TIntermediate contents,
and uses it to show how to know how many locations an object needs.
However, it still does not do cross stage, or mixed location/no-location
analysis.
- make it sharable with GLSL
- correct the case insensitivity
- remove the map; queries are not needed, all entries need processing
- make it easier to build bottom up (will help GLSL parsing)
- support semantic checking and reporting
- allow front-end dependent semantics and attribute name mapping
Set type to r-value resulting from indexing vector, to prevent
float->uint conversion when source is already uint. Resulting
OpConvertFToU would otherwise fail validation because source is
already uint.
For LoadN, incorrect uint->float->uint can be avoided; fixing
potential truncation of big integer values.
In DX10/DX11 you can only output RT/Viewport indices from GS; however,
DX11.4/DX12 add support for outputting these from VS as well.
This is supported by Vulkan if the relevant extension is available, and
by MSL and by MSL (which you can cross-compile to via SPIRV-Cross).
Some stage (e.g, hull shaders) have arrayed builtin outputs (e.g, position).
When copying from the internal structure to the split form, it is necessary
to propagate that indirection to the actual arrayed outputs. This was not
happening.
Addresses #1181
This makes struct returns from functions work, but breaks
structs containing arrays, due to limitations in subsequent
transforms in spirv-opt. This is expected to be fixed soon.
Adds command line options:
--invert-y
--iy
(synonyms) which invert position.Y on vertex shader output. Handles these cases:
* Direct single variable return
* Member of direct returned struct
* Single variable output parameter
* Member of struct output parameter
API:
// Enables position.Y output negation in vertex shader
void TShader::setInvertY(bool invert);
Fixes#1173
HLSL truncates the vector, or one of the two matrix dimensions if there is a
dimensional mismatch in m*v, v*m, or m*m.
This PR adds that ability. Conversion constructors are added as required.
If a shader includes a mixture of several stages, such as HS and GS,
the non-stage output geometry should be ignored, lest it conflict
with the stage output.
Two unrelated, minor tweaks:
(1) Use std::array for shiftBindingForSet. Now matches shiftBinding.
(2) Add parens in shouldFlatten() to make compiler warning happy.
Fixes#1092. Allows arrays of opaques to keep arrayness, unless
needed by uniform array flattening.
Can handle assignments of mixed amounts of flattening.
There was some code replication around getting string and integer
values out of an attribute map. This adds new methods to the
TAttributeMap class to encapsulate some accessor details.
A single texture can statically appear in code mixed with a shadow sampler
and a non-shadow sampler. This would be create invalid SPIR-V, unless
one of them is provably dead.
The previous detection of this happened before DCE, so some shaders would
trigger the error even though they wouldn't after DCE. To handle that
case, this PR splits the texture into two: one with each mode. It sets
"needsLegalization" (if that happens for any texture) to warn that this shader
will need post-compilation legalization.
If the texture is only used with one of the two modes, behavior is as it
was before.
Add support for Subpass Input proposal of issue #1069.
Subpass input types are given as:
layout(input_attachment_index = 1) SubpassInput<float4> subpass_f;
layout(input_attachment_index = 2) SubpassInput<int4> subpass_i;
layout(input_attachment_index = 3) SubpassInput<uint4> subpass_u;
layout(input_attachment_index = 1) SubpassInputMS<float4> subpass_ms_f;
layout(input_attachment_index = 2) SubpassInputMS<int4> subpass_ms_i;
layout(input_attachment_index = 3) SubpassInputMS<uint4> subpass_ms_u;
The input attachment may also be specified using attribute syntax:
[[vk::input_attachment_index(7)]] SubpassInput subpass_2;
The template type may be a shorter-than-vec4 vector, but currently user
structs are not supported. (An unimplemented error will be issued).
The load operations are methods on objects of the above type:
float4 result = subpass_f.SubpassLoad();
int4 result = subpass_i.SubpassLoad();
uint4 result = subpass_u.SubpassLoad();
float4 result = subpass_ms_f.SubpassLoad(samp);
int4 result = subpass_ms_i.SubpassLoad(samp);
uint4 result = subpass_ms_u.SubpassLoad(samp);
Additionally, the AST printer could not print EOpSubpass* nodes. Now it can.
Fixes#1069
- support C++11 style brackets [[...]]
- support namespaces [[vk::...]]
- support these on parameter declarations in functions
- support location, binding/set, input attachments
Texture shadow mode must match the state of the sampler they are
combined with. This change does that, both for the AST and the
symbol table. Note that the texture cannot easily be *created*
the right way, because this may not be known at that time. Instead,
the texture is subsequently patched.
This cannot work if a single texture is used with both a shadow and
non-shadow sampler, so that case is detected and generates an error.
This is permitted by the HLSL language, however. See #1073 discussion.
Fixed one test source that was using a texture with both shadow and
non-shadow samplers.