The dependency was only because of the SpvOptions struct which is used
in both, but really is part of the glslang public interface and should
be in the public GlslangToSpv.h header.
Adds the --no-link option which outputs the compiled shader binaries
without linking them. This is a first step towards allowing users to
create SPIR-v binary, non-executable libraries.
When using the --no-link option, all functions are decorated with the
Export linkage attribute.
ANGLE no longer links with glslang. This change reverts
1ef2e250fc which added a flag to strip
glslang to reduce its binary size. This flag is no longer needed.
New interface allows users to generate ResourceLimits for interface so
that additions to TBuiltInResource do not break the ABI.
Users should use the glslang-default-resource-limits library and the
Public/ResourceLimits.h header. Similar changes have been made to the
C interface. Use Public/resource_limits_c.h.
Fixes#2822
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
This adds or changes binding/location decorations in 100s of shaders.
It also allows more output (spv.register.autoassign.rangetest.frag)
due to allowing ioMap() to fail.
More aggressively prune unreachable code as follows.
When no control flow edges reach a merge block or continue target:
- delete their contents so that:
- a merge block becomes OpLabel, then OpUnreachable
- a continue target becomes OpLabel, then an OpBranch back to the
loop header
- any basic block which is dominated by such a merge block or continue
target is removed as well.
- decorations targeting the removed instructions are removed.
Enables the SPIR-V builder post-processing step the GLSLANG_WEB case.
* Changed unit tests to only record known the validation pass/fail
status
* errors are output as part of the failure message if the result is
unexpected
* can turn off validation for each test individually
* Moved some SPV_KHR_vulkan_memory_model tests to be compiled for Vulkan
1.1
Also added known-good mechanism to fetch latest validated spirv-tools.
Also added -Od and -Os to disable optimizer and optimize for size.
Fetching spirv-tools is optional for both glsl and hlsl. Legalization
of hlsl is done by default if spirv-opt is present at cmake time.
Optimization for glsl is currently done through the option -Os.
Legalization testing is currently only done on four existing shaders.
A separate baseLegalResults directory holds those results. All previous
testing is done with the optimizer disabled.
Adds a transformation step to the post processing step.
Two modes are available:
1) keep
- Keeps samplers, textures and sampled textures as is
2) transform pure texture into sampled texture and remove pure samplers
- removes all pure samplers
- transforms all pure textures into its sampled counter part
Change-Id: If54972e8052961db66c23f4b7e719d363cf6edbd
Also, provides an option to auto-assign locations.
Existing tests use this option, to avoid the error message,
however, it is not fully implemented yet.
New command line option --shift-ssbo-binding mirrors --shift-ubo-binding, etc.
New reflection query getLocalSize(int dim) queries local size, e.g, CS threads.
Any previous use would only be for "", which would probably mean changing
include(...) -> includeLocal(...)
See comments about includeLocal() being an additional search over
includeSystem(), not a superset search.
This also removed ForbidIncluder, as
- the message in ForbidIncluder was redundant: error results were
already returned to the caller, which then gives the error it
wants to
- there is a trivial default implementation that a subclass can
override any subset of (I still like abstract base classes though)
- trying to get less implementation out of the interface file anyway
This PR adds:
1. The "u" register class for RW* objects.
2. --shift-image-bindings (== --sib), analogous to --shift-texture-bindings etc.
3. Case insensitive reg classes.
4. Tests for above.
The gtest executable accepts a --test-root option to specify
a root directory for test files. It defaults to the Test directory
in the source tree from which the executable is built.
For example, this lets us run test exectuables built with MinGW on Linux
on a Windows machine with its own copy of the source tree.
Fix for two defects as follows:
- The IO mapping traverser was not setting inVisit, and would skip some AST nodes.
Depending on the order of nodes, this could have prevented the binding from
showing up in the generated SPIR-V.
- If a uniform array was flattened, each of the flattened scalars from the array
is still a (now-scalar) uniform. It was being converted to a temporary.
This checkin adds a --flatten-uniform-arrays option which can break
uniform arrays of samplers, textures, or UBOs up into individual
scalars named (e.g) myarray[0], myarray[1], etc. These appear as
individual linkage objects.
Code notes:
- shouldFlatten internally calls shouldFlattenIO, and shouldFlattenUniform,
but is the only flattening query directly called.
- flattenVariable will handle structs or arrays (but not yet arrayed structs;
this is tested an an error is generated).
- There's some error checking around unhandled situations. E.g, flattening
uniform arrays with initializer lists is not implemented.
- This piggybacks on as much of the existing mechanism for struct flattening
as it can. E.g, it uses the same flattenMap, and the same
flattenAccess() method.
- handleAssign() has been generalized to cope with either structs or arrays.
- Extended test infrastructure to test flattening ability.
This PR adds the ability to offset sampler, texture, and UBO bindings
from provided base bindings, and to auto-number bindings that are not
provided with explicit register numbers. The mechanism works as
follows:
- Offsets may be given on the command line for all stages, or
individually for one or more single stages, in which case the
offset will be auto-selected according to the stage being
compiled. There is also an API to set them. The new command line
options are --shift-sampler-binding, --shift-texture-binding, and
--shift-UBO-binding.
- Uniforms which are not given explicit bindings in the source code
are auto-numbered if and only if they are in live code as
determined by the algorithm used to build the reflection
database, and the --auto-map-bindings option is given. This auto-numbering
avoids using any binding slots which were explicitly provided in
the code, whether or not that explicit use was live. E.g, "uniform
Texture1D foo : register(t3);" with --shift-texture-binding 10 will
reserve binding 13, whether or not foo is used in live code.
- Shorter synonyms for the command line options are available. See
the --help output.
The testing infrastructure is slightly extended to allow use of the
binding offset API, and two new tests spv.register.(no)autoassign.frag are
added for comparing the resulting SPIR-V.
Added -C option to request cascading errors. By default, will exit early,
to avoid all error-recovery-based crashes.
This works by simulating end-of-file in input on first error, so no
need for exception handling, or stack unwinding, or any complex error
checking/handling to get out of the stack.