mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
Ports: Update c-ray's patches to use git patches
This commit is contained in:
parent
8b9302890e
commit
4874465018
17 changed files with 654 additions and 105 deletions
20
Ports/c-ray/patches/0001-Add-a-dummy-configure-file.patch
Normal file
20
Ports/c-ray/patches/0001-Add-a-dummy-configure-file.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
From a91deb390a4765985718c4821c0306d433c036f5 Mon Sep 17 00:00:00 2001
|
||||
From: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
Date: Tue, 25 Feb 2020 22:03:47 +0200
|
||||
Subject: [PATCH 1/8] Add a dummy configure file
|
||||
|
||||
---
|
||||
configure | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 configure
|
||||
|
||||
diff --git a/configure b/configure
|
||||
new file mode 100644
|
||||
index 0000000..04bfb39
|
||||
--- /dev/null
|
||||
+++ b/configure
|
||||
@@ -0,0 +1 @@
|
||||
+#nop
|
||||
--
|
||||
2.36.1
|
||||
|
26
Ports/c-ray/patches/0002-Disable-checkBuf-on-serenity.patch
Normal file
26
Ports/c-ray/patches/0002-Disable-checkBuf-on-serenity.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
From dc634f4d49c98a7c0243b568631c626cd3da4125 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Groh <mail@linusgroh.de>
|
||||
Date: Sat, 13 Mar 2021 22:11:07 +0100
|
||||
Subject: [PATCH 2/8] Disable checkBuf() on serenity
|
||||
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
---
|
||||
src/utils/fileio.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/utils/fileio.c b/src/utils/fileio.c
|
||||
index 6365973..2edfed8 100644
|
||||
--- a/src/utils/fileio.c
|
||||
+++ b/src/utils/fileio.c
|
||||
@@ -147,7 +147,7 @@ bool isValidFile(char *path) {
|
||||
|
||||
//Wait for 2 secs and abort if nothing is coming in from stdin
|
||||
void checkBuf() {
|
||||
-#ifndef WINDOWS
|
||||
+#if !defined(WINDOWS) && !defined(__serenity__)
|
||||
fd_set set;
|
||||
struct timeval timeout;
|
||||
int rv;
|
||||
--
|
||||
2.36.1
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From e9b3bd5acd86ffe35b0f4e22bf615b53e0af261c Mon Sep 17 00:00:00 2001
|
||||
From: Linus Groh <mail@linusgroh.de>
|
||||
Date: Sat, 13 Mar 2021 22:11:07 +0100
|
||||
Subject: [PATCH 3/8] Let c-ray define its own version of vasprintf
|
||||
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
---
|
||||
src/libraries/asprintf.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libraries/asprintf.h b/src/libraries/asprintf.h
|
||||
index 70a95ac..7571e8a 100644
|
||||
--- a/src/libraries/asprintf.h
|
||||
+++ b/src/libraries/asprintf.h
|
||||
@@ -33,7 +33,7 @@ int vscprintf(const char *format, va_list ap) {
|
||||
* GNU-C-compatible compilers implement these with the same names, thus we
|
||||
* don't have to do anything
|
||||
*/
|
||||
-#ifdef _MSC_VER
|
||||
+#if defined(_MSC_VER) || defined(__serenity__)
|
||||
int cray_vasprintf(char **strp, const char *format, va_list ap) {
|
||||
int len = vscprintf(format, ap);
|
||||
if (len == -1)
|
||||
--
|
||||
2.36.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 031255918e1421e343aedaaeb3a71b77a01dbe60 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Groh <mail@linusgroh.de>
|
||||
Date: Fri, 1 Apr 2022 01:55:25 +0200
|
||||
Subject: [PATCH 4/8] Link with the needed serenity libraries
|
||||
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
Co-Authored-By: EWouters <6179932+EWouters@users.noreply.github.com>
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 20f8440..dc254b5 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -71,7 +71,7 @@ add_executable(c-ray ${SOURCES})
|
||||
target_include_directories(c-ray PRIVATE ${c-ray_SOURCE_DIR}/src)
|
||||
target_include_directories(c-ray PRIVATE ${c-ray_SOURCE_DIR}/tests)
|
||||
if (NOT MSVC)
|
||||
- target_link_libraries(c-ray PRIVATE -lpthread -lm)
|
||||
+ target_link_libraries(c-ray PRIVATE -lSDL2 -lgui -lgfx -lipc -lcore -lpthread -lstdc++ -lm)
|
||||
endif ()
|
||||
|
||||
include(CheckIPOSupported)
|
||||
--
|
||||
2.36.1
|
||||
|
35
Ports/c-ray/patches/0005-Use-usleep-on-serenity.patch
Normal file
35
Ports/c-ray/patches/0005-Use-usleep-on-serenity.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
From 2bbcdcb8ca63d8a9cf475b148f9f11f97df14c35 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Groh <mail@linusgroh.de>
|
||||
Date: Sat, 13 Mar 2021 22:11:07 +0100
|
||||
Subject: [PATCH 5/8] Use usleep() on serenity
|
||||
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
---
|
||||
src/utils/timer.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/utils/timer.c b/src/utils/timer.c
|
||||
index dd83497..3a4357f 100644
|
||||
--- a/src/utils/timer.c
|
||||
+++ b/src/utils/timer.c
|
||||
@@ -48,7 +48,7 @@ long getUs(struct timeval timer) {
|
||||
return ((tmr2.tv_sec - timer.tv_sec) * 1000000) + (tmr2.tv_usec - timer.tv_usec);
|
||||
}
|
||||
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__serenity__)
|
||||
#define _BSD_SOURCE
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -66,7 +66,7 @@ void sleepMSec(int ms) {
|
||||
ts.tv_sec = ms / 1000;
|
||||
ts.tv_nsec = (ms % 1000) * 1000000;
|
||||
nanosleep(&ts, NULL);
|
||||
-#elif __linux__
|
||||
+#elif defined(__linux__) || defined(__serenity__)
|
||||
usleep(ms * 1000);
|
||||
#endif
|
||||
}
|
||||
--
|
||||
2.36.1
|
||||
|
413
Ports/c-ray/patches/0006-Reduce-HDR-scene-settings-a-bit.patch
Normal file
413
Ports/c-ray/patches/0006-Reduce-HDR-scene-settings-a-bit.patch
Normal file
|
@ -0,0 +1,413 @@
|
|||
From 81f73eaff2d269158ee4cef7bd576af5bedb835e Mon Sep 17 00:00:00 2001
|
||||
From: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
Date: Sat, 13 Mar 2021 22:11:07 +0100
|
||||
Subject: [PATCH 6/8] Reduce HDR scene settings a bit
|
||||
|
||||
---
|
||||
input/hdr.json | 394 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 394 insertions(+)
|
||||
create mode 100644 input/hdr.json
|
||||
|
||||
diff --git a/input/hdr.json b/input/hdr.json
|
||||
new file mode 100644
|
||||
index 0000000..b7b5b63
|
||||
--- /dev/null
|
||||
+++ b/input/hdr.json
|
||||
@@ -0,0 +1,394 @@
|
||||
+{
|
||||
+ "version": 1.0,
|
||||
+ "renderer": {
|
||||
+ "threads": 0,
|
||||
+ "samples": 25,
|
||||
+ "bounces": 30,
|
||||
+ "tileWidth": 64,
|
||||
+ "tileHeight": 64,
|
||||
+ "tileOrder": "fromMiddle",
|
||||
+ "outputFilePath": "output/",
|
||||
+ "outputFileName": "rendered",
|
||||
+ "fileType": "png",
|
||||
+ "count": 0,
|
||||
+ "width": 320,
|
||||
+ "height": 200
|
||||
+ },
|
||||
+ "display": {
|
||||
+ "isFullscreen": false,
|
||||
+ "isBorderless": false,
|
||||
+ "windowScale": 1.0
|
||||
+ },
|
||||
+ "camera": [
|
||||
+ {
|
||||
+ "FOV": 30.0,
|
||||
+ "focalDistance": 0.7,
|
||||
+ "fstops": 6.5,
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 0,
|
||||
+ "y": 0.1,
|
||||
+ "z": -0.7
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateX",
|
||||
+ "degrees": 5
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateZ",
|
||||
+ "degrees": 0
|
||||
+ }
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "FOV": 90.0,
|
||||
+ "focalDistance": 0.2,
|
||||
+ "fstops": 6.5,
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 0,
|
||||
+ "y": 0.1,
|
||||
+ "z": -0.2
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateX",
|
||||
+ "degrees": 5
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateY",
|
||||
+ "degrees": 5
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "scene": {
|
||||
+ "ambientColor": {
|
||||
+ "hdr": "HDRs/roof_garden_1k.hdr",
|
||||
+ "offset": 0,
|
||||
+ "down": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 1.0,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "up": {
|
||||
+ "r": 0.5,
|
||||
+ "g": 0.7,
|
||||
+ "b": 1.0
|
||||
+ }
|
||||
+ },
|
||||
+ "primitives": [
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": -0.25,
|
||||
+ "y": 0.1001,
|
||||
+ "z": 0.3
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 0.0,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "bsdf": "metal",
|
||||
+ "roughness": 0.05,
|
||||
+ "radius": 0.1
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 0,
|
||||
+ "y": 0.05,
|
||||
+ "z": 0
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 0.8,
|
||||
+ "g": 0.8,
|
||||
+ "b": 0.8
|
||||
+ },
|
||||
+ "bsdf": "metal",
|
||||
+ "roughness": 0.00,
|
||||
+ "radius": 0.05
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 0.05,
|
||||
+ "y": 0.05,
|
||||
+ "z": 0.1
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 0.0,
|
||||
+ "g": 0.8,
|
||||
+ "b": 0.0
|
||||
+ },
|
||||
+ "bsdf": "metal",
|
||||
+ "roughness": 0.00,
|
||||
+ "radius": 0.05
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 0.15,
|
||||
+ "y": 0.05,
|
||||
+ "z": 0
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 1.0,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "bsdf": "glass",
|
||||
+ "IOR": 1.9,
|
||||
+ "roughness": 0,
|
||||
+ "radius": 0.05
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": -0.15,
|
||||
+ "y": 0.025,
|
||||
+ "z": 0.05
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 0.1,
|
||||
+ "b": 0.1
|
||||
+ },
|
||||
+ "bsdf": "glass",
|
||||
+ "IOR": 1.9,
|
||||
+ "roughness": 0,
|
||||
+ "radius": 0.025
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": -0.120,
|
||||
+ "y": 0.025,
|
||||
+ "z": 0.1
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 0.1,
|
||||
+ "g": 1.0,
|
||||
+ "b": 0.1
|
||||
+ },
|
||||
+ "bsdf": "glass",
|
||||
+ "IOR": 1.9,
|
||||
+ "roughness": 0,
|
||||
+ "radius": 0.025
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": -0.090,
|
||||
+ "y": 0.025,
|
||||
+ "z": 0.15
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 0.1,
|
||||
+ "g": 0.1,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "bsdf": "glass",
|
||||
+ "IOR": 1.9,
|
||||
+ "roughness": 0,
|
||||
+ "radius": 0.025
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": -0.03,
|
||||
+ "y": 0.01,
|
||||
+ "z": -0.25
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "radius": 0.01,
|
||||
+ "color": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 0.0,
|
||||
+ "b": 0.0
|
||||
+ },
|
||||
+ "bsdf": "metal",
|
||||
+ "roughness": 1.0
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 1070,
|
||||
+ "y": 310,
|
||||
+ "z": 820
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "radius": 2.5,
|
||||
+ "color": {
|
||||
+ "r": 0.0,
|
||||
+ "g": 1.0,
|
||||
+ "b": 0.0
|
||||
+ },
|
||||
+ "bsdf": "emissive",
|
||||
+ "intensity": 10.0
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 1090,
|
||||
+ "y": 310,
|
||||
+ "z": 820
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "radius": 2.5,
|
||||
+ "color": {
|
||||
+ "r": 0.0,
|
||||
+ "g": 0.0,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "bsdf": "emissive",
|
||||
+ "intensity": 10.0
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "sphere",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "x": 950,
|
||||
+ "y": 420,
|
||||
+ "z": 1500
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "color": {
|
||||
+ "r": 1.0,
|
||||
+ "g": 1.0,
|
||||
+ "b": 1.0
|
||||
+ },
|
||||
+ "bsdf": "emissive",
|
||||
+ "intensity": 10.0,
|
||||
+ "radius": 10
|
||||
+ }
|
||||
+ ],
|
||||
+ "meshes": [
|
||||
+ {
|
||||
+ "fileName": "shapes/gridplane.obj",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "for": "Plane",
|
||||
+ "material": [
|
||||
+ {
|
||||
+ "type": "diffuse",
|
||||
+ "color": "shapes/grid.png"
|
||||
+ }
|
||||
+ ],
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "scaleUniform",
|
||||
+ "scale": 0.25
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateX",
|
||||
+ "degrees": 0
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "fileName": "venusscaled.obj",
|
||||
+ "instances": [
|
||||
+ {
|
||||
+ "materials": {
|
||||
+ "type": "plastic",
|
||||
+ "roughness": 0,
|
||||
+ "IOR": 1.45,
|
||||
+ "color": [1.0, 0.2705, 0.0]
|
||||
+ },
|
||||
+ "transforms": [
|
||||
+ {
|
||||
+ "type": "scaleUniform",
|
||||
+ "scale": 0.05
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "translate",
|
||||
+ "X": 0.08
|
||||
+ },
|
||||
+ {
|
||||
+ "type": "rotateY",
|
||||
+ "degrees": 0
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+ ]
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.36.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From bcf1e45d9975ff326d874eb60abaa148b321eb78 Mon Sep 17 00:00:00 2001
|
||||
From: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
Date: Sat, 17 Apr 2021 08:30:03 +0000
|
||||
Subject: [PATCH 7/8] Replace the micro symbol with a 'u'
|
||||
|
||||
Co-Authored-By: Linus Groh <mail@linusgroh.de>
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
---
|
||||
src/renderer/renderer.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/renderer/renderer.c b/src/renderer/renderer.c
|
||||
index fe0e44e..6e5e20f 100644
|
||||
--- a/src/renderer/renderer.c
|
||||
+++ b/src/renderer/renderer.c
|
||||
@@ -146,7 +146,7 @@ struct texture *renderFrame(struct renderer *r) {
|
||||
float sps = (1000000.0f / usPerRay) * (r->prefs.threadCount + remoteThreads);
|
||||
char rem[64];
|
||||
smartTime((msecTillFinished) / (r->prefs.threadCount + remoteThreads), rem);
|
||||
- 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,
|
||||
interactive ? ((float)r->state.finishedPasses / (float)r->prefs.sampleCount) * 100.0f :
|
||||
((float)r->state.finishedTileCount / (float)r->state.tileCount) * 100.0f,
|
||||
--
|
||||
2.36.1
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From e552e1be81f8873930f3a75c051cf1efb2069b64 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Groh <mail@linusgroh.de>
|
||||
Date: Sat, 13 Mar 2021 22:11:07 +0100
|
||||
Subject: [PATCH 8/8] Make SDL use software rendering
|
||||
|
||||
Serenity does not support accelerated rendering
|
||||
|
||||
Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
|
||||
---
|
||||
src/utils/ui.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/utils/ui.c b/src/utils/ui.c
|
||||
index 89553c7..4a52e6c 100644
|
||||
--- a/src/utils/ui.c
|
||||
+++ b/src/utils/ui.c
|
||||
@@ -120,7 +120,7 @@ void initDisplay(bool fullscreen, bool borderless, int width, int height, float
|
||||
return;
|
||||
}
|
||||
//Init renderer
|
||||
- gdisplay->renderer = SDL_CreateRenderer(gdisplay->window, -1, SDL_RENDERER_ACCELERATED);
|
||||
+ gdisplay->renderer = SDL_CreateRenderer(gdisplay->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (gdisplay->renderer == NULL) {
|
||||
logr(warning, "Renderer couldn't be created, error: \"%s\"\n", SDL_GetError());
|
||||
destroyDisplay();
|
||||
--
|
||||
2.36.1
|
||||
|
52
Ports/c-ray/patches/ReadMe.md
Normal file
52
Ports/c-ray/patches/ReadMe.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Patches for c-ray on SerenityOS
|
||||
|
||||
## `0001-Add-a-dummy-configure-file.patch`
|
||||
|
||||
Add a dummy configure file
|
||||
|
||||
|
||||
## `0002-Disable-checkBuf-on-serenity.patch`
|
||||
|
||||
Disable checkBuf() on serenity
|
||||
|
||||
|
||||
|
||||
## `0003-Let-c-ray-define-its-own-version-of-vasprintf.patch`
|
||||
|
||||
Let c-ray define its own version of vasprintf
|
||||
|
||||
|
||||
|
||||
## `0004-Link-with-the-needed-serenity-libraries.patch`
|
||||
|
||||
Link with the needed serenity libraries
|
||||
|
||||
|
||||
|
||||
|
||||
## `0005-Use-usleep-on-serenity.patch`
|
||||
|
||||
Use usleep() on serenity
|
||||
|
||||
|
||||
|
||||
## `0006-Reduce-HDR-scene-settings-a-bit.patch`
|
||||
|
||||
Reduce HDR scene settings a bit
|
||||
|
||||
|
||||
## `0007-Replace-the-micro-symbol-with-a-u.patch`
|
||||
|
||||
Replace the micro symbol with a 'u'
|
||||
|
||||
|
||||
|
||||
|
||||
## `0008-Make-SDL-use-software-rendering.patch`
|
||||
|
||||
Make SDL use software rendering
|
||||
|
||||
Serenity does not support accelerated rendering
|
||||
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
diff --git a/configure b/configure
|
||||
new file mode 100644
|
||||
index 0000000..04bfb39
|
||||
--- /dev/null
|
||||
+++ b/configure
|
||||
@@ -0,0 +1 @@
|
||||
+#nop
|
|
@ -1,11 +0,0 @@
|
|||
--- c-ray-master/src/utils/fileio.c 2021-03-13 00:13:46.067407670 +0100
|
||||
+++ c-ray-master/src/utils/fileio.c 2021-01-11 01:01:57.000000000 +0100
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
//Wait for 2 secs and abort if nothing is coming in from stdin
|
||||
void checkBuf() {
|
||||
-#ifndef WINDOWS
|
||||
+#if !defined(WINDOWS) && !defined(__serenity__)
|
||||
fd_set set;
|
||||
struct timeval timeout;
|
||||
int rv;
|
|
@ -1,11 +0,0 @@
|
|||
--- c-ray-master/src/libraries/asprintf.h 2021-03-13 00:16:23.782000000 +0100
|
||||
+++ c-ray-master/src/libraries/asprintf.h 2021-03-13 00:16:41.350553067 +0100
|
||||
@@ -33,7 +33,7 @@
|
||||
* GNU-C-compatible compilers implement these with the same names, thus we
|
||||
* don't have to do anything
|
||||
*/
|
||||
-#ifdef _MSC_VER
|
||||
+#if defined(_MSC_VER) || defined(__serenity__)
|
||||
int cray_vasprintf(char **strp, const char *format, va_list ap) {
|
||||
int len = vscprintf(format, ap);
|
||||
if (len == -1)
|
|
@ -1,11 +0,0 @@
|
|||
--- c-ray-master/CMakeLists.txt 2021-03-13 00:40:48.474000000 +0100
|
||||
+++ c-ray-master/CMakeLists.txt 2021-03-13 00:41:04.770789629 +0100
|
||||
@@ -71,7 +71,7 @@
|
||||
target_include_directories(c-ray PRIVATE ${c-ray_SOURCE_DIR}/src)
|
||||
target_include_directories(c-ray PRIVATE ${c-ray_SOURCE_DIR}/tests)
|
||||
if (NOT MSVC)
|
||||
- target_link_libraries(c-ray PRIVATE -lpthread -lm)
|
||||
+ target_link_libraries(c-ray PRIVATE -lSDL2 -lgui -lgfx -lipc -lcore -lpthread -lstdc++ -lm)
|
||||
endif ()
|
||||
|
||||
include(CheckIPOSupported)
|
|
@ -1,20 +0,0 @@
|
|||
--- c-ray-master/src/utils/timer.c 2021-03-13 00:26:36.846000000 +0100
|
||||
+++ c-ray-master/src/utils/timer.c 2021-03-13 00:27:29.453478737 +0100
|
||||
@@ -48,7 +48,7 @@
|
||||
return ((tmr2.tv_sec - timer.tv_sec) * 1000000) + (tmr2.tv_usec - timer.tv_usec);
|
||||
}
|
||||
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__serenity__)
|
||||
#define _BSD_SOURCE
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -66,7 +66,7 @@
|
||||
ts.tv_sec = ms / 1000;
|
||||
ts.tv_nsec = (ms % 1000) * 1000000;
|
||||
nanosleep(&ts, NULL);
|
||||
-#elif __linux__
|
||||
+#elif defined(__linux__) || defined(__serenity__)
|
||||
usleep(ms * 1000);
|
||||
#endif
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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,
|
|
@ -1,10 +0,0 @@
|
|||
+++ c-ray-master/src/renderer/renderer.c 2021-04-16 13:21:09.364524790 -0700
|
||||
@@ -138,7 +138,7 @@
|
||||
float sps = (1000000.0f / usPerRay) * (r->prefs.threadCount + remoteThreads);
|
||||
char rem[64];
|
||||
smartTime((msecTillFinished) / (r->prefs.threadCount + remoteThreads), rem);
|
||||
- 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,
|
||||
interactive ? ((float)r->state.finishedPasses / (float)r->prefs.sampleCount) * 100.0f :
|
||||
((float)r->state.finishedTileCount / (float)r->state.tileCount) * 100.0f,
|
|
@ -1,11 +0,0 @@
|
|||
--- c-ray-master/src/utils/ui.c 2021-03-13 00:30:25.488000000 +0100
|
||||
+++ c-ray-master/src/utils/ui.c 2021-03-13 00:30:41.056572879 +0100
|
||||
@@ -120,7 +120,7 @@
|
||||
return;
|
||||
}
|
||||
//Init renderer
|
||||
- gdisplay->renderer = SDL_CreateRenderer(gdisplay->window, -1, SDL_RENDERER_ACCELERATED);
|
||||
+ gdisplay->renderer = SDL_CreateRenderer(gdisplay->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (gdisplay->renderer == NULL) {
|
||||
logr(warning, "Renderer couldn't be created, error: \"%s\"\n", SDL_GetError());
|
||||
destroyDisplay();
|
Loading…
Reference in a new issue