mirror of https://github.com/bkaradzic/bgfx
Updated spirv-cross.
This commit is contained in:
parent
2d6c2cebeb
commit
b9b37e06de
|
@ -23,11 +23,21 @@ 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.")
|
||||
|
||||
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")
|
||||
|
@ -91,128 +101,220 @@ macro(extract_headers out_abs file_list)
|
|||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(spirv_cross_add_library name config_name)
|
||||
add_library(${name} ${ARGN})
|
||||
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:include/spirv_cross>)
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include/spirv_cross>)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
PUBLIC_HEADERS "${hdrs}")
|
||||
PUBLIC_HEADERS "${hdrs}")
|
||||
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()
|
||||
install(TARGETS ${name}
|
||||
EXPORT ${config_name}Config
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include/spirv_cross)
|
||||
EXPORT ${config_name}Config
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include/spirv_cross)
|
||||
install(FILES ${hdrs} DESTINATION include/spirv_cross)
|
||||
install(EXPORT ${config_name}Config DESTINATION share/${config_name}/cmake)
|
||||
export(TARGETS ${name} FILE ${config_name}Config.cmake)
|
||||
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.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)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_common.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)
|
||||
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)
|
||||
${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)
|
||||
${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)
|
||||
${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)
|
||||
${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)
|
||||
${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)
|
||||
${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})
|
||||
${spirv-cross-core-sources})
|
||||
|
||||
spirv_cross_add_library(spirv-cross-c spirv_cross_c STATIC
|
||||
${spirv-cross-c-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()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-glsl spirv_cross_glsl STATIC
|
||||
${spirv-cross-glsl-sources})
|
||||
if (SPIRV_CROSS_ENABLE_CPP)
|
||||
spirv_cross_add_library(spirv-cross-cpp spirv_cross_cpp STATIC
|
||||
${spirv-cross-cpp-sources})
|
||||
|
||||
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()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-reflect spirv_cross_reflect STATIC
|
||||
${spirv-cross-reflect-sources})
|
||||
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()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-msl spirv_cross_msl STATIC
|
||||
${spirv-cross-msl-sources})
|
||||
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()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-hlsl spirv_cross_hlsl STATIC
|
||||
${spirv-cross-hlsl-sources})
|
||||
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()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-util spirv_cross_util STATIC
|
||||
${spirv-cross-util-sources})
|
||||
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()
|
||||
|
||||
target_link_libraries(spirv-cross-util PRIVATE spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-glsl PRIVATE spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-msl PRIVATE spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-hlsl PRIVATE spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-cpp PRIVATE spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-c PRIVATE
|
||||
spirv-cross-core
|
||||
spirv-cross-glsl
|
||||
spirv-cross-hlsl
|
||||
spirv-cross-msl
|
||||
spirv-cross-cpp
|
||||
spirv-cross-reflect)
|
||||
if (SPIRV_CROSS_ENABLE_C_API)
|
||||
spirv_cross_add_library(spirv-cross-c spirv_cross_c STATIC
|
||||
${spirv-cross-c-sources})
|
||||
|
||||
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()
|
||||
|
||||
if (SPIRV_CROSS_SHARED)
|
||||
set(spirv-cross-abi-major 0)
|
||||
set(spirv-cross-abi-minor 3)
|
||||
set(spirv-cross-abi-minor 5)
|
||||
set(spirv-cross-abi-patch 0)
|
||||
set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch})
|
||||
set(SPIRV_CROSS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
set(SPIRV_CROSS_INSTALL_INC_DIR ${CMAKE_INSTALL_PREFIX}/include/spirv_cross)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pkg-config/spirv-cross-c-shared.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc @ONLY)
|
||||
${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_PREFIX}/share/pkgconfig)
|
||||
|
||||
spirv_cross_add_library(spirv-cross-c-shared spirv_cross_c_shared SHARED
|
||||
${spirv-cross-core-sources}
|
||||
${spirv-cross-glsl-sources}
|
||||
${spirv-cross-cpp-sources}
|
||||
${spirv-cross-reflect-sources}
|
||||
${spirv-cross-msl-sources}
|
||||
${spirv-cross-hlsl-sources}
|
||||
${spirv-cross-c-sources})
|
||||
${spirv-cross-core-sources}
|
||||
${spirv-cross-c-sources})
|
||||
|
||||
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)
|
||||
|
@ -224,11 +326,35 @@ if (SPIRV_CROSS_SHARED)
|
|||
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})
|
||||
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()
|
||||
|
@ -238,13 +364,13 @@ if (SPIRV_CROSS_CLI)
|
|||
set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
|
||||
install(TARGETS spirv-cross RUNTIME DESTINATION bin)
|
||||
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)
|
||||
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
|
||||
|
@ -254,17 +380,17 @@ if (SPIRV_CROSS_CLI)
|
|||
# - 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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
|
@ -279,10 +405,10 @@ if (SPIRV_CROSS_CLI)
|
|||
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}")
|
||||
--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)
|
||||
|
@ -293,61 +419,61 @@ if (SPIRV_CROSS_CLI)
|
|||
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)
|
||||
COMMAND $<TARGET_FILE:spirv-cross-c-api-test> ${CMAKE_CURRENT_SOURCE_DIR}/tests-other/c_api_test.spv)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
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>)
|
||||
endif()
|
||||
elseif(NOT ${PYTHONINTERP_FOUND})
|
||||
message(WARNING "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")
|
||||
"cmake with -DPYTHON_EXECUTABLE:FILEPATH=/path/to/python3 to help it find the executable")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
#ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
|
@ -310,6 +310,18 @@ static const char *execution_model_to_str(spv::ExecutionModel model)
|
|||
return "fragment";
|
||||
case ExecutionModelGLCompute:
|
||||
return "compute";
|
||||
case ExecutionModelRayGenerationNV:
|
||||
return "raygenNV";
|
||||
case ExecutionModelIntersectionNV:
|
||||
return "intersectionNV";
|
||||
case ExecutionModelCallableNV:
|
||||
return "callableNV";
|
||||
case ExecutionModelAnyHitNV:
|
||||
return "anyhitNV";
|
||||
case ExecutionModelClosestHitNV:
|
||||
return "closesthitNV";
|
||||
case ExecutionModelMissNV:
|
||||
return "missNV";
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
|
@ -396,6 +408,7 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
|
|||
print_resources(compiler, "ubos", res.uniform_buffers);
|
||||
print_resources(compiler, "push", res.push_constant_buffers);
|
||||
print_resources(compiler, "counters", res.atomic_counters);
|
||||
print_resources(compiler, "acceleration structures", res.acceleration_structures);
|
||||
}
|
||||
|
||||
static void print_push_constant_resources(const Compiler &compiler, const vector<Resource> &res)
|
||||
|
|
|
@ -12,7 +12,7 @@ constant uint _5_tmp [[function_constant(10)]];
|
|||
constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u;
|
||||
constant uint _6_tmp [[function_constant(12)]];
|
||||
constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_5, 20u, _6);
|
||||
|
||||
kernel void main0(device SSBO& _4 [[buffer(0)]])
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ constant uint _3_tmp [[function_constant(0)]];
|
|||
constant uint _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 1u;
|
||||
constant uint _4_tmp [[function_constant(2)]];
|
||||
constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 3u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_3, 2u, _4);
|
||||
|
||||
kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ struct cb1_struct
|
|||
float4 _m0[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(16u, 16u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u);
|
||||
|
||||
kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d<float, access::write> u0 [[texture(1)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ struct cb1_struct
|
|||
float4 _m0[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(16u, 16u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u);
|
||||
|
||||
kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d<float, access::write> u0 [[texture(1)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 4u, 2u);
|
||||
|
||||
kernel void main0(uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ struct SSBO
|
|||
Data outdata[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(2u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u);
|
||||
|
||||
constant Data_1 _25[2] = { Data_1{ 1.0, 2.0 }, Data_1{ 3.0, 4.0 } };
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ struct SSBO3
|
|||
uint count;
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Buffer1
|
|||
float buf1[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u);
|
||||
|
||||
kernel void main0(device Buffer0& _15 [[buffer(1)]], device Buffer1& _34 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Buffer1
|
|||
float buf1[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u);
|
||||
|
||||
kernel void main0(device Buffer0& _14 [[buffer(1)]], device Buffer1& _24 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ struct SSBO
|
|||
float out_data[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u);
|
||||
|
||||
kernel void main0(device SSBO& _67 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ struct SSBO2
|
|||
float out_data[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ struct SSBO
|
|||
constant uint _21 = (uint(a) + 0u);
|
||||
constant uint _22_tmp [[function_constant(10)]];
|
||||
constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, 20u, 1u);
|
||||
constant uint _27 = gl_WorkGroupSize.x;
|
||||
constant uint _28 = (_21 + _27);
|
||||
constant uint _29 = gl_WorkGroupSize.y;
|
||||
|
|
10
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk
vendored
Normal file
10
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
}
|
||||
|
12
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk
vendored
Normal file
12
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 _55 = vec2(gl_LaunchIDNV.xy);
|
||||
vec2 _59 = vec2(gl_LaunchSizeNV.xy);
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(_55.x / _59.x, _55.y / _59.y, 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0);
|
||||
}
|
||||
|
15
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk
vendored
Normal file
15
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
layout(location = 0) rayPayloadNV float payload;
|
||||
layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image;
|
||||
|
||||
void main()
|
||||
{
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0);
|
||||
vec4 _68 = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
_68.y = payload;
|
||||
imageStore(image, ivec2(gl_LaunchIDNV.xy), _68);
|
||||
}
|
||||
|
10
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk
vendored
Normal file
10
3rdparty/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
||||
|
14
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
14
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
RWByteAddressBuffer block : register(u0);
|
||||
|
||||
float _15;
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
block.Store4(0, asuint(float4(0.100000001490116119384765625f, 0.20000000298023223876953125f, 0.300000011920928955078125f, 0.0f)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
45
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
45
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
RWByteAddressBuffer _4 : register(u0);
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
int4 _19 = int4(_4.Load4(0));
|
||||
uint4 _20 = _4.Load4(16);
|
||||
_4.Store4(0, uint4(abs(_19)));
|
||||
_4.Store4(16, uint4(abs(_19)));
|
||||
_4.Store4(0, uint4(abs(int4(_20))));
|
||||
_4.Store4(16, uint4(abs(int4(_20))));
|
||||
_4.Store4(0, uint4(sign(_19)));
|
||||
_4.Store4(16, uint4(sign(_19)));
|
||||
_4.Store4(0, uint4(sign(int4(_20))));
|
||||
_4.Store4(16, uint4(sign(int4(_20))));
|
||||
_4.Store4(0, uint4(firstbithigh(int4(_20))));
|
||||
_4.Store4(16, uint4(firstbithigh(int4(_20))));
|
||||
_4.Store4(0, uint4(int4(firstbithigh(uint4(_19)))));
|
||||
_4.Store4(16, firstbithigh(uint4(_19)));
|
||||
_4.Store4(0, uint4(min(_19, _19)));
|
||||
_4.Store4(16, uint4(min(_19, int4(_20))));
|
||||
_4.Store4(0, uint4(min(int4(_20), int4(_20))));
|
||||
_4.Store4(16, uint4(min(int4(_20), _19)));
|
||||
_4.Store4(0, uint4(int4(min(uint4(_19), _20))));
|
||||
_4.Store4(16, min(uint4(_19), _20));
|
||||
_4.Store4(0, uint4(int4(min(_20, uint4(_19)))));
|
||||
_4.Store4(16, min(_20, uint4(_19)));
|
||||
_4.Store4(0, uint4(max(_19, _19)));
|
||||
_4.Store4(16, uint4(max(_19, _19)));
|
||||
_4.Store4(0, uint4(max(int4(_20), _19)));
|
||||
_4.Store4(16, uint4(max(int4(_20), _19)));
|
||||
_4.Store4(0, uint4(int4(max(uint4(_19), _20))));
|
||||
_4.Store4(16, max(uint4(_19), uint4(_19)));
|
||||
_4.Store4(0, uint4(int4(max(_20, uint4(_19)))));
|
||||
_4.Store4(16, max(_20, uint4(_19)));
|
||||
_4.Store4(0, uint4(clamp(int4(_20), int4(_20), int4(_20))));
|
||||
_4.Store4(16, uint4(clamp(int4(_20), int4(_20), int4(_20))));
|
||||
_4.Store4(0, uint4(int4(clamp(uint4(_19), uint4(_19), uint4(_19)))));
|
||||
_4.Store4(16, clamp(uint4(_19), uint4(_19), uint4(_19)));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
28
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
28
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
static float4 FragColor;
|
||||
static float4 vFloat;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 vFloat : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 undef;
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = float4(undef.x, vFloat.y, 0.0f, vFloat.w) + float4(vFloat.z, vFloat.y, 0.0f, vFloat.w);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vFloat = stage_input.vFloat;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
|
@ -92,7 +92,7 @@ void comp_main()
|
|||
s = reversebits(s);
|
||||
int v0 = countbits(u);
|
||||
int v1 = countbits(s);
|
||||
int v2 = firstbithigh(u);
|
||||
int v2 = int(firstbithigh(u));
|
||||
int v3 = firstbitlow(s);
|
||||
int3 s_1 = SPIRV_Cross_bitfieldSExtract(signed_values, 5, 20);
|
||||
uint3 u_1 = SPIRV_Cross_bitfieldUExtract(unsigned_values, 6, 21);
|
||||
|
@ -102,7 +102,7 @@ void comp_main()
|
|||
s_1 = reversebits(s_1);
|
||||
int3 v0_1 = countbits(u_1);
|
||||
int3 v1_1 = countbits(s_1);
|
||||
int3 v2_1 = firstbithigh(u_1);
|
||||
int3 v2_1 = int3(firstbithigh(u_1));
|
||||
int3 v3_1 = firstbitlow(s_1);
|
||||
}
|
||||
|
||||
|
|
17
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
17
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Block
|
||||
{
|
||||
float4 f;
|
||||
};
|
||||
|
||||
constant float _15 = {};
|
||||
|
||||
kernel void main0(device Block& block [[buffer(0)]])
|
||||
{
|
||||
block.f = float4(0.100000001490116119384765625, 0.20000000298023223876953125, 0.300000011920928955078125, 0.0);
|
||||
}
|
||||
|
73
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
73
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
int4 ints;
|
||||
uint4 uints;
|
||||
};
|
||||
|
||||
// Implementation of the signed GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findSMSB(T x)
|
||||
{
|
||||
T v = select(x, T(-1) - x, x < T(0));
|
||||
return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the unsigned GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findUMSB(T x)
|
||||
{
|
||||
return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the GLSL sign() function for integer types
|
||||
template<typename T, typename E = typename enable_if<is_integral<T>::value>::type>
|
||||
T sign(T x)
|
||||
{
|
||||
return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0));
|
||||
}
|
||||
|
||||
kernel void main0(device SSBO& _4 [[buffer(0)]])
|
||||
{
|
||||
int4 _19 = _4.ints;
|
||||
uint4 _20 = _4.uints;
|
||||
_4.ints = abs(_19);
|
||||
_4.uints = uint4(abs(_19));
|
||||
_4.ints = abs(int4(_20));
|
||||
_4.uints = uint4(abs(int4(_20)));
|
||||
_4.ints = sign(_19);
|
||||
_4.uints = uint4(sign(_19));
|
||||
_4.ints = sign(int4(_20));
|
||||
_4.uints = uint4(sign(int4(_20)));
|
||||
_4.ints = findSMSB(int4(_20));
|
||||
_4.uints = uint4(findSMSB(int4(_20)));
|
||||
_4.ints = int4(findUMSB(uint4(_19)));
|
||||
_4.uints = findUMSB(uint4(_19));
|
||||
_4.ints = min(_19, _19);
|
||||
_4.uints = uint4(min(_19, int4(_20)));
|
||||
_4.ints = min(int4(_20), int4(_20));
|
||||
_4.uints = uint4(min(int4(_20), _19));
|
||||
_4.ints = int4(min(uint4(_19), _20));
|
||||
_4.uints = min(uint4(_19), _20);
|
||||
_4.ints = int4(min(_20, uint4(_19)));
|
||||
_4.uints = min(_20, uint4(_19));
|
||||
_4.ints = max(_19, _19);
|
||||
_4.uints = uint4(max(_19, _19));
|
||||
_4.ints = max(int4(_20), _19);
|
||||
_4.uints = uint4(max(int4(_20), _19));
|
||||
_4.ints = int4(max(uint4(_19), _20));
|
||||
_4.uints = max(uint4(_19), uint4(_19));
|
||||
_4.ints = int4(max(_20, uint4(_19)));
|
||||
_4.uints = max(_20, uint4(_19));
|
||||
_4.ints = clamp(int4(_20), int4(_20), int4(_20));
|
||||
_4.uints = uint4(clamp(int4(_20), int4(_20), int4(_20)));
|
||||
_4.ints = int4(clamp(uint4(_19), uint4(_19), uint4(_19)));
|
||||
_4.uints = clamp(uint4(_19), uint4(_19), uint4(_19));
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float a;
|
||||
};
|
||||
|
||||
struct SSBORead
|
||||
{
|
||||
float b;
|
||||
};
|
||||
|
||||
void copy_out(device float& A, device const float& B)
|
||||
{
|
||||
A = B;
|
||||
}
|
||||
|
||||
kernel void main0(device SSBO& _7 [[buffer(0)]], const device SSBORead& _9 [[buffer(1)]])
|
||||
{
|
||||
copy_out(_7.a, _9.b);
|
||||
}
|
||||
|
24
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
24
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant float4 undef = {};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 vFloat [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = float4(undef.x, in.vFloat.y, 0.0, in.vFloat.w) + float4(in.vFloat.z, in.vFloat.y, 0.0, in.vFloat.w);
|
||||
return out;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ kernel void main0()
|
|||
s = reverse_bits(s);
|
||||
int v0 = popcount(u);
|
||||
int v1 = popcount(s);
|
||||
int v2 = findUMSB(u);
|
||||
int v2 = int(findUMSB(u));
|
||||
int v3 = findSMSB(s);
|
||||
int v4 = findLSB(u);
|
||||
int v5 = findLSB(s);
|
||||
|
|
|
@ -12,7 +12,7 @@ constant uint _5_tmp [[function_constant(10)]];
|
|||
constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u;
|
||||
constant uint _6_tmp [[function_constant(12)]];
|
||||
constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_5, 20u, _6);
|
||||
|
||||
kernel void main0(device SSBO& _4 [[buffer(0)]])
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ constant uint _3_tmp [[function_constant(0)]];
|
|||
constant uint _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 1u;
|
||||
constant uint _4_tmp [[function_constant(2)]];
|
||||
constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 3u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_3, 2u, _4);
|
||||
|
||||
kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ struct cb1_struct
|
|||
float4 _m0[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(16u, 16u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u);
|
||||
|
||||
int2 get_texcoord(thread const int2& base, thread const int2& index, thread uint3& gl_LocalInvocationID)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ struct cb1_struct
|
|||
float4 _m0[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(16u, 16u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u);
|
||||
|
||||
kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d<float, access::write> u0 [[texture(1)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
void barrier_shared()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 4u, 2u);
|
||||
|
||||
kernel void main0(uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ struct SSBO
|
|||
Data outdata[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(2u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u);
|
||||
|
||||
constant Data_1 _25[2] = { Data_1{ 1.0, 2.0 }, Data_1{ 3.0, 4.0 } };
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ struct SSBO3
|
|||
uint count;
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ struct Buffer1
|
|||
float buf1[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u);
|
||||
|
||||
kernel void main0(device Buffer0& _15 [[buffer(1)]], device Buffer1& _34 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Buffer1
|
|||
float buf1[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(32u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u);
|
||||
|
||||
kernel void main0(device Buffer0& _14 [[buffer(1)]], device Buffer1& _24 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ struct SSBO
|
|||
float out_data[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u);
|
||||
|
||||
void work(threadgroup float (&foo)[4][4], thread uint3& gl_LocalInvocationID, thread uint& gl_LocalInvocationIndex, device SSBO& v_67, thread uint3& gl_GlobalInvocationID)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ struct SSBO2
|
|||
float out_data[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ struct SSBO
|
|||
constant uint _21 = (uint(a) + 0u);
|
||||
constant uint _22_tmp [[function_constant(10)]];
|
||||
constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u);
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, 20u, 1u);
|
||||
constant uint _27 = gl_WorkGroupSize.x;
|
||||
constant uint _28 = (_21 + _27);
|
||||
constant uint _29 = gl_WorkGroupSize.y;
|
||||
|
|
15
3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
15
3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
#version 450
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer Block
|
||||
{
|
||||
vec4 f;
|
||||
} block;
|
||||
|
||||
float _15;
|
||||
|
||||
void main()
|
||||
{
|
||||
block.f = vec4(0.100000001490116119384765625, 0.20000000298023223876953125, 0.300000011920928955078125, 0.0);
|
||||
}
|
||||
|
47
3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
47
3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
#version 450
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
{
|
||||
ivec4 ints;
|
||||
uvec4 uints;
|
||||
} _4;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec4 _19 = _4.ints;
|
||||
uvec4 _20 = _4.uints;
|
||||
_4.ints = abs(_19);
|
||||
_4.uints = uvec4(abs(_19));
|
||||
_4.ints = abs(ivec4(_20));
|
||||
_4.uints = uvec4(abs(ivec4(_20)));
|
||||
_4.ints = sign(_19);
|
||||
_4.uints = uvec4(sign(_19));
|
||||
_4.ints = sign(ivec4(_20));
|
||||
_4.uints = uvec4(sign(ivec4(_20)));
|
||||
_4.ints = findMSB(ivec4(_20));
|
||||
_4.uints = uvec4(findMSB(ivec4(_20)));
|
||||
_4.ints = findMSB(uvec4(_19));
|
||||
_4.uints = uvec4(findMSB(uvec4(_19)));
|
||||
_4.ints = min(_19, _19);
|
||||
_4.uints = uvec4(min(_19, ivec4(_20)));
|
||||
_4.ints = min(ivec4(_20), ivec4(_20));
|
||||
_4.uints = uvec4(min(ivec4(_20), _19));
|
||||
_4.ints = ivec4(min(uvec4(_19), _20));
|
||||
_4.uints = min(uvec4(_19), _20);
|
||||
_4.ints = ivec4(min(_20, uvec4(_19)));
|
||||
_4.uints = min(_20, uvec4(_19));
|
||||
_4.ints = max(_19, _19);
|
||||
_4.uints = uvec4(max(_19, _19));
|
||||
_4.ints = max(ivec4(_20), _19);
|
||||
_4.uints = uvec4(max(ivec4(_20), _19));
|
||||
_4.ints = ivec4(max(uvec4(_19), _20));
|
||||
_4.uints = max(uvec4(_19), uvec4(_19));
|
||||
_4.ints = ivec4(max(_20, uvec4(_19)));
|
||||
_4.uints = max(_20, uvec4(_19));
|
||||
_4.ints = clamp(ivec4(_20), ivec4(_20), ivec4(_20));
|
||||
_4.uints = uvec4(clamp(ivec4(_20), ivec4(_20), ivec4(_20)));
|
||||
_4.ints = ivec4(clamp(uvec4(_19), uvec4(_19), uvec4(_19)));
|
||||
_4.uints = clamp(uvec4(_19), uvec4(_19), uvec4(_19));
|
||||
}
|
||||
|
12
3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
12
3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(location = 0) in vec4 vFloat;
|
||||
|
||||
vec4 undef;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(undef.x, vFloat.y, 0.0, vFloat.w) + vec4(vFloat.z, vFloat.y, 0.0, vFloat.w);
|
||||
}
|
||||
|
16
3rdparty/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json
vendored
Normal file
16
3rdparty/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"entryPoints" : [
|
||||
{
|
||||
"name" : "main",
|
||||
"mode" : "rgen"
|
||||
}
|
||||
],
|
||||
"acceleration_structures" : [
|
||||
{
|
||||
"type" : "accelerationStructureNV",
|
||||
"name" : "as",
|
||||
"set" : 0,
|
||||
"binding" : 1
|
||||
}
|
||||
]
|
||||
}
|
10
3rdparty/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk
vendored
Normal file
10
3rdparty/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
}
|
||||
|
21
3rdparty/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk
vendored
Normal file
21
3rdparty/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
layout(location = 0) rayPayloadNV float payload;
|
||||
|
||||
float pure_call(vec2 launchID, vec2 launchSize)
|
||||
{
|
||||
vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0);
|
||||
vec3 direction = vec3(0.0, 0.0, -1.0);
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 param = vec2(gl_LaunchIDNV.xy);
|
||||
vec2 param_1 = vec2(gl_LaunchSizeNV.xy);
|
||||
float _62 = pure_call(param, param_1);
|
||||
}
|
||||
|
17
3rdparty/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk
vendored
Normal file
17
3rdparty/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
layout(location = 0) rayPayloadNV float payload;
|
||||
layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
vec3 origin = vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0);
|
||||
vec3 direction = vec3(0.0, 0.0, -1.0);
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
|
||||
col.y = payload;
|
||||
imageStore(image, ivec2(gl_LaunchIDNV.xy), col);
|
||||
}
|
||||
|
10
3rdparty/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk
vendored
Normal file
10
3rdparty/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
||||
|
40
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
40
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %Block "Block"
|
||||
OpMemberName %Block 0 "f"
|
||||
OpName %block "block"
|
||||
OpMemberDecorate %Block 0 Offset 0
|
||||
OpDecorate %Block BufferBlock
|
||||
OpDecorate %block DescriptorSet 0
|
||||
OpDecorate %block Binding 0
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%Block = OpTypeStruct %v4float
|
||||
%_ptr_Uniform_Block = OpTypePointer Uniform %Block
|
||||
%block = OpVariable %_ptr_Uniform_Block Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%15 = OpUndef %float
|
||||
%16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%main = OpFunction %void None %6
|
||||
%18 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0
|
||||
OpStore %19 %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
123
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
123
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %SSBO "SSBO"
|
||||
OpMemberName %SSBO 0 "ints"
|
||||
OpMemberName %SSBO 1 "uints"
|
||||
OpName %_ ""
|
||||
OpMemberDecorate %SSBO 0 Offset 0
|
||||
OpMemberDecorate %SSBO 1 Offset 16
|
||||
OpDecorate %SSBO BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%SSBO = OpTypeStruct %v4int %v4uint
|
||||
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
|
||||
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0
|
||||
%uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1
|
||||
%ints = OpLoad %v4int %ints_ptr
|
||||
%uints = OpLoad %v4uint %uints_ptr
|
||||
|
||||
%int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints
|
||||
%int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints
|
||||
%uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints
|
||||
%uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints
|
||||
|
||||
%int_to_int_ssign = OpExtInst %v4int %1 SSign %ints
|
||||
%int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints
|
||||
%uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints
|
||||
%uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints
|
||||
|
||||
%int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints
|
||||
%int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints
|
||||
%uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints
|
||||
%uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints
|
||||
|
||||
%int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints
|
||||
%int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints
|
||||
%uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints
|
||||
%uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints
|
||||
|
||||
%int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints
|
||||
%int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints
|
||||
%uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints
|
||||
%uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints
|
||||
|
||||
%int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints
|
||||
%int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints
|
||||
%uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints
|
||||
%uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints
|
||||
|
||||
%int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints
|
||||
%int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints
|
||||
%uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints
|
||||
%uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints
|
||||
|
||||
%int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints
|
||||
%int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints
|
||||
%uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints
|
||||
%uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sabs
|
||||
OpStore %uints_ptr %int_to_uint_sabs
|
||||
OpStore %ints_ptr %uint_to_int_sabs
|
||||
OpStore %uints_ptr %uint_to_uint_sabs
|
||||
|
||||
OpStore %ints_ptr %int_to_int_ssign
|
||||
OpStore %uints_ptr %int_to_uint_ssign
|
||||
OpStore %ints_ptr %uint_to_int_ssign
|
||||
OpStore %uints_ptr %uint_to_uint_ssign
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smsb
|
||||
OpStore %uints_ptr %int_to_uint_smsb
|
||||
OpStore %ints_ptr %uint_to_int_umsb
|
||||
OpStore %uints_ptr %uint_to_uint_umsb
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smin
|
||||
OpStore %uints_ptr %int_to_uint_smin
|
||||
OpStore %ints_ptr %uint_to_int_smin
|
||||
OpStore %uints_ptr %uint_to_uint_smin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umin
|
||||
OpStore %uints_ptr %int_to_uint_umin
|
||||
OpStore %ints_ptr %uint_to_int_umin
|
||||
OpStore %uints_ptr %uint_to_uint_umin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smax
|
||||
OpStore %uints_ptr %int_to_uint_smax
|
||||
OpStore %ints_ptr %uint_to_int_smax
|
||||
OpStore %uints_ptr %uint_to_uint_smax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umax
|
||||
OpStore %uints_ptr %int_to_uint_umax
|
||||
OpStore %ints_ptr %uint_to_int_umax
|
||||
OpStore %uints_ptr %uint_to_uint_umax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sclamp
|
||||
OpStore %uints_ptr %int_to_uint_sclamp
|
||||
OpStore %ints_ptr %uint_to_int_uclamp
|
||||
OpStore %uints_ptr %uint_to_uint_uclamp
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
42
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
42
3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %FragColor %vFloat
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %FragColor "FragColor"
|
||||
OpName %vFloat "vFloat"
|
||||
OpName %undef "undef"
|
||||
OpDecorate %FragColor Location 0
|
||||
OpDecorate %vFloat Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%vFloat = OpVariable %_ptr_Input_v4float Input
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%undef = OpUndef %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpLoad %v4float %vFloat
|
||||
%26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3
|
||||
%27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3
|
||||
%28 = OpFAdd %v4float %26 %27
|
||||
OpStore %FragColor %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
40
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
40
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %Block "Block"
|
||||
OpMemberName %Block 0 "f"
|
||||
OpName %block "block"
|
||||
OpMemberDecorate %Block 0 Offset 0
|
||||
OpDecorate %Block BufferBlock
|
||||
OpDecorate %block DescriptorSet 0
|
||||
OpDecorate %block Binding 0
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%Block = OpTypeStruct %v4float
|
||||
%_ptr_Uniform_Block = OpTypePointer Uniform %Block
|
||||
%block = OpVariable %_ptr_Uniform_Block Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%15 = OpUndef %float
|
||||
%16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%main = OpFunction %void None %6
|
||||
%18 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0
|
||||
OpStore %19 %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
123
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
123
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %SSBO "SSBO"
|
||||
OpMemberName %SSBO 0 "ints"
|
||||
OpMemberName %SSBO 1 "uints"
|
||||
OpName %_ ""
|
||||
OpMemberDecorate %SSBO 0 Offset 0
|
||||
OpMemberDecorate %SSBO 1 Offset 16
|
||||
OpDecorate %SSBO BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%SSBO = OpTypeStruct %v4int %v4uint
|
||||
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
|
||||
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0
|
||||
%uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1
|
||||
%ints = OpLoad %v4int %ints_ptr
|
||||
%uints = OpLoad %v4uint %uints_ptr
|
||||
|
||||
%int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints
|
||||
%int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints
|
||||
%uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints
|
||||
%uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints
|
||||
|
||||
%int_to_int_ssign = OpExtInst %v4int %1 SSign %ints
|
||||
%int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints
|
||||
%uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints
|
||||
%uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints
|
||||
|
||||
%int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints
|
||||
%int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints
|
||||
%uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints
|
||||
%uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints
|
||||
|
||||
%int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints
|
||||
%int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints
|
||||
%uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints
|
||||
%uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints
|
||||
|
||||
%int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints
|
||||
%int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints
|
||||
%uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints
|
||||
%uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints
|
||||
|
||||
%int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints
|
||||
%int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints
|
||||
%uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints
|
||||
%uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints
|
||||
|
||||
%int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints
|
||||
%int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints
|
||||
%uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints
|
||||
%uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints
|
||||
|
||||
%int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints
|
||||
%int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints
|
||||
%uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints
|
||||
%uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sabs
|
||||
OpStore %uints_ptr %int_to_uint_sabs
|
||||
OpStore %ints_ptr %uint_to_int_sabs
|
||||
OpStore %uints_ptr %uint_to_uint_sabs
|
||||
|
||||
OpStore %ints_ptr %int_to_int_ssign
|
||||
OpStore %uints_ptr %int_to_uint_ssign
|
||||
OpStore %ints_ptr %uint_to_int_ssign
|
||||
OpStore %uints_ptr %uint_to_uint_ssign
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smsb
|
||||
OpStore %uints_ptr %int_to_uint_smsb
|
||||
OpStore %ints_ptr %uint_to_int_umsb
|
||||
OpStore %uints_ptr %uint_to_uint_umsb
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smin
|
||||
OpStore %uints_ptr %int_to_uint_smin
|
||||
OpStore %ints_ptr %uint_to_int_smin
|
||||
OpStore %uints_ptr %uint_to_uint_smin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umin
|
||||
OpStore %uints_ptr %int_to_uint_umin
|
||||
OpStore %ints_ptr %uint_to_int_umin
|
||||
OpStore %uints_ptr %uint_to_uint_umin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smax
|
||||
OpStore %uints_ptr %int_to_uint_smax
|
||||
OpStore %ints_ptr %uint_to_int_smax
|
||||
OpStore %uints_ptr %uint_to_uint_smax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umax
|
||||
OpStore %uints_ptr %int_to_uint_umax
|
||||
OpStore %ints_ptr %uint_to_int_umax
|
||||
OpStore %uints_ptr %uint_to_uint_umax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sclamp
|
||||
OpStore %uints_ptr %int_to_uint_sclamp
|
||||
OpStore %ints_ptr %uint_to_int_uclamp
|
||||
OpStore %uints_ptr %uint_to_uint_uclamp
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
63
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp
vendored
Normal file
63
3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointersStorageBuffer
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %copy_out_f1_f1_ "copy_out(f1;f1;"
|
||||
OpName %A "A"
|
||||
OpName %B "B"
|
||||
OpName %SSBO "SSBO"
|
||||
OpMemberName %SSBO 0 "a"
|
||||
OpName %_ ""
|
||||
OpName %SSBORead "SSBORead"
|
||||
OpMemberName %SSBORead 0 "b"
|
||||
OpName %__0 ""
|
||||
OpMemberDecorate %SSBO 0 NonReadable
|
||||
OpMemberDecorate %SSBO 0 Offset 0
|
||||
OpDecorate %SSBO Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpMemberDecorate %SSBORead 0 NonWritable
|
||||
OpMemberDecorate %SSBORead 0 Offset 0
|
||||
OpDecorate %SSBORead Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%8 = OpTypeFunction %void %_ptr_StorageBuffer_float %_ptr_StorageBuffer_float
|
||||
%SSBO = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO
|
||||
%_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%SSBORead = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_SSBORead = OpTypePointer StorageBuffer %SSBORead
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_SSBORead StorageBuffer
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%param = OpVariable %_ptr_Function_float Function
|
||||
%param_0 = OpVariable %_ptr_Function_float Function
|
||||
%25 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0
|
||||
%26 = OpAccessChain %_ptr_StorageBuffer_float %__0 %int_0
|
||||
%27 = OpFunctionCall %void %copy_out_f1_f1_ %25 %26
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%copy_out_f1_f1_ = OpFunction %void None %8
|
||||
%A = OpFunctionParameter %_ptr_StorageBuffer_float
|
||||
%B = OpFunctionParameter %_ptr_StorageBuffer_float
|
||||
%12 = OpLabel
|
||||
%13 = OpLoad %float %B
|
||||
OpStore %A %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
42
3rdparty/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
42
3rdparty/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %FragColor %vFloat
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %FragColor "FragColor"
|
||||
OpName %vFloat "vFloat"
|
||||
OpName %undef "undef"
|
||||
OpDecorate %FragColor Location 0
|
||||
OpDecorate %vFloat Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%vFloat = OpVariable %_ptr_Input_v4float Input
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%undef = OpUndef %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpLoad %v4float %vFloat
|
||||
%26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3
|
||||
%27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3
|
||||
%28 = OpFAdd %v4float %26 %27
|
||||
OpStore %FragColor %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
40
3rdparty/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
40
3rdparty/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %Block "Block"
|
||||
OpMemberName %Block 0 "f"
|
||||
OpName %block "block"
|
||||
OpMemberDecorate %Block 0 Offset 0
|
||||
OpDecorate %Block BufferBlock
|
||||
OpDecorate %block DescriptorSet 0
|
||||
OpDecorate %block Binding 0
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%Block = OpTypeStruct %v4float
|
||||
%_ptr_Uniform_Block = OpTypePointer Uniform %Block
|
||||
%block = OpVariable %_ptr_Uniform_Block Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%15 = OpUndef %float
|
||||
%16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%main = OpFunction %void None %6
|
||||
%18 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0
|
||||
OpStore %19 %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
123
3rdparty/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
123
3rdparty/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %SSBO "SSBO"
|
||||
OpMemberName %SSBO 0 "ints"
|
||||
OpMemberName %SSBO 1 "uints"
|
||||
OpName %_ ""
|
||||
OpMemberDecorate %SSBO 0 Offset 0
|
||||
OpMemberDecorate %SSBO 1 Offset 16
|
||||
OpDecorate %SSBO BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%SSBO = OpTypeStruct %v4int %v4uint
|
||||
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
|
||||
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0
|
||||
%uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1
|
||||
%ints = OpLoad %v4int %ints_ptr
|
||||
%uints = OpLoad %v4uint %uints_ptr
|
||||
|
||||
%int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints
|
||||
%int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints
|
||||
%uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints
|
||||
%uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints
|
||||
|
||||
%int_to_int_ssign = OpExtInst %v4int %1 SSign %ints
|
||||
%int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints
|
||||
%uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints
|
||||
%uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints
|
||||
|
||||
%int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints
|
||||
%int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints
|
||||
%uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints
|
||||
%uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints
|
||||
|
||||
%int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints
|
||||
%int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints
|
||||
%uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints
|
||||
%uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints
|
||||
|
||||
%int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints
|
||||
%int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints
|
||||
%uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints
|
||||
%uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints
|
||||
|
||||
%int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints
|
||||
%int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints
|
||||
%uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints
|
||||
%uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints
|
||||
|
||||
%int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints
|
||||
%int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints
|
||||
%uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints
|
||||
%uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints
|
||||
|
||||
%int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints
|
||||
%int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints
|
||||
%uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints
|
||||
%uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sabs
|
||||
OpStore %uints_ptr %int_to_uint_sabs
|
||||
OpStore %ints_ptr %uint_to_int_sabs
|
||||
OpStore %uints_ptr %uint_to_uint_sabs
|
||||
|
||||
OpStore %ints_ptr %int_to_int_ssign
|
||||
OpStore %uints_ptr %int_to_uint_ssign
|
||||
OpStore %ints_ptr %uint_to_int_ssign
|
||||
OpStore %uints_ptr %uint_to_uint_ssign
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smsb
|
||||
OpStore %uints_ptr %int_to_uint_smsb
|
||||
OpStore %ints_ptr %uint_to_int_umsb
|
||||
OpStore %uints_ptr %uint_to_uint_umsb
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smin
|
||||
OpStore %uints_ptr %int_to_uint_smin
|
||||
OpStore %ints_ptr %uint_to_int_smin
|
||||
OpStore %uints_ptr %uint_to_uint_smin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umin
|
||||
OpStore %uints_ptr %int_to_uint_umin
|
||||
OpStore %ints_ptr %uint_to_int_umin
|
||||
OpStore %uints_ptr %uint_to_uint_umin
|
||||
|
||||
OpStore %ints_ptr %int_to_int_smax
|
||||
OpStore %uints_ptr %int_to_uint_smax
|
||||
OpStore %ints_ptr %uint_to_int_smax
|
||||
OpStore %uints_ptr %uint_to_uint_smax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_umax
|
||||
OpStore %uints_ptr %int_to_uint_umax
|
||||
OpStore %ints_ptr %uint_to_int_umax
|
||||
OpStore %uints_ptr %uint_to_uint_umax
|
||||
|
||||
OpStore %ints_ptr %int_to_int_sclamp
|
||||
OpStore %uints_ptr %int_to_uint_sclamp
|
||||
OpStore %ints_ptr %uint_to_int_uclamp
|
||||
OpStore %uints_ptr %uint_to_uint_uclamp
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
42
3rdparty/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
42
3rdparty/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %FragColor %vFloat
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %FragColor "FragColor"
|
||||
OpName %vFloat "vFloat"
|
||||
OpName %undef "undef"
|
||||
OpDecorate %FragColor Location 0
|
||||
OpDecorate %vFloat Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%vFloat = OpVariable %_ptr_Input_v4float Input
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%undef = OpUndef %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpLoad %v4float %vFloat
|
||||
%26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3
|
||||
%27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3
|
||||
%28 = OpFAdd %v4float %26 %27
|
||||
OpStore %FragColor %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,9 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
|
||||
void main()
|
||||
{
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, vec3(1.0), 1000.0, 0);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
layout(location = 0) rayPayloadNV float payload;
|
||||
|
||||
float pure_call(vec2 launchID, vec2 launchSize)
|
||||
{
|
||||
vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0);
|
||||
vec3 direction = vec3(0.0, 0.0, -1.0);
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
pure_call(vec2(gl_LaunchIDNV.xy), vec2(gl_LaunchSizeNV.xy));
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(set = 0, binding = 0, rgba8) uniform image2D image;
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
|
||||
layout(location = 0) rayPayloadNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
vec3 origin = vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0);
|
||||
vec3 direction = vec3(0.0, 0.0, -1.0);
|
||||
traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0);
|
||||
col.y = payload;
|
||||
imageStore(image, ivec2(gl_LaunchIDNV.xy), col);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
CFG::CFG(Compiler &compiler_, const SPIRFunction &func_)
|
||||
: compiler(compiler_)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "spirv_common.hpp"
|
||||
#include <assert.h>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
class Compiler;
|
||||
class CFG
|
||||
|
|
|
@ -35,7 +35,23 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
// A bit crude, but allows projects which embed SPIRV-Cross statically to
|
||||
// effectively hide all the symbols from other projects.
|
||||
// There is a case where we have:
|
||||
// - Project A links against SPIRV-Cross statically.
|
||||
// - Project A links against Project B statically.
|
||||
// - Project B links against SPIRV-Cross statically (might be a different version).
|
||||
// This leads to a conflict with extremely bizarre results.
|
||||
// By overriding the namespace in one of the project builds, we can work around this.
|
||||
// If SPIRV-Cross is embedded in dynamic libraries,
|
||||
// prefer using -fvisibility=hidden on GCC/Clang instead.
|
||||
#ifdef SPIRV_CROSS_NAMESPACE_OVERRIDE
|
||||
#define SPIRV_CROSS_NAMESPACE SPIRV_CROSS_NAMESPACE_OVERRIDE
|
||||
#else
|
||||
#define SPIRV_CROSS_NAMESPACE spirv_cross
|
||||
#endif
|
||||
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
|
||||
#ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
|
@ -423,7 +439,6 @@ struct SPIRType : IVariant
|
|||
Unknown,
|
||||
Void,
|
||||
Boolean,
|
||||
Char,
|
||||
SByte,
|
||||
UByte,
|
||||
Short,
|
||||
|
@ -440,7 +455,11 @@ struct SPIRType : IVariant
|
|||
Image,
|
||||
SampledImage,
|
||||
Sampler,
|
||||
ControlPointArray
|
||||
AccelerationStructureNV,
|
||||
|
||||
// Keep internal types at the end.
|
||||
ControlPointArray,
|
||||
Char
|
||||
};
|
||||
|
||||
// Scalar/vector/matrix support.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "spirv_cpp.hpp"
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
void CompilerCPP::emit_buffer_block(const SPIRVariable &var)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
class CompilerCPP : public CompilerGLSL
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
|
||||
Compiler::Compiler(vector<uint32_t> ir_)
|
||||
{
|
||||
|
@ -144,6 +144,14 @@ bool Compiler::block_is_pure(const SPIRBlock &block)
|
|||
case OpMemoryBarrier:
|
||||
return false;
|
||||
|
||||
// Ray tracing builtins are impure.
|
||||
case OpReportIntersectionNV:
|
||||
case OpIgnoreIntersectionNV:
|
||||
case OpTerminateRayNV:
|
||||
case OpTraceNV:
|
||||
case OpExecuteCallableNV:
|
||||
return false;
|
||||
|
||||
// OpExtInst is potentially impure depending on extension, but GLSL builtins are at least pure.
|
||||
|
||||
default:
|
||||
|
@ -812,6 +820,11 @@ ShaderResources Compiler::get_shader_resources(const unordered_set<uint32_t> *ac
|
|||
{
|
||||
res.atomic_counters.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
|
||||
}
|
||||
// Acceleration structures
|
||||
else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::AccelerationStructureNV)
|
||||
{
|
||||
res.acceleration_structures.push_back({ var.self, var.basetype, type.self, get_name(var.self) });
|
||||
}
|
||||
});
|
||||
|
||||
return res;
|
||||
|
@ -3812,7 +3825,7 @@ void Compiler::build_function_control_flow_graphs_and_analyze()
|
|||
}
|
||||
}
|
||||
|
||||
Compiler::CFGBuilder::CFGBuilder(spirv_cross::Compiler &compiler_)
|
||||
Compiler::CFGBuilder::CFGBuilder(Compiler &compiler_)
|
||||
: compiler(compiler_)
|
||||
{
|
||||
}
|
||||
|
@ -4096,12 +4109,12 @@ bool Compiler::is_desktop_only_format(spv::ImageFormat format)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Compiler::image_is_comparison(const spirv_cross::SPIRType &type, uint32_t id) const
|
||||
bool Compiler::image_is_comparison(const SPIRType &type, uint32_t id) const
|
||||
{
|
||||
return type.image.depth || (comparison_ids.count(id) != 0);
|
||||
}
|
||||
|
||||
bool Compiler::type_is_opaque_value(const spirv_cross::SPIRType &type) const
|
||||
bool Compiler::type_is_opaque_value(const SPIRType &type) const
|
||||
{
|
||||
return !type.pointer && (type.basetype == SPIRType::SampledImage || type.basetype == SPIRType::Image ||
|
||||
type.basetype == SPIRType::Sampler);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "spirv_cfg.hpp"
|
||||
#include "spirv_cross_parsed_ir.hpp"
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
struct Resource
|
||||
{
|
||||
|
@ -62,6 +62,7 @@ struct ShaderResources
|
|||
std::vector<Resource> storage_images;
|
||||
std::vector<Resource> sampled_images;
|
||||
std::vector<Resource> atomic_counters;
|
||||
std::vector<Resource> acceleration_structures;
|
||||
|
||||
// There can only be one push constant block,
|
||||
// but keep the vector in case this restriction is lifted in the future.
|
||||
|
|
|
@ -15,12 +15,26 @@
|
|||
*/
|
||||
|
||||
#include "spirv_cross_c.h"
|
||||
|
||||
#if SPIRV_CROSS_C_API_CPP
|
||||
#include "spirv_cpp.hpp"
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
#include "spirv_glsl.hpp"
|
||||
#else
|
||||
#include "spirv_cross.hpp"
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
#include "spirv_hlsl.hpp"
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
#include "spirv_msl.hpp"
|
||||
#include "spirv_parser.hpp"
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_REFLECT
|
||||
#include "spirv_reflect.hpp"
|
||||
#endif
|
||||
#include "spirv_parser.hpp"
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
|
@ -49,7 +63,7 @@
|
|||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
|
||||
struct ScratchMemoryAllocation
|
||||
{
|
||||
|
@ -130,9 +144,15 @@ struct spvc_compiler_options_s : ScratchMemoryAllocation
|
|||
{
|
||||
spvc_context context = nullptr;
|
||||
uint32_t backend_flags = 0;
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
CompilerGLSL::Options glsl;
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
CompilerMSL::Options msl;
|
||||
#endif
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
CompilerHLSL::Options hlsl;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct spvc_set_s : ScratchMemoryAllocation
|
||||
|
@ -164,6 +184,7 @@ struct spvc_resources_s : ScratchMemoryAllocation
|
|||
std::vector<spvc_reflected_resource> push_constant_buffers;
|
||||
std::vector<spvc_reflected_resource> separate_images;
|
||||
std::vector<spvc_reflected_resource> separate_samplers;
|
||||
std::vector<spvc_reflected_resource> acceleration_structures;
|
||||
|
||||
bool copy_resources(std::vector<spvc_reflected_resource> &outputs, const std::vector<Resource> &inputs);
|
||||
bool copy_resources(const ShaderResources &resources);
|
||||
|
@ -252,40 +273,50 @@ spvc_result spvc_context_create_compiler(spvc_context context, spvc_backend back
|
|||
comp->compiler.reset(new Compiler(parsed_ir->parsed));
|
||||
break;
|
||||
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
case SPVC_BACKEND_GLSL:
|
||||
if (mode == SPVC_CAPTURE_MODE_TAKE_OWNERSHIP)
|
||||
comp->compiler.reset(new CompilerGLSL(move(parsed_ir->parsed)));
|
||||
else if (mode == SPVC_CAPTURE_MODE_COPY)
|
||||
comp->compiler.reset(new CompilerGLSL(parsed_ir->parsed));
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
case SPVC_BACKEND_HLSL:
|
||||
if (mode == SPVC_CAPTURE_MODE_TAKE_OWNERSHIP)
|
||||
comp->compiler.reset(new CompilerHLSL(move(parsed_ir->parsed)));
|
||||
else if (mode == SPVC_CAPTURE_MODE_COPY)
|
||||
comp->compiler.reset(new CompilerHLSL(parsed_ir->parsed));
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
case SPVC_BACKEND_MSL:
|
||||
if (mode == SPVC_CAPTURE_MODE_TAKE_OWNERSHIP)
|
||||
comp->compiler.reset(new CompilerMSL(move(parsed_ir->parsed)));
|
||||
else if (mode == SPVC_CAPTURE_MODE_COPY)
|
||||
comp->compiler.reset(new CompilerMSL(parsed_ir->parsed));
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_CPP
|
||||
case SPVC_BACKEND_CPP:
|
||||
if (mode == SPVC_CAPTURE_MODE_TAKE_OWNERSHIP)
|
||||
comp->compiler.reset(new CompilerCPP(move(parsed_ir->parsed)));
|
||||
else if (mode == SPVC_CAPTURE_MODE_COPY)
|
||||
comp->compiler.reset(new CompilerCPP(parsed_ir->parsed));
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_REFLECT
|
||||
case SPVC_BACKEND_JSON:
|
||||
if (mode == SPVC_CAPTURE_MODE_TAKE_OWNERSHIP)
|
||||
comp->compiler.reset(new CompilerReflection(move(parsed_ir->parsed)));
|
||||
else if (mode == SPVC_CAPTURE_MODE_COPY)
|
||||
comp->compiler.reset(new CompilerReflection(parsed_ir->parsed));
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
context->report_error("Invalid backend.");
|
||||
|
@ -314,22 +345,28 @@ spvc_result spvc_compiler_create_compiler_options(spvc_compiler compiler, spvc_c
|
|||
opt->backend_flags = 0;
|
||||
switch (compiler->backend)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
case SPVC_BACKEND_MSL:
|
||||
opt->backend_flags |= SPVC_COMPILER_OPTION_MSL_BIT | SPVC_COMPILER_OPTION_COMMON_BIT;
|
||||
opt->glsl = static_cast<CompilerMSL *>(compiler->compiler.get())->get_common_options();
|
||||
opt->msl = static_cast<CompilerMSL *>(compiler->compiler.get())->get_msl_options();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
case SPVC_BACKEND_HLSL:
|
||||
opt->backend_flags |= SPVC_COMPILER_OPTION_HLSL_BIT | SPVC_COMPILER_OPTION_COMMON_BIT;
|
||||
opt->glsl = static_cast<CompilerHLSL *>(compiler->compiler.get())->get_common_options();
|
||||
opt->hlsl = static_cast<CompilerHLSL *>(compiler->compiler.get())->get_hlsl_options();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
case SPVC_BACKEND_GLSL:
|
||||
opt->backend_flags |= SPVC_COMPILER_OPTION_GLSL_BIT | SPVC_COMPILER_OPTION_COMMON_BIT;
|
||||
opt->glsl = static_cast<CompilerGLSL *>(compiler->compiler.get())->get_common_options();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -350,6 +387,8 @@ spvc_result spvc_compiler_options_set_bool(spvc_compiler_options options, spvc_c
|
|||
|
||||
spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_compiler_option option, unsigned value)
|
||||
{
|
||||
(void)value;
|
||||
(void)option;
|
||||
uint32_t supported_mask = options->backend_flags;
|
||||
uint32_t required_mask = option & SPVC_COMPILER_OPTION_LANG_BITS;
|
||||
if ((required_mask | supported_mask) != supported_mask)
|
||||
|
@ -360,6 +399,7 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
|
||||
switch (option)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
case SPVC_COMPILER_OPTION_FORCE_TEMPORARY:
|
||||
options->glsl.force_temporary = value != 0;
|
||||
break;
|
||||
|
@ -372,6 +412,7 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
case SPVC_COMPILER_OPTION_FLIP_VERTEX_Y:
|
||||
options->glsl.vertex.flip_vert_y = value != 0;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_GLSL_SUPPORT_NONZERO_BASE_INSTANCE:
|
||||
options->glsl.vertex.support_nonzero_base_instance = value != 0;
|
||||
break;
|
||||
|
@ -398,7 +439,12 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
options->glsl.fragment.default_int_precision =
|
||||
value != 0 ? CompilerGLSL::Options::Precision::Highp : CompilerGLSL::Options::Precision::Mediump;
|
||||
break;
|
||||
case SPVC_COMPILER_OPTION_GLSL_EMIT_PUSH_CONSTANT_AS_UNIFORM_BUFFER:
|
||||
options->glsl.emit_push_constant_as_uniform_buffer = value != 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
case SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL:
|
||||
options->hlsl.shader_model = value;
|
||||
break;
|
||||
|
@ -414,7 +460,9 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
case SPVC_COMPILER_OPTION_HLSL_SUPPORT_NONZERO_BASE_VERTEX_BASE_INSTANCE:
|
||||
options->hlsl.support_nonzero_base_vertex_base_instance = value != 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
case SPVC_COMPILER_OPTION_MSL_VERSION:
|
||||
options->msl.msl_version = value;
|
||||
break;
|
||||
|
@ -478,10 +526,7 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
case SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS:
|
||||
options->msl.argument_buffers = value != 0;
|
||||
break;
|
||||
|
||||
case SPVC_COMPILER_OPTION_GLSL_EMIT_PUSH_CONSTANT_AS_UNIFORM_BUFFER:
|
||||
options->glsl.emit_push_constant_as_uniform_buffer = value != 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
options->context->report_error("Unknown option.");
|
||||
|
@ -493,19 +538,29 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
|
|||
|
||||
spvc_result spvc_compiler_install_compiler_options(spvc_compiler compiler, spvc_compiler_options options)
|
||||
{
|
||||
(void)options;
|
||||
switch (compiler->backend)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
case SPVC_BACKEND_GLSL:
|
||||
static_cast<CompilerGLSL &>(*compiler->compiler).set_common_options(options->glsl);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
case SPVC_BACKEND_HLSL:
|
||||
static_cast<CompilerHLSL &>(*compiler->compiler).set_common_options(options->glsl);
|
||||
static_cast<CompilerHLSL &>(*compiler->compiler).set_hlsl_options(options->hlsl);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
case SPVC_BACKEND_MSL:
|
||||
static_cast<CompilerMSL &>(*compiler->compiler).set_common_options(options->glsl);
|
||||
static_cast<CompilerMSL &>(*compiler->compiler).set_msl_options(options->msl);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -515,6 +570,7 @@ spvc_result spvc_compiler_install_compiler_options(spvc_compiler compiler, spvc_
|
|||
|
||||
spvc_result spvc_compiler_add_header_line(spvc_compiler compiler, const char *line)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
if (compiler->backend == SPVC_BACKEND_NONE)
|
||||
{
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
|
@ -523,10 +579,16 @@ spvc_result spvc_compiler_add_header_line(spvc_compiler compiler, const char *li
|
|||
|
||||
static_cast<CompilerGLSL *>(compiler->compiler.get())->add_header_line(line);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)line;
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char *line)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
if (compiler->backend == SPVC_BACKEND_NONE)
|
||||
{
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
|
@ -535,10 +597,16 @@ spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char *
|
|||
|
||||
static_cast<CompilerGLSL *>(compiler->compiler.get())->require_extension(line);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)line;
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_GLSL
|
||||
if (compiler->backend == SPVC_BACKEND_NONE)
|
||||
{
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
|
@ -547,12 +615,18 @@ spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_vari
|
|||
|
||||
static_cast<CompilerGLSL *>(compiler->compiler.get())->flatten_buffer_block(id);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)id;
|
||||
compiler->context->report_error("Cross-compilation related option used on NONE backend which only supports reflection.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_hlsl_set_root_constants_layout(spvc_compiler compiler,
|
||||
const spvc_hlsl_root_constants *constant_info,
|
||||
size_t count)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
if (compiler->backend != SPVC_BACKEND_HLSL)
|
||||
{
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
|
@ -574,12 +648,19 @@ spvc_result spvc_compiler_hlsl_set_root_constants_layout(spvc_compiler compiler,
|
|||
|
||||
hlsl.set_root_constant_layouts(std::move(roots));
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)constant_info;
|
||||
(void)count;
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_hlsl_add_vertex_attribute_remap(spvc_compiler compiler,
|
||||
const spvc_hlsl_vertex_attribute_remap *remap,
|
||||
size_t count)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
if (compiler->backend != SPVC_BACKEND_HLSL)
|
||||
{
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
|
@ -596,10 +677,17 @@ spvc_result spvc_compiler_hlsl_add_vertex_attribute_remap(spvc_compiler compiler
|
|||
}
|
||||
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)remap;
|
||||
(void)count;
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_variable_id spvc_compiler_hlsl_remap_num_workgroups_builtin(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_HLSL
|
||||
if (compiler->backend != SPVC_BACKEND_HLSL)
|
||||
{
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
|
@ -608,10 +696,15 @@ spvc_variable_id spvc_compiler_hlsl_remap_num_workgroups_builtin(spvc_compiler c
|
|||
|
||||
auto &hlsl = *static_cast<CompilerHLSL *>(compiler->compiler.get());
|
||||
return hlsl.remap_num_workgroups_builtin();
|
||||
#else
|
||||
compiler->context->report_error("HLSL function used on a non-HLSL backend.");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_is_rasterization_disabled(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -620,10 +713,15 @@ spvc_bool spvc_compiler_msl_is_rasterization_disabled(spvc_compiler compiler)
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.get_is_rasterization_disabled() ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_needs_aux_buffer(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -632,10 +730,15 @@ spvc_bool spvc_compiler_msl_needs_aux_buffer(spvc_compiler compiler)
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.needs_aux_buffer() ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_needs_output_buffer(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -644,10 +747,15 @@ spvc_bool spvc_compiler_msl_needs_output_buffer(spvc_compiler compiler)
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.needs_output_buffer() ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_needs_patch_output_buffer(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -656,10 +764,15 @@ spvc_bool spvc_compiler_msl_needs_patch_output_buffer(spvc_compiler compiler)
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.needs_patch_output_buffer() ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_needs_input_threadgroup_mem(spvc_compiler compiler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -668,10 +781,15 @@ spvc_bool spvc_compiler_msl_needs_input_threadgroup_mem(spvc_compiler compiler)
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.needs_input_threadgroup_mem() ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_msl_add_vertex_attribute(spvc_compiler compiler, const spvc_msl_vertex_attribute *va)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -689,11 +807,17 @@ spvc_result spvc_compiler_msl_add_vertex_attribute(spvc_compiler compiler, const
|
|||
attr.per_instance = va->per_instance;
|
||||
msl.add_msl_vertex_attribute(attr);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)va;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler,
|
||||
const spvc_msl_resource_binding *binding)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -710,10 +834,16 @@ spvc_result spvc_compiler_msl_add_resource_binding(spvc_compiler compiler,
|
|||
bind.msl_sampler = binding->msl_sampler;
|
||||
msl.add_msl_resource_binding(bind);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)binding;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_msl_add_discrete_descriptor_set(spvc_compiler compiler, unsigned desc_set)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -723,10 +853,16 @@ spvc_result spvc_compiler_msl_add_discrete_descriptor_set(spvc_compiler compiler
|
|||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
msl.add_discrete_descriptor_set(desc_set);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)desc_set;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_is_vertex_attribute_used(spvc_compiler compiler, unsigned location)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -735,11 +871,17 @@ spvc_bool spvc_compiler_msl_is_vertex_attribute_used(spvc_compiler compiler, uns
|
|||
|
||||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.is_msl_vertex_attribute_used(location) ? SPVC_TRUE : SPVC_FALSE;
|
||||
#else
|
||||
(void)location;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, SpvExecutionModel model, unsigned set,
|
||||
unsigned binding)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -749,11 +891,19 @@ spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, SpvExecutio
|
|||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
return msl.is_msl_resource_binding_used(static_cast<spv::ExecutionModel>(model), set, binding) ? SPVC_TRUE :
|
||||
SPVC_FALSE;
|
||||
#else
|
||||
(void)model;
|
||||
(void)set;
|
||||
(void)binding;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_msl_remap_constexpr_sampler(spvc_compiler compiler, spvc_variable_id id,
|
||||
const spvc_msl_constexpr_sampler *sampler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -779,11 +929,18 @@ spvc_result spvc_compiler_msl_remap_constexpr_sampler(spvc_compiler compiler, sp
|
|||
samp.border_color = static_cast<MSLSamplerBorderColor>(sampler->border_color);
|
||||
msl.remap_constexpr_sampler(id, samp);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)id;
|
||||
(void)sampler;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_msl_set_fragment_output_components(spvc_compiler compiler, unsigned location,
|
||||
unsigned components)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
if (compiler->backend != SPVC_BACKEND_MSL)
|
||||
{
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
|
@ -793,6 +950,12 @@ spvc_result spvc_compiler_msl_set_fragment_output_components(spvc_compiler compi
|
|||
auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get());
|
||||
msl.set_fragment_output_components(location, components);
|
||||
return SPVC_SUCCESS;
|
||||
#else
|
||||
(void)location;
|
||||
(void)components;
|
||||
compiler->context->report_error("MSL function used on a non-MSL backend.");
|
||||
return SPVC_ERROR_INVALID_ARGUMENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
spvc_result spvc_compiler_compile(spvc_compiler compiler, const char **source)
|
||||
|
@ -860,6 +1023,8 @@ bool spvc_resources_s::copy_resources(const ShaderResources &resources)
|
|||
return false;
|
||||
if (!copy_resources(separate_samplers, resources.separate_samplers))
|
||||
return false;
|
||||
if (!copy_resources(acceleration_structures, resources.acceleration_structures))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -999,6 +1164,10 @@ spvc_result spvc_resources_get_resource_list_for_type(spvc_resources resources,
|
|||
list = &resources->separate_samplers;
|
||||
break;
|
||||
|
||||
case SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE:
|
||||
list = &resources->acceleration_structures;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1624,6 +1793,7 @@ unsigned spvc_msl_get_aux_buffer_struct_version(void)
|
|||
|
||||
void spvc_msl_vertex_attribute_init(spvc_msl_vertex_attribute *attr)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
// Crude, but works.
|
||||
MSLVertexAttr attr_default;
|
||||
attr->location = attr_default.location;
|
||||
|
@ -1633,10 +1803,14 @@ void spvc_msl_vertex_attribute_init(spvc_msl_vertex_attribute *attr)
|
|||
attr->msl_buffer = attr_default.msl_buffer;
|
||||
attr->msl_offset = attr_default.msl_offset;
|
||||
attr->msl_stride = attr_default.msl_stride;
|
||||
#else
|
||||
memset(attr, 0, sizeof(*attr));
|
||||
#endif
|
||||
}
|
||||
|
||||
void spvc_msl_resource_binding_init(spvc_msl_resource_binding *binding)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
MSLResourceBinding binding_default;
|
||||
binding->desc_set = binding_default.desc_set;
|
||||
binding->binding = binding_default.binding;
|
||||
|
@ -1644,10 +1818,14 @@ void spvc_msl_resource_binding_init(spvc_msl_resource_binding *binding)
|
|||
binding->msl_texture = binding_default.msl_texture;
|
||||
binding->msl_sampler = binding_default.msl_sampler;
|
||||
binding->stage = static_cast<SpvExecutionModel>(binding_default.stage);
|
||||
#else
|
||||
memset(binding, 0, sizeof(*binding));
|
||||
#endif
|
||||
}
|
||||
|
||||
void spvc_msl_constexpr_sampler_init(spvc_msl_constexpr_sampler *sampler)
|
||||
{
|
||||
#if SPIRV_CROSS_C_API_MSL
|
||||
MSLConstexprSampler defaults;
|
||||
sampler->anisotropy_enable = defaults.anisotropy_enable ? SPVC_TRUE : SPVC_FALSE;
|
||||
sampler->border_color = static_cast<spvc_msl_sampler_border_color>(defaults.border_color);
|
||||
|
@ -1664,6 +1842,9 @@ void spvc_msl_constexpr_sampler_init(spvc_msl_constexpr_sampler *sampler)
|
|||
sampler->s_address = static_cast<spvc_msl_sampler_address>(defaults.s_address);
|
||||
sampler->t_address = static_cast<spvc_msl_sampler_address>(defaults.t_address);
|
||||
sampler->r_address = static_cast<spvc_msl_sampler_address>(defaults.r_address);
|
||||
#else
|
||||
memset(sampler, 0, sizeof(*sampler));
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned spvc_compiler_get_current_id_bound(spvc_compiler compiler)
|
||||
|
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
/* Bumped if ABI or API breaks backwards compatibility. */
|
||||
#define SPVC_C_API_VERSION_MAJOR 0
|
||||
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
|
||||
#define SPVC_C_API_VERSION_MINOR 3
|
||||
#define SPVC_C_API_VERSION_MINOR 5
|
||||
/* Bumped if internal implementation details change. */
|
||||
#define SPVC_C_API_VERSION_PATCH 0
|
||||
|
||||
|
@ -198,6 +198,7 @@ typedef enum spvc_resource_type
|
|||
SPVC_RESOURCE_TYPE_PUSH_CONSTANT = 9,
|
||||
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
|
||||
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
|
||||
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
|
||||
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
|
||||
} spvc_resource_type;
|
||||
|
||||
|
@ -223,6 +224,7 @@ typedef enum spvc_basetype
|
|||
SPVC_BASETYPE_IMAGE = 16,
|
||||
SPVC_BASETYPE_SAMPLED_IMAGE = 17,
|
||||
SPVC_BASETYPE_SAMPLER = 18,
|
||||
SPVC_BASETYPE_ACCELERATION_STRUCTURE = 19,
|
||||
|
||||
SPVC_BASETYPE_INT_MAX = 0x7fffffff
|
||||
} spvc_basetype;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
using namespace std;
|
||||
using namespace spv;
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
void ParsedIR::set_id_bounds(uint32_t bounds)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
|
||||
// This data structure holds all information needed to perform cross-compilation and reflection.
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
#include "spirv_common.hpp"
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
|
||||
namespace spirv_cross_util
|
||||
{
|
||||
void rename_interface_variable(spirv_cross::Compiler &compiler, const std::vector<spirv_cross::Resource> &resources,
|
||||
void rename_interface_variable(Compiler &compiler, const std::vector<Resource> &resources,
|
||||
uint32_t location, const std::string &name)
|
||||
{
|
||||
for (auto &v : resources)
|
||||
|
@ -49,7 +49,7 @@ void rename_interface_variable(spirv_cross::Compiler &compiler, const std::vecto
|
|||
}
|
||||
}
|
||||
|
||||
void inherit_combined_sampler_bindings(spirv_cross::Compiler &compiler)
|
||||
void inherit_combined_sampler_bindings(Compiler &compiler)
|
||||
{
|
||||
auto &samplers = compiler.get_combined_image_samplers();
|
||||
for (auto &s : samplers)
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
namespace spirv_cross_util
|
||||
{
|
||||
void rename_interface_variable(spirv_cross::Compiler &compiler, const std::vector<spirv_cross::Resource> &resources,
|
||||
void rename_interface_variable(SPIRV_CROSS_NAMESPACE::Compiler &compiler, const std::vector<SPIRV_CROSS_NAMESPACE::Resource> &resources,
|
||||
uint32_t location, const std::string &name);
|
||||
void inherit_combined_sampler_bindings(spirv_cross::Compiler &compiler);
|
||||
void inherit_combined_sampler_bindings(SPIRV_CROSS_NAMESPACE::Compiler &compiler);
|
||||
} // namespace spirv_cross_util
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <locale.h>
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
static bool is_unsigned_opcode(Op op)
|
||||
|
@ -410,6 +410,17 @@ void CompilerGLSL::find_static_extensions()
|
|||
require_extension_internal("GL_ARB_tessellation_shader");
|
||||
break;
|
||||
|
||||
case ExecutionModelRayGenerationNV:
|
||||
case ExecutionModelIntersectionNV:
|
||||
case ExecutionModelAnyHitNV:
|
||||
case ExecutionModelClosestHitNV:
|
||||
case ExecutionModelMissNV:
|
||||
case ExecutionModelCallableNV:
|
||||
if (options.es || options.version < 460)
|
||||
SPIRV_CROSS_THROW("Ray tracing shaders require non-es profile with version 460 or above.");
|
||||
require_extension_internal("GL_NV_ray_tracing");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1644,6 +1655,18 @@ const char *CompilerGLSL::to_storage_qualifiers_glsl(const SPIRVariable &var)
|
|||
{
|
||||
return "uniform ";
|
||||
}
|
||||
else if (var.storage == StorageClassRayPayloadNV)
|
||||
{
|
||||
return "rayPayloadNV ";
|
||||
}
|
||||
else if (var.storage == StorageClassIncomingRayPayloadNV)
|
||||
{
|
||||
return "rayPayloadInNV ";
|
||||
}
|
||||
else if (var.storage == StorageClassHitAttributeNV)
|
||||
{
|
||||
return "hitAttributeNV ";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
@ -2354,7 +2377,9 @@ void CompilerGLSL::emit_resources()
|
|||
}
|
||||
|
||||
if (var.storage != StorageClassFunction && type.pointer &&
|
||||
(type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter) &&
|
||||
(type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter ||
|
||||
type.storage == StorageClassRayPayloadNV || type.storage == StorageClassHitAttributeNV ||
|
||||
type.storage == StorageClassIncomingRayPayloadNV) &&
|
||||
!is_hidden_variable(var))
|
||||
{
|
||||
emit_uniform(var);
|
||||
|
@ -3425,7 +3450,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
|||
if (c.scalar_i16(vector, 0) < 0)
|
||||
SPIRV_CROSS_THROW("Tried to convert uint literal into int, but this made the literal negative.");
|
||||
}
|
||||
else if (backend.uint16_t_literal_suffix)
|
||||
else
|
||||
res += backend.uint16_t_literal_suffix;
|
||||
}
|
||||
else
|
||||
|
@ -3445,7 +3470,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
|||
SPIRV_CROSS_THROW(
|
||||
"Tried to convert uint literal into int, but this made the literal negative.");
|
||||
}
|
||||
else if (backend.uint16_t_literal_suffix)
|
||||
else
|
||||
res += backend.uint16_t_literal_suffix;
|
||||
}
|
||||
|
||||
|
@ -3459,8 +3484,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
|||
if (splat)
|
||||
{
|
||||
res += convert_to_string(c.scalar_i16(vector, 0));
|
||||
if (backend.int16_t_literal_suffix)
|
||||
res += backend.int16_t_literal_suffix;
|
||||
res += backend.int16_t_literal_suffix;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3471,8 +3495,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
|||
else
|
||||
{
|
||||
res += convert_to_string(c.scalar_i16(vector, i));
|
||||
if (backend.int16_t_literal_suffix)
|
||||
res += backend.int16_t_literal_suffix;
|
||||
res += backend.int16_t_literal_suffix;
|
||||
}
|
||||
if (i + 1 < c.vector_size())
|
||||
res += ", ";
|
||||
|
@ -3761,6 +3784,63 @@ void CompilerGLSL::emit_binary_func_op(uint32_t result_type, uint32_t result_id,
|
|||
inherit_expression_dependencies(result_id, op1);
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_unary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op,
|
||||
SPIRType::BaseType input_type, SPIRType::BaseType expected_result_type)
|
||||
{
|
||||
auto &out_type = get<SPIRType>(result_type);
|
||||
auto expected_type = out_type;
|
||||
expected_type.basetype = input_type;
|
||||
string cast_op = expression_type(op0).basetype != input_type ? bitcast_glsl(expected_type, op0) : to_expression(op0);
|
||||
|
||||
string expr;
|
||||
if (out_type.basetype != expected_result_type)
|
||||
{
|
||||
expected_type.basetype = expected_result_type;
|
||||
expr = bitcast_glsl_op(out_type, expected_type);
|
||||
expr += '(';
|
||||
expr += join(op, "(", cast_op, ")");
|
||||
expr += ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
expr += join(op, "(", cast_op, ")");
|
||||
}
|
||||
|
||||
emit_op(result_type, result_id, expr, should_forward(op0));
|
||||
inherit_expression_dependencies(result_id, op0);
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_trinary_func_op_cast(uint32_t result_type, uint32_t result_id,
|
||||
uint32_t op0, uint32_t op1, uint32_t op2,
|
||||
const char *op,
|
||||
SPIRType::BaseType input_type)
|
||||
{
|
||||
auto &out_type = get<SPIRType>(result_type);
|
||||
auto expected_type = out_type;
|
||||
expected_type.basetype = input_type;
|
||||
string cast_op0 = expression_type(op0).basetype != input_type ? bitcast_glsl(expected_type, op0) : to_expression(op0);
|
||||
string cast_op1 = expression_type(op1).basetype != input_type ? bitcast_glsl(expected_type, op1) : to_expression(op1);
|
||||
string cast_op2 = expression_type(op2).basetype != input_type ? bitcast_glsl(expected_type, op2) : to_expression(op2);
|
||||
|
||||
string expr;
|
||||
if (out_type.basetype != input_type)
|
||||
{
|
||||
expr = bitcast_glsl_op(out_type, expected_type);
|
||||
expr += '(';
|
||||
expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")");
|
||||
expr += ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")");
|
||||
}
|
||||
|
||||
emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1) && should_forward(op2));
|
||||
inherit_expression_dependencies(result_id, op0);
|
||||
inherit_expression_dependencies(result_id, op1);
|
||||
inherit_expression_dependencies(result_id, op2);
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_binary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1,
|
||||
const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type)
|
||||
{
|
||||
|
@ -4658,13 +4738,18 @@ string CompilerGLSL::to_function_args(uint32_t img, const SPIRType &imgtype, boo
|
|||
return farg_str;
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t)
|
||||
void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t length)
|
||||
{
|
||||
auto op = static_cast<GLSLstd450>(eop);
|
||||
|
||||
if (is_legacy() && is_unsigned_glsl_opcode(op))
|
||||
SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy GLSL targets.");
|
||||
|
||||
// If we need to do implicit bitcasts, make sure we do it with the correct type.
|
||||
uint32_t integer_width = get_integer_width_for_glsl_instruction(op, args, length);
|
||||
auto int_type = to_signed_basetype(integer_width);
|
||||
auto uint_type = to_unsigned_basetype(integer_width);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
// FP fiddling
|
||||
|
@ -4683,10 +4768,14 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|||
emit_unary_func_op(result_type, id, args[0], "trunc");
|
||||
break;
|
||||
case GLSLstd450SAbs:
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "abs", int_type, int_type);
|
||||
break;
|
||||
case GLSLstd450FAbs:
|
||||
emit_unary_func_op(result_type, id, args[0], "abs");
|
||||
break;
|
||||
case GLSLstd450SSign:
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "sign", int_type, int_type);
|
||||
break;
|
||||
case GLSLstd450FSign:
|
||||
emit_unary_func_op(result_type, id, args[0], "sign");
|
||||
break;
|
||||
|
@ -4729,21 +4818,41 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|||
|
||||
// Minmax
|
||||
case GLSLstd450UMin:
|
||||
case GLSLstd450FMin:
|
||||
emit_binary_func_op_cast(result_type, id, args[0], args[1], "min", uint_type, false);
|
||||
break;
|
||||
|
||||
case GLSLstd450SMin:
|
||||
emit_binary_func_op_cast(result_type, id, args[0], args[1], "min", int_type, false);
|
||||
break;
|
||||
|
||||
case GLSLstd450FMin:
|
||||
emit_binary_func_op(result_type, id, args[0], args[1], "min");
|
||||
break;
|
||||
|
||||
case GLSLstd450FMax:
|
||||
case GLSLstd450UMax:
|
||||
case GLSLstd450SMax:
|
||||
emit_binary_func_op(result_type, id, args[0], args[1], "max");
|
||||
break;
|
||||
|
||||
case GLSLstd450UMax:
|
||||
emit_binary_func_op_cast(result_type, id, args[0], args[1], "max", uint_type, false);
|
||||
break;
|
||||
|
||||
case GLSLstd450SMax:
|
||||
emit_binary_func_op_cast(result_type, id, args[0], args[1], "max", int_type, false);
|
||||
break;
|
||||
|
||||
case GLSLstd450FClamp:
|
||||
case GLSLstd450UClamp:
|
||||
case GLSLstd450SClamp:
|
||||
emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "clamp");
|
||||
break;
|
||||
|
||||
case GLSLstd450UClamp:
|
||||
emit_trinary_func_op_cast(result_type, id, args[0], args[1], args[2], "clamp", uint_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450SClamp:
|
||||
emit_trinary_func_op_cast(result_type, id, args[0], args[1], args[2], "clamp", int_type);
|
||||
break;
|
||||
|
||||
// Trig
|
||||
case GLSLstd450Sin:
|
||||
emit_unary_func_op(result_type, id, args[0], "sin");
|
||||
|
@ -4918,9 +5027,13 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|||
case GLSLstd450FindILsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "findLSB");
|
||||
break;
|
||||
|
||||
case GLSLstd450FindSMsb:
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "findMSB", int_type, int_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450FindUMsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "findMSB");
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "findMSB", uint_type, int_type); // findMSB always returns int.
|
||||
break;
|
||||
|
||||
// Multisampled varying
|
||||
|
@ -5666,6 +5779,35 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
|||
require_extension_internal("GL_KHR_shader_subgroup_ballot");
|
||||
return "gl_SubgroupLtMask";
|
||||
|
||||
case BuiltInLaunchIdNV:
|
||||
return "gl_LaunchIDNV";
|
||||
case BuiltInLaunchSizeNV:
|
||||
return "gl_LaunchSizeNV";
|
||||
case BuiltInWorldRayOriginNV:
|
||||
return "gl_WorldRayOriginNV";
|
||||
case BuiltInWorldRayDirectionNV:
|
||||
return "gl_WorldRayDirectionNV";
|
||||
case BuiltInObjectRayOriginNV:
|
||||
return "gl_ObjectRayOriginNV";
|
||||
case BuiltInObjectRayDirectionNV:
|
||||
return "gl_ObjectRayDirectionNV";
|
||||
case BuiltInRayTminNV:
|
||||
return "gl_RayTminNV";
|
||||
case BuiltInRayTmaxNV:
|
||||
return "gl_RayTmaxNV";
|
||||
case BuiltInInstanceCustomIndexNV:
|
||||
return "gl_InstanceCustomIndexNV";
|
||||
case BuiltInObjectToWorldNV:
|
||||
return "gl_ObjectToWorldNV";
|
||||
case BuiltInWorldToObjectNV:
|
||||
return "gl_WorldToObjectNV";
|
||||
case BuiltInHitTNV:
|
||||
return "gl_HitTNV";
|
||||
case BuiltInHitKindNV:
|
||||
return "gl_HitKindNV";
|
||||
case BuiltInIncomingRayFlagsNV:
|
||||
return "gl_IncomingRayFlagsNV";
|
||||
|
||||
default:
|
||||
return join("gl_BuiltIn_", convert_to_string(builtin));
|
||||
}
|
||||
|
@ -6890,6 +7032,33 @@ uint32_t CompilerGLSL::get_integer_width_for_instruction(const Instruction &inst
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t CompilerGLSL::get_integer_width_for_glsl_instruction(GLSLstd450 op, const uint32_t *ops, uint32_t length) const
|
||||
{
|
||||
if (length < 1)
|
||||
return 32;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case GLSLstd450SAbs:
|
||||
case GLSLstd450SSign:
|
||||
case GLSLstd450UMin:
|
||||
case GLSLstd450SMin:
|
||||
case GLSLstd450UMax:
|
||||
case GLSLstd450SMax:
|
||||
case GLSLstd450UClamp:
|
||||
case GLSLstd450SClamp:
|
||||
case GLSLstd450FindSMsb:
|
||||
case GLSLstd450FindUMsb:
|
||||
return expression_type(ops[0]).width;
|
||||
|
||||
default:
|
||||
{
|
||||
// We don't need to care about other opcodes, just return 32.
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
||||
{
|
||||
auto ops = stream(instruction);
|
||||
|
@ -7444,9 +7613,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
|
||||
auto &type0 = expression_type(vec0);
|
||||
|
||||
// If we have the undefined swizzle index -1, we need to swizzle in undefined data,
|
||||
// or in our case, T(0).
|
||||
bool shuffle = false;
|
||||
for (uint32_t i = 0; i < length; i++)
|
||||
if (elems[i] >= type0.vecsize)
|
||||
if (elems[i] >= type0.vecsize || elems[i] == 0xffffffffu)
|
||||
shuffle = true;
|
||||
|
||||
// Cannot use swizzles with packed expressions, force shuffle path.
|
||||
|
@ -7465,7 +7636,17 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
vector<string> args;
|
||||
for (uint32_t i = 0; i < length; i++)
|
||||
{
|
||||
if (elems[i] >= type0.vecsize)
|
||||
if (elems[i] == 0xffffffffu)
|
||||
{
|
||||
// Use a constant 0 here.
|
||||
// We could use the first component or similar, but then we risk propagating
|
||||
// a value we might not need, and bog down codegen.
|
||||
SPIRConstant c;
|
||||
c.constant_type = type0.parent_type;
|
||||
assert(type0.parent_type != 0);
|
||||
args.push_back(constant_expression(c));
|
||||
}
|
||||
else if (elems[i] >= type0.vecsize)
|
||||
args.push_back(to_extract_component_expression(vec1, elems[i] - type0.vecsize));
|
||||
else
|
||||
args.push_back(to_extract_component_expression(vec0, elems[i]));
|
||||
|
@ -7482,7 +7663,10 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
expr += to_enclosed_unpacked_expression(vec0);
|
||||
expr += ".";
|
||||
for (uint32_t i = 0; i < length; i++)
|
||||
{
|
||||
assert(elems[i] != 0xffffffffu);
|
||||
expr += index_to_swizzle(elems[i]);
|
||||
}
|
||||
|
||||
if (backend.swizzle_is_function && length > 1)
|
||||
expr += "()";
|
||||
|
@ -8965,6 +9149,25 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||
GLSL_BFOP(unsupported_FUnordGreaterThanEqual);
|
||||
break;
|
||||
|
||||
case OpReportIntersectionNV:
|
||||
statement("reportIntersectionNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");");
|
||||
break;
|
||||
case OpIgnoreIntersectionNV:
|
||||
statement("ignoreIntersectionNV();");
|
||||
break;
|
||||
case OpTerminateRayNV:
|
||||
statement("terminateRayNV();");
|
||||
break;
|
||||
case OpTraceNV:
|
||||
statement("traceNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ", ", to_expression(ops[2]), ", ",
|
||||
to_expression(ops[3]), ", ", to_expression(ops[4]), ", ", to_expression(ops[5]), ", ",
|
||||
to_expression(ops[6]), ", ", to_expression(ops[7]), ", ", to_expression(ops[8]), ", ",
|
||||
to_expression(ops[9]), ", ", to_expression(ops[10]), ");");
|
||||
break;
|
||||
case OpExecuteCallableNV:
|
||||
statement("executeCallableNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");");
|
||||
break;
|
||||
|
||||
default:
|
||||
statement("// unimplemented op ", instruction.op);
|
||||
break;
|
||||
|
@ -9513,6 +9716,9 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id)
|
|||
// this distinction into the type system.
|
||||
return comparison_ids.count(id) ? "samplerShadow" : "sampler";
|
||||
|
||||
case SPIRType::AccelerationStructureNV:
|
||||
return "accelerationStructureNV";
|
||||
|
||||
case SPIRType::Void:
|
||||
return "void";
|
||||
|
||||
|
@ -11142,7 +11348,7 @@ void CompilerGLSL::unroll_array_from_complex_load(uint32_t target_id, uint32_t s
|
|||
}
|
||||
|
||||
void CompilerGLSL::bitcast_from_builtin_load(uint32_t source_id, std::string &expr,
|
||||
const spirv_cross::SPIRType &expr_type)
|
||||
const SPIRType &expr_type)
|
||||
{
|
||||
auto *var = maybe_get_backing_variable(source_id);
|
||||
if (var)
|
||||
|
@ -11190,7 +11396,7 @@ void CompilerGLSL::bitcast_from_builtin_load(uint32_t source_id, std::string &ex
|
|||
}
|
||||
|
||||
void CompilerGLSL::bitcast_to_builtin_store(uint32_t target_id, std::string &expr,
|
||||
const spirv_cross::SPIRType &expr_type)
|
||||
const SPIRType &expr_type)
|
||||
{
|
||||
// Only interested in standalone builtin variables.
|
||||
if (!has_decoration(target_id, DecorationBuiltIn))
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
enum PlsFormat
|
||||
{
|
||||
|
@ -429,8 +429,14 @@ protected:
|
|||
void emit_trinary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2,
|
||||
const char *op);
|
||||
void emit_binary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op);
|
||||
|
||||
void emit_unary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op,
|
||||
SPIRType::BaseType input_type, SPIRType::BaseType expected_result_type);
|
||||
void emit_binary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op,
|
||||
SPIRType::BaseType input_type, bool skip_cast_if_equal_type);
|
||||
void emit_trinary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, const char *op,
|
||||
SPIRType::BaseType input_type);
|
||||
|
||||
void emit_unary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op);
|
||||
void emit_unrolled_unary_op(uint32_t result_type, uint32_t result_id, uint32_t operand, const char *op);
|
||||
void emit_binary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op);
|
||||
|
@ -635,6 +641,7 @@ protected:
|
|||
virtual void emit_store_statement(uint32_t lhs_expression, uint32_t rhs_expression);
|
||||
|
||||
uint32_t get_integer_width_for_instruction(const Instruction &instr) const;
|
||||
uint32_t get_integer_width_for_glsl_instruction(GLSLstd450 op, const uint32_t *arguments, uint32_t length) const;
|
||||
|
||||
bool variable_is_lut(const SPIRVariable &var) const;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
static unsigned image_format_to_components(ImageFormat fmt)
|
||||
|
@ -3049,7 +3049,12 @@ string CompilerHLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
|||
|
||||
void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t count)
|
||||
{
|
||||
GLSLstd450 op = static_cast<GLSLstd450>(eop);
|
||||
auto op = static_cast<GLSLstd450>(eop);
|
||||
|
||||
// If we need to do implicit bitcasts, make sure we do it with the correct type.
|
||||
uint32_t integer_width = get_integer_width_for_glsl_instruction(op, args, count);
|
||||
auto int_type = to_signed_basetype(integer_width);
|
||||
auto uint_type = to_unsigned_basetype(integer_width);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
|
@ -3189,9 +3194,13 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|||
case GLSLstd450FindILsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "firstbitlow");
|
||||
break;
|
||||
|
||||
case GLSLstd450FindSMsb:
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "firstbithigh", int_type, int_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450FindUMsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "firstbithigh");
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "firstbithigh", uint_type, uint_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450MatrixInverse:
|
||||
|
@ -4624,7 +4633,7 @@ string CompilerHLSL::compile()
|
|||
backend.double_literal_suffix = false;
|
||||
backend.long_long_literal_suffix = true;
|
||||
backend.uint32_t_literal_suffix = true;
|
||||
backend.int16_t_literal_suffix = nullptr;
|
||||
backend.int16_t_literal_suffix = "";
|
||||
backend.uint16_t_literal_suffix = "u";
|
||||
backend.basic_int_type = "int";
|
||||
backend.basic_uint_type = "uint";
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
// Interface which remaps vertex inputs to a fixed semantic name to make linking easier.
|
||||
struct HLSLVertexAttributeRemap
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <numeric>
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
static const uint32_t k_unknown_location = ~0u;
|
||||
|
@ -563,7 +563,7 @@ string CompilerMSL::compile()
|
|||
backend.null_pointer_literal = "nullptr";
|
||||
backend.float_literal_suffix = false;
|
||||
backend.uint32_t_literal_suffix = true;
|
||||
backend.int16_t_literal_suffix = nullptr;
|
||||
backend.int16_t_literal_suffix = "";
|
||||
backend.uint16_t_literal_suffix = "u";
|
||||
backend.basic_int_type = "int";
|
||||
backend.basic_uint_type = "uint";
|
||||
|
@ -2952,7 +2952,7 @@ void CompilerMSL::emit_specialization_constants_and_structs()
|
|||
// TODO: This can be expressed as a [[threads_per_threadgroup]] input semantic, but we need to know
|
||||
// the work group size at compile time in SPIR-V, and [[threads_per_threadgroup]] would need to be passed around as a global.
|
||||
// The work group size may be a specialization constant.
|
||||
statement("constant uint3 ", builtin_to_glsl(BuiltInWorkgroupSize, StorageClassWorkgroup), " = ",
|
||||
statement("constant uint3 ", builtin_to_glsl(BuiltInWorkgroupSize, StorageClassWorkgroup), " [[maybe_unused]] = ",
|
||||
constant_expression(get<SPIRConstant>(workgroup_size_id)), ";");
|
||||
emitted = true;
|
||||
}
|
||||
|
@ -4085,7 +4085,12 @@ const char *CompilerMSL::get_memory_order(uint32_t)
|
|||
// Override for MSL-specific extension syntax instructions
|
||||
void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t count)
|
||||
{
|
||||
GLSLstd450 op = static_cast<GLSLstd450>(eop);
|
||||
auto op = static_cast<GLSLstd450>(eop);
|
||||
|
||||
// If we need to do implicit bitcasts, make sure we do it with the correct type.
|
||||
uint32_t integer_width = get_integer_width_for_glsl_instruction(op, args, count);
|
||||
auto int_type = to_signed_basetype(integer_width);
|
||||
auto uint_type = to_unsigned_basetype(integer_width);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
|
@ -4100,10 +4105,11 @@ void CompilerMSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|||
break;
|
||||
|
||||
case GLSLstd450FindSMsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "findSMSB");
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "findSMSB", int_type, int_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450FindUMsb:
|
||||
emit_unary_func_op(result_type, id, args[0], "findUMSB");
|
||||
emit_unary_func_op_cast(result_type, id, args[0], "findUMSB", uint_type, uint_type);
|
||||
break;
|
||||
|
||||
case GLSLstd450PackSnorm4x8:
|
||||
|
@ -5400,7 +5406,12 @@ string CompilerMSL::get_argument_address_space(const SPIRVariable &argument)
|
|||
|
||||
case StorageClassStorageBuffer:
|
||||
{
|
||||
bool readonly = ir.get_buffer_block_flags(argument).get(DecorationNonWritable);
|
||||
// For arguments from variable pointers, we use the write count deduction, so
|
||||
// we should not assume any constness here. Only for global SSBOs.
|
||||
bool readonly = false;
|
||||
if (has_decoration(type.self, DecorationBlock))
|
||||
readonly = ir.get_buffer_block_flags(argument).get(DecorationNonWritable);
|
||||
|
||||
return readonly ? "const device" : "device";
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
|
||||
// Indicates the format of the vertex attribute. Currently limited to specifying
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using namespace std;
|
||||
using namespace spv;
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
Parser::Parser(std::vector<uint32_t> spirv)
|
||||
{
|
||||
|
@ -645,6 +645,14 @@ void Parser::parse(const Instruction &instruction)
|
|||
break;
|
||||
}
|
||||
|
||||
case OpTypeAccelerationStructureNV:
|
||||
{
|
||||
uint32_t id = ops[0];
|
||||
auto &type = set<SPIRType>(id);
|
||||
type.basetype = SPIRType::AccelerationStructureNV;
|
||||
break;
|
||||
}
|
||||
|
||||
// Variable declaration
|
||||
// All variables are essentially pointers with a storage qualifier.
|
||||
case OpVariable:
|
||||
|
@ -767,6 +775,7 @@ void Parser::parse(const Instruction &instruction)
|
|||
// We do not know their value, so any attempt to query SPIRConstant later
|
||||
// will fail. We can only propagate the ID of the expression and use to_expression on it.
|
||||
auto *constant_op = maybe_get<SPIRConstantOp>(ops[2 + i]);
|
||||
auto *undef_op = maybe_get<SPIRUndef>(ops[2 + i]);
|
||||
if (constant_op)
|
||||
{
|
||||
if (op == OpConstantComposite)
|
||||
|
@ -778,6 +787,13 @@ void Parser::parse(const Instruction &instruction)
|
|||
remapped_constant_ops[i].specialization = true;
|
||||
c[i] = &remapped_constant_ops[i];
|
||||
}
|
||||
else if (undef_op)
|
||||
{
|
||||
// Undefined, just pick 0.
|
||||
remapped_constant_ops[i].make_null(get<SPIRType>(undef_op->basetype));
|
||||
remapped_constant_ops[i].constant_type = undef_op->basetype;
|
||||
c[i] = &remapped_constant_ops[i];
|
||||
}
|
||||
else
|
||||
c[i] = &get<SPIRConstant>(ops[2 + i]);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
class Parser
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <iomanip>
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace SPIRV_CROSS_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
namespace simple_json
|
||||
|
@ -365,9 +365,9 @@ string CompilerReflection::execution_model_to_str(spv::ExecutionModel model)
|
|||
{
|
||||
switch (model)
|
||||
{
|
||||
case spv::ExecutionModelVertex:
|
||||
case ExecutionModelVertex:
|
||||
return "vert";
|
||||
case spv::ExecutionModelTessellationControl:
|
||||
case ExecutionModelTessellationControl:
|
||||
return "tesc";
|
||||
case ExecutionModelTessellationEvaluation:
|
||||
return "tese";
|
||||
|
@ -377,6 +377,18 @@ string CompilerReflection::execution_model_to_str(spv::ExecutionModel model)
|
|||
return "frag";
|
||||
case ExecutionModelGLCompute:
|
||||
return "comp";
|
||||
case ExecutionModelRayGenerationNV:
|
||||
return "rgen";
|
||||
case ExecutionModelIntersectionNV:
|
||||
return "rint";
|
||||
case ExecutionModelAnyHitNV:
|
||||
return "rahit";
|
||||
case ExecutionModelClosestHitNV:
|
||||
return "rchit";
|
||||
case ExecutionModelMissNV:
|
||||
return "rmiss";
|
||||
case ExecutionModelCallableNV:
|
||||
return "rcall";
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
|
@ -424,6 +436,7 @@ void CompilerReflection::emit_resources()
|
|||
emit_resources("ubos", res.uniform_buffers);
|
||||
emit_resources("push_constants", res.push_constant_buffers);
|
||||
emit_resources("counters", res.atomic_counters);
|
||||
emit_resources("acceleration_structures", res.acceleration_structures);
|
||||
}
|
||||
|
||||
void CompilerReflection::emit_resources(const char *tag, const vector<Resource> &resources)
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace simple_json
|
|||
class Stream;
|
||||
}
|
||||
|
||||
namespace spirv_cross
|
||||
namespace SPIRV_CROSS_NAMESPACE
|
||||
{
|
||||
class CompilerReflection : public CompilerGLSL
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue