Commit Graph

372 Commits

Author SHA1 Message Date
David Neto
8c3d5b4b6c SPIR-V: Aggressively prune unreachable merge, continue target
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.
2019-10-29 15:33:54 -04:00
David Dubois
f57feff786 Fix the exports of glslang-default-resource-limits (#1942) 2019-10-21 22:31:44 -06:00
John Kessenich
b03e4fc4e0
Merge pull request #1866 from rumblehhh/master
Export glslang targets on installation
2019-10-15 04:25:20 -06:00
John Kessenich
8317e6c683 SPV: Support SPIR-V 1.5; five extensions no longer need OpExtension.
The generalization to addIncorporatedExtension() also fixed a 1.3
corner case with SPV_KHR_16bit_storage.
2019-09-16 07:14:10 -06:00
John Kessenich
deec1933e9 Web: Turn off includes, independent preprocessing path, fine tune all.
Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.
2019-08-20 23:21:56 -06:00
John Kessenich
155d351f86 Web: Remove unused stage functionality, SPIR-V logger, and hex_utils
Saves another 20K.
2019-08-20 23:21:56 -06:00
John Kessenich
b6d3ee5aca Web: Turn off bracket-style attributes, reflection, and IO mapping. 2019-08-20 23:21:55 -06:00
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
23d27751e8 Web: Selectively remove a few key features, using #ifndef GLSLANG_WEB
Save about 100K.

N.B.: This is done by eliminating a function call, at a high level,
not by #ifdef'ing a bunch of code.

Also, removed no longer needed *_EXTENSION #ifdef in the code not
needed by GLSLANG_WEB.
2019-08-20 23:21:55 -06:00
John Kessenich
d4ed5158d1 Web: Remove a few additional HLSL constructs with ENABLE_HLSL.
Saves about 3K.
2019-08-20 23:21:55 -06:00
James Rumble
c6f7294ced
Handle install vs build include directories
Fix target_include_directories to appropriately handle build-tree and the install-tree.
2019-08-06 15:29:31 +01:00
James Rumble
ab6d1499e1
Export glslang targets on installation
This allows the targets to be used in other cmake projects. See the following for more details:
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages
https://foonathan.net/blog/2016/07/07/cmake-dependency-handling.html
2019-08-06 14:47:51 +01:00
John Kessenich
e5c394bcba Standalone: Fix #1814: Check that linkage was specified for reflection. 2019-07-02 09:47:42 -06:00
Shahbaz Youssefi
f4edb8f820 Remove __DATE__ and __TIME__ usage
These macros result in a non-deterministic build.  In chromium, these
macros are specifically set to empty, resulting in a compile error.
2019-06-25 13:20:42 -04:00
John Kessenich
605afc7b1b SPV: Add a switch for favoring non-NaN operands in min, max, and clamp. 2019-06-17 23:33:09 -06:00
Christoph Kubisch
412ff6ea6a minor naming cleanup 2019-04-13 22:57:33 +02:00
Christoph Kubisch
55ba3eaf89 introduce new --dump-builtin-symbols command line
add corresponding EShMsgBuiltinSymbolTable
TSymbol::dump functions have option to do "complete" print
bugfix in TType::getCompleteString, structure can be null for block
2019-04-13 22:18:16 +02:00
baldurk
1905069857 Add option to unwrap I/O block aggregates in reflection
* We follow similar rules to uniform block exploding.
2019-02-11 11:53:52 +00:00
baldurk
4513df9175 Reflow for better readability 2019-02-08 10:48:48 +00:00
baldurk
a972e73ad7 Add option to reflect all block members, inactive or active.
* The stages mask is more fine-grained, and each variable or block's mask
  indicates which stages it's active in.
2019-02-04 12:02:59 +00:00
baldurk
657acc0c40 Add option to reflect buffer blocks & variables separately to uniforms
* Also note the uniform indices of atomic counter buffers
2019-02-04 12:02:59 +00:00
baldurk
0af5e3e346 Reflect pipeline outputs as well as inputs, optionally from other stages
* We add an option to reflect inputs from other stages than vertex, if only a
  later subset of the stages is linked into the program.
2019-02-04 12:02:59 +00:00
baldurk
edf8212ab8 Add an option to report array variables with trailing [0] suffix
* This is as expected by ARB_program_interface_query
2019-02-04 11:21:09 +00:00
baldurk
15c37f79a9 Include array index in reflected uniform names more consistently
* This comes from the resolution of issues 4, 5 & 6 in
  ARB_program_interface_query, stating that uniform buffers should have their
  members expanded out as normal and arrays should have elements added.
* If a buffer block has a large array e.g. [10000] we don't want to iterate over
  every array element. Instead we should only expand out the first [0] element,
  then expand as normal from there.
* The array name should still be appended with [0] to indicate that it's an
  array.
2019-02-04 11:21:09 +00:00
baldurk
6d47785825 Add options to control how reflection information is built 2019-02-04 11:21:09 +00:00
BinaryRK
0d5c86644a Switch to relative include path for ResourceLimits 2019-02-02 16:18:49 +02: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
John Kessenich
8717a5d39a SPV/Standalone: Support specifying arbitrary versions of SPIR-V. 2018-10-26 10:16:47 -06:00
John Kessenich
086febc448 PP: Fix #155: Don't give error on HLSL PP-only parsing. 2018-10-25 12:43:02 -06:00
John Kessenich
c374030e80
Merge pull request #1523 from sparmarNV/fix-SPV_NV_mesh_shader
Allow redeclaration of builtin interface blocks in mesh shader
2018-10-04 23:46:21 -06:00
Sahil Parmar
035cbbe3d0 Allow redeclaration of builtin interface blocks in mesh shader
Apart from allowing redeclaration of gl_MeshPerVertexNV and gl_MeshPerPrimitiveNV blocks, this change also -
- Resize clip/cull perview distances based on static index use
- Error out use of both single-view and per-view builtins
- Add new gtests with redeclared blocks and edit existing test output
- Fix couple of typos
2018-10-04 16:39:18 -07:00
Neil Roberts
b0f3d794c8 Add an option to set the base uniform location
This will be used to generate uniform locations with --aml
2018-10-02 12:15:22 +02:00
Neil Roberts
16f53474c8 Add a command-line option to override uniform locations 2018-10-02 12:15:22 +02:00
John Kessenich
5ff3c3da3b Interfaces: Remove NV_EXTENSIONS from two more headers.
This also fixes some cpp files that uncover issues when building
with the flags turned off.
2018-09-26 09:38:20 -06:00
Chao Chen
b50c02ef53 Add-support-for-SPV_NVX_raytracing 2018-09-19 13:07:43 -07:00
Chao Chen
3c3669904c Add-support-for-SPV_NV_mesh_shader 2018-09-19 13:07:43 -07:00
John Kessenich
97068d8b30
Merge pull request #1465 from otakuto/remove-execute-permissions
Remove execute permissions
2018-08-31 08:14:47 -07:00
John Kessenich
c340425bb2 SPV: Add option for controling when the SPIRV-Tools validator is used. 2018-08-23 15:29:08 -06:00
John Kessenich
717c80a9de SPV: Isolate SPIRV-tools glue to its own file. 2018-08-23 15:17:10 -06:00
John Kessenich
251901ac8a Fix #1471: Merge shift amounts for different sets: --stb ... --std ... 2018-08-12 22:08:53 -06:00
John Kessenich
ade8bbbf5f Fix #1393: rationalize usage, in the spirit of #1393.
Order is kept about the same.
2018-08-12 21:24:55 -06:00
John Kessenich
640bd0964f Fix #1468: Add command-line --entry-point support, same as existing -e. 2018-08-09 14:15:00 -06:00
otakuto
d03da06ac1 Remove execute permissions 2018-08-07 03:16:20 +09:00
John Kessenich
e7f9caeac4 Errors and Build: Fix build warnings, which also improved error messages. 2018-07-12 15:11:07 -06:00
John Kessenich
e2156222d3 SPV: Add option to print disassembly in standard form using SPIRV-Tools. 2018-07-02 15:54:12 -06:00
Matthew Albrecht
1199cf92f7 Fixed install for SPIRV, glslang, and hlsl when building shared libs 2018-04-26 14:07:46 -05:00
John Kessenich
3beac945ff Infrastructure: If using .hlsl suffix, default is -D. 2018-04-17 21:02:19 -06:00
John Kessenich
2ead40ffa8 Tests: Add usage and tests for previous commit. 2018-04-17 17:44:11 -06:00
John Kessenich
fccbb8b40a Merge branch 'nicebyte-glsl-ext' 2018-04-17 17:30:20 -06:00
Grigory Dzhavadyan
33ddaaafc1 Make FindLanguage use the entire name if parseStageName is false 2018-04-12 20:31:27 -07:00
Grigory Dzhavadyan
ef203bfa38 Fix build error 2018-04-12 19:29:26 -07:00
Grigory Dzhavadyan
3350741e24 Make glslang validator support files ending in .glsl
This patch makes  the validator accept *.<stage name>.[g/h]lsl pattern
for file names.

This patch preserves previous behavior (i.e. *.vert/*.frag/etc. in file
names still work).
2018-04-12 14:35:24 -07:00
John Kessenich
7f0bcfd8d8 Fix #1333: Protect against -g for non-generating code. 2018-04-05 19:00:01 -06:00
GregF
fb03a55e0f Only print legalization warning if optimizer disabled 2018-03-29 13:17:54 -06:00
John Kessenich
7cec64fc42 Non functional: add EshTargetClientVersion alias for EShTargetClientVersion.
Fixes #1304.
2018-03-22 23:54:04 -06:00
John Kessenich
5d610ee1dc Implement SPV_GOOGLE_hlsl_functionality1.
Enabled via -fhlsl_functionality1
2018-03-16 20:21:44 -06:00
John Kessenich
fb97d25c98 Merge branch 'feature' of https://github.com/amdrexu/glslang into amdrexu-feature 2018-03-07 14:29:45 -07:00
Rex Xu
cb61eec948 HLSL: Map min types to GLSL 16-bit types 2018-03-07 13:10:01 +08:00
John Kessenich
66011cb2c2 SPV: Implement Vulkan 1.1 features and extensions. 2018-03-06 16:12:04 -07:00
John Kessenich
c6c80a6e48 Versioning: Address #1255: Move to semantic versioning.
Still missing is automation and final decisions on mechanisms in general.
2018-03-05 22:23:17 -07:00
David Neto
506d2c241d Fix typo in help for -V<bad-number> 2018-02-27 21:55:23 -05:00
John Kessenich
2b5ea9f851 SPV Version: Emit the requested SPIR-V version, not the header version.
Fixes #1236.
2018-01-31 18:41:59 -07:00
John Kessenich
22f02d09cc EShTargetSpv: Fix #1235, spelling, in a backward compatible way. 2018-01-31 17:53:24 -07:00
LoopDawg
b22c069f7a HLSL: add optional position.Y inversion
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
2017-12-07 10:48:14 -07:00
John Kessenich
e2c15b4f6e Memory: Reference count number of clients, to support multiple independent clients in same process.
Addresses 2nd item in #976.
2017-11-16 23:02:14 -07:00
John Kessenich
b63f4a3808 Usage: clarify meaning of -s; fixes #1135. 2017-11-16 22:32:20 -07:00
John Kessenich
94f28eb61a Memory: Add loop around main, to test tear-down and reuse, and monitor memory changes. 2017-11-13 01:52:26 -07:00
LoopDawg
e570955cdc Reverse order of setShiftBindingForSet parameters
Per feedback on PR #1111, this reverses the order of the parameters for the setShiftBinding API.

It is now:

    void TShader::setShiftBindingForSet(TResourceType res, unsigned int base, unsigned int set);
2017-11-09 09:51:15 -07:00
John Kessenich
af52799c2d Errors: Have a whole set of tool-level error messages report to stderr. 2017-11-02 22:48:15 -06:00
John Kessenich
a372a3ed1e Versioning: Update some version strings. Still need better overall version. 2017-11-02 22:34:43 -06:00
LoopDawg
08a14422c1 Add per-descriptor-set IO mapping shift values.
This PR adds the ability to provide per-descriptor-set IO mapping shift
values.  If a particular binding does not land into a per-set value,
then it falls back to the prior behavior (global shifts per resource class).

Because there were already 6 copies of many different methods and internal
variables and functions, and this PR would have added 6 more, a new API is
introduced to cut down on replication and present a cleaner interface.
For the global (non-set-specific) API, the old entry points still exist
for backward compatibility, but are phrased internally in terms of the
following.

    // Resource type for IO resolver
    enum TResourceType {
        EResSampler,
        EResTexture,
        EResImage,
        EResUbo,
        EResSsbo,
        EResUav,
        EResCount
    };

Methods on TShader:

    void setShiftBinding(TResourceType res, unsigned int base);
    void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);

The first method replaces the 6 prior entry points of various spellings, which
exist now in depreciated form.  The second provides per-resource-set functionality.
Both accept an enum from the list above.

From the command line, the existing options can accept either a single shift value as
before, or a series of 1 or more [set offset] pairs.  Both can be provided, as in:

    ... --stb 20 --stb 2 25 3 30 ...

which will use the offset 20 for anything except descriptor set 2 (which uses 25) and
3 (which uses 30).
2017-10-19 11:50:30 -06:00
John Kessenich
3693e631f5 Fix #1060: Could crash if using --source-entry-point with -e; fixed. 2017-09-29 17:51:52 -06:00
GregF
52fe3d598c Legalization: Fix warnings and disable tests when spirv-tools not present 2017-09-28 10:13:23 -06:00
GregF
cd1f169c6a Enable HLSL legalization
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.
2017-09-27 15:06:05 -06:00
John Kessenich
b3ca4045c5 Build: Fix build warnings. 2017-09-11 20:39:54 -06:00
John Kessenich
a25530cc18 Non-functional: Make usage for entry points more consistent. 2017-09-11 20:13:49 -06:00
Sven-Hendrik Haase
0dd1285cb6 Add --stdin 2017-09-07 20:35:40 +02:00
John Kessenich
2a27116cae SPV reflection: Add OpModuleProcessed for compile options. 2017-08-25 11:48:02 -06:00
LoopDawg
52017192e5 Fix crash with --resource-set-binding [n] (common set form, not per-register form)
--resource-set-binding has a mode which allows per-register assignments of
bindings and descriptor sets on the command line, and another accepting a
single descriptor set value to assign to all variables.

The former worked, but the latter would crash when assigning the values.
This fixes it, and makes the former case a bit more robust against premature
termination of the pre-register values, which must come in (regname,set,binding)
triples.

This also allows the form "--resource-set-binding stage setnum", which was
mentioned in the usage message, but did not parse.

The operation of the per-register form of this option is unchanged.
2017-07-18 11:15:40 -06:00
LoopDawg
b97b25e40b Fix StandAlone.cpp compilation warnings
find_first_of returns size_t, was overflowing int.
2017-07-12 09:05:05 -06:00
John Kessenich
17b5f9175d Merge pull request #969 from d3x0r/patch-1
Add option to skip installation
2017-07-04 11:00:42 -06:00
Rohith Chandran
6206091e63 Fix CMake scripts: The set_property script can be used to set only a single property, so now setting the POSITION_INDEPENDENT_CODE property correctly. 2017-07-04 10:53:45 -04:00
d3x0r
4593312490 Update CMakeLists.txt 2017-07-04 06:01:09 -07:00
John Kessenich
6353d55e94 Command-line: Add support for setting language's environment. 2017-06-26 14:49:11 -06:00
John Kessenich
c178f0a4d9 Infrastructure: Non-functional: rationalize some command-line processing. 2017-06-26 14:49:11 -06:00
John Kessenich
4be4aebdcd Infrastructure: Non-functional: Move to rich description of environment.
This is for input languages, client APIs, code to generate, etc.
2017-06-26 14:49:11 -06:00
John Kessenich
a931366f56 Standalone: Implement -D and -U for preprocessor macros.
Works for both GLSL and HLSL.
Fixes #87.
2017-06-15 10:57:18 -06:00
John Kessenich
04acb1b7c9 Standalone: Rationalize ShaderCompUnit and file data.
ShaderCompUnit was poorly done, a mix of a list of things and hard
coding to a single thing. This makes it all a true list.

File data was greatly simplified to be a single string, no longer
supporting breaking a single file into multiple strings.
2017-06-14 17:36:50 -06:00
John Kessenich
6263fb19fb Infrastructure: Rationalize command-line options.
Makes alphabetical order, fit in 80 columns, abstract in-option
string argument.
2017-06-14 15:52:44 -06:00
John Kessenich
971a0a8d2d Infrastructure: add include search paths (-I, etc.). 2017-06-07 15:09:54 -06:00
John Kessenich
3494b4da9b HLSL: Add an Includer to handle #include. 2017-06-01 11:16:32 -06:00
John Kessenich
121853f4df SPV: Add OpSource shader source code and file name. 2017-05-31 17:14:15 -06:00
John Kessenich
71facdf435 SPV: Give error on not assigning locations to I/O.
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.
2017-05-18 15:07:05 -06:00
John Kessenich
d9b08d5c3d Merge pull request #880 from aras-p/master
Fix for lumped/unity/batch builds
2017-05-10 11:11:44 -06:00
Aras Pranckevicius
8e204b2d67 [lumped builds] Only define _CRT_SECURE_NO_WARNINGS if it’s not defined yet.
When glslang is built with some other build system and lumped/unity builds are used,
without the checks this would get “macro is being redefined” warnings/errors.
2017-05-10 16:52:50 +03:00
Hyangran Park
36dc82908f HLSL: Manually configure descriptor set and binding number for resources 2017-05-10 16:50:18 +09:00
David Seifert
22afc38b55 Modernise CMake #2
This reverts commit cfc69d95af.
* Change CMAKE_INSTALL_PREFIX default on Windows in order
  to prevent permission denied errors when trying to install
  to "Program Files".
2017-04-29 11:23:15 +02:00
John Kessenich
cfc69d95af Revert "Modernise CMake" 2017-04-28 22:04:24 -06:00
David Seifert
5a5699bdbd Modernise CMake
* Use `GNUInstallDirs` in order to respect GNU conventions.
  This is especially important for multi-arch/multi-lib setups.
* Specify position independent mode building properly, without
  using the historic hack of adding `-fPIC` as a definition.
  This makes the build system more portable.
* Only detect C++ (and not C) to slightly speed up configuring.
* Specify C++11 mode using modern CMake idioms.
* Fix some whitespace issues.
2017-04-28 22:46:52 +02:00
steve-lunarg
be28355019 WIP: HLSL: hlsl register class iomapping
Adds --hlsl-iomap option to perform IO mapping in HLSL register space.

--shift-cbuffer-binding is now a synonym for --shift-ubo-binding.

The idea way to do this seems to be passing in a dedicated IO resolver, but
that would require more intrusive restructuring, so maybe best for its
own PR.

The TDefaultHlslIoResolver class and the former TDefaultIoResolver class
share quite a bit of mechanism in a common base class.

TODO: tbuffers are landing in the wrong register class, which needs some
investigation.  They're either wrong upstream, or the detection in the
resolver is wrong.
2017-04-20 12:41:39 -06:00
John Kessenich
4f1403ed1b SPV: Fix #807: use --hlsl-offsets to allow hlsl-style offsets in a buffer.
Corresponds to the EShMsgHlslOffsets flag in messages.
Works for both GLSL and HLSL.
2017-04-05 17:38:20 -06:00
Juan Lopez
a558b26537 This refactor the StandAlone and WorkList files in order to use more
C++11 features remove the dependencies from OS specific code. Changes:

- Making WorkList class to have its own mutex instead of the OS specific
global one. The new mutex is the one from std library. The OS specific
code is also removed.

- Using the C++11 std library to handle threads in StandAlone
application
and enabling concurrent processing on non-windows platforms.

- converting the global variable Worklist into local variable workList.
2017-04-04 22:29:59 +02:00
John Kessenich
e751bca75c Fix #777: don't parse .suffix if <stage> is provided.
Adding a test for this also uncovered an extraneous \r in the runtests script,
fixed now.
2017-03-16 11:30:20 -06:00
steve-lunarg
932bb5cc4e Add reflection queries for thread local size and ssbo auto-binding
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.
2017-02-22 09:40:28 -07:00
John Kessenich
8f674e821e Fix issue #676: emit error message on failure to open spv file. 2017-02-18 09:45:40 -07:00
Flavio
15017db971 Removed tabs and replaced with spaces. Changed layout for "else if" 2017-02-15 14:29:33 -08:00
Flavio
aea3c890d3 Added --vn option to generate a C header file containing a variable assigned to the hex representation of the shader. This is a standard feature on Microsoft's HLSL compiler and it allows developers to include pre-compiled shaders directly into the code. This option enables "Hex output", so it is NOT required to specify -x as well. The output file name is preserved, so no ".h" extension is added. If you want the output file to have ".h" extension then you have to specify it on the output file name. The generated header file uses the "#pragma once" pragma to avoid multiple inclusions. 2017-02-06 11:46:35 -08:00
Michael Maltese
6077a19ba3 CMake: add target_link_libraries internally
Makes it easier to include glslang in a larger CMake project---instead
of having to call `target_link_libraries(glslang OSDependent OGLCompiler
HLSL)`, for example, you only need to call
`target_link_libraries(glslang)` and it will pull in the helpers it
needs.

This is also better in terms of cleaning up the "public interface",
of sorts, for building glslang: end-users probably shouldn't need to
know or be explicitly dependent on internal targets.
2017-01-21 10:59:15 -08:00
John Kessenich
dc1a8196cf Infrastructure: Support standard build with ENABLE_HLSL set to off. 2017-01-11 14:50:16 -07:00
John Kessenich
ce80197c22 Merge pull request #663 from KhronosGroup/full-include-semantics
Includer interface change to support full include semantics (requires downstream changes)
2017-01-10 18:49:07 -07:00
Alex Szpakowski
ff21a25bc8 Change disabled-by-default DISABLE_HLSL option to enabled-by-default ENABLE_HLSL.
Matches existing options.
2017-01-09 18:10:14 -04:00
Alex Szpakowski
84eabf7ea7 Add a CMake option to disable compilation of HLSL input support. 2017-01-08 21:20:25 -04:00
John Kessenich
facde2c804 PP #include: address PR feedback. 2017-01-06 16:48:18 -07:00
John Kessenich
63204c2501 External interface change: PP: Full <> and "" semantics for the Includer.
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
2017-01-06 15:08:54 -07:00
John Kessenich
927608b393 Non-functional: White space after "//", mostly for copyrights. 2017-01-06 12:34:14 -07:00
John Kessenich
ecba76fe73 Non-Functional: Whitespace, comments, replace accidentally deleted comment.
- fixed ParseHelper.cpp newlines (crlf -> lf)
- removed trailing white space in most source files
- fix some spelling issues
- extra blank lines
- tabs to spaces
- replace #include comment about no location
2017-01-06 11:24:14 -07:00
John Kessenich
20f01e7fd0 Fix last commit; EOptionKeepUncalled incorrect enum bug. 2016-12-12 11:41:43 -07:00
John Kessenich
906cc21816 Linker: Eliminate uncalled functions, because they can be ill-defined.
Fixes issue #610. Also provides a testing option to keep uncalled functions.
2016-12-09 19:22:20 -07:00
steve-lunarg
f1e0c87127 allow renaming of shader entry point when creating SPIR-V
Use "--source-entrypoint name" on the command line, or the
TShader::setSourceEntryPoint(char*) API.

When the name given to the above interfaces is detected in the
shader source, it will be renamed to the entry point name supplied
to the -e option or the TShader::setEntryPoint() method.
2016-12-01 08:51:43 -07:00
steve-lunarg
9088be4c07 Add UAV (image) binding offset and HLSL register support
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.
2016-11-01 14:44:54 -06:00
David Neto
e301f67828 Use std::atoi instead of std::stoi
Some Android cross cross-compilers don't have std::stoi.

E.g. i686-linux-android-g++ from Android NDK r10e don't have std::stoi.
2016-10-31 17:02:45 -04:00
steve-lunarg
4e3dd2087c WIP: avoid strtok 2016-10-21 14:51:43 -06:00
John Kessenich
1fabc0f697 Merge pull request #548 from baldurk/vs2010-compile-fixes
VS2010 compile fixes
2016-10-15 23:09:31 -06:00
steve-lunarg
cce8d48bcc HLSL: phase 3c: add option to use Unknown storage format
This uses the Unknown storage format, instead of deducing the
format from the texture declaration type.
2016-10-14 18:50:37 -06:00
baldurk
31d5d48812 Change constructor to use ()s instead of {}s 2016-10-13 19:25:52 +02:00
steve-lunarg
9ae34742cf Check for out-of-range bindings during IO mapping. 2016-10-05 13:42:42 -06:00
steve-lunarg
bc9b7656b7 Restrict uniform array flattening to sampler and texture arrays.
Previously the uniform array flattening feature would trigger on loose
uniform arrays of any basic type (e.g, floats).  This PR restricts it
to sampler and texture arrays.  Other arrays would end up in their own
uniform block (anonymous or otherwise).  (Atomic counter arrays might be an
exception, but those are not currently flattened).
2016-09-29 14:01:25 -06:00
steve-lunarg
e0b9debda2 Flatten uniform arrays
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.
2016-09-22 08:47:48 -06:00
steve-lunarg
7f7c2ed780 HLSL: Add location offsets per resource type
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.
2016-09-20 20:31:27 -06:00
Lei Zhang
424cf80f8b Disable C4996 (secure CRT) recommendation on Windows for strtok().
strtok_s() is suggested by MSVC, but it has different signature
than the C11 standard one. So we just turn off the recommendation
here.
2016-08-26 14:43:14 -04:00
steve-lunarg
a8456415b8 WIP: SPV Remapper: add remapper test framework 2016-08-25 10:46:51 -06:00
John Kessenich
219b025d7e Non-functional: Fix commit 98f164ec48.
Fix previous commit to not use tabs and otherwise match local coding
conventions better.
2016-08-23 17:51:13 -06:00
dankbaker
afe6e9c4fc HLSL and standalone, modifying Standalone to send filename as string source, and HLSL backend will use this to print a better error mesage when things fail 2016-08-21 12:29:08 -04:00
John Kessenich
28660bb580 Merge pull request #450 from dankbaker/standalone_change
Allowing explicit specification of shader compiltion type via -T opti…
2016-08-11 16:37:52 -06:00
Dan Baker
5afdd78131 Standalong: Changing -T to -S since it's a stage now instead of a target 2016-08-11 17:53:57 -04:00
Dan Baker
895275e357 Standalone: Changing some comments and user strings 2016-08-11 14:55:49 -04:00
Dan Baker
c6ede8938a Changing target to stage 2016-08-11 14:06:06 -04:00
dankbaker
45d49bcd51 Allowing explicit specification of shader compiltion type via -T option, rather then looking at file extension. For HLSL files, this is nice because .hlsl extension is natively udnerstood by visual studio, likely to be used with the -e option. 2016-08-08 22:24:29 -04:00
John Kessenich
66ec80e01b Build: C++ headers: Replace PR #366 with a more directed version. 2016-08-05 14:04:23 -06:00
John Kessenich
b84313dca1 Versions: Update version output.
Also, the per-build part had stopped auto-updating,
which is fixed locally as a git hook.
2016-07-20 16:03:29 -06:00
John Kessenich
a86836ede2 Front-end: Fix known crashes by early exit on error (issue #29, issue #34, issue #35).
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.
2016-07-09 14:53:11 -06:00
John Kessenich
7f349c73db Build: Remove causes of pedantic warnings. Addresses issue #352 and PR #242. 2016-07-08 22:09:10 -06:00
John Kessenich
c45dddae5f Merge pull request #314 from mre4ce/master
Added -x option to save SPIR-V as 32-bit hexadecimal numbers to a text file.
2016-07-08 15:26:27 -06:00
John Kessenich
91e4aa5900 SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.
Includes adding test cases to verify the differences.
2016-07-07 19:27:15 -06:00
David Neto
b37dc0e458 For MinGW, statically link exes against basic runtimes
Avoids the need to ship basic runtimes like libgcc_s_sjlj-1.dll
with the executables.
2016-06-02 14:37:24 -04:00
Johannes van Waveren
1fd017546a turn -x into an option next to -o 2016-05-31 08:39:41 -05:00
Johannes van Waveren
ecb0f3b75b Added -x option to save SPIR-V as 32-bit hexadecimal numbers to a text file. 2016-05-27 12:55:53 -05:00
David Neto
2ed1d9bba0 atoi comes from stddef.h or cstddef
This is required to fix the Android build for ARM.
2016-05-20 16:06:49 -04:00
Lei Zhang
1b141728a6 Test compiling shaders with given resource limits using GTest. 2016-05-19 14:18:21 -04:00