Skip to content

Commit

Permalink
Vita
Browse files Browse the repository at this point in the history
Signed-off-by: Caroline Bell <[email protected]>
  • Loading branch information
SonicMastr authored and halotroop2288 committed Nov 2, 2024
1 parent e0e68ce commit ea2772d
Show file tree
Hide file tree
Showing 39 changed files with 2,877 additions and 53 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ jobs:
name: 🔄 Switch
needs: static-checks
uses: ./.github/workflows/switch_builds.yml

vita-build:
name: 🌱 PSVita
needs: static-checks
uses: ./.github/workflows/vita_builds.yml
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
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
16 changes: 14 additions & 2 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,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 @@ -558,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 @@ -1291,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 @@ -6349,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
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
22 changes: 18 additions & 4 deletions drivers/gles2/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ void light_compute(
m_var = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * m_var;\
}
*/
#ifndef VITA_ENABLED
#define SRGB_APPROX(m_var)
#endif // VITA_ENABLED

float NdotL = dot(N, L);
float cNdotL = max(NdotL, 0.0); // clamped NdotL
Expand Down Expand Up @@ -272,7 +274,9 @@ void light_compute(
diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
#endif

#ifndef VITA_ENABLED
SRGB_APPROX(diffuse_brdf_NL)
#endif // VITA_ENABLED

diffuse_interp += light_color * diffuse_brdf_NL * attenuation;

Expand Down Expand Up @@ -757,22 +761,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 Expand Up @@ -1320,7 +1328,9 @@ void light_compute(
m_var = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * m_var;\
}
*/
#ifndef VITA_ENABLED
#define SRGB_APPROX(m_var)
#endif // VITA_ENABLED

#if defined(USE_LIGHT_SHADER_CODE)
// light is written by the light shader
Expand Down Expand Up @@ -1413,7 +1423,9 @@ LIGHT_SHADER_CODE
diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
#endif

#ifndef VITA_ENABLED
SRGB_APPROX(diffuse_brdf_NL)
#endif // VITA_ENABLED

diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation;

Expand Down Expand Up @@ -1493,7 +1505,9 @@ LIGHT_SHADER_CODE

#endif

#ifndef VITA_ENABLED
SRGB_APPROX(specular_brdf_NL)
#endif // VITA_ENABLED
specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;

#if defined(LIGHT_USE_CLEARCOAT)
Expand Down
12 changes: 8 additions & 4 deletions drivers/gles2/shaders/tonemap.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,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

// Allows the use of bitshift operators for bicubic upscale
#ifdef GL_EXT_gpu_shader4
Expand Down
Loading

0 comments on commit ea2772d

Please sign in to comment.