Add Native GL Option
This commit is contained in:
parent
c513426e05
commit
3b886e055d
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
/core/build
|
/core/build
|
||||||
/mods/build
|
/mods/build
|
||||||
/out
|
/out
|
||||||
|
/debian/tmp
|
||||||
|
5
debian/client/DEBIAN/postinst
vendored
5
debian/client/DEBIAN/postinst
vendored
@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
MCPI_FEATURES='' MCPI_USERNAME='' docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml pull
|
|
5
debian/client/common/DEBIAN/postinst
vendored
Executable file
5
debian/client/common/DEBIAN/postinst
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
MCPI_MODE='' MCPI_FEATURES='' MCPI_USERNAME='' docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml pull
|
@ -10,10 +10,6 @@ fi
|
|||||||
export MCPI_FEATURES
|
export MCPI_FEATURES
|
||||||
export MCPI_USERNAME
|
export MCPI_USERNAME
|
||||||
|
|
||||||
# Start VirGL
|
|
||||||
virgl_test_server &
|
|
||||||
VIRGL_PID="$!"
|
|
||||||
|
|
||||||
# Ensure Groups Are Correct
|
# Ensure Groups Are Correct
|
||||||
if [ -z "${MCPI_SUBSHELL}" ]; then
|
if [ -z "${MCPI_SUBSHELL}" ]; then
|
||||||
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
|
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
|
||||||
@ -25,13 +21,9 @@ fi
|
|||||||
# Allow X11 Connections From Root
|
# Allow X11 Connections From Root
|
||||||
xhost local:root
|
xhost local:root
|
||||||
|
|
||||||
# Launch Minecraft
|
# Update Docker Container
|
||||||
DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml"
|
export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml"
|
||||||
(${DOCKER_COMPOSE} pull || :) | zenity --class 'Minecraft - Pi edition' --progress --pulsate --no-cancel --auto-close --text 'Updating Minecraft...'
|
(${DOCKER_COMPOSE} pull || :) | zenity --class 'Minecraft - Pi edition' --progress --pulsate --no-cancel --auto-close --text 'Updating Minecraft...'
|
||||||
${DOCKER_COMPOSE} run --rm minecraft-pi || :
|
|
||||||
RET="$?"
|
|
||||||
|
|
||||||
# Kill VirGL
|
# Run
|
||||||
kill "${VIRGL_PID}"
|
/usr/lib/minecraft-pi/run.sh
|
||||||
|
|
||||||
exit "${RET}"
|
|
@ -11,3 +11,4 @@ services:
|
|||||||
- 'DISPLAY=unix${DISPLAY}'
|
- 'DISPLAY=unix${DISPLAY}'
|
||||||
- 'MCPI_FEATURES=${MCPI_FEATURES}'
|
- 'MCPI_FEATURES=${MCPI_FEATURES}'
|
||||||
- 'MCPI_USERNAME=${MCPI_USERNAME}'
|
- 'MCPI_USERNAME=${MCPI_USERNAME}'
|
||||||
|
- 'MCPI_MODE=${MCPI_MODE}'
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
8
debian/client/native/DEBIAN/control
vendored
Normal file
8
debian/client/native/DEBIAN/control
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Package: minecraft-pi-native
|
||||||
|
Version: 1.0.0
|
||||||
|
Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||||
|
Description: Fun with Blocks
|
||||||
|
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||||
|
Architecture: all
|
||||||
|
Depends: docker.io, docker-compose, zenity, policykit-1, passwd, login, qemu-user-static, binfmt-support
|
||||||
|
Conflicts: minecraft-pi-virgl
|
9
debian/client/native/usr/lib/minecraft-pi/run.sh
vendored
Normal file
9
debian/client/native/usr/lib/minecraft-pi/run.sh
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Enable VirGL
|
||||||
|
export MCPI_MODE=native
|
||||||
|
|
||||||
|
# Launch Minecraft
|
||||||
|
${DOCKER_COMPOSE} run --rm minecraft-pi
|
@ -1,7 +1,8 @@
|
|||||||
Package: minecraft-pi
|
Package: minecraft-pi-virgl
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Maintainer: TheBrokenRail <connor24nolan@live.com>
|
Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||||
Description: Fun with Blocks
|
Description: Fun with Blocks
|
||||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: docker.io, docker-compose, virgl-server, zenity, policykit-1, passwd, login, qemu-user-static, binfmt-support
|
Depends: docker.io, docker-compose, virgl-server, zenity, policykit-1, passwd, login, qemu-user-static, binfmt-support
|
||||||
|
Conflicts: minecraft-pi-native
|
19
debian/client/virgl/usr/lib/minecraft-pi/run.sh
vendored
Normal file
19
debian/client/virgl/usr/lib/minecraft-pi/run.sh
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Enable VirGL
|
||||||
|
export MCPI_MODE=virgl
|
||||||
|
|
||||||
|
# Start VirGL
|
||||||
|
virgl_test_server &
|
||||||
|
VIRGL_PID="$!"
|
||||||
|
|
||||||
|
# Launch Minecraft
|
||||||
|
${DOCKER_COMPOSE} run --rm minecraft-pi || :
|
||||||
|
RET="$?"
|
||||||
|
|
||||||
|
# Kill VirGL
|
||||||
|
kill "${VIRGL_PID}"
|
||||||
|
|
||||||
|
exit "${RET}"
|
@ -41,7 +41,7 @@ static void store_x11_window() {
|
|||||||
|
|
||||||
// Handle GLFW Error
|
// Handle GLFW Error
|
||||||
static void glfw_error(__attribute__((unused)) int error, const char *description) {
|
static void glfw_error(__attribute__((unused)) int error, const char *description) {
|
||||||
fprintf(stderr, "GLFW Error: %s\n", description);
|
fprintf(stderr, "[ERR] GLFW Error: %s\n", description);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,9 +465,12 @@ HOOK(eglTerminate, EGLBoolean, (__attribute__((unused)) EGLDisplay display)) {
|
|||||||
|
|
||||||
// Use VirGL
|
// Use VirGL
|
||||||
__attribute__((constructor)) static void init() {
|
__attribute__((constructor)) static void init() {
|
||||||
is_server = extra_get_is_server();
|
int mode = extra_get_mode();
|
||||||
|
if (mode == 0) {
|
||||||
setenv("LIBGL_ALWAYS_SOFTWARE", "1", 1);
|
setenv("LIBGL_ALWAYS_SOFTWARE", "1", 1);
|
||||||
if (!is_server) {
|
if (!is_server) {
|
||||||
setenv("GALLIUM_DRIVER", "virpipe", 1);
|
setenv("GALLIUM_DRIVER", "virpipe", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is_server = mode == 2;
|
||||||
|
}
|
||||||
|
@ -154,12 +154,22 @@ int extra_has_feature(const char *name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int extra_get_is_server() {
|
int extra_get_mode() {
|
||||||
return getenv("MCPI_SERVER") != NULL;
|
char *mode = getenv("MCPI_MODE");
|
||||||
|
if (strcmp("virgl", mode) == 0) {
|
||||||
|
return 0;
|
||||||
|
} else if (strcmp("native", mode) == 0) {
|
||||||
|
return 1;
|
||||||
|
} else if (strcmp("server", mode) == 0) {
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "[ERR] Inavlid MCPI_MODE: %s\n", mode);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((constructor)) static void init() {
|
__attribute__((constructor)) static void init() {
|
||||||
is_server = extra_get_is_server();
|
is_server = extra_get_mode() == 2;
|
||||||
if (is_server) {
|
if (is_server) {
|
||||||
server_init();
|
server_init();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int extra_has_feature(const char *name);
|
int extra_has_feature(const char *name);
|
||||||
int extra_get_is_server();
|
int extra_get_mode();
|
||||||
|
|
||||||
void extra_key_press(char key);
|
void extra_key_press(char key);
|
||||||
void extra_clear_input();
|
void extra_clear_input();
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:client -f Dockerfile.client .
|
docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:client -f Dockerfile.client .
|
||||||
docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:server -f Dockerfile.server .
|
#docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:server -f Dockerfile.server .
|
||||||
|
@ -9,8 +9,18 @@ chmod -R g-s debian
|
|||||||
rm -rf out
|
rm -rf out
|
||||||
mkdir -p out/deb
|
mkdir -p out/deb
|
||||||
|
|
||||||
# Generate DEB
|
# Package Client DEBs
|
||||||
dpkg -b debian/client out/deb
|
package_client() {
|
||||||
|
rm -rf debian/tmp
|
||||||
|
rsync -r debian/client/common/ debian/tmp
|
||||||
|
rsync -r "debian/client/$1/" debian/tmp
|
||||||
|
dpkg -b debian/tmp out/deb
|
||||||
|
rm -rf debian/tmp
|
||||||
|
}
|
||||||
|
package_client virgl
|
||||||
|
package_client native
|
||||||
|
|
||||||
|
# Package Server DEB
|
||||||
dpkg -b debian/server out/deb
|
dpkg -b debian/server out/deb
|
||||||
|
|
||||||
# Export Libraries
|
# Export Libraries
|
||||||
|
Loading…
Reference in New Issue
Block a user