Skip to content

Commit 4ef3903

Browse files
committed
Switch: Enable CRT shader
1 parent 19354dd commit 4ef3903

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ jobs:
373373
- name: Build
374374
run: |
375375
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake \
376-
-DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON \
377-
-DBUILD_WITH_PYTHON=OFF -DBUILD_WITH_YUE=OFF
376+
-DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_SDLGPU=ON \
377+
-DBUILD_WITH_YUE=OFF
378378
cmake --build build --parallel
379379
380380
- name: Deploy

cmake/sdl.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ set(SDLGPU_SRC
9494
${SDLGPU_DIR}/externals/stb_image_write/stb_image_write.c
9595
)
9696

97-
if(NOT ANDROID)
97+
if(NOT ANDROID AND NOT NINTENDO_SWITCH)
9898
list(APPEND SDLGPU_SRC
9999
${SDLGPU_DIR}/renderer_GLES_1.c
100100
${SDLGPU_DIR}/renderer_GLES_3.c
@@ -110,7 +110,7 @@ endif()
110110

111111
add_library(sdlgpu STATIC ${SDLGPU_SRC})
112112

113-
if(EMSCRIPTEN OR ANDROID)
113+
if(EMSCRIPTEN OR ANDROID OR NINTENDO_SWITCH)
114114
target_compile_definitions(sdlgpu PRIVATE GLEW_STATIC SDL_GPU_DISABLE_GLES_1 SDL_GPU_DISABLE_GLES_3 SDL_GPU_DISABLE_OPENGL)
115115
else()
116116
target_compile_definitions(sdlgpu PRIVATE GLEW_STATIC SDL_GPU_DISABLE_GLES SDL_GPU_DISABLE_OPENGL_3 SDL_GPU_DISABLE_OPENGL_4)
@@ -146,6 +146,12 @@ if(ANDROID)
146146
)
147147
endif()
148148

149+
if(NINTENDO_SWITCH)
150+
find_package(PkgConfig REQUIRED)
151+
pkg_search_module(GLES2 glesv2 REQUIRED IMPORTED_TARGET)
152+
target_link_libraries(sdlgpu PkgConfig::GLES2)
153+
endif()
154+
149155
if(NOT EMSCRIPTEN)
150156
if(BUILD_STATIC)
151157
target_link_libraries(sdlgpu SDL2-static)

src/system/sdl/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ void tic_sys_preseed()
15111511
static void loadCrtShader()
15121512
{
15131513
static const char VertextShader[] =
1514-
#if !defined (EMSCRIPTEN)
1514+
#if !defined (EMSCRIPTEN) && !defined(__SWITCH__)
15151515
"#version 110" "\n"
15161516
#endif
15171517
"attribute vec3 gpu_Vertex;" "\n"
@@ -1529,7 +1529,7 @@ static void loadCrtShader()
15291529
;
15301530

15311531
static const char PixelShader[] =
1532-
#if !defined (EMSCRIPTEN)
1532+
#if !defined (EMSCRIPTEN) && !defined(__SWITCH__)
15331533
"#version 110" "\n"
15341534
#else
15351535
"precision highp float;" "\n"

0 commit comments

Comments
 (0)