Skip to content

Commit

Permalink
Ports: Update the C-ray renderer port
Browse files Browse the repository at this point in the history
  • Loading branch information
vkoskiv authored and awesomekling committed Feb 27, 2020
1 parent 712e710 commit 22259bf
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 87 deletions.
3 changes: 2 additions & 1 deletion Ports/c-ray/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version=git
workdir=c-ray-master
useconfigure=true
files="https://github.com/vkoskiv/c-ray/archive/master.tar.gz c-ray-git.tar.gz"
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt -DNO_SDL2=True"
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt"
depends="SDL2"

configure() {
run cmake $configopts
Expand Down
6 changes: 5 additions & 1 deletion Ports/c-ray/patches/add-dummy-configure.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
diff --git a/configure b/configure
new file mode 100644
index 0000000..e69de29
index 0000000..04bfb39
--- /dev/null
+++ b/configure
@@ -0,0 +1 @@
+#nop
2 changes: 1 addition & 1 deletion Ports/c-ray/patches/fix-linkage.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 5ccce96..1db6074 100644
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARY})
else()
- target_link_libraries(${PROJECT_NAME} -lpthread -lm ${SDL2_LIBRARY})
+ target_link_libraries(${PROJECT_NAME} -lSDL2 -lgui -ldraw -lipc -lcore -lpthread -lm -lstdc++)
+ target_link_libraries(${PROJECT_NAME} -lSDL2 -lgui -ldraw -lgfx -lipc -lcore -lpthread -lm -lstdc++)
endif()
add_definitions(-DUI_ENABLED)
else()
Expand Down
27 changes: 27 additions & 0 deletions Ports/c-ray/patches/fix-usleep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/src/utils/timer.c b/src/utils/timer.c
index 9978a99..c94d33d 100644
--- a/src/utils/timer.c
+++ b/src/utils/timer.c
@@ -48,20 +48,13 @@ long getUs(struct timeval timer) {
return ((tmr2.tv_sec - timer.tv_sec) * 1000000) + (tmr2.tv_usec - timer.tv_usec);
}

+#include <unistd.h>
+
/**
Sleep for a given amount of milliseconds

@param ms Milliseconds to sleep for
*/
void sleepMSec(int ms) {
-#ifdef WINDOWS
- Sleep(ms);
-#elif __APPLE__
- struct timespec ts;
- ts.tv_sec = ms / 1000;
- ts.tv_nsec = (ms % 1000) * 1000000;
- nanosleep(&ts, NULL);
-#elif __linux__
usleep(ms * 1000);
-#endif
}
26 changes: 0 additions & 26 deletions Ports/c-ray/patches/lower-hdr-json-settings.patch

This file was deleted.

58 changes: 0 additions & 58 deletions Ports/c-ray/patches/patch-renderthread-and-main-loop.patch

This file was deleted.

24 changes: 24 additions & 0 deletions Ports/c-ray/patches/reduce-hdr-scene-settings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/input/hdr.json b/input/hdr.json
index 5391ff0..138be3a 100644
--- a/input/hdr.json
+++ b/input/hdr.json
@@ -2,7 +2,7 @@
"version": 1.0,
"renderer": {
"threads": 0,
- "samples": 250,
+ "samples": 25,
"bounces": 30,
"antialiasing": true,
"tileWidth": 64,
@@ -12,8 +12,8 @@
"outputFileName": "rendered",
"fileType": "png",
"count": 0,
- "width": 1280,
- "height": 800
+ "width": 320,
+ "height": 200
},
"display": {
"isFullscreen": false,
13 changes: 13 additions & 0 deletions Ports/c-ray/patches/replace-micro-symbol.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/renderer/renderer.c b/src/renderer/renderer.c
index 90cfee9..4e36ed2 100644
--- a/src/renderer/renderer.c
+++ b/src/renderer/renderer.c
@@ -104,7 +104,7 @@ struct texture *renderFrame(struct renderer *r) {
char rem[64];
smartTime((msecTillFinished) / r->prefs.threadCount, rem);
float completion = ((float)completedSamples / totalTileSamples) * 100;
- logr(info, "[%s%.0f%%%s] μs/path: %.02f, etf: %s, %.02lfMs/s %s \r",
+ logr(info, "[%s%.0f%%%s] us/path: %.02f, etf: %s, %.02lfMs/s %s \r",
KBLU,
completion,
KNRM,
13 changes: 13 additions & 0 deletions Ports/c-ray/patches/set-sdl-software-renderer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/utils/ui.c b/src/utils/ui.c
index afcb4fc..3713b87 100644
--- a/src/utils/ui.c
+++ b/src/utils/ui.c
@@ -63,7 +63,7 @@ int initSDL(struct display *d) {
return -1;
}
//Init renderer
- d->renderer = SDL_CreateRenderer(d->window, -1, SDL_RENDERER_ACCELERATED);
+ d->renderer = SDL_CreateRenderer(d->window, -1, SDL_RENDERER_SOFTWARE);
if (d->renderer == NULL) {
logr(warning, "Renderer couldn't be created, error: \"%s\"\n", SDL_GetError());
return -1;

0 comments on commit 22259bf

Please sign in to comment.