Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8c591ebd
Commit
8c591ebd
authored
Feb 16, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6060 from alalek:fix_opencl_opengl_sharing_6052
parents
d1a2c732
c7bdbef5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
46 additions
and
22 deletions
+46
-22
opencl.cpp
cmake/checks/opencl.cpp
+1
-4
opencl_core.hpp
...opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
+0
-4
opencl_gl.hpp
...e/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
+4
-4
opencl_gl_wrappers.hpp
.../core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp
+4
-0
opencl_gl_impl.hpp
.../core/src/opencl/runtime/autogenerated/opencl_gl_impl.hpp
+4
-0
common.py
modules/core/src/opencl/runtime/generator/common.py
+2
-2
generate.sh
modules/core/src/opencl/runtime/generator/generate.sh
+0
-0
opencl_core.hpp.in
.../src/opencl/runtime/generator/template/opencl_core.hpp.in
+0
-4
opencl_gl.hpp.in
...re/src/opencl/runtime/generator/template/opencl_gl.hpp.in
+4
-4
opencl_gl_impl.hpp.in
...c/opencl/runtime/generator/template/opencl_gl_impl.hpp.in
+4
-0
opencl_gl_wrappers.hpp.in
...encl/runtime/generator/template/opencl_gl_wrappers.hpp.in
+4
-0
opencl_core.cpp
modules/core/src/opencl/runtime/opencl_core.cpp
+4
-0
opengl.cpp
modules/core/src/opengl.cpp
+15
-0
No files found.
cmake/checks/opencl.cpp
View file @
8c591ebd
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
// custom OpenCL headers are located in "CL" subfolder (3rdparty/include/...)
#include <CL/cl.h>
#endif
#ifndef _MSC_VER
#ifdef CL_VERSION_1_2
...
...
modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
View file @
8c591ebd
...
...
@@ -95,11 +95,7 @@
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_
#define clWaitForEvents clWaitForEvents_
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// generated by parser_cl.py
#undef clBuildProgram
...
...
modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
View file @
8c591ebd
...
...
@@ -17,11 +17,7 @@
#define clGetGLObjectInfo clGetGLObjectInfo_
#define clGetGLTextureInfo clGetGLTextureInfo_
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
// generated by parser_cl.py
#undef clCreateFromGLBuffer
...
...
@@ -45,6 +41,8 @@
#undef clGetGLTextureInfo
#define clGetGLTextureInfo clGetGLTextureInfo_pfn
#ifdef cl_khr_gl_sharing
// generated by parser_cl.py
extern
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLBuffer
)(
cl_context
,
cl_mem_flags
,
cl_GLuint
,
int
*
);
extern
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLRenderbuffer
)(
cl_context
,
cl_mem_flags
,
cl_GLuint
,
cl_int
*
);
...
...
@@ -56,3 +54,5 @@ extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_comma
extern
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLContextInfoKHR
)(
const
cl_context_properties
*
,
cl_gl_context_info
,
size_t
,
void
*
,
size_t
*
);
extern
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLObjectInfo
)(
cl_mem
,
cl_gl_object_type
*
,
cl_GLuint
*
);
extern
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLTextureInfo
)(
cl_mem
,
cl_gl_texture_info
,
size_t
,
void
*
,
size_t
*
);
#endif // cl_khr_gl_sharing
modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp
View file @
8c591ebd
...
...
@@ -5,6 +5,8 @@
#error "Invalid usage"
#endif
#ifdef cl_khr_gl_sharing
// generated by parser_cl.py
#undef clCreateFromGLBuffer
#define clCreateFromGLBuffer clCreateFromGLBuffer_fn
...
...
@@ -36,3 +38,5 @@ inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2)
#undef clGetGLTextureInfo
#define clGetGLTextureInfo clGetGLTextureInfo_fn
inline
cl_int
clGetGLTextureInfo
(
cl_mem
p0
,
cl_gl_texture_info
p1
,
size_t
p2
,
void
*
p3
,
size_t
*
p4
)
{
return
clGetGLTextureInfo_pfn
(
p0
,
p1
,
p2
,
p3
,
p4
);
}
#endif // cl_khr_gl_sharing
modules/core/src/opencl/runtime/autogenerated/opencl_gl_impl.hpp
View file @
8c591ebd
...
...
@@ -139,6 +139,8 @@ struct opencl_gl_fn14
}
// anonymous namespace
#ifdef cl_khr_gl_sharing
// generated by parser_cl.py
cl_mem
(
CL_API_CALL
*
clCreateFromGLBuffer
)(
cl_context
,
cl_mem_flags
,
cl_GLuint
,
int
*
)
=
opencl_gl_fn4
<
OPENCL_GL_FN_clCreateFromGLBuffer
,
cl_mem
,
cl_context
,
cl_mem_flags
,
cl_GLuint
,
int
*>::
switch_fn
;
...
...
@@ -196,3 +198,5 @@ static const struct DynamicFnEntry* opencl_gl_fn_list[] = {
};
// number of enabled functions: 10
#endif // cl_khr_gl_sharing
modules/core/src/opencl/runtime/generator/common.py
View file @
8c591ebd
...
...
@@ -254,6 +254,6 @@ def ProcessTemplate(inputFile, ctx, noteLine='//\n// AUTOGENERATED, DO NOT EDIT\
assert
line
[
-
1
]
==
'@'
name
=
line
[
1
:
-
1
]
assert
ctx
.
has_key
(
name
),
name
line
=
ctx
[
name
]
print
line
,
line
=
ctx
[
name
]
+
(
'
\n
'
if
len
(
ctx
[
name
])
>
0
and
ctx
[
name
][
-
1
]
!=
'
\n
'
else
''
)
sys
.
stdout
.
write
(
line
)
f
.
close
()
modules/core/src/opencl/runtime/generator/generate.sh
100644 → 100755
View file @
8c591ebd
File mode changed from 100644 to 100755
modules/core/src/opencl/runtime/generator/template/opencl_core.hpp.in
View file @
8c591ebd
...
...
@@ -4,11 +4,7 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
@CL_REMAP_DYNAMIC@
...
...
modules/core/src/opencl/runtime/generator/template/opencl_gl.hpp.in
View file @
8c591ebd
...
...
@@ -4,12 +4,12 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
@CL_REMAP_DYNAMIC@
#ifdef cl_khr_gl_sharing
@CL_FN_DECLARATIONS@
#endif // cl_khr_gl_sharing
modules/core/src/opencl/runtime/generator/template/opencl_gl_impl.hpp.in
View file @
8c591ebd
...
...
@@ -4,8 +4,12 @@ namespace {
@CL_FN_SWITCH@
} // anonymous namespace
#ifdef cl_khr_gl_sharing
@CL_FN_ENTRY_DEFINITIONS@
@CL_FN_ENTRY_LIST@
@CL_NUMBER_OF_ENABLED_FUNCTIONS@
#endif // cl_khr_gl_sharing
modules/core/src/opencl/runtime/generator/template/opencl_gl_wrappers.hpp.in
View file @
8c591ebd
...
...
@@ -2,4 +2,8 @@
#error "Invalid usage"
#endif
#ifdef cl_khr_gl_sharing
@CL_FN_INLINE_WRAPPERS@
#endif // cl_khr_gl_sharing
modules/core/src/opencl/runtime/opencl_core.cpp
View file @
8c591ebd
...
...
@@ -286,6 +286,8 @@ static void* opencl_check_fn(int ID)
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
#ifdef cl_khr_gl_sharing
static
void
*
opencl_gl_check_fn
(
int
ID
);
#include "autogenerated/opencl_gl_impl.hpp"
...
...
@@ -306,6 +308,8 @@ static void* opencl_gl_check_fn(int ID)
return
func
;
}
#endif // cl_khr_gl_sharing
#endif // HAVE_OPENGL
#endif
modules/core/src/opengl.cpp
View file @
8c591ebd
...
...
@@ -1580,6 +1580,11 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala
#ifdef HAVE_OPENCL
# include "opencv2/core/opencl/runtime/opencl_gl.hpp"
# ifdef cl_khr_gl_sharing
# define HAVE_OPENCL_OPENGL_SHARING
# else
# define NO_OPENCL_SHARING_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL/OpenGL sharing support")
# endif
#else // HAVE_OPENCL
# define NO_OPENCL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support")
#endif // HAVE_OPENCL
...
...
@@ -1602,6 +1607,8 @@ Context& initializeContextFromGL()
NO_OPENGL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL)
NO_OPENCL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL_OPENGL_SHARING)
NO_OPENCL_SHARING_ERROR
;
#else
cl_uint
numPlatforms
;
cl_int
status
=
clGetPlatformIDs
(
0
,
NULL
,
&
numPlatforms
);
...
...
@@ -1701,6 +1708,8 @@ void convertToGLTexture2D(InputArray src, Texture2D& texture)
NO_OPENGL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL)
NO_OPENCL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL_OPENGL_SHARING)
NO_OPENCL_SHARING_ERROR
;
#else
Size
srcSize
=
src
.
size
();
CV_Assert
(
srcSize
.
width
==
(
int
)
texture
.
cols
()
&&
srcSize
.
height
==
(
int
)
texture
.
rows
());
...
...
@@ -1753,6 +1762,8 @@ void convertFromGLTexture2D(const Texture2D& texture, OutputArray dst)
NO_OPENGL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL)
NO_OPENCL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL_OPENGL_SHARING)
NO_OPENCL_SHARING_ERROR
;
#else
// check texture format
const
int
dtype
=
CV_8UC4
;
...
...
@@ -1812,6 +1823,8 @@ UMat mapGLBuffer(const Buffer& buffer, int accessFlags)
NO_OPENGL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL)
NO_OPENCL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL_OPENGL_SHARING)
NO_OPENCL_SHARING_ERROR
;
#else
using
namespace
cv
::
ocl
;
Context
&
ctx
=
Context
::
getDefault
();
...
...
@@ -1862,6 +1875,8 @@ void unmapGLBuffer(UMat& u)
NO_OPENGL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL)
NO_OPENCL_SUPPORT_ERROR
;
#elif !defined(HAVE_OPENCL_OPENGL_SHARING)
NO_OPENCL_SHARING_ERROR
;
#else
using
namespace
cv
::
ocl
;
cl_command_queue
clQueue
=
(
cl_command_queue
)
Queue
::
getDefault
().
ptr
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment