mirror of
https://github.com/openharmony/third_party_glslang.git
synced 2026-07-01 06:41:53 -04:00
-108
@@ -1,108 +0,0 @@
|
||||
# Windows Build Configuration for AppVeyor
|
||||
# http://www.appveyor.com/docs/appveyor-yml
|
||||
|
||||
# build version format
|
||||
version: "{build}"
|
||||
|
||||
os: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
# changes to these files don't need to trigger testing
|
||||
skip_commits:
|
||||
files:
|
||||
- README.md
|
||||
- README-spirv-remap.txt
|
||||
- LICENSE.txt
|
||||
- CODE_OF_CONDUCT.md
|
||||
- BUILD.*
|
||||
- WORKSPACE
|
||||
- kokoro/*
|
||||
- make-revision
|
||||
- Android.mk
|
||||
- _config.yml
|
||||
|
||||
# Travis advances the master-tot tag to current top of the tree after
|
||||
# each push into the master branch, because it relies on that tag to
|
||||
# upload build artifacts to the master-tot release. This will cause
|
||||
# double testing for each push on Appveyor: one for the push, one for
|
||||
# the tag advance. Disable testing tags.
|
||||
skip_tags: true
|
||||
|
||||
clone_depth: 5
|
||||
|
||||
matrix:
|
||||
fast_finish: true # Show final status immediately if a test fails.
|
||||
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
- C:/Python27/python.exe update_glslang_sources.py
|
||||
- set PATH=C:\ninja;C:\Python36;%PATH%
|
||||
- git clone https://github.com/google/googletest.git External/googletest
|
||||
|
||||
build:
|
||||
parallel: true # enable MSBuild parallel builds
|
||||
verbosity: minimal
|
||||
|
||||
build_script:
|
||||
- mkdir build && cd build
|
||||
- cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=install ..
|
||||
- cmake --build . --config %CONFIGURATION% --target install
|
||||
|
||||
test_script:
|
||||
- ctest -C %CONFIGURATION% --output-on-failure
|
||||
- cd ../Test && bash runtests
|
||||
- cd ../build
|
||||
|
||||
after_test:
|
||||
# For debug build, the generated dll has a postfix "d" in its name.
|
||||
- ps: >-
|
||||
If ($env:configuration -Match "Debug") {
|
||||
$env:SUFFIX="d"
|
||||
} Else {
|
||||
$env:SUFFIX=""
|
||||
}
|
||||
- cd install
|
||||
# Zip all glslang artifacts for uploading and deploying
|
||||
- 7z a glslang-master-windows-"%PLATFORM%"-"%CONFIGURATION%".zip
|
||||
bin\glslangValidator.exe
|
||||
bin\spirv-remap.exe
|
||||
include\glslang\*
|
||||
lib\GenericCodeGen%SUFFIX%.lib
|
||||
lib\glslang%SUFFIX%.lib
|
||||
lib\glslang-default-resource-limits%SUFFIX%.lib
|
||||
lib\HLSL%SUFFIX%.lib
|
||||
lib\MachineIndependent%SUFFIX%.lib
|
||||
lib\OGLCompiler%SUFFIX%.lib
|
||||
lib\OSDependent%SUFFIX%.lib
|
||||
lib\SPIRV%SUFFIX%.lib
|
||||
lib\SPVRemapper%SUFFIX%.lib
|
||||
lib\SPIRV-Tools%SUFFIX%.lib
|
||||
lib\SPIRV-Tools-opt%SUFFIX%.lib
|
||||
|
||||
artifacts:
|
||||
- path: build\install\*.zip
|
||||
name: artifacts-zip
|
||||
|
||||
deploy:
|
||||
- provider: GitHub
|
||||
auth_token:
|
||||
secure: YglcSYdl0TylEa59H4K6lylBEDr586NAt2EMgZquSo+iuPrwgZQuJLPCoihSm9y6
|
||||
release: master-tot
|
||||
description: "Continuous build of the latest master branch by Appveyor and Travis CI"
|
||||
artifact: artifacts-zip
|
||||
draft: false
|
||||
prerelease: false
|
||||
force_update: true
|
||||
on:
|
||||
branch: master
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
@@ -1,13 +0,0 @@
|
||||
Language: Cpp
|
||||
IndentWidth: 4
|
||||
PointerAlignment: Left
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping: { AfterFunction: true, AfterControlStatement: false }
|
||||
IndentCaseLabels: false
|
||||
ReflowComments: false
|
||||
ColumnLimit: 120
|
||||
AccessModifierOffset: -4
|
||||
AlignTrailingComments: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
@@ -1,39 +0,0 @@
|
||||
# Copyright (C) 2020 The Khronos Group Inc.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Neither the name of The Khronos Group Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# 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 HOLDERS 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.
|
||||
|
||||
buildconfig = "//build/config/BUILDCONFIG.gn"
|
||||
|
||||
default_args = {
|
||||
clang_use_chrome_plugins = false
|
||||
use_custom_libcxx = false
|
||||
}
|
||||
Regular → Executable
-3
@@ -96,7 +96,6 @@ LOCAL_MODULE:=glslang
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
|
||||
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES:= \
|
||||
glslang/CInterface/glslang_c_interface.cpp \
|
||||
glslang/GenericCodeGen/CodeGen.cpp \
|
||||
glslang/GenericCodeGen/Link.cpp \
|
||||
glslang/HLSL/hlslAttributes.cpp \
|
||||
@@ -126,7 +125,6 @@ LOCAL_SRC_FILES:= \
|
||||
glslang/MachineIndependent/RemoveTree.cpp \
|
||||
glslang/MachineIndependent/Scan.cpp \
|
||||
glslang/MachineIndependent/ShaderLang.cpp \
|
||||
glslang/MachineIndependent/SpirvIntrinsics.cpp \
|
||||
glslang/MachineIndependent/SymbolTable.cpp \
|
||||
glslang/MachineIndependent/Versions.cpp \
|
||||
glslang/MachineIndependent/preprocessor/PpAtom.cpp \
|
||||
@@ -150,7 +148,6 @@ $(LOCAL_PATH)/SPIRV/GlslangToSpv.cpp: \
|
||||
LOCAL_MODULE:=SPIRV
|
||||
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES)
|
||||
LOCAL_SRC_FILES:= \
|
||||
SPIRV/CInterface/spirv_c_interface.cpp \
|
||||
SPIRV/GlslangToSpv.cpp \
|
||||
SPIRV/InReadableOrder.cpp \
|
||||
SPIRV/Logger.cpp \
|
||||
|
||||
Regular → Executable
+2
-18
@@ -49,28 +49,14 @@ py_binary(
|
||||
srcs = ["build_info.py"],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "gen_extension_headers",
|
||||
srcs = ["gen_extension_headers.py"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "gen_build_info_h",
|
||||
srcs = ["CHANGES.md", "build_info.h.tmpl"],
|
||||
outs = ["glslang/build_info.h"],
|
||||
cmd_bash = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)",
|
||||
cmd_bat = "for %F in ($(location CHANGES.md)) do $(location build_info) %~dpF -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)",
|
||||
cmd = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)",
|
||||
tools = [":build_info"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "gen_extension_headers_h",
|
||||
srcs = ["glslang/ExtensionHeaders", "gen_extension_headers.py"],
|
||||
outs = ["glslang/glsl_intrinsic_header.h"],
|
||||
cmd_bash = "$(location gen_extension_headers) -i $(location glslang/ExtensionHeaders) -o $(location glslang/glsl_intrinsic_header.h)",
|
||||
tools = [":gen_extension_headers"],
|
||||
)
|
||||
|
||||
COMMON_COPTS = select({
|
||||
"@bazel_tools//src/conditions:windows": [""],
|
||||
"//conditions:default": [
|
||||
@@ -157,8 +143,7 @@ genrule(
|
||||
"include/SPIRV/NonSemanticDebugPrintf.h",
|
||||
"include/SPIRV/spirv.hpp",
|
||||
],
|
||||
cmd_bash = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
|
||||
cmd_bat = "(if not exist $(@D)\\include\\SPIRV mkdir $(@D)\\include\\SPIRV) && (for %S in ($(SRCS)) do @xcopy /q %S $(@D)\\include\\SPIRV\\ >NUL)",
|
||||
cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@@ -219,7 +204,6 @@ cc_binary(
|
||||
srcs = [
|
||||
"StandAlone/StandAlone.cpp",
|
||||
"StandAlone/Worklist.h",
|
||||
":glslang/glsl_intrinsic_header.h"
|
||||
],
|
||||
copts = COMMON_COPTS,
|
||||
deps = [
|
||||
|
||||
@@ -131,7 +131,6 @@ template("glslang_sources_common") {
|
||||
"glslang/Include/PoolAlloc.h",
|
||||
"glslang/Include/ResourceLimits.h",
|
||||
"glslang/Include/ShHandle.h",
|
||||
"glslang/Include/SpirvIntrinsics.h",
|
||||
"glslang/Include/Types.h",
|
||||
"glslang/Include/arrays.h",
|
||||
"glslang/Include/intermediate.h",
|
||||
@@ -152,7 +151,6 @@ template("glslang_sources_common") {
|
||||
"glslang/MachineIndependent/Scan.h",
|
||||
"glslang/MachineIndependent/ScanContext.h",
|
||||
"glslang/MachineIndependent/ShaderLang.cpp",
|
||||
"glslang/MachineIndependent/SpirvIntrinsics.cpp",
|
||||
"glslang/MachineIndependent/SymbolTable.cpp",
|
||||
"glslang/MachineIndependent/SymbolTable.h",
|
||||
"glslang/MachineIndependent/Versions.cpp",
|
||||
@@ -248,8 +246,6 @@ template("glslang_sources_common") {
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [ "${target_gen_dir}/include" ]
|
||||
|
||||
deps = [ ":glslang_build_info" ]
|
||||
|
||||
if (invoker.enable_opt) {
|
||||
@@ -257,9 +253,10 @@ template("glslang_sources_common") {
|
||||
"${spirv_tools_dir}:spvtools_opt",
|
||||
"${spirv_tools_dir}:spvtools_val",
|
||||
]
|
||||
include_dirs += [ "${spirv_tools_dir}/include" ]
|
||||
}
|
||||
|
||||
include_dirs = [ "${target_gen_dir}/include" ]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
@@ -305,10 +302,7 @@ executable("glslang_validator") {
|
||||
]
|
||||
public_configs = [ ":glslang_hlsl" ]
|
||||
|
||||
include_dirs = [
|
||||
"${target_gen_dir}/include",
|
||||
"${spirv_tools_dir}/include",
|
||||
]
|
||||
include_dirs = [ "${target_gen_dir}/include" ]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
@@ -319,8 +313,6 @@ executable("spirv-remap") {
|
||||
defines = [ "ENABLE_OPT=1" ]
|
||||
deps = [ ":glslang_sources" ]
|
||||
|
||||
include_dirs = [ "${spirv_tools_dir}/include" ]
|
||||
|
||||
configs -= _configs_to_remove
|
||||
configs += _configs_to_add
|
||||
}
|
||||
|
||||
Regular → Executable
-78
@@ -3,84 +3,6 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## 11.10.0 2022-06-02
|
||||
|
||||
### Other changes
|
||||
* Generate OpLine before OpFunction
|
||||
* Add support for VK_EXT_fragment_shader_barycentric
|
||||
* Add whitelist filtering for debug comments in SPIRV-Remap
|
||||
* Add support for GL_EXT_ray_cull_mask
|
||||
|
||||
## 11.9.0 2022-04-06
|
||||
|
||||
### Other changes
|
||||
* Add GLSL version override functionality
|
||||
* Add eliminate-dead-input-components to -Os
|
||||
* Add enhanced-msgs option
|
||||
* Explicitly use Python 3 for builds
|
||||
|
||||
## 11.8.0 2022-01-27
|
||||
|
||||
### Other changes
|
||||
* Add support for SPIR-V 1.6
|
||||
* Add support for Vulkan 1.3
|
||||
* Add --hlsl-dx-position-w option
|
||||
|
||||
## 11.7.0 2021-11-11
|
||||
|
||||
### Other changes
|
||||
* Add support for targeting Vulkan 1.2 in the C API
|
||||
|
||||
## 11.6.0 2021-08-25
|
||||
|
||||
### Other changes
|
||||
* Atomic memory function only for shader storage block member or shared variable
|
||||
* Add support for gl_MaxVaryingVectors for ogl
|
||||
* Fix loading bool arrays from interface blocks
|
||||
* Generate separate stores for partially swizzled memory stores
|
||||
* Allow layout(std430) uniform with GL_EXT_scalar_block_layout
|
||||
* Support for pragma STDGL invariant(all)
|
||||
* Support for GL_NV_ray_tracing_motion_blur
|
||||
|
||||
## 11.5.0 2021-06-23
|
||||
|
||||
### Other changes
|
||||
* Implement GLSL_EXT_shader_atomic_float2
|
||||
* Implement GL_EXT_spirv_intrinsics
|
||||
* Fixed SPIR-V remapper not remapping OpExtInst instruction set IDs
|
||||
* only declare compatibility gl_ variables in compatibility mode
|
||||
* Add support for float spec const vector initialization
|
||||
* Implement GL_EXT_subgroup_uniform_control_flow.
|
||||
* Fix arrays dimensioned with spec constant sized gl_WorkGroupSize
|
||||
* Add support for 64bit integer scalar and vector types to bitCount() builtin
|
||||
|
||||
## 11.4.0 2021-04-22
|
||||
|
||||
### Other changes
|
||||
* Fix to keep source compatible with CMake 3.10.2
|
||||
|
||||
## 11.3.0 2021-04-21
|
||||
|
||||
### Other changes
|
||||
* Added --depfile
|
||||
* Added --auto-sampled-textures
|
||||
* Now supports InterpolateAt-based functions
|
||||
* Supports cross-stage automatic IO mapping
|
||||
* Supports GL_EXT_vulkan_glsl_relaxed (-R option)
|
||||
|
||||
## 11.2.0 2021-02-18
|
||||
|
||||
### Other changes
|
||||
* Removed Python requirement when not building with spirv-tools
|
||||
* Add support for GL_EXT_shared_memory_block
|
||||
* Implement GL_EXT_null_initializer
|
||||
* Add CMake support for Fuschia
|
||||
|
||||
## 11.1.0 2020-12-07
|
||||
|
||||
### Other changes
|
||||
* Added ray-tracing extension support
|
||||
|
||||
## 11.0.0 2020-07-20
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Regular → Executable
+52
-50
@@ -31,18 +31,15 @@
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
project(glslang
|
||||
LANGUAGES CXX)
|
||||
|
||||
# increase to 3.1 once all major distributions
|
||||
# include a version of CMake >= 3.1
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
project(glslang LANGUAGES CXX)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Enable compile commands database
|
||||
@@ -106,17 +103,10 @@ CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
|
||||
option(ENABLE_RTTI "Enables RTTI" OFF)
|
||||
option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF)
|
||||
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
|
||||
|
||||
if(MINGW OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU"))
|
||||
# Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments
|
||||
# which gcc rejects
|
||||
option(ENABLE_PCH "Enables Precompiled header" OFF)
|
||||
else()
|
||||
option(ENABLE_PCH "Enables Precompiled header" ON)
|
||||
endif()
|
||||
option(ENABLE_PCH "Enables Precompiled header" ON)
|
||||
option(ENABLE_CTEST "Enables testing" ON)
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
|
||||
endif()
|
||||
|
||||
@@ -125,7 +115,7 @@ if(USE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
endif()
|
||||
endif(CCACHE_FOUND)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CTEST)
|
||||
@@ -134,27 +124,26 @@ endif()
|
||||
|
||||
if(ENABLE_HLSL)
|
||||
add_definitions(-DENABLE_HLSL)
|
||||
endif()
|
||||
endif(ENABLE_HLSL)
|
||||
|
||||
if(ENABLE_GLSLANG_WEBMIN)
|
||||
add_definitions(-DGLSLANG_WEB)
|
||||
if(ENABLE_GLSLANG_WEBMIN_DEVEL)
|
||||
add_definitions(-DGLSLANG_WEB_DEVEL)
|
||||
endif()
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_WEBMIN_DEVEL)
|
||||
endif(ENABLE_GLSLANG_WEBMIN)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
option(OVERRIDE_MSVCCRT "Overrides runtime of MSVC " ON)
|
||||
if(MSVC AND OVERRIDE_MSVCCRT)
|
||||
if(MSVC)
|
||||
include(ChooseMSVCCRT.cmake)
|
||||
endif()
|
||||
endif(MSVC)
|
||||
add_definitions(-DGLSLANG_OSINCLUDE_WIN32)
|
||||
elseif(UNIX)
|
||||
add_definitions(-DGLSLANG_OSINCLUDE_UNIX)
|
||||
else()
|
||||
else(WIN32)
|
||||
message("unknown platform")
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||
@@ -170,7 +159,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
add_compile_options(-Werror=deprecated-copy)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.13")
|
||||
# Error if there's symbols that are not found at link time.
|
||||
# add_link_options() was added in CMake 3.13 - if using an earlier
|
||||
# version don't set this - it should be caught by presubmits anyway.
|
||||
@@ -191,26 +180,19 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
||||
# Error if there's symbols that are not found at link time.
|
||||
# add_link_options() was added in CMake 3.13 - if using an earlier
|
||||
# version don't set this - it should be caught by presubmits anyway.
|
||||
if (WIN32)
|
||||
add_link_options("-Wl,--no-undefined")
|
||||
else()
|
||||
add_link_options("-Wl,-undefined,error")
|
||||
endif()
|
||||
add_link_options("-Wl,-undefined,error")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
if(NOT ENABLE_RTTI)
|
||||
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
|
||||
if(MSVC_HAS_GR)
|
||||
string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE /GR /GR- CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
else()
|
||||
add_compile_options(/GR-) # Disable RTTI
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_EXCEPTIONS)
|
||||
add_compile_options(/EHsc) # Enable Exceptions
|
||||
else()
|
||||
string(REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Try to remove default /EHsc cxx_flag
|
||||
add_compile_options(/D_HAS_EXCEPTIONS=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -224,7 +206,7 @@ if(ENABLE_GLSLANG_JS)
|
||||
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_JS)
|
||||
|
||||
# Request C++11
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.1)
|
||||
@@ -252,33 +234,55 @@ if(NOT COMMAND find_host_package)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
# CMake needs to find the right version of python, right from the beginning,
|
||||
# otherwise, it will find the wrong version and fail later
|
||||
find_host_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
# Root directory for build-time generated include files
|
||||
set(GLSLANG_GENERATED_INCLUDEDIR "${CMAKE_BINARY_DIR}/include")
|
||||
|
||||
################################################################################
|
||||
# Build version information generation
|
||||
################################################################################
|
||||
include(parse_version.cmake)
|
||||
set(GLSLANG_CHANGES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES.md")
|
||||
set(GLSLANG_BUILD_INFO_PY "${CMAKE_CURRENT_SOURCE_DIR}/build_info.py")
|
||||
set(GLSLANG_BUILD_INFO_H_TMPL "${CMAKE_CURRENT_SOURCE_DIR}/build_info.h.tmpl")
|
||||
set(GLSLANG_BUILD_INFO_H "${GLSLANG_GENERATED_INCLUDEDIR}/glslang/build_info.h")
|
||||
|
||||
parse_version(${GLSLANG_CHANGES_FILE} GLSLANG)
|
||||
# Command to build the build_info.h file
|
||||
add_custom_command(
|
||||
OUTPUT ${GLSLANG_BUILD_INFO_H}
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_BUILD_INFO_PY}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"-i" ${GLSLANG_BUILD_INFO_H_TMPL}
|
||||
"-o" ${GLSLANG_BUILD_INFO_H}
|
||||
DEPENDS ${GLSLANG_BUILD_INFO_PY}
|
||||
${GLSLANG_CHANGES_FILE}
|
||||
${GLSLANG_BUILD_INFO_H_TMPL}
|
||||
COMMENT "Generating ${GLSLANG_BUILD_INFO_H}")
|
||||
|
||||
function(configurate_version)
|
||||
set(major ${GLSLANG_VERSION_MAJOR})
|
||||
set(minor ${GLSLANG_VERSION_MINOR})
|
||||
set(patch ${GLSLANG_VERSION_PATCH})
|
||||
set(flavor ${GLSLANG_VERSION_FLAVOR})
|
||||
configure_file(${GLSLANG_BUILD_INFO_H_TMPL} ${GLSLANG_BUILD_INFO_H} @ONLY)
|
||||
endfunction()
|
||||
# Target to build the build_info.h file
|
||||
add_custom_target(glslang-build-info DEPENDS ${GLSLANG_BUILD_INFO_H})
|
||||
|
||||
configurate_version()
|
||||
# Populate the CMake GLSLANG_VERSION* variables with the build version
|
||||
# information.
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_BUILD_INFO_PY}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR} "<major>.<minor>.<patch><-flavor>;<major>;<minor>;<patch>;<flavor>"
|
||||
OUTPUT_VARIABLE "GLSLANG_VERSIONS"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
list(GET "GLSLANG_VERSIONS" 0 "GLSLANG_VERSION")
|
||||
list(GET "GLSLANG_VERSIONS" 1 "GLSLANG_VERSION_MAJOR")
|
||||
list(GET "GLSLANG_VERSIONS" 2 "GLSLANG_VERSION_MINOR")
|
||||
list(GET "GLSLANG_VERSIONS" 3 "GLSLANG_VERSION_PATCH")
|
||||
list(GET "GLSLANG_VERSIONS" 4 "GLSLANG_VERSION_FLAVOR")
|
||||
configure_file(${GLSLANG_CHANGES_FILE} "${CMAKE_CURRENT_BINARY_DIR}/CHANGES.md") # Required to re-run cmake on version change
|
||||
|
||||
# glslang_add_build_info_dependency() adds the glslang-build-info dependency and
|
||||
# generated include directories to target.
|
||||
function(glslang_add_build_info_dependency target)
|
||||
target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${GLSLANG_GENERATED_INCLUDEDIR}>)
|
||||
add_dependencies(${target} glslang-build-info)
|
||||
endfunction()
|
||||
|
||||
# glslang_only_export_explicit_symbols() makes the symbol visibility hidden by
|
||||
@@ -312,8 +316,6 @@ else()
|
||||
endif()
|
||||
|
||||
if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
|
||||
find_host_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
# We depend on these for later projects, so they should come first.
|
||||
add_subdirectory(External)
|
||||
endif()
|
||||
@@ -340,7 +342,7 @@ endif()
|
||||
add_subdirectory(SPIRV)
|
||||
if(ENABLE_HLSL)
|
||||
add_subdirectory(hlsl)
|
||||
endif()
|
||||
endif(ENABLE_HLSL)
|
||||
if(ENABLE_CTEST)
|
||||
add_subdirectory(gtests)
|
||||
endif()
|
||||
@@ -357,11 +359,11 @@ if(ENABLE_CTEST AND BUILD_TESTING)
|
||||
set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/localResults)
|
||||
set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$<CONFIGURATION>/glslangValidator)
|
||||
set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$<CONFIGURATION>/spirv-remap)
|
||||
else()
|
||||
else(CMAKE_CONFIGURATION_TYPES)
|
||||
set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/localResults)
|
||||
set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/glslangValidator)
|
||||
set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap)
|
||||
endif()
|
||||
endif(CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
add_test(NAME glslang-testsuite
|
||||
COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+30
-662
@@ -303,647 +303,41 @@ APACHE LICENSE, VERSION 2.0
|
||||
GPL 3 with special bison exception
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
Bison Exception
|
||||
|
||||
As a special exception, you may create a larger work that contains part or all
|
||||
of the Bison parser skeleton and distribute that work under terms of your
|
||||
choice, so long as that work isn't itself a parser generator using the skeleton
|
||||
or a modified version thereof as a parser skeleton. Alternatively, if you
|
||||
modify or redistribute the parser skeleton itself, you may (at your option)
|
||||
remove this special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public License without
|
||||
this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in version
|
||||
2.2 of Bison.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
Bison implementation for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
================================================================================
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
The preprocessor has the core licenses stated above, plus additional licences:
|
||||
The preprocessor has the core licenses stated above, plus an additional licence:
|
||||
|
||||
/****************************************************************************\
|
||||
Copyright (c) 2002, NVIDIA Corporation.
|
||||
@@ -988,29 +382,3 @@ NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
|
||||
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
||||
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
\****************************************************************************/
|
||||
|
||||
/*
|
||||
** Copyright (c) 2014-2016 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and/or associated documentation files (the "Materials"),
|
||||
** to deal in the Materials without restriction, including without limitation
|
||||
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
** and/or sell copies of the Materials, and to permit persons to whom the
|
||||
** Materials are furnished to do so, subject to the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included in
|
||||
** all copies or substantial portions of the Materials.
|
||||
**
|
||||
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
|
||||
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
|
||||
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
|
||||
**
|
||||
** THE MATERIALS ARE 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 MATERIALS OR THE USE OR OTHER DEALINGS
|
||||
** IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Notes:
|
||||
This is project config file for OpenHarmony OSS Audit Tool, if you have any questions or concerns, please email chenyaxun.
|
||||
-->
|
||||
<!-- OAT(OSS Audit Tool) configuration guide:
|
||||
basedir: Root dir, the basedir + project path is the real source file location.
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
tasklist(only for batch mode):
|
||||
1. task: Define oat check thread, each task will start a new thread.
|
||||
2. task name: Only an name, no practical effect.
|
||||
3. task policy: Default policy for projects under this task, this field is required and the specified policy must defined in policylist.
|
||||
4. task filter: Default filefilter for projects under this task, this field is required and the specified filefilter must defined in filefilterlist.
|
||||
5. task project: Projects to be checked, the path field define the source root dir of the project.
|
||||
|
||||
|
||||
policyList:
|
||||
1. policy: All policyitems will be merged to default OAT.xml rules, the name of policy doesn't affect OAT check process.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(support projectroot in default OAT.xml), supported file names: LICENSE, README, README.OpenSource
|
||||
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == >
|
||||
& == >
|
||||
' == >
|
||||
< == >
|
||||
> == >
|
||||
-->
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile>COPYING</licensefile>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<filteritem type="filepath" name=".*" desc="third party"/>
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<filteritem type="filename" name="README.OpenSource"/>
|
||||
<filteritem type="filename" name="README"/>
|
||||
<filteritem type="filename" name="*.pc"/>
|
||||
<filteritem type="filename" name="doxygen.ini.in" desc="not used in ohos"/>
|
||||
<filteritem type="filename" name="COPYING" desc="data/COPYING not used in ohos"/>
|
||||
<filteritem type="filename" name="DCO-1.1.txt" desc="not used in ohos"/>
|
||||
</filefilter>
|
||||
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies" >
|
||||
<filteritem type="filename" name="README.OpenSource"/>
|
||||
<filteritem type="filename" name="README"/>
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filename" name="*.bmp|*.png|*.jpg" desc="binary not used and belonged to weston"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
@@ -19,8 +19,8 @@ See issue #1964.
|
||||
|
||||
If people are only using this location to get spirv.hpp, I recommend they get that from [SPIRV-Headers](https://github.com/KhronosGroup/SPIRV-Headers) instead.
|
||||
|
||||
[](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
|
||||

|
||||
[](https://travis-ci.org/KhronosGroup/glslang)
|
||||
[](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
|
||||
|
||||
# Glslang Components and Status
|
||||
|
||||
@@ -85,15 +85,7 @@ The applied stage-specific rules are based on the file extension:
|
||||
* `.frag` for a fragment shader
|
||||
* `.comp` for a compute shader
|
||||
|
||||
For ray tracing pipeline shaders:
|
||||
* `.rgen` for a ray generation shader
|
||||
* `.rint` for a ray intersection shader
|
||||
* `.rahit` for a ray any-hit shader
|
||||
* `.rchit` for a ray closest-hit shader
|
||||
* `.rmiss` for a ray miss shader
|
||||
* `.rcall` for a callable shader
|
||||
|
||||
There is also a non-shader extension:
|
||||
There is also a non-shader extension
|
||||
* `.conf` for a configuration file of limits, see usage statement for example
|
||||
|
||||
## Building (CMake)
|
||||
@@ -133,15 +125,6 @@ cd <the directory glslang was cloned to, "External" will be a subdirectory>
|
||||
git clone https://github.com/google/googletest.git External/googletest
|
||||
```
|
||||
|
||||
TEMPORARY NOTICE: additionally perform the following to avoid a current
|
||||
breakage in googletest:
|
||||
|
||||
```bash
|
||||
cd External/googletest
|
||||
git checkout 0c400f67fcf305869c5fb113dd296eca266c9725
|
||||
cd ../..
|
||||
```
|
||||
|
||||
If you wish to assure that SPIR-V generated from HLSL is legal for Vulkan,
|
||||
wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, or wish to run the
|
||||
integrated test suite, install spirv-tools with this:
|
||||
@@ -169,8 +152,8 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE
|
||||
|
||||
For building on Android:
|
||||
```bash
|
||||
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
|
||||
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_HOME%\prebuilt\windows-x86_64\bin\make.exe
|
||||
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
|
||||
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe
|
||||
# -G is needed for building on Windows
|
||||
# -DANDROID_ABI can also be armeabi-v7a for 32 bit
|
||||
```
|
||||
@@ -429,77 +412,6 @@ ShCompile(shader, compiler) -> compiler(AST) -> <back end>
|
||||
In practice, `ShCompile()` takes shader strings, default version, and
|
||||
warning/error and other options for controlling compilation.
|
||||
|
||||
### C Functional Interface (new)
|
||||
|
||||
This interface is located `glslang_c_interface.h` and exposes functionality similar to the C++ interface. The following snippet is a complete example showing how to compile GLSL into SPIR-V 1.5 for Vulkan 1.2.
|
||||
|
||||
```cxx
|
||||
std::vector<uint32_t> compileShaderToSPIRV_Vulkan(glslang_stage_t stage, const char* shaderSource, const char* fileName)
|
||||
{
|
||||
const glslang_input_t input = {
|
||||
.language = GLSLANG_SOURCE_GLSL,
|
||||
.stage = stage,
|
||||
.client = GLSLANG_CLIENT_VULKAN,
|
||||
.client_version = GLSLANG_TARGET_VULKAN_1_2,
|
||||
.target_language = GLSLANG_TARGET_SPV,
|
||||
.target_language_version = GLSLANG_TARGET_SPV_1_5,
|
||||
.code = shaderSource,
|
||||
.default_version = 100,
|
||||
.default_profile = GLSLANG_NO_PROFILE,
|
||||
.force_default_version_and_profile = false,
|
||||
.forward_compatible = false,
|
||||
.messages = GLSLANG_MSG_DEFAULT_BIT,
|
||||
.resource = reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource),
|
||||
};
|
||||
|
||||
glslang_shader_t* shader = glslang_shader_create(&input);
|
||||
|
||||
if (!glslang_shader_preprocess(shader, &input)) {
|
||||
printf("GLSL preprocessing failed %s\n", fileName);
|
||||
printf("%s\n", glslang_shader_get_info_log(shader));
|
||||
printf("%s\n", glslang_shader_get_info_debug_log(shader));
|
||||
printf("%s\n", input.code);
|
||||
glslang_shader_delete(shader);
|
||||
return std::vector<uint32_t>();
|
||||
}
|
||||
|
||||
if (!glslang_shader_parse(shader, &input)) {
|
||||
printf("GLSL parsing failed %s\n", fileName);
|
||||
printf("%s\n", glslang_shader_get_info_log(shader));
|
||||
printf("%s\n", glslang_shader_get_info_debug_log(shader));
|
||||
printf("%s\n", glslang_shader_get_preprocessed_code(shader));
|
||||
glslang_shader_delete(shader);
|
||||
return std::vector<uint32_t>();
|
||||
}
|
||||
|
||||
glslang_program_t* program = glslang_program_create();
|
||||
glslang_program_add_shader(program, shader);
|
||||
|
||||
if (!glslang_program_link(program, GLSLANG_MSG_SPV_RULES_BIT | GLSLANG_MSG_VULKAN_RULES_BIT)) {
|
||||
printf("GLSL linking failed %s\n", fileName);
|
||||
printf("%s\n", glslang_program_get_info_log(program));
|
||||
printf("%s\n", glslang_program_get_info_debug_log(program));
|
||||
glslang_program_delete(program);
|
||||
glslang_shader_delete(shader);
|
||||
return std::vector<uint32_t>();
|
||||
}
|
||||
|
||||
glslang_program_SPIRV_generate(program, stage);
|
||||
|
||||
std::vector<uint32_t> outShaderModule(glslang_program_SPIRV_get_size(program));
|
||||
glslang_program_SPIRV_get(program, outShaderModule.data());
|
||||
|
||||
const char* spirv_messages = glslang_program_SPIRV_get_messages(program);
|
||||
if (spirv_messages)
|
||||
printf("(%s) %s\b", fileName, spirv_messages);
|
||||
|
||||
glslang_program_delete(program);
|
||||
glslang_shader_delete(shader);
|
||||
|
||||
return outShaderModule;
|
||||
}
|
||||
```
|
||||
|
||||
## Basic Internal Operation
|
||||
|
||||
* Initial lexical analysis is done by the preprocessor in
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+4
-5
@@ -101,20 +101,19 @@ if(ENABLE_OPT)
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
|
||||
else()
|
||||
target_link_libraries(SPIRV PRIVATE MachineIndependent)
|
||||
endif()
|
||||
endif(ENABLE_OPT)
|
||||
|
||||
if(WIN32)
|
||||
source_group("Source" FILES ${SOURCES} ${HEADERS})
|
||||
source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
install(TARGETS SPIRV EXPORT SPIRVTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
@@ -136,4 +135,4 @@ if(ENABLE_GLSLANG_INSTALL)
|
||||
install(EXPORT SPIRVTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
|
||||
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
Regular → Executable
Regular → Executable
-3
@@ -36,8 +36,5 @@ static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fu
|
||||
static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density";
|
||||
static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max";
|
||||
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
|
||||
|
||||
#endif // #ifndef GLSLextEXT_H
|
||||
|
||||
Regular → Executable
+1
-6
@@ -29,7 +29,7 @@
|
||||
#define GLSLextKHR_H
|
||||
|
||||
static const int GLSLextKHRVersion = 100;
|
||||
static const int GLSLextKHRRevision = 3;
|
||||
static const int GLSLextKHRRevision = 2;
|
||||
|
||||
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
|
||||
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
|
||||
@@ -49,9 +49,4 @@ static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_s
|
||||
static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing";
|
||||
static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query";
|
||||
static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragment_shading_rate";
|
||||
static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation";
|
||||
static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout";
|
||||
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
|
||||
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
||||
Regular → Executable
-3
@@ -69,9 +69,6 @@ const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader";
|
||||
//SPV_NV_raytracing
|
||||
const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing";
|
||||
|
||||
//SPV_NV_ray_tracing_motion_blur
|
||||
const char* const E_SPV_NV_ray_tracing_motion_blur = "SPV_NV_ray_tracing_motion_blur";
|
||||
|
||||
//SPV_NV_shading_rate
|
||||
const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate";
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
+127
-844
File diff suppressed because it is too large
Load Diff
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+11
-45
@@ -160,29 +160,15 @@ namespace spv {
|
||||
}
|
||||
|
||||
// Is this an opcode we should remove when using --strip?
|
||||
bool spirvbin_t::isStripOp(spv::Op opCode, unsigned start) const
|
||||
bool spirvbin_t::isStripOp(spv::Op opCode) const
|
||||
{
|
||||
switch (opCode) {
|
||||
case spv::OpSource:
|
||||
case spv::OpSourceExtension:
|
||||
case spv::OpName:
|
||||
case spv::OpMemberName:
|
||||
case spv::OpLine :
|
||||
{
|
||||
const std::string name = literalString(start + 2);
|
||||
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it = stripWhiteList.begin(); it < stripWhiteList.end(); it++)
|
||||
{
|
||||
if (name.find(*it) != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
default :
|
||||
return false;
|
||||
case spv::OpLine: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,21 +297,15 @@ namespace spv {
|
||||
std::string spirvbin_t::literalString(unsigned word) const
|
||||
{
|
||||
std::string literal;
|
||||
const spirword_t * pos = spv.data() + word;
|
||||
|
||||
literal.reserve(16);
|
||||
|
||||
do {
|
||||
spirword_t word = *pos;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
char c = word & 0xff;
|
||||
if (c == '\0')
|
||||
return literal;
|
||||
literal += c;
|
||||
word >>= 8;
|
||||
}
|
||||
pos++;
|
||||
} while (true);
|
||||
const char* bytes = reinterpret_cast<const char*>(spv.data() + word);
|
||||
|
||||
while (bytes && *bytes)
|
||||
literal += *bytes++;
|
||||
|
||||
return literal;
|
||||
}
|
||||
|
||||
void spirvbin_t::applyMap()
|
||||
@@ -386,7 +366,7 @@ namespace spv {
|
||||
process(
|
||||
[&](spv::Op opCode, unsigned start) {
|
||||
// remember opcodes we want to strip later
|
||||
if (isStripOp(opCode, start))
|
||||
if (isStripOp(opCode))
|
||||
stripInst(start);
|
||||
return true;
|
||||
},
|
||||
@@ -564,9 +544,6 @@ namespace spv {
|
||||
// Extended instructions: currently, assume everything is an ID.
|
||||
// TODO: add whatever data we need for exceptions to that
|
||||
if (opCode == spv::OpExtInst) {
|
||||
|
||||
idFn(asId(word)); // Instruction set is an ID that also needs to be mapped
|
||||
|
||||
word += 2; // instruction set, and instruction from set
|
||||
numOperands -= 2;
|
||||
|
||||
@@ -1508,24 +1485,13 @@ namespace spv {
|
||||
}
|
||||
|
||||
// remap from a memory image
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, const std::vector<std::string>& whiteListStrings,
|
||||
std::uint32_t opts)
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, std::uint32_t opts)
|
||||
{
|
||||
stripWhiteList = whiteListStrings;
|
||||
spv.swap(in_spv);
|
||||
remap(opts);
|
||||
spv.swap(in_spv);
|
||||
}
|
||||
|
||||
// remap from a memory image - legacy interface without white list
|
||||
void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, std::uint32_t opts)
|
||||
{
|
||||
stripWhiteList.clear();
|
||||
spv.swap(in_spv);
|
||||
remap(opts);
|
||||
spv.swap(in_spv);
|
||||
}
|
||||
|
||||
} // namespace SPV
|
||||
|
||||
#endif // defined (use_cpp11)
|
||||
|
||||
Regular → Executable
-8
@@ -118,10 +118,6 @@ public:
|
||||
virtual ~spirvbin_t() { }
|
||||
|
||||
// remap on an existing binary in memory
|
||||
void remap(std::vector<std::uint32_t>& spv, const std::vector<std::string>& whiteListStrings,
|
||||
std::uint32_t opts = DO_EVERYTHING);
|
||||
|
||||
// remap on an existing binary in memory - legacy interface without white list
|
||||
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = DO_EVERYTHING);
|
||||
|
||||
// Type for error/log handler functions
|
||||
@@ -184,8 +180,6 @@ private:
|
||||
unsigned typeSizeInWords(spv::Id id) const;
|
||||
unsigned idTypeSizeInWords(spv::Id id) const;
|
||||
|
||||
bool isStripOp(spv::Op opCode, unsigned start) const;
|
||||
|
||||
spv::Id& asId(unsigned word) { return spv[word]; }
|
||||
const spv::Id& asId(unsigned word) const { return spv[word]; }
|
||||
spv::Op asOpCode(unsigned word) const { return opOpCode(spv[word]); }
|
||||
@@ -255,8 +249,6 @@ private:
|
||||
|
||||
std::vector<spirword_t> spv; // SPIR words
|
||||
|
||||
std::vector<std::string> stripWhiteList;
|
||||
|
||||
namemap_t nameMap; // ID names from OpName
|
||||
|
||||
// Since we want to also do binary ops, we can't use std::vector<bool>. we could use
|
||||
|
||||
Regular → Executable
+39
-143
@@ -427,37 +427,6 @@ Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands)
|
||||
{
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[opcode].size(); ++t) {
|
||||
type = groupedTypes[opcode][t];
|
||||
if (static_cast<size_t>(type->getNumOperands()) != operands.size())
|
||||
continue; // Number mismatch, find next
|
||||
|
||||
bool match = true;
|
||||
for (int op = 0; match && op < (int)operands.size(); ++op) {
|
||||
match = (operands[op].isId ? type->getIdOperand(op) : type->getImmediateOperand(op)) == operands[op].word;
|
||||
}
|
||||
if (match)
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
// not found, make it
|
||||
type = new Instruction(getUniqueId(), NoType, opcode);
|
||||
for (size_t op = 0; op < operands.size(); ++op) {
|
||||
if (operands[op].isId)
|
||||
type->addIdOperand(operands[op].word);
|
||||
else
|
||||
type->addImmediateOperand(operands[op].word);
|
||||
}
|
||||
groupedTypes[opcode].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
// TODO: performance: track arrays per stride
|
||||
// If a stride is supplied (non-zero) make an array.
|
||||
@@ -652,13 +621,13 @@ Id Builder::makeAccelerationStructureType()
|
||||
Id Builder::makeRayQueryType()
|
||||
{
|
||||
Instruction *type;
|
||||
if (groupedTypes[OpTypeRayQueryKHR].size() == 0) {
|
||||
type = new Instruction(getUniqueId(), NoType, OpTypeRayQueryKHR);
|
||||
groupedTypes[OpTypeRayQueryKHR].push_back(type);
|
||||
if (groupedTypes[OpTypeRayQueryProvisionalKHR].size() == 0) {
|
||||
type = new Instruction(getUniqueId(), NoType, OpTypeRayQueryProvisionalKHR);
|
||||
groupedTypes[OpTypeRayQueryProvisionalKHR].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
} else {
|
||||
type = groupedTypes[OpTypeRayQueryKHR].back();
|
||||
type = groupedTypes[OpTypeRayQueryProvisionalKHR].back();
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
@@ -774,26 +743,6 @@ Id Builder::getContainedTypeId(Id typeId, int member) const
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out the final resulting type of the access chain.
|
||||
Id Builder::getResultingAccessChainType() const
|
||||
{
|
||||
assert(accessChain.base != NoResult);
|
||||
Id typeId = getTypeId(accessChain.base);
|
||||
|
||||
assert(isPointerType(typeId));
|
||||
typeId = getContainedTypeId(typeId);
|
||||
|
||||
for (int i = 0; i < (int)accessChain.indexChain.size(); ++i) {
|
||||
if (isStructType(typeId)) {
|
||||
assert(isConstantScalar(accessChain.indexChain[i]));
|
||||
typeId = getContainedTypeId(typeId, getConstantScalar(accessChain.indexChain[i]));
|
||||
} else
|
||||
typeId = getContainedTypeId(typeId, accessChain.indexChain[i]);
|
||||
}
|
||||
|
||||
return typeId;
|
||||
}
|
||||
|
||||
// Return the immediately contained type of a given composite type.
|
||||
Id Builder::getContainedTypeId(Id typeId) const
|
||||
{
|
||||
@@ -920,30 +869,6 @@ bool Builder::isSpecConstantOpCode(Op opcode) const
|
||||
}
|
||||
}
|
||||
|
||||
Id Builder::makeNullConstant(Id typeId)
|
||||
{
|
||||
Instruction* constant;
|
||||
|
||||
// See if we already made it.
|
||||
Id existing = NoResult;
|
||||
for (int i = 0; i < (int)nullConstants.size(); ++i) {
|
||||
constant = nullConstants[i];
|
||||
if (constant->getTypeId() == typeId)
|
||||
existing = constant->getResultId();
|
||||
}
|
||||
|
||||
if (existing != NoResult)
|
||||
return existing;
|
||||
|
||||
// Make it
|
||||
Instruction* c = new Instruction(getUniqueId(), typeId, OpConstantNull);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(c));
|
||||
nullConstants.push_back(c);
|
||||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeBoolConstant(bool b, bool specConstant)
|
||||
{
|
||||
Id typeId = makeBoolType();
|
||||
@@ -1522,10 +1447,10 @@ void Builder::leaveFunction()
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::makeStatementTerminator(spv::Op opcode, const char *name)
|
||||
void Builder::makeDiscard()
|
||||
{
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(new Instruction(opcode)));
|
||||
createAndSetNoPredecessorBlock(name);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(new Instruction(OpKill)));
|
||||
createAndSetNoPredecessorBlock("post-discard");
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
@@ -1636,7 +1561,16 @@ Id Builder::createLoad(Id lValue, spv::Decoration precision, spv::MemoryAccessMa
|
||||
Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vector<Id>& offsets)
|
||||
{
|
||||
// Figure out the final resulting type.
|
||||
Id typeId = getResultingAccessChainType();
|
||||
spv::Id typeId = getTypeId(base);
|
||||
assert(isPointerType(typeId) && offsets.size() > 0);
|
||||
typeId = getContainedTypeId(typeId);
|
||||
for (int i = 0; i < (int)offsets.size(); ++i) {
|
||||
if (isStructType(typeId)) {
|
||||
assert(isConstantScalar(offsets[i]));
|
||||
typeId = getContainedTypeId(typeId, getConstantScalar(offsets[i]));
|
||||
} else
|
||||
typeId = getContainedTypeId(typeId, offsets[i]);
|
||||
}
|
||||
typeId = makePointer(storageClass, typeId);
|
||||
|
||||
// Make the instruction
|
||||
@@ -2585,7 +2519,7 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
for (int arg = 0; arg < (int)sources.size() && col < numCols; ++arg) {
|
||||
for (int arg = 0; arg < (int)sources.size(); ++arg) {
|
||||
Id argComp = sources[arg];
|
||||
for (int comp = 0; comp < getNumComponents(sources[arg]); ++comp) {
|
||||
if (getNumComponents(sources[arg]) > 1) {
|
||||
@@ -2597,10 +2531,6 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
|
||||
row = 0;
|
||||
col++;
|
||||
}
|
||||
if (col == numCols) {
|
||||
// If more components are provided than fit the matrix, discard the rest.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2831,70 +2761,36 @@ void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizz
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
void Builder::accessChainStore(Id rvalue, Decoration nonUniform, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
{
|
||||
assert(accessChain.isRValue == false);
|
||||
|
||||
transferAccessChainSwizzle(true);
|
||||
Id base = collapseAccessChain();
|
||||
Id source = rvalue;
|
||||
|
||||
// If a swizzle exists and is not full and is not dynamic, then the swizzle will be broken into individual stores.
|
||||
if (accessChain.swizzle.size() > 0 &&
|
||||
getNumTypeComponents(getResultingAccessChainType()) != (int)accessChain.swizzle.size() &&
|
||||
accessChain.component == NoResult) {
|
||||
for (unsigned int i = 0; i < accessChain.swizzle.size(); ++i) {
|
||||
accessChain.indexChain.push_back(makeUintConstant(accessChain.swizzle[i]));
|
||||
accessChain.instr = NoResult;
|
||||
// dynamic component should be gone
|
||||
assert(accessChain.component == NoResult);
|
||||
|
||||
Id base = collapseAccessChain();
|
||||
addDecoration(base, nonUniform);
|
||||
|
||||
accessChain.indexChain.pop_back();
|
||||
accessChain.instr = NoResult;
|
||||
|
||||
// dynamic component should be gone
|
||||
assert(accessChain.component == NoResult);
|
||||
|
||||
Id source = createCompositeExtract(rvalue, getContainedTypeId(getTypeId(rvalue)), i);
|
||||
|
||||
// take LSB of alignment
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
if (getStorageClass(base) == StorageClassPhysicalStorageBufferEXT) {
|
||||
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
|
||||
}
|
||||
|
||||
createStore(source, base, memoryAccess, scope, alignment);
|
||||
}
|
||||
// If swizzle still exists, it is out-of-order or not full, we must load the target vector,
|
||||
// extract and insert elements to perform writeMask and/or swizzle.
|
||||
if (accessChain.swizzle.size() > 0) {
|
||||
Id tempBaseId = createLoad(base, spv::NoPrecision);
|
||||
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle);
|
||||
}
|
||||
else {
|
||||
Id base = collapseAccessChain();
|
||||
addDecoration(base, nonUniform);
|
||||
|
||||
Id source = rvalue;
|
||||
|
||||
// dynamic component should be gone
|
||||
assert(accessChain.component == NoResult);
|
||||
|
||||
// If swizzle still exists, it may be out-of-order, we must load the target vector,
|
||||
// extract and insert elements to perform writeMask and/or swizzle.
|
||||
if (accessChain.swizzle.size() > 0) {
|
||||
Id tempBaseId = createLoad(base, spv::NoPrecision);
|
||||
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle);
|
||||
}
|
||||
|
||||
// take LSB of alignment
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
if (getStorageClass(base) == StorageClassPhysicalStorageBufferEXT) {
|
||||
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
|
||||
}
|
||||
|
||||
createStore(source, base, memoryAccess, scope, alignment);
|
||||
// take LSB of alignment
|
||||
alignment = alignment & ~(alignment & (alignment-1));
|
||||
if (getStorageClass(base) == StorageClassPhysicalStorageBufferEXT) {
|
||||
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
|
||||
}
|
||||
|
||||
createStore(source, base, memoryAccess, scope, alignment);
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::accessChainLoad(Decoration precision, Decoration l_nonUniform,
|
||||
Decoration r_nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess,
|
||||
spv::Scope scope, unsigned int alignment)
|
||||
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType,
|
||||
spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
|
||||
{
|
||||
Id id;
|
||||
|
||||
@@ -2958,9 +2854,9 @@ Id Builder::accessChainLoad(Decoration precision, Decoration l_nonUniform,
|
||||
// Buffer accesses need the access chain decorated, and this is where
|
||||
// loaded image types get decorated. TODO: This should maybe move to
|
||||
// createImageTextureFunctionCall.
|
||||
addDecoration(id, l_nonUniform);
|
||||
addDecoration(id, nonUniform);
|
||||
id = createLoad(id, precision, memoryAccess, scope, alignment);
|
||||
addDecoration(id, r_nonUniform);
|
||||
addDecoration(id, nonUniform);
|
||||
}
|
||||
|
||||
// Done, unless there are swizzles to do
|
||||
@@ -2981,7 +2877,7 @@ Id Builder::accessChainLoad(Decoration precision, Decoration l_nonUniform,
|
||||
if (accessChain.component != NoResult)
|
||||
id = setPrecision(createVectorExtractDynamic(id, resultType, accessChain.component), precision);
|
||||
|
||||
addDecoration(id, r_nonUniform);
|
||||
addDecoration(id, nonUniform);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+4
-19
@@ -99,10 +99,6 @@ public:
|
||||
stringIds[file_c_str] = strId;
|
||||
return strId;
|
||||
}
|
||||
spv::Id getSourceFile() const
|
||||
{
|
||||
return sourceFileStringId;
|
||||
}
|
||||
void setSourceFile(const std::string& file)
|
||||
{
|
||||
sourceFileStringId = getStringId(file);
|
||||
@@ -185,7 +181,6 @@ public:
|
||||
Id makeSamplerType();
|
||||
Id makeSampledImageType(Id imageType);
|
||||
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
|
||||
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
|
||||
|
||||
// accelerationStructureNV type
|
||||
Id makeAccelerationStructureType();
|
||||
@@ -207,7 +202,6 @@ public:
|
||||
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
|
||||
ImageFormat getImageTypeFormat(Id typeId) const
|
||||
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
Id getResultingAccessChainType() const;
|
||||
|
||||
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
|
||||
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
|
||||
@@ -299,7 +293,6 @@ public:
|
||||
}
|
||||
|
||||
// For making new constants (will return old constant if the requested one was already made).
|
||||
Id makeNullConstant(Id typeId);
|
||||
Id makeBoolConstant(bool b, bool specConstant = false);
|
||||
Id makeInt8Constant(int i, bool specConstant = false)
|
||||
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
|
||||
@@ -364,9 +357,8 @@ public:
|
||||
// Generate all the code needed to finish up a function.
|
||||
void leaveFunction();
|
||||
|
||||
// Create block terminator instruction for certain statements like
|
||||
// discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT
|
||||
void makeStatementTerminator(spv::Op opcode, const char *name);
|
||||
// Create a discard.
|
||||
void makeDiscard();
|
||||
|
||||
// Create a global or function local or IO variable.
|
||||
Id createVariable(Decoration precision, StorageClass, Id type, const char* name = nullptr,
|
||||
@@ -632,7 +624,6 @@ public:
|
||||
CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
|
||||
#else
|
||||
bool isVolatile() const { return volatil; }
|
||||
bool isNonUniform() const { return nonUniform; }
|
||||
bool anyCoherent() const {
|
||||
return coherent || devicecoherent || queuefamilycoherent || workgroupcoherent ||
|
||||
subgroupcoherent || shadercallcoherent;
|
||||
@@ -647,7 +638,6 @@ public:
|
||||
unsigned nonprivate : 1;
|
||||
unsigned volatil : 1;
|
||||
unsigned isImage : 1;
|
||||
unsigned nonUniform : 1;
|
||||
|
||||
void clear() {
|
||||
coherent = 0;
|
||||
@@ -659,7 +649,6 @@ public:
|
||||
nonprivate = 0;
|
||||
volatil = 0;
|
||||
isImage = 0;
|
||||
nonUniform = 0;
|
||||
}
|
||||
|
||||
CoherentFlags operator |=(const CoherentFlags &other) {
|
||||
@@ -672,7 +661,6 @@ public:
|
||||
nonprivate |= other.nonprivate;
|
||||
volatil |= other.volatil;
|
||||
isImage |= other.isImage;
|
||||
nonUniform |= other.nonUniform;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
@@ -733,12 +721,11 @@ public:
|
||||
}
|
||||
|
||||
// use accessChain and swizzle to store value
|
||||
void accessChainStore(Id rvalue, Decoration nonUniform,
|
||||
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
|
||||
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
|
||||
|
||||
// use accessChain and swizzle to load an r-value
|
||||
Id accessChainLoad(Decoration precision, Decoration l_nonUniform, Decoration r_nonUniform, Id ResultType,
|
||||
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType,
|
||||
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax,
|
||||
unsigned int alignment = 0);
|
||||
|
||||
@@ -845,8 +832,6 @@ public:
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
|
||||
// map type opcodes to type instructions
|
||||
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes;
|
||||
// list of OpConstantNull instructions
|
||||
std::vector<Instruction*> nullConstants;
|
||||
|
||||
// stack of switches
|
||||
std::stack<Block*> switchMerges;
|
||||
|
||||
Regular → Executable
+13
-58
@@ -44,8 +44,10 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "SpvBuilder.h"
|
||||
#include "spirv.hpp"
|
||||
|
||||
#include "spirv.hpp"
|
||||
#include "GlslangToSpv.h"
|
||||
#include "SpvBuilder.h"
|
||||
namespace spv {
|
||||
#include "GLSL.std.450.h"
|
||||
#include "GLSL.ext.KHR.h"
|
||||
@@ -111,6 +113,8 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OpAccessChain:
|
||||
case OpPtrAccessChain:
|
||||
case OpCopyObject:
|
||||
break;
|
||||
case OpFConvert:
|
||||
@@ -157,43 +161,26 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
switch (inst.getImmediateOperand(1)) {
|
||||
case GLSLstd450Frexp:
|
||||
case GLSLstd450FrexpStruct:
|
||||
if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeInt, 16))
|
||||
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeInt, 16))
|
||||
addExtension(spv::E_SPV_AMD_gpu_shader_int16);
|
||||
break;
|
||||
case GLSLstd450InterpolateAtCentroid:
|
||||
case GLSLstd450InterpolateAtSample:
|
||||
case GLSLstd450InterpolateAtOffset:
|
||||
if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeFloat, 16))
|
||||
if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeFloat, 16))
|
||||
addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OpAccessChain:
|
||||
case OpPtrAccessChain:
|
||||
if (isPointerType(typeId))
|
||||
break;
|
||||
if (basicTypeOp == OpTypeInt) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
else if (width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
}
|
||||
default:
|
||||
if (basicTypeOp == OpTypeInt) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
else if (width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
else if (width == 64)
|
||||
addCapability(CapabilityInt64);
|
||||
} else if (basicTypeOp == OpTypeFloat) {
|
||||
if (width == 16)
|
||||
addCapability(CapabilityFloat16);
|
||||
else if (width == 64)
|
||||
addCapability(CapabilityFloat64);
|
||||
}
|
||||
if (basicTypeOp == OpTypeFloat && width == 16)
|
||||
addCapability(CapabilityFloat16);
|
||||
if (basicTypeOp == OpTypeInt && width == 16)
|
||||
addCapability(CapabilityInt16);
|
||||
if (basicTypeOp == OpTypeInt && width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -449,38 +436,6 @@ void Builder::postProcessFeatures() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any Vulkan memory model-specific functionality is used, update the
|
||||
// OpMemoryModel to match.
|
||||
if (capabilities.find(spv::CapabilityVulkanMemoryModelKHR) != capabilities.end()) {
|
||||
memoryModel = spv::MemoryModelVulkanKHR;
|
||||
addIncorporatedExtension(spv::E_SPV_KHR_vulkan_memory_model, spv::Spv_1_5);
|
||||
}
|
||||
|
||||
// Add Aliased decoration if there's more than one Workgroup Block variable.
|
||||
if (capabilities.find(spv::CapabilityWorkgroupMemoryExplicitLayoutKHR) != capabilities.end()) {
|
||||
assert(entryPoints.size() == 1);
|
||||
auto &ep = entryPoints[0];
|
||||
|
||||
std::vector<Id> workgroup_variables;
|
||||
for (int i = 0; i < (int)ep->getNumOperands(); i++) {
|
||||
if (!ep->isIdOperand(i))
|
||||
continue;
|
||||
|
||||
const Id id = ep->getIdOperand(i);
|
||||
const Instruction *instr = module.getInstruction(id);
|
||||
if (instr->getOpCode() != spv::OpVariable)
|
||||
continue;
|
||||
|
||||
if (instr->getImmediateOperand(0) == spv::StorageClassWorkgroup)
|
||||
workgroup_variables.push_back(id);
|
||||
}
|
||||
|
||||
if (workgroup_variables.size() > 1) {
|
||||
for (size_t i = 0; i < workgroup_variables.size(); i++)
|
||||
addDecoration(workgroup_variables[i], spv::DecorationAliased);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Regular → Executable
+10
-16
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "SpvTools.h"
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
@@ -68,8 +69,6 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
|
||||
}
|
||||
case glslang::EShTargetVulkan_1_2:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_2;
|
||||
case glslang::EShTargetVulkan_1_3:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_3;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -115,18 +114,11 @@ void OptimizerMesssageConsumer(spv_message_level_t level, const char *source,
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv)
|
||||
{
|
||||
SpirvToolsDisassemble(out, spirv, spv_target_env::SPV_ENV_UNIVERSAL_1_3);
|
||||
}
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
|
||||
spv_target_env requested_context)
|
||||
{
|
||||
// disassemble
|
||||
spv_context context = spvContextCreate(requested_context);
|
||||
spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3);
|
||||
spv_text text;
|
||||
spv_diagnostic diagnostic = nullptr;
|
||||
spvBinaryToText(context, spirv.data(), spirv.size(),
|
||||
@@ -155,8 +147,6 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
||||
spv_validator_options options = spvValidatorOptionsCreate();
|
||||
spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets());
|
||||
spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization);
|
||||
spvValidatorOptionsSetScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, intermediate.usingScalarBlockLayout());
|
||||
spvValidateWithOptions(context, options, &binary, &diagnostic);
|
||||
|
||||
// report
|
||||
@@ -184,7 +174,10 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
|
||||
// line information into all SPIR-V instructions. This avoids loss of
|
||||
// information when instructions are deleted or moved. Later, remove
|
||||
// redundant information to minimize final SPRIR-V size.
|
||||
if (options->stripDebugInfo) {
|
||||
if (options->generateDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreatePropagateLineInfoPass());
|
||||
}
|
||||
else if (options->stripDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreateStripDebugInfoPass());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateWrapOpKillPass());
|
||||
@@ -209,13 +202,14 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
|
||||
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateVectorDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
|
||||
optimizer.RegisterPass(spvtools::CreateInterpolateFixupPass());
|
||||
if (options->optimizeSize) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
|
||||
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass());
|
||||
}
|
||||
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
|
||||
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
|
||||
if (options->generateDebugInfo) {
|
||||
optimizer.RegisterPass(spvtools::CreateRedundantLineInfoElimPass());
|
||||
}
|
||||
|
||||
spvtools::OptimizerOptions spvOptOptions;
|
||||
optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
|
||||
Regular → Executable
+3
-8
@@ -41,10 +41,9 @@
|
||||
#ifndef GLSLANG_SPV_TOOLS_H
|
||||
#define GLSLANG_SPV_TOOLS_H
|
||||
|
||||
#if ENABLE_OPT
|
||||
#ifdef ENABLE_OPT
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#endif
|
||||
|
||||
#include "glslang/MachineIndependent/localintermediate.h"
|
||||
@@ -63,15 +62,11 @@ struct SpvOptions {
|
||||
bool validate;
|
||||
};
|
||||
|
||||
#if ENABLE_OPT
|
||||
#ifdef ENABLE_OPT
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv,
|
||||
spv_target_env requested_context);
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
|
||||
Regular → Executable
Regular → Executable
+19
-34
@@ -43,7 +43,6 @@
|
||||
#include <stack>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "doc.h"
|
||||
@@ -101,7 +100,6 @@ protected:
|
||||
void outputMask(OperandClass operandClass, unsigned mask);
|
||||
void disassembleImmediates(int numOperands);
|
||||
void disassembleIds(int numOperands);
|
||||
std::pair<int, std::string> decodeString();
|
||||
int disassembleString();
|
||||
void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands);
|
||||
|
||||
@@ -292,44 +290,31 @@ void SpirvStream::disassembleIds(int numOperands)
|
||||
}
|
||||
}
|
||||
|
||||
// decode string from words at current position (non-consuming)
|
||||
std::pair<int, std::string> SpirvStream::decodeString()
|
||||
{
|
||||
std::string res;
|
||||
int wordPos = word;
|
||||
char c;
|
||||
bool done = false;
|
||||
|
||||
do {
|
||||
unsigned int content = stream[wordPos];
|
||||
for (int charCount = 0; charCount < 4; ++charCount) {
|
||||
c = content & 0xff;
|
||||
content >>= 8;
|
||||
if (c == '\0') {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
res += c;
|
||||
}
|
||||
++wordPos;
|
||||
} while(! done);
|
||||
|
||||
return std::make_pair(wordPos - word, res);
|
||||
}
|
||||
|
||||
// return the number of operands consumed by the string
|
||||
int SpirvStream::disassembleString()
|
||||
{
|
||||
int startWord = word;
|
||||
|
||||
out << " \"";
|
||||
|
||||
std::pair<int, std::string> decoderes = decodeString();
|
||||
const char* wordString;
|
||||
bool done = false;
|
||||
do {
|
||||
unsigned int content = stream[word];
|
||||
wordString = (const char*)&content;
|
||||
for (int charCount = 0; charCount < 4; ++charCount) {
|
||||
if (*wordString == 0) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
out << *(wordString++);
|
||||
}
|
||||
++word;
|
||||
} while (! done);
|
||||
|
||||
out << decoderes.second;
|
||||
out << "\"";
|
||||
|
||||
word += decoderes.first;
|
||||
|
||||
return decoderes.first;
|
||||
return word - startWord;
|
||||
}
|
||||
|
||||
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
|
||||
@@ -346,7 +331,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||
nextNestedControl = 0;
|
||||
}
|
||||
} else if (opCode == OpExtInstImport) {
|
||||
idDescriptor[resultId] = decodeString().second;
|
||||
idDescriptor[resultId] = (const char*)(&stream[word]);
|
||||
}
|
||||
else {
|
||||
if (resultId != 0 && idDescriptor[resultId].size() == 0) {
|
||||
@@ -443,7 +428,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||
--numOperands;
|
||||
// Get names for printing "(XXX)" for readability, *after* this id
|
||||
if (opCode == OpName)
|
||||
idDescriptor[stream[word - 1]] = decodeString().second;
|
||||
idDescriptor[stream[word - 1]] = (const char*)(&stream[word]);
|
||||
break;
|
||||
case OperandVariableIds:
|
||||
disassembleIds(numOperands);
|
||||
|
||||
Regular → Executable
Regular → Executable
+18
-102
@@ -188,7 +188,6 @@ const char* ExecutionModeString(int mode)
|
||||
case ExecutionModeRoundingModeRTE: return "RoundingModeRTE";
|
||||
case ExecutionModeRoundingModeRTZ: return "RoundingModeRTZ";
|
||||
case ExecutionModeStencilRefReplacingEXT: return "StencilRefReplacingEXT";
|
||||
case ExecutionModeSubgroupUniformControlFlowKHR: return "SubgroupUniformControlFlow";
|
||||
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
@@ -305,8 +304,7 @@ const char* DecorationString(int decoration)
|
||||
case DecorationPerPrimitiveNV: return "PerPrimitiveNV";
|
||||
case DecorationPerViewNV: return "PerViewNV";
|
||||
case DecorationPerTaskNV: return "PerTaskNV";
|
||||
|
||||
case DecorationPerVertexKHR: return "PerVertexKHR";
|
||||
case DecorationPerVertexNV: return "PerVertexNV";
|
||||
|
||||
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
||||
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
||||
@@ -393,12 +391,11 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInObjectRayDirectionKHR: return "ObjectRayDirectionKHR";
|
||||
case BuiltInRayTminKHR: return "RayTminKHR";
|
||||
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
|
||||
case BuiltInCullMaskKHR: return "CullMaskKHR";
|
||||
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
|
||||
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
||||
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
||||
case BuiltInWorldToObjectKHR: return "WorldToObjectKHR";
|
||||
case BuiltInHitTNV: return "HitTNV";
|
||||
case BuiltInHitTKHR: return "HitTKHR";
|
||||
case BuiltInHitKindKHR: return "HitKindKHR";
|
||||
case BuiltInIncomingRayFlagsKHR: return "IncomingRayFlagsKHR";
|
||||
case BuiltInViewportMaskNV: return "ViewportMaskNV";
|
||||
@@ -408,8 +405,8 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
|
||||
// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT
|
||||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||
case BuiltInBaryCoordKHR: return "BaryCoordKHR";
|
||||
case BuiltInBaryCoordNoPerspKHR: return "BaryCoordNoPerspKHR";
|
||||
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
||||
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||
|
||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
@@ -428,7 +425,6 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInSMCountNV: return "SMCountNV";
|
||||
case BuiltInWarpIDNV: return "WarpIDNV";
|
||||
case BuiltInSMIDNV: return "SMIDNV";
|
||||
case BuiltInCurrentRayTimeNV: return "CurrentRayTimeNV";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -527,8 +523,6 @@ const char* ImageFormatString(int format)
|
||||
case 37: return "Rg8ui";
|
||||
case 38: return "R16ui";
|
||||
case 39: return "R8ui";
|
||||
case 40: return "R64ui";
|
||||
case 41: return "R64i";
|
||||
|
||||
default:
|
||||
return "Bad";
|
||||
@@ -902,12 +896,6 @@ const char* CapabilityString(int info)
|
||||
case CapabilityDeviceGroup: return "DeviceGroup";
|
||||
case CapabilityMultiView: return "MultiView";
|
||||
|
||||
case CapabilityDenormPreserve: return "DenormPreserve";
|
||||
case CapabilityDenormFlushToZero: return "DenormFlushToZero";
|
||||
case CapabilitySignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
|
||||
case CapabilityRoundingModeRTE: return "RoundingModeRTE";
|
||||
case CapabilityRoundingModeRTZ: return "RoundingModeRTZ";
|
||||
|
||||
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
||||
|
||||
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
||||
@@ -925,15 +913,12 @@ const char* CapabilityString(int info)
|
||||
case CapabilityPerViewAttributesNV: return "PerViewAttributesNV";
|
||||
case CapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV";
|
||||
case CapabilityRayTracingNV: return "RayTracingNV";
|
||||
case CapabilityRayTracingMotionBlurNV: return "RayTracingMotionBlurNV";
|
||||
case CapabilityRayTracingKHR: return "RayTracingKHR";
|
||||
case CapabilityRayCullMaskKHR: return "RayCullMaskKHR";
|
||||
case CapabilityRayQueryKHR: return "RayQueryKHR";
|
||||
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
|
||||
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
|
||||
case CapabilityRayQueryProvisionalKHR: return "RayQueryProvisionalKHR";
|
||||
case CapabilityRayTraversalPrimitiveCullingProvisionalKHR: return "RayTraversalPrimitiveCullingProvisionalKHR";
|
||||
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
|
||||
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
|
||||
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
|
||||
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
|
||||
case CapabilityMeshShadingNV: return "MeshShadingNV";
|
||||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
||||
@@ -973,20 +958,11 @@ const char* CapabilityString(int info)
|
||||
|
||||
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
|
||||
case CapabilityShaderClockKHR: return "ShaderClockKHR";
|
||||
case CapabilityInt64ImageEXT: return "Int64ImageEXT";
|
||||
|
||||
case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL";
|
||||
|
||||
case CapabilityAtomicFloat16AddEXT: return "AtomicFloat16AddEXT";
|
||||
case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT";
|
||||
case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT";
|
||||
case CapabilityAtomicFloat16MinMaxEXT: return "AtomicFloat16MinMaxEXT";
|
||||
case CapabilityAtomicFloat32MinMaxEXT: return "AtomicFloat32MinMaxEXT";
|
||||
case CapabilityAtomicFloat64MinMaxEXT: return "AtomicFloat64MinMaxEXT";
|
||||
|
||||
case CapabilityWorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR";
|
||||
case CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR";
|
||||
case CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
@@ -1357,8 +1333,6 @@ const char* OpcodeString(int op)
|
||||
case 365: return "OpGroupNonUniformQuadBroadcast";
|
||||
case 366: return "OpGroupNonUniformQuadSwap";
|
||||
|
||||
case OpTerminateInvocation: return "OpTerminateInvocation";
|
||||
|
||||
case 4421: return "OpSubgroupBallotKHR";
|
||||
case 4422: return "OpSubgroupFirstInvocationKHR";
|
||||
case 4428: return "OpSubgroupAllKHR";
|
||||
@@ -1367,8 +1341,6 @@ const char* OpcodeString(int op)
|
||||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
|
||||
case OpAtomicFAddEXT: return "OpAtomicFAddEXT";
|
||||
case OpAtomicFMinEXT: return "OpAtomicFMinEXT";
|
||||
case OpAtomicFMaxEXT: return "OpAtomicFMaxEXT";
|
||||
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
@@ -1387,24 +1359,17 @@ const char* OpcodeString(int op)
|
||||
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
||||
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
||||
|
||||
case OpReportIntersectionKHR: return "OpReportIntersectionKHR";
|
||||
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
||||
case OpIgnoreIntersectionKHR: return "OpIgnoreIntersectionKHR";
|
||||
case OpTerminateRayNV: return "OpTerminateRayNV";
|
||||
case OpTerminateRayKHR: return "OpTerminateRayKHR";
|
||||
case OpTraceNV: return "OpTraceNV";
|
||||
case OpTraceRayMotionNV: return "OpTraceRayMotionNV";
|
||||
case OpTraceRayKHR: return "OpTraceRayKHR";
|
||||
case OpTypeAccelerationStructureKHR: return "OpTypeAccelerationStructureKHR";
|
||||
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
||||
case OpExecuteCallableKHR: return "OpExecuteCallableKHR";
|
||||
case OpConvertUToAccelerationStructureKHR: return "OpConvertUToAccelerationStructureKHR";
|
||||
|
||||
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
||||
case OpReportIntersectionKHR: return "OpReportIntersectionKHR";
|
||||
case OpIgnoreIntersectionKHR: return "OpIgnoreIntersectionKHR";
|
||||
case OpTerminateRayKHR: return "OpTerminateRayKHR";
|
||||
case OpTraceRayKHR: return "OpTraceRayKHR";
|
||||
case OpTypeAccelerationStructureKHR: return "OpTypeAccelerationStructureKHR";
|
||||
case OpExecuteCallableKHR: return "OpExecuteCallableKHR";
|
||||
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
||||
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
||||
|
||||
case OpTypeRayQueryKHR: return "OpTypeRayQueryKHR";
|
||||
case OpTypeRayQueryProvisionalKHR: return "OpTypeRayQueryProvisionalKHR";
|
||||
case OpRayQueryInitializeKHR: return "OpRayQueryInitializeKHR";
|
||||
case OpRayQueryTerminateKHR: return "OpRayQueryTerminateKHR";
|
||||
case OpRayQueryGenerateIntersectionKHR: return "OpRayQueryGenerateIntersectionKHR";
|
||||
@@ -1536,7 +1501,6 @@ void Parameterize()
|
||||
InstructionDesc[OpBranchConditional].setResultAndType(false, false);
|
||||
InstructionDesc[OpSwitch].setResultAndType(false, false);
|
||||
InstructionDesc[OpKill].setResultAndType(false, false);
|
||||
InstructionDesc[OpTerminateInvocation].setResultAndType(false, false);
|
||||
InstructionDesc[OpReturn].setResultAndType(false, false);
|
||||
InstructionDesc[OpReturnValue].setResultAndType(false, false);
|
||||
InstructionDesc[OpUnreachable].setResultAndType(false, false);
|
||||
@@ -2360,16 +2324,6 @@ void Parameterize()
|
||||
InstructionDesc[OpAtomicSMax].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
@@ -2748,7 +2702,7 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "X");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "'Direction'");
|
||||
InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandLiteralNumber, "'Direction'");
|
||||
|
||||
InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'");
|
||||
|
||||
@@ -2811,34 +2765,7 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
|
||||
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'");
|
||||
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpTraceNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Miss Index'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Origin'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMin'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Ray Direction'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'TMax'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Time'");
|
||||
InstructionDesc[OpTraceRayMotionNV].operands.push(OperandId, "'Payload'");
|
||||
InstructionDesc[OpTraceRayMotionNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Acceleration Structure'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'NV Acceleration Structure'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Flags'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Cull Mask'");
|
||||
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Offset'");
|
||||
@@ -2854,28 +2781,17 @@ void Parameterize()
|
||||
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Parameter'");
|
||||
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Kind'");
|
||||
|
||||
InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpIgnoreIntersectionKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTerminateRayNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpTerminateRayKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index");
|
||||
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID");
|
||||
InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "SBT Record Index");
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData");
|
||||
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData ID");
|
||||
InstructionDesc[OpExecuteCallableKHR].setResultAndType(false, false);
|
||||
|
||||
InstructionDesc[OpConvertUToAccelerationStructureKHR].operands.push(OperandId, "Value");
|
||||
InstructionDesc[OpConvertUToAccelerationStructureKHR].setResultAndType(true, true);
|
||||
|
||||
// Ray Query
|
||||
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
|
||||
InstructionDesc[OpTypeRayQueryKHR].setResultAndType(true, false);
|
||||
InstructionDesc[OpTypeRayQueryProvisionalKHR].setResultAndType(true, false);
|
||||
|
||||
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayQuery'");
|
||||
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'AccelerationS'");
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+2196
-2511
File diff suppressed because it is too large
Load Diff
Regular → Executable
+14
-26
@@ -111,23 +111,27 @@ public:
|
||||
|
||||
void addStringOperand(const char* str)
|
||||
{
|
||||
unsigned int word = 0;
|
||||
unsigned int shiftAmount = 0;
|
||||
unsigned int word;
|
||||
char* wordString = (char*)&word;
|
||||
char* wordPtr = wordString;
|
||||
int charCount = 0;
|
||||
char c;
|
||||
|
||||
do {
|
||||
c = *(str++);
|
||||
word |= ((unsigned int)c) << shiftAmount;
|
||||
shiftAmount += 8;
|
||||
if (shiftAmount == 32) {
|
||||
*(wordPtr++) = c;
|
||||
++charCount;
|
||||
if (charCount == 4) {
|
||||
addImmediateOperand(word);
|
||||
word = 0;
|
||||
shiftAmount = 0;
|
||||
wordPtr = wordString;
|
||||
charCount = 0;
|
||||
}
|
||||
} while (c != 0);
|
||||
|
||||
// deal with partial last word
|
||||
if (shiftAmount > 0) {
|
||||
if (charCount > 0) {
|
||||
// pad with 0s
|
||||
for (; charCount < 4; ++charCount)
|
||||
*(wordPtr++) = 0;
|
||||
addImmediateOperand(word);
|
||||
}
|
||||
}
|
||||
@@ -259,7 +263,6 @@ public:
|
||||
case OpBranchConditional:
|
||||
case OpSwitch:
|
||||
case OpKill:
|
||||
case OpTerminateInvocation:
|
||||
case OpReturn:
|
||||
case OpReturnValue:
|
||||
case OpUnreachable:
|
||||
@@ -357,14 +360,6 @@ public:
|
||||
Decoration getReturnPrecision() const
|
||||
{ return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; }
|
||||
|
||||
void setDebugLineInfo(Id fileName, int line, int column) {
|
||||
lineInstruction = std::unique_ptr<Instruction>{new Instruction(OpLine)};
|
||||
lineInstruction->addIdOperand(fileName);
|
||||
lineInstruction->addImmediateOperand(line);
|
||||
lineInstruction->addImmediateOperand(column);
|
||||
}
|
||||
bool hasDebugLineInfo() const { return lineInstruction != nullptr; }
|
||||
|
||||
void setImplicitThis() { implicitThis = true; }
|
||||
bool hasImplicitThis() const { return implicitThis; }
|
||||
|
||||
@@ -381,11 +376,6 @@ public:
|
||||
|
||||
void dump(std::vector<unsigned int>& out) const
|
||||
{
|
||||
// OpLine
|
||||
if (lineInstruction != nullptr) {
|
||||
lineInstruction->dump(out);
|
||||
}
|
||||
|
||||
// OpFunction
|
||||
functionInstruction.dump(out);
|
||||
|
||||
@@ -404,7 +394,6 @@ protected:
|
||||
Function& operator=(Function&);
|
||||
|
||||
Module& parent;
|
||||
std::unique_ptr<Instruction> lineInstruction;
|
||||
Instruction functionInstruction;
|
||||
std::vector<Instruction*> parameterInstructions;
|
||||
std::vector<Block*> blocks;
|
||||
@@ -471,8 +460,7 @@ protected:
|
||||
// - the OpFunction instruction
|
||||
// - all the OpFunctionParameter instructions
|
||||
__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent)
|
||||
: parent(parent), lineInstruction(nullptr),
|
||||
functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
||||
: parent(parent), functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
||||
reducedPrecisionReturn(false)
|
||||
{
|
||||
// OpFunction
|
||||
|
||||
Regular → Executable
+7
-33
@@ -31,22 +31,6 @@
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
find_host_package(PythonInterp 3 REQUIRED)
|
||||
|
||||
set(GLSLANG_INTRINSIC_H "${GLSLANG_GENERATED_INCLUDEDIR}/glslang/glsl_intrinsic_header.h")
|
||||
set(GLSLANG_INTRINSIC_PY "${CMAKE_CURRENT_SOURCE_DIR}/../gen_extension_headers.py")
|
||||
set(GLSLANG_INTRINSIC_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../glslang/ExtensionHeaders")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${GLSLANG_INTRINSIC_H}
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${GLSLANG_INTRINSIC_PY}"
|
||||
"-i" ${GLSLANG_INTRINSIC_HEADER_DIR}
|
||||
"-o" ${GLSLANG_INTRINSIC_H}
|
||||
DEPENDS ${GLSLANG_INTRINSIC_PY}
|
||||
COMMENT "Generating ${GLSLANG_INTRINSIC_H}")
|
||||
|
||||
#add_custom_target(glslangValidator DEPENDS ${GLSLANG_INTRINSIC_H})
|
||||
|
||||
add_library(glslang-default-resource-limits
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
|
||||
@@ -57,7 +41,8 @@ target_include_directories(glslang-default-resource-limits
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
|
||||
|
||||
set(SOURCES StandAlone.cpp DirStackFileIncluder.h ${GLSLANG_INTRINSIC_H})
|
||||
|
||||
set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
|
||||
|
||||
add_executable(glslangValidator ${SOURCES})
|
||||
set_property(TARGET glslangValidator PROPERTY FOLDER tools)
|
||||
@@ -78,19 +63,13 @@ elseif(UNIX)
|
||||
if(NOT ANDROID)
|
||||
set(LIBRARIES ${LIBRARIES} pthread)
|
||||
endif()
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(glslangValidator ${LIBRARIES})
|
||||
target_include_directories(glslangValidator PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
|
||||
|
||||
if(ENABLE_OPT)
|
||||
target_include_directories(glslangValidator
|
||||
PRIVATE ${spirv-tools_SOURCE_DIR}/include
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SPVREMAPPER)
|
||||
set(REMAPPER_SOURCES spirv-remap.cpp)
|
||||
add_executable(spirv-remap ${REMAPPER_SOURCES})
|
||||
@@ -101,7 +80,7 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
source_group("Source" FILES ${SOURCES})
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
if(ENABLE_GLSLANG_INSTALL)
|
||||
install(TARGETS glslangValidator EXPORT glslangValidatorTargets
|
||||
@@ -116,12 +95,7 @@ if(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else()
|
||||
install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
|
||||
endif()
|
||||
endif(ENABLE_GLSLANG_INSTALL)
|
||||
|
||||
Regular → Executable
-8
@@ -40,7 +40,6 @@
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
#include "./../glslang/Public/ShaderLang.h"
|
||||
|
||||
@@ -85,18 +84,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::set<std::string> getIncludedFiles()
|
||||
{
|
||||
return includedFiles;
|
||||
}
|
||||
|
||||
virtual ~DirStackFileIncluder() override { }
|
||||
|
||||
protected:
|
||||
typedef char tUserDataElement;
|
||||
std::vector<std::string> directoryStack;
|
||||
int externalLocalDirectoryCount;
|
||||
std::set<std::string> includedFiles;
|
||||
|
||||
// Search for a valid "local" path based on combining the stack of include
|
||||
// directories and the nominal name of the header.
|
||||
@@ -115,7 +108,6 @@ protected:
|
||||
std::ifstream file(path, std::ios_base::binary | std::ios_base::ate);
|
||||
if (file) {
|
||||
directoryStack.push_back(getDirectory(path));
|
||||
includedFiles.insert(path);
|
||||
return newIncludeResult(path, file, (int)file.tellg());
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+12
-359
@@ -2,7 +2,6 @@
|
||||
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
||||
// Copyright (C) 2013-2016 LunarG, Inc.
|
||||
// Copyright (C) 2016-2020 Google, Inc.
|
||||
// Modifications Copyright(C) 2021 Advanced Micro Devices, Inc.All rights reserved.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -59,15 +58,12 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
|
||||
#include "../glslang/OSDependent/osinclude.h"
|
||||
|
||||
// Build-time generated includes
|
||||
#include "glslang/build_info.h"
|
||||
|
||||
#include "glslang/glsl_intrinsic_header.h"
|
||||
|
||||
extern "C" {
|
||||
GLSLANG_EXPORT void ShOutputHtml();
|
||||
}
|
||||
@@ -114,8 +110,6 @@ bool SpvToolsValidate = false;
|
||||
bool NaNClamp = false;
|
||||
bool stripDebugInfo = false;
|
||||
bool beQuiet = false;
|
||||
bool VulkanRulesRelaxed = false;
|
||||
bool autoSampledTextures = false;
|
||||
|
||||
//
|
||||
// Return codes from main/exit().
|
||||
@@ -170,15 +164,12 @@ int ReflectOptions = EShReflectionDefault;
|
||||
int Options = 0;
|
||||
const char* ExecutableName = nullptr;
|
||||
const char* binaryFileName = nullptr;
|
||||
const char* depencyFileName = nullptr;
|
||||
const char* entryPointName = nullptr;
|
||||
const char* sourceEntryPointName = nullptr;
|
||||
const char* shaderStageName = nullptr;
|
||||
const char* variableName = nullptr;
|
||||
bool HlslEnable16BitTypes = false;
|
||||
bool HlslDX9compatible = false;
|
||||
bool HlslDxPositionW = false;
|
||||
bool EnhancedMsgs = false;
|
||||
bool DumpBuiltinSymbols = false;
|
||||
std::vector<std::string> IncludeDirectoryList;
|
||||
|
||||
@@ -192,9 +183,6 @@ glslang::EShTargetClientVersion ClientVersion; // not valid until Client i
|
||||
glslang::EShTargetLanguage TargetLanguage = glslang::EShTargetNone;
|
||||
glslang::EShTargetLanguageVersion TargetVersion; // not valid until TargetLanguage is set
|
||||
|
||||
// GLSL version
|
||||
int GlslVersion = 0; // GLSL version specified on CLI, overrides #version in shader source
|
||||
|
||||
std::vector<std::string> Processes; // what should be recorded by OpModuleProcessed, or equivalent
|
||||
|
||||
// Per descriptor-set binding base data
|
||||
@@ -207,17 +195,6 @@ std::array<std::array<unsigned int, EShLangCount>, glslang::EResCount> baseBindi
|
||||
std::array<std::array<TPerSetBaseBinding, EShLangCount>, glslang::EResCount> baseBindingForSet;
|
||||
std::array<std::vector<std::string>, EShLangCount> baseResourceSetBinding;
|
||||
|
||||
std::vector<std::pair<std::string, glslang::TBlockStorageClass>> blockStorageOverrides;
|
||||
|
||||
bool setGlobalUniformBlock = false;
|
||||
std::string globalUniformName;
|
||||
unsigned int globalUniformBinding;
|
||||
unsigned int globalUniformSet;
|
||||
|
||||
bool setGlobalBufferBlock = false;
|
||||
std::string atomicCounterBlockName;
|
||||
unsigned int atomicCounterBlockSet;
|
||||
|
||||
// Add things like "#define ..." to a preamble to use in the beginning of the shader.
|
||||
class TPreamble {
|
||||
public:
|
||||
@@ -271,7 +248,6 @@ protected:
|
||||
|
||||
// Track the user's #define and #undef from the command line.
|
||||
TPreamble UserPreamble;
|
||||
std::string PreambleString;
|
||||
|
||||
//
|
||||
// Create the default name for saving a binary if -o is not provided.
|
||||
@@ -356,13 +332,13 @@ void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res)
|
||||
lang = FindLanguage(argv[arg++], false);
|
||||
}
|
||||
|
||||
if ((argc - arg) >= 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
if ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
// Parse a per-set binding base
|
||||
do {
|
||||
while ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
|
||||
const int baseNum = atoi(argv[arg++]);
|
||||
const int setNum = atoi(argv[arg++]);
|
||||
perSetBase[setNum] = baseNum;
|
||||
} while ((argc - arg) >= 2 && isdigit(argv[arg + 0][0]) && isdigit(argv[arg + 1][0]));
|
||||
}
|
||||
} else {
|
||||
// Parse single binding base
|
||||
singleBase = atoi(argv[arg++]);
|
||||
@@ -420,115 +396,6 @@ void ProcessResourceSetBindingBase(int& argc, char**& argv, std::array<std::vect
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process an optional binding base of one the forms:
|
||||
// --argname name {uniform|buffer|push_constant}
|
||||
void ProcessBlockStorage(int& argc, char**& argv, std::vector<std::pair<std::string, glslang::TBlockStorageClass>>& storage)
|
||||
{
|
||||
if (argc < 3)
|
||||
usage();
|
||||
|
||||
glslang::TBlockStorageClass blockStorage = glslang::EbsNone;
|
||||
|
||||
std::string strBacking(argv[2]);
|
||||
if (strBacking == "uniform")
|
||||
blockStorage = glslang::EbsUniform;
|
||||
else if (strBacking == "buffer")
|
||||
blockStorage = glslang::EbsStorageBuffer;
|
||||
else if (strBacking == "push_constant")
|
||||
blockStorage = glslang::EbsPushConstant;
|
||||
else {
|
||||
printf("%s: invalid block storage\n", strBacking.c_str());
|
||||
usage();
|
||||
}
|
||||
|
||||
storage.push_back(std::make_pair(std::string(argv[1]), blockStorage));
|
||||
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
inline bool isNonDigit(char c) {
|
||||
// a non-digit character valid in a glsl identifier
|
||||
return (c == '_') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
// whether string isa valid identifier to be used in glsl
|
||||
bool isValidIdentifier(const char* str) {
|
||||
std::string idn(str);
|
||||
|
||||
if (idn.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (idn.length() >= 3 && idn.substr(0, 3) == "gl_") {
|
||||
// identifiers startin with "gl_" are reserved
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isNonDigit(idn[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 1; i < idn.length(); ++i) {
|
||||
if (!(isdigit(idn[i]) || isNonDigit(idn[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Process settings for either the global buffer block or global unfirom block
|
||||
// of the form:
|
||||
// --argname name set binding
|
||||
void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsigned int* set, unsigned int* binding)
|
||||
{
|
||||
if (argc < 4)
|
||||
usage();
|
||||
|
||||
unsigned int curArg = 1;
|
||||
|
||||
assert(name || set || binding);
|
||||
|
||||
if (name) {
|
||||
if (!isValidIdentifier(argv[curArg])) {
|
||||
printf("%s: invalid identifier\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*name = argv[curArg];
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
if (set) {
|
||||
errno = 0;
|
||||
int setVal = ::strtol(argv[curArg], NULL, 10);
|
||||
if (errno || setVal < 0) {
|
||||
printf("%s: invalid set\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*set = setVal;
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
if (binding) {
|
||||
errno = 0;
|
||||
int bindingVal = ::strtol(argv[curArg], NULL, 10);
|
||||
if (errno || bindingVal < 0) {
|
||||
printf("%s: invalid binding\n", argv[curArg]);
|
||||
usage();
|
||||
}
|
||||
*binding = bindingVal;
|
||||
|
||||
curArg++;
|
||||
}
|
||||
|
||||
argc -= (curArg - 1);
|
||||
argv += (curArg - 1);
|
||||
}
|
||||
|
||||
//
|
||||
// Do all command-line argument parsing. This includes building up the work-items
|
||||
// to be processed later, and saving all the command-line options.
|
||||
@@ -657,48 +524,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
lowerword == "flatten-uniform-array" ||
|
||||
lowerword == "fua") {
|
||||
Options |= EOptionFlattenUniformArrays;
|
||||
} else if (lowerword == "glsl-version") {
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "100") == 0) {
|
||||
GlslVersion = 100;
|
||||
} else if (strcmp(argv[1], "110") == 0) {
|
||||
GlslVersion = 110;
|
||||
} else if (strcmp(argv[1], "120") == 0) {
|
||||
GlslVersion = 120;
|
||||
} else if (strcmp(argv[1], "130") == 0) {
|
||||
GlslVersion = 130;
|
||||
} else if (strcmp(argv[1], "140") == 0) {
|
||||
GlslVersion = 140;
|
||||
} else if (strcmp(argv[1], "150") == 0) {
|
||||
GlslVersion = 150;
|
||||
} else if (strcmp(argv[1], "300es") == 0) {
|
||||
GlslVersion = 300;
|
||||
} else if (strcmp(argv[1], "310es") == 0) {
|
||||
GlslVersion = 310;
|
||||
} else if (strcmp(argv[1], "320es") == 0) {
|
||||
GlslVersion = 320;
|
||||
} else if (strcmp(argv[1], "330") == 0) {
|
||||
GlslVersion = 330;
|
||||
} else if (strcmp(argv[1], "400") == 0) {
|
||||
GlslVersion = 400;
|
||||
} else if (strcmp(argv[1], "410") == 0) {
|
||||
GlslVersion = 410;
|
||||
} else if (strcmp(argv[1], "420") == 0) {
|
||||
GlslVersion = 420;
|
||||
} else if (strcmp(argv[1], "430") == 0) {
|
||||
GlslVersion = 430;
|
||||
} else if (strcmp(argv[1], "440") == 0) {
|
||||
GlslVersion = 440;
|
||||
} else if (strcmp(argv[1], "450") == 0) {
|
||||
GlslVersion = 450;
|
||||
} else if (strcmp(argv[1], "460") == 0) {
|
||||
GlslVersion = 460;
|
||||
} else
|
||||
Error("--glsl-version expected one of: 100, 110, 120, 130, 140, 150,\n"
|
||||
"300es, 310es, 320es, 330\n"
|
||||
"400, 410, 420, 430, 440, 450, 460");
|
||||
}
|
||||
bumpArg();
|
||||
} else if (lowerword == "hlsl-offsets") {
|
||||
Options |= EOptionHlslOffsets;
|
||||
} else if (lowerword == "hlsl-iomap" ||
|
||||
@@ -709,12 +534,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
HlslEnable16BitTypes = true;
|
||||
} else if (lowerword == "hlsl-dx9-compatible") {
|
||||
HlslDX9compatible = true;
|
||||
} else if (lowerword == "hlsl-dx-position-w") {
|
||||
HlslDxPositionW = true;
|
||||
} else if (lowerword == "enhanced-msgs") {
|
||||
EnhancedMsgs = true;
|
||||
} else if (lowerword == "auto-sampled-textures") {
|
||||
autoSampledTextures = true;
|
||||
} else if (lowerword == "invert-y" || // synonyms
|
||||
lowerword == "iy") {
|
||||
Options |= EOptionInvertY;
|
||||
@@ -750,17 +569,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
lowerword == "resource-set-binding" ||
|
||||
lowerword == "rsb") {
|
||||
ProcessResourceSetBindingBase(argc, argv, baseResourceSetBinding);
|
||||
} else if (lowerword == "set-block-storage" ||
|
||||
lowerword == "sbs") {
|
||||
ProcessBlockStorage(argc, argv, blockStorageOverrides);
|
||||
} else if (lowerword == "set-atomic-counter-block" ||
|
||||
lowerword == "sacb") {
|
||||
ProcessGlobalBlockSettings(argc, argv, &atomicCounterBlockName, &atomicCounterBlockSet, nullptr);
|
||||
setGlobalBufferBlock = true;
|
||||
} else if (lowerword == "set-default-uniform-block" ||
|
||||
lowerword == "sdub") {
|
||||
ProcessGlobalBlockSettings(argc, argv, &globalUniformName, &globalUniformSet, &globalUniformBinding);
|
||||
setGlobalUniformBlock = true;
|
||||
} else if (lowerword == "shift-image-bindings" || // synonyms
|
||||
lowerword == "shift-image-binding" ||
|
||||
lowerword == "sib") {
|
||||
@@ -815,9 +623,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "vulkan1.2") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_2;
|
||||
} else if (strcmp(argv[1], "vulkan1.3") == 0) {
|
||||
setVulkanSpv();
|
||||
ClientVersion = glslang::EShTargetVulkan_1_3;
|
||||
} else if (strcmp(argv[1], "opengl") == 0) {
|
||||
setOpenGlSpv();
|
||||
ClientVersion = glslang::EShTargetOpenGL_450;
|
||||
@@ -839,13 +644,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} else if (strcmp(argv[1], "spirv1.5") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
} else if (strcmp(argv[1], "spirv1.6") == 0) {
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
} else
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2,\n"
|
||||
"vulkan1.3, opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n"
|
||||
"spirv1.4, spirv1.5 or spirv1.6");
|
||||
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
|
||||
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
|
||||
}
|
||||
bumpArg();
|
||||
} else if (lowerword == "undef-macro" ||
|
||||
@@ -865,11 +666,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
break;
|
||||
} else if (lowerword == "quiet") {
|
||||
beQuiet = true;
|
||||
} else if (lowerword == "depfile") {
|
||||
if (argc <= 1)
|
||||
Error("no <depfile-name> provided", lowerword.c_str());
|
||||
depencyFileName = argv[1];
|
||||
bumpArg();
|
||||
} else if (lowerword == "version") {
|
||||
Options |= EOptionDumpVersions;
|
||||
} else if (lowerword == "help") {
|
||||
@@ -925,9 +721,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
else
|
||||
Error("unknown -O option");
|
||||
break;
|
||||
case 'R':
|
||||
VulkanRulesRelaxed = true;
|
||||
break;
|
||||
case 'S':
|
||||
if (argc <= 1)
|
||||
Error("no <stage> specified for -S");
|
||||
@@ -1051,10 +844,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
(Options & EOptionReadHlsl) == 0)
|
||||
Error("uniform array flattening only valid when compiling HLSL source.");
|
||||
|
||||
if ((Options & EOptionReadHlsl) && (Client == glslang::EShClientOpenGL)) {
|
||||
Error("Using HLSL input under OpenGL semantics is not currently supported.");
|
||||
}
|
||||
|
||||
// rationalize client and target language
|
||||
if (TargetLanguage == glslang::EShTargetNone) {
|
||||
switch (ClientVersion) {
|
||||
@@ -1070,10 +859,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_5;
|
||||
break;
|
||||
case glslang::EShTargetVulkan_1_3:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_6;
|
||||
break;
|
||||
case glslang::EShTargetOpenGL_450:
|
||||
TargetLanguage = glslang::EShTargetSpv;
|
||||
TargetVersion = glslang::EShTargetSpv_1_0;
|
||||
@@ -1121,8 +906,6 @@ void SetMessageOptions(EShMessages& messages)
|
||||
messages = (EShMessages)(messages | EShMsgHlslDX9Compatible);
|
||||
if (DumpBuiltinSymbols)
|
||||
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
|
||||
if (EnhancedMsgs)
|
||||
messages = (EShMessages)(messages | EShMsgEnhanced);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1213,46 +996,6 @@ struct ShaderCompUnit {
|
||||
}
|
||||
};
|
||||
|
||||
// Writes a string into a depfile, escaping some special characters following the Makefile rules.
|
||||
static void writeEscapedDepString(std::ofstream& file, const std::string& str)
|
||||
{
|
||||
for (char c : str) {
|
||||
switch (c) {
|
||||
case ' ':
|
||||
case ':':
|
||||
case '#':
|
||||
case '[':
|
||||
case ']':
|
||||
case '\\':
|
||||
file << '\\';
|
||||
break;
|
||||
case '$':
|
||||
file << '$';
|
||||
break;
|
||||
}
|
||||
file << c;
|
||||
}
|
||||
}
|
||||
|
||||
// Writes a depfile similar to gcc -MMD foo.c
|
||||
bool writeDepFile(std::string depfile, std::vector<std::string>& binaryFiles, const std::vector<std::string>& sources)
|
||||
{
|
||||
std::ofstream file(depfile);
|
||||
if (file.fail())
|
||||
return false;
|
||||
|
||||
for (auto binaryFile = binaryFiles.begin(); binaryFile != binaryFiles.end(); binaryFile++) {
|
||||
writeEscapedDepString(file, *binaryFile);
|
||||
file << ":";
|
||||
for (auto sourceFile = sources.begin(); sourceFile != sources.end(); sourceFile++) {
|
||||
file << " ";
|
||||
writeEscapedDepString(file, *sourceFile);
|
||||
}
|
||||
file << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// For linking mode: Will independently parse each compilation unit, but then put them
|
||||
// in the same program and link them together, making at most one linked module per
|
||||
@@ -1269,12 +1012,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
EShMessages messages = EShMsgDefault;
|
||||
SetMessageOptions(messages);
|
||||
|
||||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
|
||||
std::vector<std::string> sources;
|
||||
|
||||
//
|
||||
// Per-shader processing...
|
||||
//
|
||||
@@ -1282,9 +1019,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
glslang::TProgram& program = *new glslang::TProgram;
|
||||
for (auto it = compUnits.cbegin(); it != compUnits.cend(); ++it) {
|
||||
const auto &compUnit = *it;
|
||||
for (int i = 0; i < compUnit.count; i++) {
|
||||
sources.push_back(compUnit.fileNameList[i]);
|
||||
}
|
||||
glslang::TShader* shader = new glslang::TShader(compUnit.stage);
|
||||
shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
|
||||
if (entryPointName)
|
||||
@@ -1295,19 +1029,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
"Use '-e <name>'.\n");
|
||||
shader->setSourceEntryPoint(sourceEntryPointName);
|
||||
}
|
||||
|
||||
shader->setOverrideVersion(GlslVersion);
|
||||
|
||||
std::string intrinsicString = getIntrinsic(compUnit.text, compUnit.count);
|
||||
|
||||
PreambleString = "";
|
||||
if (UserPreamble.isSet())
|
||||
PreambleString.append(UserPreamble.get());
|
||||
|
||||
if (!intrinsicString.empty())
|
||||
PreambleString.append(intrinsicString);
|
||||
|
||||
shader->setPreamble(PreambleString.c_str());
|
||||
shader->setPreamble(UserPreamble.get());
|
||||
shader->addProcesses(Processes);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
@@ -1327,9 +1050,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||
|
||||
if (autoSampledTextures)
|
||||
shader->setTextureSamplerTransformMode(EShTexSampTransUpgradeTextureRemoveSampler);
|
||||
|
||||
if (Options & EOptionAutoMapBindings)
|
||||
shader->setAutoMapBindings(true);
|
||||
|
||||
@@ -1344,24 +1064,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setUniformLocationBase(uniformBase);
|
||||
#endif
|
||||
|
||||
if (VulkanRulesRelaxed) {
|
||||
for (auto& storageOverride : blockStorageOverrides) {
|
||||
shader->addBlockStorageOverride(storageOverride.first.c_str(),
|
||||
storageOverride.second);
|
||||
}
|
||||
|
||||
if (setGlobalBufferBlock) {
|
||||
shader->setAtomicCounterBlockName(atomicCounterBlockName.c_str());
|
||||
shader->setAtomicCounterBlockSet(atomicCounterBlockSet);
|
||||
}
|
||||
|
||||
if (setGlobalUniformBlock) {
|
||||
shader->setGlobalUniformBlockName(globalUniformName.c_str());
|
||||
shader->setGlobalUniformSet(globalUniformSet);
|
||||
shader->setGlobalUniformBinding(globalUniformBinding);
|
||||
}
|
||||
}
|
||||
|
||||
shader->setNanMinMaxClamp(NaNClamp);
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
@@ -1373,12 +1075,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
if (HlslDxPositionW)
|
||||
shader->setDxPositionW(true);
|
||||
|
||||
if (EnhancedMsgs)
|
||||
shader->setEnhancedMsgs();
|
||||
|
||||
// Set up the environment, some subsettings take precedence over earlier
|
||||
// ways of setting things.
|
||||
if (Options & EOptionSpv) {
|
||||
@@ -1391,14 +1087,15 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (targetHlslFunctionality1)
|
||||
shader->setEnvTargetHlslFunctionality1();
|
||||
#endif
|
||||
if (VulkanRulesRelaxed)
|
||||
shader->setEnvInputVulkanRulesRelaxed();
|
||||
}
|
||||
|
||||
shaders.push_back(shader);
|
||||
|
||||
const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100;
|
||||
|
||||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionOutputPreprocessed) {
|
||||
std::string str;
|
||||
@@ -1458,8 +1155,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::string> outputFiles;
|
||||
|
||||
// Dump SPIR-V
|
||||
if (Options & EOptionSpv) {
|
||||
if (CompileFailed || LinkFailed)
|
||||
@@ -1489,8 +1184,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
} else {
|
||||
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
||||
}
|
||||
|
||||
outputFiles.push_back(GetBinaryName((EShLanguage)stage));
|
||||
#ifndef GLSLANG_WEB
|
||||
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
||||
spv::Disassemble(std::cout, spirv);
|
||||
@@ -1501,13 +1194,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
}
|
||||
}
|
||||
|
||||
if (depencyFileName && !(CompileFailed || LinkFailed)) {
|
||||
std::set<std::string> includedFiles = includer.getIncludedFiles();
|
||||
sources.insert(sources.end(), includedFiles.begin(), includedFiles.end());
|
||||
|
||||
writeDepFile(depencyFileName, outputFiles, sources);
|
||||
}
|
||||
|
||||
// Free everything up, program has to go before the shaders
|
||||
// because it might have merged stuff from the shaders, and
|
||||
// the stuff from the shaders has to have its destructors called
|
||||
@@ -1875,16 +1561,12 @@ void usage()
|
||||
" 'ver', when present, is the version of the input semantics,\n"
|
||||
" which will appear in #define GL_SPIRV ver;\n"
|
||||
" '--client opengl100' is the same as -G100;\n"
|
||||
" a '--target-env' for OpenGL will also imply '-G';\n"
|
||||
" currently only supports GLSL\n"
|
||||
" a '--target-env' for OpenGL will also imply '-G'\n"
|
||||
" -H print human readable form of SPIR-V; turns on -V\n"
|
||||
" -I<dir> add dir to the include search path; includer's directory\n"
|
||||
" is searched first, followed by left-to-right order of -I\n"
|
||||
" -Od disables optimization; may cause illegal SPIR-V for HLSL\n"
|
||||
" -Os optimizes SPIR-V to minimize size\n"
|
||||
" -R use relaxed verification rules for generating Vulkan SPIR-V,\n"
|
||||
" allowing the use of default uniforms, atomic_uints, and\n"
|
||||
" gl_VertexID and gl_InstanceID keywords.\n"
|
||||
" -S <stage> uses specified stage rather than parsing the file extension\n"
|
||||
" choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
|
||||
" -U<name> | --undef-macro <name> | --U <name>\n"
|
||||
@@ -1927,19 +1609,11 @@ void usage()
|
||||
" without explicit bindings\n"
|
||||
" --auto-map-locations | --aml automatically locate input/output lacking\n"
|
||||
" 'location' (fragile, not cross stage)\n"
|
||||
" --auto-sampled-textures Removes sampler variables and converts\n"
|
||||
" existing textures to sampled textures\n"
|
||||
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
|
||||
" --depfile <file> writes depfile for build systems\n"
|
||||
" --dump-builtin-symbols prints builtin symbol table prior each compile\n"
|
||||
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n"
|
||||
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n"
|
||||
" scalars\n"
|
||||
" --glsl-version {100 | 110 | 120 | 130 | 140 | 150 |\n"
|
||||
" 300es | 310es | 320es | 330\n"
|
||||
" 400 | 410 | 420 | 430 | 440 | 450 | 460}\n"
|
||||
" set GLSL version, overrides #version\n"
|
||||
" in shader sourcen\n"
|
||||
" --hlsl-offsets allow block offsets to follow HLSL rules\n"
|
||||
" works independently of source language\n"
|
||||
" --hlsl-iomap perform IO mapping in HLSL register space\n"
|
||||
@@ -1947,10 +1621,7 @@ void usage()
|
||||
" --hlsl-dx9-compatible interprets sampler declarations as a\n"
|
||||
" texture/sampler combo like DirectX9 would,\n"
|
||||
" and recognizes DirectX9-specific semantics\n"
|
||||
" --hlsl-dx-position-w W component of SV_Position in HLSL fragment\n"
|
||||
" shaders compatible with DirectX\n"
|
||||
" --invert-y | --iy invert position.Y output in vertex shader\n"
|
||||
" --enhanced-msgs print more readable error messages (GLSL only)\n"
|
||||
" --keep-uncalled | --ku don't eliminate uncalled functions\n"
|
||||
" --nan-clamp favor non-NaN operand in min, max, and clamp\n"
|
||||
" --no-storage-format | --nsf use Unknown image format\n"
|
||||
@@ -1973,22 +1644,6 @@ void usage()
|
||||
" --resource-set-binding [stage] set\n"
|
||||
" set descriptor set for all resources\n"
|
||||
" --rsb synonym for --resource-set-binding\n"
|
||||
" --set-block-backing name {uniform|buffer|push_constant}\n"
|
||||
" changes the backing type of a uniform, buffer,\n"
|
||||
" or push_constant block declared in\n"
|
||||
" in the program, when using -R option.\n"
|
||||
" This can be used to change the backing\n"
|
||||
" for existing blocks as well as implicit ones\n"
|
||||
" such as 'gl_DefaultUniformBlock'.\n"
|
||||
" --sbs synonym for set-block-storage\n"
|
||||
" --set-atomic-counter-block name set\n"
|
||||
" set name, and descriptor set for\n"
|
||||
" atomic counter blocks, with -R opt\n"
|
||||
" --sacb synonym for set-atomic-counter-block\n"
|
||||
" --set-default-uniform-block name set binding\n"
|
||||
" set name, descriptor set, and binding for\n"
|
||||
" global default-uniform-block, with -R opt\n"
|
||||
" --sdub synonym for set-default-uniform-block\n"
|
||||
" --shift-image-binding [stage] num\n"
|
||||
" base binding number for images (uav)\n"
|
||||
" --shift-image-binding [stage] [num set]...\n"
|
||||
@@ -2025,9 +1680,8 @@ void usage()
|
||||
" --sep synonym for --source-entrypoint\n"
|
||||
" --stdin read from stdin instead of from a file;\n"
|
||||
" requires providing the shader stage using -S\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | opengl |\n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 |\n"
|
||||
" spirv1.5 | spirv1.6}\n"
|
||||
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
|
||||
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
|
||||
" Set the execution environment that the\n"
|
||||
" generated code will be executed in.\n"
|
||||
" Defaults to:\n"
|
||||
@@ -2036,7 +1690,6 @@ void usage()
|
||||
" * spirv1.0 under --target-env vulkan1.0\n"
|
||||
" * spirv1.3 under --target-env vulkan1.1\n"
|
||||
" * spirv1.5 under --target-env vulkan1.2\n"
|
||||
" * spirv1.6 under --target-env vulkan1.3\n"
|
||||
" Multiple --target-env can be specified.\n"
|
||||
" --variable-name <name>\n"
|
||||
" --vn <name> creates a C header file that contains a\n"
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+6
-40
@@ -105,32 +105,6 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
// Read strings from a file
|
||||
void read(std::vector<std::string>& strings, const std::string& inFilename, int verbosity)
|
||||
{
|
||||
std::ifstream fp;
|
||||
|
||||
if (verbosity > 0)
|
||||
logHandler(std::string(" reading: ") + inFilename);
|
||||
|
||||
strings.clear();
|
||||
fp.open(inFilename, std::fstream::in);
|
||||
|
||||
if (fp.fail())
|
||||
errHandler("error opening file for read: ");
|
||||
|
||||
std::string line;
|
||||
while (std::getline(fp, line))
|
||||
{
|
||||
// Ignore empty lines and lines starting with the comment marker '#'.
|
||||
if (line.length() == 0 || line[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
strings.push_back(line);
|
||||
}
|
||||
}
|
||||
|
||||
void write(std::vector<SpvWord>& spv, const std::string& outFile, int verbosity)
|
||||
{
|
||||
if (outFile.empty())
|
||||
@@ -170,7 +144,6 @@ namespace {
|
||||
<< " [--dce (all|types|funcs)]"
|
||||
<< " [--opt (all|loadstore)]"
|
||||
<< " [--strip-all | --strip all | -s]"
|
||||
<< " [--strip-white-list]"
|
||||
<< " [--do-everything]"
|
||||
<< " --input | -i file1 [file2...] --output|-o DESTDIR"
|
||||
<< std::endl;
|
||||
@@ -183,18 +156,16 @@ namespace {
|
||||
|
||||
// grind through each SPIR in turn
|
||||
void execute(const std::vector<std::string>& inputFile, const std::string& outputDir,
|
||||
const std::string& whiteListFile, int opts, int verbosity)
|
||||
int opts, int verbosity)
|
||||
{
|
||||
std::vector<std::string> whiteListStrings;
|
||||
if(!whiteListFile.empty())
|
||||
read(whiteListStrings, whiteListFile, verbosity);
|
||||
|
||||
for (auto it = inputFile.cbegin(); it != inputFile.cend(); ++it) {
|
||||
const std::string &filename = *it;
|
||||
std::vector<SpvWord> spv;
|
||||
read(spv, filename, verbosity);
|
||||
spv::spirvbin_t(verbosity).remap(spv, whiteListStrings, opts);
|
||||
spv::spirvbin_t(verbosity).remap(spv, opts);
|
||||
|
||||
const std::string outfile = outputDir + path_sep_char() + basename(filename);
|
||||
|
||||
write(spv, outfile, verbosity);
|
||||
}
|
||||
|
||||
@@ -205,7 +176,6 @@ namespace {
|
||||
// Parse command line options
|
||||
void parseCmdLine(int argc, char** argv, std::vector<std::string>& inputFile,
|
||||
std::string& outputDir,
|
||||
std::string& stripWhiteListFile,
|
||||
int& options,
|
||||
int& verbosity)
|
||||
{
|
||||
@@ -275,9 +245,6 @@ namespace {
|
||||
options = options | spv::spirvbin_t::STRIP;
|
||||
++a;
|
||||
}
|
||||
} else if (arg == "--strip-white-list") {
|
||||
++a;
|
||||
stripWhiteListFile = argv[a++];
|
||||
} else if (arg == "--dce") {
|
||||
// Parse comma (or colon, etc) separated list of things to dce
|
||||
++a;
|
||||
@@ -348,7 +315,6 @@ int main(int argc, char** argv)
|
||||
{
|
||||
std::vector<std::string> inputFile;
|
||||
std::string outputDir;
|
||||
std::string whiteListFile;
|
||||
int opts;
|
||||
int verbosity;
|
||||
|
||||
@@ -363,13 +329,13 @@ int main(int argc, char** argv)
|
||||
if (argc < 2)
|
||||
usage(argv[0]);
|
||||
|
||||
parseCmdLine(argc, argv, inputFile, outputDir, whiteListFile, opts, verbosity);
|
||||
parseCmdLine(argc, argv, inputFile, outputDir, opts, verbosity);
|
||||
|
||||
if (outputDir.empty())
|
||||
usage(argv[0], "Output directory required");
|
||||
|
||||
// Main operations: read, remap, and write.
|
||||
execute(inputFile, outputDir, whiteListFile, opts, verbosity);
|
||||
execute(inputFile, outputDir, opts, verbosity);
|
||||
|
||||
// If we get here, everything went OK! Nothing more to be done.
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+15
-15
@@ -111,8 +111,8 @@ void qlodFail()
|
||||
vec2 pf2;
|
||||
vec3 pf3;
|
||||
|
||||
lod = textureQueryLOD(samp1D, pf); // ERROR, extension GL_ARB_texture_query_lod needed
|
||||
lod = textureQueryLOD(samp2Ds, pf2); // ERROR, extension GL_ARB_texture_query_lod needed
|
||||
lod = textureQueryLod(samp1D, pf); // ERROR, extension GL_ARB_texture_query_lod needed
|
||||
lod = textureQueryLod(samp2Ds, pf2); // ERROR, extension GL_ARB_texture_query_lod needed
|
||||
}
|
||||
|
||||
#extension GL_ARB_texture_query_lod : enable
|
||||
@@ -138,21 +138,21 @@ void qlodPass()
|
||||
vec2 pf2;
|
||||
vec3 pf3;
|
||||
|
||||
lod = textureQueryLOD(samp1D, pf);
|
||||
lod = textureQueryLOD(isamp2D, pf2);
|
||||
lod = textureQueryLOD(usamp3D, pf3);
|
||||
lod = textureQueryLOD(sampCube, pf3);
|
||||
lod = textureQueryLOD(isamp1DA, pf);
|
||||
lod = textureQueryLOD(usamp2DA, pf2);
|
||||
lod = textureQueryLod(samp1D, pf);
|
||||
lod = textureQueryLod(isamp2D, pf2);
|
||||
lod = textureQueryLod(usamp3D, pf3);
|
||||
lod = textureQueryLod(sampCube, pf3);
|
||||
lod = textureQueryLod(isamp1DA, pf);
|
||||
lod = textureQueryLod(usamp2DA, pf2);
|
||||
|
||||
lod = textureQueryLOD(samp1Ds, pf);
|
||||
lod = textureQueryLOD(samp2Ds, pf2);
|
||||
lod = textureQueryLOD(sampCubes, pf3);
|
||||
lod = textureQueryLOD(samp1DAs, pf);
|
||||
lod = textureQueryLOD(samp2DAs, pf2);
|
||||
lod = textureQueryLod(samp1Ds, pf);
|
||||
lod = textureQueryLod(samp2Ds, pf2);
|
||||
lod = textureQueryLod(sampCubes, pf3);
|
||||
lod = textureQueryLod(samp1DAs, pf);
|
||||
lod = textureQueryLod(samp2DAs, pf2);
|
||||
|
||||
lod = textureQueryLOD(sampBuf, pf); // ERROR
|
||||
lod = textureQueryLOD(sampRect, pf2); // ERROR
|
||||
lod = textureQueryLod(sampBuf, pf); // ERROR
|
||||
lod = textureQueryLod(sampRect, pf2); // ERROR
|
||||
}
|
||||
|
||||
// Test extension GL_EXT_shader_integer_mix
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user