Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross into hlsl
# Conflicts: # spirv_glsl.hpp
This commit is contained in:
Коммит
429b8cb25f
|
@ -162,3 +162,6 @@ TabWidth: 4
|
|||
|
||||
# The way to use tab characters in the resulting file. Possible values: Never, ForIndentation, Always.
|
||||
UseTab: ForIndentation
|
||||
|
||||
# Do not reflow comments
|
||||
ReflowComments: false
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
# 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
|
||||
env:
|
||||
- GLSLANG_REV=b56f4ac72c57f5c50f14ddb0bf1f78eaaef21c2b
|
||||
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 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
|
||||
- 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
|
|
@ -16,46 +16,85 @@ cmake_minimum_required(VERSION 2.8)
|
|||
project(SPIRV-Cross)
|
||||
enable_testing()
|
||||
|
||||
option(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS "Instead of throwing exceptions assert" OFF)
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Makefile")
|
||||
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
message(FATAL_ERROR "Build out of tree to avoid overwriting Makefile")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(spirv-cross
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_common.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.hpp
|
||||
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)
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_glsl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.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 "")
|
||||
|
||||
if(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
set(spirv-compiler-defines ${spirv-compiler-defines} SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
endif()
|
||||
|
||||
# To specify special debug or optimization options, use
|
||||
# -DCMAKE_CXX_COMPILE_FLAGS
|
||||
# However, we require the C++11 dialect.
|
||||
if (NOT "${MSVC}")
|
||||
target_compile_options(spirv-cross PRIVATE -std=c++11 -Wall -Wextra -Werror -Wshadow)
|
||||
endif(NOT "${MSVC}")
|
||||
set(spirv-compiler-options ${spirv-compiler-options} -std=c++11 -Wall -Wextra -Werror -Wshadow)
|
||||
set(spirv-compiler-defines ${spirv-compiler-defines} __STDC_LIMIT_MACROS)
|
||||
|
||||
if(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
|
||||
set(spirv-compiler-options ${spirv-compiler-options} -fno-exceptions)
|
||||
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})
|
||||
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})
|
||||
|
||||
# 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_program(PYTHON3_EXE python3)
|
||||
if(${PYTHON3_EXE} MATCHES "NOTFOUND")
|
||||
message(WARNING "Testing disabled. Could not find python3")
|
||||
find_package(PythonInterp)
|
||||
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)
|
||||
endif()
|
||||
else()
|
||||
add_test(NAME spirv-cross-test
|
||||
COMMAND ${PYTHON3_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
|
||||
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")
|
||||
endif()
|
||||
|
|
8
Makefile
8
Makefile
|
@ -10,12 +10,16 @@ STATIC_LIB := lib$(TARGET).a
|
|||
|
||||
DEPS := $(OBJECTS:.o=.d) $(CLI_OBJECTS:.o=.d)
|
||||
|
||||
CXXFLAGS += -std=c++11 -Wall -Wextra -Wshadow
|
||||
CXXFLAGS += -std=c++11 -Wall -Wextra -Wshadow -D__STDC_LIMIT_MACROS
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CXXFLAGS += -O0 -g
|
||||
else
|
||||
CXXFLAGS += -O2 -g
|
||||
CXXFLAGS += -O2 -DNDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS), 1)
|
||||
CXXFLAGS += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS -fno-exceptions
|
||||
endif
|
||||
|
||||
all: $(TARGET)
|
||||
|
|
51
README.md
51
README.md
|
@ -2,6 +2,8 @@
|
|||
|
||||
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.
|
||||
|
||||
[![Build Status](https://travis-ci.org/KhronosGroup/SPIRV-Cross.svg?branch=master)](https://travis-ci.org/KhronosGroup/SPIRV-Cross)
|
||||
|
||||
## Features
|
||||
|
||||
- Convert SPIR-V to readable, usable and efficient GLSL
|
||||
|
@ -21,7 +23,9 @@ However, most missing features are expected to be "trivial" improvements at this
|
|||
|
||||
SPIRV-Cross has been tested on Linux, OSX and Windows.
|
||||
|
||||
### Linux and OSX
|
||||
The make and CMake build flavors offer the option to treat exceptions as assertions. To disable exceptions for make just append SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=1 to the command line. For CMake append -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON. By default exceptions are enabled.
|
||||
|
||||
### Linux and macOS
|
||||
|
||||
Just run `make` on the command line. A recent GCC (4.8+) or Clang (3.x+) compiler is required as SPIRV-Cross uses C++11 extensively.
|
||||
|
||||
|
@ -117,6 +121,41 @@ 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
|
||||
|
||||
#### Entry point
|
||||
|
||||
When using SPIR-V shaders compiled from HLSL, there are some extra things you need to take care of.
|
||||
First make sure that the entry point is used correctly.
|
||||
If you forget to set the entry point correctly in glslangValidator (-e MyFancyEntryPoint),
|
||||
you will likely encounter this error message:
|
||||
|
||||
```
|
||||
Cannot end a function before ending the current block.
|
||||
Likely cause: If this SPIR-V was created from glslang HLSL, make sure the entry point is valid.
|
||||
```
|
||||
|
||||
#### Separate image samplers
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
// From main.cpp
|
||||
// Builds a mapping for all combinations of images and samplers.
|
||||
compiler->build_combined_image_samplers();
|
||||
|
||||
// Give the remapped combined samplers new names.
|
||||
// Here you can also set up decorations if you want (binding = #N).
|
||||
for (auto &remap : compiler->get_combined_image_samplers())
|
||||
{
|
||||
compiler->set_name(remap.combined_id, join("SPIRV_Cross_Combined", compiler->get_name(remap.image_id),
|
||||
compiler->get_name(remap.sampler_id)));
|
||||
}
|
||||
```
|
||||
|
||||
If your target is Vulkan GLSL, `--vulkan-semantics` will emit separate image samplers as you'd expect.
|
||||
The command line client does this automatically, but if you're calling the library, you'll need to do this yourself.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to SPIRV-Cross are welcome. See Testing and Licensing sections for details.
|
||||
|
@ -142,8 +181,14 @@ along with the Apache 2.0 licensing stub.
|
|||
|
||||
### Formatting
|
||||
|
||||
SPIRV-Cross uses clang-format to automatically format code.
|
||||
Please use clang-format with the style sheet found in `.clang-format` to automatically format code before submitting a pull request.
|
||||
SPIRV-Cross uses `clang-format` to automatically format code.
|
||||
Please use `clang-format` with the style sheet found in `.clang-format` to automatically format code before submitting a pull request.
|
||||
|
||||
To make things easy, the `format_all.sh` script can be used to format all
|
||||
source files in the library. In this directory, run the following from the
|
||||
command line:
|
||||
|
||||
./format_all.sh
|
||||
|
||||
## ABI concerns
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,8 +4,9 @@ include $(CLEAR_VARS)
|
|||
|
||||
LOCAL_CFLAGS += -std=c++11 -Wall -Wextra
|
||||
LOCAL_MODULE := spirv-cross
|
||||
LOCAL_SRC_FILES := ../spirv_cross.cpp ../spirv_glsl.cpp ../spirv_cpp.cpp
|
||||
LOCAL_SRC_FILES := ../spirv_cfg.cpp ../spirv_cross.cpp ../spirv_glsl.cpp ../spirv_msl.cpp ../spirv_cpp.cpp
|
||||
LOCAL_CPP_FEATURES := exceptions
|
||||
LOCAL_ARM_MODE := arm
|
||||
LOCAL_CFLAGS := -D__STDC_LIMIT_MACROS
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
|
122
main.cpp
122
main.cpp
|
@ -26,10 +26,25 @@
|
|||
#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)
|
||||
#else
|
||||
#define THROW(x) runtime_error(x)
|
||||
#endif
|
||||
|
||||
struct CLIParser;
|
||||
struct CLICallbacks
|
||||
{
|
||||
|
@ -53,7 +68,9 @@ struct CLIParser
|
|||
|
||||
bool parse()
|
||||
{
|
||||
#ifndef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
try
|
||||
#endif
|
||||
{
|
||||
while (argc && !ended_state)
|
||||
{
|
||||
|
@ -69,7 +86,7 @@ struct CLIParser
|
|||
auto itr = cbs.callbacks.find(next);
|
||||
if (itr == ::end(cbs.callbacks))
|
||||
{
|
||||
throw logic_error("Invalid argument.\n");
|
||||
THROW("Invalid argument");
|
||||
}
|
||||
|
||||
itr->second(*this);
|
||||
|
@ -78,6 +95,7 @@ struct CLIParser
|
|||
|
||||
return true;
|
||||
}
|
||||
#ifndef SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
catch (...)
|
||||
{
|
||||
if (cbs.error_handler)
|
||||
|
@ -86,6 +104,7 @@ struct CLIParser
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void end()
|
||||
|
@ -97,13 +116,13 @@ struct CLIParser
|
|||
{
|
||||
if (!argc)
|
||||
{
|
||||
throw logic_error("Tried to parse uint, but nothing left in arguments.\n");
|
||||
THROW("Tried to parse uint, but nothing left in arguments");
|
||||
}
|
||||
|
||||
uint32_t val = stoul(*argv);
|
||||
if (val > numeric_limits<uint32_t>::max())
|
||||
{
|
||||
throw out_of_range("next_uint() out of range.\n");
|
||||
THROW("next_uint() out of range");
|
||||
}
|
||||
|
||||
argc--;
|
||||
|
@ -116,7 +135,7 @@ struct CLIParser
|
|||
{
|
||||
if (!argc)
|
||||
{
|
||||
throw logic_error("Tried to parse double, but nothing left in arguments.\n");
|
||||
THROW("Tried to parse double, but nothing left in arguments");
|
||||
}
|
||||
|
||||
double val = stod(*argv);
|
||||
|
@ -131,7 +150,7 @@ struct CLIParser
|
|||
{
|
||||
if (!argc)
|
||||
{
|
||||
throw logic_error("Tried to parse string, but nothing left in arguments.\n");
|
||||
THROW("Tried to parse string, but nothing left in arguments");
|
||||
}
|
||||
|
||||
const char *ret = *argv;
|
||||
|
@ -196,8 +215,14 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
|
|||
bool is_push_constant = compiler.get_storage_class(res.id) == StorageClassPushConstant;
|
||||
bool is_block = (compiler.get_decoration_mask(type.self) &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))) != 0;
|
||||
bool is_sized_block = is_block && (compiler.get_storage_class(res.id) == StorageClassUniform ||
|
||||
compiler.get_storage_class(res.id) == StorageClassUniformConstant);
|
||||
uint32_t fallback_id = !is_push_constant && is_block ? res.base_type_id : res.id;
|
||||
|
||||
uint32_t block_size = 0;
|
||||
if (is_sized_block)
|
||||
block_size = uint32_t(compiler.get_declared_struct_size(compiler.get_type(res.base_type_id)));
|
||||
|
||||
string array;
|
||||
for (auto arr : type.array)
|
||||
array = join("[", arr ? convert_to_string(arr) : "", "]") + array;
|
||||
|
@ -213,6 +238,12 @@ 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);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
fprintf(stderr, "=============\n\n");
|
||||
|
@ -317,6 +348,8 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
|
|||
print_resources(compiler, "inputs", res.stage_inputs);
|
||||
print_resources(compiler, "outputs", res.stage_outputs);
|
||||
print_resources(compiler, "textures", res.sampled_images);
|
||||
print_resources(compiler, "separate images", res.separate_images);
|
||||
print_resources(compiler, "separate samplers", res.separate_samplers);
|
||||
print_resources(compiler, "images", res.storage_images);
|
||||
print_resources(compiler, "ssbos", res.storage_buffers);
|
||||
print_resources(compiler, "ubos", res.uniform_buffers);
|
||||
|
@ -345,6 +378,16 @@ static void print_push_constant_resources(const Compiler &compiler, const vector
|
|||
}
|
||||
}
|
||||
|
||||
static void print_spec_constants(const Compiler &compiler)
|
||||
{
|
||||
auto spec_constants = compiler.get_specialization_constants();
|
||||
fprintf(stderr, "Specialization constants\n");
|
||||
fprintf(stderr, "==================\n\n");
|
||||
for (auto &c : spec_constants)
|
||||
fprintf(stderr, "ID: %u, Spec ID: %u\n", c.id, c.constant_id);
|
||||
fprintf(stderr, "==================\n\n");
|
||||
}
|
||||
|
||||
struct PLSArg
|
||||
{
|
||||
PlsFormat format;
|
||||
|
@ -358,6 +401,12 @@ struct Remap
|
|||
unsigned components;
|
||||
};
|
||||
|
||||
struct VariableTypeRemap
|
||||
{
|
||||
string variable_name;
|
||||
string new_variable_type;
|
||||
};
|
||||
|
||||
struct CLIArguments
|
||||
{
|
||||
const char *input = nullptr;
|
||||
|
@ -375,21 +424,26 @@ struct CLIArguments
|
|||
vector<PLSArg> pls_out;
|
||||
vector<Remap> remaps;
|
||||
vector<string> extensions;
|
||||
vector<VariableTypeRemap> variable_type_remaps;
|
||||
string entry;
|
||||
|
||||
uint32_t iterations = 1;
|
||||
bool cpp = false;
|
||||
bool metal = false;
|
||||
bool vulkan_semantics = false;
|
||||
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] [--version <GLSL "
|
||||
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]\n");
|
||||
"[--extension ext] [--entry name] [--remove-unused-variables] "
|
||||
"[--remap-variable-type <variable_name> <new_variable_type>]\n");
|
||||
}
|
||||
|
||||
static bool remap_generic(Compiler &compiler, const vector<Resource> &resources, const Remap &remap)
|
||||
|
@ -498,6 +552,7 @@ 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; });
|
||||
|
@ -516,6 +571,12 @@ int main(int argc, char *argv[])
|
|||
args.remaps.push_back({ move(src), move(dst), components });
|
||||
});
|
||||
|
||||
cbs.add("--remap-variable-type", [&args](CLIParser &parser) {
|
||||
string var_name = parser.next_string();
|
||||
string new_type = parser.next_string();
|
||||
args.variable_type_remaps.push_back({ move(var_name), move(new_type) });
|
||||
});
|
||||
|
||||
cbs.add("--pls-in", [&args](CLIParser &parser) {
|
||||
auto fmt = pls_format(parser.next_string());
|
||||
auto name = parser.next_string();
|
||||
|
@ -527,6 +588,8 @@ int main(int argc, char *argv[])
|
|||
args.pls_out.push_back({ move(fmt), move(name) });
|
||||
});
|
||||
|
||||
cbs.add("--remove-unused-variables", [&args](CLIParser &) { args.remove_unused = true; });
|
||||
|
||||
cbs.default_handler = [&args](const char *value) { args.input = value; };
|
||||
cbs.error_handler = [] { print_help(); };
|
||||
|
||||
|
@ -549,6 +612,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
unique_ptr<CompilerGLSL> compiler;
|
||||
|
||||
bool combined_image_samplers = false;
|
||||
|
||||
if (args.cpp)
|
||||
{
|
||||
compiler = unique_ptr<CompilerGLSL>(new CompilerCPP(read_spirv_file(args.input)));
|
||||
|
@ -558,7 +623,21 @@ int main(int argc, char *argv[])
|
|||
else if (args.metal)
|
||||
compiler = unique_ptr<CompilerMSL>(new CompilerMSL(read_spirv_file(args.input)));
|
||||
else
|
||||
{
|
||||
combined_image_samplers = !args.vulkan_semantics;
|
||||
compiler = unique_ptr<CompilerGLSL>(new CompilerGLSL(read_spirv_file(args.input)));
|
||||
}
|
||||
|
||||
if (!args.variable_type_remaps.empty())
|
||||
{
|
||||
auto remap_cb = [&](const SPIRType &, const string &name, string &out) -> void {
|
||||
for (const VariableTypeRemap &remap : args.variable_type_remaps)
|
||||
if (name == remap.variable_name)
|
||||
out = remap.new_variable_type;
|
||||
};
|
||||
|
||||
compiler->set_variable_type_remap_callback(move(remap_cb));
|
||||
}
|
||||
|
||||
if (!args.entry.empty())
|
||||
compiler->set_entry_point(args.entry);
|
||||
|
@ -578,13 +657,26 @@ int main(int argc, char *argv[])
|
|||
opts.force_temporary = args.force_temporary;
|
||||
opts.vulkan_semantics = args.vulkan_semantics;
|
||||
opts.vertex.fixup_clipspace = args.fixup;
|
||||
opts.cfg_analysis = args.cfg_analysis;
|
||||
compiler->set_options(opts);
|
||||
|
||||
auto res = compiler->get_shader_resources();
|
||||
ShaderResources res;
|
||||
if (args.remove_unused)
|
||||
{
|
||||
auto active = compiler->get_active_interface_variables();
|
||||
res = compiler->get_shader_resources(active);
|
||||
compiler->set_enabled_interface_variables(move(active));
|
||||
}
|
||||
else
|
||||
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);
|
||||
|
@ -607,6 +699,18 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
print_resources(*compiler, res);
|
||||
print_push_constant_resources(*compiler, res.push_constant_buffers);
|
||||
print_spec_constants(*compiler);
|
||||
}
|
||||
|
||||
if (combined_image_samplers)
|
||||
{
|
||||
compiler->build_combined_image_samplers();
|
||||
// Give the remapped combined samplers new names.
|
||||
for (auto &remap : compiler->get_combined_image_samplers())
|
||||
{
|
||||
compiler->set_name(remap.combined_id, join("SPIRV_Cross_Combined", compiler->get_name(remap.image_id),
|
||||
compiler->get_name(remap.sampler_id)));
|
||||
}
|
||||
}
|
||||
|
||||
string glsl;
|
||||
|
|
|
@ -128,6 +128,7 @@
|
|||
<ClCompile Include="..\spirv_cross.cpp" />
|
||||
<ClCompile Include="..\spirv_glsl.cpp" />
|
||||
<ClCompile Include="..\spirv_msl.cpp" />
|
||||
<ClCompile Include="..\spirv_cfg.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GLSL.std.450.h" />
|
||||
|
@ -137,8 +138,9 @@
|
|||
<ClInclude Include="..\spirv_glsl.hpp" />
|
||||
<ClInclude Include="..\spirv.hpp" />
|
||||
<ClInclude Include="..\spirv_msl.hpp" />
|
||||
<ClInclude Include="..\spirv_cfg.hpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<ClCompile Include="..\spirv_msl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\spirv_cfg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GLSL.std.450.h">
|
||||
|
@ -53,5 +56,8 @@
|
|||
<ClInclude Include="..\spirv_msl.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\spirv_cfg.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -15,13 +15,13 @@ layout(binding = 1, std430) restrict buffer _4
|
|||
|
||||
void main()
|
||||
{
|
||||
_6._0 = (_5._1 + uvec4(_5._0));
|
||||
_6._0 = (uvec4(_5._0) + _5._1);
|
||||
_6._0 = (_5._1 + _5._1);
|
||||
_6._0 = _5._1 + uvec4(_5._0);
|
||||
_6._0 = uvec4(_5._0) + _5._1;
|
||||
_6._0 = _5._1 + _5._1;
|
||||
_6._0 = uvec4(_5._0 + _5._0);
|
||||
_6._1 = ivec4(_5._1 + _5._1);
|
||||
_6._1 = (_5._0 + _5._0);
|
||||
_6._1 = (ivec4(_5._1) + _5._0);
|
||||
_6._1 = (_5._0 + ivec4(_5._1));
|
||||
_6._1 = _5._0 + _5._0;
|
||||
_6._1 = ivec4(_5._1) + _5._0;
|
||||
_6._1 = _5._0 + ivec4(_5._1);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ void main()
|
|||
_6._0 = uvec4(_5._0 >> ivec4(_5._1));
|
||||
_6._0 = uvec4(ivec4(_5._1) >> ivec4(_5._1));
|
||||
_6._0 = uvec4(_5._0 >> _5._0);
|
||||
_6._1 = (ivec4(_5._1) >> ivec4(_5._1));
|
||||
_6._1 = (_5._0 >> _5._0);
|
||||
_6._1 = (ivec4(_5._1) >> _5._0);
|
||||
_6._1 = (_5._0 >> ivec4(_5._1));
|
||||
_6._1 = ivec4(_5._1) >> ivec4(_5._1);
|
||||
_6._1 = _5._0 >> _5._0;
|
||||
_6._1 = ivec4(_5._1) >> _5._0;
|
||||
_6._1 = _5._0 >> ivec4(_5._1);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ void main()
|
|||
_6._0 = uvec4(_5._0 / ivec4(_5._1));
|
||||
_6._0 = uvec4(ivec4(_5._1) / ivec4(_5._1));
|
||||
_6._0 = uvec4(_5._0 / _5._0);
|
||||
_6._1 = (ivec4(_5._1) / ivec4(_5._1));
|
||||
_6._1 = (_5._0 / _5._0);
|
||||
_6._1 = (ivec4(_5._1) / _5._0);
|
||||
_6._1 = (_5._0 / ivec4(_5._1));
|
||||
_6._1 = ivec4(_5._1) / ivec4(_5._1);
|
||||
_6._1 = _5._0 / _5._0;
|
||||
_6._1 = ivec4(_5._1) / _5._0;
|
||||
_6._1 = _5._0 / ivec4(_5._1);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ layout(binding = 1, std430) buffer _4
|
|||
|
||||
void main()
|
||||
{
|
||||
_6._0 = (_5._1 >> uvec4(_5._0));
|
||||
_6._0 = (uvec4(_5._0) >> _5._1);
|
||||
_6._0 = (_5._1 >> _5._1);
|
||||
_6._0 = (uvec4(_5._0) >> uvec4(_5._0));
|
||||
_6._0 = _5._1 >> uvec4(_5._0);
|
||||
_6._0 = uvec4(_5._0) >> _5._1;
|
||||
_6._0 = _5._1 >> _5._1;
|
||||
_6._0 = uvec4(_5._0) >> uvec4(_5._0);
|
||||
_6._1 = ivec4(_5._1 >> _5._1);
|
||||
_6._1 = ivec4(uvec4(_5._0) >> uvec4(_5._0));
|
||||
_6._1 = ivec4(_5._1 >> uvec4(_5._0));
|
||||
|
|
|
@ -15,10 +15,10 @@ layout(binding = 1, std430) buffer _4
|
|||
|
||||
void main()
|
||||
{
|
||||
_6._0 = (_5._1 / uvec4(_5._0));
|
||||
_6._0 = (uvec4(_5._0) / _5._1);
|
||||
_6._0 = (_5._1 / _5._1);
|
||||
_6._0 = (uvec4(_5._0) / uvec4(_5._0));
|
||||
_6._0 = _5._1 / uvec4(_5._0);
|
||||
_6._0 = uvec4(_5._0) / _5._1;
|
||||
_6._0 = _5._1 / _5._1;
|
||||
_6._0 = uvec4(_5._0) / uvec4(_5._0);
|
||||
_6._1 = ivec4(_5._1 / _5._1);
|
||||
_6._1 = ivec4(uvec4(_5._0) / uvec4(_5._0));
|
||||
_6._1 = ivec4(_5._1 / uvec4(_5._0));
|
||||
|
|
|
@ -15,13 +15,13 @@ layout(binding = 1, std430) restrict buffer _7
|
|||
|
||||
void main()
|
||||
{
|
||||
_9._0 = (_8._1 + uvec4(_8._0));
|
||||
_9._0 = (uvec4(_8._0) + _8._1);
|
||||
_9._0 = (_8._1 + _8._1);
|
||||
_9._0 = _8._1 + uvec4(_8._0);
|
||||
_9._0 = uvec4(_8._0) + _8._1;
|
||||
_9._0 = _8._1 + _8._1;
|
||||
_9._0 = uvec4(_8._0 + _8._0);
|
||||
_9._1 = ivec4(_8._1 + _8._1);
|
||||
_9._1 = (_8._0 + _8._0);
|
||||
_9._1 = (ivec4(_8._1) + _8._0);
|
||||
_9._1 = (_8._0 + ivec4(_8._1));
|
||||
_9._1 = _8._0 + _8._0;
|
||||
_9._1 = ivec4(_8._1) + _8._0;
|
||||
_9._1 = _8._0 + ivec4(_8._1);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ void main()
|
|||
float b = v1;
|
||||
float _17 = a;
|
||||
a = v1;
|
||||
FragColor = ((_17 + b) * b);
|
||||
FragColor = (_17 + b) * b;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,23 +14,23 @@ layout(binding = 3, rgba16f) uniform mediump writeonly image2D iGradJacobian;
|
|||
|
||||
mediump float jacobian(mediump vec2 dDdx, mediump vec2 dDdy)
|
||||
{
|
||||
return (((1.0 + dDdx.x) * (1.0 + dDdy.y)) - (dDdx.y * dDdy.x));
|
||||
return ((1.0 + dDdx.x) * (1.0 + dDdy.y)) - (dDdx.y * dDdy.x);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 uv = ((vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5));
|
||||
vec4 uv = (vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5);
|
||||
float h = textureLod(uHeight, uv.xy, 0.0).x;
|
||||
float x0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(-1, 0)).x;
|
||||
float x1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(1, 0)).x;
|
||||
float y0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, -1)).x;
|
||||
float y1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, 1)).x;
|
||||
vec2 grad = ((_46.uScale.xy * 0.5) * vec2((x1 - x0), (y1 - y0)));
|
||||
vec2 displacement = (textureLod(uDisplacement, uv.zw, 0.0).xy * 1.2000000476837158203125);
|
||||
vec2 dDdx = ((textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625);
|
||||
vec2 dDdy = ((textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625);
|
||||
vec2 param = (dDdx * _46.uScale.z);
|
||||
vec2 param_1 = (dDdy * _46.uScale.z);
|
||||
vec2 grad = (_46.uScale.xy * 0.5) * vec2(x1 - x0, y1 - y0);
|
||||
vec2 displacement = textureLod(uDisplacement, uv.zw, 0.0).xy * 1.2000000476837158203125;
|
||||
vec2 dDdx = (textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625;
|
||||
vec2 dDdy = (textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625;
|
||||
vec2 param = dDdx * _46.uScale.z;
|
||||
vec2 param_1 = dDdy * _46.uScale.z;
|
||||
float j = jacobian(param, param_1);
|
||||
displacement = vec2(0.0);
|
||||
imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(h, displacement, 0.0));
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
vec4 in_data[];
|
||||
} _23;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _45;
|
||||
|
@ -20,7 +20,7 @@ void main()
|
|||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
vec4 idata = _23.in_data[ident];
|
||||
if ((dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875))
|
||||
if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875)
|
||||
{
|
||||
uint _52 = atomicAdd(_48.counter, 1u);
|
||||
_45.out_data[_52] = idata;
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
{
|
||||
float data;
|
||||
} _11;
|
||||
|
||||
void test()
|
||||
{
|
||||
float m;
|
||||
if (_11.data != 0.0)
|
||||
{
|
||||
float tmp = 10.0;
|
||||
_11.data = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
float tmp_1 = 15.0;
|
||||
_11.data = tmp_1;
|
||||
}
|
||||
if (_11.data != 0.0)
|
||||
{
|
||||
float e;
|
||||
if (_11.data != 5.0)
|
||||
{
|
||||
if (_11.data != 6.0)
|
||||
{
|
||||
e = 10.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e = 20.0;
|
||||
}
|
||||
}
|
||||
switch (int(_11.data))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
float tmp_2 = 20.0;
|
||||
_11.data = tmp_2;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
float tmp_3 = 30.0;
|
||||
_11.data = tmp_3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float f;
|
||||
switch (int(_11.data))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
f = 30.0;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
f = 40.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float h;
|
||||
for (int i = 0; i < 20; i++, h += 10.0)
|
||||
{
|
||||
}
|
||||
_11.data = h;
|
||||
do
|
||||
{
|
||||
} while (m != 20.0);
|
||||
_11.data = m;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
test();
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ layout(binding = 1, std430) buffer SSBO1
|
|||
|
||||
vec4 summe(vec4 values[3][2])
|
||||
{
|
||||
return (((values[0][0] + values[2][1]) + values[0][1]) + values[1][0]);
|
||||
return ((values[0][0] + values[2][1]) + values[0][1]) + values[1][0];
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
float in_data[];
|
||||
} _22;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
float out_data[];
|
||||
} _38;
|
||||
|
@ -20,7 +20,7 @@ void main()
|
|||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
float idata = _22.in_data[ident];
|
||||
if ((idata > 12.0))
|
||||
if (idata > 12.0)
|
||||
{
|
||||
uint _45 = atomicAdd(_41.count, 1u);
|
||||
_38.out_data[_45] = idata;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
{
|
||||
vec4 data;
|
||||
int index;
|
||||
} _13;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 d = _13.data;
|
||||
_13.data = vec4(d.x, d.yz + vec2(10.0), d.w);
|
||||
_13.data = (d + d) + d;
|
||||
_13.data = (d.yz + vec2(10.0)).xxyy;
|
||||
float t = (d.yz + vec2(10.0)).y;
|
||||
_13.data = vec4(t);
|
||||
t = (d.zw + vec2(10.0))[_13.index];
|
||||
_13.data = vec4(t);
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
mat4 mvp;
|
||||
vec4 in_data[];
|
||||
} _28;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _52;
|
||||
|
@ -21,9 +21,9 @@ void main()
|
|||
vec4 idat = _28.in_data[ident];
|
||||
do
|
||||
{
|
||||
idat = (_28.mvp * idat);
|
||||
i = (i + 1);
|
||||
} while ((i < 16));
|
||||
idat = _28.mvp * idat;
|
||||
i++;
|
||||
} while (i < 16);
|
||||
_52.out_data[ident] = idat;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer Distribution
|
||||
layout(binding = 0, std430) readonly buffer Distribution
|
||||
{
|
||||
vec2 distribution[];
|
||||
} _190;
|
||||
|
@ -11,7 +11,7 @@ layout(binding = 2, std140) uniform UBO
|
|||
vec4 uModTime;
|
||||
} _218;
|
||||
|
||||
layout(binding = 1, std430) buffer HeightmapFFT
|
||||
layout(binding = 1, std430) writeonly buffer HeightmapFFT
|
||||
{
|
||||
uint heights[];
|
||||
} _276;
|
||||
|
@ -19,7 +19,6 @@ layout(binding = 1, std430) buffer HeightmapFFT
|
|||
uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel)
|
||||
{
|
||||
uint _137;
|
||||
uint _148;
|
||||
if (sel.x)
|
||||
{
|
||||
_137 = b.x;
|
||||
|
@ -29,6 +28,7 @@ uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel)
|
|||
_137 = a.x;
|
||||
}
|
||||
uint _147 = _137;
|
||||
uint _148;
|
||||
if (sel.y)
|
||||
{
|
||||
_148 = b.y;
|
||||
|
@ -42,17 +42,17 @@ uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel)
|
|||
|
||||
vec2 alias(vec2 i, vec2 N)
|
||||
{
|
||||
return mix(i, (i - N), greaterThan(i, (N * 0.5)));
|
||||
return mix(i, i - N, greaterThan(i, N * 0.5));
|
||||
}
|
||||
|
||||
vec2 cmul(vec2 a, vec2 b)
|
||||
{
|
||||
vec2 r3 = a.yx;
|
||||
vec2 r1 = b.xx;
|
||||
vec2 R0 = (a * r1);
|
||||
vec2 R0 = a * r1;
|
||||
vec2 r2 = b.yy;
|
||||
vec2 R1 = (r2 * r3);
|
||||
return (R0 + vec2((-R1.x), R1.y));
|
||||
vec2 R1 = r2 * r3;
|
||||
return R0 + vec2(-R1.x, R1.y);
|
||||
}
|
||||
|
||||
uint pack2(vec2 v)
|
||||
|
@ -62,19 +62,19 @@ uint pack2(vec2 v)
|
|||
|
||||
void generate_heightmap()
|
||||
{
|
||||
uvec2 N = (uvec2(64u, 1u) * gl_NumWorkGroups.xy);
|
||||
uvec2 N = uvec2(64u, 1u) * gl_NumWorkGroups.xy;
|
||||
uvec2 i = gl_GlobalInvocationID.xy;
|
||||
uvec2 param = (N - i);
|
||||
uvec2 param = N - i;
|
||||
uvec2 param_1 = uvec2(0u);
|
||||
bvec2 param_2 = equal(i, uvec2(0u));
|
||||
uvec2 wi = workaround_mix(param, param_1, param_2);
|
||||
vec2 a = _190.distribution[((i.y * N.x) + i.x)];
|
||||
vec2 b = _190.distribution[((wi.y * N.x) + wi.x)];
|
||||
vec2 a = _190.distribution[(i.y * N.x) + i.x];
|
||||
vec2 b = _190.distribution[(wi.y * N.x) + wi.x];
|
||||
vec2 param_3 = vec2(i);
|
||||
vec2 param_4 = vec2(N);
|
||||
vec2 k = (_218.uModTime.xy * alias(param_3, param_4));
|
||||
vec2 k = _218.uModTime.xy * alias(param_3, param_4);
|
||||
float k_len = length(k);
|
||||
float w = (sqrt((9.81000041961669921875 * k_len)) * _218.uModTime.z);
|
||||
float w = sqrt(9.81000041961669921875 * k_len) * _218.uModTime.z;
|
||||
float cw = cos(w);
|
||||
float sw = sin(w);
|
||||
vec2 param_5 = a;
|
||||
|
@ -83,10 +83,10 @@ void generate_heightmap()
|
|||
vec2 param_7 = b;
|
||||
vec2 param_8 = vec2(cw, sw);
|
||||
b = cmul(param_7, param_8);
|
||||
b = vec2(b.x, (-b.y));
|
||||
vec2 res = (a + b);
|
||||
b = vec2(b.x, -b.y);
|
||||
vec2 res = a + b;
|
||||
vec2 param_9 = res;
|
||||
_276.heights[((i.y * N.x) + i.x)] = pack2(param_9);
|
||||
_276.heights[(i.y * N.x) + i.x] = pack2(param_9);
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -6,7 +6,7 @@ layout(binding = 1, rgba8) uniform mediump writeonly image2D uImageOut;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec4 v = imageLoad(uImageIn, (ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn)));
|
||||
vec4 v = imageLoad(uImageIn, ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn));
|
||||
imageStore(uImageOut, ivec2(gl_GlobalInvocationID.xy), v);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
vec4 a;
|
||||
vec4 b;
|
||||
vec4 c;
|
||||
vec4 d;
|
||||
};
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
{
|
||||
vec4 data[];
|
||||
} indata;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
{
|
||||
vec4 data[];
|
||||
} outdata;
|
||||
|
||||
layout(binding = 2, std430) buffer SSBO3
|
||||
{
|
||||
Foo foos[];
|
||||
} foobar;
|
||||
|
||||
void baz(out Foo foo)
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
foo.a = indata.data[((4u * ident) + 0u)];
|
||||
foo.b = indata.data[((4u * ident) + 1u)];
|
||||
foo.c = indata.data[((4u * ident) + 2u)];
|
||||
foo.d = indata.data[((4u * ident) + 3u)];
|
||||
}
|
||||
|
||||
void meow(inout Foo foo)
|
||||
{
|
||||
foo.a = (foo.a + vec4(10.0));
|
||||
foo.b = (foo.b + vec4(20.0));
|
||||
foo.c = (foo.c + vec4(30.0));
|
||||
foo.d = (foo.d + vec4(40.0));
|
||||
}
|
||||
|
||||
vec4 bar(Foo foo)
|
||||
{
|
||||
return (((foo.a + foo.b) + foo.c) + foo.d);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
Foo param;
|
||||
baz(param);
|
||||
Foo foo = param;
|
||||
Foo param_1 = foo;
|
||||
meow(param_1);
|
||||
foo = param_1;
|
||||
Foo param_2 = foo;
|
||||
Foo param_3 = foobar.foos[gl_GlobalInvocationID.x];
|
||||
outdata.data[gl_GlobalInvocationID.x] = (bar(param_2) + bar(param_3));
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
vec4 a;
|
||||
vec4 b;
|
||||
vec4 c;
|
||||
vec4 d;
|
||||
};
|
||||
|
||||
layout(binding = 1, std430) readonly buffer SSBO2
|
||||
{
|
||||
vec4 data[];
|
||||
} indata;
|
||||
|
||||
layout(binding = 0, std430) writeonly buffer SSBO
|
||||
{
|
||||
vec4 data[];
|
||||
} outdata;
|
||||
|
||||
layout(binding = 2, std430) readonly buffer SSBO3
|
||||
{
|
||||
Foo foos[];
|
||||
} foobar;
|
||||
|
||||
void baz(out Foo foo)
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
foo.a = indata.data[(4u * ident) + 0u];
|
||||
foo.b = indata.data[(4u * ident) + 1u];
|
||||
foo.c = indata.data[(4u * ident) + 2u];
|
||||
foo.d = indata.data[(4u * ident) + 3u];
|
||||
}
|
||||
|
||||
void meow(inout Foo foo)
|
||||
{
|
||||
foo.a += vec4(10.0);
|
||||
foo.b += vec4(20.0);
|
||||
foo.c += vec4(30.0);
|
||||
foo.d += vec4(40.0);
|
||||
}
|
||||
|
||||
vec4 bar(Foo foo)
|
||||
{
|
||||
return ((foo.a + foo.b) + foo.c) + foo.d;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
Foo param;
|
||||
baz(param);
|
||||
Foo foo = param;
|
||||
Foo param_1 = foo;
|
||||
meow(param_1);
|
||||
foo = param_1;
|
||||
Foo param_2 = foo;
|
||||
Foo param_3;
|
||||
param_3.a = foobar.foos[gl_GlobalInvocationID.x].a;
|
||||
param_3.b = foobar.foos[gl_GlobalInvocationID.x].b;
|
||||
param_3.c = foobar.foos[gl_GlobalInvocationID.x].c;
|
||||
param_3.d = foobar.foos[gl_GlobalInvocationID.x].d;
|
||||
outdata.data[gl_GlobalInvocationID.x] = bar(param_2) + bar(param_3);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) writeonly buffer SSBO
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _27;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
mat4 mvp;
|
||||
vec4 in_data[];
|
||||
} _24;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _177;
|
||||
|
@ -18,16 +18,13 @@ void main()
|
|||
vec4 idat = _24.in_data[ident];
|
||||
int k = 0;
|
||||
uint i = 0u;
|
||||
uint i_1;
|
||||
uint j;
|
||||
int l;
|
||||
if ((idat.y == 20.0))
|
||||
if (idat.y == 20.0)
|
||||
{
|
||||
do
|
||||
{
|
||||
k = (k * 2);
|
||||
i = (i + uint(1));
|
||||
} while ((i < ident));
|
||||
k *= 2;
|
||||
i++;
|
||||
} while (i < ident);
|
||||
}
|
||||
switch (k)
|
||||
{
|
||||
|
@ -35,8 +32,8 @@ void main()
|
|||
{
|
||||
for (;;)
|
||||
{
|
||||
i = (i + uint(1));
|
||||
if ((i > 10u))
|
||||
i++;
|
||||
if (i > 10u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -48,8 +45,8 @@ void main()
|
|||
{
|
||||
for (;;)
|
||||
{
|
||||
i = (i + 2u);
|
||||
if ((i > 20u))
|
||||
i += 2u;
|
||||
if (i > 20u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -58,51 +55,49 @@ void main()
|
|||
break;
|
||||
}
|
||||
}
|
||||
while ((k < 10))
|
||||
while (k < 10)
|
||||
{
|
||||
idat = (idat * 2.0);
|
||||
k = (k + 1);
|
||||
idat *= 2.0;
|
||||
k++;
|
||||
}
|
||||
i_1 = 0u;
|
||||
for (; (i_1 < 16u); i_1 = (i_1 + uint(1)), k = (k + 1))
|
||||
for (uint i_1 = 0u; i_1 < 16u; i_1++, k++)
|
||||
{
|
||||
j = 0u;
|
||||
for (; (j < 30u); j = (j + uint(1)))
|
||||
for (uint j = 0u; j < 30u; j++)
|
||||
{
|
||||
idat = (_24.mvp * idat);
|
||||
idat = _24.mvp * idat;
|
||||
}
|
||||
}
|
||||
k = 0;
|
||||
for (;;)
|
||||
{
|
||||
k = (k + 1);
|
||||
if ((k > 10))
|
||||
k++;
|
||||
if (k > 10)
|
||||
{
|
||||
k = (k + 2);
|
||||
k += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
k = (k + 3);
|
||||
k += 3;
|
||||
continue;
|
||||
}
|
||||
k = (k + 10);
|
||||
k += 10;
|
||||
continue;
|
||||
}
|
||||
k = 0;
|
||||
do
|
||||
{
|
||||
k = (k + 1);
|
||||
} while ((k > 10));
|
||||
l = 0;
|
||||
k++;
|
||||
} while (k > 10);
|
||||
int l = 0;
|
||||
for (;;)
|
||||
{
|
||||
if ((l == 5))
|
||||
if (l == 5)
|
||||
{
|
||||
l = (l + 1);
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
idat = (idat + vec4(1.0));
|
||||
l = (l + 1);
|
||||
idat += vec4(1.0);
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
_177.out_data[ident] = idat;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
mat3 out_data[];
|
||||
} _22;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
vec4 in_data[];
|
||||
} _23;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _33;
|
||||
|
@ -16,9 +16,9 @@ void main()
|
|||
uint ident = gl_GlobalInvocationID.x;
|
||||
vec4 v = mod(_23.in_data[ident], _33.out_data[ident]);
|
||||
_33.out_data[ident] = v;
|
||||
uvec4 vu = (floatBitsToUint(_23.in_data[ident]) % floatBitsToUint(_33.out_data[ident]));
|
||||
uvec4 vu = floatBitsToUint(_23.in_data[ident]) % floatBitsToUint(_33.out_data[ident]);
|
||||
_33.out_data[ident] = uintBitsToFloat(vu);
|
||||
ivec4 vi = (floatBitsToInt(_23.in_data[ident]) % floatBitsToInt(_33.out_data[ident]));
|
||||
ivec4 vi = floatBitsToInt(_23.in_data[ident]) % floatBitsToInt(_33.out_data[ident]);
|
||||
_33.out_data[ident] = intBitsToFloat(vi);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
vec4 in_data[];
|
||||
} _23;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _35;
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 2, std430) restrict writeonly buffer SSBO2
|
||||
{
|
||||
vec4 data4;
|
||||
vec4 data5;
|
||||
} _10;
|
||||
|
||||
layout(binding = 0, std430) readonly buffer SSBO0
|
||||
{
|
||||
vec4 data0;
|
||||
vec4 data1;
|
||||
} _15;
|
||||
|
||||
layout(binding = 1, std430) restrict buffer SSBO1
|
||||
{
|
||||
vec4 data2;
|
||||
vec4 data3;
|
||||
} _21;
|
||||
|
||||
void main()
|
||||
{
|
||||
_10.data4 = _15.data0 + _21.data2;
|
||||
_10.data5 = _15.data1 + _21.data3;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _27;
|
||||
|
@ -9,23 +9,21 @@ layout(binding = 1, std430) buffer SSBO2
|
|||
void main()
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
int i;
|
||||
if ((ident == 2u))
|
||||
if (ident == 2u)
|
||||
{
|
||||
_27.out_data[ident] = vec4(20.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ident == 4u))
|
||||
if (ident == 4u)
|
||||
{
|
||||
_27.out_data[ident] = vec4(10.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
for (; (i < 20); i = (i + 1))
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if ((i == 10))
|
||||
if (i == 10)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
float in_data[];
|
||||
} _22;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
float out_data[];
|
||||
} _43;
|
||||
} _44;
|
||||
|
||||
shared float sShared[4];
|
||||
|
||||
|
@ -20,6 +20,6 @@ void main()
|
|||
sShared[gl_LocalInvocationIndex] = idata;
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
_43.out_data[ident] = sShared[((4u - gl_LocalInvocationIndex) - 1u)];
|
||||
_44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u];
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ struct Foo
|
|||
mat4 m;
|
||||
};
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
Foo out_data[];
|
||||
} _23;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
Foo in_data[];
|
||||
} _30;
|
||||
|
@ -19,6 +19,6 @@ layout(binding = 0, std430) buffer SSBO
|
|||
void main()
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
_23.out_data[ident].m = (_30.in_data[ident].m * _30.in_data[ident].m);
|
||||
_23.out_data[ident].m = _30.in_data[ident].m * _30.in_data[ident].m;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@ struct S3
|
|||
float b;
|
||||
};
|
||||
|
||||
struct S4
|
||||
{
|
||||
vec2 c;
|
||||
};
|
||||
|
||||
struct Content
|
||||
{
|
||||
S0 m0s[1];
|
||||
|
@ -35,6 +40,7 @@ struct Content
|
|||
S2 m2;
|
||||
S3 m3;
|
||||
float m4;
|
||||
S4 m3s[8];
|
||||
};
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO1
|
||||
|
@ -63,6 +69,28 @@ layout(binding = 0, std140) buffer SSBO0
|
|||
|
||||
void main()
|
||||
{
|
||||
ssbo_430.content = ssbo_140.content;
|
||||
ssbo_430.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0];
|
||||
ssbo_430.content.m0s[0].b = ssbo_140.content.m0s[0].b;
|
||||
ssbo_430.content.m1s[0].a = ssbo_140.content.m1s[0].a;
|
||||
ssbo_430.content.m1s[0].b = ssbo_140.content.m1s[0].b;
|
||||
ssbo_430.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0];
|
||||
ssbo_430.content.m2s[0].b = ssbo_140.content.m2s[0].b;
|
||||
ssbo_430.content.m0.a[0] = ssbo_140.content.m0.a[0];
|
||||
ssbo_430.content.m0.b = ssbo_140.content.m0.b;
|
||||
ssbo_430.content.m1.a = ssbo_140.content.m1.a;
|
||||
ssbo_430.content.m1.b = ssbo_140.content.m1.b;
|
||||
ssbo_430.content.m2.a[0] = ssbo_140.content.m2.a[0];
|
||||
ssbo_430.content.m2.b = ssbo_140.content.m2.b;
|
||||
ssbo_430.content.m3.a = ssbo_140.content.m3.a;
|
||||
ssbo_430.content.m3.b = ssbo_140.content.m3.b;
|
||||
ssbo_430.content.m4 = ssbo_140.content.m4;
|
||||
ssbo_430.content.m3s[0].c = ssbo_140.content.m3s[0].c;
|
||||
ssbo_430.content.m3s[1].c = ssbo_140.content.m3s[1].c;
|
||||
ssbo_430.content.m3s[2].c = ssbo_140.content.m3s[2].c;
|
||||
ssbo_430.content.m3s[3].c = ssbo_140.content.m3s[3].c;
|
||||
ssbo_430.content.m3s[4].c = ssbo_140.content.m3s[4].c;
|
||||
ssbo_430.content.m3s[5].c = ssbo_140.content.m3s[5].c;
|
||||
ssbo_430.content.m3s[6].c = ssbo_140.content.m3s[6].c;
|
||||
ssbo_430.content.m3s[7].c = ssbo_140.content.m3s[7].c;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
mat4 mvp;
|
||||
vec4 in_data[];
|
||||
} _24;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO2
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _89;
|
||||
|
@ -17,17 +17,15 @@ void main()
|
|||
uint ident = gl_GlobalInvocationID.x;
|
||||
vec4 idat = _24.in_data[ident];
|
||||
int k = 0;
|
||||
uint i;
|
||||
uint j;
|
||||
for (;;)
|
||||
{
|
||||
int _39 = k;
|
||||
int _40 = _39 + 1;
|
||||
k = _40;
|
||||
if ((_40 < 10))
|
||||
if (_40 < 10)
|
||||
{
|
||||
idat = (idat * 2.0);
|
||||
k = (k + 1);
|
||||
idat *= 2.0;
|
||||
k++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
@ -35,19 +33,17 @@ void main()
|
|||
break;
|
||||
}
|
||||
}
|
||||
i = 0u;
|
||||
for (; (i < 16u); i = (i + uint(1)), k = (k + 1))
|
||||
for (uint i = 0u; i < 16u; i++, k++)
|
||||
{
|
||||
j = 0u;
|
||||
for (; (j < 30u); j = (j + uint(1)))
|
||||
for (uint j = 0u; j < 30u; j++)
|
||||
{
|
||||
idat = (_24.mvp * idat);
|
||||
idat = _24.mvp * idat;
|
||||
}
|
||||
}
|
||||
do
|
||||
{
|
||||
k = (k + 1);
|
||||
} while ((k > 10));
|
||||
k++;
|
||||
} while (k > 10);
|
||||
_89.out_data[ident] = idat;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ layout(binding = 0, std430) buffer SSBO0
|
|||
layout(binding = 1, std430) buffer SSBO1
|
||||
{
|
||||
S1 s1s[];
|
||||
} _53;
|
||||
} _55;
|
||||
|
||||
layout(binding = 2, std430) buffer SSBO2
|
||||
{
|
||||
vec4 outputs[];
|
||||
} _62;
|
||||
} _66;
|
||||
|
||||
vec4 overload(S0 s0)
|
||||
{
|
||||
|
@ -38,10 +38,12 @@ vec4 overload(S1 s1)
|
|||
|
||||
void main()
|
||||
{
|
||||
S0 s0 = _36.s0s[gl_GlobalInvocationID.x];
|
||||
S1 s1 = _53.s1s[gl_GlobalInvocationID.x];
|
||||
S0 s0;
|
||||
s0.a = _36.s0s[gl_GlobalInvocationID.x].a;
|
||||
S1 s1;
|
||||
s1.a = _55.s1s[gl_GlobalInvocationID.x].a;
|
||||
S0 param = s0;
|
||||
S1 param_1 = s1;
|
||||
_62.outputs[gl_GlobalInvocationID.x] = (overload(param) + overload(param_1));
|
||||
_66.outputs[gl_GlobalInvocationID.x] = overload(param) + overload(param_1);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ layout(binding = 0, std430) buffer SSBO
|
|||
|
||||
void main()
|
||||
{
|
||||
_10.outputs[gl_GlobalInvocationID.x] = (_23.inputs[gl_GlobalInvocationID.x] / 29u);
|
||||
_10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ layout(binding = 3, std140) buffer SSBO3
|
|||
|
||||
void main()
|
||||
{
|
||||
ssbo_0.a = (ssbo_0.a + dvec4(10.0lf, 20.0lf, 30.0lf, 40.0lf));
|
||||
ssbo_0.a = (ssbo_0.a + dvec4(20.0lf));
|
||||
ssbo_0.a += dvec4(10.0lf, 20.0lf, 30.0lf, 40.0lf);
|
||||
ssbo_0.a += dvec4(20.0lf);
|
||||
dvec4 a = ssbo_0.a;
|
||||
dmat4 amat = ssbo_0.b;
|
||||
ssbo_0.a = abs(a);
|
||||
|
@ -68,7 +68,7 @@ void main()
|
|||
a = faceforward(a, a, a);
|
||||
a = reflect(a, a);
|
||||
a = refract(a, a, a.x);
|
||||
dmat4 l = dmat4((amat[0] * amat[0]), (amat[1] * amat[1]), (amat[2] * amat[2]), (amat[3] * amat[3]));
|
||||
dmat4 l = dmat4(amat[0] * amat[0], amat[1] * amat[1], amat[2] * amat[2], amat[3] * amat[3]);
|
||||
l = outerProduct(a, a);
|
||||
l = transpose(l);
|
||||
double m = determinant(l);
|
||||
|
@ -77,5 +77,8 @@ void main()
|
|||
k = lessThanEqual(a, a);
|
||||
k = greaterThan(a, a);
|
||||
k = greaterThanEqual(a, a);
|
||||
ssbo_1.b.x += 1.0lf;
|
||||
ssbo_2.b[0].x += 1.0lf;
|
||||
ssbo_3.b[0].x += 1.0lf;
|
||||
}
|
||||
|
|
@ -36,15 +36,17 @@ layout(binding = 3, std140) buffer SSBO3
|
|||
|
||||
void main()
|
||||
{
|
||||
ssbo_0.a = (ssbo_0.a + i64vec4(10l, 20l, 30l, 40l));
|
||||
ssbo_1.b = (ssbo_1.b + u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul));
|
||||
ssbo_0.a = (ssbo_0.a + i64vec4(20l));
|
||||
ssbo_0.a = abs((ssbo_0.a + i64vec4(ssbo_1.b)));
|
||||
ssbo_0.a = (ssbo_0.a + i64vec4(1l));
|
||||
ssbo_1.b = (ssbo_1.b + u64vec4(i64vec4(1l)));
|
||||
ssbo_0.a = (ssbo_0.a - i64vec4(1l));
|
||||
ssbo_1.b = (ssbo_1.b - u64vec4(i64vec4(1l)));
|
||||
ssbo_0.a += i64vec4(10l, 20l, 30l, 40l);
|
||||
ssbo_1.b += u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul);
|
||||
ssbo_0.a += i64vec4(20l);
|
||||
ssbo_0.a = abs(ssbo_0.a + i64vec4(ssbo_1.b));
|
||||
ssbo_0.a += i64vec4(1l);
|
||||
ssbo_1.b += u64vec4(i64vec4(1l));
|
||||
ssbo_0.a -= i64vec4(1l);
|
||||
ssbo_1.b -= u64vec4(i64vec4(1l));
|
||||
ssbo_1.b = doubleBitsToUint64(int64BitsToDouble(ssbo_0.a));
|
||||
ssbo_0.a = doubleBitsToInt64(uint64BitsToDouble(ssbo_1.b));
|
||||
ssbo_2.a[0] += 1l;
|
||||
ssbo_3.a[0] += 2l;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
in VertexData
|
||||
{
|
||||
layout(location = 0) flat float f;
|
||||
layout(location = 1) centroid vec4 g;
|
||||
layout(location = 2) flat int h;
|
||||
layout(location = 3) float i;
|
||||
} vin;
|
||||
|
||||
layout(location = 4) in flat float f;
|
||||
layout(location = 5) in centroid vec4 g;
|
||||
layout(location = 6) in flat int h;
|
||||
layout(location = 7) in sample float i;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = ((((((vec4(vin.f) + vin.g) + vec4(float(vin.h))) + vec4(vin.i)) + vec4(f)) + g) + vec4(float(h))) + vec4(i);
|
||||
}
|
||||
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(float((((textureSamples(uSampler) + textureSamples(uSamplerArray)) + imageSamples(uImage)) + imageSamples(uImageArray))));
|
||||
FragColor = vec4(float(((textureSamples(uSampler) + textureSamples(uSamplerArray)) + imageSamples(uImage)) + imageSamples(uImageArray)));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#version 450
|
||||
|
||||
out VertexData
|
||||
{
|
||||
layout(location = 0) flat float f;
|
||||
layout(location = 1) centroid vec4 g;
|
||||
layout(location = 2) flat int h;
|
||||
layout(location = 3) float i;
|
||||
} vout;
|
||||
|
||||
layout(location = 4) out flat float f;
|
||||
layout(location = 5) out centroid vec4 g;
|
||||
layout(location = 6) out flat int h;
|
||||
layout(location = 7) out float i;
|
||||
|
||||
void main()
|
||||
{
|
||||
vout.f = 10.0;
|
||||
vout.g = vec4(20.0);
|
||||
vout.h = 20;
|
||||
vout.i = 30.0;
|
||||
f = 10.0;
|
||||
g = vec4(20.0);
|
||||
h = 20;
|
||||
i = 30.0;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 UBO[56];
|
||||
in vec4 aVertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 a4 = UBO[23];
|
||||
vec4 offset = (UBO[50] + UBO[45]) + vec4(UBO[54].x);
|
||||
gl_Position = ((mat4(UBO[40], UBO[41], UBO[42], UBO[43]) * aVertex) + UBO[55]) + offset;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 UBO[4];
|
||||
in vec4 aVertex;
|
||||
out vec3 vNormal;
|
||||
in vec3 aNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#version 310 es
|
||||
|
||||
struct Light
|
||||
{
|
||||
vec3 Position;
|
||||
float Radius;
|
||||
vec4 Color;
|
||||
};
|
||||
|
||||
uniform vec4 UBO[12];
|
||||
in vec4 aVertex;
|
||||
out vec4 vColor;
|
||||
in vec3 aNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
|
||||
vColor = vec4(0.0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Light light;
|
||||
light.Position = Light(UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]).Position;
|
||||
light.Radius = Light(UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]).Radius;
|
||||
light.Color = Light(UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]).Color;
|
||||
vec3 L = aVertex.xyz - light.Position;
|
||||
vColor += (((UBO[i * 2 + 5]) * clamp(1.0 - (length(L) / light.Radius), 0.0, 1.0)) * dot(aNormal, normalize(L)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#version 310 es
|
||||
|
||||
struct Light
|
||||
{
|
||||
vec3 Position;
|
||||
float Radius;
|
||||
vec4 Color;
|
||||
};
|
||||
|
||||
uniform vec4 UBO[12];
|
||||
in vec4 aVertex;
|
||||
out vec4 vColor;
|
||||
in vec3 aNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
|
||||
vColor = vec4(0.0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vec3 L = aVertex.xyz - (UBO[i * 2 + 4].xyz);
|
||||
vColor += (((UBO[i * 2 + 5]) * clamp(1.0 - (length(L) / (UBO[i * 2 + 4].w)), 0.0, 1.0)) * dot(aNormal, normalize(L)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 UBO[15];
|
||||
in ivec2 aIndex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0];
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 PushMe[6];
|
||||
layout(location = 1) in vec4 Pos;
|
||||
layout(location = 0) out vec2 vRot;
|
||||
layout(location = 0) in vec2 Rot;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(PushMe[0], PushMe[1], PushMe[2], PushMe[3]) * Pos;
|
||||
vRot = (mat2(PushMe[4].xy, PushMe[4].zw) * Rot) + vec2(PushMe[5].z);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 UBO[12];
|
||||
in vec4 aVertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 v = mat4x2(UBO[8].xy, UBO[9].xy, UBO[10].xy, UBO[11].xy) * aVertex;
|
||||
gl_Position = (mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex) + (aVertex * mat4(UBO[4], UBO[5], UBO[6], UBO[7]));
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#version 310 es
|
||||
|
||||
struct Light
|
||||
{
|
||||
vec3 Position;
|
||||
float Radius;
|
||||
vec4 Color;
|
||||
};
|
||||
|
||||
uniform vec4 UBO[6];
|
||||
in vec4 aVertex;
|
||||
out vec4 vColor;
|
||||
in vec3 aNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
|
||||
vColor = vec4(0.0);
|
||||
vec3 L = aVertex.xyz - UBO[4].xyz;
|
||||
vColor += ((UBO[5] * clamp(1.0 - (length(L) / UBO[4].w), 0.0, 1.0)) * dot(aNormal, normalize(L)));
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#version 310 es
|
||||
|
||||
struct Foo
|
||||
{
|
||||
mat3x4 MVP0;
|
||||
mat3x4 MVP1;
|
||||
};
|
||||
|
||||
uniform vec4 UBO[8];
|
||||
layout(location = 0) in vec4 v0;
|
||||
layout(location = 1) in vec4 v1;
|
||||
layout(location = 0) out vec3 V0;
|
||||
layout(location = 1) out vec3 V1;
|
||||
|
||||
void main()
|
||||
{
|
||||
Foo f;
|
||||
f.MVP0 = Foo(transpose(mat4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(mat4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))).MVP0;
|
||||
f.MVP1 = Foo(transpose(mat4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(mat4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))).MVP1;
|
||||
vec3 a = v0 * f.MVP0;
|
||||
vec3 b = v1 * f.MVP1;
|
||||
V0 = a;
|
||||
V1 = b;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#version 310 es
|
||||
|
||||
uniform vec4 UBO[8];
|
||||
out vec4 oA;
|
||||
out vec4 oB;
|
||||
out vec4 oC;
|
||||
out vec4 oD;
|
||||
out vec4 oE;
|
||||
out vec4 oF;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(0.0);
|
||||
oA = UBO[0];
|
||||
oB = vec4(UBO[1].xy, UBO[1].zw);
|
||||
oC = vec4(UBO[2].x, UBO[3].xyz);
|
||||
oD = vec4(UBO[4].xyz, UBO[4].w);
|
||||
oE = vec4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w);
|
||||
oF = vec4(UBO[6].x, UBO[6].zw, UBO[7].x);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
uniform mediump ivec4 UBO1[2];
|
||||
uniform mediump uvec4 UBO2[2];
|
||||
uniform vec4 UBO0[2];
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = ((((vec4(UBO1[0]) + vec4(UBO1[1])) + vec4(UBO2[0])) + vec4(UBO2[1])) + UBO0[0]) + UBO0[1];
|
||||
}
|
||||
|
|
@ -10,6 +10,6 @@ in vec2 vTex;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (vColor * texture(uTex, vTex));
|
||||
FragColor = vColor * texture(uTex, vTex);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
void main()
|
||||
{
|
||||
float f = texture(Texture, vTexCoord).x;
|
||||
FragColor = vec4((f * f));
|
||||
FragColor = vec4(f * f);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ layout(location = 0) in mediump flat int index;
|
|||
|
||||
vec4 resolve(Foobar f)
|
||||
{
|
||||
return vec4((f.a + f.b));
|
||||
return vec4(f.a + f.b);
|
||||
}
|
||||
|
||||
void main()
|
||||
|
@ -23,6 +23,6 @@ void main()
|
|||
Foobar param = Foobar(10.0, 20.0);
|
||||
Foobar indexable_2[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0));
|
||||
Foobar param_1 = indexable_2[index];
|
||||
FragColor = (((indexable[index] + indexable_1[index][(index + 1)]) + resolve(param)) + resolve(param_1));
|
||||
FragColor = ((indexable[index] + (indexable_1[index][index + 1])) + resolve(param)) + resolve(param_1);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) out mediump int FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = 16;
|
||||
for (mediump int i = 0; i < 25; i++)
|
||||
{
|
||||
FragColor += 10;
|
||||
}
|
||||
for (mediump int i_1 = 1, j = 4; i_1 < 30; i_1++, j += 4)
|
||||
{
|
||||
FragColor += 11;
|
||||
}
|
||||
mediump int k = 0;
|
||||
for (; k < 20; k++)
|
||||
{
|
||||
FragColor += 12;
|
||||
}
|
||||
k += 3;
|
||||
FragColor += k;
|
||||
mediump int l;
|
||||
if (k == 40)
|
||||
{
|
||||
l = 0;
|
||||
for (; l < 40; l++)
|
||||
{
|
||||
FragColor += 13;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = k;
|
||||
FragColor += l;
|
||||
}
|
||||
mediump ivec2 i_2 = ivec2(0);
|
||||
for (; i_2.x < 10; i_2.x += 4)
|
||||
{
|
||||
FragColor += i_2.y;
|
||||
}
|
||||
mediump int o = k;
|
||||
for (mediump int m = k; m < 40; m++)
|
||||
{
|
||||
FragColor += m;
|
||||
}
|
||||
FragColor += o;
|
||||
}
|
||||
|
|
@ -29,16 +29,16 @@ float saturate(float x)
|
|||
void Resolve(vec3 Albedo, vec3 Normal, float Roughness, float Metallic)
|
||||
{
|
||||
LightingOut = vec4(0.0);
|
||||
NormalOut = vec4(((Normal * 0.5) + vec3(0.5)), 0.0);
|
||||
NormalOut = vec4((Normal * 0.5) + vec3(0.5), 0.0);
|
||||
SpecularOut = vec4(Roughness, Metallic, 0.0, 0.0);
|
||||
AlbedoOut = vec4(Albedo, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Normal = ((texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0));
|
||||
vec3 Normal = (texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0);
|
||||
Normal = normalize(Normal);
|
||||
highp float param = (length(EyeVec) / 1000.0);
|
||||
highp float param = length(EyeVec) / 1000.0;
|
||||
vec2 scatter_uv;
|
||||
scatter_uv.x = saturate(param);
|
||||
vec3 nEye = normalize(EyeVec);
|
||||
|
@ -47,12 +47,12 @@ void main()
|
|||
vec3 grass = vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625);
|
||||
vec3 dirt = vec3(0.100000001490116119384765625);
|
||||
vec3 snow = vec3(0.800000011920928955078125);
|
||||
float grass_snow = smoothstep(0.0, 0.1500000059604644775390625, ((_56.g_CamPos.y + EyeVec.y) / 200.0));
|
||||
float grass_snow = smoothstep(0.0, 0.1500000059604644775390625, (_56.g_CamPos.y + EyeVec.y) / 200.0);
|
||||
vec3 base = mix(grass, snow, vec3(grass_snow));
|
||||
float edge = smoothstep(0.699999988079071044921875, 0.75, Normal.y);
|
||||
Color = mix(dirt, base, vec3(edge));
|
||||
Color = (Color * Color);
|
||||
float Roughness = (1.0 - (edge * grass_snow));
|
||||
Color *= Color;
|
||||
float Roughness = 1.0 - (edge * grass_snow);
|
||||
highp vec3 param_1 = Color;
|
||||
highp vec3 param_2 = Normal;
|
||||
highp float param_3 = Roughness;
|
||||
|
|
|
@ -15,7 +15,6 @@ void main()
|
|||
bool f = true;
|
||||
FragColor = vec4(mix(vIn2, vIn3, f));
|
||||
highp vec4 _35;
|
||||
highp float _44;
|
||||
if (f)
|
||||
{
|
||||
_35 = vIn0;
|
||||
|
@ -25,6 +24,7 @@ void main()
|
|||
_35 = vIn1;
|
||||
}
|
||||
FragColor = _35;
|
||||
highp float _44;
|
||||
if (f)
|
||||
{
|
||||
_44 = vIn2;
|
||||
|
|
|
@ -13,9 +13,9 @@ in vec4 PLSIn3;
|
|||
|
||||
void main()
|
||||
{
|
||||
PLSOut0 = (PLSIn0 * 2.0);
|
||||
PLSOut1 = (PLSIn1 * 6.0);
|
||||
PLSOut2 = (PLSIn2 * 7.0);
|
||||
PLSOut3 = (PLSIn3 * 4.0);
|
||||
PLSOut0 = PLSIn0 * 2.0;
|
||||
PLSOut1 = PLSIn1 * 6.0;
|
||||
PLSOut2 = PLSIn2 * 7.0;
|
||||
PLSOut3 = PLSIn3 * 4.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
void main()
|
||||
{
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
FragColor = (((texelFetch(uSampler, coord, 0) + texelFetch(uSampler, coord, 1)) + texelFetch(uSampler, coord, 2)) + texelFetch(uSampler, coord, 3));
|
||||
FragColor = ((texelFetch(uSampler, coord, 0) + texelFetch(uSampler, coord, 1)) + texelFetch(uSampler, coord, 2)) + texelFetch(uSampler, coord, 3);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ vec4 sample_texture(mediump sampler2D tex, vec2 uv)
|
|||
void main()
|
||||
{
|
||||
highp vec2 param = vTex;
|
||||
FragColor = (vColor * sample_texture(uTex, param));
|
||||
FragColor = vColor * sample_texture(uTex, param);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ void main()
|
|||
{
|
||||
FragColor = vec4(texture(samp, vUV).xyz, 1.0);
|
||||
FragColor = vec4(texture(samp, vUV).xz, 1.0, 4.0);
|
||||
FragColor = vec4(texture(samp, vUV).xx, texture(samp, (vUV + vec2(0.100000001490116119384765625))).yy);
|
||||
FragColor = vec4(texture(samp, vUV).xx, texture(samp, vUV + vec2(0.100000001490116119384765625)).yy);
|
||||
FragColor = vec4(vNormal, 1.0);
|
||||
FragColor = vec4((vNormal + vec3(1.7999999523162841796875)), 1.0);
|
||||
FragColor = vec4(vUV, (vUV + vec2(1.7999999523162841796875)));
|
||||
FragColor = vec4(vNormal + vec3(1.7999999523162841796875), 1.0);
|
||||
FragColor = vec4(vUV, vUV + vec2(1.7999999523162841796875));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (ubo1.foo.foo[0] + ubo0.foo.foo[0]);
|
||||
FragColor = ubo1.foo.foo[0] + ubo0.foo.foo[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ in VertexData
|
|||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = (vin[0].normal + vec3(float(gl_InvocationID)));
|
||||
vNormal = vin[0].normal + vec3(float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
vNormal = (vin[1].normal + vec3((4.0 * float(gl_InvocationID))));
|
||||
vNormal = vin[1].normal + vec3(4.0 * float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
vNormal = (vin[2].normal + vec3((2.0 * float(gl_InvocationID))));
|
||||
vNormal = vin[2].normal + vec3(2.0 * float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(lines_adjacency) in;
|
||||
layout(max_vertices = 3, line_strip) out;
|
||||
|
||||
out vec3 vNormal;
|
||||
in VertexData
|
||||
{
|
||||
vec3 normal;
|
||||
} vin[4];
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
vNormal = vin[1].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
vNormal = vin[2].normal;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(lines) in;
|
||||
layout(max_vertices = 2, line_strip) out;
|
||||
|
||||
out vec3 vNormal;
|
||||
in VertexData
|
||||
{
|
||||
vec3 normal;
|
||||
} vin[2];
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
vNormal = vin[1].normal;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(points) in;
|
||||
layout(max_vertices = 3, points) out;
|
||||
|
||||
out vec3 vNormal;
|
||||
in VertexData
|
||||
{
|
||||
vec3 normal;
|
||||
} vin[1];
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(triangles_adjacency) in;
|
||||
layout(max_vertices = 3, triangle_strip) out;
|
||||
|
||||
out vec3 vNormal;
|
||||
in VertexData
|
||||
{
|
||||
vec3 normal;
|
||||
} vin[6];
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
vNormal = vin[1].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
vNormal = vin[2].normal;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(triangles) in;
|
||||
layout(max_vertices = 3, triangle_strip) out;
|
||||
|
||||
out vec3 vNormal;
|
||||
in VertexData
|
||||
{
|
||||
vec3 normal;
|
||||
} vin[3];
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
vNormal = vin[0].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
vNormal = vin[1].normal;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
vNormal = vin[2].normal;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#version 100
|
||||
|
||||
struct Buffer
|
||||
{
|
||||
mat4 MVPRowMajor;
|
||||
mat4 MVPColMajor;
|
||||
mat4 M;
|
||||
};
|
||||
|
||||
uniform Buffer _13;
|
||||
|
||||
attribute vec4 Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 c0 = _13.M * (Position * _13.MVPRowMajor);
|
||||
vec4 c1 = _13.M * (_13.MVPColMajor * Position);
|
||||
vec4 c2 = _13.M * (_13.MVPRowMajor * Position);
|
||||
vec4 c3 = _13.M * (Position * _13.MVPColMajor);
|
||||
gl_Position = ((c0 + c1) + c2) + c3;
|
||||
}
|
||||
|
|
@ -18,66 +18,66 @@ in vec2 vPatchPosBase[32];
|
|||
|
||||
bool frustum_cull(vec2 p0)
|
||||
{
|
||||
vec2 min_xz = ((p0 - vec2(10.0)) * _41.uScale.xy);
|
||||
vec2 max_xz = (((p0 + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy);
|
||||
vec2 min_xz = (p0 - vec2(10.0)) * _41.uScale.xy;
|
||||
vec2 max_xz = ((p0 + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy;
|
||||
vec3 bb_min = vec3(min_xz.x, -10.0, min_xz.y);
|
||||
vec3 bb_max = vec3(max_xz.x, 10.0, max_xz.y);
|
||||
vec3 center = ((bb_min + bb_max) * 0.5);
|
||||
float radius = (0.5 * length((bb_max - bb_min)));
|
||||
vec3 center = (bb_min + bb_max) * 0.5;
|
||||
float radius = 0.5 * length(bb_max - bb_min);
|
||||
vec3 f0 = vec3(dot(_41.uFrustum[0], vec4(center, 1.0)), dot(_41.uFrustum[1], vec4(center, 1.0)), dot(_41.uFrustum[2], vec4(center, 1.0)));
|
||||
vec3 f1 = vec3(dot(_41.uFrustum[3], vec4(center, 1.0)), dot(_41.uFrustum[4], vec4(center, 1.0)), dot(_41.uFrustum[5], vec4(center, 1.0)));
|
||||
vec3 _199 = f0;
|
||||
bool _205 = any(lessThanEqual(_199, vec3((-radius))));
|
||||
bool _205 = any(lessThanEqual(_199, vec3(-radius)));
|
||||
bool _215;
|
||||
if ((!_205))
|
||||
if (!_205)
|
||||
{
|
||||
_215 = any(lessThanEqual(f1, vec3((-radius))));
|
||||
_215 = any(lessThanEqual(f1, vec3(-radius)));
|
||||
}
|
||||
else
|
||||
{
|
||||
_215 = _205;
|
||||
}
|
||||
return (!_215);
|
||||
return !_215;
|
||||
}
|
||||
|
||||
float lod_factor(vec2 pos_)
|
||||
{
|
||||
vec2 pos = (pos_ * _41.uScale.xy);
|
||||
vec3 dist_to_cam = (_41.uCamPos - vec3(pos.x, 0.0, pos.y));
|
||||
float level = log2(((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod));
|
||||
vec2 pos = pos_ * _41.uScale.xy;
|
||||
vec3 dist_to_cam = _41.uCamPos - vec3(pos.x, 0.0, pos.y);
|
||||
float level = log2((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod);
|
||||
return clamp(level, 0.0, _41.uMaxTessLevel.x);
|
||||
}
|
||||
|
||||
vec4 tess_level(vec4 lod)
|
||||
{
|
||||
return (exp2((-lod)) * _41.uMaxTessLevel.y);
|
||||
return exp2(-lod) * _41.uMaxTessLevel.y;
|
||||
}
|
||||
|
||||
float tess_level(float lod)
|
||||
{
|
||||
return (_41.uMaxTessLevel.y * exp2((-lod)));
|
||||
return _41.uMaxTessLevel.y * exp2(-lod);
|
||||
}
|
||||
|
||||
void compute_tess_levels(vec2 p0)
|
||||
{
|
||||
vOutPatchPosBase = p0;
|
||||
vec2 param = (p0 + (vec2(-0.5) * _41.uPatchSize));
|
||||
vec2 param = p0 + (vec2(-0.5) * _41.uPatchSize);
|
||||
float l00 = lod_factor(param);
|
||||
vec2 param_1 = (p0 + (vec2(0.5, -0.5) * _41.uPatchSize));
|
||||
vec2 param_1 = p0 + (vec2(0.5, -0.5) * _41.uPatchSize);
|
||||
float l10 = lod_factor(param_1);
|
||||
vec2 param_2 = (p0 + (vec2(1.5, -0.5) * _41.uPatchSize));
|
||||
vec2 param_2 = p0 + (vec2(1.5, -0.5) * _41.uPatchSize);
|
||||
float l20 = lod_factor(param_2);
|
||||
vec2 param_3 = (p0 + (vec2(-0.5, 0.5) * _41.uPatchSize));
|
||||
vec2 param_3 = p0 + (vec2(-0.5, 0.5) * _41.uPatchSize);
|
||||
float l01 = lod_factor(param_3);
|
||||
vec2 param_4 = (p0 + (vec2(0.5) * _41.uPatchSize));
|
||||
vec2 param_4 = p0 + (vec2(0.5) * _41.uPatchSize);
|
||||
float l11 = lod_factor(param_4);
|
||||
vec2 param_5 = (p0 + (vec2(1.5, 0.5) * _41.uPatchSize));
|
||||
vec2 param_5 = p0 + (vec2(1.5, 0.5) * _41.uPatchSize);
|
||||
float l21 = lod_factor(param_5);
|
||||
vec2 param_6 = (p0 + (vec2(-0.5, 1.5) * _41.uPatchSize));
|
||||
vec2 param_6 = p0 + (vec2(-0.5, 1.5) * _41.uPatchSize);
|
||||
float l02 = lod_factor(param_6);
|
||||
vec2 param_7 = (p0 + (vec2(0.5, 1.5) * _41.uPatchSize));
|
||||
vec2 param_7 = p0 + (vec2(0.5, 1.5) * _41.uPatchSize);
|
||||
float l12 = lod_factor(param_7);
|
||||
vec2 param_8 = (p0 + (vec2(1.5) * _41.uPatchSize));
|
||||
vec2 param_8 = p0 + (vec2(1.5) * _41.uPatchSize);
|
||||
float l22 = lod_factor(param_8);
|
||||
vec4 lods = vec4(dot(vec4(l01, l11, l02, l12), vec4(0.25)), dot(vec4(l00, l10, l01, l11), vec4(0.25)), dot(vec4(l10, l20, l11, l21), vec4(0.25)), dot(vec4(l11, l21, l12, l22), vec4(0.25)));
|
||||
vPatchLods = lods;
|
||||
|
@ -99,8 +99,7 @@ void main()
|
|||
{
|
||||
vec2 p0 = vPatchPosBase[0];
|
||||
vec2 param = p0;
|
||||
vec2 param_1;
|
||||
if ((!frustum_cull(param)))
|
||||
if (!frustum_cull(param))
|
||||
{
|
||||
gl_TessLevelOuter[0] = -1.0;
|
||||
gl_TessLevelOuter[1] = -1.0;
|
||||
|
@ -111,7 +110,7 @@ void main()
|
|||
}
|
||||
else
|
||||
{
|
||||
param_1 = p0;
|
||||
vec2 param_1 = p0;
|
||||
compute_tess_levels(param_1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, ccw, fractional_even_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, cw, fractional_even_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, cw, equal_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, cw, fractional_even_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, cw, fractional_odd_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(isolines, point_mode, fractional_even_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles, cw, fractional_even_spacing) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ out vec3 vWorld;
|
|||
|
||||
vec2 lerp_vertex(vec2 tess_coord)
|
||||
{
|
||||
return (vOutPatchPosBase + (tess_coord * _31.uPatchSize));
|
||||
return vOutPatchPosBase + (tess_coord * _31.uPatchSize);
|
||||
}
|
||||
|
||||
mediump vec2 lod_factor(vec2 tess_coord)
|
||||
|
@ -29,13 +29,13 @@ mediump vec2 lod_factor(vec2 tess_coord)
|
|||
mediump vec2 x = mix(vPatchLods.yx, vPatchLods.zw, vec2(tess_coord.x));
|
||||
mediump float level = mix(x.x, x.y, tess_coord.y);
|
||||
mediump float floor_level = floor(level);
|
||||
mediump float fract_level = (level - floor_level);
|
||||
mediump float fract_level = level - floor_level;
|
||||
return vec2(floor_level, fract_level);
|
||||
}
|
||||
|
||||
mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod)
|
||||
{
|
||||
return mix(textureLod(uHeightmapDisplacement, (uv + (off * 0.5)), lod.x).xyz, textureLod(uHeightmapDisplacement, (uv + (off * 1.0)), (lod.x + 1.0)).xyz, vec3(lod.y));
|
||||
return mix(textureLod(uHeightmapDisplacement, uv + (off * 0.5), lod.x).xyz, textureLod(uHeightmapDisplacement, uv + (off * 1.0), lod.x + 1.0).xyz, vec3(lod.y));
|
||||
}
|
||||
|
||||
void main()
|
||||
|
@ -45,17 +45,17 @@ void main()
|
|||
vec2 pos = lerp_vertex(param);
|
||||
vec2 param_1 = tess_coord;
|
||||
mediump vec2 lod = lod_factor(param_1);
|
||||
vec2 tex = (pos * _31.uInvHeightmapSize);
|
||||
pos = (pos * _31.uScale.xy);
|
||||
vec2 tex = pos * _31.uInvHeightmapSize;
|
||||
pos *= _31.uScale.xy;
|
||||
mediump float delta_mod = exp2(lod.x);
|
||||
vec2 off = (_31.uInvHeightmapSize * delta_mod);
|
||||
vGradNormalTex = vec4((tex + (_31.uInvHeightmapSize * 0.5)), (tex * _31.uScale.zw));
|
||||
vec2 off = _31.uInvHeightmapSize * delta_mod;
|
||||
vGradNormalTex = vec4(tex + (_31.uInvHeightmapSize * 0.5), tex * _31.uScale.zw);
|
||||
vec2 param_2 = tex;
|
||||
vec2 param_3 = off;
|
||||
vec2 param_4 = lod;
|
||||
vec3 height_displacement = sample_height_displacement(param_2, param_3, param_4);
|
||||
pos = (pos + height_displacement.yz);
|
||||
pos += height_displacement.yz;
|
||||
vWorld = vec3(pos.x, height_displacement.x, pos.y);
|
||||
gl_Position = (_31.uMVP * vec4(vWorld, 1.0));
|
||||
gl_Position = _31.uMVP * vec4(vWorld, 1.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ in vec3 aNormal;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_Position = (_16.uMVP * aVertex);
|
||||
gl_Position = _16.uMVP * aVertex;
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,24 +44,22 @@ layout(binding = 1) uniform mediump sampler2D TexLOD;
|
|||
layout(binding = 0) uniform mediump sampler2D TexHeightmap;
|
||||
|
||||
layout(location = 1) in vec4 LODWeights;
|
||||
uniform int SPIRV_Cross_BaseInstance;
|
||||
layout(location = 0) in vec2 Position;
|
||||
layout(location = 1) out vec3 EyeVec;
|
||||
layout(location = 0) out vec2 TexCoord;
|
||||
|
||||
vec2 warp_position()
|
||||
{
|
||||
float vlod = dot(LODWeights, _284.Patches[gl_InstanceID].LODs);
|
||||
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.0))));
|
||||
float vlod = dot(LODWeights, _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs);
|
||||
vlod = mix(vlod, _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w, all(equal(LODWeights, vec4(0.0))));
|
||||
float floor_lod = floor(vlod);
|
||||
float fract_lod = (vlod - floor_lod);
|
||||
float fract_lod = vlod - floor_lod;
|
||||
uint ufloor_lod = uint(floor_lod);
|
||||
uvec2 uPosition = uvec2(Position);
|
||||
uvec2 mask = ((uvec2(1u) << uvec2(ufloor_lod, (ufloor_lod + 1u))) - uvec2(1u));
|
||||
uvec2 rounding;
|
||||
uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - uvec2(1u);
|
||||
uint _332;
|
||||
uint _343;
|
||||
vec4 lower_upper_snapped;
|
||||
if ((uPosition.x < 32u))
|
||||
if (uPosition.x < 32u)
|
||||
{
|
||||
_332 = mask.x;
|
||||
}
|
||||
|
@ -70,7 +68,8 @@ vec2 warp_position()
|
|||
_332 = 0u;
|
||||
}
|
||||
uint _342 = _332;
|
||||
if ((uPosition.y < 32u))
|
||||
uint _343;
|
||||
if (uPosition.y < 32u)
|
||||
{
|
||||
_343 = mask.y;
|
||||
}
|
||||
|
@ -78,34 +77,34 @@ vec2 warp_position()
|
|||
{
|
||||
_343 = 0u;
|
||||
}
|
||||
rounding = uvec2(_342, _343);
|
||||
lower_upper_snapped = vec4(((uPosition + rounding).xyxy & (~mask).xxyy));
|
||||
uvec2 rounding = uvec2(_342, _343);
|
||||
vec4 lower_upper_snapped = vec4((uPosition + rounding).xyxy & ~mask.xxyy);
|
||||
return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, vec2(fract_lod));
|
||||
}
|
||||
|
||||
vec2 lod_factor(vec2 uv)
|
||||
{
|
||||
float level = (textureLod(TexLOD, uv, 0.0).x * 7.96875);
|
||||
float level = textureLod(TexLOD, uv, 0.0).x * 7.96875;
|
||||
float floor_level = floor(level);
|
||||
float fract_level = (level - floor_level);
|
||||
float fract_level = level - floor_level;
|
||||
return vec2(floor_level, fract_level);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 PatchPos = (_284.Patches[gl_InstanceID].Position.xz * _381.InvGroundSize_PatchScale.zw);
|
||||
vec2 PatchPos = _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _381.InvGroundSize_PatchScale.zw;
|
||||
vec2 WarpedPos = warp_position();
|
||||
vec2 VertexPos = (PatchPos + WarpedPos);
|
||||
vec2 NormalizedPos = (VertexPos * _381.InvGroundSize_PatchScale.xy);
|
||||
vec2 VertexPos = PatchPos + WarpedPos;
|
||||
vec2 NormalizedPos = VertexPos * _381.InvGroundSize_PatchScale.xy;
|
||||
vec2 param = NormalizedPos;
|
||||
vec2 lod = lod_factor(param);
|
||||
vec2 Offset = (_381.InvGroundSize_PatchScale.xy * exp2(lod.x));
|
||||
float Elevation = mix(textureLod(TexHeightmap, (NormalizedPos + (Offset * 0.5)), lod.x).x, textureLod(TexHeightmap, (NormalizedPos + (Offset * 1.0)), (lod.x + 1.0)).x, lod.y);
|
||||
vec2 Offset = _381.InvGroundSize_PatchScale.xy * exp2(lod.x);
|
||||
float Elevation = mix(textureLod(TexHeightmap, NormalizedPos + (Offset * 0.5), lod.x).x, textureLod(TexHeightmap, NormalizedPos + (Offset * 1.0), lod.x + 1.0).x, lod.y);
|
||||
vec3 WorldPos = vec3(NormalizedPos.x, Elevation, NormalizedPos.y);
|
||||
WorldPos = (WorldPos * _381.GroundScale.xyz);
|
||||
WorldPos = (WorldPos + _381.GroundPosition.xyz);
|
||||
EyeVec = (WorldPos - _58.g_CamPos.xyz);
|
||||
TexCoord = (NormalizedPos + (_381.InvGroundSize_PatchScale.xy * 0.5));
|
||||
gl_Position = ((((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3);
|
||||
WorldPos *= _381.GroundScale.xyz;
|
||||
WorldPos += _381.GroundPosition.xyz;
|
||||
EyeVec = WorldPos - _58.g_CamPos.xyz;
|
||||
TexCoord = NormalizedPos + (_381.InvGroundSize_PatchScale.xy * 0.5);
|
||||
gl_Position = (((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,26 +45,22 @@ layout(binding = 1) uniform mediump sampler2D TexLOD;
|
|||
layout(binding = 0) uniform mediump sampler2D TexDisplacement;
|
||||
|
||||
layout(location = 1) in vec4 LODWeights;
|
||||
uniform int SPIRV_Cross_BaseInstance;
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 0) out vec3 EyeVec;
|
||||
layout(location = 1) out vec4 TexCoord;
|
||||
|
||||
vec2 warp_position()
|
||||
{
|
||||
float vlod = dot(LODWeights, _284.Patches[gl_InstanceID].LODs);
|
||||
vlod = mix(vlod, _284.Patches[gl_InstanceID].Position.w, all(equal(LODWeights, vec4(0.0))));
|
||||
float vlod = dot(LODWeights, _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs);
|
||||
vlod = mix(vlod, _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w, all(equal(LODWeights, vec4(0.0))));
|
||||
float floor_lod = floor(vlod);
|
||||
float fract_lod = (vlod - floor_lod);
|
||||
float fract_lod = vlod - floor_lod;
|
||||
uint ufloor_lod = uint(floor_lod);
|
||||
uvec4 uPosition = uvec4(Position);
|
||||
uvec2 mask = ((uvec2(1u) << uvec2(ufloor_lod, (ufloor_lod + 1u))) - uvec2(1u));
|
||||
uvec4 rounding;
|
||||
uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - uvec2(1u);
|
||||
uint _333;
|
||||
uint _345;
|
||||
uint _356;
|
||||
uint _368;
|
||||
vec4 lower_upper_snapped;
|
||||
if ((uPosition.x < 32u))
|
||||
if (uPosition.x < 32u)
|
||||
{
|
||||
_333 = mask.x;
|
||||
}
|
||||
|
@ -72,8 +68,10 @@ vec2 warp_position()
|
|||
{
|
||||
_333 = 0u;
|
||||
}
|
||||
uvec4 rounding;
|
||||
rounding.x = _333;
|
||||
if ((uPosition.y < 32u))
|
||||
uint _345;
|
||||
if (uPosition.y < 32u)
|
||||
{
|
||||
_345 = mask.x;
|
||||
}
|
||||
|
@ -82,7 +80,8 @@ vec2 warp_position()
|
|||
_345 = 0u;
|
||||
}
|
||||
rounding.y = _345;
|
||||
if ((uPosition.x < 32u))
|
||||
uint _356;
|
||||
if (uPosition.x < 32u)
|
||||
{
|
||||
_356 = mask.y;
|
||||
}
|
||||
|
@ -91,7 +90,8 @@ vec2 warp_position()
|
|||
_356 = 0u;
|
||||
}
|
||||
rounding.z = _356;
|
||||
if ((uPosition.y < 32u))
|
||||
uint _368;
|
||||
if (uPosition.y < 32u)
|
||||
{
|
||||
_368 = mask.y;
|
||||
}
|
||||
|
@ -100,34 +100,34 @@ vec2 warp_position()
|
|||
_368 = 0u;
|
||||
}
|
||||
rounding.w = _368;
|
||||
lower_upper_snapped = vec4(((uPosition.xyxy + rounding) & (~mask).xxyy));
|
||||
vec4 lower_upper_snapped = vec4((uPosition.xyxy + rounding) & ~mask.xxyy);
|
||||
return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, vec2(fract_lod));
|
||||
}
|
||||
|
||||
vec2 lod_factor(vec2 uv)
|
||||
{
|
||||
float level = (textureLod(TexLOD, uv, 0.0).x * 7.96875);
|
||||
float level = textureLod(TexLOD, uv, 0.0).x * 7.96875;
|
||||
float floor_level = floor(level);
|
||||
float fract_level = (level - floor_level);
|
||||
float fract_level = level - floor_level;
|
||||
return vec2(floor_level, fract_level);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 PatchPos = (_284.Patches[gl_InstanceID].Position.xz * _405.InvOceanSize_PatchScale.zw);
|
||||
vec2 PatchPos = _284.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _405.InvOceanSize_PatchScale.zw;
|
||||
vec2 WarpedPos = warp_position();
|
||||
vec2 VertexPos = (PatchPos + WarpedPos);
|
||||
vec2 NormalizedPos = (VertexPos * _405.InvOceanSize_PatchScale.xy);
|
||||
vec2 NormalizedTex = (NormalizedPos * _405.NormalTexCoordScale.zw);
|
||||
vec2 VertexPos = PatchPos + WarpedPos;
|
||||
vec2 NormalizedPos = VertexPos * _405.InvOceanSize_PatchScale.xy;
|
||||
vec2 NormalizedTex = NormalizedPos * _405.NormalTexCoordScale.zw;
|
||||
vec2 param = NormalizedPos;
|
||||
vec2 lod = lod_factor(param);
|
||||
vec2 Offset = ((_405.InvOceanSize_PatchScale.xy * exp2(lod.x)) * _405.NormalTexCoordScale.zw);
|
||||
vec3 Displacement = mix(textureLod(TexDisplacement, (NormalizedTex + (Offset * 0.5)), lod.x).yxz, textureLod(TexDisplacement, (NormalizedTex + (Offset * 1.0)), (lod.x + 1.0)).yxz, vec3(lod.y));
|
||||
vec3 WorldPos = (vec3(NormalizedPos.x, 0.0, NormalizedPos.y) + Displacement);
|
||||
WorldPos = (WorldPos * _405.OceanScale.xyz);
|
||||
WorldPos = (WorldPos + _405.OceanPosition.xyz);
|
||||
EyeVec = (WorldPos - _58.g_CamPos.xyz);
|
||||
TexCoord = (vec4(NormalizedTex, (NormalizedTex * _405.NormalTexCoordScale.xy)) + ((_405.InvOceanSize_PatchScale.xyxy * 0.5) * _405.NormalTexCoordScale.zwzw));
|
||||
gl_Position = ((((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3);
|
||||
vec2 Offset = (_405.InvOceanSize_PatchScale.xy * exp2(lod.x)) * _405.NormalTexCoordScale.zw;
|
||||
vec3 Displacement = mix(textureLod(TexDisplacement, NormalizedTex + (Offset * 0.5), lod.x).yxz, textureLod(TexDisplacement, NormalizedTex + (Offset * 1.0), lod.x + 1.0).yxz, vec3(lod.y));
|
||||
vec3 WorldPos = vec3(NormalizedPos.x, 0.0, NormalizedPos.y) + Displacement;
|
||||
WorldPos *= _405.OceanScale.xyz;
|
||||
WorldPos += _405.OceanPosition.xyz;
|
||||
EyeVec = WorldPos - _58.g_CamPos.xyz;
|
||||
TexCoord = vec4(NormalizedTex, NormalizedTex * _405.NormalTexCoordScale.xy) + ((_405.InvOceanSize_PatchScale.xyxy * 0.5) * _405.NormalTexCoordScale.zwzw);
|
||||
gl_Position = (((_58.g_ViewProj_Row0 * WorldPos.x) + (_58.g_ViewProj_Row1 * WorldPos.y)) + (_58.g_ViewProj_Row2 * WorldPos.z)) + _58.g_ViewProj_Row3;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ layout(binding = 5, rgba32f) uniform highp readonly imageBuffer uSampo;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_Position = (texelFetch(uSamp, 10) + imageLoad(uSampo, 100));
|
||||
gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ in vec3 aNormal;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_Position = (_16.mvp * aVertex);
|
||||
gl_Position = _16.mvp * aVertex;
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler0;
|
||||
uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler1;
|
||||
uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler0;
|
||||
uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler1;
|
||||
|
||||
layout(location = 0) in vec2 vTex;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
vec4 sample_dual(mediump sampler2D SPIRV_Cross_Combinedtexsamp)
|
||||
{
|
||||
return texture(SPIRV_Cross_Combinedtexsamp, vTex);
|
||||
}
|
||||
|
||||
vec4 sample_duals()
|
||||
{
|
||||
vec4 a = sample_dual(SPIRV_Cross_CombineduTexture0uSampler0);
|
||||
vec4 b = sample_dual(SPIRV_Cross_CombineduTexture1uSampler1);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
vec4 sample_global_tex(mediump sampler2D SPIRV_Cross_CombineduTexture0samp, mediump sampler2D SPIRV_Cross_CombineduTexture1samp)
|
||||
{
|
||||
vec4 a = texture(SPIRV_Cross_CombineduTexture0samp, vTex);
|
||||
vec4 b = sample_dual(SPIRV_Cross_CombineduTexture1samp);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
vec4 sample_global_sampler(mediump sampler2D SPIRV_Cross_CombinedtexuSampler0, mediump sampler2D SPIRV_Cross_CombinedtexuSampler1)
|
||||
{
|
||||
vec4 a = texture(SPIRV_Cross_CombinedtexuSampler0, vTex);
|
||||
vec4 b = sample_dual(SPIRV_Cross_CombinedtexuSampler1);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 c0 = sample_duals();
|
||||
vec4 c1 = sample_global_tex(SPIRV_Cross_CombineduTexture0uSampler0, SPIRV_Cross_CombineduTexture1uSampler0);
|
||||
vec4 c2 = sample_global_tex(SPIRV_Cross_CombineduTexture0uSampler1, SPIRV_Cross_CombineduTexture1uSampler1);
|
||||
vec4 c3 = sample_global_sampler(SPIRV_Cross_CombineduTexture0uSampler0, SPIRV_Cross_CombineduTexture0uSampler1);
|
||||
vec4 c4 = sample_global_sampler(SPIRV_Cross_CombineduTexture1uSampler0, SPIRV_Cross_CombineduTexture1uSampler1);
|
||||
FragColor = (((c0 + c1) + c2) + c3) + c4;
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(set = 0, binding = 2) uniform mediump texture2D uTexture0;
|
||||
layout(set = 0, binding = 3) uniform mediump texture2D uTexture1;
|
||||
layout(set = 0, binding = 0) uniform mediump sampler uSampler0;
|
||||
layout(set = 0, binding = 1) uniform mediump sampler uSampler1;
|
||||
|
||||
layout(location = 0) in vec2 vTex;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
vec4 sample_dual(mediump sampler samp, mediump texture2D tex)
|
||||
{
|
||||
return texture(sampler2D(tex, samp), vTex);
|
||||
}
|
||||
|
||||
vec4 sample_duals()
|
||||
{
|
||||
vec4 a = sample_dual(uSampler0, uTexture0);
|
||||
vec4 b = sample_dual(uSampler1, uTexture1);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
vec4 sample_global_tex(mediump sampler samp)
|
||||
{
|
||||
vec4 a = texture(sampler2D(uTexture0, samp), vTex);
|
||||
vec4 b = sample_dual(samp, uTexture1);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
vec4 sample_global_sampler(mediump texture2D tex)
|
||||
{
|
||||
vec4 a = texture(sampler2D(tex, uSampler0), vTex);
|
||||
vec4 b = sample_dual(uSampler1, tex);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 c0 = sample_duals();
|
||||
vec4 c1 = sample_global_tex(uSampler0);
|
||||
vec4 c2 = sample_global_tex(uSampler1);
|
||||
vec4 c3 = sample_global_sampler(uTexture0);
|
||||
vec4 c4 = sample_global_sampler(uTexture1);
|
||||
FragColor = (((c0 + c1) + c2) + c3) + c4;
|
||||
}
|
||||
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 1) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 2));
|
||||
FragColor = texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 1) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2));
|
||||
FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 0) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 0));
|
||||
FragColor = texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 0) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ layout(location = 0) out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = (subpassLoad(uSubpass0) + subpassLoad(uSubpass1));
|
||||
FragColor = subpassLoad(uSubpass0) + subpassLoad(uSubpass1);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,6 @@ layout(location = 0) in vec4 vColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
FragColor = ((vColor + push.value0) + push.value1);
|
||||
FragColor = (vColor + push.value0) + push.value1;
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче