Fix code formatting issues and VS compilation

Also temporarily disable multicheck build so that we get a full build
even when there are style issues on Vulkan.

Fixes #33356.
This commit is contained in:
Rémi Verschelde 2019-11-05 12:01:00 +01:00
parent b509c814fc
commit fff4240bb4
51 changed files with 1438 additions and 1115 deletions

View file

@ -4,7 +4,6 @@ language: cpp
dist: xenial
stages:
- check
- build
env:
@ -21,7 +20,7 @@ cache:
matrix:
include:
- name: Static checks (clang-format) + Documentation checks
stage: check
stage: build
env: STATIC_CHECKS=yes
os: linux
compiler: gcc

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* vector3i.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "vector3i.h"
void Vector3i::set_axis(int p_axis, int32_t p_value) {

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* vector3i.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR3I_H
#define VECTOR3I_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rid_owner.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "rid_owner.h"
volatile uint64_t RID_AllocBase::base_id = 1;

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rid_owner.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RID_OWNER_H
#define RID_OWNER_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* spin_lock.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef SPIN_LOCK_H
#define SPIN_LOCK_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* thread_work_pool.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "thread_work_pool.h"
#include "core/os/os.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* thread_work_pool.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef THREAD_WORK_POOL_H
#define THREAD_WORK_POOL_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* editor_visual_profiler.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_visual_profiler.h"
#include "core/os/os.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* editor_visual_profiler.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef EDITOR_FRAME_PROFILER_H
#define EDITOR_FRAME_PROFILER_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* resource_importer_layered_texture.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#if 0
/*************************************************************************/
/* resource_importer_layered_texture.h */

View file

@ -136,7 +136,6 @@ void GIProbeEditorPlugin::_bind_methods() {
ClassDB::bind_method("_bake", &GIProbeEditorPlugin::_bake);
ClassDB::bind_method("_giprobe_save_path_and_bake", &GIProbeEditorPlugin::_giprobe_save_path_and_bake);
}
GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {

View file

@ -57,7 +57,6 @@ class GIProbeEditorPlugin : public EditorPlugin {
void _bake();
void _giprobe_save_path_and_bake(const String &p_path);
protected:
static void _bind_methods();
void _notification(int p_what);

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "core/os/os.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* texture_basisu.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "texture_basisu.h"
#if 0
#include "core/os/os.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* texture_basisu.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "scene/resources/texture.h"
#ifdef TOOLS_ENABLED

View file

@ -1949,7 +1949,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
cursors_cache.erase(p_shape);
}
}
void OS_OSX::set_mouse_show(bool p_show) {

View file

@ -1457,7 +1457,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
context_gles2 = NULL;
ERR_FAIL_V(ERR_UNAVAILABLE);
}
}
#endif
#if defined(VULKAN_ENABLED)
@ -1659,7 +1658,6 @@ void OS_Windows::finalize() {
if (context_gles2)
memdelete(context_gles2);
}
#endif
#if defined(VULKAN_ENABLED)

View file

@ -415,7 +415,6 @@ Vector3i GIProbe::get_estimated_cell_size() const {
int longest_axis = bounds.get_longest_axis_index();
axis_cell_size[longest_axis] = 1 << cell_subdiv;
for (int i = 0; i < 3; i++) {
if (i == longest_axis)

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rasterizer_effects_rd.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "rasterizer_effects_rd.h"
static _FORCE_INLINE_ void store_transform_3x3(const Basis &p_basis, float *p_array) {

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rasterizer_effects_rd.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RASTERIZER_EFFECTS_RD_H
#define RASTERIZER_EFFECTS_RD_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* rasterizer_rd.cpp */
/* rasterizer_rd.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View file

@ -1556,7 +1556,7 @@ void RasterizerSceneForwardRD::_setup_gi_probes(RID *p_gi_probe_probe_cull_resul
gi_probe_ubo.texture_slot = gi_probe_instance_get_slot(rpi);
gi_probe_ubo.anisotropy_strength = storage->gi_probe_get_anisotropy_strength(base_probe);
gi_probe_ubo.ao = storage->gi_probe_get_ao(base_probe);
gi_probe_ubo.ao_size = Math::pow(storage->gi_probe_get_ao_size(base_probe),4.0);
gi_probe_ubo.ao_size = Math::pow(storage->gi_probe_get_ao_size(base_probe), 4.0f);
if (gi_probe_is_anisotropic()) {
gi_probe_ubo.texture_slot *= 3;

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rasterizer_scene_rd.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "rasterizer_scene_rd.h"
#include "core/os/os.h"
#include "core/project_settings.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* rasterizer_scene_rd.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RASTERIZER_SCENE_RD_H
#define RASTERIZER_SCENE_RD_H

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* shader_compiler_rd.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "shader_compiler_rd.h"
#include "core/os/os.h"

View file

@ -1,3 +1,33 @@
/*************************************************************************/
/* shader_compiler_rd.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef SHADER_COMPILER_RD_H
#define SHADER_COMPILER_RD_H

View file

@ -1,16 +1,14 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#include "blur_inc.glsl"
layout(location = 0) out vec2 uv_interp;
/* clang-format on */
void main() {
@ -26,22 +24,19 @@ void main() {
if (bool(blur.flags & FLAG_FLIP_Y)) {
uv_interp.y = 1.0 - uv_interp.y;
}
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#include "blur_inc.glsl"
layout(location = 0) in vec2 uv_interp;
/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_color;
@ -53,7 +48,6 @@ layout( set=1, binding=0 ) uniform sampler2D source_ssao;
layout(set = 1, binding = 0) uniform sampler2D source_auto_exposure;
#endif
layout(location = 0) out vec4 frag_color;
//DOF
@ -86,7 +80,6 @@ const float dof_kernel[21] = float[](0.028174, 0.032676, 0.037311, 0.041944, 0.0
#endif
void main() {
#ifdef MODE_MIPMAP
@ -128,8 +121,6 @@ void main() {
}
#endif
#ifdef MODE_GAUSSIAN_GLOW
//Glow uses larger sigma 1 for a more rounded blur effect
@ -159,7 +150,6 @@ void main() {
frag_color = color;
}
if (bool(blur.flags & FLAG_GLOW_FIRST_PASS)) {
#ifdef GLOW_USE_AUTO_EXPOSURE
@ -173,7 +163,6 @@ void main() {
frag_color = min(frag_color * feedback, vec4(blur.glow_luminance_cap));
}
#endif
#ifdef MODE_DOF_FAR_BLUR

View file

@ -10,7 +10,7 @@ layout(push_constant, binding = 1, std430) uniform Blur {
vec2 pixel_size;
uint flags;
uint pad;
//glow
// Glow.
float glow_strength;
float glow_bloom;
float glow_hdr_threshold;
@ -19,7 +19,7 @@ layout(push_constant, binding = 1, std430) uniform Blur {
float glow_white;
float glow_luminance_cap;
float glow_auto_exposure_grey;
//dof
// DOF.
float dof_begin;
float dof_end;
float dof_radius;
@ -30,7 +30,4 @@ layout(push_constant, binding = 1, std430) uniform Blur {
float camera_z_near;
vec4 ssao_color;
} blur;

View file

@ -1,15 +1,13 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#ifdef USE_ATTRIBUTES
layout(location = 0) in vec2 vertex_attrib;
/* clang-format on */
layout(location = 3) in vec4 color_attrib;
layout(location = 4) in vec2 uv_attrib;
@ -19,7 +17,6 @@ layout(location = 6) in uvec4 bones_attrib;
#include "canvas_uniforms_inc.glsl"
layout(location = 0) out vec2 uv_interp;
layout(location = 1) out vec4 color_interp;
layout(location = 2) out vec2 vertex_interp;
@ -42,7 +39,6 @@ MATERIAL_UNIFORMS
VERTEX_SHADER_GLOBALS
/* clang-format on */
void main() {
vec4 instance_custom = vec4(0.0);
@ -89,8 +85,8 @@ void main() {
#endif
mat4 world_matrix = mat4(vec4(draw_data.world_x, 0.0, 0.0), vec4(draw_data.world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data.world_ofs, 0.0, 1.0));
#if 0
#if 0
if (draw_data.flags & FLAGS_INSTANCING_ENABLED) {
uint offset = draw_data.flags & FLAGS_INSTANCING_STRIDE_MASK;
@ -122,7 +118,6 @@ void main() {
instance_custom = vec4(texelFetch(instancing_buffer, offset + 0), texelFetch(instancing_buffer, offset + 1), texelFetch(instancing_buffer, offset + 2), texelFetch(instancing_buffer, offset + 3));
}
}
}
#endif
@ -143,8 +138,6 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
#ifdef USE_NINEPATCH
pixel_size_interp = abs(draw_data.dst_rect.zw) * vertex_base;
#endif
@ -206,7 +199,6 @@ VERTEX_SHADER_CODE
#endif
#endif
vertex = (canvas_data.canvas_transform * vec4(vertex, 0.0, 1.0)).xy;
vertex_interp = vertex;
@ -217,7 +209,6 @@ VERTEX_SHADER_CODE
#ifdef USE_POINT_SIZE
gl_PointSize = point_size;
#endif
}
/* clang-format off */
@ -225,13 +216,12 @@ VERTEX_SHADER_CODE
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#include "canvas_uniforms_inc.glsl"
layout(location = 0) in vec2 uv_interp;
/* clang-format on */
layout(location = 1) in vec4 color_interp;
layout(location = 2) in vec2 vertex_interp;
@ -251,7 +241,6 @@ MATERIAL_UNIFORMS
} material;
#endif
/* clang-format off */
FRAGMENT_SHADER_GLOBALS
/* clang-format on */
@ -318,7 +307,6 @@ float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, flo
}
}
#endif
void main() {
@ -354,7 +342,6 @@ void main() {
uint light_count = (draw_data.flags >> FLAGS_LIGHT_COUNT_SHIFT) & 0xF; //max 16 lights
vec3 normal;
#if defined(NORMAL_USED)
@ -364,7 +351,6 @@ void main() {
bool normal_used = false;
#endif
if (normal_used || (light_count > 0 && bool(draw_data.flags & FLAGS_DEFAULT_NORMAL_MAP_USED))) {
normal.xy = texture(sampler2D(normal_texture, texture_sampler), uv).xy * vec2(2.0, -2.0) - vec2(1.0, -1.0);
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
@ -390,7 +376,6 @@ void main() {
specular_shininess = vec4(1.0);
}
#if defined(SCREEN_UV_USED)
vec2 screen_uv = gl_FragCoord.xy * canvas_data.screen_pixel_size;
#else
@ -426,7 +411,6 @@ FRAGMENT_SHADER_CODE
normal = normalize((canvas_data.canvas_normal_transform * vec4(normal, 0.0)).xyz);
}
vec4 base_color = color;
if (bool(draw_data.flags & FLAGS_USING_LIGHT_MASK)) {
color = vec4(0.0); //inivisible by default due to using light mask
@ -468,7 +452,6 @@ FRAGMENT_SHADER_CODE
light_color = light_compute(light_vertex, light_position, normal, light_color, light_base_color.a, specular_shininess, shadow_modulate, screen_uv, color, uv);
#else
light_color.rgb *= light_base_color.rgb * light_base_color.a;
if (normal_used) {
@ -496,7 +479,6 @@ FRAGMENT_SHADER_CODE
} else {
light_color.rgb *= cNdotL;
}
}
#endif
if (any(lessThan(tex_uv, vec2(0.0, 0.0))) || any(greaterThanEqual(tex_uv, vec2(1.0, 1.0)))) {
@ -573,7 +555,6 @@ FRAGMENT_SHADER_CODE
shadow_color *= shadow_modulate;
#endif
light_color = mix(light_color, shadow_color, shadow);
}
uint blend_mode = light_array.data[light_base].flags & LIGHT_FLAGS_BLEND_MASK;
@ -597,5 +578,4 @@ FRAGMENT_SHADER_CODE
#endif
frag_color = color;
}

View file

@ -1,10 +1,10 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
layout(location = 0) in highp vec3 vertex;
/* clang-format on */
layout(push_constant, binding = 0, std430) uniform Constants {
@ -22,16 +22,15 @@ void main() {
depth = dot(constants.direction, vtx.xy);
gl_Position = constants.projection * vtx;
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
layout(location = 0) in highp float depth;
/* clang-format on */
layout(location = 0) out highp float distance_buf;
void main() {

View file

@ -1,6 +1,3 @@
#define M_PI 3.14159265359
#define FLAGS_INSTANCING_STRIDE_MASK 0xF
@ -53,7 +50,6 @@ layout(push_constant, binding = 0, std430) uniform DrawData {
#endif
vec2 color_texture_pixel_size;
uint lights[4];
} draw_data;
// The values passed per draw primitives are cached within it
@ -67,7 +63,6 @@ layout(set = 0, binding = 5) uniform textureBuffer instancing_buffer;
/* SET1: Is reserved for the material */
#ifdef USE_MATERIAL_SAMPLERS
layout(set = 1, binding = 0) uniform sampler material_samplers[12];
@ -76,7 +71,6 @@ layout(set = 1, binding = 0) uniform sampler material_samplers[12];
/* SET2: Canvas Item State (including lighting) */
layout(set = 2, binding = 0, std140) uniform CanvasData {
mat4 canvas_transform;
mat4 screen_transform;
@ -95,7 +89,6 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData {
mat4 skeleton_transform_inverse;
} skeleton_data;
#ifdef USE_LIGHTING
#define LIGHT_FLAGS_BLEND_MASK (3 << 16)
@ -110,7 +103,6 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData {
#define LIGHT_FLAGS_SHADOW_PCF5 (1 << 22)
#define LIGHT_FLAGS_SHADOW_PCF13 (2 << 22)
struct Light {
mat2x4 matrix; //light to texture coordinate matrix (transposed)
mat2x4 shadow_matrix; //light to shadow coordinate matrix (transposed)

View file

@ -1,14 +1,12 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) out vec2 uv_interp;
/* clang-format on */
void main() {
@ -16,20 +14,17 @@ void main() {
uv_interp = base_arr[gl_VertexIndex];
gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0);
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) in vec2 uv_interp;
/* clang-format on */
#ifdef MODE_CUBE_TO_DP
@ -40,14 +35,12 @@ layout(push_constant, binding = 0, std430) uniform Params {
float z_far;
float z_near;
bool z_flip;
} params;
layout(location = 0) out float depth_buffer;
#endif
void main() {
#ifdef MODE_CUBE_TO_DP
@ -57,7 +50,6 @@ void main() {
normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
normal = normalize(normal);
normal.y = -normal.y; //needs to be flipped to match projection matrix
if (!params.z_flip) {
normal.z = -normal.z;

View file

@ -1,37 +1,30 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) out highp vec2 uv_interp;
/* clang-format on */
void main() {
vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0));
uv_interp = base_arr[gl_VertexIndex];
gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0);
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#ifdef MODE_SOURCE_PANORAMA
layout(set = 0, binding = 0) uniform sampler2D source_panorama;
/* clang-format on */
#endif
#ifdef MODE_SOURCE_CUBEMAP
@ -184,7 +177,6 @@ vec4 texturePanorama(vec3 normal, sampler2D pano) {
#endif
void main() {
vec2 uv = (uv_interp * 2.0) - 1.0;

View file

@ -1,3 +1,4 @@
/* clang-format off */
[compute]
#version 450
@ -5,14 +6,11 @@
VERSION_DEFINES
#ifdef MODE_DYNAMIC
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
#else
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
#endif
/* clang-format on */
#ifndef MODE_DYNAMIC
@ -38,7 +36,6 @@ layout(set=0,binding=2,std430) buffer CellDataBuffer {
CellData data[];
} cell_data;
#endif // MODE DYNAMIC
#define LIGHT_TYPE_DIRECTIONAL 0
@ -64,16 +61,12 @@ struct Light {
bool has_shadow;
};
layout(set = 0, binding = 3, std140) uniform Lights {
Light data[MAX_LIGHTS];
} lights;
#endif // MODE COMPUTE LIGHT
#ifdef MODE_SECOND_BOUNCE
layout(set = 0, binding = 5) uniform texture3D color_texture;
@ -88,7 +81,6 @@ layout (set=0,binding=8) uniform texture3D aniso_neg_texture;
#ifndef MODE_DYNAMIC
layout(push_constant, binding = 0, std430) uniform Params {
ivec3 limits;
uint stack_size;
@ -101,10 +93,8 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint cell_count;
float aniso_strength;
uint pad;
} params;
layout(set = 0, binding = 4, std430) buffer Outputs {
vec4 data[];
} outputs;
@ -125,14 +115,11 @@ layout (r16ui,set=0,binding=7) uniform restrict writeonly uimage3D aniso_neg_tex
#endif
#endif
#ifdef MODE_DYNAMIC
layout(push_constant, binding = 0, std430) uniform Params {
ivec3 limits;
uint light_count; //when not lighting
ivec3 x_dir;
@ -193,15 +180,12 @@ layout (r16ui,set=0,binding=13) uniform restrict writeonly uimage3D aniso_neg_te
//layout (rgba8,set=0,binding=5) uniform restrict writeonly image3D color_tex;
#endif // MODE DYNAMIC
#if defined(MODE_COMPUTE_LIGHT) || defined(MODE_DYNAMIC_LIGHTING)
float raymarch(float distance, float distance_adv, vec3 from, vec3 direction) {
vec3 cell_size = 1.0 / vec3(params.limits);
float occlusion = 1.0;
while (distance > 0.5) { //use this to avoid precision errors
@ -220,12 +204,10 @@ float raymarch(float distance,float distance_adv,vec3 from,vec3 direction) {
}
return occlusion; //max(0.0,distance);
}
bool compute_light_vector(uint light, vec3 pos, out float attenuation, out vec3 light_pos) {
if (lights.data[light].type == LIGHT_TYPE_DIRECTIONAL) {
light_pos = pos - lights.data[light].direction * length(vec3(params.limits));
@ -239,10 +221,8 @@ bool compute_light_vector(uint light, vec3 pos,out float attenuation, out vec3 l
return false;
}
attenuation = pow(clamp(1.0 - distance / lights.data[light].radius, 0.0001, 1.0), lights.data[light].attenuation);
if (lights.data[light].type == LIGHT_TYPE_SPOT) {
vec3 rel = normalize(pos - light_pos);
@ -282,9 +262,6 @@ float get_normal_advance(vec3 p_normal) {
return 1.0 / dot(normal, unorm);
}
void clip_segment(vec4 plane, vec3 begin, inout vec3 end) {
vec3 segment = begin - end;
@ -322,7 +299,6 @@ bool compute_light_at_pos(uint index, vec3 pos, vec3 normal, inout vec3 light, i
float distance_adv = get_normal_advance(light_dir);
vec3 to = pos;
if (length(normal) > 0.2) {
to += normal * distance_adv * 0.51;
@ -335,7 +311,6 @@ bool compute_light_at_pos(uint index, vec3 pos, vec3 normal, inout vec3 light, i
clip_segment(mix(vec4(0.0, -1.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, float(params.limits.y - 1)), bvec4(light_dir.y < 0.0)), to, light_pos);
clip_segment(mix(vec4(0.0, 0.0, -1.0, 0.0), vec4(0.0, 0.0, 1.0, float(params.limits.z - 1)), bvec4(light_dir.z < 0.0)), to, light_pos);
float distance = length(to - light_pos);
if (distance < 0.1) {
return false; // hit
@ -362,7 +337,6 @@ bool compute_light_at_pos(uint index, vec3 pos, vec3 normal, inout vec3 light, i
}
attenuation *= occlusion; //1.0 - smoothstep(0.1*distance_adv,distance_adv,dist);
}
light = lights.data[index].color * attenuation * lights.data[index].energy;
@ -375,7 +349,7 @@ void main() {
#ifndef MODE_DYNAMIC
uint cell_index = gl_GlobalInvocationID.x;;
uint cell_index = gl_GlobalInvocationID.x;
if (cell_index >= params.cell_count) {
return;
}
@ -427,7 +401,6 @@ void main() {
#endif
}
#ifdef MODE_ANISOTROPIC
for (uint i = 0; i < 6; i++) {
@ -446,17 +419,15 @@ void main() {
#endif
#endif //MODE_COMPUTE_LIGHT
/////////////////SECOND BOUNCE///////////////////////////////
#ifdef MODE_SECOND_BOUNCE
vec3 pos = vec3(posu) + vec3(0.5);
ivec3 ipos = ivec3(posu);
vec4 normal = unpackSnorm4x8(cell_data.data[cell_index].normal);
#ifdef MODE_ANISOTROPIC
vec3 accum[6];
const vec3 accum_dirs[6] = vec3[](vec3(1.0, 0.0, 0.0), vec3(-1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, -1.0));
@ -537,9 +508,7 @@ void main() {
float a = (1.0 - color.a);
color += a * scolor;
dist += half_diameter;
}
}
color *= cone_weights[i] * vec4(albedo.rgb, 1.0) * params.dynamic_range; //restore range
#ifdef MODE_ANISOTROPIC
@ -567,6 +536,7 @@ void main() {
#endif
#endif // MODE_SECOND_BOUNCE
/////////////////UPDATE MIPMAPS///////////////////////////////
#ifdef MODE_UPDATE_MIPMAPS
@ -611,9 +581,6 @@ void main() {
#else
outputs.data[cell_index] = vec4(light_accum / divisor, 0.0);
#endif
}
#endif
@ -635,7 +602,6 @@ void main() {
vec3 iso_positive = vec3(dot(outputs.data[cell_index * 6 + 0].rgb, GREY_VEC), dot(outputs.data[cell_index * 6 + 2].rgb, GREY_VEC), dot(outputs.data[cell_index * 6 + 4].rgb, GREY_VEC)) / vec3(accum_total_energy);
vec3 iso_negative = vec3(dot(outputs.data[cell_index * 6 + 1].rgb, GREY_VEC), dot(outputs.data[cell_index * 6 + 3].rgb, GREY_VEC), dot(outputs.data[cell_index * 6 + 5].rgb, GREY_VEC)) / vec3(accum_total_energy);
{
uint aniso_pos = uint(clamp(iso_positive.b * 31.0, 0.0, 31.0));
aniso_pos |= uint(clamp(iso_positive.g * 63.0, 0.0, 63.0)) << 5;
@ -657,8 +623,6 @@ void main() {
imageStore(color_tex, ivec3(posu), vec4(outputs.data[cell_index].rgb / params.dynamic_range, albedo.a));
#endif
}
#endif
@ -679,13 +643,9 @@ void main() {
uv_xy.y = params.rect_size.y - pos_xy.y - 1;
}
#ifdef MODE_DYNAMIC_LIGHTING
{
float z = params.z_base + imageLoad(depth, uv_xy).x * params.z_sign;
ivec3 pos = params.x_dir * (params.rect_pos.x + pos_xy.x) + params.y_dir * (params.rect_pos.y + pos_xy.y) + abs(params.z_dir) * int(z);
@ -693,9 +653,6 @@ void main() {
vec3 normal = imageLoad(source_normal, uv_xy).xyz * 2.0 - 1.0;
normal = vec3(params.x_dir) * normal.x * mix(1.0, -1.0, params.flip_x) + vec3(params.y_dir) * normal.y * mix(1.0, -1.0, params.flip_y) - vec3(params.z_dir) * normal.z;
vec4 albedo = imageLoad(source_albedo, uv_xy);
//determine the position in space
@ -712,14 +669,12 @@ void main() {
light *= albedo.rgb;
accum += max(0.0, dot(normal, -light_dir)) * light;
}
accum += imageLoad(emission, uv_xy).xyz;
imageStore(emission, uv_xy, vec4(accum, albedo.a));
imageStore(depth, uv_xy, vec4(z));
}
#endif // MODE DYNAMIC LIGHTING
@ -753,7 +708,6 @@ void main() {
count += 1.0;
}
if (params.on_mipmap) {
accum.rgb /= mix(8.0, count, params.propagation);
accum.a /= 8.0;
@ -775,7 +729,6 @@ void main() {
#ifdef MODE_DYNAMIC_SHRINK_PLOT
if (accum.a < 0.001) {
return; //do not blit if alpha is too low
}
@ -799,7 +752,6 @@ void main() {
color.a+=color_blit.a;
#else
float sa = 1.0 - color_blit.a;
vec4 result;
result.a = color.a * sa + color_blit.a;
@ -823,8 +775,6 @@ void main() {
#endif // ANISOTROPIC
}
#endif // MODE_DYNAMIC_SHRINK_PLOT
}
#endif

View file

@ -1,3 +1,4 @@
/* clang-format off */
[vertex]
#version 450
@ -10,6 +11,7 @@ struct CellData {
uint emission; //rgb normalized with e as multiplier
uint normal; //RGB normal encoded
};
/* clang-format on */
layout(set = 0, binding = 1, std140) buffer CellDataBuffer {
CellData data[];
@ -24,7 +26,6 @@ layout (set=0,binding=4) uniform texture3D aniso_pos_tex;
layout(set = 0, binding = 5) uniform texture3D aniso_neg_tex;
#endif
layout(push_constant, binding = 0, std430) uniform Params {
mat4 projection;
@ -34,7 +35,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint level;
ivec3 bounds;
uint pad;
} params;
layout(location = 0) out vec4 color_interp;
@ -77,9 +77,7 @@ void main() {
vec3(-1.0f, 1.0f, 1.0f),
vec3(1.0f, 1.0f, 1.0f),
vec3(-1.0f, 1.0f, 1.0f),
vec3(1.0f,-1.0f, 1.0f)
);
vec3(1.0f, -1.0f, 1.0f));
vec3 vertex = cube_triangles[gl_VertexIndex] * 0.5 + 0.5;
#ifdef MODE_DEBUG_LIGHT_FULL
@ -121,8 +119,7 @@ void main() {
POS_X,
POS_Y,
POS_Y,
POS_Z
);
POS_Z);
color_interp.xyz = texelFetch(sampler3D(color_tex, tex_sampler), ivec3(posu), int(params.level)).xyz * params.dynamic_range;
vec3 aniso_pos = texelFetch(sampler3D(aniso_pos_tex, tex_sampler), ivec3(posu), int(params.level)).xyz;
@ -137,7 +134,6 @@ void main() {
case NEG_X: strength = aniso_neg.x; break;
case NEG_Y: strength = aniso_neg.y; break;
case NEG_Z: strength = aniso_neg.z; break;
}
color_interp.xyz *= strength;
@ -160,9 +156,9 @@ void main() {
#else
color_interp.a = params.alpha;
#endif
}
/* clang-format off */
[fragment]
#version 450
@ -170,6 +166,7 @@ void main() {
VERSION_DEFINES
layout(location = 0) in vec4 color_interp;
/* clang-format on */
layout(location = 0) out vec4 frag_color;
void main() {

View file

@ -1,3 +1,4 @@
/* clang-format off */
[compute]
#version 450
@ -5,6 +6,7 @@
VERSION_DEFINES
layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in;
/* clang-format on */
#define MAX_DISTANCE 100000
@ -19,7 +21,6 @@ layout(set=0,binding=1,std430) buffer CellChildrenBuffer {
CellChildren data[];
} cell_children;
struct CellData {
uint position; // xyz 10 bits
uint albedo; //rgb albedo
@ -33,9 +34,7 @@ layout(set=0,binding=2,std430) buffer CellDataBuffer {
layout(r8ui, set = 0, binding = 3) uniform restrict writeonly uimage3D sdf_tex;
layout(push_constant, binding = 0, std430) uniform Params {
uint offset;
uint end;
uint pad0;
@ -67,7 +66,6 @@ void main() {
//imageStore(sdf_tex,pos,uvec4(pos*2,0));
}
#if 0
layout(push_constant, binding = 0, std430) uniform Params {
@ -75,7 +73,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint stack_size;
} params;
float distance_to_aabb(ivec3 pos, ivec3 aabb_pos, ivec3 aabb_size) {
vec3 delta = vec3(max(ivec3(0), max(aabb_pos - pos, pos - (aabb_pos + aabb_size - ivec3(1)))));
@ -98,8 +95,7 @@ void main() {
0x8d11f5,
0x70ae2e,
0x463d47,
0x29cbb8
);
0x29cbb8);
bool cell_found = false;
bool cell_found_exact = false;
@ -122,7 +118,6 @@ void main() {
stack_indices[stack_pos] = (stack_indices[stack_pos] & ((1 << 24) - 1)) | ((index + 1) << 24);
uint cell_index = (stack_indices[stack_pos] >> (index * 3)) & 0x7;
uint child_cell = cell_children.data[stack[stack_pos]].children[cell_index];
@ -163,9 +158,6 @@ void main() {
continue;
}
bvec3 direction = greaterThan((pos - (child_cell_pos + (child_cell_size >> 1))), ivec3(0));
uint cell_order = 0;
cell_order |= mix(0, 1, direction.x);
@ -176,7 +168,6 @@ void main() {
stack_indices[stack_pos + 1] = cell_orders[cell_order]; //start counting
stack_positions[stack_pos + 1] = child_cell_pos;
stack_pos++; //go up stack
}
uint dist_8;
@ -189,6 +180,5 @@ void main() {
}
imageStore(sdf_tex, pos, uvec4(dist_8));
}
#endif

View file

@ -1,3 +1,4 @@
/* clang-format off */
[compute]
#version 450
@ -5,6 +6,7 @@
VERSION_DEFINES
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
/* clang-format on */
#define NO_CHILDREN 0xFFFFFFFF
#define GREY_VEC vec3(0.33333, 0.33333, 0.33333)
@ -35,7 +37,6 @@ layout(set=0,binding=2,std430) buffer CellDataBuffer {
#ifdef MODE_COMPUTE_LIGHT
struct Light {
uint type;
float energy;
float radius;
@ -51,7 +52,6 @@ struct Light {
bool has_shadow;
};
layout(set = 0, binding = 3, std140) uniform Lights {
Light data[MAX_LIGHTS];
} lights;
@ -59,7 +59,6 @@ layout(set=0,binding=3,std140) uniform Lights {
#endif
layout(push_constant, binding = 0, std430) uniform Params {
ivec3 limits;
uint stack_size;
@ -71,16 +70,12 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint cell_offset;
uint cell_count;
uint pad[2];
} params;
layout(set = 0, binding = 4, std140) uniform Outputs {
vec4 data[];
} output;
#ifdef MODE_COMPUTE_LIGHT
uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) {
@ -127,7 +122,6 @@ uint raymarch(float distance,float distance_adv,vec3 from,vec3 direction) {
if (cell != NO_CHILDREN) {
return cell; //found cell!
}
}
from += direction * distance_adv;
@ -139,7 +133,6 @@ uint raymarch(float distance,float distance_adv,vec3 from,vec3 direction) {
bool compute_light_vector(uint light, uint cell, vec3 pos, out float attenuation, out vec3 light_pos) {
if (lights.data[light].type == LIGHT_TYPE_DIRECTIONAL) {
light_pos = pos - lights.data[light].direction * length(vec3(params.limits));
@ -153,10 +146,8 @@ bool compute_light_vector(uint light,uint cell, vec3 pos,out float attenuation,
return false;
}
attenuation = pow(clamp(1.0 - distance / lights.data[light].radius, 0.0001, 1.0), lights.data[light].attenuation);
if (lights.data[light].type == LIGHT_TYPE_SPOT) {
vec3 rel = normalize(pos - light_pos);
@ -198,12 +189,9 @@ float get_normal_advance(vec3 p_normal) {
#endif
void main() {
uint cell_index = gl_GlobalInvocationID.x;;
uint cell_index = gl_GlobalInvocationID.x;
if (cell_index >= params.cell_count) {
return;
}
@ -247,14 +235,11 @@ void main() {
float distance_adv = get_normal_advance(light_dir);
distance += distance_adv - mod(distance, distance_adv); //make it reach the center of the box always
vec3 from = pos - light_dir * distance; //approximate
from -= sign(light_dir) * 0.45; //go near the edge towards the light direction to avoid self occlusion
uint result = raymarch(distance, distance_adv, from, light_dir);
if (result != cell_index) {
@ -276,7 +261,6 @@ void main() {
accum += light + emission;
}
#endif
}
#ifdef MODE_ANISOTROPIC
@ -294,7 +278,6 @@ void main() {
#endif //MODE_COMPUTE_LIGHT
#ifdef MODE_UPDATE_MIPMAPS
{
@ -337,17 +320,11 @@ void main() {
#else
output.data[cell_index] = vec4(light_accum / divisor, 0.0);
#endif
}
#endif
#ifdef MODE_WRITE_TEXTURE
{
}
#endif
}

View file

@ -1,16 +1,12 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#include "scene_forward_inc.glsl"
/* INPUT ATTRIBS */
layout(location = 0) in vec3 vertex_attrib;
@ -64,7 +60,6 @@ MATERIAL_UNIFORMS
} material;
#endif
/* clang-format off */
VERTEX_SHADER_GLOBALS
@ -99,7 +94,6 @@ void main() {
uint offset = (instances.data[instance_index].flags >> INSTANCE_FLAGS_MULTIMESH_STRIDE_SHIFT) & INSTANCE_FLAGS_MULTIMESH_STRIDE_MASK;
offset *= gl_InstanceIndex;
mat4 matrix;
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_MULTIMESH_FORMAT_2D)) {
matrix = mat4(transforms.data[offset + 0], transforms.data[offset + 1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
@ -139,7 +133,6 @@ void main() {
vec3 binormal = normalize(cross(normal, tangent) * binormalf);
#endif
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_SKELETON)) {
//multimesh, instances are for it
@ -162,7 +155,6 @@ void main() {
tangent = (vec4(tangent, 0.0) * m).xyz;
binormal = (vec4(binormal, 0.0) * m).xyz;
#endif
}
#if defined(UV_USED)
@ -177,8 +169,6 @@ void main() {
vec4 position;
#endif
mat4 projection_matrix = scene_data.projection_matrix;
//using world coordinates
@ -222,7 +212,6 @@ VERTEX_SHADER_CODE
tangent = modelview_normal * tangent;
#endif
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
@ -278,24 +267,21 @@ VERTEX_SHADER_CODE
#else
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
#endif
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#include "scene_forward_inc.glsl"
/* Varyings */
layout(location = 0) in vec3 vertex_interp;
/* clang-format on */
layout(location = 1) in vec3 normal_interp;
#if defined(COLOR_USED)
@ -323,7 +309,6 @@ layout(location =8) in float dp_clip;
#endif
//defines to keep compatibility with vertex
#define world_matrix instances.data[instance_index].transform
@ -369,8 +354,6 @@ layout(location = 0) out vec4 frag_color;
#endif // RENDER DEPTH
// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V.
// We're dividing this factor off because the overall term we'll end up looks like
// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012):
@ -461,8 +444,7 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, vec3 attenuation, v
#ifdef USE_SHADOW_TO_OPACITY
inout float alpha,
#endif
inout vec3 diffuse_light, inout vec3 specular_light
) {
inout vec3 diffuse_light, inout vec3 specular_light) {
#if defined(USE_LIGHT_SHADER_CODE)
// light is written by the light shader
@ -696,7 +678,6 @@ float sample_shadow(texture2D shadow, vec2 shadow_pixel_size, vec4 coord) {
#endif //USE_NO_SHADOWS
void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 albedo, float roughness, float metallic, float specular, float p_blob_intensity,
#ifdef LIGHT_TRANSMISSION_USED
vec3 transmission,
@ -743,7 +724,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 a
} else {
splane.z = 1.0 - splane.z;
}
splane.xy /= splane.z;
@ -771,14 +751,12 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 a
binormal, tangent, anisotropy,
#endif
#ifdef USE_SHADOW_TO_OPACITY
alpha
alpha,
#endif
diffuse_light, specular_light);
diffuse_light,
specular_light);
}
void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 albedo, float roughness, float metallic, float specular, float p_blob_intensity,
#ifdef LIGHT_TRANSMISSION_USED
vec3 transmission,
@ -793,9 +771,10 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 a
vec3 binormal, vec3 tangent, float anisotropy,
#endif
#ifdef USE_SHADOW_TO_OPACITY
inout float alpha
inout float alpha,
#endif
inout vec3 diffuse_light, inout vec3 specular_light) {
inout vec3 diffuse_light,
inout vec3 specular_light) {
vec3 light_rel_vec = lights.data[idx].position - vertex;
float light_length = length(light_rel_vec);
@ -811,8 +790,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 a
vec4 color_specular = unpackUnorm4x8(lights.data[idx].color_specular);
color_specular.rgb *= attenuation_energy.y;
/*
if (lights.data[idx].atlas_rect!=vec4(0.0)) {
//use projector texture
@ -951,13 +928,11 @@ vec4 voxel_cone_trace(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction,
float a = (1.0 - color.a);
color += a * scolor;
dist += half_diameter;
}
return color;
}
#ifndef GI_PROBE_HIGH_QUALITY
//faster version for 45 degrees
@ -989,8 +964,6 @@ vec4 voxel_cone_trace_anisotropic_45_degrees(texture3D probe,texture3D aniso_pos
color += scolor;
dist += radius;
radius = max(0.5, tan_half_angle * dist);
}
return color;
@ -1019,7 +992,6 @@ vec4 voxel_cone_trace_45_degrees(texture3D probe, vec3 cell_size, vec3 pos, vec3
color += scolor;
dist += radius;
radius = max(0.5, tan_half_angle * dist);
}
return color;
@ -1027,10 +999,8 @@ vec4 voxel_cone_trace_45_degrees(texture3D probe, vec3 cell_size, vec3 pos, vec3
#endif
#elif defined(GI_PROBE_USE_ANISOTROPY)
//standard voxel cone trace
vec4 voxel_cone_trace_anisotropic(texture3D probe, texture3D aniso_pos, texture3D aniso_neg, vec3 normal, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias) {
@ -1056,20 +1026,15 @@ vec4 voxel_cone_trace_anisotropic(texture3D probe,texture3D aniso_pos,texture3D
scolor *= a;
color += scolor;
dist += half_diameter;
}
return color;
}
#endif
void gi_probe_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3 normal_xform, float roughness, vec3 ambient, vec3 environment, inout vec4 out_spec, inout vec4 out_diff) {
position = (gi_probes.data[index].xform * vec4(position, 1.0)).xyz;
ref_vec = normalize((gi_probes.data[index].xform * vec4(ref_vec, 0.0)).xyz);
normal = normalize((gi_probes.data[index].xform * vec4(normal, 0.0)).xyz);
@ -1145,7 +1110,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal,vec3 ref_vec, mat3
#else
#ifdef GI_PROBE_USE_ANISOTROPY
vec4 cone_light = voxel_cone_trace_anisotropic_45_degrees(gi_probe_textures[gi_probes.data[index].texture_slot], gi_probe_textures[gi_probes.data[index].texture_slot + 1], gi_probe_textures[gi_probes.data[index].texture_slot + 2], normalize(mix(dir, normal, gi_probes.data[index].anisotropy_strength)), cell_size, position, dir, cone_angle_tan, max_distance, gi_probes.data[index].bias);
#else
@ -1158,8 +1122,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal,vec3 ref_vec, mat3
}
light += cone_weights[i] * cone_light.rgb;
}
light *= gi_probes.data[index].dynamic_range;
@ -1205,7 +1167,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal,vec3 ref_vec, mat3
#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
void main() {
#ifdef MODE_DUAL_PARABOLOID
@ -1281,7 +1242,6 @@ void main() {
float sss_strength = 0.0;
{
/* clang-format off */
@ -1380,14 +1340,11 @@ FRAGMENT_SHADER_CODE
ambient_light = mix(ambient_light, cubemap_ambient * scene_data.ambient_light_color_energy.a, scene_data.ambient_color_sky_mix);
}
}
#endif // USE_LIGHTMAP
#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
//radiance
float specular_blob_intensity = 1.0;
@ -1434,13 +1391,11 @@ FRAGMENT_SHADER_CODE
specular_light = spec_accum.rgb;
ambient_light = amb_accum.rgb;
}
}
#endif
{ // process reflections
vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
@ -1448,7 +1403,6 @@ FRAGMENT_SHADER_CODE
for (uint i = 0; i < reflection_probe_count; i++) {
uint ref_index = instances.data[instance_index].reflection_probe_indices[i >> 1];
if (bool(i & 1)) {
@ -1457,9 +1411,7 @@ FRAGMENT_SHADER_CODE
ref_index &= 0xFFFF;
}
reflection_process(ref_index, vertex, normal, roughness, ambient_light, specular_light, ambient_accum, reflection_accum);
}
if (reflection_accum.a > 0.0) {
@ -1471,8 +1423,6 @@ FRAGMENT_SHADER_CODE
ambient_light = ambient_accum.rgb / ambient_accum.a;
}
#endif
}
{
@ -1548,7 +1498,6 @@ FRAGMENT_SHADER_CODE
float shadow2 = sample_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size, pssm_coord);
shadow = mix(shadow, shadow2, pssm_blend);
}
shadow = mix(shadow, 1.0, smoothstep(directional_lights.data[i].fade_from, directional_lights.data[i].fade_to, vertex.z)); //done with negative values for performance
@ -1556,7 +1505,6 @@ FRAGMENT_SHADER_CODE
light_attenuation = mix(directional_lights.data[i].shadow_color, vec3(1.0), shadow);
}
light_compute(normal, directional_lights.data[i].direction, normalize(view), directional_lights.data[i].color * directional_lights.data[i].energy, light_attenuation, albedo, roughness, metallic, specular, directional_lights.data[i].specular * specular_blob_intensity,
#ifdef LIGHT_TRANSMISSION_USED
transmission,
@ -1571,9 +1519,10 @@ FRAGMENT_SHADER_CODE
binormal, tangent, anisotropy,
#endif
#ifdef USE_SHADOW_TO_OPACITY
alpha
alpha,
#endif
diffuse_light, specular_light);
diffuse_light,
specular_light);
}
}
@ -1613,7 +1562,6 @@ FRAGMENT_SHADER_CODE
#endif
diffuse_light, specular_light);
}
}
{ //spot lights
@ -1652,12 +1600,8 @@ FRAGMENT_SHADER_CODE
#endif
diffuse_light, specular_light);
}
}
#ifdef USE_SHADOW_TO_OPACITY
alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
@ -1679,7 +1623,6 @@ FRAGMENT_SHADER_CODE
#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
#ifdef MODE_RENDER_DEPTH
#ifdef MODE_RENDER_MATERIAL

View file

@ -1,4 +1,3 @@
#define M_PI 3.14159265359
#define ROUGHNESS_MAX_LOD 5
@ -7,11 +6,8 @@ layout(push_constant, binding = 0, std430) uniform DrawCall {
uint pad[3]; //16 bits minimum size
} draw_call;
/* Set 0 Scene data that never changes, ever */
#define SAMPLER_NEAREST_CLAMP 0
#define SAMPLER_LINEAR_CLAMP 1
#define SAMPLER_NEAREST_WITH_MIMPAMPS_CLAMP 2
@ -44,7 +40,6 @@ layout(set=0,binding=3,std140) uniform SceneData {
float z_offset;
float z_slope_scale;
float time;
float reflection_multiplier; // one normally, zero when rendering reflections
@ -74,14 +69,12 @@ layout(set=0,binding=3,std140) uniform SceneData {
float ambient_energy;
float bg_energy;
#endif
#if 0
vec2 shadow_atlas_pixel_size;
vec2 directional_shadow_pixel_size;
float z_far;
float subsurface_scatter_width;
@ -118,7 +111,6 @@ layout(set=0,binding=3,std140) uniform SceneData {
#define INSTANCE_FLAGS_SKELETON (1 << 19)
struct InstanceData {
mat4 transform;
mat4 normal_transform;
@ -133,13 +125,11 @@ struct InstanceData {
uint decal_indices[4];
};
layout(set = 0, binding = 4, std430) buffer Instances {
InstanceData data[];
} instances;
struct LightData { //this structure needs to be 128 bits
vec3 position;
float inv_radius;
vec3 direction;
@ -173,7 +163,6 @@ layout(set=0,binding=6,std140) uniform ReflectionProbeData {
} reflections;
struct DirectionalLightData {
vec3 direction;
float energy;
vec3 color;
@ -189,7 +178,6 @@ struct DirectionalLightData {
mat4 shadow_matrix2;
mat4 shadow_matrix3;
mat4 shadow_matrix4;
};
layout(set = 0, binding = 7, std140) uniform DirectionalLights {
@ -218,10 +206,8 @@ layout(set=0,binding=8,std140) uniform GIProbes {
layout(set = 0, binding = 9) uniform texture3D gi_probe_textures[MAX_GI_PROBE_TEXTURES];
/* Set 1, Scene data that changes per render pass */
layout(set = 1, binding = 0) uniform texture2D depth_buffer;
layout(set = 1, binding = 1) uniform texture2D color_buffer;
layout(set = 1, binding = 2) uniform texture2D normal_buffer;
@ -237,14 +223,12 @@ layout(set = 1, binding = 4) uniform textureCube radiance_cubemap;
#endif
layout(set = 1, binding = 5) uniform textureCubeArray reflection_atlas;
layout(set = 1, binding = 6) uniform texture2D shadow_atlas;
layout(set = 1, binding = 7) uniform texture2D directional_shadow_atlas;
/* Set 2 Skeleton & Instancing (Multimesh) */
layout(set = 2, binding = 0, std430) buffer Transforms {
@ -252,5 +236,3 @@ layout(set=2,binding=0,std430) buffer Transforms {
} transforms;
/* Set 3 User Material */

View file

@ -1,14 +1,12 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) out vec2 uv_interp;
/* clang-format on */
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
@ -17,7 +15,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float alpha;
float depth;
float pad;
} params;
void main() {
@ -25,26 +22,22 @@ void main() {
vec2 base_arr[4] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0), vec2(1.0, -1.0));
uv_interp = base_arr[gl_VertexIndex];
gl_Position = vec4(uv_interp, params.depth, 1.0);
}
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
#define M_PI 3.14159265359
layout(location = 0) in vec2 uv_interp;
/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_panorama;
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
vec4 proj;
@ -52,10 +45,8 @@ layout(push_constant, binding = 1, std430) uniform Params {
float alpha;
float depth;
float pad;
} params;
vec4 texturePanorama(sampler2D pano, vec3 normal) {
vec2 st = vec2(
@ -70,10 +61,8 @@ vec4 texturePanorama(sampler2D pano, vec3 normal) {
return texture(pano, st);
}
layout(location = 0) out vec4 frag_color;
void main() {
vec3 cube_normal;
@ -85,5 +74,4 @@ void main() {
frag_color.rgb = texturePanorama(source_panorama, normalize(cube_normal.xyz)).rgb;
frag_color.a = params.alpha;
}

View file

@ -1,14 +1,12 @@
/* clang-format off */
[vertex]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) out vec2 uv_interp;
/* clang-format on */
void main() {
@ -20,16 +18,12 @@ void main() {
/* clang-format off */
[fragment]
/* clang-format on */
#version 450
/* clang-format off */
VERSION_DEFINES
/* clang-format on */
layout(location = 0) in vec2 uv_interp;
/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_color;
layout(set = 1, binding = 0) uniform sampler2D source_auto_exposure;
@ -54,7 +48,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float exposure;
float white;
float auto_exposure_grey;
} params;
layout(location = 0) out vec4 frag_color;
@ -95,7 +88,6 @@ float h1(float a) {
return 1.0f + w3(a) / (w2(a) + w3(a));
}
vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
float lod = float(p_lod);
vec2 tex_size = vec2(params.glow_texture_size >> p_lod);