increase worksize again and print debug outputs
This commit is contained in:
parent
49201ea8cf
commit
fc0de0aa30
26
src/main.c
26
src/main.c
@ -6,28 +6,30 @@
|
||||
#include <CL/cl.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
static const char * const vertex_shader = "#version 330 core\n \
|
||||
layout (location = 0) in vec3 aPos;\n \
|
||||
layout (location = 1) in vec2 aTexCoord;\n\
|
||||
out vec2 texCoord;\n\
|
||||
out vec3 vertPos;\n \
|
||||
void main()\n \
|
||||
{\n \
|
||||
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n \
|
||||
texCoord = aTexCoord;\n\
|
||||
vertPos = aPos;\n\
|
||||
}\n";
|
||||
|
||||
static const char * const orange_framgment_shader = " \
|
||||
#version 330 core\n \
|
||||
out vec4 FragColor;\n \
|
||||
in vec4 vertexColor;\n \
|
||||
in vec3 vertPos;\n \
|
||||
in vec2 texCoord;\n \
|
||||
uniform sampler2D ourTexture;\n \
|
||||
\n \
|
||||
void main()\n \
|
||||
{\n \
|
||||
FragColor = texture(ourTexture, texCoord);\n \
|
||||
FragColor = texture(ourTexture, texCoord); //+ vec4(vertPos.x, -vertPos.x, vertPos.y, 0.0);\n \
|
||||
}";
|
||||
|
||||
struct canvas_buffer {
|
||||
@ -147,7 +149,7 @@ static int calculate_mandelbrot(struct canvas_buffer *buff)
|
||||
char *source_code = NULL;
|
||||
char temp_buff[100];
|
||||
size_t data_size;
|
||||
size_t work_size = 10;
|
||||
size_t work_size = 64;
|
||||
|
||||
|
||||
data_size = buff->width*buff->height;
|
||||
@ -377,8 +379,8 @@ int main(int argc, char **argv)
|
||||
GtkGLArea *gl_area;
|
||||
GtkWindow *window;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *temp;
|
||||
static struct canvas_buffer mandelbrot_buff;
|
||||
clock_t start, end;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
@ -388,17 +390,20 @@ int main(int argc, char **argv)
|
||||
g_signal_connect(window, "delete-event", G_CALLBACK(on_main_window_close), NULL);
|
||||
|
||||
|
||||
|
||||
mandelbrot_buff.x_span = 0.075;//2.8;
|
||||
mandelbrot_buff.y_span = 0.075;//2.25;
|
||||
mandelbrot_buff.center_x = -0.6;
|
||||
mandelbrot_buff.center_y = 0.45;
|
||||
mandelbrot_buff.width = 3000;
|
||||
mandelbrot_buff.height = 3000;
|
||||
mandelbrot_buff.iterations = 200;
|
||||
mandelbrot_buff.width = 2000;
|
||||
mandelbrot_buff.height = 2000;
|
||||
mandelbrot_buff.iterations = 400;
|
||||
mandelbrot_buff.mandelbrot_buffer = NULL;
|
||||
calculate_mandelbrot(&mandelbrot_buff);
|
||||
|
||||
printf("Compile and run Mandelbrot on OpenCL HW\n");
|
||||
start = clock();
|
||||
calculate_mandelbrot(&mandelbrot_buff);
|
||||
end = clock();
|
||||
printf("Calculation finished. Time needed: %lf ms\n", ((double) (end - start)) / CLOCKS_PER_SEC * 1000.0);
|
||||
|
||||
|
||||
gl_area = GTK_GL_AREA(gtk_gl_area_new());
|
||||
@ -415,6 +420,7 @@ int main(int argc, char **argv)
|
||||
|
||||
gtk_gl_area_make_current(gl_area);
|
||||
|
||||
printf("Gui will be displayed\n");
|
||||
|
||||
gtk_main();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user