diff --git a/c++/contourgl/clcontext.cpp b/c++/contourgl/clcontext.cpp index 6183921..d5a60a8 100644 --- a/c++/contourgl/clcontext.cpp +++ b/c++/contourgl/clcontext.cpp @@ -80,6 +80,7 @@ ClContext::ClContext(): err(), context(), queue() { queue = clCreateCommandQueue(context, devices.front(), CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, NULL); assert(queue); + //hello(); } ClContext::~ClContext() { diff --git a/c++/contourgl/clrender.cpp b/c++/contourgl/clrender.cpp index 9bcf1eb..447aab2 100644 --- a/c++/contourgl/clrender.cpp +++ b/c++/contourgl/clrender.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "clrender.h" #include "measure.h" @@ -102,10 +103,15 @@ void ClRender::send_surface(Surface *surface) { surface_format.image_channel_order = CL_RGBA; surface_format.image_channel_data_type = CL_FLOAT; - surface_image = clCreateImage2D( + cl_image_desc surface_desc = { }; + surface_desc.image_type = CL_MEM_OBJECT_IMAGE2D; + surface_desc.image_width = surface->width; + surface_desc.image_height = surface->height; + + surface_image = clCreateImage( cl.context, CL_MEM_READ_WRITE, - &surface_format, surface->width, surface->height, - 0, NULL, NULL ); + &surface_format, &surface_desc, + NULL, NULL ); assert(surface_image); size_t origin[3] = { }; @@ -141,7 +147,9 @@ Surface* ClRender::receive_surface() { cl.err |= clEnqueueReadImage( cl.queue, surface_image, CL_FALSE, origin, region, 0, 0, surface->data, - prev_event ? 1 : 0, &prev_event, NULL ); + prev_event ? 1 : 0, + prev_event ? &prev_event : NULL, + NULL ); assert(!cl.err); cl.err |= clFinish(cl.queue); @@ -212,7 +220,7 @@ void ClRender::path(int start, int count, const Color &color, bool invert, bool &scount, NULL, prev_event ? 1 : 0, - &prev_event, + prev_event ? &prev_event : NULL, &path_event ); assert(!cl.err); diff --git a/c++/contourgl/polyspan.cpp b/c++/contourgl/polyspan.cpp index 2e39124..1d21dc2 100644 --- a/c++/contourgl/polyspan.cpp +++ b/c++/contourgl/polyspan.cpp @@ -755,7 +755,7 @@ void Polyspan::draw_line(Real x1, Real y1, Real x2, Real y2) { } } -Real Polyspan::extract_alpha(Real area, bool evenodd) const { +Real Polyspan::extract_alpha(Real area, bool evenodd) { if (area < 0) area = -area; diff --git a/c++/contourgl/polyspan.h b/c++/contourgl/polyspan.h index bb19648..aa4d86b 100644 --- a/c++/contourgl/polyspan.h +++ b/c++/contourgl/polyspan.h @@ -140,7 +140,7 @@ public: void draw_scanline(int y, Real x1, Real y1, Real x2, Real y2); void draw_line(Real x1, Real y1, Real x2, Real y2); - Real extract_alpha(Real area, bool evenodd) const; + static Real extract_alpha(Real area, bool evenodd); }; #endif