mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 13:20:52 +00:00
update SPIRV-Cross
- https://github.com/KhronosGroup/SPIRV-Cross/commit/ 66a407285e36a0f772e3209cb86ded6e3d900f6a
This commit is contained in:
parent
c0117f077b
commit
5af5222249
2
deps/SPIRV-Cross/.gitignore
vendored
2
deps/SPIRV-Cross/.gitignore
vendored
@ -13,5 +13,7 @@
|
||||
*.opensdf
|
||||
*.shader
|
||||
*.a
|
||||
*.bc
|
||||
/external
|
||||
|
||||
!CMakeLists.txt
|
||||
|
13
deps/SPIRV-Cross/.travis.yml
vendored
13
deps/SPIRV-Cross/.travis.yml
vendored
@ -2,25 +2,32 @@ language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode8.2
|
||||
|
||||
# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
# We check out glslang at a specific revision to avoid test output mismatches
|
||||
# We check out glslang and SPIRV-Tools at specific revisions to avoid test output mismatches
|
||||
env:
|
||||
- GLSLANG_REV=b56f4ac72c57f5c50f14ddb0bf1f78eaaef21c2b
|
||||
- GLSLANG_REV=9c6f8cc29ba303b43ccf36deea6bb38a304f9b92 SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
|
||||
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install python3; fi
|
||||
- git clone https://github.com/KhronosGroup/glslang.git glslang
|
||||
- git clone https://github.com/KhronosGroup/SPIRV-Tools SPIRV-Tools
|
||||
- git clone https://github.com/KhronosGroup/SPIRV-Headers.git SPIRV-Tools/external/spirv-headers
|
||||
|
||||
script:
|
||||
- git -C glslang checkout $GLSLANG_REV
|
||||
- git -C SPIRV-Tools checkout $SPIRV_TOOLS_REV
|
||||
- cd glslang && cmake . && make -j2 && cd ..
|
||||
- cd SPIRV-Tools && cmake . && make -j2 && cd ..
|
||||
- make -j2
|
||||
- PATH=./glslang/StandAlone:./SPIRV-Tools/tools:$PATH
|
||||
- ./test_shaders.py shaders
|
||||
- ./test_shaders.py --msl shaders-msl
|
||||
- ./test_shaders.py --hlsl shaders-hlsl
|
||||
- ./test_shaders.py shaders --opt
|
||||
- ./test_shaders.py --msl shaders-msl --opt
|
||||
- ./test_shaders.py --hlsl shaders-hlsl --opt
|
||||
|
127
deps/SPIRV-Cross/CMakeLists.txt
vendored
127
deps/SPIRV-Cross/CMakeLists.txt
vendored
@ -24,34 +24,6 @@ if(${CMAKE_GENERATOR} MATCHES "Makefile")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(spirv-cross-core STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_common.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.cpp)
|
||||
|
||||
add_library(spirv-cross-glsl STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.hpp)
|
||||
|
||||
add_library(spirv-cross-cpp STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.cpp)
|
||||
|
||||
add_library(spirv-cross-msl STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.cpp)
|
||||
|
||||
add_executable(spirv-cross main.cpp)
|
||||
target_link_libraries(spirv-cross spirv-cross-glsl spirv-cross-cpp spirv-cross-msl spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-glsl spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-msl spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-cpp spirv-cross-glsl)
|
||||
target_include_directories(spirv-cross-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(spirv-compiler-options "")
|
||||
set(spirv-compiler-defines "")
|
||||
|
||||
@ -71,27 +43,102 @@ if (NOT "${MSVC}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_options(spirv-cross-core PRIVATE ${spirv-compiler-options})
|
||||
target_compile_options(spirv-cross-glsl PRIVATE ${spirv-compiler-options})
|
||||
target_compile_options(spirv-cross-msl PRIVATE ${spirv-compiler-options})
|
||||
target_compile_options(spirv-cross-cpp PRIVATE ${spirv-compiler-options})
|
||||
macro(extract_headers out_abs file_list)
|
||||
set(${out_abs}) # absolute paths
|
||||
foreach(_a ${file_list})
|
||||
# get_filename_component only returns the longest extension, so use a regex
|
||||
string(REGEX REPLACE ".*\\.(h|hpp)" "\\1" ext ${_a})
|
||||
if(("${ext}" STREQUAL "h") OR ("${ext}" STREQUAL "hpp"))
|
||||
list(APPEND ${out_abs} "${_a}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(spirv_cross_add_library name config_name)
|
||||
add_library(${name} ${ARGN})
|
||||
extract_headers(hdrs "${ARGN}")
|
||||
target_include_directories(${name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include/spirv_cross>)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
PUBLIC_HEADERS "${hdrs}")
|
||||
target_compile_options(${name} PRIVATE ${spirv-compiler-options})
|
||||
target_compile_definitions(${name} PRIVATE ${spirv-compiler-defines})
|
||||
install(TARGETS ${name}
|
||||
EXPORT ${config_name}Config
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include/spirv_cross)
|
||||
install(FILES ${hdrs} DESTINATION include/spirv_cross)
|
||||
install(EXPORT ${config_name}Config DESTINATION share/${config_name}/cmake)
|
||||
export(TARGETS ${targets} FILE ${config_name}Config.cmake)
|
||||
endmacro()
|
||||
|
||||
|
||||
spirv_cross_add_library(spirv-cross-core spirv_cross_core STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_common.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cfg.cpp)
|
||||
|
||||
spirv_cross_add_library(spirv-cross-glsl spirv_cross_glsl STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.hpp)
|
||||
|
||||
spirv_cross_add_library(spirv-cross-cpp spirv_cross_cpp STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.cpp)
|
||||
|
||||
spirv_cross_add_library(spirv-cross-msl spirv_cross_msl STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.cpp)
|
||||
|
||||
spirv_cross_add_library(spirv-cross-hlsl spirv_cross_hlsl STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_hlsl.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_hlsl.cpp)
|
||||
|
||||
add_executable(spirv-cross main.cpp)
|
||||
target_compile_options(spirv-cross PRIVATE ${spirv-compiler-options})
|
||||
target_compile_definitions(spirv-cross-core PRIVATE ${spirv-compiler-defines})
|
||||
target_compile_definitions(spirv-cross-glsl PRIVATE ${spirv-compiler-defines})
|
||||
target_compile_definitions(spirv-cross-msl PRIVATE ${spirv-compiler-defines})
|
||||
target_compile_definitions(spirv-cross-cpp PRIVATE ${spirv-compiler-defines})
|
||||
target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines})
|
||||
|
||||
install(TARGETS spirv-cross RUNTIME DESTINATION bin)
|
||||
target_link_libraries(spirv-cross spirv-cross-glsl spirv-cross-hlsl spirv-cross-cpp spirv-cross-msl spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-glsl spirv-cross-core)
|
||||
target_link_libraries(spirv-cross-msl spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-hlsl spirv-cross-glsl)
|
||||
target_link_libraries(spirv-cross-cpp spirv-cross-glsl)
|
||||
|
||||
# Set up tests, using only the simplest modes of the test_shaders
|
||||
# script. You have to invoke the script manually to:
|
||||
# - Update the reference files
|
||||
# - Get cycle counts from malisc
|
||||
# - Keep failing outputs
|
||||
find_package(PythonInterp)
|
||||
if(${PYTHONINTERP_FOUND} AND ${PYTHON_VERSION_MAJOR} GREATER 2)
|
||||
add_test(NAME spirv-cross-test
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
|
||||
if (${PYTHONINTERP_FOUND})
|
||||
if (${PYTHON_VERSION_MAJOR} GREATER 2)
|
||||
add_test(NAME spirv-cross-test
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
|
||||
add_test(NAME spirv-cross-test-metal
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl)
|
||||
add_test(NAME spirv-cross-test-hlsl
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
|
||||
add_test(NAME spirv-cross-test-opt
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --opt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
|
||||
add_test(NAME spirv-cross-test-metal-opt
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal --opt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl)
|
||||
add_test(NAME spirv-cross-test-hlsl-opt
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl --opt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Testing disabled. Could not find python3. If you have python3 installed try running "
|
||||
"cmake with -DPYTHON_EXECUTABLE:FILEPATH=/path/to/python3 to help it find the executable")
|
||||
|
2
deps/SPIRV-Cross/GLSL.std.450.h
vendored
2
deps/SPIRV-Cross/GLSL.std.450.h
vendored
@ -13,7 +13,7 @@
|
||||
**
|
||||
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
|
||||
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
|
||||
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
|
||||
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
|
151
deps/SPIRV-Cross/README.md
vendored
151
deps/SPIRV-Cross/README.md
vendored
@ -8,6 +8,7 @@ SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader
|
||||
|
||||
- Convert SPIR-V to readable, usable and efficient GLSL
|
||||
- Convert SPIR-V to readable, usable and efficient Metal Shading Language (MSL) [EXPERIMENTAL]
|
||||
- Convert SPIR-V to readable, usable and efficient HLSL [EXPERIMENTAL]
|
||||
- Convert SPIR-V to debuggable C++ [EXPERIMENTAL]
|
||||
- Reflection API to simplify the creation of Vulkan pipeline layouts
|
||||
- Reflection API to modify and tweak OpDecorations
|
||||
@ -121,9 +122,15 @@ Please see `samples/cpp` where some GLSL shaders are compiled to SPIR-V, decompi
|
||||
Reading through the samples should explain how to use the C++ interface.
|
||||
A simple Makefile is included to build all shaders in the directory.
|
||||
|
||||
### Using SPIRV-Cross to output GLSL shaders from glslang HLSL
|
||||
### Implementation notes
|
||||
|
||||
#### Entry point
|
||||
When using SPIR-V and SPIRV-Cross as an intermediate step for cross-compiling between high level languages there are some considerations to take into account,
|
||||
as not all features used by one high-level language are necessarily supported natively by the target shader language.
|
||||
SPIRV-Cross aims to provide the tools needed to handle these scenarios in a clean and robust way, but some manual action is required to maintain compatibility.
|
||||
|
||||
#### HLSL source to GLSL
|
||||
|
||||
##### HLSL entry points
|
||||
|
||||
When using SPIR-V shaders compiled from HLSL, there are some extra things you need to take care of.
|
||||
First make sure that the entry point is used correctly.
|
||||
@ -135,7 +142,73 @@ Cannot end a function before ending the current block.
|
||||
Likely cause: If this SPIR-V was created from glslang HLSL, make sure the entry point is valid.
|
||||
```
|
||||
|
||||
#### Separate image samplers
|
||||
##### Vertex/Fragment interface linking
|
||||
|
||||
HLSL relies on semantics in order to effectively link together shader stages. In the SPIR-V generated by glslang, the transformation from HLSL to GLSL ends up looking like
|
||||
|
||||
```
|
||||
struct VSOutput {
|
||||
// SV_Position is rerouted to gl_Position
|
||||
float4 position : SV_Position;
|
||||
float4 coord : TEXCOORD0;
|
||||
};
|
||||
|
||||
VSOutput main(...) {}
|
||||
```
|
||||
|
||||
```
|
||||
struct VSOutput {
|
||||
float4 coord;
|
||||
}
|
||||
layout(location = 0) out VSOutput _magicNameGeneratedByGlslang;
|
||||
```
|
||||
|
||||
While this works, be aware of the type of the struct which is used in the vertex stage and the fragment stage.
|
||||
There may be issues if the structure type name differs in vertex stage and fragment stage.
|
||||
|
||||
You can make use of the reflection interface to force the name of the struct type.
|
||||
|
||||
```
|
||||
// Something like this for both vertex outputs and fragment inputs.
|
||||
compiler.set_name(varying_resource.base_type_id, "VertexFragmentLinkage");
|
||||
```
|
||||
|
||||
Some platform may require identical variable name for both vertex outputs and fragment inputs. (for example MacOSX)
|
||||
to rename varaible base on location, please add
|
||||
```
|
||||
--rename-interface-variable <in|out> <location> <new_variable_name>
|
||||
```
|
||||
|
||||
#### HLSL source to legacy GLSL/ESSL
|
||||
|
||||
HLSL tends to emit varying struct types to pass data between vertex and fragment.
|
||||
This is not supported in legacy GL/GLES targets, so to support this, varying structs are flattened.
|
||||
This is done automatically, but the API user might need to be aware that this is happening in order to support all cases.
|
||||
|
||||
Modern GLES code like this:
|
||||
```
|
||||
struct Output {
|
||||
vec4 a;
|
||||
vec2 b;
|
||||
};
|
||||
out Output vout;
|
||||
```
|
||||
|
||||
Is transformed into:
|
||||
```
|
||||
struct Output {
|
||||
vec4 a;
|
||||
vec2 b;
|
||||
};
|
||||
varying vec4 Output_a;
|
||||
varying vec2 Output_b;
|
||||
```
|
||||
|
||||
Note that now, both the struct name and the member names will participate in the linking interface between vertex and fragment, so
|
||||
API users might want to ensure that both the struct names and member names match so that vertex outputs and fragment inputs can link properly.
|
||||
|
||||
|
||||
#### Separate image samplers (HLSL/Vulkan) for backends which do not support it (GLSL)
|
||||
|
||||
Another thing you need to remember is when using samplers and textures in HLSL these are separable, and not directly compatible with GLSL. If you need to use this with desktop GL/GLES, you need to call `Compiler::build_combined_image_samplers` first before calling `Compiler::compile`, or you will get an exception.
|
||||
|
||||
@ -154,7 +227,33 @@ for (auto &remap : compiler->get_combined_image_samplers())
|
||||
```
|
||||
|
||||
If your target is Vulkan GLSL, `--vulkan-semantics` will emit separate image samplers as you'd expect.
|
||||
The command line client does this automatically, but if you're calling the library, you'll need to do this yourself.
|
||||
The command line client calls `Compiler::build_combined_image_samplers` automatically, but if you're calling the library, you'll need to do this yourself.
|
||||
|
||||
#### Descriptor sets (Vulkan GLSL) for backends which do not support them (HLSL/GLSL/Metal)
|
||||
|
||||
Descriptor sets are unique to Vulkan, so make sure that descriptor set + binding is remapped to a flat binding scheme (set always 0), so that other APIs can make sense of the bindings.
|
||||
This can be done with `Compiler::set_decoration(id, spv::DecorationDescriptorSet)`.
|
||||
|
||||
#### Linking by name for targets which do not support explicit locations (legacy GLSL/ESSL)
|
||||
|
||||
Modern GLSL and HLSL sources (and SPIR-V) relies on explicit layout(location) qualifiers to guide the linking process between shader stages,
|
||||
but older GLSL relies on symbol names to perform the linking. When emitting shaders with older versions, these layout statements will be removed,
|
||||
so it is important that the API user ensures that the names of I/O variables are sanitized so that linking will work properly.
|
||||
The reflection API can rename variables, struct types and struct members to deal with these scenarios using `Compiler::set_name` and friends.
|
||||
|
||||
#### Clip-space conventions
|
||||
|
||||
SPIRV-Cross can perform some common clip space conversions on gl_Position/SV_Position by enabling `CompilerGLSL::Options.vertex.fixup_clipspace`.
|
||||
While this can be convenient, it is recommended to modify the projection matrices instead as that can achieve the same result.
|
||||
|
||||
For GLSL targets, enabling this will convert a shader which assumes `[0, w]` depth range (Vulkan / D3D / Metal) into `[-w, w]` range.
|
||||
For MSL and HLSL targets, enabling this will convert a shader in `[-w, w]` depth range (OpenGL) to `[0, w]` depth range.
|
||||
|
||||
By default, the CLI will not enable `fixup_clipspace`, but in the API you might want to set an explicit value using `CompilerGLSL::set_options()`.
|
||||
|
||||
Y-flipping of gl_Position and similar is also supported.
|
||||
The use of this is discouraged, because relying on vertex shader Y-flipping tends to get quite messy.
|
||||
To enable this, set `CompilerGLSL::Options.vertex.flip_vert_y` or `--flip-vert-y` in CLI.
|
||||
|
||||
## Contributing
|
||||
|
||||
@ -165,12 +264,38 @@ Contributions to SPIRV-Cross are welcome. See Testing and Licensing sections for
|
||||
SPIRV-Cross maintains a test suite of shaders with reference output of how the output looks after going through a roundtrip through
|
||||
glslangValidator then back through SPIRV-Cross again. The reference files are stored inside the repository in order to be able to track regressions.
|
||||
|
||||
All pull requests should ensure that test output does not change unexpectedly. This can be tested with `./test_shaders.py shaders`.
|
||||
However, when improving SPIRV-Cross there are of course legitimate cases where reference output should change.
|
||||
In these cases, run `./test_shaders.py shaders --update` to update the reference files and include these changes as part of the pull request.
|
||||
Always make sure you are running up to date glslangValidator as well as SPIRV-Tools when updating reference files.
|
||||
All pull requests should ensure that test output does not change unexpectedly. This can be tested with:
|
||||
|
||||
In short, the master branch should always be able to run `./test_shaders.py shaders` without failure.
|
||||
```
|
||||
./test_shaders.py shaders
|
||||
./test_shaders.py shaders --opt
|
||||
./test_shaders.py shaders-hlsl --hlsl
|
||||
./test_shaders.py shaders-hlsl --hlsl --opt
|
||||
./test_shaders.py shaders-msl --msl
|
||||
./test_shaders.py shaders-msl --msl --opt
|
||||
```
|
||||
|
||||
although there are a couple of convenience script for doing this:
|
||||
|
||||
```
|
||||
./checkout_glslang_spirv_tools.sh # Checks out glslang and SPIRV-Tools at a fixed revision which matches the reference output.
|
||||
./test_shaders.sh # Runs over all changes and makes sure that there are no deltas compared to reference files.
|
||||
```
|
||||
|
||||
However, when improving SPIRV-Cross there are of course legitimate cases where reference output should change.
|
||||
In these cases, run:
|
||||
|
||||
```
|
||||
./update_test_shaders.sh
|
||||
```
|
||||
|
||||
to update the reference files and include these changes as part of the pull request.
|
||||
Always make sure you are running the correct version of glslangValidator as well as SPIRV-Tools when updating reference files.
|
||||
See `checkout_glslang_spirv_tools.sh`.
|
||||
|
||||
In short, the master branch should always be able to run `./test_shaders.py shaders` and friends without failure.
|
||||
SPIRV-Cross uses Travis CI to test all pull requests, so it is not strictly needed to perform testing yourself if you have problems running it locally.
|
||||
A pull request which does not pass testing on Travis will not be accepted however.
|
||||
|
||||
When adding support for new features to SPIRV-Cross, a new shader and reference file should be added which covers usage of the new shader features in question.
|
||||
|
||||
@ -205,6 +330,14 @@ The current reference output is contained in reference/.
|
||||
|
||||
See `./test_shaders.py --help` for more.
|
||||
|
||||
### Metal backend
|
||||
|
||||
To test the roundtrip path GLSL -> SPIR-V -> MSL, `--msl` can be added, e.g. `./test_shaders.py --msl shaders-msl`.
|
||||
|
||||
### HLSL backend
|
||||
|
||||
To test the roundtrip path GLSL -> SPIR-V -> HLSL, `--hlsl` can be added, e.g. `./test_shaders.py --hlsl shaders-hlsl`.
|
||||
|
||||
### Updating regression tests
|
||||
|
||||
When legitimate changes are found, use `--update` flag to update regression files.
|
||||
|
57
deps/SPIRV-Cross/checkout_glslang_spirv_tools.sh
vendored
Normal file
57
deps/SPIRV-Cross/checkout_glslang_spirv_tools.sh
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
GLSLANG_REV=9c6f8cc29ba303b43ccf36deea6bb38a304f9b92
|
||||
SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
|
||||
|
||||
if [ -d external/glslang ]; then
|
||||
echo "Updating glslang to revision $GLSLANG_REV."
|
||||
cd external/glslang
|
||||
git fetch origin
|
||||
git checkout $GLSLANG_REV
|
||||
else
|
||||
echo "Cloning glslang revision $GLSLANG_REV."
|
||||
mkdir -p external
|
||||
cd external
|
||||
git clone git://github.com/KhronosGroup/glslang.git
|
||||
cd glslang
|
||||
git checkout $GLSLANG_REV
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
echo "Building glslang."
|
||||
mkdir -p external/glslang-build
|
||||
cd external/glslang-build
|
||||
cmake ../glslang -DCMAKE_BUILD_TYPE=Release -G"Unix Makefiles"
|
||||
make -j$(nproc)
|
||||
cd ../..
|
||||
|
||||
if [ -d external/spirv-tools ]; then
|
||||
echo "Updating SPIRV-Tools to revision $SPIRV_TOOLS_REV."
|
||||
cd external/spirv-tools
|
||||
git fetch origin
|
||||
git checkout $SPIRV_TOOLS_REV
|
||||
else
|
||||
echo "Cloning SPIRV-Tools revision $SPIRV_TOOLS_REV."
|
||||
mkdir -p external
|
||||
cd external
|
||||
git clone git://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
|
||||
cd spirv-tools
|
||||
git checkout $SPIRV_TOOLS_REV
|
||||
|
||||
if [ -d external/spirv-headers ]; then
|
||||
cd external/spirv-headers
|
||||
git pull origin master
|
||||
cd ../..
|
||||
else
|
||||
git clone git://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
|
||||
fi
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
echo "Building SPIRV-Tools."
|
||||
mkdir -p external/spirv-tools-build
|
||||
cd external/spirv-tools-build
|
||||
cmake ../spirv-tools -DCMAKE_BUILD_TYPE=Release -G"Unix Makefiles"
|
||||
make -j$(nproc)
|
||||
cd ../..
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -33,7 +33,7 @@ template <typename T>
|
||||
struct image2DBase
|
||||
{
|
||||
virtual ~image2DBase() = default;
|
||||
inline virtual T load(glm::ivec2 coord)
|
||||
inline virtual T load(glm::ivec2 coord) const
|
||||
{
|
||||
return T(0, 0, 0, 1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -19,8 +19,8 @@
|
||||
|
||||
// This file must only be included by the shader generated by spirv-cross!
|
||||
|
||||
#ifndef GLM_SWIZZLE
|
||||
#define GLM_SWIZZLE
|
||||
#ifndef GLM_FORCE_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#endif
|
||||
|
||||
#ifndef GLM_FORCE_RADIANS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
263
deps/SPIRV-Cross/main.cpp
vendored
263
deps/SPIRV-Cross/main.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 ARM Limited
|
||||
* Copyright 2015-2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
#include "spirv_cpp.hpp"
|
||||
#include "spirv_glsl.hpp"
|
||||
#include "spirv_hlsl.hpp"
|
||||
#include "spirv_msl.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
@ -26,19 +28,23 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
using namespace spv;
|
||||
using namespace spirv_cross;
|
||||
using namespace std;
|
||||
|
||||
#ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
#define THROW(x) \
|
||||
do \
|
||||
{ \
|
||||
fprintf(stderr, "%s.", x); \
|
||||
exit(1); \
|
||||
} while (0)
|
||||
static inline void THROW(const char *str)
|
||||
{
|
||||
fprintf(stderr, "SPIRV-Cross will abort: %s\n", str);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
#else
|
||||
#define THROW(x) runtime_error(x)
|
||||
#define THROW(x) throw runtime_error(x)
|
||||
#endif
|
||||
|
||||
struct CLIParser;
|
||||
@ -187,7 +193,7 @@ static bool write_string_to_file(const char *path, const char *string)
|
||||
FILE *file = fopen(path, "w");
|
||||
if (!file)
|
||||
{
|
||||
fprintf(file, "Failed to write file: %s\n", path);
|
||||
fprintf(stderr, "Failed to write file: %s\n", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -200,11 +206,16 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
|
||||
{
|
||||
fprintf(stderr, "%s\n", tag);
|
||||
fprintf(stderr, "=============\n\n");
|
||||
bool print_ssbo = !strcmp(tag, "ssbos");
|
||||
|
||||
for (auto &res : resources)
|
||||
{
|
||||
auto &type = compiler.get_type(res.type_id);
|
||||
auto mask = compiler.get_decoration_mask(res.id);
|
||||
|
||||
if (print_ssbo && compiler.buffer_is_hlsl_counter_buffer(res.id))
|
||||
continue;
|
||||
|
||||
// If we don't have a name, use the fallback for the type instead of the variable
|
||||
// for SSBOs and UBOs since those are the only meaningful names to use externally.
|
||||
// Push constant blocks are still accessed by name and not block name, even though they are technically Blocks.
|
||||
@ -217,7 +228,7 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
|
||||
|
||||
uint32_t block_size = 0;
|
||||
if (is_sized_block)
|
||||
block_size = compiler.get_declared_struct_size(compiler.get_type(res.base_type_id));
|
||||
block_size = uint32_t(compiler.get_declared_struct_size(compiler.get_type(res.base_type_id)));
|
||||
|
||||
string array;
|
||||
for (auto arr : type.array)
|
||||
@ -234,8 +245,16 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
|
||||
fprintf(stderr, " (Binding : %u)", compiler.get_decoration(res.id, DecorationBinding));
|
||||
if (mask & (1ull << DecorationInputAttachmentIndex))
|
||||
fprintf(stderr, " (Attachment : %u)", compiler.get_decoration(res.id, DecorationInputAttachmentIndex));
|
||||
if (mask & (1ull << DecorationNonReadable))
|
||||
fprintf(stderr, " writeonly");
|
||||
if (mask & (1ull << DecorationNonWritable))
|
||||
fprintf(stderr, " readonly");
|
||||
if (is_sized_block)
|
||||
fprintf(stderr, " (BlockSize : %u bytes)", block_size);
|
||||
|
||||
uint32_t counter_id = 0;
|
||||
if (print_ssbo && compiler.buffer_get_hlsl_counter_buffer(res.id, counter_id))
|
||||
fprintf(stderr, " (HLSL counter buffer ID: %u)", counter_id);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf(stderr, "=============\n\n");
|
||||
@ -380,6 +399,21 @@ static void print_spec_constants(const Compiler &compiler)
|
||||
fprintf(stderr, "==================\n\n");
|
||||
}
|
||||
|
||||
static void print_capabilities_and_extensions(const Compiler &compiler)
|
||||
{
|
||||
fprintf(stderr, "Capabilities\n");
|
||||
fprintf(stderr, "============\n");
|
||||
for (auto &capability : compiler.get_declared_capabilities())
|
||||
fprintf(stderr, "Capability: %u\n", static_cast<unsigned>(capability));
|
||||
fprintf(stderr, "============\n\n");
|
||||
|
||||
fprintf(stderr, "Extensions\n");
|
||||
fprintf(stderr, "============\n");
|
||||
for (auto &ext : compiler.get_declared_extensions())
|
||||
fprintf(stderr, "Extension: %s\n", ext.c_str());
|
||||
fprintf(stderr, "============\n\n");
|
||||
}
|
||||
|
||||
struct PLSArg
|
||||
{
|
||||
PlsFormat format;
|
||||
@ -399,43 +433,71 @@ struct VariableTypeRemap
|
||||
string new_variable_type;
|
||||
};
|
||||
|
||||
struct InterfaceVariableRename
|
||||
{
|
||||
StorageClass storageClass;
|
||||
uint32_t location;
|
||||
string variable_name;
|
||||
};
|
||||
|
||||
struct CLIArguments
|
||||
{
|
||||
const char *input = nullptr;
|
||||
const char *output = nullptr;
|
||||
const char *cpp_interface_name = nullptr;
|
||||
uint32_t version = 0;
|
||||
uint32_t shader_model = 0;
|
||||
uint32_t msl_version = 0;
|
||||
bool es = false;
|
||||
bool set_version = false;
|
||||
bool set_shader_model = false;
|
||||
bool set_msl_version = false;
|
||||
bool set_es = false;
|
||||
bool dump_resources = false;
|
||||
bool force_temporary = false;
|
||||
bool flatten_ubo = false;
|
||||
bool fixup = false;
|
||||
bool yflip = false;
|
||||
bool sso = false;
|
||||
vector<PLSArg> pls_in;
|
||||
vector<PLSArg> pls_out;
|
||||
vector<Remap> remaps;
|
||||
vector<string> extensions;
|
||||
vector<VariableTypeRemap> variable_type_remaps;
|
||||
vector<InterfaceVariableRename> interface_variable_renames;
|
||||
vector<HLSLVertexAttributeRemap> hlsl_attr_remap;
|
||||
string entry;
|
||||
|
||||
vector<pair<string, string>> entry_point_rename;
|
||||
|
||||
uint32_t iterations = 1;
|
||||
bool cpp = false;
|
||||
bool metal = false;
|
||||
bool msl = false;
|
||||
bool hlsl = false;
|
||||
bool hlsl_compat = false;
|
||||
bool vulkan_semantics = false;
|
||||
bool flatten_multidimensional_arrays = false;
|
||||
bool use_420pack_extension = true;
|
||||
bool remove_unused = false;
|
||||
bool cfg_analysis = true;
|
||||
};
|
||||
|
||||
static void print_help()
|
||||
{
|
||||
fprintf(stderr, "Usage: spirv-cross [--output <output path>] [SPIR-V file] [--es] [--no-es] [--no-cfg-analysis] "
|
||||
"[--version <GLSL "
|
||||
"version>] [--dump-resources] [--help] [--force-temporary] [--cpp] [--cpp-interface-name <name>] "
|
||||
"[--metal] [--vulkan-semantics] [--flatten-ubo] [--fixup-clipspace] [--iterations iter] [--pls-in "
|
||||
"format input-name] [--pls-out format output-name] [--remap source_name target_name components] "
|
||||
"[--extension ext] [--entry name] [--remove-unused-variables] "
|
||||
"[--remap-variable-type <variable_name> <new_variable_type>]\n");
|
||||
fprintf(stderr, "Usage: spirv-cross [--output <output path>] [SPIR-V file] [--es] [--no-es] "
|
||||
"[--version <GLSL version>] [--dump-resources] [--help] [--force-temporary] "
|
||||
"[--vulkan-semantics] [--flatten-ubo] [--fixup-clipspace] [--flip-vert-y] [--iterations iter] "
|
||||
"[--cpp] [--cpp-interface-name <name>] "
|
||||
"[--msl] [--msl-version <MMmmpp>]"
|
||||
"[--hlsl] [--shader-model] [--hlsl-enable-compat] "
|
||||
"[--separate-shader-objects]"
|
||||
"[--pls-in format input-name] [--pls-out format output-name] [--remap source_name target_name "
|
||||
"components] [--extension ext] [--entry name] [--remove-unused-variables] "
|
||||
"[--flatten-multidimensional-arrays] [--no-420pack-extension] "
|
||||
"[--remap-variable-type <variable_name> <new_variable_type>] "
|
||||
"[--rename-interface-variable <in|out> <location> <new_variable_name>] "
|
||||
"[--set-hlsl-vertex-input-semantic <location> <semantic>] "
|
||||
"[--rename-entry-point <old> <new>] "
|
||||
"\n");
|
||||
}
|
||||
|
||||
static bool remap_generic(Compiler &compiler, const vector<Resource> &resources, const Remap &remap)
|
||||
@ -522,7 +584,34 @@ static PlsFormat pls_format(const char *str)
|
||||
return PlsNone;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
void rename_interface_variable(Compiler &compiler, const vector<Resource> &resources,
|
||||
const InterfaceVariableRename &rename)
|
||||
{
|
||||
for (auto &v : resources)
|
||||
{
|
||||
if (!compiler.has_decoration(v.id, spv::DecorationLocation))
|
||||
continue;
|
||||
|
||||
auto loc = compiler.get_decoration(v.id, spv::DecorationLocation);
|
||||
if (loc != rename.location)
|
||||
continue;
|
||||
|
||||
auto &type = compiler.get_type(v.base_type_id);
|
||||
|
||||
// This is more of a friendly variant. If we need to rename interface variables, we might have to rename
|
||||
// structs as well and make sure all the names match up.
|
||||
if (type.basetype == SPIRType::Struct)
|
||||
{
|
||||
compiler.set_name(v.base_type_id, join("SPIRV_Cross_Interface_Location", rename.location));
|
||||
for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++)
|
||||
compiler.set_member_name(v.base_type_id, i, join("InterfaceMember", i));
|
||||
}
|
||||
|
||||
compiler.set_name(v.id, rename.variable_name);
|
||||
}
|
||||
}
|
||||
|
||||
static int main_inner(int argc, char *argv[])
|
||||
{
|
||||
CLIArguments args;
|
||||
CLICallbacks cbs;
|
||||
@ -544,18 +633,36 @@ int main(int argc, char *argv[])
|
||||
args.version = parser.next_uint();
|
||||
args.set_version = true;
|
||||
});
|
||||
cbs.add("--no-cfg-analysis", [&args](CLIParser &) { args.cfg_analysis = false; });
|
||||
cbs.add("--dump-resources", [&args](CLIParser &) { args.dump_resources = true; });
|
||||
cbs.add("--force-temporary", [&args](CLIParser &) { args.force_temporary = true; });
|
||||
cbs.add("--flatten-ubo", [&args](CLIParser &) { args.flatten_ubo = true; });
|
||||
cbs.add("--fixup-clipspace", [&args](CLIParser &) { args.fixup = true; });
|
||||
cbs.add("--flip-vert-y", [&args](CLIParser &) { args.yflip = true; });
|
||||
cbs.add("--iterations", [&args](CLIParser &parser) { args.iterations = parser.next_uint(); });
|
||||
cbs.add("--cpp", [&args](CLIParser &) { args.cpp = true; });
|
||||
cbs.add("--cpp-interface-name", [&args](CLIParser &parser) { args.cpp_interface_name = parser.next_string(); });
|
||||
cbs.add("--metal", [&args](CLIParser &) { args.metal = true; });
|
||||
cbs.add("--metal", [&args](CLIParser &) { args.msl = true; }); // Legacy compatibility
|
||||
cbs.add("--msl", [&args](CLIParser &) { args.msl = true; });
|
||||
cbs.add("--hlsl", [&args](CLIParser &) { args.hlsl = true; });
|
||||
cbs.add("--hlsl-enable-compat", [&args](CLIParser &) { args.hlsl_compat = true; });
|
||||
cbs.add("--vulkan-semantics", [&args](CLIParser &) { args.vulkan_semantics = true; });
|
||||
cbs.add("--flatten-multidimensional-arrays", [&args](CLIParser &) { args.flatten_multidimensional_arrays = true; });
|
||||
cbs.add("--no-420pack-extension", [&args](CLIParser &) { args.use_420pack_extension = false; });
|
||||
cbs.add("--extension", [&args](CLIParser &parser) { args.extensions.push_back(parser.next_string()); });
|
||||
cbs.add("--rename-entry-point", [&args](CLIParser &parser) {
|
||||
auto old_name = parser.next_string();
|
||||
auto new_name = parser.next_string();
|
||||
args.entry_point_rename.push_back({ old_name, new_name });
|
||||
});
|
||||
cbs.add("--entry", [&args](CLIParser &parser) { args.entry = parser.next_string(); });
|
||||
cbs.add("--separate-shader-objects", [&args](CLIParser &) { args.sso = true; });
|
||||
cbs.add("--set-hlsl-vertex-input-semantic", [&args](CLIParser &parser) {
|
||||
HLSLVertexAttributeRemap remap;
|
||||
remap.location = parser.next_uint();
|
||||
remap.semantic = parser.next_string();
|
||||
args.hlsl_attr_remap.push_back(move(remap));
|
||||
});
|
||||
|
||||
cbs.add("--remap", [&args](CLIParser &parser) {
|
||||
string src = parser.next_string();
|
||||
string dst = parser.next_string();
|
||||
@ -569,6 +676,19 @@ int main(int argc, char *argv[])
|
||||
args.variable_type_remaps.push_back({ move(var_name), move(new_type) });
|
||||
});
|
||||
|
||||
cbs.add("--rename-interface-variable", [&args](CLIParser &parser) {
|
||||
StorageClass cls = StorageClassMax;
|
||||
string clsStr = parser.next_string();
|
||||
if (clsStr == "in")
|
||||
cls = StorageClassInput;
|
||||
else if (clsStr == "out")
|
||||
cls = StorageClassOutput;
|
||||
|
||||
uint32_t loc = parser.next_uint();
|
||||
string var_name = parser.next_string();
|
||||
args.interface_variable_renames.push_back({ cls, loc, move(var_name) });
|
||||
});
|
||||
|
||||
cbs.add("--pls-in", [&args](CLIParser &parser) {
|
||||
auto fmt = pls_format(parser.next_string());
|
||||
auto name = parser.next_string();
|
||||
@ -579,6 +699,14 @@ int main(int argc, char *argv[])
|
||||
auto name = parser.next_string();
|
||||
args.pls_out.push_back({ move(fmt), move(name) });
|
||||
});
|
||||
cbs.add("--shader-model", [&args](CLIParser &parser) {
|
||||
args.shader_model = parser.next_uint();
|
||||
args.set_shader_model = true;
|
||||
});
|
||||
cbs.add("--msl-version", [&args](CLIParser &parser) {
|
||||
args.msl_version = parser.next_uint();
|
||||
args.set_msl_version = true;
|
||||
});
|
||||
|
||||
cbs.add("--remove-unused-variables", [&args](CLIParser &) { args.remove_unused = true; });
|
||||
|
||||
@ -612,8 +740,18 @@ int main(int argc, char *argv[])
|
||||
if (args.cpp_interface_name)
|
||||
static_cast<CompilerCPP *>(compiler.get())->set_interface_name(args.cpp_interface_name);
|
||||
}
|
||||
else if (args.metal)
|
||||
else if (args.msl)
|
||||
{
|
||||
compiler = unique_ptr<CompilerMSL>(new CompilerMSL(read_spirv_file(args.input)));
|
||||
|
||||
auto *msl_comp = static_cast<CompilerMSL *>(compiler.get());
|
||||
auto msl_opts = msl_comp->get_options();
|
||||
if (args.set_msl_version)
|
||||
msl_opts.msl_version = args.msl_version;
|
||||
msl_comp->set_options(msl_opts);
|
||||
}
|
||||
else if (args.hlsl)
|
||||
compiler = unique_ptr<CompilerHLSL>(new CompilerHLSL(read_spirv_file(args.input)));
|
||||
else
|
||||
{
|
||||
combined_image_samplers = !args.vulkan_semantics;
|
||||
@ -631,6 +769,9 @@ int main(int argc, char *argv[])
|
||||
compiler->set_variable_type_remap_callback(move(remap_cb));
|
||||
}
|
||||
|
||||
for (auto &rename : args.entry_point_rename)
|
||||
compiler->rename_entry_point(rename.first, rename.second);
|
||||
|
||||
if (!args.entry.empty())
|
||||
compiler->set_entry_point(args.entry);
|
||||
|
||||
@ -647,11 +788,38 @@ int main(int argc, char *argv[])
|
||||
if (args.set_es)
|
||||
opts.es = args.es;
|
||||
opts.force_temporary = args.force_temporary;
|
||||
opts.separate_shader_objects = args.sso;
|
||||
opts.flatten_multidimensional_arrays = args.flatten_multidimensional_arrays;
|
||||
opts.enable_420pack_extension = args.use_420pack_extension;
|
||||
opts.vulkan_semantics = args.vulkan_semantics;
|
||||
opts.vertex.fixup_clipspace = args.fixup;
|
||||
opts.cfg_analysis = args.cfg_analysis;
|
||||
opts.vertex.flip_vert_y = args.yflip;
|
||||
compiler->set_options(opts);
|
||||
|
||||
// Set HLSL specific options.
|
||||
if (args.hlsl)
|
||||
{
|
||||
auto *hlsl = static_cast<CompilerHLSL *>(compiler.get());
|
||||
auto hlsl_opts = hlsl->get_options();
|
||||
if (args.set_shader_model)
|
||||
{
|
||||
if (args.shader_model < 30)
|
||||
{
|
||||
fprintf(stderr, "Shader model earlier than 30 (3.0) not supported.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
hlsl_opts.shader_model = args.shader_model;
|
||||
}
|
||||
|
||||
if (args.hlsl_compat)
|
||||
{
|
||||
// Enable all compat options.
|
||||
hlsl_opts.point_size_compat = true;
|
||||
}
|
||||
hlsl->set_options(hlsl_opts);
|
||||
}
|
||||
|
||||
ShaderResources res;
|
||||
if (args.remove_unused)
|
||||
{
|
||||
@ -663,8 +831,12 @@ int main(int argc, char *argv[])
|
||||
res = compiler->get_shader_resources();
|
||||
|
||||
if (args.flatten_ubo)
|
||||
{
|
||||
for (auto &ubo : res.uniform_buffers)
|
||||
compiler->flatten_interface_block(ubo.id);
|
||||
compiler->flatten_buffer_block(ubo.id);
|
||||
for (auto &ubo : res.push_constant_buffers)
|
||||
compiler->flatten_buffer_block(ubo.id);
|
||||
}
|
||||
|
||||
auto pls_inputs = remap_pls(args.pls_in, res.stage_inputs, &res.subpass_inputs);
|
||||
auto pls_outputs = remap_pls(args.pls_out, res.stage_outputs, nullptr);
|
||||
@ -683,11 +855,25 @@ int main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto &rename : args.interface_variable_renames)
|
||||
{
|
||||
if (rename.storageClass == StorageClassInput)
|
||||
rename_interface_variable(*compiler, res.stage_inputs, rename);
|
||||
else if (rename.storageClass == StorageClassOutput)
|
||||
rename_interface_variable(*compiler, res.stage_outputs, rename);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "error at --rename-interface-variable <in|out> ...\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.dump_resources)
|
||||
{
|
||||
print_resources(*compiler, res);
|
||||
print_push_constant_resources(*compiler, res.push_constant_buffers);
|
||||
print_spec_constants(*compiler);
|
||||
print_capabilities_and_extensions(*compiler);
|
||||
}
|
||||
|
||||
if (combined_image_samplers)
|
||||
@ -703,10 +889,35 @@ int main(int argc, char *argv[])
|
||||
|
||||
string glsl;
|
||||
for (uint32_t i = 0; i < args.iterations; i++)
|
||||
glsl = compiler->compile();
|
||||
{
|
||||
if (args.hlsl)
|
||||
glsl = static_cast<CompilerHLSL *>(compiler.get())->compile(move(args.hlsl_attr_remap));
|
||||
else
|
||||
glsl = compiler->compile();
|
||||
}
|
||||
|
||||
if (args.output)
|
||||
write_string_to_file(args.output, glsl.c_str());
|
||||
else
|
||||
printf("%s", glsl.c_str());
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
return main_inner(argc, argv);
|
||||
#else
|
||||
// Make sure we catch the exception or it just disappears into the aether on Windows.
|
||||
try
|
||||
{
|
||||
return main_inner(argc, argv);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fprintf(stderr, "SPIRV-Cross threw an exception: %s\n", e.what());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
2
deps/SPIRV-Cross/msvc/SPIRV-Cross.vcxproj
vendored
2
deps/SPIRV-Cross/msvc/SPIRV-Cross.vcxproj
vendored
@ -127,6 +127,7 @@
|
||||
<ClCompile Include="..\spirv_cpp.cpp" />
|
||||
<ClCompile Include="..\spirv_cross.cpp" />
|
||||
<ClCompile Include="..\spirv_glsl.cpp" />
|
||||
<ClCompile Include="..\spirv_hlsl.cpp" />
|
||||
<ClCompile Include="..\spirv_msl.cpp" />
|
||||
<ClCompile Include="..\spirv_cfg.cpp" />
|
||||
</ItemGroup>
|
||||
@ -137,6 +138,7 @@
|
||||
<ClInclude Include="..\spirv_cross.hpp" />
|
||||
<ClInclude Include="..\spirv_glsl.hpp" />
|
||||
<ClInclude Include="..\spirv.hpp" />
|
||||
<ClInclude Include="..\spirv_hlsl.hpp" />
|
||||
<ClInclude Include="..\spirv_msl.hpp" />
|
||||
<ClInclude Include="..\spirv_cfg.hpp" />
|
||||
</ItemGroup>
|
||||
|
@ -33,6 +33,9 @@
|
||||
<ClCompile Include="..\spirv_cfg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\spirv_hlsl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GLSL.std.450.h">
|
||||
@ -59,5 +62,8 @@
|
||||
<ClInclude Include="..\spirv_cfg.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\spirv_hlsl.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -0,0 +1,16 @@
|
||||
static const uint _5 = 9u;
|
||||
static const uint _6 = 4u;
|
||||
static const uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||
|
||||
RWByteAddressBuffer _4 : register(u0);
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
_4.Store(0, asuint(asfloat(_4.Load(0)) + 1.0f));
|
||||
}
|
||||
|
||||
[numthreads(9, 20, 4)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
24
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp
vendored
Normal file
24
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/comp/storage-buffer-basic.nofxc.asm.comp
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
static const uint _3 = 1u;
|
||||
static const uint _4 = 3u;
|
||||
static const uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||
|
||||
RWByteAddressBuffer _8 : register(u0);
|
||||
RWByteAddressBuffer _9 : register(u1);
|
||||
|
||||
static uint3 gl_WorkGroupID;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint3 gl_WorkGroupID : SV_GroupID;
|
||||
};
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
_8.Store(gl_WorkGroupID.x * 4 + 0, asuint(asfloat(_9.Load(gl_WorkGroupID.x * 4 + 0)) + asfloat(_8.Load(gl_WorkGroupID.x * 4 + 0))));
|
||||
}
|
||||
|
||||
[numthreads(1, 2, 3)]
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_WorkGroupID = stage_input.gl_WorkGroupID;
|
||||
comp_main();
|
||||
}
|
25
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag
vendored
Normal file
25
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
cbuffer _5 : register(b0)
|
||||
{
|
||||
column_major float2x4 _5_m0 : packoffset(c0);
|
||||
float4 _5_m1 : packoffset(c4);
|
||||
};
|
||||
|
||||
static float2 _3;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 _3 : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
_3 = mul(_5_m0, _5_m1);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output._3 = _3;
|
||||
return stage_output;
|
||||
}
|
42
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag
vendored
Normal file
42
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
static int counter;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
nointerpolation int counter : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 _21;
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _33;
|
||||
do
|
||||
{
|
||||
if (counter == 10)
|
||||
{
|
||||
_33 = 10.0f.xxxx;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_33 = 30.0f.xxxx;
|
||||
break;
|
||||
}
|
||||
} while (false);
|
||||
FragColor = _33;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
counter = stage_input.counter;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/vert/empty-struct-composite.asm.vert
vendored
Normal file
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/vert/empty-struct-composite.asm.vert
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
void vert_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vert_main();
|
||||
}
|
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert
vendored
Normal file
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
static float4 gl_Position;
|
||||
static int gl_VertexID;
|
||||
static int gl_InstanceID;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint gl_VertexID : SV_VertexID;
|
||||
uint gl_InstanceID : SV_InstanceID;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = float(gl_VertexID + gl_InstanceID).xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_VertexID = int(stage_input.gl_VertexID);
|
||||
gl_InstanceID = int(stage_input.gl_InstanceID);
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
21
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/access-chains.comp
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/access-chains.comp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
RWByteAddressBuffer wo : register(u1);
|
||||
ByteAddressBuffer ro : register(t0);
|
||||
|
||||
static uint3 gl_GlobalInvocationID;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160))));
|
||||
wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480))));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||
comp_main();
|
||||
}
|
15
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/address-buffers.comp
vendored
Normal file
15
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/address-buffers.comp
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
RWByteAddressBuffer WriteOnly : register(u2);
|
||||
ByteAddressBuffer ReadOnly : register(t0);
|
||||
RWByteAddressBuffer ReadWrite : register(u1);
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
WriteOnly.Store4(0, asuint(asfloat(ReadOnly.Load4(0))));
|
||||
ReadWrite.Store4(0, asuint(asfloat(ReadWrite.Load4(0)) + 10.0f.xxxx));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
89
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/atomic.comp
vendored
Normal file
89
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/atomic.comp
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
RWByteAddressBuffer ssbo : register(u2);
|
||||
RWTexture2D<uint> uImage : register(u0);
|
||||
RWTexture2D<int> iImage : register(u1);
|
||||
|
||||
groupshared int int_atomic;
|
||||
groupshared uint uint_atomic;
|
||||
groupshared int int_atomic_array[1];
|
||||
groupshared uint uint_atomic_array[1];
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
uint _19;
|
||||
InterlockedAdd(uImage[int2(1, 5)], 1u, _19);
|
||||
uint _27;
|
||||
InterlockedAdd(uImage[int2(1, 5)], 1u, _27);
|
||||
iImage[int2(1, 6)] = int(_27).x;
|
||||
uint _32;
|
||||
InterlockedOr(uImage[int2(1, 5)], 1u, _32);
|
||||
uint _34;
|
||||
InterlockedXor(uImage[int2(1, 5)], 1u, _34);
|
||||
uint _36;
|
||||
InterlockedAnd(uImage[int2(1, 5)], 1u, _36);
|
||||
uint _38;
|
||||
InterlockedMin(uImage[int2(1, 5)], 1u, _38);
|
||||
uint _40;
|
||||
InterlockedMax(uImage[int2(1, 5)], 1u, _40);
|
||||
uint _44;
|
||||
InterlockedCompareExchange(uImage[int2(1, 5)], 10u, 2u, _44);
|
||||
int _47;
|
||||
InterlockedAdd(iImage[int2(1, 6)], 1, _47);
|
||||
int _49;
|
||||
InterlockedOr(iImage[int2(1, 6)], 1, _49);
|
||||
int _51;
|
||||
InterlockedXor(iImage[int2(1, 6)], 1, _51);
|
||||
int _53;
|
||||
InterlockedAnd(iImage[int2(1, 6)], 1, _53);
|
||||
int _55;
|
||||
InterlockedMin(iImage[int2(1, 6)], 1, _55);
|
||||
int _57;
|
||||
InterlockedMax(iImage[int2(1, 6)], 1, _57);
|
||||
int _61;
|
||||
InterlockedCompareExchange(iImage[int2(1, 5)], 10, 2, _61);
|
||||
uint _68;
|
||||
ssbo.InterlockedAdd(0, 1u, _68);
|
||||
uint _70;
|
||||
ssbo.InterlockedOr(0, 1u, _70);
|
||||
uint _72;
|
||||
ssbo.InterlockedXor(0, 1u, _72);
|
||||
uint _74;
|
||||
ssbo.InterlockedAnd(0, 1u, _74);
|
||||
uint _76;
|
||||
ssbo.InterlockedMin(0, 1u, _76);
|
||||
uint _78;
|
||||
ssbo.InterlockedMax(0, 1u, _78);
|
||||
uint _80;
|
||||
ssbo.InterlockedExchange(0, 1u, _80);
|
||||
uint _82;
|
||||
ssbo.InterlockedCompareExchange(0, 10u, 2u, _82);
|
||||
int _85;
|
||||
ssbo.InterlockedAdd(4, 1, _85);
|
||||
int _87;
|
||||
ssbo.InterlockedOr(4, 1, _87);
|
||||
int _89;
|
||||
ssbo.InterlockedXor(4, 1, _89);
|
||||
int _91;
|
||||
ssbo.InterlockedAnd(4, 1, _91);
|
||||
int _93;
|
||||
ssbo.InterlockedMin(4, 1, _93);
|
||||
int _95;
|
||||
ssbo.InterlockedMax(4, 1, _95);
|
||||
int _97;
|
||||
ssbo.InterlockedExchange(4, 1, _97);
|
||||
int _99;
|
||||
ssbo.InterlockedCompareExchange(4, 10, 2, _99);
|
||||
int _102;
|
||||
InterlockedAdd(int_atomic, 10, _102);
|
||||
uint _105;
|
||||
InterlockedAdd(uint_atomic, 10u, _105);
|
||||
int _110;
|
||||
InterlockedAdd(int_atomic_array[0], 10, _110);
|
||||
uint _115;
|
||||
InterlockedAdd(uint_atomic_array[0], 10u, _115);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/barriers.comp
vendored
Normal file
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/barriers.comp
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
GroupMemoryBarrier();
|
||||
AllMemoryBarrier();
|
||||
DeviceMemoryBarrier();
|
||||
DeviceMemoryBarrier();
|
||||
AllMemoryBarrier();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
AllMemoryBarrier();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
DeviceMemoryBarrier();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
DeviceMemoryBarrier();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
AllMemoryBarrier();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
}
|
||||
|
||||
[numthreads(4, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
113
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/bitfield.noopt.comp
vendored
Normal file
113
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/bitfield.noopt.comp
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
uint SPIRV_Cross_bitfieldInsert(uint Base, uint Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint2 SPIRV_Cross_bitfieldInsert(uint2 Base, uint2 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint3 SPIRV_Cross_bitfieldInsert(uint3 Base, uint3 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint4 SPIRV_Cross_bitfieldInsert(uint4 Base, uint4 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_bitfieldUExtract(uint Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint2 SPIRV_Cross_bitfieldUExtract(uint2 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint3 SPIRV_Cross_bitfieldUExtract(uint3 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint4 SPIRV_Cross_bitfieldUExtract(uint4 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
int SPIRV_Cross_bitfieldSExtract(int Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int2 SPIRV_Cross_bitfieldSExtract(int2 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int2 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int3 SPIRV_Cross_bitfieldSExtract(int3 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int3 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int4 SPIRV_Cross_bitfieldSExtract(int4 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int4 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
int signed_value = 0;
|
||||
uint unsigned_value = 0u;
|
||||
int3 signed_values = int3(0, 0, 0);
|
||||
uint3 unsigned_values = uint3(0u, 0u, 0u);
|
||||
int s = SPIRV_Cross_bitfieldSExtract(signed_value, 5, 20);
|
||||
uint u = SPIRV_Cross_bitfieldUExtract(unsigned_value, 6, 21);
|
||||
s = int(SPIRV_Cross_bitfieldInsert(s, 40, 5, 4));
|
||||
u = SPIRV_Cross_bitfieldInsert(u, 60u, 5, 4);
|
||||
u = reversebits(u);
|
||||
s = reversebits(s);
|
||||
int v0 = countbits(u);
|
||||
int v1 = countbits(s);
|
||||
int v2 = firstbithigh(u);
|
||||
int v3 = firstbitlow(s);
|
||||
int3 s_1 = SPIRV_Cross_bitfieldSExtract(signed_values, 5, 20);
|
||||
uint3 u_1 = SPIRV_Cross_bitfieldUExtract(unsigned_values, 6, 21);
|
||||
s_1 = int3(SPIRV_Cross_bitfieldInsert(s_1, int3(40, 40, 40), 5, 4));
|
||||
u_1 = SPIRV_Cross_bitfieldInsert(u_1, uint3(60u, 60u, 60u), 5, 4);
|
||||
u_1 = reversebits(u_1);
|
||||
s_1 = reversebits(s_1);
|
||||
int3 v0_1 = countbits(u_1);
|
||||
int3 v1_1 = countbits(s_1);
|
||||
int3 v2_1 = firstbithigh(u_1);
|
||||
int3 v3_1 = firstbitlow(s_1);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/builtins.comp
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/builtins.comp
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
void comp_main()
|
||||
{
|
||||
}
|
||||
|
||||
[numthreads(8, 4, 2)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
62
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/image.comp
vendored
Normal file
62
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/image.comp
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
RWTexture2D<float> uImageInF : register(u0);
|
||||
RWTexture2D<float> uImageOutF : register(u1);
|
||||
RWTexture2D<int> uImageInI : register(u2);
|
||||
RWTexture2D<int> uImageOutI : register(u3);
|
||||
RWTexture2D<uint> uImageInU : register(u4);
|
||||
RWTexture2D<uint> uImageOutU : register(u5);
|
||||
RWBuffer<float> uImageInBuffer : register(u6);
|
||||
RWBuffer<float> uImageOutBuffer : register(u7);
|
||||
RWTexture2D<float2> uImageInF2 : register(u8);
|
||||
RWTexture2D<float2> uImageOutF2 : register(u9);
|
||||
RWTexture2D<int2> uImageInI2 : register(u10);
|
||||
RWTexture2D<int2> uImageOutI2 : register(u11);
|
||||
RWTexture2D<uint2> uImageInU2 : register(u12);
|
||||
RWTexture2D<uint2> uImageOutU2 : register(u13);
|
||||
RWBuffer<float2> uImageInBuffer2 : register(u14);
|
||||
RWBuffer<float2> uImageOutBuffer2 : register(u15);
|
||||
RWTexture2D<float4> uImageInF4 : register(u16);
|
||||
RWTexture2D<float4> uImageOutF4 : register(u17);
|
||||
RWTexture2D<int4> uImageInI4 : register(u18);
|
||||
RWTexture2D<int4> uImageOutI4 : register(u19);
|
||||
RWTexture2D<uint4> uImageInU4 : register(u20);
|
||||
RWTexture2D<uint4> uImageOutU4 : register(u21);
|
||||
RWBuffer<float4> uImageInBuffer4 : register(u22);
|
||||
RWBuffer<float4> uImageOutBuffer4 : register(u23);
|
||||
RWTexture2D<float4> uImageNoFmtF : register(u24);
|
||||
RWTexture2D<uint4> uImageNoFmtU : register(u25);
|
||||
RWTexture2D<int4> uImageNoFmtI : register(u26);
|
||||
|
||||
static uint3 gl_GlobalInvocationID;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
uImageOutF[int2(gl_GlobalInvocationID.xy)] = uImageInF[int2(gl_GlobalInvocationID.xy)].x;
|
||||
uImageOutI[int2(gl_GlobalInvocationID.xy)] = uImageInI[int2(gl_GlobalInvocationID.xy)].x;
|
||||
uImageOutU[int2(gl_GlobalInvocationID.xy)] = uImageInU[int2(gl_GlobalInvocationID.xy)].x;
|
||||
uImageOutBuffer[int(gl_GlobalInvocationID.x)] = uImageInBuffer[int(gl_GlobalInvocationID.x)].x;
|
||||
uImageOutF2[int2(gl_GlobalInvocationID.xy)] = uImageInF2[int2(gl_GlobalInvocationID.xy)].xy;
|
||||
uImageOutI2[int2(gl_GlobalInvocationID.xy)] = uImageInI2[int2(gl_GlobalInvocationID.xy)].xy;
|
||||
uImageOutU2[int2(gl_GlobalInvocationID.xy)] = uImageInU2[int2(gl_GlobalInvocationID.xy)].xy;
|
||||
float4 _135 = uImageInBuffer2[int(gl_GlobalInvocationID.x)].xyyy;
|
||||
uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = _135.xy;
|
||||
uImageOutF4[int2(gl_GlobalInvocationID.xy)] = uImageInF4[int2(gl_GlobalInvocationID.xy)];
|
||||
int4 _165 = uImageInI4[int2(gl_GlobalInvocationID.xy)];
|
||||
uImageOutI4[int2(gl_GlobalInvocationID.xy)] = _165;
|
||||
uint4 _180 = uImageInU4[int2(gl_GlobalInvocationID.xy)];
|
||||
uImageOutU4[int2(gl_GlobalInvocationID.xy)] = _180;
|
||||
uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = uImageInBuffer4[int(gl_GlobalInvocationID.x)];
|
||||
uImageNoFmtF[int2(gl_GlobalInvocationID.xy)] = _135;
|
||||
uImageNoFmtU[int2(gl_GlobalInvocationID.xy)] = _180;
|
||||
uImageNoFmtI[int2(gl_GlobalInvocationID.xy)] = _165;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||
comp_main();
|
||||
}
|
90
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp
vendored
Normal file
90
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
RWByteAddressBuffer _28 : register(u0);
|
||||
cbuffer _68 : register(b1)
|
||||
{
|
||||
int _68_index0 : packoffset(c0);
|
||||
int _68_index1 : packoffset(c0.y);
|
||||
};
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
float4x4 _253 = asfloat(uint4x4(_28.Load(64), _28.Load(80), _28.Load(96), _28.Load(112), _28.Load(68), _28.Load(84), _28.Load(100), _28.Load(116), _28.Load(72), _28.Load(88), _28.Load(104), _28.Load(120), _28.Load(76), _28.Load(92), _28.Load(108), _28.Load(124)));
|
||||
_28.Store4(0, asuint(_253[0]));
|
||||
_28.Store4(16, asuint(_253[1]));
|
||||
_28.Store4(32, asuint(_253[2]));
|
||||
_28.Store4(48, asuint(_253[3]));
|
||||
float2x2 _256 = asfloat(uint2x2(_28.Load(144), _28.Load(152), _28.Load(148), _28.Load(156)));
|
||||
_28.Store2(128, asuint(_256[0]));
|
||||
_28.Store2(136, asuint(_256[1]));
|
||||
float2x3 _259 = asfloat(uint2x3(_28.Load(192), _28.Load(200), _28.Load(208), _28.Load(196), _28.Load(204), _28.Load(212)));
|
||||
_28.Store3(160, asuint(_259[0]));
|
||||
_28.Store3(176, asuint(_259[1]));
|
||||
float3x2 _262 = asfloat(uint3x2(_28.Load(240), _28.Load(256), _28.Load(244), _28.Load(260), _28.Load(248), _28.Load(264)));
|
||||
_28.Store2(216, asuint(_262[0]));
|
||||
_28.Store2(224, asuint(_262[1]));
|
||||
_28.Store2(232, asuint(_262[2]));
|
||||
float4x4 _265 = asfloat(uint4x4(_28.Load4(0), _28.Load4(16), _28.Load4(32), _28.Load4(48)));
|
||||
_28.Store(64, asuint(_265[0].x));
|
||||
_28.Store(68, asuint(_265[1].x));
|
||||
_28.Store(72, asuint(_265[2].x));
|
||||
_28.Store(76, asuint(_265[3].x));
|
||||
_28.Store(80, asuint(_265[0].y));
|
||||
_28.Store(84, asuint(_265[1].y));
|
||||
_28.Store(88, asuint(_265[2].y));
|
||||
_28.Store(92, asuint(_265[3].y));
|
||||
_28.Store(96, asuint(_265[0].z));
|
||||
_28.Store(100, asuint(_265[1].z));
|
||||
_28.Store(104, asuint(_265[2].z));
|
||||
_28.Store(108, asuint(_265[3].z));
|
||||
_28.Store(112, asuint(_265[0].w));
|
||||
_28.Store(116, asuint(_265[1].w));
|
||||
_28.Store(120, asuint(_265[2].w));
|
||||
_28.Store(124, asuint(_265[3].w));
|
||||
float2x2 _268 = asfloat(uint2x2(_28.Load2(128), _28.Load2(136)));
|
||||
_28.Store(144, asuint(_268[0].x));
|
||||
_28.Store(148, asuint(_268[1].x));
|
||||
_28.Store(152, asuint(_268[0].y));
|
||||
_28.Store(156, asuint(_268[1].y));
|
||||
float2x3 _271 = asfloat(uint2x3(_28.Load3(160), _28.Load3(176)));
|
||||
_28.Store(192, asuint(_271[0].x));
|
||||
_28.Store(196, asuint(_271[1].x));
|
||||
_28.Store(200, asuint(_271[0].y));
|
||||
_28.Store(204, asuint(_271[1].y));
|
||||
_28.Store(208, asuint(_271[0].z));
|
||||
_28.Store(212, asuint(_271[1].z));
|
||||
float3x2 _274 = asfloat(uint3x2(_28.Load2(216), _28.Load2(224), _28.Load2(232)));
|
||||
_28.Store(240, asuint(_274[0].x));
|
||||
_28.Store(244, asuint(_274[1].x));
|
||||
_28.Store(248, asuint(_274[2].x));
|
||||
_28.Store(256, asuint(_274[0].y));
|
||||
_28.Store(260, asuint(_274[1].y));
|
||||
_28.Store(264, asuint(_274[2].y));
|
||||
_28.Store(_68_index0 * 4 + _68_index1 * 16 + 64, asuint(1.0f));
|
||||
_28.Store(_68_index0 * 4 + _68_index1 * 8 + 144, asuint(2.0f));
|
||||
_28.Store(_68_index0 * 4 + _68_index1 * 8 + 192, asuint(3.0f));
|
||||
_28.Store(_68_index0 * 4 + _68_index1 * 16 + 240, asuint(4.0f));
|
||||
_28.Store(_68_index0 * 4 + 64, asuint(1.0f.x));
|
||||
_28.Store(_68_index0 * 4 + 80, asuint(1.0f.xxxx.y));
|
||||
_28.Store(_68_index0 * 4 + 96, asuint(1.0f.xxxx.z));
|
||||
_28.Store(_68_index0 * 4 + 112, asuint(1.0f.xxxx.w));
|
||||
_28.Store(_68_index0 * 4 + 144, asuint(2.0f.x));
|
||||
_28.Store(_68_index0 * 4 + 152, asuint(2.0f.xx.y));
|
||||
_28.Store(_68_index0 * 4 + 192, asuint(3.0f.x));
|
||||
_28.Store(_68_index0 * 4 + 200, asuint(3.0f.xxx.y));
|
||||
_28.Store(_68_index0 * 4 + 208, asuint(3.0f.xxx.z));
|
||||
_28.Store(_68_index0 * 4 + 240, asuint(4.0f.x));
|
||||
_28.Store(_68_index0 * 4 + 256, asuint(4.0f.xx.y));
|
||||
_28.Store(_68_index0 * 16 + _68_index1 * 4 + 0, asuint(1.0f));
|
||||
_28.Store(_68_index0 * 8 + _68_index1 * 4 + 128, asuint(2.0f));
|
||||
_28.Store(_68_index0 * 16 + _68_index1 * 4 + 160, asuint(3.0f));
|
||||
_28.Store(_68_index0 * 8 + _68_index1 * 4 + 216, asuint(4.0f));
|
||||
_28.Store4(_68_index0 * 16 + 0, asuint(1.0f.xxxx));
|
||||
_28.Store2(_68_index0 * 8 + 128, asuint(2.0f.xx));
|
||||
_28.Store3(_68_index0 * 16 + 160, asuint(3.0f.xxx));
|
||||
_28.Store2(_68_index0 * 8 + 216, asuint(4.0f.xx));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/shared.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/shared.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
|
||||
ByteAddressBuffer _22 : register(t0);
|
||||
RWByteAddressBuffer _44 : register(u1);
|
||||
|
||||
static uint3 gl_GlobalInvocationID;
|
||||
static uint gl_LocalInvocationIndex;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||
uint gl_LocalInvocationIndex : SV_GroupIndex;
|
||||
};
|
||||
|
||||
groupshared float sShared[4];
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0));
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
_44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[(4u - gl_LocalInvocationIndex) - 1u]));
|
||||
}
|
||||
|
||||
[numthreads(4, 1, 1)]
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex;
|
||||
comp_main();
|
||||
}
|
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
void comp_main()
|
||||
{
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
32
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/basic.frag
vendored
Normal file
32
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/basic.frag
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
Texture2D<float4> uTex : register(t0);
|
||||
SamplerState _uTex_sampler : register(s0);
|
||||
|
||||
static float4 FragColor;
|
||||
static float4 vColor;
|
||||
static float2 vTex;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 vColor : TEXCOORD0;
|
||||
float2 vTex : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = vColor * uTex.Sample(_uTex_sampler, vTex);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vColor = stage_input.vColor;
|
||||
vTex = stage_input.vTex;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag
vendored
Normal file
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
static float2 value;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 value : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = float4(1.0f, 0.0f, asfloat(asint(value.x)), 1.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
value = stage_input.value;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
27
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag
vendored
Normal file
27
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
static float2 FragColor;
|
||||
static float2 x0;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 x0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool2 _27 = (x0.x > x0.y).xx;
|
||||
FragColor = float2(_27.x ? float2(1.0f, 0.0f).x : float2(0.0f, 1.0f).x, _27.y ? float2(1.0f, 0.0f).y : float2(0.0f, 1.0f).y);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
x0 = stage_input.x0;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
33
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/builtins.frag
vendored
Normal file
33
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/builtins.frag
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
static float4 gl_FragCoord;
|
||||
static float gl_FragDepth;
|
||||
static float4 FragColor;
|
||||
static float4 vColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 vColor : TEXCOORD0;
|
||||
float4 gl_FragCoord : SV_Position;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
float gl_FragDepth : SV_Depth;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = gl_FragCoord + vColor;
|
||||
gl_FragDepth = 0.5f;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_FragCoord = stage_input.gl_FragCoord;
|
||||
vColor = stage_input.vColor;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_FragDepth = gl_FragDepth;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
27
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag
vendored
Normal file
27
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
static float2 value;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 value : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool2 _25 = bool2(value.x == 0.0f, value.y == 0.0f);
|
||||
FragColor = float4(1.0f, 0.0f, float(bool2(!_25.x, !_25.y).x), float(bool2(value.x <= float2(1.5f, 0.5f).x, value.y <= float2(1.5f, 0.5f).y).x));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
value = stage_input.value;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
24
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag
vendored
Normal file
24
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Texture2D<float4> uSampler : register(t0);
|
||||
SamplerState _uSampler_sampler : register(s0);
|
||||
Texture2D<float4> uSamplerShadow : register(t1);
|
||||
SamplerComparisonState _uSamplerShadow_sampler : register(s1);
|
||||
|
||||
static float FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = (uSampler.Sample(_uSampler_sampler, 1.0f.xx) + uSampler.Load(int3(int2(10, 10), 0))).x + uSamplerShadow.SampleCmp(_uSamplerShadow_sampler, 1.0f.xxx.xy, 1.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
23
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag
vendored
Normal file
23
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
Texture2D<float4> uDepth : register(t2);
|
||||
SamplerComparisonState uSampler : register(s0);
|
||||
SamplerState uSampler1 : register(s1);
|
||||
|
||||
static float FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = uDepth.SampleCmp(uSampler, 1.0f.xxx.xy, 1.0f) + uDepth.Sample(uSampler1, 1.0f.xx).x;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
43
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/constant-buffer-array.sm51.frag
vendored
Normal file
43
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/constant-buffer-array.sm51.frag
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
struct CBO_1
|
||||
{
|
||||
float4 a;
|
||||
float4 b;
|
||||
float4 c;
|
||||
float4 d;
|
||||
};
|
||||
|
||||
ConstantBuffer<CBO_1> cbo[2][4] : register(b4, space0);
|
||||
cbuffer push
|
||||
{
|
||||
float4 push_a : packoffset(c0);
|
||||
float4 push_b : packoffset(c1);
|
||||
float4 push_c : packoffset(c2);
|
||||
float4 push_d : packoffset(c3);
|
||||
};
|
||||
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = cbo[1][2].a;
|
||||
FragColor += cbo[1][2].b;
|
||||
FragColor += cbo[1][2].c;
|
||||
FragColor += cbo[1][2].d;
|
||||
FragColor += push_a;
|
||||
FragColor += push_b;
|
||||
FragColor += push_c;
|
||||
FragColor += push_d;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
void frag_main()
|
||||
{
|
||||
}
|
||||
|
||||
[earlydepthstencil]
|
||||
void main()
|
||||
{
|
||||
frag_main();
|
||||
}
|
44
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag
vendored
Normal file
44
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
static float2 FP32Out;
|
||||
static uint FP16;
|
||||
static uint FP16Out;
|
||||
static float2 FP32;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
nointerpolation uint FP16 : TEXCOORD0;
|
||||
nointerpolation float2 FP32 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 FP32Out : SV_Target0;
|
||||
uint FP16Out : SV_Target1;
|
||||
};
|
||||
|
||||
uint SPIRV_Cross_packHalf2x16(float2 value)
|
||||
{
|
||||
uint2 Packed = f32tof16(value);
|
||||
return Packed.x | (Packed.y << 16);
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_unpackHalf2x16(uint value)
|
||||
{
|
||||
return f16tof32(uint2(value & 0xffff, value >> 16));
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FP32Out = SPIRV_Cross_unpackHalf2x16(FP16);
|
||||
FP16Out = SPIRV_Cross_packHalf2x16(FP32);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
FP16 = stage_input.FP16;
|
||||
FP32 = stage_input.FP32;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FP32Out = FP32Out;
|
||||
stage_output.FP16Out = FP16Out;
|
||||
return stage_output;
|
||||
}
|
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
Texture1D<uint4> uSampler1DUint : register(t0);
|
||||
SamplerState _uSampler1DUint_sampler : register(s0);
|
||||
Texture1D<int4> uSampler1DInt : register(t0);
|
||||
SamplerState _uSampler1DInt_sampler : register(s0);
|
||||
|
||||
uint SPIRV_Cross_textureSize(Texture1D<int4> Tex, uint Level, out uint Param)
|
||||
{
|
||||
uint ret;
|
||||
Tex.GetDimensions(Level, ret.x, Param);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_textureSize(Texture1D<uint4> Tex, uint Level, out uint Param)
|
||||
{
|
||||
uint ret;
|
||||
Tex.GetDimensions(Level, ret.x, Param);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
uint _17_dummy_parameter;
|
||||
uint _24_dummy_parameter;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_main();
|
||||
}
|
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/image-query.frag
vendored
Normal file
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/image-query.frag
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
void frag_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_main();
|
||||
}
|
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/io-block.frag
vendored
Normal file
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/io-block.frag
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
static float4 FragColor;
|
||||
|
||||
struct VertexOut
|
||||
{
|
||||
float4 a : TEXCOORD1;
|
||||
float4 b : TEXCOORD2;
|
||||
};
|
||||
|
||||
static VertexOut _12;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = _12.a + _12.b;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(in VertexOut stage_input_12)
|
||||
{
|
||||
_12 = stage_input_12;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/matrix-input.frag
vendored
Normal file
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/matrix-input.frag
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
static float4 FragColor;
|
||||
static float4x4 m;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4x4 m : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = ((m[0] + m[1]) + m[2]) + m[3];
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
m = stage_input.m;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
67
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/mod.frag
vendored
Normal file
67
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/mod.frag
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
static float4 a4;
|
||||
static float4 b4;
|
||||
static float3 a3;
|
||||
static float3 b3;
|
||||
static float2 a2;
|
||||
static float2 b2;
|
||||
static float a1;
|
||||
static float b1;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 a4 : TEXCOORD0;
|
||||
float3 a3 : TEXCOORD1;
|
||||
float2 a2 : TEXCOORD2;
|
||||
float a1 : TEXCOORD3;
|
||||
float4 b4 : TEXCOORD4;
|
||||
float3 b3 : TEXCOORD5;
|
||||
float2 b2 : TEXCOORD6;
|
||||
float b1 : TEXCOORD7;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float mod(float x, float y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float2 mod(float2 x, float2 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float3 mod(float3 x, float3 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 mod(float4 x, float4 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = ((mod(a4, b4) + mod(a3, b3).xyzx) + mod(a2, b2).xyxy) + mod(a1, b1).xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
a4 = stage_input.a4;
|
||||
b4 = stage_input.b4;
|
||||
a3 = stage_input.a3;
|
||||
b3 = stage_input.b3;
|
||||
a2 = stage_input.a2;
|
||||
b2 = stage_input.b2;
|
||||
a1 = stage_input.a1;
|
||||
b1 = stage_input.b1;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
31
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/mrt.frag
vendored
Normal file
31
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/mrt.frag
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
static float4 RT0;
|
||||
static float4 RT1;
|
||||
static float4 RT2;
|
||||
static float4 RT3;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 RT0 : SV_Target0;
|
||||
float4 RT1 : SV_Target1;
|
||||
float4 RT2 : SV_Target2;
|
||||
float4 RT3 : SV_Target3;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
RT0 = 1.0f.xxxx;
|
||||
RT1 = 2.0f.xxxx;
|
||||
RT2 = 3.0f.xxxx;
|
||||
RT3 = 4.0f.xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.RT0 = RT0;
|
||||
stage_output.RT1 = RT1;
|
||||
stage_output.RT2 = RT2;
|
||||
stage_output.RT3 = RT3;
|
||||
return stage_output;
|
||||
}
|
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/no-return.frag
vendored
Normal file
8
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/no-return.frag
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
void frag_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_main();
|
||||
}
|
16
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/no-return2.frag
vendored
Normal file
16
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/no-return2.frag
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
static float4 vColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 vColor : TEXCOORD0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vColor = stage_input.vColor;
|
||||
frag_main();
|
||||
}
|
14
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag
vendored
Normal file
14
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
struct B
|
||||
{
|
||||
float a;
|
||||
float b;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_main();
|
||||
}
|
30
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag
vendored
Normal file
30
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
Texture2D<float4> uSampler : register(t0);
|
||||
SamplerState _uSampler_sampler : register(s0);
|
||||
|
||||
static float4 FragColor;
|
||||
static float2 vTexCoord;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 vTexCoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float _19_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vTexCoord);
|
||||
FragColor = float2(_19_tmp, _19_tmp).xyxy;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vTexCoord = stage_input.vTexCoord;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
39
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/resources.frag
vendored
Normal file
39
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/resources.frag
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
cbuffer cbuf : register(b3)
|
||||
{
|
||||
float4 cbuf_a : packoffset(c0);
|
||||
};
|
||||
cbuffer registers
|
||||
{
|
||||
float4 registers_d : packoffset(c0);
|
||||
};
|
||||
Texture2D<float4> uSampledImage : register(t4);
|
||||
SamplerState _uSampledImage_sampler : register(s4);
|
||||
Texture2D<float4> uTexture : register(t5);
|
||||
SamplerState uSampler : register(s6);
|
||||
|
||||
static float2 vTex;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 vTex : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_d);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vTex = stage_input.vTex;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
57
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag
vendored
Normal file
57
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
Texture2D<float4> uSampler2D : register(t0);
|
||||
SamplerComparisonState _uSampler2D_sampler : register(s0);
|
||||
Texture2DArray<float4> uSampler2DArray : register(t1);
|
||||
SamplerComparisonState _uSampler2DArray_sampler : register(s1);
|
||||
TextureCube<float4> uSamplerCube : register(t2);
|
||||
SamplerComparisonState _uSamplerCube_sampler : register(s2);
|
||||
TextureCubeArray<float4> uSamplerCubeArray : register(t3);
|
||||
SamplerComparisonState _uSamplerCubeArray_sampler : register(s3);
|
||||
|
||||
static float3 vUVRef;
|
||||
static float4 vDirRef;
|
||||
static float FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float3 vUVRef : TEXCOORD0;
|
||||
float4 vDirRef : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
|
||||
{
|
||||
return coord.x / coord.y;
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
|
||||
{
|
||||
return float2(coord.x, coord.y) / coord.z;
|
||||
}
|
||||
|
||||
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
|
||||
{
|
||||
return float3(coord.x, coord.y, coord.z) / coord.w;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _80 = vDirRef;
|
||||
_80.z = vDirRef.w;
|
||||
float4 _87 = vDirRef;
|
||||
_87.z = vDirRef.w;
|
||||
FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_87.xyz), vDirRef.z, int2(1, 1));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vUVRef = stage_input.vUVRef;
|
||||
vDirRef = stage_input.vDirRef;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/sampler-array.frag
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/sampler-array.frag
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
Texture2D<float4> uCombined[4] : register(t0);
|
||||
SamplerState _uCombined_sampler[4] : register(s0);
|
||||
Texture2D<float4> uTex[4] : register(t4);
|
||||
SamplerState uSampler[4] : register(s8);
|
||||
RWTexture2D<float4> uImage[8] : register(u12);
|
||||
|
||||
static float4 gl_FragCoord;
|
||||
static float2 vTex;
|
||||
static int vIndex;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 vTex : TEXCOORD0;
|
||||
nointerpolation int vIndex : TEXCOORD1;
|
||||
float4 gl_FragCoord : SV_Position;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + (uCombined[vIndex + 1].Sample(_uCombined_sampler[vIndex + 1], vTex))) + (uTex[vIndex + 1].Sample(uSampler[vIndex + 1], vTex));
|
||||
}
|
||||
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_FragCoord = stage_input.gl_FragCoord;
|
||||
vTex = stage_input.vTex;
|
||||
vIndex = stage_input.vIndex;
|
||||
frag_main();
|
||||
}
|
33
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/spec-constant.frag
vendored
Normal file
33
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/spec-constant.frag
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
static const float a = 1.0f;
|
||||
static const float b = 2.0f;
|
||||
static const int c = 3;
|
||||
static const int d = 4;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float elems[(d + 2)];
|
||||
};
|
||||
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float vec0[(c + 3)][8];
|
||||
vec0[0][0] = 10.0f;
|
||||
Foo foo;
|
||||
foo.elems[c] = 10.0f;
|
||||
FragColor = (((a + b).xxxx + vec0[0][0].xxxx) + 20.0f.xxxx) + foo.elems[c].xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
41
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag
vendored
Normal file
41
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
static float4 Float;
|
||||
static float vFloat;
|
||||
static int4 Int;
|
||||
static int vInt;
|
||||
static float4 Float2;
|
||||
static int4 Int2;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
nointerpolation float vFloat : TEXCOORD0;
|
||||
nointerpolation int vInt : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 Float : SV_Target0;
|
||||
int4 Int : SV_Target1;
|
||||
float4 Float2 : SV_Target2;
|
||||
int4 Int2 : SV_Target3;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
Float = vFloat.xxxx * 2.0f;
|
||||
Int = vInt.xxxx * int4(2, 2, 2, 2);
|
||||
Float2 = 10.0f.xxxx;
|
||||
Int2 = int4(10, 10, 10, 10);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vFloat = stage_input.vFloat;
|
||||
vInt = stage_input.vInt;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.Float = Float;
|
||||
stage_output.Int = Int;
|
||||
stage_output.Float2 = Float2;
|
||||
stage_output.Int2 = Int2;
|
||||
return stage_output;
|
||||
}
|
87
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag
vendored
Normal file
87
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
Texture1D<float4> tex1d;
|
||||
SamplerState _tex1d_sampler;
|
||||
Texture2D<float4> tex2d;
|
||||
SamplerState _tex2d_sampler;
|
||||
Texture3D<float4> tex3d;
|
||||
SamplerState _tex3d_sampler;
|
||||
TextureCube<float4> texCube;
|
||||
SamplerState _texCube_sampler;
|
||||
Texture1D<float4> tex1dShadow;
|
||||
SamplerComparisonState _tex1dShadow_sampler;
|
||||
Texture2D<float4> tex2dShadow;
|
||||
SamplerComparisonState _tex2dShadow_sampler;
|
||||
TextureCube<float4> texCubeShadow;
|
||||
SamplerComparisonState _texCubeShadow_sampler;
|
||||
Texture1DArray<float4> tex1dArray;
|
||||
SamplerState _tex1dArray_sampler;
|
||||
Texture2DArray<float4> tex2dArray;
|
||||
SamplerState _tex2dArray_sampler;
|
||||
TextureCubeArray<float4> texCubeArray;
|
||||
SamplerState _texCubeArray_sampler;
|
||||
Texture2D<float4> separateTex2d;
|
||||
SamplerState samplerNonDepth;
|
||||
Texture2D<float4> separateTex2dDepth;
|
||||
SamplerComparisonState samplerDepth;
|
||||
|
||||
static float texCoord1d;
|
||||
static float2 texCoord2d;
|
||||
static float3 texCoord3d;
|
||||
static float4 texCoord4d;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float texCoord1d : TEXCOORD0;
|
||||
float2 texCoord2d : TEXCOORD1;
|
||||
float3 texCoord3d : TEXCOORD2;
|
||||
float4 texCoord4d : TEXCOORD3;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
|
||||
{
|
||||
return coord.x / coord.y;
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
|
||||
{
|
||||
return float2(coord.x, coord.y) / coord.z;
|
||||
}
|
||||
|
||||
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
|
||||
{
|
||||
return float3(coord.x, coord.y, coord.z) / coord.w;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)))) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)))) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)))) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f);
|
||||
float _178 = _162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f);
|
||||
float4 _327 = _162;
|
||||
_327.w = _178;
|
||||
float _193 = _178 + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f);
|
||||
float4 _331 = _327;
|
||||
_331.w = _193;
|
||||
float4 _335 = _331;
|
||||
_335.w = _193 + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f);
|
||||
float4 _308 = ((((((((((((((_335 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d);
|
||||
float4 _339 = _308;
|
||||
_339.w = _308.w + separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z);
|
||||
FragColor = _339;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
texCoord1d = stage_input.texCoord1d;
|
||||
texCoord2d = stage_input.texCoord2d;
|
||||
texCoord3d = stage_input.texCoord3d;
|
||||
texCoord4d = stage_input.texCoord4d;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
66
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag
vendored
Normal file
66
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
Texture1D<float4> uShadow1D : register(t0);
|
||||
SamplerComparisonState _uShadow1D_sampler : register(s0);
|
||||
Texture2D<float4> uShadow2D : register(t1);
|
||||
SamplerComparisonState _uShadow2D_sampler : register(s1);
|
||||
Texture1D<float4> uSampler1D : register(t2);
|
||||
SamplerState _uSampler1D_sampler : register(s2);
|
||||
Texture2D<float4> uSampler2D : register(t3);
|
||||
SamplerState _uSampler2D_sampler : register(s3);
|
||||
Texture3D<float4> uSampler3D : register(t4);
|
||||
SamplerState _uSampler3D_sampler : register(s4);
|
||||
|
||||
static float FragColor;
|
||||
static float4 vClip4;
|
||||
static float2 vClip2;
|
||||
static float3 vClip3;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float3 vClip3 : TEXCOORD0;
|
||||
float4 vClip4 : TEXCOORD1;
|
||||
float2 vClip2 : TEXCOORD2;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
|
||||
{
|
||||
return coord.x / coord.y;
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
|
||||
{
|
||||
return float2(coord.x, coord.y) / coord.z;
|
||||
}
|
||||
|
||||
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
|
||||
{
|
||||
return float3(coord.x, coord.y, coord.z) / coord.w;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _20 = vClip4;
|
||||
_20.y = vClip4.w;
|
||||
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, SPIRV_Cross_projectTextureCoordinate(_20.xy), vClip4.z);
|
||||
float4 _30 = vClip4;
|
||||
_30.z = vClip4.w;
|
||||
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, SPIRV_Cross_projectTextureCoordinate(_30.xyz), vClip4.z);
|
||||
FragColor = uSampler1D.Sample(_uSampler1D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip2)).x;
|
||||
FragColor = uSampler2D.Sample(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip3)).x;
|
||||
FragColor = uSampler3D.Sample(_uSampler3D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip4)).x;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vClip4 = stage_input.vClip4;
|
||||
vClip2 = stage_input.vClip2;
|
||||
vClip3 = stage_input.vClip3;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
static float4 FragColor;
|
||||
static float4 vIn;
|
||||
static int4 vIn1;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 vIn : TEXCOORD0;
|
||||
nointerpolation int4 vIn1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = -(-vIn);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
vIn = stage_input.vIn;
|
||||
vIn1 = stage_input.vIn1;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
109
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag
vendored
Normal file
109
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
static float4 FP32Out;
|
||||
static uint UNORM8;
|
||||
static uint SNORM8;
|
||||
static uint UNORM16;
|
||||
static uint SNORM16;
|
||||
static uint UNORM8Out;
|
||||
static float4 FP32;
|
||||
static uint SNORM8Out;
|
||||
static uint UNORM16Out;
|
||||
static uint SNORM16Out;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
nointerpolation uint SNORM8 : TEXCOORD0;
|
||||
nointerpolation uint UNORM8 : TEXCOORD1;
|
||||
nointerpolation uint SNORM16 : TEXCOORD2;
|
||||
nointerpolation uint UNORM16 : TEXCOORD3;
|
||||
nointerpolation float4 FP32 : TEXCOORD4;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FP32Out : SV_Target0;
|
||||
uint UNORM8Out : SV_Target1;
|
||||
uint SNORM8Out : SV_Target2;
|
||||
uint UNORM16Out : SV_Target3;
|
||||
uint SNORM16Out : SV_Target4;
|
||||
};
|
||||
|
||||
uint SPIRV_Cross_packUnorm4x8(float4 value)
|
||||
{
|
||||
uint4 Packed = uint4(round(saturate(value) * 255.0));
|
||||
return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);
|
||||
}
|
||||
|
||||
float4 SPIRV_Cross_unpackUnorm4x8(uint value)
|
||||
{
|
||||
uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);
|
||||
return float4(Packed) / 255.0;
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_packSnorm4x8(float4 value)
|
||||
{
|
||||
int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;
|
||||
return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));
|
||||
}
|
||||
|
||||
float4 SPIRV_Cross_unpackSnorm4x8(uint value)
|
||||
{
|
||||
int SignedValue = int(value);
|
||||
int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;
|
||||
return clamp(float4(Packed) / 127.0, -1.0, 1.0);
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_packUnorm2x16(float2 value)
|
||||
{
|
||||
uint2 Packed = uint2(round(saturate(value) * 65535.0));
|
||||
return Packed.x | (Packed.y << 16);
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_unpackUnorm2x16(uint value)
|
||||
{
|
||||
uint2 Packed = uint2(value & 0xffff, value >> 16);
|
||||
return float2(Packed) / 65535.0;
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_packSnorm2x16(float2 value)
|
||||
{
|
||||
int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;
|
||||
return uint(Packed.x | (Packed.y << 16));
|
||||
}
|
||||
|
||||
float2 SPIRV_Cross_unpackSnorm2x16(uint value)
|
||||
{
|
||||
int SignedValue = int(value);
|
||||
int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;
|
||||
return clamp(float2(Packed) / 32767.0, -1.0, 1.0);
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FP32Out = SPIRV_Cross_unpackUnorm4x8(UNORM8);
|
||||
FP32Out = SPIRV_Cross_unpackSnorm4x8(SNORM8);
|
||||
float2 _21 = SPIRV_Cross_unpackUnorm2x16(UNORM16);
|
||||
FP32Out = float4(_21.x, _21.y, FP32Out.z, FP32Out.w);
|
||||
float2 _26 = SPIRV_Cross_unpackSnorm2x16(SNORM16);
|
||||
FP32Out = float4(_26.x, _26.y, FP32Out.z, FP32Out.w);
|
||||
UNORM8Out = SPIRV_Cross_packUnorm4x8(FP32);
|
||||
SNORM8Out = SPIRV_Cross_packSnorm4x8(FP32);
|
||||
UNORM16Out = SPIRV_Cross_packUnorm2x16(FP32.xy);
|
||||
SNORM16Out = SPIRV_Cross_packSnorm2x16(FP32.zw);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
UNORM8 = stage_input.UNORM8;
|
||||
SNORM8 = stage_input.SNORM8;
|
||||
UNORM16 = stage_input.UNORM16;
|
||||
SNORM16 = stage_input.SNORM16;
|
||||
FP32 = stage_input.FP32;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FP32Out = FP32Out;
|
||||
stage_output.UNORM8Out = UNORM8Out;
|
||||
stage_output.SNORM8Out = SNORM8Out;
|
||||
stage_output.UNORM16Out = UNORM16Out;
|
||||
stage_output.SNORM16Out = SNORM16Out;
|
||||
return stage_output;
|
||||
}
|
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag
vendored
Normal file
26
deps/SPIRV-Cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
static float2 interpolant;
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 interpolant : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
FragColor = float4(0.0f, 0.0f, 0.0f, EvaluateAttributeSnapped(interpolant, 0.100000001490116119384765625f.xx).x) + float4(0.0f, 0.0f, 0.0f, ddx_coarse(interpolant.x));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
interpolant = stage_input.interpolant;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
38
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/basic.vert
vendored
Normal file
38
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/basic.vert
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
cbuffer _16
|
||||
{
|
||||
row_major float4x4 _16_uMVP : packoffset(c0);
|
||||
};
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 aVertex;
|
||||
static float3 vNormal;
|
||||
static float3 aNormal;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 aVertex : TEXCOORD0;
|
||||
float3 aNormal : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float3 vNormal : TEXCOORD0;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = mul(aVertex, _16_uMVP);
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
aVertex = stage_input.aVertex;
|
||||
aNormal = stage_input.aNormal;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.vNormal = vNormal;
|
||||
return stage_output;
|
||||
}
|
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/instancing.vert
vendored
Normal file
28
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/instancing.vert
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
static float4 gl_Position;
|
||||
static int gl_VertexIndex;
|
||||
static int gl_InstanceIndex;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint gl_VertexIndex : SV_VertexID;
|
||||
uint gl_InstanceIndex : SV_InstanceID;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_VertexIndex = int(stage_input.gl_VertexIndex);
|
||||
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
79
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/locations.vert
vendored
Normal file
79
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/locations.vert
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
struct Foo
|
||||
{
|
||||
float3 a;
|
||||
float3 b;
|
||||
float3 c;
|
||||
};
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 Input2;
|
||||
static float4 Input4;
|
||||
static float4 Input0;
|
||||
static float vLocation0;
|
||||
static float vLocation1;
|
||||
static float vLocation2[2];
|
||||
static Foo vLocation4;
|
||||
static float vLocation9;
|
||||
|
||||
struct VertexOut
|
||||
{
|
||||
float3 color : TEXCOORD7;
|
||||
float3 foo : TEXCOORD8;
|
||||
};
|
||||
|
||||
static VertexOut vout;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 Input0 : TEXCOORD0;
|
||||
float4 Input2 : TEXCOORD2;
|
||||
float4 Input4 : TEXCOORD4;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float vLocation0 : TEXCOORD0;
|
||||
float vLocation1 : TEXCOORD1;
|
||||
float vLocation2[2] : TEXCOORD2;
|
||||
Foo vLocation4 : TEXCOORD4;
|
||||
float vLocation9 : TEXCOORD9;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
Foo _70;
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = ((1.0f.xxxx + Input2) + Input4) + Input0;
|
||||
vLocation0 = 0.0f;
|
||||
vLocation1 = 1.0f;
|
||||
vLocation2[0] = 2.0f;
|
||||
vLocation2[1] = 2.0f;
|
||||
Foo _65 = _70;
|
||||
_65.a = 1.0f.xxx;
|
||||
Foo _67 = _65;
|
||||
_67.b = 1.0f.xxx;
|
||||
Foo _69 = _67;
|
||||
_69.c = 1.0f.xxx;
|
||||
vLocation4 = _69;
|
||||
vLocation9 = 9.0f;
|
||||
vout.color = 2.0f.xxx;
|
||||
vout.foo = 4.0f.xxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input, out VertexOut stage_outputvout)
|
||||
{
|
||||
Input2 = stage_input.Input2;
|
||||
Input4 = stage_input.Input4;
|
||||
Input0 = stage_input.Input0;
|
||||
vert_main();
|
||||
stage_outputvout = vout;
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.vLocation0 = vLocation0;
|
||||
stage_output.vLocation1 = vLocation1;
|
||||
stage_output.vLocation2 = vLocation2;
|
||||
stage_output.vLocation4 = vLocation4;
|
||||
stage_output.vLocation9 = vLocation9;
|
||||
return stage_output;
|
||||
}
|
35
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert
vendored
Normal file
35
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
static float4 gl_Position;
|
||||
static float4x4 m;
|
||||
static float3 pos;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float3 pos : TEXCOORD0;
|
||||
float4 m_0 : TEXCOORD1_0;
|
||||
float4 m_1 : TEXCOORD1_1;
|
||||
float4 m_2 : TEXCOORD1_2;
|
||||
float4 m_3 : TEXCOORD1_3;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = mul(float4(pos, 1.0f), m);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
m[0] = stage_input.m_0;
|
||||
m[1] = stage_input.m_1;
|
||||
m[2] = stage_input.m_2;
|
||||
m[3] = stage_input.m_3;
|
||||
pos = stage_input.pos;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
23
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/matrix-output.vert
vendored
Normal file
23
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/matrix-output.vert
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
static float4 gl_Position;
|
||||
static float4x4 m;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4x4 m : TEXCOORD0;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = 1.0f.xxxx;
|
||||
m = float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.m = m;
|
||||
return stage_output;
|
||||
}
|
18
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/no-input.vert
vendored
Normal file
18
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/no-input.vert
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = 1.0f.xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
20
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert
vendored
Normal file
20
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
static float4 gl_Position;
|
||||
static float gl_PointSize;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = 1.0f.xxxx;
|
||||
gl_PointSize = 10.0f;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
50
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/qualifiers.vert
vendored
Normal file
50
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/qualifiers.vert
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
static float4 gl_Position;
|
||||
static float vFlat;
|
||||
static float vCentroid;
|
||||
static float vSample;
|
||||
static float vNoperspective;
|
||||
|
||||
struct Block
|
||||
{
|
||||
nointerpolation float vFlat : TEXCOORD4;
|
||||
centroid float vCentroid : TEXCOORD5;
|
||||
sample float vSample : TEXCOORD6;
|
||||
noperspective float vNoperspective : TEXCOORD7;
|
||||
};
|
||||
|
||||
static Block vout;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
nointerpolation float vFlat : TEXCOORD0;
|
||||
centroid float vCentroid : TEXCOORD1;
|
||||
sample float vSample : TEXCOORD2;
|
||||
noperspective float vNoperspective : TEXCOORD3;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = 1.0f.xxxx;
|
||||
vFlat = 0.0f;
|
||||
vCentroid = 1.0f;
|
||||
vSample = 2.0f;
|
||||
vNoperspective = 3.0f;
|
||||
vout.vFlat = 0.0f;
|
||||
vout.vCentroid = 1.0f;
|
||||
vout.vSample = 2.0f;
|
||||
vout.vNoperspective = 3.0f;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(out Block stage_outputvout)
|
||||
{
|
||||
vert_main();
|
||||
stage_outputvout = vout;
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.vFlat = vFlat;
|
||||
stage_output.vCentroid = vCentroid;
|
||||
stage_output.vSample = vSample;
|
||||
stage_output.vNoperspective = vNoperspective;
|
||||
return stage_output;
|
||||
}
|
22
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert
vendored
Normal file
22
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Buffer<float4> uFloatSampler : register(t1);
|
||||
Buffer<int4> uIntSampler : register(t2);
|
||||
Buffer<uint4> uUintSampler : register(t3);
|
||||
|
||||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = (uFloatSampler.Load(20) + asfloat(uIntSampler.Load(40))) + asfloat(uUintSampler.Load(60));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
44
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert
vendored
Normal file
44
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
struct VOut
|
||||
{
|
||||
float4 a;
|
||||
float4 b;
|
||||
float4 c;
|
||||
float4 d;
|
||||
};
|
||||
|
||||
static VOut vout;
|
||||
static float4 a;
|
||||
static float4 b;
|
||||
static float4 c;
|
||||
static float4 d;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 a : TEXCOORD0;
|
||||
float4 b : TEXCOORD1;
|
||||
float4 c : TEXCOORD2;
|
||||
float4 d : TEXCOORD3;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
VOut vout : TEXCOORD0;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
VOut _26 = { a, b, c, d };
|
||||
vout = _26;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
a = stage_input.a;
|
||||
b = stage_input.b;
|
||||
c = stage_input.c;
|
||||
d = stage_input.d;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.vout = vout;
|
||||
return stage_output;
|
||||
}
|
21
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Buffer<float4> uSamp : register(t4);
|
||||
RWBuffer<float4> uSampo : register(u5);
|
||||
|
||||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = uSamp.Load(10) + uSampo[100];
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _3
|
||||
{
|
||||
int4 _m0;
|
||||
uint4 _m1;
|
||||
};
|
||||
|
||||
struct _4
|
||||
{
|
||||
uint4 _m0;
|
||||
int4 _m1;
|
||||
};
|
||||
|
||||
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||
{
|
||||
_6._m0 = _5._m1 + uint4(_5._m0);
|
||||
_6._m0 = uint4(_5._m0) + _5._m1;
|
||||
_6._m0 = _5._m1 + _5._m1;
|
||||
_6._m0 = uint4(_5._m0 + _5._m0);
|
||||
_6._m1 = int4(_5._m1 + _5._m1);
|
||||
_6._m1 = _5._m0 + _5._m0;
|
||||
_6._m1 = int4(_5._m1) + _5._m0;
|
||||
_6._m1 = _5._m0 + int4(_5._m1);
|
||||
}
|
||||
|
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _3
|
||||
{
|
||||
int4 _m0;
|
||||
uint4 _m1;
|
||||
};
|
||||
|
||||
struct _4
|
||||
{
|
||||
uint4 _m0;
|
||||
int4 _m1;
|
||||
};
|
||||
|
||||
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||
{
|
||||
_6._m0 = uint4(int4(_5._m1) >> _5._m0);
|
||||
_6._m0 = uint4(_5._m0 >> int4(_5._m1));
|
||||
_6._m0 = uint4(int4(_5._m1) >> int4(_5._m1));
|
||||
_6._m0 = uint4(_5._m0 >> _5._m0);
|
||||
_6._m1 = int4(_5._m1) >> int4(_5._m1);
|
||||
_6._m1 = _5._m0 >> _5._m0;
|
||||
_6._m1 = int4(_5._m1) >> _5._m0;
|
||||
_6._m1 = _5._m0 >> int4(_5._m1);
|
||||
}
|
||||
|
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _3
|
||||
{
|
||||
int4 _m0;
|
||||
uint4 _m1;
|
||||
};
|
||||
|
||||
struct _4
|
||||
{
|
||||
uint4 _m0;
|
||||
int4 _m1;
|
||||
};
|
||||
|
||||
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||
{
|
||||
_6._m0 = uint4(int4(_5._m1) / _5._m0);
|
||||
_6._m0 = uint4(_5._m0 / int4(_5._m1));
|
||||
_6._m0 = uint4(int4(_5._m1) / int4(_5._m1));
|
||||
_6._m0 = uint4(_5._m0 / _5._m0);
|
||||
_6._m1 = int4(_5._m1) / int4(_5._m1);
|
||||
_6._m1 = _5._m0 / _5._m0;
|
||||
_6._m1 = int4(_5._m1) / _5._m0;
|
||||
_6._m1 = _5._m0 / int4(_5._m1);
|
||||
}
|
||||
|
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _3
|
||||
{
|
||||
int4 _m0;
|
||||
uint4 _m1;
|
||||
};
|
||||
|
||||
struct _4
|
||||
{
|
||||
uint4 _m0;
|
||||
int4 _m1;
|
||||
};
|
||||
|
||||
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||
{
|
||||
_6._m0 = _5._m1 >> uint4(_5._m0);
|
||||
_6._m0 = uint4(_5._m0) >> _5._m1;
|
||||
_6._m0 = _5._m1 >> _5._m1;
|
||||
_6._m0 = uint4(_5._m0) >> uint4(_5._m0);
|
||||
_6._m1 = int4(_5._m1 >> _5._m1);
|
||||
_6._m1 = int4(uint4(_5._m0) >> uint4(_5._m0));
|
||||
_6._m1 = int4(_5._m1 >> uint4(_5._m0));
|
||||
_6._m1 = int4(uint4(_5._m0) >> _5._m1);
|
||||
}
|
||||
|
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp
vendored
Normal file
29
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _6
|
||||
{
|
||||
int4 _m0;
|
||||
uint4 _m1;
|
||||
};
|
||||
|
||||
struct _7
|
||||
{
|
||||
uint4 _m0;
|
||||
int4 _m1;
|
||||
};
|
||||
|
||||
kernel void main0(device _6& _8 [[buffer(0)]], device _7& _9 [[buffer(1)]])
|
||||
{
|
||||
_9._m0 = _8._m1 + uint4(_8._m0);
|
||||
_9._m0 = uint4(_8._m0) + _8._m1;
|
||||
_9._m0 = _8._m1 + _8._m1;
|
||||
_9._m0 = uint4(_8._m0 + _8._m0);
|
||||
_9._m1 = int4(_8._m1 + _8._m1);
|
||||
_9._m1 = _8._m0 + _8._m0;
|
||||
_9._m1 = int4(_8._m1) + _8._m0;
|
||||
_9._m1 = _8._m0 + int4(_8._m1);
|
||||
}
|
||||
|
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO0
|
||||
{
|
||||
float scalar;
|
||||
float2 vec2_val;
|
||||
float3 vec3_val;
|
||||
float4 vec4_val;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO0& _4 [[buffer(0)]])
|
||||
{
|
||||
_4.scalar = float(half(_4.scalar));
|
||||
_4.vec2_val = float2(half2(_4.vec2_val));
|
||||
_4.vec3_val = float3(half3(_4.vec3_val));
|
||||
_4.vec4_val = float4(half4(_4.vec4_val));
|
||||
}
|
||||
|
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant uint _5_tmp [[function_constant(10)]];
|
||||
constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u;
|
||||
constant uint _6_tmp [[function_constant(12)]];
|
||||
constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float a;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& _4 [[buffer(0)]])
|
||||
{
|
||||
_4.a += 1.0;
|
||||
}
|
||||
|
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/comp/storage-buffer-basic.asm.comp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant uint _3_tmp [[function_constant(0)]];
|
||||
constant uint _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 1u;
|
||||
constant uint _4_tmp [[function_constant(2)]];
|
||||
constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 3u;
|
||||
constant uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||
|
||||
struct _6
|
||||
{
|
||||
float _m0[1];
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]])
|
||||
{
|
||||
_8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x];
|
||||
}
|
||||
|
41
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag
vendored
Normal file
41
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _9
|
||||
{
|
||||
float _m0;
|
||||
};
|
||||
|
||||
struct _10
|
||||
{
|
||||
float _m0;
|
||||
float _m1;
|
||||
float _m2;
|
||||
float _m3;
|
||||
float _m4;
|
||||
float _m5;
|
||||
float _m6;
|
||||
float _m7;
|
||||
float _m8;
|
||||
float _m9;
|
||||
float _m10;
|
||||
float _m11;
|
||||
_9 _m12;
|
||||
};
|
||||
|
||||
constant _10 _51 = {};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 m_3 [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
out.m_3 = float4(_51._m0, _51._m1, _51._m2, _51._m3);
|
||||
return out;
|
||||
}
|
||||
|
235
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag
vendored
Normal file
235
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/inliner-dominator-inside-loop.asm.frag
vendored
Normal file
@ -0,0 +1,235 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 HPosition;
|
||||
float4 Uv_EdgeDistance1;
|
||||
float4 UvStuds_EdgeDistance2;
|
||||
float4 Color;
|
||||
float4 LightPosition_Fog;
|
||||
float4 View_Depth;
|
||||
float4 Normal_SpecPower;
|
||||
float3 Tangent;
|
||||
float4 PosLightSpace_Reflectance;
|
||||
float studIndex;
|
||||
};
|
||||
|
||||
struct Surface
|
||||
{
|
||||
float3 albedo;
|
||||
float3 normal;
|
||||
float specular;
|
||||
float gloss;
|
||||
float reflectance;
|
||||
float opacity;
|
||||
};
|
||||
|
||||
struct SurfaceInput
|
||||
{
|
||||
float4 Color;
|
||||
float2 Uv;
|
||||
float2 UvStuds;
|
||||
};
|
||||
|
||||
struct Globals
|
||||
{
|
||||
float4x4 ViewProjection;
|
||||
float4 ViewRight;
|
||||
float4 ViewUp;
|
||||
float4 ViewDir;
|
||||
float3 CameraPosition;
|
||||
float3 AmbientColor;
|
||||
float3 Lamp0Color;
|
||||
float3 Lamp0Dir;
|
||||
float3 Lamp1Color;
|
||||
float4 FogParams;
|
||||
float3 FogColor;
|
||||
float4 LightBorder;
|
||||
float4 LightConfig0;
|
||||
float4 LightConfig1;
|
||||
float4 LightConfig2;
|
||||
float4 LightConfig3;
|
||||
float4 RefractionBias_FadeDistance_GlowFactor;
|
||||
float4 OutlineBrightness_ShadowInfo;
|
||||
float4 ShadowMatrix0;
|
||||
float4 ShadowMatrix1;
|
||||
float4 ShadowMatrix2;
|
||||
};
|
||||
|
||||
struct Params
|
||||
{
|
||||
float4 LqmatFarTilingFactor;
|
||||
};
|
||||
|
||||
struct CB0
|
||||
{
|
||||
Globals CB0;
|
||||
};
|
||||
|
||||
struct CB2
|
||||
{
|
||||
Params CB2;
|
||||
};
|
||||
|
||||
constant VertexOutput _121 = {};
|
||||
constant SurfaceInput _122 = {};
|
||||
constant float2 _123 = {};
|
||||
constant float4 _124 = {};
|
||||
constant Surface _125 = {};
|
||||
constant float4 _192 = {};
|
||||
constant float4 _219 = {};
|
||||
constant float4 _297 = {};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float IN_studIndex [[user(locn8)]];
|
||||
float4 IN_PosLightSpace_Reflectance [[user(locn7)]];
|
||||
float3 IN_Tangent [[user(locn6)]];
|
||||
float4 IN_Normal_SpecPower [[user(locn5)]];
|
||||
float4 IN_View_Depth [[user(locn4)]];
|
||||
float4 IN_LightPosition_Fog [[user(locn3)]];
|
||||
float4 IN_Color [[user(locn2)]];
|
||||
float4 IN_UvStuds_EdgeDistance2 [[user(locn1)]];
|
||||
float4 IN_Uv_EdgeDistance1 [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 _entryPointOutput [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]], constant CB0& _19 [[buffer(0)]], texture3d<float> LightMapTexture [[texture(0)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], texture2d<float> ShadowMapTexture [[texture(1)]], texturecube<float> EnvironmentMapTexture [[texture(2)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], texture2d<float> DiffuseMapTexture [[texture(3)]], sampler NormalMapSampler [[sampler(4)]], texture2d<float> NormalMapTexture [[texture(4)]], texture2d<float> NormalDetailMapTexture [[texture(5)]], sampler NormalDetailMapSampler [[sampler(5)]], texture2d<float> StudsMapTexture [[texture(6)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], texture2d<float> SpecularMapTexture [[texture(7)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
VertexOutput _128 = _121;
|
||||
_128.HPosition = gl_FragCoord;
|
||||
VertexOutput _130 = _128;
|
||||
_130.Uv_EdgeDistance1 = in.IN_Uv_EdgeDistance1;
|
||||
VertexOutput _132 = _130;
|
||||
_132.UvStuds_EdgeDistance2 = in.IN_UvStuds_EdgeDistance2;
|
||||
VertexOutput _134 = _132;
|
||||
_134.Color = in.IN_Color;
|
||||
VertexOutput _136 = _134;
|
||||
_136.LightPosition_Fog = in.IN_LightPosition_Fog;
|
||||
VertexOutput _138 = _136;
|
||||
_138.View_Depth = in.IN_View_Depth;
|
||||
VertexOutput _140 = _138;
|
||||
_140.Normal_SpecPower = in.IN_Normal_SpecPower;
|
||||
VertexOutput _142 = _140;
|
||||
_142.Tangent = in.IN_Tangent;
|
||||
VertexOutput _144 = _142;
|
||||
_144.PosLightSpace_Reflectance = in.IN_PosLightSpace_Reflectance;
|
||||
VertexOutput _146 = _144;
|
||||
_146.studIndex = in.IN_studIndex;
|
||||
SurfaceInput _147 = _122;
|
||||
_147.Color = in.IN_Color;
|
||||
SurfaceInput _149 = _147;
|
||||
_149.Uv = in.IN_Uv_EdgeDistance1.xy;
|
||||
SurfaceInput _151 = _149;
|
||||
_151.UvStuds = in.IN_UvStuds_EdgeDistance2.xy;
|
||||
SurfaceInput _156 = _151;
|
||||
_156.UvStuds.y = (fract(_151.UvStuds.y) + in.IN_studIndex) * 0.25;
|
||||
float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y;
|
||||
float _165 = clamp(1.0 - _163, 0.0, 1.0);
|
||||
float2 _166 = in.IN_Uv_EdgeDistance1.xy * 1.0;
|
||||
bool _173;
|
||||
float4 _193;
|
||||
do
|
||||
{
|
||||
_173 = 0.0 == 0.0;
|
||||
if (_173)
|
||||
{
|
||||
_193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _180 = 1.0 / (1.0 - 0.0);
|
||||
_193 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_193 = _192;
|
||||
break;
|
||||
} while (false);
|
||||
float4 _220;
|
||||
do
|
||||
{
|
||||
if (_173)
|
||||
{
|
||||
_220 = NormalMapTexture.sample(NormalMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _207 = 1.0 / (1.0 - 0.0);
|
||||
_220 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_220 = _219;
|
||||
break;
|
||||
} while (false);
|
||||
float2 _223 = float2(1.0);
|
||||
float2 _224 = (_220.wy * 2.0) - _223;
|
||||
float3 _232 = float3(_224, sqrt(clamp(1.0 + dot(-_224, _224), 0.0, 1.0)));
|
||||
float2 _240 = (NormalDetailMapTexture.sample(NormalDetailMapSampler, (_166 * 0.0)).wy * 2.0) - _223;
|
||||
float2 _252 = _232.xy + (float3(_240, sqrt(clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0);
|
||||
float3 _253 = float3(_252.x, _252.y, _232.z);
|
||||
float2 _255 = _253.xy * _165;
|
||||
float3 _256 = float3(_255.x, _255.y, _253.z);
|
||||
float3 _271 = ((in.IN_Color.xyz * (_193 * 1.0).xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (StudsMapTexture.sample(StudsMapSampler, _156.UvStuds).x * 2.0);
|
||||
float4 _298;
|
||||
do
|
||||
{
|
||||
if (0.75 == 0.0)
|
||||
{
|
||||
_298 = SpecularMapTexture.sample(SpecularMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _285 = 1.0 / (1.0 - 0.75);
|
||||
_298 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_298 = _297;
|
||||
break;
|
||||
} while (false);
|
||||
float2 _303 = mix(float2(0.800000011920928955078125, 120.0), (_298.xy * float2(2.0, 256.0)) + float2(0.0, 0.00999999977648258209228515625), float2(_165));
|
||||
Surface _304 = _125;
|
||||
_304.albedo = _271;
|
||||
Surface _305 = _304;
|
||||
_305.normal = _256;
|
||||
float _306 = _303.x;
|
||||
Surface _307 = _305;
|
||||
_307.specular = _306;
|
||||
float _308 = _303.y;
|
||||
Surface _309 = _307;
|
||||
_309.gloss = _308;
|
||||
float _312 = (_298.xy.y * _165) * 0.0;
|
||||
Surface _313 = _309;
|
||||
_313.reflectance = _312;
|
||||
float4 _318 = float4(_271, _146.Color.w);
|
||||
float3 _329 = normalize(((in.IN_Tangent * _313.normal.x) + (cross(in.IN_Normal_SpecPower.xyz, in.IN_Tangent) * _313.normal.y)) + (in.IN_Normal_SpecPower.xyz * _313.normal.z));
|
||||
float3 _332 = -_19.CB0.Lamp0Dir;
|
||||
float _333 = dot(_329, _332);
|
||||
float _357 = clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(in.IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), float3(1.0)), 0.0, 1.0);
|
||||
float4 _368 = mix(LightMapTexture.sample(LightMapSampler, (in.IN_LightPosition_Fog.xyz.yzx - (in.IN_LightPosition_Fog.xyz.yzx * _357))), _19.CB0.LightBorder, float4(_357));
|
||||
float2 _376 = ShadowMapTexture.sample(ShadowMapSampler, in.IN_PosLightSpace_Reflectance.xyz.xy).xy;
|
||||
float _392 = (1.0 - (((step(_376.x, in.IN_PosLightSpace_Reflectance.xyz.z) * clamp(9.0 - (20.0 * abs(in.IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w;
|
||||
float3 _403 = mix(_318.xyz, EnvironmentMapTexture.sample(EnvironmentMapSampler, reflect(-in.IN_View_Depth.xyz, _329)).xyz, float3(_312));
|
||||
float4 _404 = float4(_403.x, _403.y, _403.z, _318.w);
|
||||
float3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * max(-_333, 0.0))) * _392)) + _368.xyz) * _404.xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(clamp(dot(_329, normalize(_332 + normalize(in.IN_View_Depth.xyz))), 0.0, 1.0), _308)));
|
||||
float4 _425 = float4(_422.x, _422.y, _422.z, _124.w);
|
||||
_425.w = _404.w;
|
||||
float2 _435 = min(in.IN_Uv_EdgeDistance1.wz, in.IN_UvStuds_EdgeDistance2.wz);
|
||||
float _439 = min(_435.x, _435.y) / _163;
|
||||
float3 _445 = _425.xyz * clamp((clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0);
|
||||
float4 _446 = float4(_445.x, _445.y, _445.z, _425.w);
|
||||
float3 _453 = mix(_19.CB0.FogColor, _446.xyz, float3(clamp(_146.LightPosition_Fog.w, 0.0, 1.0)));
|
||||
out._entryPointOutput = float4(_453.x, _453.y, _453.z, _446.w);
|
||||
return out;
|
||||
}
|
||||
|
23
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag
vendored
Normal file
23
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct D
|
||||
{
|
||||
float4 a;
|
||||
float b;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = 0.0;
|
||||
return out;
|
||||
}
|
||||
|
12
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag
vendored
Normal file
12
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
fragment void main0()
|
||||
{
|
||||
for (int _22 = 35; _22 >= 0; _22--)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
38
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag
vendored
Normal file
38
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant float4 _38 = {};
|
||||
constant float4 _50 = {};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 _entryPointOutput [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 _51;
|
||||
_51 = _50;
|
||||
float4 _52;
|
||||
for (;;)
|
||||
{
|
||||
if (0.0 != 0.0)
|
||||
{
|
||||
_52 = float4(1.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_52 = float4(1.0, 1.0, 0.0, 1.0);
|
||||
break;
|
||||
}
|
||||
_52 = _38;
|
||||
break;
|
||||
}
|
||||
out._entryPointOutput = _52;
|
||||
return out;
|
||||
}
|
||||
|
38
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag
vendored
Normal file
38
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant float4 _21 = {};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
int counter [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 _33;
|
||||
do
|
||||
{
|
||||
if (in.counter == 10)
|
||||
{
|
||||
_33 = float4(10.0);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_33 = float4(30.0);
|
||||
break;
|
||||
}
|
||||
} while (false);
|
||||
out.FragColor = _33;
|
||||
return out;
|
||||
}
|
||||
|
321
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag
vendored
Normal file
321
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag
vendored
Normal file
@ -0,0 +1,321 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct _28
|
||||
{
|
||||
float4 _m0;
|
||||
};
|
||||
|
||||
struct _6
|
||||
{
|
||||
float4 _m0;
|
||||
float _m1;
|
||||
float4 _m2;
|
||||
};
|
||||
|
||||
struct _10
|
||||
{
|
||||
float3 _m0;
|
||||
packed_float3 _m1;
|
||||
float _m2;
|
||||
packed_float3 _m3;
|
||||
float _m4;
|
||||
packed_float3 _m5;
|
||||
float _m6;
|
||||
packed_float3 _m7;
|
||||
float _m8;
|
||||
packed_float3 _m9;
|
||||
float _m10;
|
||||
packed_float3 _m11;
|
||||
float _m12;
|
||||
float2 _m13;
|
||||
float2 _m14;
|
||||
packed_float3 _m15;
|
||||
float _m16;
|
||||
float _m17;
|
||||
float _m18;
|
||||
float _m19;
|
||||
float _m20;
|
||||
float4 _m21;
|
||||
float4 _m22;
|
||||
float4x4 _m23;
|
||||
float4 _m24;
|
||||
};
|
||||
|
||||
struct _18
|
||||
{
|
||||
float4x4 _m0;
|
||||
float4x4 _m1;
|
||||
float4x4 _m2;
|
||||
float4x4 _m3;
|
||||
float4 _m4;
|
||||
float4 _m5;
|
||||
float _m6;
|
||||
float _m7;
|
||||
float _m8;
|
||||
float _m9;
|
||||
packed_float3 _m10;
|
||||
float _m11;
|
||||
packed_float3 _m12;
|
||||
float _m13;
|
||||
packed_float3 _m14;
|
||||
float _m15;
|
||||
packed_float3 _m16;
|
||||
float _m17;
|
||||
float _m18;
|
||||
float _m19;
|
||||
float2 _m20;
|
||||
float2 _m21;
|
||||
float2 _m22;
|
||||
float4 _m23;
|
||||
float2 _m24;
|
||||
float2 _m25;
|
||||
float2 _m26;
|
||||
char pad27[8];
|
||||
packed_float3 _m27;
|
||||
float _m28;
|
||||
float _m29;
|
||||
float _m30;
|
||||
float _m31;
|
||||
float _m32;
|
||||
float2 _m33;
|
||||
float _m34;
|
||||
float _m35;
|
||||
float3 _m36;
|
||||
float4x4 _m37[2];
|
||||
float4 _m38[2];
|
||||
};
|
||||
|
||||
constant _28 _74 = {};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 m_5 [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(float4 gl_FragCoord [[position]], constant _6& _7 [[buffer(0)]], texture2d<float> _8 [[texture(0)]], sampler _9 [[sampler(0)]], constant _10& _11 [[buffer(1)]], texture2d<float> _12 [[texture(1)]], sampler _13 [[sampler(1)]], texture2d<float> _14 [[texture(2)]], sampler _15 [[sampler(2)]], constant _18& _19 [[buffer(2)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
_28 _77 = _74;
|
||||
_77._m0 = float4(0.0);
|
||||
float2 _82 = gl_FragCoord.xy * _19._m23.xy;
|
||||
float4 _88 = _7._m2 * _7._m0.xyxy;
|
||||
float2 _97 = clamp(_82 + (float3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _109 = _11._m5 * clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _113 = _12.sample(_13, _97, level(0.0));
|
||||
float3 _129;
|
||||
if (_113.y > 0.0)
|
||||
{
|
||||
_129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * clamp(_113.y * _113.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_129 = _109;
|
||||
}
|
||||
float3 _133 = float4(0.0).xyz + (_129 * 0.5);
|
||||
float4 _134 = float4(_133.x, _133.y, _133.z, float4(0.0).w);
|
||||
_28 _135 = _77;
|
||||
_135._m0 = _134;
|
||||
float2 _144 = clamp(_82 + (float3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _156 = _11._m5 * clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _160 = _12.sample(_13, _144, level(0.0));
|
||||
float3 _176;
|
||||
if (_160.y > 0.0)
|
||||
{
|
||||
_176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * clamp(_160.y * _160.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_176 = _156;
|
||||
}
|
||||
float3 _180 = _134.xyz + (_176 * 0.5);
|
||||
float4 _181 = float4(_180.x, _180.y, _180.z, _134.w);
|
||||
_28 _182 = _135;
|
||||
_182._m0 = _181;
|
||||
float2 _191 = clamp(_82 + (float3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _203 = _11._m5 * clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _207 = _12.sample(_13, _191, level(0.0));
|
||||
float3 _223;
|
||||
if (_207.y > 0.0)
|
||||
{
|
||||
_223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * clamp(_207.y * _207.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_223 = _203;
|
||||
}
|
||||
float3 _227 = _181.xyz + (_223 * 0.75);
|
||||
float4 _228 = float4(_227.x, _227.y, _227.z, _181.w);
|
||||
_28 _229 = _182;
|
||||
_229._m0 = _228;
|
||||
float2 _238 = clamp(_82 + (float3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _250 = _11._m5 * clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _254 = _12.sample(_13, _238, level(0.0));
|
||||
float3 _270;
|
||||
if (_254.y > 0.0)
|
||||
{
|
||||
_270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * clamp(_254.y * _254.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_270 = _250;
|
||||
}
|
||||
float3 _274 = _228.xyz + (_270 * 0.5);
|
||||
float4 _275 = float4(_274.x, _274.y, _274.z, _228.w);
|
||||
_28 _276 = _229;
|
||||
_276._m0 = _275;
|
||||
float2 _285 = clamp(_82 + (float3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _297 = _11._m5 * clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _301 = _12.sample(_13, _285, level(0.0));
|
||||
float3 _317;
|
||||
if (_301.y > 0.0)
|
||||
{
|
||||
_317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * clamp(_301.y * _301.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_317 = _297;
|
||||
}
|
||||
float3 _321 = _275.xyz + (_317 * 0.5);
|
||||
float4 _322 = float4(_321.x, _321.y, _321.z, _275.w);
|
||||
_28 _323 = _276;
|
||||
_323._m0 = _322;
|
||||
float2 _332 = clamp(_82 + (float3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _344 = _11._m5 * clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _348 = _12.sample(_13, _332, level(0.0));
|
||||
float3 _364;
|
||||
if (_348.y > 0.0)
|
||||
{
|
||||
_364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * clamp(_348.y * _348.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_364 = _344;
|
||||
}
|
||||
float3 _368 = _322.xyz + (_364 * 0.75);
|
||||
float4 _369 = float4(_368.x, _368.y, _368.z, _322.w);
|
||||
_28 _370 = _323;
|
||||
_370._m0 = _369;
|
||||
float2 _379 = clamp(_82 + (float3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _391 = _11._m5 * clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _395 = _12.sample(_13, _379, level(0.0));
|
||||
float3 _411;
|
||||
if (_395.y > 0.0)
|
||||
{
|
||||
_411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * clamp(_395.y * _395.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_411 = _391;
|
||||
}
|
||||
float3 _415 = _369.xyz + (_411 * 1.0);
|
||||
float4 _416 = float4(_415.x, _415.y, _415.z, _369.w);
|
||||
_28 _417 = _370;
|
||||
_417._m0 = _416;
|
||||
float2 _426 = clamp(_82 + (float3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _438 = _11._m5 * clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _442 = _12.sample(_13, _426, level(0.0));
|
||||
float3 _458;
|
||||
if (_442.y > 0.0)
|
||||
{
|
||||
_458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * clamp(_442.y * _442.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_458 = _438;
|
||||
}
|
||||
float3 _462 = _416.xyz + (_458 * 0.75);
|
||||
float4 _463 = float4(_462.x, _462.y, _462.z, _416.w);
|
||||
_28 _464 = _417;
|
||||
_464._m0 = _463;
|
||||
float2 _473 = clamp(_82 + (float3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _485 = _11._m5 * clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _489 = _12.sample(_13, _473, level(0.0));
|
||||
float3 _505;
|
||||
if (_489.y > 0.0)
|
||||
{
|
||||
_505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * clamp(_489.y * _489.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_505 = _485;
|
||||
}
|
||||
float3 _509 = _463.xyz + (_505 * 0.5);
|
||||
float4 _510 = float4(_509.x, _509.y, _509.z, _463.w);
|
||||
_28 _511 = _464;
|
||||
_511._m0 = _510;
|
||||
float2 _520 = clamp(_82 + (float3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _532 = _11._m5 * clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _536 = _12.sample(_13, _520, level(0.0));
|
||||
float3 _552;
|
||||
if (_536.y > 0.0)
|
||||
{
|
||||
_552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * clamp(_536.y * _536.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_552 = _532;
|
||||
}
|
||||
float3 _556 = _510.xyz + (_552 * 0.5);
|
||||
float4 _557 = float4(_556.x, _556.y, _556.z, _510.w);
|
||||
_28 _558 = _511;
|
||||
_558._m0 = _557;
|
||||
float2 _567 = clamp(_82 + (float3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _579 = _11._m5 * clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _583 = _12.sample(_13, _567, level(0.0));
|
||||
float3 _599;
|
||||
if (_583.y > 0.0)
|
||||
{
|
||||
_599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * clamp(_583.y * _583.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_599 = _579;
|
||||
}
|
||||
float3 _603 = _557.xyz + (_599 * 0.75);
|
||||
float4 _604 = float4(_603.x, _603.y, _603.z, _557.w);
|
||||
_28 _605 = _558;
|
||||
_605._m0 = _604;
|
||||
float2 _614 = clamp(_82 + (float3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _626 = _11._m5 * clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _630 = _12.sample(_13, _614, level(0.0));
|
||||
float3 _646;
|
||||
if (_630.y > 0.0)
|
||||
{
|
||||
_646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * clamp(_630.y * _630.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_646 = _626;
|
||||
}
|
||||
float3 _650 = _604.xyz + (_646 * 0.5);
|
||||
float4 _651 = float4(_650.x, _650.y, _650.z, _604.w);
|
||||
_28 _652 = _605;
|
||||
_652._m0 = _651;
|
||||
float2 _661 = clamp(_82 + (float3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
|
||||
float3 _673 = _11._m5 * clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0);
|
||||
float4 _677 = _12.sample(_13, _661, level(0.0));
|
||||
float3 _693;
|
||||
if (_677.y > 0.0)
|
||||
{
|
||||
_693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * clamp(_677.y * _677.z, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_693 = _673;
|
||||
}
|
||||
float3 _697 = _651.xyz + (_693 * 0.5);
|
||||
float4 _698 = float4(_697.x, _697.y, _697.z, _651.w);
|
||||
_28 _699 = _652;
|
||||
_699._m0 = _698;
|
||||
float3 _702 = _698.xyz / float3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5);
|
||||
_28 _704 = _699;
|
||||
_704._m0 = float4(_702.x, _702.y, _702.z, _698.w);
|
||||
_28 _705 = _704;
|
||||
_705._m0.w = 1.0;
|
||||
out.m_5 = _705._m0;
|
||||
return out;
|
||||
}
|
||||
|
9
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/vert/empty-struct-composite.asm.vert
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-msl/asm/vert/empty-struct-composite.asm.vert
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
vertex void main0()
|
||||
{
|
||||
}
|
||||
|
36
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/atomic.comp
vendored
Normal file
36
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/atomic.comp
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
#include <metal_atomic>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
uint u32;
|
||||
int i32;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& ssbo [[buffer(0)]])
|
||||
{
|
||||
uint _16 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _18 = atomic_fetch_or_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _20 = atomic_fetch_xor_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _22 = atomic_fetch_and_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _24 = atomic_fetch_min_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _26 = atomic_fetch_max_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _28 = atomic_exchange_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||
uint _30 = 10u;
|
||||
uint _32 = atomic_compare_exchange_weak_explicit((volatile device atomic_uint*)&(ssbo.u32), &(_30), 2u, memory_order_relaxed, memory_order_relaxed);
|
||||
int _36 = atomic_fetch_add_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _38 = atomic_fetch_or_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _40 = atomic_fetch_xor_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _42 = atomic_fetch_and_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _44 = atomic_fetch_min_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _46 = atomic_fetch_max_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _48 = atomic_exchange_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||
int _50 = 10;
|
||||
int _52 = atomic_compare_exchange_weak_explicit((volatile device atomic_int*)&(ssbo.i32), &(_50), 2, memory_order_relaxed, memory_order_relaxed);
|
||||
}
|
||||
|
22
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/bake_gradient.comp
vendored
Normal file
22
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/bake_gradient.comp
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(8u, 8u, 1u);
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4 uInvSize;
|
||||
float4 uScale;
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant UBO& _46 [[buffer(0)]], texture2d<float> uHeight [[texture(0)]], sampler uHeightSmplr [[sampler(0)]], texture2d<float> uDisplacement [[texture(1)]], sampler uDisplacementSmplr [[sampler(1)]], texture2d<float, access::write> iHeightDisplacement [[texture(2)]], texture2d<float, access::write> iGradJacobian [[texture(3)]])
|
||||
{
|
||||
float4 _59 = (float2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5);
|
||||
float2 _157 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(1, 0)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z;
|
||||
float2 _161 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, 1)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z;
|
||||
iHeightDisplacement.write(float4(uHeight.sample(uHeightSmplr, _59.xy, level(0.0)).x, 0.0, 0.0, 0.0), uint2(int2(gl_GlobalInvocationID.xy)));
|
||||
iGradJacobian.write(float4((_46.uScale.xy * 0.5) * float2(uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(1, 0)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(-1, 0)).x, uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, 1)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, -1)).x), ((1.0 + _157.x) * (1.0 + _161.y)) - (_157.y * _161.x), 0.0), uint2(int2(gl_GlobalInvocationID.xy)));
|
||||
}
|
||||
|
20
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/barriers.comp
vendored
Normal file
20
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/barriers.comp
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
|
||||
kernel void main0()
|
||||
{
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_none);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_none);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||
}
|
||||
|
33
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp
vendored
Normal file
33
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/basic.comp
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
#include <metal_atomic>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float4 in_data[1];
|
||||
};
|
||||
|
||||
struct SSBO2
|
||||
{
|
||||
float4 out_data[1];
|
||||
};
|
||||
|
||||
struct SSBO3
|
||||
{
|
||||
uint counter;
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]])
|
||||
{
|
||||
float4 _29 = _23.in_data[gl_GlobalInvocationID.x];
|
||||
if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875)
|
||||
{
|
||||
uint _52 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(_48.counter), 1u, memory_order_relaxed);
|
||||
_45.out_data[_52] = _29;
|
||||
}
|
||||
}
|
||||
|
47
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/bitfield.noopt.comp
vendored
Normal file
47
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/bitfield.noopt.comp
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
// Implementation of the GLSL findLSB() function
|
||||
template<typename T>
|
||||
T findLSB(T x)
|
||||
{
|
||||
return select(ctz(x), T(-1), x == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the signed GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findSMSB(T x)
|
||||
{
|
||||
T v = select(x, T(-1) - x, x < T(0));
|
||||
return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the unsigned GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findUMSB(T x)
|
||||
{
|
||||
return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0));
|
||||
}
|
||||
|
||||
kernel void main0()
|
||||
{
|
||||
int signed_value = 0;
|
||||
uint unsigned_value = 0u;
|
||||
int s = extract_bits(signed_value, 5, 20);
|
||||
uint u = extract_bits(unsigned_value, 6, 21);
|
||||
s = insert_bits(s, 40, 5, 4);
|
||||
u = insert_bits(u, 60u, 5, 4);
|
||||
u = reverse_bits(u);
|
||||
s = reverse_bits(s);
|
||||
int v0 = popcount(u);
|
||||
int v1 = popcount(s);
|
||||
int v2 = findUMSB(u);
|
||||
int v3 = findSMSB(s);
|
||||
int v4 = findLSB(u);
|
||||
int v5 = findLSB(s);
|
||||
}
|
||||
|
9
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/builtins.comp
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/builtins.comp
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
kernel void main0(uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||
{
|
||||
}
|
||||
|
9
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp
vendored
Normal file
9
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
kernel void main0()
|
||||
{
|
||||
}
|
||||
|
15
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/coherent-block.comp
vendored
Normal file
15
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/coherent-block.comp
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float4 value;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& _10 [[buffer(0)]])
|
||||
{
|
||||
_10.value = float4(20.0);
|
||||
}
|
||||
|
15
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/coherent-image.comp
vendored
Normal file
15
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/coherent-image.comp
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
int4 value;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& _10 [[buffer(0)]], texture2d<int> uImage [[texture(0)]])
|
||||
{
|
||||
_10.value = uImage.read(uint2(int2(10)));
|
||||
}
|
||||
|
35
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp
vendored
Normal file
35
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/culling.comp
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
#include <metal_atomic>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float in_data[1];
|
||||
};
|
||||
|
||||
struct SSBO2
|
||||
{
|
||||
float out_data[1];
|
||||
};
|
||||
|
||||
struct SSBO3
|
||||
{
|
||||
uint count;
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]])
|
||||
{
|
||||
float _28 = _22.in_data[gl_GlobalInvocationID.x];
|
||||
if (_28 > 12.0)
|
||||
{
|
||||
uint _45 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(_41.count), 1u, memory_order_relaxed);
|
||||
_38.out_data[_45] = _28;
|
||||
}
|
||||
}
|
||||
|
21
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/defer-parens.comp
vendored
Normal file
21
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/defer-parens.comp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float4 data;
|
||||
int index;
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& _13 [[buffer(0)]])
|
||||
{
|
||||
float4 _17 = _13.data;
|
||||
_13.data = float4(_17.x, _17.yz + float2(10.0), _17.w);
|
||||
_13.data = (_17 + _17) + _17;
|
||||
_13.data = (_17.yz + float2(10.0)).xxyy;
|
||||
_13.data = float4((_17.yz + float2(10.0)).y);
|
||||
_13.data = float4((_17.zw + float2(10.0))[_13.index]);
|
||||
}
|
||||
|
39
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp
vendored
Normal file
39
deps/SPIRV-Cross/reference/opt/shaders-msl/comp/dowhile.comp
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float4x4 mvp;
|
||||
float4 in_data[1];
|
||||
};
|
||||
|
||||
struct SSBO2
|
||||
{
|
||||
float4 out_data[1];
|
||||
};
|
||||
|
||||
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]])
|
||||
{
|
||||
int i = 0;
|
||||
float4 _56;
|
||||
_56 = _28.in_data[gl_GlobalInvocationID.x];
|
||||
float4 _42;
|
||||
for (;;)
|
||||
{
|
||||
_42 = _28.mvp * _56;
|
||||
i++;
|
||||
if (i < 16)
|
||||
{
|
||||
_56 = _42;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
_52.out_data[gl_GlobalInvocationID.x] = _42;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user