From be4f2582062196dd6ecf393f55566367bc1dfa9f Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Thu, 1 Feb 2018 00:26:36 +0100 Subject: reorganized configs --- src/render_opencl.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/render_opencl.c') diff --git a/src/render_opencl.c b/src/render_opencl.c index 055a7f3..7bc9620 100644 --- a/src/render_opencl.c +++ b/src/render_opencl.c @@ -12,7 +12,7 @@ void idle_opencl_dummy(void) glutPostRedisplay(); } -void init_opencl(OpenCLConfig *config) +void init_opencl(config_t *cfg) { x_min_s_cl = -2.0; x_max_s_cl = 1.0; @@ -23,7 +23,7 @@ void init_opencl(OpenCLConfig *config) y_min_cl = y_min_s_cl; y_max_cl = y_max_s_cl; - config_opencl = config; + config_opencl = cfg; output = (cl_uint *) malloc((config_opencl->width) * (config_opencl->height) * sizeof(cl_uchar4)); context = NULL; @@ -47,10 +47,10 @@ void init_opencl(OpenCLConfig *config) FILE *fp; char *cl_src, *path, *flags = (char *)malloc(200 * sizeof(char)); flags[0] = '\0'; - switch(config_opencl->fpu) + switch(config_opencl->config_opencl.fpu) { case OPENCL_FPU_32: - switch(config_opencl->set_func) + switch(config_opencl->config_opencl.set_func) { case SFUNC_JULIA: path = "cl/julia32.cl"; @@ -62,7 +62,7 @@ void init_opencl(OpenCLConfig *config) } break; case OPENCL_FPU_64: - switch(config_opencl->set_func) + switch(config_opencl->config_opencl.set_func) { case SFUNC_JULIA: path = "cl/julia64.cl"; @@ -123,7 +123,7 @@ void init_opencl(OpenCLConfig *config) (sizeof(cl_uint) * (config_opencl->width) * (config_opencl->height)) / num_devices, NULL, &ret); } - if (config_opencl->fma) + if (config_opencl->config_opencl.fma) { flags = strcat(flags, "-D MUL_ADD=fma "); } @@ -138,7 +138,6 @@ void init_opencl(OpenCLConfig *config) { kernel_vector[i] = clCreateKernel(program, "calculate", &ret); } - } void render_opencl(void) @@ -186,7 +185,8 @@ void render_opencl(void) //printf("x_delta: %f, y_delta: %f, x_delta_f: %f, y_delta_f: %f, x_min_f: %f, y_max_t: %f, y_max_t_f: %f\n", x_delta, y_delta, x_delta_f, y_delta_f, x_min_f, y_max_t, y_max_t_f); - switch (config_opencl->fpu) + printf("set args\n"); + switch (config_opencl->config_opencl.fpu) { case OPENCL_FPU_32: // lel ret = clSetKernelArg(kernel, 1, sizeof(cl_float), (void *) &x_min_f); @@ -220,7 +220,6 @@ void render_opencl(void) ret = clWaitForEvents(1, &events[num_devices - i - 1]); ret = clReleaseEvent(events[num_devices - i - 1]); } - for (cl_uint i = 0; i < num_devices; i++) { ret = clEnqueueReadBuffer(commandQueue[i], outputBuffer[i], @@ -232,7 +231,6 @@ void render_opencl(void) / num_devices) * i, 0, NULL, &events[i]); } - for (cl_uint i = 0; i < num_devices; i++) { ret = clFlush(commandQueue[i]); @@ -243,6 +241,7 @@ void render_opencl(void) ret = clWaitForEvents(1, &events[num_devices - i - 1]); ret = clReleaseEvent(events[num_devices - i - 1]); } + printf("ocl render2\n"); glBindTexture(GL_TEXTURE_2D, config_opencl->tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, config_opencl->width, -- cgit v1.2.1