Rework API graphique Vulkan - EnTT pour ECS + Chargement modèle 3D assimp + SDL3 pour events input et fenetre + mesh texture camera transform ok + attention tous les assets nouveaus ne sont pas commités et il y a du code test en dur dans scene addentity + restructuration globale

This commit is contained in:
Tom Ray
2026-03-14 20:24:17 +01:00
parent 7c352bc280
commit 6695d46bcd
672 changed files with 238656 additions and 1821 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
build
.vscode
.cache

View File

@@ -39,16 +39,6 @@ if(UNIX)
# endif() # endif()
# --------------------------------------- # ---------------------------------------
# --------- Inclusion de Vulkan ----------
# Vulkan Lib pour charger Vulkan, fournit avec les drivers, donc se trouve toute seul.
# find_package(Vulkan REQUIRED)
# if(VULKAN_FOUND)
# message("lib OpenGL Trouvé")
# else()
# message("lib OpenGL Introuvable")
# endif()
# ---------------------------------------
# ---------- Inclusion de GLM ----------- # ---------- Inclusion de GLM -----------
# GLM Lib pour mathématique, en mode header only. # GLM Lib pour mathématique, en mode header only.
set(GLMlib_DIR ./lib/CMake/Linux) set(GLMlib_DIR ./lib/CMake/Linux)
@@ -208,12 +198,12 @@ if(UNIX)
# ---------- Inclusion de ASSIMP ----------- # ---------- Inclusion de ASSIMP -----------
# Assimp Lib import modèles 3D. # Assimp Lib import modèles 3D.
# find_package(assimp REQUIRED) find_package(assimp REQUIRED)
# if(assimp_FOUND) if(assimp_FOUND)
# message("lib ASSIMP Trouvé") message("lib ASSIMP Trouvé")
# else() else()
# message("lib ASSIMP Introuvable") message("lib ASSIMP Introuvable")
# endif() endif()
# --------------------------------------- # ---------------------------------------
# ---------- Inclusion de ODE ----------- # ---------- Inclusion de ODE -----------
@@ -265,17 +255,158 @@ else()
message("lib Catch2 Introuvable") message("lib Catch2 Introuvable")
endif() endif()
# ---------- Inclusion de SDL3-----------
# la sdl3
find_package(SDL3 REQUIRED)
# These tests can use the Catch2-provided main
if(SDL3_found)
message("lib Catch2 Trouvé")
else()
message("lib Catch2 Introuvable")
endif() endif()
# ---------- Inclusion de Vulkan-----------
# vulkan
# --------- Inclusion de Vulkan ----------
# Vulkan Lib pour charger Vulkan, fournit avec les drivers, donc se trouve toute seul.
find_package(Vulkan REQUIRED)
if(VULKAN_FOUND)
message("lib OpenGL Trouvé")
else()
message("lib OpenGL Introuvable")
endif()
# ---------------------------------------
# ------- Inclusion de SDL2_IMAGE --------
# SDL2_IMAGE Lib pour charger une image
# Les autre plateforme (Linux...) ont un installateur de paquet, la lib se trouve toute seul.
find_package(SDL3_image QUIET)
# #find_library(SDL2_image libSDL2_image)
if(SDL3_image_FOUND)
message("lib SDL3_IMAGE Trouvé")
else()
message("lib SDL3_IMAGE Introuvable")
endif()
# ---------------------------------------
# ------- Inclusion de SDL3_TTF --------
#SDL3_IMAGE Lib pour charger une police d'écriture.
#set(SDL3_ttf_DIR ./lib/CMake/Linux)
# Les autre plateforme (Linux...) ont un installateur de paquet, la lib se trouve toute seul.
find_package(SDL3_ttf QUIET)
#find_library(SDL2_ttf libSDL2_ttf)
if(SDL3_ttf_FOUND)
message("lib SDL3_TTF Trouvé")
else()
message("lib SDL3_TTF Introuvable")
endif()
# ---------------------------------------
# ------- Inclusion de Spirv-cross --------
#Spirv-cross pour metadonnees shader spirv
# set(spirv_cross_core_DIR ./lib/CMake/Linux/spirv-crossConf)
# set(spirv_cross_glsl_DIR ./lib/CMake/Linux/spirv-crossConf)
# Les autre plateforme (Linux...) ont un installateur de paquet, la lib se trouve toute seul.
# find_package(spirv_cross_core QUIET)
# find_package(spirv_cross_glsl QUIET)
#find_library(SDL2_ttf libSDL2_ttf)
# if(spirv_cross_core_FOUND AND spirv_cross_glsl_FOUND)
# message("lib spirv_cross Trouvé")
# else()
# message("lib spirv_cross Introuvable")
# endif()
# ---------------------------------------
# ------- Inclusion de Spirv-cross --------
#Spirv-cross pour metadonnees shader spirv
set(spirvreflectlib_DIR ./lib/CMake/Linux/)
# Les autre plateforme (Linux...) ont un installateur de paquet, la lib se trouve toute seul.
# find_package(spirv_cross_core QUIET)
find_package(spirvreflectlib QUIET)
if(spirvreflectlib_FOUND)
message("lib spirvReflect Trouvé")
else()
message("lib spirvReflect Introuvable")
endif()
# ---------------------------------------
add_library(spirv-reflect STATIC ${SPIRV_EXT_SRC})
# ------- Inclusion de JSONfMC++ --------
# JSONfMC++ Lib pour gestion fichier JSON, en mode header only.
set(VulkanMemoryAllocatorlib_DIR ./lib/CMake/Linux)
find_package(VulkanMemoryAllocatorlib REQUIRED)
if(VulkanMemoryAllocatorlib_FOUND)
message("lib VulkanMemoryAllocator Trouvé")
else()
message("lib VulkanMemoryAllocator Introuvable")
endif()
# ---------------------------------------
endif()
# Chemin executable # Chemin executable
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/${CMAKE_BUILD_TYPE}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/${CMAKE_BUILD_TYPE}")
set(PATH_TO_SHADER_BUILD_TYPE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
function(compile_slang_shaders SLANG_FILES OUTPUT_DIR)
set(SLANG_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/lib/All/slang/bin/slangc)
set(GENERATED_SPV_FILES "")
set (SHADERS_DIR ${PATH_TO_SHADER_BUILD_TYPE}/assets/shaders/slang)
set (ENTRY_POINTS -entry vertMain -entry fragMain)
foreach(SLANG_FILE ${SLANG_FILES})
get_filename_component(FILE_NAME ${SLANG_FILE} NAME_WE)
# Un seul fichier de sortie par shader source
set(OUTPUT_FILE "${OUTPUT_DIR}/${FILE_NAME}.spv")
# Compiler tout le shader en un seul SPIR-V
add_custom_command(
OUTPUT ${OUTPUT_FILE}
COMMAND ${SLANG_COMPILER}
${SLANG_FILE}
-target spirv
-profile spirv_1_4
-emit-spirv-directly
-o ${OUTPUT_FILE}
DEPENDS ${SLANG_FILE}
COMMENT "Compiling Slang shader ${FILE_NAME} → ${OUTPUT_FILE}"
VERBATIM
)
list(APPEND GENERATED_SPV_FILES ${OUTPUT_FILE})
endforeach()
set(GENERATED_SPV_FILES ${GENERATED_SPV_FILES} PARENT_SCOPE)
endfunction()
# On indique que l'on veut un exécutable nommé PROJECT compilé à partir des fichiers décrits par les variables SRCS et HEADERS.
add_library(Engine SHARED ${SRCS_ENGINE} ${SRCS_EXTERNAL_GLAD}) add_library(Engine SHARED ${SRCS_ENGINE} ${SRCS_EXTERNAL_GLAD})
add_executable(${PROJECT} ${SRCS}) add_executable(${PROJECT} ${SRCS})
add_dependencies(${PROJECT} Engine)
add_executable(CosmicTest ${SRCS_TESTS}) add_executable(CosmicTest ${SRCS_TESTS})
# On indique que l'on veut un exécutable nommé PROJECT compilé à partir des fichiers décrits par les variables SRCS et HEADERS.
file(GLOB_RECURSE SLANG_SHADERS "${PATH_TO_SHADER_BUILD_TYPE}/assets/shaders/slang/*.slang")
compile_slang_shaders("${SLANG_SHADERS}" "${PATH_TO_SHADER_BUILD_TYPE}/assets/shaders/slang/spv")
message(STATUS "GENERATED_SPV_FILES = ${GENERATED_SPV_FILES}")
# Créer la target ICI, au niveau global
if(GENERATED_SPV_FILES)
add_custom_target(CompileSlangShaders ALL
DEPENDS ${GENERATED_SPV_FILES}
)
endif()
add_dependencies(${PROJECT} Engine)
add_dependencies(Engine CompileSlangShaders)
target_link_libraries(CosmicTest PRIVATE Catch2::Catch2WithMain Engine) target_link_libraries(CosmicTest PRIVATE Catch2::Catch2WithMain Engine)
# Fichier include # Fichier include
@@ -295,9 +426,12 @@ include_directories(${GLM_INCLUDE_DIRS})
include_directories(${JSONFMCPP_INCLUDE_DIRS}) include_directories(${JSONFMCPP_INCLUDE_DIRS})
#ENTT #ENTT
include_directories(${ENTT_INCLUDE_DIRS}) include_directories(${ENTT_INCLUDE_DIRS})
#include_directories(${SPIRV_INCLUDE_DIRS})
include_directories(${SPIRV_REFLECT_INCLUDE_DIRS})
include_directories(${VMA_INCLUDE_DIRS})
# ASSIMP # ASSIMP
#include_directories(${ASSIMP_INCLUDE_DIRS}) include_directories(${ASSIMP_INCLUDE_DIRS})
# ODE # ODE
#include_directories(${ODE_INCLUDE_DIRS}) #include_directories(${ODE_INCLUDE_DIRS})
# SNDFILE # SNDFILE
@@ -314,21 +448,28 @@ include_directories(${ENTT_INCLUDE_DIRS})
# SDL2 # SDL2
#target_link_libraries(Engine ${SDL2_LIBRARIES}) #target_link_libraries(Engine ${SDL2_LIBRARIES})
target_link_libraries(Engine SDL3::SDL3)
# GLEW # GLEW
#target_link_libraries(Engine ${GLEW_LIBRARIES}) #target_link_libraries(Engine ${GLEW_LIBRARIES})
# SDL2_image # SDL2_image
#target_link_libraries(Engine SDL2_image) #target_link_libraries(Engine SDL2_image)
target_link_libraries(Engine SDL3_image)
# SDL2_ttf # SDL2_ttf
#target_link_libraries(Engine SDL2_ttf) #target_link_libraries(Engine SDL2_ttf)
target_link_libraries(Engine SDL3_ttf)
# Boost # Boost
#Vulkan
target_link_libraries(Engine Vulkan::Vulkan)
target_link_libraries(Engine spirv-reflect)
#target_link_libraries(Engine spirv-cross-glsl spirv-cross-core)
# ASSIMP # ASSIMP
#target_link_libraries(Engine ${ASSIMP_LIBRARIES}) target_link_libraries(Engine ${ASSIMP_LIBRARIES})
# ODE # ODE
@@ -368,7 +509,7 @@ endif()
# Paramètre de compilation # Paramètre de compilation
if (UNIX) if (UNIX)
set(CMAKE_CXX_FLAGS "-Wall -ldl -fPIC") set(CMAKE_CXX_FLAGS "-Wall -fPIC")
endif () endif ()
# Valgrind ne marche que pour Linux... # Valgrind ne marche que pour Linux...

View File

@@ -0,0 +1,31 @@
static float2 positions[3] = float2[](
float2(0.0, -0.5),
float2(0.5, 0.5),
float2(-0.5, 0.5)
);
static float3 colors[3] = float3[](
float3(1.0, 0.0, 0.0),
float3(0.0, 1.0, 0.0),
float3(0.0, 0.0, 1.0)
);
struct VertexOutput {
float3 color;
float4 sv_position : SV_Position;
};
[shader("vertex")]
VertexOutput vertMain(uint vid : SV_VertexID) {
VertexOutput output;
output.sv_position = float4(positions[vid], 0.0, 1.0);
output.color = colors[vid];
return output;
}
[shader("fragment")]
float4 fragMain(VertexOutput inVert) : SV_Target
{
float3 color = inVert.color;
return float4(color, 1.0);
}

View File

@@ -0,0 +1,7 @@
---
Language: Cpp
BasedOnStyle: Google
DerivePointerAlignment: false
SortIncludes: true
ColumnLimit: 132
...

View File

@@ -0,0 +1,2 @@
# rerun clang-format with 132 line width
dc6582bf8c1520a632dca98b11974048ad89fe16

View File

@@ -0,0 +1,47 @@
name: Code formatting check
on:
pull_request:
# Cancel previous runs if a more recent commit is pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions: read-all
jobs:
clang-format-check:
name: clang-format
runs-on: ubuntu-latest
steps:
- name: Setup clang-format
run: |
sudo apt-get install -yqq clang-format
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Switch to pull request branch
run: |
git checkout ${GITHUB_SHA}
- name: Run clang-format
run: |
git diff origin/${{ github.base_ref }} -U0 --no-color -- '**/*.cpp' '**/*.cc' '**/*.h' '**/*.hh' '**/*.hpp' \
| clang-format-diff -p1 >not-formatted.diff 2>&1
- name: Check formatting
run: |
if ! grep -q '[^[:space:]]' not-formatted.diff ; then
echo "Code is formatted."
else
echo "Code is not formatted."
echo "Run clang-format-diff on your changes:"
echo " git diff origin/${{ github.base_ref }} -U0 --no-color | clang-format-diff -p1 -i"
echo ""
echo "You can disable clang-format for specific code blocks. Follow https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code."
echo ""
echo "Diff:"
cat not-formatted.diff
echo ""
exit 3
fi

View File

@@ -0,0 +1,58 @@
name: Linux build
on:
pull_request:
# Cancel previous runs if a more recent commit is pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions: read-all
jobs:
linux-build:
name: Build and run tests on Linux using CMake
runs-on: ubuntu-latest
strategy:
matrix:
asan: ["ON", "OFF"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Clone submodules
run: git submodule update --init --recursive
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DSPIRV_REFLECT_BUILD_TESTS=ON -DSPIRV_REFLECT_ENABLE_ASAN=${{matrix.asan}}
make -j $(nproc)
- name: Run unit tests
run: |
cd build
./test-spirv-reflect
- name: Clone SPIRV-Database
run: |
git clone https://github.com/LunarG/SPIRV-Database.git build/SPIRV-Database
- name: Test - SaschaWillemsVulkan
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/SaschaWillemsVulkan/
- name: Test - clspv
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/clspv/
- name: Test - dawn
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/dawn/
- name: Test - gl_cts
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/gl_cts/
- name: Test - naga
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/naga/remaps/
- name: Test - tint
run: |
python tests/ci_database.py --dir build/SPIRV-Database/vulkan/tint/

View File

@@ -0,0 +1,30 @@
name: Windows build
on:
pull_request:
# Cancel previous runs if a more recent commit is pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions: read-all
jobs:
windows-build:
name: Build and run tests on Windows using CMake
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Clone submodules
run: git submodule update --init --recursive
- name: Build
run: |
mkdir build
cd build
cmake -DSPIRV_REFLECT_BUILD_TESTS=ON ..
cmake --build . --config Release -- /nologo /verbosity:minimal /maxcpucount

10
lib/All/SPIRV-Reflect/.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
/build*
/bin/*
bazel-bin
bazel-genfiles
bazel-out
bazel-spirv-reflect
bazel-SPIRV-Reflect
bazel-testlogs
/.vs
/.vscode

3
lib/All/SPIRV-Reflect/.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest

View File

@@ -0,0 +1,130 @@
cmake_minimum_required(VERSION 3.16)
project(spirv-reflect)
OPTION(SPIRV_REFLECT_EXECUTABLE "Build spirv-reflect executable" ON)
OPTION(SPIRV_REFLECT_STATIC_LIB "Build a SPIRV-Reflect static library" OFF)
OPTION(SPIRV_REFLECT_BUILD_TESTS "Build the SPIRV-Reflect test suite" OFF)
OPTION(SPIRV_REFLECT_ENABLE_ASSERTS "Enable asserts for debugging" OFF)
OPTION(SPIRV_REFLECT_ENABLE_ASAN "Use address sanitization" OFF)
OPTION(SPIRV_REFLECT_INSTALL "Whether to install" ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
if (SPIRV_REFLECT_ENABLE_ASAN)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
endif()
if (SPIRV_REFLECT_EXECUTABLE)
# ==========================================================================
# Compile spirv_reflect.c as C
# ==========================================================================
add_executable(spirv-reflect ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.c
${CMAKE_CURRENT_SOURCE_DIR}/examples/arg_parser.h
${CMAKE_CURRENT_SOURCE_DIR}/examples/arg_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/examples/common.h
${CMAKE_CURRENT_SOURCE_DIR}/examples/common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.cpp)
target_compile_options(spirv-reflect PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Wextra -Wpedantic -Werror>)
if (SPIRV_REFLECT_ENABLE_ASSERTS)
target_compile_definitions(spirv-reflect PRIVATE SPIRV_REFLECT_ENABLE_ASSERTS)
endif()
set_target_properties(spirv-reflect PROPERTIES CXX_STANDARD 11)
target_include_directories(spirv-reflect PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)
target_compile_definitions(spirv-reflect PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if(SPIRV_REFLECT_INSTALL)
install(TARGETS spirv-reflect RUNTIME DESTINATION bin)
endif()
# ==========================================================================
# Compile spirv_reflect.c as C++
# ==========================================================================
add_executable(spirv-reflect-pp ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/examples/arg_parser.h
${CMAKE_CURRENT_SOURCE_DIR}/examples/arg_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/examples/common.h
${CMAKE_CURRENT_SOURCE_DIR}/examples/common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.cpp)
target_compile_options(spirv-reflect-pp PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -Wextra -Wpedantic -Werror>)
if (SPIRV_REFLECT_ENABLE_ASSERTS)
target_compile_definitions(spirv-reflect-pp PRIVATE SPIRV_REFLECT_ENABLE_ASSERTS)
endif()
set_target_properties(spirv-reflect-pp PROPERTIES CXX_STANDARD 11)
target_include_directories(spirv-reflect-pp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)
target_compile_definitions(spirv-reflect-pp PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if(SPIRV_REFLECT_INSTALL)
install(TARGETS spirv-reflect-pp RUNTIME DESTINATION bin)
endif()
endif()
if (SPIRV_REFLECT_EXAMPLES)
add_subdirectory(examples)
endif()
if (SPIRV_REFLECT_BUILD_TESTS)
message("Tests are enabled!")
SET(BUILD_GMOCK OFF CACHE BOOL "Builds the googlemock subproject" FORCE)
SET(BUILD_GTEST ON CACHE BOOL "Builds the googletest subproject" FORCE)
SET(INSTALL_GTEST OFF CACHE BOOL "Enable installation of googletest. (Projects embedding googletest generally turn this OFF.)" FORCE)
SET(gtest_force_shared_crt ON CACHE BOOL "Enable DLL for C runtime libraries on Windows" FORCE)
add_subdirectory(third_party/googletest)
add_executable(test-spirv-reflect ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-spirv-reflect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.c
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.h
${CMAKE_CURRENT_SOURCE_DIR}/common/output_stream.cpp)
set_target_properties(test-spirv-reflect PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
CXX_STANDARD 11)
target_compile_definitions(test-spirv-reflect PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>)
target_link_libraries(test-spirv-reflect gtest_main)
target_include_directories(test-spirv-reflect PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_command(TARGET test-spirv-reflect POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/tests ${CMAKE_CURRENT_BINARY_DIR}/tests)
endif()
if(SPIRV_REFLECT_STATIC_LIB)
add_library(spirv-reflect-static STATIC ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.c)
target_include_directories(spirv-reflect-static
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(spirv-reflect-static PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.h")
if(SPIRV_REFLECT_INSTALL)
install(TARGETS spirv-reflect-static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include)
endif()
endif()

View File

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

View File

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

View File

@@ -0,0 +1,141 @@
# SPIRV-Reflect
SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for
[SPIR-V](https://www.khronos.org/spir/) shader bytecode in
[Vulkan](https://www.khronos.org/vulkan/) applications.
SPIRV-Reflect has been tested on Linux and Windows.
## NEWS
- **2023-07-04** - We have removed support for
[Bazel](https://bazel.build).
- **2023-06-07** - We are planning to remove support for
[Bazel](https://bazel.build/). If you rely on Bazel for
building this code, please let us know in
https://github.com/KhronosGroup/SPIRV-Reflect/issues/188.
- **2023-05-03** - The `master` branch has been renamed to `main` (see
https://github.com/KhronosGroup/SPIRV-Reflect/issues/164 for
details). Please update your fork as per instructions in that
issue.
## Features
- Extract descriptor bindings from SPIR-V bytecode, to assist in the generation of
Vulkan descriptor set and pipeline layouts.
- Extract push constant block size from SPIR-V bytecode to assist in the generation
of pipeline layouts.
- Extract full layout data for uniform buffer and push constant blocks from SPIR-V
bytecode, to assist in application updates of these structures.
- Extract input/output variables from SPIR-V bytecode (including semantic decorations
for HLSL shaders), to assist in validation of pipeline input/output settings.
- Remap descriptor bindings at runtime, and update the source SPIR-V bytecode
accordingly.
- Log all reflection data as human-readable text.
## Integration
SPIRV-Reflect is designed to make integration as easy as possible. The only
external dependency is the [Vulkan SDK](https://vulkan.lunarg.com/sdk/home).
To integrate SPIRV-Reflect into a project, simply add `spirv_reflect.h` and
`spirv_reflect.c` in the project's build, and include `spirv_reflect.h` from
the necessary source files.
If the project wants to use it's own SPIRV-Header path, it can set `SPIRV_REFLECT_USE_SYSTEM_SPIRV_H`
```cmake
# CMake example
target_compile_definitions(project_name PUBLIC SPIRV_REFLECT_USE_SYSTEM_SPIRV_H)
```
## Building Samples
**This step is only necessary when building/running SPIRV-Reflect's example applications.**
SPIRV-Reflect includes a collection of sample programs in the `examples/` directory which
demonstrate various use cases:
- **descriptors**: This sample demonstrates the retrieval of descriptor bindings, including
the population of `VkDescriptorSetLayoutCreateInfo` structures from reflection data.
- **hlsl_resource_types**: This sample shows how various HLSL resource types are represented
in SPIR-V.
- **io_variables**: This sample demonstrates the retrieval of input/output variables, including
the population of `VkPipelineVertexInputStateCreateInfo` structures from reflection data.
To build the included sample applications, use [CMake](https://cmake.org/) to generate the
appropriate project files for your platform, then build them as usual.
Note that you can set VulkanSDK directory as your preference. For example, on Linux:
```
VULKAN_SDK=$HOME/VulkanSDK/1.1.70.1/x86_64 cmake -G Ninja ..
```
## Usage
SPIRV-Reflect's core C API should be familiar to Vulkan developers:
```c++
#include "spirv_reflect.h"
int SpirvReflectExample(const void* spirv_code, size_t spirv_nbytes)
{
// Generate reflection data for a shader
SpvReflectShaderModule module;
SpvReflectResult result = spvReflectCreateShaderModule(spirv_nbytes, spirv_code, &module);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
// Enumerate and extract shader's input variables
uint32_t var_count = 0;
result = spvReflectEnumerateInputVariables(&module, &var_count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
SpvReflectInterfaceVariable** input_vars =
(SpvReflectInterfaceVariable**)malloc(var_count * sizeof(SpvReflectInterfaceVariable*));
result = spvReflectEnumerateInputVariables(&module, &var_count, input_vars);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
// Output variables, descriptor bindings, descriptor sets, and push constants
// can be enumerated and extracted using a similar mechanism.
// Destroy the reflection data when no longer required.
spvReflectDestroyShaderModule(&module);
}
```
A C++ wrapper is also provided.
## Building Examples
By adding `-DSPIRV_REFLECT_EXAMPLES=ON` in CMake you can see the use of the API used in action.
The `main_explorer.cpp` file is designed to allow an user to use their debugger of choice to breakpoint
and explorer the contents of the `SpvReflectShaderModule` object. Just build with `-DCMAKE_BUILD_TYPE=Debug`
and setup a debugger to run `./bin/explorer path/to/shader.spv`
## Building Self-Test Suite
SPIRV-Reflect uses [googletest](https://github.com/google/googletest) for self-testing.
This component is optional, and generally only of interest to developers modifying SPIRV-Reflect.
To run the self-tests:
- `git submodule init`
- `git submodule update`
- Enable `SPIRV_REFLECT_BUILD_TESTS` in CMake
- Build and run the `test-spirv-reflect` project.
## License
Copyright 2017-2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
Security updates are applied only to the latest release.
## Reporting a Vulnerability
If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
Please disclose it at [security advisory](https://github.com/KhronosGroup/SPIRV-Reflect/security/advisories/new).
This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
#ifndef SPIRV_REFLECT_OUTPUT_STREAM_H
#define SPIRV_REFLECT_OUTPUT_STREAM_H
#include <map>
#include <ostream>
#include <string>
#include "spirv_reflect.h"
std::string ToStringSpvSourceLanguage(SpvSourceLanguage lang);
std::string ToStringSpvExecutionModel(SpvExecutionModel model);
std::string ToStringSpvStorageClass(int storage_class);
std::string ToStringSpvDim(SpvDim dim);
std::string ToStringSpvBuiltIn(const SpvReflectInterfaceVariable& variable, bool preface);
std::string ToStringSpvImageFormat(SpvImageFormat fmt);
std::string ToStringGenerator(SpvReflectGenerator generator);
std::string ToStringShaderStage(SpvReflectShaderStageFlagBits stage);
std::string ToStringResourceType(SpvReflectResourceType type);
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
std::string ToStringTypeFlags(SpvReflectTypeFlags type_flags);
std::string ToStringVariableFlags(SpvReflectVariableFlags flags);
std::string ToStringDecorationFlags(SpvReflectDecorationFlags decoration_flags);
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
std::string ToStringFormat(SpvReflectFormat fmt);
std::string ToStringComponentType(const SpvReflectTypeDescription& type, uint32_t member_decoration_flags);
std::string ToStringType(SpvSourceLanguage src_lang, const SpvReflectTypeDescription& type);
// std::ostream& operator<<(std::ostream& os, const spv_reflect::ShaderModule& obj);
void WriteReflection(const spv_reflect::ShaderModule& obj, bool flatten_cbuffers, std::ostream& os);
class SpvReflectToYaml {
public:
// verbosity = 0: top-level tables only (module, block variables, interface variables, descriptor bindings).
// verbosity = 1: everything above, plus type description tables for all public objects.
// verbosity = 2: everything above, plus SPIRV bytecode and full type description table. HUGE.
explicit SpvReflectToYaml(const SpvReflectShaderModule& shader_module, uint32_t verbosity = 0);
friend std::ostream& operator<<(std::ostream& os, SpvReflectToYaml& to_yaml) {
to_yaml.Write(os);
return os;
}
private:
void Write(std::ostream& os);
SpvReflectToYaml(const SpvReflectToYaml&) = delete;
SpvReflectToYaml(const SpvReflectToYaml&&) = delete;
static std::string Indent(uint32_t level) { return std::string(2 * level, ' '); }
static std::string SafeString(const char* str) { return str ? (std::string("\"") + str + "\"") : ""; }
void WriteTypeDescription(std::ostream& os, const SpvReflectTypeDescription& td, uint32_t indent_level);
void WriteBlockVariable(std::ostream& os, const SpvReflectBlockVariable& bv, uint32_t indent_level);
void WriteDescriptorBinding(std::ostream& os, const SpvReflectDescriptorBinding& db, uint32_t indent_level);
void WriteInterfaceVariable(std::ostream& os, const SpvReflectInterfaceVariable& iv, uint32_t indent_level);
// Write all SpvReflectTypeDescription objects reachable from the specified objects, if they haven't been
// written already.
void WriteBlockVariableTypes(std::ostream& os, const SpvReflectBlockVariable& bv, uint32_t indent_level);
void WriteDescriptorBindingTypes(std::ostream& os, const SpvReflectDescriptorBinding& db, uint32_t indent_level);
void WriteInterfaceVariableTypes(std::ostream& os, const SpvReflectInterfaceVariable& iv, uint32_t indent_level);
const SpvReflectShaderModule& sm_;
uint32_t verbosity_ = 0;
std::map<const SpvReflectTypeDescription*, uint32_t> type_description_to_index_;
std::map<const SpvReflectBlockVariable*, uint32_t> block_variable_to_index_;
std::map<const SpvReflectDescriptorBinding*, uint32_t> descriptor_binding_to_index_;
std::map<const SpvReflectInterfaceVariable*, uint32_t> interface_variable_to_index_;
};
#endif

View File

@@ -0,0 +1,76 @@
cmake_minimum_required(VERSION 3.16)
project(examples)
list(APPEND SPIRV_REFLECT_FILES
${CMAKE_SOURCE_DIR}/spirv_reflect.h
${CMAKE_SOURCE_DIR}/spirv_reflect.c
)
list(APPEND COMMON_FILES
common.h
common.cpp
../common/output_stream.h
../common/output_stream.cpp
sample_spv.h
)
################################################################################
# descriptors
################################################################################
add_executable(descriptors ${CMAKE_CURRENT_SOURCE_DIR}/main_descriptors.cpp ${COMMON_FILES} ${SPIRV_REFLECT_FILES})
target_include_directories(descriptors PRIVATE ${CMAKE_SOURCE_DIR})
if (${VULKAN_DIR_FOUND})
target_compile_definitions(descriptors PRIVATE SPIRV_REFLECT_HAS_VULKAN_H)
target_include_directories(descriptors PRIVATE ${VULKAN_DIR}/include)
set_target_properties(descriptors PROPERTIES CXX_STANDARD 11)
endif()
if(WIN32)
target_compile_definitions(descriptors PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(descriptors PROPERTIES FOLDER "examples")
endif()
################################################################################
# io_variables
################################################################################
add_executable(io_variables ${CMAKE_CURRENT_SOURCE_DIR}/main_io_variables.cpp ${COMMON_FILES} ${SPIRV_REFLECT_FILES})
target_include_directories(io_variables PRIVATE ${CMAKE_SOURCE_DIR})
if (${VULKAN_DIR_FOUND})
target_compile_definitions(io_variables PRIVATE SPIRV_REFLECT_HAS_VULKAN_H)
target_include_directories(io_variables PRIVATE ${VULKAN_DIR}/include)
set_target_properties(io_variables PROPERTIES CXX_STANDARD 11)
endif()
if(WIN32)
target_compile_definitions(io_variables PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(io_variables PROPERTIES FOLDER "examples")
endif()
################################################################################
# hlsl_resource_types
################################################################################
add_executable(hlsl_resource_types ${CMAKE_CURRENT_SOURCE_DIR}/main_hlsl_resource_types.cpp ${COMMON_FILES} ${SPIRV_REFLECT_FILES})
target_include_directories(hlsl_resource_types PRIVATE ${CMAKE_SOURCE_DIR})
if (${VULKAN_DIR_FOUND})
target_compile_definitions(hlsl_resource_types PRIVATE SPIRV_REFLECT_HAS_VULKAN_H)
target_include_directories(hlsl_resource_types PRIVATE ${VULKAN_DIR}/include)
set_target_properties(hlsl_resource_types PROPERTIES CXX_STANDARD 11)
endif()
if(WIN32)
target_compile_definitions(hlsl_resource_types PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(hlsl_resource_types PROPERTIES FOLDER "examples")
endif()
################################################################################
# explorer
################################################################################
add_executable(explorer ${CMAKE_CURRENT_SOURCE_DIR}/main_explorer.cpp ${COMMON_FILES} ${SPIRV_REFLECT_FILES})
target_include_directories(explorer PRIVATE ${CMAKE_SOURCE_DIR})
if (${VULKAN_DIR_FOUND})
target_compile_definitions(explorer PRIVATE SPIRV_REFLECT_HAS_VULKAN_H)
target_include_directories(explorer PRIVATE ${VULKAN_DIR}/include)
set_target_properties(explorer PROPERTIES CXX_STANDARD 11)
endif()
if(WIN32)
target_compile_definitions(explorer PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(explorer PROPERTIES FOLDER "examples")
endif()

View File

@@ -0,0 +1,362 @@
#include "arg_parser.h"
#include <algorithm>
#include <iomanip>
#include <sstream>
ArgParser::ArgParser() {}
ArgParser::~ArgParser() {}
ArgParser::Option* ArgParser::FindOptionByShortName(const std::string& short_name) {
ArgParser::Option* p_option = nullptr;
auto it = std::find_if(std::begin(m_options), std::end(m_options),
[short_name](const ArgParser::Option& elem) -> bool { return elem.short_name == short_name; });
if (it != std::end(m_options)) {
p_option = &(*it);
}
return p_option;
}
const ArgParser::Option* ArgParser::FindOptionByShortName(const std::string& short_name) const {
const ArgParser::Option* p_option = nullptr;
auto it = std::find_if(std::begin(m_options), std::end(m_options),
[short_name](const ArgParser::Option& elem) -> bool { return elem.short_name == short_name; });
if (it != std::end(m_options)) {
p_option = &(*it);
}
return p_option;
}
ArgParser::Option* ArgParser::FindOptionByLongName(const std::string& long_name) {
ArgParser::Option* p_option = nullptr;
auto it = std::find_if(std::begin(m_options), std::end(m_options),
[long_name](const ArgParser::Option& elem) -> bool { return elem.long_name == long_name; });
if (it != std::end(m_options)) {
p_option = &(*it);
}
return p_option;
}
const ArgParser::Option* ArgParser::FindOptionByLongName(const std::string& long_name) const {
const ArgParser::Option* p_option = nullptr;
auto it = std::find_if(std::begin(m_options), std::end(m_options),
[long_name](const ArgParser::Option& elem) -> bool { return elem.long_name == long_name; });
if (it != std::end(m_options)) {
p_option = &(*it);
}
return p_option;
}
bool ArgParser::AddFlag(const std::string& short_name, const std::string& long_name, const std::string& desc) {
Option option = {};
option.short_name = short_name;
option.long_name = long_name;
option.type = OPTION_TYPE_FLAG;
option.desc = desc;
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
if ((p_short != nullptr) || (p_long != nullptr)) {
return false;
}
m_options.push_back(option);
return true;
}
bool ArgParser::AddOptionString(const std::string& short_name, const std::string& long_name, const std::string& desc,
const std::string& default_value) {
Option option = {};
option.short_name = short_name;
option.long_name = long_name;
option.type = OPTION_TYPE_STRING;
option.desc = desc;
option.default_value.str = default_value;
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
if ((p_short != nullptr) || (p_long != nullptr)) {
return false;
}
m_options.push_back(option);
return true;
}
bool ArgParser::AddOptionInt(const std::string& short_name, const std::string& long_name, const std::string& desc,
int default_value) {
Option option = {};
option.short_name = short_name;
option.long_name = long_name;
option.type = OPTION_TYPE_INT;
option.desc = desc;
option.default_value.i32 = default_value;
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
if ((p_short != nullptr) || (p_long != nullptr)) {
return false;
}
m_options.push_back(option);
return true;
}
bool ArgParser::AddOptionFloat(const std::string& short_name, const std::string& long_name, const std::string& desc,
float default_value) {
Option option = {};
option.short_name = short_name;
option.long_name = long_name;
option.type = OPTION_TYPE_FLOAT;
option.desc = desc;
option.default_value.f32 = default_value;
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
if ((p_short != nullptr) || (p_long != nullptr)) {
return false;
}
m_options.push_back(option);
return true;
}
bool ArgParser::Parse(int argc, char** argv, std::ostream& os) {
for (auto& opt : m_options) {
opt.value = opt.default_value;
opt.parsed = false;
}
int i = 1;
while (i < argc) {
std::string s = argv[i];
if (s[0] == '-') {
ArgParser::Option* p_option = nullptr;
if ((s.length() >= 2) && ((s[0] == '-') && (s[1] == '-'))) {
std::string long_name = s.substr(2);
p_option = FindOptionByLongName(long_name);
} else {
std::string short_name = s.substr(1);
p_option = FindOptionByShortName(short_name);
}
if (p_option == nullptr) {
os << "ERROR: invalid argument " << s << std::endl;
return false;
}
switch (p_option->type) {
case OPTION_TYPE_FLAG: {
p_option->parsed = true;
i += 1;
} break;
case OPTION_TYPE_STRING: {
if ((i + 1) >= argc) {
os << "ERROR: missing option data for " << s << std::endl;
return false;
}
s = argv[i + 1];
p_option->value.str = s;
p_option->parsed = true;
i += 2;
} break;
case OPTION_TYPE_INT: {
if ((i + 1) >= argc) {
os << "ERROR: missing option data for " << s << std::endl;
return false;
}
s = argv[i + 1];
p_option->value.i32 = atoi(s.c_str());
p_option->parsed = true;
i += 2;
} break;
case OPTION_TYPE_FLOAT: {
if ((i + 1) >= argc) {
os << "ERROR: missing option data for " << s << std::endl;
return false;
}
s = argv[i + 1];
p_option->value.f32 = static_cast<float>(atof(s.c_str()));
p_option->parsed = true;
i += 2;
} break;
case OPTION_TYPE_UNDEFINED: {
} break;
}
} else {
m_args.push_back(s);
i += 1;
}
}
return true;
}
size_t ArgParser::GetArgCount() const { return m_args.size(); }
bool ArgParser::GetArg(size_t i, std::string* p_value) const {
if ((GetArgCount() == 0) && (i >= GetArgCount())) {
return false;
}
if (p_value != nullptr) {
*p_value = m_args[i];
}
return true;
}
const std::vector<std::string>& ArgParser::GetArgs() const { return m_args; }
bool ArgParser::GetFlag(const std::string& short_name, const std::string& long_name) const {
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
const ArgParser::Option* p_option = nullptr;
if (p_short != nullptr) {
p_option = p_short;
}
if ((p_option == nullptr) && (p_long != nullptr)) {
p_option = p_short;
}
if (p_option == nullptr) {
return false;
}
if (p_option->type != OPTION_TYPE_FLAG) {
return false;
}
return p_option->parsed;
}
bool ArgParser::GetString(const std::string& short_name, const std::string& long_name, std::string* p_value) const {
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
const ArgParser::Option* p_option = nullptr;
if (p_short != nullptr) {
p_option = p_short;
}
if ((p_option == nullptr) && (p_long != nullptr)) {
p_option = p_short;
}
if (p_option == nullptr) {
return false;
}
if (!p_option->parsed || (p_option->type != OPTION_TYPE_STRING)) {
return false;
}
if (p_value != nullptr) {
*p_value = p_option->value.str;
}
return true;
}
bool ArgParser::GetInt(const std::string& short_name, const std::string& long_name, int* p_value) const {
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
const ArgParser::Option* p_option = nullptr;
if (p_short != nullptr) {
p_option = p_short;
}
if ((p_option == nullptr) && (p_long != nullptr)) {
p_option = p_short;
}
if (p_option == nullptr) {
return false;
}
if (!p_option->parsed || (p_option->type != OPTION_TYPE_INT)) {
return false;
}
if (p_value != nullptr) {
*p_value = p_option->value.i32;
}
return true;
}
bool ArgParser::GetFloat(const std::string& short_name, const std::string& long_name, float* p_value) const {
auto p_short = FindOptionByShortName(short_name);
auto p_long = FindOptionByLongName(long_name);
const ArgParser::Option* p_option = nullptr;
if (p_short != nullptr) {
p_option = p_short;
}
if ((p_option == nullptr) && (p_long != nullptr)) {
p_option = p_short;
}
if (p_option == nullptr) {
return false;
}
if (!p_option->parsed || (p_option->type != OPTION_TYPE_FLOAT)) {
return false;
}
if (p_value != nullptr) {
*p_value = p_option->value.f32;
}
return true;
}
void ArgParser::PrintHelp(std::ostream& os) {
(void)os;
/*
if (m_options.empty()) {
return;
}
struct TextLine {
std::string option;
std::string desc;
};
std::vector<TextLine> text_lines;
size_t max_width = 0;
for (auto& it : m_options) {
std::stringstream ss;
ss << "--" << it.first;
switch (it.second.type) {
default: break;
case OPTION_TYPE_STRING : ss << " " << "[s]"; break;
case OPTION_TYPE_INT : ss << " " << "[i]"; break;
case OPTION_TYPE_FLOAT : ss << " " << "[f]"; break;
}
std::string option = ss.str();
max_width = std::max(max_width, option.size());
TextLine tl;
tl.option = option;
tl.desc = it.second.desc;
text_lines.push_back(tl);
}
max_width += 2;
os << "\n";
os << "Options:" << "\n";
for (auto& tl : text_lines) {
os << " ";
os << std::left << std::setw(max_width) << tl.option;
os << tl.desc;
os << "\n";
}
*/
}

View File

@@ -0,0 +1,65 @@
#ifndef __VERIFLECT_ARG_PARSER_H__
#define __VERIFLECT_ARG_PARSER_H__
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
class ArgParser {
public:
enum OptionType { OPTION_TYPE_UNDEFINED = 0, OPTION_TYPE_FLAG, OPTION_TYPE_STRING, OPTION_TYPE_INT, OPTION_TYPE_FLOAT };
struct OptionValue {
std::string str;
union {
int i32;
float f32;
};
};
struct Option {
std::string short_name;
std::string long_name;
OptionType type;
std::string desc;
OptionValue value;
OptionValue default_value;
bool parsed;
};
ArgParser();
~ArgParser();
bool AddFlag(const std::string& short_name, const std::string& long_name, const std::string& desc);
bool AddOptionString(const std::string& short_name, const std::string& long_name, const std::string& desc,
const std::string& default_value = "");
bool AddOptionInt(const std::string& short_name, const std::string& long_name, const std::string& desc, int default_value = 0);
bool AddOptionFloat(const std::string& short_name, const std::string& long_name, const std::string& desc,
float default_value = 0);
bool Parse(int argc, char** argv, std::ostream& os);
size_t GetArgCount() const;
bool GetArg(size_t i, std::string* p_value) const;
const std::vector<std::string>& GetArgs() const;
bool GetFlag(const std::string& short_name, const std::string& long_name) const;
bool GetString(const std::string& short_name, const std::string& long_name, std::string* p_value) const;
bool GetInt(const std::string& short_name, const std::string& long_name, int* p_value) const;
bool GetFloat(const std::string& short_name, const std::string& long_name, float* p_value) const;
void PrintHelp(std::ostream& os);
private:
ArgParser::Option* FindOptionByShortName(const std::string& short_name);
const ArgParser::Option* FindOptionByShortName(const std::string& short_name) const;
ArgParser::Option* FindOptionByLongName(const std::string& long_name);
const ArgParser::Option* FindOptionByLongName(const std::string& long_name) const;
private:
std::vector<ArgParser::Option> m_options;
std::vector<std::string> m_args;
};
#endif // __VERIFLECT_ARG_PARSER_H__

View File

@@ -0,0 +1,32 @@
#!/bin/sh
echo -e "#ifndef SAMPLE_SPV_H" > sample_spv.h
echo -e "#define SAMPLE_SPV_H" >> sample_spv.h
echo -e "" >> sample_spv.h
echo -e "/* Source from sample.hlsl" >> sample_spv.h
echo -e "" >> sample_spv.h
cat sample.hlsl >> sample_spv.h
echo -e "\n" >> sample_spv.h
echo -e "*/" >> sample_spv.h
echo -e "" >> sample_spv.h
echo -e "// Imported from file 'sample.spv'" >> sample_spv.h
echo -e "const uint32_t k_sample_spv[] = {" >> sample_spv.h
glslc.exe -fshader-stage=frag -fentry-point=main -mfmt=num -o - sample.hlsl >> sample_spv.h
echo -e "};" >> sample_spv.h
echo -e "" >> sample_spv.h
echo -e "/* SPIRV Disassembly" >> sample_spv.h
echo -e "" >> sample_spv.h
spirv-dis --raw-id sample.spv >> sample_spv.h
echo -e "" >> sample_spv.h
echo -e "*/" >> sample_spv.h
echo -e "" >> sample_spv.h
echo -e "#endif // SAMPLE_SPV_H" >> sample_spv.h
dos2unix sample_spv.h
rm -f tmp_sample_spv_h

View File

@@ -0,0 +1,128 @@
#include "common.h"
#include <cstring>
#include <fstream>
#include <sstream>
#include "../common/output_stream.h"
void PrintModuleInfo(std::ostream& os, const SpvReflectShaderModule& obj, const char* /*indent*/) {
os << "entry point : " << obj.entry_point_name << "\n";
os << "source lang : " << spvReflectSourceLanguage(obj.source_language) << "\n";
os << "source lang ver : " << obj.source_language_version << "\n";
if (obj.source_language == SpvSourceLanguageHLSL) {
os << "stage : ";
switch (obj.shader_stage) {
default:
break;
case SPV_REFLECT_SHADER_STAGE_VERTEX_BIT:
os << "VS";
break;
case SPV_REFLECT_SHADER_STAGE_TESSELLATION_CONTROL_BIT:
os << "HS";
break;
case SPV_REFLECT_SHADER_STAGE_TESSELLATION_EVALUATION_BIT:
os << "DS";
break;
case SPV_REFLECT_SHADER_STAGE_GEOMETRY_BIT:
os << "GS";
break;
case SPV_REFLECT_SHADER_STAGE_FRAGMENT_BIT:
os << "PS";
break;
case SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT:
os << "CS";
break;
}
}
}
void PrintDescriptorSet(std::ostream& os, const SpvReflectDescriptorSet& obj, const char* indent) {
const char* t = indent;
std::string tt = std::string(indent) + " ";
std::string ttttt = std::string(indent) + " ";
os << t << "set : " << obj.set << "\n";
os << t << "binding count : " << obj.binding_count;
os << "\n";
for (uint32_t i = 0; i < obj.binding_count; ++i) {
const SpvReflectDescriptorBinding& binding = *obj.bindings[i];
os << tt << i << ":"
<< "\n";
PrintDescriptorBinding(os, binding, false, ttttt.c_str());
if (i < (obj.binding_count - 1)) {
os << "\n";
}
}
}
void PrintDescriptorBinding(std::ostream& os, const SpvReflectDescriptorBinding& obj, bool write_set, const char* indent) {
const char* t = indent;
os << t << "binding : " << obj.binding << "\n";
if (write_set) {
os << t << "set : " << obj.set << "\n";
}
os << t << "type : " << ToStringDescriptorType(obj.descriptor_type) << "\n";
// array
if (obj.array.dims_count > 0) {
os << t << "array : ";
for (uint32_t dim_index = 0; dim_index < obj.array.dims_count; ++dim_index) {
os << "[" << obj.array.dims[dim_index] << "]";
}
os << "\n";
}
// counter
if (obj.uav_counter_binding != nullptr) {
os << t << "counter : ";
os << "(";
os << "set=" << obj.uav_counter_binding->set << ", ";
os << "binding=" << obj.uav_counter_binding->binding << ", ";
os << "name=" << obj.uav_counter_binding->name;
os << ");";
os << "\n";
}
os << t << "name : " << obj.name;
if ((obj.type_description->type_name != nullptr) && (strlen(obj.type_description->type_name) > 0)) {
os << " "
<< "(" << obj.type_description->type_name << ")";
}
}
void PrintInterfaceVariable(std::ostream& os, SpvSourceLanguage src_lang, const SpvReflectInterfaceVariable& obj,
const char* indent) {
const char* t = indent;
os << t << "location : ";
if (obj.decoration_flags & SPV_REFLECT_DECORATION_BUILT_IN) {
os << ToStringSpvBuiltIn(obj, true);
} else {
os << obj.location;
}
os << "\n";
if (obj.semantic != nullptr) {
os << t << "semantic : " << obj.semantic << "\n";
}
os << t << "type : " << ToStringType(src_lang, *obj.type_description) << "\n";
os << t << "format : " << ToStringFormat(obj.format) << "\n";
os << t << "qualifier : ";
if (obj.decoration_flags & SPV_REFLECT_DECORATION_FLAT) {
os << "flat";
} else if (obj.decoration_flags & SPV_REFLECT_DECORATION_NOPERSPECTIVE) {
os << "noperspective";
} else if (obj.decoration_flags & SPV_REFLECT_DECORATION_PATCH) {
os << "patch";
} else if (obj.decoration_flags & SPV_REFLECT_DECORATION_PER_VERTEX) {
os << "pervertex";
} else if (obj.decoration_flags & SPV_REFLECT_DECORATION_PER_TASK) {
os << "pertask";
}
os << "\n";
os << t << "name : " << obj.name;
if ((obj.type_description->type_name != nullptr) && (strlen(obj.type_description->type_name) > 0)) {
os << " "
<< "(" << obj.type_description->type_name << ")";
}
}

View File

@@ -0,0 +1,14 @@
#ifndef SPIRV_REFLECT_EXAMPLES_COMMON_H
#define SPIRV_REFLECT_EXAMPLES_COMMON_H
#include <iostream>
#include "spirv_reflect.h"
void PrintModuleInfo(std::ostream& os, const SpvReflectShaderModule& obj, const char* indent = "");
void PrintDescriptorSet(std::ostream& os, const SpvReflectDescriptorSet& obj, const char* indent = "");
void PrintDescriptorBinding(std::ostream& os, const SpvReflectDescriptorBinding& obj, bool write_set, const char* indent = "");
void PrintInterfaceVariable(std::ostream& os, SpvSourceLanguage src_lang, const SpvReflectInterfaceVariable& obj,
const char* indent);
#endif

View File

@@ -0,0 +1,85 @@
#include <cassert>
#include "common.h"
#include "sample_spv.h"
#if defined(SPIRV_REFLECT_HAS_VULKAN_H)
#include <vulkan/vulkan.h>
struct DescriptorSetLayoutData {
uint32_t set_number;
VkDescriptorSetLayoutCreateInfo create_info;
std::vector<VkDescriptorSetLayoutBinding> bindings;
};
#endif
int main(int argn, char** argv) {
SpvReflectShaderModule module = {};
SpvReflectResult result = spvReflectCreateShaderModule(sizeof(k_sample_spv), k_sample_spv, &module);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
uint32_t count = 0;
result = spvReflectEnumerateDescriptorSets(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectDescriptorSet*> sets(count);
result = spvReflectEnumerateDescriptorSets(&module, &count, sets.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
#if defined(SPIRV_REFLECT_HAS_VULKAN_H)
// Demonstrates how to generate all necessary data structures to create a
// VkDescriptorSetLayout for each descriptor set in this shader.
std::vector<DescriptorSetLayoutData> set_layouts(sets.size(), DescriptorSetLayoutData{});
for (size_t i_set = 0; i_set < sets.size(); ++i_set) {
const SpvReflectDescriptorSet& refl_set = *(sets[i_set]);
DescriptorSetLayoutData& layout = set_layouts[i_set];
layout.bindings.resize(refl_set.binding_count);
for (uint32_t i_binding = 0; i_binding < refl_set.binding_count; ++i_binding) {
const SpvReflectDescriptorBinding& refl_binding = *(refl_set.bindings[i_binding]);
VkDescriptorSetLayoutBinding& layout_binding = layout.bindings[i_binding];
layout_binding.binding = refl_binding.binding;
layout_binding.descriptorType = static_cast<VkDescriptorType>(refl_binding.descriptor_type);
layout_binding.descriptorCount = 1;
for (uint32_t i_dim = 0; i_dim < refl_binding.array.dims_count; ++i_dim) {
layout_binding.descriptorCount *= refl_binding.array.dims[i_dim];
}
layout_binding.stageFlags = static_cast<VkShaderStageFlagBits>(module.shader_stage);
}
layout.set_number = refl_set.set;
layout.create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
layout.create_info.bindingCount = refl_set.binding_count;
layout.create_info.pBindings = layout.bindings.data();
}
// Nothing further is done with set_layouts in this sample; in a real
// application they would be merged with similar structures from other shader
// stages and/or pipelines to create a VkPipelineLayout.
#endif
// Log the descriptor set contents to stdout
const char* t = " ";
const char* tt = " ";
PrintModuleInfo(std::cout, module);
std::cout << "\n\n";
std::cout << "Descriptor sets:"
<< "\n";
for (size_t index = 0; index < sets.size(); ++index) {
auto p_set = sets[index];
// descriptor sets can also be retrieved directly from the module, by set
// index
auto p_set2 = spvReflectGetDescriptorSet(&module, p_set->set, &result);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
assert(p_set == p_set2);
(void)p_set2;
std::cout << t << index << ":"
<< "\n";
PrintDescriptorSet(std::cout, *p_set, tt);
std::cout << "\n\n";
}
spvReflectDestroyShaderModule(&module);
return 0;
}

View File

@@ -0,0 +1,104 @@
/* Copyright (c) 2023 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cassert>
#include <cstring>
#include <fstream>
#include <iostream>
#include "spirv_reflect.h"
// =================================================================================================
// PrintUsage()
// =================================================================================================
void PrintUsage() {
std::cout << "Usage: explorer path/to/SPIR-V/bytecode.spv\n"
<< "\tThis is used to set a breakpoint and explorer the API and "
"how to access info needed\n";
}
// =================================================================================================
// main()
// =================================================================================================
int main(int argn, char** argv) {
if (argn != 2) {
PrintUsage();
return EXIT_FAILURE;
} else if (std::string(argv[1]) == "--help") {
PrintUsage();
return EXIT_SUCCESS;
}
std::string input_spv_path = argv[1];
std::ifstream spv_ifstream(input_spv_path.c_str(), std::ios::binary);
if (!spv_ifstream.is_open()) {
std::cerr << "ERROR: could not open '" << input_spv_path << "' for reading\n";
return EXIT_FAILURE;
}
spv_ifstream.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(spv_ifstream.tellg());
spv_ifstream.seekg(0, std::ios::beg);
std::vector<char> spv_data(size);
spv_ifstream.read(spv_data.data(), size);
SpvReflectShaderModule module = {};
SpvReflectResult result = spvReflectCreateShaderModule(spv_data.size(), spv_data.data(), &module);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
// Go through each enumerate to examine it
uint32_t count = 0;
result = spvReflectEnumerateDescriptorSets(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectDescriptorSet*> sets(count);
result = spvReflectEnumerateDescriptorSets(&module, &count, sets.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
result = spvReflectEnumerateDescriptorBindings(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectDescriptorBinding*> bindings(count);
result = spvReflectEnumerateDescriptorBindings(&module, &count, bindings.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
result = spvReflectEnumerateInterfaceVariables(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectInterfaceVariable*> interface_variables(count);
result = spvReflectEnumerateInterfaceVariables(&module, &count, interface_variables.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
result = spvReflectEnumerateInputVariables(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectInterfaceVariable*> input_variables(count);
result = spvReflectEnumerateInputVariables(&module, &count, input_variables.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
result = spvReflectEnumerateOutputVariables(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectInterfaceVariable*> output_variables(count);
result = spvReflectEnumerateOutputVariables(&module, &count, output_variables.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
result = spvReflectEnumeratePushConstantBlocks(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectBlockVariable*> push_constant(count);
result = spvReflectEnumeratePushConstantBlocks(&module, &count, push_constant.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
// Can set a breakpoint here and explorer the various variables enumerated.
spvReflectDestroyShaderModule(&module);
return 0;
}

View File

@@ -0,0 +1,149 @@
/*
Copyright 2017-2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#if defined(WIN32)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#endif
#include <cassert>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include "../common/output_stream.h"
#include "examples/common.h"
#include "spirv_reflect.h"
void StreamWrite(std::ostream& os, const SpvReflectDescriptorBinding& obj, bool write_set, const char* indent = "") {
const char* t = indent;
os << " " << obj.name;
os << "\n";
os << t;
os << ToStringDescriptorType(obj.descriptor_type);
os << " "
<< "(" << ToStringResourceType(obj.resource_type) << ")";
if ((obj.descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
(obj.descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
(obj.descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) ||
(obj.descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) {
os << "\n";
os << t;
os << "dim=" << obj.image.dim << ", ";
os << "depth=" << obj.image.depth << ", ";
os << "arrayed=" << obj.image.arrayed << ", ";
os << "ms=" << obj.image.ms << ", ";
os << "sampled=" << obj.image.sampled;
}
}
void StreamWrite(std::ostream& os, const SpvReflectShaderModule& obj, const char* indent = "") {
os << "entry point : " << obj.entry_point_name << "\n";
os << "source lang : " << spvReflectSourceLanguage(obj.source_language) << "\n";
os << "source lang ver : " << obj.source_language_version;
}
void StreamWrite(std::ostream& os, const SpvReflectDescriptorBinding& obj) { StreamWrite(os, obj, true, " "); }
// Specialized stream-writer that only includes descriptor bindings.
void StreamWrite(std::ostream& os, const spv_reflect::ShaderModule& obj) {
const char* t = " ";
const char* tt = " ";
const char* ttt = " ";
StreamWrite(os, obj.GetShaderModule(), "");
SpvReflectResult result = SPV_REFLECT_RESULT_NOT_READY;
uint32_t count = 0;
std::vector<SpvReflectInterfaceVariable*> variables;
std::vector<SpvReflectDescriptorBinding*> bindings;
std::vector<SpvReflectDescriptorSet*> sets;
count = 0;
result = obj.EnumerateDescriptorBindings(&count, nullptr);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
bindings.resize(count);
result = obj.EnumerateDescriptorBindings(&count, bindings.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
if (count > 0) {
os << "\n";
os << "\n";
os << t << "Descriptor bindings: " << count << "\n";
for (size_t i = 0; i < bindings.size(); ++i) {
auto p_binding = bindings[i];
assert(result == SPV_REFLECT_RESULT_SUCCESS);
os << tt << i << ":";
StreamWrite(os, *p_binding, true, ttt);
if (i < (count - 1)) {
os << "\n\n";
}
}
}
}
// =================================================================================================
// PrintUsage()
// =================================================================================================
void PrintUsage() {
std::cout << "Usage: hlsl_resource_types [OPTIONS] path/to/SPIR-V/bytecode.spv" << std::endl
<< "Options:" << std::endl
<< " --help: Display this message" << std::endl
<< std::endl;
}
// =================================================================================================
// main()
// =================================================================================================
int main(int argn, char** argv) {
if (argn != 2) {
PrintUsage();
return EXIT_FAILURE;
} else if (std::string(argv[1]) == "--help") {
PrintUsage();
return EXIT_SUCCESS;
}
std::string input_spv_path = argv[1];
std::ifstream spv_ifstream(input_spv_path.c_str(), std::ios::binary);
if (!spv_ifstream.is_open()) {
std::cerr << "ERROR: could not open '" << input_spv_path << "' for reading" << std::endl;
return EXIT_FAILURE;
}
spv_ifstream.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(spv_ifstream.tellg());
spv_ifstream.seekg(0, std::ios::beg);
{
std::vector<char> spv_data(size);
spv_ifstream.read(spv_data.data(), size);
spv_reflect::ShaderModule reflection(spv_data.size(), spv_data.data());
if (reflection.GetResult() != SPV_REFLECT_RESULT_SUCCESS) {
std::cerr << "ERROR: could not process '" << input_spv_path << "' (is it a valid SPIR-V bytecode?)" << std::endl;
return EXIT_FAILURE;
}
StreamWrite(std::cout, reflection);
std::cout << std::endl << std::endl;
}
return 0;
}

View File

@@ -0,0 +1,557 @@
#include <algorithm>
#include <cassert>
#include "common.h"
#include "sample_spv.h"
#if defined(SPIRV_REFLECT_HAS_VULKAN_H)
#include <vulkan/vulkan.h>
// Returns the size in bytes of the provided VkFormat.
// As this is only intended for vertex attribute formats, not all VkFormats are
// supported.
static uint32_t FormatSize(VkFormat format) {
uint32_t result = 0;
switch (format) {
case VK_FORMAT_UNDEFINED:
result = 0;
break;
case VK_FORMAT_R4G4_UNORM_PACK8:
result = 1;
break;
case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_R5G6B5_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_B5G6R5_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
result = 2;
break;
case VK_FORMAT_R8_UNORM:
result = 1;
break;
case VK_FORMAT_R8_SNORM:
result = 1;
break;
case VK_FORMAT_R8_USCALED:
result = 1;
break;
case VK_FORMAT_R8_SSCALED:
result = 1;
break;
case VK_FORMAT_R8_UINT:
result = 1;
break;
case VK_FORMAT_R8_SINT:
result = 1;
break;
case VK_FORMAT_R8_SRGB:
result = 1;
break;
case VK_FORMAT_R8G8_UNORM:
result = 2;
break;
case VK_FORMAT_R8G8_SNORM:
result = 2;
break;
case VK_FORMAT_R8G8_USCALED:
result = 2;
break;
case VK_FORMAT_R8G8_SSCALED:
result = 2;
break;
case VK_FORMAT_R8G8_UINT:
result = 2;
break;
case VK_FORMAT_R8G8_SINT:
result = 2;
break;
case VK_FORMAT_R8G8_SRGB:
result = 2;
break;
case VK_FORMAT_R8G8B8_UNORM:
result = 3;
break;
case VK_FORMAT_R8G8B8_SNORM:
result = 3;
break;
case VK_FORMAT_R8G8B8_USCALED:
result = 3;
break;
case VK_FORMAT_R8G8B8_SSCALED:
result = 3;
break;
case VK_FORMAT_R8G8B8_UINT:
result = 3;
break;
case VK_FORMAT_R8G8B8_SINT:
result = 3;
break;
case VK_FORMAT_R8G8B8_SRGB:
result = 3;
break;
case VK_FORMAT_B8G8R8_UNORM:
result = 3;
break;
case VK_FORMAT_B8G8R8_SNORM:
result = 3;
break;
case VK_FORMAT_B8G8R8_USCALED:
result = 3;
break;
case VK_FORMAT_B8G8R8_SSCALED:
result = 3;
break;
case VK_FORMAT_B8G8R8_UINT:
result = 3;
break;
case VK_FORMAT_B8G8R8_SINT:
result = 3;
break;
case VK_FORMAT_B8G8R8_SRGB:
result = 3;
break;
case VK_FORMAT_R8G8B8A8_UNORM:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_SNORM:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_USCALED:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_SSCALED:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_UINT:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_SINT:
result = 4;
break;
case VK_FORMAT_R8G8B8A8_SRGB:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_UNORM:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_SNORM:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_USCALED:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_SSCALED:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_UINT:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_SINT:
result = 4;
break;
case VK_FORMAT_B8G8R8A8_SRGB:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_UINT_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_SINT_PACK32:
result = 4;
break;
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_SNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_USCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_SSCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_UINT_PACK32:
result = 4;
break;
case VK_FORMAT_A2R10G10B10_SINT_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
result = 4;
break;
case VK_FORMAT_A2B10G10R10_SINT_PACK32:
result = 4;
break;
case VK_FORMAT_R16_UNORM:
result = 2;
break;
case VK_FORMAT_R16_SNORM:
result = 2;
break;
case VK_FORMAT_R16_USCALED:
result = 2;
break;
case VK_FORMAT_R16_SSCALED:
result = 2;
break;
case VK_FORMAT_R16_UINT:
result = 2;
break;
case VK_FORMAT_R16_SINT:
result = 2;
break;
case VK_FORMAT_R16_SFLOAT:
result = 2;
break;
case VK_FORMAT_R16G16_UNORM:
result = 4;
break;
case VK_FORMAT_R16G16_SNORM:
result = 4;
break;
case VK_FORMAT_R16G16_USCALED:
result = 4;
break;
case VK_FORMAT_R16G16_SSCALED:
result = 4;
break;
case VK_FORMAT_R16G16_UINT:
result = 4;
break;
case VK_FORMAT_R16G16_SINT:
result = 4;
break;
case VK_FORMAT_R16G16_SFLOAT:
result = 4;
break;
case VK_FORMAT_R16G16B16_UNORM:
result = 6;
break;
case VK_FORMAT_R16G16B16_SNORM:
result = 6;
break;
case VK_FORMAT_R16G16B16_USCALED:
result = 6;
break;
case VK_FORMAT_R16G16B16_SSCALED:
result = 6;
break;
case VK_FORMAT_R16G16B16_UINT:
result = 6;
break;
case VK_FORMAT_R16G16B16_SINT:
result = 6;
break;
case VK_FORMAT_R16G16B16_SFLOAT:
result = 6;
break;
case VK_FORMAT_R16G16B16A16_UNORM:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_SNORM:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_USCALED:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_SSCALED:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_UINT:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_SINT:
result = 8;
break;
case VK_FORMAT_R16G16B16A16_SFLOAT:
result = 8;
break;
case VK_FORMAT_R32_UINT:
result = 4;
break;
case VK_FORMAT_R32_SINT:
result = 4;
break;
case VK_FORMAT_R32_SFLOAT:
result = 4;
break;
case VK_FORMAT_R32G32_UINT:
result = 8;
break;
case VK_FORMAT_R32G32_SINT:
result = 8;
break;
case VK_FORMAT_R32G32_SFLOAT:
result = 8;
break;
case VK_FORMAT_R32G32B32_UINT:
result = 12;
break;
case VK_FORMAT_R32G32B32_SINT:
result = 12;
break;
case VK_FORMAT_R32G32B32_SFLOAT:
result = 12;
break;
case VK_FORMAT_R32G32B32A32_UINT:
result = 16;
break;
case VK_FORMAT_R32G32B32A32_SINT:
result = 16;
break;
case VK_FORMAT_R32G32B32A32_SFLOAT:
result = 16;
break;
case VK_FORMAT_R64_UINT:
result = 8;
break;
case VK_FORMAT_R64_SINT:
result = 8;
break;
case VK_FORMAT_R64_SFLOAT:
result = 8;
break;
case VK_FORMAT_R64G64_UINT:
result = 16;
break;
case VK_FORMAT_R64G64_SINT:
result = 16;
break;
case VK_FORMAT_R64G64_SFLOAT:
result = 16;
break;
case VK_FORMAT_R64G64B64_UINT:
result = 24;
break;
case VK_FORMAT_R64G64B64_SINT:
result = 24;
break;
case VK_FORMAT_R64G64B64_SFLOAT:
result = 24;
break;
case VK_FORMAT_R64G64B64A64_UINT:
result = 32;
break;
case VK_FORMAT_R64G64B64A64_SINT:
result = 32;
break;
case VK_FORMAT_R64G64B64A64_SFLOAT:
result = 32;
break;
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
result = 4;
break;
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
result = 4;
break;
default:
break;
}
return result;
}
#endif
int main(int argn, char** argv) {
SpvReflectShaderModule module = {};
SpvReflectResult result = spvReflectCreateShaderModule(sizeof(k_sample_spv), k_sample_spv, &module);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
uint32_t count = 0;
result = spvReflectEnumerateInputVariables(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectInterfaceVariable*> input_vars(count);
result = spvReflectEnumerateInputVariables(&module, &count, input_vars.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
count = 0;
result = spvReflectEnumerateOutputVariables(&module, &count, NULL);
assert(result == SPV_REFLECT_RESULT_SUCCESS);
std::vector<SpvReflectInterfaceVariable*> output_vars(count);
result = spvReflectEnumerateOutputVariables(&module, &count, output_vars.data());
assert(result == SPV_REFLECT_RESULT_SUCCESS);
#if defined(SPIRV_REFLECT_HAS_VULKAN_H)
if (module.shader_stage == SPV_REFLECT_SHADER_STAGE_VERTEX_BIT) {
// Demonstrates how to generate all necessary data structures to populate
// a VkPipelineVertexInputStateCreateInfo structure, given the module's
// expected input variables.
//
// Simplifying assumptions:
// - All vertex input attributes are sourced from a single vertex buffer,
// bound to VB slot 0.
// - Each vertex's attribute are laid out in ascending order by location.
// - The format of each attribute matches its usage in the shader;
// float4 -> VK_FORMAT_R32G32B32A32_FLOAT, etc. No attribute compression
// is applied.
// - All attributes are provided per-vertex, not per-instance.
VkVertexInputBindingDescription binding_description = {};
binding_description.binding = 0;
binding_description.stride = 0; // computed below
binding_description.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
VkPipelineVertexInputStateCreateInfo vertex_input_state_create_info = {
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
std::vector<VkVertexInputAttributeDescription> attribute_descriptions;
attribute_descriptions.reserve(input_vars.size());
for (size_t i_var = 0; i_var < input_vars.size(); ++i_var) {
const SpvReflectInterfaceVariable& refl_var = *(input_vars[i_var]);
// ignore built-in variables
if (refl_var.decoration_flags & SPV_REFLECT_DECORATION_BUILT_IN) {
continue;
}
VkVertexInputAttributeDescription attr_desc{};
attr_desc.location = refl_var.location;
attr_desc.binding = binding_description.binding;
attr_desc.format = static_cast<VkFormat>(refl_var.format);
attr_desc.offset = 0; // final offset computed below after sorting.
attribute_descriptions.push_back(attr_desc);
}
// Sort attributes by location
std::sort(std::begin(attribute_descriptions), std::end(attribute_descriptions),
[](const VkVertexInputAttributeDescription& a, const VkVertexInputAttributeDescription& b) {
return a.location < b.location;
});
// Compute final offsets of each attribute, and total vertex stride.
for (auto& attribute : attribute_descriptions) {
uint32_t format_size = FormatSize(attribute.format);
attribute.offset = binding_description.stride;
binding_description.stride += format_size;
}
// Nothing further is done with attribute_descriptions or
// binding_description in this sample. A real application would probably
// derive this information from its mesh format(s); a similar mechanism
// could be used to ensure mesh/shader compatibility.
}
#endif
// Log the interface variables to stdout
const char* t = " ";
const char* tt = " ";
PrintModuleInfo(std::cout, module);
std::cout << "\n\n";
std::cout << "Input variables:"
<< "\n";
for (size_t index = 0; index < input_vars.size(); ++index) {
auto p_var = input_vars[index];
// input variables can also be retrieved directly from the module, by
// location (unless the location is (uint32_t)-1, as is the case with
// built-in inputs)
auto p_var2 = spvReflectGetInputVariableByLocation(&module, p_var->location, &result);
if (p_var->location == UINT32_MAX) {
assert(result == SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND);
assert(p_var2 == nullptr);
} else {
assert(result == SPV_REFLECT_RESULT_SUCCESS);
assert(p_var == p_var2);
}
(void)p_var2;
// input variables can also be retrieved directly from the module, by
// semantic (if present)
p_var2 = spvReflectGetInputVariableBySemantic(&module, p_var->semantic, &result);
if (!p_var->semantic) {
assert(result == SPV_REFLECT_RESULT_ERROR_NULL_POINTER);
assert(p_var2 == nullptr);
} else if (p_var->semantic[0] != '\0') {
assert(result == SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND);
assert(p_var2 == nullptr);
} else {
assert(result == SPV_REFLECT_RESULT_SUCCESS);
assert(p_var == p_var2);
}
(void)p_var2;
std::cout << t << index << ":"
<< "\n";
PrintInterfaceVariable(std::cout, module.source_language, *p_var, tt);
std::cout << "\n\n";
}
std::cout << "Output variables:"
<< "\n";
for (size_t index = 0; index < output_vars.size(); ++index) {
auto p_var = output_vars[index];
// output variables can also be retrieved directly from the module, by
// location (unless the location is (uint32_t)-1, as is the case with
// built-in outputs)
auto p_var2 = spvReflectGetOutputVariableByLocation(&module, p_var->location, &result);
if (p_var->location == UINT32_MAX) {
assert(result == SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND);
assert(p_var2 == nullptr);
} else {
assert(result == SPV_REFLECT_RESULT_SUCCESS);
assert(p_var == p_var2);
}
(void)p_var2;
// output variables can also be retrieved directly from the module, by
// semantic (if present)
p_var2 = spvReflectGetOutputVariableBySemantic(&module, p_var->semantic, &result);
if (!p_var->semantic) {
assert(result == SPV_REFLECT_RESULT_ERROR_NULL_POINTER);
assert(p_var2 == nullptr);
} else if (p_var->semantic[0] != '\0') {
assert(result == SPV_REFLECT_RESULT_ERROR_ELEMENT_NOT_FOUND);
assert(p_var2 == nullptr);
} else {
assert(result == SPV_REFLECT_RESULT_SUCCESS);
assert(p_var == p_var2);
}
(void)p_var2;
std::cout << t << index << ":"
<< "\n";
PrintInterfaceVariable(std::cout, module.source_language, *p_var, tt);
std::cout << "\n\n";
}
spvReflectDestroyShaderModule(&module);
return 0;
}

View File

@@ -0,0 +1,64 @@
Texture2D MyTexture : register(t0, space0);
SamplerState MySampler : register(s1, space1);
struct RGB {
float r;
float g;
float b;
};
struct UBO {
float4x4 XformMatrix;
float3 Scale;
RGB Rgb;
float t;
float2 uv;
};
ConstantBuffer<UBO> MyConstants : register(b2, space2);
struct Data {
float4 Element;
};
ConsumeStructuredBuffer<Data> MyBufferIn : register(u3, space2);
AppendStructuredBuffer<Data> MyBufferOut : register(u4, space2);
struct PSInput {
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float3 Color : COLOR;
float Alpha : OPACITY;
float4 Scaling : SCALE;
float2 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float2 TexCoord2 : TEXCOORD2;
};
struct PSOutput {
float4 oColor0 : SV_TARGET0;
float4 oColor1 : SV_TARGET1;
float4 oColor2 : SV_TARGET2;
float4 oColor3 : SV_TARGET3;
float4 oColor4 : SV_TARGET4;
float4 oColor5 : SV_TARGET5;
float4 oColor6 : SV_TARGET6;
float4 oColor7 : SV_TARGET7;
};
PSOutput main(PSInput input)
{
Data val = MyBufferIn[0];
MyBufferOut[0] = val;
PSOutput ret;
ret.oColor0 = mul(MyConstants.XformMatrix, input.Position);
ret.oColor1 = float4(input.Normal, 1) + float4(MyConstants.Scale, 0);
ret.oColor2 = float4(input.Color, 1);
ret.oColor3 = float4(MyTexture.Sample(MySampler, input.TexCoord0).xyz, input.Alpha);
ret.oColor4 = input.Scaling;
ret.oColor5 = float4(input.TexCoord0, 0, 0);
ret.oColor6 = float4(input.TexCoord1, 0, 0);
ret.oColor7 = float4(input.TexCoord2, 0, 0);
return ret;
}

Binary file not shown.

View File

@@ -0,0 +1,527 @@
#ifndef SAMPLE_SPV_H
#define SAMPLE_SPV_H
#include <stdint.h>
/* Source from sample.hlsl
Texture2D MyTexture : register(t0, space0);
SamplerState MySampler : register(s1, space1);
struct RGB {
float r;
float g;
float b;
};
struct UBO {
float4x4 XformMatrix;
float3 Scale;
RGB Rgb;
float t;
float2 uv;
};
ConstantBuffer<UBO> MyConstants : register(b2, space2);
struct Data {
float4 Element;
};
ConsumeStructuredBuffer<Data> MyBufferIn : register(u3, space2);
AppendStructuredBuffer<Data> MyBufferOut : register(u4, space2);
struct PSInput {
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float3 Color : COLOR;
float Alpha : OPACITY;
float4 Scaling : SCALE;
float2 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float2 TexCoord2 : TEXCOORD2;
};
struct PSOutput {
float4 oColor0 : SV_TARGET0;
float4 oColor1 : SV_TARGET1;
float4 oColor2 : SV_TARGET2;
float4 oColor3 : SV_TARGET3;
float4 oColor4 : SV_TARGET4;
float4 oColor5 : SV_TARGET5;
float4 oColor6 : SV_TARGET6;
float4 oColor7 : SV_TARGET7;
};
PSOutput main(PSInput input)
{
Data val = MyBufferIn[0];
MyBufferOut[0] = val;
PSOutput ret;
ret.oColor0 = mul(MyConstants.XformMatrix, input.Position);
ret.oColor1 = float4(input.Normal, 1) + float4(MyConstants.Scale, 0);
ret.oColor2 = float4(input.Color, 1);
ret.oColor3 = float4(MyTexture.Sample(MySampler, input.TexCoord0).xyz, input.Alpha);
ret.oColor4 = input.Scaling;
ret.oColor5 = float4(input.TexCoord0, 0, 0);
ret.oColor6 = float4(input.TexCoord1, 0, 0);
ret.oColor7 = float4(input.TexCoord2, 0, 0);
return ret;
}
*/
// Imported from file 'sample.spv'
const uint32_t k_sample_spv[] = {
0x07230203,0x00010000,0x000d0004,0x00000106,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0015000f,0x00000004,0x00000004,0x6e69616d,
0x00000000,0x00000086,0x0000008a,0x0000008d,
0x00000091,0x00000094,0x00000098,0x0000009b,
0x0000009e,0x000000a6,0x000000a9,0x000000ac,
0x000000af,0x000000b2,0x000000b5,0x000000b8,
0x000000bb,0x00030010,0x00000004,0x00000007,
0x00030003,0x00000005,0x000001f4,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00040005,0x00000014,0x61746144,
0x00000000,0x00050006,0x00000014,0x00000000,
0x6d656c45,0x00746e65,0x00050005,0x00000016,
0x7542794d,0x72656666,0x00006e49,0x00050006,
0x00000016,0x00000000,0x74616440,0x00000061,
0x00050005,0x00000018,0x7542794d,0x72656666,
0x00006e49,0x00050005,0x00000021,0x7542794d,
0x72656666,0x0074754f,0x00030005,0x0000002c,
0x00424752,0x00040006,0x0000002c,0x00000000,
0x00000072,0x00040006,0x0000002c,0x00000001,
0x00000067,0x00040006,0x0000002c,0x00000002,
0x00000062,0x00050005,0x0000002d,0x6f43794d,
0x6174736e,0x0073746e,0x00060006,0x0000002d,
0x00000000,0x726f6658,0x74614d6d,0x00786972,
0x00050006,0x0000002d,0x00000001,0x6c616353,
0x00000065,0x00040006,0x0000002d,0x00000002,
0x00626752,0x00040006,0x0000002d,0x00000003,
0x00000074,0x00040006,0x0000002d,0x00000004,
0x00007675,0x00050005,0x0000002f,0x6f43794d,
0x6174736e,0x0073746e,0x00050005,0x00000053,
0x6554794d,0x72757478,0x00000065,0x00050005,
0x00000057,0x6153794d,0x656c706d,0x00000072,
0x00060005,0x00000086,0x75706e69,0x6f502e74,
0x69746973,0x00006e6f,0x00060005,0x0000008a,
0x75706e69,0x6f4e2e74,0x6c616d72,0x00000000,
0x00050005,0x0000008d,0x75706e69,0x6f432e74,
0x00726f6c,0x00050005,0x00000091,0x75706e69,
0x6c412e74,0x00616870,0x00060005,0x00000094,
0x75706e69,0x63532e74,0x6e696c61,0x00000067,
0x00060005,0x00000098,0x75706e69,0x65542e74,
0x6f6f4378,0x00306472,0x00060005,0x0000009b,
0x75706e69,0x65542e74,0x6f6f4378,0x00316472,
0x00060005,0x0000009e,0x75706e69,0x65542e74,
0x6f6f4378,0x00326472,0x00090005,0x000000a6,
0x746e6540,0x6f507972,0x4f746e69,0x75707475,
0x436f2e74,0x726f6c6f,0x00000030,0x00090005,
0x000000a9,0x746e6540,0x6f507972,0x4f746e69,
0x75707475,0x436f2e74,0x726f6c6f,0x00000031,
0x00090005,0x000000ac,0x746e6540,0x6f507972,
0x4f746e69,0x75707475,0x436f2e74,0x726f6c6f,
0x00000032,0x00090005,0x000000af,0x746e6540,
0x6f507972,0x4f746e69,0x75707475,0x436f2e74,
0x726f6c6f,0x00000033,0x00090005,0x000000b2,
0x746e6540,0x6f507972,0x4f746e69,0x75707475,
0x436f2e74,0x726f6c6f,0x00000034,0x00090005,
0x000000b5,0x746e6540,0x6f507972,0x4f746e69,
0x75707475,0x436f2e74,0x726f6c6f,0x00000035,
0x00090005,0x000000b8,0x746e6540,0x6f507972,
0x4f746e69,0x75707475,0x436f2e74,0x726f6c6f,
0x00000036,0x00090005,0x000000bb,0x746e6540,
0x6f507972,0x4f746e69,0x75707475,0x436f2e74,
0x726f6c6f,0x00000037,0x00050048,0x00000014,
0x00000000,0x00000023,0x00000000,0x00040047,
0x00000015,0x00000006,0x00000010,0x00050048,
0x00000016,0x00000000,0x00000023,0x00000000,
0x00030047,0x00000016,0x00000003,0x00040047,
0x00000018,0x00000022,0x00000002,0x00040047,
0x00000018,0x00000021,0x00000003,0x00040047,
0x00000021,0x00000022,0x00000002,0x00040047,
0x00000021,0x00000021,0x00000004,0x00050048,
0x0000002c,0x00000000,0x00000023,0x00000000,
0x00050048,0x0000002c,0x00000001,0x00000023,
0x00000004,0x00050048,0x0000002c,0x00000002,
0x00000023,0x00000008,0x00040048,0x0000002d,
0x00000000,0x00000004,0x00050048,0x0000002d,
0x00000000,0x00000023,0x00000000,0x00050048,
0x0000002d,0x00000000,0x00000007,0x00000010,
0x00050048,0x0000002d,0x00000001,0x00000023,
0x00000040,0x00050048,0x0000002d,0x00000002,
0x00000023,0x00000050,0x00050048,0x0000002d,
0x00000003,0x00000023,0x00000060,0x00050048,
0x0000002d,0x00000004,0x00000023,0x00000064,
0x00030047,0x0000002d,0x00000002,0x00040047,
0x0000002f,0x00000022,0x00000002,0x00040047,
0x0000002f,0x00000021,0x00000002,0x00040047,
0x00000053,0x00000022,0x00000000,0x00040047,
0x00000053,0x00000021,0x00000000,0x00040047,
0x00000057,0x00000022,0x00000001,0x00040047,
0x00000057,0x00000021,0x00000001,0x00040047,
0x00000086,0x0000000b,0x0000000f,0x00040047,
0x0000008a,0x0000001e,0x00000000,0x00040047,
0x0000008d,0x0000001e,0x00000001,0x00040047,
0x00000091,0x0000001e,0x00000002,0x00040047,
0x00000094,0x0000001e,0x00000003,0x00040047,
0x00000098,0x0000001e,0x00000004,0x00040047,
0x0000009b,0x0000001e,0x00000005,0x00040047,
0x0000009e,0x0000001e,0x00000006,0x00040047,
0x000000a6,0x0000001e,0x00000000,0x00040047,
0x000000a9,0x0000001e,0x00000001,0x00040047,
0x000000ac,0x0000001e,0x00000002,0x00040047,
0x000000af,0x0000001e,0x00000003,0x00040047,
0x000000b2,0x0000001e,0x00000004,0x00040047,
0x000000b5,0x0000001e,0x00000005,0x00040047,
0x000000b8,0x0000001e,0x00000006,0x00040047,
0x000000bb,0x0000001e,0x00000007,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00030016,0x00000006,0x00000020,0x00040017,
0x00000007,0x00000006,0x00000004,0x00040017,
0x00000008,0x00000006,0x00000003,0x00040017,
0x00000009,0x00000006,0x00000002,0x0003001e,
0x00000014,0x00000007,0x0003001d,0x00000015,
0x00000014,0x0003001e,0x00000016,0x00000015,
0x00040020,0x00000017,0x00000002,0x00000016,
0x0004003b,0x00000017,0x00000018,0x00000002,
0x00040015,0x00000019,0x00000020,0x00000001,
0x0004002b,0x00000019,0x0000001a,0x00000000,
0x00040020,0x0000001b,0x00000002,0x00000014,
0x0004003b,0x00000017,0x00000021,0x00000002,
0x00040020,0x00000025,0x00000002,0x00000007,
0x00040018,0x0000002b,0x00000007,0x00000004,
0x0005001e,0x0000002c,0x00000006,0x00000006,
0x00000006,0x0007001e,0x0000002d,0x0000002b,
0x00000008,0x0000002c,0x00000006,0x00000009,
0x00040020,0x0000002e,0x00000002,0x0000002d,
0x0004003b,0x0000002e,0x0000002f,0x00000002,
0x00040020,0x00000030,0x00000002,0x0000002b,
0x0004002b,0x00000019,0x00000035,0x00000001,
0x0004002b,0x00000006,0x00000039,0x3f800000,
0x00040020,0x0000003e,0x00000002,0x00000008,
0x0004002b,0x00000006,0x00000041,0x00000000,
0x00090019,0x00000051,0x00000006,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x00040020,0x00000052,0x00000000,
0x00000051,0x0004003b,0x00000052,0x00000053,
0x00000000,0x0002001a,0x00000055,0x00040020,
0x00000056,0x00000000,0x00000055,0x0004003b,
0x00000056,0x00000057,0x00000000,0x0003001b,
0x00000059,0x00000051,0x00040020,0x00000085,
0x00000001,0x00000007,0x0004003b,0x00000085,
0x00000086,0x00000001,0x00040020,0x00000089,
0x00000001,0x00000008,0x0004003b,0x00000089,
0x0000008a,0x00000001,0x0004003b,0x00000089,
0x0000008d,0x00000001,0x00040020,0x00000090,
0x00000001,0x00000006,0x0004003b,0x00000090,
0x00000091,0x00000001,0x0004003b,0x00000085,
0x00000094,0x00000001,0x00040020,0x00000097,
0x00000001,0x00000009,0x0004003b,0x00000097,
0x00000098,0x00000001,0x0004003b,0x00000097,
0x0000009b,0x00000001,0x0004003b,0x00000097,
0x0000009e,0x00000001,0x00040020,0x000000a5,
0x00000003,0x00000007,0x0004003b,0x000000a5,
0x000000a6,0x00000003,0x0004003b,0x000000a5,
0x000000a9,0x00000003,0x0004003b,0x000000a5,
0x000000ac,0x00000003,0x0004003b,0x000000a5,
0x000000af,0x00000003,0x0004003b,0x000000a5,
0x000000b2,0x00000003,0x0004003b,0x000000a5,
0x000000b5,0x00000003,0x0004003b,0x000000a5,
0x000000b8,0x00000003,0x0004003b,0x000000a5,
0x000000bb,0x00000003,0x00050036,0x00000002,
0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x0004003d,0x00000007,0x00000087,
0x00000086,0x0004003d,0x00000008,0x0000008b,
0x0000008a,0x0004003d,0x00000008,0x0000008e,
0x0000008d,0x0004003d,0x00000006,0x00000092,
0x00000091,0x0004003d,0x00000007,0x00000095,
0x00000094,0x0004003d,0x00000009,0x00000099,
0x00000098,0x0004003d,0x00000009,0x0000009c,
0x0000009b,0x0004003d,0x00000009,0x0000009f,
0x0000009e,0x00060041,0x0000001b,0x000000c1,
0x00000018,0x0000001a,0x0000001a,0x0004003d,
0x00000014,0x000000c2,0x000000c1,0x00050051,
0x00000007,0x000000c3,0x000000c2,0x00000000,
0x00060041,0x0000001b,0x000000c6,0x00000021,
0x0000001a,0x0000001a,0x00050041,0x00000025,
0x000000c8,0x000000c6,0x0000001a,0x0003003e,
0x000000c8,0x000000c3,0x00050041,0x00000030,
0x000000cb,0x0000002f,0x0000001a,0x0004003d,
0x0000002b,0x000000cc,0x000000cb,0x00050090,
0x00000007,0x000000cd,0x00000087,0x000000cc,
0x00050051,0x00000006,0x000000d1,0x0000008b,
0x00000000,0x00050051,0x00000006,0x000000d2,
0x0000008b,0x00000001,0x00050051,0x00000006,
0x000000d3,0x0000008b,0x00000002,0x00070050,
0x00000007,0x000000d4,0x000000d1,0x000000d2,
0x000000d3,0x00000039,0x00050041,0x0000003e,
0x000000d5,0x0000002f,0x00000035,0x0004003d,
0x00000008,0x000000d6,0x000000d5,0x00050051,
0x00000006,0x000000d7,0x000000d6,0x00000000,
0x00050051,0x00000006,0x000000d8,0x000000d6,
0x00000001,0x00050051,0x00000006,0x000000d9,
0x000000d6,0x00000002,0x00070050,0x00000007,
0x000000da,0x000000d7,0x000000d8,0x000000d9,
0x00000041,0x00050081,0x00000007,0x000000db,
0x000000d4,0x000000da,0x00050051,0x00000006,
0x000000df,0x0000008e,0x00000000,0x00050051,
0x00000006,0x000000e0,0x0000008e,0x00000001,
0x00050051,0x00000006,0x000000e1,0x0000008e,
0x00000002,0x00070050,0x00000007,0x000000e2,
0x000000df,0x000000e0,0x000000e1,0x00000039,
0x0004003d,0x00000051,0x000000e4,0x00000053,
0x0004003d,0x00000055,0x000000e5,0x00000057,
0x00050056,0x00000059,0x000000e6,0x000000e4,
0x000000e5,0x00050057,0x00000007,0x000000e9,
0x000000e6,0x00000099,0x0008004f,0x00000008,
0x000000ea,0x000000e9,0x000000e9,0x00000000,
0x00000001,0x00000002,0x00050051,0x00000006,
0x000000ed,0x000000ea,0x00000000,0x00050051,
0x00000006,0x000000ee,0x000000ea,0x00000001,
0x00050051,0x00000006,0x000000ef,0x000000ea,
0x00000002,0x00070050,0x00000007,0x000000f0,
0x000000ed,0x000000ee,0x000000ef,0x00000092,
0x00050051,0x00000006,0x000000f7,0x00000099,
0x00000000,0x00050051,0x00000006,0x000000f8,
0x00000099,0x00000001,0x00070050,0x00000007,
0x000000f9,0x000000f7,0x000000f8,0x00000041,
0x00000041,0x00050051,0x00000006,0x000000fd,
0x0000009c,0x00000000,0x00050051,0x00000006,
0x000000fe,0x0000009c,0x00000001,0x00070050,
0x00000007,0x000000ff,0x000000fd,0x000000fe,
0x00000041,0x00000041,0x00050051,0x00000006,
0x00000103,0x0000009f,0x00000000,0x00050051,
0x00000006,0x00000104,0x0000009f,0x00000001,
0x00070050,0x00000007,0x00000105,0x00000103,
0x00000104,0x00000041,0x00000041,0x0003003e,
0x000000a6,0x000000cd,0x0003003e,0x000000a9,
0x000000db,0x0003003e,0x000000ac,0x000000e2,
0x0003003e,0x000000af,0x000000f0,0x0003003e,
0x000000b2,0x00000095,0x0003003e,0x000000b5,
0x000000f9,0x0003003e,0x000000b8,0x000000ff,
0x0003003e,0x000000bb,0x00000105,0x000100fd,
0x00010038
};
/* SPIRV Disassembly
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 2
; Bound: 241
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %117 %121 %124 %128 %131 %135 %138 %141 %149 %152 %155 %158 %161 %164 %167 %170
OpExecutionMode %4 OriginUpperLeft
OpSource HLSL 500
OpName %4 "main"
OpName %10 "PSInput"
OpMemberName %10 0 "Position"
OpMemberName %10 1 "Normal"
OpMemberName %10 2 "Color"
OpMemberName %10 3 "Alpha"
OpMemberName %10 4 "Scaling"
OpMemberName %10 5 "TexCoord0"
OpMemberName %10 6 "TexCoord1"
OpMemberName %10 7 "TexCoord2"
OpName %12 "PSOutput"
OpMemberName %12 0 "oColor0"
OpMemberName %12 1 "oColor1"
OpMemberName %12 2 "oColor2"
OpMemberName %12 3 "oColor3"
OpMemberName %12 4 "oColor4"
OpMemberName %12 5 "oColor5"
OpMemberName %12 6 "oColor6"
OpMemberName %12 7 "oColor7"
OpName %17 "Data"
OpMemberName %17 0 "Element"
OpName %20 "Data"
OpMemberName %20 0 "Element"
OpName %22 "MyBufferIn"
OpMemberName %22 0 "@data"
OpName %24 "MyBufferIn"
OpName %33 "MyBufferOut"
OpName %44 "RGB"
OpMemberName %44 0 "r"
OpMemberName %44 1 "g"
OpMemberName %44 2 "b"
OpName %45 "MyConstants"
OpMemberName %45 0 "XformMatrix"
OpMemberName %45 1 "Scale"
OpMemberName %45 2 "Rgb"
OpMemberName %45 3 "t"
OpMemberName %45 4 "uv"
OpName %47 "MyConstants"
OpName %117 "input.Position"
OpName %121 "input.Normal"
OpName %124 "input.Color"
OpName %128 "input.Alpha"
OpName %131 "input.Scaling"
OpName %135 "input.TexCoord0"
OpName %138 "input.TexCoord1"
OpName %141 "input.TexCoord2"
OpName %149 "@entryPointOutput.oColor0"
OpName %152 "@entryPointOutput.oColor1"
OpName %155 "@entryPointOutput.oColor2"
OpName %158 "@entryPointOutput.oColor3"
OpName %161 "@entryPointOutput.oColor4"
OpName %164 "@entryPointOutput.oColor5"
OpName %167 "@entryPointOutput.oColor6"
OpName %170 "@entryPointOutput.oColor7"
OpMemberDecorate %20 0 Offset 0
OpDecorate %21 ArrayStride 16
OpMemberDecorate %22 0 Offset 0
OpDecorate %22 BufferBlock
OpDecorate %24 DescriptorSet 2
OpDecorate %24 Binding 3
OpDecorate %33 DescriptorSet 2
OpDecorate %33 Binding 4
OpMemberDecorate %44 0 Offset 0
OpMemberDecorate %44 1 Offset 4
OpMemberDecorate %44 2 Offset 8
OpMemberDecorate %45 0 RowMajor
OpMemberDecorate %45 0 Offset 0
OpMemberDecorate %45 0 MatrixStride 16
OpMemberDecorate %45 1 Offset 64
OpMemberDecorate %45 2 Offset 80
OpMemberDecorate %45 3 Offset 96
OpMemberDecorate %45 4 Offset 100
OpDecorate %45 Block
OpDecorate %47 DescriptorSet 2
OpDecorate %47 Binding 2
OpDecorate %117 BuiltIn FragCoord
OpDecorate %121 Location 0
OpDecorate %124 Location 1
OpDecorate %128 Location 2
OpDecorate %131 Location 3
OpDecorate %135 Location 4
OpDecorate %138 Location 5
OpDecorate %141 Location 6
OpDecorate %149 Location 0
OpDecorate %152 Location 1
OpDecorate %155 Location 2
OpDecorate %158 Location 3
OpDecorate %161 Location 4
OpDecorate %164 Location 5
OpDecorate %167 Location 6
OpDecorate %170 Location 7
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypeVector %6 4
%8 = OpTypeVector %6 3
%9 = OpTypeVector %6 2
%10 = OpTypeStruct %7 %8 %8 %6 %7 %9 %9 %9
%12 = OpTypeStruct %7 %7 %7 %7 %7 %7 %7 %7
%17 = OpTypeStruct %7
%20 = OpTypeStruct %7
%21 = OpTypeRuntimeArray %20
%22 = OpTypeStruct %21
%23 = OpTypePointer Uniform %22
%24 = OpVariable %23 Uniform
%25 = OpTypeInt 32 1
%26 = OpConstant %25 0
%27 = OpTypePointer Uniform %20
%33 = OpVariable %23 Uniform
%37 = OpTypePointer Uniform %7
%43 = OpTypeMatrix %7 4
%44 = OpTypeStruct %6 %6 %6
%45 = OpTypeStruct %43 %8 %44 %6 %9
%46 = OpTypePointer Uniform %45
%47 = OpVariable %46 Uniform
%48 = OpTypePointer Uniform %43
%53 = OpConstant %25 1
%57 = OpConstant %6 1
%62 = OpTypePointer Uniform %8
%65 = OpConstant %6 0
%116 = OpTypePointer Input %7
%117 = OpVariable %116 Input
%120 = OpTypePointer Input %8
%121 = OpVariable %120 Input
%124 = OpVariable %120 Input
%127 = OpTypePointer Input %6
%128 = OpVariable %127 Input
%131 = OpVariable %116 Input
%134 = OpTypePointer Input %9
%135 = OpVariable %134 Input
%138 = OpVariable %134 Input
%141 = OpVariable %134 Input
%148 = OpTypePointer Output %7
%149 = OpVariable %148 Output
%152 = OpVariable %148 Output
%155 = OpVariable %148 Output
%158 = OpVariable %148 Output
%161 = OpVariable %148 Output
%164 = OpVariable %148 Output
%167 = OpVariable %148 Output
%170 = OpVariable %148 Output
%4 = OpFunction %2 None %3
%5 = OpLabel
%118 = OpLoad %7 %117
%122 = OpLoad %8 %121
%125 = OpLoad %8 %124
%129 = OpLoad %6 %128
%132 = OpLoad %7 %131
%136 = OpLoad %9 %135
%139 = OpLoad %9 %138
%142 = OpLoad %9 %141
%182 = OpAccessChain %27 %24 %26 %26
%183 = OpLoad %20 %182
%184 = OpCompositeExtract %7 %183 0
%187 = OpAccessChain %27 %33 %26 %26
%189 = OpAccessChain %37 %187 %26
OpStore %189 %184
%192 = OpAccessChain %48 %47 %26
%193 = OpLoad %43 %192
%194 = OpVectorTimesMatrix %7 %118 %193
%198 = OpCompositeExtract %6 %122 0
%199 = OpCompositeExtract %6 %122 1
%200 = OpCompositeExtract %6 %122 2
%201 = OpCompositeConstruct %7 %198 %199 %200 %57
%202 = OpAccessChain %62 %47 %53
%203 = OpLoad %8 %202
%204 = OpCompositeExtract %6 %203 0
%205 = OpCompositeExtract %6 %203 1
%206 = OpCompositeExtract %6 %203 2
%207 = OpCompositeConstruct %7 %204 %205 %206 %65
%208 = OpFAdd %7 %201 %207
%212 = OpCompositeExtract %6 %125 0
%213 = OpCompositeExtract %6 %125 1
%214 = OpCompositeExtract %6 %125 2
%215 = OpCompositeConstruct %7 %212 %213 %214 %57
%219 = OpCompositeConstruct %7 %65 %65 %65 %129
%226 = OpCompositeExtract %6 %136 0
%227 = OpCompositeExtract %6 %136 1
%228 = OpCompositeConstruct %7 %226 %227 %65 %65
%232 = OpCompositeExtract %6 %139 0
%233 = OpCompositeExtract %6 %139 1
%234 = OpCompositeConstruct %7 %232 %233 %65 %65
%238 = OpCompositeExtract %6 %142 0
%239 = OpCompositeExtract %6 %142 1
%240 = OpCompositeConstruct %7 %238 %239 %65 %65
OpStore %149 %194
OpStore %152 %208
OpStore %155 %215
OpStore %158 %219
OpStore %161 %132
OpStore %164 %228
OpStore %167 %234
OpStore %170 %240
OpReturn
OpFunctionEnd
*/
#endif // SAMPLE_SPV_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,211 @@
/*
Copyright 2017-2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <cstdint>
#include <cstdio>
#if defined(WIN32)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#endif
#include <cassert>
#include <cstring>
#include <fstream>
#include <iostream>
#include "common/output_stream.h"
#include "examples/arg_parser.h"
#include "spirv_reflect.h"
// =================================================================================================
// PrintUsage()
// =================================================================================================
void PrintUsage() {
std::cout << "Usage: spirv-reflect [OPTIONS] path/to/SPIR-V/bytecode.spv" << std::endl
<< "Prints a summary of the reflection data extracted from SPIR-V "
"bytecode."
<< std::endl
<< "Options:" << std::endl
<< " --help Display this message" << std::endl
<< " -o,--output Print output to file. [default: stdout]" << std::endl
<< " -y,--yaml Format output as YAML. [default: disabled]" << std::endl
<< " -v VERBOSITY Specify output verbosity (YAML output "
"only):"
<< std::endl
<< " 0: shader info, block variables, interface "
"variables,"
<< std::endl
<< " descriptor bindings. No type "
"descriptions. [default]"
<< std::endl
<< " 1: Everything above, plus type "
"descriptions."
<< std::endl
<< " 2: Everything above, plus SPIR-V bytecode "
"and all internal"
<< std::endl
<< " type descriptions. If you're not "
"working on SPIRV-Reflect"
<< std::endl
<< " itself, you probably don't want this." << std::endl
<< "-e,--entrypoint Prints entry points found in shader "
"module."
<< std::endl
<< "-s,--stage Prints Vulkan shader stages found in "
"shader module."
<< std::endl
<< "-f,--file Prints the source file found in shader "
"module."
<< std::endl
<< "-fcb,--flatten_cbuffers Flatten constant buffers on non-YAML "
"output."
<< std::endl;
}
// =================================================================================================
// main()
// =================================================================================================
int main(int argn, char** argv) {
ArgParser arg_parser;
arg_parser.AddFlag("h", "help", "");
arg_parser.AddOptionString("o", "output", "");
arg_parser.AddFlag("y", "yaml", "");
arg_parser.AddOptionInt("v", "verbosity", "", 0);
arg_parser.AddFlag("e", "entrypoint", "");
arg_parser.AddFlag("s", "stage", "");
arg_parser.AddFlag("f", "file", "");
arg_parser.AddFlag("fcb", "flatten_cbuffers", "");
arg_parser.AddFlag("ci", "ci", ""); // Not advertised
if (!arg_parser.Parse(argn, argv, std::cerr)) {
PrintUsage();
return EXIT_FAILURE;
}
if (arg_parser.GetFlag("h", "help")) {
PrintUsage();
return EXIT_SUCCESS;
}
std::string output_file;
arg_parser.GetString("o", "output", &output_file);
FILE* output_fp = output_file.empty() ? NULL : freopen(output_file.c_str(), "w", stdout);
bool output_as_yaml = arg_parser.GetFlag("y", "yaml");
int yaml_verbosity = 0;
arg_parser.GetInt("v", "verbosity", &yaml_verbosity);
bool print_entry_point = arg_parser.GetFlag("e", "entrypoint");
bool print_shader_stage = arg_parser.GetFlag("s", "stage");
bool print_source_file = arg_parser.GetFlag("f", "file");
bool flatten_cbuffers = arg_parser.GetFlag("fcb", "flatten_cbuffers");
bool ci_mode = arg_parser.GetFlag("ci", "ci");
std::string input_spv_path;
std::vector<uint8_t> spv_data;
// Get SPIR-V data/input
if (arg_parser.GetArg(0, &input_spv_path)) {
std::ifstream spv_ifstream(input_spv_path.c_str(), std::ios::binary);
if (!spv_ifstream.is_open()) {
std::cerr << "ERROR: could not open '" << input_spv_path << "' for reading" << std::endl;
return EXIT_FAILURE;
}
spv_ifstream.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(spv_ifstream.tellg());
spv_ifstream.seekg(0, std::ios::beg);
spv_data.resize(size);
spv_ifstream.read((char*)spv_data.data(), size);
} else {
uint8_t buffer[4096];
size_t bytes_read = fread(buffer, 1, sizeof(buffer), stdin);
if (bytes_read == 0) {
std::cerr << "ERROR: no SPIR-V file specified" << std::endl;
return EXIT_FAILURE;
}
spv_data.insert(spv_data.end(), buffer, buffer + bytes_read);
while ((bytes_read = fread(buffer, 1, sizeof(buffer), stdin)) > 0) {
spv_data.insert(spv_data.end(), buffer, buffer + bytes_read);
}
}
// run reflection with input
{
spv_reflect::ShaderModule reflection(spv_data.size(), spv_data.data());
if (reflection.GetResult() != SPV_REFLECT_RESULT_SUCCESS) {
std::cerr << "ERROR: could not process '" << input_spv_path << "' (is it a valid SPIR-V bytecode?)" << std::endl;
return EXIT_FAILURE;
}
if (ci_mode) {
// When running CI we want to just test that SPIRV-Reflect doesn't crash,
// The output is not important (as there is nothing to compare it too)
// This hidden flag is here to allow a way to suppress the logging in CI
// to only the shader name (otherwise the logs noise and GBs large)
std::cout << input_spv_path << std::endl;
return EXIT_SUCCESS;
}
if (print_entry_point || print_shader_stage || print_source_file) {
size_t printed_count = 0;
if (print_entry_point || print_shader_stage) {
for (uint32_t i = 0; i < reflection.GetEntryPointCount(); ++i) {
if (print_entry_point) {
if (printed_count > 0) {
std::cout << ";";
}
std::cout << reflection.GetEntryPointName(i);
++printed_count;
}
if (print_shader_stage) {
if (printed_count > 0) {
std::cout << ";";
}
std::cout << ToStringShaderStage(reflection.GetEntryPointShaderStage(i));
++printed_count;
}
++printed_count;
}
}
if (print_source_file) {
if (printed_count > 0) {
std::cout << ";";
}
std::cout << (reflection.GetSourceFile() != NULL ? reflection.GetSourceFile() : "");
}
std::cout << std::endl;
} else {
if (output_as_yaml) {
SpvReflectToYaml yamlizer(reflection.GetShaderModule(), yaml_verbosity);
std::cout << yamlizer;
} else {
WriteReflection(reflection, flatten_cbuffers, std::cout);
std::cout << std::endl;
std::cout << std::endl;
}
}
}
if (output_fp) {
fclose(output_fp);
}
return EXIT_SUCCESS;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
//
// This file exists to force compiling spirv_reflect.c as C++.
//
#include "spirv_reflect.c"

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,357 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 6
op: 22
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 14
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 22
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 30
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td4
id: 38
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 46
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 10
name: "a"
location: 0
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 76 # VK_FORMAT_R16_SFLOAT
type_description: *td0
word_offset: { location: 122 }
- &iv1
spirv_id: 18
name: "b"
location: 1
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 90 # VK_FORMAT_R16G16B16_SFLOAT
type_description: *td1
word_offset: { location: 130 }
- &iv2
spirv_id: 26
name: "c"
location: 2
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 74 # VK_FORMAT_R16_UINT
type_description: *td2
word_offset: { location: 138 }
- &iv3
spirv_id: 34
name: "d"
location: 3
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 88 # VK_FORMAT_R16G16B16_UINT
type_description: *td3
word_offset: { location: 146 }
- &iv4
spirv_id: 42
name: "e"
location: 4
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 75 # VK_FORMAT_R16_SINT
type_description: *td4
word_offset: { location: 154 }
- &iv5
spirv_id: 50
name: "f"
location: 5
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 89 # VK_FORMAT_R16G16B16_SINT
type_description: *td5
word_offset: { location: 162 }
- &iv6
spirv_id: 8
name: "_a"
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 76 # VK_FORMAT_R16_SFLOAT
type_description: *td0
word_offset: { location: 118 }
- &iv7
spirv_id: 16
name: "_b"
location: 1
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 90 # VK_FORMAT_R16G16B16_SFLOAT
type_description: *td1
word_offset: { location: 126 }
- &iv8
spirv_id: 24
name: "_c"
location: 2
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 74 # VK_FORMAT_R16_UINT
type_description: *td2
word_offset: { location: 134 }
- &iv9
spirv_id: 32
name: "_d"
location: 3
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 88 # VK_FORMAT_R16G16B16_UINT
type_description: *td3
word_offset: { location: 142 }
- &iv10
spirv_id: 40
name: "_e"
location: 4
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 75 # VK_FORMAT_R16_SINT
type_description: *td4
word_offset: { location: 150 }
- &iv11
spirv_id: 48
name: "_f"
location: 5
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 16, signedness: 1 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 89 # VK_FORMAT_R16G16B16_SINT
type_description: *td5
word_offset: { location: 158 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 0 # Vertex
shader_stage: 0x00000001 # VS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 6,
input_variables:
- *iv0 # "a"
- *iv1 # "b"
- *iv2 # "c"
- *iv3 # "d"
- *iv4 # "e"
- *iv5 # "f"
output_variable_count: 6,
output_variables:
- *iv6 # "_a"
- *iv7 # "_b"
- *iv8 # "_c"
- *iv9 # "_d"
- *iv10 # "_e"
- *iv11 # "_f"
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,27 @@
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
layout(location = 0) in float16_t a;
layout(location = 1) in f16vec3 b;
layout(location = 2) in uint16_t c;
layout(location = 3) in u16vec3 d;
layout(location = 4) in int16_t e;
layout(location = 5) in i16vec3 f;
layout(location = 0) out float16_t _a;
layout(location = 1) out f16vec3 _b;
layout(location = 2) out uint16_t _c;
layout(location = 3) out u16vec3 _d;
layout(location = 4) out int16_t _e;
layout(location = 5) out i16vec3 _f;
void main()
{
_a = a * float16_t(2.0);
_b = b * f16vec3(2.0);
_c = c * 2us;
_d = d * u16vec3(2);
_e = e * 2s;
_f = f * i16vec3(2);
}

View File

@@ -0,0 +1,152 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 21
type_name:
struct_member_name:
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 4
op: 29
type_name:
struct_member_name:
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td2
id: 3
op: 30
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td0
- *td1
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td0
- &bv1
name:
offset: 4
absolute_offset: 4
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td1
- &bv2
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv0
- *bv1
type_description: *td2
all_descriptor_bindings:
- &db0
spirv_id: 2
name:
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv2 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td2
word_offset: { binding: 43, set: 39 }
all_interface_variables:
module:
generator: 7 # Khronos SPIR-V Tools Assembler
entry_point_name: "main"
entry_point_id: 1
source_language: 0 # Unknown
source_language_version: 0
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 #
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 #
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,13 @@
uniform uint* data_ptr; // creates a ptr chain access
struct Data{
int x;
}
uniform Data* data_struct;
[numthreads(1,1,1)]
void computeMain()
{
data_ptr[0] = 1;
data_struct->x = 1;
}

View File

@@ -0,0 +1,204 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 4
op: 32
type_name:
struct_member_name:
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x40000004 # REF INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 19
op: 21
type_name:
struct_member_name:
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 5
op: 32
type_name:
struct_member_name:
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td1
- &td3
id: 6
op: 30
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td0
- *td2
- &td4
id: 19
op: 21
type_name:
struct_member_name:
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td0
- &bv1
name:
offset: 0
absolute_offset: 0
size: 4
padded_size: 16
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td4
- &bv2
name:
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv1
type_description: *td2
- &bv3
name:
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv0
- *bv2
type_description: *td3
all_descriptor_bindings:
- &db0
spirv_id: 3
name:
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 6 # VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
resource_type: 2 # CBV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv3 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td3
word_offset: { binding: 86, set: 90 }
all_interface_variables:
module:
generator: 7 # Khronos SPIR-V Tools Assembler
entry_point_name: "main"
entry_point_id: 2
source_language: 0 # Unknown
source_language_version: 0
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 #
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 #
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,73 @@
# Usage:
# python tests/build_all_shaders.py
import argparse
import os
import pathlib
import shutil
import subprocess
import sys
def my_which(cmd):
if sys.hexversion >= 0x03030000:
return shutil.which(cmd)
else:
try:
subprocess.check_output([cmd], stderr=subprocess.STDOUT)
return cmd
except subprocess.CalledProcessError:
return cmd # that's fine, it exists though
except OSError:
return None
shaders = [
{'source':"glsl/built_in_format.glsl", 'entry':"main", 'stage':'vert'},
{'source':"glsl/buffer_pointer.glsl", 'entry':"main", 'stage':'frag', 'target-env':'vulkan1.3'},
{'source':"glsl/input_attachment.glsl", 'entry':"main", 'stage':'frag'},
{'source':"glsl/texel_buffer.glsl", 'entry':"main", 'stage':'vert'},
{'source':"glsl/storage_buffer.glsl", 'entry':"main", 'stage':'comp', 'target-env':'vulkan1.1'},
{'source':"glsl/runtime_array_of_array_of_struct.glsl", 'entry':"main", 'stage':'comp'},
{'source':"hlsl/append_consume.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
{'source':"hlsl/binding_array.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
{'source':"hlsl/binding_types.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
{'source':"hlsl/cbuffer.hlsl", 'entry':"main", 'profile':'vs_6_0', 'stage':'vert'},
{'source':"hlsl/counter_buffers.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
{'source':"hlsl/semantics.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
{'source':"hlsl/user_type.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'},
]
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Compile test shaders")
parser.add_argument("--glslc", help="path to glslc compiler", default=my_which("glslc"))
parser.add_argument("--dxc", help="path to dxc compiler", default=my_which("dxc"))
parser.add_argument("--verbose", "-v", help="enable verbose output", action='store_true')
args = parser.parse_args()
test_dir = pathlib.Path(__file__).parent.resolve()
root_dir = test_dir.parent.resolve()
if not args.dxc:
print("WARNING: dxc not found in PATH; HLSL shaders will be compiled with glslc.")
if not args.glslc:
print("WARNING: glslc not found in PATH. This is a bad sign.")
for shader in shaders:
src_path = os.path.join(test_dir, shader['source'])
base, ext = os.path.splitext(src_path)
spv_path = base + ".spv"
if ext.lower() == ".glsl" or (ext.lower() == ".hlsl" and not args.dxc):
compile_cmd_args = [args.glslc, "-g", "-fshader-stage=" + shader['stage'], "-fentry-point=" + shader['entry'], "-o", spv_path, src_path]
if 'target-env' in shader:
compile_cmd_args.append("--target-env=" + shader['target-env'])
elif ext.lower() == ".hlsl":
compile_cmd_args = [args.dxc, "-spirv", "-Zi", "-fspv-reflect", "-O0", "-T", shader['profile'], "-E", shader['entry'], "-Fo", spv_path, src_path]
print("%s -> %s" % (src_path, spv_path))
if args.verbose:
print(" ".join(compile_cmd_args))
try:
compile_cmd_output = subprocess.check_output(compile_cmd_args, stderr = subprocess.STDOUT)
except subprocess.CalledProcessError as error:
print("Compilation failed for %s with error code %d:\n%s" % (src_path, error.returncode, error.output.decode('utf-8')))
print("")

View File

@@ -0,0 +1,72 @@
# Usage:
# Prereq: build spirv-reflect
# Prereq: build shader SPVs
# python tests/build_golden_yaml.py
import argparse
import os
import pathlib
import platform
import subprocess
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate golden YAML from test shader .spv files")
parser.add_argument("--verbose", "-v", help="enable verbose output", action='store_true')
args = parser.parse_args()
print("""\
WARNING: This script regenerates the golden YAML output for all test shaders.
The new YAML will be considered the expected correct output for future test
runs. Before commiting the updated YAML to GitHub, it is therefore critical
to carefully inspect the diffs between the old and new YAML output, to ensure
that all differences can be traced back to intentional changes to either the
reflection code or the test shaders.
""")
test_dir = pathlib.Path(__file__).parent.resolve()
root_dir = test_dir.parent.resolve()
spirv_reflect_exe_paths_windows = [
os.path.join(root_dir, "bin", "Debug", "spirv-reflect.exe"),
os.path.join(root_dir, "bin", "Release", "spirv-reflect.exe"),
]
spirv_reflect_exe_paths_unix = [
os.path.join(root_dir, "bin", "spirv-reflect"),
]
spirv_reflect_exe = None
if platform.system() == "Windows":
for path in spirv_reflect_exe_paths_windows:
if os.path.isfile(path):
spirv_reflect_exe = path
break
else:
for path in spirv_reflect_exe_paths_unix:
if os.path.isfile(path):
spirv_reflect_exe = path
break
if spirv_reflect_exe is None:
exit("spirv-reflect executable not found!")
spv_paths = []
for root, dirs, files in os.walk(test_dir):
for f in files:
base, ext = os.path.splitext(f)
if ext.lower() == ".spv":
spv_paths.append(os.path.normpath(os.path.join(root, f)))
for spv_path in spv_paths:
yaml_path = spv_path + ".yaml"
try:
# TODO Replace hard-coded EXE path with something less brittle.
yaml_cmd_args = [spirv_reflect_exe, "-y", "-v", "1", spv_path]
if args.verbose:
print(" ".join(yaml_cmd_args))
subprocess.run(yaml_cmd_args, stdout=open(yaml_path, "w"))
subprocess.run(yaml_cmd_args)
print("%s -> %s" % (spv_path, yaml_path))
except NameError:
print("spirv-reflect application not found; did you build it first?")
sys.exit()
except subprocess.CalledProcessError as error:
print("YAML generation failed with error code %d:\n%s" % (error.returncode, error.output.decode('utf-8')))

View File

@@ -0,0 +1,198 @@
struct ColorDesc {
float R;
float2 RG;
float3 RGB;
float4 RGBA;
};
cbuffer MyParams : register(b0)
{
float4x4 MvpMatrix;
float4x4 NotUsedNormalMatrix;
float3 Offset;
float ScalarScale;
float2 Vector2ScaleX;
float2 Vector2ScaleY;
float2 Vector2ScaleXY;
float2 Vector2ScaleXXXX;
float2 Vector2ScaleXYXY;
float3 Vector3ScaleX;
float3 Vector3ScaleY;
float3 Vector3ScaleZ;
float3 Vector3ScaleXZ;
float3 Vector3ScaleXYZ;
float3 Vector3ScaleXX;
float3 Vector3ScaleYZX;
float3 Vector3ScaleZZZZ;
float4 Vector4ScaleX;
float4 Vector4ScaleY;
float4 Vector4ScaleZ;
float4 Vector4ScaleW;
float4 Vector4ScaleXY;
float4 Vector4ScaleXZ;
float4 Vector4ScaleYZ;
float4 Vector4ScaleXZW;
float4 Vector4ScaleYZW;
float4 Vector4ScaleXYZW;
float NotUsed1;
float2 NotUsed2;
float3 NotUsed3;
float3 MoreOffset;
float2 NotUsed4;
float3 NotUsed5;
float3 LastOffset;
float3 NotUsed6;
float ScalarArray[4];
float2 Vector2Array[4];
float3 Vector3Array[4];
float4 Vector4Array[4];
float2 Vector2ArrayX[4];
float3 Vector3ArrayX[4];
float4 Vector4ArrayX[4];
float2 NotUsedVectorArray[4];
ColorDesc ColorArray[8][7][6][5][4][3][2];
float ScalarMultiDimArray[8][7][6][5][4][3][2];
float2 Vector2MultiDimArray[8][7][6][5][4][3][2];
float3 Vector3MultiDimArray[8][7][6][5][4][3][2];
float4 Vector4MultiDimArray[8][7][6][5][4][3][2];
float2 Vector2MultiDimArrayX[8][7][6][5][4][3][2];
float3 Vector3MultiDimArrayX[8][7][6][5][4][3][2];
float4 Vector4MultiDimArrayX[8][7][6][5][4][3][2];
float2 NotUsedVector2MultiDimArrayY[8][7][6][5][4][3][2];
float3 NotUsedVector3MultiDimArrayY[8][7][6][5][4][3][2];
float4 NotUsedVector4MultiDimArrayY[8][7][6][5][4][3][2];
float3 Vector3MultiDimArrayZ[8][7][6][5][4][3][2];
float4 Vector4MultiDimArrayZ[8][7][6][5][4][3][2];
float2 Vector2MultiDimArrayXYX[8][7][6][5][4][3][2];
float3 Vector3MultiDimArrayXYX[8][7][6][5][4][3][2];
float4 Vector4MultiDimArrayXYX[8][7][6][5][4][3][2];
}
struct NestedUsedParams {
float NotUsed;
float3 Offset;
float4x4 NotUsedMatrix;
};
struct NestedNotUsedParams {
float NotUsed1;
float2 NotUsed2;
float3 NotUsed3;
};
struct UsedParams {
float3 Position;
float3 NotUsedColor;
float3 Normal;
NestedNotUsedParams NotUsedNested;
NestedUsedParams UsedNested;
float NotUsed1;
ColorDesc ColorArray[4];
};
struct NotUsedParams {
float NotUsed1;
float2 NotUsed2;
float3 NotUsed3;
NestedNotUsedParams NotUsedNested;
};
struct UsedComponents {
float3 ScaleByX;
};
struct Params2 {
float4 PostTransformOffset;
float NotUsedScale;
float3 Mask;
UsedParams Used;
NotUsedParams NotUsed;
UsedComponents Components;
};
ConstantBuffer<Params2> MyParams2 : register(b1);
float4 main(float3 Position : Position) : SV_POSITION
{
float4 result = mul(MvpMatrix, float4(Position + Offset, 1)) + MyParams2.PostTransformOffset;
//float4 result = (float4)1;
result.x *= ScalarScale;
result.y *= Vector2ScaleX.x;
result.x *= Vector2ScaleY.y;
result.yx *= Vector2ScaleXY.xy;
result.xyzw *= Vector2ScaleXXXX.xxxx;
result.xyzw *= Vector2ScaleXYXY.xyxy;
result.z *= Vector3ScaleX.x;
result.y *= Vector3ScaleY.y;
result.x *= Vector3ScaleZ.z;
result.xy *= Vector3ScaleXZ.xz;
result.xyz *= Vector3ScaleXYZ.xyz;
result.xy *= Vector3ScaleXX.xx;
result.xyz *= Vector3ScaleYZX.yzx;
result.xyzw *= Vector3ScaleZZZZ.zzzz;
result.x *= Vector4ScaleX.w;
result.y *= Vector4ScaleY.y;
result.z *= Vector4ScaleZ.z;
result.w *= Vector4ScaleW.x;
result.xy *= Vector4ScaleXY.xy;
result.xz *= Vector4ScaleXZ.xz;
result.xy *= Vector4ScaleYZ.yz;
result.xyz *= Vector4ScaleXZW.xzw;
result.yzw *= Vector4ScaleYZW.yzw;
result.xyzw *= Vector4ScaleXYZW.xyzw;
result *= ScalarArray[0];
result.xy *= Vector2Array[1];
result.xyz *= Vector3Array[2];
result.xyzw *= Vector4Array[3];
result.x *= Vector2ArrayX[1].x;
result.x *= Vector3ArrayX[2].x;
result.x *= Vector4ArrayX[3].x;
result.xyz *= ColorArray[7][6][5][4][3][2][1].RGB;
result.x *= ScalarMultiDimArray[7][6][5][4][3][2][1];
result.xy *= Vector2MultiDimArray[7][6][5][4][3][2][1];
result.xyz *= Vector3MultiDimArray[7][6][5][4][3][2][1];
result.xyzw *= Vector4MultiDimArray[7][6][5][4][3][2][1];
result.xy *= Vector2MultiDimArrayX[7][6][5][4][3][2][1].x;
result.xyz *= Vector3MultiDimArrayX[7][6][5][4][3][2][1].x;
result.xyzw *= Vector4MultiDimArrayX[7][6][5][4][3][2][1].x;
result.xyz *= Vector3MultiDimArrayZ[7][6][5][4][3][2][1].z;
result.xyzw *= Vector4MultiDimArrayZ[7][6][5][4][3][2][1].z;
result.xyz *= Vector2MultiDimArrayXYX[7][6][5][4][3][2][1].xyx;
result.xyz *= Vector3MultiDimArrayXYX[7][6][5][4][3][2][1].xyx;
result.xyz *= Vector4MultiDimArrayXYX[7][6][5][4][3][2][1].xyx;
result.xyz *= MyParams2.Mask;
result.xyz *= MyParams2.Used.Position;
result.xyz += MyParams2.Used.Normal;
result.xyz += MoreOffset;
result.xyz += LastOffset;
result.xyz += MyParams2.Used.UsedNested.Offset;
result.xyz *= MyParams2.Components.ScaleByX.x;
result.xyzw += MyParams2.Used.ColorArray[3].RGBA;
result.y *= MyParams2.Used.ColorArray[3].RGB.x;
return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
import os
import sys
import argparse
import subprocess
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='run SPIRV-Database in CI')
# Main reason for passing dir in is so GitHub Actions can group things, otherwise logs get VERY long for a single action
parser.add_argument('--dir', action='store', required=True, type=str, help='path to SPIR-V files')
args = parser.parse_args()
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
exe_path = os.path.join(root_dir, 'bin/spirv-reflect')
for currentpath, folders, files in os.walk(args.dir):
for file in files:
spirv_file = os.path.join(currentpath, file)
command = f'{exe_path} {spirv_file} -ci'
exit_code = subprocess.call(command.split())
if exit_code != 0:
print(f'ERROR for {spirv_file}')
sys.exit(1)

View File

@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.16)
project(noncopyable)
list(APPEND SPIRV_REFLECT_FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../spirv_reflect.h
${CMAKE_CURRENT_SOURCE_DIR}/../../../spirv_reflect.c
)
add_executable(noncopyable ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${COMMON_FILES} ${SPIRV_REFLECT_FILES})
target_include_directories(noncopyable PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set_target_properties(noncopyable PROPERTIES CXX_STANDARD 11)
if(WIN32)
target_compile_definitions(noncopyable PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(noncopyable PROPERTIES FOLDER "tests")
endif()

View File

@@ -0,0 +1,7 @@
#include "spirv_reflect.h"
int main(int argc, char** argv) {
spv_reflect::ShaderModule shaderModule;
shaderModule = spv_reflect::ShaderModule();
return 0;
}

View File

@@ -0,0 +1,15 @@
#version 450 core
layout(set = 0, binding = 0) buffer buf
{
uint buf_Data[];
};
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main()
{
buf_Data[0] = buf_Data[32];
buf_Data[100] = buf_Data[132];
buf_Data[200] = buf_Data[232];
}

View File

@@ -0,0 +1,117 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 29
type_name:
struct_member_name: "buf_Data"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td1
id: 8
op: 30
type_name: "buf"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000002 # BUFFER_BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
all_block_variables:
- &bv0
name: "buf_Data"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td0
- &bv1
name: ""
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td1
all_descriptor_bindings:
- &db0
spirv_id: 10
name: ""
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv1 # ""
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td1
word_offset: { binding: 65, set: 61 }
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # ""
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # ""
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,13 @@
#version 450 core
layout (points, invocations = 2) in;
layout (line_strip, max_vertices = 2) out;
void main() {
gl_Position = gl_in[0].gl_Position + vec4(-0.1, 0.0, 0.0, 0.0);
EmitVertex();
gl_Position = gl_in[0].gl_Position + vec4( 0.1, 0.0, 0.0, 0.0);
EmitVertex();
EndPrimitive();
}

View File

@@ -0,0 +1,395 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 23
type_name:
struct_member_name: "gl_Position"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 6
op: 22
type_name:
struct_member_name: "gl_PointSize"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 10
op: 28
type_name:
struct_member_name: "gl_ClipDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td3
id: 10
op: 28
type_name:
struct_member_name: "gl_CullDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td4
id: 17
op: 28
type_name: "gl_PerVertex"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x30080000 # ARRAY STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 4
members:
- *td0
- *td1
- *td2
- *td3
- &td5
id: 7
op: 23
type_name:
struct_member_name: "gl_Position"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 6
op: 22
type_name:
struct_member_name: "gl_PointSize"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 10
op: 28
type_name:
struct_member_name: "gl_ClipDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td8
id: 10
op: 28
type_name:
struct_member_name: "gl_CullDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td9
id: 11
op: 30
type_name: "gl_PerVertex"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td5
- *td6
- *td7
- *td8
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 0
name:
location: 0
storage_class: 0 # UniformConstant
semantic:
decoration_flags: 0x00000000 # NONE
built_in: 0 # Position
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 0 # VK_FORMAT_UNDEFINED
type_description:
word_offset: { location: 0 }
- &iv1
spirv_id: 0
name:
location: 0
storage_class: 0 # UniformConstant
semantic:
decoration_flags: 0x00000000 # NONE
built_in: 0 # Position
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 0 # VK_FORMAT_UNDEFINED
type_description:
word_offset: { location: 0 }
- &iv2
spirv_id: 0
name:
location: 0
storage_class: 0 # UniformConstant
semantic:
decoration_flags: 0x00000000 # NONE
built_in: 0 # Position
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 0 # VK_FORMAT_UNDEFINED
type_description:
word_offset: { location: 0 }
- &iv3
spirv_id: 0
name:
location: 0
storage_class: 0 # UniformConstant
semantic:
decoration_flags: 0x00000000 # NONE
built_in: 0 # Position
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 0 # VK_FORMAT_UNDEFINED
type_description:
word_offset: { location: 0 }
- &iv4
spirv_id: 19
name: "gl_in"
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 4
members:
- *iv0 #
- *iv1 #
- *iv2 #
- *iv3 #
format: 0 # VK_FORMAT_UNDEFINED
type_description: *td4
word_offset: { location: 0 }
- &iv5
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 0 # Position
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv6
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 1 # PointSize
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td6
word_offset: { location: 0 }
- &iv7
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 3 # ClipDistance
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td7
word_offset: { location: 0 }
- &iv8
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 4 # CullDistance
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td8
word_offset: { location: 0 }
- &iv9
spirv_id: 13
name: ""
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000011 # BUILT_IN BLOCK
built_in: 0, 1, 3, 4 # [Position, PointSize, ClipDistance, CullDistance]
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *iv5 #
- *iv6 #
- *iv7 #
- *iv8 #
format: 0 # VK_FORMAT_UNDEFINED
type_description: *td9
word_offset: { location: 0 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 3 # Geometry
shader_stage: 0x00000008 # GS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 1,
input_variables:
- *iv4 # "gl_in"
output_variable_count: 1,
output_variables:
- *iv9 # ""
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,27 @@
%YAML 1.1
---
all_type_descriptions:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
module:
generator: 7 # Khronos SPIR-V Tools Assembler
entry_point_name: "main"
entry_point_id: 2
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,27 @@
%YAML 1.1
---
all_type_descriptions:
all_block_variables:
all_descriptor_bindings:
all_interface_variables:
module:
generator: 7 # Khronos SPIR-V Tools Assembler
entry_point_name: "main"
entry_point_id: 2
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,32 @@
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer t1;
layout(buffer_reference) buffer t2;
layout(buffer_reference) buffer t3;
layout(buffer_reference) buffer t4;
layout(buffer_reference, std430) buffer t1 {
t4 i_1;
};
layout(buffer_reference, std430) buffer t2 {
t4 i_2;
};
layout(buffer_reference, std430) buffer t3 {
t2 i_3;
};
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
t1 k_1;
t2 k_2;
t3 k_3;
} x;
layout(set = 0, binding = 0, std430) buffer t5 {
t4 m;
} s5;
void main() {}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
#version 450
// Taken from glslang/Test/spv.bufferhandle4.frag
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer t4;
layout(buffer_reference, std430) buffer t3 {
int h;
t4 i;
};
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
t3 k;
} x;
layout(set = 0, binding = 0, std430) buffer t5 {
t4 m;
} s5;
void main() {
x.k.h = s5.m.k.i.k.i.k.h;
bool b = true;
s5.m = b ? s5.m : s5.m.k.i;
}

Binary file not shown.

View File

@@ -0,0 +1,706 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 6
op: 21
type_name:
struct_member_name: "h"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 9
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- [forward pointer]
- &td3
id: 7
op: 32
type_name: "t3"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td1
- *td2
- &td4
id: 9
op: 32
type_name: "t4"
struct_member_name: "m"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td0
- *td3
- &td5
id: 19
op: 30
type_name: "t5"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td4
- &td6
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 6
op: 21
type_name:
struct_member_name: "h"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td8
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td9
id: 7
op: 32
type_name:
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- [forward pointer]
- &td10
id: 9
op: 32
type_name: "t4"
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td8
- *td9
- &td11
id: 7
op: 32
type_name: "t3"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td7
- *td10
- &td12
id: 6
op: 21
type_name:
struct_member_name: "h"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td13
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td14
id: 6
op: 21
type_name:
struct_member_name: "h"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td15
id: 9
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- [forward pointer]
- &td16
id: 7
op: 32
type_name: "t3"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td14
- *td15
- &td17
id: 9
op: 32
type_name: "t4"
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td13
- *td16
- &td18
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td19
id: 6
op: 21
type_name:
struct_member_name: "h"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td20
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td21
id: 7
op: 32
type_name:
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- [forward pointer]
- &td22
id: 9
op: 32
type_name: "t4"
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td20
- *td21
- &td23
id: 7
op: 32
type_name: "t3"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td19
- *td22
- &td24
id: 8
op: 30
type_name: "t4"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td18
- *td23
all_block_variables:
- &bv0
name: "j"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td6
- &bv1
name: "h"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td12
- &bv2
name: "k"
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 2
members:
- *bv1
- [recursive]
type_description: *td11
- &bv3
name: "m"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv0
- *bv2
type_description: *td4
- &bv4
name: "s5"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv3
type_description: *td5
- &bv5
name: "j"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td18
- &bv6
name: "h"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td12
- &bv7
name: "j"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td6
- &bv8
name: "i"
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 2
members:
- *bv7
- [recursive]
type_description: *td17
- &bv9
name: "k"
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv6
- *bv8
type_description: *td23
- &bv10
name: "x"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv5
- *bv9
type_description: *td24
all_descriptor_bindings:
- &db0
spirv_id: 21
name: "s5"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv4 # "s5"
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td5
word_offset: { binding: 171, set: 167 }
- &db1
spirv_id: 13
name: "x"
binding: 2
input_attachment_index: 0
set: 1
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv10 # "x"
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td24
word_offset: { binding: 155, set: 151 }
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 2
descriptor_bindings:
- *db0 # "s5"
- *db1 # "x"
descriptor_set_count: 2
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "s5"
- set: 1
binding_count: 1
bindings:
- *db1 # "x"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,30 @@
#version 450 core
// Taken from glslang/Test/spv.bufferhandle6.frag
#extension GL_EXT_buffer_reference : enable
layout (push_constant, std430) uniform Block { int identity[32]; } pc;
layout(r32ui, set = 3, binding = 0) uniform uimage2D image0_0;
layout(buffer_reference) buffer T1;
layout(set = 3, binding = 1, buffer_reference) buffer T1 {
layout(offset = 0) int a[2]; // stride = 4 for std430, 16 for std140
layout(offset = 32) int b;
layout(offset = 48) T1 c[2]; // stride = 8 for std430, 16 for std140
layout(offset = 80) T1 d;
} x;
void main()
{
int accum = 0, temp;
accum |= x.a[0] - 0;
accum |= x.a[pc.identity[1]] - 1;
accum |= x.b - 2;
accum |= x.c[0].a[0] - 3;
accum |= x.c[0].a[pc.identity[1]] - 4;
accum |= x.c[0].b - 5;
accum |= x.c[pc.identity[1]].a[0] - 6;
accum |= x.c[pc.identity[1]].a[pc.identity[1]] - 7;
accum |= x.c[pc.identity[1]].b - 8;
accum |= x.d.a[0] - 9;
accum |= x.d.a[pc.identity[1]] - 10;
accum |= x.d.b - 11;
uvec4 color = (accum != 0) ? uvec4(0,0,0,0) : uvec4(1,0,0,1);
imageStore(image0_0, ivec2(gl_FragCoord.x, gl_FragCoord.y), color);
}

Binary file not shown.

View File

@@ -0,0 +1,836 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 147
op: 25
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00010004 # EXTERNAL_IMAGE INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 2, image_format: 33 } # dim=2D image_format=R32ui
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 12
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td2
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td4
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td6
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 17
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- [forward pointer]
- &td8
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td9
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td10
id: 17
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- [forward pointer]
- &td11
id: 13
op: 32
type_name:
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- [forward pointer]
- &td12
id: 13
op: 32
type_name: "T1"
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td8
- *td9
- *td10
- *td11
- &td13
id: 17
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- *td5
- *td6
- *td7
- *td12
- &td14
id: 13
op: 32
type_name: "T1"
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- [forward pointer]
- &td15
id: 14
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- *td3
- *td4
- *td13
- *td14
- &td16
id: 13
op: 32
type_name: "T1"
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- [forward pointer]
- &td17
id: 15
op: 30
type_name: "T1"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td1
- *td2
- *td15
- *td16
- &td18
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td19
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td20
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td21
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td22
id: 17
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- [forward pointer]
- &td23
id: 16
op: 28
type_name:
struct_member_name: "a"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 4 }
member_count: 0
members:
- &td24
id: 6
op: 21
type_name:
struct_member_name: "b"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td25
id: 17
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- [forward pointer]
- &td26
id: 13
op: 32
type_name:
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- [forward pointer]
- &td27
id: 13
op: 32
type_name: "T1"
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td23
- *td24
- *td25
- *td26
- &td28
id: 17
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 4
members:
- *td20
- *td21
- *td22
- *td27
- &td29
id: 13
op: 32
type_name: "T1"
struct_member_name: "d"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- [forward pointer]
- &td30
id: 29
op: 28
type_name:
struct_member_name: "identity"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [32,], stride: 4 }
member_count: 0
members:
- &td31
id: 30
op: 30
type_name: "Block"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td30
- &td32
id: 152
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name:
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description:
- &bv1
name: "a"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [2,], stride: 4 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td1
- &bv2
name: "b"
offset: 32
absolute_offset: 32
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td2
- &bv3
name: "a"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [2,], stride: 4 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td18
- &bv4
name: "b"
offset: 32
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td19
- &bv5
name: "c"
offset: 48
absolute_offset: 48
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 4
members:
- *bv3
- *bv4
- [recursive]
- [recursive]
type_description: *td15
- &bv6
name: "x"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 4
members:
- *bv1
- *bv2
- *bv5
- [recursive]
type_description: *td17
- &bv7
name: "identity"
offset: 0
absolute_offset: 0
size: 128
padded_size: 128
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [32,], stride: 4 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td30
- &bv8
name: "pc"
offset: 0
absolute_offset: 0
size: 128
padded_size: 128
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv7
type_description: *td31
all_descriptor_bindings:
- &db0
spirv_id: 149
name: "image0_0"
binding: 0
input_attachment_index: 0
set: 3
decoration_flags: 0x00000000 # NONE
descriptor_type: 3 # VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
resource_type: 8 # UAV
image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 2, image_format: 33 } # dim=2D image_format=R32ui
block: *bv0 #
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td0
word_offset: { binding: 227, set: 223 }
- &db1
spirv_id: 21
name: "x"
binding: 1
input_attachment_index: 0
set: 3
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv6 # "x"
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td17
word_offset: { binding: 207, set: 203 }
all_interface_variables:
- &iv0
spirv_id: 154
name: "gl_FragCoord"
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 15 # FragCoord
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td32
word_offset: { location: 0 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 2
descriptor_bindings:
- *db0 # "image0_0"
- *db1 # "x"
descriptor_set_count: 1
descriptor_sets:
- set: 3
binding_count: 2
bindings:
- *db0 # "image0_0"
- *db1 # "x"
input_variable_count: 1,
input_variables:
- *iv0 # "gl_FragCoord"
output_variable_count: 0,
output_variables:
push_constant_count: 1,
push_constants:
- *bv8 # "pc"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,19 @@
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer t1;
layout(buffer_reference, std430) buffer t1 {
t1 i;
};
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
t1 k;
} x;
layout(set = 0, binding = 0, std430) buffer t5 {
t4 m;
} s5;
void main() {}

Binary file not shown.

View File

@@ -0,0 +1,441 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 7
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td2
id: 7
op: 32
type_name: "t1"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td1
- &td3
id: 12
op: 32
type_name: "t4"
struct_member_name: "m"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td0
- *td2
- &td4
id: 13
op: 30
type_name: "t5"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td3
- &td5
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 7
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td7
id: 7
op: 32
type_name: "t1"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td6
- &td8
id: 7
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td9
id: 7
op: 32
type_name: "t1"
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td8
- &td10
id: 6
op: 21
type_name:
struct_member_name: "j"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td11
id: 7
op: 32
type_name:
struct_member_name: "i"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td12
id: 7
op: 32
type_name: "t1"
struct_member_name: "k"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td11
- &td13
id: 8
op: 30
type_name: "t4"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td10
- *td12
all_block_variables:
- &bv0
name: "j"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td5
- &bv1
name: "k"
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 1
members:
- [recursive]
type_description: *td7
- &bv2
name: "m"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 2
members:
- *bv0
- *bv1
type_description: *td3
- &bv3
name: "s5"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 1
members:
- *bv2
type_description: *td4
- &bv4
name: "j"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td10
- &bv5
name: "k"
offset: 8
absolute_offset: 8
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 1
members:
- [recursive]
type_description: *td12
- &bv6
name: "x"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 2
members:
- *bv4
- *bv5
type_description: *td13
all_descriptor_bindings:
- &db0
spirv_id: 16
name: "s5"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv3 # "s5"
array: { dims_count: 0, dims: [] }
accessed: 0
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td4
word_offset: { binding: 159, set: 155 }
- &db1
spirv_id: 11
name: "x"
binding: 2
input_attachment_index: 0
set: 1
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv6 # "x"
array: { dims_count: 0, dims: [] }
accessed: 0
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td13
word_offset: { binding: 130, set: 126 }
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 2
descriptor_bindings:
- *db0 # "s5"
- *db1 # "x"
descriptor_set_count: 2
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "s5"
- set: 1
binding_count: 1
bindings:
- *db1 # "x"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,34 @@
#version 460 core
#extension GL_EXT_buffer_reference : require
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : require
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
#extension GL_EXT_shader_explicit_arithmetic_types_int32 : require
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(buffer_reference, buffer_reference_align = 4) readonly buffer ReadVecf
{
float32_t values[];
};
layout(buffer_reference, buffer_reference_align = 4) writeonly buffer WriteVecf
{
float32_t values[];
};
layout(push_constant, std430) uniform Parameters
{
ReadVecf a;
ReadVecf b;
WriteVecf c;
uint64_t n;
} params;
void main()
{
uint32_t idx = gl_GlobalInvocationID.x;
uint32_t stride = gl_NumWorkGroups.x * gl_WorkGroupSize.x;
for (; idx < params.n; idx += stride) {
params.c.values[idx] = params.a.values[idx] + params.b.values[idx];
}
}

Binary file not shown.

View File

@@ -0,0 +1,345 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 34
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td1
id: 30
op: 32
type_name: "ReadVecf"
struct_member_name: "a"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
- &td2
id: 30
op: 32
type_name: "ReadVecf"
struct_member_name: "b"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td3
id: 36
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td4
id: 31
op: 32
type_name: "WriteVecf"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td3
- &td5
id: 28
op: 21
type_name:
struct_member_name: "n"
storage_class: 0 # UniformConstant
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 64, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 32
op: 30
type_name: "Parameters"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td1
- *td2
- *td4
- *td5
- &td7
id: 34
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td8
id: 36
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td9
id: 9
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name: "values"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td7
- &bv1
name: "a"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td1
- &bv2
name: "values"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000200 # NON_READABLE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td8
- &bv3
name: "c"
offset: 16
absolute_offset: 16
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv2
type_description: *td4
- &bv4
name: "n"
offset: 24
absolute_offset: 24
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 64, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td5
- &bv5
name: "params"
offset: 0
absolute_offset: 0
size: 32
padded_size: 32
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 4
members:
- *bv1
- [recursive]
- *bv3
- *bv4
type_description: *td6
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 11
name: "gl_GlobalInvocationID"
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 28 # GlobalInvocationId
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td9
word_offset: { location: 0 }
- &iv1
spirv_id: 17
name: "gl_NumWorkGroups"
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 24 # NumWorkgroups
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 3 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 104 # VK_FORMAT_R32G32B32_UINT
type_description: *td9
word_offset: { location: 0 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 2,
input_variables:
- *iv0 # "gl_GlobalInvocationID"
- *iv1 # "gl_NumWorkGroups"
output_variable_count: 0,
output_variables:
push_constant_count: 1,
push_constants:
- *bv5 # "params"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,19 @@
#version 460 core
#extension GL_EXT_buffer_reference : require
layout(buffer_reference, buffer_reference_align = 4) readonly buffer t2 {
int values[];
};
layout(buffer_reference, buffer_reference_align = 4) readonly buffer t1 {
t2 c;
};
layout(push_constant, std430) uniform Parameters {
t1 a;
t2 b;
} params;
void main() {
params.a.c.values[0] = params.b.values[0] + 1;
}

Binary file not shown.

View File

@@ -0,0 +1,238 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 11
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td1
id: 7
op: 32
type_name: "t2"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
- &td2
id: 6
op: 32
type_name: "t1"
struct_member_name: "a"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td1
- &td3
id: 7
op: 32
type_name: "t2"
struct_member_name: "b"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td4
id: 8
op: 30
type_name: "Parameters"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td2
- *td3
- &td5
id: 11
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td6
id: 7
op: 32
type_name: "t2"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td5
- &td7
id: 11
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
all_block_variables:
- &bv0
name: "values"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td7
- &bv1
name: "c"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td6
- &bv2
name: "a"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv1
type_description: *td2
- &bv3
name: "params"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv2
- [recursive]
type_description: *td4
all_descriptor_bindings:
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 1,
push_constants:
- *bv3 # "params"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,36 @@
#version 450
#extension GL_EXT_buffer_reference : require
#extension GL_ARB_enhanced_layouts : require
#extension GL_EXT_nonuniform_qualifier : require
#extension GL_KHR_shader_subgroup_arithmetic : require
layout(row_major) uniform;
layout(row_major) buffer;
struct BDAGlobals_t_0 {
vec4 g_vTest;
vec4 g_vTest2;
};
layout(buffer_reference, std430, buffer_reference_align = 16) readonly buffer BufferPointer_BDAGlobals_t_0_1 {
BDAGlobals_t_0 _data;
};
struct GlobalsBDAPushConstant_t_0 {
BufferPointer_BDAGlobals_t_0_1 g_GlobalsBDAPerStage_0[6];
};
layout(push_constant)
layout(std140) uniform _S2 {
BufferPointer_BDAGlobals_t_0_1 g_GlobalsBDAPerStage_0[6];
} g_GlobalsBDAPushConstant_0;
struct PS_OUTPUT_0 {
vec4 vColor_1;
};
layout(location = 0) out vec4 _S149;
void main() {
_S149 = g_GlobalsBDAPushConstant_0.g_GlobalsBDAPerStage_0[0]._data.g_vTest;
return;
}

Binary file not shown.

View File

@@ -0,0 +1,290 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 23
type_name:
struct_member_name: "g_vTest"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 7
op: 23
type_name:
struct_member_name: "g_vTest2"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 15
op: 30
type_name: "BDAGlobals_t_0"
struct_member_name: "_data"
storage_class: 0 # UniformConstant
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td0
- *td1
- &td3
id: 13
op: 28
type_name: "BufferPointer_BDAGlobals_t_0_1"
struct_member_name: "g_GlobalsBDAPerStage_0"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [6,], stride: 16 }
member_count: 1
members:
- *td2
- &td4
id: 14
op: 30
type_name: "_S2"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td3
- &td5
id: 7
op: 23
type_name:
struct_member_name: "g_vTest"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 7
op: 23
type_name:
struct_member_name: "g_vTest2"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 15
op: 30
type_name: "BDAGlobals_t_0"
struct_member_name: "_data"
storage_class: 0 # UniformConstant
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td5
- *td6
- &td8
id: 7
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name: "g_vTest"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td5
- &bv1
name: "g_vTest2"
offset: 16
absolute_offset: 0
size: 16
padded_size: 16
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td6
- &bv2
name: "_data"
offset: 0
absolute_offset: 0
size: 32
padded_size: 32
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 2
members:
- *bv0
- *bv1
type_description: *td7
- &bv3
name: "g_GlobalsBDAPerStage_0"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv2
type_description: *td3
- &bv4
name: "g_GlobalsBDAPushConstant_0"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv3
type_description: *td4
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 9
name: "_S149"
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td8
word_offset: { location: 144 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 1,
output_variables:
- *iv0 # "_S149"
push_constant_count: 1,
push_constants:
- *bv4 # "g_GlobalsBDAPushConstant_0"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,23 @@
#version 460 core
#extension GL_EXT_buffer_reference : require
layout(buffer_reference, buffer_reference_align = 4) readonly buffer t2 {
int values[];
};
layout(buffer_reference, buffer_reference_align = 4) readonly buffer t1 {
t2 c;
};
layout(buffer_reference, buffer_reference_align = 4) readonly buffer t0 {
t1 a;
t2 b;
};
layout(push_constant, std430) uniform Parameters {
t0 x;
} params;
void main() {
params.x.a.c.values[0] = params.x.b.values[0] + 1;
}

Binary file not shown.

View File

@@ -0,0 +1,344 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 13
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td1
id: 9
op: 32
type_name: "t2"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
- &td2
id: 8
op: 32
type_name: "t1"
struct_member_name: "a"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td1
- &td3
id: 9
op: 32
type_name: "t2"
struct_member_name: "b"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
- &td4
id: 6
op: 32
type_name: "t0"
struct_member_name: "x"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 2
members:
- *td2
- *td3
- &td5
id: 7
op: 30
type_name: "Parameters"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td4
- &td6
id: 13
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td7
id: 9
op: 32
type_name: "t2"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td6
- &td8
id: 8
op: 32
type_name: "t1"
struct_member_name: "a"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td7
- &td9
id: 13
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td10
id: 9
op: 32
type_name: "t2"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td9
- &td11
id: 13
op: 29
type_name:
struct_member_name: "values"
storage_class: 0 # UniformConstant
type_flags: 0x20000004 # ARRAY INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 4 }
member_count: 0
members:
- &td12
id: 9
op: 32
type_name: "t2"
struct_member_name: "b"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- [forward pointer]
all_block_variables:
- &bv0
name: "values"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td11
- &bv1
name: "c"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td10
- &bv2
name: "a"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv1
type_description: *td8
- &bv3
name: "x"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 2
members:
- *bv2
- [recursive]
type_description: *td4
- &bv4
name: "params"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv3
type_description: *td5
all_descriptor_bindings:
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 1,
push_constants:
- *bv4 # "params"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,9 @@
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer T1;
layout(set = 3, binding = 1, buffer_reference) buffer T1 {
layout(offset = 48) T1 c[2]; // stride = 8 for std430, 16 for std140
} x;
void main() {}

Binary file not shown.

View File

@@ -0,0 +1,191 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 11
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 1
members:
- [forward pointer]
- &td1
id: 11
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 1
members:
- *td0
- &td2
id: 9
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 1
members:
- *td1
- &td3
id: 10
op: 30
type_name: "T1"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td2
- &td4
id: 11
op: 28
type_name:
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 1
members:
- [forward pointer]
- &td5
id: 11
op: 28
type_name: "T1"
struct_member_name: "c"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [2,], stride: 8 }
member_count: 1
members:
- *td4
all_block_variables:
- &bv0
name: "c"
offset: 48
absolute_offset: 48
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 1
members:
- [recursive]
type_description: *td2
- &bv1
name: "x"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 1
members:
- *bv0
type_description: *td3
all_descriptor_bindings:
- &db0
spirv_id: 15
name: "x"
binding: 1
input_attachment_index: 0
set: 3
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv1 # "x"
array: { dims_count: 0, dims: [] }
accessed: 0
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td3
word_offset: { binding: 115, set: 111 }
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 450
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "x"
descriptor_set_count: 1
descriptor_sets:
- set: 3
binding_count: 1
bindings:
- *db0 # "x"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,16 @@
#version 460
#extension GL_EXT_buffer_reference2: require
#extension GL_EXT_scalar_block_layout : enable
layout(buffer_reference, scalar) readonly buffer VertexBufferPtr {
vec4 v[];
};
// Has a OpTypeRuntimeArray
layout(binding = 1, set = 0, scalar) readonly buffer Vertices {
VertexBufferPtr vertex_buffers[];
};
void main() {
gl_Position = vertex_buffers[gl_VertexIndex].v[gl_VertexIndex];
}

Binary file not shown.

View File

@@ -0,0 +1,389 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 19
op: 29
type_name:
struct_member_name: "v"
storage_class: 0 # UniformConstant
type_flags: 0x20000108 # ARRAY VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 16 }
member_count: 0
members:
- &td1
id: 17
op: 29
type_name: "VertexBufferPtr"
struct_member_name: "vertex_buffers"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x70080000 # ARRAY STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 8 }
member_count: 1
members:
- *td0
- &td2
id: 18
op: 30
type_name: "Vertices"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td1
- &td3
id: 19
op: 29
type_name:
struct_member_name: "v"
storage_class: 0 # UniformConstant
type_flags: 0x20000108 # ARRAY VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [0,], stride: 16 }
member_count: 0
members:
- &td4
id: 14
op: 21
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000004 # INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td5
id: 7
op: 23
type_name:
struct_member_name: "gl_Position"
storage_class: 0 # UniformConstant
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 6
op: 22
type_name:
struct_member_name: "gl_PointSize"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 10
op: 28
type_name:
struct_member_name: "gl_ClipDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td8
id: 10
op: 28
type_name:
struct_member_name: "gl_CullDistance"
storage_class: 0 # UniformConstant
type_flags: 0x20000008 # ARRAY FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
- &td9
id: 11
op: 30
type_name: "gl_PerVertex"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *td5
- *td6
- *td7
- *td8
all_block_variables:
- &bv0
name: "v"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td3
- &bv1
name: "vertex_buffers"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td1
- &bv2
name: ""
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv1
type_description: *td2
all_descriptor_bindings:
- &db0
spirv_id: 23
name: ""
binding: 1
input_attachment_index: 0
set: 0
decoration_flags: 0x00000080 # NON_WRITABLE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 4 # SRV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv2 # ""
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td2
word_offset: { binding: 191, set: 187 }
all_interface_variables:
- &iv0
spirv_id: 25
name: "gl_VertexIndex"
location: 4294967295
storage_class: 1 # Input
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 42 # VertexIndex
numeric:
scalar: { width: 32, signedness: 1 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 99 # VK_FORMAT_R32_SINT
type_description: *td4
word_offset: { location: 0 }
- &iv1
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 0 # Position
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td5
word_offset: { location: 0 }
- &iv2
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 1 # PointSize
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td6
word_offset: { location: 0 }
- &iv3
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 3 # ClipDistance
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td7
word_offset: { location: 0 }
- &iv4
spirv_id: 0
name:
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000010 # BUILT_IN
built_in: 4 # CullDistance
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 1, dims: [1,], stride: 0 }
member_count: 0
members:
format: 100 # VK_FORMAT_R32_SFLOAT
type_description: *td8
word_offset: { location: 0 }
- &iv5
spirv_id: 13
name: ""
location: 4294967295
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000011 # BUILT_IN BLOCK
built_in: 0, 1, 3, 4 # [Position, PointSize, ClipDistance, CullDistance]
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 4
members:
- *iv1 #
- *iv2 #
- *iv3 #
- *iv4 #
format: 0 # VK_FORMAT_UNDEFINED
type_description: *td9
word_offset: { location: 0 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 0 # Vertex
shader_stage: 0x00000001 # VS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # ""
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # ""
input_variable_count: 1,
input_variables:
- *iv0 # "gl_VertexIndex"
output_variable_count: 1,
output_variables:
- *iv5 # ""
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,16 @@
#version 460
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_buffer_reference_uvec2 : require
layout(buffer_reference) buffer VertexBuffer;
layout(buffer_reference, buffer_reference_align = 16, std430) buffer VertexBuffer {
int x;
};
layout(push_constant, std430) uniform PerFrameData {
uvec2 bufferId;
} pc;
void main() {
VertexBuffer(pc.bufferId).x = 0;
}

View File

@@ -0,0 +1,96 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 23
type_name:
struct_member_name: "bufferId"
storage_class: 0 # UniformConstant
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 2 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 8
op: 30
type_name: "PerFrameData"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
all_block_variables:
- &bv0
name: "bufferId"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 2 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td0
- &bv1
name: "pc"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td1
all_descriptor_bindings:
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 1,
push_constants:
- *bv1 # "pc"
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,16 @@
#version 460
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_buffer_reference_uvec2 : require
layout(buffer_reference) buffer VertexBuffer;
layout(buffer_reference, buffer_reference_align = 16, std430) buffer VertexBuffer {
int x;
};
layout(set = 0, binding = 0) buffer T1 {
uvec2 bufferId;
} ssbo;
void main() {
VertexBuffer(ssbo.bufferId).x = 0;
}

View File

@@ -0,0 +1,117 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 23
type_name:
struct_member_name: "bufferId"
storage_class: 0 # UniformConstant
type_flags: 0x00000104 # VECTOR INT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 2 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 8
op: 30
type_name: "T1"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td0
all_block_variables:
- &bv0
name: "bufferId"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 2 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td0
- &bv1
name: "ssbo"
offset: 0
absolute_offset: 0
size: 0
padded_size: 0
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv0
type_description: *td1
all_descriptor_bindings:
- &db0
spirv_id: 10
name: "ssbo"
binding: 0
input_attachment_index: 0
set: 0
decoration_flags: 0x00000000 # NONE
descriptor_type: 7 # VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
resource_type: 8 # UAV
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
block: *bv1 # "ssbo"
array: { dims_count: 0, dims: [] }
accessed: 1
uav_counter_id: 4294967295
uav_counter_binding:
type_description: *td1
word_offset: { binding: 118, set: 114 }
all_interface_variables:
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 4
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 5 # GLCompute
shader_stage: 0x00000020 # CS
descriptor_binding_count: 1
descriptor_bindings:
- *db0 # "ssbo"
descriptor_set_count: 1
descriptor_sets:
- set: 0
binding_count: 1
bindings:
- *db0 # "ssbo"
input_variable_count: 0,
input_variables:
output_variable_count: 0,
output_variables:
push_constant_count: 0,
push_constants:
specialization_constant_count: 0,
specialization_constants:
...

View File

@@ -0,0 +1,22 @@
#version 460 core
#extension GL_EXT_buffer_reference : require
layout(buffer_reference, buffer_reference_align = 16) buffer Data {
float g0;
float g1;
float g2;
};
layout(push_constant) uniform PushData {
Data data_ptr;
} push;
layout(location = 0, index = 0) out vec4 Color;
void main()
{
float f1 = push.data_ptr.g1;
Color = vec4(f1, 0.0, 0.0, 0.0);
}

Binary file not shown.

View File

@@ -0,0 +1,288 @@
%YAML 1.1
---
all_type_descriptions:
- &td0
id: 7
op: 22
type_name:
struct_member_name: "g0"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td1
id: 7
op: 22
type_name:
struct_member_name: "g1"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td2
id: 7
op: 22
type_name:
struct_member_name: "g2"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td3
id: 10
op: 32
type_name: "Data"
struct_member_name: "data_ptr"
storage_class: 5349 # PhysicalStorageBuffer
type_flags: 0x50080000 # STRUCT REF EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 3
members:
- *td0
- *td1
- *td2
- &td4
id: 11
op: 30
type_name: "PushData"
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK
decoration_flags: 0x00000001 # BLOCK
traits:
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 1
members:
- *td3
- &td5
id: 7
op: 22
type_name:
struct_member_name: "g0"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td6
id: 7
op: 22
type_name:
struct_member_name: "g1"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td7
id: 7
op: 22
type_name:
struct_member_name: "g2"
storage_class: 0 # UniformConstant
type_flags: 0x00000008 # FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
- &td8
id: 24
op: 23
type_name:
struct_member_name:
storage_class: -1 # NOT APPLICABLE
type_flags: 0x00000108 # VECTOR FLOAT
decoration_flags: 0x00000000 # NONE
traits:
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
all_block_variables:
- &bv0
name: "g0"
offset: 0
absolute_offset: 0
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td5
- &bv1
name: "g1"
offset: 4
absolute_offset: 4
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 0
members:
type_description: *td6
- &bv2
name: "g2"
offset: 8
absolute_offset: 8
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000001 # UNUSED
member_count: 0
members:
type_description: *td7
- &bv3
name: "data_ptr"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 3
members:
- *bv0
- *bv1
- *bv2
type_description: *td3
- &bv4
name: "push"
offset: 0
absolute_offset: 0
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
vector: { component_count: 0 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
flags: 0x00000000 # NONE
member_count: 1
members:
- *bv3
type_description: *td4
all_descriptor_bindings:
all_interface_variables:
- &iv0
spirv_id: 26
name: "Color"
location: 0
storage_class: 3 # Output
semantic:
decoration_flags: 0x00000000 # NONE
built_in: -1 # ??? (-1)
numeric:
scalar: { width: 32, signedness: 0 }
vector: { component_count: 4 }
matrix: { column_count: 0, row_count: 0, stride: 0 }
array: { dims_count: 0, dims: [], stride: 0 }
member_count: 0
members:
format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT
type_description: *td8
word_offset: { location: 240 }
module:
generator: 8 # Khronos Glslang Reference Front End
entry_point_name: "main"
entry_point_id: 5
source_language: 2 # GLSL
source_language_version: 460
spirv_execution_model: 4 # Fragment
shader_stage: 0x00000010 # PS
descriptor_binding_count: 0
descriptor_bindings:
descriptor_set_count: 0
descriptor_sets:
input_variable_count: 0,
input_variables:
output_variable_count: 1,
output_variables:
- *iv0 # "Color"
push_constant_count: 1,
push_constants:
- *bv4 # "push"
specialization_constant_count: 0,
specialization_constants:
...

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