├── .tag ├── tests ├── auto │ ├── buildtimeqsb │ │ ├── replacements │ │ │ ├── r1.vert │ │ │ ├── r3.vert │ │ │ ├── r4.frag │ │ │ └── r2.spv │ │ ├── color.frag │ │ ├── tess.frag │ │ ├── tess.vert │ │ ├── subdir │ │ │ ├── texture.frag │ │ │ ├── texture.vert │ │ │ ├── texture2.vert │ │ │ └── test │ │ │ │ └── texture_def.frag │ │ ├── color.vert │ │ ├── color_multiview.vert │ │ ├── color_multiview_def.vert │ │ ├── tess.tesc │ │ ├── tess_hull.hlsl │ │ ├── tess.tese │ │ └── tess_domain.hlsl │ ├── qsbdepfiles │ │ ├── data │ │ │ ├── tst.frag.qsb.d.in │ │ │ ├── tstinclude.frag.qsb.d.in │ │ │ ├── tstincludewhitespaces.frag.qsb.d.in │ │ │ ├── tstincludecomment.frag.qsb.d.in │ │ │ └── tstincluderelative.frag.qsb.d.in │ │ ├── shaders │ │ │ ├── common.glsl │ │ │ ├── tst.frag │ │ │ ├── inner │ │ │ │ └── common2.glsl │ │ │ ├── tstinclude.frag │ │ │ ├── tstincludewhitespaces.frag │ │ │ ├── tstincluderelative.frag │ │ │ └── tstincludecomment.frag │ │ ├── tst_qsbdepfiles.cpp │ │ └── CMakeLists.txt │ ├── qshaderbaker │ │ ├── data │ │ │ ├── multiview_simple.vert │ │ │ ├── color.frag │ │ │ ├── texturesize.frag │ │ │ ├── color.vert │ │ │ ├── error.vert │ │ │ ├── sgtexture.frag │ │ │ ├── color_spirv_only.vert │ │ │ ├── combined_and_separate_samplers.frag │ │ │ ├── defines.frag │ │ │ ├── color_glsl_only.vert │ │ │ ├── color_hlsl_msl_only.vert │ │ │ ├── imageloadstore.comp │ │ │ ├── tess.tesc │ │ │ ├── color_pertarget.vert │ │ │ ├── arrays_of_samplers.frag │ │ │ ├── manyresources.frag │ │ │ ├── tess.tese │ │ │ ├── voxelize.geom │ │ │ ├── hlsl_cbuf_error.frag │ │ │ ├── storagebuffer.comp │ │ │ └── array_of_struct_in_ubuf.frag │ │ └── CMakeLists.txt │ └── CMakeLists.txt ├── playground │ ├── fragcolor.inc │ ├── color.frag │ ├── tessellation │ │ ├── test.frag │ │ ├── test.vert │ │ ├── test.tesc │ │ ├── per_patch_output.tesc │ │ ├── test.tese │ │ └── per_patch_output.tese │ ├── testexternalsampler.bat │ ├── includetest.frag │ ├── color_pc.frag │ ├── externalsampler_gles.frag │ ├── texture.frag │ ├── color_pc.vert │ ├── externalsampler.frag │ ├── cbuf_without_inst.frag │ ├── preamble.frag │ ├── color.vert │ ├── texture.vert │ ├── externalsampler.vert │ ├── texture_sep_arr.frag │ ├── comp_image.comp │ ├── cbuf.frag │ ├── comp_buffer.comp │ ├── texture_sep.frag │ ├── multiple_sets.frag │ ├── multiview.frag │ ├── arrays_of_samplers.frag │ ├── multiview.vert │ ├── sampler_arrays.frag │ ├── manyresources.frag │ ├── color_phong.vert │ ├── voxelize.geom │ ├── color_phong.frag │ ├── visualize.geom │ ├── hlsl_cbuf_error.frag │ └── array.frag ├── CMakeLists.txt └── manual │ └── qmlappshadermacro │ ├── wobble.frag │ ├── main.cpp │ ├── CMakeLists.txt │ └── main.qml ├── tools ├── tools.pro ├── qsb │ ├── qsb.pro │ └── CMakeLists.txt └── CMakeLists.txt ├── .gitreview ├── dependencies.yaml ├── src ├── shadertools │ ├── doc │ │ ├── images │ │ │ └── shaderconditioning.png │ │ ├── snippets │ │ │ ├── color.frag │ │ │ └── color.vert │ │ ├── src │ │ │ ├── qtshadertools-toc.qdoc │ │ │ └── qtshadertools-index.qdoc │ │ └── qtshadertools.qdocconf │ ├── qtshadertoolsglobal.h │ ├── qtshadertoolsglobal_p.h │ ├── qshaderrewriter_p.h │ ├── qspirvshaderremap_p.h │ ├── qspirvshaderremap.cpp │ ├── CMakeLists.txt │ ├── qspirvcompiler_p.h │ └── qshaderbaker.h ├── 3rdparty │ ├── SPIRV-Cross │ │ ├── REUSE.toml │ │ ├── COPYRIGHT.txt │ │ ├── qt_attribution.json │ │ ├── Makefile │ │ ├── spirv_cross_util.hpp │ │ ├── spirv_reflect.hpp │ │ ├── spirv_cross_util.cpp │ │ ├── spirv_cpp.hpp │ │ ├── spirv_parser.hpp │ │ └── spirv_cross_error_handling.hpp │ ├── glslang │ │ ├── COPYRIGHT.txt │ │ ├── REUSE.toml │ │ ├── qt_attribution.json │ │ ├── SPIRV │ │ │ ├── GLSL.ext.ARM.h │ │ │ ├── GLSL.ext.QCOM.h │ │ │ ├── NonSemanticDebugPrintf.h │ │ │ ├── disassemble.h │ │ │ ├── GLSL.ext.EXT.h │ │ │ ├── Logger.cpp │ │ │ ├── Logger.h │ │ │ ├── GlslangToSpv.h │ │ │ └── bitutils.h │ │ └── glslang │ │ │ ├── updateGrammar │ │ │ ├── MachineIndependent │ │ │ ├── RemoveTree.h │ │ │ ├── pch.h │ │ │ └── propagateNoContraction.h │ │ │ ├── ExtensionHeaders │ │ │ └── GL_EXT_shader_realtime_clock.glsl │ │ │ ├── OSDependent │ │ │ ├── osinclude.h │ │ │ ├── Unix │ │ │ │ └── ossource.cpp │ │ │ └── Windows │ │ │ │ ├── main.cpp │ │ │ │ └── ossource.cpp │ │ │ ├── Include │ │ │ ├── InitializeGlobals.h │ │ │ └── visibility.h │ │ │ ├── HLSL │ │ │ ├── pch.h │ │ │ ├── hlslAttributes.h │ │ │ ├── hlslOpMap.h │ │ │ └── hlslParseables.h │ │ │ ├── ResourceLimits │ │ │ └── resource_limits_c.cpp │ │ │ ├── Public │ │ │ ├── resource_limits_c.h │ │ │ └── ResourceLimits.h │ │ │ ├── GenericCodeGen │ │ │ ├── CodeGen.cpp │ │ │ └── Link.cpp │ │ │ └── build_info.h │ └── patches │ │ ├── glslang │ │ ├── 0006-Undefine_restrict_keyword.patch │ │ ├── 0001-glslang-Fix-build-on-INTEGRITY.patch │ │ ├── 0004-Fix-build-with-gcc-13.patch │ │ ├── 0005-glslang-Replace-BOOL-with-ANOTHER_BOOL-define-for-VxWroks.patch │ │ ├── 0009-glslang-Fix-Workaround-crash-on-Android-arm64-v8a-in.patch │ │ ├── 0008-glslang-Drop-C-17-filesystem-usage.patch │ │ └── 0010-glslang-fix-missing-namespacing.patch │ │ └── SPIRV-Cross │ │ ├── 0003-Use-localeconv-for-VxWorks-instead-of-unavailable-nl_langinfo.patch │ │ └── 0001-SPIRV-Cross-Fix-build-on-INTEGRITY-and-QNX.patch ├── CMakeLists.txt └── SPIRV-Cross │ └── CMakeLists.txt ├── dist ├── REUSE.toml └── changes-6.0.0 ├── .cmake.conf ├── LICENSES ├── LicenseRef-Qt-Commercial.txt ├── Bison-exception-2.2.txt ├── Qt-GPL-exception-1.0.txt ├── MIT.txt ├── LicenseRef-MIT-Khronos-old.txt ├── BSD-3-Clause.txt └── AML-glslang.txt ├── coin ├── module_config.yaml └── axivion │ └── ci_config_linux.json ├── CMakeLists.txt └── REUSE.toml /.tag: -------------------------------------------------------------------------------- 1 | cff6953e790086bbbc69a05570e99049c98f33fd 2 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/replacements/r1.vert: -------------------------------------------------------------------------------- 1 | Test r1 2 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/replacements/r3.vert: -------------------------------------------------------------------------------- 1 | Test r3 2 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/replacements/r4.frag: -------------------------------------------------------------------------------- 1 | Test r4 2 | -------------------------------------------------------------------------------- /tools/tools.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += qsb 3 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/replacements/r2.spv: -------------------------------------------------------------------------------- 1 | Not very valid SPIR-V 2 | -------------------------------------------------------------------------------- /tests/playground/fragcolor.inc: -------------------------------------------------------------------------------- 1 | fragColor = vec4(v_color, 1.0); 2 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=codereview.qt-project.org 3 | project=qt/qtshadertools 4 | defaultbranch=dev 5 | -------------------------------------------------------------------------------- /dependencies.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | ../qtbase: 3 | ref: df1292e2b96aab02ad6df778d8336e7958ad5d1c 4 | required: true 5 | -------------------------------------------------------------------------------- /tools/qsb/qsb.pro: -------------------------------------------------------------------------------- 1 | SOURCES += qsb.cpp 2 | 3 | QT += shadertools-private gui-private 4 | 5 | requires(qtConfig(process)) 6 | 7 | load(qt_tool) 8 | -------------------------------------------------------------------------------- /src/shadertools/doc/images/shaderconditioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtshadertools/dev/src/shadertools/doc/images/shaderconditioning.png -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/data/tst.frag.qsb.d.in: -------------------------------------------------------------------------------- 1 | @CMAKE_CURRENT_BINARY_DIR@/.qsb/shaders/tst.frag.qsb: \ 2 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/tst.frag 3 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["*"] 5 | precedence = "closest" 6 | SPDX-License-Identifier = "Apache-2.0 OR MIT" 7 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from tools.pro. 5 | 6 | add_subdirectory(qsb) 7 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/common.glsl: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_GLSL 2 | #define COMMON_GLSL 3 | 4 | vec4 getColor() 5 | { 6 | return vec4(1.0, 0.0, 0.0, 1.0); 7 | } 8 | #endif 9 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/tst.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) out vec4 fragColor; 4 | 5 | void main() { 6 | fragColor = vec4(1.0, 0.0, 0.0, 1.0); 7 | } 8 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/inner/common2.glsl: -------------------------------------------------------------------------------- 1 | #ifndef COMMON2_GLSL 2 | #define COMMON2_GLSL 3 | vec4 getColor2() 4 | { 5 | return vec4(1.0, 0.0, 0.0, 1.0); 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /tests/playground/color.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | void main() 8 | { 9 | fragColor = vec4(v_color, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/color.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | void main() 8 | { 9 | fragColor = vec4(v_color, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | void main() 8 | { 9 | fragColor = vec4(v_color, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/data/tstinclude.frag.qsb.d.in: -------------------------------------------------------------------------------- 1 | @CMAKE_CURRENT_BINARY_DIR@/.qsb/shaders/tstinclude.frag.qsb: \ 2 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/tstinclude.frag \ 3 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/common.glsl 4 | -------------------------------------------------------------------------------- /tests/playground/tessellation/test.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | void main() 8 | { 9 | fragColor = vec4(v_color, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from src.pro. 5 | 6 | add_subdirectory(glslang) 7 | add_subdirectory(SPIRV-Cross) 8 | add_subdirectory(shadertools) 9 | -------------------------------------------------------------------------------- /tests/playground/testexternalsampler.bat: -------------------------------------------------------------------------------- 1 | qsb --glsl 100es -o externalsampler.vert.qsb externalsampler.vert 2 | qsb --glsl 100es -o externalsampler.frag.qsb externalsampler.frag 3 | qsb -r glsl,100es,externalsampler_gles.frag externalsampler.frag.qsb 4 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/data/tstincludewhitespaces.frag.qsb.d.in: -------------------------------------------------------------------------------- 1 | @CMAKE_CURRENT_BINARY_DIR@/.qsb/shaders/tstincludewhitespaces.frag.qsb: \ 2 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/tstincludewhitespaces.frag \ 3 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/common.glsl 4 | -------------------------------------------------------------------------------- /tests/playground/includetest.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_GOOGLE_include_directive : enable 3 | 4 | layout(location = 0) in vec3 v_color; 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | void main() 8 | { 9 | #include "fragcolor.inc" 10 | } 11 | -------------------------------------------------------------------------------- /tests/playground/color_pc.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(push_constant) uniform PC { 4 | layout(offset = 64) vec3 color; 5 | } pc; 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() 10 | { 11 | fragColor = vec4(pc.color, 1.0); 12 | } 13 | -------------------------------------------------------------------------------- /tests/playground/externalsampler_gles.frag: -------------------------------------------------------------------------------- 1 | #extension GL_OES_EGL_image_external : require 2 | 3 | varying highp vec2 textureCoords; 4 | uniform samplerExternalOES frameTexture; 5 | 6 | void main() 7 | { 8 | gl_FragColor = texture2D(frameTexture, textureCoords).bgra; 9 | } 10 | -------------------------------------------------------------------------------- /tests/playground/texture.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform sampler2D tex; 8 | 9 | void main() 10 | { 11 | fragColor = texture(tex, v_texcoord); 12 | } 13 | -------------------------------------------------------------------------------- /dist/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["*"] 5 | precedence = "override" 6 | comment = "Licensed as documentation." 7 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 8 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" 9 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/tstinclude.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_GOOGLE_include_directive : enable 3 | 4 | #include "common.glsl" 5 | #include "common.glsl" 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() { 10 | fragColor = getColor(); 11 | } 12 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/tstincludewhitespaces.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_GOOGLE_include_directive : enable 3 | 4 | # include "common.glsl" 5 | 6 | layout(location = 0) out vec4 fragColor; 7 | 8 | void main() { 9 | fragColor = vec4(1.0, 0.0, 0.0, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /.cmake.conf: -------------------------------------------------------------------------------- 1 | set(QT_REPO_MODULE_VERSION "6.12.0") 2 | set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") 3 | 4 | list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES 5 | "QT_LEAN_HEADERS=1" 6 | "QT_NO_FOREACH=1" 7 | "QT_NO_QASCONST=1" 8 | "QT_NO_URL_CAST_FROM_STRING=1" 9 | ) 10 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec3 color; 5 | 6 | layout(location = 0) out vec3 v_color; 7 | 8 | void main() 9 | { 10 | gl_Position = vec4(position, 1.0); 11 | v_color = color; 12 | } 13 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Copyright 2015-2020 Arm Limited 2 | Copyright (c) 2014-2019 The Khronos Group Inc. 3 | Copyright 2019-2020 Hans-Kristian Arntzen 4 | Copyright 2016-2020 Robert Konrad 5 | Copyright 2016-2020 The Brenwill Workshop Ltd. 6 | Copyright 2018-2020 Bradley Austin Davis 7 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/subdir/texture.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform sampler2D tex; 8 | 9 | void main() 10 | { 11 | fragColor = texture(tex, v_texcoord); 12 | } 13 | -------------------------------------------------------------------------------- /tests/playground/color_pc.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | 5 | out gl_PerVertex { vec4 gl_Position; }; 6 | 7 | layout(push_constant) uniform PC { 8 | mat4 mvp; 9 | } pc; 10 | 11 | void main() 12 | { 13 | gl_Position = pc.mvp * position; 14 | } 15 | -------------------------------------------------------------------------------- /tests/playground/tessellation/test.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 position; 4 | layout(location = 1) in vec3 color; 5 | 6 | layout(location = 0) out vec3 v_color; 7 | 8 | void main() 9 | { 10 | gl_Position = vec4(position, 1.0); 11 | v_color = color; 12 | } 13 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/data/tstincludecomment.frag.qsb.d.in: -------------------------------------------------------------------------------- 1 | @CMAKE_CURRENT_BINARY_DIR@/.qsb/shaders/tstincludecomment.frag.qsb: \ 2 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/tstincludecomment.frag \ 3 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/common.glsl \ 4 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/inner/common2.glsl 5 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/data/tstincluderelative.frag.qsb.d.in: -------------------------------------------------------------------------------- 1 | @CMAKE_CURRENT_BINARY_DIR@/.qsb/shaders/tstincluderelative.frag.qsb: \ 2 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/tstincluderelative.frag \ 3 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/common.glsl \ 4 | @CMAKE_CURRENT_SOURCE_DIR@/shaders/inner/common2.glsl 5 | -------------------------------------------------------------------------------- /tests/playground/externalsampler.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 textureCoords; 4 | layout(location = 0) out vec4 fragColor; 5 | layout(binding = 1) uniform sampler2D frameTexture; 6 | 7 | void main() 8 | { 9 | fragColor = texture(frameTexture, textureCoords).bgra; 10 | } 11 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/multiview_simple.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_EXT_multiview : require 3 | 4 | layout(location = 0) in vec4 pos; 5 | 6 | layout(std140, binding = 0) uniform buf 7 | { 8 | mat4 mvp[2]; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = mvp[gl_ViewIndex] * pos; 14 | } 15 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/tstincluderelative.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_GOOGLE_include_directive : enable 3 | 4 | #include "common.glsl" 5 | #include "inner/common2.glsl" 6 | 7 | layout(location = 0) out vec4 fragColor; 8 | 9 | void main() { 10 | fragColor = getColor(); 11 | fragColor = getColor2(); 12 | } 13 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from tests.pro. 5 | 6 | if(QT_BUILD_STANDALONE_TESTS) 7 | # Add qt_find_package calls for extra dependencies that need to be found when building 8 | # the standalone tests here. 9 | endif() 10 | qt_build_tests() 11 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | layout(location = 0) out vec4 fragColor; 5 | 6 | layout(std140, binding = 0) uniform buf { 7 | mat4 mvp; 8 | float opacity; 9 | } ubuf; 10 | 11 | void main() 12 | { 13 | fragColor = vec4(v_color * ubuf.opacity, ubuf.opacity); 14 | } 15 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2019 ARM Limited 2 | Copyright (c) 2002-2005 3 Dlabs Inc. Ltd. 3 | Copyright (c) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 4 | Copyright (c) 2014-2018 Google, Inc. 5 | Copyright (c) 2002 NVIDIA Corporation 6 | Copyright (c) 2002-2010 The ANGLE Project 7 | Copyright (c) 2014-2019 The Khronos Group Inc. -------------------------------------------------------------------------------- /src/shadertools/doc/snippets/color.frag: -------------------------------------------------------------------------------- 1 | //! [0] 2 | #version 440 3 | 4 | layout(location = 0) in vec3 v_color; 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | }; 11 | 12 | void main() 13 | { 14 | fragColor = vec4(v_color * opacity, opacity); 15 | } 16 | //! [0] 17 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/color.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | 6 | layout(location = 0) out vec3 v_color; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | }; 11 | 12 | void main() 13 | { 14 | v_color = color; 15 | gl_Position = mvp * position; 16 | } 17 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/subdir/texture.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec2 texcoord; 5 | 6 | layout(location = 0) out vec2 v_texcoord; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | }; 11 | 12 | void main() 13 | { 14 | v_texcoord = texcoord; 15 | gl_Position = mvp * position; 16 | } 17 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/subdir/texture2.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec2 texcoord; 5 | 6 | layout(location = 0) out vec2 v_texcoord; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | }; 11 | 12 | void main() 13 | { 14 | v_texcoord = texcoord; 15 | gl_Position = mvp * position; 16 | } 17 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/texturesize.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | layout(location = 0) out vec4 fragColor; 5 | layout(binding = 0) uniform sampler2D tex; 6 | 7 | void main() 8 | { 9 | vec2 size = vec2(textureSize(tex, 0)); 10 | vec2 d = vec2(1.0 / size.x, 1.0 / size.y); 11 | fragColor = texture(tex, v_texcoord + d); 12 | } 13 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/subdir/test/texture_def.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | #ifdef MY_DEFINE 4 | #ifdef ANOTHER_DEFINE 5 | layout(location = 0) in vec2 v_texcoord; 6 | layout(location = 0) out vec4 fragColor; 7 | layout(binding = 1) uniform sampler2D tex; 8 | #endif 9 | #endif // else breaks compilation 10 | 11 | void main() 12 | { 13 | fragColor = texture(tex, v_texcoord); 14 | } 15 | -------------------------------------------------------------------------------- /tests/playground/cbuf_without_inst.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(std140, binding = 0) uniform buf1 { 4 | vec3 v; 5 | float f; 6 | } ubuf1; 7 | 8 | layout(std140, binding = 1) uniform buf2 { 9 | float f2; 10 | }; // no instance name 11 | 12 | layout(location = 0) out vec4 fragColor; 13 | 14 | void main() 15 | { 16 | fragColor = vec4(ubuf1.v, ubuf1.f + f2); 17 | } 18 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/shaders/tstincludecomment.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_GOOGLE_include_directive : enable 3 | 4 | #include "common.glsl" // The followup comment 5 | #include "inner/common2.glsl" // The followup comment with " 6 | // #include "common.glsl" commented line 7 | 8 | layout(location = 0) out vec4 fragColor; 9 | 10 | void main() { 11 | fragColor = getColor(); 12 | } 13 | -------------------------------------------------------------------------------- /src/shadertools/doc/snippets/color.vert: -------------------------------------------------------------------------------- 1 | //! [0] 2 | #version 440 3 | 4 | layout(location = 0) in vec4 position; 5 | layout(location = 1) in vec3 color; 6 | layout(location = 0) out vec3 v_color; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | float opacity; 11 | }; 12 | 13 | void main() 14 | { 15 | v_color = color; 16 | gl_Position = mvp * position; 17 | } 18 | //! [0] 19 | -------------------------------------------------------------------------------- /tests/playground/preamble.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | layout(location = 0) out vec4 fragColor; 5 | 6 | // must be compiled with -DMAKE_IT_WORK -DYES_REALLY=99 7 | 8 | #ifdef MAKE_IT_WORK 9 | #if YES_REALLY > 98 10 | layout(binding = 1) uniform sampler2D tex; 11 | #endif 12 | #endif 13 | 14 | void main() 15 | { 16 | fragColor = texture(tex, v_texcoord); 17 | } 18 | -------------------------------------------------------------------------------- /tests/playground/color.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | 6 | layout(location = 0) out vec3 v_color; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | v_color = color; 17 | gl_Position = ubuf.mvp * position; 18 | } 19 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/color_multiview.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_EXT_multiview : require 3 | 4 | layout(location = 0) in vec4 position; 5 | layout(location = 1) in vec3 color; 6 | 7 | layout(location = 0) out vec3 v_color; 8 | 9 | layout(std140, binding = 0) uniform buf { 10 | mat4 mvp[2]; 11 | }; 12 | 13 | void main() 14 | { 15 | v_color = color; 16 | gl_Position = mvp[gl_ViewIndex] * position; 17 | } 18 | -------------------------------------------------------------------------------- /tests/playground/texture.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec2 texcoord; 5 | 6 | layout(location = 0) out vec2 v_texcoord; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 mvp; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | v_texcoord = texcoord; 17 | gl_Position = ubuf.mvp * position; 18 | } 19 | -------------------------------------------------------------------------------- /src/shadertools/qtshadertoolsglobal.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTSHADERTOOLSGLOBAL_H 5 | #define QTSHADERTOOLSGLOBAL_H 6 | 7 | #include 8 | #include 9 | 10 | #ifdef Q_QDOC 11 | #define Q_SHADERTOOLS_EXPORT 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | v_color = color; 17 | gl_Position = ubuf.mvp * position; 18 | } 19 | -------------------------------------------------------------------------------- /tests/playground/externalsampler.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 vertexCoordsArray; 4 | layout(location = 1) in vec2 textureCoordArray; 5 | layout(location = 0) out vec2 textureCoords; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 texMatrix; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = vertexCoordsArray; 14 | textureCoords = (texMatrix * vec4(textureCoordArray, 0.0, 1.0)).xy; 15 | } 16 | -------------------------------------------------------------------------------- /tests/playground/texture_sep_arr.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform texture2D sepTex[2]; 8 | layout(binding = 2) uniform sampler sepSampler; 9 | 10 | void main() 11 | { 12 | fragColor = texture(sampler2D(sepTex[0], sepSampler), v_texcoord); 13 | fragColor *= texture(sampler2D(sepTex[1], sepSampler), v_texcoord); 14 | } 15 | -------------------------------------------------------------------------------- /tests/playground/comp_image.comp: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout (local_size_x = 16, local_size_y = 16) in; 4 | 5 | layout (binding = 0, rgba8) uniform readonly image2D inputImage; 6 | layout (binding = 1, rgba8) uniform writeonly image2D resultImage; 7 | 8 | void main() 9 | { 10 | vec4 c = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y)); 11 | imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), c); 12 | } 13 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/error.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | v_color = cgrepijrgrewolor; 17 | gl_Position = ubuf.mvp * position; 18 | } 19 | -------------------------------------------------------------------------------- /tests/playground/cbuf.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | 6 | layout(std140, binding = 1) uniform buf { 7 | vec3 v; 8 | float f; 9 | } ubuf; 10 | 11 | layout(std140, binding = 2) uniform buf2 { 12 | float f; 13 | vec3 v; 14 | } ubuf2; 15 | 16 | layout(location = 0) out vec4 fragColor; 17 | 18 | void main() 19 | { 20 | fragColor = vec4(ubuf.v, ubuf.f); 21 | } 22 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/sgtexture.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 qt_TexCoord; 4 | layout(location = 0) out vec4 fragColor; 5 | 6 | layout(std140, binding = 0) uniform buf { 7 | mat4 qt_Matrix; 8 | float opacity; 9 | } ubuf; 10 | 11 | layout(binding = 1) uniform sampler2D qt_Texture; 12 | layout(binding = 2) uniform sampler2D t1; 13 | 14 | void main() 15 | { 16 | fragColor = texture(qt_Texture, qt_TexCoord) * ubuf.opacity * texture(t1, qt_TexCoord); 17 | } 18 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-Qt-Commercial.txt: -------------------------------------------------------------------------------- 1 | Licensees holding valid commercial Qt licenses may use this software in 2 | accordance with the the terms contained in a written agreement between 3 | you and The Qt Company. Alternatively, the terms and conditions that were 4 | accepted by the licensee when buying and/or downloading the 5 | software do apply. 6 | 7 | For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions. 8 | For further information use the contact form at https://www.qt.io/contact-us. 9 | -------------------------------------------------------------------------------- /coin/module_config.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | accept_configuration: 3 | condition: property 4 | property: features 5 | not_contains_value: Disable 6 | 7 | instructions: 8 | Build: 9 | - type: EnvironmentVariable 10 | variableName: VERIFY_SOURCE_SBOM 11 | variableValue: "ON" 12 | - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" 13 | 14 | Test: 15 | - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" 16 | - !include "{{qt/qtbase}}/coin_module_test_docs.yaml" 17 | -------------------------------------------------------------------------------- /tests/playground/comp_buffer.comp: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout (local_size_x = 256) in; 4 | 5 | struct Stuff { 6 | vec2 a; 7 | vec2 b; 8 | }; 9 | 10 | layout(std140, binding = 0) buffer StuffSsbo 11 | { 12 | vec4 whatever; 13 | Stuff stuff[]; 14 | } buf; 15 | 16 | void main() 17 | { 18 | uint index = gl_GlobalInvocationID.x; 19 | vec2 a = buf.stuff[index].a; 20 | vec2 b = buf.stuff[index].b; 21 | 22 | a.x += 1.0; 23 | buf.stuff[index].a = a; 24 | b.y += 1.0; 25 | buf.stuff[index].b = b; 26 | } 27 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color_spirv_only.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | #if QSHADER_SPIRV && QSHADER_SPIRV_VERSION >= 100 17 | v_color = color; 18 | gl_Position = ubuf.mvp * position; 19 | #else 20 | something is broken 21 | #endif 22 | } 23 | -------------------------------------------------------------------------------- /tests/playground/tessellation/test.tesc: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(vertices = 3) out; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor[]; 8 | 9 | void main() 10 | { 11 | if (gl_InvocationID == 0) { 12 | gl_TessLevelOuter[0] = 4.0; 13 | gl_TessLevelOuter[1] = 4.0; 14 | gl_TessLevelOuter[2] = 4.0; 15 | 16 | gl_TessLevelInner[0] = 4.0; 17 | } 18 | 19 | gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 20 | outColor[gl_InvocationID] = inColor[gl_InvocationID]; 21 | } 22 | -------------------------------------------------------------------------------- /tests/playground/texture_sep.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | float f; 9 | }; 10 | 11 | layout(binding = 1) uniform texture2D sepTex; 12 | layout(binding = 2) uniform sampler sepSampler; 13 | layout(binding = 3) uniform sampler sepSampler2; 14 | 15 | void main() 16 | { 17 | fragColor = texture(sampler2D(sepTex, sepSampler), v_texcoord); 18 | fragColor *= texture(sampler2D(sepTex, sepSampler2), v_texcoord); 19 | fragColor.a *= f; 20 | } 21 | -------------------------------------------------------------------------------- /tests/manual/qmlappshadermacro/wobble.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 qt_TexCoord0; 4 | layout(location = 0) out vec4 fragColor; 5 | 6 | layout(binding = 1) uniform sampler2D source; 7 | 8 | layout(std140, binding = 0) uniform buf { 9 | mat4 qt_Matrix; 10 | float qt_Opacity; 11 | float amplitude; 12 | float frequency; 13 | float time; 14 | } ubuf; 15 | 16 | void main() 17 | { 18 | vec2 p = sin(ubuf.time + ubuf.frequency * qt_TexCoord0); 19 | fragColor = texture(source, qt_TexCoord0 + ubuf.amplitude * vec2(p.y, -p.x)) * ubuf.qt_Opacity; 20 | } 21 | -------------------------------------------------------------------------------- /src/shadertools/doc/src/qtshadertools-toc.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page qtshadertools-toc.html 6 | \title Qt Shader Tools module topics 7 | 8 | The following list has links to all the individual topics (HTML files) 9 | in the Qt Shader Tools module. 10 | 11 | \list 12 | \li \l {Qt Shader Tools Overview}{Overview} 13 | \li \l {QSB Manual} 14 | \li \l {Qt Shader Tools Build System Integration}{Build System Integration} 15 | \endlist 16 | 17 | */ 18 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/color_multiview_def.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_EXT_multiview : require 3 | 4 | layout(location = 0) in vec4 position; 5 | layout(location = 1) in vec3 color; 6 | 7 | layout(location = 0) out vec3 v_color; 8 | 9 | layout(std140, binding = 0) uniform buf { 10 | #if QSHADER_VIEW_COUNT >= 2 11 | mat4 mvp[QSHADER_VIEW_COUNT]; 12 | #else 13 | mat4 mvp; 14 | #endif 15 | }; 16 | 17 | void main() 18 | { 19 | v_color = color; 20 | #if QSHADER_VIEW_COUNT >= 2 21 | gl_Position = mvp[gl_ViewIndex] * position; 22 | #else 23 | gl_Position = mvp * position; 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /tests/playground/multiple_sets.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 0) uniform sampler2D tex; 8 | layout(std140, binding = 1) uniform buf { 9 | vec4 color; 10 | }; 11 | 12 | layout(set = 1, binding = 0) uniform sampler2D tex2; 13 | layout(std140, set = 1, binding = 1) uniform buf2 { 14 | vec4 color2; 15 | }; 16 | layout(set = 1, binding = 2) uniform sampler2D tex3; 17 | 18 | void main() 19 | { 20 | fragColor = texture(tex, v_texcoord) * texture(tex2, v_texcoord) * color * color2 * texture(tex3, v_texcoord); 21 | } 22 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/combined_and_separate_samplers.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform sampler2D combinedTexSampler; 8 | layout(binding = 2) uniform texture2D sepTex; 9 | layout(binding = 3) uniform sampler sepSampler; 10 | layout(binding = 4) uniform sampler sepSampler2; 11 | 12 | void main() 13 | { 14 | fragColor = texture(sampler2D(sepTex, sepSampler), v_texcoord); 15 | fragColor *= texture(sampler2D(sepTex, sepSampler2), v_texcoord); 16 | fragColor *= texture(combinedTexSampler, v_texcoord); 17 | } 18 | -------------------------------------------------------------------------------- /tests/playground/tessellation/per_patch_output.tesc: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(vertices = 3) out; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) patch out vec3 stuff; 8 | layout(location = 1) patch out float more_stuff; 9 | 10 | void main() 11 | { 12 | if (gl_InvocationID == 0) { 13 | gl_TessLevelOuter[0] = 4.0; 14 | gl_TessLevelOuter[1] = 4.0; 15 | gl_TessLevelOuter[2] = 4.0; 16 | 17 | gl_TessLevelInner[0] = 4.0; 18 | } 19 | 20 | gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 21 | stuff = vec3(1.0); 22 | more_stuff = stuff.x + 0.5; 23 | } 24 | -------------------------------------------------------------------------------- /src/shadertools/qtshadertoolsglobal_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTSHADERTOOLSGLOBAL_P_H 5 | #define QTSHADERTOOLSGLOBAL_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists purely as an 12 | // implementation detail. This header file may change from version to 13 | // version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include "qtshadertoolsglobal.h" 19 | #include 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/defines.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 v_color; 4 | layout(location = 0) out vec4 fragColor; 5 | 6 | layout(std140, binding = 0) uniform buf { 7 | mat4 mvp; 8 | #if OPACITY_SIZE == 1 9 | float opacity; 10 | #elif OPACITY_SIZE == 2 11 | vec2 opacity; 12 | #elif OPACITY_SIZE == 3 13 | vec3 opacity; 14 | #else 15 | vec4 opacity; 16 | #endif 17 | } ubuf; 18 | 19 | #ifdef DO_NOT_BREAK 20 | void main() 21 | #endif 22 | { 23 | #if OPACITY_SIZE == 1 24 | fragColor = vec4(v_color * ubuf.opacity, ubuf.opacity); 25 | #else 26 | fragColor = vec4(v_color * ubuf.opacity.r, ubuf.opacity.r); 27 | #endif 28 | } 29 | -------------------------------------------------------------------------------- /tests/playground/multiview.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) out vec4 fragColor; 4 | 5 | void main() 6 | { 7 | // qsb on a fragment shader with --view-count should still work, even if it 8 | // does not actually enable GL_EXT_multiview. (mainly due to OpenGL / 9 | // SPIRV-Cross (?) issues due to only supporting gl_ViewIndex and co. in 10 | // vertex shaders) It defines QSHADER_VIEW_COUNT however. 11 | #if QSHADER_VIEW_COUNT < 2 12 | error, needs --view-count=2, or something is broken 13 | #endif 14 | // Should this (using gl_ViewIndex) work or not? 15 | //fragColor = vec4(gl_ViewIndex, 0.0, 0.0, 1.0); 16 | fragColor = vec4(1.0); 17 | } 18 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color_glsl_only.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | #if QSHADER_SPIRV || QSHADER_HLSL || QSHADER_MSL 17 | wrong 18 | #endif 19 | 20 | #if QSHADER_GLSL && !QSHADER_GLSL_ES && (QSHADER_GLSL_VERSION == 330 || QSHADER_GLSL_VERSION == 440) 21 | v_color = color; 22 | gl_Position = ubuf.mvp * position; 23 | #else 24 | something is broken 25 | #endif 26 | } 27 | -------------------------------------------------------------------------------- /tests/playground/tessellation/test.tese: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles, fractional_odd_spacing, ccw) in; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor; 8 | 9 | layout(std140, binding = 0) uniform buf { 10 | mat4 mvp; 11 | float time; 12 | float amplitude; 13 | }; 14 | 15 | void main() 16 | { 17 | gl_Position = mvp * ((gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position)); 18 | gl_Position.x += sin(time + gl_Position.y) * amplitude; 19 | outColor = gl_TessCoord.x * inColor[0] + gl_TessCoord.y * inColor[1] + gl_TessCoord.z * inColor[2]; 20 | } 21 | -------------------------------------------------------------------------------- /tests/manual/qmlappshadermacro/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | qputenv("QSG_INFO", "1"); 10 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 11 | QGuiApplication app(argc, argv); 12 | 13 | QQuickView view; 14 | view.setColor(Qt::black); 15 | view.setResizeMode(QQuickView::SizeRootObjectToView); 16 | view.resize(1280, 720); 17 | view.setSource(QUrl("qrc:/main.qml")); 18 | view.show(); 19 | 20 | int r = app.exec(); 21 | 22 | return r; 23 | } 24 | -------------------------------------------------------------------------------- /LICENSES/Bison-exception-2.2.txt: -------------------------------------------------------------------------------- 1 | Bison Exception 2 | 3 | As a special exception, you may create a larger work that contains part or all 4 | of the Bison parser skeleton and distribute that work under terms of your 5 | choice, so long as that work isn't itself a parser generator using the 6 | skeleton or a modified version thereof as a parser skeleton. Alternatively, 7 | if you modify or redistribute the parser skeleton itself, you may (at your 8 | option) remove this special exception, which will cause the skeleton and the 9 | resulting Bison output files to be licensed under the GNU General Public 10 | License without this special exception. 11 | 12 | This special exception was added by the Free Software Foundation in version 2.2 of Bison. 13 | -------------------------------------------------------------------------------- /dist/changes-6.0.0: -------------------------------------------------------------------------------- 1 | Qt 6.0.0 is a new major version release of Qt. It is not binary compatible with 2 | earlier Qt releases. 3 | 4 | The goal has been to retain as much source compatibility with Qt 5.15 as 5 | possible, but some changes were inevitable to make Qt a better framework. 6 | 7 | To make it easier to port to Qt 6.0, we have created a porting guide to 8 | summarize those changes and provide guidance to handle them. In the guide, you 9 | can find links to articles about changes that may affect your application and 10 | help you transition from Qt 5.15 to Qt 6.0: 11 | 12 | https://doc.qt.io/qt-6/portingguide.html 13 | 14 | For more details refer to the online documentation of Qt 6.0: 15 | 16 | https://doc.qt.io/qt-6/index.html 17 | 18 | -------------------------------------------------------------------------------- /tests/auto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For now, don't built auto tests when QT_BUILD_MINIMAL_STATIC_TEST 2 | # is specified and the build is targeting iOS. QT_BUILD_MINIMAL_STATIC_TEST is used in our CI. 3 | # Regular non-cmake build tests shouldn't be built because the CI will try to run them and fail 4 | # due to missing simulator support. 5 | if(IOS AND QT_BUILD_MINIMAL_STATIC_TESTS) 6 | return() 7 | endif() 8 | 9 | add_subdirectory(qshaderbaker) 10 | add_subdirectory(buildtimeqsb) 11 | 12 | _qt_internal_check_depfile_support(has_depfile_support) 13 | if(has_depfile_support AND NOT CMAKE_CROSSCOMPILING) 14 | # The test is disabled for cross-compiling platforms since we cannot embed the test results. 15 | add_subdirectory(qsbdepfiles) 16 | endif() 17 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color_hlsl_msl_only.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | #if QSHADER_SPIRV || QSHADER_GLSL || QSHADER_GLSL_ES 17 | wrong 18 | #endif 19 | 20 | #if QSHADER_HLSL || QSHADER_MSL 21 | 22 | #if QSHADER_HLSL_VERSION == 50 || QSHADER_MSL_VERSION == 12 23 | v_color = color; 24 | gl_Position = ubuf.mvp * position; 25 | #else 26 | version macros broken 27 | #endif 28 | 29 | #else 30 | something is broken 31 | #endif 32 | } 33 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/imageloadstore.comp: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout ( local_size_x = 1, local_size_y = 1, local_size_z = 1 ) in; 4 | 5 | layout ( r32f, binding = 0 ) uniform image2D image; 6 | layout ( r32f, binding = 1 ) writeonly uniform image2D imageWriteOnly; 7 | layout ( r32f, binding = 2 ) readonly uniform image2D imageReadOnly; 8 | layout ( r32f, binding = 3 ) readonly writeonly uniform image2D imageReadOnlyWriteOnly; 9 | 10 | void main() 11 | { 12 | imageLoad(image, ivec2(gl_GlobalInvocationID.xy)); 13 | imageStore(image, ivec2(gl_GlobalInvocationID.xy), vec4(0)); 14 | 15 | imageStore(imageWriteOnly, ivec2(gl_GlobalInvocationID.xy), vec4(0)); 16 | 17 | imageLoad(imageReadOnly, ivec2(gl_GlobalInvocationID.xy)); 18 | 19 | imageSize(imageReadOnlyWriteOnly); 20 | } 21 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["**"] 5 | precedence = "closest" 6 | SPDX-FileCopyrightText = ["Copyright (c) 2017, 2019 ARM Limited", 7 | "Copyright (c) 2002-2005 3 Dlabs Inc. Ltd.", 8 | "Copyright (c) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.", 9 | "Copyright (c) 2014-2018 Google, Inc.", 10 | "Copyright (c) 2002 NVIDIA Corporation", 11 | "Copyright (c) 2002-2010 The ANGLE Project", 12 | "Copyright (c) 2014-2019 The Khronos Group Inc."] 13 | SPDX-License-Identifier = "BSD-3-Clause AND LicenseRef-MIT-Khronos-old AND Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2 AND AML-glslang" 14 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess.tesc: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(vertices = 3) out; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor[]; 8 | 9 | // these serve no purpose, just exist to test per-patch outputs 10 | layout(location = 1) patch out vec3 stuff; 11 | layout(location = 2) patch out float more_stuff; 12 | 13 | void main() 14 | { 15 | if (gl_InvocationID == 0) { 16 | gl_TessLevelOuter[0] = 4.0; 17 | gl_TessLevelOuter[1] = 4.0; 18 | gl_TessLevelOuter[2] = 4.0; 19 | 20 | gl_TessLevelInner[0] = 4.0; 21 | } 22 | 23 | gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 24 | outColor[gl_InvocationID] = inColor[gl_InvocationID]; 25 | stuff = vec3(1.0); 26 | more_stuff = 1.0; 27 | } 28 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/tess.tesc: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(vertices = 3) out; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor[]; 8 | 9 | // these serve no purpose, just exist to test per-patch outputs 10 | layout(location = 1) patch out vec3 stuff; 11 | layout(location = 2) patch out float more_stuff; 12 | 13 | void main() 14 | { 15 | if (gl_InvocationID == 0) { 16 | gl_TessLevelOuter[0] = 4.0; 17 | gl_TessLevelOuter[1] = 4.0; 18 | gl_TessLevelOuter[2] = 4.0; 19 | 20 | gl_TessLevelInner[0] = 4.0; 21 | } 22 | 23 | gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 24 | outColor[gl_InvocationID] = inColor[gl_InvocationID]; 25 | stuff = vec3(1.0); 26 | more_stuff = 1.0; 27 | } 28 | -------------------------------------------------------------------------------- /tests/playground/tessellation/per_patch_output.tese: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles, fractional_odd_spacing, ccw) in; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 1) patch in vec3 stuff; 8 | layout(location = 2) patch in float more_stuff; 9 | 10 | layout(location = 0) out vec3 outColor; 11 | 12 | layout(std140, binding = 0) uniform buf { 13 | mat4 mvp; 14 | float time; 15 | float amplitude; 16 | }; 17 | 18 | void main() 19 | { 20 | gl_Position = mvp * ((gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position)); 21 | gl_Position.x += sin(time + gl_Position.y) * amplitude * more_stuff * stuff.y; 22 | outColor = gl_TessCoord.x * inColor[0] + gl_TessCoord.y * inColor[1] + gl_TessCoord.z * inColor[2]; 23 | } 24 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0006-Undefine_restrict_keyword.patch: -------------------------------------------------------------------------------- 1 | From d895b6b871947baa82c21838bee6e3f5803aaa5b Mon Sep 17 00:00:00 2001 2 | From: Krzysztof Sommerfeld 3 | Date: Thu, 10 Aug 2023 11:28:32 +0200 4 | Subject: [PATCH] Undefine 'restrict' keyword 5 | 6 | Task-number: QTBUG-115777 7 | Change-Id: Ib06b0b9b2c41be99db0be61fa233c16fcf910565 8 | --- 9 | 10 | diff --git a/src/3rdparty/glslang/glslang/Include/Types.h b/src/3rdparty/glslang/glslang/Include/Types.h 11 | index 6e5ea06..6330354 100644 12 | --- a/src/3rdparty/glslang/glslang/Include/Types.h 13 | +++ b/src/3rdparty/glslang/glslang/Include/Types.h 14 | @@ -48,6 +48,10 @@ 15 | 16 | #include 17 | 18 | +#ifdef restrict 19 | +#undef restrict 20 | +#endif 21 | + 22 | namespace QtShaderTools { 23 | namespace glslang { 24 | 25 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/color_pertarget.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 color; 5 | layout(location = 0) out vec3 v_color; 6 | 7 | layout(std140, binding = 0) uniform buf { 8 | mat4 mvp; 9 | float opacity; 10 | } ubuf; 11 | 12 | out gl_PerVertex { vec4 gl_Position; }; 13 | 14 | void main() 15 | { 16 | // ensure that the manually defined macro still works 17 | #ifdef MY_MACRO 18 | #if MY_VALUE == 321 19 | v_color = color; 20 | #else 21 | broken MY_VALUE 22 | #endif 23 | #else 24 | broken MY_MACRO 25 | #endif 26 | 27 | // fail in non-per-target mode 28 | #if !defined(QSHADER_SPIRV) && !defined(QSHADER_GLSL) && !defined(QSHADER_HLSL) && !defined(QSHADER_MSL) 29 | macros not present?! 30 | #endif 31 | 32 | gl_Position = ubuf.mvp * position; 33 | } 34 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/qt_attribution.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": "spirvcross", 4 | "Name": "SPIRV-Cross", 5 | "QDocModule": "qtshadertools", 6 | "Description": "A practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.", 7 | "QtUsage": "Shader code generation.", 8 | 9 | "Homepage": "https://github.com/KhronosGroup/SPIRV-Cross", 10 | "PURL": [ 11 | "pkg:github/KhronosGroup/SPIRV-Cross@$" 12 | ], 13 | "Comment": "No relevant CPE found", 14 | "Version": "1a69a919fa302e92b337594bd0a8aaea61037d91", 15 | "License": "Apache License 2.0 and MIT Khronos - old variant", 16 | "LicenseId": "Apache-2.0 AND LicenseRef-MIT-Khronos-old", 17 | "CopyrightFile": "COPYRIGHT.txt" 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /src/shadertools/qshaderrewriter_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QSHADERREWRITER_P_H 5 | #define QSHADERREWRITER_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists for the convenience 12 | // of a number of Qt sources files. This header file may change from 13 | // version to version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | namespace QShaderRewriter { 24 | void debugTokenizer(const QByteArray &input); 25 | QByteArray addZAdjustment(const QByteArray &input, int vertexInputLocation); 26 | } 27 | 28 | QT_END_NAMESPACE 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /tests/playground/arrays_of_samplers.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 4) uniform sampler2D tex1; 8 | layout(binding = 8) uniform sampler2D shadowMaps[4]; 9 | layout(binding = 9) uniform samplerCube shadowCubes[4]; 10 | layout(binding = 10) uniform sampler2D tex2; 11 | 12 | void main() 13 | { 14 | fragColor = texture(tex1, v_texcoord) * texture(tex2, v_texcoord) 15 | * texture(shadowMaps[0], v_texcoord) 16 | * texture(shadowMaps[1], v_texcoord) 17 | * texture(shadowMaps[2], v_texcoord) 18 | * texture(shadowMaps[3], v_texcoord) 19 | * texture(shadowCubes[0], vec3(v_texcoord, 0.0)) 20 | * texture(shadowCubes[1], vec3(v_texcoord, 0.0)) 21 | * texture(shadowCubes[2], vec3(v_texcoord, 0.0)) 22 | * texture(shadowCubes[3], vec3(v_texcoord, 0.0)); 23 | } 24 | -------------------------------------------------------------------------------- /tests/playground/multiview.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | #extension GL_EXT_multiview : require 3 | 4 | // For HLSL, Shader Model 6.1 or higher is needed to transpile this. 5 | // 6 | // For OpenGL we'd need layout(num_views = 2) in; but that's not a thing with 7 | // Vulkan so will rather rely on QShaderBaker/qsb passing the view count to 8 | // SPIRV-Cross which then inserts the num_views line to the OpenGL-targeted GLSL 9 | // code. To do this, run qsb with --view-count 2 10 | // 11 | // Metal is currently unknown. It probably needs some additional options in the 12 | // shader pipeline. Running with --msl 12 succeeds but the generated MSL code is 13 | // not multiview-capable. To be investigated. 14 | 15 | layout(location = 0) in vec4 pos; 16 | 17 | layout(std140, binding = 0) uniform buf 18 | { 19 | mat4 mvp[2]; 20 | }; 21 | 22 | void main() 23 | { 24 | gl_Position = mvp[gl_ViewIndex] * pos; 25 | } 26 | -------------------------------------------------------------------------------- /tests/playground/sampler_arrays.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 4) uniform sampler2D tex1; 8 | layout(binding = 8) uniform sampler2DArray shadowMaps; 9 | layout(binding = 9) uniform samplerCubeArray shadowCubes; 10 | layout(binding = 10) uniform sampler2D tex2; 11 | 12 | void main() 13 | { 14 | fragColor = texture(tex1, v_texcoord) * texture(tex2, v_texcoord) 15 | * texture(shadowMaps, vec3(v_texcoord, 0.0)) 16 | * texture(shadowMaps, vec3(v_texcoord, 1.0)) 17 | * texture(shadowMaps, vec3(v_texcoord, 2.0)) 18 | * texture(shadowMaps, vec3(v_texcoord, 3.0)) 19 | * texture(shadowCubes, vec4(v_texcoord, 0.0, 0.0)) 20 | * texture(shadowCubes, vec4(v_texcoord, 0.0, 1.0)) 21 | * texture(shadowCubes, vec4(v_texcoord, 0.0, 2.0)) 22 | * texture(shadowCubes, vec4(v_texcoord, 0.0, 3.0)); 23 | } 24 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/arrays_of_samplers.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 4) uniform sampler2D tex1; 8 | layout(binding = 8) uniform sampler2D shadowMaps[4]; // array of textures 9 | layout(binding = 9) uniform samplerCube shadowCubes[4]; // array of cubemap textures 10 | layout(binding = 10) uniform sampler2DArray texArr; // texture array 11 | 12 | void main() 13 | { 14 | fragColor = texture(tex1, v_texcoord) * texture(texArr, vec3(v_texcoord, 0.0)) 15 | * texture(shadowMaps[0], v_texcoord) 16 | * texture(shadowMaps[1], v_texcoord) 17 | * texture(shadowMaps[2], v_texcoord) 18 | * texture(shadowMaps[3], v_texcoord) 19 | * texture(shadowCubes[0], vec3(v_texcoord, 0.0)) 20 | * texture(shadowCubes[1], vec3(v_texcoord, 0.0)) 21 | * texture(shadowCubes[2], vec3(v_texcoord, 0.0)) 22 | * texture(shadowCubes[3], vec3(v_texcoord, 0.0)); 23 | } 24 | -------------------------------------------------------------------------------- /tools/qsb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from qsb.pro. 5 | 6 | ##################################################################### 7 | ## qsb Tool: 8 | ##################################################################### 9 | 10 | qt_get_tool_target_name(target_name qsb) 11 | qt_internal_add_tool(${target_name} 12 | TOOLS_TARGET # special case 13 | ShaderTools # special case 14 | SOURCES 15 | qsb.cpp 16 | LIBRARIES 17 | Qt::Gui 18 | Qt::GuiPrivate 19 | Qt::ShaderToolsPrivate 20 | EXTRA_CMAKE_FILES 21 | "${CMAKE_CURRENT_SOURCE_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}ShaderToolsMacros.cmake" 22 | EXTRA_CMAKE_INCLUDES 23 | "${QT_CMAKE_EXPORT_NAMESPACE}ShaderToolsMacros.cmake" 24 | ) 25 | qt_internal_return_unless_building_tools() 26 | 27 | #### Keys ignored in scope 1:.:.:qsb.pro:: 28 | # _REQUIREMENTS = "qtConfig(process)" 29 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0001-glslang-Fix-build-on-INTEGRITY.patch: -------------------------------------------------------------------------------- 1 | From df904c457ac271530c522bcafce4d27e36d54e55 Mon Sep 17 00:00:00 2001 2 | From: Laszlo Agocs 3 | Date: Fri, 25 Aug 2023 15:30:52 +0200 4 | Subject: [PATCH] glslang: Fix build on INTEGRITY 5 | 6 | Change-Id: I81b03f27d14613e3aa2a6ff721f90c4d893c0565 7 | --- 8 | src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp b/src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp 12 | index fbb51f7..3348bf8 100644 13 | --- a/src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp 14 | +++ b/src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp 15 | @@ -39,7 +39,7 @@ 16 | 17 | #include 18 | 19 | -#if !defined(__Fuchsia__) 20 | +#if !defined(__Fuchsia__) && !defined(__ghs__) 21 | #include 22 | #endif 23 | 24 | -- 25 | 2.36.1.windows.1 26 | 27 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/qt_attribution.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": "glslang", 4 | "Name": "glslang", 5 | "QDocModule": "qtshadertools", 6 | "Description": "An OpenGL and OpenGL ES shader front end and validator.", 7 | "QtUsage": "Compile GLSL to SPIR-V.", 8 | 9 | "Homepage": "https://github.com/KhronosGroup/glslang", 10 | "PURL": [ 11 | "pkg:github/KhronosGroup/glslang@$" 12 | ], 13 | "Comment": "No relevant CPE found", 14 | "Version": "15.1.0", 15 | "License": "BSD 3-Clause \"New\" or \"Revised\" License, and MIT Khronos - old variant, and Apache License 2.0, and GNU General Public License v3.0 or later with Bison exception 2.2, and AML glslang variant License", 16 | "LicenseId": "BSD-3-Clause AND LicenseRef-MIT-Khronos-old AND Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2 AND AML-glslang", 17 | "LicenseFile": "LICENSE.txt", 18 | "CopyrightFile": "COPYRIGHT.txt" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /tests/playground/manyresources.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform sampler2D tex; 8 | layout(binding = 2) uniform sampler2D tex2; 9 | layout(binding = 3) uniform sampler2D tex3; 10 | 11 | layout (binding = 4, rgba8) uniform readonly image2D image0; 12 | layout (binding = 5, rgba8) uniform writeonly image2D image1; 13 | 14 | layout(std140, binding = 10) buffer storageBuf { 15 | vec4 whatever; 16 | } buf; 17 | 18 | layout(std140, binding = 11) uniform buf { 19 | mat4 mvp; 20 | } ubuf; 21 | 22 | layout(std140, binding = 12) uniform buf2 { 23 | float f; 24 | } ubuf2; 25 | 26 | void main() 27 | { 28 | vec4 c = texture(tex, v_texcoord) * texture(tex2, v_texcoord) * texture(tex3, v_texcoord); 29 | c = ubuf.mvp * c; 30 | c *= ubuf2.f; 31 | c *= buf.whatever; 32 | c += imageLoad(image0, ivec2(0, 0)); 33 | imageStore(image1, ivec2(0, 0), c); 34 | fragColor = c; 35 | } 36 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/manyresources.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec2 v_texcoord; 4 | 5 | layout(location = 0) out vec4 fragColor; 6 | 7 | layout(binding = 1) uniform sampler2D tex; 8 | layout(binding = 2) uniform sampler2D tex2; 9 | layout(binding = 3) uniform sampler2D tex3; 10 | 11 | layout (binding = 4, rgba8) uniform readonly image2D image0; 12 | layout (binding = 5, rgba8) uniform writeonly image2D image1; 13 | 14 | layout(std140, binding = 10) buffer storageBuf { 15 | vec4 whatever; 16 | } buf; 17 | 18 | layout(std140, binding = 11) uniform buf { 19 | mat4 mvp; 20 | } ubuf; 21 | 22 | layout(std140, binding = 12) uniform buf2 { 23 | float f; 24 | } ubuf2; 25 | 26 | void main() 27 | { 28 | vec4 c = texture(tex, v_texcoord) * texture(tex2, v_texcoord) * texture(tex3, v_texcoord); 29 | c = ubuf.mvp * c; 30 | c *= ubuf2.f; 31 | c *= buf.whatever; 32 | c += imageLoad(image0, ivec2(0, 0)); 33 | imageStore(image1, ivec2(0, 0), c); 34 | fragColor = c; 35 | } 36 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0004-Fix-build-with-gcc-13.patch: -------------------------------------------------------------------------------- 1 | From 08881a072f210746ea4edf904fd4902d588e49f5 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= 3 | Date: Mon, 1 May 2023 20:28:05 +0200 4 | Subject: [PATCH] Fix build with gcc 13 5 | 6 | Change-Id: Ib2a9d2e9590be01ce62da8e9476a06e1031f4b6e 7 | --- 8 | src/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/src/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h b/src/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h 12 | index c43972f..a1f27dd 100644 13 | --- a/src/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h 14 | +++ b/src/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h 15 | @@ -68,6 +68,7 @@ 16 | #include "../Include/Common.h" 17 | #include "../Include/intermediate.h" 18 | #include "../Include/InfoSink.h" 19 | +#include 20 | 21 | namespace QtShaderTools { 22 | namespace glslang { 23 | -- 24 | 2.40.1 25 | 26 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from qshaderbaker.pro. 5 | 6 | ##################################################################### 7 | ## tst_qshaderbaker Test: 8 | ##################################################################### 9 | 10 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 11 | cmake_minimum_required(VERSION 3.16) 12 | project(tst_qshaderbaker LANGUAGES CXX) 13 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 14 | endif() 15 | 16 | qt_internal_add_test(tst_qshaderbaker 17 | SOURCES 18 | tst_qshaderbaker.cpp 19 | LIBRARIES 20 | Qt::Gui 21 | Qt::GuiPrivate 22 | Qt::ShaderToolsPrivate 23 | ) 24 | 25 | # Resources: 26 | set(qshaderbaker_resource_files 27 | "data" 28 | ) 29 | 30 | qt_internal_add_resource(tst_qshaderbaker "qshaderbaker" 31 | PREFIX 32 | "/" 33 | FILES 34 | ${qshaderbaker_resource_files} 35 | ) 36 | 37 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess_hull.hlsl: -------------------------------------------------------------------------------- 1 | struct Input 2 | { 3 | float3 color : TEXCOORD0; 4 | float4 position : SV_Position; 5 | }; 6 | 7 | struct Output 8 | { 9 | float3 position : POSITION; 10 | float3 color : COLOR; 11 | }; 12 | 13 | struct ConstantData 14 | { 15 | float edges[3] : SV_TessFactor; 16 | float inside : SV_InsideTessFactor; 17 | }; 18 | 19 | ConstantData patchConstFunc(InputPatch ip, uint PatchID : SV_PrimitiveID ) 20 | { 21 | ConstantData d; 22 | d.edges[0] = 4.0; 23 | d.edges[1] = 4.0; 24 | d.edges[2] = 4.0; 25 | d.inside = 4.0; 26 | return d; 27 | } 28 | 29 | [domain("tri")] 30 | [partitioning("integer")] 31 | [outputtopology("triangle_cw")] 32 | [outputcontrolpoints(3)] 33 | [patchconstantfunc("patchConstFunc")] 34 | Output main(InputPatch patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) 35 | { 36 | Output output; 37 | output.position = patch[pointId].position; 38 | output.color = patch[pointId].color; 39 | return output; 40 | } 41 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/tess.tese: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles, fractional_odd_spacing, ccw) in; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor; 8 | 9 | // these serve no purpose, just exist to test per-patch outputs 10 | layout(location = 1) patch in vec3 stuff; 11 | layout(location = 2) patch in float more_stuff; 12 | 13 | layout(std140, binding = 0) uniform buf { 14 | mat4 mvp; 15 | float time; 16 | float amplitude; 17 | }; 18 | 19 | void main() 20 | { 21 | gl_Position = mvp * ((gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position)); 22 | gl_Position.x += sin(time + gl_Position.y) * amplitude; 23 | outColor = gl_TessCoord.x * inColor[0] + gl_TessCoord.y * inColor[1] + gl_TessCoord.z * inColor[2] 24 | // these are all 1.0, just here to exercise the shader generation and the runtime pipeline setup 25 | * stuff.x * more_stuff * (gl_TessLevelOuter[0] / 4.0) * (gl_TessLevelInner[0] / 4.0); 26 | } 27 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess.tese: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles, fractional_odd_spacing, ccw) in; 4 | 5 | layout(location = 0) in vec3 inColor[]; 6 | 7 | layout(location = 0) out vec3 outColor; 8 | 9 | // these serve no purpose, just exist to test per-patch outputs 10 | layout(location = 1) patch in vec3 stuff; 11 | layout(location = 2) patch in float more_stuff; 12 | 13 | layout(std140, binding = 0) uniform buf { 14 | mat4 mvp; 15 | float time; 16 | float amplitude; 17 | }; 18 | 19 | void main() 20 | { 21 | vec4 pos = (gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position); 22 | gl_Position = mvp * pos; 23 | gl_Position.x += sin(time + pos.y) * amplitude; 24 | outColor = gl_TessCoord.x * inColor[0] + gl_TessCoord.y * inColor[1] + gl_TessCoord.z * inColor[2] 25 | // these are all 1.0, just here to exercise the shader generation and the runtime pipeline setup 26 | * stuff.x * more_stuff * (gl_TessLevelOuter[0] / 4.0) * (gl_TessLevelInner[0] / 4.0); 27 | } 28 | -------------------------------------------------------------------------------- /LICENSES/Qt-GPL-exception-1.0.txt: -------------------------------------------------------------------------------- 1 | The Qt Company GPL Exception 1.0 2 | 3 | Exception 1: 4 | 5 | As a special exception you may create a larger work which contains the 6 | output of this application and distribute that work under terms of your 7 | choice, so long as the work is not otherwise derived from or based on 8 | this application and so long as the work does not in itself generate 9 | output that contains the output from this application in its original 10 | or modified form. 11 | 12 | Exception 2: 13 | 14 | As a special exception, you have permission to combine this application 15 | with Plugins licensed under the terms of your choice, to produce an 16 | executable, and to copy and distribute the resulting executable under 17 | the terms of your choice. However, the executable must be accompanied 18 | by a prominent notice offering all users of the executable the entire 19 | source code to this application, excluding the source code of the 20 | independent modules, but including any changes you have made to this 21 | application, under the terms of this license. 22 | 23 | -------------------------------------------------------------------------------- /tests/playground/color_phong.vert: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec4 position; 4 | layout(location = 1) in vec3 normal; 5 | 6 | // Instanced attributes to variate the translation of the model and the diffuse 7 | // color of the material. 8 | layout(location = 2) in vec3 instTranslate; 9 | layout(location = 3) in vec3 instDiffuseAdjust; 10 | 11 | out gl_PerVertex { vec4 gl_Position; }; 12 | layout(location = 0) out vec3 vECVertNormal; 13 | layout(location = 1) out vec3 vECVertPos; 14 | layout(location = 2) flat out vec3 vDiffuseAdjust; 15 | 16 | layout(std140, binding = 0) uniform buf { 17 | mat4 vp; 18 | mat4 model; 19 | mat3 modelNormal; 20 | } ubuf; 21 | 22 | void main() 23 | { 24 | vECVertNormal = normalize(ubuf.modelNormal * normal); 25 | mat4 t = mat4(1, 0, 0, 0, 26 | 0, 1, 0, 0, 27 | 0, 0, 1, 0, 28 | instTranslate.x, instTranslate.y, instTranslate.z, 1); 29 | vECVertPos = vec3(t * ubuf.model * position); 30 | vDiffuseAdjust = instDiffuseAdjust; 31 | gl_Position = ubuf.vp * t * ubuf.model * position; 32 | } 33 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 The Khronos Group Inc. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | TARGET := spirv-cross 5 | 6 | SOURCES := $(wildcard spirv_*.cpp) 7 | CLI_SOURCES := main.cpp 8 | 9 | OBJECTS := $(SOURCES:.cpp=.o) 10 | CLI_OBJECTS := $(CLI_SOURCES:.cpp=.o) 11 | 12 | STATIC_LIB := lib$(TARGET).a 13 | 14 | DEPS := $(OBJECTS:.o=.d) $(CLI_OBJECTS:.o=.d) 15 | 16 | CXXFLAGS += -std=c++11 -Wall -Wextra -Wshadow -Wno-deprecated-declarations 17 | 18 | ifeq ($(DEBUG), 1) 19 | CXXFLAGS += -O0 -g 20 | else 21 | CXXFLAGS += -O2 -DNDEBUG 22 | endif 23 | 24 | ifeq ($(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS), 1) 25 | CXXFLAGS += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS -fno-exceptions 26 | endif 27 | 28 | all: $(TARGET) 29 | 30 | -include $(DEPS) 31 | 32 | $(TARGET): $(CLI_OBJECTS) $(STATIC_LIB) 33 | $(CXX) -o $@ $(CLI_OBJECTS) $(STATIC_LIB) $(LDFLAGS) 34 | 35 | $(STATIC_LIB): $(OBJECTS) 36 | $(AR) rcs $@ $(OBJECTS) 37 | 38 | %.o: %.cpp 39 | $(CXX) -c -o $@ $< $(CXXFLAGS) -MMD 40 | 41 | clean: 42 | rm -f $(TARGET) $(OBJECTS) $(CLI_OBJECTS) $(STATIC_LIB) $(DEPS) 43 | 44 | .PHONY: clean 45 | -------------------------------------------------------------------------------- /src/shadertools/qspirvshaderremap_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QSPIRVSHADERREMAP_P_H 5 | #define QSPIRVSHADERREMAP_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists for the convenience 12 | // of a number of Qt sources files. This header file may change from 13 | // version to version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | #include "qspirvshader_p.h" 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Q_SHADERTOOLS_EXPORT QSpirvShaderRemapper 24 | { 25 | public: 26 | QByteArray remap(const QByteArray &ir, QSpirvShader::RemapFlags flags); 27 | QString errorMessage() const { return remapErrorMsg; } 28 | 29 | private: 30 | void remapErrorHandler(const std::string &s); 31 | void remapLogHandler(const std::string &s); 32 | 33 | QString remapErrorMsg; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /tests/manual/qmlappshadermacro/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(contextinfo LANGUAGES CXX) 6 | 7 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 8 | 9 | set(CMAKE_AUTOMOC ON) 10 | set(CMAKE_AUTORCC ON) 11 | set(CMAKE_AUTOUIC ON) 12 | 13 | find_package(Qt6 COMPONENTS Core) 14 | find_package(Qt6 COMPONENTS Gui) 15 | find_package(Qt6 COMPONENTS Qml) 16 | find_package(Qt6 COMPONENTS Quick) 17 | find_package(Qt6 COMPONENTS ShaderTools) 18 | 19 | qt6_add_executable(qmlappshadermacro 20 | main.cpp 21 | ) 22 | target_link_libraries(qmlappshadermacro PUBLIC 23 | Qt::Core 24 | Qt::Gui 25 | Qt::Qml 26 | Qt::Quick 27 | ) 28 | 29 | set(qmlappshadermacro_resource_files 30 | "main.qml" 31 | ) 32 | 33 | qt6_add_resources(qmlappshadermacro "qmlappshadermacro" 34 | PREFIX 35 | "/" 36 | FILES 37 | ${qmlappshadermacro_resource_files} 38 | ) 39 | 40 | qt6_add_shaders(qmlappshadermacro "qmlappshadermacro_shaders" 41 | PREFIX 42 | "/" 43 | FILES 44 | "wobble.frag" 45 | ) 46 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0005-glslang-Replace-BOOL-with-ANOTHER_BOOL-define-for-VxWroks.patch: -------------------------------------------------------------------------------- 1 | From 6875f18b6a62168d3902efc9cee94991005f8ed5 Mon Sep 17 00:00:00 2001 2 | From: Krzysztof Sommerfeld 3 | Date: Thu, 10 Aug 2023 11:19:35 +0200 4 | Subject: [PATCH] Replace BOOL with ANOTHER_BOOL define for VxWroks 5 | 6 | Task-number: QTBUG-115777 7 | Change-Id: I0d8c8104306d822247f53a74733781bd9e209ae3 8 | --- 9 | src/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h | 3 +- 10 | 1 file changed, 3 insertion(+), 0 deletion(-) 11 | 12 | diff --git a/src/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/src/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h 13 | index 65d1b8e..6942a8e 100644 14 | --- a/src/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h 15 | +++ b/src/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h 16 | @@ -44,6 +44,9 @@ 17 | #if YYDEBUG 18 | extern int yydebug; 19 | #endif 20 | +#ifdef __VXWORKS__ 21 | +#define BOOL ANOTHER_BOOL // VxWorks has typedef BOOL 22 | +#endif 23 | 24 | /* Token kinds. */ 25 | #ifndef YYTOKENTYPE 26 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | MIT License 4 | 5 | Copyright (c) 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /tests/auto/buildtimeqsb/tess_domain.hlsl: -------------------------------------------------------------------------------- 1 | struct Input 2 | { 3 | float edges[3] : SV_TessFactor; 4 | float inside : SV_InsideTessFactor; 5 | }; 6 | 7 | struct PatchInput 8 | { 9 | float3 position : POSITION; 10 | float3 color : COLOR; 11 | }; 12 | 13 | struct PixelInput 14 | { 15 | float3 color : TEXCOORD0; 16 | float4 position : SV_POSITION; 17 | }; 18 | 19 | cbuffer buf : register(b0) 20 | { 21 | row_major float4x4 mvp : packoffset(c0); 22 | float time : packoffset(c4); 23 | float amplitude : packoffset(c4.y); 24 | }; 25 | 26 | [domain("tri")] 27 | PixelInput main(Input input, float3 uvwCoord : SV_DomainLocation, const OutputPatch patch) 28 | { 29 | PixelInput output; 30 | 31 | float3 vertexPosition = uvwCoord.x * patch[0].position + uvwCoord.y * patch[1].position + uvwCoord.z * patch[2].position; 32 | output.position = mul(float4(vertexPosition, 1.0f), mvp); 33 | output.position.x += sin(time + vertexPosition.y) * amplitude; 34 | 35 | output.color = uvwCoord.x * patch[0].color + uvwCoord.y * patch[1].color + uvwCoord.z * patch[2].color; 36 | 37 | return output; 38 | } 39 | -------------------------------------------------------------------------------- /coin/axivion/ci_config_linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "Project": { 3 | "BuildSystemIntegration": { 4 | "child_order": [ 5 | "GCCSetup", 6 | "CMake", 7 | "LinkLibraries" 8 | ] 9 | }, 10 | "CMake": { 11 | "_active": true, 12 | "_copy_from": "CMakeIntegration", 13 | "build_environment": {}, 14 | "build_options": "-j4", 15 | "generate_options": "--fresh", 16 | "generator": "Ninja" 17 | }, 18 | "GCCSetup": { 19 | "_active": true, 20 | "_copy_from": "Command", 21 | "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/" 22 | }, 23 | "LinkLibraries": { 24 | "_active": true, 25 | "_copy_from": "AxivionLinker", 26 | "input_files": [ 27 | "build/lib/lib*.so*.ir" 28 | ], 29 | "ir": "build/$(env:TESTED_MODULE_COIN).ir" 30 | } 31 | }, 32 | "_Format": "1.0", 33 | "_Version": "7.6.2", 34 | "_VersionNum": [ 35 | 7, 36 | 6, 37 | 2, 38 | 12725 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from qtshadertools.pro. 5 | 6 | cmake_minimum_required(VERSION 3.16) 7 | 8 | include(.cmake.conf) 9 | project(QtShaderTools 10 | VERSION "${QT_REPO_MODULE_VERSION}" 11 | DESCRIPTION "Qt ShaderTools Libraries" 12 | HOMEPAGE_URL "https://qt.io/" 13 | LANGUAGES CXX C 14 | ) 15 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals) # special case 16 | 17 | qt_internal_project_setup() 18 | 19 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED Core) 20 | find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui) 21 | 22 | if(INTEGRITY) 23 | add_compile_definitions(__inline=inline) 24 | endif() 25 | 26 | if(NOT TARGET Qt::Gui) 27 | message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.") 28 | return() 29 | endif() 30 | if(WATCHOS) 31 | message(NOTICE "Skipping the build as the condition \"NOT WATCHOS\" is not met.") 32 | return() 33 | endif() 34 | 35 | # Ensure macros are available when configuring tests in-tree with the Qt build 36 | include(tools/qsb/Qt6ShaderToolsMacros.cmake) 37 | 38 | qt_build_repo() 39 | -------------------------------------------------------------------------------- /src/3rdparty/patches/SPIRV-Cross/0003-Use-localeconv-for-VxWorks-instead-of-unavailable-nl_langinfo.patch: -------------------------------------------------------------------------------- 1 | From 38ded2f53221fc51d6802746820c06d5f1d7c21c Mon Sep 17 00:00:00 2001 2 | From: Krzysztof Sommerfeld 3 | Date: Thu, 10 Aug 2023 10:49:45 +0200 4 | Subject: [PATCH] Use localeconv for VxWorks instead of unavailable nl_langinfo 5 | 6 | Task-number: QTBUG-115777 7 | Change-Id: I4bb5c22b35928813aee9524706632f7db6995dca 8 | --- 9 | 10 | diff --git a/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp b/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 11 | index dc5aeb3..5dd601c 100644 12 | --- a/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 13 | +++ b/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 14 | @@ -178,7 +178,7 @@ 15 | const struct lconv *conv = localeconv(); 16 | if (conv && conv->decimal_point) 17 | current_locale_radix_character = *conv->decimal_point; 18 | -#elif defined(__ANDROID__) && __ANDROID_API__ < 26 || defined(__ghs__) || defined(__QNXNTO__) 19 | +#elif defined(__ANDROID__) && __ANDROID_API__ < 26 || defined(__ghs__) || defined(__QNXNTO__) || defined(__VXWORKS__) 20 | // nl_langinfo is not supported on this platform, fall back to the worse alternative. 21 | const struct lconv *conv = localeconv(); 22 | if (conv && conv->decimal_point) 23 | -------------------------------------------------------------------------------- /tests/playground/voxelize.geom: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles) in; 4 | layout(triangle_strip, max_vertices = 3) out; 5 | 6 | layout(location = 0) in vec2 v_texCoord[]; 7 | layout(location = 1) in vec3 v_worldPos[]; 8 | layout(location = 2) in vec3 v_normal[]; 9 | 10 | layout(location = 0) out vec2 g_texCoord; 11 | layout(location = 1) out vec3 g_worldPos; 12 | layout(location = 2) out vec3 g_normal; 13 | 14 | layout(std140, binding = 0) uniform buf { 15 | mat4 mvp; 16 | mat4 modelMatrix; 17 | vec3 voxelSpaceSize; 18 | }; 19 | 20 | void main() 21 | { 22 | const vec3 planeNormal = cross(v_worldPos[1] - v_worldPos[0], v_worldPos[2] - v_worldPos[0]); 23 | const vec3 p = abs(planeNormal); 24 | 25 | for (uint i = 0; i < 3; ++i) { 26 | g_texCoord = v_texCoord[i]; 27 | g_worldPos = v_worldPos[i]; 28 | g_normal = v_normal[i]; 29 | 30 | const vec3 pos = g_worldPos / voxelSpaceSize; 31 | if (p.z > p.x && p.z > p.y) 32 | gl_Position = vec4(pos.x, pos.y, 0.0, 1.0); 33 | else if (p.x > p.y && p.x > p.z) 34 | gl_Position = vec4(pos.y, pos.z, 0.0, 1.0); 35 | else 36 | gl_Position = vec4(pos.x, pos.z, 0.0, 1.0); 37 | 38 | EmitVertex(); 39 | } 40 | 41 | EndPrimitive(); 42 | } 43 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/voxelize.geom: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(triangles) in; 4 | layout(triangle_strip, max_vertices = 3) out; 5 | 6 | layout(location = 0) in vec2 v_texCoord[]; 7 | layout(location = 1) in vec3 v_worldPos[]; 8 | layout(location = 2) in vec3 v_normal[]; 9 | 10 | layout(location = 0) out vec2 g_texCoord; 11 | layout(location = 1) out vec3 g_worldPos; 12 | layout(location = 2) out vec3 g_normal; 13 | 14 | layout(std140, binding = 0) uniform buf { 15 | mat4 mvp; 16 | mat4 modelMatrix; 17 | vec3 voxelSpaceSize; 18 | }; 19 | 20 | void main() 21 | { 22 | const vec3 planeNormal = cross(v_worldPos[1] - v_worldPos[0], v_worldPos[2] - v_worldPos[0]); 23 | const vec3 p = abs(planeNormal); 24 | 25 | for (uint i = 0; i < 3; ++i) { 26 | g_texCoord = v_texCoord[i]; 27 | g_worldPos = v_worldPos[i]; 28 | g_normal = v_normal[i]; 29 | 30 | const vec3 pos = g_worldPos / voxelSpaceSize; 31 | if (p.z > p.x && p.z > p.y) 32 | gl_Position = vec4(pos.x, pos.y, 0.0, 1.0); 33 | else if (p.x > p.y && p.x > p.z) 34 | gl_Position = vec4(pos.y, pos.z, 0.0, 1.0); 35 | else 36 | gl_Position = vec4(pos.x, pos.z, 0.0, 1.0); 37 | 38 | EmitVertex(); 39 | } 40 | 41 | EndPrimitive(); 42 | } 43 | -------------------------------------------------------------------------------- /tests/playground/color_phong.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | layout(location = 2) flat in vec3 vDiffuseAdjust; 6 | 7 | layout(std140, binding = 1) uniform buf { 8 | vec3 ECCameraPosition; 9 | vec3 ka; 10 | vec3 kd; 11 | vec3 ks; 12 | // Have one light only for now. 13 | vec3 ECLightPosition; 14 | vec3 attenuation; 15 | vec3 color; 16 | float intensity; 17 | float specularExp; 18 | } ubuf; 19 | 20 | layout(location = 0) out vec4 fragColor; 21 | 22 | void main() 23 | { 24 | vec3 unnormL = ubuf.ECLightPosition - vECVertPos; 25 | float dist = length(unnormL); 26 | float att = 1.0 / (ubuf.attenuation.x + ubuf.attenuation.y * dist + ubuf.attenuation.z * dist * dist); 27 | 28 | vec3 N = normalize(vECVertNormal); 29 | vec3 L = normalize(unnormL); 30 | float NL = max(0.0, dot(N, L)); 31 | vec3 dColor = att * ubuf.intensity * ubuf.color * NL; 32 | 33 | vec3 R = reflect(-L, N); 34 | vec3 V = normalize(ubuf.ECCameraPosition - vECVertPos); 35 | float RV = max(0.0, dot(R, V)); 36 | vec3 sColor = att * ubuf.intensity * ubuf.color * pow(RV, ubuf.specularExp); 37 | 38 | fragColor = vec4(ubuf.ka + (ubuf.kd + vDiffuseAdjust) * dColor + ubuf.ks * sColor, 1.0); 39 | } 40 | -------------------------------------------------------------------------------- /src/SPIRV-Cross/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from SPIRV-Cross.pro. 5 | 6 | ##################################################################### 7 | ## BundledSpirv_Cross Generic Library: 8 | ##################################################################### 9 | 10 | qt_internal_add_3rdparty_library(BundledSpirv_Cross 11 | QMAKE_LIB_NAME spirv_cross 12 | SKIP_AUTOMOC 13 | STATIC 14 | EXCEPTIONS 15 | SOURCES 16 | ../3rdparty/SPIRV-Cross/spirv_cfg.cpp 17 | ../3rdparty/SPIRV-Cross/spirv_cpp.cpp 18 | ../3rdparty/SPIRV-Cross/spirv_cross.cpp 19 | ../3rdparty/SPIRV-Cross/spirv_cross_c.cpp 20 | ../3rdparty/SPIRV-Cross/spirv_cross_parsed_ir.cpp 21 | ../3rdparty/SPIRV-Cross/spirv_cross_util.cpp 22 | ../3rdparty/SPIRV-Cross/spirv_glsl.cpp 23 | ../3rdparty/SPIRV-Cross/spirv_hlsl.cpp 24 | ../3rdparty/SPIRV-Cross/spirv_msl.cpp 25 | ../3rdparty/SPIRV-Cross/spirv_parser.cpp 26 | ../3rdparty/SPIRV-Cross/spirv_reflect.cpp 27 | DEFINES 28 | SPIRV_CROSS_C_API_GLSL=1 29 | SPIRV_CROSS_C_API_HLSL=1 30 | SPIRV_CROSS_C_API_MSL=1 31 | ATTRIBUTION_FILE_DIR_PATHS 32 | ../3rdparty/SPIRV-Cross 33 | ) 34 | qt_disable_warnings(BundledSpirv_Cross) 35 | qt_set_symbol_visibility_hidden(BundledSpirv_Cross) 36 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-MIT-Khronos-old.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2020 The Khronos Group Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and/or associated documentation files (the "Materials"), 5 | to deal in the Materials without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Materials, and to permit persons to whom the 8 | Materials are furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Materials. 12 | 13 | MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 14 | STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 15 | HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 16 | 17 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS 23 | IN THE MATERIALS. 24 | -------------------------------------------------------------------------------- /tests/playground/visualize.geom: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(points) in; 4 | layout(triangle_strip, max_vertices = 14) out; 5 | 6 | layout(location = 0) in vec4 v_position[]; 7 | layout(location = 1) in vec4 v_color[]; 8 | 9 | layout(location = 0) out vec4 g_color; 10 | 11 | layout(std140, binding = 1) uniform buf { 12 | mat4 viewProjection; 13 | vec3 voxelSpaceSize; 14 | uint voxelGridSize; 15 | }; 16 | 17 | // 14 vertices, triangle strip, 0..1 18 | // See GPU Gems 3 Chapter 6 19 | vec3 createCube(uint vertex_id) 20 | { 21 | uint x = (0x287A >> vertex_id) & 1; 22 | uint y = (0x02AF >> vertex_id) & 1; 23 | uint z = (0x31E3 >> vertex_id) & 1; 24 | return vec3(uvec3(x, y, z)); 25 | } 26 | 27 | void main() 28 | { 29 | if (v_color[0].a > 0.0) { 30 | for (uint i = 0; i < 14; ++i) { 31 | g_color = v_color[0]; 32 | gl_Position = v_position[0]; 33 | gl_Position.xyz = (gl_Position.xyz / float(voxelGridSize)) * 2.0 - 1; // -1..1 34 | gl_Position.xyz *= voxelGridSize; // -64..64 35 | gl_Position.xyz += (createCube(i) - vec3(0.5)) * 2.0; 36 | 37 | vec3 worldSpaceUnitsPerVoxel = voxelSpaceSize / float(voxelGridSize); 38 | gl_Position.xyz *= worldSpaceUnitsPerVoxel; 39 | 40 | gl_Position = viewProjection * vec4(gl_Position.xyz, 1.0); 41 | 42 | EmitVertex(); 43 | } 44 | EndPrimitive(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/3rdparty/patches/SPIRV-Cross/0001-SPIRV-Cross-Fix-build-on-INTEGRITY-and-QNX.patch: -------------------------------------------------------------------------------- 1 | From edd047c552ad2e4b701dd38bc44eb6a0e732bfce Mon Sep 17 00:00:00 2001 2 | From: Laszlo Agocs 3 | Date: Fri, 25 Aug 2023 15:24:33 +0200 4 | Subject: [PATCH] SPIRV-Cross: Fix build on INTEGRITY and QNX 5 | 6 | Change-Id: I0fe75761952e64bba9a559ae9e78b9c94f1dec93 7 | --- 8 | src/3rdparty/SPIRV-Cross/spirv_glsl.cpp | 4 +++- 9 | 1 file changed, 3 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp b/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 12 | index 690bc9d..9d57d6d 100644 13 | --- a/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 14 | +++ b/src/3rdparty/SPIRV-Cross/spirv_glsl.cpp 15 | @@ -33,8 +33,10 @@ 16 | #include 17 | 18 | #ifndef _WIN32 19 | +#ifndef __ghs__ 20 | #include 21 | #endif 22 | +#endif 23 | #include 24 | 25 | using namespace spv; 26 | @@ -177,7 +179,7 @@ void CompilerGLSL::init() 27 | const struct lconv *conv = localeconv(); 28 | if (conv && conv->decimal_point) 29 | current_locale_radix_character = *conv->decimal_point; 30 | -#elif defined(__ANDROID__) && __ANDROID_API__ < 26 31 | +#elif defined(__ANDROID__) && __ANDROID_API__ < 26 || defined(__ghs__) || defined(__QNXNTO__) 32 | // nl_langinfo is not supported on this platform, fall back to the worse alternative. 33 | const struct lconv *conv = localeconv(); 34 | if (conv && conv->decimal_point) 35 | -- 36 | 2.36.1.windows.1 37 | 38 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) . 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /src/shadertools/doc/qtshadertools.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 2 | 3 | project = QtShaderTools 4 | description = Qt Shader Tools Reference Documentation 5 | version = $QT_VERSION 6 | 7 | qhp.projects = QtShaderTools 8 | 9 | qhp.QtShaderTools.file = qtshadertools.qhp 10 | qhp.QtShaderTools.namespace = org.qt-project.qtshadertools.$QT_VERSION_TAG 11 | qhp.QtShaderTools.virtualFolder = qtshadertools 12 | qhp.QtShaderTools.indexTitle = Qt Shader Tools 13 | qhp.QtShaderTools.indexRoot = 14 | 15 | qhp.QtShaderTools.subprojects = manual 16 | qhp.QtShaderTools.subprojects.manual.title = Qt Shader Tools 17 | qhp.QtShaderTools.subprojects.manual.indexTitle = Qt Shader Tools module topics 18 | qhp.QtShaderTools.subprojects.manual.type = manual 19 | 20 | tagfile = ../../../doc/qtshadertools/qtshadertools.tags 21 | 22 | depends += qtdoc qtcmake qmake qtcore qtgui qtquick 23 | 24 | headerdirs += .. 25 | 26 | sourcedirs += .. 27 | 28 | exampledirs += snippets 29 | 30 | imagedirs += images 31 | 32 | navigation.landingpage = "Qt Shader Tools" 33 | # Autogenerate navigation linking based on "Qt Shader Tools module topics": 34 | navigation.toctitles = "Qt Shader Tools module topics" 35 | navigation.toctitles.inclusive = false 36 | 37 | macro.cmakeoptionsince = "\n\nThis option was introduced in Qt \1.\n\n" 38 | 39 | # Allow zero warnings when testing documentation in CI 40 | warninglimit = 0 41 | -------------------------------------------------------------------------------- /tests/playground/hlsl_cbuf_error.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | layout(location = 2) flat in vec3 vDiffuseAdjust; 6 | 7 | #define MAX_LIGHTS 10 8 | 9 | struct Light { 10 | vec3 ECLightPosition; 11 | vec3 attenuation; 12 | vec3 color; 13 | float intensity; 14 | float specularExp; 15 | // this is not translatable to HLSL 16 | }; 17 | 18 | layout(std140, binding = 1) uniform buf { 19 | vec3 ECCameraPosition; 20 | vec3 ka; 21 | vec3 kd; 22 | vec3 ks; 23 | Light lights[MAX_LIGHTS]; 24 | int numLights; 25 | layout(row_major) mat3 mm; 26 | } ubuf; 27 | 28 | layout(location = 0) out vec4 fragColor; 29 | 30 | void main() 31 | { 32 | vec3 unnormL = ubuf.lights[0].ECLightPosition - vECVertPos; 33 | float dist = length(unnormL); 34 | float att = 1.0 / (ubuf.lights[0].attenuation.x + ubuf.lights[0].attenuation.y * dist + ubuf.lights[0].attenuation.z * dist * dist); 35 | 36 | vec3 N = normalize(vECVertNormal); 37 | vec3 L = normalize(unnormL); 38 | float NL = max(0.0, dot(N, L)); 39 | vec3 dColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * NL; 40 | 41 | vec3 R = reflect(-L, N); 42 | vec3 V = normalize(ubuf.ECCameraPosition - vECVertPos); 43 | float RV = max(0.0, dot(R, V)); 44 | vec3 sColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * pow(RV, ubuf.lights[0].specularExp); 45 | 46 | fragColor = vec4(ubuf.ka + (ubuf.kd + vDiffuseAdjust) * dColor + ubuf.ks * sColor, 1.0); 47 | } 48 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_cross_util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_UTIL_HPP 25 | #define SPIRV_CROSS_UTIL_HPP 26 | 27 | #include "spirv_cross.hpp" 28 | 29 | namespace spirv_cross_util 30 | { 31 | void rename_interface_variable(SPIRV_CROSS_NAMESPACE::Compiler &compiler, 32 | const SPIRV_CROSS_NAMESPACE::SmallVector &resources, 33 | uint32_t location, const std::string &name); 34 | void inherit_combined_sampler_bindings(SPIRV_CROSS_NAMESPACE::Compiler &compiler); 35 | } // namespace spirv_cross_util 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/hlsl_cbuf_error.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | layout(location = 2) flat in vec3 vDiffuseAdjust; 6 | 7 | #define MAX_LIGHTS 10 8 | 9 | struct Light { 10 | vec3 ECLightPosition; 11 | vec3 attenuation; 12 | vec3 color; 13 | float intensity; 14 | float specularExp; 15 | // this is not translatable to HLSL 16 | }; 17 | 18 | layout(std140, binding = 1) uniform buf { 19 | vec3 ECCameraPosition; 20 | vec3 ka; 21 | vec3 kd; 22 | vec3 ks; 23 | Light lights[MAX_LIGHTS]; 24 | int numLights; 25 | layout(row_major) mat3 mm; 26 | } ubuf; 27 | 28 | layout(location = 0) out vec4 fragColor; 29 | 30 | void main() 31 | { 32 | vec3 unnormL = ubuf.lights[0].ECLightPosition - vECVertPos; 33 | float dist = length(unnormL); 34 | float att = 1.0 / (ubuf.lights[0].attenuation.x + ubuf.lights[0].attenuation.y * dist + ubuf.lights[0].attenuation.z * dist * dist); 35 | 36 | vec3 N = normalize(vECVertNormal); 37 | vec3 L = normalize(unnormL); 38 | float NL = max(0.0, dot(N, L)); 39 | vec3 dColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * NL; 40 | 41 | vec3 R = reflect(-L, N); 42 | vec3 V = normalize(ubuf.ECCameraPosition - vECVertPos); 43 | float RV = max(0.0, dot(R, V)); 44 | vec3 sColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * pow(RV, ubuf.lights[0].specularExp); 45 | 46 | fragColor = vec4(ubuf.ka + (ubuf.kd + vDiffuseAdjust) * dColor + ubuf.ks * sColor, 1.0); 47 | } 48 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/storagebuffer.comp: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout ( local_size_x = 1, local_size_y = 1, local_size_z = 1 ) in; 4 | 5 | layout ( std430, binding = 0) buffer Buffer430 6 | { 7 | float _float[]; 8 | }buffer430; 9 | 10 | layout ( std140, binding = 1 ) coherent buffer Buffer140 11 | { 12 | float _float[]; 13 | }buffer140; 14 | 15 | layout ( std430, binding = 2 ) volatile writeonly buffer BufferWriteOnly430 16 | { 17 | vec2 _vec2[]; 18 | }bufferWriteOnly430; 19 | 20 | layout ( std140, binding = 3 ) restrict writeonly buffer BufferWriteOnly140 21 | { 22 | vec2 _vec2[]; 23 | }bufferWriteOnly140; 24 | 25 | layout ( std430, binding = 4 ) readonly buffer BufferReadOnly430 26 | { 27 | vec3 _vec3[]; 28 | }bufferReadOnly430; 29 | 30 | layout ( std140, binding = 5 ) coherent readonly buffer BufferReadOnly140 31 | { 32 | vec3 _vec3[]; 33 | }bufferReadOnly140; 34 | 35 | layout ( std430, binding = 6 ) volatile readonly writeonly buffer BufferReadOnlyWriteOnly430 36 | { 37 | vec4 _vec4[]; 38 | }bufferReadOnlyWriteOnly430; 39 | 40 | layout ( std140, binding = 7 ) restrict readonly writeonly buffer BufferReadOnlyWriteOnly140 41 | { 42 | vec4 _vec4[]; 43 | }bufferReadOnlyWriteOnly140; 44 | 45 | void main() 46 | { 47 | buffer430._float[0] = 0.0f; 48 | buffer140._float[1] = 1.0f; 49 | bufferWriteOnly430._vec2[0] = vec2(2.0f, 3.0f); 50 | bufferWriteOnly140._vec2[0] = vec2(4.0f, 5.0f); 51 | vec3 a = bufferReadOnly430._vec3[0]; 52 | vec3 b = bufferReadOnly140._vec3[0]; 53 | int c = bufferReadOnlyWriteOnly430._vec4.length(); 54 | int d = bufferReadOnlyWriteOnly140._vec4.length(); 55 | } 56 | -------------------------------------------------------------------------------- /src/shadertools/qspirvshaderremap.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qspirvshaderremap_p.h" 5 | 6 | #include 7 | 8 | QT_BEGIN_NAMESPACE 9 | 10 | void QSpirvShaderRemapper::remapErrorHandler(const std::string &s) 11 | { 12 | if (!remapErrorMsg.isEmpty()) 13 | remapErrorMsg.append(QLatin1Char('\n')); 14 | remapErrorMsg.append(QString::fromStdString(s)); 15 | } 16 | 17 | void QSpirvShaderRemapper::remapLogHandler(const std::string &) 18 | { 19 | } 20 | 21 | QByteArray QSpirvShaderRemapper::remap(const QByteArray &ir, QSpirvShader::RemapFlags flags) 22 | { 23 | if (ir.isEmpty()) 24 | return QByteArray(); 25 | 26 | remapErrorMsg.clear(); 27 | 28 | spv::spirvbin_t b; 29 | b.registerErrorHandler(std::bind(&QSpirvShaderRemapper::remapErrorHandler, this, std::placeholders::_1)); 30 | b.registerLogHandler(std::bind(&QSpirvShaderRemapper::remapLogHandler, this, std::placeholders::_1)); 31 | 32 | const uint32_t opts = flags.testFlag(QSpirvShader::RemapFlag::StripOnly) ? spv::spirvbin_t::STRIP 33 | : spv::spirvbin_t::DO_EVERYTHING; 34 | 35 | std::vector v; 36 | v.resize(ir.size() / 4); 37 | memcpy(v.data(), ir.constData(), v.size() * 4); 38 | 39 | b.remap(v, opts); 40 | 41 | if (!remapErrorMsg.isEmpty()) 42 | return QByteArray(); 43 | 44 | return QByteArray(reinterpret_cast(v.data()), int(v.size()) * 4); 45 | } 46 | 47 | QT_END_NAMESPACE 48 | -------------------------------------------------------------------------------- /tests/playground/array.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | layout(location = 2) flat in vec3 vDiffuseAdjust; 6 | 7 | #define MAX_LIGHTS 10 8 | 9 | struct Light { 10 | vec3 ECLightPosition; 11 | vec3 attenuation; 12 | vec3 color; 13 | float intensity; 14 | float specularExp; 15 | // two dummies so that it stays translatable to HLSL with packoffset in the top-level block 16 | float __dummy0; 17 | float __dummy1; 18 | }; 19 | 20 | layout(std140, binding = 1) uniform buf { 21 | vec3 ECCameraPosition; 22 | vec3 ka; 23 | vec3 kd; 24 | vec3 ks; 25 | Light lights[MAX_LIGHTS]; 26 | int numLights; 27 | layout(row_major) mat3 mm; 28 | } ubuf; 29 | 30 | layout(location = 0) out vec4 fragColor; 31 | 32 | void main() 33 | { 34 | vec3 unnormL = ubuf.lights[0].ECLightPosition - vECVertPos; 35 | float dist = length(unnormL); 36 | float att = 1.0 / (ubuf.lights[0].attenuation.x + ubuf.lights[0].attenuation.y * dist + ubuf.lights[0].attenuation.z * dist * dist); 37 | 38 | vec3 N = normalize(vECVertNormal); 39 | vec3 L = normalize(unnormL); 40 | float NL = max(0.0, dot(N, L)); 41 | vec3 dColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * NL; 42 | 43 | vec3 R = reflect(-L, N); 44 | vec3 V = normalize(ubuf.ECCameraPosition - vECVertPos); 45 | float RV = max(0.0, dot(R, V)); 46 | vec3 sColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * pow(RV, ubuf.lights[0].specularExp); 47 | 48 | fragColor = vec4(ubuf.ka + (ubuf.kd + vDiffuseAdjust) * dColor + ubuf.ks * sColor, 1.0); 49 | } 50 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/tst_qsbdepfiles.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | #include 4 | #include 5 | 6 | using namespace Qt::StringLiterals; 7 | 8 | class tst_qsbdepfiles : public QObject 9 | { 10 | Q_OBJECT 11 | private: 12 | void init(); 13 | private slots: 14 | void Depfiles_data(); 15 | void Depfiles(); 16 | }; 17 | 18 | void tst_qsbdepfiles::Depfiles_data() 19 | { 20 | QTest::addColumn("filename"); 21 | 22 | QTest::newRow("WithoutInclude") << "tst.frag.qsb.d"_L1; 23 | QTest::newRow("WithInclude") << "tstinclude.frag.qsb.d"_L1; 24 | QTest::newRow("WithWhitespaces") << "tstincludewhitespaces.frag.qsb.d"_L1; 25 | QTest::newRow("WithRelativeInclude") << "tstincluderelative.frag.qsb.d"_L1; 26 | QTest::newRow("WithComment") << "tstincludecomment.frag.qsb.d"_L1; 27 | } 28 | 29 | void tst_qsbdepfiles::Depfiles() 30 | { 31 | QFETCH(const QLatin1String, filename); 32 | QString resultFilePath = QFINDTESTDATA(QString(".qsb/shaders/%1").arg(filename)); 33 | QString expectedFilePath = QString(":/data/%1").arg(filename); 34 | 35 | QFile resultFile(resultFilePath); 36 | QFile expectedFile(expectedFilePath); 37 | 38 | QVERIFY(resultFile.open(QFile::ReadOnly)); 39 | QVERIFY(expectedFile.open(QFile::ReadOnly)); 40 | 41 | // We chop the one byte from expectedFile because of CMake issue. 42 | // See https://gitlab.kitware.com/cmake/cmake/-/issues/25164 43 | QVERIFY(resultFile.readAll() == expectedFile.readAll().chopped(1)); 44 | } 45 | 46 | QTEST_MAIN(tst_qsbdepfiles) 47 | 48 | #include "tst_qsbdepfiles.moc" 49 | -------------------------------------------------------------------------------- /tests/auto/qshaderbaker/data/array_of_struct_in_ubuf.frag: -------------------------------------------------------------------------------- 1 | #version 440 2 | 3 | layout(location = 0) in vec3 vECVertNormal; 4 | layout(location = 1) in vec3 vECVertPos; 5 | layout(location = 2) flat in vec3 vDiffuseAdjust; 6 | 7 | #define MAX_LIGHTS 10 8 | 9 | struct Light { 10 | // padding1, 2, and 3 ensures it stays translatable to HLSL with packoffset in the top-level block 11 | 12 | vec3 ECLightPosition; 13 | float padding1; 14 | vec3 attenuation; 15 | float padding2; 16 | vec3 color; 17 | float padding3; 18 | float intensity; 19 | float specularExp; 20 | }; 21 | 22 | layout(std140, binding = 1) uniform buf { 23 | vec3 ECCameraPosition; 24 | vec3 ka; 25 | vec3 kd; 26 | vec3 ks; 27 | Light lights[MAX_LIGHTS]; 28 | int numLights; 29 | layout(row_major) mat3 mm; 30 | } ubuf; 31 | 32 | layout(location = 0) out vec4 fragColor; 33 | 34 | void main() 35 | { 36 | vec3 unnormL = ubuf.lights[0].ECLightPosition - vECVertPos; 37 | float dist = length(unnormL); 38 | float att = 1.0 / (ubuf.lights[0].attenuation.x + ubuf.lights[0].attenuation.y * dist + ubuf.lights[0].attenuation.z * dist * dist); 39 | 40 | vec3 N = normalize(vECVertNormal); 41 | vec3 L = normalize(unnormL); 42 | float NL = max(0.0, dot(N, L)); 43 | vec3 dColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * NL; 44 | 45 | vec3 R = reflect(-L, N); 46 | vec3 V = normalize(ubuf.ECCameraPosition - vECVertPos); 47 | float RV = max(0.0, dot(R, V)); 48 | vec3 sColor = att * ubuf.lights[0].intensity * ubuf.lights[0].color * pow(RV, ubuf.lights[0].specularExp); 49 | 50 | fragColor = vec4(ubuf.ka + (ubuf.kd + vDiffuseAdjust) * dColor + ubuf.ks * sColor, 1.0); 51 | } 52 | -------------------------------------------------------------------------------- /tests/manual/qmlappshadermacro/main.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 2.15 5 | 6 | Item { 7 | Text { 8 | color: "#ffffff" 9 | style: Text.Outline 10 | styleColor: "#606060" 11 | font.pixelSize: 28 12 | property int api: GraphicsInfo.api 13 | text: { 14 | if (GraphicsInfo.api === GraphicsInfo.OpenGLRhi) 15 | "OpenGL on QRhi"; 16 | else if (GraphicsInfo.api === GraphicsInfo.Direct3D11Rhi) 17 | "D3D11 on QRhi"; 18 | else if (GraphicsInfo.api === GraphicsInfo.VulkanRhi) 19 | "Vulkan on QRhi"; 20 | else if (GraphicsInfo.api === GraphicsInfo.MetalRhi) 21 | "Metal on QRhi"; 22 | else if (GraphicsInfo.api === GraphicsInfo.Null) 23 | "Null on QRhi"; 24 | else 25 | "Unknown API"; 26 | } 27 | } 28 | 29 | Text { 30 | id: srcItem 31 | text: "Hello world" 32 | anchors.centerIn: parent 33 | color: "red" 34 | font.pixelSize: 40 35 | } 36 | 37 | ShaderEffectSource { 38 | id: src 39 | sourceItem: srcItem 40 | anchors.fill: srcItem 41 | hideSource: true 42 | visible: false 43 | } 44 | 45 | ShaderEffect { 46 | anchors.fill: src 47 | property variant source: src 48 | property real amplitude: 0.04 49 | property real frequency: 5 50 | property real time: 0 51 | NumberAnimation on time { from: 0; to: Math.PI * 2; duration: 600; loops: -1 } 52 | fragmentShader: "wobble.frag.qsb" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/GLSL.ext.ARM.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2022 ARM Limited 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 5 | ** of this software and/or associated documentation files (the "Materials"), 6 | ** to deal in the Materials without restriction, including without limitation 7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | ** and/or sell copies of the Materials, and to permit persons to whom the 9 | ** Materials are furnished to do so, subject to the following conditions: 10 | ** 11 | ** The above copyright notice and this permission notice shall be included in 12 | ** all copies or substantial portions of the Materials. 13 | ** 14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS 24 | ** IN THE MATERIALS. 25 | */ 26 | 27 | #ifndef GLSLextARM_H 28 | #define GLSLextARM_H 29 | 30 | static const int GLSLextARMVersion = 100; 31 | static const int GLSLextARMRevision = 1; 32 | 33 | static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins"; 34 | 35 | #endif // #ifndef GLSLextARM_H 36 | -------------------------------------------------------------------------------- /src/shadertools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | # Generated from shadertools.pro. 5 | 6 | ##################################################################### 7 | ## ShaderTools Module: 8 | ##################################################################### 9 | 10 | qt_internal_add_module(ShaderTools 11 | EXCEPTIONS 12 | SOURCES 13 | qshaderbaker.cpp qshaderbaker.h 14 | qshaderrewriter.cpp qshaderrewriter_p.h 15 | qspirvcompiler.cpp qspirvcompiler_p.h 16 | qspirvshader.cpp qspirvshader_p.h 17 | qspirvshaderremap.cpp qspirvshaderremap_p.h 18 | qtshadertoolsglobal.h 19 | qtshadertoolsglobal_p.h 20 | DEFINES 21 | QT_BUILD_SHADERTOOLS_LIB 22 | INCLUDE_DIRECTORIES 23 | ../3rdparty/SPIRV-Cross 24 | ../3rdparty/glslang 25 | LIBRARIES 26 | Qt::GuiPrivate 27 | # special case begin 28 | Qt::BundledSpirv_Cross 29 | Qt::BundledGlslang_Glslang 30 | Qt::BundledGlslang_Spirv 31 | Qt::BundledGlslang_Osdependent 32 | # special case end 33 | PUBLIC_LIBRARIES 34 | Qt::Core 35 | Qt::Gui 36 | PRIVATE_MODULE_INTERFACE 37 | Qt::GuiPrivate 38 | RHI_HEADER_FILTERS 39 | "(^|/)qshaderbaker\\.h$" 40 | ) 41 | 42 | ## Scopes: 43 | ##################################################################### 44 | 45 | #### Keys ignored in scope 2:.:.:shadertools.pro:NOT EXISTS _ss_[QT_HOST_DATA]/.qmake.cache: 46 | # LIBLOC = "$$shadowed($$dirname _QMAKE_CONF_)" "/lib" 47 | 48 | #### Keys ignored in scope 3:.:.:shadertools.pro:else: 49 | # LIBLOC = "$$[QT_HOST_LIBS]" 50 | qt_internal_add_docs(ShaderTools 51 | doc/qtshadertools.qdocconf 52 | ) 53 | 54 | -------------------------------------------------------------------------------- /src/shadertools/qspirvcompiler_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QSPIRVCOMPILER_P_H 5 | #define QSPIRVCOMPILER_P_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is not part of the Qt API. It exists for the convenience 12 | // of a number of Qt sources files. This header file may change from 13 | // version to version without notice, or even be removed. 14 | // 15 | // We mean it. 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | struct QSpirvCompilerPrivate; 25 | class QIODevice; 26 | 27 | class Q_SHADERTOOLS_EXPORT QSpirvCompiler 28 | { 29 | public: 30 | QSpirvCompiler(); 31 | ~QSpirvCompiler(); 32 | 33 | enum Flag { 34 | RewriteToMakeBatchableForSG = 0x01, 35 | FullDebugInfo = 0x02 36 | }; 37 | Q_DECLARE_FLAGS(Flags, Flag) 38 | 39 | void setSourceFileName(const QString &fileName); 40 | void setSourceFileName(const QString &fileName, QShader::Stage stage); 41 | void setSourceDevice(QIODevice *device, QShader::Stage stage, const QString &fileName = QString()); 42 | void setSourceString(const QByteArray &sourceString, QShader::Stage stage, const QString &fileName = QString()); 43 | void setFlags(Flags flags); 44 | void setPreamble(const QByteArray &preamble); 45 | void setSGBatchingVertexInputLocation(int location); 46 | 47 | QByteArray compileToSpirv(); 48 | QString errorMessage() const; 49 | 50 | private: 51 | Q_DISABLE_COPY(QSpirvCompiler) 52 | QSpirvCompilerPrivate *d = nullptr; 53 | }; 54 | 55 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSpirvCompiler::Flags) 56 | 57 | QT_END_NAMESPACE 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/updateGrammar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (C) 2020 The Khronos Group Inc. 4 | # 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 14 | # Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials provided 17 | # with the distribution. 18 | # 19 | # Neither the name of The Khronos Group Inc. nor the names of its 20 | # contributors may be used to endorse or promote products derived 21 | # from this software without specific prior written permission. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | # POSSIBILITY OF SUCH DAMAGE. 35 | 36 | bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp 37 | -------------------------------------------------------------------------------- /tests/auto/qsbdepfiles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) 5 | cmake_minimum_required(VERSION 3.16) 6 | project(tst_qsbdepfiles LANGUAGES CXX) 7 | find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) 8 | endif() 9 | 10 | qt_internal_add_test(tst_qsbdepfiles 11 | SOURCES 12 | tst_qsbdepfiles.cpp 13 | ) 14 | 15 | qt_add_shaders(tst_qsbdepfiles 16 | "shaders" 17 | PRECOMPILE 18 | OPTIMIZED 19 | PREFIX 20 | "/" 21 | FILES 22 | "shaders/tst.frag" 23 | "shaders/tstinclude.frag" 24 | "shaders/tstincluderelative.frag" 25 | "shaders/tstincludewhitespaces.frag" 26 | "shaders/tstincludecomment.frag" 27 | ) 28 | 29 | set(data_base_dir "${CMAKE_CURRENT_BINARY_DIR}/data") 30 | 31 | configure_file("data/tst.frag.qsb.d.in" 32 | "${data_base_dir}/tst.frag.qsb.d" NEWLINE_STYLE LF) 33 | configure_file("data/tstinclude.frag.qsb.d.in" 34 | "${data_base_dir}/tstinclude.frag.qsb.d" NEWLINE_STYLE LF) 35 | configure_file("data/tstincluderelative.frag.qsb.d.in" 36 | "${data_base_dir}/tstincluderelative.frag.qsb.d" NEWLINE_STYLE LF) 37 | configure_file("data/tstincludewhitespaces.frag.qsb.d.in" 38 | "${data_base_dir}/tstincludewhitespaces.frag.qsb.d" NEWLINE_STYLE LF) 39 | configure_file("data/tstincludecomment.frag.qsb.d.in" 40 | "${data_base_dir}/tstincludecomment.frag.qsb.d" NEWLINE_STYLE LF) 41 | 42 | qt_add_resources(tst_qsbdepfiles "tst_qsbdepfiles_data" 43 | PREFIX "/data" 44 | BASE "${data_base_dir}" 45 | FILES 46 | "${data_base_dir}/tst.frag.qsb.d" 47 | "${data_base_dir}/tstinclude.frag.qsb.d" 48 | "${data_base_dir}/tstincluderelative.frag.qsb.d" 49 | "${data_base_dir}/tstincludewhitespaces.frag.qsb.d" 50 | "${data_base_dir}/tstincludecomment.frag.qsb.d" 51 | ) 52 | 53 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/MachineIndependent/RemoveTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #pragma once 36 | 37 | namespace QtShaderTools { 38 | namespace glslang { 39 | 40 | void RemoveAllTreeNodes(TIntermNode*); 41 | 42 | } // end namespace glslang 43 | } // namespace QtShaderTools 44 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // Copyright (C) 2013-2016 LunarG, Inc. 4 | // Copyright (C) 2016-2020 Google, Inc. 5 | // Modifications Copyright(C) 2021 Advanced Micro Devices, Inc.All rights reserved. 6 | // 7 | // All rights reserved. 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above 17 | // copyright notice, this list of conditions and the following 18 | // disclaimer in the documentation and/or other materials provided 19 | // with the distribution. 20 | // 21 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 22 | // contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 28 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 30 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | // POSSIBILITY OF SUCH DAMAGE. 37 | // 38 | 39 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2021 The Khronos Group Inc. 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 5 | ** of this software and/or associated documentation files (the "Materials"), 6 | ** to deal in the Materials without restriction, including without limitation 7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | ** and/or sell copies of the Materials, and to permit persons to whom the 9 | ** Materials are furnished to do so, subject to the following conditions: 10 | ** 11 | ** The above copyright notice and this permission notice shall be included in 12 | ** all copies or substantial portions of the Materials. 13 | ** 14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS 24 | ** IN THE MATERIALS. 25 | */ 26 | 27 | #ifndef GLSLextQCOM_H 28 | #define GLSLextQCOM_H 29 | 30 | enum BuiltIn; 31 | enum Decoration; 32 | enum Op; 33 | enum Capability; 34 | 35 | static const int GLSLextQCOMVersion = 100; 36 | static const int GLSLextQCOMRevision = 1; 37 | 38 | //SPV_QCOM_image_processing 39 | const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing"; 40 | //SPV_QCOM_image_processing2 41 | const char* const E_SPV_QCOM_image_processing2 = "SPV_QCOM_image_processing2"; 42 | 43 | #endif // #ifndef GLSLextQCOM_H 44 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/OSDependent/osinclude.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #ifndef __OSINCLUDE_H 36 | #define __OSINCLUDE_H 37 | 38 | #include "../Include/visibility.h" 39 | namespace QtShaderTools { 40 | namespace glslang { 41 | 42 | GLSLANG_EXPORT void OS_DumpMemoryCounters(); 43 | 44 | } // end namespace glslang 45 | } // namespace QtShaderTools 46 | 47 | #endif // __OSINCLUDE_H 48 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/NonSemanticDebugPrintf.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Khronos Group Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and/or associated documentation files (the 5 | // "Materials"), to deal in the Materials without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Materials, and to 8 | // permit persons to whom the Materials are furnished to do so, subject to 9 | // the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Materials. 13 | // 14 | // MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS 15 | // KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS 16 | // SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT 17 | // https://www.khronos.org/registry/ 18 | // 19 | // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 26 | // 27 | 28 | #ifndef SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ 29 | #define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | enum { 36 | NonSemanticDebugPrintfRevision = 1, 37 | NonSemanticDebugPrintfRevision_BitWidthPadding = 0x7fffffff 38 | }; 39 | 40 | enum NonSemanticDebugPrintfInstructions { 41 | NonSemanticDebugPrintfDebugPrintf = 1, 42 | NonSemanticDebugPrintfInstructionsMax = 0x7fffffff 43 | }; 44 | 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif // SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ 51 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/Include/InitializeGlobals.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #ifndef __INITIALIZE_GLOBALS_INCLUDED_ 36 | #define __INITIALIZE_GLOBALS_INCLUDED_ 37 | 38 | namespace QtShaderTools { 39 | namespace glslang { 40 | 41 | inline bool InitializePoolIndex() { return true; } // DEPRECATED: No need to call 42 | 43 | } // end namespace glslang 44 | } // namespace QtShaderTools 45 | 46 | #endif // __INITIALIZE_GLOBALS_INCLUDED_ 47 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/MachineIndependent/pch.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCH_H 2 | #define _PCH_H 3 | // 4 | // Copyright (C) 2018 The Khronos Group Inc. 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions 9 | // are met: 10 | // 11 | // Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above 15 | // copyright notice, this list of conditions and the following 16 | // disclaimer in the documentation and/or other materials provided 17 | // with the distribution. 18 | // 19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 20 | // contributors may be used to endorse or promote products derived 21 | // from this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | // POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include "SymbolTable.h" 45 | #include "ParseHelper.h" 46 | #include "Scan.h" 47 | #include "ScanContext.h" 48 | 49 | #endif /* _PCH_H */ 50 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/HLSL/pch.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCH_H 2 | #define _PCH_H 3 | // 4 | // Copyright (C) 2018 The Khronos Group Inc. 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions 9 | // are met: 10 | // 11 | // Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above 15 | // copyright notice, this list of conditions and the following 16 | // disclaimer in the documentation and/or other materials provided 17 | // with the distribution. 18 | // 19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 20 | // contributors may be used to endorse or promote products derived 21 | // from this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | // POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | 37 | #include "hlslAttributes.h" 38 | #include "hlslGrammar.h" 39 | #include "hlslParseHelper.h" 40 | #include "hlslScanContext.h" 41 | 42 | #include "../MachineIndependent/Scan.h" 43 | #include "../MachineIndependent/preprocessor/PpContext.h" 44 | 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #endif /* _PCH_H */ 52 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/disassemble.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014-2015 LunarG, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | // 36 | // Disassembler for SPIR-V. 37 | // 38 | 39 | #pragma once 40 | #ifndef disassembler_H 41 | #define disassembler_H 42 | 43 | #include 44 | #include 45 | 46 | #include "glslang/Include/visibility.h" 47 | 48 | namespace spv { 49 | 50 | // disassemble with glslang custom disassembler 51 | GLSLANG_EXPORT void Disassemble(std::ostream& out, const std::vector&); 52 | 53 | } // end namespace spv 54 | 55 | #endif // disassembler_H 56 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0009-glslang-Fix-Workaround-crash-on-Android-arm64-v8a-in.patch: -------------------------------------------------------------------------------- 1 | From 1ee1724bf37f4ff78340e6bb342182ae195ff10e Mon Sep 17 00:00:00 2001 2 | From: Andy Nichols 3 | Date: Wed, 23 Oct 2024 09:10:08 +0200 4 | Subject: [PATCH] glslang: Fix/Workaround crash on Android (arm64-v8a) in debug 5 | mode 6 | 7 | When compiling shaders (GLSL->SPIRV) at runtime on Android (arm64-v8a) 8 | when targeting debug mode, we get a crash in the STL/C++ runtime code 9 | just based on the particular usage patched. By changing how this 10 | operation is performed, we can work around the triggered bug. This 11 | bug has already been reported upstream, and this workaround comes from 12 | that bug report. The fix was not applied upstream because they claim it 13 | is a bug in the Android NDK/runtime, and this is just a workaround, not 14 | a fix. That is fine for us though, we have many workaround patches. 15 | 16 | Change-Id: I44bdd148a85e3ede0924404aecfd7f0feeb16613 17 | --- 18 | src/3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 4 +++- 19 | 1 file changed, 3 insertions(+), 1 deletion(-) 20 | 21 | diff --git a/src/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/src/3rdparty/glslang/SPIRV/GlslangToSpv.cpp 22 | index 7ee26e9..adb16cd 100644 23 | --- a/src/3rdparty/glslang/SPIRV/GlslangToSpv.cpp 24 | +++ b/src/3rdparty/glslang/SPIRV/GlslangToSpv.cpp 25 | @@ -9343,7 +9343,9 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: 26 | // Use an extended instruction from the standard library. 27 | // Construct the call arguments, without modifying the original operands vector. 28 | // We might need the remaining arguments, e.g. in the EOpFrexp case. 29 | - std::vector callArguments(operands.begin(), operands.begin() + consumedOperands); 30 | + std::vector callArguments(consumedOperands); 31 | + for (size_t i = 0; i < consumedOperands; ++i) 32 | + callArguments[i] = operands[i]; 33 | id = builder.createBuiltinCall(typeId, extBuiltins >= 0 ? extBuiltins : stdBuiltins, libCall, callArguments); 34 | } else if (opCode == spv::OpDot && !isFloat) { 35 | // int dot(int, int) 36 | -- 37 | 2.39.5 (Apple Git-154) 38 | 39 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["tests/**.frag", "tests/**.vert", "tests/**.comp", "tests/**.tesc", 5 | "tests/**.glsl", "tests/**.tese", "tests/**.geom", "tests/**.hlsl", 6 | "**.inc", "**.spv"] 7 | precedence = "closest" 8 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 9 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" 10 | 11 | [[annotations]] 12 | path = ["**.bat"] 13 | precedence = "closest" 14 | comment = "tools" 15 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 16 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0" 17 | 18 | [[annotations]] 19 | path = ["**.in", "**.pro", "**CMakeLists.txt", ".cmake.conf", "**.yaml", 20 | "**ci_config_linux.json", ".tag"] 21 | precedence = "closest" 22 | comment = "build system" 23 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 24 | SPDX-License-Identifier = "BSD-3-Clause" 25 | 26 | [[annotations]] 27 | path = ["**/.gitattributes", "**.gitignore", "**/.gitreview"] 28 | precedence = "closest" 29 | comment = "infrastructure" 30 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 31 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" 32 | 33 | [[annotations]] 34 | path = ["**/doc/snippets/**"] 35 | comment = "this must be after the build system table because example and snippets take precedence over build system" 36 | precedence = "closest" 37 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 38 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" 39 | 40 | [[annotations]] 41 | path = ["**/doc/images/**", "**.qdocconf", "**.patch"] 42 | comment = "documentation" 43 | precedence = "closest" 44 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 45 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" 46 | 47 | [[annotations]] 48 | path = ["**.toml", "licenseRule.json"] 49 | precedence = "override" 50 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 51 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause" 52 | 53 | [[annotations]] 54 | path = ["**/qt_attribution.json"] 55 | precedence = "override" 56 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 57 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" 58 | 59 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/HLSL/hlslAttributes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 LunarG, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google, Inc., nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #ifndef HLSLATTRIBUTES_H_ 37 | #define HLSLATTRIBUTES_H_ 38 | 39 | #include 40 | #include 41 | 42 | #include "../MachineIndependent/attribute.h" 43 | #include "../MachineIndependent/SymbolTable.h" 44 | #include "hlslScanContext.h" 45 | 46 | namespace glslang { 47 | 48 | class TFunctionDeclarator { 49 | public: 50 | TFunctionDeclarator() : function(nullptr), body(nullptr) { } 51 | TSourceLoc loc; 52 | TFunction* function; 53 | TAttributes attributes; 54 | TVector* body; 55 | }; 56 | 57 | } // end namespace glslang 58 | 59 | #endif // HLSLATTRIBUTES_H_ 60 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/ResourceLimits/resource_limits_c.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | BSD 2-Clause License 3 | 4 | Copyright (c) 2020, Travis Fort 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **/ 28 | 29 | #include "glslang/Public/resource_limits_c.h" 30 | #include "glslang/Public/ResourceLimits.h" 31 | #include 32 | #include 33 | #include 34 | 35 | glslang_resource_t* glslang_resource(void) 36 | { 37 | return reinterpret_cast(GetResources()); 38 | } 39 | 40 | const glslang_resource_t* glslang_default_resource(void) 41 | { 42 | return reinterpret_cast(GetDefaultResources()); 43 | } 44 | 45 | const char* glslang_default_resource_string() 46 | { 47 | std::string cpp_str = GetDefaultTBuiltInResourceString(); 48 | char* c_str = (char*)malloc(cpp_str.length() + 1); 49 | strncpy(c_str, cpp_str.c_str(), cpp_str.length() + 1); 50 | return c_str; 51 | } 52 | 53 | void glslang_decode_resource_limits(glslang_resource_t* resources, char* config) 54 | { 55 | DecodeResourceLimits(reinterpret_cast(resources), config); 56 | } 57 | -------------------------------------------------------------------------------- /LICENSES/AML-glslang.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002, NVIDIA Corporation. 2 | 3 | NVIDIA Corporation("NVIDIA") supplies this software to you in consideration of your agreement to the following terms, and your use, 4 | installation, modification or redistribution of this NVIDIA software constitutes acceptance of these terms. If you do not agree with 5 | these terms, please do not use, install, modify or redistribute this NVIDIA software. 6 | 7 | In consideration of your agreement to abide by the following terms, and subject to these terms, NVIDIA grants you a personal, 8 | non-exclusive license, under NVIDIA's copyrights in this original NVIDIA software (the " NVIDIA Software"), to use, reproduce, 9 | modify and redistribute the NVIDIA Software, with or without modifications, in source and/or binary forms; provided that if you 10 | redistribute the NVIDIA Software, you must retain the copyright notice of NVIDIA, this notice and the following text and disclaimers 11 | in all such redistributions of the NVIDIA Software. Neither the name, trademarks, service marks nor logos of NVIDIA Corporation may 12 | be used to endorse or promote products derived from the NVIDIA Software without specific prior written permission from NVIDIA. 13 | Except as expressly stated in this notice, no other rights or licenses express or implied, are granted by NVIDIA herein, including 14 | but not limited to any patent rights that may be infringed by your derivative works or by other works in which the NVIDIA Software 15 | may be incorporated. No hardware is licensed hereunder. 16 | 17 | THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 18 | INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 19 | OR ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS. 20 | 21 | IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 22 | TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN 23 | ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY 24 | OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0008-glslang-Drop-C-17-filesystem-usage.patch: -------------------------------------------------------------------------------- 1 | From 4d7c280081cc50b20aba848fbe6055ce075e74bc Mon Sep 17 00:00:00 2001 2 | From: Laszlo Agocs 3 | Date: Wed, 5 Jun 2024 14:55:18 +0200 4 | Subject: [PATCH] glslang: Drop C++17 filesystem usage 5 | 6 | ...does not work on QNX at least. 7 | 8 | Restore the code from 13.something (the version we had 9 | before upgrading to 14.2.0). Not sure what we lose but 10 | probably not very relevant for Qt. 11 | 12 | Change-Id: I40e44d8323b628392a90bef173c8d9ae6895830d 13 | --- 14 | .../glslang/glslang/Include/InfoSink.h | 27 +++++++++++-------- 15 | 1 file changed, 16 insertions(+), 11 deletions(-) 16 | 17 | diff --git a/src/3rdparty/glslang/glslang/Include/InfoSink.h b/src/3rdparty/glslang/glslang/Include/InfoSink.h 18 | index b3f37c7..cebe88b 100644 19 | --- a/src/3rdparty/glslang/glslang/Include/InfoSink.h 20 | +++ b/src/3rdparty/glslang/glslang/Include/InfoSink.h 21 | @@ -36,7 +36,10 @@ 22 | #define _INFOSINK_INCLUDED_ 23 | 24 | #include "../Include/Common.h" 25 | -#include 26 | + 27 | +// QNX says no 28 | +//#include 29 | + 30 | #include 31 | 32 | namespace QtShaderTools { 33 | @@ -101,16 +104,18 @@ public: 34 | char locText[maxSize]; 35 | snprintf(locText, maxSize, ":%d", loc.line); 36 | 37 | - if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) { 38 | - append(std::filesystem::absolute(shaderFileName).string()); 39 | - } else { 40 | - std::string location = loc.getStringNameOrNum(false); 41 | - if (absolute) { 42 | - append(std::filesystem::absolute(location).string()); 43 | - } else { 44 | - append(location); 45 | - } 46 | - } 47 | + append(loc.getStringNameOrNum(false).c_str()); 48 | + 49 | + // if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) { 50 | + // append(std::filesystem::absolute(shaderFileName).string()); 51 | + // } else { 52 | + // std::string location = loc.getStringNameOrNum(false); 53 | + // if (absolute) { 54 | + // append(std::filesystem::absolute(location).string()); 55 | + // } else { 56 | + // append(location); 57 | + // } 58 | + // } 59 | 60 | append(locText); 61 | append(": "); 62 | -- 63 | 2.36.1.windows.1 64 | 65 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/OSDependent/Unix/ossource.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | // 36 | // This file contains the Linux-specific functions 37 | // 38 | #include "../osinclude.h" 39 | 40 | #include 41 | 42 | #if !defined(__Fuchsia__) && !defined(__ghs__) 43 | #include 44 | #endif 45 | 46 | namespace QtShaderTools { 47 | namespace glslang { 48 | 49 | // #define DUMP_COUNTERS 50 | 51 | void OS_DumpMemoryCounters() 52 | { 53 | #ifdef DUMP_COUNTERS 54 | struct rusage usage; 55 | 56 | if (getrusage(RUSAGE_SELF, &usage) == 0) 57 | printf("Working set size: %ld\n", usage.ru_maxrss * 1024); 58 | #else 59 | printf("Recompile with DUMP_COUNTERS defined to see counters.\n"); 60 | #endif 61 | } 62 | 63 | } // end namespace glslang 64 | } // namespace QtShaderTools 65 | -------------------------------------------------------------------------------- /src/shadertools/doc/src/qtshadertools-index.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \title Qt Shader Tools 6 | \page qtshadertools-index.html 7 | 8 | The Qt Shader Tools module builds on the SPIR-V Open Source Ecosystem as 9 | described at \l{https://www.khronos.org/spir/}{the Khronos SPIR-V web site}. 10 | 11 | The main components of the Qt shader conditioning system are: 12 | 13 | \list 14 | \li the \c qsb command-line tool 15 | \li CMake integration for the \c qsb tool 16 | \li QShader (part of the QtGui module) 17 | \li QShaderBaker (part of this module, the library equivalent of the \c qsb 18 | tool) 19 | \endlist 20 | 21 | \section1 Articles and Guides 22 | 23 | \list 24 | \li \l {Qt Shader Tools Overview} 25 | \li \l {QSB Manual} 26 | \li \l {Qt Shader Tools Build System Integration} (CMake) 27 | \endlist 28 | 29 | \section2 C++ API 30 | 31 | \generatelist classesbymodule QtShaderTools 32 | 33 | \note Applications and libraries should avoid using the C++ API directly, unless 34 | they have a good reason to do so. Rather, prefer relying on offline 35 | pre-processing by invoking the \c qsb command-line tool at build time via CMake, 36 | or manually if invoking via CMake is not feasible. The \c qsb tool uses 37 | QShaderBaker and writes the serialized version of the generated QShader into a 38 | file. The usage of the C++ API should be restricted to cases where run time 39 | processing and translation cannot be avoided, and the performance implications 40 | are understood. An example of this are applications that work with user-provided 41 | or dynamically generated shader source strings. 42 | 43 | \section1 Licenses and Attributions 44 | 45 | Qt Shader Tools runtime library is available under commercial licenses from 46 | \l{The Qt Company}. In addition, it is available under free software licenses. 47 | Since Qt 6.3, these free software licenses are \l{GNU Lesser General Public 48 | License, version 3}, or the \l{GNU General Public License, version 2}. 49 | 50 | The \c qsb command-line tool is available under commercial licenses from 51 | \l{The Qt Company}. In addition, it is available under the \l {GNU General 52 | Public License, version 3}. 53 | 54 | See \l{Qt Licensing} for further details. 55 | 56 | Furthermore, Qt Shader Tools in \QtVersion may contain third party 57 | modules under following permissive licenses: 58 | 59 | \annotatedlist attributions-qtshadertools 60 | */ 61 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/Include/visibility.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2023 LunarG, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | #ifdef GLSLANG_IS_SHARED_LIBRARY 36 | #ifdef _WIN32 37 | #ifdef GLSLANG_EXPORTING 38 | #define GLSLANG_EXPORT __declspec(dllexport) 39 | #else 40 | #define GLSLANG_EXPORT __declspec(dllimport) 41 | #endif 42 | #elif __GNUC__ >= 4 43 | #define GLSLANG_EXPORT __attribute__((visibility("default"))) 44 | #endif 45 | #endif // GLSLANG_IS_SHARED_LIBRARY 46 | 47 | #ifndef GLSLANG_EXPORT 48 | #define GLSLANG_EXPORT 49 | #endif 50 | 51 | // Symbols marked with this macro are only meant for public use by the test suite 52 | // and do not appear in publicly installed headers. They are not considered to be 53 | // part of the glslang library ABI. 54 | #define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT 55 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/HLSL/hlslOpMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google, Inc., nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #ifndef HLSLOPMAP_H_ 37 | #define HLSLOPMAP_H_ 38 | 39 | #include "hlslScanContext.h" 40 | 41 | namespace glslang { 42 | 43 | enum PrecedenceLevel { 44 | PlBad, 45 | PlLogicalOr, 46 | PlLogicalXor, 47 | PlLogicalAnd, 48 | PlBitwiseOr, 49 | PlBitwiseXor, 50 | PlBitwiseAnd, 51 | PlEquality, 52 | PlRelational, 53 | PlShift, 54 | PlAdd, 55 | PlMul 56 | }; 57 | 58 | class HlslOpMap { 59 | public: 60 | static TOperator assignment(EHlslTokenClass op); 61 | static TOperator binary(EHlslTokenClass op); 62 | static TOperator preUnary(EHlslTokenClass op); 63 | static TOperator postUnary(EHlslTokenClass op); 64 | static PrecedenceLevel precedenceLevel(TOperator); 65 | }; 66 | 67 | } // end namespace glslang 68 | 69 | #endif // HLSLOPMAP_H_ 70 | -------------------------------------------------------------------------------- /src/shadertools/qshaderbaker.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QSHADERBAKER_H 5 | #define QSHADERBAKER_H 6 | 7 | // 8 | // W A R N I N G 9 | // ------------- 10 | // 11 | // This file is part of the RHI API, with limited compatibility guarantees. 12 | // Usage of this API may make your code source and binary incompatible with 13 | // future versions of Qt. 14 | // 15 | 16 | #include 17 | #include 18 | 19 | QT_BEGIN_NAMESPACE 20 | 21 | struct QShaderBakerPrivate; 22 | class QIODevice; 23 | 24 | class Q_SHADERTOOLS_EXPORT QShaderBaker 25 | { 26 | public: 27 | enum class SpirvOption { 28 | GenerateFullDebugInfo = 0x01, 29 | StripDebugAndVarInfo = 0x02 30 | }; 31 | Q_DECLARE_FLAGS(SpirvOptions, SpirvOption) 32 | 33 | enum class GlslOption { 34 | GlslEsFragDefaultFloatPrecisionMedium = 0x01 35 | }; 36 | Q_DECLARE_FLAGS(GlslOptions, GlslOption) 37 | 38 | QShaderBaker(); 39 | ~QShaderBaker(); 40 | 41 | void setSourceFileName(const QString &fileName); 42 | void setSourceFileName(const QString &fileName, QShader::Stage stage); 43 | 44 | void setSourceDevice(QIODevice *device, QShader::Stage stage, 45 | const QString &fileName = QString()); 46 | 47 | void setSourceString(const QByteArray &sourceString, QShader::Stage stage, 48 | const QString &fileName = QString()); 49 | 50 | typedef QPair GeneratedShader; 51 | void setGeneratedShaders(const QList &v); 52 | void setGeneratedShaderVariants(const QList &v); 53 | 54 | void setPreamble(const QByteArray &preamble); 55 | void setBatchableVertexShaderExtraInputLocation(int location); 56 | void setPerTargetCompilation(bool enable); 57 | void setBreakOnShaderTranslationError(bool enable); 58 | void setTessellationMode(QShaderDescription::TessellationMode mode); 59 | void setTessellationOutputVertexCount(int count); 60 | void setMultiViewCount(int count); 61 | 62 | void setSpirvOptions(SpirvOptions options); 63 | void setGlslOptions(GlslOptions options); 64 | 65 | QShader bake(); 66 | 67 | QString errorMessage() const; 68 | 69 | private: 70 | Q_DISABLE_COPY(QShaderBaker) 71 | QShaderBakerPrivate *d = nullptr; 72 | }; 73 | 74 | Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderBaker::SpirvOptions) 75 | Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderBaker::GlslOptions) 76 | 77 | QT_END_NAMESPACE 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/Public/resource_limits_c.h: -------------------------------------------------------------------------------- 1 | /** 2 | BSD 2-Clause License 3 | 4 | Copyright (c) 2020, Travis Fort 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **/ 28 | 29 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 30 | #define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 31 | 32 | #include "../Include/glslang_c_interface.h" 33 | #include "../Include/visibility.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | // Returns a struct that can be use to create custom resource values. 40 | GLSLANG_EXPORT glslang_resource_t* glslang_resource(void); 41 | 42 | // These are the default resources for TBuiltInResources, used for both 43 | // - parsing this string for the case where the user didn't supply one, 44 | // - dumping out a template for user construction of a config file. 45 | GLSLANG_EXPORT const glslang_resource_t* glslang_default_resource(void); 46 | 47 | // Returns the DefaultTBuiltInResource as a human-readable string. 48 | // NOTE: User is responsible for freeing this string. 49 | GLSLANG_EXPORT const char* glslang_default_resource_string(); 50 | 51 | // Decodes the resource limits from |config| to |resources|. 52 | GLSLANG_EXPORT void glslang_decode_resource_limits(glslang_resource_t* resources, char* config); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_ 59 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/OSDependent/Windows/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #include "InitializeDll.h" 36 | 37 | #define STRICT 38 | #define VC_EXTRALEAN 1 39 | #include 40 | #include 41 | 42 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 43 | { 44 | switch (fdwReason) 45 | { 46 | case DLL_PROCESS_ATTACH: 47 | 48 | if (! glslang::InitProcess()) 49 | return FALSE; 50 | break; 51 | case DLL_THREAD_ATTACH: 52 | 53 | if (! glslang::InitThread()) 54 | return FALSE; 55 | break; 56 | 57 | case DLL_THREAD_DETACH: 58 | 59 | if (! glslang::DetachThread()) 60 | return FALSE; 61 | break; 62 | 63 | case DLL_PROCESS_DETACH: 64 | 65 | glslang::DetachProcess(); 66 | break; 67 | 68 | default: 69 | assert(0 && "DllMain(): Reason for calling DLL Main is unknown"); 70 | return FALSE; 71 | } 72 | 73 | return TRUE; 74 | } 75 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/OSDependent/Windows/ossource.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #include "../osinclude.h" 36 | 37 | #define STRICT 38 | #define VC_EXTRALEAN 1 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | // 45 | // This file contains the Window-OS-specific functions 46 | // 47 | 48 | #if !(defined(_WIN32) || defined(_WIN64)) 49 | #error Trying to build a windows specific file in a non windows build. 50 | #endif 51 | 52 | namespace QtShaderTools { 53 | namespace glslang { 54 | 55 | //#define DUMP_COUNTERS 56 | 57 | void OS_DumpMemoryCounters() 58 | { 59 | #ifdef DUMP_COUNTERS 60 | PROCESS_MEMORY_COUNTERS counters; 61 | GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters)); 62 | printf("Working set size: %d\n", counters.WorkingSetSize); 63 | #else 64 | printf("Recompile with DUMP_COUNTERS defined to see counters.\n"); 65 | #endif 66 | } 67 | 68 | } // namespace glslang 69 | } // namespace QtShaderTools 70 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015-2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | // 36 | // Visit the nodes in the glslang intermediate tree representation to 37 | // propagate 'noContraction' qualifier. 38 | // 39 | 40 | #pragma once 41 | 42 | #include "../Include/intermediate.h" 43 | 44 | namespace QtShaderTools { 45 | namespace glslang { 46 | 47 | // Propagates the 'precise' qualifier for objects (objects marked with 48 | // 'noContraction' qualifier) from the shader source specified 'precise' 49 | // variables to all the involved objects, and add 'noContraction' qualifier for 50 | // the involved arithmetic operations. 51 | // Note that the same qualifier: 'noContraction' is used in both object nodes 52 | // and arithmetic operation nodes, but has different meaning. For object nodes, 53 | // 'noContraction' means the object is 'precise'; and for arithmetic operation 54 | // nodes, it means the operation should not be contracted. 55 | void PropagateNoContraction(const glslang::TIntermediate& intermediate); 56 | 57 | } 58 | } // namespace QtShaderTools 59 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/Public/ResourceLimits.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 36 | #define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 37 | 38 | #include 39 | 40 | #include "../Include/ResourceLimits.h" 41 | #include "../Include/visibility.h" 42 | 43 | namespace QtShaderTools { 44 | 45 | // Return pointer to user-writable Resource to pass through API in 46 | // future-proof way. 47 | GLSLANG_EXPORT extern TBuiltInResource* GetResources(); 48 | 49 | // These are the default resources for TBuiltInResources, used for both 50 | // - parsing this string for the case where the user didn't supply one, 51 | // - dumping out a template for user construction of a config file. 52 | GLSLANG_EXPORT extern const TBuiltInResource* GetDefaultResources(); 53 | 54 | // Returns the DefaultTBuiltInResource as a human-readable string. 55 | GLSLANG_EXPORT std::string GetDefaultTBuiltInResourceString(); 56 | 57 | // Decodes the resource limits from |config| to |resources|. 58 | GLSLANG_EXPORT void DecodeResourceLimits(TBuiltInResource* resources, char* config); 59 | 60 | } 61 | 62 | #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 63 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2014-2016 The Khronos Group Inc. 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 5 | ** of this software and/or associated documentation files (the "Materials"), 6 | ** to deal in the Materials without restriction, including without limitation 7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | ** and/or sell copies of the Materials, and to permit persons to whom the 9 | ** Materials are furnished to do so, subject to the following conditions: 10 | ** 11 | ** The above copyright notice and this permission notice shall be included in 12 | ** all copies or substantial portions of the Materials. 13 | ** 14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS 15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND 16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS 24 | ** IN THE MATERIALS. 25 | */ 26 | 27 | #ifndef GLSLextEXT_H 28 | #define GLSLextEXT_H 29 | 30 | static const int GLSLextEXTVersion = 100; 31 | static const int GLSLextEXTRevision = 2; 32 | 33 | static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export"; 34 | static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer"; 35 | static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; 36 | static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density"; 37 | static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation"; 38 | static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add"; 39 | static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add"; 40 | static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max"; 41 | static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64"; 42 | static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image"; 43 | static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader"; 44 | static const char* const E_SPV_ARM_cooperative_matrix_layouts = "SPV_ARM_cooperative_matrix_layouts"; 45 | 46 | #endif // #ifndef GLSLextEXT_H 47 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/HLSL/hlslParseables.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 LunarG, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | // 35 | 36 | #ifndef _HLSLPARSEABLES_INCLUDED_ 37 | #define _HLSLPARSEABLES_INCLUDED_ 38 | 39 | #include "../MachineIndependent/Initialize.h" 40 | 41 | namespace glslang { 42 | 43 | // 44 | // This is an HLSL specific derivation of TBuiltInParseables. See comment 45 | // above TBuiltInParseables for details. 46 | // 47 | class TBuiltInParseablesHlsl : public TBuiltInParseables { 48 | public: 49 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) 50 | TBuiltInParseablesHlsl(); 51 | void initialize(int version, EProfile, const SpvVersion& spvVersion); 52 | void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage); 53 | 54 | void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable); 55 | 56 | void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); 57 | 58 | private: 59 | void createMatTimesMat(); 60 | }; 61 | 62 | } // end namespace glslang 63 | 64 | #endif // _HLSLPARSEABLES_INCLUDED_ 65 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_reflect.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2021 Bradley Austin Davis 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_REFLECT_HPP 25 | #define SPIRV_CROSS_REFLECT_HPP 26 | 27 | #include "spirv_glsl.hpp" 28 | #include 29 | 30 | namespace simple_json 31 | { 32 | class Stream; 33 | } 34 | 35 | namespace SPIRV_CROSS_NAMESPACE 36 | { 37 | class CompilerReflection : public CompilerGLSL 38 | { 39 | using Parent = CompilerGLSL; 40 | 41 | public: 42 | explicit CompilerReflection(std::vector spirv_) 43 | : Parent(std::move(spirv_)) 44 | { 45 | options.vulkan_semantics = true; 46 | } 47 | 48 | CompilerReflection(const uint32_t *ir_, size_t word_count) 49 | : Parent(ir_, word_count) 50 | { 51 | options.vulkan_semantics = true; 52 | } 53 | 54 | explicit CompilerReflection(const ParsedIR &ir_) 55 | : CompilerGLSL(ir_) 56 | { 57 | options.vulkan_semantics = true; 58 | } 59 | 60 | explicit CompilerReflection(ParsedIR &&ir_) 61 | : CompilerGLSL(std::move(ir_)) 62 | { 63 | options.vulkan_semantics = true; 64 | } 65 | 66 | void set_format(const std::string &format); 67 | std::string compile() override; 68 | 69 | private: 70 | static std::string execution_model_to_str(spv::ExecutionModel model); 71 | 72 | void emit_entry_points(); 73 | void emit_types(); 74 | void emit_resources(); 75 | void emit_specialization_constants(); 76 | 77 | void emit_type(uint32_t type_id, bool &emitted_open_tag); 78 | void emit_type_member(const SPIRType &type, uint32_t index); 79 | void emit_type_member_qualifiers(const SPIRType &type, uint32_t index); 80 | void emit_type_array(const SPIRType &type); 81 | void emit_resources(const char *tag, const SmallVector &resources); 82 | bool type_is_reference(const SPIRType &type) const; 83 | 84 | std::string to_member_name(const SPIRType &type, uint32_t index) const; 85 | 86 | std::shared_ptr json_stream; 87 | }; 88 | 89 | } // namespace SPIRV_CROSS_NAMESPACE 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_cross_util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #include "spirv_cross_util.hpp" 25 | #include "spirv_common.hpp" 26 | 27 | using namespace spv; 28 | using namespace SPIRV_CROSS_NAMESPACE; 29 | 30 | namespace spirv_cross_util 31 | { 32 | void rename_interface_variable(Compiler &compiler, const SmallVector &resources, uint32_t location, 33 | const std::string &name) 34 | { 35 | for (auto &v : resources) 36 | { 37 | if (!compiler.has_decoration(v.id, spv::DecorationLocation)) 38 | continue; 39 | 40 | auto loc = compiler.get_decoration(v.id, spv::DecorationLocation); 41 | if (loc != location) 42 | continue; 43 | 44 | auto &type = compiler.get_type(v.base_type_id); 45 | 46 | // This is more of a friendly variant. If we need to rename interface variables, we might have to rename 47 | // structs as well and make sure all the names match up. 48 | if (type.basetype == SPIRType::Struct) 49 | { 50 | compiler.set_name(v.base_type_id, join("SPIRV_Cross_Interface_Location", location)); 51 | for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++) 52 | compiler.set_member_name(v.base_type_id, i, join("InterfaceMember", i)); 53 | } 54 | 55 | compiler.set_name(v.id, name); 56 | } 57 | } 58 | 59 | void inherit_combined_sampler_bindings(Compiler &compiler) 60 | { 61 | auto &samplers = compiler.get_combined_image_samplers(); 62 | for (auto &s : samplers) 63 | { 64 | if (compiler.has_decoration(s.image_id, spv::DecorationDescriptorSet)) 65 | { 66 | uint32_t set = compiler.get_decoration(s.image_id, spv::DecorationDescriptorSet); 67 | compiler.set_decoration(s.combined_id, spv::DecorationDescriptorSet, set); 68 | } 69 | 70 | if (compiler.has_decoration(s.image_id, spv::DecorationBinding)) 71 | { 72 | uint32_t binding = compiler.get_decoration(s.image_id, spv::DecorationBinding); 73 | compiler.set_decoration(s.combined_id, spv::DecorationBinding, binding); 74 | } 75 | } 76 | } 77 | } // namespace spirv_cross_util 78 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/GenericCodeGen/CodeGen.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #include "../Include/Common.h" 36 | #include "../Include/ShHandle.h" 37 | #include "../MachineIndependent/Versions.h" 38 | 39 | namespace QtShaderTools { 40 | // 41 | // Here is where real machine specific high-level data would be defined. 42 | // 43 | class TGenericCompiler : public TCompiler { 44 | public: 45 | TGenericCompiler(EShLanguage l) : TCompiler(l, infoSink) {} 46 | virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile); 47 | TInfoSink infoSink; 48 | }; 49 | 50 | // 51 | // This function must be provided to create the actual 52 | // compile object used by higher level code. It returns 53 | // a subclass of TCompiler. 54 | // 55 | TCompiler* ConstructCompiler(EShLanguage language, int) { return new TGenericCompiler(language); } 56 | 57 | // 58 | // Delete the compiler made by ConstructCompiler 59 | // 60 | void DeleteCompiler(TCompiler* compiler) 61 | { 62 | delete compiler; 63 | } 64 | 65 | // 66 | // Generate code from the given parse tree 67 | // 68 | bool TGenericCompiler::compile(TIntermNode* /*root*/, int /*version*/, EProfile /*profile*/) 69 | { 70 | haveValidObjectCode = true; 71 | 72 | return haveValidObjectCode; 73 | } 74 | } // namespace QtShaderTools 75 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/Logger.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #include "Logger.h" 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | namespace spv { 42 | 43 | void SpvBuildLogger::tbdFunctionality(const std::string& f) 44 | { 45 | if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures)) 46 | tbdFeatures.push_back(f); 47 | } 48 | 49 | void SpvBuildLogger::missingFunctionality(const std::string& f) 50 | { 51 | if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures)) 52 | missingFeatures.push_back(f); 53 | } 54 | 55 | std::string SpvBuildLogger::getAllMessages() const { 56 | std::ostringstream messages; 57 | for (auto it = tbdFeatures.cbegin(); it != tbdFeatures.cend(); ++it) 58 | messages << "TBD functionality: " << *it << "\n"; 59 | for (auto it = missingFeatures.cbegin(); it != missingFeatures.cend(); ++it) 60 | messages << "Missing functionality: " << *it << "\n"; 61 | for (auto it = warnings.cbegin(); it != warnings.cend(); ++it) 62 | messages << "warning: " << *it << "\n"; 63 | for (auto it = errors.cbegin(); it != errors.cend(); ++it) 64 | messages << "error: " << *it << "\n"; 65 | return messages.str(); 66 | } 67 | 68 | } // end spv namespace 69 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_cpp.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_CPP_HPP 25 | #define SPIRV_CROSS_CPP_HPP 26 | 27 | #include "spirv_glsl.hpp" 28 | #include 29 | 30 | namespace SPIRV_CROSS_NAMESPACE 31 | { 32 | class CompilerCPP : public CompilerGLSL 33 | { 34 | public: 35 | explicit CompilerCPP(std::vector spirv_) 36 | : CompilerGLSL(std::move(spirv_)) 37 | { 38 | } 39 | 40 | CompilerCPP(const uint32_t *ir_, size_t word_count) 41 | : CompilerGLSL(ir_, word_count) 42 | { 43 | } 44 | 45 | explicit CompilerCPP(const ParsedIR &ir_) 46 | : CompilerGLSL(ir_) 47 | { 48 | } 49 | 50 | explicit CompilerCPP(ParsedIR &&ir_) 51 | : CompilerGLSL(std::move(ir_)) 52 | { 53 | } 54 | 55 | std::string compile() override; 56 | 57 | // Sets a custom symbol name that can override 58 | // spirv_cross_get_interface. 59 | // 60 | // Useful when several shader interfaces are linked 61 | // statically into the same binary. 62 | void set_interface_name(std::string name) 63 | { 64 | interface_name = std::move(name); 65 | } 66 | 67 | private: 68 | void emit_header() override; 69 | void emit_c_linkage(); 70 | void emit_function_prototype(SPIRFunction &func, const Bitset &return_flags) override; 71 | 72 | void emit_resources(); 73 | void emit_buffer_block(const SPIRVariable &type) override; 74 | void emit_push_constant_block(const SPIRVariable &var) override; 75 | void emit_interface_block(const SPIRVariable &type); 76 | void emit_block_chain(SPIRBlock &block); 77 | void emit_uniform(const SPIRVariable &var) override; 78 | void emit_shared(const SPIRVariable &var); 79 | void emit_block_struct(SPIRType &type); 80 | std::string variable_decl(const SPIRType &type, const std::string &name, uint32_t id) override; 81 | 82 | std::string argument_decl(const SPIRFunction::Parameter &arg); 83 | 84 | SmallVector resource_registrations; 85 | std::string impl_type; 86 | std::string resource_type; 87 | uint32_t shared_counter = 0; 88 | 89 | std::string interface_name; 90 | }; 91 | } // namespace SPIRV_CROSS_NAMESPACE 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/Logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Google, Inc. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following 15 | // disclaimer in the documentation and/or other materials provided 16 | // with the distribution. 17 | // 18 | // Neither the name of Google Inc. nor the names of its 19 | // contributors may be used to endorse or promote products derived 20 | // from this software without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | // POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #ifndef GLSLANG_SPIRV_LOGGER_H 36 | #define GLSLANG_SPIRV_LOGGER_H 37 | 38 | #include 39 | #include 40 | #include "glslang/Include/visibility.h" 41 | 42 | namespace spv { 43 | 44 | // A class for holding all SPIR-V build status messages, including 45 | // missing/TBD functionalities, warnings, and errors. 46 | class GLSLANG_EXPORT SpvBuildLogger { 47 | public: 48 | SpvBuildLogger() {} 49 | 50 | // Registers a TBD functionality. 51 | void tbdFunctionality(const std::string& f); 52 | // Registers a missing functionality. 53 | void missingFunctionality(const std::string& f); 54 | 55 | // Logs a warning. 56 | void warning(const std::string& w) { warnings.push_back(w); } 57 | // Logs an error. 58 | void error(const std::string& e) { errors.push_back(e); } 59 | 60 | // Returns all messages accumulated in the order of: 61 | // TBD functionalities, missing functionalities, warnings, errors. 62 | std::string getAllMessages() const; 63 | 64 | private: 65 | SpvBuildLogger(const SpvBuildLogger&); 66 | 67 | std::vector tbdFeatures; 68 | std::vector missingFeatures; 69 | std::vector warnings; 70 | std::vector errors; 71 | }; 72 | 73 | } // end spv namespace 74 | 75 | #endif // GLSLANG_SPIRV_LOGGER_H 76 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/build_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Khronos Group Inc. 2 | // 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of The Khronos Group Inc. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | 34 | #ifndef GLSLANG_BUILD_INFO 35 | #define GLSLANG_BUILD_INFO 36 | 37 | #define GLSLANG_VERSION_MAJOR 13 38 | #define GLSLANG_VERSION_MINOR 0 39 | #define GLSLANG_VERSION_PATCH 0 40 | #define GLSLANG_VERSION_FLAVOR "" 41 | 42 | #define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \ 43 | (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ 44 | (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ 45 | ((patch) > GLSLANG_VERSION_PATCH))))) 46 | 47 | #define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \ 48 | (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ 49 | (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ 50 | ((patch) >= GLSLANG_VERSION_PATCH))))) 51 | 52 | #define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \ 53 | (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ 54 | (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ 55 | ((patch) < GLSLANG_VERSION_PATCH))))) 56 | 57 | #define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \ 58 | (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ 59 | (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ 60 | ((patch) <= GLSLANG_VERSION_PATCH))))) 61 | 62 | #endif // GLSLANG_BUILD_INFO 63 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_parser.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_PARSER_HPP 25 | #define SPIRV_CROSS_PARSER_HPP 26 | 27 | #include "spirv_cross_parsed_ir.hpp" 28 | #include 29 | 30 | namespace SPIRV_CROSS_NAMESPACE 31 | { 32 | class Parser 33 | { 34 | public: 35 | Parser(const uint32_t *spirv_data, size_t word_count); 36 | Parser(std::vector spirv); 37 | 38 | void parse(); 39 | 40 | ParsedIR &get_parsed_ir() 41 | { 42 | return ir; 43 | } 44 | 45 | private: 46 | ParsedIR ir; 47 | SPIRFunction *current_function = nullptr; 48 | SPIRBlock *current_block = nullptr; 49 | // For workarounds. 50 | bool ignore_trailing_block_opcodes = false; 51 | 52 | void parse(const Instruction &instr); 53 | const uint32_t *stream(const Instruction &instr) const; 54 | 55 | template 56 | T &set(uint32_t id, P &&... args) 57 | { 58 | ir.add_typed_id(static_cast(T::type), id); 59 | auto &var = variant_set(ir.ids[id], std::forward

(args)...); 60 | var.self = id; 61 | return var; 62 | } 63 | 64 | template 65 | T &get(uint32_t id) 66 | { 67 | return variant_get(ir.ids[id]); 68 | } 69 | 70 | template 71 | T *maybe_get(uint32_t id) 72 | { 73 | if (ir.ids[id].get_type() == static_cast(T::type)) 74 | return &get(id); 75 | else 76 | return nullptr; 77 | } 78 | 79 | template 80 | const T &get(uint32_t id) const 81 | { 82 | return variant_get(ir.ids[id]); 83 | } 84 | 85 | template 86 | const T *maybe_get(uint32_t id) const 87 | { 88 | if (ir.ids[id].get_type() == T::type) 89 | return &get(id); 90 | else 91 | return nullptr; 92 | } 93 | 94 | // This must be an ordered data structure so we always pick the same type aliases. 95 | SmallVector global_struct_cache; 96 | SmallVector> forward_pointer_fixups; 97 | 98 | bool types_are_logically_equivalent(const SPIRType &a, const SPIRType &b) const; 99 | bool variable_storage_is_aliased(const SPIRVariable &v) const; 100 | }; 101 | } // namespace SPIRV_CROSS_NAMESPACE 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/glslang/GenericCodeGen/Link.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions 7 | // are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | // POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | // 36 | // The top level algorithms for linking multiple 37 | // shaders together. 38 | // 39 | #include "../Include/Common.h" 40 | #include "../Include/ShHandle.h" 41 | 42 | namespace QtShaderTools { 43 | // 44 | // Actual link object, derived from the shader handle base classes. 45 | // 46 | class TGenericLinker : public TLinker { 47 | public: 48 | TGenericLinker(EShExecutable e) : TLinker(e, infoSink) {} 49 | bool link(TCompilerList&, TUniformMap*) { return true; } 50 | void getAttributeBindings(ShBindingTable const **) const { } 51 | TInfoSink infoSink; 52 | }; 53 | 54 | // 55 | // The internal view of a uniform/float object exchanged with the driver. 56 | // 57 | class TUniformLinkedMap : public TUniformMap { 58 | public: 59 | TUniformLinkedMap() { } 60 | virtual int getLocation(const char*) { return 0; } 61 | }; 62 | 63 | TShHandleBase* ConstructLinker(EShExecutable executable, int) { return new TGenericLinker(executable); } 64 | 65 | void DeleteLinker(TShHandleBase* linker) 66 | { 67 | delete linker; 68 | } 69 | 70 | TUniformMap* ConstructUniformMap() 71 | { 72 | return new TUniformLinkedMap(); 73 | } 74 | 75 | void DeleteUniformMap(TUniformMap* map) 76 | { 77 | delete map; 78 | } 79 | 80 | TShHandleBase* ConstructBindings() 81 | { 82 | return nullptr; 83 | } 84 | 85 | void DeleteBindingList(TShHandleBase* bindingList) 86 | { 87 | delete bindingList; 88 | } 89 | 90 | } // namespace QtShaderTools 91 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/GlslangToSpv.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014 LunarG, Inc. 3 | // Copyright (C) 2015-2018 Google, Inc. 4 | // 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions 9 | // are met: 10 | // 11 | // Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above 15 | // copyright notice, this list of conditions and the following 16 | // disclaimer in the documentation and/or other materials provided 17 | // with the distribution. 18 | // 19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 20 | // contributors may be used to endorse or promote products derived 21 | // from this software without specific prior written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | // POSSIBILITY OF SUCH DAMAGE. 35 | 36 | #pragma once 37 | 38 | #include 39 | #include 40 | 41 | #include "Logger.h" 42 | #include "glslang/Include/visibility.h" 43 | 44 | namespace QtShaderTools { 45 | namespace glslang { 46 | class TIntermediate; 47 | 48 | struct SpvOptions { 49 | bool generateDebugInfo {false}; 50 | bool stripDebugInfo {false}; 51 | bool disableOptimizer {true}; 52 | bool optimizeSize {false}; 53 | bool disassemble {false}; 54 | bool validate {false}; 55 | bool emitNonSemanticShaderDebugInfo {false}; 56 | bool emitNonSemanticShaderDebugSource{ false }; 57 | bool compileOnly{false}; 58 | bool optimizerAllowExpandedIDBound{false}; 59 | }; 60 | 61 | GLSLANG_EXPORT void GetSpirvVersion(std::string&); 62 | GLSLANG_EXPORT int GetSpirvGeneratorVersion(); 63 | GLSLANG_EXPORT void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, 64 | SpvOptions* options = nullptr); 65 | GLSLANG_EXPORT void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, 66 | spv::SpvBuildLogger* logger, SpvOptions* options = nullptr); 67 | GLSLANG_EXPORT bool OutputSpvBin(const std::vector& spirv, const char* baseName); 68 | GLSLANG_EXPORT bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); 69 | 70 | } // namespace glslang 71 | } // namespace QtShaderTools 72 | -------------------------------------------------------------------------------- /src/3rdparty/SPIRV-Cross/spirv_cross_error_handling.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Arm Limited 3 | * SPDX-License-Identifier: Apache-2.0 OR MIT 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* 19 | * At your option, you may choose to accept this material under either: 20 | * 1. The Apache License, Version 2.0, found at , or 21 | * 2. The MIT License, found at . 22 | */ 23 | 24 | #ifndef SPIRV_CROSS_ERROR_HANDLING 25 | #define SPIRV_CROSS_ERROR_HANDLING 26 | 27 | #include 28 | #include 29 | #include 30 | #ifndef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS 31 | #include 32 | #endif 33 | 34 | #ifdef SPIRV_CROSS_NAMESPACE_OVERRIDE 35 | #define SPIRV_CROSS_NAMESPACE SPIRV_CROSS_NAMESPACE_OVERRIDE 36 | #else 37 | #define SPIRV_CROSS_NAMESPACE spirv_cross 38 | #endif 39 | 40 | namespace SPIRV_CROSS_NAMESPACE 41 | { 42 | #ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS 43 | #if !defined(_MSC_VER) || defined(__clang__) 44 | [[noreturn]] 45 | #elif defined(_MSC_VER) 46 | __declspec(noreturn) 47 | #endif 48 | inline void 49 | report_and_abort(const std::string &msg) 50 | { 51 | #ifdef NDEBUG 52 | (void)msg; 53 | #else 54 | fprintf(stderr, "There was a compiler error: %s\n", msg.c_str()); 55 | #endif 56 | fflush(stderr); 57 | abort(); 58 | } 59 | 60 | #define SPIRV_CROSS_THROW(x) report_and_abort(x) 61 | #else 62 | class CompilerError : public std::runtime_error 63 | { 64 | public: 65 | explicit CompilerError(const std::string &str) 66 | : std::runtime_error(str) 67 | { 68 | } 69 | 70 | explicit CompilerError(const char *str) 71 | : std::runtime_error(str) 72 | { 73 | } 74 | }; 75 | 76 | #define SPIRV_CROSS_THROW(x) throw CompilerError(x) 77 | #endif 78 | 79 | // MSVC 2013 does not have noexcept. We need this for Variant to get move constructor to work correctly 80 | // instead of copy constructor. 81 | // MSVC 2013 ignores that move constructors cannot throw in std::vector, so just don't define it. 82 | #if defined(_MSC_VER) && _MSC_VER < 1900 83 | #define SPIRV_CROSS_NOEXCEPT 84 | #else 85 | #define SPIRV_CROSS_NOEXCEPT noexcept 86 | #endif 87 | 88 | #if __cplusplus >= 201402l 89 | #define SPIRV_CROSS_DEPRECATED(reason) [[deprecated(reason)]] 90 | #elif defined(__GNUC__) 91 | #define SPIRV_CROSS_DEPRECATED(reason) __attribute__((deprecated)) 92 | #elif defined(_MSC_VER) 93 | #define SPIRV_CROSS_DEPRECATED(reason) __declspec(deprecated(reason)) 94 | #else 95 | #define SPIRV_CROSS_DEPRECATED(reason) 96 | #endif 97 | } // namespace SPIRV_CROSS_NAMESPACE 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /src/3rdparty/patches/glslang/0010-glslang-fix-missing-namespacing.patch: -------------------------------------------------------------------------------- 1 | From ee947c59a2f5ee0e72816fe559a9755c1587c520 Mon Sep 17 00:00:00 2001 2 | From: Tim Blechmann 3 | Date: Mon, 1 Sep 2025 13:37:01 +0800 4 | Subject: [PATCH] glslang: fix missing namespacing 5 | 6 | * functions declared inside an extern "C" block are not name mangled, 7 | even if they are in namespaces. We close the extern "C" block before 8 | opening the namespace 9 | * the resource limit files were not namespaced inside a QtShaderTools 10 | block, resulting in their symbols being exported. 11 | 12 | --- 13 | src/3rdparty/glslang/glslang/Public/ResourceLimits.h | 4 ++++ 14 | src/3rdparty/glslang/glslang/Public/ShaderLang.h | 8 ++++++++ 15 | .../glslang/glslang/ResourceLimits/ResourceLimits.cpp | 5 +++++ 16 | 3 files changed, 17 insertions(+) 17 | 18 | diff --git a/src/3rdparty/glslang/glslang/Public/ResourceLimits.h b/src/3rdparty/glslang/glslang/Public/ResourceLimits.h 19 | index 8245e12..3dba0cb 100644 20 | --- a/src/3rdparty/glslang/glslang/Public/ResourceLimits.h 21 | +++ b/src/3rdparty/glslang/glslang/Public/ResourceLimits.h 22 | @@ -40,6 +40,8 @@ 23 | #include "../Include/ResourceLimits.h" 24 | #include "../Include/visibility.h" 25 | 26 | +namespace QtShaderTools { 27 | + 28 | // Return pointer to user-writable Resource to pass through API in 29 | // future-proof way. 30 | GLSLANG_EXPORT extern TBuiltInResource* GetResources(); 31 | @@ -55,4 +57,6 @@ GLSLANG_EXPORT std::string GetDefaultTBuiltInResourceString(); 32 | // Decodes the resource limits from |config| to |resources|. 33 | GLSLANG_EXPORT void DecodeResourceLimits(TBuiltInResource* resources, char* config); 34 | 35 | +} 36 | + 37 | #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ 38 | diff --git a/src/3rdparty/glslang/glslang/Public/ShaderLang.h b/src/3rdparty/glslang/glslang/Public/ShaderLang.h 39 | index 03b9b66..81aa7c7 100755 40 | --- a/src/3rdparty/glslang/glslang/Public/ShaderLang.h 41 | +++ b/src/3rdparty/glslang/glslang/Public/ShaderLang.h 42 | @@ -126,6 +126,10 @@ typedef enum : unsigned { 43 | LAST_ELEMENT_MARKER(EShLanguageMaskCount), 44 | } EShLanguageMask; 45 | 46 | +#ifdef __cplusplus 47 | + } 48 | +#endif 49 | + 50 | namespace QtShaderTools { 51 | namespace glslang { 52 | 53 | @@ -223,6 +227,10 @@ GLSLANG_EXPORT const char* StageName(EShLanguage); 54 | } // end namespace glslang 55 | } // namespace QtShaderTools 56 | 57 | +#ifdef __cplusplus 58 | + extern "C" { 59 | +#endif 60 | + 61 | // 62 | // Types of output the linker will create. 63 | // 64 | diff --git a/src/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp b/src/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp 65 | index 0e9d1b5..d9afaa9 100644 66 | --- a/src/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp 67 | +++ b/src/3rdparty/glslang/glslang/ResourceLimits/ResourceLimits.cpp 68 | @@ -39,6 +39,8 @@ 69 | 70 | #include "glslang/Public/ResourceLimits.h" 71 | 72 | +namespace QtShaderTools { 73 | + 74 | TBuiltInResource Resources; 75 | 76 | const TBuiltInResource DefaultTBuiltInResource = { 77 | @@ -540,3 +542,6 @@ const TBuiltInResource* GetDefaultResources() 78 | { 79 | return &DefaultTBuiltInResource; 80 | } 81 | + 82 | +} // namespace QtShaderTools 83 | + 84 | -- 85 | 2.51.0 86 | 87 | -------------------------------------------------------------------------------- /src/3rdparty/glslang/SPIRV/bitutils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 The Khronos Group Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef LIBSPIRV_UTIL_BITUTILS_H_ 16 | #define LIBSPIRV_UTIL_BITUTILS_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace spvutils { 22 | 23 | // Performs a bitwise copy of source to the destination type Dest. 24 | template 25 | Dest BitwiseCast(Src source) { 26 | Dest dest; 27 | static_assert(sizeof(source) == sizeof(dest), 28 | "BitwiseCast: Source and destination must have the same size"); 29 | std::memcpy(static_cast(&dest), &source, sizeof(dest)); 30 | return dest; 31 | } 32 | 33 | // SetBits returns an integer of type with bits set 34 | // for position through , counting from the least 35 | // significant bit. In particular when Num == 0, no positions are set to 1. 36 | // A static assert will be triggered if First + Num > sizeof(T) * 8, that is, 37 | // a bit that will not fit in the underlying type is set. 38 | template 39 | struct SetBits { 40 | static_assert(First < sizeof(T) * 8, 41 | "Tried to set a bit that is shifted too far."); 42 | const static T get = (T(1) << First) | SetBits::get; 43 | }; 44 | 45 | template 46 | struct SetBits { 47 | const static T get = T(0); 48 | }; 49 | 50 | // This is all compile-time so we can put our tests right here. 51 | static_assert(SetBits::get == uint32_t(0x00000000), 52 | "SetBits failed"); 53 | static_assert(SetBits::get == uint32_t(0x00000001), 54 | "SetBits failed"); 55 | static_assert(SetBits::get == uint32_t(0x80000000), 56 | "SetBits failed"); 57 | static_assert(SetBits::get == uint32_t(0x00000006), 58 | "SetBits failed"); 59 | static_assert(SetBits::get == uint32_t(0xc0000000), 60 | "SetBits failed"); 61 | static_assert(SetBits::get == uint32_t(0x7FFFFFFF), 62 | "SetBits failed"); 63 | static_assert(SetBits::get == uint32_t(0xFFFFFFFF), 64 | "SetBits failed"); 65 | static_assert(SetBits::get == uint32_t(0xFFFF0000), 66 | "SetBits failed"); 67 | 68 | static_assert(SetBits::get == uint64_t(0x0000000000000001LL), 69 | "SetBits failed"); 70 | static_assert(SetBits::get == uint64_t(0x8000000000000000LL), 71 | "SetBits failed"); 72 | static_assert(SetBits::get == uint64_t(0xc000000000000000LL), 73 | "SetBits failed"); 74 | static_assert(SetBits::get == uint64_t(0x0000000080000000LL), 75 | "SetBits failed"); 76 | static_assert(SetBits::get == uint64_t(0x00000000FFFF0000LL), 77 | "SetBits failed"); 78 | 79 | } // namespace spvutils 80 | 81 | #endif // LIBSPIRV_UTIL_BITUTILS_H_ 82 | --------------------------------------------------------------------------------