clray
diff src/rt.cc @ 40:1bcbb53b3505
segfault on exit?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 27 Aug 2010 19:00:14 +0100 |
parents | 980bc07be868 |
children | 057b8575a1c1 |
line diff
1.1 --- a/src/rt.cc Fri Aug 27 18:30:09 2010 +0100 1.2 +++ b/src/rt.cc Fri Aug 27 19:00:14 2010 +0100 1.3 @@ -129,6 +129,7 @@ 1.4 1.5 long tm0 = get_msec(); 1.6 1.7 +#ifdef CLGL_INTEROP 1.8 cl_event ev; 1.9 CLMemBuffer *texbuf = prog->get_arg_buffer(KARG_FRAMEBUFFER); 1.10 1.11 @@ -138,20 +139,24 @@ 1.12 1.13 // make sure that we will wait for the acquire to finish before running 1.14 prog->set_wait_event(ev); 1.15 +#endif 1.16 1.17 if(!prog->run(1, global_size)) { 1.18 return false; 1.19 } 1.20 1.21 +#ifdef CLGL_INTEROP 1.22 if(!release_gl_object(texbuf, &ev)) { 1.23 return false; 1.24 } 1.25 clWaitForEvents(1, &ev); 1.26 +#endif 1.27 1.28 - printf("rendered in %ld msec\n", get_msec() - tm0); 1.29 - 1.30 - /*long tm_run = get_msec() - tm0; 1.31 - 1.32 +#ifndef CLGL_INTEROP 1.33 + /* if we don't compile in CL/GL interoperability support, we need 1.34 + * to copy the output buffer to the OpenGL texture used to displaying 1.35 + * the image. 1.36 + */ 1.37 CLMemBuffer *mbuf = prog->get_arg_buffer(KARG_FRAMEBUFFER); 1.38 void *fb = map_mem_buffer(mbuf, MAP_RD); 1.39 if(!fb) { 1.40 @@ -161,11 +166,9 @@ 1.41 1.42 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rinf.xsz, rinf.ysz, GL_RGBA, GL_FLOAT, fb); 1.43 unmap_mem_buffer(mbuf); 1.44 +#endif 1.45 1.46 - long tm_upd = get_msec() - tm0 - tm_run; 1.47 - 1.48 - printf("render %ld msec (%ld run, %ld upd)\n", tm_run + tm_upd, tm_run, tm_upd); 1.49 - */ 1.50 + printf("rendered in %ld msec\n", get_msec() - tm0); 1.51 return true; 1.52 } 1.53