From 1c3ea27064257d8cf7b9f36b0388b8cf2e94ab08 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Fri, 26 Jan 2018 01:12:49 +0100 Subject: Skeleton for OpenCL rendering, cleaned up alot, WIP and crashing --- src/mandelbrot-zoom.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/mandelbrot-zoom.c') diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c index 9410734..f54a2ab 100644 --- a/src/mandelbrot-zoom.c +++ b/src/mandelbrot-zoom.c @@ -24,6 +24,8 @@ int main(int argc, char **argv) ui_settings.zoomToXEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToXEntry")); ui_settings.zoomToYEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToYEntry")); ui_settings.speedEntry = GTK_ENTRY(gtk_builder_get_object(builder, "speedEntry")); + ui_settings.modeCPURd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "modeCPURd")); + ui_settings.modeGPURd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "modeGPURd")); ui_settings.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb")); ui_settings.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd")); ui_settings.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp")); @@ -82,12 +84,13 @@ int main(int argc, char **argv) void on_iterationsSp_valueChanged() { - config.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp); + config.config_cpu.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp); + config.config_opencl.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp); } void on_threadsSp_valueChanged() { - config.threads = gtk_spin_button_get_value(ui_settings.threadsSp); + config.config_cpu.threads = gtk_spin_button_get_value(ui_settings.threadsSp); } void on_colorFromBtn_clicked() @@ -115,16 +118,21 @@ void on_exportTf_changed() void on_widthSp_valueChanged() { config.width = gtk_spin_button_get_value(ui_settings.widthSp); + config.config_cpu.width = gtk_spin_button_get_value(ui_settings.widthSp); + config.config_opencl.width = gtk_spin_button_get_value(ui_settings.widthSp); } void on_heightSp_valueChanged() { config.height = gtk_spin_button_get_value(ui_settings.heightSp); + config.config_cpu.height = gtk_spin_button_get_value(ui_settings.heightSp); + config.config_opencl.height = gtk_spin_button_get_value(ui_settings.heightSp); } void on_fpsRenderSp_valueChanged() { - config.renderFPS = gtk_spin_button_get_value(ui_settings.fpsRenderSp); + config.config_cpu.renderFPS = gtk_spin_button_get_value(ui_settings.fpsRenderSp); + config.config_opencl.renderFPS = gtk_spin_button_get_value(ui_settings.fpsRenderSp); } void on_fpsVideoSp_valueChanged() @@ -143,12 +151,23 @@ void on_startBtn_clicked() sscanf(gtk_entry_get_text(ui_settings.zoomToXEntry), "%lf", &x); sscanf(gtk_entry_get_text(ui_settings.zoomToYEntry), "%lf", &y); sscanf(gtk_entry_get_text(ui_settings.speedEntry), "%lf", &speed); - config.to_x = x; - config.to_y = y; - config.speed = speed; - printf("config {\n\t.iterations = %u\n\t.tox = %f\n\t.toy = %f\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, x, y, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path); - render_init(&config, mandelbrot_r); - render_show(); + config.config_cpu.to_x = x; + config.config_cpu.to_y = y; + config.config_cpu.speed = speed; + config.config_opencl.to_x = x; + config.config_opencl.to_y = y; + config.config_opencl.speed = speed; + //printf("config {\n\t.iterations = %u\n\t.tox = %f\n\t.toy = %f\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, x, y, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path); + + // TODO: implement selection of sets correctly + config.config_cpu.set_func = mandelbrot_r; + config.config_opencl.set_func = mandelbrot_r; + + // TODO: implement selection of render mode correctly + config.mode = MODE_CPU; + + init_render(&config); + show_render(); } void on_exitBtn_clicked() -- cgit v1.2.1