aboutsummaryrefslogtreecommitdiff
path: root/fractal-gen.c
diff options
context:
space:
mode:
Diffstat (limited to 'fractal-gen.c')
-rw-r--r--fractal-gen.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/fractal-gen.c b/fractal-gen.c
index 117e2ca..075858a 100644
--- a/fractal-gen.c
+++ b/fractal-gen.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include "trampoline.h"
@@ -24,8 +25,41 @@ int main() {
}
fprintf(stderr, "Compiled.\n");
+ fprintf(stderr, "Setting kernel arguments... ");
+ if (tramp_set_kernel_args()) {
+ fprintf(stderr, "Failed.\n");
+ return 1;
+ }
+ fprintf(stderr, "Done.\n");
+
+ fprintf(stderr, "Running kernel... ");
+ if (tramp_run_kernel()) {
+ fprintf(stderr, "Failed.\n");
+ return 1;
+ }
+ fprintf(stderr, "Done.\n");
+
+
+ unsigned int *buffer = calloc(sizeof(unsigned int), 1024*1024);
+ if (!buffer) {
+ perror("malloc");
+ return 1;
+ }
+ fprintf(stderr, "Reading data from device... ");
+ if (tramp_copy_data(&buffer)) {
+ fprintf(stderr, "Failed.\n");
+ return 1;
+ }
+ fprintf(stderr, "Done.\n");
+
fprintf(stderr, "Destroying CL trampoline... ");
tramp_destroy();
fprintf(stderr, "Blown to smitherines.\n");
+
+ printf("P5\n1024\n1024\n255\n");
+ unsigned int i;
+ for (i = 0; i < 1024*1024; i++)
+ fputc(buffer[i], stdout);
+
return 0;
}