mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 11:54:44 +08:00
[primitives,opencl] Use CMake to include opencl code
* Use CMake to convert opencl source file to C constant * Mark opencl sources as headers and add to CMake to show in IDE
This commit is contained in:
parent
fe590801a1
commit
fffabcaab1
@ -64,9 +64,20 @@ set(PRIMITIVES_OPENCL_SRCS
|
||||
)
|
||||
|
||||
if (WITH_OPENCL)
|
||||
freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS})
|
||||
freerdp_library_add(OpenCL::OpenCL)
|
||||
set(FILENAME "opencl/primitives.cl")
|
||||
set_source_files_properties(${FILENAME} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
list(APPEND PRIMITIVES_OPENCL_SRCS ${FILENAME})
|
||||
|
||||
include(ConvertFileToHexArray)
|
||||
file_to_hex_array(${FILENAME} FILEDATA)
|
||||
|
||||
set(HDR_FILE "${CMAKE_CURRENT_BINARY_DIR}/opencl/primitives-opencl-program.h")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencl/primitives.h.in" ${HDR_FILE} @ONLY)
|
||||
list(APPEND PRIMITIVES_OPENCL_SRCS ${HDR_FILE})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/opencl)
|
||||
freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS})
|
||||
freerdp_library_add(OpenCL::OpenCL)
|
||||
endif()
|
||||
|
||||
set(PRIMITIVES_OPT_SRCS
|
||||
|
@ -30,6 +30,7 @@
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
#include "primitives-opencl-program.h"
|
||||
|
||||
#include <freerdp/log.h>
|
||||
#define TAG FREERDP_TAG("primitives")
|
||||
@ -260,10 +261,6 @@ static pstatus_t primitives_uninit_opencl(void)
|
||||
return PRIMITIVES_SUCCESS;
|
||||
}
|
||||
|
||||
static const char openclProgram[] =
|
||||
#include "primitives.cl"
|
||||
;
|
||||
|
||||
static BOOL primitives_init_opencl_context(primitives_opencl_context* WINPR_RESTRICT prims)
|
||||
{
|
||||
cl_uint ndevices = 0;
|
||||
|
@ -16,9 +16,6 @@
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
STRINGIFY(
|
||||
uchar clamp_uc(int v, short l, short h)
|
||||
{
|
||||
if (v > h)
|
||||
@ -460,4 +457,3 @@ __kernel void yuv444_to_xrgb_1b(
|
||||
destPtr[1] = clamp_uc((y256 + (403 * V)) >> 8, 0, 255); /* R */
|
||||
destPtr[0] = 0xff; /* A */
|
||||
}
|
||||
)
|
||||
|
11
libfreerdp/primitives/opencl/primitives.h.in
Normal file
11
libfreerdp/primitives/opencl/primitives.h.in
Normal file
@ -0,0 +1,11 @@
|
||||
/* AUTOGENERATED file, do not edit
|
||||
*
|
||||
* part of @PROJECT_NAME@
|
||||
* generated from libfreerdp/primitives/opencl/primitives.h.in
|
||||
*
|
||||
* with file contents of @FILENAME@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
static const char openclProgram[] = { @FILEDATA@ };
|
||||
|
Loading…
Reference in New Issue
Block a user