Squashed 'deps/SPIRV-Cross/' content from commit f3a75d1d4b

git-subtree-dir: deps/SPIRV-Cross
git-subtree-split: f3a75d1d4ba6b559d5c89550f800a518baad522d
This commit is contained in:
libretroadmin 2023-01-20 18:00:31 +01:00
commit da29639d70
4110 changed files with 300005 additions and 0 deletions

170
.clang-format Executable file
View file

@ -0,0 +1,170 @@
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# The style used for all options not specifically set in the configuration.
BasedOnStyle: LLVM
# The extra indent or outdent of access modifiers, e.g. public:.
AccessModifierOffset: -4
# If true, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column.
AlignEscapedNewlinesLeft: true
# If true, aligns trailing comments.
AlignTrailingComments: false
# Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.
AllowAllParametersOfDeclarationOnNextLine: false
# Allows contracting simple braced statements to a single line.
AllowShortBlocksOnASingleLine: false
# If true, short case labels will be contracted to a single line.
AllowShortCaseLabelsOnASingleLine: false
# Dependent on the value, int f() { return 0; } can be put on a single line. Possible values: None, Inline, All.
AllowShortFunctionsOnASingleLine: None
# If true, if (a) return; can be put on a single line.
AllowShortIfStatementsOnASingleLine: false
# If true, while (true) continue; can be put on a single line.
AllowShortLoopsOnASingleLine: false
# If true, always break after function definition return types.
AlwaysBreakAfterDefinitionReturnType: false
# If true, always break before multiline string literals.
AlwaysBreakBeforeMultilineStrings: false
# If true, always break after the template<...> of a template declaration.
AlwaysBreakTemplateDeclarations: true
# If false, a function call's arguments will either be all on the same line or will have one line each.
BinPackArguments: true
# If false, a function declaration's or function definition's parameters will either all be on the same line
# or will have one line each.
BinPackParameters: true
# The way to wrap binary operators. Possible values: None, NonAssignment, All.
BreakBeforeBinaryOperators: None
# The brace breaking style to use. Possible values: Attach, Linux, Stroustrup, Allman, GNU.
BreakBeforeBraces: Allman
# If true, ternary operators will be placed after line breaks.
BreakBeforeTernaryOperators: false
# Always break constructor initializers before commas and align the commas with the colon.
BreakConstructorInitializersBeforeComma: true
# The column limit. A column limit of 0 means that there is no column limit.
ColumnLimit: 120
# A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed.
CommentPragmas: '^ *'
# If the constructor initializers don't fit on a line, put each initializer on its own line.
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# The number of characters to use for indentation of constructor initializer lists.
ConstructorInitializerIndentWidth: 4
# Indent width for line continuations.
ContinuationIndentWidth: 4
# If true, format braced lists as best suited for C++11 braced lists.
Cpp11BracedListStyle: false
# Disables formatting at all.
DisableFormat: false
# A vector of macros that should be interpreted as foreach loops instead of as function calls.
#ForEachMacros: ''
# Indent case labels one level from the switch statement.
# When false, use the same indentation level as for the switch statement.
# Switch statement body is always indented one level more than case labels.
IndentCaseLabels: false
# The number of columns to use for indentation.
IndentWidth: 4
# Indent if a function definition or declaration is wrapped after the type.
IndentWrappedFunctionNames: false
# If true, empty lines at the start of blocks are kept.
KeepEmptyLinesAtTheStartOfBlocks: true
# Language, this format style is targeted at. Possible values: None, Cpp, Java, JavaScript, Proto.
Language: Cpp
# The maximum number of consecutive empty lines to keep.
MaxEmptyLinesToKeep: 1
# The indentation used for namespaces. Possible values: None, Inner, All.
NamespaceIndentation: None
# The penalty for breaking a function call after "call(".
PenaltyBreakBeforeFirstCallParameter: 19
# The penalty for each line break introduced inside a comment.
PenaltyBreakComment: 300
# The penalty for breaking before the first <<.
PenaltyBreakFirstLessLess: 120
# The penalty for each line break introduced inside a string literal.
PenaltyBreakString: 1000
# The penalty for each character outside of the column limit.
PenaltyExcessCharacter: 1000000
# Penalty for putting the return type of a function onto its own line.
PenaltyReturnTypeOnItsOwnLine: 1000000000
# Pointer and reference alignment style. Possible values: Left, Right, Middle.
PointerAlignment: Right
# If true, a space may be inserted after C style casts.
SpaceAfterCStyleCast: false
# If false, spaces will be removed before assignment operators.
SpaceBeforeAssignmentOperators: true
# Defines in which cases to put a space before opening parentheses. Possible values: Never, ControlStatements, Always.
SpaceBeforeParens: ControlStatements
# If true, spaces may be inserted into '()'.
SpaceInEmptyParentheses: false
# The number of spaces before trailing line comments (// - comments).
SpacesBeforeTrailingComments: 1
# If true, spaces will be inserted after '<' and before '>' in template argument lists.
SpacesInAngles: false
# If true, spaces may be inserted into C style casts.
SpacesInCStyleCastParentheses: false
# If true, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals).
SpacesInContainerLiterals: false
# If true, spaces will be inserted after '(' and before ')'.
SpacesInParentheses: false
# If true, spaces will be inserted after '[' and befor']'.
SpacesInSquareBrackets: false
# Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>> for LS_Cpp03. Possible values: Cpp03, Cpp11, Auto.
Standard: Cpp11
# The number of columns used for tab stops.
TabWidth: 4
# The way to use tab characters in the resulting file. Possible values: Never, ForIndentation, Always.
UseTab: ForIndentation
# Do not reflow comments
ReflowComments: false

70
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,70 @@
# Copyright 2020-2021 The Khronos Group, Inc.
# SPDX-License-Identifier: Apache-2.0
name: CI
on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
name: "Build ${{ matrix.platform }}"
strategy:
matrix:
platform: [windows-latest, ubuntu-18.04, ubuntu-20.04, macos-latest]
env:
PARALLEL: -j 2
runs-on: "${{ matrix.platform }}"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Pull glslang / SPIRV-Tools
shell: bash
working-directory: ${{github.workspace}}
run: ./checkout_glslang_spirv_tools.sh
- name: Build glslang / SPIRV-Tools
shell: bash
working-directory: ${{github.workspace}}
run: ./build_glslang_spirv_tools.sh Release
- name: Configure SPIRV-Cross
shell: bash
run: |
mkdir build
cd build
cmake .. -DSPIRV_CROSS_WERROR=ON -DSPIRV_CROSS_MISC_WARNINGS=ON -DSPIRV_CROSS_SHARED=ON -DCMAKE_INSTALL_PREFIX=output -DCMAKE_BUILD_TYPE=Release -DSPIRV_CROSS_ENABLE_TESTS=ON
- name: Build SPIRV-Cross
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake --build . --config Release
cmake --build . --config Release --target install
- name: Test SPIRV-Cross
shell: bash
working-directory: ${{github.workspace}}/build
run: ctest --verbose -C Release
reuse:
name: "REUSE license check"
runs-on: ubuntu-latest
container: khronosgroup/docker-images:asciidoctor-spec
steps:
- uses: actions/checkout@v2
# REUSE license checker
- name: license-check
run: |
reuse lint

24
.gitignore vendored Normal file
View file

@ -0,0 +1,24 @@
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
*.o
*.d
*.txt
/test
/spirv-cross
/obj
/msvc/x64
/msvc/Debug
/msvc/Release
*.suo
*.sdf
*.opensdf
*.shader
*.a
*.bc
/external
.vs/
*.vcxproj.user
!CMakeLists.txt
!LICENSES/*.txt

11
.reuse/dep5 Normal file
View file

@ -0,0 +1,11 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SPIRV-Cross
Source: https://github.com/KhronosGroup/SPIRV-Cross
Files: shaders*/* reference/* tests-other/*
Copyright: 2016-2021 The Khronos Group, Inc.
License: Apache-2.0
Files: spirv.h spirv.hpp GLSL.std.450.h
Copyright: 2016-2021 The Khronos Group, Inc.
License: MIT

617
CMakeLists.txt Normal file
View file

@ -0,0 +1,617 @@
# Copyright 2016-2021 Google Inc.
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# 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.
#
# At your option, you may choose to accept this material under either:
# 1. The Apache License, Version 2.0, found at <http://www.apache.org/licenses/LICENSE-2.0>, or
# 2. The MIT License, found at <http://opensource.org/licenses/MIT>.
#
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
# Avoid a warning if parent project sets VERSION in project().
if (${CMAKE_VERSION} VERSION_GREATER "3.0.1")
cmake_policy(SET CMP0048 NEW)
endif()
project(SPIRV-Cross LANGUAGES CXX C)
enable_testing()
include(GNUInstallDirs)
option(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS "Instead of throwing exceptions assert" OFF)
option(SPIRV_CROSS_SHARED "Build the C API as a single shared library." OFF)
option(SPIRV_CROSS_STATIC "Build the C and C++ API as static libraries." ON)
option(SPIRV_CROSS_CLI "Build the CLI binary. Requires SPIRV_CROSS_STATIC." ON)
option(SPIRV_CROSS_ENABLE_TESTS "Enable SPIRV-Cross tests." ON)
option(SPIRV_CROSS_ENABLE_GLSL "Enable GLSL support." ON)
option(SPIRV_CROSS_ENABLE_HLSL "Enable HLSL target support." ON)
option(SPIRV_CROSS_ENABLE_MSL "Enable MSL target support." ON)
option(SPIRV_CROSS_ENABLE_CPP "Enable C++ target support." ON)
option(SPIRV_CROSS_ENABLE_REFLECT "Enable JSON reflection target support." ON)
option(SPIRV_CROSS_ENABLE_C_API "Enable C API wrapper support in static library." ON)
option(SPIRV_CROSS_ENABLE_UTIL "Enable util module support." ON)
option(SPIRV_CROSS_SANITIZE_ADDRESS "Sanitize address" OFF)
option(SPIRV_CROSS_SANITIZE_MEMORY "Sanitize memory" OFF)
option(SPIRV_CROSS_SANITIZE_THREADS "Sanitize threads" OFF)
option(SPIRV_CROSS_SANITIZE_UNDEFINED "Sanitize undefined" OFF)
option(SPIRV_CROSS_NAMESPACE_OVERRIDE "" "Override the namespace used in the C++ API.")
option(SPIRV_CROSS_FORCE_STL_TYPES "Force use of STL types instead of STL replacements in certain places. Might reduce performance." OFF)
option(SPIRV_CROSS_SKIP_INSTALL "Skips installation targets." OFF)
option(SPIRV_CROSS_WERROR "Fail build on warnings." OFF)
option(SPIRV_CROSS_MISC_WARNINGS "Misc warnings useful for Travis runs." OFF)
option(SPIRV_CROSS_FORCE_PIC "Force position-independent code for all targets." OFF)
if(${CMAKE_GENERATOR} MATCHES "Makefile")
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "Build out of tree to avoid overwriting Makefile")
endif()
endif()
set(spirv-compiler-options "")
set(spirv-compiler-defines "")
set(spirv-cross-link-flags "")
message(STATUS "SPIRV-Cross: Finding Git version for SPIRV-Cross.")
set(spirv-cross-build-version "unknown")
find_package(Git)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE spirv-cross-build-version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "SPIRV-Cross: Git hash: ${spirv-cross-build-version}")
else()
message(STATUS "SPIRV-Cross: Git not found, using unknown build version.")
endif()
string(TIMESTAMP spirv-cross-timestamp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/gitversion.in.h ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h @ONLY)
if (SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
set(spirv-compiler-defines ${spirv-compiler-defines} SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
if (NOT MSVC)
set(spirv-compiler-options ${spirv-compiler-options} -fno-exceptions)
endif()
endif()
if (SPIRV_CROSS_FORCE_STL_TYPES)
set(spirv-compiler-defines ${spirv-compiler-defines} SPIRV_CROSS_FORCE_STL_TYPES)
endif()
if (WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR ((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") AND NOT MSVC))
set(spirv-compiler-options ${spirv-compiler-options} -Wall -Wextra -Wshadow -Wno-deprecated-declarations)
if (SPIRV_CROSS_MISC_WARNINGS)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(spirv-compiler-options ${spirv-compiler-options} -Wshorten-64-to-32)
endif()
endif()
if (SPIRV_CROSS_WERROR)
set(spirv-compiler-options ${spirv-compiler-options} -Werror)
endif()
if (SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
set(spirv-compiler-options ${spirv-compiler-options} -fno-exceptions)
endif()
if (SPIRV_CROSS_SANITIZE_ADDRESS)
set(spirv-compiler-options ${spirv-compiler-options} -fsanitize=address)
set(spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=address")
endif()
if (SPIRV_CROSS_SANITIZE_UNDEFINED)
set(spirv-compiler-options ${spirv-compiler-options} -fsanitize=undefined)
set(spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=undefined")
endif()
if (SPIRV_CROSS_SANITIZE_MEMORY)
set(spirv-compiler-options ${spirv-compiler-options} -fsanitize=memory)
set(spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=memory")
endif()
if (SPIRV_CROSS_SANITIZE_THREADS)
set(spirv-compiler-options ${spirv-compiler-options} -fsanitize=thread)
set(spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=thread")
endif()
elseif (MSVC)
# AppVeyor spuriously fails in debug build on older MSVC without /bigobj.
set(spirv-compiler-options ${spirv-compiler-options} /wd4267 /wd4996 $<$<CONFIG:DEBUG>:/bigobj>)
endif()
macro(extract_headers out_abs file_list)
set(${out_abs}) # absolute paths
foreach(_a ${file_list})
# get_filename_component only returns the longest extension, so use a regex
string(REGEX REPLACE ".*\\.(h|hpp)" "\\1" ext ${_a})
# For shared library, we are only interested in the C header.
if (SPIRV_CROSS_STATIC)
if(("${ext}" STREQUAL "h") OR ("${ext}" STREQUAL "hpp"))
list(APPEND ${out_abs} "${_a}")
endif()
else()
if("${ext}" STREQUAL "h")
list(APPEND ${out_abs} "${_a}")
endif()
endif()
endforeach()
endmacro()
macro(spirv_cross_add_library name config_name library_type)
add_library(${name} ${library_type} ${ARGN})
extract_headers(hdrs "${ARGN}")
target_include_directories(${name} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/spirv_cross>)
set_target_properties(${name} PROPERTIES
PUBLIC_HEADERS "${hdrs}")
if (SPIRV_CROSS_FORCE_PIC)
set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
target_compile_options(${name} PRIVATE ${spirv-compiler-options})
target_compile_definitions(${name} PRIVATE ${spirv-compiler-defines})
if (SPIRV_CROSS_NAMESPACE_OVERRIDE)
if (${library_type} MATCHES "STATIC")
target_compile_definitions(${name} PUBLIC SPIRV_CROSS_NAMESPACE_OVERRIDE=${SPIRV_CROSS_NAMESPACE_OVERRIDE})
else()
target_compile_definitions(${name} PRIVATE SPIRV_CROSS_NAMESPACE_OVERRIDE=${SPIRV_CROSS_NAMESPACE_OVERRIDE})
endif()
endif()
if (NOT SPIRV_CROSS_SKIP_INSTALL)
install(TARGETS ${name}
EXPORT ${config_name}Config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/spirv_cross)
install(FILES ${hdrs} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/spirv_cross)
install(EXPORT ${config_name}Config DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${config_name}/cmake)
export(TARGETS ${name} FILE ${config_name}Config.cmake)
endif()
endmacro()
set(spirv-cross-core-sources
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.std.450.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_common.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_containers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_error_handling.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_parser.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_parsed_ir.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_parsed_ir.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.cpp)
set(spirv-cross-c-sources
spirv.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_c.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_c.h)
set(spirv-cross-glsl-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.hpp)
set(spirv-cross-cpp-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.hpp)
set(spirv-cross-msl-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.hpp)
set(spirv-cross-hlsl-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_hlsl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_hlsl.hpp)
set(spirv-cross-reflect-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.hpp)
set(spirv-cross-util-sources
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_util.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_util.hpp)
if (SPIRV_CROSS_STATIC)
spirv_cross_add_library(spirv-cross-core spirv_cross_core STATIC
${spirv-cross-core-sources})
if (SPIRV_CROSS_ENABLE_GLSL)
spirv_cross_add_library(spirv-cross-glsl spirv_cross_glsl STATIC
${spirv-cross-glsl-sources})
target_link_libraries(spirv-cross-glsl PRIVATE spirv-cross-core)
endif()
if (SPIRV_CROSS_ENABLE_CPP)
spirv_cross_add_library(spirv-cross-cpp spirv_cross_cpp STATIC
${spirv-cross-cpp-sources})
if (SPIRV_CROSS_ENABLE_GLSL)
target_link_libraries(spirv-cross-cpp PRIVATE spirv-cross-glsl)
else()
message(FATAL_ERROR "Must enable GLSL support to enable C++ support.")
endif()
endif()
if (SPIRV_CROSS_ENABLE_REFLECT)
if (SPIRV_CROSS_ENABLE_GLSL)
spirv_cross_add_library(spirv-cross-reflect spirv_cross_reflect STATIC
${spirv-cross-reflect-sources})
else()
message(FATAL_ERROR "Must enable GLSL support to enable JSON reflection support.")
endif()
endif()
if (SPIRV_CROSS_ENABLE_MSL)
spirv_cross_add_library(spirv-cross-msl spirv_cross_msl STATIC
${spirv-cross-msl-sources})
if (SPIRV_CROSS_ENABLE_GLSL)
target_link_libraries(spirv-cross-msl PRIVATE spirv-cross-glsl)
else()
message(FATAL_ERROR "Must enable GLSL support to enable MSL support.")
endif()
endif()
if (SPIRV_CROSS_ENABLE_HLSL)
spirv_cross_add_library(spirv-cross-hlsl spirv_cross_hlsl STATIC
${spirv-cross-hlsl-sources})
if (SPIRV_CROSS_ENABLE_GLSL)
target_link_libraries(spirv-cross-hlsl PRIVATE spirv-cross-glsl)
else()
message(FATAL_ERROR "Must enable GLSL support to enable HLSL support.")
endif()
endif()
if (SPIRV_CROSS_ENABLE_UTIL)
spirv_cross_add_library(spirv-cross-util spirv_cross_util STATIC
${spirv-cross-util-sources})
target_link_libraries(spirv-cross-util PRIVATE spirv-cross-core)
endif()
if (SPIRV_CROSS_ENABLE_C_API)
spirv_cross_add_library(spirv-cross-c spirv_cross_c STATIC
${spirv-cross-c-sources})
target_include_directories(spirv-cross-c PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(spirv-cross-c PRIVATE HAVE_SPIRV_CROSS_GIT_VERSION)
if (SPIRV_CROSS_ENABLE_GLSL)
target_link_libraries(spirv-cross-c PRIVATE spirv-cross-glsl)
target_compile_definitions(spirv-cross-c PRIVATE SPIRV_CROSS_C_API_GLSL=1)
endif()
if (SPIRV_CROSS_ENABLE_HLSL)
target_link_libraries(spirv-cross-c PRIVATE spirv-cross-hlsl)
target_compile_definitions(spirv-cross-c PRIVATE SPIRV_CROSS_C_API_HLSL=1)
endif()
if (SPIRV_CROSS_ENABLE_MSL)
target_link_libraries(spirv-cross-c PRIVATE spirv-cross-msl)
target_compile_definitions(spirv-cross-c PRIVATE SPIRV_CROSS_C_API_MSL=1)
endif()
if (SPIRV_CROSS_ENABLE_CPP)
target_link_libraries(spirv-cross-c PRIVATE spirv-cross-cpp)
target_compile_definitions(spirv-cross-c PRIVATE SPIRV_CROSS_C_API_CPP=1)
endif()
if (SPIRV_CROSS_ENABLE_REFLECT)
target_link_libraries(spirv-cross-c PRIVATE spirv-cross-reflect)
target_compile_definitions(spirv-cross-c PRIVATE SPIRV_CROSS_C_API_REFLECT=1)
endif()
endif()
endif()
set(spirv-cross-abi-major 0)
set(spirv-cross-abi-minor 54)
set(spirv-cross-abi-patch 0)
if (SPIRV_CROSS_SHARED)
set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch})
if (NOT SPIRV_CROSS_SKIP_INSTALL)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/pkg-config/spirv-cross-c-shared.pc.in
${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
spirv_cross_add_library(spirv-cross-c-shared spirv_cross_c_shared SHARED
${spirv-cross-core-sources}
${spirv-cross-c-sources})
target_include_directories(spirv-cross-c-shared PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(spirv-cross-c-shared PRIVATE HAVE_SPIRV_CROSS_GIT_VERSION)
if (SPIRV_CROSS_ENABLE_GLSL)
target_sources(spirv-cross-c-shared PRIVATE ${spirv-cross-glsl-sources})
target_compile_definitions(spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_GLSL=1)
endif()
if (SPIRV_CROSS_ENABLE_HLSL)
if (SPIRV_CROSS_ENABLE_GLSL)
target_sources(spirv-cross-c-shared PRIVATE ${spirv-cross-hlsl-sources})
else()
message(FATAL_ERROR "Must enable GLSL support to enable HLSL support.")
endif()
target_compile_definitions(spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_HLSL=1)
endif()
if (SPIRV_CROSS_ENABLE_MSL)
if (SPIRV_CROSS_ENABLE_GLSL)
target_sources(spirv-cross-c-shared PRIVATE ${spirv-cross-msl-sources})
else()
message(FATAL_ERROR "Must enable GLSL support to enable MSL support.")
endif()
target_compile_definitions(spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_MSL=1)
endif()
if (SPIRV_CROSS_ENABLE_CPP)
if (SPIRV_CROSS_ENABLE_GLSL)
target_sources(spirv-cross-c-shared PRIVATE ${spirv-cross-cpp-sources})
else()
message(FATAL_ERROR "Must enable GLSL support to enable C++ support.")
endif()
target_compile_definitions(spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_CPP=1)
endif()
if (SPIRV_CROSS_ENABLE_REFLECT)
if (SPIRV_CROSS_ENABLE_GLSL)
target_sources(spirv-cross-c-shared PRIVATE ${spirv-cross-reflect-sources})
else()
message(FATAL_ERROR "Must enable GLSL support to enable JSON reflection support.")
endif()
target_compile_definitions(spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_REFLECT=1)
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
# Only export the C API.
target_compile_options(spirv-cross-c-shared PRIVATE -fvisibility=hidden)
if (NOT APPLE)
set_target_properties(spirv-cross-c-shared PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
endif()
endif()
target_compile_definitions(spirv-cross-c-shared PRIVATE SPVC_EXPORT_SYMBOLS)
set_target_properties(spirv-cross-c-shared PROPERTIES
VERSION ${SPIRV_CROSS_VERSION}
SOVERSION ${spirv-cross-abi-major})
endif()
if (SPIRV_CROSS_CLI)
if (NOT SPIRV_CROSS_ENABLE_GLSL)
message(FATAL_ERROR "Must enable GLSL if building CLI.")
endif()
if (NOT SPIRV_CROSS_ENABLE_HLSL)
message(FATAL_ERROR "Must enable HLSL if building CLI.")
endif()
if (NOT SPIRV_CROSS_ENABLE_MSL)
message(FATAL_ERROR "Must enable MSL if building CLI.")
endif()
if (NOT SPIRV_CROSS_ENABLE_CPP)
message(FATAL_ERROR "Must enable C++ if building CLI.")
endif()
if (NOT SPIRV_CROSS_ENABLE_REFLECT)
message(FATAL_ERROR "Must enable reflection if building CLI.")
endif()
if (NOT SPIRV_CROSS_ENABLE_UTIL)
message(FATAL_ERROR "Must enable utils if building CLI.")
endif()
if (NOT SPIRV_CROSS_STATIC)
message(FATAL_ERROR "Must build static libraries if building CLI.")
endif()
add_executable(spirv-cross main.cpp)
target_compile_options(spirv-cross PRIVATE ${spirv-compiler-options})
target_include_directories(spirv-cross PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines} HAVE_SPIRV_CROSS_GIT_VERSION)
set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
if (NOT SPIRV_CROSS_SKIP_INSTALL)
install(TARGETS spirv-cross DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
target_link_libraries(spirv-cross PRIVATE
spirv-cross-glsl
spirv-cross-hlsl
spirv-cross-cpp
spirv-cross-reflect
spirv-cross-msl
spirv-cross-util
spirv-cross-core)
if (SPIRV_CROSS_ENABLE_TESTS)
# Set up tests, using only the simplest modes of the test_shaders
# script. You have to invoke the script manually to:
# - Update the reference files
# - Get cycle counts from malisc
# - Keep failing outputs
find_package(PythonInterp)
find_program(spirv-cross-glslang NAMES glslangValidator
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/glslang-build/output/bin
NO_DEFAULT_PATH)
find_program(spirv-cross-spirv-as NAMES spirv-as
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/spirv-tools-build/output/bin
NO_DEFAULT_PATH)
find_program(spirv-cross-spirv-val NAMES spirv-val
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/spirv-tools-build/output/bin
NO_DEFAULT_PATH)
find_program(spirv-cross-spirv-opt NAMES spirv-opt
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external/spirv-tools-build/output/bin
NO_DEFAULT_PATH)
if ((${spirv-cross-glslang} MATCHES "NOTFOUND") OR (${spirv-cross-spirv-as} MATCHES "NOTFOUND") OR (${spirv-cross-spirv-val} MATCHES "NOTFOUND") OR (${spirv-cross-spirv-opt} MATCHES "NOTFOUND"))
set(SPIRV_CROSS_ENABLE_TESTS OFF)
message("SPIRV-Cross: Testing will be disabled for SPIRV-Cross. Could not find glslang or SPIRV-Tools build under external/. To enable testing, run ./checkout_glslang_spirv_tools.sh and ./build_glslang_spirv_tools.sh first.")
else()
set(SPIRV_CROSS_ENABLE_TESTS ON)
message("SPIRV-Cross: Found glslang and SPIRV-Tools. Enabling test suite.")
message("SPIRV-Cross: Found glslangValidator in: ${spirv-cross-glslang}.")
message("SPIRV-Cross: Found spirv-as in: ${spirv-cross-spirv-as}.")
message("SPIRV-Cross: Found spirv-val in: ${spirv-cross-spirv-val}.")
message("SPIRV-Cross: Found spirv-opt in: ${spirv-cross-spirv-opt}.")
endif()
set(spirv-cross-externals
--glslang "${spirv-cross-glslang}"
--spirv-as "${spirv-cross-spirv-as}"
--spirv-opt "${spirv-cross-spirv-opt}"
--spirv-val "${spirv-cross-spirv-val}")
if (${PYTHONINTERP_FOUND} AND SPIRV_CROSS_ENABLE_TESTS)
if (${PYTHON_VERSION_MAJOR} GREATER 2)
add_executable(spirv-cross-c-api-test tests-other/c_api_test.c)
target_link_libraries(spirv-cross-c-api-test spirv-cross-c)
set_target_properties(spirv-cross-c-api-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-small-vector-test tests-other/small_vector.cpp)
target_link_libraries(spirv-cross-small-vector-test spirv-cross-core)
set_target_properties(spirv-cross-small-vector-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-msl-constexpr-test tests-other/msl_constexpr_test.cpp)
target_link_libraries(spirv-cross-msl-constexpr-test spirv-cross-c)
set_target_properties(spirv-cross-msl-constexpr-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-msl-resource-binding-test tests-other/msl_resource_bindings.cpp)
target_link_libraries(spirv-cross-msl-resource-binding-test spirv-cross-c)
set_target_properties(spirv-cross-msl-resource-binding-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-hlsl-resource-binding-test tests-other/hlsl_resource_bindings.cpp)
target_link_libraries(spirv-cross-hlsl-resource-binding-test spirv-cross-c)
set_target_properties(spirv-cross-hlsl-resource-binding-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-msl-ycbcr-conversion-test tests-other/msl_ycbcr_conversion_test.cpp)
target_link_libraries(spirv-cross-msl-ycbcr-conversion-test spirv-cross-c)
set_target_properties(spirv-cross-msl-ycbcr-conversion-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
add_executable(spirv-cross-typed-id-test tests-other/typed_id_test.cpp)
target_link_libraries(spirv-cross-typed-id-test spirv-cross-core)
set_target_properties(spirv-cross-typed-id-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
target_compile_options(spirv-cross-c-api-test PRIVATE -std=c89 -Wall -Wextra)
endif()
add_test(NAME spirv-cross-c-api-test
COMMAND $<TARGET_FILE:spirv-cross-c-api-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/c_api_test.spv
${spirv-cross-abi-major}
${spirv-cross-abi-minor}
${spirv-cross-abi-patch})
add_test(NAME spirv-cross-small-vector-test
COMMAND $<TARGET_FILE:spirv-cross-small-vector-test>)
add_test(NAME spirv-cross-msl-constexpr-test
COMMAND $<TARGET_FILE:spirv-cross-msl-constexpr-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/msl_constexpr_test.spv)
add_test(NAME spirv-cross-msl-resource-binding-test
COMMAND $<TARGET_FILE:spirv-cross-msl-resource-binding-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/msl_resource_binding.spv)
add_test(NAME spirv-cross-hlsl-resource-binding-test
COMMAND $<TARGET_FILE:spirv-cross-hlsl-resource-binding-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/hlsl_resource_binding.spv)
add_test(NAME spirv-cross-msl-ycbcr-conversion-test
COMMAND $<TARGET_FILE:spirv-cross-msl-ycbcr-conversion-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/msl_ycbcr_conversion_test.spv)
add_test(NAME spirv-cross-msl-ycbcr-conversion-test-2
COMMAND $<TARGET_FILE:spirv-cross-msl-ycbcr-conversion-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/msl_ycbcr_conversion_test_2.spv)
add_test(NAME spirv-cross-typed-id-test
COMMAND $<TARGET_FILE:spirv-cross-typed-id-test>)
add_test(NAME spirv-cross-test
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-no-opt
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-metal
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-metal-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl-no-opt
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-hlsl
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-hlsl-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl-no-opt
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --opt --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-metal-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal --opt --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-hlsl-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl --opt --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-reflection
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --reflect --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-reflection
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-ue4
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-ue4-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --opt --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-ue4-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4-no-opt
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
endif()
elseif(NOT ${PYTHONINTERP_FOUND})
message(WARNING "SPIRV-Cross: Testing disabled. Could not find python3. If you have python3 installed try running "
"cmake with -DPYTHON_EXECUTABLE:FILEPATH=/path/to/python3 to help it find the executable")
endif()
endif()
endif()

11
CODE_OF_CONDUCT.adoc Normal file
View file

@ -0,0 +1,11 @@
// Copyright (c) 2016-2020 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0
= Code of Conduct
A reminder that this issue tracker is managed by the Khronos Group.
Interactions here should follow the
https://www.khronos.org/developers/code-of-conduct[Khronos Code of Conduct],
which prohibits aggressive or derogatory language. Please keep the
discussion friendly and civil.

114
GLSL.std.450.h Normal file
View file

@ -0,0 +1,114 @@
/*
* Copyright 2014-2016,2021 The Khronos Group, Inc.
* SPDX-License-Identifier: MIT
*
* 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/
*/
#ifndef GLSLstd450_H
#define GLSLstd450_H
static const int GLSLstd450Version = 100;
static const int GLSLstd450Revision = 3;
enum GLSLstd450 {
GLSLstd450Bad = 0, // Don't use
GLSLstd450Round = 1,
GLSLstd450RoundEven = 2,
GLSLstd450Trunc = 3,
GLSLstd450FAbs = 4,
GLSLstd450SAbs = 5,
GLSLstd450FSign = 6,
GLSLstd450SSign = 7,
GLSLstd450Floor = 8,
GLSLstd450Ceil = 9,
GLSLstd450Fract = 10,
GLSLstd450Radians = 11,
GLSLstd450Degrees = 12,
GLSLstd450Sin = 13,
GLSLstd450Cos = 14,
GLSLstd450Tan = 15,
GLSLstd450Asin = 16,
GLSLstd450Acos = 17,
GLSLstd450Atan = 18,
GLSLstd450Sinh = 19,
GLSLstd450Cosh = 20,
GLSLstd450Tanh = 21,
GLSLstd450Asinh = 22,
GLSLstd450Acosh = 23,
GLSLstd450Atanh = 24,
GLSLstd450Atan2 = 25,
GLSLstd450Pow = 26,
GLSLstd450Exp = 27,
GLSLstd450Log = 28,
GLSLstd450Exp2 = 29,
GLSLstd450Log2 = 30,
GLSLstd450Sqrt = 31,
GLSLstd450InverseSqrt = 32,
GLSLstd450Determinant = 33,
GLSLstd450MatrixInverse = 34,
GLSLstd450Modf = 35, // second operand needs an OpVariable to write to
GLSLstd450ModfStruct = 36, // no OpVariable operand
GLSLstd450FMin = 37,
GLSLstd450UMin = 38,
GLSLstd450SMin = 39,
GLSLstd450FMax = 40,
GLSLstd450UMax = 41,
GLSLstd450SMax = 42,
GLSLstd450FClamp = 43,
GLSLstd450UClamp = 44,
GLSLstd450SClamp = 45,
GLSLstd450FMix = 46,
GLSLstd450IMix = 47, // Reserved
GLSLstd450Step = 48,
GLSLstd450SmoothStep = 49,
GLSLstd450Fma = 50,
GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to
GLSLstd450FrexpStruct = 52, // no OpVariable operand
GLSLstd450Ldexp = 53,
GLSLstd450PackSnorm4x8 = 54,
GLSLstd450PackUnorm4x8 = 55,
GLSLstd450PackSnorm2x16 = 56,
GLSLstd450PackUnorm2x16 = 57,
GLSLstd450PackHalf2x16 = 58,
GLSLstd450PackDouble2x32 = 59,
GLSLstd450UnpackSnorm2x16 = 60,
GLSLstd450UnpackUnorm2x16 = 61,
GLSLstd450UnpackHalf2x16 = 62,
GLSLstd450UnpackSnorm4x8 = 63,
GLSLstd450UnpackUnorm4x8 = 64,
GLSLstd450UnpackDouble2x32 = 65,
GLSLstd450Length = 66,
GLSLstd450Distance = 67,
GLSLstd450Cross = 68,
GLSLstd450Normalize = 69,
GLSLstd450FaceForward = 70,
GLSLstd450Reflect = 71,
GLSLstd450Refract = 72,
GLSLstd450FindILsb = 73,
GLSLstd450FindSMsb = 74,
GLSLstd450FindUMsb = 75,
GLSLstd450InterpolateAtCentroid = 76,
GLSLstd450InterpolateAtSample = 77,
GLSLstd450InterpolateAtOffset = 78,
GLSLstd450NMin = 79,
GLSLstd450NMax = 80,
GLSLstd450NClamp = 81,
GLSLstd450Count
};
#endif // #ifndef GLSLstd450_H

202
LICENSE Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

208
LICENSES/Apache-2.0.txt Normal file
View file

@ -0,0 +1,208 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION,
AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution
as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct
or indirect, to cause the direction or management of such entity, whether
by contract or otherwise, or (ii) ownership of fifty percent (50%) or more
of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions
granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation
or translation of a Source form, including but not limited to compiled object
code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form,
made available under the License, as indicated by a copyright notice that
is included in or attached to the work (an example is provided in the Appendix
below).
"Derivative Works" shall mean any work, whether in Source or Object form,
that is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative
Works shall not include works that remain separable from, or merely link (or
bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative
Works thereof, that is intentionally submitted to Licensor for inclusion in
the Work by the copyright owner or by an individual or Legal Entity authorized
to submit on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication
sent to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor
for the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently incorporated
within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
Derivative Works of, publicly display, publicly perform, sublicense, and distribute
the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License,
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and otherwise
transfer the Work, where such license applies only to those patent claims
licensable by such Contributor that are necessarily infringed by their Contribution(s)
alone or by combination of their Contribution(s) with the Work to which such
Contribution(s) was submitted. If You institute patent litigation against
any entity (including a cross-claim or counterclaim in a lawsuit) alleging
that the Work or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses granted to You
under this License for that Work shall terminate as of the date such litigation
is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or
Derivative Works thereof in any medium, with or without modifications, and
in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy
of this License; and
(b) You must cause any modified files to carry prominent notices stating that
You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source
form of the Work, excluding those notices that do not pertain to any part
of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution,
then any Derivative Works that You distribute must include a readable copy
of the attribution notices contained within such NOTICE file, excluding those
notices that do not pertain to any part of the Derivative Works, in at least
one of the following places: within a NOTICE text file distributed as part
of the Derivative Works; within the Source form or documentation, if provided
along with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works
that You distribute, alongside or as an addendum to the NOTICE text from the
Work, provided that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction,
or distribution of Your modifications, or for any such Derivative Works as
a whole, provided Your use, reproduction, and distribution of the Work otherwise
complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any
Contribution intentionally submitted for inclusion in the Work by You to the
Licensor shall be under the terms and conditions of this License, without
any additional terms or conditions. Notwithstanding the above, nothing herein
shall supersede or modify the terms of any separate license agreement you
may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names,
trademarks, service marks, or product names of the Licensor, except as required
for reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
in writing, Licensor provides the Work (and each Contributor provides its
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied, including, without limitation, any warranties
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR
A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness
of using or redistributing the Work and assume any risks associated with Your
exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether
in tort (including negligence), contract, or otherwise, unless required by
applicable law (such as deliberate and grossly negligent acts) or agreed to
in writing, shall any Contributor be liable to You for damages, including
any direct, indirect, special, incidental, or consequential damages of any
character arising as a result of this License or out of the use or inability
to use the Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all other commercial
damages or losses), even if such Contributor has been advised of the possibility
of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work
or Derivative Works thereof, You may choose to offer, and charge a fee for,
acceptance of support, warranty, indemnity, or other liability obligations
and/or rights consistent with this License. However, in accepting such obligations,
You may act only on Your own behalf and on Your sole responsibility, not on
behalf of any other Contributor, and only if You agree to indemnify, defend,
and hold each Contributor harmless for any liability incurred by, or claims
asserted against, such Contributor by reason of your accepting any such warranty
or additional liability. END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own identifying
information. (Don't include the brackets!) The text should be enclosed in
the appropriate comment syntax for the file format. We also recommend that
a file or class name and description of purpose be included on the same "printed
page" as the copyright notice for easier identification within third-party
archives.
Copyright [yyyy] [name of copyright owner]
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.

324
LICENSES/CC-BY-4.0.txt Normal file
View file

@ -0,0 +1,324 @@
Creative Commons Attribution 4.0 International Creative Commons Corporation
("Creative Commons") is not a law firm and does not provide legal services
or legal advice. Distribution of Creative Commons public licenses does not
create a lawyer-client or other relationship. Creative Commons makes its licenses
and related information available on an "as-is" basis. Creative Commons gives
no warranties regarding its licenses, any material licensed under their terms
and conditions, or any related information. Creative Commons disclaims all
liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions
that creators and other rights holders may use to share original works of
authorship and other material subject to copyright and certain other rights
specified in the public license below. The following considerations are for
informational purposes only, are not exhaustive, and do not form part of our
licenses.
Considerations for licensors: Our public licenses are intended for use by
those authorized to give the public permission to use material in ways otherwise
restricted by copyright and certain other rights. Our licenses are irrevocable.
Licensors should read and understand the terms and conditions of the license
they choose before applying it. Licensors should also secure all rights necessary
before applying our licenses so that the public can reuse the material as
expected. Licensors should clearly mark any material not subject to the license.
This includes other CC-licensed material, or material used under an exception
or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor
grants the public permission to use the licensed material under specified
terms and conditions. If the licensor's permission is not necessary for any
reasonfor example, because of any applicable exception or limitation to copyrightthen
that use is not regulated by the license. Our licenses grant only permissions
under copyright and certain other rights that a licensor has authority to
grant. Use of the licensed material may still be restricted for other reasons,
including because others have copyright or other rights in the material. A
licensor may make special requests, such as asking that all changes be marked
or described. Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations for the public
: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution
4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to
be bound by the terms and conditions of this Creative Commons Attribution
4.0 International Public License ("Public License"). To the extent this Public
License may be interpreted as a contract, You are granted the Licensed Rights
in consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the Licensor
receives from making the Licensed Material available under these terms and
conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights
that is derived from or based upon the Licensed Material and in which the
Licensed Material is translated, altered, arranged, transformed, or otherwise
modified in a manner requiring permission under the Copyright and Similar
Rights held by the Licensor. For purposes of this Public License, where the
Licensed Material is a musical work, performance, or sound recording, Adapted
Material is always produced where the Licensed Material is synched in timed
relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar
Rights in Your contributions to Adapted Material in accordance with the terms
and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely
related to copyright including, without limitation, performance, broadcast,
sound recording, and Sui Generis Database Rights, without regard to how the
rights are labeled or categorized. For purposes of this Public License, the
rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence
of proper authority, may not be circumvented under laws fulfilling obligations
under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other
exception or limitation to Copyright and Similar Rights that applies to Your
use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other
material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and
conditions of this Public License, which are limited to all Copyright and
Similar Rights that apply to Your use of the Licensed Material and that the
Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this
Public License.
i. Share means to provide material to the public by any means or process that
requires permission under the Licensed Rights, such as reproduction, public
display, public performance, distribution, dissemination, communication, or
importation, and to make material available to the public including in ways
that members of the public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting
from Directive 96/9/EC of the European Parliament and of the Council of 11
March 1996 on the legal protection of databases, as amended and/or succeeded,
as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under
this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor
hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
irrevocable license to exercise the Licensed Rights in the Licensed Material
to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
and Limitations apply to Your use, this Public License does not apply, and
You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes
You to exercise the Licensed Rights in all media and formats whether now known
or hereafter created, and to make technical modifications necessary to do
so. The Licensor waives and/or agrees not to assert any right or authority
to forbid You from making technical modifications necessary to exercise the
Licensed Rights, including technical modifications necessary to circumvent
Effective Technological Measures. For purposes of this Public License, simply
making modifications authorized by this Section 2(a)(4) never produces Adapted
Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed
Material automatically receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional
or different terms or conditions on, or apply any Effective Technological
Measures to, the Licensed Material if doing so restricts exercise of the Licensed
Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed
as permission to assert or imply that You are, or that Your use of the Licensed
Material is, connected with, or sponsored, endorsed, or granted official status
by, the Licensor or others designated to receive attribution as provided in
Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this
Public License, nor are publicity, privacy, and/or other similar personality
rights; however, to the extent possible, the Licensor waives and/or agrees
not to assert any such rights held by the Licensor to the limited extent necessary
to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties
from You for the exercise of the Licensed Rights, whether directly or through
a collecting society under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly reserves any right
to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following
conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed
Material:
i. identification of the creator(s) of the Licensed Material and any others
designated to receive attribution, in any reasonable manner requested by the
Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication
of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and
include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
based on the medium, means, and context in which You Share the Licensed Material.
For example, it may be reasonable to satisfy the conditions by providing a
URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required
by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply
must not prevent recipients of the Adapted Material from complying with this
Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to
Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
reuse, reproduce, and Share all or a substantial portion of the contents of
the database;
b. if You include all or a substantial portion of the database contents in
a database in which You have Sui Generis Database Rights, then the database
in which You have Sui Generis Database Rights (but not its individual contents)
is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or
a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace
Your obligations under this Public License where the Licensed Rights include
other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
the Licensor offers the Licensed Material as-is and as-available, and makes
no representations or warranties of any kind concerning the Licensed Material,
whether express, implied, statutory, or other. This includes, without limitation,
warranties of title, merchantability, fitness for a particular purpose, non-infringement,
absence of latent or other defects, accuracy, or the presence or absence of
errors, whether or not known or discoverable. Where disclaimers of warranties
are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You
on any legal theory (including, without limitation, negligence) or otherwise
for any direct, special, indirect, incidental, consequential, punitive, exemplary,
or other losses, costs, expenses, or damages arising out of this Public License
or use of the Licensed Material, even if the Licensor has been advised of
the possibility of such losses, costs, expenses, or damages. Where a limitation
of liability is not allowed in full or in part, this limitation may not apply
to You.
c. The disclaimer of warranties and limitation of liability provided above
shall be interpreted in a manner that, to the extent possible, most closely
approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights
licensed here. However, if You fail to comply with this Public License, then
Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section
6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured
within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right
the Licensor may have to seek remedies for Your violations of this Public
License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material
under separate terms or conditions or stop distributing the Licensed Material
at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or
conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed
Material not stated herein are separate from and independent of the terms
and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not
be interpreted to, reduce, limit, restrict, or impose conditions on any use
of the Licensed Material that could lawfully be made without permission under
this Public License.
b. To the extent possible, if any provision of this Public License is deemed
unenforceable, it shall be automatically reformed to the minimum extent necessary
to make it enforceable. If the provision cannot be reformed, it shall be severed
from this Public License without affecting the enforceability of the remaining
terms and conditions.
c. No term or condition of this Public License will be waived and no failure
to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation
upon, or waiver of, any privileges and immunities that apply to the Licensor
or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative
Commons may elect to apply one of its public licenses to material it publishes
and in those instances will be considered the "Licensor." The text of the
Creative Commons public licenses is dedicated to the public domain under the
CC0 Public Domain Dedication. Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as otherwise
permitted by the Creative Commons policies published at creativecommons.org/policies,
Creative Commons does not authorize the use of the trademark "Creative Commons"
or any other trademark or logo of Creative Commons without its prior written
consent including, without limitation, in connection with any unauthorized
modifications to any of its public licenses or any other arrangements, understandings,
or agreements concerning use of licensed material. For the avoidance of doubt,
this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

19
LICENSES/MIT.txt Normal file
View file

@ -0,0 +1,19 @@
MIT License Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

44
Makefile Normal file
View file

@ -0,0 +1,44 @@
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
TARGET := spirv-cross
SOURCES := $(wildcard spirv_*.cpp)
CLI_SOURCES := main.cpp
OBJECTS := $(SOURCES:.cpp=.o)
CLI_OBJECTS := $(CLI_SOURCES:.cpp=.o)
STATIC_LIB := lib$(TARGET).a
DEPS := $(OBJECTS:.o=.d) $(CLI_OBJECTS:.o=.d)
CXXFLAGS += -std=c++11 -Wall -Wextra -Wshadow -Wno-deprecated-declarations
ifeq ($(DEBUG), 1)
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O2 -DNDEBUG
endif
ifeq ($(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS), 1)
CXXFLAGS += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS -fno-exceptions
endif
all: $(TARGET)
-include $(DEPS)
$(TARGET): $(CLI_OBJECTS) $(STATIC_LIB)
$(CXX) -o $@ $(CLI_OBJECTS) $(STATIC_LIB) $(LDFLAGS)
$(STATIC_LIB): $(OBJECTS)
$(AR) rcs $@ $(OBJECTS)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) -MMD
clean:
rm -f $(TARGET) $(OBJECTS) $(CLI_OBJECTS) $(STATIC_LIB) $(DEPS)
.PHONY: clean

72
Package.swift Normal file
View file

@ -0,0 +1,72 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
// Copyright 2016-2021 The Khronos Group Inc.
// SPDX-License-Identifier: Apache-2.0
import PackageDescription
let package = Package(
name: "SPIRV-Cross",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SPIRV-Cross",
targets: ["SPIRV-Cross"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SPIRV-Cross",
dependencies: [],
path: ".",
exclude: ["CMakeLists.txt",
"CODE_OF_CONDUCT.adoc",
"LICENSE",
"LICENSES",
"Makefile",
"README.md",
"appveyor.yml",
"build_glslang_spirv_tools.sh",
"checkout_glslang_spirv_tools.sh",
"cmake",
"format_all.sh",
"gn",
"main.cpp",
"pkg-config",
"reference",
"samples",
"shaders",
"shaders-hlsl",
"shaders-hlsl-no-opt",
"shaders-msl",
"shaders-msl-no-opt",
"shaders-no-opt",
"shaders-other",
"shaders-reflection",
"shaders-ue4",
"shaders-ue4-no-opt",
"test_shaders.py",
"test_shaders.sh",
"tests-other",
"update_test_shaders.sh"],
sources: ["spirv_cfg.cpp",
"spirv_cpp.cpp",
"spirv_cross.cpp",
"spirv_cross_c.cpp",
"spirv_cross_parsed_ir.cpp",
"spirv_cross_util.cpp",
"spirv_glsl.cpp",
"spirv_hlsl.cpp",
"spirv_msl.cpp",
"spirv_parser.cpp",
"spirv_reflect.cpp"],
publicHeadersPath: "."),
],
cxxLanguageStandard: .cxx14
)

554
README.md Normal file
View file

@ -0,0 +1,554 @@
<!--
Copyright 2020-2021 The Khronos Group, Inc.
SPDX-License-Identifier: CC-BY-4.0
-->
# SPIRV-Cross
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.
[![CI](https://github.com/KhronosGroup/SPIRV-Cross/actions/workflows/main.yml/badge.svg)](https://github.com/KhronosGroup/SPIRV-Cross/actions/workflows/main.yml)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/KhronosGroup/SPIRV-Cross?svg=true&branch=main)](https://ci.appveyor.com/project/HansKristian-Work/SPIRV-Cross)
## Features
- Convert SPIR-V to readable, usable and efficient GLSL
- Convert SPIR-V to readable, usable and efficient Metal Shading Language (MSL)
- Convert SPIR-V to readable, usable and efficient HLSL
- Convert SPIR-V to a JSON reflection format
- Convert SPIR-V to debuggable C++ [DEPRECATED]
- Reflection API to simplify the creation of Vulkan pipeline layouts
- Reflection API to modify and tweak OpDecorations
- Supports "all" of vertex, fragment, tessellation, geometry and compute shaders.
SPIRV-Cross tries hard to emit readable and clean output from the SPIR-V.
The goal is to emit GLSL or MSL that looks like it was written by a human and not awkward IR/assembly-like code.
NOTE: Individual features are expected to be mostly complete, but it is possible that certain obscure GLSL features are not yet supported.
However, most missing features are expected to be "trivial" improvements at this stage.
## Building
SPIRV-Cross has been tested on Linux, iOS/OSX, Windows and Android. CMake is the main build system.
### NOTE: main branch rename
On 2023-01-12, `master` was renamed to `main` as per Khronos policy.
### Linux and macOS
Building with CMake is recommended, as it is the only build system which is tested in continuous integration.
It is also the only build system which has install commands and other useful build system features.
However, you can just run `make` on the command line as a fallback if you only care about the CLI tool.
A non-ancient GCC (4.8+) or Clang (3.x+) compiler is required as SPIRV-Cross uses C++11 extensively.
### Windows
Building with CMake is recommended, which is the only way to target MSVC.
MinGW-w64 based compilation works with `make` as a fallback.
### Android
SPIRV-Cross is only useful as a library here. Use the CMake build to link SPIRV-Cross to your project.
### C++ exceptions
The make and CMake build flavors offer the option to treat exceptions as assertions. To disable exceptions for make just append `SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=1` to the command line. For CMake append `-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON`. By default exceptions are enabled.
### Static, shared and CLI
You can use `-DSPIRV_CROSS_STATIC=ON/OFF` `-DSPIRV_CROSS_SHARED=ON/OFF` `-DSPIRV_CROSS_CLI=ON/OFF` to control which modules are built (and installed).
### Installing SPIRV-Cross (vcpkg)
Alternatively, you can build and install SPIRV-Cross using [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
```
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install spirv-cross
```
The SPIRV-Cross port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
## Usage
### Using the C++ API
The C++ API is the main API for SPIRV-Cross. For more in-depth documentation than what's provided in this README,
please have a look at the [Wiki](https://github.com/KhronosGroup/SPIRV-Cross/wiki).
**NOTE**: This API is not guaranteed to be ABI-stable, and it is highly recommended to link against this API statically.
The API is generally quite stable, but it can change over time, see the C API for more stability.
To perform reflection and convert to other shader languages you can use the SPIRV-Cross API.
For example:
```c++
#include "spirv_glsl.hpp"
#include <vector>
#include <utility>
extern std::vector<uint32_t> load_spirv_file();
int main()
{
// Read SPIR-V from disk or similar.
std::vector<uint32_t> spirv_binary = load_spirv_file();
spirv_cross::CompilerGLSL glsl(std::move(spirv_binary));
// The SPIR-V is now parsed, and we can perform reflection on it.
spirv_cross::ShaderResources resources = glsl.get_shader_resources();
// Get all sampled images in the shader.
for (auto &resource : resources.sampled_images)
{
unsigned set = glsl.get_decoration(resource.id, spv::DecorationDescriptorSet);
unsigned binding = glsl.get_decoration(resource.id, spv::DecorationBinding);
printf("Image %s at set = %u, binding = %u\n", resource.name.c_str(), set, binding);
// Modify the decoration to prepare it for GLSL.
glsl.unset_decoration(resource.id, spv::DecorationDescriptorSet);
// Some arbitrary remapping if we want.
glsl.set_decoration(resource.id, spv::DecorationBinding, set * 16 + binding);
}
// Set some options.
spirv_cross::CompilerGLSL::Options options;
options.version = 310;
options.es = true;
glsl.set_common_options(options);
// Compile to GLSL, ready to give to GL driver.
std::string source = glsl.compile();
}
```
### Using the C API wrapper
To facilitate C compatibility and compatibility with foreign programming languages, a C89-compatible API wrapper is provided. Unlike the C++ API,
the goal of this wrapper is to be fully stable, both API and ABI-wise.
This is the only interface which is supported when building SPIRV-Cross as a shared library.
An important point of the wrapper is that all memory allocations are contained in the `spvc_context`.
This simplifies the use of the API greatly. However, you should destroy the context as soon as reasonable,
or use `spvc_context_release_allocations()` if you intend to reuse the `spvc_context` object again soon.
Most functions return a `spvc_result`, where `SPVC_SUCCESS` is the only success code.
For brevity, the code below does not do any error checking.
```c
#include <spirv_cross_c.h>
const SpvId *spirv = get_spirv_data();
size_t word_count = get_spirv_word_count();
spvc_context context = NULL;
spvc_parsed_ir ir = NULL;
spvc_compiler compiler_glsl = NULL;
spvc_compiler_options options = NULL;
spvc_resources resources = NULL;
const spvc_reflected_resource *list = NULL;
const char *result = NULL;
size_t count;
size_t i;
// Create context.
spvc_context_create(&context);
// Set debug callback.
spvc_context_set_error_callback(context, error_callback, userdata);
// Parse the SPIR-V.
spvc_context_parse_spirv(context, spirv, word_count, &ir);
// Hand it off to a compiler instance and give it ownership of the IR.
spvc_context_create_compiler(context, SPVC_BACKEND_GLSL, ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler_glsl);
// Do some basic reflection.
spvc_compiler_create_shader_resources(compiler_glsl, &resources);
spvc_resources_get_resource_list_for_type(resources, SPVC_RESOURCE_TYPE_UNIFORM_BUFFER, &list, &count);
for (i = 0; i < count; i++)
{
printf("ID: %u, BaseTypeID: %u, TypeID: %u, Name: %s\n", list[i].id, list[i].base_type_id, list[i].type_id,
list[i].name);
printf(" Set: %u, Binding: %u\n",
spvc_compiler_get_decoration(compiler_glsl, list[i].id, SpvDecorationDescriptorSet),
spvc_compiler_get_decoration(compiler_glsl, list[i].id, SpvDecorationBinding));
}
// Modify options.
spvc_compiler_create_compiler_options(compiler_glsl, &options);
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 330);
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_FALSE);
spvc_compiler_install_compiler_options(compiler_glsl, options);
spvc_compiler_compile(compiler_glsl, &result);
printf("Cross-compiled source: %s\n", result);
// Frees all memory we allocated so far.
spvc_context_destroy(context);
```
### Linking
#### CMake add_subdirectory()
This is the recommended way if you are using CMake and want to link against SPIRV-Cross statically.
#### Integrating SPIRV-Cross in a custom build system
To add SPIRV-Cross to your own codebase, just copy the source and header files from root directory
and build the relevant .cpp files you need. Make sure to build with C++11 support, e.g. `-std=c++11` in GCC and Clang.
Alternatively, the Makefile generates a libspirv-cross.a static library during build that can be linked in.
#### Linking against SPIRV-Cross as a system library
It is possible to link against SPIRV-Cross when it is installed as a system library,
which would be mostly relevant for Unix-like platforms.
##### pkg-config
For Unix-based systems, a pkg-config is installed for the C API, e.g.:
```
$ pkg-config spirv-cross-c-shared --libs --cflags
-I/usr/local/include/spirv_cross -L/usr/local/lib -lspirv-cross-c-shared
```
##### CMake
If the project is installed, it can be found with `find_package()`, e.g.:
```
cmake_minimum_required(VERSION 3.5)
set(CMAKE_C_STANDARD 99)
project(Test LANGUAGES C)
find_package(spirv_cross_c_shared)
if (spirv_cross_c_shared_FOUND)
message(STATUS "Found SPIRV-Cross C API! :)")
else()
message(STATUS "Could not find SPIRV-Cross C API! :(")
endif()
add_executable(test test.c)
target_link_libraries(test spirv-cross-c-shared)
```
test.c:
```c
#include <spirv_cross_c.h>
int main(void)
{
spvc_context context;
spvc_context_create(&context);
spvc_context_destroy(context);
}
```
### CLI
The CLI is suitable for basic cross-compilation tasks, but it cannot support the full flexibility that the API can.
Some examples below.
#### Creating a SPIR-V file from GLSL with glslang
```
glslangValidator -H -V -o test.spv test.frag
```
#### Converting a SPIR-V file to GLSL ES
```
glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spirv-cross --version 310 --es test.spv
```
#### Converting to desktop GLSL
```
glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spirv-cross --version 330 --no-es test.spv --output test.comp
```
#### Disable prettifying optimizations
```
glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spirv-cross --version 310 --es test.spv --output test.comp --force-temporary
```
### Using shaders generated from C++ backend
Please see `samples/cpp` where some GLSL shaders are compiled to SPIR-V, decompiled to C++ and run with test data.
Reading through the samples should explain how to use the C++ interface.
A simple Makefile is included to build all shaders in the directory.
### Implementation notes
When using SPIR-V and SPIRV-Cross as an intermediate step for cross-compiling between high level languages there are some considerations to take into account,
as not all features used by one high-level language are necessarily supported natively by the target shader language.
SPIRV-Cross aims to provide the tools needed to handle these scenarios in a clean and robust way, but some manual action is required to maintain compatibility.
#### HLSL source to GLSL
##### HLSL entry points
When using SPIR-V shaders compiled from HLSL, there are some extra things you need to take care of.
First make sure that the entry point is used correctly.
If you forget to set the entry point correctly in glslangValidator (-e MyFancyEntryPoint),
you will likely encounter this error message:
```
Cannot end a function before ending the current block.
Likely cause: If this SPIR-V was created from glslang HLSL, make sure the entry point is valid.
```
##### Vertex/Fragment interface linking
HLSL relies on semantics in order to effectively link together shader stages. In the SPIR-V generated by glslang, the transformation from HLSL to GLSL ends up looking like
```c++
struct VSOutput {
// SV_Position is rerouted to gl_Position
float4 position : SV_Position;
float4 coord : TEXCOORD0;
};
VSOutput main(...) {}
```
```c++
struct VSOutput {
float4 coord;
}
layout(location = 0) out VSOutput _magicNameGeneratedByGlslang;
```
While this works, be aware of the type of the struct which is used in the vertex stage and the fragment stage.
There may be issues if the structure type name differs in vertex stage and fragment stage.
You can make use of the reflection interface to force the name of the struct type.
```
// Something like this for both vertex outputs and fragment inputs.
compiler.set_name(varying_resource.base_type_id, "VertexFragmentLinkage");
```
Some platform may require identical variable name for both vertex outputs and fragment inputs. (for example MacOSX)
to rename variable base on location, please add
```
--rename-interface-variable <in|out> <location> <new_variable_name>
```
#### HLSL source to legacy GLSL/ESSL
HLSL tends to emit varying struct types to pass data between vertex and fragment.
This is not supported in legacy GL/GLES targets, so to support this, varying structs are flattened.
This is done automatically, but the API user might need to be aware that this is happening in order to support all cases.
Modern GLES code like this:
```c++
struct Output {
vec4 a;
vec2 b;
};
out Output vout;
```
Is transformed into:
```c++
struct Output {
vec4 a;
vec2 b;
};
varying vec4 Output_a;
varying vec2 Output_b;
```
Note that now, both the struct name and the member names will participate in the linking interface between vertex and fragment, so
API users might want to ensure that both the struct names and member names match so that vertex outputs and fragment inputs can link properly.
#### Separate image samplers (HLSL/Vulkan) for backends which do not support it (GLSL)
Another thing you need to remember is when using samplers and textures in HLSL these are separable, and not directly compatible with GLSL. If you need to use this with desktop GL/GLES, you need to call `Compiler::build_combined_image_samplers` first before calling `Compiler::compile`, or you will get an exception.
```c++
// From main.cpp
// Builds a mapping for all combinations of images and samplers.
compiler->build_combined_image_samplers();
// Give the remapped combined samplers new names.
// Here you can also set up decorations if you want (binding = #N).
for (auto &remap : compiler->get_combined_image_samplers())
{
compiler->set_name(remap.combined_id, join("SPIRV_Cross_Combined", compiler->get_name(remap.image_id),
compiler->get_name(remap.sampler_id)));
}
```
If your target is Vulkan GLSL, `--vulkan-semantics` will emit separate image samplers as you'd expect.
The command line client calls `Compiler::build_combined_image_samplers` automatically, but if you're calling the library, you'll need to do this yourself.
#### Descriptor sets (Vulkan GLSL) for backends which do not support them (pre HLSL 5.1 / GLSL)
Descriptor sets are unique to Vulkan, so make sure that descriptor set + binding is remapped to a flat binding scheme (set always 0), so that other APIs can make sense of the bindings.
This can be done with `Compiler::set_decoration(id, spv::DecorationDescriptorSet)`. For other backends like MSL and HLSL, descriptor sets
can be used, with some minor caveats, see below.
##### MSL 2.0+
Metal supports indirect argument buffers (--msl-argument-buffers). In this case, descriptor sets become argument buffers,
and bindings are mapped to [[id(N)]] within the argument buffer. One quirk is that arrays of resources consume multiple ids,
where Vulkan does not. This can be worked around either from shader authoring stage
or remapping bindings as needed to avoid the overlap.
There is also a rich API to declare remapping schemes which is intended to work like
the pipeline layout in Vulkan. See `CompilerMSL::add_msl_resource_binding`. Remapping combined image samplers for example
must be split into two bindings in MSL, so it's possible to declare an id for the texture and sampler binding separately.
##### HLSL - SM 5.1+
In SM 5.1+, descriptor set bindings are interpreted as register spaces directly. In HLSL however, arrays of resources consume
multiple binding slots where Vulkan does not, so there might be overlap if the SPIR-V was not authored with this in mind.
This can be worked around either from shader authoring stage (don't assign overlapping bindings)
or remap bindings in SPIRV-Cross as needed to avoid the overlap.
#### Linking by name for targets which do not support explicit locations (legacy GLSL/ESSL)
Modern GLSL and HLSL sources (and SPIR-V) relies on explicit layout(location) qualifiers to guide the linking process between shader stages,
but older GLSL relies on symbol names to perform the linking. When emitting shaders with older versions, these layout statements will be removed,
so it is important that the API user ensures that the names of I/O variables are sanitized so that linking will work properly.
The reflection API can rename variables, struct types and struct members to deal with these scenarios using `Compiler::set_name` and friends.
#### Clip-space conventions
SPIRV-Cross can perform some common clip space conversions on gl_Position/SV_Position by enabling `CompilerGLSL::Options.vertex.fixup_clipspace`.
While this can be convenient, it is recommended to modify the projection matrices instead as that can achieve the same result.
For GLSL targets, enabling this will convert a shader which assumes `[0, w]` depth range (Vulkan / D3D / Metal) into `[-w, w]` range.
For MSL and HLSL targets, enabling this will convert a shader in `[-w, w]` depth range (OpenGL) to `[0, w]` depth range.
By default, the CLI will not enable `fixup_clipspace`, but in the API you might want to set an explicit value using `CompilerGLSL::set_options()`.
Y-flipping of gl_Position and similar is also supported.
The use of this is discouraged, because relying on vertex shader Y-flipping tends to get quite messy.
To enable this, set `CompilerGLSL::Options.vertex.flip_vert_y` or `--flip-vert-y` in CLI.
#### Reserved identifiers
When cross-compiling, certain identifiers are considered to be reserved by the implementation.
Code generated by SPIRV-Cross cannot emit these identifiers as they are reserved and used for various internal purposes,
and such variables will typically show up as `_RESERVED_IDENTIFIER_FIXUP_`
or some similar name to make it more obvious that an identifier has been renamed.
Reflection output will follow the exact name specified in the SPIR-V module. It might not be a valid identifier in the C sense,
as it may contain non-alphanumeric/non-underscore characters.
Reserved identifiers currently assumed by the implementation are (in pseudo-regex):
- _$digit+, e.g. `_100`, `_2`
- _$digit+_.+, e.g. `_100_tmp`, `_2_foobar`. `_2Bar` is **not** reserved.
- gl_- prefix
- spv- prefix
- SPIRV_Cross prefix. This prefix is generally used for interface variables where app needs to provide data for workaround purposes.
This identifier will not be rewritten, but be aware of potential collisions.
- Double underscores (reserved by all target languages).
Members of structs also have a reserved identifier:
- _m$digit+$END, e.g. `_m20` and `_m40` are reserved, but not `_m40Foobar`.
## Contributing
Contributions to SPIRV-Cross are welcome. See Testing and Licensing sections for details.
### Testing
SPIRV-Cross maintains a test suite of shaders with reference output of how the output looks after going through a roundtrip through
glslangValidator/spirv-as then back through SPIRV-Cross again.
The reference files are stored inside the repository in order to be able to track regressions.
All pull requests should ensure that test output does not change unexpectedly. This can be tested with:
```
./checkout_glslang_spirv_tools.sh # Checks out glslang and SPIRV-Tools at a fixed revision which matches the reference output.
./build_glslang_spirv_tools.sh # Builds glslang and SPIRV-Tools.
./test_shaders.sh # Runs over all changes and makes sure that there are no deltas compared to reference files.
```
`./test_shaders.sh` currently requires a Makefile setup with GCC/Clang to be set up.
However, on Windows, this can be rather inconvenient if a MinGW environment is not set up.
To use a spirv-cross binary you built with CMake (or otherwise), you can pass in an environment variable as such:
```
SPIRV_CROSS_PATH=path/to/custom/spirv-cross ./test_shaders.sh
```
However, when improving SPIRV-Cross there are of course legitimate cases where reference output should change.
In these cases, run:
```
./update_test_shaders.sh # SPIRV_CROSS_PATH also works here.
```
to update the reference files and include these changes as part of the pull request.
Always make sure you are running the correct version of glslangValidator as well as SPIRV-Tools when updating reference files.
See `checkout_glslang_spirv_tools.sh` which revisions are currently expected. The revisions change regularly.
In short, the main branch should always be able to run `./test_shaders.py shaders` and friends without failure.
SPIRV-Cross uses Travis CI to test all pull requests, so it is not strictly needed to perform testing yourself if you have problems running it locally.
A pull request which does not pass testing on Travis will not be accepted however.
When adding support for new features to SPIRV-Cross, a new shader and reference file should be added which covers usage of the new shader features in question.
Travis CI runs the test suite with the CMake, by running `ctest`. This is a more straight-forward alternative to `./test_shaders.sh`.
### Licensing
Contributors of new files should add a copyright header at the top of every new source code file with their copyright
along with the Apache 2.0 licensing stub.
### Formatting
SPIRV-Cross uses `clang-format` to automatically format code.
Please use `clang-format` with the style sheet found in `.clang-format` to automatically format code before submitting a pull request.
To make things easy, the `format_all.sh` script can be used to format all
source files in the library. In this directory, run the following from the
command line:
./format_all.sh
## Regression testing
In shaders/ a collection of shaders are maintained for purposes of regression testing.
The current reference output is contained in reference/.
`./test_shaders.py shaders` can be run to perform regression testing.
See `./test_shaders.py --help` for more.
### Metal backend
To test the roundtrip path GLSL -> SPIR-V -> MSL, `--msl` can be added, e.g. `./test_shaders.py --msl shaders-msl`.
### HLSL backend
To test the roundtrip path GLSL -> SPIR-V -> HLSL, `--hlsl` can be added, e.g. `./test_shaders.py --hlsl shaders-hlsl`.
### Updating regression tests
When legitimate changes are found, use `--update` flag to update regression files.
Otherwise, `./test_shaders.py` will fail with error code.
### Mali Offline Compiler cycle counts
To obtain a CSV of static shader cycle counts before and after going through spirv-cross, add
`--malisc` flag to `./test_shaders`. This requires the Mali Offline Compiler to be installed in PATH.

33
appveyor.yml Normal file
View file

@ -0,0 +1,33 @@
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
environment:
matrix:
- GENERATOR: "Visual Studio 12 2013 Win64"
CONFIG: Debug
- GENERATOR: "Visual Studio 12 2013 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 14 2015 Win64"
CONFIG: Debug
- GENERATOR: "Visual Studio 14 2015 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 12 2013"
CONFIG: Debug
- GENERATOR: "Visual Studio 12 2013"
CONFIG: Release
- GENERATOR: "Visual Studio 14 2015"
CONFIG: Debug
- GENERATOR: "Visual Studio 14 2015"
CONFIG: Release
build_script:
- git submodule update --init
- cmake "-G%GENERATOR%" -H. -B_builds
- cmake --build _builds --config "%CONFIG%"

28
build_glslang_spirv_tools.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
PROFILE=Release
if [ ! -z $1 ]; then
PROFILE=$1
fi
if [ ! -z $2 ]; then
NPROC="--parallel $2"
fi
echo "Building glslang."
mkdir -p external/glslang-build
cd external/glslang-build
cmake ../glslang -DCMAKE_BUILD_TYPE=$PROFILE -DCMAKE_INSTALL_PREFIX=output
cmake --build . --config $PROFILE --target install ${NPROC}
cd ../..
echo "Building SPIRV-Tools."
mkdir -p external/spirv-tools-build
cd external/spirv-tools-build
cmake ../spirv-tools -DCMAKE_BUILD_TYPE=$PROFILE -DSPIRV_WERROR=OFF -DCMAKE_INSTALL_PREFIX=output
cmake --build . --config $PROFILE --target install ${NPROC}
cd ../..

52
checkout_glslang_spirv_tools.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
GLSLANG_REV=06a7078ce74ab5c7801a165b8145859678831fb8
SPIRV_TOOLS_REV=f62e121b0df5374d1f043d1fbda98467406af0b1
SPIRV_HEADERS_REV=d13b52222c39a7e9a401b44646f0ca3a640fbd47
PROTOCOL=https
if [ -d external/glslang ]; then
echo "Updating glslang to revision $GLSLANG_REV."
cd external/glslang
git fetch origin
git checkout $GLSLANG_REV
else
echo "Cloning glslang revision $GLSLANG_REV."
mkdir -p external
cd external
git clone $PROTOCOL://github.com/KhronosGroup/glslang.git
cd glslang
git checkout $GLSLANG_REV
fi
cd ../..
if [ -d external/spirv-tools ]; then
echo "Updating SPIRV-Tools to revision $SPIRV_TOOLS_REV."
cd external/spirv-tools
git fetch origin
git checkout $SPIRV_TOOLS_REV
else
echo "Cloning SPIRV-Tools revision $SPIRV_TOOLS_REV."
mkdir -p external
cd external
git clone $PROTOCOL://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
cd spirv-tools
git checkout $SPIRV_TOOLS_REV
fi
if [ -d external/spirv-headers ]; then
cd external/spirv-headers
git fetch origin
git checkout $SPIRV_HEADERS_REV
cd ../..
else
git clone $PROTOCOL://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
cd external/spirv-headers
git checkout $SPIRV_HEADERS_REV
cd ../..
fi
cd ../..

9
cmake/gitversion.in.h Normal file
View file

@ -0,0 +1,9 @@
// Copyright 2016-2021 The Khronos Group Inc.
// SPDX-License-Identifier: Apache-2.0
#ifndef SPIRV_CROSS_GIT_VERSION_H_
#define SPIRV_CROSS_GIT_VERSION_H_
#define SPIRV_CROSS_GIT_REVISION "Git commit: @spirv-cross-build-version@ Timestamp: @spirv-cross-timestamp@"
#endif

10
format_all.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# Copyright 2016-2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
#for file in spirv_*.{cpp,hpp} include/spirv_cross/*.{hpp,h} samples/cpp/*.cpp main.cpp
for file in spirv_*.{cpp,hpp} main.cpp
do
echo "Formatting file: $file ..."
clang-format -style=file -i $file
done

68
gn/BUILD.gn Normal file
View file

@ -0,0 +1,68 @@
# Copyright (C) 2019 Google, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# 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.
#
config("spirv_cross_public") {
include_dirs = [ ".." ]
defines = [ "SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" ]
}
source_set("spirv_cross_sources") {
public_configs = [ ":spirv_cross_public" ]
sources = [
"../GLSL.std.450.h",
"../spirv.hpp",
"../spirv_cfg.cpp",
"../spirv_cfg.hpp",
"../spirv_common.hpp",
"../spirv_cross.cpp",
"../spirv_cross.hpp",
"../spirv_cross_containers.hpp",
"../spirv_cross_error_handling.hpp",
"../spirv_cross_parsed_ir.cpp",
"../spirv_cross_parsed_ir.hpp",
"../spirv_cross_util.cpp",
"../spirv_cross_util.hpp",
"../spirv_glsl.cpp",
"../spirv_glsl.hpp",
"../spirv_hlsl.cpp",
"../spirv_hlsl.hpp",
"../spirv_msl.cpp",
"../spirv_msl.hpp",
"../spirv_parser.cpp",
"../spirv_parser.hpp",
"../spirv_reflect.cpp",
"../spirv_reflect.hpp",
]
if (!is_win) {
cflags = [ "-fno-exceptions" ]
}
if (is_clang) {
cflags_cc = [
"-Wno-extra-semi",
"-Wno-ignored-qualifiers",
"-Wno-implicit-fallthrough",
"-Wno-inconsistent-missing-override",
"-Wno-missing-field-initializers",
"-Wno-newline-eof",
"-Wno-sign-compare",
"-Wno-unused-variable",
]
}
}

View file

@ -0,0 +1,80 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_BARRIER_HPP
#define SPIRV_CROSS_BARRIER_HPP
#include <atomic>
#include <thread>
namespace spirv_cross
{
class Barrier
{
public:
Barrier()
{
count.store(0);
iteration.store(0);
}
void set_release_divisor(unsigned divisor)
{
this->divisor = divisor;
}
static inline void memoryBarrier()
{
std::atomic_thread_fence(std::memory_order_seq_cst);
}
void reset_counter()
{
count.store(0);
iteration.store(0);
}
void wait()
{
unsigned target_iteration = iteration.load(std::memory_order_relaxed) + 1;
// Overflows cleanly.
unsigned target_count = divisor * target_iteration;
// Barriers don't enforce memory ordering.
// Be as relaxed about the barrier as we possibly can!
unsigned c = count.fetch_add(1u, std::memory_order_relaxed);
if (c + 1 == target_count)
{
iteration.store(target_iteration, std::memory_order_relaxed);
}
else
{
// If we have more threads than the CPU, don't hog the CPU for very long periods of time.
while (iteration.load(std::memory_order_relaxed) != target_iteration)
std::this_thread::yield();
}
}
private:
unsigned divisor = 1;
std::atomic<unsigned> count;
std::atomic<unsigned> iteration;
};
}
#endif

View file

@ -0,0 +1,127 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_EXTERNAL_INTERFACE_H
#define SPIRV_CROSS_EXTERNAL_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
typedef struct spirv_cross_shader spirv_cross_shader_t;
struct spirv_cross_interface
{
spirv_cross_shader_t *(*construct)(void);
void (*destruct)(spirv_cross_shader_t *thiz);
void (*invoke)(spirv_cross_shader_t *thiz);
};
void spirv_cross_set_stage_input(spirv_cross_shader_t *thiz, unsigned location, void *data, size_t size);
void spirv_cross_set_stage_output(spirv_cross_shader_t *thiz, unsigned location, void *data, size_t size);
void spirv_cross_set_push_constant(spirv_cross_shader_t *thiz, void *data, size_t size);
void spirv_cross_set_uniform_constant(spirv_cross_shader_t *thiz, unsigned location, void *data, size_t size);
void spirv_cross_set_resource(spirv_cross_shader_t *thiz, unsigned set, unsigned binding, void **data, size_t size);
const struct spirv_cross_interface *spirv_cross_get_interface(void);
typedef enum spirv_cross_builtin {
SPIRV_CROSS_BUILTIN_POSITION = 0,
SPIRV_CROSS_BUILTIN_FRAG_COORD = 1,
SPIRV_CROSS_BUILTIN_WORK_GROUP_ID = 2,
SPIRV_CROSS_BUILTIN_NUM_WORK_GROUPS = 3,
SPIRV_CROSS_NUM_BUILTINS
} spirv_cross_builtin;
void spirv_cross_set_builtin(spirv_cross_shader_t *thiz, spirv_cross_builtin builtin, void *data, size_t size);
#define SPIRV_CROSS_NUM_DESCRIPTOR_SETS 4
#define SPIRV_CROSS_NUM_DESCRIPTOR_BINDINGS 16
#define SPIRV_CROSS_NUM_STAGE_INPUTS 16
#define SPIRV_CROSS_NUM_STAGE_OUTPUTS 16
#define SPIRV_CROSS_NUM_UNIFORM_CONSTANTS 32
enum spirv_cross_format
{
SPIRV_CROSS_FORMAT_R8_UNORM = 0,
SPIRV_CROSS_FORMAT_R8G8_UNORM = 1,
SPIRV_CROSS_FORMAT_R8G8B8_UNORM = 2,
SPIRV_CROSS_FORMAT_R8G8B8A8_UNORM = 3,
SPIRV_CROSS_NUM_FORMATS
};
enum spirv_cross_wrap
{
SPIRV_CROSS_WRAP_CLAMP_TO_EDGE = 0,
SPIRV_CROSS_WRAP_REPEAT = 1,
SPIRV_CROSS_NUM_WRAP
};
enum spirv_cross_filter
{
SPIRV_CROSS_FILTER_NEAREST = 0,
SPIRV_CROSS_FILTER_LINEAR = 1,
SPIRV_CROSS_NUM_FILTER
};
enum spirv_cross_mipfilter
{
SPIRV_CROSS_MIPFILTER_BASE = 0,
SPIRV_CROSS_MIPFILTER_NEAREST = 1,
SPIRV_CROSS_MIPFILTER_LINEAR = 2,
SPIRV_CROSS_NUM_MIPFILTER
};
struct spirv_cross_miplevel
{
const void *data;
unsigned width, height;
size_t stride;
};
struct spirv_cross_sampler_info
{
const struct spirv_cross_miplevel *mipmaps;
unsigned num_mipmaps;
enum spirv_cross_format format;
enum spirv_cross_wrap wrap_s;
enum spirv_cross_wrap wrap_t;
enum spirv_cross_filter min_filter;
enum spirv_cross_filter mag_filter;
enum spirv_cross_mipfilter mip_filter;
};
typedef struct spirv_cross_sampler_2d spirv_cross_sampler_2d_t;
spirv_cross_sampler_2d_t *spirv_cross_create_sampler_2d(const struct spirv_cross_sampler_info *info);
void spirv_cross_destroy_sampler_2d(spirv_cross_sampler_2d_t *samp);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,63 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_IMAGE_HPP
#define SPIRV_CROSS_IMAGE_HPP
#ifndef GLM_SWIZZLE
#define GLM_SWIZZLE
#endif
#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#endif
#include <glm/glm.hpp>
namespace spirv_cross
{
template <typename T>
struct image2DBase
{
virtual ~image2DBase() = default;
inline virtual T load(glm::ivec2 coord) const
{
return T(0, 0, 0, 1);
}
inline virtual void store(glm::ivec2 coord, const T &v)
{
}
};
typedef image2DBase<glm::vec4> image2D;
typedef image2DBase<glm::ivec4> iimage2D;
typedef image2DBase<glm::uvec4> uimage2D;
template <typename T>
inline T imageLoad(const image2DBase<T> &image, glm::ivec2 coord)
{
return image.load(coord);
}
template <typename T>
void imageStore(image2DBase<T> &image, glm::ivec2 coord, const T &value)
{
image.store(coord, value);
}
}
#endif

View file

@ -0,0 +1,604 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_INTERNAL_INTERFACE_HPP
#define SPIRV_CROSS_INTERNAL_INTERFACE_HPP
// This file must only be included by the shader generated by spirv-cross!
#ifndef GLM_FORCE_SWIZZLE
#define GLM_FORCE_SWIZZLE
#endif
#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#endif
#include <glm/glm.hpp>
#include "barrier.hpp"
#include "external_interface.h"
#include "image.hpp"
#include "sampler.hpp"
#include "thread_group.hpp"
#include <assert.h>
#include <stdint.h>
namespace internal
{
// Adaptor helpers to adapt GLSL access chain syntax to C++.
// Don't bother with arrays of arrays on uniforms ...
// Would likely need horribly complex variadic template munging.
template <typename T>
struct Interface
{
enum
{
ArraySize = 1,
Size = sizeof(T)
};
Interface()
: ptr(0)
{
}
T &get()
{
assert(ptr);
return *ptr;
}
T *ptr;
};
// For array types, return a pointer instead.
template <typename T, unsigned U>
struct Interface<T[U]>
{
enum
{
ArraySize = U,
Size = U * sizeof(T)
};
Interface()
: ptr(0)
{
}
T *get()
{
assert(ptr);
return ptr;
}
T *ptr;
};
// For case when array size is 1, avoid double dereference.
template <typename T>
struct PointerInterface
{
enum
{
ArraySize = 1,
Size = sizeof(T *)
};
enum
{
PreDereference = true
};
PointerInterface()
: ptr(0)
{
}
T &get()
{
assert(ptr);
return *ptr;
}
T *ptr;
};
// Automatically converts a pointer down to reference to match GLSL syntax.
template <typename T>
struct DereferenceAdaptor
{
DereferenceAdaptor(T **ptr)
: ptr(ptr)
{
}
T &operator[](unsigned index) const
{
return *(ptr[index]);
}
T **ptr;
};
// We can't have a linear array of T* since T* can be an abstract type in case of samplers.
// We also need a list of pointers since we can have run-time length SSBOs.
template <typename T, unsigned U>
struct PointerInterface<T[U]>
{
enum
{
ArraySize = U,
Size = sizeof(T *) * U
};
enum
{
PreDereference = false
};
PointerInterface()
: ptr(0)
{
}
DereferenceAdaptor<T> get()
{
assert(ptr);
return DereferenceAdaptor<T>(ptr);
}
T **ptr;
};
// Resources can be more abstract and be unsized,
// so we need to have an array of pointers for those cases.
template <typename T>
struct Resource : PointerInterface<T>
{
};
// POD with no unknown sizes, so we can express these as flat arrays.
template <typename T>
struct UniformConstant : Interface<T>
{
};
template <typename T>
struct StageInput : Interface<T>
{
};
template <typename T>
struct StageOutput : Interface<T>
{
};
template <typename T>
struct PushConstant : Interface<T>
{
};
}
struct spirv_cross_shader
{
struct PPSize
{
PPSize()
: ptr(0)
, size(0)
{
}
void **ptr;
size_t size;
};
struct PPSizeResource
{
PPSizeResource()
: ptr(0)
, size(0)
, pre_dereference(false)
{
}
void **ptr;
size_t size;
bool pre_dereference;
};
PPSizeResource resources[SPIRV_CROSS_NUM_DESCRIPTOR_SETS][SPIRV_CROSS_NUM_DESCRIPTOR_BINDINGS];
PPSize stage_inputs[SPIRV_CROSS_NUM_STAGE_INPUTS];
PPSize stage_outputs[SPIRV_CROSS_NUM_STAGE_OUTPUTS];
PPSize uniform_constants[SPIRV_CROSS_NUM_UNIFORM_CONSTANTS];
PPSize push_constant;
PPSize builtins[SPIRV_CROSS_NUM_BUILTINS];
template <typename U>
void register_builtin(spirv_cross_builtin builtin, const U &value)
{
assert(!builtins[builtin].ptr);
builtins[builtin].ptr = (void **)&value.ptr;
builtins[builtin].size = sizeof(*value.ptr) * U::ArraySize;
}
void set_builtin(spirv_cross_builtin builtin, void *data, size_t size)
{
assert(builtins[builtin].ptr);
assert(size >= builtins[builtin].size);
*builtins[builtin].ptr = data;
}
template <typename U>
void register_resource(const internal::Resource<U> &value, unsigned set, unsigned binding)
{
assert(set < SPIRV_CROSS_NUM_DESCRIPTOR_SETS);
assert(binding < SPIRV_CROSS_NUM_DESCRIPTOR_BINDINGS);
assert(!resources[set][binding].ptr);
resources[set][binding].ptr = (void **)&value.ptr;
resources[set][binding].size = internal::Resource<U>::Size;
resources[set][binding].pre_dereference = internal::Resource<U>::PreDereference;
}
template <typename U>
void register_stage_input(const internal::StageInput<U> &value, unsigned location)
{
assert(location < SPIRV_CROSS_NUM_STAGE_INPUTS);
assert(!stage_inputs[location].ptr);
stage_inputs[location].ptr = (void **)&value.ptr;
stage_inputs[location].size = internal::StageInput<U>::Size;
}
template <typename U>
void register_stage_output(const internal::StageOutput<U> &value, unsigned location)
{
assert(location < SPIRV_CROSS_NUM_STAGE_OUTPUTS);
assert(!stage_outputs[location].ptr);
stage_outputs[location].ptr = (void **)&value.ptr;
stage_outputs[location].size = internal::StageOutput<U>::Size;
}
template <typename U>
void register_uniform_constant(const internal::UniformConstant<U> &value, unsigned location)
{
assert(location < SPIRV_CROSS_NUM_UNIFORM_CONSTANTS);
assert(!uniform_constants[location].ptr);
uniform_constants[location].ptr = (void **)&value.ptr;
uniform_constants[location].size = internal::UniformConstant<U>::Size;
}
template <typename U>
void register_push_constant(const internal::PushConstant<U> &value)
{
assert(!push_constant.ptr);
push_constant.ptr = (void **)&value.ptr;
push_constant.size = internal::PushConstant<U>::Size;
}
void set_stage_input(unsigned location, void *data, size_t size)
{
assert(location < SPIRV_CROSS_NUM_STAGE_INPUTS);
assert(stage_inputs[location].ptr);
assert(size >= stage_inputs[location].size);
*stage_inputs[location].ptr = data;
}
void set_stage_output(unsigned location, void *data, size_t size)
{
assert(location < SPIRV_CROSS_NUM_STAGE_OUTPUTS);
assert(stage_outputs[location].ptr);
assert(size >= stage_outputs[location].size);
*stage_outputs[location].ptr = data;
}
void set_uniform_constant(unsigned location, void *data, size_t size)
{
assert(location < SPIRV_CROSS_NUM_UNIFORM_CONSTANTS);
assert(uniform_constants[location].ptr);
assert(size >= uniform_constants[location].size);
*uniform_constants[location].ptr = data;
}
void set_push_constant(void *data, size_t size)
{
assert(push_constant.ptr);
assert(size >= push_constant.size);
*push_constant.ptr = data;
}
void set_resource(unsigned set, unsigned binding, void **data, size_t size)
{
assert(set < SPIRV_CROSS_NUM_DESCRIPTOR_SETS);
assert(binding < SPIRV_CROSS_NUM_DESCRIPTOR_BINDINGS);
assert(resources[set][binding].ptr);
assert(size >= resources[set][binding].size);
// We're using the regular PointerInterface, dereference ahead of time.
if (resources[set][binding].pre_dereference)
*resources[set][binding].ptr = *data;
else
*resources[set][binding].ptr = data;
}
};
namespace spirv_cross
{
template <typename T>
struct BaseShader : spirv_cross_shader
{
void invoke()
{
static_cast<T *>(this)->main();
}
};
struct FragmentResources
{
internal::StageOutput<glm::vec4> gl_FragCoord;
void init(spirv_cross_shader &s)
{
s.register_builtin(SPIRV_CROSS_BUILTIN_FRAG_COORD, gl_FragCoord);
}
#define gl_FragCoord __res->gl_FragCoord.get()
};
template <typename T, typename Res>
struct FragmentShader : BaseShader<FragmentShader<T, Res>>
{
inline void main()
{
impl.main();
}
FragmentShader()
{
resources.init(*this);
impl.__res = &resources;
}
T impl;
Res resources;
};
struct VertexResources
{
internal::StageOutput<glm::vec4> gl_Position;
void init(spirv_cross_shader &s)
{
s.register_builtin(SPIRV_CROSS_BUILTIN_POSITION, gl_Position);
}
#define gl_Position __res->gl_Position.get()
};
template <typename T, typename Res>
struct VertexShader : BaseShader<VertexShader<T, Res>>
{
inline void main()
{
impl.main();
}
VertexShader()
{
resources.init(*this);
impl.__res = &resources;
}
T impl;
Res resources;
};
struct TessEvaluationResources
{
inline void init(spirv_cross_shader &)
{
}
};
template <typename T, typename Res>
struct TessEvaluationShader : BaseShader<TessEvaluationShader<T, Res>>
{
inline void main()
{
impl.main();
}
TessEvaluationShader()
{
resources.init(*this);
impl.__res = &resources;
}
T impl;
Res resources;
};
struct TessControlResources
{
inline void init(spirv_cross_shader &)
{
}
};
template <typename T, typename Res>
struct TessControlShader : BaseShader<TessControlShader<T, Res>>
{
inline void main()
{
impl.main();
}
TessControlShader()
{
resources.init(*this);
impl.__res = &resources;
}
T impl;
Res resources;
};
struct GeometryResources
{
inline void init(spirv_cross_shader &)
{
}
};
template <typename T, typename Res>
struct GeometryShader : BaseShader<GeometryShader<T, Res>>
{
inline void main()
{
impl.main();
}
GeometryShader()
{
resources.init(*this);
impl.__res = &resources;
}
T impl;
Res resources;
};
struct ComputeResources
{
internal::StageInput<glm::uvec3> gl_WorkGroupID__;
internal::StageInput<glm::uvec3> gl_NumWorkGroups__;
void init(spirv_cross_shader &s)
{
s.register_builtin(SPIRV_CROSS_BUILTIN_WORK_GROUP_ID, gl_WorkGroupID__);
s.register_builtin(SPIRV_CROSS_BUILTIN_NUM_WORK_GROUPS, gl_NumWorkGroups__);
}
#define gl_WorkGroupID __res->gl_WorkGroupID__.get()
#define gl_NumWorkGroups __res->gl_NumWorkGroups__.get()
Barrier barrier__;
#define barrier() __res->barrier__.wait()
};
struct ComputePrivateResources
{
uint32_t gl_LocalInvocationIndex__;
#define gl_LocalInvocationIndex __priv_res.gl_LocalInvocationIndex__
glm::uvec3 gl_LocalInvocationID__;
#define gl_LocalInvocationID __priv_res.gl_LocalInvocationID__
glm::uvec3 gl_GlobalInvocationID__;
#define gl_GlobalInvocationID __priv_res.gl_GlobalInvocationID__
};
template <typename T, typename Res, unsigned WorkGroupX, unsigned WorkGroupY, unsigned WorkGroupZ>
struct ComputeShader : BaseShader<ComputeShader<T, Res, WorkGroupX, WorkGroupY, WorkGroupZ>>
{
inline void main()
{
resources.barrier__.reset_counter();
for (unsigned z = 0; z < WorkGroupZ; z++)
for (unsigned y = 0; y < WorkGroupY; y++)
for (unsigned x = 0; x < WorkGroupX; x++)
impl[z][y][x].__priv_res.gl_GlobalInvocationID__ =
glm::uvec3(WorkGroupX, WorkGroupY, WorkGroupZ) * resources.gl_WorkGroupID__.get() +
glm::uvec3(x, y, z);
group.run();
group.wait();
}
ComputeShader()
: group(&impl[0][0][0])
{
resources.init(*this);
resources.barrier__.set_release_divisor(WorkGroupX * WorkGroupY * WorkGroupZ);
unsigned i = 0;
for (unsigned z = 0; z < WorkGroupZ; z++)
{
for (unsigned y = 0; y < WorkGroupY; y++)
{
for (unsigned x = 0; x < WorkGroupX; x++)
{
impl[z][y][x].__priv_res.gl_LocalInvocationID__ = glm::uvec3(x, y, z);
impl[z][y][x].__priv_res.gl_LocalInvocationIndex__ = i++;
impl[z][y][x].__res = &resources;
}
}
}
}
T impl[WorkGroupZ][WorkGroupY][WorkGroupX];
ThreadGroup<T, WorkGroupX * WorkGroupY * WorkGroupZ> group;
Res resources;
};
inline void memoryBarrierShared()
{
Barrier::memoryBarrier();
}
inline void memoryBarrier()
{
Barrier::memoryBarrier();
}
// TODO: Rest of the barriers.
// Atomics
template <typename T>
inline T atomicAdd(T &v, T a)
{
static_assert(sizeof(std::atomic<T>) == sizeof(T), "Cannot cast properly to std::atomic<T>.");
// We need explicit memory barriers in GLSL to enfore any ordering.
// FIXME: Can we really cast this? There is no other way I think ...
return std::atomic_fetch_add_explicit(reinterpret_cast<std::atomic<T> *>(&v), a, std::memory_order_relaxed);
}
}
void spirv_cross_set_stage_input(spirv_cross_shader_t *shader, unsigned location, void *data, size_t size)
{
shader->set_stage_input(location, data, size);
}
void spirv_cross_set_stage_output(spirv_cross_shader_t *shader, unsigned location, void *data, size_t size)
{
shader->set_stage_output(location, data, size);
}
void spirv_cross_set_uniform_constant(spirv_cross_shader_t *shader, unsigned location, void *data, size_t size)
{
shader->set_uniform_constant(location, data, size);
}
void spirv_cross_set_resource(spirv_cross_shader_t *shader, unsigned set, unsigned binding, void **data, size_t size)
{
shader->set_resource(set, binding, data, size);
}
void spirv_cross_set_push_constant(spirv_cross_shader_t *shader, void *data, size_t size)
{
shader->set_push_constant(data, size);
}
void spirv_cross_set_builtin(spirv_cross_shader_t *shader, spirv_cross_builtin builtin, void *data, size_t size)
{
shader->set_builtin(builtin, data, size);
}
#endif

View file

@ -0,0 +1,106 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_SAMPLER_HPP
#define SPIRV_CROSS_SAMPLER_HPP
#include <vector>
namespace spirv_cross
{
struct spirv_cross_sampler_2d
{
inline virtual ~spirv_cross_sampler_2d()
{
}
};
template <typename T>
struct sampler2DBase : spirv_cross_sampler_2d
{
sampler2DBase(const spirv_cross_sampler_info *info)
{
mips.insert(mips.end(), info->mipmaps, info->mipmaps + info->num_mipmaps);
format = info->format;
wrap_s = info->wrap_s;
wrap_t = info->wrap_t;
min_filter = info->min_filter;
mag_filter = info->mag_filter;
mip_filter = info->mip_filter;
}
inline virtual T sample(glm::vec2 uv, float bias)
{
return sampleLod(uv, bias);
}
inline virtual T sampleLod(glm::vec2 uv, float lod)
{
if (mag_filter == SPIRV_CROSS_FILTER_NEAREST)
{
uv.x = wrap(uv.x, wrap_s, mips[0].width);
uv.y = wrap(uv.y, wrap_t, mips[0].height);
glm::vec2 uv_full = uv * glm::vec2(mips[0].width, mips[0].height);
int x = int(uv_full.x);
int y = int(uv_full.y);
return sample(x, y, 0);
}
else
{
return T(0, 0, 0, 1);
}
}
inline float wrap(float v, spirv_cross_wrap wrap, unsigned size)
{
switch (wrap)
{
case SPIRV_CROSS_WRAP_REPEAT:
return v - glm::floor(v);
case SPIRV_CROSS_WRAP_CLAMP_TO_EDGE:
{
float half = 0.5f / size;
return glm::clamp(v, half, 1.0f - half);
}
default:
return 0.0f;
}
}
std::vector<spirv_cross_miplevel> mips;
spirv_cross_format format;
spirv_cross_wrap wrap_s;
spirv_cross_wrap wrap_t;
spirv_cross_filter min_filter;
spirv_cross_filter mag_filter;
spirv_cross_mipfilter mip_filter;
};
typedef sampler2DBase<glm::vec4> sampler2D;
typedef sampler2DBase<glm::ivec4> isampler2D;
typedef sampler2DBase<glm::uvec4> usampler2D;
template <typename T>
inline T texture(const sampler2DBase<T> &samp, const glm::vec2 &uv, float bias = 0.0f)
{
return samp.sample(uv, bias);
}
}
#endif

View file

@ -0,0 +1,114 @@
/*
* Copyright 2015-2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#ifndef SPIRV_CROSS_THREAD_GROUP_HPP
#define SPIRV_CROSS_THREAD_GROUP_HPP
#include <condition_variable>
#include <mutex>
#include <thread>
namespace spirv_cross
{
template <typename T, unsigned Size>
class ThreadGroup
{
public:
ThreadGroup(T *impl)
{
for (unsigned i = 0; i < Size; i++)
workers[i].start(&impl[i]);
}
void run()
{
for (auto &worker : workers)
worker.run();
}
void wait()
{
for (auto &worker : workers)
worker.wait();
}
private:
struct Thread
{
enum State
{
Idle,
Running,
Dying
};
State state = Idle;
void start(T *impl)
{
worker = std::thread([impl, this] {
for (;;)
{
{
std::unique_lock<std::mutex> l{ lock };
cond.wait(l, [this] { return state != Idle; });
if (state == Dying)
break;
}
impl->main();
std::lock_guard<std::mutex> l{ lock };
state = Idle;
cond.notify_one();
}
});
}
void wait()
{
std::unique_lock<std::mutex> l{ lock };
cond.wait(l, [this] { return state == Idle; });
}
void run()
{
std::lock_guard<std::mutex> l{ lock };
state = Running;
cond.notify_one();
}
~Thread()
{
if (worker.joinable())
{
{
std::lock_guard<std::mutex> l{ lock };
state = Dying;
cond.notify_one();
}
worker.join();
}
}
std::thread worker;
std::condition_variable cond;
std::mutex lock;
};
Thread workers[Size];
};
}
#endif

1957
main.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
# Copyright 2020-2021 Hans-Kristian Arntzen
# SPDX-License-Identifier: Apache-2.0
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
sharedlibdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/spirv_cross
Name: spirv-cross-c-shared
Description: C API for SPIRV-Cross
Version: @SPIRV_CROSS_VERSION@
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lspirv-cross-c-shared
Cflags: -I${includedir}

View file

@ -0,0 +1,19 @@
RWByteAddressBuffer _4 : register(u0);
void comp_main()
{
uint _21 = _4.Load(_4.Load(0) * 4 + 4);
for (uint _23 = 0u; _23 < 64u; )
{
_4.Store(_23 * 4 + 4, 0u);
_23++;
continue;
}
_4.Store(_4.Load(0) * 4 + 4, _21);
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,22 @@
RWByteAddressBuffer u0_counter : register(u1);
RWBuffer<uint> u0 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
uint _29;
u0_counter.InterlockedAdd(0, -1, _29);
u0[asint(asfloat(_29))] = uint(int(gl_GlobalInvocationID.x)).x;
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,22 @@
RWByteAddressBuffer u0_counter : register(u1);
RWBuffer<uint> u0 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
uint _29;
u0_counter.InterlockedAdd(0, 1, _29);
u0[asint(asfloat(_29))] = uint(int(gl_GlobalInvocationID.x)).x;
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,20 @@
RWByteAddressBuffer _5 : register(u0);
RWByteAddressBuffer _6 : register(u1);
void comp_main()
{
_6.Store4(0, uint4(bool4(int(_5.Load4(16).x) < int4(_5.Load4(0)).x, int(_5.Load4(16).y) < int4(_5.Load4(0)).y, int(_5.Load4(16).z) < int4(_5.Load4(0)).z, int(_5.Load4(16).w) < int4(_5.Load4(0)).w)));
_6.Store4(0, uint4(bool4(int(_5.Load4(16).x) <= int4(_5.Load4(0)).x, int(_5.Load4(16).y) <= int4(_5.Load4(0)).y, int(_5.Load4(16).z) <= int4(_5.Load4(0)).z, int(_5.Load4(16).w) <= int4(_5.Load4(0)).w)));
_6.Store4(0, uint4(bool4(_5.Load4(16).x < uint(int4(_5.Load4(0)).x), _5.Load4(16).y < uint(int4(_5.Load4(0)).y), _5.Load4(16).z < uint(int4(_5.Load4(0)).z), _5.Load4(16).w < uint(int4(_5.Load4(0)).w))));
_6.Store4(0, uint4(bool4(_5.Load4(16).x <= uint(int4(_5.Load4(0)).x), _5.Load4(16).y <= uint(int4(_5.Load4(0)).y), _5.Load4(16).z <= uint(int4(_5.Load4(0)).z), _5.Load4(16).w <= uint(int4(_5.Load4(0)).w))));
_6.Store4(0, uint4(bool4(int(_5.Load4(16).x) > int4(_5.Load4(0)).x, int(_5.Load4(16).y) > int4(_5.Load4(0)).y, int(_5.Load4(16).z) > int4(_5.Load4(0)).z, int(_5.Load4(16).w) > int4(_5.Load4(0)).w)));
_6.Store4(0, uint4(bool4(int(_5.Load4(16).x) >= int4(_5.Load4(0)).x, int(_5.Load4(16).y) >= int4(_5.Load4(0)).y, int(_5.Load4(16).z) >= int4(_5.Load4(0)).z, int(_5.Load4(16).w) >= int4(_5.Load4(0)).w)));
_6.Store4(0, uint4(bool4(_5.Load4(16).x > uint(int4(_5.Load4(0)).x), _5.Load4(16).y > uint(int4(_5.Load4(0)).y), _5.Load4(16).z > uint(int4(_5.Load4(0)).z), _5.Load4(16).w > uint(int4(_5.Load4(0)).w))));
_6.Store4(0, uint4(bool4(_5.Load4(16).x >= uint(int4(_5.Load4(0)).x), _5.Load4(16).y >= uint(int4(_5.Load4(0)).y), _5.Load4(16).z >= uint(int4(_5.Load4(0)).z), _5.Load4(16).w >= uint(int4(_5.Load4(0)).w))));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,39 @@
struct A
{
int a;
int b;
};
RWByteAddressBuffer C1 : register(u1);
cbuffer C2 : register(b2)
{
A C2_1_Data[1024] : packoffset(c0);
};
RWByteAddressBuffer C3 : register(u0);
cbuffer B : register(b3)
{
A C4_Data[1024] : packoffset(c0);
};
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
C1.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C2_1_Data[gl_GlobalInvocationID.x].a));
C1.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C2_1_Data[gl_GlobalInvocationID.x].b));
C3.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C4_Data[gl_GlobalInvocationID.x].a));
C3.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C4_Data[gl_GlobalInvocationID.x].b));
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,41 @@
RWByteAddressBuffer bar : register(u0);
RWByteAddressBuffer foo : register(u1);
void comp_main()
{
bar.Store4(0, asuint(asfloat(foo.Load4(0))));
bar.Store4(16, asuint(asfloat(foo.Load4(16))));
bar.Store4(32, asuint(asfloat(foo.Load4(32))));
bar.Store4(48, asuint(asfloat(foo.Load4(48))));
bar.Store4(64, asuint(asfloat(foo.Load4(64))));
bar.Store4(80, asuint(asfloat(foo.Load4(80))));
bar.Store4(96, asuint(asfloat(foo.Load4(96))));
bar.Store4(112, asuint(asfloat(foo.Load4(112))));
bar.Store4(128, asuint(asfloat(foo.Load4(128))));
bar.Store4(144, asuint(asfloat(foo.Load4(144))));
bar.Store4(160, asuint(asfloat(foo.Load4(160))));
bar.Store4(176, asuint(asfloat(foo.Load4(176))));
bar.Store4(192, asuint(asfloat(foo.Load4(192))));
bar.Store4(208, asuint(asfloat(foo.Load4(208))));
bar.Store4(224, asuint(asfloat(foo.Load4(224))));
bar.Store4(240, asuint(asfloat(foo.Load4(240))));
[loop]
for (int _137 = 0; _137 < 16; )
{
bar.Store4((15 - _137) * 16 + 0, asuint(asfloat(foo.Load4(_137 * 16 + 0))));
_137++;
continue;
}
[branch]
if (asfloat(bar.Load(160)) > 10.0f)
{
foo.Store4(320, asuint(5.0f.xxxx));
}
foo.Store4(320, asuint(20.0f.xxxx));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,9 @@
void comp_main()
{
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,87 @@
RWByteAddressBuffer _4 : register(u0);
void comp_main()
{
_4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : min(asfloat(_4.Load(48)), asfloat(_4.Load(96))))));
bool2 _146 = isnan(asfloat(_4.Load2(56)));
bool2 _147 = isnan(asfloat(_4.Load2(104)));
float2 _148 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)));
float2 _149 = float2(_146.x ? asfloat(_4.Load2(104)).x : _148.x, _146.y ? asfloat(_4.Load2(104)).y : _148.y);
_4.Store2(8, asuint(float2(_147.x ? asfloat(_4.Load2(56)).x : _149.x, _147.y ? asfloat(_4.Load2(56)).y : _149.y)));
bool3 _151 = isnan(asfloat(_4.Load3(64)));
bool3 _152 = isnan(asfloat(_4.Load3(112)));
float3 _153 = min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112)));
float3 _154 = float3(_151.x ? asfloat(_4.Load3(112)).x : _153.x, _151.y ? asfloat(_4.Load3(112)).y : _153.y, _151.z ? asfloat(_4.Load3(112)).z : _153.z);
_4.Store3(16, asuint(float3(_152.x ? asfloat(_4.Load3(64)).x : _154.x, _152.y ? asfloat(_4.Load3(64)).y : _154.y, _152.z ? asfloat(_4.Load3(64)).z : _154.z)));
bool4 _156 = isnan(asfloat(_4.Load4(80)));
bool4 _157 = isnan(asfloat(_4.Load4(128)));
float4 _158 = min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128)));
float4 _159 = float4(_156.x ? asfloat(_4.Load4(128)).x : _158.x, _156.y ? asfloat(_4.Load4(128)).y : _158.y, _156.z ? asfloat(_4.Load4(128)).z : _158.z, _156.w ? asfloat(_4.Load4(128)).w : _158.w);
_4.Store4(32, asuint(float4(_157.x ? asfloat(_4.Load4(80)).x : _159.x, _157.y ? asfloat(_4.Load4(80)).y : _159.y, _157.z ? asfloat(_4.Load4(80)).z : _159.z, _157.w ? asfloat(_4.Load4(80)).w : _159.w)));
_4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : max(asfloat(_4.Load(48)), asfloat(_4.Load(96))))));
bool2 _166 = isnan(asfloat(_4.Load2(56)));
bool2 _167 = isnan(asfloat(_4.Load2(104)));
float2 _168 = max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)));
float2 _169 = float2(_166.x ? asfloat(_4.Load2(104)).x : _168.x, _166.y ? asfloat(_4.Load2(104)).y : _168.y);
_4.Store2(8, asuint(float2(_167.x ? asfloat(_4.Load2(56)).x : _169.x, _167.y ? asfloat(_4.Load2(56)).y : _169.y)));
bool3 _171 = isnan(asfloat(_4.Load3(64)));
bool3 _172 = isnan(asfloat(_4.Load3(112)));
float3 _173 = max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112)));
float3 _174 = float3(_171.x ? asfloat(_4.Load3(112)).x : _173.x, _171.y ? asfloat(_4.Load3(112)).y : _173.y, _171.z ? asfloat(_4.Load3(112)).z : _173.z);
_4.Store3(16, asuint(float3(_172.x ? asfloat(_4.Load3(64)).x : _174.x, _172.y ? asfloat(_4.Load3(64)).y : _174.y, _172.z ? asfloat(_4.Load3(64)).z : _174.z)));
bool4 _176 = isnan(asfloat(_4.Load4(80)));
bool4 _177 = isnan(asfloat(_4.Load4(128)));
float4 _178 = max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128)));
float4 _179 = float4(_176.x ? asfloat(_4.Load4(128)).x : _178.x, _176.y ? asfloat(_4.Load4(128)).y : _178.y, _176.z ? asfloat(_4.Load4(128)).z : _178.z, _176.w ? asfloat(_4.Load4(128)).w : _178.w);
_4.Store4(32, asuint(float4(_177.x ? asfloat(_4.Load4(80)).x : _179.x, _177.y ? asfloat(_4.Load4(80)).y : _179.y, _177.z ? asfloat(_4.Load4(80)).z : _179.z, _177.w ? asfloat(_4.Load4(80)).w : _179.w)));
float _180 = isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(48)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(48))));
_4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? _180 : (isnan(_180) ? asfloat(_4.Load(96)) : min(_180, asfloat(_4.Load(96))))));
bool2 _193 = isnan(asfloat(_4.Load2(8)));
bool2 _194 = isnan(asfloat(_4.Load2(56)));
float2 _195 = max(asfloat(_4.Load2(8)), asfloat(_4.Load2(56)));
float2 _196 = float2(_193.x ? asfloat(_4.Load2(56)).x : _195.x, _193.y ? asfloat(_4.Load2(56)).y : _195.y);
float2 _191 = float2(_194.x ? asfloat(_4.Load2(8)).x : _196.x, _194.y ? asfloat(_4.Load2(8)).y : _196.y);
bool2 _198 = isnan(_191);
bool2 _199 = isnan(asfloat(_4.Load2(104)));
float2 _200 = min(_191, asfloat(_4.Load2(104)));
float2 _201 = float2(_198.x ? asfloat(_4.Load2(104)).x : _200.x, _198.y ? asfloat(_4.Load2(104)).y : _200.y);
_4.Store2(8, asuint(float2(_199.x ? _191.x : _201.x, _199.y ? _191.y : _201.y)));
bool3 _204 = isnan(asfloat(_4.Load3(16)));
bool3 _205 = isnan(asfloat(_4.Load3(64)));
float3 _206 = max(asfloat(_4.Load3(16)), asfloat(_4.Load3(64)));
float3 _207 = float3(_204.x ? asfloat(_4.Load3(64)).x : _206.x, _204.y ? asfloat(_4.Load3(64)).y : _206.y, _204.z ? asfloat(_4.Load3(64)).z : _206.z);
float3 _202 = float3(_205.x ? asfloat(_4.Load3(16)).x : _207.x, _205.y ? asfloat(_4.Load3(16)).y : _207.y, _205.z ? asfloat(_4.Load3(16)).z : _207.z);
bool3 _209 = isnan(_202);
bool3 _210 = isnan(asfloat(_4.Load3(112)));
float3 _211 = min(_202, asfloat(_4.Load3(112)));
float3 _212 = float3(_209.x ? asfloat(_4.Load3(112)).x : _211.x, _209.y ? asfloat(_4.Load3(112)).y : _211.y, _209.z ? asfloat(_4.Load3(112)).z : _211.z);
_4.Store3(16, asuint(float3(_210.x ? _202.x : _212.x, _210.y ? _202.y : _212.y, _210.z ? _202.z : _212.z)));
bool4 _215 = isnan(asfloat(_4.Load4(32)));
bool4 _216 = isnan(asfloat(_4.Load4(80)));
float4 _217 = max(asfloat(_4.Load4(32)), asfloat(_4.Load4(80)));
float4 _218 = float4(_215.x ? asfloat(_4.Load4(80)).x : _217.x, _215.y ? asfloat(_4.Load4(80)).y : _217.y, _215.z ? asfloat(_4.Load4(80)).z : _217.z, _215.w ? asfloat(_4.Load4(80)).w : _217.w);
float4 _213 = float4(_216.x ? asfloat(_4.Load4(32)).x : _218.x, _216.y ? asfloat(_4.Load4(32)).y : _218.y, _216.z ? asfloat(_4.Load4(32)).z : _218.z, _216.w ? asfloat(_4.Load4(32)).w : _218.w);
bool4 _220 = isnan(_213);
bool4 _221 = isnan(asfloat(_4.Load4(128)));
float4 _222 = min(_213, asfloat(_4.Load4(128)));
float4 _223 = float4(_220.x ? asfloat(_4.Load4(128)).x : _222.x, _220.y ? asfloat(_4.Load4(128)).y : _222.y, _220.z ? asfloat(_4.Load4(128)).z : _222.z, _220.w ? asfloat(_4.Load4(128)).w : _222.w);
_4.Store4(32, asuint(float4(_221.x ? _213.x : _223.x, _221.y ? _213.y : _223.y, _221.z ? _213.z : _223.z, _221.w ? _213.w : _223.w)));
for (int _139 = 0; _139 < 2; )
{
bool2 _225 = isnan(asfloat(_4.Load2(56)));
bool2 _226 = isnan(asfloat(_4.Load2(104)));
float2 _227 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)));
float2 _228 = float2(_225.x ? asfloat(_4.Load2(104)).x : _227.x, _225.y ? asfloat(_4.Load2(104)).y : _227.y);
_4.Store2(8, asuint(float2(_226.x ? asfloat(_4.Load2(56)).x : _228.x, _226.y ? asfloat(_4.Load2(56)).y : _228.y)));
float _229 = isnan(asfloat(_4.Load(56))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(56)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(56))));
_4.Store(0, asuint(isnan(asfloat(_4.Load(60))) ? _229 : (isnan(_229) ? asfloat(_4.Load(60)) : min(_229, asfloat(_4.Load(60))))));
_139++;
continue;
}
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,30 @@
RWByteAddressBuffer _4 : register(u0);
void comp_main()
{
_4.Store(0, asuint(min(asfloat(_4.Load(48)), asfloat(_4.Load(96)))));
_4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)))));
_4.Store3(16, asuint(min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112)))));
_4.Store4(32, asuint(min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128)))));
_4.Store(0, asuint(max(asfloat(_4.Load(48)), asfloat(_4.Load(96)))));
_4.Store2(8, asuint(max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)))));
_4.Store3(16, asuint(max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112)))));
_4.Store4(32, asuint(max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128)))));
_4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(48)), asfloat(_4.Load(96)))));
_4.Store2(8, asuint(clamp(asfloat(_4.Load2(8)), asfloat(_4.Load2(56)), asfloat(_4.Load2(104)))));
_4.Store3(16, asuint(clamp(asfloat(_4.Load3(16)), asfloat(_4.Load3(64)), asfloat(_4.Load3(112)))));
_4.Store4(32, asuint(clamp(asfloat(_4.Load4(32)), asfloat(_4.Load4(80)), asfloat(_4.Load4(128)))));
for (int _139 = 0; _139 < 2; )
{
_4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104)))));
_4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(56)), asfloat(_4.Load(60)))));
_139++;
continue;
}
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,26 @@
cbuffer _4_5 : register(b0)
{
column_major float2x4 _5_m0 : packoffset(c0);
float4 _5_m1 : packoffset(c4);
};
static float2 _3;
struct SPIRV_Cross_Output
{
float2 _3 : SV_Target0;
};
void frag_main()
{
_3 = mul(_5_m0, _5_m1);
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output._3 = _3;
return stage_output;
}

View file

@ -0,0 +1,30 @@
Texture2D<float4> uTex : register(t1);
SamplerState uSampler : register(s0);
static float4 FragColor;
static float2 vUV;
struct SPIRV_Cross_Input
{
float2 vUV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uTex.Sample(uSampler, vUV);
FragColor += uTex.Sample(uSampler, vUV, int2(1, 1));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vUV = stage_input.vUV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,8 @@
void frag_main()
{
}
void main()
{
frag_main();
}

View file

@ -0,0 +1,29 @@
static float4 FragColor;
static float4 vA;
static float4 vB;
struct SPIRV_Cross_Input
{
float4 vA : TEXCOORD0;
float4 vB : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = fmod(vA, vB);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vA = stage_input.vA;
vB = stage_input.vB;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,19 @@
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = 10.0f.xxxx;
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,31 @@
Texture2D<float4> uTexture : register(t0);
SamplerState _uTexture_sampler : register(s0);
static int2 Size;
struct SPIRV_Cross_Output
{
int2 Size : SV_Target0;
};
uint2 spvTextureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
void frag_main()
{
uint _19_dummy_parameter;
uint _20_dummy_parameter;
Size = int2(spvTextureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(spvTextureSize(uTexture, uint(1), _20_dummy_parameter));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.Size = Size;
return stage_output;
}

View file

@ -0,0 +1,57 @@
Texture2D<float4> uImage : register(t0);
SamplerState _uImage_sampler : register(s0);
static float4 v0;
static float4 FragColor;
struct SPIRV_Cross_Input
{
float4 v0 : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
float phi;
float4 _36;
int _51;
_51 = 0;
phi = 1.0f;
_36 = float4(1.0f, 2.0f, 1.0f, 2.0f);
for (;;)
{
FragColor = _36;
if (_51 < 4)
{
if (v0[_51] > 0.0f)
{
float2 _48 = phi.xx;
_51++;
phi += 2.0f;
_36 = uImage.SampleLevel(_uImage_sampler, _48, 0.0f);
continue;
}
else
{
break;
}
}
else
{
break;
}
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v0 = stage_input.v0;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,19 @@
static float3 FragColor;
struct SPIRV_Cross_Output
{
float3 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = float3(asfloat(0x7f800000u /* inf */), asfloat(0xff800000u /* -inf */), asfloat(0x7fc00000u /* nan */));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,91 @@
static float FragColor;
static float vColor;
struct SPIRV_Cross_Input
{
float vColor : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
#line 8 "test.frag"
void frag_main()
{
#line 8 "test.frag"
FragColor = 1.0f;
#line 9 "test.frag"
FragColor = 2.0f;
#line 10 "test.frag"
if (vColor < 0.0f)
{
#line 12 "test.frag"
FragColor = 3.0f;
}
else
{
#line 16 "test.frag"
FragColor = 4.0f;
}
#line 19 "test.frag"
for (int _127 = 0; float(_127) < (40.0f + vColor); )
{
#line 21 "test.frag"
FragColor += 0.20000000298023223876953125f;
#line 22 "test.frag"
FragColor += 0.300000011920928955078125f;
#line 19 "test.frag"
_127 += (int(vColor) + 5);
continue;
}
#line 25 "test.frag"
switch (int(vColor))
{
case 0:
{
#line 28 "test.frag"
FragColor += 0.20000000298023223876953125f;
#line 29 "test.frag"
break;
}
case 1:
{
#line 32 "test.frag"
FragColor += 0.4000000059604644775390625f;
#line 33 "test.frag"
break;
}
default:
{
#line 36 "test.frag"
FragColor += 0.800000011920928955078125f;
#line 37 "test.frag"
break;
}
}
for (;;)
{
#line 42 "test.frag"
FragColor += (10.0f + vColor);
#line 43 "test.frag"
if (FragColor < 100.0f)
{
}
else
{
break;
}
}
#line 48 "test.frag"
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vColor = stage_input.vColor;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,57 @@
static const float _46[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f };
static const float4 _76[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx };
static const float4 _90[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx };
static float FragColor;
static int index;
struct SPIRV_Cross_Input
{
nointerpolation int index : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
float4 foobar[4] = _76;
float4 baz[4] = _76;
FragColor = _46[index];
if (index < 10)
{
FragColor += _46[index ^ 1];
}
else
{
FragColor += _46[index & 1];
}
bool _99 = index > 30;
if (_99)
{
FragColor += _76[index & 3].y;
}
else
{
FragColor += _76[index & 1].x;
}
if (_99)
{
foobar[1].z = 20.0f;
}
int _37 = index & 3;
FragColor += foobar[_37].z;
baz = _90;
FragColor += baz[_37].z;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
index = stage_input.index;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,19 @@
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = float4(18.0f, 52.0f, 1.0f, 1.0f);
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,25 @@
cbuffer Registers
{
float registers_foo : packoffset(c0);
};
static float FragColor;
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
FragColor = 10.0f + registers_foo;
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,30 @@
Texture2D<float4> g_Texture : register(t0);
SamplerState g_Sampler : register(s0);
SamplerComparisonState g_CompareSampler : register(s1);
static float2 in_var_TEXCOORD0;
static float out_var_SV_Target;
struct SPIRV_Cross_Input
{
float2 in_var_TEXCOORD0 : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float out_var_SV_Target : SV_Target0;
};
void frag_main()
{
out_var_SV_Target = g_Texture.Sample(g_Sampler, in_var_TEXCOORD0).x + g_Texture.SampleCmpLevelZero(g_CompareSampler, in_var_TEXCOORD0, 0.5f);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.out_var_SV_Target = out_var_SV_Target;
return stage_output;
}

View file

@ -0,0 +1,63 @@
struct myType
{
float data;
};
static const myType _18 = { 0.0f };
static const myType _20 = { 1.0f };
static const myType _21[5] = { { 0.0f }, { 1.0f }, { 0.0f }, { 1.0f }, { 0.0f } };
static float4 gl_FragCoord;
static float4 o_color;
struct SPIRV_Cross_Input
{
float4 gl_FragCoord : SV_Position;
};
struct SPIRV_Cross_Output
{
float4 o_color : SV_Target0;
};
float mod(float x, float y)
{
return x - y * floor(x / y);
}
float2 mod(float2 x, float2 y)
{
return x - y * floor(x / y);
}
float3 mod(float3 x, float3 y)
{
return x - y * floor(x / y);
}
float4 mod(float4 x, float4 y)
{
return x - y * floor(x / y);
}
void frag_main()
{
if (_21[int(mod(gl_FragCoord.x, 4.0f))].data > 0.0f)
{
o_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
else
{
o_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_FragCoord = stage_input.gl_FragCoord;
gl_FragCoord.w = 1.0 / gl_FragCoord.w;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.o_color = o_color;
return stage_output;
}

View file

@ -0,0 +1,29 @@
static float4 FragColor;
static int4 vA;
static int4 vB;
struct SPIRV_Cross_Input
{
nointerpolation int4 vA : TEXCOORD0;
nointerpolation int4 vB : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = float4(vA - vB * (vA / vB));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vA = stage_input.vA;
vB = stage_input.vB;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,23 @@
static const float4 _20[2] = { float4(1.0f, 2.0f, 3.0f, 4.0f), 10.0f.xxxx };
static float4 FragColors[2] = _20;
static float4 FragColor = 5.0f.xxxx;
struct SPIRV_Cross_Output
{
float4 FragColors[2] : SV_Target0;
float4 FragColor : SV_Target2;
};
void frag_main()
{
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColors = FragColors;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,30 @@
Texture2D<float4> uTexture : register(t0);
SamplerState _uTexture_sampler : register(s0);
static float4 gl_FragCoord;
static float4 FragColor;
struct SPIRV_Cross_Input
{
float4 gl_FragCoord : SV_Position;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_FragCoord = stage_input.gl_FragCoord;
gl_FragCoord.w = 1.0 / gl_FragCoord.w;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,29 @@
Texture2D<float4> uTexture : register(t0);
SamplerState _uTexture_sampler : register(s0);
static min16float4 FragColor;
static min16float2 UV;
struct SPIRV_Cross_Input
{
min16float2 UV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
min16float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = min16float4(uTexture.Sample(_uTexture_sampler, UV));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
UV = stage_input.UV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,31 @@
Texture2D<float4> uShadow : register(t0);
SamplerComparisonState _uShadow_sampler : register(s0);
Texture2D<float4> uTexture : register(t1);
SamplerComparisonState uSampler : register(s2);
static float3 vUV;
static float FragColor;
struct SPIRV_Cross_Input
{
float3 vUV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uShadow.SampleCmp(_uShadow_sampler, vUV.xy, vUV.z) + uTexture.SampleCmp(uSampler, vUV.xy, vUV.z);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vUV = stage_input.vUV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,40 @@
static int counter;
static float4 FragColor;
struct SPIRV_Cross_Input
{
nointerpolation int counter : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
float4 _33;
for (;;)
{
if (counter == 10)
{
_33 = 10.0f.xxxx;
break;
}
else
{
_33 = 30.0f.xxxx;
break;
}
}
FragColor = _33;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
counter = stage_input.counter;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,45 @@
struct InstanceData
{
column_major float4x4 MATRIX_MVP;
float4 Color;
};
cbuffer gInstanceData : register(b0)
{
InstanceData gInstanceData_1_data[32] : packoffset(c0);
};
static float4 gl_Position;
static int gl_InstanceIndex;
static float3 PosL;
static float4 _entryPointOutput_Color;
struct SPIRV_Cross_Input
{
float3 PosL : TEXCOORD0;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
{
float4 _entryPointOutput_Color : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(float4(PosL, 1.0f), gInstanceData_1_data[uint(gl_InstanceIndex)].MATRIX_MVP);
_entryPointOutput_Color = gInstanceData_1_data[uint(gl_InstanceIndex)].Color;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
PosL = stage_input.PosL;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output._entryPointOutput_Color = _entryPointOutput_Color;
return stage_output;
}

View file

@ -0,0 +1,42 @@
#ifndef SPIRV_CROSS_CONSTANT_ID_201
#define SPIRV_CROSS_CONSTANT_ID_201 -10
#endif
static const int _7 = SPIRV_CROSS_CONSTANT_ID_201;
static const int _20 = (_7 + 2);
#ifndef SPIRV_CROSS_CONSTANT_ID_202
#define SPIRV_CROSS_CONSTANT_ID_202 100u
#endif
static const uint _8 = SPIRV_CROSS_CONSTANT_ID_202;
static const uint _25 = (_8 % 5u);
static const int4 _30 = int4(20, 30, _20, _20);
static const int2 _32 = int2(_30.y, _30.x);
static const int _33 = _30.y;
static float4 gl_Position;
static int _4;
struct SPIRV_Cross_Output
{
nointerpolation int _4 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
float4 _63 = 0.0f.xxxx;
_63.y = float(_20);
_63.z = float(_25);
float4 _52 = _63 + float4(_30);
float2 _56 = _52.xy + float2(_32);
gl_Position = float4(_56.x, _56.y, _52.z, _52.w);
_4 = _33;
}
SPIRV_Cross_Output main()
{
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output._4 = _4;
return stage_output;
}

View file

@ -0,0 +1,28 @@
static float4 gl_Position;
static int gl_VertexIndex;
static int gl_InstanceIndex;
struct SPIRV_Cross_Input
{
uint gl_VertexIndex : SV_VertexID;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = float(uint(gl_VertexIndex) + uint(gl_InstanceIndex)).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexIndex = int(stage_input.gl_VertexIndex);
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View file

@ -0,0 +1,28 @@
static float4 gl_Position;
static int gl_VertexIndex;
static int gl_InstanceIndex;
struct SPIRV_Cross_Input
{
uint gl_VertexIndex : SV_VertexID;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexIndex = int(stage_input.gl_VertexIndex);
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View file

@ -0,0 +1,108 @@
struct Baz
{
float c;
};
struct Bar
{
float d[2][4];
Baz baz[2];
};
struct Foo
{
column_major float2x2 a;
float2 b;
Bar c[5];
};
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _31 : register(u0);
void comp_main()
{
Foo _36;
_36.a = asfloat(uint2x2(_31.Load(0), _31.Load(8), _31.Load(4), _31.Load(12)));
_36.b = asfloat(_31.Load2(16));
[unroll]
for (int _4ident = 0; _4ident < 5; _4ident++)
{
[unroll]
for (int _5ident = 0; _5ident < 2; _5ident++)
{
[unroll]
for (int _6ident = 0; _6ident < 4; _6ident++)
{
_36.c[_4ident].d[_5ident][_6ident] = asfloat(_31.Load(_6ident * 4 + _5ident * 16 + _4ident * 40 + 24));
}
}
[unroll]
for (int _7ident = 0; _7ident < 2; _7ident++)
{
_36.c[_4ident].baz[_7ident].c = asfloat(_31.Load(_7ident * 4 + _4ident * 40 + 56));
}
}
float2x2 _234 = float2x2(_36.a[0] + 1.0f.xx, _36.a[1] + 1.0f.xx);
_31.Store(224, asuint(_234[0].x));
_31.Store(228, asuint(_234[1].x));
_31.Store(232, asuint(_234[0].y));
_31.Store(236, asuint(_234[1].y));
_31.Store2(240, asuint(_36.b + 2.0f.xx));
_31.Store(248, asuint(_36.c[0].d[0][0]));
_31.Store(252, asuint(_36.c[0].d[0][1]));
_31.Store(256, asuint(_36.c[0].d[0][2]));
_31.Store(260, asuint(_36.c[0].d[0][3]));
_31.Store(264, asuint(_36.c[0].d[1][0]));
_31.Store(268, asuint(_36.c[0].d[1][1]));
_31.Store(272, asuint(_36.c[0].d[1][2]));
_31.Store(276, asuint(_36.c[0].d[1][3]));
_31.Store(280, asuint(_36.c[0].baz[0].c));
_31.Store(284, asuint(_36.c[0].baz[1].c));
_31.Store(288, asuint(_36.c[1].d[0][0]));
_31.Store(292, asuint(_36.c[1].d[0][1]));
_31.Store(296, asuint(_36.c[1].d[0][2]));
_31.Store(300, asuint(_36.c[1].d[0][3]));
_31.Store(304, asuint(_36.c[1].d[1][0]));
_31.Store(308, asuint(_36.c[1].d[1][1]));
_31.Store(312, asuint(_36.c[1].d[1][2]));
_31.Store(316, asuint(_36.c[1].d[1][3]));
_31.Store(320, asuint(_36.c[1].baz[0].c));
_31.Store(324, asuint(_36.c[1].baz[1].c));
_31.Store(328, asuint(_36.c[2].d[0][0]));
_31.Store(332, asuint(_36.c[2].d[0][1]));
_31.Store(336, asuint(_36.c[2].d[0][2]));
_31.Store(340, asuint(_36.c[2].d[0][3]));
_31.Store(344, asuint(_36.c[2].d[1][0]));
_31.Store(348, asuint(_36.c[2].d[1][1]));
_31.Store(352, asuint(_36.c[2].d[1][2]));
_31.Store(356, asuint(_36.c[2].d[1][3]));
_31.Store(360, asuint(_36.c[2].baz[0].c));
_31.Store(364, asuint(_36.c[2].baz[1].c));
_31.Store(368, asuint(_36.c[3].d[0][0]));
_31.Store(372, asuint(_36.c[3].d[0][1]));
_31.Store(376, asuint(_36.c[3].d[0][2]));
_31.Store(380, asuint(_36.c[3].d[0][3]));
_31.Store(384, asuint(_36.c[3].d[1][0]));
_31.Store(388, asuint(_36.c[3].d[1][1] + 5.0f));
_31.Store(392, asuint(_36.c[3].d[1][2]));
_31.Store(396, asuint(_36.c[3].d[1][3]));
_31.Store(400, asuint(_36.c[3].baz[0].c));
_31.Store(404, asuint(_36.c[3].baz[1].c));
_31.Store(408, asuint(_36.c[4].d[0][0]));
_31.Store(412, asuint(_36.c[4].d[0][1]));
_31.Store(416, asuint(_36.c[4].d[0][2]));
_31.Store(420, asuint(_36.c[4].d[0][3]));
_31.Store(424, asuint(_36.c[4].d[1][0]));
_31.Store(428, asuint(_36.c[4].d[1][1]));
_31.Store(432, asuint(_36.c[4].d[1][2]));
_31.Store(436, asuint(_36.c[4].d[1][3]));
_31.Store(440, asuint(_36.c[4].baz[0].c));
_31.Store(444, asuint(_36.c[4].baz[1].c));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,23 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer wo : register(u1);
ByteAddressBuffer ro : register(t0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160))));
wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480))));
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,23 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer wo : register(u1);
RWByteAddressBuffer ro : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160))));
wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480))));
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,17 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer WriteOnly : register(u2);
ByteAddressBuffer ReadOnly : register(t0);
RWByteAddressBuffer ReadWrite : register(u1);
void comp_main()
{
WriteOnly.Store4(0, asuint(asfloat(ReadOnly.Load4(0))));
ReadWrite.Store4(0, asuint(asfloat(ReadWrite.Load4(0)) + 10.0f.xxxx));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,91 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer ssbo : register(u2);
RWTexture2D<uint> uImage : register(u0);
RWTexture2D<int> iImage : register(u1);
groupshared int int_atomic;
groupshared uint uint_atomic;
groupshared int int_atomic_array[1];
groupshared uint uint_atomic_array[1];
void comp_main()
{
uint _19;
InterlockedAdd(uImage[int2(1, 5)], 1u, _19);
uint _27;
InterlockedAdd(uImage[int2(1, 5)], 1u, _27);
iImage[int2(1, 6)] = int(_27).x;
uint _32;
InterlockedOr(uImage[int2(1, 5)], 1u, _32);
uint _34;
InterlockedXor(uImage[int2(1, 5)], 1u, _34);
uint _36;
InterlockedAnd(uImage[int2(1, 5)], 1u, _36);
uint _38;
InterlockedMin(uImage[int2(1, 5)], 1u, _38);
uint _40;
InterlockedMax(uImage[int2(1, 5)], 1u, _40);
uint _44;
InterlockedCompareExchange(uImage[int2(1, 5)], 10u, 2u, _44);
int _47;
InterlockedAdd(iImage[int2(1, 6)], 1, _47);
int _49;
InterlockedOr(iImage[int2(1, 6)], 1, _49);
int _51;
InterlockedXor(iImage[int2(1, 6)], 1, _51);
int _53;
InterlockedAnd(iImage[int2(1, 6)], 1, _53);
int _55;
InterlockedMin(iImage[int2(1, 6)], 1, _55);
int _57;
InterlockedMax(iImage[int2(1, 6)], 1, _57);
int _61;
InterlockedCompareExchange(iImage[int2(1, 5)], 10, 2, _61);
uint _68;
ssbo.InterlockedAdd(0, 1u, _68);
uint _70;
ssbo.InterlockedOr(0, 1u, _70);
uint _72;
ssbo.InterlockedXor(0, 1u, _72);
uint _74;
ssbo.InterlockedAnd(0, 1u, _74);
uint _76;
ssbo.InterlockedMin(0, 1u, _76);
uint _78;
ssbo.InterlockedMax(0, 1u, _78);
uint _80;
ssbo.InterlockedExchange(0, 1u, _80);
uint _82;
ssbo.InterlockedCompareExchange(0, 10u, 2u, _82);
int _85;
ssbo.InterlockedAdd(4, 1, _85);
int _87;
ssbo.InterlockedOr(4, 1, _87);
int _89;
ssbo.InterlockedXor(4, 1, _89);
int _91;
ssbo.InterlockedAnd(4, 1, _91);
int _93;
ssbo.InterlockedMin(4, 1, _93);
int _95;
ssbo.InterlockedMax(4, 1, _95);
int _97;
ssbo.InterlockedExchange(4, 1, _97);
int _99;
ssbo.InterlockedCompareExchange(4, 10, 2, _99);
int _102;
InterlockedAdd(int_atomic, 10, _102);
uint _105;
InterlockedAdd(uint_atomic, 10u, _105);
int _110;
InterlockedAdd(int_atomic_array[0], 10, _110);
uint _115;
InterlockedAdd(uint_atomic_array[0], 10u, _115);
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,26 @@
static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
void comp_main()
{
GroupMemoryBarrier();
AllMemoryBarrier();
DeviceMemoryBarrier();
DeviceMemoryBarrier();
AllMemoryBarrier();
GroupMemoryBarrierWithGroupSync();
AllMemoryBarrier();
GroupMemoryBarrierWithGroupSync();
DeviceMemoryBarrier();
GroupMemoryBarrierWithGroupSync();
DeviceMemoryBarrier();
GroupMemoryBarrierWithGroupSync();
AllMemoryBarrier();
GroupMemoryBarrierWithGroupSync();
GroupMemoryBarrierWithGroupSync();
}
[numthreads(4, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,11 @@
static const uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u);
void comp_main()
{
}
[numthreads(8, 4, 2)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,50 @@
struct Data
{
float a;
float b;
};
#ifndef SPIRV_CROSS_CONSTANT_ID_0
#define SPIRV_CROSS_CONSTANT_ID_0 4.0f
#endif
static const float X = SPIRV_CROSS_CONSTANT_ID_0;
static const uint3 gl_WorkGroupSize = uint3(2u, 1u, 1u);
static const Data _21 = { 1.0f, 2.0f };
static const Data _24 = { 3.0f, 4.0f };
static const Data _25[2] = { { 1.0f, 2.0f }, { 3.0f, 4.0f } };
static const Data _30 = { 3.0f, 5.0f };
RWByteAddressBuffer _61 : register(u0);
static uint3 gl_WorkGroupID;
static uint3 gl_LocalInvocationID;
static uint gl_LocalInvocationIndex;
struct SPIRV_Cross_Input
{
uint3 gl_WorkGroupID : SV_GroupID;
uint3 gl_LocalInvocationID : SV_GroupThreadID;
uint gl_LocalInvocationIndex : SV_GroupIndex;
};
void comp_main()
{
Data _28 = { X, 2.0f };
Data _31[2] = { _28, _30 };
Data data2[2] = _31;
if (gl_LocalInvocationIndex == 0u)
{
_61.Store(gl_WorkGroupID.x * 8 + 0, asuint(_25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a));
_61.Store(gl_WorkGroupID.x * 8 + 4, asuint(_25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b));
}
}
[numthreads(2, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_WorkGroupID = stage_input.gl_WorkGroupID;
gl_LocalInvocationID = stage_input.gl_LocalInvocationID;
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex;
comp_main();
}

View file

@ -0,0 +1,18 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
globallycoherent RWByteAddressBuffer _29 : register(u3);
ByteAddressBuffer _33 : register(t2);
RWTexture2D<float> uImageIn : register(u0);
globallycoherent RWTexture2D<float> uImageOut : register(u1);
void comp_main()
{
uImageOut[int2(9, 7)] = uImageIn[int2(9, 7)].x;
_29.Store(0, asuint(asfloat(_33.Load(0))));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,66 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWTexture2D<float> uImageInF : register(u0);
RWTexture2D<float> uImageOutF : register(u1);
RWTexture2D<int> uImageInI : register(u2);
RWTexture2D<int> uImageOutI : register(u3);
RWTexture2D<uint> uImageInU : register(u4);
RWTexture2D<uint> uImageOutU : register(u5);
RWBuffer<float> uImageInBuffer : register(u6);
RWBuffer<float> uImageOutBuffer : register(u7);
RWTexture2D<float2> uImageInF2 : register(u8);
RWTexture2D<float2> uImageOutF2 : register(u9);
RWTexture2D<int2> uImageInI2 : register(u10);
RWTexture2D<int2> uImageOutI2 : register(u11);
RWTexture2D<uint2> uImageInU2 : register(u12);
RWTexture2D<uint2> uImageOutU2 : register(u13);
RWBuffer<float2> uImageInBuffer2 : register(u14);
RWBuffer<float2> uImageOutBuffer2 : register(u15);
RWTexture2D<float4> uImageInF4 : register(u16);
RWTexture2D<float4> uImageOutF4 : register(u17);
RWTexture2D<int4> uImageInI4 : register(u18);
RWTexture2D<int4> uImageOutI4 : register(u19);
RWTexture2D<uint4> uImageInU4 : register(u20);
RWTexture2D<uint4> uImageOutU4 : register(u21);
RWBuffer<float4> uImageInBuffer4 : register(u22);
RWBuffer<float4> uImageOutBuffer4 : register(u23);
RWTexture2D<float4> uImageNoFmtF : register(u24);
RWTexture2D<uint4> uImageNoFmtU : register(u25);
RWTexture2D<int4> uImageNoFmtI : register(u26);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
int2 _23 = int2(gl_GlobalInvocationID.xy);
uImageOutF[_23] = uImageInF[_23].x;
uImageOutI[_23] = uImageInI[_23].x;
uImageOutU[_23] = uImageInU[_23].x;
int _74 = int(gl_GlobalInvocationID.x);
uImageOutBuffer[_74] = uImageInBuffer[_74].x;
uImageOutF2[_23] = uImageInF2[_23].xy;
uImageOutI2[_23] = uImageInI2[_23].xy;
uImageOutU2[_23] = uImageInU2[_23].xy;
float4 _135 = uImageInBuffer2[_74].xyyy;
uImageOutBuffer2[_74] = _135.xy;
uImageOutF4[_23] = uImageInF4[_23];
int4 _165 = uImageInI4[_23];
uImageOutI4[_23] = _165;
uint4 _180 = uImageInU4[_23];
uImageOutU4[_23] = _180;
uImageOutBuffer4[_74] = uImageInBuffer4[_74];
uImageNoFmtF[_23] = _135;
uImageNoFmtU[_23] = _180;
uImageNoFmtI[_23] = _165;
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,66 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
Texture2D<float4> uImageInF : register(t0);
RWTexture2D<float> uImageOutF : register(u1);
Texture2D<int4> uImageInI : register(t2);
RWTexture2D<int> uImageOutI : register(u3);
Texture2D<uint4> uImageInU : register(t4);
RWTexture2D<uint> uImageOutU : register(u5);
Buffer<float4> uImageInBuffer : register(t6);
RWBuffer<float> uImageOutBuffer : register(u7);
Texture2D<float4> uImageInF2 : register(t8);
RWTexture2D<float2> uImageOutF2 : register(u9);
Texture2D<int4> uImageInI2 : register(t10);
RWTexture2D<int2> uImageOutI2 : register(u11);
Texture2D<uint4> uImageInU2 : register(t12);
RWTexture2D<uint2> uImageOutU2 : register(u13);
Buffer<float4> uImageInBuffer2 : register(t14);
RWBuffer<float2> uImageOutBuffer2 : register(u15);
Texture2D<float4> uImageInF4 : register(t16);
RWTexture2D<float4> uImageOutF4 : register(u17);
Texture2D<int4> uImageInI4 : register(t18);
RWTexture2D<int4> uImageOutI4 : register(u19);
Texture2D<uint4> uImageInU4 : register(t20);
RWTexture2D<uint4> uImageOutU4 : register(u21);
Buffer<float4> uImageInBuffer4 : register(t22);
RWBuffer<float4> uImageOutBuffer4 : register(u23);
RWTexture2D<float4> uImageNoFmtF : register(u24);
RWTexture2D<uint4> uImageNoFmtU : register(u25);
RWTexture2D<int4> uImageNoFmtI : register(u26);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
int2 _23 = int2(gl_GlobalInvocationID.xy);
uImageOutF[_23] = uImageInF[_23].x;
uImageOutI[_23] = uImageInI[_23].x;
uImageOutU[_23] = uImageInU[_23].x;
int _74 = int(gl_GlobalInvocationID.x);
uImageOutBuffer[_74] = uImageInBuffer[_74].x;
uImageOutF2[_23] = uImageInF2[_23].xy;
uImageOutI2[_23] = uImageInI2[_23].xy;
uImageOutU2[_23] = uImageInU2[_23].xy;
float4 _135 = uImageInBuffer2[_74];
uImageOutBuffer2[_74] = _135.xy;
uImageOutF4[_23] = uImageInF4[_23];
int4 _165 = uImageInI4[_23];
uImageOutI4[_23] = _165;
uint4 _180 = uImageInU4[_23];
uImageOutU4[_23] = _180;
uImageOutBuffer4[_74] = uImageInBuffer4[_74];
uImageNoFmtF[_23] = _135;
uImageNoFmtU[_23] = _180;
uImageNoFmtI[_23] = _165;
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,124 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _15 : register(u0);
ByteAddressBuffer _20 : register(t1);
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float2x2 spvInverse(float2x2 m)
{
float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
adj[0][0] = m[1][1];
adj[0][1] = -m[0][1];
adj[1][0] = -m[1][0];
adj[1][1] = m[0][0];
// Calculate the determinant as a combination of the cofactors of the first row.
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]);
// Divide the classical adjoint matrix by the determinant.
// If determinant is zero, matrix is not invertable, so leave it unchanged.
return (det != 0.0f) ? (adj * (1.0f / det)) : m;
}
// Returns the determinant of a 2x2 matrix.
float spvDet2x2(float a1, float a2, float b1, float b2)
{
return a1 * b2 - b1 * a2;
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float3x3 spvInverse(float3x3 m)
{
float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]);
adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]);
adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]);
// Calculate the determinant as a combination of the cofactors of the first row.
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);
// Divide the classical adjoint matrix by the determinant.
// If determinant is zero, matrix is not invertable, so leave it unchanged.
return (det != 0.0f) ? (adj * (1.0f / det)) : m;
}
// Returns the determinant of a 3x3 matrix.
float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
{
return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
float4x4 spvInverse(float4x4 m)
{
float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]);
adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]);
adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]);
adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]);
adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]);
adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]);
adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]);
adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]);
// Calculate the determinant as a combination of the cofactors of the first row.
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]);
// Divide the classical adjoint matrix by the determinant.
// If determinant is zero, matrix is not invertable, so leave it unchanged.
return (det != 0.0f) ? (adj * (1.0f / det)) : m;
}
void comp_main()
{
float2x2 _23 = asfloat(uint2x2(_20.Load2(0), _20.Load2(8)));
float2x2 _24 = spvInverse(_23);
_15.Store2(0, asuint(_24[0]));
_15.Store2(8, asuint(_24[1]));
float3x3 _29 = asfloat(uint3x3(_20.Load3(16), _20.Load3(32), _20.Load3(48)));
float3x3 _30 = spvInverse(_29);
_15.Store3(16, asuint(_30[0]));
_15.Store3(32, asuint(_30[1]));
_15.Store3(48, asuint(_30[2]));
float4x4 _35 = asfloat(uint4x4(_20.Load4(64), _20.Load4(80), _20.Load4(96), _20.Load4(112)));
float4x4 _36 = spvInverse(_35);
_15.Store4(64, asuint(_36[0]));
_15.Store4(80, asuint(_36[1]));
_15.Store4(96, asuint(_36[2]));
_15.Store4(112, asuint(_36[3]));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,19 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _10 : register(u0);
cbuffer SPIRV_Cross_NumWorkgroups
{
uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0);
};
void comp_main()
{
_10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count);
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,26 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _10 : register(u0);
cbuffer SPIRV_Cross_NumWorkgroups
{
uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0);
};
static uint3 gl_WorkGroupID;
struct SPIRV_Cross_Input
{
uint3 gl_WorkGroupID : SV_GroupID;
};
void comp_main()
{
_10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count + gl_WorkGroupID);
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_WorkGroupID = stage_input.gl_WorkGroupID;
comp_main();
}

View file

@ -0,0 +1,50 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _21 : register(u0);
ByteAddressBuffer _26 : register(t1);
void comp_main()
{
float2x2 _32 = float2x2(asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).y);
_21.Store2(0, asuint(_32[0]));
_21.Store2(8, asuint(_32[1]));
float2x3 _41 = float2x3(asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).y);
_21.Store3(16, asuint(_41[0]));
_21.Store3(32, asuint(_41[1]));
float2x4 _50 = float2x4(asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).y);
_21.Store4(48, asuint(_50[0]));
_21.Store4(64, asuint(_50[1]));
float3x2 _58 = float3x2(asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).z);
_21.Store2(80, asuint(_58[0]));
_21.Store2(88, asuint(_58[1]));
_21.Store2(96, asuint(_58[2]));
float3x3 _66 = float3x3(asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).z);
_21.Store3(112, asuint(_66[0]));
_21.Store3(128, asuint(_66[1]));
_21.Store3(144, asuint(_66[2]));
float3x4 _74 = float3x4(asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).z);
_21.Store4(160, asuint(_74[0]));
_21.Store4(176, asuint(_74[1]));
_21.Store4(192, asuint(_74[2]));
float4x2 _82 = float4x2(asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).w);
_21.Store2(208, asuint(_82[0]));
_21.Store2(216, asuint(_82[1]));
_21.Store2(224, asuint(_82[2]));
_21.Store2(232, asuint(_82[3]));
float4x3 _90 = float4x3(asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).w);
_21.Store3(240, asuint(_90[0]));
_21.Store3(256, asuint(_90[1]));
_21.Store3(272, asuint(_90[2]));
_21.Store3(288, asuint(_90[3]));
float4x4 _98 = float4x4(asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).w);
_21.Store4(304, asuint(_98[0]));
_21.Store4(320, asuint(_98[1]));
_21.Store4(336, asuint(_98[2]));
_21.Store4(352, asuint(_98[3]));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,242 @@
static float3x4 _362;
static float4x3 _364;
RWByteAddressBuffer _17 : register(u0);
uniform RaytracingAccelerationStructure rtas : register(t1);
static RayQuery<RAY_FLAG_NONE> rayQuery;
void comp_main()
{
RayDesc _1ident = {0.0f.xxx, 0.0f, float3(1.0f, 0.0f, 0.0f), 9999.0f};
rayQuery.TraceRayInline(rtas, 0u, 255u, _1ident);
float3x4 _361;
float4x3 _363;
_363 = _364;
_361 = _362;
float3x4 _387;
float4x3 _398;
for (;;)
{
bool _67 = rayQuery.Proceed();
if (_67)
{
uint _71 = rayQuery.CandidateType();
switch (_71)
{
case 0u:
{
rayQuery.Abort();
float4x3 _79 = rayQuery.CandidateObjectToWorld4x3();
rayQuery.CommitNonOpaqueTriangleHit();
bool _87 = rayQuery.CommittedTriangleFrontFace();
if (_87)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float2 _92 = rayQuery.CommittedTriangleBarycentrics();
if (_92.x == 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _98 = rayQuery.CommittedInstanceID();
if (_98 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _103 = rayQuery.CommittedInstanceIndex();
if (_103 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float3 _108 = rayQuery.CommittedObjectRayDirection();
if (_108.x > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float3 _114 = rayQuery.CommittedObjectRayOrigin();
if (_114.x > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _120 = rayQuery.CommittedPrimitiveIndex();
if (_120 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float _125 = rayQuery.CommittedRayT();
if (_125 > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
uint _130 = rayQuery.CommittedInstanceContributionToHitGroupIndex();
if (_130 > 0u)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
_398 = _79;
_387 = transpose(_79);
break;
}
case 1u:
{
float4x3 _136 = rayQuery.CandidateObjectToWorld4x3();
bool _139 = rayQuery.CandidateProceduralPrimitiveNonOpaque();
if (_139)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
rayQuery.CommitProceduralPrimitiveHit(144);
rayQuery.Abort();
_398 = _136;
_387 = transpose(_136);
break;
}
default:
{
_398 = _363;
_387 = _361;
break;
}
}
_363 = _398;
_361 = _387;
continue;
}
else
{
break;
}
}
if (_361[0].x == _363[0].x)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
uint _157 = rayQuery.CommittedStatus();
float3x4 _365;
float4x3 _376;
switch (_157)
{
case 0u:
{
float4x3 _163 = rayQuery.CandidateWorldToObject4x3();
_376 = _163;
_365 = transpose(_163);
break;
}
case 1u:
{
float4x3 _167 = rayQuery.CommittedWorldToObject4x3();
bool _170 = rayQuery.CommittedTriangleFrontFace();
if (_170)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float2 _174 = rayQuery.CommittedTriangleBarycentrics();
if (_174.y == 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
_376 = _167;
_365 = transpose(_167);
break;
}
case 2u:
{
int _182 = rayQuery.CommittedGeometryIndex();
if (_182 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _187 = rayQuery.CommittedInstanceIndex();
if (_187 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _192 = rayQuery.CommittedInstanceID();
if (_192 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float3 _197 = rayQuery.CommittedObjectRayDirection();
if (_197.z > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float3 _204 = rayQuery.CommittedObjectRayOrigin();
if (_204.x > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
int _210 = rayQuery.CommittedPrimitiveIndex();
if (_210 > 0)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float _215 = rayQuery.CommittedRayT();
if (_215 > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
_376 = _363;
_365 = _361;
break;
}
default:
{
_376 = _363;
_365 = _361;
break;
}
}
if (_365[0].x == _376[0].x)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
uint _230 = rayQuery.RayFlags();
if (_230 > 256u)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float _236 = rayQuery.RayTMin();
if (_236 > 0.0f)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
float3 _242 = rayQuery.WorldRayOrigin();
float3 _244 = rayQuery.WorldRayDirection();
if (_242.x == _244.z)
{
_17.Store(0, 0u);
_17.Store(4, 0u);
}
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,22 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _11 : register(u0);
void comp_main()
{
_11.Store(0, asuint(asfloat(_11.Load(0)) * asfloat(_11.Load(96))));
_11.Store4(16, asuint(asfloat(_11.Load4(16)) * asfloat(_11.Load4(112))));
float4x4 _35 = asfloat(uint4x4(_11.Load4(128), _11.Load4(144), _11.Load4(160), _11.Load4(176)));
float4x4 _37 = asfloat(uint4x4(_11.Load4(32), _11.Load4(48), _11.Load4(64), _11.Load4(80)));
float4x4 _38 = mul(_35, _37);
_11.Store4(32, asuint(_38[0]));
_11.Store4(48, asuint(_38[1]));
_11.Store4(64, asuint(_38[2]));
_11.Store4(80, asuint(_38[3]));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,93 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _28 : register(u0);
cbuffer UBO : register(b1)
{
int _68_index0 : packoffset(c0);
int _68_index1 : packoffset(c0.y);
};
void comp_main()
{
float4x4 _258 = asfloat(uint4x4(_28.Load(64), _28.Load(80), _28.Load(96), _28.Load(112), _28.Load(68), _28.Load(84), _28.Load(100), _28.Load(116), _28.Load(72), _28.Load(88), _28.Load(104), _28.Load(120), _28.Load(76), _28.Load(92), _28.Load(108), _28.Load(124)));
_28.Store4(0, asuint(_258[0]));
_28.Store4(16, asuint(_258[1]));
_28.Store4(32, asuint(_258[2]));
_28.Store4(48, asuint(_258[3]));
float2x2 _261 = asfloat(uint2x2(_28.Load(144), _28.Load(152), _28.Load(148), _28.Load(156)));
_28.Store2(128, asuint(_261[0]));
_28.Store2(136, asuint(_261[1]));
float2x3 _264 = asfloat(uint2x3(_28.Load(192), _28.Load(200), _28.Load(208), _28.Load(196), _28.Load(204), _28.Load(212)));
_28.Store3(160, asuint(_264[0]));
_28.Store3(176, asuint(_264[1]));
float3x2 _267 = asfloat(uint3x2(_28.Load(240), _28.Load(256), _28.Load(244), _28.Load(260), _28.Load(248), _28.Load(264)));
_28.Store2(216, asuint(_267[0]));
_28.Store2(224, asuint(_267[1]));
_28.Store2(232, asuint(_267[2]));
float4x4 _271 = asfloat(uint4x4(_28.Load4(0), _28.Load4(16), _28.Load4(32), _28.Load4(48)));
_28.Store(64, asuint(_271[0].x));
_28.Store(68, asuint(_271[1].x));
_28.Store(72, asuint(_271[2].x));
_28.Store(76, asuint(_271[3].x));
_28.Store(80, asuint(_271[0].y));
_28.Store(84, asuint(_271[1].y));
_28.Store(88, asuint(_271[2].y));
_28.Store(92, asuint(_271[3].y));
_28.Store(96, asuint(_271[0].z));
_28.Store(100, asuint(_271[1].z));
_28.Store(104, asuint(_271[2].z));
_28.Store(108, asuint(_271[3].z));
_28.Store(112, asuint(_271[0].w));
_28.Store(116, asuint(_271[1].w));
_28.Store(120, asuint(_271[2].w));
_28.Store(124, asuint(_271[3].w));
float2x2 _274 = asfloat(uint2x2(_28.Load2(128), _28.Load2(136)));
_28.Store(144, asuint(_274[0].x));
_28.Store(148, asuint(_274[1].x));
_28.Store(152, asuint(_274[0].y));
_28.Store(156, asuint(_274[1].y));
float2x3 _277 = asfloat(uint2x3(_28.Load3(160), _28.Load3(176)));
_28.Store(192, asuint(_277[0].x));
_28.Store(196, asuint(_277[1].x));
_28.Store(200, asuint(_277[0].y));
_28.Store(204, asuint(_277[1].y));
_28.Store(208, asuint(_277[0].z));
_28.Store(212, asuint(_277[1].z));
float3x2 _280 = asfloat(uint3x2(_28.Load2(216), _28.Load2(224), _28.Load2(232)));
_28.Store(240, asuint(_280[0].x));
_28.Store(244, asuint(_280[1].x));
_28.Store(248, asuint(_280[2].x));
_28.Store(256, asuint(_280[0].y));
_28.Store(260, asuint(_280[1].y));
_28.Store(264, asuint(_280[2].y));
_28.Store(_68_index0 * 4 + _68_index1 * 16 + 64, asuint(1.0f));
_28.Store(_68_index0 * 4 + _68_index1 * 8 + 144, asuint(2.0f));
_28.Store(_68_index0 * 4 + _68_index1 * 8 + 192, asuint(3.0f));
_28.Store(_68_index0 * 4 + _68_index1 * 16 + 240, asuint(4.0f));
_28.Store(_68_index0 * 4 + 64, asuint(1.0f.x));
_28.Store(_68_index0 * 4 + 80, asuint(1.0f.xxxx.y));
_28.Store(_68_index0 * 4 + 96, asuint(1.0f.xxxx.z));
_28.Store(_68_index0 * 4 + 112, asuint(1.0f.xxxx.w));
_28.Store(_68_index0 * 4 + 144, asuint(2.0f.x));
_28.Store(_68_index0 * 4 + 152, asuint(2.0f.xx.y));
_28.Store(_68_index0 * 4 + 192, asuint(3.0f.x));
_28.Store(_68_index0 * 4 + 200, asuint(3.0f.xxx.y));
_28.Store(_68_index0 * 4 + 208, asuint(3.0f.xxx.z));
_28.Store(_68_index0 * 4 + 240, asuint(4.0f.x));
_28.Store(_68_index0 * 4 + 256, asuint(4.0f.xx.y));
_28.Store(_68_index0 * 16 + _68_index1 * 4 + 0, asuint(1.0f));
_28.Store(_68_index0 * 8 + _68_index1 * 4 + 128, asuint(2.0f));
_28.Store(_68_index0 * 16 + _68_index1 * 4 + 160, asuint(3.0f));
_28.Store(_68_index0 * 8 + _68_index1 * 4 + 216, asuint(4.0f));
_28.Store4(_68_index0 * 16 + 0, asuint(1.0f.xxxx));
_28.Store2(_68_index0 * 8 + 128, asuint(2.0f.xx));
_28.Store3(_68_index0 * 16 + 160, asuint(3.0f.xxx));
_28.Store2(_68_index0 * 8 + 216, asuint(4.0f.xx));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,16 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _9 : register(u0);
void comp_main()
{
_9.Store(8, asuint(distance(asfloat(_9.Load(0)), asfloat(_9.Load(4)))));
_9.Store(12, asuint(length(asfloat(_9.Load(0)))));
_9.Store(16, asuint(sign(asfloat(_9.Load(0)))));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,29 @@
static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
ByteAddressBuffer _22 : register(t0);
RWByteAddressBuffer _44 : register(u1);
static uint3 gl_GlobalInvocationID;
static uint gl_LocalInvocationIndex;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
uint gl_LocalInvocationIndex : SV_GroupIndex;
};
groupshared float sShared[4];
void comp_main()
{
sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0));
GroupMemoryBarrierWithGroupSync();
_44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[3u - gl_LocalInvocationIndex]));
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex;
comp_main();
}

View file

@ -0,0 +1,51 @@
#ifndef SPIRV_CROSS_CONSTANT_ID_0
#define SPIRV_CROSS_CONSTANT_ID_0 100
#endif
static const int a = SPIRV_CROSS_CONSTANT_ID_0;
#ifndef SPIRV_CROSS_CONSTANT_ID_1
#define SPIRV_CROSS_CONSTANT_ID_1 200
#endif
static const int b = SPIRV_CROSS_CONSTANT_ID_1;
struct A
{
int member0[a];
int member1[b];
};
struct B
{
int member0[b];
int member1[a];
};
#ifndef SPIRV_CROSS_CONSTANT_ID_2
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
static const int c = SPIRV_CROSS_CONSTANT_ID_2;
static const int d = (c + 50);
#ifndef SPIRV_CROSS_CONSTANT_ID_3
#define SPIRV_CROSS_CONSTANT_ID_3 400
#endif
static const int e = SPIRV_CROSS_CONSTANT_ID_3;
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _22 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
_22.Store(gl_GlobalInvocationID.x * 4 + 2800, uint(int(_22.Load(gl_GlobalInvocationID.x * 4 + 2800)) + (int(_22.Load(gl_GlobalInvocationID.x * 4 + 2400)) + e)));
}
[numthreads(1, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,43 @@
#ifndef SPIRV_CROSS_CONSTANT_ID_1
#define SPIRV_CROSS_CONSTANT_ID_1 2
#endif
static const int b = SPIRV_CROSS_CONSTANT_ID_1;
#ifndef SPIRV_CROSS_CONSTANT_ID_0
#define SPIRV_CROSS_CONSTANT_ID_0 1
#endif
static const int a = SPIRV_CROSS_CONSTANT_ID_0;
static const uint _26 = (uint(a) + 0u);
#ifndef SPIRV_CROSS_CONSTANT_ID_10
#define SPIRV_CROSS_CONSTANT_ID_10 1u
#endif
static const uint _27 = SPIRV_CROSS_CONSTANT_ID_10;
static const uint3 gl_WorkGroupSize = uint3(_27, 20u, 1u);
static const uint _32 = gl_WorkGroupSize.x;
static const uint _33 = (_26 + _32);
static const uint _34 = gl_WorkGroupSize.y;
static const uint _35 = (_33 + _34);
static const int _42 = (1 - a);
RWByteAddressBuffer _23 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
int spec_const_array_size[b];
spec_const_array_size[0] = 10;
spec_const_array_size[1] = 40;
spec_const_array_size[a] = a;
_23.Store((_35 + gl_GlobalInvocationID.x) * 4 + 0, uint(b + spec_const_array_size[_42]));
}
[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View file

@ -0,0 +1,17 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _11 : register(u1);
void comp_main()
{
uint _14;
_11.GetDimensions(_14);
_14 = (_14 - 16) / 16;
_11.Store(0, uint(int(_14)));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,11 @@
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
void comp_main()
{
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View file

@ -0,0 +1,28 @@
uniform float4 UBO[56];
static float4 gl_Position;
static float4 aVertex;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = (mul(aVertex, float4x4(UBO[40], UBO[41], UBO[42], UBO[43])) + UBO[55]) + ((UBO[50] + UBO[45]) + UBO[54].x.xxxx);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View file

@ -0,0 +1,35 @@
uniform float4 UBO[4];
static float4 gl_Position;
static float4 aVertex;
static float3 vNormal;
static float3 aNormal;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
float3 aNormal : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float3 vNormal : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3]));
vNormal = aNormal;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
aNormal = stage_input.aNormal;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vNormal = vNormal;
return stage_output;
}

View file

@ -0,0 +1,50 @@
struct Light
{
float3 Position;
float Radius;
float4 Color;
};
uniform float4 UBO[12];
static float4 gl_Position;
static float4 aVertex;
static float4 vColor;
static float3 aNormal;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
float3 aNormal : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 vColor : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3]));
vColor = 0.0f.xxxx;
for (int _96 = 0; _96 < 4; )
{
Light _51 = {UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]};
float3 _68 = aVertex.xyz - _51.Position;
vColor += ((UBO[_96 * 2 + 5] * clamp(1.0f - (length(_68) / _51.Radius), 0.0f, 1.0f)) * dot(aNormal, normalize(_68)));
_96++;
continue;
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
aNormal = stage_input.aNormal;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vColor = vColor;
return stage_output;
}

View file

@ -0,0 +1,49 @@
struct Light
{
float3 Position;
float Radius;
float4 Color;
};
uniform float4 UBO[12];
static float4 gl_Position;
static float4 aVertex;
static float4 vColor;
static float3 aNormal;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
float3 aNormal : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 vColor : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3]));
vColor = 0.0f.xxxx;
for (int _82 = 0; _82 < 4; )
{
float3 _54 = aVertex.xyz - UBO[_82 * 2 + 4].xyz;
vColor += ((UBO[_82 * 2 + 5] * clamp(1.0f - (length(_54) / UBO[_82 * 2 + 4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(_54)));
_82++;
continue;
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
aNormal = stage_input.aNormal;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vColor = vColor;
return stage_output;
}

View file

@ -0,0 +1,29 @@
uniform float4 UBO[4];
static float3 FragColor;
static float3 vNormal;
struct SPIRV_Cross_Input
{
nointerpolation float3 vNormal : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float3 FragColor : SV_Target0;
};
void frag_main()
{
float4x4 _19 = float4x4(UBO[0], UBO[1], UBO[2], UBO[3]);
FragColor = mul(vNormal, float3x3(_19[0].xyz, _19[1].xyz, _19[2].xyz));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vNormal = stage_input.vNormal;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,41 @@
uniform float4 UBO[14];
static float4 gl_Position;
static float4 oA;
static float4 oB;
static float4 oC;
static float4 oD;
static float4 oE;
struct SPIRV_Cross_Output
{
float4 oA : TEXCOORD0;
float4 oB : TEXCOORD1;
float4 oC : TEXCOORD2;
float4 oD : TEXCOORD3;
float4 oE : TEXCOORD4;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = 0.0f.xxxx;
oA = UBO[1];
oB = float4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y);
oC = UBO[9];
oD = float4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x);
oE = float4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y);
}
SPIRV_Cross_Output main()
{
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.oA = oA;
stage_output.oB = oB;
stage_output.oC = oC;
stage_output.oD = oD;
stage_output.oE = oE;
return stage_output;
}

View file

@ -0,0 +1,28 @@
uniform float4 UBO[15];
static float4 gl_Position;
static int2 aIndex;
struct SPIRV_Cross_Input
{
int2 aIndex : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0];
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aIndex = stage_input.aIndex;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View file

@ -0,0 +1,35 @@
uniform float4 PushMe[6];
static float4 gl_Position;
static float4 Pos;
static float2 vRot;
static float2 Rot;
struct SPIRV_Cross_Input
{
float2 Rot : TEXCOORD0;
float4 Pos : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float2 vRot : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(Pos, float4x4(PushMe[0], PushMe[1], PushMe[2], PushMe[3]));
vRot = mul(Rot, float2x2(PushMe[4].xy, PushMe[4].zw)) + PushMe[5].z.xx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
Pos = stage_input.Pos;
Rot = stage_input.Rot;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vRot = vRot;
return stage_output;
}

View file

@ -0,0 +1,28 @@
uniform float4 UBO[12];
static float4 gl_Position;
static float4 aVertex;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])) + mul(aVertex, transpose(float4x4(UBO[4], UBO[5], UBO[6], UBO[7])));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View file

@ -0,0 +1,44 @@
struct Light
{
float3 Position;
float Radius;
float4 Color;
};
uniform float4 UBO[6];
static float4 gl_Position;
static float4 aVertex;
static float4 vColor;
static float3 aNormal;
struct SPIRV_Cross_Input
{
float4 aVertex : TEXCOORD0;
float3 aNormal : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 vColor : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3]));
vColor = 0.0f.xxxx;
float3 _39 = aVertex.xyz - UBO[4].xyz;
vColor += ((UBO[5] * clamp(1.0f - (length(_39) / UBO[4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(_39)));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
aVertex = stage_input.aVertex;
aNormal = stage_input.aNormal;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.vColor = vColor;
return stage_output;
}

View file

@ -0,0 +1,43 @@
struct Foo
{
column_major float3x4 MVP0;
column_major float3x4 MVP1;
};
uniform float4 UBO[8];
static float4 v0;
static float4 v1;
static float3 V0;
static float3 V1;
struct SPIRV_Cross_Input
{
float4 v0 : TEXCOORD0;
float4 v1 : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float3 V0 : TEXCOORD0;
float3 V1 : TEXCOORD1;
};
void vert_main()
{
Foo _19 = {transpose(float4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(float4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))};
Foo _20 = _19;
V0 = mul(_20.MVP0, v0);
V1 = mul(_20.MVP1, v1);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v0 = stage_input.v0;
v1 = stage_input.v1;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.V0 = V0;
stage_output.V1 = V1;
return stage_output;
}

View file

@ -0,0 +1,45 @@
uniform float4 UBO[8];
static float4 gl_Position;
static float4 oA;
static float4 oB;
static float4 oC;
static float4 oD;
static float4 oE;
static float4 oF;
struct SPIRV_Cross_Output
{
float4 oA : TEXCOORD0;
float4 oB : TEXCOORD1;
float4 oC : TEXCOORD2;
float4 oD : TEXCOORD3;
float4 oE : TEXCOORD4;
float4 oF : TEXCOORD5;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = 0.0f.xxxx;
oA = UBO[0];
oB = float4(UBO[1].xy, UBO[1].zw);
oC = float4(UBO[2].x, UBO[3].xyz);
oD = float4(UBO[4].xyz, UBO[4].w);
oE = float4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w);
oF = float4(UBO[6].x, UBO[6].zw, UBO[7].x);
}
SPIRV_Cross_Output main()
{
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.oA = oA;
stage_output.oB = oB;
stage_output.oC = oC;
stage_output.oD = oD;
stage_output.oE = oE;
stage_output.oF = oF;
return stage_output;
}

View file

@ -0,0 +1,23 @@
uniform int4 UBO1[2];
uniform uint4 UBO2[2];
uniform float4 UBO0[2];
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = ((((float4(UBO1[0]) + float4(UBO1[1])) + float4(UBO2[0])) + float4(UBO2[1])) + UBO0[0]) + UBO0[1];
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,27 @@
static const float _17[5] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f };
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
for (int _46 = 0; _46 < 4; )
{
int _33 = _46 + 1;
FragColor += _17[_33].xxxx;
_46 = _33;
continue;
}
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View file

@ -0,0 +1,26 @@
static float3 FragColor;
static float4 vColor;
struct SPIRV_Cross_Input
{
float4 vColor : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : COLOR0;
};
void frag_main()
{
FragColor = vColor.xyz;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vColor = stage_input.vColor;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = float4(FragColor, 0.0);
return stage_output;
}

Some files were not shown because too many files have changed in this diff Show more