aboutsummaryrefslogtreecommitdiff
path: root/src/mandelbrot-zoom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mandelbrot-zoom.c')
-rw-r--r--src/mandelbrot-zoom.c112
1 files changed, 63 insertions, 49 deletions
diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c
index 9410734..72b54ba 100644
--- a/src/mandelbrot-zoom.c
+++ b/src/mandelbrot-zoom.c
@@ -17,6 +17,7 @@ int main(int argc, char **argv)
ui_settings.settings = GTK_WINDOW(gtk_builder_get_object(builder, "settings"));
//gtk_builder_connect_signals(builder, NULL);
+ ui_settings.setCombo = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "setCombo"));
ui_settings.iterationsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "iterationsSp"));
ui_settings.threadsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "threadsSp"));
ui_settings.colorFromBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorFromBtn"));
@@ -24,6 +25,10 @@ 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.fpuCombo = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "fpuCombo"));
+ ui_settings.fmaCb = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "fmaCb"));
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"));
@@ -60,17 +65,15 @@ int main(int argc, char **argv)
gtk_spin_button_set_range(ui_settings.fpsVideoSp, 1, 60);
gtk_spin_button_set_range(ui_settings.bitrateSp, 1, 65535);
- g_signal_connect(ui_settings.iterationsSp, "value-changed", G_CALLBACK(on_iterationsSp_valueChanged), NULL);
- g_signal_connect(ui_settings.threadsSp, "value-changed", G_CALLBACK(on_threadsSp_valueChanged), NULL);
+ gtk_combo_box_text_append(ui_settings.setCombo, NULL, "Mandelbrot");
+ gtk_combo_box_text_append(ui_settings.setCombo, NULL, "Julia");
+
+ gtk_combo_box_text_append(ui_settings.fpuCombo, NULL, "32 bit");
+ gtk_combo_box_text_append(ui_settings.fpuCombo, NULL, "64 bit");
+ gtk_combo_box_text_append(ui_settings.fpuCombo, NULL, "128 bit");
+
g_signal_connect(ui_settings.colorFromBtn, "clicked", G_CALLBACK(on_colorFromBtn_clicked), NULL);
g_signal_connect(ui_settings.colorToBtn, "clicked", G_CALLBACK(on_colorToBtn_clicked), NULL);
- g_signal_connect(ui_settings.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
- g_signal_connect(ui_settings.widthSp, "value-changed", G_CALLBACK(on_widthSp_valueChanged), NULL);
- g_signal_connect(ui_settings.heightSp, "value-changed", G_CALLBACK(on_heightSp_valueChanged), NULL);
- g_signal_connect(ui_settings.fpsRenderSp, "value-changed", G_CALLBACK(on_fpsRenderSp_valueChanged), NULL);
- g_signal_connect(ui_settings.fpsVideoSp, "value-changed", G_CALLBACK(on_fpsVideoSp_valueChanged), NULL);
- g_signal_connect(ui_settings.bitrateSp, "value-changed", G_CALLBACK(on_bitrateSp_valueChanged), NULL);
- g_signal_connect(ui_settings.exportTf, "changed", G_CALLBACK(on_exportTf_changed), NULL);
g_signal_connect(ui_settings.startBtn, "clicked", G_CALLBACK(on_startBtn_clicked), NULL);
g_signal_connect(ui_settings.exitBtn, "clicked", G_CALLBACK(on_exitBtn_clicked), NULL);
@@ -80,16 +83,6 @@ int main(int argc, char **argv)
return 0;
}
-void on_iterationsSp_valueChanged()
-{
- config.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp);
-}
-
-void on_threadsSp_valueChanged()
-{
- config.threads = gtk_spin_button_get_value(ui_settings.threadsSp);
-}
-
void on_colorFromBtn_clicked()
{
currentColor = COLOR_FROM;
@@ -102,53 +95,74 @@ void on_colorToBtn_clicked()
gtk_dialog_run(ui_settings.colorDialog);
}
-void on_exportCb_toggled()
+void on_startBtn_clicked()
{
- config.video = gtk_toggle_button_get_active(ui_settings.exportCb);
-}
+ config.config_cpu.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp);
+ config.config_opencl.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp);
+
+ config.config_cpu.threads = gtk_spin_button_get_value(ui_settings.threadsSp);
+
+ config.config_opencl.fma = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui_settings.fmaCb));
+
+ config.video = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui_settings.exportCb));
-void on_exportTf_changed()
-{
config.path = CHAR_PTR(gtk_entry_get_text(ui_settings.exportTf));
-}
-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()
-{
config.videoFPS = gtk_spin_button_get_value(ui_settings.fpsVideoSp);
-}
-void on_bitrateSp_valueChanged()
-{
config.bitrate = gtk_spin_button_get_value(ui_settings.bitrateSp);
-}
-void on_startBtn_clicked()
-{
double x, y, speed;
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;
+
+ config.mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui_settings.modeGPURd));
+ //config.mode = MODE_CPU;
+
+ if (strcmp(gtk_combo_box_text_get_active_text(ui_settings.setCombo), "Mandelbrot") == 0)
+ {
+ config.config_cpu.set_func = mandelbrot_r;
+ config.config_opencl.set_func = SFUNC_MANDELBROT;
+ }
+ else if (strcmp(gtk_combo_box_text_get_active_text(ui_settings.setCombo), "Julia") == 0)
+ {
+ config.config_cpu.set_func = julia;
+ config.config_opencl.set_func = SFUNC_JULIA;
+ }
+
+ if (strcmp(gtk_combo_box_text_get_active_text(ui_settings.fpuCombo), "32 bit") == 0)
+ {
+ config.config_opencl.fpu = OPENCL_FPU_32;
+ }
+ else if (strcmp(gtk_combo_box_text_get_active_text(ui_settings.fpuCombo), "64 bit") == 0)
+ {
+ config.config_opencl.fpu = OPENCL_FPU_64;
+ }
+ else if (strcmp(gtk_combo_box_text_get_active_text(ui_settings.fpuCombo), "128 bit") == 0)
+ {
+ config.config_opencl.fpu = OPENCL_FPU_128;
+ }
+
+ init_render(&config);
+ show_render();
}
void on_exitBtn_clicked()