Builds on knulli
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# Find link platform-specific libraries
|
# Find link platform-specific libraries
|
||||||
|
set(OpenGL_GL_PREFERENCE LEGACY)
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
|
find_library(EGL_LIB EGL REQUIRED)
|
||||||
|
find_library(GL_LIB GL REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
# Setup endianess at compile time to optimize.
|
# Setup endianess at compile time to optimize.
|
||||||
@@ -16,11 +19,12 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link required libraries.
|
# Link required libraries.
|
||||||
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PRIVATE
|
||||||
SDL2
|
SDL2
|
||||||
pthread
|
pthread
|
||||||
OpenGL::GL
|
OpenGL::GLES2
|
||||||
GL
|
${GL_LIB}
|
||||||
|
${EGL_LIB}
|
||||||
m
|
m
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,6 +32,7 @@ target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
|||||||
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
DUSK_SDL2
|
DUSK_SDL2
|
||||||
DUSK_OPENGL
|
DUSK_OPENGL
|
||||||
|
DUSK_OPENGL_ES
|
||||||
DUSK_LINUX
|
DUSK_LINUX
|
||||||
DUSK_DISPLAY_SIZE_DYNAMIC
|
DUSK_DISPLAY_SIZE_DYNAMIC
|
||||||
DUSK_DISPLAY_WIDTH_DEFAULT=640
|
DUSK_DISPLAY_WIDTH_DEFAULT=640
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM debian:bookworm
|
FROM debian:trixie
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
WORKDIR /workdir
|
WORKDIR /workdir
|
||||||
RUN dpkg --add-architecture arm64 && \
|
RUN dpkg --add-architecture arm64 && \
|
||||||
@@ -19,13 +19,17 @@ RUN dpkg --add-architecture arm64 && \
|
|||||||
python3-dotenv \
|
python3-dotenv \
|
||||||
python3-pyqt5 \
|
python3-pyqt5 \
|
||||||
python3-opengl \
|
python3-opengl \
|
||||||
liblua5.3-dev:arm64 \
|
liblua5.4-dev:arm64 \
|
||||||
xz-utils:arm64 \
|
xz-utils:arm64 \
|
||||||
libbz2-dev:arm64 \
|
libbz2-dev:arm64 \
|
||||||
zlib1g-dev:arm64 \
|
zlib1g-dev:arm64 \
|
||||||
libzip-dev:arm64 \
|
libzip-dev:arm64 \
|
||||||
libbz2-dev:arm64 \
|
|
||||||
libssl-dev:arm64 \
|
libssl-dev:arm64 \
|
||||||
libsdl2-dev:arm64 \
|
libsdl2-dev:arm64 \
|
||||||
|
liblzma-dev:arm64 \
|
||||||
|
libopengl0:arm64 \
|
||||||
|
libgl1:arm64 \
|
||||||
|
libegl1:arm64 \
|
||||||
|
libgles2:arm64 \
|
||||||
libgl1-mesa-dev:arm64 && \
|
libgl1-mesa-dev:arm64 && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@@ -4,4 +4,21 @@ cmake -S . -B build-rg35xxh -G Ninja \
|
|||||||
-DDUSK_TARGET_SYSTEM=rg35xxh \
|
-DDUSK_TARGET_SYSTEM=rg35xxh \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=./cmake/toolchains/aarch64-linux-gnu.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=./cmake/toolchains/aarch64-linux-gnu.cmake \
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build build-rg35xxh -- -j$(nproc)
|
cmake --build build-rg35xxh -- -j$(nproc)
|
||||||
|
|
||||||
|
# Copy necessary libs out
|
||||||
|
mkdir -p ./build-rg35xxh/dusk
|
||||||
|
cp ./build-rg35xxh/Dusk ./build-rg35xxh/dusk/Dusk
|
||||||
|
cp ./build-rg35xxh/dusk.dsk ./build-rg35xxh/dusk/dusk.dsk
|
||||||
|
echo '#!/bin/bash' > build-rg35xxh/dusk/Dusk.sh
|
||||||
|
echo 'cd "$(dirname "$(readlink -f "$0")")"' >> build-rg35xxh/dusk/Dusk.sh
|
||||||
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(dirname "$(readlink -f "$0")")' >> build-rg35xxh/dusk/Dusk.sh
|
||||||
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gl4es' >> build-rg35xxh/dusk/Dusk.sh
|
||||||
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib' >> build-rg35xxh/dusk/Dusk.sh
|
||||||
|
echo '$(dirname "$(readlink -f "$0")")/Dusk' >> build-rg35xxh/dusk/Dusk.sh
|
||||||
|
chmod +x build-rg35xxh/dusk/Dusk.sh
|
||||||
|
cp /usr/lib/aarch64-linux-gnu/liblua5.4.so.0 build-rg35xxh/dusk/
|
||||||
|
# cp /usr/lib/aarch64-linux-gnu/libSDL2-2.0.so.0 build-rg35xxh/dusk/
|
||||||
|
# cp /usr/lib/aarch64-linux-gnu/libGL.so.1 build-rg35xxh/dusk/
|
||||||
|
# cp /usr/lib/aarch64-linux-gnu/libEGL.so.1 build-rg35xxh/dusk/
|
||||||
|
# cp /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 build-rg35xxh/dusk/
|
||||||
@@ -9,6 +9,45 @@
|
|||||||
|
|
||||||
#ifdef DUSK_OPENGL_LEGACY
|
#ifdef DUSK_OPENGL_LEGACY
|
||||||
shaderdefinition_t SHADER_UNLIT_DEFINITION = { 0 };
|
shaderdefinition_t SHADER_UNLIT_DEFINITION = { 0 };
|
||||||
|
#elifdef DUSK_OPENGL_ES
|
||||||
|
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
|
||||||
|
.vert =
|
||||||
|
"#version 300 es\n"
|
||||||
|
"layout(location = 0) in vec3 a_Pos;\n"
|
||||||
|
"layout(location = 1) in vec2 a_TexCoord;\n"
|
||||||
|
"layout(location = 2) in vec4 a_Color;\n"
|
||||||
|
"uniform mat4 u_Proj;\n"
|
||||||
|
"uniform mat4 u_View;\n"
|
||||||
|
"uniform mat4 u_Model;\n"
|
||||||
|
"out vec4 v_Color;\n"
|
||||||
|
"out vec2 v_TexCoord;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" gl_Position = u_Proj * u_View * u_Model * vec4(a_Pos, 1.0);\n"
|
||||||
|
" v_Color = a_Color;\n"
|
||||||
|
" v_TexCoord = a_TexCoord;\n"
|
||||||
|
"}\n",
|
||||||
|
|
||||||
|
.frag =
|
||||||
|
"#version 300 es\n"
|
||||||
|
"precision mediump float;\n"
|
||||||
|
"uniform sampler2D u_Texture;\n"
|
||||||
|
"uniform uint u_Colors[256];\n"
|
||||||
|
"uniform int u_ColorCount;\n"
|
||||||
|
"in vec4 v_Color;\n"
|
||||||
|
"in vec2 v_TexCoord;\n"
|
||||||
|
"out vec4 FragColor;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" vec4 texColor = texture(u_Texture, v_TexCoord);\n"
|
||||||
|
" uint index = uint(floor(texColor.r * 255.0));\n"
|
||||||
|
" uint palColor = u_Colors[index];\n"
|
||||||
|
" float r = float((palColor >> 24) & 0xFFu) / 255.0;\n"
|
||||||
|
" float g = float((palColor >> 16) & 0xFFu) / 255.0;\n"
|
||||||
|
" float b = float((palColor >> 8) & 0xFFu) / 255.0;\n"
|
||||||
|
" float a = float((palColor >> 0) & 0xFFu) / 255.0;\n"
|
||||||
|
" vec4 paletteColor = vec4(r, g, b, a);\n"
|
||||||
|
" FragColor = paletteColor;\n"
|
||||||
|
"}\n"
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
|
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
|
||||||
.vert =
|
.vert =
|
||||||
|
|||||||
@@ -6,6 +6,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#define GL_GLEXT_PROTOTYPES
|
#ifdef DUSK_OPENGL_ES
|
||||||
#include <GL/gl.h>
|
#include <GLES3/gl3.h>
|
||||||
#include <GL/glext.h>
|
#define GL_COLOR_INDEX8_EXT 0x80E5
|
||||||
|
#define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER
|
||||||
|
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
||||||
|
#define glCheckFramebufferStatusEXT glCheckFramebufferStatus
|
||||||
|
#define glDeleteFramebuffersEXT glDeleteFramebuffers
|
||||||
|
#define glGenFramebuffersEXT glGenFramebuffers
|
||||||
|
#define glBindFramebufferEXT glBindFramebuffer
|
||||||
|
#define glFramebufferTexture2DEXT glFramebufferTexture2D
|
||||||
|
#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
|
||||||
|
#define glClearDepth(depth) glClearDepthf(depth)
|
||||||
|
#else
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glext.h>
|
||||||
|
#endif
|
||||||
@@ -19,4 +19,5 @@ void logError(const char_t *message, ...) {
|
|||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
vprintf(message, args);
|
vprintf(message, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user