mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-22 00:48:09 +01:00
Fix frt's compile.
This commit is contained in:
parent
a197623126
commit
adcc57bc7b
@ -21,27 +21,18 @@ env.Append(BUILDERS={'DLCPP': env.Builder(action=procdl.build_cc_action, suffix=
|
||||
for dl in Glob('dl/*.dl'):
|
||||
env.DLH(str(dl))
|
||||
env.DLCPP(str(dl))
|
||||
for libname in ['gles2', 'gles3']:
|
||||
env.Depends('platform_config.h', 'dl/' + libname + '.gen.h')
|
||||
|
||||
env.Depends('platform_config.h', 'dl/gles2.gen.h')
|
||||
env.Depends('platform_config.h', 'dl/gles2.gen.cc')
|
||||
|
||||
frt_env = env.Clone()
|
||||
frt_env.ParseConfig(env['FRT_PKG_CONFIG'] + ' sdl2 --cflags --libs')
|
||||
|
||||
common_sources = [ 'frt_exe.cc', 'frt.cc' ]
|
||||
|
||||
import version
|
||||
if version.major == 2:
|
||||
version_sources = ['frt_godot2.cc', 'dl/gles2.gen.cc']
|
||||
elif version.major == 3:
|
||||
version_sources = ['frt_godot3.cc', 'dl/gles2.gen.cc', 'dl/gles3.gen.cc']
|
||||
common_sources = [ 'frt_exe.cc', 'frt.cc', 'frt_godot3.cc', 'dl/gles2.gen.cc' ]
|
||||
|
||||
std = env['frt_std']
|
||||
if std == 'auto':
|
||||
std = {
|
||||
2: 'c++98',
|
||||
3: 'c++14',
|
||||
}[version.major]
|
||||
if std != 'no':
|
||||
frt_env.Append(CCFLAGS=['-std=' + std])
|
||||
|
||||
prog = frt_env.add_program('#bin/godot', common_sources + version_sources)
|
||||
if std != 'no':
|
||||
frt_env.Append(CCFLAGS=['-std=c++14'])
|
||||
|
||||
prog = frt_env.add_program('#bin/pandemonium', common_sources)
|
||||
|
@ -1,19 +1,111 @@
|
||||
# detect.py
|
||||
# detect.py + detect_godot3.py
|
||||
#
|
||||
# FRT - A Godot platform targeting single board computers
|
||||
# Copyright (c) 2017-2022 Emanuele Fornara
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
import version
|
||||
if version.major == 2:
|
||||
from detect_godot2 import *
|
||||
version_handled = True
|
||||
elif version.major == 3:
|
||||
from detect_godot3 import *
|
||||
version_handled = True
|
||||
else:
|
||||
version_handled = False
|
||||
|
||||
# TODO factor out common bits
|
||||
|
||||
def get_opts():
|
||||
from SCons.Variables import BoolVariable
|
||||
return [
|
||||
BoolVariable('use_llvm', 'Use llvm compiler', False),
|
||||
BoolVariable('use_lto', 'Use link time optimization', False),
|
||||
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically', False),
|
||||
('frt_std', 'C++ standard for frt itself (no/auto/c++98/...)', 'auto'),
|
||||
('frt_arch', 'Architecture (no/arm32v6/arm32v7/arm64v8)', 'no'),
|
||||
('frt_cross', 'Cross compilation (no/auto/<triple>)', 'no'),
|
||||
]
|
||||
|
||||
def get_flags():
|
||||
return [
|
||||
]
|
||||
|
||||
def configure_compiler(env):
|
||||
if env['use_llvm']:
|
||||
env['CC'] = 'clang'
|
||||
env['CXX'] = 'clang++'
|
||||
env['LD'] = 'clang++'
|
||||
env.extra_suffix += '.llvm'
|
||||
|
||||
def configure_lto(env):
|
||||
if not env['use_lto']:
|
||||
return
|
||||
if env['use_llvm']:
|
||||
env.Append(CCFLAGS=['-flto=thin'])
|
||||
env.Append(LINKFLAGS=['-fuse-ld=lld', '-flto=thin'])
|
||||
env['AR'] = 'llvm-ar'
|
||||
env['RANLIB'] = 'llvm-ranlib'
|
||||
else:
|
||||
env.Append(CCFLAGS=['-flto'])
|
||||
env.Append(LINKFLAGS=['-flto'])
|
||||
env.extra_suffix += '.lto'
|
||||
|
||||
def configure_arch(env):
|
||||
if env['frt_arch'] == 'arm32v6':
|
||||
env.Append(CCFLAGS=['-march=armv6', '-mfpu=vfp', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v6'
|
||||
elif env['frt_arch'] == 'arm32v7':
|
||||
env.Append(CCFLAGS=['-march=armv7-a', '-mfpu=neon-vfpv4', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v7'
|
||||
elif env['frt_arch'] == 'arm64v8':
|
||||
env.Append(CCFLAGS=['-march=armv8-a'])
|
||||
env.extra_suffix += '.arm64v8'
|
||||
|
||||
def configure_cross(env):
|
||||
if env['frt_cross'] == 'no':
|
||||
env['FRT_PKG_CONFIG'] = 'pkg-config'
|
||||
return
|
||||
if env['frt_cross'] == 'auto':
|
||||
triple = {
|
||||
'arm32v7': 'arm-linux-gnueabihf',
|
||||
'arm64v8': 'aarch64-linux-gnu',
|
||||
}[env['frt_arch']]
|
||||
else:
|
||||
triple = env['frt_cross']
|
||||
if env['use_llvm']:
|
||||
env.Append(CCFLAGS=['-target', triple])
|
||||
env.Append(LINKFLAGS=['-target', triple])
|
||||
else:
|
||||
env['CC'] = triple + '-gcc'
|
||||
env['CXX'] = triple + '-g++'
|
||||
env['FRT_PKG_CONFIG'] = triple + '-pkg-config'
|
||||
|
||||
def configure_target(env):
|
||||
if env['target'] == 'release':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
|
||||
elif env['target'] == 'release_debug':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math'])
|
||||
elif env['target'] == 'debug':
|
||||
env.Append(CCFLAGS=['-g2'])
|
||||
|
||||
def configure_misc(env):
|
||||
env.Append(CPPPATH=['#platform/frt'])
|
||||
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_ENABLED', '-DJOYDEV_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DFRT_ENABLED'])
|
||||
env.Append(CFLAGS=['-std=gnu11']) # for libwebp (maybe more in the future)
|
||||
env.Append(LIBS=['pthread', 'z', 'dl'])
|
||||
if env['frt_arch'] == 'arm32v6' and version.minor >= 4: # TODO find out exact combination
|
||||
env.Append(LIBS=['atomic'])
|
||||
if env['CXX'] == 'clang++':
|
||||
env['CC'] = 'clang'
|
||||
env['LD'] = 'clang++'
|
||||
if env['use_static_cpp']:
|
||||
env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
|
||||
|
||||
def configure(env):
|
||||
configure_compiler(env)
|
||||
configure_lto(env)
|
||||
configure_arch(env)
|
||||
configure_cross(env)
|
||||
configure_target(env)
|
||||
configure_misc(env)
|
||||
|
||||
def get_name():
|
||||
return "FRT"
|
||||
@ -25,7 +117,5 @@ def can_build():
|
||||
import os
|
||||
if os.name != "posix":
|
||||
return False
|
||||
if not version_handled:
|
||||
print("Error: Godot version not handled by FRT. Aborting.")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
@ -1,111 +0,0 @@
|
||||
# detect_godot2.py
|
||||
#
|
||||
# FRT - A Godot platform targeting single board computers
|
||||
# Copyright (c) 2017-2022 Emanuele Fornara
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
def get_opts():
|
||||
return [
|
||||
('use_llvm', 'Use llvm compiler', 'no'),
|
||||
('use_lto', 'Use link time optimization', 'no'),
|
||||
('use_static_cpp', 'Link libgcc and libstdc++ statically', 'no'),
|
||||
('frt_std', 'C++ standard for frt itself (no/auto/c++98/...)', 'auto'),
|
||||
('frt_arch', 'Architecture (no/arm32v6/arm32v7/arm64v8)', 'no'),
|
||||
('frt_cross', 'Cross compilation (no/auto/<triple>)', 'no'),
|
||||
]
|
||||
|
||||
def get_flags():
|
||||
return [
|
||||
]
|
||||
|
||||
def configure_compiler(env):
|
||||
if env['use_llvm'] == 'yes':
|
||||
env['CC'] = 'clang'
|
||||
env['CXX'] = 'clang++'
|
||||
env['LD'] = 'clang++'
|
||||
env.extra_suffix += '.llvm'
|
||||
else:
|
||||
print('Newer GCC compilers not supported in Godot 2. Handle with care.')
|
||||
|
||||
def configure_lto(env):
|
||||
if env['use_lto'] == 'no':
|
||||
return
|
||||
if env['use_llvm'] == 'yes':
|
||||
env.Append(CCFLAGS=['-flto=thin'])
|
||||
env.Append(LINKFLAGS=['-fuse-ld=lld', '-flto=thin'])
|
||||
env['AR'] = 'llvm-ar'
|
||||
env['RANLIB'] = 'llvm-ranlib'
|
||||
else:
|
||||
env.Append(CCFLAGS=['-flto'])
|
||||
env.Append(LINKFLAGS=['-flto'])
|
||||
env.extra_suffix += '.lto'
|
||||
|
||||
def configure_arch(env):
|
||||
if env['frt_arch'] == 'arm32v6':
|
||||
env.Append(CCFLAGS=['-march=armv6', '-mfpu=vfp', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v6'
|
||||
elif env['frt_arch'] == 'arm32v7':
|
||||
env.Append(CCFLAGS=['-march=armv7-a', '-mfpu=neon-vfpv4', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v7'
|
||||
elif env['frt_arch'] == 'arm64v8':
|
||||
env.Append(CCFLAGS=['-march=armv8-a'])
|
||||
env.extra_suffix += '.arm64v8'
|
||||
|
||||
def configure_cross(env):
|
||||
if env['frt_cross'] == 'no':
|
||||
env['FRT_PKG_CONFIG'] = 'pkg-config'
|
||||
return
|
||||
if env['frt_cross'] == 'auto':
|
||||
triple = {
|
||||
'arm32v7': 'arm-linux-gnueabihf',
|
||||
'arm64v8': 'aarch64-linux-gnu',
|
||||
}[env['frt_arch']]
|
||||
else:
|
||||
triple = env['frt_cross']
|
||||
if env['use_llvm'] == 'yes':
|
||||
env.Append(CCFLAGS=['-target', triple])
|
||||
env.Append(LINKFLAGS=['-target', triple])
|
||||
else:
|
||||
env['CC'] = triple + '-gcc'
|
||||
env['CXX'] = triple + '-g++'
|
||||
env['FRT_PKG_CONFIG'] = triple + '-pkg-config'
|
||||
|
||||
def configure_glsl_builders(env):
|
||||
import methods
|
||||
env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||
env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||
env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||
|
||||
def configure_target(env):
|
||||
if env['target'] == 'release':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
|
||||
elif env['target'] == 'release_debug':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||
elif env['target'] == 'debug':
|
||||
env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
def configure_misc(env):
|
||||
env.Append(CPPPATH=['#platform/frt'])
|
||||
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DJOYDEV_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DFRT_ENABLED'])
|
||||
env.Append(LIBS=['pthread', 'z'])
|
||||
if env['CXX'] == 'clang++':
|
||||
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
|
||||
env['CC'] = 'clang'
|
||||
env['LD'] = 'clang++'
|
||||
if env['use_static_cpp'] == 'yes':
|
||||
env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
|
||||
|
||||
def configure(env):
|
||||
configure_compiler(env)
|
||||
configure_lto(env)
|
||||
configure_arch(env)
|
||||
configure_cross(env)
|
||||
configure_glsl_builders(env)
|
||||
configure_target(env)
|
||||
configure_misc(env)
|
@ -1,108 +0,0 @@
|
||||
# detect_godot3.py
|
||||
#
|
||||
# FRT - A Godot platform targeting single board computers
|
||||
# Copyright (c) 2017-2022 Emanuele Fornara
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
import version
|
||||
|
||||
# TODO factor out common bits
|
||||
|
||||
def get_opts():
|
||||
from SCons.Variables import BoolVariable
|
||||
return [
|
||||
BoolVariable('use_llvm', 'Use llvm compiler', False),
|
||||
BoolVariable('use_lto', 'Use link time optimization', False),
|
||||
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically', False),
|
||||
('frt_std', 'C++ standard for frt itself (no/auto/c++98/...)', 'auto'),
|
||||
('frt_arch', 'Architecture (no/arm32v6/arm32v7/arm64v8)', 'no'),
|
||||
('frt_cross', 'Cross compilation (no/auto/<triple>)', 'no'),
|
||||
]
|
||||
|
||||
def get_flags():
|
||||
return [
|
||||
]
|
||||
|
||||
def configure_compiler(env):
|
||||
if env['use_llvm']:
|
||||
env['CC'] = 'clang'
|
||||
env['CXX'] = 'clang++'
|
||||
env['LD'] = 'clang++'
|
||||
env.extra_suffix += '.llvm'
|
||||
|
||||
def configure_lto(env):
|
||||
if not env['use_lto']:
|
||||
return
|
||||
if env['use_llvm']:
|
||||
env.Append(CCFLAGS=['-flto=thin'])
|
||||
env.Append(LINKFLAGS=['-fuse-ld=lld', '-flto=thin'])
|
||||
env['AR'] = 'llvm-ar'
|
||||
env['RANLIB'] = 'llvm-ranlib'
|
||||
else:
|
||||
env.Append(CCFLAGS=['-flto'])
|
||||
env.Append(LINKFLAGS=['-flto'])
|
||||
env.extra_suffix += '.lto'
|
||||
|
||||
def configure_arch(env):
|
||||
if env['frt_arch'] == 'arm32v6':
|
||||
env.Append(CCFLAGS=['-march=armv6', '-mfpu=vfp', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v6'
|
||||
elif env['frt_arch'] == 'arm32v7':
|
||||
env.Append(CCFLAGS=['-march=armv7-a', '-mfpu=neon-vfpv4', '-mfloat-abi=hard'])
|
||||
env.extra_suffix += '.arm32v7'
|
||||
elif env['frt_arch'] == 'arm64v8':
|
||||
env.Append(CCFLAGS=['-march=armv8-a'])
|
||||
env.extra_suffix += '.arm64v8'
|
||||
|
||||
def configure_cross(env):
|
||||
if env['frt_cross'] == 'no':
|
||||
env['FRT_PKG_CONFIG'] = 'pkg-config'
|
||||
return
|
||||
if env['frt_cross'] == 'auto':
|
||||
triple = {
|
||||
'arm32v7': 'arm-linux-gnueabihf',
|
||||
'arm64v8': 'aarch64-linux-gnu',
|
||||
}[env['frt_arch']]
|
||||
else:
|
||||
triple = env['frt_cross']
|
||||
if env['use_llvm']:
|
||||
env.Append(CCFLAGS=['-target', triple])
|
||||
env.Append(LINKFLAGS=['-target', triple])
|
||||
else:
|
||||
env['CC'] = triple + '-gcc'
|
||||
env['CXX'] = triple + '-g++'
|
||||
env['FRT_PKG_CONFIG'] = triple + '-pkg-config'
|
||||
|
||||
def configure_target(env):
|
||||
if env['target'] == 'release':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
|
||||
elif env['target'] == 'release_debug':
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math'])
|
||||
elif env['target'] == 'debug':
|
||||
env.Append(CCFLAGS=['-g2'])
|
||||
|
||||
def configure_misc(env):
|
||||
env.Append(CPPPATH=['#platform/frt'])
|
||||
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_ENABLED', '-DJOYDEV_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DFRT_ENABLED'])
|
||||
env.Append(CFLAGS=['-std=gnu11']) # for libwebp (maybe more in the future)
|
||||
env.Append(LIBS=['pthread', 'z', 'dl'])
|
||||
if env['frt_arch'] == 'arm32v6' and version.minor >= 4: # TODO find out exact combination
|
||||
env.Append(LIBS=['atomic'])
|
||||
if env['CXX'] == 'clang++':
|
||||
env['CC'] = 'clang'
|
||||
env['LD'] = 'clang++'
|
||||
if env['use_static_cpp']:
|
||||
env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
|
||||
|
||||
def configure(env):
|
||||
configure_compiler(env)
|
||||
configure_lto(env)
|
||||
configure_arch(env)
|
||||
configure_cross(env)
|
||||
configure_target(env)
|
||||
configure_misc(env)
|
@ -1,255 +0,0 @@
|
||||
// gles3.dl
|
||||
/*
|
||||
FRT - A Godot platform targeting single board computers
|
||||
Copyright (c) 2017-2022 Emanuele Fornara
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
typedef void (*___glActiveTexture___)(GLenum texture);
|
||||
typedef void (*___glAttachShader___)(GLuint program, GLuint shader);
|
||||
typedef void (*___glBindAttribLocation___)(GLuint program, GLuint index, const GLchar *name);
|
||||
typedef void (*___glBindBuffer___)(GLenum target, GLuint buffer);
|
||||
typedef void (*___glBindFramebuffer___)(GLenum target, GLuint framebuffer);
|
||||
typedef void (*___glBindRenderbuffer___)(GLenum target, GLuint renderbuffer);
|
||||
typedef void (*___glBindTexture___)(GLenum target, GLuint texture);
|
||||
typedef void (*___glBlendColor___)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (*___glBlendEquation___)(GLenum mode);
|
||||
typedef void (*___glBlendEquationSeparate___)(GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (*___glBlendFunc___)(GLenum sfactor, GLenum dfactor);
|
||||
typedef void (*___glBlendFuncSeparate___)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (*___glBufferData___)(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
typedef void (*___glBufferSubData___)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
typedef GLenum (*___glCheckFramebufferStatus___)(GLenum target);
|
||||
typedef void (*___glClear___)(GLbitfield mask);
|
||||
typedef void (*___glClearColor___)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (*___glClearDepthf___)(GLfloat d);
|
||||
typedef void (*___glClearStencil___)(GLint s);
|
||||
typedef void (*___glColorMask___)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
typedef void (*___glCompileShader___)(GLuint shader);
|
||||
typedef void (*___glCompressedTexImage2D___)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (*___glCompressedTexSubImage2D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (*___glCopyTexImage2D___)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
typedef void (*___glCopyTexSubImage2D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef GLuint (*___glCreateProgram___)();
|
||||
typedef GLuint (*___glCreateShader___)(GLenum type);
|
||||
typedef void (*___glCullFace___)(GLenum mode);
|
||||
typedef void (*___glDeleteBuffers___)(GLsizei n, const GLuint *buffers);
|
||||
typedef void (*___glDeleteFramebuffers___)(GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (*___glDeleteProgram___)(GLuint program);
|
||||
typedef void (*___glDeleteRenderbuffers___)(GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (*___glDeleteShader___)(GLuint shader);
|
||||
typedef void (*___glDeleteTextures___)(GLsizei n, const GLuint *textures);
|
||||
typedef void (*___glDepthFunc___)(GLenum func);
|
||||
typedef void (*___glDepthMask___)(GLboolean flag);
|
||||
typedef void (*___glDepthRangef___)(GLfloat n, GLfloat f);
|
||||
typedef void (*___glDetachShader___)(GLuint program, GLuint shader);
|
||||
typedef void (*___glDisable___)(GLenum cap);
|
||||
typedef void (*___glDisableVertexAttribArray___)(GLuint index);
|
||||
typedef void (*___glDrawArrays___)(GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (*___glDrawElements___)(GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (*___glEnable___)(GLenum cap);
|
||||
typedef void (*___glEnableVertexAttribArray___)(GLuint index);
|
||||
typedef void (*___glFinish___)();
|
||||
typedef void (*___glFlush___)();
|
||||
typedef void (*___glFramebufferRenderbuffer___)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (*___glFramebufferTexture2D___)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (*___glFrontFace___)(GLenum mode);
|
||||
typedef void (*___glGenBuffers___)(GLsizei n, GLuint *buffers);
|
||||
typedef void (*___glGenerateMipmap___)(GLenum target);
|
||||
typedef void (*___glGenFramebuffers___)(GLsizei n, GLuint *framebuffers);
|
||||
typedef void (*___glGenRenderbuffers___)(GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (*___glGenTextures___)(GLsizei n, GLuint *textures);
|
||||
typedef void (*___glGetActiveAttrib___)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (*___glGetActiveUniform___)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (*___glGetAttachedShaders___)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
typedef GLint (*___glGetAttribLocation___)(GLuint program, const GLchar *name);
|
||||
typedef void (*___glGetBooleanv___)(GLenum pname, GLboolean *data);
|
||||
typedef void (*___glGetBufferParameteriv___)(GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLenum (*___glGetError___)();
|
||||
typedef void (*___glGetFloatv___)(GLenum pname, GLfloat *data);
|
||||
typedef void (*___glGetFramebufferAttachmentParameteriv___)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetIntegerv___)(GLenum pname, GLint *data);
|
||||
typedef void (*___glGetProgramiv___)(GLuint program, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetProgramInfoLog___)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (*___glGetRenderbufferParameteriv___)(GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetShaderiv___)(GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetShaderInfoLog___)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (*___glGetShaderPrecisionFormat___)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
typedef void (*___glGetShaderSource___)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
typedef const GLubyte * (*___glGetString___)(GLenum name);
|
||||
typedef void (*___glGetTexParameterfv___)(GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (*___glGetTexParameteriv___)(GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetUniformfv___)(GLuint program, GLint location, GLfloat *params);
|
||||
typedef void (*___glGetUniformiv___)(GLuint program, GLint location, GLint *params);
|
||||
typedef GLint (*___glGetUniformLocation___)(GLuint program, const GLchar *name);
|
||||
typedef void (*___glGetVertexAttribfv___)(GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (*___glGetVertexAttribiv___)(GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetVertexAttribPointerv___)(GLuint index, GLenum pname, void **pointer);
|
||||
typedef void (*___glHint___)(GLenum target, GLenum mode);
|
||||
typedef GLboolean (*___glIsBuffer___)(GLuint buffer);
|
||||
typedef GLboolean (*___glIsEnabled___)(GLenum cap);
|
||||
typedef GLboolean (*___glIsFramebuffer___)(GLuint framebuffer);
|
||||
typedef GLboolean (*___glIsProgram___)(GLuint program);
|
||||
typedef GLboolean (*___glIsRenderbuffer___)(GLuint renderbuffer);
|
||||
typedef GLboolean (*___glIsShader___)(GLuint shader);
|
||||
typedef GLboolean (*___glIsTexture___)(GLuint texture);
|
||||
typedef void (*___glLineWidth___)(GLfloat width);
|
||||
typedef void (*___glLinkProgram___)(GLuint program);
|
||||
typedef void (*___glPixelStorei___)(GLenum pname, GLint param);
|
||||
typedef void (*___glPolygonOffset___)(GLfloat factor, GLfloat units);
|
||||
typedef void (*___glReadPixels___)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (*___glReleaseShaderCompiler___)();
|
||||
typedef void (*___glRenderbufferStorage___)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (*___glSampleCoverage___)(GLfloat value, GLboolean invert);
|
||||
typedef void (*___glScissor___)(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (*___glShaderBinary___)(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
typedef void (*___glShaderSource___)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
typedef void (*___glStencilFunc___)(GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (*___glStencilFuncSeparate___)(GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (*___glStencilMask___)(GLuint mask);
|
||||
typedef void (*___glStencilMaskSeparate___)(GLenum face, GLuint mask);
|
||||
typedef void (*___glStencilOp___)(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
typedef void (*___glStencilOpSeparate___)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (*___glTexImage2D___)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (*___glTexParameterf___)(GLenum target, GLenum pname, GLfloat param);
|
||||
typedef void (*___glTexParameterfv___)(GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (*___glTexParameteri___)(GLenum target, GLenum pname, GLint param);
|
||||
typedef void (*___glTexParameteriv___)(GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (*___glTexSubImage2D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (*___glUniform1f___)(GLint location, GLfloat v0);
|
||||
typedef void (*___glUniform1fv___)(GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (*___glUniform1i___)(GLint location, GLint v0);
|
||||
typedef void (*___glUniform1iv___)(GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (*___glUniform2f___)(GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (*___glUniform2fv___)(GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (*___glUniform2i___)(GLint location, GLint v0, GLint v1);
|
||||
typedef void (*___glUniform2iv___)(GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (*___glUniform3f___)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (*___glUniform3fv___)(GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (*___glUniform3i___)(GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (*___glUniform3iv___)(GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (*___glUniform4f___)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (*___glUniform4fv___)(GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (*___glUniform4i___)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (*___glUniform4iv___)(GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (*___glUniformMatrix2fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix3fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix4fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUseProgram___)(GLuint program);
|
||||
typedef void (*___glValidateProgram___)(GLuint program);
|
||||
typedef void (*___glVertexAttrib1f___)(GLuint index, GLfloat x);
|
||||
typedef void (*___glVertexAttrib1fv___)(GLuint index, const GLfloat *v);
|
||||
typedef void (*___glVertexAttrib2f___)(GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (*___glVertexAttrib2fv___)(GLuint index, const GLfloat *v);
|
||||
typedef void (*___glVertexAttrib3f___)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (*___glVertexAttrib3fv___)(GLuint index, const GLfloat *v);
|
||||
typedef void (*___glVertexAttrib4f___)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (*___glVertexAttrib4fv___)(GLuint index, const GLfloat *v);
|
||||
typedef void (*___glVertexAttribPointer___)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
typedef void (*___glViewport___)(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (*___glReadBuffer___)(GLenum src);
|
||||
typedef void (*___glDrawRangeElements___)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (*___glTexImage3D___)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (*___glTexSubImage3D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (*___glCopyTexSubImage3D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (*___glCompressedTexImage3D___)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (*___glCompressedTexSubImage3D___)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (*___glGenQueries___)(GLsizei n, GLuint *ids);
|
||||
typedef void (*___glDeleteQueries___)(GLsizei n, const GLuint *ids);
|
||||
typedef GLboolean (*___glIsQuery___)(GLuint id);
|
||||
typedef void (*___glBeginQuery___)(GLenum target, GLuint id);
|
||||
typedef void (*___glEndQuery___)(GLenum target);
|
||||
typedef void (*___glGetQueryiv___)(GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetQueryObjectuiv___)(GLuint id, GLenum pname, GLuint *params);
|
||||
typedef GLboolean (*___glUnmapBuffer___)(GLenum target);
|
||||
typedef void (*___glGetBufferPointerv___)(GLenum target, GLenum pname, void **params);
|
||||
typedef void (*___glDrawBuffers___)(GLsizei n, const GLenum *bufs);
|
||||
typedef void (*___glUniformMatrix2x3fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix3x2fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix2x4fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix4x2fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix3x4fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glUniformMatrix4x3fv___)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (*___glBlitFramebuffer___)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
typedef void (*___glRenderbufferStorageMultisample___)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (*___glFramebufferTextureLayer___)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
typedef void * (*___glMapBufferRange___)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
typedef void (*___glFlushMappedBufferRange___)(GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
typedef void (*___glBindVertexArray___)(GLuint array);
|
||||
typedef void (*___glDeleteVertexArrays___)(GLsizei n, const GLuint *arrays);
|
||||
typedef void (*___glGenVertexArrays___)(GLsizei n, GLuint *arrays);
|
||||
typedef GLboolean (*___glIsVertexArray___)(GLuint array);
|
||||
typedef void (*___glGetIntegeri_v___)(GLenum target, GLuint index, GLint *data);
|
||||
typedef void (*___glBeginTransformFeedback___)(GLenum primitiveMode);
|
||||
typedef void (*___glEndTransformFeedback___)();
|
||||
typedef void (*___glBindBufferRange___)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
|
||||
typedef void (*___glBindBufferBase___)(GLenum target, GLuint index, GLuint buffer);
|
||||
typedef void (*___glTransformFeedbackVaryings___)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
|
||||
typedef void (*___glGetTransformFeedbackVarying___)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
|
||||
typedef void (*___glVertexAttribIPointer___)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
typedef void (*___glGetVertexAttribIiv___)(GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetVertexAttribIuiv___)(GLuint index, GLenum pname, GLuint *params);
|
||||
typedef void (*___glVertexAttribI4i___)(GLuint index, GLint x, GLint y, GLint z, GLint w);
|
||||
typedef void (*___glVertexAttribI4ui___)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
||||
typedef void (*___glVertexAttribI4iv___)(GLuint index, const GLint *v);
|
||||
typedef void (*___glVertexAttribI4uiv___)(GLuint index, const GLuint *v);
|
||||
typedef void (*___glGetUniformuiv___)(GLuint program, GLint location, GLuint *params);
|
||||
typedef GLint (*___glGetFragDataLocation___)(GLuint program, const GLchar *name);
|
||||
typedef void (*___glUniform1ui___)(GLint location, GLuint v0);
|
||||
typedef void (*___glUniform2ui___)(GLint location, GLuint v0, GLuint v1);
|
||||
typedef void (*___glUniform3ui___)(GLint location, GLuint v0, GLuint v1, GLuint v2);
|
||||
typedef void (*___glUniform4ui___)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
||||
typedef void (*___glUniform1uiv___)(GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (*___glUniform2uiv___)(GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (*___glUniform3uiv___)(GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (*___glUniform4uiv___)(GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (*___glClearBufferiv___)(GLenum buffer, GLint drawbuffer, const GLint *value);
|
||||
typedef void (*___glClearBufferuiv___)(GLenum buffer, GLint drawbuffer, const GLuint *value);
|
||||
typedef void (*___glClearBufferfv___)(GLenum buffer, GLint drawbuffer, const GLfloat *value);
|
||||
typedef void (*___glClearBufferfi___)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
|
||||
typedef const GLubyte * (*___glGetStringi___)(GLenum name, GLuint index);
|
||||
typedef void (*___glCopyBufferSubData___)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
typedef void (*___glGetUniformIndices___)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
|
||||
typedef void (*___glGetActiveUniformsiv___)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
|
||||
typedef GLuint (*___glGetUniformBlockIndex___)(GLuint program, const GLchar *uniformBlockName);
|
||||
typedef void (*___glGetActiveUniformBlockiv___)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetActiveUniformBlockName___)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
|
||||
typedef void (*___glUniformBlockBinding___)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
typedef void (*___glDrawArraysInstanced___)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
typedef void (*___glDrawElementsInstanced___)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
|
||||
typedef GLsync (*___glFenceSync___)(GLenum condition, GLbitfield flags);
|
||||
typedef GLboolean (*___glIsSync___)(GLsync sync);
|
||||
typedef void (*___glDeleteSync___)(GLsync sync);
|
||||
typedef GLenum (*___glClientWaitSync___)(GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (*___glWaitSync___)(GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (*___glGetInteger64v___)(GLenum pname, GLint64 *data);
|
||||
typedef void (*___glGetSynciv___)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
||||
typedef void (*___glGetInteger64i_v___)(GLenum target, GLuint index, GLint64 *data);
|
||||
typedef void (*___glGetBufferParameteri64v___)(GLenum target, GLenum pname, GLint64 *params);
|
||||
typedef void (*___glGenSamplers___)(GLsizei count, GLuint *samplers);
|
||||
typedef void (*___glDeleteSamplers___)(GLsizei count, const GLuint *samplers);
|
||||
typedef GLboolean (*___glIsSampler___)(GLuint sampler);
|
||||
typedef void (*___glBindSampler___)(GLuint unit, GLuint sampler);
|
||||
typedef void (*___glSamplerParameteri___)(GLuint sampler, GLenum pname, GLint param);
|
||||
typedef void (*___glSamplerParameteriv___)(GLuint sampler, GLenum pname, const GLint *param);
|
||||
typedef void (*___glSamplerParameterf___)(GLuint sampler, GLenum pname, GLfloat param);
|
||||
typedef void (*___glSamplerParameterfv___)(GLuint sampler, GLenum pname, const GLfloat *param);
|
||||
typedef void (*___glGetSamplerParameteriv___)(GLuint sampler, GLenum pname, GLint *params);
|
||||
typedef void (*___glGetSamplerParameterfv___)(GLuint sampler, GLenum pname, GLfloat *params);
|
||||
typedef void (*___glVertexAttribDivisor___)(GLuint index, GLuint divisor);
|
||||
typedef void (*___glBindTransformFeedback___)(GLenum target, GLuint id);
|
||||
typedef void (*___glDeleteTransformFeedbacks___)(GLsizei n, const GLuint *ids);
|
||||
typedef void (*___glGenTransformFeedbacks___)(GLsizei n, GLuint *ids);
|
||||
typedef GLboolean (*___glIsTransformFeedback___)(GLuint id);
|
||||
typedef void (*___glPauseTransformFeedback___)();
|
||||
typedef void (*___glResumeTransformFeedback___)();
|
||||
typedef void (*___glGetProgramBinary___)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
|
||||
typedef void (*___glProgramBinary___)(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
typedef void (*___glProgramParameteri___)(GLuint program, GLenum pname, GLint value);
|
||||
typedef void (*___glInvalidateFramebuffer___)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
typedef void (*___glInvalidateSubFramebuffer___)(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (*___glTexStorage2D___)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (*___glTexStorage3D___)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
typedef void (*___glGetInternalformativ___)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
|
@ -1,393 +0,0 @@
|
||||
// frt_godot2.cc
|
||||
/*
|
||||
FRT - A Godot platform targeting single board computers
|
||||
Copyright (c) 2017-2022 Emanuele Fornara
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "frt.h"
|
||||
#include "sdl2_adapter.h"
|
||||
#include "sdl2_godot_mapping.h"
|
||||
#include "dl/gles2.gen.h"
|
||||
|
||||
#include "core/print_string.h"
|
||||
#include "drivers/unix/os_unix.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/audio/audio_server_sw.h"
|
||||
#include "servers/audio/sample_manager_sw.h"
|
||||
#include "servers/spatial_sound/spatial_sound_server_sw.h"
|
||||
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
#include "main/main.h"
|
||||
|
||||
namespace frt {
|
||||
|
||||
class AudioDriverSDL2 : public AudioDriverSW, public SampleProducer {
|
||||
private:
|
||||
Audio audio_;
|
||||
int mix_rate_;
|
||||
OutputFormat output_format_;
|
||||
public:
|
||||
AudioDriverSDL2() : audio_(this) {
|
||||
}
|
||||
public: // AudioDriverSW
|
||||
const char *get_name() const FRT_OVERRIDE {
|
||||
return "SDL2";
|
||||
}
|
||||
Error init() FRT_OVERRIDE {
|
||||
mix_rate_ = GLOBAL_DEF("audio/mix_rate", 44100);
|
||||
output_format_ = OUTPUT_STEREO;
|
||||
const int latency = GLOBAL_DEF("audio/output_latency", 25);
|
||||
const int samples = closest_power_of_2(latency * mix_rate_ / 1000);
|
||||
return audio_.init(mix_rate_, samples) ? OK : ERR_CANT_OPEN;
|
||||
}
|
||||
int get_mix_rate() const FRT_OVERRIDE {
|
||||
return mix_rate_;
|
||||
}
|
||||
OutputFormat get_output_format() const FRT_OVERRIDE {
|
||||
return output_format_;
|
||||
}
|
||||
void start() FRT_OVERRIDE {
|
||||
audio_.start();
|
||||
}
|
||||
void lock() FRT_OVERRIDE {
|
||||
audio_.lock();
|
||||
}
|
||||
void unlock() FRT_OVERRIDE {
|
||||
audio_.unlock();
|
||||
}
|
||||
void finish() FRT_OVERRIDE {
|
||||
audio_.finish();
|
||||
}
|
||||
public: // SampleProducer
|
||||
void produce_samples(int n_of_frames, int32_t *frames) FRT_OVERRIDE {
|
||||
audio_server_process(n_of_frames, frames);
|
||||
}
|
||||
};
|
||||
|
||||
class Godot2_OS : public OS_Unix, public EventHandler {
|
||||
private:
|
||||
MainLoop *main_loop_;
|
||||
VideoMode video_mode_;
|
||||
bool quit_;
|
||||
OS_FRT os_;
|
||||
RasterizerGLES2 *rasterizer_;
|
||||
VisualServer *visual_server_;
|
||||
int event_id_;
|
||||
void init_video() {
|
||||
rasterizer_ = memnew(RasterizerGLES2);
|
||||
visual_server_ = memnew(VisualServerRaster(rasterizer_));
|
||||
visual_server_->init();
|
||||
}
|
||||
void cleanup_video() {
|
||||
visual_server_->finish();
|
||||
memdelete(visual_server_);
|
||||
memdelete(rasterizer_);
|
||||
}
|
||||
AudioDriverSDL2 audio_driver_;
|
||||
AudioServerSW *audio_server_;
|
||||
SampleManagerMallocSW *sample_manager_;
|
||||
SpatialSoundServerSW *spatial_sound_server_;
|
||||
SpatialSound2DServerSW *spatial_sound_2d_server_;
|
||||
void init_audio() {
|
||||
const int driver_id = 0;
|
||||
AudioDriverManagerSW::add_driver(&audio_driver_);
|
||||
AudioDriverManagerSW::get_driver(driver_id)->set_singleton();
|
||||
if (AudioDriverManagerSW::get_driver(driver_id)->init() != OK)
|
||||
fatal("audio driver failed to initialize.");
|
||||
sample_manager_ = memnew(SampleManagerMallocSW);
|
||||
audio_server_ = memnew(AudioServerSW(sample_manager_));
|
||||
audio_server_->init();
|
||||
spatial_sound_server_ = memnew(SpatialSoundServerSW);
|
||||
spatial_sound_server_->init();
|
||||
spatial_sound_2d_server_ = memnew(SpatialSound2DServerSW);
|
||||
spatial_sound_2d_server_->init();
|
||||
}
|
||||
void cleanup_audio() {
|
||||
spatial_sound_server_->finish();
|
||||
memdelete(spatial_sound_server_);
|
||||
spatial_sound_2d_server_->finish();
|
||||
memdelete(spatial_sound_2d_server_);
|
||||
memdelete(sample_manager_);
|
||||
audio_server_->finish();
|
||||
memdelete(audio_server_);
|
||||
}
|
||||
PhysicsServer *physics_server_;
|
||||
Physics2DServer *physics_2d_server_;
|
||||
void init_physics() {
|
||||
physics_server_ = memnew(PhysicsServerSW);
|
||||
physics_server_->init();
|
||||
physics_2d_server_ = memnew(Physics2DServerSW);
|
||||
physics_2d_server_->init();
|
||||
}
|
||||
void cleanup_physics() {
|
||||
physics_2d_server_->finish();
|
||||
memdelete(physics_2d_server_);
|
||||
physics_server_->finish();
|
||||
memdelete(physics_server_);
|
||||
}
|
||||
InputDefault *input_;
|
||||
Point2 mouse_pos_;
|
||||
int mouse_state_;
|
||||
void init_input() {
|
||||
input_ = memnew(InputDefault);
|
||||
mouse_pos_ = Point2(-1, -1);
|
||||
mouse_state_ = 0;
|
||||
}
|
||||
void cleanup_input() {
|
||||
memdelete(input_);
|
||||
}
|
||||
void fill_modifier_state(::InputModifierState &st) {
|
||||
const InputModifierState *os_st = os_.get_modifier_state();
|
||||
st.shift = os_st->shift;
|
||||
st.alt = os_st->alt;
|
||||
st.control = os_st->control;
|
||||
st.meta = os_st->meta;
|
||||
}
|
||||
public:
|
||||
Godot2_OS() : os_(this) {
|
||||
main_loop_ = 0;
|
||||
quit_ = false;
|
||||
event_id_ = 0;
|
||||
}
|
||||
void run() {
|
||||
if (main_loop_) {
|
||||
main_loop_->init();
|
||||
while (!quit_ && !Main::iteration())
|
||||
os_.dispatch_events();
|
||||
main_loop_->finish();
|
||||
}
|
||||
}
|
||||
public: // OS
|
||||
int get_video_driver_count() const FRT_OVERRIDE {
|
||||
return 1;
|
||||
}
|
||||
const char *get_video_driver_name(int driver) const FRT_OVERRIDE {
|
||||
return "GLES2";
|
||||
}
|
||||
VideoMode get_default_video_mode() const FRT_OVERRIDE {
|
||||
return OS::VideoMode(960, 540, false);
|
||||
}
|
||||
void initialize(const VideoMode &desired, int video_driver, int audio_driver) FRT_OVERRIDE {
|
||||
video_mode_ = desired;
|
||||
os_.init(API_OpenGL_ES2, video_mode_.width, video_mode_.height, video_mode_.resizable, video_mode_.borderless_window, video_mode_.always_on_top);
|
||||
frt_resolve_symbols_gles2(get_proc_address);
|
||||
init_video();
|
||||
init_audio();
|
||||
init_physics();
|
||||
init_input();
|
||||
_ensure_data_dir();
|
||||
}
|
||||
void set_main_loop(MainLoop *main_loop) FRT_OVERRIDE {
|
||||
main_loop_ = main_loop;
|
||||
input_->set_main_loop(main_loop);
|
||||
}
|
||||
void delete_main_loop() FRT_OVERRIDE {
|
||||
if (main_loop_)
|
||||
memdelete(main_loop_);
|
||||
main_loop_ = 0;
|
||||
}
|
||||
void finalize() FRT_OVERRIDE {
|
||||
delete_main_loop();
|
||||
cleanup_input();
|
||||
cleanup_physics();
|
||||
cleanup_audio();
|
||||
cleanup_video();
|
||||
os_.cleanup();
|
||||
}
|
||||
Point2 get_mouse_pos() const FRT_OVERRIDE {
|
||||
return mouse_pos_;
|
||||
}
|
||||
int get_mouse_button_state() const FRT_OVERRIDE {
|
||||
return mouse_state_;
|
||||
}
|
||||
void set_mouse_mode(OS::MouseMode mode) FRT_OVERRIDE {
|
||||
os_.set_mouse_mode(map_mouse_mode(mode));
|
||||
}
|
||||
OS::MouseMode get_mouse_mode() const FRT_OVERRIDE {
|
||||
return map_mouse_os_mode(os_.get_mouse_mode());
|
||||
}
|
||||
void set_window_title(const String &title) FRT_OVERRIDE {
|
||||
os_.set_title(title.utf8().get_data());
|
||||
}
|
||||
void set_video_mode(const VideoMode &video_mode, int screen) FRT_OVERRIDE {
|
||||
}
|
||||
VideoMode get_video_mode(int screen = 0) const FRT_OVERRIDE {
|
||||
return video_mode_;
|
||||
}
|
||||
void get_fullscreen_mode_list(List<VideoMode> *list, int screen) const FRT_OVERRIDE {
|
||||
}
|
||||
Size2 get_window_size() const FRT_OVERRIDE {
|
||||
return Size2(video_mode_.width, video_mode_.height);
|
||||
}
|
||||
void set_window_size(const Size2 size) FRT_OVERRIDE {
|
||||
ivec2 os_size = { (int)size.width, (int)size.height };
|
||||
os_.set_size(os_size);
|
||||
video_mode_.width = os_size.x;
|
||||
video_mode_.height = os_size.y;
|
||||
}
|
||||
Point2 get_window_position() const FRT_OVERRIDE {
|
||||
ivec2 pos = os_.get_pos();
|
||||
return Point2(pos.x, pos.y);
|
||||
}
|
||||
void set_window_position(const Point2 &pos) FRT_OVERRIDE {
|
||||
ivec2 os_pos = { (int)pos.width, (int)pos.height };
|
||||
os_.set_pos(os_pos);
|
||||
}
|
||||
void set_window_fullscreen(bool enable) FRT_OVERRIDE {
|
||||
os_.set_fullscreen(enable);
|
||||
video_mode_.fullscreen = enable;
|
||||
}
|
||||
bool is_window_fullscreen() const FRT_OVERRIDE {
|
||||
return os_.is_fullscreen();
|
||||
}
|
||||
void set_window_always_on_top(bool enable) FRT_OVERRIDE {
|
||||
os_.set_always_on_top(enable);
|
||||
video_mode_.always_on_top = enable;
|
||||
}
|
||||
bool is_window_always_on_top() const FRT_OVERRIDE {
|
||||
return os_.is_always_on_top();
|
||||
}
|
||||
void set_window_resizable(bool enable) FRT_OVERRIDE {
|
||||
os_.set_resizable(enable);
|
||||
}
|
||||
bool is_window_resizable() const FRT_OVERRIDE {
|
||||
return os_.is_resizable();
|
||||
}
|
||||
void set_window_maximized(bool enable) FRT_OVERRIDE {
|
||||
os_.set_maximized(enable);
|
||||
}
|
||||
bool is_window_maximized() const FRT_OVERRIDE {
|
||||
return os_.is_maximized();
|
||||
}
|
||||
void set_window_minimized(bool enable) FRT_OVERRIDE {
|
||||
os_.set_minimized(enable);
|
||||
}
|
||||
bool is_window_minimized() const FRT_OVERRIDE {
|
||||
return os_.is_minimized();
|
||||
}
|
||||
MainLoop *get_main_loop() const FRT_OVERRIDE {
|
||||
return main_loop_;
|
||||
}
|
||||
bool can_draw() const FRT_OVERRIDE {
|
||||
return true;
|
||||
}
|
||||
void set_cursor_shape(CursorShape shape) FRT_OVERRIDE {
|
||||
}
|
||||
void set_custom_mouse_cursor(const RES &cursor, CursorShape shape, const Vector2 &hotspot) FRT_OVERRIDE {
|
||||
}
|
||||
void make_rendering_thread() FRT_OVERRIDE {
|
||||
os_.make_current();
|
||||
}
|
||||
void release_rendering_thread() FRT_OVERRIDE {
|
||||
os_.release_current();
|
||||
}
|
||||
void swap_buffers() FRT_OVERRIDE {
|
||||
os_.swap_buffers();
|
||||
}
|
||||
void set_use_vsync(bool enable) FRT_OVERRIDE {
|
||||
os_.set_use_vsync(enable);
|
||||
}
|
||||
bool is_vsync_enabled() const FRT_OVERRIDE {
|
||||
return os_.is_vsync_enabled();
|
||||
}
|
||||
public: // EventHandler
|
||||
void handle_resize_event(ivec2 size) FRT_OVERRIDE {
|
||||
video_mode_.width = size.x;
|
||||
video_mode_.height = size.y;
|
||||
}
|
||||
void handle_key_event(int sdl2_code, int unicode, bool pressed) FRT_OVERRIDE {
|
||||
int code = map_key_sdl2_code(sdl2_code);
|
||||
InputEvent event;
|
||||
event.ID = ++event_id_;
|
||||
event.type = InputEvent::KEY;
|
||||
event.device = 0;
|
||||
fill_modifier_state(event.key.mod);
|
||||
event.key.pressed = pressed;
|
||||
event.key.scancode = code;
|
||||
event.key.unicode = unicode;
|
||||
event.key.echo = 0;
|
||||
input_->parse_input_event(event);
|
||||
}
|
||||
void handle_mouse_motion_event(ivec2 pos, ivec2 dpos) FRT_OVERRIDE {
|
||||
mouse_pos_.x = pos.x;
|
||||
mouse_pos_.y = pos.y;
|
||||
InputEvent event;
|
||||
event.ID = ++event_id_;
|
||||
event.type = InputEvent::MOUSE_MOTION;
|
||||
event.device = 0;
|
||||
fill_modifier_state(event.mouse_motion.mod);
|
||||
event.mouse_motion.button_mask = mouse_state_;
|
||||
event.mouse_motion.x = mouse_pos_.x;
|
||||
event.mouse_motion.y = mouse_pos_.y;
|
||||
input_->set_mouse_pos(mouse_pos_);
|
||||
event.mouse_motion.global_x = mouse_pos_.x;
|
||||
event.mouse_motion.global_y = mouse_pos_.y;
|
||||
event.mouse_motion.speed_x = input_->get_mouse_speed().x;
|
||||
event.mouse_motion.speed_y = input_->get_mouse_speed().y;
|
||||
event.mouse_motion.relative_x = dpos.x;
|
||||
event.mouse_motion.relative_y = dpos.y;
|
||||
input_->parse_input_event(event);
|
||||
}
|
||||
void handle_mouse_button_event(int os_button, bool pressed, bool doubleclick) FRT_OVERRIDE {
|
||||
int button = map_mouse_os_button(os_button);
|
||||
int bit = (1 << (button - 1));
|
||||
if (pressed)
|
||||
mouse_state_ |= bit;
|
||||
else
|
||||
mouse_state_ &= ~bit;
|
||||
InputEvent event;
|
||||
event.ID = ++event_id_;
|
||||
event.type = InputEvent::MOUSE_BUTTON;
|
||||
event.device = 0;
|
||||
fill_modifier_state(event.mouse_button.mod);
|
||||
event.mouse_button.button_mask = mouse_state_;
|
||||
event.mouse_button.x = mouse_pos_.x;
|
||||
event.mouse_button.y = mouse_pos_.y;
|
||||
event.mouse_button.global_x = mouse_pos_.x;
|
||||
event.mouse_button.global_y = mouse_pos_.y;
|
||||
event.mouse_button.button_index = button;
|
||||
event.mouse_button.doubleclick = doubleclick;
|
||||
event.mouse_button.pressed = pressed;
|
||||
input_->parse_input_event(event);
|
||||
}
|
||||
void handle_js_status_event(int id, bool connected, const char *name, const char *guid) FRT_OVERRIDE {
|
||||
input_->joy_connection_changed(id, connected, name, guid);
|
||||
}
|
||||
void handle_js_button_event(int id, int button, bool pressed) FRT_OVERRIDE {
|
||||
event_id_ = input_->joy_button(event_id_, id, button, pressed ? 1 : 0);
|
||||
}
|
||||
void handle_js_axis_event(int id, int axis, float value) FRT_OVERRIDE {
|
||||
InputDefault::JoyAxis v = { -1, value };
|
||||
event_id_ = input_->joy_axis(event_id_, id, axis, v);
|
||||
}
|
||||
void handle_js_hat_event(int id, int os_mask) FRT_OVERRIDE {
|
||||
int mask = map_hat_os_mask(os_mask);
|
||||
event_id_ = input_->joy_hat(event_id_, id, mask);
|
||||
}
|
||||
void handle_quit_event() FRT_OVERRIDE {
|
||||
quit_ = true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace frt
|
||||
|
||||
#include "frt_lib.h"
|
||||
|
||||
extern "C" int frt_godot_main(int argc, char *argv[]) {
|
||||
frt::Godot2_OS os;
|
||||
Error err = Main::setup(argv[0], argc - 1, &argv[1]);
|
||||
if (err != OK)
|
||||
return 255;
|
||||
if (Main::start())
|
||||
os.run();
|
||||
Main::cleanup();
|
||||
return os.get_exit_code();
|
||||
}
|
@ -8,9 +8,9 @@
|
||||
#include "frt.h"
|
||||
#include "sdl2_adapter.h"
|
||||
#include "sdl2_godot_mapping.h"
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#define FRT_DL_SKIP
|
||||
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
//#define FRT_DL_SKIP
|
||||
|
||||
#include "core/print_string.h"
|
||||
#include "drivers/unix/os_unix.h"
|
||||
@ -84,7 +84,6 @@ class Godot3_OS : public OS_Unix, public EventHandler {
|
||||
private:
|
||||
enum {
|
||||
VIDEO_DRIVER_GLES2,
|
||||
VIDEO_DRIVER_GLES3
|
||||
};
|
||||
MainLoop *main_loop_;
|
||||
VideoMode video_mode_;
|
||||
@ -93,15 +92,11 @@ private:
|
||||
int video_driver_;
|
||||
VisualServer *visual_server_;
|
||||
void init_video() {
|
||||
if (video_driver_ == VIDEO_DRIVER_GLES2) {
|
||||
frt_resolve_symbols_gles2(get_proc_address);
|
||||
RasterizerGLES2::register_config();
|
||||
RasterizerGLES2::make_current();
|
||||
} else {
|
||||
frt_resolve_symbols_gles3(get_proc_address);
|
||||
RasterizerGLES3::register_config();
|
||||
RasterizerGLES3::make_current();
|
||||
}
|
||||
//if (video_driver_ == VIDEO_DRIVER_GLES2) {
|
||||
frt_resolve_symbols_gles2(get_proc_address);
|
||||
RasterizerGLES2::register_config();
|
||||
RasterizerGLES2::make_current();
|
||||
//}
|
||||
visual_server_ = memnew(VisualServerRaster);
|
||||
visual_server_->init();
|
||||
}
|
||||
@ -157,11 +152,9 @@ public: // OS
|
||||
}
|
||||
#endif
|
||||
const char *get_video_driver_name(int driver) const FRT_OVERRIDE {
|
||||
return driver == VIDEO_DRIVER_GLES3 ? "GLES3" : "GLES2";
|
||||
return "GLES2";
|
||||
}
|
||||
bool _check_internal_feature_support(const String &feature) FRT_OVERRIDE {
|
||||
if (video_driver_ == VIDEO_DRIVER_GLES3 && feature == "etc2")
|
||||
return true;
|
||||
return feature == "mobile" || feature == "etc";
|
||||
}
|
||||
String get_config_path() const FRT_OVERRIDE {
|
||||
|
Loading…
Reference in New Issue
Block a user