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
ee68d26f
Commit
ee68d26f
authored
9 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: update generator scripts
parent
8298644b
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
195 additions
and
12 deletions
+195
-12
opencl_gl.hpp
...es/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp
+65
-0
opencl_gl_wrappers.hpp
...nclude/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp
+47
-0
generate.sh
modules/core/src/opencl/runtime/generator/generate.sh
+2
-0
parser_cl.py
modules/core/src/opencl/runtime/generator/parser_cl.py
+22
-12
opencl_gl.hpp.in
...re/src/opencl/runtime/generator/template/opencl_gl.hpp.in
+17
-0
opencl_gl_impl.hpp.in
...c/opencl/runtime/generator/template/opencl_gl_impl.hpp.in
+11
-0
opencl_gl_wrappers.hpp.in
...encl/runtime/generator/template/opencl_gl_wrappers.hpp.in
+5
-0
opencl_core.cpp
modules/core/src/opencl/runtime/opencl_core.cpp
+26
-0
No files found.
modules/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp
0 → 100644
View file @
ee68d26f
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the OpenCV Foundation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP__
#define __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP__
#if defined HAVE_OPENCL && defined HAVE_OPENGL
#include "opencl_core.hpp"
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
#else // HAVE_OPENCL_STATIC
#include "autogenerated/opencl_gl.hpp"
#endif // HAVE_OPENCL_STATIC
#endif // defined HAVE_OPENCL && defined HAVE_OPENGL
#endif // __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP__
This diff is collapsed.
Click to expand it.
modules/core/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp
0 → 100644
View file @
ee68d26f
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the OpenCV Foundation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP__
#define __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP__
#include "autogenerated/opencl_gl_wrappers.hpp"
#endif // __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP__
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/generator/generate.sh
View file @
ee68d26f
...
@@ -3,4 +3,6 @@ echo "Generate files for CL runtime..."
...
@@ -3,4 +3,6 @@ echo "Generate files for CL runtime..."
python parser_cl.py opencl_core < sources/cl.h
python parser_cl.py opencl_core < sources/cl.h
python parser_clamdblas.py < sources/clAmdBlas.h
python parser_clamdblas.py < sources/clAmdBlas.h
python parser_clamdfft.py < sources/clAmdFft.h
python parser_clamdfft.py < sources/clAmdFft.h
python parser_cl.py opencl_gl < sources/cl_gl.h
echo
"Generate files for CL runtime... Done"
echo
"Generate files for CL runtime... Done"
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/generator/parser_cl.py
View file @
ee68d26f
...
@@ -8,9 +8,10 @@ from common import remove_comments, getTokens, getParameters, postProcessParamet
...
@@ -8,9 +8,10 @@ from common import remove_comments, getTokens, getParameters, postProcessParamet
try
:
try
:
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
outfile
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/'
+
sys
.
argv
[
1
]
+
'.hpp'
,
'wb'
)
module_name
=
sys
.
argv
[
1
]
outfile_impl
=
open
(
'../autogenerated/'
+
sys
.
argv
[
1
]
+
'_impl.hpp'
,
'wb'
)
outfile
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/
%
s.hpp'
%
module_name
,
'wb'
)
outfile_wrappers
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/'
+
sys
.
argv
[
1
]
+
'_wrappers.hpp'
,
'wb'
)
outfile_impl
=
open
(
'../autogenerated/
%
s_impl.hpp'
%
module_name
,
'wb'
)
outfile_wrappers
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/
%
s_wrappers.hpp'
%
module_name
,
'wb'
)
if
len
(
sys
.
argv
)
>
2
:
if
len
(
sys
.
argv
)
>
2
:
f
=
open
(
sys
.
argv
[
2
],
"r"
)
f
=
open
(
sys
.
argv
[
2
],
"r"
)
else
:
else
:
...
@@ -95,7 +96,7 @@ pprint(fns)
...
@@ -95,7 +96,7 @@ pprint(fns)
from
common
import
*
from
common
import
*
filterFileName
=
'./filter/opencl_core_functions.list'
filterFileName
=
'./filter/
%
s_functions.list'
%
module_name
numEnabled
=
readFunctionFilter
(
fns
,
filterFileName
)
numEnabled
=
readFunctionFilter
(
fns
,
filterFileName
)
functionsFilter
=
generateFilterNames
(
fns
)
functionsFilter
=
generateFilterNames
(
fns
)
...
@@ -108,18 +109,27 @@ ctx['CL_REMAP_DYNAMIC'] = generateRemapDynamic(fns)
...
@@ -108,18 +109,27 @@ ctx['CL_REMAP_DYNAMIC'] = generateRemapDynamic(fns)
ctx
[
'CL_FN_DECLARATIONS'
]
=
generateFnDeclaration
(
fns
)
ctx
[
'CL_FN_DECLARATIONS'
]
=
generateFnDeclaration
(
fns
)
sys
.
stdout
=
outfile
sys
.
stdout
=
outfile
ProcessTemplate
(
'template/
opencl_core.hpp.in'
,
ctx
)
ProcessTemplate
(
'template/
%
s.hpp.in'
%
module_name
,
ctx
)
ctx
[
'CL_FN_INLINE_WRAPPERS'
]
=
generateInlineWrappers
(
fns
)
ctx
[
'CL_FN_INLINE_WRAPPERS'
]
=
generateInlineWrappers
(
fns
)
sys
.
stdout
=
outfile_wrappers
sys
.
stdout
=
outfile_wrappers
ProcessTemplate
(
'template/opencl_core_wrappers.hpp.in'
,
ctx
)
ProcessTemplate
(
'template/
%
s_wrappers.hpp.in'
%
module_name
,
ctx
)
ctx
[
'CL_FN_ENTRY_DEFINITIONS'
]
=
generateStructDefinitions
(
fns
)
if
module_name
==
'opencl_core'
:
ctx
[
'CL_FN_ENTRY_LIST'
]
=
generateListOfDefinitions
(
fns
)
ctx
[
'CL_FN_ENTRY_DEFINITIONS'
]
=
generateStructDefinitions
(
fns
)
ctx
[
'CL_FN_ENUMS'
]
=
generateEnums
(
fns
)
ctx
[
'CL_FN_ENTRY_LIST'
]
=
generateListOfDefinitions
(
fns
)
ctx
[
'CL_FN_SWITCH'
]
=
generateTemplates
(
15
,
'opencl_fn'
,
'opencl_check_fn'
,
'CL_API_CALL'
)
ctx
[
'CL_FN_ENUMS'
]
=
generateEnums
(
fns
)
ctx
[
'CL_FN_SWITCH'
]
=
generateTemplates
(
15
,
'opencl_fn'
,
'opencl_check_fn'
,
'CL_API_CALL'
)
else
:
lprefix
=
module_name
+
'_fn'
enumprefix
=
module_name
.
upper
()
+
'_FN'
fn_list_name
=
module_name
+
'_fn_list'
ctx
[
'CL_FN_ENTRY_DEFINITIONS'
]
=
generateStructDefinitions
(
fns
,
lprefix
=
lprefix
,
enumprefix
=
enumprefix
)
ctx
[
'CL_FN_ENTRY_LIST'
]
=
generateListOfDefinitions
(
fns
,
fn_list_name
)
ctx
[
'CL_FN_ENUMS'
]
=
generateEnums
(
fns
,
prefix
=
enumprefix
)
ctx
[
'CL_FN_SWITCH'
]
=
generateTemplates
(
15
,
lprefix
,
'
%
s_check_fn'
%
module_name
,
'CL_API_CALL'
)
ctx
[
'CL_NUMBER_OF_ENABLED_FUNCTIONS'
]
=
'// number of enabled functions:
%
d'
%
(
numEnabled
)
ctx
[
'CL_NUMBER_OF_ENABLED_FUNCTIONS'
]
=
'// number of enabled functions:
%
d'
%
(
numEnabled
)
sys
.
stdout
=
outfile_impl
sys
.
stdout
=
outfile_impl
ProcessTemplate
(
'template/
opencl_core_impl.hpp.in'
,
ctx
)
ProcessTemplate
(
'template/
%
s_impl.hpp.in'
%
module_name
,
ctx
)
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/generator/template/opencl_gl.hpp.in
0 → 100644
View file @
ee68d26f
#ifndef __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP__
#error "Invalid usage"
#endif
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl.h>
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl.h>
#include <CL/cl_gl.h>
#endif
@CL_REMAP_DYNAMIC@
@CL_FN_DECLARATIONS@
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/generator/template/opencl_gl_impl.hpp.in
0 → 100644
View file @
ee68d26f
@CL_FN_ENUMS@
namespace {
@CL_FN_SWITCH@
} // anonymous namespace
@CL_FN_ENTRY_DEFINITIONS@
@CL_FN_ENTRY_LIST@
@CL_NUMBER_OF_ENABLED_FUNCTIONS@
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/generator/template/opencl_gl_wrappers.hpp.in
0 → 100644
View file @
ee68d26f
#ifndef __OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP__
#error "Invalid usage"
#endif
@CL_FN_INLINE_WRAPPERS@
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/opencl_core.cpp
View file @
ee68d26f
...
@@ -279,4 +279,30 @@ static void* opencl_check_fn(int ID)
...
@@ -279,4 +279,30 @@ static void* opencl_check_fn(int ID)
return
func
;
return
func
;
}
}
#ifdef HAVE_OPENGL
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
static
void
*
opencl_gl_check_fn
(
int
ID
);
#include "autogenerated/opencl_gl_impl.hpp"
static
void
*
opencl_gl_check_fn
(
int
ID
)
{
const
struct
DynamicFnEntry
*
e
=
NULL
;
assert
(
ID
>=
0
&&
ID
<
(
int
)(
sizeof
(
opencl_gl_fn_list
)
/
sizeof
(
opencl_gl_fn_list
[
0
])));
e
=
opencl_gl_fn_list
[
ID
];
void
*
func
=
CV_CL_GET_PROC_ADDRESS
(
e
->
fnName
);
if
(
!
func
)
{
throw
cv
::
Exception
(
cv
::
Error
::
OpenCLApiCallError
,
cv
::
format
(
"OpenCL function is not available: [%s]"
,
e
->
fnName
),
CV_Func
,
__FILE__
,
__LINE__
);
}
*
(
e
->
ppFn
)
=
func
;
return
func
;
}
#endif // HAVE_OPENGL
#endif
#endif
This diff is collapsed.
Click to expand it.
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