Commit Graph

4731 Commits

Author SHA1 Message Date
Juan Ramos
e7c558ba38 cmake: Fix Android build for r25 NDK
Currently with the build instructions provided in README.md
the build will fail.

In the r25 NDK the CMake toolchain defaults to the legacy path,
due to a bug in the current implementation.

https://github.com/android/ndk/issues/323
2023-12-11 20:03:16 +00:00
Pedro Olsen Ferreira
02aa2b282b Fix maybe-uninitialized warning
The 'set' and 'setRT' variables were warning as maybe-uninitialized even
though in practice that case would never trigger (due to how the
function flow-controls).
The code blocks where these variables are actually read do not overlap,
so merge them into the same 'set' variable.
Simplify the control flow of the function with early-returns, which
drops indentation and simplifies the function.
2023-12-11 20:03:16 +00:00
Dawid-Lorenz-Mobica
a94c5ff864 HLSL: support binary literals
Fixes #3089
2023-12-11 20:03:16 +00:00
Zeqiang Li
1804b08805 Add missing initialization members for web (#3246) 2023-12-11 20:03:16 +00:00
Malcolm Bechard
b8227c215e Rework how auto push_constant upgrading works a bit.
Ensure we traverse the entire tree and upgrade all references to the
given symbol so it can be upgraded to push_constant. Without this change
only one instance was upgraded, and others were left as uniform buffers.
2023-12-11 20:03:16 +00:00
Nathaniel Cesario
2f4a667120 build: Remove bazel build support 2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
f83eeaebf5 Use std::call_once in spv::Parameterize()
There was a race condition in this function as it used a static variable
to attempt to ensure global initialization was only done once, which was
not thread-safe. Instead, use std::call_once, which was added to C++11
for this exact case.

Fixes #342
2023-12-11 20:03:16 +00:00
Joyce
6f0b445f90 Create a Security Policy (#3169)
* Create SECURITY.md

Signed-off-by: Joyce <joycebrum@google.com>
2023-12-11 20:03:16 +00:00
Dawid Lorenz
56b1090f33 Add support for pre and post HLSL qualifier validation
The change makes it possible to define a const variable after the marked
type. Example "float const"
2023-12-11 20:03:16 +00:00
Dawid Lorenz
10da9c9550 Add support for pre and post HLSL qualifier validation
The change makes it possible to define a const variable after the marked
type. Example "float const"
2023-12-11 20:03:16 +00:00
Rex Xu
4218bbe746 Spirv_intrinsics: Add support of type specifier to spirv_type
Previously, spirv_type doesn't accept type specifier as its parameter.
With this change, we can input non-array type specifier. This is because
some SPIR-V type definition intructions often need to reference other
SPIR-V types as its source operands. We add the support to facilitate
such usage.
2023-12-11 20:03:16 +00:00
Nathaniel Cesario
e0151ab8c7 Fix C example in README
Remove the usage of C++ STL types in the C-only interface example.

Fixes #3239.
2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
d88a85c288 Add an assert that ID operands are non-zero
Zero is not a valid ID value and the SPIR-V emitter library should never
be emitting instructions with ID values of 0.
2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
26751a0558 Force generateDebugInfo when non-semantic debug info is enabled
From the command line, the debug options "stack", with -gVS enabling all
of generateDebugInfo, emitNonSemanticShaderDebugInfo and
emitNonSemanticShaderDebugSource, however the programmatic interface
allows setting the latter options without the former. In this case, the
string corresponding to the source filename never gets emitted and some
debuginfo instructions end up with zero ID operands, resulting in
invalid SPIR-V.

Fixes #3240
2023-12-11 20:03:16 +00:00
Sven van Haastregt
36d3c1ff1d Fix unused parameter warning in Release builds
The `function` parameter is only used by an assert currently, so mark
it as "maybe unused".  Alternatively the parameter could be removed,
but avoid such API churn for now.
2023-12-11 20:03:16 +00:00
Jason Liu
4b340dbc78 Fix linking error "ld: unknown option: --no-undefined" on macOS 2023-12-11 20:03:16 +00:00
juan-lunarg
352885abbc cmake: Fix CMake 3.27 warnings
The FindPythonInterp and FindPythonLibs modules, which have
been deprecated since CMake 3.12, have been removed by policy
CMP0148. Port projects to FindPython3, FindPython2, or FindPython.
2023-12-11 20:03:16 +00:00
Pablo Delgado Krämer
7b27be3f49 Fix GL_NV_shader_invocation_reorder #define typo 2023-12-11 20:03:16 +00:00
Sven van Haastregt
5f8a1985bd Fix -Wmaybe-uninitialized warnings
Fix some potentially uninitialized uses that are reported by GCC 13
with `-O3`.
2023-12-11 20:03:16 +00:00
David Neto
d88c49823d ndk-build: test Android API 24
Vulkan was introduced in Android API 24.
Test against that API level.
NDKs drop support for older APIs

Google-internal BUG=285134453
2023-12-11 20:03:16 +00:00
rcombs
58bbccc3cf glslang_c_interface: use valid C function prototypes
Prototypes are required in C.
2023-12-11 20:03:16 +00:00
Rémi Verschelde
fded2b4341 CMake: Use set_target_properties instead of set_property
This makes the cmake code a bit cleaner and more consistent.
2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
d7c51a7dce CMake: Make glslang-default-resource-limits STATIC 2023-12-11 20:03:16 +00:00
Allan MacKinnon
bef8f6335e glslangValidator: Exit with an error if output file cannot be written
Propagate the error from glslang::OutputSpv[Hex|Bin] and exit with an error code if there is an error.
2023-12-11 20:03:16 +00:00
Allan MacKinnon
ab739640cf [glslang] Strip trailing whitespace
There are many other files in the repo that have trailing whitespace
but this PR only cleans `glslang/SPIRV` and `glslang/Standalone`.
2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
fe57308534 Switch Android.mk to use --std=c++17 2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
3b815127a3 Switch Bazel to c++17 2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
1f727e86c8 Add decorations to structs with buffer references
The containsPhysicalStorageBufferOrArray function now handles struct
types correctly, checking their contents recursively for buffer
reference types. As a result, OpVariables containing structs that have
members that are buffer references now have the appropriate
AliasedPointer or RestrictPointer decoration as per the spec.

Fixes #3188
2023-12-11 20:03:16 +00:00
Jeremy Hayes
87a3777efa Update CHANGES for release 12.2.0 2023-12-11 20:03:16 +00:00
Jeremy Hayes
4e73fc2cec Update known_good.json 2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
6ae905e638 Include <cstdint> header in Common.h
This change also cleans up some ifdef'd code for no longer supported
versions of MSVC.

Fixes: #3139
2023-12-11 20:03:16 +00:00
Johannes Kauffmann
f6c1769134 Common.h: don't use to_string workaround on MSVC
Pre-VS2012 is no longer supported.

It might still be needed on Android, I haven't tested this.
2023-12-11 20:03:16 +00:00
Johannes Kauffmann
0c479ae4ae PP: remove workaround for VS2015 2023-12-11 20:03:16 +00:00
Johannes Kauffmann
fed6709f25 SPIRV: remove pre-C++11 workaround 2023-12-11 20:03:16 +00:00
Johannes Kauffmann
12e9fdc2ec SPIRV: hex_float: remove workaround for VS2013 2023-12-11 20:03:16 +00:00
Arcady Goldmints-Orlov
d8d1d4ef14 Enable constructor reorder warnings
They no longer happen "all over" as the comment suggests, and downstream
builds have them enabled already.
2023-12-11 20:03:16 +00:00
Ryan Harrison
b2af3b916e Correct ctor order to make '-Wreorder-ctor' pass
These lines in the ctor being out of order are causing -Wreorder-ctor
to fire when trying to integrate glslang ToT into Chromium/Dawn/etc,
https://logs.chromium.org/logs/dawn/buildbucket/cr-buildbucket/8781562047251466593/+/u/compile_with_ninja/stdout.
2023-12-11 20:03:16 +00:00
Steven Perron
7ce81c7a32 Remove the windows-msvc-2015-release-bazel config
The VS2015 bazel test has been stopped, so we can not remove the config
file. We have the windows-msvc-2019-release-bazel to replace it. It is
already running, and it is passing.
2023-12-11 20:03:16 +00:00
Alexey Ozeritskiy
6929ac54eb Use custom callbacks if they are available in 'i->callbacks' 2023-12-11 20:03:16 +00:00
Steven Perron
910542a2cd Add windows-msvc-2019-release-bazel CI config
The `windows-msvc-2015-release-bazel` build config name is misleading.
It now runs VS2019. We should rename it. This is the first part: create
the new config files.
2023-12-11 20:03:15 +00:00
Jeremy Hayes
74f286b050 Fix windows-msvc-2015-bazel CI job
The build file is updated to use MSVC 2019 as well as bazel 5.0.0.
2023-12-11 20:03:15 +00:00
janharaldfredriksen-arm
d5a8bab702 Add GLSL_EXT_shader_tile_image 2023-12-11 20:03:15 +00:00
juan-lunarg
75a9df78c6 ci: Test GCC on MacOS CI
closes #3062
2023-12-11 20:03:15 +00:00
juan-lunarg
50527923a5 cmake: Don't set CMAKE_INSTALL_PREFIX
While trying to set a default for CMAKE_INSTALL_PREFIX sounds
appealing it has multiple issues.

It's particularly problematic for open source projects where
many users try to accomplish many different things.

It's also conflicting with the new way of installing with cmake

IE: `cmake --install build --prefix build/install`

I've already removed similar logic in various other Khronos
repositories a while ago to address similar complaints.

closes #1015
2023-12-11 20:03:15 +00:00
Eric Werness
c51a510b03 GL_EXT_ray_tracing_position_fetch 2023-12-11 20:03:15 +00:00
juan-lunarg
eb82ff12cd cmake: Remove USE_CCACHE
This is no longer needed with modern CMake.

I've already removed this from several Khronos repos.

See this stackoverflow for modern approaches to setting ccache via cmake:
https://stackoverflow.com/a/74120112/19739129
2023-12-11 20:03:15 +00:00
juan-lunarg
de88aab6d7 cmake: Remove explicitly setting CMAKE_EXPORT_COMPILE_COMMANDS
Modern IDEs / C++ environments will just set this for you.

EX: vscode will set this for you.
2023-12-11 20:03:15 +00:00
Sruthik P
77d5fede50 glslang: Do not link with pthread on QNX
On QNX, pthread APIs are provided as part of libc and a separate pthread
library does not exist.

This change updates the makefile of glslang to not link with pthread on
QNX, thereby enabling glslang to be built for QNX platforms.
2023-12-11 20:03:15 +00:00
Chuang Zhu
9468109f82 Use CMAKE_INSTALL_FULL_LIBDIR in compat cmake files
According to
https://cmake.org/cmake/help/v3.25/module/GNUInstallDirs.html,
CMAKE_INSTALL_LIBDIR can be an absolute path. For instance, Nixpkgs
[defined it to an absolute path in /nix/store](3d17b4c305/pkgs/development/tools/build-managers/cmake/setup-hook.sh (L101)).
The output in this case is:

	# result-glslang/lib/cmake/glslangTargets.cmake:5
	include("${CMAKE_CURRENT_LIST_DIR}/../..//nix/store/3mif2zibig0cilk5dbz334278n0vlq9s-glslang-1.3.231.0/lib/glslang/glslang-targets.cmake")

Signed-off-by: Chuang Zhu <git@chuang.cz>
2023-12-11 20:03:15 +00:00
Brad Smith
0dfc4e8547 Fix building on OpenBSD when building shared libs
OpenBSD does not link shared libs against libc so it is expected
that the use of --no-undefined when linking will fail.

Also garbage collect CMAKE_VERSION check while here, as requested, since
the minimum version is already 3.14.
2023-12-11 20:03:15 +00:00