giving a chance for OpenCL 1.1 devices
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#define __CL_ENABLE_EXCEPTIONS
|
#define __CL_ENABLE_EXCEPTIONS
|
||||||
|
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS /*let's give a chance for OpenCL 1.1 devices*/
|
||||||
#include <CL/cl.hpp>
|
#include <CL/cl.hpp>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
@@ -182,12 +183,12 @@ void procOCL_I2I(int texIn, int texOut, int w, int h)
|
|||||||
LOGD("enqueueReleaseGLObjects() costs %d ms", getTimeInterval(t));
|
LOGD("enqueueReleaseGLObjects() costs %d ms", getTimeInterval(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void procOCL_OCV(int tex, int w, int h)
|
void procOCL_OCV(int texIn, int texOut, int w, int h)
|
||||||
{
|
{
|
||||||
if(!haveOpenCL) return;
|
if(!haveOpenCL) return;
|
||||||
|
|
||||||
int64_t t = getTimeMs();
|
int64_t t = getTimeMs();
|
||||||
cl::ImageGL imgIn (theContext, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, tex);
|
cl::ImageGL imgIn (theContext, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texIn);
|
||||||
std::vector < cl::Memory > images(1, imgIn);
|
std::vector < cl::Memory > images(1, imgIn);
|
||||||
theQueue.enqueueAcquireGLObjects(&images);
|
theQueue.enqueueAcquireGLObjects(&images);
|
||||||
theQueue.finish();
|
theQueue.finish();
|
||||||
@@ -204,7 +205,7 @@ void procOCL_OCV(int tex, int w, int h)
|
|||||||
LOGD("OpenCV processing costs %d ms", getTimeInterval(t));
|
LOGD("OpenCV processing costs %d ms", getTimeInterval(t));
|
||||||
|
|
||||||
t = getTimeMs();
|
t = getTimeMs();
|
||||||
cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, tex);
|
cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, texOut);
|
||||||
images.clear();
|
images.clear();
|
||||||
images.push_back(imgOut);
|
images.push_back(imgOut);
|
||||||
theQueue.enqueueAcquireGLObjects(&images);
|
theQueue.enqueueAcquireGLObjects(&images);
|
||||||
|
@@ -31,7 +31,7 @@ const char vss[] = \
|
|||||||
"varying vec2 texCoord;\n" \
|
"varying vec2 texCoord;\n" \
|
||||||
"void main() {\n" \
|
"void main() {\n" \
|
||||||
" texCoord = vTexCoord;\n" \
|
" texCoord = vTexCoord;\n" \
|
||||||
" gl_Position = vec4 ( vPosition, 0.0f, 1.0f );\n" \
|
" gl_Position = vec4 ( vPosition, 0.0, 1.0 );\n" \
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char fssOES[] = \
|
const char fssOES[] = \
|
||||||
@@ -268,7 +268,7 @@ void drawFrameProcCPU()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void procOCL_I2I(int texIn, int texOut, int w, int h);
|
void procOCL_I2I(int texIn, int texOut, int w, int h);
|
||||||
void procOCL_OCV(int tex, int w, int h);
|
void procOCL_OCV(int texIn, int texOut, int w, int h);
|
||||||
void drawFrameProcOCL()
|
void drawFrameProcOCL()
|
||||||
{
|
{
|
||||||
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
|
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
|
||||||
@@ -285,10 +285,10 @@ void drawFrameProcOCLOCV()
|
|||||||
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
|
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
|
||||||
|
|
||||||
// modify pixels in FBO texture using OpenCL and CL-GL interop
|
// modify pixels in FBO texture using OpenCL and CL-GL interop
|
||||||
procOCL_OCV(FBOtex, texWidth, texHeight);
|
procOCL_OCV(FBOtex, FBOtex2, texWidth, texHeight);
|
||||||
|
|
||||||
// render to screen
|
// render to screen
|
||||||
drawTex(FBOtex, GL_TEXTURE_2D, 0);
|
drawTex(FBOtex2, GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void drawFrame()
|
extern "C" void drawFrame()
|
||||||
|
Reference in New Issue
Block a user