Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.6 | Vita | Switch] Initial 3.6 Ports #20

Draft
wants to merge 2 commits into
base: 3.6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ jobs:
name: 🏁 Windows
needs: static-checks
uses: ./.github/workflows/windows_builds.yml

switch-build:
name: 🔄 Switch
needs: static-checks
uses: ./.github/workflows/switch_builds.yml

vita-build:
name: 🌱 PSVita
needs: static-checks
uses: ./.github/workflows/vita_builds.yml
48 changes: 48 additions & 0 deletions .github/workflows/switch_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 🔄 Switch Builds
on:
workflow_call:

# Global Cache Settings
env:
GODOT_BASE_BRANCH: 3.5
SCONS_CACHE_LIMIT: 4096

jobs:
switch-template:
runs-on: ubuntu-latest
container: devkitpro/devkita64

name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v3

# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: switch-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}

- name: Install scons from pip
run: |
sudo apt-get update
sudo apt-get -y install python3-pip
sudo python3 -m pip install scons

- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=no platform=switch target=release tools=no

- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
59 changes: 59 additions & 0 deletions .github/workflows/vita_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🌱 PSVita Builds
on:
workflow_call:

# Global Settings
env:
GODOT_BASE_BRANCH: 3.5
SCONSFLAGS: verbose=yes warnings=all werror=no debug_symbols=no
VITASDK: /usr/local/vitasdk
EUID: 1 makepkg

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-vita
cancel-in-progress: true

jobs:
vita-template:
runs-on: "ubuntu-20.04"
name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v2

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
continue-on-error: true

- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Setup VitaSDK
run: |
sudo apt-get install cmake libarchive-tools fakeroot zip -y
git clone https://github.com/vitasdk/vdpm
git clone https://github.com/isage/vita-packages-extra
cd vdpm
./bootstrap-vitasdk.sh
./install-all.sh
export PATH=$VITASDK/bin:$PATH
vdpm vita-rss-libdl
cd ../vita-packages-extra/pvr_psp2
vita-makepkg
vdpm *-arm.tar.xz
- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: vita
target: release
tools: false

- name: Upload artifact
uses: ./.github/actions/upload-artifact
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,13 @@ $RECYCLE.BIN/
*.msm
*.msp
*.lnk

# Templates
templates/
/*.zip
/*.tpz

# Switch
*.nro
switch/
config/nx-hbmenu/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "platform/switch"]
path = platform/switch
url = https://github.com/Homebrodot/platform-switch
8 changes: 8 additions & 0 deletions core/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
}
#endif

#ifdef HORIZON_ENABLED
if (!found) {
if (_load_resource_pack("romfs:/game.pck")) {
found = true;
}
}
#endif

if (!found) {
// Try to load data pack at the location of the executable.
// As mentioned above, we have two potential names to attempt.
Expand Down
3 changes: 2 additions & 1 deletion drivers/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ SConscript("winmidi/SCsub")

# Graphics drivers
if env["platform"] != "server":
SConscript("gles3/SCsub")
if env["platform"] != "vita":
SConscript("gles3/SCsub")
SConscript("gles2/SCsub")
SConscript("gles_common/SCsub")
SConscript("gl_context/SCsub")
Expand Down
4 changes: 4 additions & 0 deletions drivers/gles2/rasterizer_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
#include <GLES2/gl2ext.h>
#include <GLES2/gl2platform.h>

#ifdef VITA_ENABLED
#include <psp2/types.h>
#endif // VITA_ENABLED

#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif
Expand Down
31 changes: 28 additions & 3 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,20 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;
#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf

#if defined IPHONE_ENABLED || defined ANDROID_ENABLED
// enable extensions manually for android and ios
#ifndef UWP_ENABLED
#include <dlfcn.h> // needed to load extensions
#endif
#endif

#ifdef IPHONE_ENABLED

#include <OpenGLES/ES2/glext.h>
//void *glRenderbufferStorageMultisampleAPPLE;
//void *glResolveMultisampleFramebufferAPPLE;
#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleAPPLE
#elif defined(ANDROID_ENABLED)
#elif defined ANDROID_ENABLED || defined HORIZON_ENABLED

#include <GLES2/gl2ext.h>
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT;
Expand All @@ -111,9 +113,17 @@ PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT
#define glFramebufferTexture2DMultisample glFramebufferTexture2DMultisampleEXT

#elif defined(UWP_ENABLED)

#include <GLES2/gl2ext.h>
#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleANGLE
#define glFramebufferTexture2DMultisample glFramebufferTexture2DMultisampleANGLE

#elif defined(VITA_ENABLED)

#include <GLES2/gl2ext.h>
#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleIMG
#define glFramebufferTexture2DMultisample glFramebufferTexture2DMultisampleIMG

#endif

#define GL_TEXTURE_3D 0x806F
Expand Down Expand Up @@ -556,7 +566,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
texture->images.resize(1);
} break;
case VS::TEXTURE_TYPE_EXTERNAL: {
#ifdef ANDROID_ENABLED
#if defined(ANDROID_ENABLED) || defined(VITA_ENABLED)
texture->target = _GL_TEXTURE_EXTERNAL_OES;
#else
texture->target = GL_TEXTURE_2D;
Expand Down Expand Up @@ -1289,7 +1299,11 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glCopyTexSubImage2D(_cube_side_enum[i], lod, 0, 0, 0, 0, size, size);
}

#ifdef VITA_ENABLED
size = 0;
#else // VITA_ENABLED
size >>= 1;
#endif // !VITA_ENABLED

mm_level--;

Expand Down Expand Up @@ -6347,7 +6361,7 @@ void RasterizerStorageGLES2::initialize() {
// If the desktop build is using S3TC, and you export / run from the IDE for android, if the device supports
// S3TC it will crash trying to load these textures, as they are not exported in the APK. This is a simple way
// to prevent Android devices trying to load S3TC, by faking lack of hardware support.
#if defined(ANDROID_ENABLED) || defined(IPHONE_ENABLED)
#if defined(ANDROID_ENABLED) || defined(IPHONE_ENABLED) || defined(VITA_ENABLED)
config.s3tc_supported = false;
#endif

Expand Down Expand Up @@ -6397,6 +6411,17 @@ void RasterizerStorageGLES2::initialize() {
config.render_to_mipmap_supported = config.extensions.has("GL_OES_fbo_render_mipmap") && config.extensions.has("GL_EXT_texture_lod");
#endif

// If the desktop build is using S3TC, and you export / run from the IDE for android, if the device supports
// S3TC it will crash trying to load these textures, as they are not exported in the APK. This is a simple way
// to prevent Android devices trying to load S3TC, by faking lack of hardware support.

// Switch: this happens on Horizon too.
#ifndef TOOLS_ENABLED
#if defined ANDROID_ENABLED || defined HORIZON_ENABLED
config.s3tc_supported = false;
#endif
#endif

#ifdef GLES_OVER_GL
config.use_rgba_2d_shadows = false;
config.support_depth_texture = true;
Expand Down
12 changes: 8 additions & 4 deletions drivers/gles2/shaders/canvas.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,26 @@ VERTEX_SHADER_CODE

// texture2DLodEXT and textureCubeLodEXT are fragment shader specific.
// Do not copy these defines in the vertex section.
#ifndef VITA_ENABLED

#ifndef USE_GLES_OVER_GL
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
#endif
#endif // GL_EXT_shader_texture_lod
#endif // !USE_GLES_OVER_GL

#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
#endif
#endif // GL_ARB_shader_texture_lod

#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
#endif // !VITA_ENABLED

#if (!defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)) || defined(VITA_ENABLED)
#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
#endif
#endif // (!GL_EXT_shader_texture_lod && !GL_ARB_shader_texture_lod) || VITA_ENABLED

#ifdef USE_GLES_OVER_GL
#define lowp
Expand Down
12 changes: 8 additions & 4 deletions drivers/gles2/shaders/cubemap_filter.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ void main() {

// texture2DLodEXT and textureCubeLodEXT are fragment shader specific.
// Do not copy these defines in the vertex section.
#ifndef VITA_ENABLED

#ifndef USE_GLES_OVER_GL
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
#endif
#endif // GL_EXT_shader_texture_lod
#endif // !USE_GLES_OVER_GL

#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
#endif
#endif // GL_ARB_shader_texture_lod

#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
#endif // !VITA_ENABLED

#if (!defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)) || defined(VITA_ENABLED)
#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
#endif
#endif // (!GL_EXT_shader_texture_lod && !GL_ARB_shader_texture_lod) || VITA_ENABLED

#ifdef USE_GLES_OVER_GL
#define lowp
Expand Down
12 changes: 8 additions & 4 deletions drivers/gles2/shaders/effect_blur.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,26 @@ void main() {

// texture2DLodEXT and textureCubeLodEXT are fragment shader specific.
// Do not copy these defines in the vertex section.
#ifndef VITA_ENABLED

#ifndef USE_GLES_OVER_GL
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
#endif
#endif // GL_EXT_shader_texture_lod
#endif // !USE_GLES_OVER_GL

#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
#endif
#endif // GL_ARB_shader_texture_lod

#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
#endif // !VITA_ENABLED

#if (!defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)) || defined(VITA_ENABLED)
#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
#endif
#endif // (!GL_EXT_shader_texture_lod && !GL_ARB_shader_texture_lod) || VITA_ENABLED

#ifdef USE_GLES_OVER_GL
#define lowp
Expand Down
Loading
Loading