Commit Graph

267 Commits

Author SHA1 Message Date
Johannes Kauffmann
a7603c132d Use nullptr where possible instead of NULL or 0 2022-11-30 09:33:28 -07:00
Greg Fischer
90c5214344 Improve ResourceLimits interface to be more forward compatible
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
2022-11-01 12:06:51 -06:00
Greg Fischer
284ceb6d45
Merge pull request #2985 from jeremy-lunarg/hayes-nonsemantic-shader-debuginfo-rebase
Implement NonSemantic.Shader.DebugInfo.100 debug instruction generation.

These instructions will be generated under the -gV and -gVS  command line options. These instructions enable source-level shader debugging with Renderdoc.

This is an alpha release of this capability. Additional improvements are forthcoming. Use and feedback are welcome.
2022-09-09 10:13:02 -06:00
Pankaj Mistry
228c67228a GL_EXT_mesh_shader/SPV_EXT_mesh_shader implementation
Added following updates to GL_EXT_mesh_shader implementation:

1. Added SPIRV and GLSL test cases
2. Added checks to ensure NV and EXT mesh shader builtins cannot be used interchangeably.
3. Updated the language name by removing the postfix "NV" to MeshShader and TaskShader.
4. Added checks for grammar checking to comply with the spec.

5. Added gl_NumWorkGroups builtin to Mesh shader
6. Fixed data type of gl_PrimitiveLineIndicesEXT and gl_PrimitiveTriangleIndicesEXT
7. Added new constants to the resources table
8. Updates to handle new storage qualifier "taskPayloadSharedEXT"
9. Updated test cases by replacing "taskEXT" with storage qualifier "taskPayloadSharedEXT"

Addressed  Review comments
1. Fixed instruction description used by glslang disassembly.
2. Updated OpEmitMeshTasksEXT as per spec update
3. Fixed implementation that errors out if there are more then one taskPayloadSharedEXT varjables.
4. Fixed miscellaneous error logs and removed unwanted code.

SPIRV 1.6 related build failure fixes
- Update SPIRV header to 1.6
- Fix conflict wiht SPIRV 1.6 change, where localSizeId is used for execution mode for mesh/task shaders

Enable SPIRV generated for EXT_mesh_shader to be version 1.4

GL_EXT_mesh_shader: Add checks for atomic support and corresponding test cases
2022-09-01 18:02:21 -07:00
Jeremy Hayes
7a914ce926 Implement NonSemantic.Shader.DebugInfo.100
See https://github.com/KhronosGroup/SPIRV-Registry.
2022-08-26 16:17:54 -06:00
Greg Fischer
f1d286fcc2
Merge pull request #2851 from chaoticbob/version-override
Added GLSL version override functionality and CLI
2022-03-24 17:51:54 -06:00
Alexey Panteleev
d44871ca08 Escape the characters that Make considers special in the dependency files. 2022-03-11 17:56:15 -08:00
Greg Fischer
ca0d54d51b Enhance readability of error messages for GLSL
Specifically, make GLSL link error messages more specific and output
only information relevant to the error.

Also change type printing to more closely reflect GLSL syntax. This
is the default for link error messages, but must me enabled with the
new option --enhanced-msgs for compilation error messages.

Also with --enhanced-msgs, only emit one error message per source
line.
2022-02-01 12:10:08 -07:00
Greg Fischer
9ebd8ff6c1 Add Vulkan 1.3 support
Also update known goods to Vulkan 1.3 support
Also re-enable SPIR-V 1.6 tests with vulkan1.3 target
Also re-cache SPIRV 1.6 header which somehow regressed back to 1.5
2022-01-26 17:57:31 -07:00
Hai Nguyen
1f10dddac4 Revisions to GLSL version override
- Reverted public function interface changes for C++.
- Added override member variable to TShader.
- Added accessor TShader::setOverrideVersion.
- Reverted changes to tests.
2022-01-01 19:02:14 -05:00
Hai Nguyen
9a98d32366 Added GLSL version override interface and CLI
This change list allows a user to override the GLSL version from the
command line or through the C and C++ interfaces. This will override the
override happens in ProcessDeferred() before DeduceVersionProfile() so
the process should still error out if the version is insufficient for
the shader code.

- Added --glsl-version <version> to CLI.
- Added parameter to route glslVersion as override version to
  preprocessor and parse functions to C++ interface.
- Updated C interface with function to override GLSL version.
2022-01-01 04:31:44 -05:00
Greg Fischer
7a49192d23 Add support for spirv1.6
Add command line support which enables the following behavior:

- Remap discard

  Map discard to DemoteToHelperInvocation for HLSL shaders. Map to
  OpTerminateInvocation for GLSL shaders.

- Decorate HelperInvocation with Volatile

- Use localSizeId for execution mode

  WorkGroupSize is deprecated in spirv1.6

Also update known goods to SPIRV 1.6
2021-12-16 15:01:42 -07:00
Greg Fischer
e9564feb55 Add --hlsl-dx-position-w option
This reciprocates the w component of SV_Position in HLSL fragment shaders
to provide DirectX compatibility for HLSL shaders in Vulkan.

Fixes #2244
2021-11-16 18:42:12 -07:00
amhagan
035a3bbc4a GL_EXT_spirv_intrinsics - Port extensions
Add mechanism to use GL_EXT_spirv_intrinsics headers in glslang.
Ported GL_EXT_shader_realtime_clock as an example.
2021-10-15 14:13:08 -04:00
Yun Hsiao Wu
ae4305da91 Fix per-set argument parsing in standalone 2021-07-26 16:21:12 +08:00
Robin Quint
4bf373e9a3 Improved usage hint 2021-04-27 16:06:06 +02:00
Robin Quint
e50b0a857c Added usage hint for --auto-sampled-textures, added test cases 2021-04-22 13:13:38 +02:00
Greg Fischer
7f46558b8c
Merge pull request #2616 from Rob2309/standalone-hlsl-sampled-textures
Exposed #856 as --hlsl-sampled-textures in the StandAlone
2021-04-21 18:17:42 -06:00
Greg Fischer
ebfca6099f Change --hlsl-sampled-textures to --auto-sampled-textures 2021-04-21 16:49:53 -06:00
Georg Lehmann
f050209ce1 Add a --depfile option.
The output is similar to gcc -MMD and can be used by build systems
like meson to automatically recompile shaders if an included header
was changed.
2021-04-20 18:09:56 +02:00
Robin Quint
219b7b9f72 Exposed #856 as --hlsl-sampled-textures in the StandAlone 2021-04-20 07:58:36 +02:00
greg-lunarg
4e064eef46
Revert "Revert "GL_ext_vulkan_glsl_relaxed extension support, and cross stage aware IO mapper"" 2021-03-15 11:26:11 -06:00
greg-lunarg
e063363878
Revert "GL_ext_vulkan_glsl_relaxed extension support, and cross stage aware IO mapper" 2021-03-10 11:26:43 -07:00
will brown
ecc9b9149f Implement GL_EXT_vulkan_glsl_relaxed option 2021-03-08 13:31:39 -05:00
Jeremy Hayes
b73afa8631 Prevent HLSL input under OpenGL semantics
Fix #2497.
2021-01-05 15:55:58 -07:00
johnkslang
2de6d657dd SPV: Standalone; sanity check the client GLSL input semantics option value. 2020-08-04 07:17:39 -06:00
Ben Clayton
fbe9a23baf Generate build information from CHANGES.md
This PR significantly reworks the way glslang is versioned.

Instead of committing changes to the `GLSLANG_MINOR_VERSION` define in
`glslang/Public/ShaderLang.h`, and using `make-revision` to generate
`GLSLANG_PATCH_LEVEL` in `glslang/Include/revision.h`, all version
information is now derived from the new `CHANGES.md` file.

`CHANGES.md` acts as the single source of truth for glslang version
information, along with a convenient place to put all release notes for
each notable change made.

`CHANGES.md` is parsed using the new `build_info.py` python script.
This script can read basic template files to produce new source files,
which it does to read the new `build_info.h.tmpl` to generate (at build
time) a glslang private header at
`<build-dir>/include/glslang/build_info.h`.
I've written generators for each of the CMake, Bazel, gn, and
`Android.mk` build scripts.

The new version code conforms to the Semantic Versioning 2.0 spec.

This new version is also used by the CMake rules to produce versioned
shared objects, including a major-versioned SONAME.

New APIs:
---------

* `glslang::GetVersion()` returns a `Version` struct with the version
  major, minor, patch and flavor.

Breaking API changes:
---------------------

* The public defines `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL`
  have been entirely removed.
* `glslang/Public/ShaderLang.h` and `glslang/Include/revision.h` have
  been deleted.
* Instead, `<build-dir>/include/glslang/build_info.h` is created in
  the build directory, and `<build-dir>/include` is a CMake `PUBLIC`
  (dependee-inherited) include directory for the glslang targets.
* `<build-dir>/include/glslang/build_info.h` contains the following
   new #defines:
   `GLSLANG_VERSION_MAJOR`, `GLSLANG_VERSION_MINOR`,
   `GLSLANG_VERSION_PATCH`, `GLSLANG_VERSION_FLAVOR`,
   `GLSLANG_VERSION_GREATER_THAN(major, minor, patch)`,
   `GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch)`,
   `GLSLANG_VERSION_LESS_THAN(major, minor, patch)`,
   `GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch)`
*  The CMake install output directory contains a copy of
   `build_info.h` at: `include/glslang/build_info.h`
*  Python3 is now always required to build glslang (likely always
   required for transitive dependency builds).
2020-07-09 12:34:02 +01:00
Marcin Ślusarz
245c30c296 Add --quiet option.
Being quiet should have been the default, but I guess it's too late
now to change it.
2020-07-06 10:55:40 +02:00
Ben Clayton
d64e859987 glslang: Only export public interface for SOs
Default to `-fvisibility=hidden`, and annotate the public glslang interface with `GLSLANG_EXPORT` to change the visibility of these cherry-picked symbols to default.
This is also used by Windows builds for `__declspec(dllexport)`-ing the public DLL interface.

This allows us to classify API changes into those that are publicly backwards compatible, and those that are not.

Note that `libSPIRV` will likely need similar treatment.

Issues: #2283, #1484
2020-06-30 17:06:17 +01:00
Shahbaz Youssefi
d52dce5067
Add -g0 command line argument
Analogous to gcc, -g0 would strip all debug info.  This is done
regardless of whether optimizations are enabled.

Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
2020-06-18 10:16:40 -04:00
Chow
8111268575
Add Shared/Std140 SSBO process & top-level array elements related (#2231)
* Add Shared/Std140 SSBO process & top-level array elements related
process

1.Add process options for shared/std140 ssbo, following ubo process
2.Add IO Variables reflection option, would keep all input/output
variables in reflection
3.Add Top-level related process, fix top-level array size issues,
following spec
4.Split ssbo/ubo reflection options, merge blowup expanding all into
function blowupActiveAggregate to allow other functions keep same entry
format.

Add options in StandAlone and test symbols.

1. Add options in StandAlone for std140/shared ubo/ssbo and all io variables reflection.
2. Add test for ssbo. When EShReflectionSharedStd140SSBO turns on, generated symbol and output would be different, to remind the difference. Defaultly disabled and nothing would change, nor blocking normal test.

* Add options in runtest script, refresh test results.

Add options in StandAlone:
--reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo

refresh test results.
Now the index, size of unsized array are expected.
2020-06-04 01:47:18 -06:00
rdb
b56e0e441b
HLSL: Recognize POSITION semantic et al in DX9 compatibility mode (#2255) 2020-06-02 00:30:50 -06:00
John Kessenich
344bd0889a
Merge pull request #2162 from ntfshard/small_fix
Humble fix
2020-03-30 00:33:09 -06:00
John Kessenich
83855b97db Fix #2163: improve comments for addProcess() and the preamble. 2020-03-30 00:27:31 -06:00
ntfs.hard
988cd6769c unused var 2020-03-30 01:38:21 +03:00
Daniel Koch
db32b243ff Add support for GLSL_EXT_ray_tracing
and SPV_KHR_ray_tracing
2020-03-17 20:42:47 -04:00
John Kessenich
56364b6b60 Copyright update, mostly to trigger bots again. 2020-03-01 04:51:40 -07:00
Jordan Justen
6ad120eaeb
standalone: Fix --help
Fixes: bd97b6f9 ("Command-line: Give better error messages. From #1829.")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2020-01-28 14:08:12 -08:00
John Kessenich
273d3a5093 SPV/Vulkan: Add support for Vulkan 1.2, which defaults to SPIR-V 1.5. 2020-01-15 00:10:41 -07:00
John Kessenich
6f98892dd1 Fix #1829: Add "--" command-line options for macro def/undef.
This allows OpModuleProcessed logging to be consistent with everything taking
"--" options.
2020-01-08 01:28:45 -07:00
John Kessenich
bd97b6f9f2 Command-line: Give better error messages. From #1829. 2019-12-20 10:33:13 -07:00
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
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
John Kessenich
e5c394bcba Standalone: Fix #1814: Check that linkage was specified for reflection. 2019-07-02 09:47:42 -06:00