Skip to content

Commit

Permalink
Merge pull request godotengine#36098 from godotengine/vulkan
Browse files Browse the repository at this point in the history
Add initial Vulkan support, master branch goes UNSTABLE
  • Loading branch information
akien-mga authored Feb 11, 2020
2 parents 3e3f8a4 + db81928 commit 1eb424e
Show file tree
Hide file tree
Showing 739 changed files with 334,592 additions and 12,007 deletions.
77 changes: 41 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ language: cpp
dist: xenial

stages:
- check
- build

env:
Expand All @@ -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
Expand All @@ -34,7 +33,7 @@ matrix:

- name: Linux editor (debug, GCC 9, with Mono)
stage: build
env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes"
env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra"
os: linux
compiler: gcc-9
addons:
Expand All @@ -49,56 +48,62 @@ matrix:

- name: Linux export template (release, Clang)
stage: build
env: PLATFORM=x11 TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
env: PLATFORM=x11 TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra"
os: linux
compiler: clang
addons:
apt:
packages:
- *linux_deps

- name: Android export template (release_debug, Clang)
stage: build
env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
os: linux
compiler: clang
addons:
apt:
packages:
- openjdk-8-jdk
# TODO: Android support

- name: macOS editor (debug, Clang)
stage: build
env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes"
os: osx
compiler: clang
addons:
homebrew:
packages:
- scons
# - name: Android export template (release_debug, Clang)
# stage: build
# env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
# os: linux
# compiler: clang
# addons:
# apt:
# packages:
# - openjdk-8-jdk

- name: iOS export template (debug, Clang)
- name: macOS editor (debug, Clang)
stage: build
env: PLATFORM=iphone TOOLS=no TARGET=debug CACHE_NAME=${PLATFORM}-clang
env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra" # werror=yes
os: osx
compiler: clang
addons:
homebrew:
packages:
- scons

- name: Linux headless editor (release_debug, GCC 9, testing project exporting and script running)
stage: build
env: PLATFORM=server TOOLS=yes TARGET=release_debug CACHE_NAME=${PLATFORM}-tools-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="warnings=extra werror=yes" TEST_PROJECT=yes
os: linux
compiler: gcc-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *gcc9_deps
- *linux_deps
# TODO: iOS MoltenVK support

# - name: iOS export template (debug, Clang)
# stage: build
# env: PLATFORM=iphone TOOLS=no TARGET=debug CACHE_NAME=${PLATFORM}-clang
# os: osx
# compiler: clang
# addons:
# homebrew:
# packages:
# - scons

# TODO: Dummy/Offscreen rasterizer

# - name: Linux headless editor (release_debug, GCC 9, testing project exporting and script running)
# stage: build
# env: PLATFORM=server TOOLS=yes TARGET=release_debug CACHE_NAME=${PLATFORM}-tools-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="warnings=extra werror=yes" TEST_PROJECT=yes
# os: linux
# compiler: gcc-9
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - *gcc9_deps
# - *linux_deps

- name: Linux export template (release_debug, GCC 5, without 3D support)
stage: build
Expand Down
130 changes: 130 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ Comment: Open Asset Import Library (assimp)
Copyright: 2006-2016, assimp team
License: BSD-3-clause

Files: ./thirdparty/basis_universal/
Comment: Basis Universal
Copyright: 2019, Binomial LLC.
License: Apache-2.0

Files: ./thirdparty/bullet/
Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2003-2013, Erwin Coumans
Expand Down Expand Up @@ -167,6 +172,12 @@ Comment: glad
Copyright: 2013-2019, David Herberth
License: Expat

Files: ./thirdparty/glslang/
Comment: glslang
Copyright: 2015-2018 Google, Inc.
2002, NVIDIA Corporation.
License: glslang

Files: ./thirdparty/jpeg_compressor/
Comment: jpeg-compressor
Copyright: 2012, Rich Geldreich
Expand Down Expand Up @@ -354,6 +365,19 @@ Copyright: 2011, Khaled Mamou
2003-2009, Erwin Coumans
License: BSD-3-clause

Files: ./thirdparty/vulkan/
Comment: Vulkan Ecosystem Components (Vulkan ICD loader and headers)
Copyright: 2014-2019, The Khronos Group Inc.
2014-2019, Valve Corporation
2014-2019, LunarG, Inc.
2015-2019, Google Inc.
License: Apache-2.0

Files: ./thirdparty/vulkan/vk_mem_alloc.h
Comment: Vulkan Memory Allocator
Copyright: 2017-2019, Advanced Micro Devices, Inc.
License: Expat

Files: ./thirdparty/wslay/
Comment: Wslay
Copyright: 2011-2015, Tatsuhiro Tsujikawa
Expand Down Expand Up @@ -882,6 +906,112 @@ License: Expat
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

License: glslang
Here, glslang proper means core GLSL parsing, HLSL parsing, and SPIR-V code
generation. Glslang proper requires use of two licenses, one that covers
non-preprocessing and an additional one that covers preprocessing.
.
Bison was removed long ago. You can build glslang from the source grammar,
using tools of your choice, without using bison or any bison files.
.
Other parts, outside of glslang proper, include:
.
- gl_types.h, only needed for OpenGL-like reflection, and can be left out of
a parse and codegen project. See it for its license.
.
- update_glslang_sources.py, which is not part of the project proper and does
not need to be used.
.
- the SPIR-V "remapper", which is optional, but has the same license as
glslang proper
.
- Google tests and SPIR-V tools, and anything in the external subdirectory
are external and optional; see them for their respective licenses.
.
--------------------------------------------------------------------------------
.
The core of glslang-proper, minus the preprocessor is licenced as follows:
.
Copyright (C) 2015-2018 Google, Inc.
Copyright (C) <various other dates and companies>
.
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
.
Neither the name of 3Dlabs Inc. Ltd. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
.
--------------------------------------------------------------------------------
.
The preprocessor has the core license stated above, plus an additional licence:
.
Copyright (c) 2002, NVIDIA Corporation.
.
NVIDIA Corporation("NVIDIA") supplies this software to you in
consideration of your agreement to the following terms, and your use,
installation, modification or redistribution of this NVIDIA software
constitutes acceptance of these terms. If you do not agree with these
terms, please do not use, install, modify or redistribute this NVIDIA
software.
.
In consideration of your agreement to abide by the following terms, and
subject to these terms, NVIDIA grants you a personal, non-exclusive
license, under NVIDIA's copyrights in this original NVIDIA software (the
"NVIDIA Software"), to use, reproduce, modify and redistribute the
NVIDIA Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the NVIDIA Software, you must
retain the copyright notice of NVIDIA, this notice and the following
text and disclaimers in all such redistributions of the NVIDIA Software.
Neither the name, trademarks, service marks nor logos of NVIDIA
Corporation may be used to endorse or promote products derived from the
NVIDIA Software without specific prior written permission from NVIDIA.
Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
PRODUCTS.
.
IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: FTL
The FreeType Project LICENSE
----------------------------
Expand Down
4 changes: 4 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ opts.Add('p', "Platform (alias for 'platform')", '')
opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
opts.Add(EnumVariable('optimize', "Optimization type", 'speed', ('speed', 'size')))

opts.Add(BoolVariable('tools', "Build the tools (a.k.a. the Godot editor)", True))
opts.Add(BoolVariable('use_lto', 'Use link-time optimization', False))
opts.Add(BoolVariable('use_precise_math_checks', 'Math checks use very precise epsilon (useful to debug the engine)', False))
Expand Down Expand Up @@ -139,6 +140,7 @@ opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True)
opts.Add(BoolVariable('builtin_certs', "Bundle default SSL certificates to be used if you don't specify an override in the project settings", True))
opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True))
opts.Add(BoolVariable('builtin_freetype', "Use the built-in FreeType library", True))
opts.Add(BoolVariable('builtin_glslang', "Use the built-in glslang library", True))
opts.Add(BoolVariable('builtin_libogg', "Use the built-in libogg library", True))
opts.Add(BoolVariable('builtin_libpng', "Use the built-in libpng library", True))
opts.Add(BoolVariable('builtin_libtheora', "Use the built-in libtheora library", True))
Expand All @@ -154,6 +156,7 @@ opts.Add(BoolVariable('builtin_pcre2_with_jit', "Use JIT compiler for the built-
opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True))
opts.Add(BoolVariable('builtin_rvo2', "Use the built-in RVO2 library", True))
opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True))
opts.Add(BoolVariable('builtin_vulkan', "Use the built-in Vulkan loader library and headers", True))
opts.Add(BoolVariable('builtin_xatlas', "Use the built-in xatlas library", True))
opts.Add(BoolVariable('builtin_zlib', "Use the built-in zlib library", True))
opts.Add(BoolVariable('builtin_zstd', "Use the built-in Zstd library", True))
Expand Down Expand Up @@ -497,6 +500,7 @@ if selected_platform in platform_list:
if (not env["platform"] == "server"): # FIXME: detect GLES3
env.Append(BUILDERS = { 'GLES3_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_gles3_headers), suffix='glsl.gen.h', src_suffix='.glsl')})
env.Append(BUILDERS = { 'GLES2_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_gles2_headers), suffix='glsl.gen.h', src_suffix='.glsl')})
env.Append(BUILDERS = { 'RD_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_rd_headers), suffix='glsl.gen.h', src_suffix='.glsl')})

scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
Expand Down
2 changes: 1 addition & 1 deletion core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,7 @@ void _Semaphore::_bind_methods() {

_Semaphore::_Semaphore() {

semaphore = Semaphore::create();
semaphore = SemaphoreOld::create();
}

_Semaphore::~_Semaphore() {
Expand Down
3 changes: 2 additions & 1 deletion core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class _OS : public Object {
enum VideoDriver {
VIDEO_DRIVER_GLES3,
VIDEO_DRIVER_GLES2,
VIDEO_DRIVER_VULKAN,
};

enum PowerState {
Expand Down Expand Up @@ -642,7 +643,7 @@ class _Mutex : public Reference {
class _Semaphore : public Reference {

GDCLASS(_Semaphore, Reference);
Semaphore *semaphore;
SemaphoreOld *semaphore;

static void _bind_methods();

Expand Down
13 changes: 13 additions & 0 deletions core/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,19 @@ StringName ClassDB::get_parent_class_nocheck(const StringName &p_class) {
return ti->inherits;
}

StringName ClassDB::get_compatibility_remapped_class(const StringName &p_class) {

if (classes.has(p_class)) {
return p_class;
}

if (compat_classes.has(p_class)) {
return compat_classes[p_class];
}

return p_class;
}

StringName ClassDB::get_parent_class(const StringName &p_class) {

OBJTYPE_RLOCK;
Expand Down
1 change: 1 addition & 0 deletions core/class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class ClassDB {
static void get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes);
static StringName get_parent_class_nocheck(const StringName &p_class);
static StringName get_parent_class(const StringName &p_class);
static StringName get_compatibility_remapped_class(const StringName &p_class);
static bool class_exists(const StringName &p_class);
static bool is_parent_class(const StringName &p_class, const StringName &p_inherits);
static bool can_instance(const StringName &p_class);
Expand Down
8 changes: 0 additions & 8 deletions core/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,6 @@ Color Color::operator+(const Color &p_color) const {
a + p_color.a);
}

void Color::operator+=(const Color &p_color) {

r = r + p_color.r;
g = g + p_color.g;
b = b + p_color.b;
a = a + p_color.a;
}

Color Color::operator-(const Color &p_color) const {

return Color(
Expand Down
7 changes: 6 additions & 1 deletion core/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ struct Color {
}

Color operator+(const Color &p_color) const;
void operator+=(const Color &p_color);
_FORCE_INLINE_ void operator+=(const Color &p_color) {
r = r + p_color.r;
g = g + p_color.g;
b = b + p_color.b;
a = a + p_color.a;
}

Color operator-() const;
Color operator-(const Color &p_color) const;
Expand Down
Loading

0 comments on commit 1eb424e

Please sign in to comment.