aboutsummaryrefslogtreecommitdiff
path: root/src/render_opencl.h
diff options
context:
space:
mode:
authorcxp2249 <moritz.pirk@tuhh.de>2018-01-27 02:35:54 +0100
committercxp2249 <moritz.pirk@tuhh.de>2018-01-27 02:35:54 +0100
commitf72c4f122ccd832031925974ff521955e0e9b17c (patch)
tree02766a38371000ced0e2cb109f4e6a7f5c97a61c /src/render_opencl.h
parentcbac1496b1c8023a7fdede63e9556f2de82bbafe (diff)
parentc8a38bd8ad66eb0b35f08a4733fdee37a888b83c (diff)
Merge branch 'master' of https://collaborating.tuhh.de/cev7691/mandelbrot-zoom
Diffstat (limited to 'src/render_opencl.h')
-rw-r--r--src/render_opencl.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/render_opencl.h b/src/render_opencl.h
new file mode 100644
index 0000000..b995c4d
--- /dev/null
+++ b/src/render_opencl.h
@@ -0,0 +1,75 @@
+/*
+ * render_opencl.h
+ *
+ * Created on: 25.01.2018
+ * Author: Superleo1810
+ */
+
+#ifndef RENDER_OPENCL_H_
+#define RENDER_OPENCL_H_
+
+#include "defs.h"
+#include <stdlib.h>
+#include <GL/glut.h>
+#include <CL/cl.h>
+#include "sets.h"
+#include <math.h>
+
+#define OPENCL_FPU_32 0
+#define OPENCL_FPU_64 1
+#define OPENCL_FPU_128 2
+
+#define MAX_SOURCE_SIZE 0xFFFF // 64 KiB
+#define MAX_DEVICES 4
+
+typedef struct config_opencl {
+ u8 fpu;
+ u8 fma;
+ GLuint tex;
+ d64 (*zoom_func)(d64, d64);
+ u8 set_func; // id, not pointer!
+ u32 *arr;
+ u32 iterations;
+ u32 colorFrom;
+ u32 colorTo;
+ d64 to_x;
+ d64 to_y;
+ d64 speed;
+ u16 width;
+ u16 height;
+ u8 renderFPS;
+} OpenCLConfig;
+
+OpenCLConfig *config_opencl;
+
+d64 x_min, x_max, y_min, y_max;
+d64 x_min_s, x_max_s, y_min_s, y_max_s;
+
+float cl_ft;
+cl_uint *output;
+cl_device_id device_id;
+cl_context context;
+cl_int ret;
+cl_kernel kernel_vector[MAX_DEVICES];
+cl_uint num_devices;
+cl_device_id *devices;
+cl_command_queue commandQueue[MAX_DEVICES];
+cl_mem outputBuffer[MAX_DEVICES];
+
+double xpos;
+double ypos;
+double xsize;
+double ysize;
+double xstep;
+double ystep;
+double leftx;
+double topy;
+double topy0;
+
+d64 zoom_func(d64 ft, d64 s);
+
+void init_opencl(OpenCLConfig *config);
+void render_opencl(void);
+void idle_opencl(void);
+
+#endif /* RENDER_OPENCL_H_ */