Merge 'opencl/amd-staging' into amd-staging
Change-Id: I11562fa9ec72cdf669c85f7e06e49ec93225fbad
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: false
|
||||
ColumnLimit: 100
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
DerivePointerAlignment: false
|
||||
IndentFunctionDeclarationAfterType: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
SortIncludes: false
|
||||
@@ -0,0 +1,20 @@
|
||||
# Set the default behavior, in case people don't have core.autolf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to have LF line endings on checkout.
|
||||
*.c text eol=lf
|
||||
*.cpp text eol=lf
|
||||
*.cc text eol=lf
|
||||
*.h text eol=lf
|
||||
*.hpp text eol=lf
|
||||
*.txt text eol=lf
|
||||
|
||||
# Define files to support auto-remove trailing white space
|
||||
# Need to run the command below, before add modified file(s) to the staging area
|
||||
# git config filter.trimspace.clean 'sed -e "s/[[:space:]]*$//g"'
|
||||
*.cpp filter=trimspace
|
||||
*.c filter=trimspace
|
||||
*.h filter=trimspacecpp
|
||||
*.hpp filter=trimspace
|
||||
*.md filter=trimspace
|
||||
@@ -0,0 +1,14 @@
|
||||
.*
|
||||
!.gitignore
|
||||
*.d
|
||||
*.o
|
||||
*.obj
|
||||
*.gch
|
||||
*.pch
|
||||
*.so
|
||||
*.dll
|
||||
*.a
|
||||
*.lib
|
||||
*.exe
|
||||
*.out
|
||||
build
|
||||
@@ -0,0 +1,115 @@
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
set(PROJ_VERSION VERSION 1.5.0)
|
||||
endif()
|
||||
|
||||
project(opencl)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Set default libdir to be "lib" for ROCm, distros will override this anyway:
|
||||
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install directory")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(BUILD_TESTS "Enable building OpenCL tests" OFF)
|
||||
option(BUILD_ICD "Enable building OpenCL ICD Loader" ON)
|
||||
option(EMU_ENV "Enable building for emulation environment" OFF)
|
||||
option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorganization backward compatibility" ON)
|
||||
|
||||
|
||||
set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/khronos/headers/opencl2.2" CACHE PATH "")
|
||||
if(BUILD_ICD)
|
||||
add_subdirectory(khronos/icd)
|
||||
else()
|
||||
find_package(OpenCL REQUIRED)
|
||||
endif()
|
||||
add_subdirectory(amdocl)
|
||||
add_subdirectory(tools/clinfo)
|
||||
add_subdirectory(tools/cltrace)
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(tests/ocltst)
|
||||
endif()
|
||||
|
||||
###--- Packaging ------------------------------------------------------------###
|
||||
|
||||
# DEV package
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
|
||||
DESTINATION include
|
||||
COMPONENT DEV
|
||||
USE_SOURCE_PERMISSIONS
|
||||
PATTERN cl_d3d10.h EXCLUDE
|
||||
PATTERN cl_d3d11.h EXCLUDE
|
||||
PATTERN cl_dx9_media_sharing.h EXCLUDE
|
||||
PATTERN cl_egl.h EXCLUDE)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
if(NOT WIN32)
|
||||
find_package(ROCM QUIET CONFIG PATHS /opt/rocm)
|
||||
if(ROCM_FOUND)
|
||||
include(ROCMSetupVersion)
|
||||
rocm_setup_version( VERSION "2.0.0" )
|
||||
else()
|
||||
set(PROJECT_VERSION "2.0.0")
|
||||
endif()
|
||||
|
||||
#set a name for icd file
|
||||
set(OPENCL_AMD_ICD_FILE "amdocl64.icd")
|
||||
if (DEFINED ROCM_PATCH_VERSION)
|
||||
# set unique name for ICD file for each jenkins build
|
||||
# Use ENV variable CPACK_RPM_PACKAGE_RELEASE, which is having build number
|
||||
set(PACKAGE_RELEASE_VERSION "")
|
||||
if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
set(PACKAGE_RELEASE_VERSION $ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
endif()
|
||||
if(PACKAGE_RELEASE_VERSION)
|
||||
# Replace "." to "_" in package version string. So file name will have .icd as extension
|
||||
string(REPLACE "." "_" PACKAGE_RELEASE_VERSION ${PACKAGE_RELEASE_VERSION})
|
||||
else()
|
||||
# set a default value
|
||||
set(PACKAGE_RELEASE_VERSION "9999")
|
||||
endif()
|
||||
set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}_${PACKAGE_RELEASE_VERSION}.icd")
|
||||
endif()
|
||||
|
||||
if(BUILD_ICD)
|
||||
get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
|
||||
get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
|
||||
endif()
|
||||
|
||||
#Set Package Version
|
||||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.$ENV{ROCM_LIBPATCH_VERSION}")
|
||||
message("Using CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Package Installation path for OpenCL")
|
||||
#ROCM_PATH is needed to create symlink of libraries
|
||||
if(NOT DEFINED ROCM_PATH)
|
||||
string(REPLACE "/opencl" "" ROCM_PATH ${CPACK_PACKAGING_INSTALL_PREFIX})
|
||||
endif()
|
||||
message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}")
|
||||
|
||||
#Package: rocm-opencl,rocm-opencl-dev/devel,rocm-ocl-icd
|
||||
|
||||
if(BUILD_ICD)
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-ocl-icd)
|
||||
configure_file(packaging/rocm-ocl-icd.postinst ${BUILD_DIR}/postinst @ONLY)
|
||||
configure_file(packaging/rocm-ocl-icd.prerm ${BUILD_DIR}/prerm @ONLY)
|
||||
configure_file(packaging/rocm-ocl-icd.rpm_post ${BUILD_DIR}/rpm_post @ONLY)
|
||||
configure_file(packaging/rocm-ocl-icd.rpm_postun ${BUILD_DIR}/rpm_postun @ONLY)
|
||||
endif()
|
||||
|
||||
add_subdirectory(packaging)
|
||||
|
||||
#File reorg Backward compatibility function
|
||||
if(FILE_REORG_BACKWARD_COMPATIBILITY)
|
||||
include(opencl-backward-compat.cmake)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# OpenCL™ Compatible Runtime
|
||||
|
||||
- OpenCL 2.0 compatible language runtime
|
||||
- Supports offline and in-process/in-memory compilation
|
||||
|
||||
## DISCLAIMER
|
||||
|
||||
The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions, and typographical errors. The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product and roadmap changes, component and motherboard versionchanges, new model and/or product releases, product differences between differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. Any computer system has risks of security vulnerabilities that cannot be completely prevented or mitigated.AMD assumes no obligation to update or otherwise correct or revise this information. However, AMD reserves the right to revise this information and to make changes from time to time to the content hereof without obligation of AMD to notify any person of such revisions or changes.THIS INFORMATION IS PROVIDED ‘AS IS.” AMD MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND ASSUMES NO RESPONSIBILITY FOR ANY INACCURACIES, ERRORS, OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION. AMD SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL AMD BE LIABLE TO ANY PERSON FOR ANY RELIANCE, DIRECT, INDIRECT, SPECIAL, OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
|
||||
|
||||
© 2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
|
||||
## Getting the source code
|
||||
Download the git projects using the following commands:
|
||||
|
||||
```bash
|
||||
git clone -b main https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git
|
||||
```
|
||||
|
||||
## Repository branches
|
||||
|
||||
The repository maintains several branches. The branches that are of importance are:
|
||||
|
||||
- Main branch: This is the stable branch. It is up to date with the latest release branch, for example, if the latest ROCM release is rocm-4.1, main branch will be the repository based on this release.
|
||||
- Develop branch: This is the default branch, on which the new features are still under development and visible. While this maybe of interest to many, it should be noted that this branch and the features under development might not be stable.
|
||||
- Release branches: These are branches corresponding to each ROCM release, listed with release tags, such as rocm-4.0, rocm-4.1, etc.
|
||||
|
||||
## Setup OpenCL
|
||||
Copy the amdocl64.icd file to /etc/OpenCL/vendors
|
||||
|
||||
```bash
|
||||
sudo cp api/opencl/config/amdocl64.icd /etc/OpenCL/vendors/
|
||||
```
|
||||
|
||||
## Building
|
||||
Follow these steps:
|
||||
|
||||
- Build ROCclr first. Follow the steps in the following link to build ROCclr
|
||||
[ROCclr Readme](https://github.com/ROCm-Developer-Tools/ROCclr)
|
||||
In this step, $OPENCL_DIR and $ROCclr_DIR are defined.
|
||||
|
||||
- Building OpenCL
|
||||
Run these commands:
|
||||
|
||||
```bash
|
||||
cd "$OPENCL_DIR"
|
||||
mkdir -p build; cd build
|
||||
cmake -DUSE_COMGR_LIBRARY=ON -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" ..
|
||||
make -j$(nproc)
|
||||
```
|
||||
|
||||
Note: For release build, add "-DCMAKE_BUILD_TYPE=Release" to the cmake command line.
|
||||
|
||||
---
|
||||
OpenCL™ is registered Trademark of Apple
|
||||
@@ -0,0 +1,123 @@
|
||||
# Copyright (c) 2020 - 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(amdocl)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build the shared library" ON)
|
||||
|
||||
if(ADDRESS_SANITIZER)
|
||||
set(ASAN_LINKER_FLAGS "-fsanitize=address")
|
||||
set(ASAN_COMPILER_FLAGS "-fno-omit-frame-pointer -fsanitize=address")
|
||||
|
||||
if(NOT CMAKE_COMPILER_IS_GNUCC)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(ASAN_COMPILER_FLAGS "${ASAN_COMPILER_FLAGS} -shared-libsan")
|
||||
set(ASAN_LINKER_FLAGS "${ASAN_LINKER_FLAGS} -shared-libsan")
|
||||
else()
|
||||
set(ASAN_LINKER_FLAGS "${ASAN_LINKER_FLAGS} -static-libsan")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ASAN_COMPILER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ASAN_COMPILER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ASAN_LINKER_FLAGS} -s -Wl,--build-id=sha1")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ASAN_LINKER_FLAGS} -Wl,--build-id=sha1")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
find_package(ROCclr)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(amdocl SHARED)
|
||||
# Windows doesn't have a strip utility, so CMAKE_STRIP won't be set.
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND NOT ("${CMAKE_STRIP}" STREQUAL ""))
|
||||
add_custom_command(TARGET amdocl POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:amdocl>)
|
||||
endif()
|
||||
else()
|
||||
add_library(amdocl STATIC)
|
||||
endif()
|
||||
|
||||
set_target_properties(amdocl PROPERTIES
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set_target_properties(amdocl PROPERTIES OUTPUT_NAME "amdocl64")
|
||||
else()
|
||||
set_target_properties(amdocl PROPERTIES OUTPUT_NAME "amdocl32")
|
||||
endif()
|
||||
|
||||
target_sources(amdocl PRIVATE
|
||||
cl_command.cpp
|
||||
cl_context.cpp
|
||||
cl_counter.cpp
|
||||
cl_d3d9.cpp
|
||||
cl_d3d10.cpp
|
||||
cl_d3d11.cpp
|
||||
cl_device.cpp
|
||||
cl_event.cpp
|
||||
cl_execute.cpp
|
||||
cl_gl.cpp
|
||||
cl_icd.cpp
|
||||
cl_kernel_info_amd.cpp
|
||||
cl_memobj.cpp
|
||||
cl_p2p_amd.cpp
|
||||
cl_pipe.cpp
|
||||
cl_platform_amd.cpp
|
||||
cl_profile_amd.cpp
|
||||
cl_program.cpp
|
||||
cl_sampler.cpp
|
||||
cl_sdi_amd.cpp
|
||||
cl_svm.cpp
|
||||
cl_thread_trace_amd.cpp)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(amdocl PRIVATE
|
||||
cl_runtime.cpp)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
target_sources(amdocl PRIVATE amdocl.def)
|
||||
else()
|
||||
# -Bsymbolic is required to make sure all AMD OpenCL runtime symbols are resolved internally
|
||||
# Otherwise ld might resolve them using symbols from the OpenCL ICD
|
||||
target_link_libraries(amdocl PRIVATE "-Wl,-Bsymbolic")
|
||||
target_link_libraries(amdocl PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/amdocl.map")
|
||||
set_target_properties(amdocl PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/amdocl.map")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
configure_file(amdocl.rc.in amdocl_info.rc @ONLY)
|
||||
target_sources(amdocl PRIVATE amdocl_info.rc)
|
||||
endif()
|
||||
|
||||
target_link_libraries(amdocl PUBLIC rocclr)
|
||||
|
||||
INSTALL(TARGETS amdocl
|
||||
COMPONENT MAIN
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
@@ -0,0 +1,125 @@
|
||||
EXPORTS
|
||||
clBuildProgram
|
||||
clCreateBuffer
|
||||
clCreateCommandQueue
|
||||
clCreateContext
|
||||
clCreateContextFromType
|
||||
clCreateFromGLBuffer
|
||||
clCreateFromGLRenderbuffer
|
||||
clCreateFromGLTexture2D
|
||||
clCreateFromGLTexture3D
|
||||
clCreateImage2D
|
||||
clCreateImage3D
|
||||
clCreateKernel
|
||||
clCreateKernelsInProgram
|
||||
clCreateProgramWithBinary
|
||||
clCreateProgramWithSource
|
||||
clCreateSampler
|
||||
clEnqueueAcquireGLObjects
|
||||
clEnqueueBarrier
|
||||
clEnqueueCopyBuffer
|
||||
clEnqueueCopyBufferToImage
|
||||
clEnqueueCopyImage
|
||||
clEnqueueCopyImageToBuffer
|
||||
clEnqueueMapBuffer
|
||||
clEnqueueMapImage
|
||||
clEnqueueMarker
|
||||
clEnqueueNDRangeKernel
|
||||
clEnqueueNativeKernel
|
||||
clEnqueueReadBuffer
|
||||
clEnqueueReadImage
|
||||
clEnqueueReleaseGLObjects
|
||||
clEnqueueTask
|
||||
clEnqueueUnmapMemObject
|
||||
clEnqueueWaitForEvents
|
||||
clEnqueueWriteBuffer
|
||||
clEnqueueWriteImage
|
||||
clFinish
|
||||
clFlush
|
||||
clGetCommandQueueInfo
|
||||
clGetContextInfo
|
||||
clGetDeviceIDs
|
||||
clGetDeviceInfo
|
||||
clGetEventInfo
|
||||
clGetEventProfilingInfo
|
||||
clGetExtensionFunctionAddress
|
||||
clGetGLObjectInfo
|
||||
clGetGLTextureInfo
|
||||
clGetImageInfo
|
||||
clGetKernelInfo
|
||||
clGetKernelWorkGroupInfo
|
||||
clGetMemObjectInfo
|
||||
clGetPlatformIDs
|
||||
clGetPlatformInfo
|
||||
clGetProgramBuildInfo
|
||||
clGetProgramInfo
|
||||
clGetSamplerInfo
|
||||
clGetSupportedImageFormats
|
||||
clReleaseCommandQueue
|
||||
clReleaseContext
|
||||
clReleaseEvent
|
||||
clReleaseKernel
|
||||
clReleaseMemObject
|
||||
clReleaseProgram
|
||||
clReleaseSampler
|
||||
clRetainCommandQueue
|
||||
clRetainContext
|
||||
clRetainEvent
|
||||
clRetainKernel
|
||||
clRetainMemObject
|
||||
clRetainProgram
|
||||
clRetainSampler
|
||||
clSetCommandQueueProperty
|
||||
clSetKernelArg
|
||||
clUnloadCompiler
|
||||
clWaitForEvents
|
||||
clIcdGetPlatformIDsKHR
|
||||
clCreateUserEvent
|
||||
clSetUserEventStatus
|
||||
clSetEventCallback
|
||||
clSetMemObjectDestructorCallback
|
||||
clCreateSubBuffer
|
||||
clEnqueueReadBufferRect
|
||||
clEnqueueWriteBufferRect
|
||||
clEnqueueCopyBufferRect
|
||||
|
||||
clCompileProgram
|
||||
clCreateFromGLTexture
|
||||
clCreateImage
|
||||
clCreateProgramWithBuiltInKernels
|
||||
clCreateSubDevices
|
||||
clEnqueueBarrierWithWaitList
|
||||
clEnqueueFillBuffer
|
||||
clEnqueueFillImage
|
||||
clEnqueueMarkerWithWaitList
|
||||
clEnqueueMigrateMemObjects
|
||||
clGetExtensionFunctionAddressForPlatform
|
||||
clGetKernelArgInfo
|
||||
clLinkProgram
|
||||
clReleaseDevice
|
||||
clRetainDevice
|
||||
clUnloadPlatformCompiler
|
||||
|
||||
clCreateCommandQueueWithProperties
|
||||
clCreateSamplerWithProperties
|
||||
clCreatePipe
|
||||
clGetPipeInfo
|
||||
clSVMAlloc
|
||||
clSVMFree
|
||||
clSetKernelArgSVMPointer
|
||||
clSetKernelExecInfo
|
||||
clEnqueueSVMFree
|
||||
clEnqueueSVMMemcpy
|
||||
clEnqueueSVMMemFill
|
||||
clEnqueueSVMMap
|
||||
clEnqueueSVMUnmap
|
||||
|
||||
clCloneKernel
|
||||
clCreateProgramWithIL
|
||||
clEnqueueSVMMigrateMem
|
||||
clGetDeviceAndHostTimer
|
||||
clGetHostTimer
|
||||
clGetKernelSubGroupInfo
|
||||
clSetDefaultDeviceCommandQueue
|
||||
|
||||
clCreateProgramWithIL
|
||||
@@ -0,0 +1,174 @@
|
||||
EXPORTS
|
||||
clBuildProgram
|
||||
clCreateBuffer
|
||||
clCreateCommandQueue
|
||||
clCreateContext
|
||||
clCreateContextFromType
|
||||
clCreateFromGLBuffer
|
||||
clCreateFromGLRenderbuffer
|
||||
clCreateFromGLTexture2D
|
||||
clCreateFromGLTexture3D
|
||||
clCreateImage2D
|
||||
clCreateImage3D
|
||||
clCreateKernel
|
||||
clCreateKernelsInProgram
|
||||
clCreateProgramWithBinary
|
||||
clCreateProgramWithSource
|
||||
clCreateSampler
|
||||
clEnqueueAcquireGLObjects
|
||||
clEnqueueBarrier
|
||||
clEnqueueCopyBuffer
|
||||
clEnqueueCopyBufferToImage
|
||||
clEnqueueCopyImage
|
||||
clEnqueueCopyImageToBuffer
|
||||
clEnqueueMapBuffer
|
||||
clEnqueueMapImage
|
||||
clEnqueueMarker
|
||||
clEnqueueNDRangeKernel
|
||||
clEnqueueNativeKernel
|
||||
clEnqueueReadBuffer
|
||||
clEnqueueReadImage
|
||||
clEnqueueReleaseGLObjects
|
||||
clEnqueueTask
|
||||
clEnqueueUnmapMemObject
|
||||
clEnqueueWaitForEvents
|
||||
clEnqueueWriteBuffer
|
||||
clEnqueueWriteImage
|
||||
clFinish
|
||||
clFlush
|
||||
clGetCommandQueueInfo
|
||||
clGetContextInfo
|
||||
clGetDeviceIDs
|
||||
clGetDeviceInfo
|
||||
clGetEventInfo
|
||||
clGetEventProfilingInfo
|
||||
clGetExtensionFunctionAddress
|
||||
clGetGLObjectInfo
|
||||
clGetGLTextureInfo
|
||||
clGetImageInfo
|
||||
clGetKernelInfo
|
||||
clGetKernelWorkGroupInfo
|
||||
clGetMemObjectInfo
|
||||
clGetPlatformIDs
|
||||
clGetPlatformInfo
|
||||
clGetProgramBuildInfo
|
||||
clGetProgramInfo
|
||||
clGetSamplerInfo
|
||||
clGetSupportedImageFormats
|
||||
clReleaseCommandQueue
|
||||
clReleaseContext
|
||||
clReleaseEvent
|
||||
clReleaseKernel
|
||||
clReleaseMemObject
|
||||
clReleaseProgram
|
||||
clReleaseSampler
|
||||
clRetainCommandQueue
|
||||
clRetainContext
|
||||
clRetainEvent
|
||||
clRetainKernel
|
||||
clRetainMemObject
|
||||
clRetainProgram
|
||||
clRetainSampler
|
||||
clSetCommandQueueProperty
|
||||
clSetKernelArg
|
||||
clUnloadCompiler
|
||||
clWaitForEvents
|
||||
clIcdGetPlatformIDsKHR
|
||||
clCreateUserEvent
|
||||
clSetUserEventStatus
|
||||
clSetEventCallback
|
||||
clSetMemObjectDestructorCallback
|
||||
clCreateSubBuffer
|
||||
clEnqueueReadBufferRect
|
||||
clEnqueueWriteBufferRect
|
||||
clEnqueueCopyBufferRect
|
||||
|
||||
#if (OPENCL_MAJOR > 1) || (OPENCL_MAJOR == 1 && OPENCL_MINOR >= 2)
|
||||
clCompileProgram
|
||||
clCreateFromGLTexture
|
||||
clCreateImage
|
||||
clCreateProgramWithBuiltInKernels
|
||||
clCreateSubDevices
|
||||
clEnqueueBarrierWithWaitList
|
||||
clEnqueueFillBuffer
|
||||
clEnqueueFillImage
|
||||
clEnqueueMarkerWithWaitList
|
||||
clEnqueueMigrateMemObjects
|
||||
clGetExtensionFunctionAddressForPlatform
|
||||
clGetKernelArgInfo
|
||||
clLinkProgram
|
||||
clReleaseDevice
|
||||
clRetainDevice
|
||||
clUnloadPlatformCompiler
|
||||
#endif
|
||||
|
||||
#if (OPENCL_MAJOR >= 2)
|
||||
clCreateCommandQueueWithProperties
|
||||
clCreateSamplerWithProperties
|
||||
clCreatePipe
|
||||
clGetPipeInfo
|
||||
clSVMAlloc
|
||||
clSVMFree
|
||||
clSetKernelArgSVMPointer
|
||||
clSetKernelExecInfo
|
||||
clEnqueueSVMFree
|
||||
clEnqueueSVMMemcpy
|
||||
clEnqueueSVMMemFill
|
||||
clEnqueueSVMMap
|
||||
clEnqueueSVMUnmap
|
||||
#endif
|
||||
|
||||
#if (OPENCL_MAJOR > 2) || (OPENCL_MAJOR == 2 && OPENCL_MINOR >= 1)
|
||||
clCloneKernel
|
||||
clCreateProgramWithIL
|
||||
clEnqueueSVMMigrateMem
|
||||
clGetDeviceAndHostTimer
|
||||
clGetHostTimer
|
||||
clGetKernelSubGroupInfo
|
||||
clSetDefaultDeviceCommandQueue
|
||||
#endif
|
||||
|
||||
#if !defined(WITH_LIGHTNING_COMPILER)
|
||||
aclCompilerInit
|
||||
aclCompilerFini
|
||||
aclCompilerVersion
|
||||
aclVersionSize
|
||||
aclGetErrorString
|
||||
aclGetArchInfo
|
||||
aclGetDeviceInfo
|
||||
aclGetTargetInfo
|
||||
aclGetArchitecture
|
||||
aclGetFamily
|
||||
aclGetChip
|
||||
aclBinaryInit
|
||||
aclBinaryFini
|
||||
aclReadFromFile
|
||||
aclReadFromMem
|
||||
aclWriteToFile
|
||||
aclWriteToMem
|
||||
aclCreateFromBinary
|
||||
aclBinaryVersion
|
||||
aclInsertSection
|
||||
aclRemoveSection
|
||||
aclExtractSection
|
||||
aclInsertSymbol
|
||||
aclRemoveSymbol
|
||||
aclExtractSymbol
|
||||
aclDbgAddArgument
|
||||
aclDbgRemoveArgument
|
||||
aclQueryInfo
|
||||
aclCompile
|
||||
aclLink
|
||||
aclGetCompilerLog
|
||||
aclRetrieveType
|
||||
aclSetType
|
||||
aclConvertType
|
||||
aclDisassemble
|
||||
aclInsertKernelStatistics
|
||||
aclGetDeviceBinary
|
||||
aclDumpBinary
|
||||
#endif // !defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
#if (OPENCL_MAJOR > 2) || (OPENCL_MAJOR == 2 && OPENCL_MINOR >= 1)
|
||||
clCreateProgramWithIL
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
OPENCL_1.0 {
|
||||
global:
|
||||
clBuildProgram;
|
||||
clCreateBuffer;
|
||||
clCreateCommandQueue;
|
||||
clCreateContext;
|
||||
clCreateContextFromType;
|
||||
clCreateFromD3D10Buffer;
|
||||
clCreateFromGLBuffer;
|
||||
clCreateFromGLRenderbuffer;
|
||||
clCreateFromGLTexture2D;
|
||||
clCreateFromGLTexture3D;
|
||||
clCreateImage2D;
|
||||
clCreateImage3D;
|
||||
clCreateImageFromD3D10Resource;
|
||||
clCreateKernel;
|
||||
clCreateKernelsInProgram;
|
||||
clCreateProgramWithBinary;
|
||||
clCreateProgramWithSource;
|
||||
clCreateSampler;
|
||||
clEnqueueAcquireExternalObjects;
|
||||
clEnqueueAcquireGLObjects;
|
||||
clEnqueueBarrier;
|
||||
clEnqueueCopyBuffer;
|
||||
clEnqueueCopyBufferToImage;
|
||||
clEnqueueCopyImage;
|
||||
clEnqueueCopyImageToBuffer;
|
||||
clEnqueueMapBuffer;
|
||||
clEnqueueMapImage;
|
||||
clEnqueueMarker;
|
||||
clEnqueueNDRangeKernel;
|
||||
clEnqueueNativeKernel;
|
||||
clEnqueueReadBuffer;
|
||||
clEnqueueReadImage;
|
||||
clEnqueueReleaseExternalObjects;
|
||||
clEnqueueReleaseGLObjects;
|
||||
clEnqueueTask;
|
||||
clEnqueueUnmapMemObject;
|
||||
clEnqueueWaitForEvents;
|
||||
clEnqueueWriteBuffer;
|
||||
clEnqueueWriteImage;
|
||||
clFinish;
|
||||
clFlush;
|
||||
clGetCommandQueueInfo;
|
||||
clGetContextInfo;
|
||||
clGetDeviceIDs;
|
||||
clGetDeviceInfo;
|
||||
clGetEventInfo;
|
||||
clGetEventProfilingInfo;
|
||||
clGetExtensionFunctionAddress;
|
||||
clGetGLObjectInfo;
|
||||
clGetGLTextureInfo;
|
||||
clGetImageInfo;
|
||||
clGetKernelInfo;
|
||||
clGetKernelWorkGroupInfo;
|
||||
clGetMemObjectInfo;
|
||||
clGetPlatformIDs;
|
||||
clGetPlatformInfo;
|
||||
clGetProgramBuildInfo;
|
||||
clGetProgramInfo;
|
||||
clGetSamplerInfo;
|
||||
clGetSupportedImageFormats;
|
||||
clReleaseCommandQueue;
|
||||
clReleaseContext;
|
||||
clReleaseEvent;
|
||||
clReleaseKernel;
|
||||
clReleaseMemObject;
|
||||
clReleaseProgram;
|
||||
clReleaseSampler;
|
||||
clRetainCommandQueue;
|
||||
clRetainContext;
|
||||
clRetainEvent;
|
||||
clRetainKernel;
|
||||
clRetainMemObject;
|
||||
clRetainProgram;
|
||||
clRetainSampler;
|
||||
clSetCommandQueueProperty;
|
||||
clSetKernelArg;
|
||||
clUnloadCompiler;
|
||||
clWaitForEvents;
|
||||
clIcdGetPlatformIDsKHR;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
||||
|
||||
OPENCL_1.1 {
|
||||
global:
|
||||
clCreateUserEvent;
|
||||
clSetUserEventStatus;
|
||||
clSetEventCallback;
|
||||
clSetMemObjectDestructorCallback;
|
||||
clCreateSubBuffer;
|
||||
clEnqueueReadBufferRect;
|
||||
clEnqueueWriteBufferRect;
|
||||
clEnqueueCopyBufferRect;
|
||||
|
||||
aclGetTargetInfo;
|
||||
aclCompilerInit;
|
||||
aclCompilerFini;
|
||||
aclReadFromMem;
|
||||
aclReadFromFile;
|
||||
aclBinaryInit;
|
||||
aclBinaryFini;
|
||||
aclWriteToMem;
|
||||
aclInsertSection;
|
||||
aclExtractSection;
|
||||
aclRemoveSection;
|
||||
aclQueryInfo;
|
||||
aclDbgAddArgument;
|
||||
aclExtractSymbol;
|
||||
aclInsertSymbol;
|
||||
aclRemoveSymbol;
|
||||
aclCompile;
|
||||
aclInsertKernelStatistics;
|
||||
aclDisassemble;
|
||||
} OPENCL_1.0;
|
||||
|
||||
OPENCL_1.2 {
|
||||
global:
|
||||
clCompileProgram;
|
||||
clCreateFromGLTexture;
|
||||
clCreateImage;
|
||||
clCreateProgramWithBuiltInKernels;
|
||||
clCreateSubDevices;
|
||||
clEnqueueBarrierWithWaitList;
|
||||
clEnqueueFillBuffer;
|
||||
clEnqueueFillImage;
|
||||
clEnqueueMarkerWithWaitList;
|
||||
clEnqueueMigrateMemObjects;
|
||||
clGetExtensionFunctionAddressForPlatform;
|
||||
clGetKernelArgInfo;
|
||||
clLinkProgram;
|
||||
clReleaseDevice;
|
||||
clRetainDevice;
|
||||
clUnloadPlatformCompiler;
|
||||
} OPENCL_1.1;
|
||||
|
||||
OPENCL_2.0 {
|
||||
global:
|
||||
clCreateCommandQueueWithProperties;
|
||||
clCreateSamplerWithProperties;
|
||||
clCreatePipe;
|
||||
clGetPipeInfo;
|
||||
clSVMAlloc;
|
||||
clSVMFree;
|
||||
clSetKernelArgSVMPointer;
|
||||
clSetKernelExecInfo;
|
||||
clEnqueueSVMFree;
|
||||
clEnqueueSVMMemcpy;
|
||||
clEnqueueSVMMemFill;
|
||||
clEnqueueSVMMap;
|
||||
clEnqueueSVMUnmap;
|
||||
} OPENCL_1.2;
|
||||
|
||||
OPENCL_2.1 {
|
||||
global:
|
||||
clCloneKernel;
|
||||
clCreateProgramWithIL;
|
||||
clEnqueueSVMMigrateMem;
|
||||
clGetDeviceAndHostTimer;
|
||||
clGetHostTimer;
|
||||
clGetKernelSubGroupInfo;
|
||||
clSetDefaultDeviceCommandQueue;
|
||||
} OPENCL_2.0;
|
||||
@@ -0,0 +1,214 @@
|
||||
OPENCL_1.0 {
|
||||
global:
|
||||
clBuildProgram;
|
||||
clCreateBuffer;
|
||||
clCreateCommandQueue;
|
||||
clCreateContext;
|
||||
clCreateContextFromType;
|
||||
clCreateFromD3D10Buffer;
|
||||
clCreateFromGLBuffer;
|
||||
clCreateFromGLRenderbuffer;
|
||||
clCreateFromGLTexture2D;
|
||||
clCreateFromGLTexture3D;
|
||||
clCreateImage2D;
|
||||
clCreateImage3D;
|
||||
clCreateImageFromD3D10Resource;
|
||||
clCreateKernel;
|
||||
clCreateKernelsInProgram;
|
||||
clCreateProgramWithBinary;
|
||||
clCreateProgramWithSource;
|
||||
clCreateSampler;
|
||||
clEnqueueAcquireExternalObjects;
|
||||
clEnqueueAcquireGLObjects;
|
||||
clEnqueueBarrier;
|
||||
clEnqueueCopyBuffer;
|
||||
clEnqueueCopyBufferToImage;
|
||||
clEnqueueCopyImage;
|
||||
clEnqueueCopyImageToBuffer;
|
||||
clEnqueueMapBuffer;
|
||||
clEnqueueMapImage;
|
||||
clEnqueueMarker;
|
||||
clEnqueueNDRangeKernel;
|
||||
clEnqueueNativeKernel;
|
||||
clEnqueueReadBuffer;
|
||||
clEnqueueReadImage;
|
||||
clEnqueueReleaseExternalObjects;
|
||||
clEnqueueReleaseGLObjects;
|
||||
clEnqueueTask;
|
||||
clEnqueueUnmapMemObject;
|
||||
clEnqueueWaitForEvents;
|
||||
clEnqueueWriteBuffer;
|
||||
clEnqueueWriteImage;
|
||||
clFinish;
|
||||
clFlush;
|
||||
clGetCommandQueueInfo;
|
||||
clGetContextInfo;
|
||||
clGetDeviceIDs;
|
||||
clGetDeviceInfo;
|
||||
clGetEventInfo;
|
||||
clGetEventProfilingInfo;
|
||||
clGetExtensionFunctionAddress;
|
||||
clGetGLObjectInfo;
|
||||
clGetGLTextureInfo;
|
||||
clGetImageInfo;
|
||||
clGetKernelInfo;
|
||||
clGetKernelWorkGroupInfo;
|
||||
clGetMemObjectInfo;
|
||||
clGetPlatformIDs;
|
||||
clGetPlatformInfo;
|
||||
clGetProgramBuildInfo;
|
||||
clGetProgramInfo;
|
||||
clGetSamplerInfo;
|
||||
clGetSupportedImageFormats;
|
||||
clReleaseCommandQueue;
|
||||
clReleaseContext;
|
||||
clReleaseEvent;
|
||||
clReleaseKernel;
|
||||
clReleaseMemObject;
|
||||
clReleaseProgram;
|
||||
clReleaseSampler;
|
||||
clRetainCommandQueue;
|
||||
clRetainContext;
|
||||
clRetainEvent;
|
||||
clRetainKernel;
|
||||
clRetainMemObject;
|
||||
clRetainProgram;
|
||||
clRetainSampler;
|
||||
clSetCommandQueueProperty;
|
||||
clSetKernelArg;
|
||||
clUnloadCompiler;
|
||||
clWaitForEvents;
|
||||
clIcdGetPlatformIDsKHR;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
||||
#if (OPENCL_MAJOR > 1) || (OPENCL_MAJOR == 1 && OPENCL_MINOR >= 1)
|
||||
OPENCL_1.1 {
|
||||
global:
|
||||
clCreateUserEvent;
|
||||
clSetUserEventStatus;
|
||||
clSetEventCallback;
|
||||
clSetMemObjectDestructorCallback;
|
||||
clCreateSubBuffer;
|
||||
clEnqueueReadBufferRect;
|
||||
clEnqueueWriteBufferRect;
|
||||
clEnqueueCopyBufferRect;
|
||||
|
||||
aclGetTargetInfo;
|
||||
aclCompilerInit;
|
||||
aclCompilerFini;
|
||||
aclReadFromMem;
|
||||
aclReadFromFile;
|
||||
aclBinaryInit;
|
||||
aclBinaryFini;
|
||||
aclWriteToMem;
|
||||
aclInsertSection;
|
||||
aclExtractSection;
|
||||
aclRemoveSection;
|
||||
aclQueryInfo;
|
||||
aclDbgAddArgument;
|
||||
aclExtractSymbol;
|
||||
aclInsertSymbol;
|
||||
aclRemoveSymbol;
|
||||
aclCompile;
|
||||
aclInsertKernelStatistics;
|
||||
aclDisassemble;
|
||||
} OPENCL_1.0;
|
||||
#endif
|
||||
|
||||
#if (OPENCL_MAJOR > 1) || (OPENCL_MAJOR == 1 && OPENCL_MINOR >= 2)
|
||||
OPENCL_1.2 {
|
||||
global:
|
||||
clCompileProgram;
|
||||
clCreateFromGLTexture;
|
||||
clCreateImage;
|
||||
clCreateProgramWithBuiltInKernels;
|
||||
clCreateSubDevices;
|
||||
clEnqueueBarrierWithWaitList;
|
||||
clEnqueueFillBuffer;
|
||||
clEnqueueFillImage;
|
||||
clEnqueueMarkerWithWaitList;
|
||||
clEnqueueMigrateMemObjects;
|
||||
clGetExtensionFunctionAddressForPlatform;
|
||||
clGetKernelArgInfo;
|
||||
clLinkProgram;
|
||||
clReleaseDevice;
|
||||
clRetainDevice;
|
||||
clUnloadPlatformCompiler;
|
||||
} OPENCL_1.1;
|
||||
#endif
|
||||
|
||||
#if (OPENCL_MAJOR >= 2)
|
||||
OPENCL_2.0 {
|
||||
global:
|
||||
clCreateCommandQueueWithProperties;
|
||||
clCreateSamplerWithProperties;
|
||||
clCreatePipe;
|
||||
clGetPipeInfo;
|
||||
clSVMAlloc;
|
||||
clSVMFree;
|
||||
clSetKernelArgSVMPointer;
|
||||
clSetKernelExecInfo;
|
||||
clEnqueueSVMFree;
|
||||
clEnqueueSVMMemcpy;
|
||||
clEnqueueSVMMemFill;
|
||||
clEnqueueSVMMap;
|
||||
clEnqueueSVMUnmap;
|
||||
} OPENCL_1.2;
|
||||
#endif
|
||||
|
||||
#if (OPENCL_MAJOR > 2) || (OPENCL_MAJOR == 2 && OPENCL_MINOR >= 1)
|
||||
OPENCL_2.1 {
|
||||
global:
|
||||
clCloneKernel;
|
||||
clCreateProgramWithIL;
|
||||
clEnqueueSVMMigrateMem;
|
||||
clGetDeviceAndHostTimer;
|
||||
clGetHostTimer;
|
||||
clGetKernelSubGroupInfo;
|
||||
clSetDefaultDeviceCommandQueue;
|
||||
} OPENCL_2.0;
|
||||
#endif
|
||||
|
||||
ACL_0.8 {
|
||||
global:
|
||||
aclCompilerInit;
|
||||
aclCompilerFini;
|
||||
aclCompilerVersion;
|
||||
aclVersionSize;
|
||||
aclGetErrorString;
|
||||
aclGetArchInfo;
|
||||
aclGetDeviceInfo;
|
||||
aclGetTargetInfo;
|
||||
aclGetArchitecture;
|
||||
aclGetFamily;
|
||||
aclGetChip;
|
||||
aclBinaryInit;
|
||||
aclBinaryFini;
|
||||
aclReadFromFile;
|
||||
aclReadFromMem;
|
||||
aclWriteToFile;
|
||||
aclWriteToMem;
|
||||
aclCreateFromBinary;
|
||||
aclBinaryVersion;
|
||||
aclInsertSection;
|
||||
aclRemoveSection;
|
||||
aclExtractSection;
|
||||
aclInsertSymbol;
|
||||
aclRemoveSymbol;
|
||||
aclExtractSymbol;
|
||||
aclDbgAddArgument;
|
||||
aclDbgRemoveArgument;
|
||||
aclQueryInfo;
|
||||
aclCompile;
|
||||
aclLink;
|
||||
aclGetCompilerLog;
|
||||
aclRetrieveType;
|
||||
aclSetType;
|
||||
aclConvertType;
|
||||
aclDisassemble;
|
||||
aclInsertKernelStatistics;
|
||||
aclGetDeviceBinary;
|
||||
aclDumpBinary;
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
#define STR(__macro__) #__macro__
|
||||
#define XSTR(__macro__) STR(__macro__)
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#define DEBUG_ONLY(x) x
|
||||
#else
|
||||
#define DEBUG_ONLY(x)
|
||||
#endif
|
||||
|
||||
#define VERSION_PREFIX_MAJOR 2
|
||||
#define VERSION_PREFIX_MINOR 0
|
||||
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winresrc.h"
|
||||
#include "utils/versions.hpp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 10,0,AMD_PLATFORM_BUILD_NUMBER,AMD_PLATFORM_REVISION_NUMBER
|
||||
PRODUCTVERSION 10,0,AMD_PLATFORM_BUILD_NUMBER,AMD_PLATFORM_REVISION_NUMBER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", " \0"
|
||||
VALUE "CompanyName", "Advanced Micro Devices Inc.\0"
|
||||
VALUE "FileDescription", AMD_PLATFORM_NAME " OpenCL " XSTR(VERSION_PREFIX_MAJOR) "." XSTR(VERSION_PREFIX_MINOR) " Runtime\0"
|
||||
VALUE "FileVersion", "10.0." XSTR(AMD_PLATFORM_BUILD_NUMBER) "." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
VALUE "InternalName", "OpenCL"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2011 - 2021 Advanced Micro Devices Inc.\0"
|
||||
VALUE "OriginalFilename", "OpenCL.dll"
|
||||
VALUE "ProductName", "OpenCL " XSTR(VERSION_PREFIX_MAJOR) "." XSTR(VERSION_PREFIX_MINOR) " " AMD_PLATFORM_INFO "\0"
|
||||
VALUE "ProductVersion", "10.0." XSTR(AMD_PLATFORM_BUILD_NUMBER) "." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,75 @@
|
||||
#define STR(__macro__) #__macro__
|
||||
#define XSTR(__macro__) STR(__macro__)
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#define DEBUG_ONLY(x) x
|
||||
#else
|
||||
#define DEBUG_ONLY(x)
|
||||
#endif
|
||||
|
||||
#define VERSION_PREFIX_MAJOR 2
|
||||
#define VERSION_PREFIX_MINOR 0
|
||||
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winresrc.h"
|
||||
#include "utils/versions.hpp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 10,0,AMD_PLATFORM_BUILD_NUMBER,AMD_PLATFORM_REVISION_NUMBER
|
||||
PRODUCTVERSION 10,0,AMD_PLATFORM_BUILD_NUMBER,AMD_PLATFORM_REVISION_NUMBER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", " \0"
|
||||
VALUE "CompanyName", "Advanced Micro Devices Inc.\0"
|
||||
VALUE "FileDescription", AMD_PLATFORM_NAME " OpenCL " XSTR(VERSION_PREFIX_MAJOR) "." XSTR(VERSION_PREFIX_MINOR) " Runtime\0"
|
||||
VALUE "FileVersion", "10.0." XSTR(AMD_PLATFORM_BUILD_NUMBER) "." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
VALUE "InternalName", "OpenCL"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2011 - 2022 Advanced Micro Devices Inc.\0"
|
||||
VALUE "OriginalFilename", "OpenCL.dll"
|
||||
VALUE "ProductName", "OpenCL " XSTR(VERSION_PREFIX_MAJOR) "." XSTR(VERSION_PREFIX_MINOR) " " AMD_PLATFORM_INFO "\0"
|
||||
VALUE "ProductVersion", "10.0." XSTR(AMD_PLATFORM_BUILD_NUMBER) "." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,187 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __OPENCL_CL_AGENT_AMD_H
|
||||
#define __OPENCL_CL_AGENT_AMD_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include "cl_icd_amd.h"
|
||||
|
||||
#define cl_amd_agent 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef const struct _cl_agent cl_agent;
|
||||
|
||||
#define CL_AGENT_VERSION_1_0 100
|
||||
|
||||
/* Context Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acContextCreate_fn)(cl_agent* /* agent */, cl_context /* context */);
|
||||
|
||||
typedef void(CL_CALLBACK* acContextFree_fn)(cl_agent* /* agent */, cl_context /* context */);
|
||||
|
||||
/* Command Queue Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acCommandQueueCreate_fn)(cl_agent* /* agent */,
|
||||
cl_command_queue /* queue */);
|
||||
|
||||
typedef void(CL_CALLBACK* acCommandQueueFree_fn)(cl_agent* /* agent */,
|
||||
cl_command_queue /* queue */);
|
||||
|
||||
/* Event Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acEventCreate_fn)(cl_agent* /* agent */, cl_event /* event */,
|
||||
cl_command_type /* type */);
|
||||
|
||||
typedef void(CL_CALLBACK* acEventFree_fn)(cl_agent* /* agent */, cl_event /* event */);
|
||||
|
||||
typedef void(CL_CALLBACK* acEventStatusChanged_fn)(cl_agent* /* agent */, cl_event /* event */,
|
||||
cl_int /* execution_status */,
|
||||
cl_long /* epoch_time_stamp */);
|
||||
|
||||
/* Memory Object Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acMemObjectCreate_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
|
||||
|
||||
typedef void(CL_CALLBACK* acMemObjectFree_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
|
||||
|
||||
typedef void(CL_CALLBACK* acMemObjectAcquired_fn)(cl_agent* /* agent */, cl_mem /* memobj */,
|
||||
cl_device_id /* device */,
|
||||
cl_long /* elapsed_time */);
|
||||
|
||||
/* Sampler Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acSamplerCreate_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
|
||||
|
||||
typedef void(CL_CALLBACK* acSamplerFree_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
|
||||
|
||||
/* Program Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acProgramCreate_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||
|
||||
typedef void(CL_CALLBACK* acProgramFree_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||
|
||||
typedef void(CL_CALLBACK* acProgramBuild_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||
|
||||
/* Kernel Callbacks */
|
||||
|
||||
typedef void(CL_CALLBACK* acKernelCreate_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
|
||||
|
||||
typedef void(CL_CALLBACK* acKernelFree_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
|
||||
|
||||
typedef void(CL_CALLBACK* acKernelSetArg_fn)(cl_agent* /* agent */, cl_kernel /* kernel */,
|
||||
cl_int /* arg_index */, size_t /* size */,
|
||||
const void* /* value_ptr */);
|
||||
|
||||
typedef struct _cl_agent_callbacks {
|
||||
/* Context Callbacks */
|
||||
acContextCreate_fn ContextCreate;
|
||||
acContextFree_fn ContextFree;
|
||||
|
||||
/* Command Queue Callbacks */
|
||||
acCommandQueueCreate_fn CommandQueueCreate;
|
||||
acCommandQueueFree_fn CommandQueueFree;
|
||||
|
||||
/* Event Callbacks */
|
||||
acEventCreate_fn EventCreate;
|
||||
acEventFree_fn EventFree;
|
||||
acEventStatusChanged_fn EventStatusChanged;
|
||||
|
||||
/* Memory Object Callbacks */
|
||||
acMemObjectCreate_fn MemObjectCreate;
|
||||
acMemObjectFree_fn MemObjectFree;
|
||||
acMemObjectAcquired_fn MemObjectAcquired;
|
||||
|
||||
/* Sampler Callbacks */
|
||||
acSamplerCreate_fn SamplerCreate;
|
||||
acSamplerFree_fn SamplerFree;
|
||||
|
||||
/* Program Callbacks */
|
||||
acProgramCreate_fn ProgramCreate;
|
||||
acProgramFree_fn ProgramFree;
|
||||
acProgramBuild_fn ProgramBuild;
|
||||
|
||||
/* Kernel Callbacks */
|
||||
acKernelCreate_fn KernelCreate;
|
||||
acKernelFree_fn KernelFree;
|
||||
acKernelSetArg_fn KernelSetArg;
|
||||
|
||||
} cl_agent_callbacks;
|
||||
|
||||
typedef cl_uint cl_agent_capability_action;
|
||||
|
||||
#define CL_AGENT_ADD_CAPABILITIES 0x0
|
||||
#define CL_AGENT_RELINQUISH_CAPABILITIES 0x1
|
||||
|
||||
typedef struct _cl_agent_capabilities {
|
||||
cl_bitfield canGenerateContextEvents : 1;
|
||||
cl_bitfield canGenerateCommandQueueEvents : 1;
|
||||
cl_bitfield canGenerateEventEvents : 1;
|
||||
cl_bitfield canGenerateMemObjectEvents : 1;
|
||||
cl_bitfield canGenerateSamplerEvents : 1;
|
||||
cl_bitfield canGenerateProgramEvents : 1;
|
||||
cl_bitfield canGenerateKernelEvents : 1;
|
||||
|
||||
} cl_agent_capabilities;
|
||||
|
||||
struct _cl_agent {
|
||||
cl_int(CL_API_CALL* GetVersionNumber)(cl_agent* /* agent */, cl_int* /* version_ret */);
|
||||
|
||||
cl_int(CL_API_CALL* GetPlatform)(cl_agent* /* agent */, cl_platform_id* /* platform_id_ret */);
|
||||
|
||||
cl_int(CL_API_CALL* GetTime)(cl_agent* /* agent */, cl_long* /* time_nanos */);
|
||||
|
||||
cl_int(CL_API_CALL* SetCallbacks)(cl_agent* /* agent */,
|
||||
const cl_agent_callbacks* /* callbacks */, size_t /* size */);
|
||||
|
||||
|
||||
cl_int(CL_API_CALL* GetPotentialCapabilities)(cl_agent* /* agent */,
|
||||
cl_agent_capabilities* /* capabilities */);
|
||||
|
||||
cl_int(CL_API_CALL* GetCapabilities)(cl_agent* /* agent */,
|
||||
cl_agent_capabilities* /* capabilities */);
|
||||
|
||||
cl_int(CL_API_CALL* SetCapabilities)(cl_agent* /* agent */,
|
||||
const cl_agent_capabilities* /* capabilities */,
|
||||
cl_agent_capability_action /* action */);
|
||||
|
||||
|
||||
cl_int(CL_API_CALL* GetICDDispatchTable)(cl_agent* /* agent */,
|
||||
cl_icd_dispatch_table* /* table */, size_t /* size */);
|
||||
|
||||
cl_int(CL_API_CALL* SetICDDispatchTable)(cl_agent* /* agent */,
|
||||
const cl_icd_dispatch_table* /* table */,
|
||||
size_t /* size */);
|
||||
|
||||
/* add Kernel/Program helper functions, etc... */
|
||||
};
|
||||
|
||||
extern cl_int CL_CALLBACK clAgent_OnLoad(cl_agent* /* agent */);
|
||||
|
||||
extern void CL_CALLBACK clAgent_OnUnload(cl_agent* /* agent */);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __OPENCL_CL_AGENT_AMD_H */
|
||||
@@ -0,0 +1,421 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
|
||||
#include "platform/object.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
#include "platform/agent.hpp"
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup CL_Queues
|
||||
*
|
||||
* OpenCL objects such as memory objects, program and kernel objects are
|
||||
* created using a context. Operations on these objects are performed using
|
||||
* a command-queue. The command-queue can be used to queue a set of operations
|
||||
* (referred to as commands) in order. Having multiple command-queues allows
|
||||
* applications to queue multiple independent commands without requiring
|
||||
* synchronization. Note that this should work as long as these objects are
|
||||
* not being shared. Sharing of objects across multiple command-queues will
|
||||
* require the application to perform appropriate synchronization.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief Create a command-queue on a specific device.
|
||||
*
|
||||
* \param context must be a valid OpenCL context.
|
||||
*
|
||||
* \param device must be a device associated with context. It can either be
|
||||
* in the list of devices specified when context is created using
|
||||
* clCreateContext or have the same device type as device type specified wheni
|
||||
* context is created using clCreateContextFromType.
|
||||
*
|
||||
* \param properties specifies a list of properties for the command-queue.
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code. If \a errcode_ret
|
||||
* is NULL, no error code is returned.
|
||||
*
|
||||
* \return A valid non-zero command-queue and \a errcode_ret is set to
|
||||
* CL_SUCCESS if the command-queue is created successfully or a NULL value
|
||||
* with one of the following error values returned \a in errcode_ret:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid.
|
||||
* - CL_INVALID_DEVICE if device is not a valid device or is not associated
|
||||
* with context
|
||||
* - CL_INVALID_VALUE if values specified in properties are not valid.
|
||||
* - CL_INVALID_QUEUE_PROPERTIES if values specified in properties are valid
|
||||
* but are not supported by the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
|
||||
* required by the runtime.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties,
|
||||
(cl_context context, cl_device_id device,
|
||||
const cl_queue_properties* queue_properties, cl_int* errcode_ret)) {
|
||||
if (!is_valid(context)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
|
||||
amd::Context& amdContext = *as_amd(context);
|
||||
amd::Device& amdDevice = *as_amd(device);
|
||||
|
||||
if (!is_valid(device) || !amdContext.containsDevice(&amdDevice)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
|
||||
cl_command_queue_properties properties = 0;
|
||||
const struct QueueProperty {
|
||||
cl_queue_properties name;
|
||||
union {
|
||||
cl_queue_properties raw;
|
||||
// FIXME_lmoriche: Check with Khronos. cl_queue_properties is an intptr,
|
||||
// but cl_command_queue_properties is a bitfield (truncate?).
|
||||
// cl_command_queue_properties properties;
|
||||
cl_uint size;
|
||||
} value;
|
||||
}* p = reinterpret_cast<const QueueProperty*>(queue_properties);
|
||||
|
||||
uint queueSize = amdDevice.info().queueOnDevicePreferredSize_;
|
||||
uint queueRTCUs = amd::CommandQueue::RealTimeDisabled;
|
||||
amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal;
|
||||
if (p != NULL)
|
||||
while (p->name != 0) {
|
||||
switch (p->name) {
|
||||
case CL_QUEUE_PROPERTIES:
|
||||
// FIXME_lmoriche: See comment above.
|
||||
// properties = p->value.properties;
|
||||
properties = static_cast<cl_command_queue_properties>(p->value.raw);
|
||||
break;
|
||||
case CL_QUEUE_SIZE:
|
||||
queueSize = p->value.size;
|
||||
break;
|
||||
#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f
|
||||
case CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD:
|
||||
queueRTCUs = p->value.size;
|
||||
break;
|
||||
#define CL_QUEUE_MEDIUM_PRIORITY_AMD 0x4050
|
||||
case CL_QUEUE_MEDIUM_PRIORITY_AMD:
|
||||
priority = amd::CommandQueue::Priority::Medium;
|
||||
if (p->value.size != 0) {
|
||||
queueRTCUs = p->value.size;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES;
|
||||
LogWarning("invalid property name");
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
if (queueSize > amdDevice.info().queueOnDeviceMaxSize_) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
|
||||
if ((queueRTCUs != amd::CommandQueue::RealTimeDisabled) &&
|
||||
((queueRTCUs > amdDevice.info().numRTCUs_) || (queueRTCUs == 0)
|
||||
|| (queueRTCUs < amdDevice.info().granularityRTCUs_))) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
|
||||
amd::CommandQueue* queue = NULL;
|
||||
{
|
||||
amd::ScopedLock lock(amdContext.lock());
|
||||
|
||||
// Check if the app creates a host queue
|
||||
if (!(properties & CL_QUEUE_ON_DEVICE)) {
|
||||
queue = new amd::HostQueue(amdContext, amdDevice, properties, queueRTCUs, priority);
|
||||
} else {
|
||||
// Is it a device default queue
|
||||
if (properties & CL_QUEUE_ON_DEVICE_DEFAULT) {
|
||||
queue = amdContext.defDeviceQueue(amdDevice);
|
||||
// If current context has one already then return it
|
||||
if (NULL != queue) {
|
||||
queue->retain();
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(queue);
|
||||
}
|
||||
}
|
||||
// Check if runtime can allocate a new device queue on this context
|
||||
if (amdContext.isDevQueuePossible(amdDevice)) {
|
||||
queue = new amd::DeviceQueue(amdContext, amdDevice, properties, queueSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (queue == NULL || !queue->create()) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
delete queue;
|
||||
return (cl_command_queue)0;
|
||||
}
|
||||
}
|
||||
|
||||
if (amd::Agent::shouldPostCommandQueueEvents()) {
|
||||
amd::Agent::postCommandQueueCreate(as_cl(queue->asCommandQueue()));
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(queue);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueue,
|
||||
(cl_context context, cl_device_id device, cl_command_queue_properties properties,
|
||||
cl_int* errcode_ret)) {
|
||||
const cl_queue_properties cprops[] = {CL_QUEUE_PROPERTIES,
|
||||
static_cast<cl_queue_properties>(properties), 0};
|
||||
return clCreateCommandQueueWithProperties(context, device, properties ? cprops : NULL,
|
||||
errcode_ret);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Replaces the default command queue on the device
|
||||
*
|
||||
* \param context must be a valid OpenCL context.
|
||||
*
|
||||
* \param device must be a device associated with context.
|
||||
*
|
||||
* \param command_queue specifies the default command-queue.
|
||||
*
|
||||
* \reture One of the following values:
|
||||
* - CL_SUCCESS if the function executed successfully.
|
||||
* - CL_INVALID_CONTEXT if \a context is not a valid context.
|
||||
* - CL_INVALID_DEVICE if \a device is not a valid device or is not
|
||||
* associated with context.
|
||||
* - CL_INVALID_COMMAND_QUEUE if \a command_queue is not a valid command-
|
||||
* queue for device.
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clSetDefaultDeviceCommandQueue,
|
||||
(cl_context context, cl_device_id device, cl_command_queue command_queue)) {
|
||||
if (!is_valid(context)) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
amd::Context* amdContext = as_amd(context);
|
||||
amd::Device* amdDevice = as_amd(device);
|
||||
if (!is_valid(device) || !amdContext->containsDevice(amdDevice)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
|
||||
if ((deviceQueue == NULL) || (amdContext != &deviceQueue->context()) ||
|
||||
(amdDevice != &deviceQueue->device())) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
{
|
||||
amd::ScopedLock lock(amdContext->lock());
|
||||
amdContext->setDefDeviceQueue(*amdDevice, deviceQueue);
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increment the \a command_queue reference count.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_COMMAND_QUEUE if \a command_queue is not a valid
|
||||
* command-queue.
|
||||
*
|
||||
* clCreateCommandQueue performs an implicit retain. This is very helpful for
|
||||
* 3rd party libraries, which typically get a command-queue passed to them
|
||||
* by the application. However, it is possible that the application may delete
|
||||
* the command-queue without informing the library. Allowing functions to
|
||||
* attach to (i.e. retain) and release a command-queue solves the problem of a
|
||||
* command-queue being used by a library no longer being valid.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainCommandQueue, (cl_command_queue command_queue)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
as_amd(command_queue)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Decrement the \a command_queue reference count.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_COMMAND_QUEUE if \a command_queue is not a valid
|
||||
* command-queue.
|
||||
*
|
||||
* After the command_queue reference count becomes zero and all commands queued
|
||||
* to \a command_queue have finished (eg. kernel executions, memory object
|
||||
* updates etc.), the command-queue is deleted.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleaseCommandQueue, (cl_command_queue command_queue)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
as_amd(command_queue)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Query information about a command-queue.
|
||||
*
|
||||
* \param command_queue specifies the command-queue being queried.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result
|
||||
* being queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
* If param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by \a param_value. If \a param_value_size_ret is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_COMMAND_QUEUE if \a command_queue is not a valid
|
||||
* command-queue.
|
||||
* - CL_INVALID_VALUE if \a param_name is not one of the supported
|
||||
* values or if size in bytes specified by \a param_value_size is < size of
|
||||
* return type and \a param_value is not a NULL value.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetCommandQueueInfo,
|
||||
(cl_command_queue command_queue, cl_command_queue_info param_name,
|
||||
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
switch (param_name) {
|
||||
case CL_QUEUE_CONTEXT: {
|
||||
cl_context context = const_cast<cl_context>(as_cl(&as_amd(command_queue)->context()));
|
||||
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_DEVICE: {
|
||||
cl_device_id device = const_cast<cl_device_id>(as_cl(&as_amd(command_queue)->device()));
|
||||
return amd::clGetInfo(device, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_PROPERTIES: {
|
||||
cl_command_queue_properties properties = as_amd(command_queue)->properties().value_;
|
||||
return amd::clGetInfo(properties, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(command_queue)->referenceCount();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_SIZE: {
|
||||
const amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
|
||||
if (NULL == deviceQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
cl_uint size = deviceQueue->size();
|
||||
return amd::clGetInfo(size, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_THREAD_HANDLE_AMD: {
|
||||
const amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == hostQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
const void* handle = hostQueue->thread().handle();
|
||||
return amd::clGetInfo(handle, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_QUEUE_DEVICE_DEFAULT: {
|
||||
const amd::Device& device = as_amd(command_queue)->device();
|
||||
amd::CommandQueue* defQueue = as_amd(command_queue)->context().defDeviceQueue(device);
|
||||
cl_command_queue queue = defQueue ? as_cl(defQueue) : NULL;
|
||||
return amd::clGetInfo(queue, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Enable or disable the properties of a command-queue.
|
||||
*
|
||||
* \param command_queue specifies the command-queue being queried.
|
||||
*
|
||||
* \param properties specifies the new command-queue properties to be applied
|
||||
* to \a command_queue .
|
||||
*
|
||||
* \param enable determines whether the values specified by properties are
|
||||
* enabled (if enable is CL_TRUE) or disabled (if enable is CL_FALSE) for the
|
||||
* command-queue .
|
||||
*
|
||||
* \param old_properties returns the command-queue properties before they were
|
||||
* changed by clSetCommandQueueProperty. If \a old_properties is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the command-queue properties are successfully updated.
|
||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||
* - CL_INVALID_VALUE if the values specified in properties are not valid.
|
||||
* - CL_INVALID_QUEUE_PROPERTIES if values specified in properties are
|
||||
* not supported by the device.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clSetCommandQueueProperty,
|
||||
(cl_command_queue command_queue, cl_command_queue_properties properties,
|
||||
cl_bool enable, cl_command_queue_properties* old_properties)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
*not_null(old_properties) = as_amd(command_queue)->properties().value_;
|
||||
|
||||
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
|
||||
clFinish(command_queue);
|
||||
}
|
||||
|
||||
bool success;
|
||||
if (enable == CL_TRUE) {
|
||||
success = as_amd(command_queue)->properties().set(properties);
|
||||
} else {
|
||||
success = as_amd(command_queue)->properties().clear(properties);
|
||||
}
|
||||
|
||||
return success ? CL_SUCCESS : CL_INVALID_QUEUE_PROPERTIES;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,158 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef CL_COMMON_HPP_
|
||||
#define CL_COMMON_HPP_
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <CL/cl_d3d11.h>
|
||||
#include <CL/cl_d3d10.h>
|
||||
#include <CL/cl_dx9_media_sharing.h>
|
||||
#endif
|
||||
#include <CL/cl_icd.h>
|
||||
|
||||
#include "top.hpp"
|
||||
#include "vdi_common.hpp"
|
||||
|
||||
//! Helper function to check "properties" parameter in various functions
|
||||
int checkContextProperties(
|
||||
const cl_context_properties *properties,
|
||||
bool* offlineDevices);
|
||||
|
||||
namespace amd {
|
||||
|
||||
template <typename T>
|
||||
static inline cl_int
|
||||
clGetInfo(
|
||||
T& field,
|
||||
size_t param_value_size,
|
||||
void* param_value,
|
||||
size_t* param_value_size_ret)
|
||||
{
|
||||
const void *valuePtr;
|
||||
size_t valueSize;
|
||||
|
||||
std::tie(valuePtr, valueSize)
|
||||
= detail::ParamInfo<typename std::remove_const<T>::type>::get(field);
|
||||
|
||||
*not_null(param_value_size_ret) = valueSize;
|
||||
|
||||
cl_int ret = CL_SUCCESS;
|
||||
if (param_value != NULL && param_value_size < valueSize) {
|
||||
if ((param_value_size == 0) || !std::is_pointer<T>() || !std::is_same<typename
|
||||
std::remove_const<typename std::remove_pointer<T>::type>::type, char>()) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
// For char* and char[] params, we will at least fill up to
|
||||
// param_value_size, then return an error.
|
||||
valueSize = param_value_size;
|
||||
static_cast<char*>(param_value)[--valueSize] = '\0';
|
||||
ret = CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (param_value != NULL) {
|
||||
::memcpy(param_value, valuePtr, valueSize);
|
||||
if (param_value_size > valueSize) {
|
||||
::memset(static_cast<address>(param_value) + valueSize,
|
||||
'\0', param_value_size - valueSize);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline cl_int
|
||||
clSetEventWaitList(
|
||||
Command::EventWaitList& eventWaitList,
|
||||
const amd::HostQueue& hostQueue,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list)
|
||||
{
|
||||
if ((num_events_in_wait_list == 0 && event_wait_list != NULL)
|
||||
|| (num_events_in_wait_list != 0 && event_wait_list == NULL)) {
|
||||
return CL_INVALID_EVENT_WAIT_LIST;
|
||||
}
|
||||
|
||||
while (num_events_in_wait_list-- > 0) {
|
||||
cl_event event = *event_wait_list++;
|
||||
Event* amdEvent = as_amd(event);
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT_WAIT_LIST;
|
||||
}
|
||||
if (&hostQueue.context() != &amdEvent->context()) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
if ((amdEvent->command().queue() != &hostQueue) && !amdEvent->notifyCmdQueue()) {
|
||||
return CL_INVALID_EVENT_WAIT_LIST;
|
||||
}
|
||||
eventWaitList.push_back(amdEvent);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
//! Common function declarations for CL-external graphics API interop
|
||||
cl_int clEnqueueAcquireExtObjectsAMD(cl_command_queue command_queue,
|
||||
cl_uint num_objects, const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||
cl_event* event, cl_command_type cmd_type);
|
||||
cl_int clEnqueueReleaseExtObjectsAMD(cl_command_queue command_queue,
|
||||
cl_uint num_objects, const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||
cl_event* event, cl_command_type cmd_type);
|
||||
|
||||
} // namespace amd
|
||||
|
||||
extern "C" {
|
||||
|
||||
#if defined(CL_VERSION_1_1)
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetCommandQueueProperty(
|
||||
cl_command_queue command_queue,
|
||||
cl_command_queue_properties properties,
|
||||
cl_bool enable,
|
||||
cl_command_queue_properties *old_properties) CL_API_SUFFIX__VERSION_1_0;
|
||||
#endif // CL_VERSION_1_1
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clConvertImageAMD(
|
||||
cl_context context,
|
||||
cl_mem image,
|
||||
const cl_image_format * image_format,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateBufferFromImageAMD(
|
||||
cl_context context,
|
||||
cl_mem image,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
extern CL_API_ENTRY cl_program CL_API_CALL
|
||||
clCreateProgramWithAssemblyAMD(
|
||||
cl_context context,
|
||||
cl_uint count,
|
||||
const char ** strings,
|
||||
const size_t * lengths,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif /*CL_COMMON_HPP_*/
|
||||
@@ -0,0 +1,558 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "vdi_common.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "device/device.hpp"
|
||||
#include "platform/runtime.hpp"
|
||||
#include "platform/agent.hpp"
|
||||
#ifdef _WIN32
|
||||
#include "cl_d3d9_amd.hpp"
|
||||
#include "cl_d3d10_amd.hpp"
|
||||
#include "cl_d3d11_amd.hpp"
|
||||
#endif // _WIN32
|
||||
#include "cl_kernel_info_amd.h"
|
||||
#include "cl_profile_amd.h"
|
||||
#include "cl_platform_amd.h"
|
||||
#include "cl_sdi_amd.h"
|
||||
#include "cl_thread_trace_amd.h"
|
||||
#include "cl_p2p_amd.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include "CL/cl_gl.h"
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup CL_Contexts
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief Create an OpenCL context.
|
||||
*
|
||||
* An OpenCL context is created with one or more devices. Contexts are used by
|
||||
* the OpenCL runtime for managing objects such as command-queues, memory,
|
||||
* program and kernel objects and for executing kernels on one or more devices
|
||||
* specified in the context.
|
||||
*
|
||||
* \param properties is reserved and must be zero.
|
||||
*
|
||||
* \param num_devices is the number of devices specified in the \a devices
|
||||
* argument.
|
||||
*
|
||||
* \param devices is a pointer to a list of unique devices returned by
|
||||
* clGetDevices. If more than one device is specified in devices,
|
||||
* a selection criteria may be applied to determine if the list of devices
|
||||
* specified can be used together to create a context.
|
||||
*
|
||||
* \param pfn_notify is a callback function that can be registered by the
|
||||
* application. This callback function will be used by the runtime to report
|
||||
* information on errors that occur in this context. This callback function
|
||||
* may be called asynchronously by the runtime. If \a pfn_notify is NULL,
|
||||
* no callback function is registered.
|
||||
*
|
||||
* \param user_data will be passed as the user_data argument when \a pfn_notify
|
||||
* is called. \a user_data can be NULL.
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code. If \a errcode_ret
|
||||
* is NULL, no error code is returned.
|
||||
*
|
||||
* \return A valid non-zero context and errcode_ret is set to CL_SUCCESS
|
||||
* if the context is created successfully or NULL with the following
|
||||
* error values stored in \a errcode_ret:
|
||||
* - CL_INVALID_VALUE if \a properties is not zero.
|
||||
* - CL_INVALID_VALUE if \a devices is NULL.
|
||||
* - CL_INVALID_VALUE if \a num_devices is equal to zero.
|
||||
* - CL_INVALID_DEVICE if \a devices contains an invalid device.
|
||||
* - CL_INVALID_DEVICE_LIST if more than one device is specified in
|
||||
* \a devices and the list of devices specified cannot be used together
|
||||
* to create a context.
|
||||
* - CL_DEVICE_NOT_AVAILABLE if a device in \a devices is currently not
|
||||
* available even though the device was returned by clGetDevices.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
|
||||
* required by the runtime.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_context, clCreateContext,
|
||||
(const cl_context_properties* properties, cl_uint num_devices,
|
||||
const cl_device_id* devices,
|
||||
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
|
||||
void* user_data, cl_int* errcode_ret)) {
|
||||
cl_int errcode;
|
||||
amd::Context::Info info;
|
||||
|
||||
errcode = amd::Context::checkProperties(properties, &info);
|
||||
if (CL_SUCCESS != errcode) {
|
||||
*not_null(errcode_ret) = errcode;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
if (num_devices == 0 || devices == NULL) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
std::vector<amd::Device*> devices_;
|
||||
for (cl_uint i = 0; i < num_devices; ++i) {
|
||||
// FIXME_lmoriche: Set errcode_ret to CL_DEVICE_NOT_AVAILABLE if a
|
||||
// device in devices is no longer available.
|
||||
cl_device_id device = devices[i];
|
||||
|
||||
if (!is_valid(device)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||
return (cl_context)0;
|
||||
}
|
||||
devices_.push_back(as_amd(device));
|
||||
}
|
||||
|
||||
amd::Context* context = new amd::Context(devices_, info);
|
||||
if (context == NULL) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
if (CL_SUCCESS != (errcode = context->create(properties))) {
|
||||
context->release();
|
||||
*not_null(errcode_ret) = errcode;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
if (amd::Agent::shouldPostContextEvents()) {
|
||||
amd::Agent::postContextCreate(as_cl(context));
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(context);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Create an OpenCL context from a device type that identifies the
|
||||
* specific device(s) to use.
|
||||
*
|
||||
* \param properties is reserved and must be zero.
|
||||
*
|
||||
* \param device_type is a bit-field that identifies the type of device.
|
||||
*
|
||||
* \param pfn_notify described in clCreateContext.
|
||||
*
|
||||
* \param user_data described in clCreateContext.
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code. If \a errcode_ret
|
||||
* is NULL, no error code is returned.
|
||||
*
|
||||
* \return A valid non-zero context and errcode_ret is set to CL_SUCCESS
|
||||
* if the context is created successfully or NULL with the following error
|
||||
* values stored in errcode_ret:
|
||||
* - CL_INVALID_VALUE if \a properties is not zero.
|
||||
* - CL_INVALID_DEVICE_TYPE if \a device_type is not a valid value.
|
||||
* - CL_DEVICE_NOT_AVAILABLE if no devices that match \a device_type
|
||||
* are currently available.
|
||||
* - CL_DEVICE_NOT_FOUND if no devices that match \a device_type were found.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
|
||||
* required by the runtime.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_context, clCreateContextFromType,
|
||||
(const cl_context_properties* properties, cl_device_type device_type,
|
||||
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
|
||||
void* user_data, cl_int* errcode_ret)) {
|
||||
amd::Context::Info info;
|
||||
cl_int errcode = amd::Context::checkProperties(properties, &info);
|
||||
if (errcode != CL_SUCCESS) {
|
||||
*not_null(errcode_ret) = errcode;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
// Get the devices of the given type.
|
||||
cl_uint num_devices;
|
||||
bool offlineDevices = (info.flags_ & amd::Context::OfflineDevices) ? true : false;
|
||||
if (!amd::Device::getDeviceIDs(device_type, 0, NULL, &num_devices, offlineDevices)) {
|
||||
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
assert(num_devices > 0 && "Should have returned an error!");
|
||||
cl_device_id* devices = (cl_device_id*)alloca(num_devices * sizeof(cl_device_id));
|
||||
|
||||
if (!amd::Device::getDeviceIDs(device_type, num_devices, devices, NULL, offlineDevices)) {
|
||||
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
||||
return (cl_context)0;
|
||||
}
|
||||
|
||||
// Create a new context with the devices
|
||||
cl_context context =
|
||||
clCreateContext(properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
||||
|
||||
return context;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increment the context reference count.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid OpenCL context.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* clCreateContext and clCreateContextFromType perform an implicit retain.
|
||||
* This is very helpful for 3rd party libraries, which typically get a context
|
||||
* passed to them by the application.
|
||||
* However, it is possible that the application may delete the context without
|
||||
* informing the library. Allowing functions to attach to (i.e. retain) and
|
||||
* release a context solves the problem of a context being used by a library
|
||||
* no longer being valid.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainContext, (cl_context context)) {
|
||||
if (!is_valid(context)) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
as_amd(context)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Decrement the context reference count.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid OpenCL context.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* After the context reference count becomes zero and all the objects attached
|
||||
* to context (such as memory objects, command-queues) are released,
|
||||
* the context is deleted.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleaseContext, (cl_context context)) {
|
||||
if (!is_valid(context)) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
as_amd(context)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Query information about a context.
|
||||
*
|
||||
* \param context specifies the OpenCL context being queried.
|
||||
*
|
||||
* \param param_name is an enum that specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result being
|
||||
* queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size specifies the size in bytes of memory pointed to by
|
||||
* \a param_value. This size must be greater than or equal to the size of
|
||||
* return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by \a param_value. If \a param_value_size_ret is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid context.
|
||||
* - CL_INVALID_VALUE if \a param_name is not one of the supported values
|
||||
* or if size in bytes specified by \a param_value_size is < size of return
|
||||
* type and \a param_value is not a NULL value.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetContextInfo,
|
||||
(cl_context context, cl_context_info param_name, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
if (!is_valid(context)) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
switch (param_name) {
|
||||
case CL_CONTEXT_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(context)->referenceCount();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_CONTEXT_NUM_DEVICES: {
|
||||
cl_uint numDevices = (cl_uint)as_amd(context)->devices().size();
|
||||
return amd::clGetInfo(numDevices, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_CONTEXT_DEVICES: {
|
||||
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
||||
size_t numDevices = devices.size();
|
||||
size_t valueSize = numDevices * sizeof(cl_device_id*);
|
||||
|
||||
if (param_value != NULL && param_value_size < valueSize) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = valueSize;
|
||||
if (param_value != NULL) {
|
||||
cl_device_id* device_list = (cl_device_id*)param_value;
|
||||
for (const auto& it : devices) {
|
||||
*device_list++ = const_cast<cl_device_id>(as_cl(it));
|
||||
}
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_PROPERTIES: {
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
size_t valueSize = amdContext->info().propertiesSize_;
|
||||
|
||||
if (param_value != NULL && param_value_size < valueSize) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = valueSize;
|
||||
if ((param_value != NULL) && (valueSize != 0)) {
|
||||
::memcpy(param_value, amdContext->properties(), valueSize);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
case CL_CONTEXT_D3D10_DEVICE_KHR: {
|
||||
// Not defined in the ext.spec, but tested in the conf.test
|
||||
// Guessing functionality from the test...
|
||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
if (!(amdContext->info().flags_ & amd::Context::D3D10DeviceKhr)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||
if (param_value != NULL) {
|
||||
*(intptr_t*)param_value =
|
||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR: {
|
||||
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
||||
if (param_value != NULL) {
|
||||
*(cl_bool*)param_value = CL_TRUE;
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_D3D11_DEVICE_KHR: {
|
||||
// Not defined in the ext.spec, but tested in the conf.test
|
||||
// Guessing functionality from the test...
|
||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
if (!(amdContext->info().flags_ & amd::Context::D3D11DeviceKhr)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||
if (param_value != NULL) {
|
||||
*(intptr_t*)param_value =
|
||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR: {
|
||||
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
||||
if (param_value != NULL) {
|
||||
*(cl_bool*)param_value = CL_TRUE;
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_ADAPTER_D3D9_KHR: {
|
||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceKhr)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||
if (param_value != NULL) {
|
||||
*(intptr_t*)param_value =
|
||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
|
||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceEXKhr)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||
if (param_value != NULL) {
|
||||
*(intptr_t*)param_value =
|
||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
case CL_CONTEXT_ADAPTER_DXVA_KHR: {
|
||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
const amd::Context* amdContext = as_amd(context);
|
||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceVAKhr)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||
if (param_value != NULL) {
|
||||
*(intptr_t*)param_value =
|
||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
#endif //_WIN32
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief returns the address of the extension function named by
|
||||
* funcname for a given platform. The pointer returned should be cast
|
||||
* to a function pointer type matching the extension functions definition
|
||||
* defined in the appropriate extension specification and header file.
|
||||
* A return value of NULL indicates that the specified function does not
|
||||
* exist for the implementation or platform is not a valid platform.
|
||||
* A non-NULL return value for \a clGetExtensionFunctionAddressForPlatform
|
||||
* does not guarantee that an extension function is actually supported by
|
||||
* the platform. The application must also make a corresponding query using
|
||||
* \a clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, ... ) or
|
||||
* \a clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, ... ) to determine if
|
||||
* an extension is supported by the OpenCL implementation.
|
||||
*
|
||||
* \version 1.2r07
|
||||
*/
|
||||
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
|
||||
const char* funcname) {
|
||||
if (platform != NULL && platform != AMD_PLATFORM) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return clGetExtensionFunctionAddress(funcname);
|
||||
}
|
||||
|
||||
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddress(const char* func_name) {
|
||||
#define CL_EXTENSION_ENTRYPOINT_CHECK(name) \
|
||||
if (!strcmp(func_name, #name)) return reinterpret_cast<void*>(name);
|
||||
#define CL_EXTENSION_ENTRYPOINT_CHECK2(name1, name2) \
|
||||
if (!strcmp(func_name, #name1)) return reinterpret_cast<void*>(name2);
|
||||
|
||||
switch (func_name[2]) {
|
||||
case 'C':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateEventFromGLsyncKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreatePerfCounterAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateThreadTraceAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLBuffer);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture2D);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture3D);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLRenderbuffer);
|
||||
#ifdef _WIN32
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10BufferKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture2DKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture3DKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromDX9MediaSurfaceKHR);
|
||||
#endif //_WIN32
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
|
||||
#if defined(cl_khr_il_program) || defined(CL_VERSION_2_1)
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK2(clCreateProgramWithILKHR,clCreateProgramWithIL);
|
||||
#endif // defined(cl_khr_il_program) || defined(CL_VERSION_2_1)
|
||||
#if cl_amd_assembly_program
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithAssemblyAMD);
|
||||
#endif // cl_amd_assembly_program
|
||||
break;
|
||||
case 'D':
|
||||
break;
|
||||
case 'E':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueEndPerfCounterAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireGLObjects);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseGLObjects);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBindThreadTraceBufferAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueThreadTraceCommandAMD);
|
||||
#ifdef _WIN32
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
|
||||
#endif //_WIN32
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
|
||||
#if cl_amd_copy_buffer_p2p
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueCopyBufferP2PAMD);
|
||||
#endif // cl_amd_copy_buffer_p2p
|
||||
break;
|
||||
case 'G':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPerfCounterInfoAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLObjectInfo);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
|
||||
#ifdef _WIN32
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPlaneFromImageAMD);
|
||||
#endif //_WIN32
|
||||
#if defined(cl_khr_sub_groups) || defined(CL_VERSION_2_1)
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK2(clGetKernelSubGroupInfoKHR,clGetKernelSubGroupInfo);
|
||||
#endif // defined(cl_khr_sub_groups) || defined(CL_VERSION_2_1)
|
||||
break;
|
||||
case 'I':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clIcdGetPlatformIDsKHR);
|
||||
break;
|
||||
case 'R':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleasePerfCounterAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainPerfCounterAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseThreadTraceAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainThreadTraceAMD);
|
||||
break;
|
||||
case 'S':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clSetDeviceClockModeAMD);
|
||||
break;
|
||||
case 'U':
|
||||
CL_EXTENSION_ENTRYPOINT_CHECK(clUnloadPlatformAMD);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clTerminateContextKHR, (cl_context context)) { return CL_INVALID_CONTEXT; }
|
||||
RUNTIME_EXIT
|
||||
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,127 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#include "platform/object.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
#include "platform/counter.hpp"
|
||||
|
||||
#ifdef cl_amd_atomic_counters
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
* \addtogroup CL_Counters
|
||||
*
|
||||
* Counter objects ...
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_counter_amd, clCreateCounterAMD,
|
||||
(cl_context context, cl_counter_flags_amd flags, cl_uint value,
|
||||
cl_int* errcode_ret)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
return (cl_counter_amd)0;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetCounterInfoAMD,
|
||||
(cl_counter_amd counter, cl_counter_info_amd param_name, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
return CL_INVALID_COUNTER_AMD;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increment the counter reference count.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_COUNTER if \a counter is not a valid counter object.
|
||||
*
|
||||
* The OpenCL commands that return a counter perform an implicit retain.
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainCounterAMD, (cl_counter_amd counter)) {
|
||||
if (!is_valid(counter)) {
|
||||
return CL_INVALID_COUNTER_AMD;
|
||||
}
|
||||
as_amd(counter)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Decrement the counter reference count.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_EVENT if \a counter is not a valid counter object.
|
||||
*
|
||||
* The counter object is deleted once the reference count becomes zero.
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleaseCounterAMD, (cl_counter_amd counter)) {
|
||||
if (!is_valid(counter)) {
|
||||
return CL_INVALID_COUNTER_AMD;
|
||||
}
|
||||
as_amd(counter)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueReadCounterAMD,
|
||||
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_read,
|
||||
cl_uint* value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||
cl_event* event)) {
|
||||
return CL_INVALID_COUNTER_AMD;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief
|
||||
*
|
||||
* \version 1.1r18
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueWriteCounterAMD,
|
||||
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_write,
|
||||
cl_uint value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||
cl_event* event)) {
|
||||
return CL_INVALID_COUNTER_AMD;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // cl_amd_atomic_counters
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,339 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef CL_D3D10_AMD_HPP_
|
||||
#define CL_D3D10_AMD_HPP_
|
||||
|
||||
#include "cl_common.hpp"
|
||||
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace amd
|
||||
{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
UINT ByteWidth;
|
||||
UINT Width;
|
||||
};
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
} D3D10ObjSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
D3D10_USAGE d3d10Usage_;
|
||||
UINT bindFlags_;
|
||||
UINT cpuAccessFlags_;
|
||||
UINT miscFlags_;
|
||||
} D3D10Flags_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
D3D10_RESOURCE_DIMENSION objDim_;
|
||||
D3D10ObjSize_t objSize_;
|
||||
D3D10Flags_t objFlags_;
|
||||
UINT mipLevels_;
|
||||
UINT arraySize_;
|
||||
DXGI_FORMAT dxgiFormat_;
|
||||
DXGI_SAMPLE_DESC dxgiSampleDesc_;
|
||||
} D3D10ObjDesc_t;
|
||||
|
||||
const DXGI_SAMPLE_DESC dxgiSampleDescDefault = {1, 0};
|
||||
|
||||
//! Class D3D10Object keeps all the info about the D3D10 object
|
||||
//! from which the CL object is created
|
||||
class D3D10Object : public InteropObject
|
||||
{
|
||||
private:
|
||||
ID3D10Resource* pD3D10Aux_;
|
||||
|
||||
// @todo: TBD: Do we need to sync data after access
|
||||
// or it'll be done by the D3D driver?
|
||||
cl_int cliChecksum_;
|
||||
bool releaseResources_;
|
||||
|
||||
static bool createSharedResource(D3D10Object& obj);
|
||||
static std::vector<std::pair<void*, UINT>> resources_;
|
||||
//! Global lock.
|
||||
static Monitor resLock_;
|
||||
|
||||
protected:
|
||||
ID3D10Resource* pD3D10Res_;
|
||||
ID3D10Resource* pD3D10ResOrig_;
|
||||
ID3D10Query* pQuery_;
|
||||
D3D10ObjDesc_t objDesc_;
|
||||
D3D10ObjDesc_t objDescOrig_;
|
||||
UINT subRes_;
|
||||
|
||||
public:
|
||||
// Default constructor
|
||||
D3D10Object()
|
||||
:pD3D10Aux_(NULL)
|
||||
,cliChecksum_(0)
|
||||
,releaseResources_(false)
|
||||
,pD3D10Res_(NULL)
|
||||
,pD3D10ResOrig_(NULL)
|
||||
,pQuery_(NULL)
|
||||
,subRes_(0)
|
||||
{
|
||||
memset(&objDesc_,0,sizeof(objDesc_));
|
||||
memset(&objDescOrig_,0,sizeof(objDescOrig_));
|
||||
}
|
||||
// Copy constructor
|
||||
D3D10Object(D3D10Object& d3d10obj)
|
||||
: pQuery_(NULL)
|
||||
{
|
||||
*this = d3d10obj;
|
||||
this->releaseResources_ = true;
|
||||
// Add reference to the D3D10 resource to prevent its disappearance
|
||||
if(pD3D10ResOrig_) {
|
||||
pD3D10ResOrig_->AddRef();
|
||||
}
|
||||
else if(pD3D10Res_) {
|
||||
pD3D10Res_->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
//! Virtual destructor
|
||||
virtual ~D3D10Object()
|
||||
{
|
||||
ScopedLock sl(resLock_);
|
||||
if(releaseResources_) {
|
||||
// Decrement reference to the D3D10 objects
|
||||
if(pD3D10Res_) pD3D10Res_->Release();
|
||||
if(pD3D10Aux_) pD3D10Aux_->Release();
|
||||
if(pD3D10ResOrig_) pD3D10ResOrig_->Release();
|
||||
if(pQuery_) pQuery_->Release();
|
||||
// Check if this resource has already been used for interop
|
||||
if(resources_.size()) {
|
||||
for(auto& it = resources_.cbegin(); it != resources_.cend(); it++) {
|
||||
if(((pD3D10ResOrig_ && (*it).first == (void*) pD3D10ResOrig_)
|
||||
|| ((*it).first == (void*) pD3D10Res_))
|
||||
&& (*it).second == subRes_) {
|
||||
resources_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int initD3D10Object(const Context& amdContext, ID3D10Resource* pRes, UINT subresource,
|
||||
D3D10Object& obj);
|
||||
|
||||
D3D10Object* asD3D10Object() { return this; }
|
||||
|
||||
//! D3D10Object query functions to get D3D10 info from member variables
|
||||
ID3D10Resource* getD3D10Resource() const {return pD3D10Res_;}
|
||||
ID3D10Resource* getD3D10ResOrig() const {return pD3D10ResOrig_;}
|
||||
D3D10_USAGE getUsage() const { return objDesc_.objFlags_.d3d10Usage_; }
|
||||
void setD3D10AuxRes(ID3D10Resource* pAux) {pD3D10Aux_ = pAux;}
|
||||
ID3D10Resource* getD3D10AuxRes() const {return pD3D10Aux_;}
|
||||
ID3D10Query* getQuery() const {return pQuery_;}
|
||||
|
||||
UINT getWidth() const {return objDesc_.objSize_.Width;}
|
||||
UINT getHeight() const {return objDesc_.objSize_.Height;}
|
||||
UINT getDepth() const {return objDesc_.objSize_.Depth;}
|
||||
size_t getElementBytes(DXGI_FORMAT dxgiFomat);
|
||||
size_t getElementBytes() {return getElementBytes(objDesc_.dxgiFormat_);}
|
||||
DXGI_FORMAT getDxgiFormat() {return objDesc_.dxgiFormat_;}
|
||||
UINT getSubresource() const {return subRes_;}
|
||||
const D3D10ObjDesc_t* getObjDesc() const { return &objDesc_; }
|
||||
|
||||
//! Returns bytes per pixel > 0 if conversion successful, 0 otherwise;
|
||||
//! if formats are not compatible, cl format channel
|
||||
//! order and type are set to 0
|
||||
cl_image_format getCLFormatFromDXGI(DXGI_FORMAT dxgiFmt);
|
||||
cl_image_format getCLFormatFromDXGI()
|
||||
{
|
||||
return getCLFormatFromDXGI(objDesc_.dxgiFormat_);
|
||||
}
|
||||
size_t getResourceByteSize();
|
||||
|
||||
// On acquire copy data from original resource to shared resource
|
||||
virtual bool copyOrigToShared();
|
||||
// On release copy data from shared copy to the original resource
|
||||
virtual bool copySharedToOrig();
|
||||
};
|
||||
|
||||
//! Class BufferD3D10 is derived from classes Buffer and D3D10Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D10 object
|
||||
class BufferD3D10 : public D3D10Object, public Buffer
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after 'BufferD3D10' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! BufferD3D10 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
BufferD3D10(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D10Object& d3d10obj)
|
||||
: // Call base classes constructors
|
||||
D3D10Object(d3d10obj),
|
||||
Buffer(
|
||||
amdContext,
|
||||
clFlags,
|
||||
d3d10obj.getResourceByteSize())
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~BufferD3D10() {}
|
||||
};
|
||||
|
||||
//! Class Image1DD3D10 is derived from classes Image1D and D3D10Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D10 object
|
||||
class Image1DD3D10 : public D3D10Object, public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image1DD3D10' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image1DD3D10 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image1DD3D10(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D10Object& d3d10obj)
|
||||
: // Call base classes constructors
|
||||
D3D10Object(d3d10obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE1D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d10obj.getDxgiFormat()), //format,
|
||||
d3d10obj.getWidth(),
|
||||
1,
|
||||
1,
|
||||
d3d10obj.getWidth() * d3d10obj.getElementBytes(), //rowPitch),
|
||||
0)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image1DD3D10() {}
|
||||
};
|
||||
|
||||
//! Class Image2DD3D10 is derived from classes Image2D and D3D10Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D10 object
|
||||
class Image2DD3D10 : public D3D10Object, public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image2DD3D10' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image2DD3D10 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image2DD3D10(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D10Object& d3d10obj)
|
||||
: // Call base classes constructors
|
||||
D3D10Object(d3d10obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE2D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d10obj.getDxgiFormat()), //format,
|
||||
d3d10obj.getWidth(),
|
||||
d3d10obj.getHeight(),
|
||||
1,
|
||||
d3d10obj.getWidth() * d3d10obj.getElementBytes(), //rowPitch),
|
||||
0)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image2DD3D10() {}
|
||||
};
|
||||
|
||||
//! Class Image3DD3D10 is derived from classes Image3D and D3D10Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D10 object
|
||||
class Image3DD3D10 : public D3D10Object, public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image3DD3D10' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image2DD3D10 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image3DD3D10(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D10Object& d3d10obj)
|
||||
: // Call base classes constructors
|
||||
D3D10Object(d3d10obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE3D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d10obj.getDxgiFormat()), //format,
|
||||
d3d10obj.getWidth(),
|
||||
d3d10obj.getHeight(),
|
||||
d3d10obj.getDepth(),
|
||||
d3d10obj.getWidth() * d3d10obj.getElementBytes(), //rowPitch),
|
||||
d3d10obj.getWidth() * d3d10obj.getHeight() * d3d10obj.getElementBytes())
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image3DD3D10() {}
|
||||
};
|
||||
|
||||
//! Functions for executing the D3D10 related stuff
|
||||
cl_mem clCreateBufferFromD3D10ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Resource* pD3DResource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage1DFromD3D10ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage2DFromD3D10ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage3DFromD3D10ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
void SyncD3D10Objects(std::vector<amd::Memory*>& memObjects);
|
||||
} //namespace amd
|
||||
|
||||
#endif //CL_D3D10_AMD_HPP_
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,348 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef CL_D3D11_AMD_HPP_
|
||||
#define CL_D3D11_AMD_HPP_
|
||||
|
||||
#include "cl_d3d10_amd.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clGetPlaneFromImageAMD(
|
||||
cl_context /* context */,
|
||||
cl_mem /* mem */,
|
||||
cl_uint /* plane */,
|
||||
cl_int* /* errcode_ret */);
|
||||
|
||||
namespace amd
|
||||
{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
UINT ByteWidth;
|
||||
UINT Width;
|
||||
};
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
} D3D11ObjSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
D3D11_USAGE d3d11Usage_;
|
||||
UINT bindFlags_;
|
||||
UINT cpuAccessFlags_;
|
||||
UINT miscFlags_;
|
||||
UINT structureByteStride_;
|
||||
} D3D11Flags_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
D3D11_RESOURCE_DIMENSION objDim_;
|
||||
D3D11ObjSize_t objSize_;
|
||||
D3D11Flags_t objFlags_;
|
||||
UINT mipLevels_;
|
||||
UINT arraySize_;
|
||||
DXGI_FORMAT dxgiFormat_;
|
||||
DXGI_SAMPLE_DESC dxgiSampleDesc_;
|
||||
} D3D11ObjDesc_t;
|
||||
|
||||
//! Class D3D11Object keeps all the info about the D3D11 object
|
||||
//! from which the CL object is created
|
||||
class D3D11Object : public InteropObject
|
||||
{
|
||||
private:
|
||||
ID3D11Resource* pD3D11Aux_;
|
||||
|
||||
// @todo: TBD: Do we need to sync data after access
|
||||
// or it'll be done by the D3D driver?
|
||||
cl_int cliChecksum_;
|
||||
bool releaseResources_;
|
||||
|
||||
static bool createSharedResource(D3D11Object& obj);
|
||||
static std::vector<std::pair<void*, std::pair<UINT,UINT>>> resources_;
|
||||
protected:
|
||||
//! Global lock.
|
||||
static Monitor resLock_;
|
||||
|
||||
ID3D11Resource* pD3D11Res_;
|
||||
ID3D11Resource* pD3D11ResOrig_;
|
||||
ID3D11Query* pQuery_;
|
||||
D3D11ObjDesc_t objDesc_;
|
||||
UINT subRes_;
|
||||
INT plane_;
|
||||
|
||||
public:
|
||||
// Default constructor
|
||||
D3D11Object()
|
||||
:pD3D11Aux_(NULL)
|
||||
,cliChecksum_(0)
|
||||
,releaseResources_(false)
|
||||
,pD3D11Res_(NULL)
|
||||
,pD3D11ResOrig_(NULL)
|
||||
,pQuery_(NULL)
|
||||
,subRes_(NULL)
|
||||
,plane_(NULL)
|
||||
{
|
||||
memset(&objDesc_,0,sizeof(objDesc_));
|
||||
}
|
||||
// Copy constructor
|
||||
D3D11Object(D3D11Object& d3d11obj)
|
||||
: pQuery_(NULL)
|
||||
{
|
||||
*this = d3d11obj;
|
||||
this->releaseResources_ = true;
|
||||
// Add reference to the D3D11 resource to prevent its disappearance
|
||||
if(pD3D11ResOrig_) {
|
||||
pD3D11ResOrig_->AddRef();
|
||||
}
|
||||
else if(pD3D11Res_) {
|
||||
pD3D11Res_->AddRef();
|
||||
}
|
||||
assert(pD3D11Res_ != pD3D11ResOrig_);
|
||||
}
|
||||
|
||||
//! Virtual destructor
|
||||
virtual ~D3D11Object()
|
||||
{
|
||||
ScopedLock sl(resLock_);
|
||||
if(releaseResources_) {
|
||||
// Decrement reference to the D3D11 objects
|
||||
if(pD3D11Res_) pD3D11Res_->Release();
|
||||
if(pD3D11Aux_) pD3D11Aux_->Release();
|
||||
if(pD3D11ResOrig_) pD3D11ResOrig_->Release();
|
||||
if(pQuery_) pQuery_->Release();
|
||||
// Check if this resource has already been used for interop
|
||||
if(resources_.size()) {
|
||||
for(auto& it = resources_.cbegin(); it != resources_.cend(); it++) {
|
||||
if(((pD3D11ResOrig_ && (*it).first == (void*) pD3D11ResOrig_)
|
||||
|| ((*it).first == (void*) pD3D11Res_))
|
||||
&& (*it).second.first == subRes_
|
||||
&& (*it).second.second == plane_) {
|
||||
resources_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int initD3D11Object(const Context& amdContext, ID3D11Resource* pRes, UINT subresource,
|
||||
D3D11Object& obj, INT plane = -1);
|
||||
|
||||
D3D11Object* asD3D11Object() { return this; }
|
||||
|
||||
//! D3D11Object query functions to get D3D11 info from member variables
|
||||
ID3D11Resource* getD3D11Resource() const {return pD3D11Res_;}
|
||||
ID3D11Resource* getD3D11ResOrig() const {return pD3D11ResOrig_;}
|
||||
D3D11_USAGE getUsage() const { return objDesc_.objFlags_.d3d11Usage_; }
|
||||
void setD3D11AuxRes(ID3D11Resource* pAux) {pD3D11Aux_ = pAux;}
|
||||
ID3D11Resource* getD3D11AuxRes() const {return pD3D11Aux_;}
|
||||
ID3D11Query* getQuery() const {return pQuery_;}
|
||||
Monitor& getResLock() { return resLock_;}
|
||||
UINT getWidth() const {return objDesc_.objSize_.Width;}
|
||||
UINT getHeight() const {return objDesc_.objSize_.Height;}
|
||||
UINT getDepth() const {return objDesc_.objSize_.Depth;}
|
||||
size_t getElementBytes(DXGI_FORMAT dxgiFomat, cl_uint plane);
|
||||
size_t getElementBytes() {return getElementBytes(objDesc_.dxgiFormat_, plane_);}
|
||||
DXGI_FORMAT getDxgiFormat() {return objDesc_.dxgiFormat_;}
|
||||
UINT getSubresource() const {return subRes_;}
|
||||
INT getPlane() const {return plane_;}
|
||||
const D3D11ObjDesc_t* getObjDesc() const { return &objDesc_; }
|
||||
|
||||
cl_uint getMiscFlag(void);
|
||||
//! Returns bytes per pixel > 0 if conversion successful, 0 otherwise;
|
||||
//! if formats are not compatible, cl format channel
|
||||
//! order and type are set to 0
|
||||
cl_image_format getCLFormatFromDXGI(DXGI_FORMAT dxgiFmt, cl_uint plane);
|
||||
cl_image_format getCLFormatFromDXGI()
|
||||
{
|
||||
return getCLFormatFromDXGI(objDesc_.dxgiFormat_, plane_);
|
||||
}
|
||||
size_t getResourceByteSize();
|
||||
|
||||
// On acquire copy data from original resource to shared resource
|
||||
virtual bool copyOrigToShared();
|
||||
// On release copy data from shared copy to the original resource
|
||||
virtual bool copySharedToOrig();
|
||||
};
|
||||
|
||||
//! Class BufferD3D11 is derived from classes Buffer and D3D11Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D11 object
|
||||
class BufferD3D11 : public D3D11Object, public Buffer
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'BufferD3D11' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! BufferD3D11 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
BufferD3D11(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D11Object& d3d11obj)
|
||||
: // Call base classes constructors
|
||||
D3D11Object(d3d11obj),
|
||||
Buffer(
|
||||
amdContext,
|
||||
clFlags,
|
||||
d3d11obj.getResourceByteSize())
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~BufferD3D11() {}
|
||||
};
|
||||
|
||||
//! Class Image1DD3D11 is derived from classes Image1D and D3D11Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D11 object
|
||||
class Image1DD3D11 : public D3D11Object, public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image1DD3D11' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image1DD3D11 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image1DD3D11(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D11Object& d3d11obj)
|
||||
: // Call base classes constructors
|
||||
D3D11Object(d3d11obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE1D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d11obj.getDxgiFormat(), d3d11obj.getPlane()), //format,
|
||||
d3d11obj.getWidth(),
|
||||
1,
|
||||
1,
|
||||
d3d11obj.getWidth() * d3d11obj.getElementBytes(), //rowPitch),
|
||||
0)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image1DD3D11() {}
|
||||
};
|
||||
|
||||
//! Class Image2DD3D11 is derived from classes Image2D and D3D11Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D11 object
|
||||
class Image2DD3D11 : public Image, public D3D11Object
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image2DD3D11' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image2DD3D11 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image2DD3D11(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D11Object& d3d11obj)
|
||||
: // Call base classes constructors
|
||||
D3D11Object(d3d11obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE2D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d11obj.getDxgiFormat(), d3d11obj.getPlane()), //format,
|
||||
d3d11obj.getWidth(),
|
||||
d3d11obj.getHeight(),
|
||||
1,
|
||||
d3d11obj.getWidth() * d3d11obj.getElementBytes(), //rowPitch),
|
||||
0)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image2DD3D11() {}
|
||||
};
|
||||
|
||||
//! Class Image3DD3D11 is derived from classes Image3D and D3D11Object
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for D3D11 object
|
||||
class Image3DD3D11 : public D3D11Object, public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image3DD3D11' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image2DD3D11 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image3DD3D11(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D11Object& d3d11obj)
|
||||
: // Call base classes constructors
|
||||
D3D11Object(d3d11obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE3D,
|
||||
clFlags,
|
||||
getCLFormatFromDXGI(d3d11obj.getDxgiFormat(), d3d11obj.getPlane()), //format,
|
||||
d3d11obj.getWidth(),
|
||||
d3d11obj.getHeight(),
|
||||
d3d11obj.getDepth(),
|
||||
d3d11obj.getWidth() * d3d11obj.getElementBytes(), //rowPitch),
|
||||
d3d11obj.getWidth() * d3d11obj.getHeight() * d3d11obj.getElementBytes())
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image3DD3D11() {}
|
||||
};
|
||||
|
||||
//! Functions for executing the D3D11 related stuff
|
||||
cl_mem clCreateBufferFromD3D11ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Resource* pD3DResource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage1DFromD3D11ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage2DFromD3D11ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
cl_mem clCreateImage3DFromD3D11ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Resource* pD3DResource,
|
||||
UINT subresource,
|
||||
int* errcode_ret);
|
||||
void SyncD3D11Objects(std::vector<amd::Memory*>& memObjects);
|
||||
} //namespace amd
|
||||
|
||||
#endif //CL_D3D11_AMD_HPP_
|
||||
@@ -0,0 +1,855 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "top.hpp"
|
||||
|
||||
#include "cl_d3d9_amd.hpp"
|
||||
#include "platform/command.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#define D3DFMT_NV_12 static_cast<D3DFORMAT>(MAKEFOURCC('N', 'V', '1', '2'))
|
||||
#define D3DFMT_P010 static_cast<D3DFORMAT>(MAKEFOURCC('P', '0', '1', '0'))
|
||||
#define D3DFMT_YV_12 static_cast<D3DFORMAT>(MAKEFOURCC('Y', 'V', '1', '2'))
|
||||
#define D3DFMT_YUY2 static_cast<D3DFORMAT>(MAKEFOURCC('Y', 'U', 'Y', '2'))
|
||||
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clGetDeviceIDsFromDX9MediaAdapterKHR,
|
||||
(cl_platform_id platform, cl_uint num_media_adapters,
|
||||
cl_dx9_media_adapter_type_khr* media_adapters_type, void* media_adapters,
|
||||
cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries,
|
||||
cl_device_id* devices, cl_uint* num_devices)) {
|
||||
cl_int errcode;
|
||||
// Accept an array of DX9 devices here as the spec mention of array of num_media_adapters size.
|
||||
IDirect3DDevice9Ex** d3d9_device = static_cast<IDirect3DDevice9Ex**>(media_adapters);
|
||||
cl_device_id* gpu_devices = NULL;
|
||||
cl_uint num_gpu_devices = 0;
|
||||
static const bool VALIDATE_ONLY = true;
|
||||
|
||||
if (platform != NULL && platform != AMD_PLATFORM) {
|
||||
LogWarning("\"platrform\" is not a valid AMD platform");
|
||||
return CL_INVALID_PLATFORM;
|
||||
}
|
||||
// check if input parameter are correct
|
||||
if ((num_media_adapters == 0) || (media_adapters_type == NULL) || (media_adapters == NULL) ||
|
||||
(media_adapter_set != CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR &&
|
||||
media_adapter_set != CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR) ||
|
||||
(num_entries == 0 && devices != NULL)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
// Get GPU devices
|
||||
errcode = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 0, NULL, &num_gpu_devices);
|
||||
if (errcode != CL_SUCCESS && errcode != CL_DEVICE_NOT_FOUND) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!num_gpu_devices) {
|
||||
*not_null(num_devices) = 0;
|
||||
return CL_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
switch (media_adapter_set) {
|
||||
case CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR:
|
||||
case CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR: {
|
||||
gpu_devices = new cl_device_id[num_gpu_devices];
|
||||
errcode = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, num_gpu_devices, gpu_devices, NULL);
|
||||
if (errcode != CL_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
std::vector<amd::Device*> compatible_devices;
|
||||
for (cl_uint i = 0; i < num_gpu_devices; ++i) {
|
||||
cl_device_id device = gpu_devices[i];
|
||||
amd::Context::Flags context_flag;
|
||||
amd::Context::DeviceFlagIdx devIdx;
|
||||
switch (media_adapters_type[i]) {
|
||||
case CL_ADAPTER_D3D9_KHR:
|
||||
context_flag = amd::Context::Flags::D3D9DeviceKhr;
|
||||
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceKhrIdx;
|
||||
break;
|
||||
case CL_ADAPTER_D3D9EX_KHR:
|
||||
context_flag = amd::Context::Flags::D3D9DeviceEXKhr;
|
||||
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceEXKhrIdx;
|
||||
break;
|
||||
case CL_ADAPTER_DXVA_KHR:
|
||||
context_flag = amd::Context::Flags::D3D9DeviceVAKhr;
|
||||
devIdx = amd::Context::DeviceFlagIdx::D3D9DeviceVAKhrIdx;
|
||||
break;
|
||||
}
|
||||
|
||||
for (cl_uint j = 0; j < num_media_adapters; ++j) {
|
||||
// Since there can be multiple DX9 adapters passed in the array we need to validate
|
||||
// interopability with each.
|
||||
void* external_device[amd::Context::DeviceFlagIdx::LastDeviceFlagIdx] = {};
|
||||
external_device[devIdx] = d3d9_device[j];
|
||||
|
||||
if (is_valid(device) && (media_adapters_type[j] == CL_ADAPTER_D3D9EX_KHR) &&
|
||||
as_amd(device)->bindExternalDevice(context_flag, external_device, NULL,
|
||||
VALIDATE_ONLY)) {
|
||||
compatible_devices.push_back(as_amd(device));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (compatible_devices.size() == 0) {
|
||||
*not_null(num_devices) = 0;
|
||||
errcode = CL_DEVICE_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
|
||||
auto it = compatible_devices.cbegin();
|
||||
cl_uint compatible_count = std::min(num_entries, (cl_uint)compatible_devices.size());
|
||||
|
||||
while (compatible_count--) {
|
||||
*devices++ = as_cl(*it++);
|
||||
--num_entries;
|
||||
}
|
||||
while (num_entries--) {
|
||||
*devices++ = (cl_device_id)0;
|
||||
}
|
||||
|
||||
*not_null(num_devices) = (cl_uint)compatible_devices.size();
|
||||
} break;
|
||||
|
||||
default:
|
||||
LogWarning("\"d3d9_device_set\" is invalid");
|
||||
errcode = CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
delete[] gpu_devices;
|
||||
return errcode;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY_RET(cl_mem, clCreateFromDX9MediaSurfaceKHR,
|
||||
(cl_context context, cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type, void* surface_info, cl_uint plane,
|
||||
cl_int* errcode_ret)) {
|
||||
cl_mem clMemObj = NULL;
|
||||
|
||||
cl_dx9_surface_info_khr* cl_surf_info = NULL;
|
||||
|
||||
if (!is_valid(context)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
LogWarning("invalid parameter \"context\"");
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
if (!flags) flags = CL_MEM_READ_WRITE;
|
||||
if (!(((flags & CL_MEM_READ_ONLY) == CL_MEM_READ_ONLY) ||
|
||||
((flags & CL_MEM_WRITE_ONLY) == CL_MEM_WRITE_ONLY) ||
|
||||
((flags & CL_MEM_READ_WRITE) == CL_MEM_READ_WRITE))) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid parameter \"flags\"");
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
if ((adapter_type != CL_ADAPTER_D3D9_KHR) && (adapter_type != CL_ADAPTER_D3D9EX_KHR) &&
|
||||
(adapter_type != CL_ADAPTER_DXVA_KHR)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
if (!surface_info) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("parameter \"pD3DResource\" is a NULL pointer");
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
cl_surf_info = (cl_dx9_surface_info_khr*)surface_info;
|
||||
IDirect3DSurface9* pD3D9Resource = cl_surf_info->resource;
|
||||
HANDLE shared_handle = cl_surf_info->shared_handle;
|
||||
|
||||
if (!pD3D9Resource) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("parameter \"surface_info\" is a NULL pointer");
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
D3DSURFACE_DESC Desc;
|
||||
pD3D9Resource->GetDesc(&Desc);
|
||||
|
||||
if ((Desc.Format != D3DFMT_NV_12) &&
|
||||
(Desc.Format != D3DFMT_P010) &&
|
||||
(Desc.Format != D3DFMT_YV_12) && (plane != 0)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("The plane has to be Zero if the surface format is non-planar !");
|
||||
return clMemObj;
|
||||
}
|
||||
|
||||
// Check for image support
|
||||
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
||||
bool supportPass = false;
|
||||
bool sizePass = false;
|
||||
for (const auto& it : devices) {
|
||||
if (it->info().imageSupport_) {
|
||||
supportPass = true;
|
||||
}
|
||||
}
|
||||
if (!supportPass) {
|
||||
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
||||
LogWarning("there are no devices in context to support images");
|
||||
return (cl_mem)0;
|
||||
}
|
||||
// Verify the resource is a 2D image
|
||||
return amd::clCreateImage2DFromD3D9ResourceAMD(*as_amd(context), flags, adapter_type,
|
||||
cl_surf_info, plane, errcode_ret);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueAcquireDX9MediaSurfacesKHR,
|
||||
(cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event)) {
|
||||
return amd::clEnqueueAcquireExtObjectsAMD(command_queue, num_objects, mem_objects,
|
||||
num_events_in_wait_list, event_wait_list, event,
|
||||
CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueReleaseDX9MediaSurfacesKHR,
|
||||
(cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event)) {
|
||||
return amd::clEnqueueReleaseExtObjectsAMD(command_queue, num_objects, mem_objects,
|
||||
num_events_in_wait_list, event_wait_list, event,
|
||||
CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
//
|
||||
//
|
||||
// namespace amd
|
||||
//
|
||||
//
|
||||
namespace amd {
|
||||
/*! @}
|
||||
* \addtogroup CL-D3D9 interop helper functions
|
||||
* @{
|
||||
*/
|
||||
//
|
||||
// Class D3D9Object implementation
|
||||
//
|
||||
std::vector<std::pair<TD3D9RESINFO, TD3D9RESINFO>> D3D9Object::resources_;
|
||||
Monitor D3D9Object::resLock_;
|
||||
|
||||
//
|
||||
// clCreateImage2DFromD3D9ResourceAMD
|
||||
//
|
||||
cl_mem clCreateImage2DFromD3D9ResourceAMD(Context& amdContext, cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
cl_dx9_surface_info_khr* surface_info, cl_uint plane,
|
||||
int* errcode_ret) {
|
||||
cl_dx9_surface_info_khr* cl_surf_info = reinterpret_cast<cl_dx9_surface_info_khr*>(surface_info);
|
||||
IDirect3DSurface9* pD3D9Resource = cl_surf_info->resource;
|
||||
HANDLE shared_handle = cl_surf_info->shared_handle;
|
||||
|
||||
D3D9Object obj;
|
||||
cl_int errcode = D3D9Object::initD3D9Object(amdContext, adapter_type, surface_info, plane, obj);
|
||||
if (CL_SUCCESS != errcode) {
|
||||
*not_null(errcode_ret) = errcode;
|
||||
return (cl_mem)0;
|
||||
}
|
||||
|
||||
Image2DD3D9* pImage2DD3D9 = new (amdContext) Image2DD3D9(amdContext, flags, obj);
|
||||
if (!pImage2DD3D9) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
return (cl_mem)0;
|
||||
}
|
||||
if (!pImage2DD3D9->create()) {
|
||||
*not_null(errcode_ret) = CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||
pImage2DD3D9->release();
|
||||
return (cl_mem)0;
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl<Memory>(pImage2DD3D9);
|
||||
}
|
||||
|
||||
//
|
||||
// Helper function SyncD3D9Objects
|
||||
//
|
||||
void SyncD3D9Objects(std::vector<amd::Memory*>& memObjects) {
|
||||
Memory*& mem = memObjects.front();
|
||||
if (!mem) {
|
||||
LogWarning("\nNULL memory object\n");
|
||||
return;
|
||||
}
|
||||
InteropObject* interop = mem->getInteropObj();
|
||||
if (!interop) {
|
||||
LogWarning("\nNULL interop object\n");
|
||||
return;
|
||||
}
|
||||
D3D9Object* d3d9Obj = interop->asD3D9Object();
|
||||
if (!d3d9Obj) {
|
||||
LogWarning("\nNULL D3D9 object\n");
|
||||
return;
|
||||
}
|
||||
IDirect3DQuery9* query = d3d9Obj->getQuery();
|
||||
if (!query) {
|
||||
LogWarning("\nNULL IDirect3DQuery9\n");
|
||||
return;
|
||||
}
|
||||
ScopedLock sl(d3d9Obj->getResLock());
|
||||
query->Issue(D3DISSUE_END);
|
||||
BOOL data = FALSE;
|
||||
while (S_OK != query->GetData(&data, sizeof(BOOL), D3DGETDATA_FLUSH)) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Class D3D10Object implementation
|
||||
//
|
||||
size_t D3D9Object::getElementBytes(D3DFORMAT d3d9Format, cl_uint plane) {
|
||||
size_t bytesPerPixel;
|
||||
|
||||
switch (d3d9Format) {
|
||||
case D3DFMT_UNKNOWN:
|
||||
case D3DFMT_UYVY:
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
case D3DFMT_VERTEXDATA:
|
||||
case D3DFMT_D32:
|
||||
case D3DFMT_D15S1:
|
||||
case D3DFMT_D24S8:
|
||||
case D3DFMT_D24X8:
|
||||
case D3DFMT_D24X4S4:
|
||||
case D3DFMT_D16:
|
||||
case D3DFMT_INDEX16:
|
||||
case D3DFMT_INDEX32:
|
||||
case D3DFMT_MULTI2_ARGB8:
|
||||
case D3DFMT_CxV8U8:
|
||||
// Less than 1 byte per pixel - needs special consideration
|
||||
bytesPerPixel = 0;
|
||||
break;
|
||||
|
||||
case D3DFMT_R3G3B2:
|
||||
case D3DFMT_P8:
|
||||
case D3DFMT_A8:
|
||||
case D3DFMT_L8:
|
||||
case D3DFMT_A4L4:
|
||||
bytesPerPixel = 1;
|
||||
break;
|
||||
|
||||
case D3DFMT_R16F:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case D3DFMT_A8R3G3B2:
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_A8P8:
|
||||
case D3DFMT_A8L8:
|
||||
case D3DFMT_V8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
case D3DFMT_D16_LOCKABLE:
|
||||
case D3DFMT_L16:
|
||||
bytesPerPixel = 2;
|
||||
break;
|
||||
|
||||
case D3DFMT_R8G8B8:
|
||||
case D3DFMT_D24FS8:
|
||||
bytesPerPixel = 3;
|
||||
break;
|
||||
|
||||
case D3DFMT_D32F_LOCKABLE:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_R32F:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A2B10G10R10:
|
||||
case D3DFMT_A8B8G8R8:
|
||||
case D3DFMT_X8B8G8R8:
|
||||
case D3DFMT_G16R16:
|
||||
case D3DFMT_A2R10G10B10:
|
||||
case D3DFMT_Q8W8V8U8:
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_V16U16:
|
||||
case D3DFMT_A2W10V10U10:
|
||||
case D3DFMT_R8G8_B8G8:
|
||||
case D3DFMT_G8R8_G8B8:
|
||||
case D3DFMT_G16R16F:
|
||||
case D3DFMT_YUY2:
|
||||
bytesPerPixel = 4;
|
||||
break;
|
||||
|
||||
case D3DFMT_G32R32F:
|
||||
case D3DFMT_A16B16G16R16:
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
case D3DFMT_Q16W16V16U16:
|
||||
bytesPerPixel = 8;
|
||||
break;
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
bytesPerPixel = 16;
|
||||
break;
|
||||
//#if !defined(D3D_DISABLE_9EX)
|
||||
// case D3DFMT_D32_LOCKABLE:
|
||||
// case D3DFMT_S8_LOCKABLE:
|
||||
//#endif // !D3D_DISABLE_9EX
|
||||
case D3DFMT_NV_12:
|
||||
if (plane == 0) {
|
||||
bytesPerPixel = 1;
|
||||
} else if (plane == 1) {
|
||||
bytesPerPixel = 2;
|
||||
} // plane != 0 or != 1 shouldn't happen here
|
||||
break;
|
||||
case D3DFMT_P010:
|
||||
if (plane == 0) {
|
||||
bytesPerPixel = 2;
|
||||
} else if (plane == 1) {
|
||||
bytesPerPixel = 4;
|
||||
} // plane != 0 or != 1 shouldn't happen here
|
||||
break;
|
||||
case D3DFMT_YV_12:
|
||||
bytesPerPixel = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
bytesPerPixel = 0;
|
||||
_ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
return bytesPerPixel;
|
||||
}
|
||||
|
||||
void setObjDesc(amd::D3D9ObjDesc_t& objDesc, D3DSURFACE_DESC& resDesc, cl_uint plane) {
|
||||
objDesc.d3dPool_ = resDesc.Pool;
|
||||
objDesc.resType_ = resDesc.Type;
|
||||
objDesc.usage_ = resDesc.Usage;
|
||||
objDesc.d3dFormat_ = resDesc.Format;
|
||||
switch (resDesc.Format) {
|
||||
case D3DFMT_NV_12:
|
||||
case D3DFMT_P010:
|
||||
objDesc.surfRect_.left = 0;
|
||||
objDesc.surfRect_.top = 0;
|
||||
if (plane == 0) {
|
||||
objDesc.objSize_.Height = resDesc.Height;
|
||||
objDesc.objSize_.Width = resDesc.Width;
|
||||
objDesc.surfRect_.right = resDesc.Width; // resDesc.Width/2-1;
|
||||
objDesc.surfRect_.bottom = 3 * resDesc.Height / 2;
|
||||
; // 3*resDesc.Height/2-1;
|
||||
} else if (plane == 1) {
|
||||
objDesc.objSize_.Height = resDesc.Height / 2;
|
||||
objDesc.objSize_.Width = resDesc.Width / 2;
|
||||
objDesc.surfRect_.right = resDesc.Width; // resDesc.Width/2-1;
|
||||
objDesc.surfRect_.bottom = 3 * resDesc.Height / 2;
|
||||
; // 3*resDesc.Height/2-1;
|
||||
} // plane != 0 or != 1 shouldn't happen here
|
||||
break;
|
||||
case D3DFMT_YV_12:
|
||||
objDesc.surfRect_.left = 0;
|
||||
if (plane == 0) {
|
||||
objDesc.objSize_.Height = resDesc.Height;
|
||||
objDesc.objSize_.Width = resDesc.Width;
|
||||
objDesc.surfRect_.top = 0;
|
||||
objDesc.surfRect_.right = resDesc.Width - 1;
|
||||
objDesc.surfRect_.bottom = resDesc.Height - 1;
|
||||
} else if (plane == 1) {
|
||||
objDesc.objSize_.Height = resDesc.Height / 2;
|
||||
objDesc.objSize_.Width = resDesc.Width / 2;
|
||||
objDesc.surfRect_.top = resDesc.Height;
|
||||
objDesc.surfRect_.right = resDesc.Width / 2 - 1;
|
||||
objDesc.surfRect_.bottom = 3 * resDesc.Height / 2 - 1;
|
||||
} else if (plane == 2) {
|
||||
objDesc.objSize_.Height = resDesc.Height / 2;
|
||||
objDesc.objSize_.Width = resDesc.Width / 2;
|
||||
objDesc.surfRect_.top = 3 * resDesc.Height / 2;
|
||||
objDesc.surfRect_.right = resDesc.Width / 2 - 1;
|
||||
objDesc.surfRect_.bottom = 2 * resDesc.Height - 1;
|
||||
} // plane > 0 or > 2 shouldn't happen here
|
||||
break;
|
||||
default:
|
||||
objDesc.objSize_.Height = resDesc.Height;
|
||||
objDesc.objSize_.Width = resDesc.Width;
|
||||
objDesc.surfRect_.left = 0;
|
||||
objDesc.surfRect_.top = 0;
|
||||
objDesc.surfRect_.right = resDesc.Width - 1;
|
||||
objDesc.surfRect_.bottom = resDesc.Height - 1;
|
||||
if (resDesc.Format == D3DFMT_YUY2) {
|
||||
objDesc.objSize_.Width >>= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int D3D9Object::initD3D9Object(const Context& amdContext,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
cl_dx9_surface_info_khr* cl_surf_info, cl_uint plane,
|
||||
D3D9Object& obj) {
|
||||
ScopedLock sl(resLock_);
|
||||
|
||||
IDirect3DDevice9Ex* pDev9Ex = NULL;
|
||||
cl_int errcode = CL_SUCCESS;
|
||||
|
||||
// Check if this ressource has already been used for interop
|
||||
IDirect3DSurface9* pD3D9res = cl_surf_info->resource;
|
||||
HANDLE shared_handle = cl_surf_info->shared_handle;
|
||||
|
||||
if ((adapter_type == CL_ADAPTER_D3D9_KHR) || (adapter_type == CL_ADAPTER_DXVA_KHR)) {
|
||||
return CL_INVALID_DX9_MEDIA_ADAPTER_KHR; // Not supported yet
|
||||
}
|
||||
|
||||
for (const auto& it : resources_) {
|
||||
if (it.first.surfInfo.resource == cl_surf_info->resource && it.first.surfPlane == plane) {
|
||||
return CL_INVALID_D3D9_RESOURCE_KHR;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT hr;
|
||||
D3DQUERYTYPE desc = D3DQUERYTYPE_EVENT;
|
||||
|
||||
D3DSURFACE_DESC resDesc;
|
||||
if (D3D_OK != pD3D9res->GetDesc(&resDesc)) {
|
||||
return CL_INVALID_D3D9_RESOURCE_KHR;
|
||||
}
|
||||
|
||||
hr = pD3D9res->GetContainer(IID_IDirect3DDevice9Ex, (void**)&pDev9Ex);
|
||||
if (hr == D3D_OK) {
|
||||
pDev9Ex->CreateQuery(desc, &(obj.pQuery_));
|
||||
} else {
|
||||
return CL_INVALID_D3D9_RESOURCE_KHR; // d3d9ex should be supported
|
||||
}
|
||||
|
||||
obj.handleShared_ = shared_handle;
|
||||
obj.surfPlane_ = plane;
|
||||
obj.surfInfo_ = *cl_surf_info;
|
||||
obj.adapterType_ = adapter_type;
|
||||
|
||||
// Init defaults
|
||||
setObjDesc(obj.objDescOrig_, resDesc, plane);
|
||||
obj.objDesc_ = obj.objDescOrig_;
|
||||
|
||||
// shared handle cases if the shared_handle is NULL
|
||||
// first check if the format is NV12 or YV12, which we need special handling
|
||||
if (NULL == shared_handle) {
|
||||
bool found = false;
|
||||
for (const auto& it : resources_) {
|
||||
if (it.first.surfInfo.resource == cl_surf_info->resource &&
|
||||
it.first.surfPlane != plane) {
|
||||
obj.handleShared_ = it.second.surfInfo.shared_handle;
|
||||
obj.pD3D9Res_ = it.second.surfInfo.resource;
|
||||
obj.pD3D9Res_->AddRef();
|
||||
obj.objDesc_ = obj.objDescOrig_;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
obj.handleShared_ = 0;
|
||||
hr = pDev9Ex->CreateOffscreenPlainSurface(resDesc.Width, resDesc.Height, resDesc.Format,
|
||||
resDesc.Pool, &obj.pD3D9Res_, &obj.handleShared_);
|
||||
|
||||
if (D3D_OK != hr) {
|
||||
errcode = CL_INVALID_D3D9_RESOURCE_KHR;
|
||||
}
|
||||
}
|
||||
|
||||
// put the original info into the obj
|
||||
obj.pD3D9ResOrig_ = pD3D9res;
|
||||
obj.pD3D9ResOrig_->AddRef(); // addRef in case lost the resource
|
||||
} else {
|
||||
// Share the original resource
|
||||
obj.pD3D9ResOrig_ = NULL;
|
||||
obj.pD3D9Res_ = pD3D9res;
|
||||
obj.pD3D9Res_->AddRef();
|
||||
}
|
||||
|
||||
// Release the Ex interface
|
||||
if (pDev9Ex) pDev9Ex->Release();
|
||||
|
||||
// Check for CL format compatibilty
|
||||
if (obj.objDesc_.resType_ == D3DRTYPE_SURFACE) {
|
||||
cl_image_format clFmt = obj.getCLFormatFromD3D9(obj.objDesc_.d3dFormat_, plane);
|
||||
amd::Image::Format imageFormat(clFmt);
|
||||
if (!imageFormat.isSupported(amdContext)) {
|
||||
return CL_INVALID_IMAGE_FORMAT_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
|
||||
TD3D9RESINFO d3d9ObjOri = {*cl_surf_info, plane};
|
||||
TD3D9RESINFO d3d9ObjShared = {{obj.pD3D9Res_, obj.handleShared_}, plane};
|
||||
|
||||
if (errcode == CL_SUCCESS) {
|
||||
resources_.push_back({d3d9ObjOri, d3d9ObjShared});
|
||||
}
|
||||
|
||||
return errcode;
|
||||
}
|
||||
cl_uint D3D9Object::getMiscFlag() {
|
||||
switch (objDescOrig_.d3dFormat_) {
|
||||
case D3DFMT_NV_12:
|
||||
case D3DFMT_P010:
|
||||
return 1;
|
||||
break;
|
||||
case D3DFMT_YV_12:
|
||||
return 2;
|
||||
break;
|
||||
case D3DFMT_YUY2:
|
||||
return 3;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cl_image_format D3D9Object::getCLFormatFromD3D9() {
|
||||
return getCLFormatFromD3D9(objDesc_.d3dFormat_, surfPlane_);
|
||||
}
|
||||
|
||||
cl_image_format D3D9Object::getCLFormatFromD3D9(D3DFORMAT d3d9Fmt, cl_uint plane) {
|
||||
cl_image_format fmt;
|
||||
|
||||
fmt.image_channel_order = 0; // CL_RGBA;
|
||||
fmt.image_channel_data_type = 0; // CL_UNSIGNED_INT8;
|
||||
|
||||
switch (d3d9Fmt) {
|
||||
case D3DFMT_R32F:
|
||||
fmt.image_channel_order = CL_R;
|
||||
fmt.image_channel_data_type = CL_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_R16F:
|
||||
fmt.image_channel_order = CL_R;
|
||||
fmt.image_channel_data_type = CL_HALF_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_L16:
|
||||
fmt.image_channel_order = CL_R;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT16;
|
||||
break;
|
||||
|
||||
case D3DFMT_A8:
|
||||
fmt.image_channel_order = CL_A;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_L8:
|
||||
fmt.image_channel_order = CL_R;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_G32R32F:
|
||||
fmt.image_channel_order = CL_RG;
|
||||
fmt.image_channel_data_type = CL_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_G16R16F:
|
||||
fmt.image_channel_order = CL_RG;
|
||||
fmt.image_channel_data_type = CL_HALF_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_G16R16:
|
||||
fmt.image_channel_order = CL_RG;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT16;
|
||||
break;
|
||||
|
||||
case D3DFMT_A8L8:
|
||||
fmt.image_channel_order = CL_RG;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_HALF_FLOAT;
|
||||
break;
|
||||
|
||||
case D3DFMT_A16B16G16R16:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT16;
|
||||
break;
|
||||
|
||||
case D3DFMT_A8B8G8R8:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_X8B8G8R8:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_A8R8G8B8:
|
||||
fmt.image_channel_order = CL_BGRA;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
|
||||
case D3DFMT_X8R8G8B8:
|
||||
fmt.image_channel_order = CL_BGRA;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
case D3DFMT_NV_12:
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
if (plane == 0) {
|
||||
fmt.image_channel_order = CL_R;
|
||||
} else if (plane == 1) {
|
||||
fmt.image_channel_order = CL_RG;
|
||||
}
|
||||
break;
|
||||
case D3DFMT_P010:
|
||||
fmt.image_channel_data_type = CL_UNORM_INT16;
|
||||
if (plane == 0) {
|
||||
fmt.image_channel_order = CL_R;
|
||||
} else if (plane == 1) {
|
||||
fmt.image_channel_order = CL_RG;
|
||||
}
|
||||
break;
|
||||
case D3DFMT_YV_12:
|
||||
fmt.image_channel_order = CL_R;
|
||||
fmt.image_channel_data_type = CL_UNORM_INT8;
|
||||
break;
|
||||
case D3DFMT_YUY2:
|
||||
fmt.image_channel_order = CL_RGBA;
|
||||
fmt.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
break;
|
||||
case D3DFMT_UNKNOWN:
|
||||
case D3DFMT_R8G8B8:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case D3DFMT_R3G3B2:
|
||||
case D3DFMT_A8R3G3B2:
|
||||
case D3DFMT_X4R4G4B4:
|
||||
case D3DFMT_A2B10G10R10:
|
||||
case D3DFMT_A2R10G10B10:
|
||||
case D3DFMT_A8P8:
|
||||
case D3DFMT_P8:
|
||||
case D3DFMT_A4L4:
|
||||
case D3DFMT_V8U8:
|
||||
case D3DFMT_L6V5U5:
|
||||
case D3DFMT_X8L8V8U8:
|
||||
case D3DFMT_Q8W8V8U8:
|
||||
case D3DFMT_V16U16:
|
||||
case D3DFMT_A2W10V10U10:
|
||||
case D3DFMT_UYVY:
|
||||
case D3DFMT_R8G8_B8G8:
|
||||
case D3DFMT_G8R8_G8B8:
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT2:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT4:
|
||||
case D3DFMT_DXT5:
|
||||
case D3DFMT_D16_LOCKABLE:
|
||||
case D3DFMT_D32:
|
||||
case D3DFMT_D15S1:
|
||||
case D3DFMT_D24S8:
|
||||
case D3DFMT_D24X8:
|
||||
case D3DFMT_D24X4S4:
|
||||
case D3DFMT_D16:
|
||||
case D3DFMT_D32F_LOCKABLE:
|
||||
case D3DFMT_D24FS8:
|
||||
//#if !defined(D3D_DISABLE_9EX)
|
||||
case D3DFMT_D32_LOCKABLE:
|
||||
case D3DFMT_S8_LOCKABLE:
|
||||
//#endif // !D3D_DISABLE_9EX
|
||||
case D3DFMT_VERTEXDATA:
|
||||
case D3DFMT_INDEX16:
|
||||
case D3DFMT_INDEX32:
|
||||
case D3DFMT_Q16W16V16U16:
|
||||
case D3DFMT_MULTI2_ARGB8:
|
||||
case D3DFMT_CxV8U8:
|
||||
//#if !defined(D3D_DISABLE_9EX)
|
||||
case D3DFMT_A1:
|
||||
case D3DFMT_A2B10G10R10_XR_BIAS:
|
||||
case D3DFMT_BINARYBUFFER:
|
||||
_ASSERT(FALSE); // NOT SURPPORTED
|
||||
break;
|
||||
//#endif // !D3D_DISABLE_9EX
|
||||
default:
|
||||
_ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
bool D3D9Object::copyOrigToShared() {
|
||||
// Don't copy if there is no orig
|
||||
if (NULL == getD3D9ResOrig()) return true;
|
||||
|
||||
IDirect3DDevice9Ex* d3dDev;
|
||||
HRESULT hr;
|
||||
ScopedLock sl(getResLock());
|
||||
|
||||
IDirect3DSurface9* srcSurf = getD3D9ResOrig();
|
||||
IDirect3DSurface9* dstSurf = getD3D9Resource();
|
||||
|
||||
hr = getD3D9Resource()->GetContainer(IID_IDirect3DDevice9Ex, (void**)&d3dDev);
|
||||
if (hr != D3D_OK || !d3dDev) {
|
||||
LogError("\nCannot get D3D9 device from D3D9 surface\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = d3dDev->StretchRect(srcSurf, NULL, dstSurf, NULL, D3DTEXF_NONE);
|
||||
if (hr != D3D_OK) {
|
||||
LogError("\ncopy original surface to shared surface failed\n");
|
||||
return false;
|
||||
}
|
||||
// Flush D3D queues and make sure D3D stuff is finished
|
||||
pQuery_->Issue(D3DISSUE_END);
|
||||
BOOL data;
|
||||
while ((D3D_OK != pQuery_->GetData(&data, sizeof(BOOL), D3DGETDATA_FLUSH)) && (data != TRUE)) {
|
||||
}
|
||||
|
||||
if (d3dDev) d3dDev->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool D3D9Object::copySharedToOrig() {
|
||||
// Don't copy if there is no orig
|
||||
if (NULL == getD3D9ResOrig()) return true;
|
||||
|
||||
IDirect3DDevice9Ex* d3dDev;
|
||||
HRESULT hr;
|
||||
ScopedLock sl(getResLock());
|
||||
|
||||
hr = getD3D9Resource()->GetContainer(IID_IDirect3DDevice9Ex, (void**)&d3dDev);
|
||||
if (hr != D3D_OK || !d3dDev) {
|
||||
LogError("\nCannot get D3D9 device from D3D9 surface\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = d3dDev->StretchRect(getD3D9Resource(), NULL, getD3D9ResOrig(), NULL, D3DTEXF_NONE);
|
||||
if (hr != D3D_OK) {
|
||||
LogError("\ncopy shared surface to original surface failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d3dDev) d3dDev->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Image2DD3D9::initDeviceMemory() {
|
||||
deviceMemories_ =
|
||||
reinterpret_cast<DeviceMemory*>(reinterpret_cast<char*>(this) + sizeof(Image2DD3D9));
|
||||
memset(deviceMemories_, 0, context_().devices().size() * sizeof(DeviceMemory));
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
|
||||
#endif //_WIN32
|
||||
@@ -0,0 +1,218 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
/* $Revision$ on $Date$ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D9_AMD_H
|
||||
#define __OPENCL_CL_D3D9_AMD_H
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
/* cl_amd_d3d9_sharing extension */
|
||||
#define cl_amd_d3d9_sharing 1
|
||||
|
||||
/* cl_amd_d3d9_sharing error codes */
|
||||
#define CL_INVALID_D3D9_DEVICE_KHR -1021
|
||||
#define CL_INVALID_D3D9_RESOURCE_KHR -1022
|
||||
|
||||
/* cl_amd_d3d9_sharing enumerations */
|
||||
#define CL_CONTEXT_D3D9_DEVICE_KHR 0x4039
|
||||
|
||||
namespace amd
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
UINT ByteWidth;
|
||||
UINT Width;
|
||||
};
|
||||
UINT Height;
|
||||
UINT Depth;
|
||||
} D3D9ObjSize_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
D3D9ObjSize_t objSize_;
|
||||
D3DFORMAT d3dFormat_;
|
||||
D3DRESOURCETYPE resType_;
|
||||
UINT usage_;
|
||||
D3DPOOL d3dPool_;
|
||||
D3DMULTISAMPLE_TYPE msType_;
|
||||
UINT msQuality_;
|
||||
UINT mipLevels_;
|
||||
UINT fvf_;
|
||||
RECT surfRect_;
|
||||
} D3D9ObjDesc_t;
|
||||
|
||||
typedef struct d3d9ResInfo {
|
||||
cl_dx9_surface_info_khr surfInfo;
|
||||
cl_uint surfPlane;
|
||||
} TD3D9RESINFO;
|
||||
|
||||
|
||||
//typedef std::pair<cl_dx9_surface_info_khr, D3D9Object*> TD3D9OBJINFO;
|
||||
|
||||
//! Class D3D9Object keeps all the info about the D3D9 object
|
||||
//! from which the CL object is created
|
||||
class D3D9Object : public InteropObject
|
||||
{
|
||||
private:
|
||||
IDirect3DSurface9* pD3D9Aux_;
|
||||
cl_int cliChecksum_;
|
||||
bool releaseResources_;
|
||||
static bool createSharedResource(D3D9Object& obj);
|
||||
static std::vector<std::pair<TD3D9RESINFO, TD3D9RESINFO>> resources_;
|
||||
|
||||
//!Global lock
|
||||
static Monitor resLock_;
|
||||
cl_uint surfPlane_;
|
||||
cl_dx9_surface_info_khr surfInfo_;
|
||||
|
||||
protected:
|
||||
IDirect3DSurface9* pD3D9Res_;
|
||||
IDirect3DSurface9* pD3D9ResOrig_;
|
||||
IDirect3DQuery9* pQuery_;
|
||||
D3D9ObjDesc_t objDesc_;
|
||||
D3D9ObjDesc_t objDescOrig_;
|
||||
HANDLE handleOrig_;
|
||||
HANDLE handleShared_;
|
||||
RECT srcSurfRect;
|
||||
RECT SharedSurfRect;
|
||||
cl_dx9_media_adapter_type_khr adapterType_;
|
||||
|
||||
public:
|
||||
//! D3D9Object constructor initializes memeber variables
|
||||
D3D9Object()
|
||||
: releaseResources_(false),
|
||||
pQuery_(NULL)
|
||||
{
|
||||
// @todo Incorrect initialization!!!
|
||||
memset(this, 0, sizeof(D3D9Object));
|
||||
}
|
||||
//copy constructor
|
||||
D3D9Object(D3D9Object& d3d9obj)
|
||||
:pQuery_(NULL)
|
||||
{
|
||||
*this = d3d9obj;
|
||||
this->releaseResources_ = true;
|
||||
}
|
||||
|
||||
//virtual destructor
|
||||
virtual ~D3D9Object()
|
||||
{
|
||||
ScopedLock sl(resLock_);
|
||||
if(releaseResources_) {
|
||||
if(pD3D9ResOrig_) pD3D9ResOrig_->Release();
|
||||
if(pD3D9Res_) pD3D9Res_->Release();
|
||||
if(pD3D9Aux_) pD3D9Aux_->Release();
|
||||
if(pQuery_) pQuery_->Release();
|
||||
//if the resouce is being used
|
||||
if(resources_.size()) {
|
||||
for(auto& it = resources_.cbegin(); it != resources_.cend(); it++) {
|
||||
if( surfInfo_.resource &&
|
||||
((*it).first.surfInfo.resource == surfInfo_.resource) &&
|
||||
((*it).first.surfPlane == surfPlane_)) {
|
||||
resources_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static int initD3D9Object(const Context& amdContext, cl_dx9_media_adapter_type_khr adapter_type,
|
||||
cl_dx9_surface_info_khr* cl_surf_info, cl_uint plane, D3D9Object& obj);
|
||||
cl_uint getMiscFlag(void);
|
||||
|
||||
D3D9Object* asD3D9Object() {return this;}
|
||||
IDirect3DSurface9* getD3D9Resource() const {return pD3D9Res_;}
|
||||
HANDLE getD3D9SharedHandle() const {return handleShared_;}
|
||||
IDirect3DSurface9* getD3D9ResOrig() const {return pD3D9ResOrig_;}
|
||||
RECT* getSrcSurfRect() {return &objDesc_.surfRect_;}
|
||||
RECT* getSharedSurfRect() {return &objDescOrig_.surfRect_;}
|
||||
void setD3D9AuxRes(IDirect3DSurface9* pAux) {pD3D9Aux_ = pAux;}
|
||||
IDirect3DSurface9* getD3D9AuxRes() {return pD3D9Aux_;}
|
||||
IDirect3DQuery9* getQuery() const {return pQuery_;}
|
||||
Monitor & getResLock() { return resLock_;}
|
||||
UINT getWidth() const {return objDesc_.objSize_.Width;}
|
||||
UINT getHeight() const {return objDesc_.objSize_.Height;}
|
||||
cl_uint getPlane() const {return surfPlane_;}
|
||||
cl_dx9_media_adapter_type_khr getAdapterType() const { return adapterType_;};
|
||||
const cl_dx9_surface_info_khr& getSurfInfo() const {return surfInfo_;};
|
||||
size_t getElementBytes(D3DFORMAT d3d9Format, cl_uint plane);
|
||||
size_t getElementBytes() {return getElementBytes(objDesc_.d3dFormat_, surfPlane_);}
|
||||
D3DFORMAT getD3D9Format() {return objDesc_.d3dFormat_;}
|
||||
D3D9ObjDesc_t* getObjDesc() {return &objDesc_;}
|
||||
cl_image_format getCLFormatFromD3D9();
|
||||
cl_image_format getCLFormatFromD3D9(D3DFORMAT d3d9Fmt, cl_uint plane);
|
||||
// On acquire copy data from original resource to shared resource
|
||||
virtual bool copyOrigToShared();
|
||||
// On release copy data from shared copy to the original resource
|
||||
virtual bool copySharedToOrig();
|
||||
};
|
||||
|
||||
class Image2DD3D9 : public D3D9Object , public Image
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'Image2DD3D9' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! Image2DD3D9 constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
Image2DD3D9(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
D3D9Object& d3d9obj)
|
||||
: // Call base classes constructors
|
||||
D3D9Object(d3d9obj),
|
||||
Image(
|
||||
amdContext,
|
||||
CL_MEM_OBJECT_IMAGE2D,
|
||||
clFlags,
|
||||
d3d9obj.getCLFormatFromD3D9(),
|
||||
d3d9obj.getWidth(),
|
||||
d3d9obj.getHeight(),
|
||||
1,
|
||||
d3d9obj.getWidth() * d3d9obj.getElementBytes(), //rowPitch),
|
||||
0)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~Image2DD3D9() {}
|
||||
};
|
||||
|
||||
cl_mem clCreateImage2DFromD3D9ResourceAMD(
|
||||
Context& amdContext,
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
cl_dx9_surface_info_khr* surface_info,
|
||||
cl_uint plane,
|
||||
int* errcode_ret);
|
||||
|
||||
void SyncD3D9Objects(std::vector<amd::Memory*>& memObjects);
|
||||
|
||||
} //namespace amd
|
||||
|
||||
#endif /* __OPENCL_CL_D3D9_AMD_H */
|
||||
@@ -0,0 +1,496 @@
|
||||
/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "vdi_common.hpp"
|
||||
#include "device/device.hpp"
|
||||
#include "platform/runtime.hpp"
|
||||
#include "utils/versions.hpp"
|
||||
#include "os/os.hpp"
|
||||
#include "cl_semaphore_amd.h"
|
||||
|
||||
#include "CL/cl_ext.h"
|
||||
|
||||
#include <cstdlib> // for alloca
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup CL_PlatformInfo
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief Get the list of available platforms.
|
||||
*
|
||||
* \param num_entries is the number of cl_platform_id entries that can be added
|
||||
* to platforms. If \a platforms is not NULL, the \a num_entries must be greater
|
||||
* than zero.
|
||||
*
|
||||
* \param platforms returns a list of OpenCL platforms found. The cl_platform_id
|
||||
* values returned in \a platforms can be used to identify a specific OpenCL
|
||||
* platform. If \a platforms argument is NULL, this argument is ignored. The
|
||||
* number of OpenCL platforms returned is the mininum of the value specified by
|
||||
* \a num_entries or the number of OpenCL platforms available.
|
||||
*
|
||||
* \param num_platforms returns the number of OpenCL platforms available. If
|
||||
* \a num_platforms is NULL, this argument is ignored.
|
||||
*
|
||||
* \return CL_INVALID_VALUE if num_entries is equal to zero and platforms is not
|
||||
* NULL or if both num_platforms and platforms are NULL, and returns CL_SUCCESS
|
||||
* if the function is executed successfully.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clGetPlatformIDs,
|
||||
(cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms)) {
|
||||
if (!amd::Runtime::initialized()) {
|
||||
amd::Runtime::init();
|
||||
}
|
||||
|
||||
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL) ||
|
||||
(num_entries == 0 && platforms != NULL)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
if (num_platforms != NULL && platforms == NULL) {
|
||||
*num_platforms = 1;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
assert(platforms != NULL && "check the code above");
|
||||
*platforms = AMD_PLATFORM;
|
||||
|
||||
*not_null(num_platforms) = 1;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Get specific information about the OpenCL platform.
|
||||
*
|
||||
* \param param_name is an enum that identifies the platform information being
|
||||
* queried.
|
||||
*
|
||||
* \param param_value is a pointer to memory location where appropriate values
|
||||
* for a given \a param_name will be returned. If \a param_value is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \param param_value_size specifies the size in bytes of memory pointed to by
|
||||
* \a param_value. This size in bytes must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_VALUE if \a param_name is not one of the supported
|
||||
* values or if size in bytes specified by \a param_value_size is < size of
|
||||
* return type and \a param_value is not a NULL value.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetPlatformInfo,
|
||||
(cl_platform_id platform, cl_platform_info param_name, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
if (platform != NULL && platform != AMD_PLATFORM) {
|
||||
return CL_INVALID_PLATFORM;
|
||||
}
|
||||
|
||||
const char* value = NULL;
|
||||
switch (param_name) {
|
||||
case CL_PLATFORM_PROFILE:
|
||||
value = "FULL_PROFILE";
|
||||
break;
|
||||
case CL_PLATFORM_VERSION:
|
||||
value = "OpenCL " XSTR(OPENCL_MAJOR) "." XSTR(OPENCL_MINOR) " " AMD_PLATFORM_INFO;
|
||||
break;
|
||||
case CL_PLATFORM_NAME:
|
||||
value = AMD_PLATFORM_NAME;
|
||||
break;
|
||||
case CL_PLATFORM_VENDOR:
|
||||
value = "Advanced Micro Devices, Inc.";
|
||||
break;
|
||||
case CL_PLATFORM_EXTENSIONS:
|
||||
value = "cl_khr_icd "
|
||||
#ifdef _WIN32
|
||||
"cl_khr_d3d10_sharing "
|
||||
"cl_khr_d3d11_sharing "
|
||||
"cl_khr_dx9_media_sharing "
|
||||
#endif //_WIN32
|
||||
"cl_amd_event_callback "
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
"cl_amd_offline_devices "
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
;
|
||||
break;
|
||||
case CL_PLATFORM_ICD_SUFFIX_KHR:
|
||||
value = "AMD";
|
||||
break;
|
||||
case CL_PLATFORM_HOST_TIMER_RESOLUTION: {
|
||||
cl_ulong resolution = (cl_ulong)amd::Os::timerResolutionNanos();
|
||||
return amd::clGetInfo(resolution, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (value != NULL) {
|
||||
return amd::clGetInfo(value, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* \addtogroup CL_Devices
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief Get the list of available devices.
|
||||
*
|
||||
* \param device_type is a bitfield that identifies the type of OpenCL device.
|
||||
* The \a device_type can be used to query specific OpenCL devices or all
|
||||
* OpenCL devices available.
|
||||
*
|
||||
* \param num_entries is the number of cl_device_id entries that can be added
|
||||
* to devices. If devices is not NULL, the \a num_entries must be greater than
|
||||
* zero.
|
||||
*
|
||||
* \param devices returns a list of OpenCL devices found. The cl_device_id
|
||||
* values returned in devices can be used to identify a specific OpenCL device.
|
||||
* If \a devices argument is NULL, this argument is ignored. The number of
|
||||
* OpenCL devices returned is the mininum of value specified by \a num_entries
|
||||
* or the number of OpenCL devices whose type matches device_type.
|
||||
*
|
||||
* \param num_devices returns the number of OpenCL devices available that match
|
||||
* device_type. If \a num_devices is NULL, this argument is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_DEVICE_TYPE if \a device_type is not a valid value.
|
||||
* - CL_INVALID_VALUE if \a num_entries is equal to zero and devices is
|
||||
* not NULL or if both \a num_devices and \a devices are NULL.
|
||||
* - CL_DEVICE_ NOT_FOUND if no OpenCL devices that matched \a device_type
|
||||
* were found.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* The application can query specific capabilities of the OpenCL device(s)
|
||||
* returned by clGetDeviceIDs. This can be used by the application to
|
||||
* determine which device(s) to use.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetDeviceIDs,
|
||||
(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries,
|
||||
cl_device_id* devices, cl_uint* num_devices)) {
|
||||
if (platform != NULL && platform != AMD_PLATFORM) {
|
||||
return CL_INVALID_PLATFORM;
|
||||
}
|
||||
|
||||
if (((num_entries > 0 || num_devices == NULL) && devices == NULL) ||
|
||||
(num_entries == 0 && devices != NULL)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
// Get all available devices
|
||||
if (!amd::Device::getDeviceIDs(device_type, num_entries, devices, num_devices, false)) {
|
||||
return CL_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \fn clGetDeviceInfo
|
||||
*
|
||||
* \brief Get specific information about an OpenCL device.
|
||||
*
|
||||
* \param device is a device returned by clGetDeviceIDs.
|
||||
*
|
||||
* \param param_name is an enum that identifies the device information being
|
||||
* queried.
|
||||
*
|
||||
* \param param_value is a pointer to memory location where appropriate values
|
||||
* for a given \a param_name will be returned. If \a param_value is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \param param_value_size specifies the size in bytes of memory pointed to
|
||||
* by \a param_value. This size in bytes must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_INVALID_DEVICE if device is not valid.
|
||||
* - CL_INVALID_VALUE if param_name is not one of the supported values
|
||||
* or if size in bytes specified by \a param_value_size is < size of return
|
||||
* type and \a param_value is not a NULL value.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetDeviceInfo,
|
||||
(cl_device_id device, cl_device_info param_name, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
if (!is_valid(device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
#define CASE(param_name, field_name) \
|
||||
case param_name: \
|
||||
return amd::clGetInfo(as_amd(device)->info().field_name, param_value_size, param_value, \
|
||||
param_value_size_ret);
|
||||
|
||||
switch (param_name) {
|
||||
case CL_DEVICE_TYPE: {
|
||||
// For cl_device_type, we need to mask out the default bit.
|
||||
cl_device_type device_type = as_amd(device)->type();
|
||||
return amd::clGetInfo(device_type, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
CASE(CL_DEVICE_VENDOR_ID, vendorId_);
|
||||
CASE(CL_DEVICE_MAX_COMPUTE_UNITS, maxComputeUnits_);
|
||||
CASE(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, maxWorkItemDimensions_);
|
||||
CASE(CL_DEVICE_MAX_WORK_GROUP_SIZE, preferredWorkGroupSize_);
|
||||
CASE(CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD, preferredWorkGroupSize_);
|
||||
CASE(CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD, maxWorkGroupSize_);
|
||||
CASE(CL_DEVICE_MAX_WORK_ITEM_SIZES, maxWorkItemSizes_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, preferredVectorWidthChar_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, preferredVectorWidthShort_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, preferredVectorWidthInt_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, preferredVectorWidthLong_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, preferredVectorWidthFloat_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, preferredVectorWidthDouble_);
|
||||
CASE(CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, preferredVectorWidthDouble_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, nativeVectorWidthChar_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, nativeVectorWidthShort_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, nativeVectorWidthInt_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, nativeVectorWidthLong_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, nativeVectorWidthFloat_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, nativeVectorWidthDouble_);
|
||||
CASE(CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, nativeVectorWidthDouble_);
|
||||
CASE(CL_DEVICE_MAX_CLOCK_FREQUENCY, maxEngineClockFrequency_);
|
||||
CASE(CL_DEVICE_ADDRESS_BITS, addressBits_);
|
||||
CASE(CL_DEVICE_MAX_READ_IMAGE_ARGS, maxReadImageArgs_);
|
||||
CASE(CL_DEVICE_MAX_WRITE_IMAGE_ARGS, maxWriteImageArgs_);
|
||||
CASE(CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS, maxReadWriteImageArgs_);
|
||||
CASE(CL_DEVICE_MAX_MEM_ALLOC_SIZE, maxMemAllocSize_);
|
||||
CASE(CL_DEVICE_IMAGE2D_MAX_WIDTH, image2DMaxWidth_);
|
||||
CASE(CL_DEVICE_IMAGE2D_MAX_HEIGHT, image2DMaxHeight_);
|
||||
CASE(CL_DEVICE_IMAGE3D_MAX_WIDTH, image3DMaxWidth_);
|
||||
CASE(CL_DEVICE_IMAGE3D_MAX_HEIGHT, image3DMaxHeight_);
|
||||
CASE(CL_DEVICE_IMAGE3D_MAX_DEPTH, image3DMaxDepth_);
|
||||
CASE(CL_DEVICE_IMAGE_SUPPORT, imageSupport_);
|
||||
CASE(CL_DEVICE_MAX_PARAMETER_SIZE, maxParameterSize_);
|
||||
CASE(CL_DEVICE_MAX_SAMPLERS, maxSamplers_);
|
||||
CASE(CL_DEVICE_MEM_BASE_ADDR_ALIGN, memBaseAddrAlign_);
|
||||
CASE(CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, minDataTypeAlignSize_);
|
||||
CASE(CL_DEVICE_HALF_FP_CONFIG, halfFPConfig_);
|
||||
CASE(CL_DEVICE_SINGLE_FP_CONFIG, singleFPConfig_);
|
||||
CASE(CL_DEVICE_DOUBLE_FP_CONFIG, doubleFPConfig_);
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, globalMemCacheType_);
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, globalMemCacheLineSize_);
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, globalMemCacheSize_);
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_SIZE, globalMemSize_);
|
||||
CASE(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, maxConstantBufferSize_);
|
||||
CASE(CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD, preferredConstantBufferSize_);
|
||||
CASE(CL_DEVICE_MAX_CONSTANT_ARGS, maxConstantArgs_);
|
||||
CASE(CL_DEVICE_LOCAL_MEM_TYPE, localMemType_);
|
||||
CASE(CL_DEVICE_LOCAL_MEM_SIZE, localMemSize_);
|
||||
CASE(CL_DEVICE_ERROR_CORRECTION_SUPPORT, errorCorrectionSupport_);
|
||||
CASE(CL_DEVICE_HOST_UNIFIED_MEMORY, hostUnifiedMemory_);
|
||||
CASE(CL_DEVICE_PROFILING_TIMER_RESOLUTION, profilingTimerResolution_);
|
||||
CASE(CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, profilingTimerOffset_);
|
||||
CASE(CL_DEVICE_ENDIAN_LITTLE, littleEndian_);
|
||||
CASE(CL_DEVICE_AVAILABLE, available_);
|
||||
CASE(CL_DEVICE_COMPILER_AVAILABLE, compilerAvailable_);
|
||||
CASE(CL_DEVICE_EXECUTION_CAPABILITIES, executionCapabilities_);
|
||||
CASE(CL_DEVICE_SVM_CAPABILITIES, svmCapabilities_);
|
||||
CASE(CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT, preferredPlatformAtomicAlignment_);
|
||||
CASE(CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT, preferredGlobalAtomicAlignment_);
|
||||
CASE(CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT, preferredLocalAtomicAlignment_);
|
||||
CASE(CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, queueProperties_);
|
||||
CASE(CL_DEVICE_PLATFORM, platform_);
|
||||
CASE(CL_DEVICE_NAME, name_);
|
||||
CASE(CL_DEVICE_VENDOR, vendor_);
|
||||
CASE(CL_DRIVER_VERSION, driverVersion_);
|
||||
CASE(CL_DEVICE_PROFILE, profile_);
|
||||
CASE(CL_DEVICE_VERSION, version_);
|
||||
CASE(CL_DEVICE_OPENCL_C_VERSION, oclcVersion_);
|
||||
CASE(CL_DEVICE_EXTENSIONS, extensions_);
|
||||
CASE(CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT, maxAtomicCounters_);
|
||||
CASE(CL_DEVICE_TOPOLOGY_AMD, deviceTopology_);
|
||||
CASE(CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD, maxSemaphoreSize_);
|
||||
CASE(CL_DEVICE_BOARD_NAME_AMD, boardName_);
|
||||
CASE(CL_DEVICE_SPIR_VERSIONS, spirVersions_);
|
||||
CASE(CL_DEVICE_IL_VERSION, spirVersions_);
|
||||
CASE(CL_DEVICE_MAX_PIPE_ARGS, maxPipeArgs_);
|
||||
CASE(CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS, maxPipeActiveReservations_);
|
||||
CASE(CL_DEVICE_PIPE_MAX_PACKET_SIZE, maxPipePacketSize_);
|
||||
CASE(CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE, maxGlobalVariableSize_);
|
||||
CASE(CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE, globalVariablePreferredTotalSize_);
|
||||
CASE(CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, queueOnDeviceProperties_);
|
||||
CASE(CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, queueOnDevicePreferredSize_);
|
||||
CASE(CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, queueOnDeviceMaxSize_);
|
||||
CASE(CL_DEVICE_MAX_ON_DEVICE_QUEUES, maxOnDeviceQueues_);
|
||||
CASE(CL_DEVICE_MAX_ON_DEVICE_EVENTS, maxOnDeviceEvents_);
|
||||
CASE(CL_DEVICE_LINKER_AVAILABLE, linkerAvailable_);
|
||||
CASE(CL_DEVICE_BUILT_IN_KERNELS, builtInKernels_);
|
||||
CASE(CL_DEVICE_IMAGE_MAX_BUFFER_SIZE, imageMaxBufferSize_);
|
||||
CASE(CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, imageMaxArraySize_);
|
||||
case CL_DEVICE_PARENT_DEVICE: {
|
||||
cl_device_id parent = (cl_device_id)0;
|
||||
return amd::clGetInfo(parent, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
CASE(CL_DEVICE_PARTITION_MAX_SUB_DEVICES, maxComputeUnits_);
|
||||
case CL_DEVICE_PARTITION_PROPERTIES: {
|
||||
cl_device_partition_property cl_property = {};
|
||||
return amd::clGetInfo(cl_property, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_DEVICE_PARTITION_AFFINITY_DOMAIN: {
|
||||
cl_device_affinity_domain deviceAffinity = {};
|
||||
return amd::clGetInfo(deviceAffinity, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_DEVICE_PARTITION_TYPE: {
|
||||
cl_device_partition_property cl_property = {};
|
||||
return amd::clGetInfo(cl_property, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_DEVICE_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(device)->referenceCount();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
CASE(CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, preferredInteropUserSync_);
|
||||
CASE(CL_DEVICE_PRINTF_BUFFER_SIZE, printfBufferSize_);
|
||||
CASE(CL_DEVICE_IMAGE_PITCH_ALIGNMENT, imagePitchAlignment_);
|
||||
CASE(CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT, imageBaseAddressAlignment_);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (as_amd(device)->type() == CL_DEVICE_TYPE_GPU) {
|
||||
switch (param_name) {
|
||||
case CL_DEVICE_GLOBAL_FREE_MEMORY_AMD: {
|
||||
// Free memory should contain 2 values:
|
||||
// total free memory and the biggest free block
|
||||
size_t freeMemory[2];
|
||||
if (!as_amd(device)->globalFreeMemory(freeMemory)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
if (param_value_size < sizeof(freeMemory)) {
|
||||
// Return just total free memory if the app provided space for one value
|
||||
return amd::clGetInfo(freeMemory[0], param_value_size, param_value, param_value_size_ret);
|
||||
} else {
|
||||
return amd::clGetInfo(freeMemory, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
}
|
||||
CASE(CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, simdPerCU_);
|
||||
CASE(CL_DEVICE_SIMD_WIDTH_AMD, simdWidth_);
|
||||
CASE(CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, simdInstructionWidth_);
|
||||
CASE(CL_DEVICE_WAVEFRONT_WIDTH_AMD, wavefrontWidth_);
|
||||
case CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD: {
|
||||
cl_uint globalMemChannels = as_amd(device)->info().vramBusBitWidth_ / 32;
|
||||
return amd::clGetInfo(globalMemChannels, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, globalMemChannelBanks_);
|
||||
CASE(CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, globalMemChannelBankWidth_);
|
||||
CASE(CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, localMemSizePerCU_);
|
||||
CASE(CL_DEVICE_LOCAL_MEM_BANKS_AMD, localMemBanks_);
|
||||
CASE(CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD, threadTraceEnable_);
|
||||
case CL_DEVICE_GFXIP_MAJOR_AMD: {
|
||||
cl_uint major = as_amd(device)->isa().versionMajor();
|
||||
return amd::clGetInfo(major, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_DEVICE_GFXIP_MINOR_AMD: {
|
||||
cl_uint minor = as_amd(device)->isa().versionMinor();
|
||||
return amd::clGetInfo(minor, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
CASE(CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD, numAsyncQueues_);
|
||||
#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD 0x404D
|
||||
#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_AMD 0x404E
|
||||
#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_GRANULARITY_AMD 0x403A
|
||||
CASE(CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD, numRTQueues_);
|
||||
CASE(CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_AMD, numRTCUs_);
|
||||
CASE(CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_GRANULARITY_AMD, granularityRTCUs_);
|
||||
case CL_DEVICE_NUM_P2P_DEVICES_AMD: {
|
||||
cl_uint num_p2p_devices = as_amd(device)->p2pDevices_.size();
|
||||
return amd::clGetInfo(num_p2p_devices, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_DEVICE_P2P_DEVICES_AMD: {
|
||||
uint valueSize = as_amd(device)->p2pDevices_.size() * sizeof(cl_device_id);
|
||||
if (param_value != NULL) {
|
||||
if ((param_value_size < valueSize) || (param_value_size == 0)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
} else {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
memcpy(param_value, as_amd(device)->p2pDevices_.data(), valueSize);
|
||||
*not_null(param_value_size_ret) = valueSize;
|
||||
if (param_value != NULL && param_value_size > valueSize) {
|
||||
::memset(static_cast<char*>(param_value) + valueSize, '\0', param_value_size - valueSize);
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
CASE(CL_DEVICE_PCIE_ID_AMD, pcieDeviceId_);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#undef CASE
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clCreateSubDevices,
|
||||
(cl_device_id in_device, const cl_device_partition_property* partition_properties,
|
||||
cl_uint num_entries, cl_device_id* out_devices, cl_uint* num_devices)) {
|
||||
if (!is_valid(in_device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
if (partition_properties == NULL || *partition_properties == 0u) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
if ((num_devices == NULL && out_devices == NULL) || (num_entries == 0 && out_devices != NULL)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clRetainDevice, (cl_device_id device)) {
|
||||
if (!is_valid(device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
as_amd(device)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clReleaseDevice, (cl_device_id device)) {
|
||||
if (!is_valid(device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
as_amd(device)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,387 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
|
||||
#include "platform/object.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
* \addtogroup CL_Events
|
||||
*
|
||||
* Event objects can be used to refer to a kernel execution command:
|
||||
* - clEnqueueNDRangeKernel
|
||||
* - clEnqueueTask
|
||||
* - clEnqueueNativeKernel
|
||||
*
|
||||
* or read, write, map and copy commands on memory objects:
|
||||
* - clEnqueue{Read|Write|Map}{Buffer|Image}
|
||||
* - clEnqueueCopy{Buffer|Image}
|
||||
* - clEnqueueCopyBufferToImage
|
||||
* - clEnqueueCopyImageToBuffer
|
||||
*
|
||||
* An event object can be used to track the execution status of a command.
|
||||
* The execution status of a command at any given point in time can be
|
||||
* CL_QUEUED (is currently in the command queue),
|
||||
* CL_RUNNING (device is currently executing this command),
|
||||
* CL_COMPLETE (command has successfully completed) or the appropriate error
|
||||
* code if the command was abnormally terminated (this may be caused by a bad
|
||||
* memory access etc.). The error code returned by a terminated command is
|
||||
* a negative integer value. A command is considered to be complete if its
|
||||
* execution status is CL_COMPLETE or is a negative integer value.
|
||||
*
|
||||
* If the execution of a command is terminated, the command-queue associated
|
||||
* with this terminated command, and the associated context (and all other
|
||||
* command-queues in this context) may no longer be available. The behavior of
|
||||
* OpenCL API calls that use this context (and command-queues associated with
|
||||
* this context) are now considered to be implementationdefined. The user
|
||||
* registered callback function specified when context is created can be used
|
||||
* to report appropriate error information.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/*! \brief Wait on the host thread for commands identified by event objects in
|
||||
* event_list to complete.
|
||||
*
|
||||
* A command is considered complete if its execution status is CL_COMPLETE or
|
||||
* a negative value. The events specified in event_list act as synchronization
|
||||
* points.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function was executed successfully.
|
||||
* - CL_INVALID_VALUE if \a num_events is zero
|
||||
* - CL_INVALID_CONTEXT if events specified in \a event_list do not belong to
|
||||
* the same context
|
||||
* - CL_INVALID_EVENT if event objects specified in \a event_list are not valid
|
||||
* event objects.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clWaitForEvents, (cl_uint num_events, const cl_event* event_list)) {
|
||||
if (num_events == 0 || event_list == NULL) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
const amd::Context* prevContext = NULL;
|
||||
const amd::HostQueue* prevQueue = NULL;
|
||||
|
||||
for (cl_uint i = 0; i < num_events; ++i) {
|
||||
cl_event event = event_list[i];
|
||||
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
|
||||
// Make sure all the events are associated with the same context
|
||||
const amd::Context* context = &as_amd(event)->context();
|
||||
if (prevContext != NULL && prevContext != context) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
prevContext = context;
|
||||
|
||||
// Flush the command queues associated with event1...eventN
|
||||
amd::HostQueue* queue = as_amd(event)->command().queue();
|
||||
if (queue != NULL && prevQueue != queue) {
|
||||
queue->flush();
|
||||
}
|
||||
prevQueue = queue;
|
||||
}
|
||||
|
||||
bool allSucceeded = true;
|
||||
while (num_events-- > 0) {
|
||||
allSucceeded &= as_amd(*event_list++)->awaitCompletion();
|
||||
}
|
||||
return allSucceeded ? CL_SUCCESS : CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Return information about the event object.
|
||||
*
|
||||
* \param event specifies the event object being queried.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result being
|
||||
* queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data copied
|
||||
* to \a param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* Using clGetEventInfo to determine if a command identified by event has
|
||||
* finished execution (i.e. CL_EVENT_COMMAND_EXECUTION_STATUS returns
|
||||
* CL_COMPLETE) is not a synchronization point i.e. there are no guarantees
|
||||
* that the memory objects being modified by command associated with event will
|
||||
* be visible to other enqueued commands.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully
|
||||
* - CL_INVALID_VALUE if \a param_name is not valid, or if size in bytes
|
||||
* specified by \a param_value_size is < size of return type and
|
||||
* \a param_value is not NULL
|
||||
* - CL_INVALID_EVENT if \a event is a not a valid event object.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetEventInfo,
|
||||
(cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value,
|
||||
size_t* param_value_size_ret)) {
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
|
||||
switch (param_name) {
|
||||
case CL_EVENT_CONTEXT: {
|
||||
amd::Context& amdCtx = const_cast<amd::Context&>(as_amd(event)->context());
|
||||
cl_context context = as_cl(&amdCtx);
|
||||
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_EVENT_COMMAND_QUEUE: {
|
||||
amd::Command& command = as_amd(event)->command();
|
||||
cl_command_queue queue = command.queue() == NULL
|
||||
? NULL
|
||||
: const_cast<cl_command_queue>(as_cl(command.queue()->asCommandQueue()));
|
||||
return amd::clGetInfo(queue, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_EVENT_COMMAND_TYPE: {
|
||||
cl_command_type type = as_amd(event)->command().type();
|
||||
return amd::clGetInfo(type, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_EVENT_COMMAND_EXECUTION_STATUS: {
|
||||
as_amd(event)->notifyCmdQueue();
|
||||
cl_int status = as_amd(event)->command().status();
|
||||
return amd::clGetInfo(status, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_EVENT_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(event)->referenceCount();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increment the event reference count.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_EVENT if \a event is not a valid event object.
|
||||
*
|
||||
* The OpenCL commands that return an event perform an implicit retain.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainEvent, (cl_event event)) {
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
as_amd(event)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Decrement the event reference count.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_EVENT if \a event is not a valid event object.
|
||||
*
|
||||
* The event object is deleted once the reference count becomes zero, the
|
||||
* specific command identified by this event has completed (or terminated) and
|
||||
* there are no commands in the command-queues of a context that require a wait
|
||||
* for this event to complete.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleaseEvent, (cl_event event)) {
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
as_amd(event)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Creates a user event object.
|
||||
*
|
||||
* User events allow applications to enqueue commands that wait on a user event
|
||||
* to finish before the command is executed by the device.
|
||||
*
|
||||
* \return a valid non-zero event object and errcode_ret is set to CL_SUCCESS
|
||||
* if the user event object is created successfully. Otherwise, it returns
|
||||
* a NULL value with one of the following error values returned in errcode_ret:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid context.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
|
||||
* required by the OpenCL implementation on the host.
|
||||
*
|
||||
* The execution status of the user event object created is set to CL_SUBMITTED.
|
||||
*
|
||||
* \version 1.1r15
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_event, clCreateUserEvent, (cl_context context, cl_int* errcode_ret)) {
|
||||
if (!is_valid(context)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
return (cl_event)0;
|
||||
}
|
||||
|
||||
amd::Event* event = new amd::UserEvent(*as_amd(context));
|
||||
if (event == NULL) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
return (cl_event)0;
|
||||
}
|
||||
|
||||
event->retain();
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(event);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Sets the execution status of a user event object.
|
||||
*
|
||||
* \a event is a user event object created using clCreateUserEvent.
|
||||
* \a execution_status specifies the new execution status to be set and can be
|
||||
* CL_COMPLETE or a negative integer value to indicate an error.
|
||||
* clSetUserEventStatus can only be called once to change the execution status
|
||||
* of event.
|
||||
*
|
||||
* \return CL_SUCCESS if the function was executed successfully. Otherwise,
|
||||
* it returns one of the following errors:
|
||||
* - CL_INVALID_EVENT if event is not a valid user event object.
|
||||
* - CL_INVALID_VALUE if the execution_status is not CL_COMPLETE or
|
||||
* a negative integer value.
|
||||
* - CL_INVALID_OPERATION if the execution_status for event has already been
|
||||
* changed by a previous call to clSetUserEventStatus.
|
||||
*
|
||||
* \version 1.1r15
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clSetUserEventStatus, (cl_event event, cl_int execution_status)) {
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
if (execution_status > CL_COMPLETE) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!as_amd(event)->setStatus(execution_status)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Registers a user callback function for a specific command execution
|
||||
* status.
|
||||
*
|
||||
* The registered callback function will be called when the execution status
|
||||
* of command associated with event changes to the execution status specified
|
||||
* by command_exec_status.
|
||||
*
|
||||
* Each call to clSetEventCallback registers the specified user callback
|
||||
* function on a callback stack associated with event. The order in which the
|
||||
* registered user callback functions are called is undefined.
|
||||
*
|
||||
* \a event is a valid event object.
|
||||
* \a command_exec_callback_type specifies the command execution status for
|
||||
* which the callback is registered. The command execution callback mask
|
||||
* values for which a callback can be registered are: CL_COMPLETE.
|
||||
* There is no guarantee that the callback functions registered for various
|
||||
* execution status values for an event will be called in the exact order
|
||||
* that the execution status of a command changes.
|
||||
* \a pfn_event_notify is the event callback function that can be registered
|
||||
* by the application. This callback function may be called asynchronously
|
||||
* by the OpenCL implementation. It is the application’s responsibility to
|
||||
* ensure that the callback function is thread-safe. The parameters to this
|
||||
* callback function are:
|
||||
* event is the event object for which the callback function is invoked.
|
||||
* event_command_exec_status represents the execution status of command
|
||||
* for which this callback function is invoked. If the callback is called
|
||||
* as the result of the command associated with event being abnormally
|
||||
* terminated, an appropriate error code for the error that caused the
|
||||
* termination will be passed to event_command_exec_status instead.
|
||||
* \a user_data is a pointer to user supplied data. user_data will be passed as
|
||||
* the user_data argument when pfn_notify is called. user_data can be NULL.
|
||||
*
|
||||
* All callbacks registered for an event object must be called. All enqueued
|
||||
* callbacks shall be called before the event object is destroyed. Callbacks
|
||||
* must return promptly. The behavior of calling expensive system routines,
|
||||
* OpenCL API calls to create contexts or command-queues, or blocking OpenCL
|
||||
* operations from the following list below, in a callback is undefined.
|
||||
* clFinish, clWaitForEvents, blocking calls to clEnqueueReadBuffer,
|
||||
* clEnqueueReadBufferRect, clEnqueueWriteBuffer, clEnqueueWriteBufferRect,
|
||||
* blocking calls to clEnqueueReadImage and clEnqueueWriteImage, blocking
|
||||
* calls to clEnqueueMapBuffer and clEnqueueMapImage, blocking calls to
|
||||
* clBuildProgram
|
||||
*
|
||||
* If an application needs to wait for completion of a routine from the above
|
||||
* list in a callback, please use the non-blocking form of the function, and
|
||||
* assign a completion callback to it to do the remainder of your work.
|
||||
* Note that when a callback (or other code) enqueues commands to a
|
||||
* command-queue, the commands are not required to begin execution until the
|
||||
* queue is flushed. In standard usage, blocking enqueue calls serve this role
|
||||
* by implicitly flushing the queue. Since blocking calls are not permitted in
|
||||
* callbacks, those callbacks that enqueue commands on a command queue should
|
||||
* either call clFlush on the queue before returning or arrange for clFlush
|
||||
* to be called later on another thread.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. Otherwise,
|
||||
* it returns one of the following errors:
|
||||
* - CL_INVALID_EVENT if event is not a valid event object or is a user event
|
||||
* object created using clCreateUserEvent.
|
||||
* - CL_INVALID_VALUE if pfn_event_notify is NULL or if
|
||||
* command_exec_callback_type is not a valid command execution status.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
|
||||
* required by the OpenCL implementation on the host.
|
||||
*
|
||||
* \version 1.1r15
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clSetEventCallback,
|
||||
(cl_event event, cl_int command_exec_callback_type,
|
||||
void(CL_CALLBACK* pfn_notify)(cl_event event, cl_int command_exec_status,
|
||||
void* user_data),
|
||||
void* user_data)) {
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT;
|
||||
}
|
||||
|
||||
if (pfn_notify == NULL || command_exec_callback_type < CL_COMPLETE ||
|
||||
command_exec_callback_type > CL_QUEUED) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!as_amd(event)->setCallback(command_exec_callback_type, pfn_notify, user_data)) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
as_amd(event)->notifyCmdQueue();
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,397 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef CL_GL_AMD_HPP_
|
||||
#define CL_GL_AMD_HPP_
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else //!_WIN32
|
||||
#include <dlfcn.h>
|
||||
#endif //!_WIN32
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include "CL/cl_gl.h"
|
||||
#ifndef _WIN32
|
||||
#include <GL/glx.h>
|
||||
#endif //!_WIN32
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
|
||||
namespace amd
|
||||
{
|
||||
|
||||
//! Class GLObject keeps all the info about the GL object
|
||||
//! from which the CL object is created
|
||||
class GLObject : public InteropObject
|
||||
{
|
||||
protected:
|
||||
cl_gl_object_type clGLType_; //!< CL GL object type
|
||||
GLenum glTarget_;
|
||||
GLuint gluiName_;
|
||||
GLint gliMipLevel_;
|
||||
GLenum glInternalFormat_;
|
||||
GLint gliWidth_;
|
||||
GLint gliHeight_;
|
||||
GLint gliDepth_;
|
||||
GLenum glCubemapFace_;
|
||||
GLsizei glNumSamples_;
|
||||
|
||||
public:
|
||||
//! GLObject constructor initializes member variables
|
||||
GLObject(
|
||||
GLenum glTarget,
|
||||
GLuint gluiName,
|
||||
GLint gliMipLevel,
|
||||
GLenum glInternalFormat,
|
||||
GLint gliWidth,
|
||||
GLint gliHeight,
|
||||
GLint gliDepth,
|
||||
cl_gl_object_type clGLType,
|
||||
GLenum glCubemapFace,
|
||||
GLsizei glNumSamples
|
||||
): // Initialization of member variables
|
||||
clGLType_(clGLType),
|
||||
glTarget_(glTarget),
|
||||
gluiName_(gluiName),
|
||||
gliMipLevel_(gliMipLevel),
|
||||
glInternalFormat_(glInternalFormat),
|
||||
gliWidth_(gliWidth),
|
||||
gliHeight_(gliHeight),
|
||||
gliDepth_(gliDepth),
|
||||
glCubemapFace_(glCubemapFace),
|
||||
glNumSamples_(glNumSamples)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~GLObject() {}
|
||||
virtual GLObject* asGLObject() {return this;}
|
||||
|
||||
//! GLObject query functions to get GL info from member variables
|
||||
GLenum getGLTarget() const {return glTarget_;}
|
||||
GLuint getGLName() const {return gluiName_;}
|
||||
GLint getGLMipLevel() const {return gliMipLevel_;}
|
||||
GLenum getGLInternalFormat() const {return glInternalFormat_;}
|
||||
GLint getGLSize() const {return gliWidth_;}
|
||||
GLint getGLWidth() const {return gliWidth_;}
|
||||
GLint getGLHeight() const {return gliHeight_;}
|
||||
GLint getGLDepth() const {return gliDepth_;}
|
||||
cl_gl_object_type getCLGLObjectType() const { return clGLType_; }
|
||||
GLenum getCubemapFace() const {return glCubemapFace_;}
|
||||
GLsizei getNumSamples() const { return glNumSamples_;}
|
||||
};
|
||||
|
||||
|
||||
//! Class BufferGL is drived from classes Buffer and GLObject
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for GL object
|
||||
class BufferGL : public Buffer, public GLObject
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'BufferGL' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
public:
|
||||
//! BufferGL constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
BufferGL(
|
||||
Context& amdContext,
|
||||
cl_mem_flags clFlags,
|
||||
size_t uiSizeInBytes,
|
||||
GLenum glTarget,
|
||||
GLuint gluiName)
|
||||
: // Call base classes constructors
|
||||
Buffer(
|
||||
amdContext,
|
||||
clFlags,
|
||||
uiSizeInBytes
|
||||
),
|
||||
GLObject(
|
||||
glTarget,
|
||||
gluiName,
|
||||
0, // Mipmap level default
|
||||
GL_ARRAY_BUFFER, // Just init to some value
|
||||
(GLint) uiSizeInBytes,
|
||||
1,
|
||||
1,
|
||||
CL_GL_OBJECT_BUFFER,
|
||||
0,
|
||||
0
|
||||
)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~BufferGL() {}
|
||||
|
||||
virtual BufferGL* asBufferGL() { return this; }
|
||||
};
|
||||
|
||||
|
||||
//! Class ImageGL is derived from classes Image and GLObject
|
||||
//! where the former keeps all data for CL object and
|
||||
//! the latter keeps all data for GL object
|
||||
class ImageGL : public Image, public GLObject
|
||||
{
|
||||
public:
|
||||
//! ImageGL constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
ImageGL(
|
||||
Context& amdContext,
|
||||
cl_mem_object_type clType,
|
||||
cl_mem_flags clFlags,
|
||||
const Format& format,
|
||||
size_t width,
|
||||
size_t height,
|
||||
size_t depth,
|
||||
GLenum glTarget,
|
||||
GLuint gluiName,
|
||||
GLint gliMipLevel,
|
||||
GLenum glInternalFormat,
|
||||
cl_gl_object_type clGLType,
|
||||
GLsizei numSamples,
|
||||
GLenum glCubemapFace = 0)
|
||||
: Image(amdContext, clType, clFlags, format, width, height, depth,
|
||||
Format(format).getElementSize() * width,
|
||||
Format(format).getElementSize() * width * depth)
|
||||
, GLObject(glTarget, gluiName, gliMipLevel, glInternalFormat,
|
||||
static_cast<GLint>(width), static_cast<GLint>(height),
|
||||
static_cast<GLint>(depth), clGLType, glCubemapFace,numSamples)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
|
||||
virtual ~ImageGL() {}
|
||||
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'BufferGL' object in memory layout.
|
||||
virtual void initDeviceMemory();
|
||||
};
|
||||
|
||||
typedef EGLContext (*PFN_eglGetCurrentContext) ();
|
||||
#ifdef _WIN32
|
||||
#define APICALL WINAPI
|
||||
#define GETPROCADDRESS GetProcAddress
|
||||
#define API_GETPROCADDR "wglGetProcAddress"
|
||||
#define FCN_STR_TYPE LPCSTR
|
||||
typedef PROC (WINAPI* PFN_xxxGetProcAddress) (LPCSTR fcnName);
|
||||
typedef HGLRC (APICALL* PFN_wglCreateContext) (HDC hdc);
|
||||
typedef HGLRC (APICALL* PFN_wglGetCurrentContext) (void);
|
||||
typedef HDC (APICALL* PFN_wglGetCurrentDC) (void);
|
||||
typedef BOOL (APICALL* PFN_wglDeleteContext) (HGLRC hglrc);
|
||||
typedef BOOL (APICALL* PFN_wglMakeCurrent) (HDC hdc, HGLRC hglrc);
|
||||
typedef BOOL (APICALL* PFN_wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
|
||||
#else //!_WIN32
|
||||
#define APICALL // __stdcall //??? todo odintsov
|
||||
#define API_GETPROCADDR "glXGetProcAddress"
|
||||
#define GETPROCADDRESS dlsym
|
||||
#define FCN_STR_TYPE const GLubyte*
|
||||
#define WINAPI
|
||||
#define PROC void*
|
||||
typedef void* (*PFN_xxxGetProcAddress) (const GLubyte* procName);
|
||||
// X11 typedef
|
||||
typedef Display* (*PFNXOpenDisplay)(_Xconst char* display_name );
|
||||
typedef int (*PFNXCloseDisplay)(Display* display );
|
||||
|
||||
//glx typedefs
|
||||
typedef GLXDrawable (*PFNglXGetCurrentDrawable)();
|
||||
typedef Display* (*PFNglXGetCurrentDisplay)();
|
||||
typedef GLXContext (*PFNglXGetCurrentContext)( void );
|
||||
typedef XVisualInfo* (*PFNglXChooseVisual)(Display *dpy, int screen, int *attribList);
|
||||
typedef GLXContext(*PFNglXCreateContext)(Display* dpy,XVisualInfo* vis,GLXContext shareList,Bool direct);
|
||||
typedef void(*PFNglXDestroyContext)(Display* dpy, GLXContext ctx);
|
||||
typedef Bool(*PFNglXMakeCurrent)( Display* dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
typedef void* HMODULE;
|
||||
#endif //!_WIN32
|
||||
|
||||
#define GLPREFIX(rtype, fcn, dclargs) \
|
||||
typedef rtype (APICALL* PFN_##fcn) dclargs;
|
||||
|
||||
// Declare prototypes for GL functions
|
||||
#include "gl_functions.hpp"
|
||||
|
||||
class GLFunctions
|
||||
{
|
||||
public:
|
||||
//! Locks any access to the virtual GPUs
|
||||
class SetIntEnv : public amd::StackObject {
|
||||
public:
|
||||
//! Default constructor
|
||||
SetIntEnv(GLFunctions* env);
|
||||
|
||||
//! Destructor
|
||||
~SetIntEnv();
|
||||
|
||||
//! Checks if the environment setup was successful
|
||||
bool isValid() const { return isValid_; }
|
||||
|
||||
private:
|
||||
GLFunctions* env_; //!< GL environment
|
||||
bool isValid_; //!< If TRUE, then it's a valid setup
|
||||
};
|
||||
|
||||
private:
|
||||
HMODULE libHandle_;
|
||||
int missed_; // Indicates how many GL functions not init'ed, if any
|
||||
|
||||
amd::Monitor lock_;
|
||||
|
||||
EGLDisplay eglDisplay_;
|
||||
EGLContext eglOriginalContext_;
|
||||
EGLContext eglInternalContext_;
|
||||
EGLContext eglTempContext_;
|
||||
bool isEGL_;
|
||||
PFN_eglGetCurrentContext eglGetCurrentContext_;
|
||||
|
||||
#ifdef _WIN32
|
||||
HGLRC hOrigGLRC_;
|
||||
HDC hDC_;
|
||||
HGLRC hIntGLRC_; // handle for internal GLRC to access shared context
|
||||
HDC tempDC_;
|
||||
HGLRC tempGLRC_;
|
||||
|
||||
public:
|
||||
PFN_wglCreateContext wglCreateContext_;
|
||||
PFN_wglGetCurrentContext wglGetCurrentContext_;
|
||||
PFN_wglGetCurrentDC wglGetCurrentDC_;
|
||||
PFN_wglDeleteContext wglDeleteContext_;
|
||||
PFN_wglMakeCurrent wglMakeCurrent_;
|
||||
PFN_wglShareLists wglShareLists_;
|
||||
#else
|
||||
public:
|
||||
Display* Dpy_;
|
||||
GLXDrawable Drawable_;
|
||||
GLXContext origCtx_;
|
||||
Display* intDpy_;
|
||||
Window intDrawable_;
|
||||
GLXContext intCtx_;
|
||||
Display* tempDpy_;
|
||||
GLXDrawable tempDrawable_;
|
||||
GLXContext tempCtx_;
|
||||
|
||||
//pointers to X11 functions
|
||||
PFNXOpenDisplay XOpenDisplay_;
|
||||
PFNXCloseDisplay XCloseDisplay_;
|
||||
|
||||
//pointers to GLX functions
|
||||
PFNglXGetCurrentDrawable glXGetCurrentDrawable_;
|
||||
PFNglXGetCurrentDisplay glXGetCurrentDisplay_;
|
||||
PFNglXGetCurrentContext glXGetCurrentContext_;
|
||||
PFNglXChooseVisual glXChooseVisual_;
|
||||
PFNglXCreateContext glXCreateContext_;
|
||||
PFNglXDestroyContext glXDestroyContext_;
|
||||
PFNglXMakeCurrent glXMakeCurrent_;
|
||||
#endif
|
||||
public:
|
||||
|
||||
GLFunctions(HMODULE h, bool isEGL);
|
||||
~GLFunctions();
|
||||
|
||||
bool IsCurrentGlContext(const amd::Context::Info& info) const {
|
||||
if (isEGL_) {
|
||||
return ((info.hCtx_ != nullptr) && (eglGetCurrentContext_ != nullptr) &&
|
||||
(info.hCtx_ == eglGetCurrentContext_()));
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
return ((info.hCtx_ != nullptr) && (info.hCtx_ == wglGetCurrentContext_()));
|
||||
#else
|
||||
return ((info.hCtx_ != nullptr) && (info.hCtx_ == glXGetCurrentContext_()));
|
||||
#endif // _WIN32
|
||||
}
|
||||
}
|
||||
|
||||
void WaitCurrentGlContext(const amd::Context::Info& info) const;
|
||||
|
||||
// Query CL-GL context association
|
||||
bool isAssociated() const
|
||||
{
|
||||
if (isEGL_ && eglDisplay_ && eglOriginalContext_) return true;
|
||||
#ifdef _WIN32
|
||||
if(hDC_ && hOrigGLRC_) return true;
|
||||
#else //!_WIN32
|
||||
if(Dpy_ && origCtx_) return true;
|
||||
#endif //!_WIN32
|
||||
return false;
|
||||
}
|
||||
bool isEGL() const
|
||||
{
|
||||
return isEGL_;
|
||||
}
|
||||
// Accessor methods
|
||||
#ifdef _WIN32
|
||||
HGLRC getOrigGLRC() const {return hOrigGLRC_;}
|
||||
HDC getDC() const {return hDC_;}
|
||||
HGLRC getIntGLRC() const {return hIntGLRC_;}
|
||||
#else //!_WIN32
|
||||
Display* getDpy() const {return Dpy_;}
|
||||
GLXDrawable getDrawable() const {return Drawable_;}
|
||||
GLXContext getOrigCtx() const {return origCtx_;}
|
||||
|
||||
Display* getIntDpy() const {return intDpy_;}
|
||||
GLXDrawable getIntDrawable() const {return intDrawable_;}
|
||||
GLXContext getIntCtx() const {return intCtx_;}
|
||||
|
||||
EGLDisplay getEglDpy() const { return eglDisplay_; }
|
||||
EGLContext getEglOrigCtx() const { return eglOriginalContext_; }
|
||||
#endif //!_WIN32
|
||||
|
||||
// Initialize GL dynamic library and function pointers
|
||||
bool init(intptr_t hdc, intptr_t hglrc);
|
||||
|
||||
// Return true if successful, false - if error occurred
|
||||
bool setIntEnv();
|
||||
bool restoreEnv();
|
||||
|
||||
amd::Monitor& getLock() { return lock_; }
|
||||
|
||||
PFN_xxxGetProcAddress GetProcAddress_;
|
||||
|
||||
#define GLPREFIX(rtype, fcn, dclargs) \
|
||||
PFN_##fcn fcn##_;
|
||||
// Declare pointers to GL functions
|
||||
#include "gl_functions.hpp"
|
||||
};
|
||||
|
||||
//! Functions for executing the GL related stuff
|
||||
cl_mem clCreateFromGLBufferAMD(Context& amdContext, cl_mem_flags flags,
|
||||
GLuint bufobj, cl_int* errcode_ret);
|
||||
cl_mem clCreateFromGLTextureAMD(Context& amdContext, cl_mem_flags flags,
|
||||
GLenum target, GLint miplevel, GLuint texture, int* errcode_ret);
|
||||
cl_mem clCreateFromGLRenderbufferAMD(Context& amdContext, cl_mem_flags flags,
|
||||
GLuint renderbuffer, int* errcode_ret);
|
||||
|
||||
bool
|
||||
getCLFormatFromGL(
|
||||
const Context& amdContext,
|
||||
GLint gliInternalFormat,
|
||||
cl_image_format* pclImageFormat,
|
||||
int* piBytesPerPixel,
|
||||
cl_mem_flags flags
|
||||
);
|
||||
|
||||
} //namespace amd
|
||||
|
||||
#endif //CL_GL_AMD_HPP_
|
||||
@@ -0,0 +1,295 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "vdi_common.hpp"
|
||||
#ifdef _WIN32
|
||||
#include <d3d10_1.h>
|
||||
#include "cl_d3d9_amd.hpp"
|
||||
#include "cl_d3d10_amd.hpp"
|
||||
#include "cl_d3d11_amd.hpp"
|
||||
#endif //_WIN32
|
||||
|
||||
#include <mutex>
|
||||
|
||||
amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
|
||||
{amd::ICDDispatchedObject::icdVendorDispatch_};
|
||||
|
||||
static cl_int CL_API_CALL icdGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name,
|
||||
size_t param_value_size, void* param_value,
|
||||
size_t* param_value_size_ret) {
|
||||
if (platform != reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform)) {
|
||||
return CL_INVALID_PLATFORM;
|
||||
}
|
||||
|
||||
return clGetPlatformInfo(NULL, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int CL_API_CALL icdGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
|
||||
cl_uint num_entries, cl_device_id* devices,
|
||||
cl_uint* num_devices) {
|
||||
return clGetDeviceIDs(NULL, device_type, num_entries, devices, num_devices);
|
||||
}
|
||||
|
||||
static cl_int CL_API_CALL icdGetDeviceInfo(cl_device_id device, cl_device_info param_name,
|
||||
size_t param_value_size, void* param_value,
|
||||
size_t* param_value_size_ret) {
|
||||
if (param_name == CL_DEVICE_PLATFORM) {
|
||||
// Return the ICD platform instead of the default NULL platform.
|
||||
cl_platform_id platform = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
||||
return amd::clGetInfo(platform, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
return clGetDeviceInfo(device, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
cl_icd_dispatch amd::ICDDispatchedObject::icdVendorDispatch_[] = {
|
||||
{NULL /* should not get called */, icdGetPlatformInfo, icdGetDeviceIDs, icdGetDeviceInfo,
|
||||
clCreateContext, clCreateContextFromType, clRetainContext, clReleaseContext, clGetContextInfo,
|
||||
clCreateCommandQueue, clRetainCommandQueue, clReleaseCommandQueue, clGetCommandQueueInfo,
|
||||
clSetCommandQueueProperty, clCreateBuffer, clCreateImage2D, clCreateImage3D, clRetainMemObject,
|
||||
clReleaseMemObject, clGetSupportedImageFormats, clGetMemObjectInfo, clGetImageInfo,
|
||||
clCreateSampler, clRetainSampler, clReleaseSampler, clGetSamplerInfo,
|
||||
clCreateProgramWithSource, clCreateProgramWithBinary, clRetainProgram, clReleaseProgram,
|
||||
clBuildProgram, clUnloadCompiler, clGetProgramInfo, clGetProgramBuildInfo, clCreateKernel,
|
||||
clCreateKernelsInProgram, clRetainKernel, clReleaseKernel, clSetKernelArg, clGetKernelInfo,
|
||||
clGetKernelWorkGroupInfo, clWaitForEvents, clGetEventInfo, clRetainEvent, clReleaseEvent,
|
||||
clGetEventProfilingInfo, clFlush, clFinish, clEnqueueReadBuffer, clEnqueueWriteBuffer,
|
||||
clEnqueueCopyBuffer, clEnqueueReadImage, clEnqueueWriteImage, clEnqueueCopyImage,
|
||||
clEnqueueCopyImageToBuffer, clEnqueueCopyBufferToImage, clEnqueueMapBuffer, clEnqueueMapImage,
|
||||
clEnqueueUnmapMemObject, clEnqueueNDRangeKernel, clEnqueueTask, clEnqueueNativeKernel,
|
||||
clEnqueueMarker, clEnqueueWaitForEvents, clEnqueueBarrier, clGetExtensionFunctionAddress,
|
||||
clCreateFromGLBuffer, clCreateFromGLTexture2D, clCreateFromGLTexture3D,
|
||||
clCreateFromGLRenderbuffer, clGetGLObjectInfo, clGetGLTextureInfo, clEnqueueAcquireGLObjects,
|
||||
clEnqueueReleaseGLObjects, clGetGLContextInfoKHR,
|
||||
WINDOWS_SWITCH(clGetDeviceIDsFromD3D10KHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D10BufferKHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D10Texture2DKHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D10Texture3DKHR, NULL),
|
||||
WINDOWS_SWITCH(clEnqueueAcquireD3D10ObjectsKHR, NULL),
|
||||
WINDOWS_SWITCH(clEnqueueReleaseD3D10ObjectsKHR, NULL), clSetEventCallback, clCreateSubBuffer,
|
||||
clSetMemObjectDestructorCallback, clCreateUserEvent, clSetUserEventStatus,
|
||||
clEnqueueReadBufferRect, clEnqueueWriteBufferRect, clEnqueueCopyBufferRect,
|
||||
NULL, NULL, NULL, clCreateEventFromGLsyncKHR,
|
||||
|
||||
/* OpenCL 1.2*/
|
||||
clCreateSubDevices, clRetainDevice, clReleaseDevice, clCreateImage,
|
||||
clCreateProgramWithBuiltInKernels, clCompileProgram, clLinkProgram, clUnloadPlatformCompiler,
|
||||
clGetKernelArgInfo, clEnqueueFillBuffer, clEnqueueFillImage, clEnqueueMigrateMemObjects,
|
||||
clEnqueueMarkerWithWaitList, clEnqueueBarrierWithWaitList,
|
||||
clGetExtensionFunctionAddressForPlatform, clCreateFromGLTexture,
|
||||
|
||||
WINDOWS_SWITCH(clGetDeviceIDsFromD3D11KHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D11BufferKHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D11Texture2DKHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromD3D11Texture3DKHR, NULL),
|
||||
WINDOWS_SWITCH(clCreateFromDX9MediaSurfaceKHR, NULL),
|
||||
WINDOWS_SWITCH(clEnqueueAcquireD3D11ObjectsKHR, NULL),
|
||||
WINDOWS_SWITCH(clEnqueueReleaseD3D11ObjectsKHR, NULL),
|
||||
|
||||
WINDOWS_SWITCH(clGetDeviceIDsFromDX9MediaAdapterKHR,
|
||||
NULL), // KHRpfn_clGetDeviceIDsFromDX9MediaAdapterKHR
|
||||
// clGetDeviceIDsFromDX9MediaAdapterKHR;
|
||||
WINDOWS_SWITCH(
|
||||
clEnqueueAcquireDX9MediaSurfacesKHR,
|
||||
NULL), // KHRpfn_clEnqueueAcquireDX9MediaSurfacesKHR clEnqueueAcquireDX9MediaSurfacesKHR;
|
||||
WINDOWS_SWITCH(
|
||||
clEnqueueReleaseDX9MediaSurfacesKHR,
|
||||
NULL), // KHRpfn_clEnqueueReleaseDX9MediaSurfacesKHR clEnqueueReleaseDX9MediaSurfacesKHR;
|
||||
|
||||
NULL,
|
||||
NULL, NULL, NULL,
|
||||
|
||||
clCreateCommandQueueWithProperties, clCreatePipe, clGetPipeInfo, clSVMAlloc, clSVMFree,
|
||||
clEnqueueSVMFree, clEnqueueSVMMemcpy, clEnqueueSVMMemFill, clEnqueueSVMMap, clEnqueueSVMUnmap,
|
||||
clCreateSamplerWithProperties, clSetKernelArgSVMPointer, clSetKernelExecInfo,
|
||||
clGetKernelSubGroupInfo,
|
||||
clCloneKernel,
|
||||
clCreateProgramWithIL,
|
||||
clEnqueueSVMMigrateMem,
|
||||
clGetDeviceAndHostTimer,
|
||||
clGetHostTimer,
|
||||
clGetKernelSubGroupInfo,
|
||||
clSetDefaultDeviceCommandQueue,
|
||||
|
||||
clSetProgramReleaseCallback,
|
||||
clSetProgramSpecializationConstant }};
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <Shlwapi.h>
|
||||
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
|
||||
static bool ShouldLoadPlatform() {
|
||||
// Get the OpenCL ICD registry values
|
||||
HKEY platformsKey = NULL;
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\OpenCL\\Vendors", 0, KEY_READ,
|
||||
&platformsKey) != ERROR_SUCCESS)
|
||||
return true;
|
||||
|
||||
std::vector<std::string> registryValues;
|
||||
DWORD dwIndex = 0;
|
||||
while (true) {
|
||||
char cszLibraryName[1024] = {0};
|
||||
DWORD dwLibraryNameSize = sizeof(cszLibraryName);
|
||||
DWORD dwLibraryNameType = 0;
|
||||
DWORD dwValue = 0;
|
||||
DWORD dwValueSize = sizeof(dwValue);
|
||||
|
||||
if (RegEnumValueA(platformsKey, dwIndex++, cszLibraryName, &dwLibraryNameSize, NULL,
|
||||
&dwLibraryNameType, (LPBYTE)&dwValue, &dwValueSize) != ERROR_SUCCESS)
|
||||
break;
|
||||
// Require that the value be a DWORD and equal zero
|
||||
if (dwLibraryNameType != REG_DWORD || dwValue != 0) {
|
||||
continue;
|
||||
}
|
||||
registryValues.push_back(cszLibraryName);
|
||||
}
|
||||
RegCloseKey(platformsKey);
|
||||
|
||||
HMODULE hm = NULL;
|
||||
if (!GetModuleHandleExA(
|
||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
(LPCSTR)&ShouldLoadPlatform, &hm))
|
||||
return true;
|
||||
|
||||
char cszDllPath[1024] = {0};
|
||||
if (!GetModuleFileNameA(hm, cszDllPath, sizeof(cszDllPath))) return true;
|
||||
|
||||
// If we are loaded from the DriverStore, then there should be a registry
|
||||
// value matching our current module absolute path.
|
||||
if (std::find(registryValues.begin(), registryValues.end(), cszDllPath) == registryValues.end())
|
||||
return true;
|
||||
|
||||
LPSTR cszFileName;
|
||||
char buffer[1024] = {0};
|
||||
if (!GetFullPathNameA(cszDllPath, sizeof(buffer), buffer, &cszFileName)) return true;
|
||||
|
||||
// We found an absolute path in the registry that matched this DLL, now
|
||||
// check if there is also an entry with the same filename.
|
||||
if (std::find(registryValues.begin(), registryValues.end(), cszFileName) == registryValues.end())
|
||||
return true;
|
||||
|
||||
// Lastly, check if there is a DLL with the same name in the System folder.
|
||||
char cszSystemPath[1024] = {0};
|
||||
#if defined(ATI_BITS_32)
|
||||
if (!GetSystemWow64DirectoryA(cszSystemPath, sizeof(cszSystemPath)))
|
||||
#endif // defined(ATI_BITS_32)
|
||||
if (!GetSystemDirectoryA(cszSystemPath, sizeof(cszSystemPath))) return true;
|
||||
|
||||
std::string systemDllPath;
|
||||
systemDllPath.append(cszSystemPath).append("\\").append(cszFileName);
|
||||
if (!PathFileExistsA(systemDllPath.c_str())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we get here, then all 3 conditions are true:
|
||||
// - An entry in the registry with an absolute path matches the current DLL
|
||||
// - An entry in the registry with a relative path matches the current DLL
|
||||
// - A DLL with the same name was found in the system directory
|
||||
//
|
||||
// We should not load this platform!
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
// If there is only one platform, load it.
|
||||
// If there is more than one platform, only load platforms that have visible devices
|
||||
// If all platforms have no devices available, only load the PAL platform
|
||||
static bool ShouldLoadPlatform() {
|
||||
bool shouldLoad = true;
|
||||
|
||||
if (!amd::Runtime::initialized()) {
|
||||
amd::Runtime::init();
|
||||
}
|
||||
const int numDevices = amd::Device::numDevices(CL_DEVICE_TYPE_GPU, false);
|
||||
|
||||
void *otherPlatform = nullptr;
|
||||
if (amd::IS_LEGACY) {
|
||||
otherPlatform = dlopen("libamdocl64.so", RTLD_LAZY);
|
||||
if (otherPlatform != nullptr) { // Present platform exists
|
||||
shouldLoad = numDevices > 0;
|
||||
}
|
||||
} else {
|
||||
otherPlatform = dlopen("libamdocl-orca64.so", RTLD_LAZY);
|
||||
if (otherPlatform != nullptr) { // Legacy platform exists
|
||||
// gcc4.8 doesn't support casting void* to a function pointer
|
||||
// Work around this by creating a typedef untill we upgrade the compiler
|
||||
typedef void*(*clGetFunctionAddress_t)(const char *);
|
||||
typedef cl_int(*clIcdGetPlatformIDs_t)(cl_uint, cl_platform_id *, cl_uint *);
|
||||
|
||||
clGetFunctionAddress_t legacyGetFunctionAddress =
|
||||
reinterpret_cast<clGetFunctionAddress_t>(dlsym(otherPlatform, "clGetExtensionFunctionAddress"));
|
||||
clIcdGetPlatformIDs_t legacyGetPlatformIDs =
|
||||
reinterpret_cast<clIcdGetPlatformIDs_t>(legacyGetFunctionAddress("clIcdGetPlatformIDsKHR"));
|
||||
|
||||
cl_uint numLegacyPlatforms = 0;
|
||||
legacyGetPlatformIDs(0, nullptr, &numLegacyPlatforms);
|
||||
|
||||
shouldLoad = (numDevices > 0) || (numLegacyPlatforms == 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (otherPlatform != nullptr) {
|
||||
dlclose(otherPlatform);
|
||||
}
|
||||
|
||||
return shouldLoad;
|
||||
}
|
||||
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint num_entries,
|
||||
cl_platform_id* platforms,
|
||||
cl_uint* num_platforms) {
|
||||
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL) ||
|
||||
(num_entries == 0 && platforms != NULL)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
static bool shouldLoad = true;
|
||||
|
||||
static std::once_flag initOnce;
|
||||
std::call_once(initOnce, [](){ shouldLoad = ShouldLoadPlatform(); });
|
||||
|
||||
if (!shouldLoad) {
|
||||
*not_null(num_platforms) = 0;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
if (!amd::Runtime::initialized()) {
|
||||
amd::Runtime::init();
|
||||
}
|
||||
|
||||
if (num_platforms != NULL && platforms == NULL) {
|
||||
*num_platforms = 1;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
assert(platforms != NULL && "check the code above");
|
||||
*platforms = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
||||
|
||||
*not_null(num_platforms) = 1;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,739 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_ICD_H
|
||||
#define __OPENCL_CL_ICD_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_gl.h>
|
||||
|
||||
#define cl_khr_icd 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetPlatformIDs_fn)(
|
||||
cl_uint /* num_entries */, cl_platform_id* /* platforms */,
|
||||
cl_uint* /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetPlatformInfo_fn)(
|
||||
cl_platform_id /* platform */, cl_platform_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetDeviceIDs_fn)(
|
||||
cl_platform_id /* platform */, cl_device_type /* device_type */, cl_uint /* num_entries */,
|
||||
cl_device_id* /* devices */, cl_uint* /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetDeviceInfo_fn)(
|
||||
cl_device_id /* device */, cl_device_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_context(CL_API_CALL* clCreateContext_fn)(
|
||||
const cl_context_properties* /* properties */, cl_uint /* num_devices */,
|
||||
const cl_device_id* /* devices */,
|
||||
void(CL_CALLBACK* /* pfn_notify */)(const char*, const void*, size_t, void*),
|
||||
void* /* user_data */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_context(CL_API_CALL* clCreateContextFromType_fn)(
|
||||
const cl_context_properties* /* properties */, cl_device_type /* device_type */,
|
||||
void(CL_CALLBACK* /* pfn_notify*/)(const char*, const void*, size_t, void*),
|
||||
void* /* user_data */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainContext_fn)(cl_context /* context */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseContext_fn)(cl_context /* context */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetContextInfo_fn)(
|
||||
cl_context /* context */, cl_context_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_command_queue(CL_API_CALL* clCreateCommandQueue_fn)(
|
||||
cl_context /* context */, cl_device_id /* device */,
|
||||
cl_command_queue_properties /* properties */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainCommandQueue_fn)(cl_command_queue /* command_queue */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseCommandQueue_fn)(cl_command_queue /* command_queue */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetCommandQueueInfo_fn)(
|
||||
cl_command_queue /* command_queue */, cl_command_queue_info /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */,
|
||||
size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetCommandQueueProperty_fn)(
|
||||
cl_command_queue /* command_queue */, cl_command_queue_properties /* properties */,
|
||||
cl_bool /* enable */,
|
||||
cl_command_queue_properties* /* old_properties */) /*CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED*/;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateBuffer_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, size_t /* size */, void* /* host_ptr */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateSubBuffer_fn)(
|
||||
cl_mem /* buffer */, cl_mem_flags /* flags */, cl_buffer_create_type /* buffer_create_type */,
|
||||
const void* /* buffer_create_info */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateImage2D_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, const cl_image_format* /* image_format */,
|
||||
size_t /* image_width */, size_t /* image_height */, size_t /* image_row_pitch */,
|
||||
void* /* host_ptr */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateImage3D_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, const cl_image_format* /* image_format */,
|
||||
size_t /* image_width */, size_t /* image_height */, size_t /* image_depth */,
|
||||
size_t /* image_row_pitch */, size_t /* image_slice_pitch */, void* /* host_ptr */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainMemObject_fn)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseMemObject_fn)(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetSupportedImageFormats_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_mem_object_type /* image_type */,
|
||||
cl_uint /* num_entries */, cl_image_format* /* image_formats */,
|
||||
cl_uint* /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetMemObjectInfo_fn)(
|
||||
cl_mem /* memobj */, cl_mem_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetImageInfo_fn)(
|
||||
cl_mem /* image */, cl_image_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetMemObjectDestructorCallback_fn)(
|
||||
cl_mem /* memobj */,
|
||||
void(CL_CALLBACK* /*pfn_notify*/)(cl_mem /* memobj */, void* /*user_data*/),
|
||||
void* /*user_data */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* Sampler APIs */
|
||||
typedef cl_sampler(CL_API_CALL* clCreateSampler_fn)(
|
||||
cl_context /* context */, cl_bool /* normalized_coords */,
|
||||
cl_addressing_mode /* addressing_mode */, cl_filter_mode /* filter_mode */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainSampler_fn)(cl_sampler /* sampler */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseSampler_fn)(cl_sampler /* sampler */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetSamplerInfo_fn)(
|
||||
cl_sampler /* sampler */, cl_sampler_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Program Object APIs */
|
||||
typedef cl_program(CL_API_CALL* clCreateProgramWithSource_fn)(
|
||||
cl_context /* context */, cl_uint /* count */, const char** /* strings */,
|
||||
const size_t* /* lengths */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_program CL_API_CALL
|
||||
clCreateProgramWithIL(cl_context /* context */,
|
||||
const void * /* strings */, size_t /* lengths */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_program(CL_API_CALL* clCreateProgramWithILKHR_fn)(
|
||||
cl_context /* context */, const void* /* il */, size_t /* length */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_program(CL_API_CALL* clCreateProgramWithBinary_fn)(
|
||||
cl_context /* context */, cl_uint /* num_devices */, const cl_device_id* /* device_list */,
|
||||
const size_t* /* lengths */, const unsigned char** /* binaries */, cl_int* /* binary_status */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainProgram_fn)(cl_program /* program */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseProgram_fn)(cl_program /* program */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clBuildProgram_fn)(
|
||||
cl_program /* program */, cl_uint /* num_devices */, const cl_device_id* /* device_list */,
|
||||
const char* /* options */,
|
||||
void(CL_CALLBACK* /* pfn_notify */)(cl_program /* program */, void* /* user_data */),
|
||||
void* /* user_data */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clUnloadCompiler_fn)(void) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetProgramInfo_fn)(
|
||||
cl_program /* program */, cl_program_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetProgramBuildInfo_fn)(
|
||||
cl_program /* program */, cl_device_id /* device */, cl_program_build_info /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */,
|
||||
size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Kernel Object APIs */
|
||||
typedef cl_kernel(CL_API_CALL* clCreateKernel_fn)(
|
||||
cl_program /* program */, const char* /* kernel_name */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clCreateKernelsInProgram_fn)(
|
||||
cl_program /* program */, cl_uint /* num_kernels */, cl_kernel* /* kernels */,
|
||||
cl_uint* /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainKernel_fn)(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseKernel_fn)(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetKernelArg_fn)(cl_kernel /* kernel */, cl_uint /* arg_index */,
|
||||
size_t /* arg_size */, const void* /* arg_value */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetKernelInfo_fn)(
|
||||
cl_kernel /* kernel */, cl_kernel_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetKernelWorkGroupInfo_fn)(
|
||||
cl_kernel /* kernel */, cl_device_id /* device */, cl_kernel_work_group_info /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */,
|
||||
size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Event Object APIs */
|
||||
typedef cl_int(CL_API_CALL* clWaitForEvents_fn)(
|
||||
cl_uint /* num_events */, const cl_event* /* event_list */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetEventInfo_fn)(
|
||||
cl_event /* event */, cl_event_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_event(CL_API_CALL* clCreateUserEvent_fn)(
|
||||
cl_context /* context */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainEvent_fn)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseEvent_fn)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetUserEventStatus_fn)(
|
||||
cl_event /* event */, cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetEventCallback_fn)(
|
||||
cl_event /* event */, cl_int /* command_exec_callback_type */,
|
||||
void(CL_CALLBACK* /* pfn_notify */)(cl_event, cl_int, void*),
|
||||
void* /* user_data */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* Profiling APIs */
|
||||
typedef cl_int(CL_API_CALL* clGetEventProfilingInfo_fn)(
|
||||
cl_event /* event */, cl_profiling_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Flush and Finish APIs */
|
||||
typedef cl_int(CL_API_CALL* clFlush_fn)(cl_command_queue /* command_queue */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clFinish_fn)(cl_command_queue /* command_queue */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Enqueued Commands APIs */
|
||||
typedef cl_int(CL_API_CALL* clEnqueueReadBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */,
|
||||
size_t /* offset */, size_t /* cb */, void* /* ptr */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueReadBufferRect_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */,
|
||||
const size_t* /* buffer_offset */, const size_t* /* host_offset */, const size_t* /* region */,
|
||||
size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */, size_t /* host_row_pitch */,
|
||||
size_t /* host_slice_pitch */, void* /* ptr */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueWriteBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_write */,
|
||||
size_t /* offset */, size_t /* cb */, const void* /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueWriteBufferRect_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */,
|
||||
const size_t* /* buffer_offset */, const size_t* /* host_offset */, const size_t* /* region */,
|
||||
size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */, size_t /* host_row_pitch */,
|
||||
size_t /* host_slice_pitch */, const void* /* ptr */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueCopyBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_buffer */,
|
||||
size_t /* src_offset */, size_t /* dst_offset */, size_t /* cb */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueCopyBufferRect_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_buffer */,
|
||||
const size_t* /* src_origin */, const size_t* /* dst_origin */, const size_t* /* region */,
|
||||
size_t /* src_row_pitch */, size_t /* src_slice_pitch */, size_t /* dst_row_pitch */,
|
||||
size_t /* dst_slice_pitch */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueReadImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_read */,
|
||||
const size_t* /* origin[3] */, const size_t* /* region[3] */, size_t /* row_pitch */,
|
||||
size_t /* slice_pitch */, void* /* ptr */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueWriteImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_write */,
|
||||
const size_t* /* origin[3] */, const size_t* /* region[3] */, size_t /* input_row_pitch */,
|
||||
size_t /* input_slice_pitch */, const void* /* ptr */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueCopyImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* src_image */, cl_mem /* dst_image */,
|
||||
const size_t* /* src_origin[3] */, const size_t* /* dst_origin[3] */,
|
||||
const size_t* /* region[3] */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueCopyImageToBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* src_image */, cl_mem /* dst_buffer */,
|
||||
const size_t* /* src_origin[3] */, const size_t* /* region[3] */, size_t /* dst_offset */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueCopyBufferToImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_image */,
|
||||
size_t /* src_offset */, const size_t* /* dst_origin[3] */, const size_t* /* region[3] */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef void*(CL_API_CALL* clEnqueueMapBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_map */,
|
||||
cl_map_flags /* map_flags */, size_t /* offset */, size_t /* cb */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */, cl_int* /* errcode_ret */)CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef void*(CL_API_CALL* clEnqueueMapImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* image */, cl_bool /* blocking_map */,
|
||||
cl_map_flags /* map_flags */, const size_t* /* origin[3] */, const size_t* /* region[3] */,
|
||||
size_t* /* image_row_pitch */, size_t* /* image_slice_pitch */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */, cl_int* /* errcode_ret */)CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueUnmapMemObject_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* memobj */, void* /* mapped_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueNDRangeKernel_fn)(
|
||||
cl_command_queue /* command_queue */, cl_kernel /* kernel */, cl_uint /* work_dim */,
|
||||
const size_t* /* global_work_offset */, const size_t* /* global_work_size */,
|
||||
const size_t* /* local_work_size */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueTask_fn)(cl_command_queue /* command_queue */,
|
||||
cl_kernel /* kernel */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueNativeKernel_fn)(
|
||||
cl_command_queue /* command_queue */, void(CL_CALLBACK* user_func)(void*), void* /* args */,
|
||||
size_t /* cb_args */, cl_uint /* num_mem_objects */, const cl_mem* /* mem_list */,
|
||||
const void** /* args_mem_loc */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueMarker_fn)(cl_command_queue /* command_queue */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueWaitForEvents_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_events */,
|
||||
const cl_event* /* event_list */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueBarrier_fn)(cl_command_queue /* command_queue */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef void*(CL_API_CALL* clGetExtensionFunctionAddress_fn)(const char* /* func_name */)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateFromGLBuffer_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_GLuint /* bufobj */,
|
||||
int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateFromGLTexture2D_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */, cl_GLuint /* texture */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateFromGLTexture3D_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */, cl_GLuint /* texture */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateFromGLRenderbuffer_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_GLuint /* renderbuffer */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetGLObjectInfo_fn)(
|
||||
cl_mem /* memobj */, cl_gl_object_type* /* gl_object_type */,
|
||||
cl_GLuint* /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetGLTextureInfo_fn)(
|
||||
cl_mem /* memobj */, cl_gl_texture_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_event(CL_API_CALL* clCreateEventFromGLsyncKHR_fn)(
|
||||
cl_context /* context */, cl_GLsync /* cl_GLsync */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueAcquireGLObjects_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_objects */,
|
||||
const cl_mem* /* mem_objects */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueReleaseGLObjects_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_objects */,
|
||||
const cl_mem* /* mem_objects */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clCreateSubDevices_fn)(
|
||||
cl_device_id /* in_device */, const cl_device_partition_property* /* properties */,
|
||||
cl_uint /* num_entries */, cl_device_id* /* out_devices */,
|
||||
cl_uint* /* num_devices */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clRetainDevice_fn)(cl_device_id /* device */)
|
||||
CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clReleaseDevice_fn)(cl_device_id /* device */)
|
||||
CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateImage_fn)(cl_context /* context */, cl_mem_flags /* flags */,
|
||||
const cl_image_format* /* image_format*/,
|
||||
const cl_image_desc* /* image_desc*/,
|
||||
void* /* host_ptr */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_program(CL_API_CALL* clCreateProgramWithBuiltInKernels_fn)(
|
||||
cl_context /* context */, cl_uint /* num_devices */, const cl_device_id* /* device_list */,
|
||||
const char* /* kernel_names */, cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clCompileProgram_fn)(
|
||||
cl_program /* program */, cl_uint /* num_devices */, const cl_device_id* /* device_list */,
|
||||
const char* /* options */, cl_uint /* num_input_headers */,
|
||||
const cl_program* /* input_headers */, const char** /* header_include_names */,
|
||||
void(CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
|
||||
void* /* user_data */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_program(CL_API_CALL* clLinkProgram_fn)(
|
||||
cl_context /* context */, cl_uint /* num_devices */, const cl_device_id* /* device_list */,
|
||||
const char* /* options */, cl_uint /* num_input_programs */,
|
||||
const cl_program* /* input_programs */,
|
||||
void(CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* /* user_data */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clUnloadPlatformCompiler_fn)(cl_platform_id /* platform */)
|
||||
CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetKernelArgInfo_fn)(
|
||||
cl_kernel /* kernel */, cl_uint /* arg_indx */, cl_kernel_arg_info /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */,
|
||||
size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueFillBuffer_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* buffer */, const void* /* pattern */,
|
||||
size_t /* pattern_size */, size_t /* offset */, size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueFillImage_fn)(
|
||||
cl_command_queue /* command_queue */, cl_mem /* image */, const void* /* fill_color */,
|
||||
const size_t* /* origin */, const size_t* /* region */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueMigrateMemObjects_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_mem_objects */,
|
||||
const cl_mem* /* mem_objects */, cl_mem_migration_flags /* flags */,
|
||||
cl_uint /* num_events_in_wait_list */, const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueMarkerWithWaitList_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueBarrierWithWaitList_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef void*(CL_API_CALL* clGetExtensionFunctionAddressForPlatform_fn)(
|
||||
cl_platform_id /* platform */, const char* /* funcname */)CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreateFromGLTexture_fn)(
|
||||
cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* texture_target */,
|
||||
cl_GLint /* miplevel */, cl_GLuint /* texture */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef cl_command_queue(CL_API_CALL* clCreateCommandQueueWithProperties_fn)(
|
||||
cl_context /* context */, cl_device_id /* device */,
|
||||
const cl_queue_properties* /* properties */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_sampler(CL_API_CALL* clCreateSamplerWithProperties_fn)(
|
||||
cl_context /* context */, const cl_sampler_properties* /* properties */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef void*(CL_API_CALL* clSVMAlloc_fn)(cl_context /* context */, cl_svm_mem_flags /* flags */,
|
||||
size_t /* size */,
|
||||
cl_uint /* alignment */)CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef void(CL_API_CALL* clSVMFree_fn)(cl_context /* context */,
|
||||
void* /* svm_pointer */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetKernelArgSVMPointer_fn)(
|
||||
cl_kernel /* kernel */, cl_uint /* arg_index */,
|
||||
const void* /* arg_value */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetKernelExecInfo_fn)(
|
||||
cl_kernel /* kernel */, cl_kernel_exec_info /* param_name */, size_t /* param_value_size */,
|
||||
const void* /* param_value */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueSVMFree_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_svm_pointers */,
|
||||
void* [] /* svm_pointers */,
|
||||
void(CL_CALLBACK* /* pfn_free_func */)(cl_command_queue /* queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void* [] /* svm_pointers */, void* /* user_data */),
|
||||
void* /* user_data */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueSVMMemcpy_fn)(
|
||||
cl_command_queue /* command_queue */, cl_bool /* blocking_copy */, void* /* dst_ptr */,
|
||||
const void* /* src_ptr */, size_t /* size */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueSVMMemFill_fn)(
|
||||
cl_command_queue /* command_queue */, void* /* svm_ptr */, const void* /* pattern */,
|
||||
size_t /* pattern_size */, size_t /* size */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueSVMMap_fn)(
|
||||
cl_command_queue /* command_queue */, cl_bool /* blocking_map */, cl_map_flags /* flags */,
|
||||
void* /* svm_ptr */, size_t /* size */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clEnqueueSVMUnmap_fn)(cl_command_queue /* command_queue */,
|
||||
void* /* svm_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */,
|
||||
cl_event* /* event */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_mem(CL_API_CALL* clCreatePipe_fn)(cl_context /* context */, cl_mem_flags /* flags */,
|
||||
cl_uint /* pipe_packet_size */,
|
||||
cl_uint /* pipe_max_packets */,
|
||||
const cl_pipe_properties* /* properties */,
|
||||
cl_int* /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetPipeInfo_fn)(
|
||||
cl_mem /* pipe */, cl_pipe_info /* param_name */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef cl_int(CL_API_CALL* clGetKernelSubGroupInfoKHR_fn)(
|
||||
cl_kernel /* kernel */, cl_device_id /* device */, cl_kernel_sub_group_info /* param_name */,
|
||||
size_t /* input_value_size */, const void* /* input_value */, size_t /* param_value_size */,
|
||||
void* /* param_value */, size_t* /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0;
|
||||
|
||||
|
||||
typedef cl_int(CL_API_CALL* clSetDefaultDeviceCommandQueue_fn)(
|
||||
cl_context /* context */, cl_device_id /* device */,
|
||||
cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_2_1;
|
||||
|
||||
typedef cl_kernel(CL_API_CALL* clCloneKernel_fn)(
|
||||
cl_kernel /* source_kernel */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_1;
|
||||
|
||||
typedef cl_int (CL_API_CALL* clEnqueueSVMMigrateMem_fn)(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_svm_pointers */,
|
||||
const void ** /* svm_pointers */, const size_t * /* sizes */,
|
||||
cl_mem_migration_flags /* flags */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_2_1;
|
||||
|
||||
typedef cl_int (CL_API_CALL* clGetDeviceAndHostTimer_fn)(
|
||||
cl_device_id /* device */, cl_ulong * /* device_timestamp */,
|
||||
cl_ulong * /* host_timestamp */) CL_API_SUFFIX__VERSION_2_1;
|
||||
|
||||
typedef cl_int (CL_API_CALL* clGetHostTimer_fn)(
|
||||
cl_device_id /* device */, cl_ulong * /* host_timestamp */) CL_API_SUFFIX__VERSION_2_1;
|
||||
|
||||
typedef cl_int (CL_API_CALL* clSetProgramSpecializationConstant_fn)(
|
||||
cl_program /* program */, cl_uint /* spec_id */, size_t /* spec_size */,
|
||||
const void* /* spec_value */) CL_API_SUFFIX__VERSION_2_2;
|
||||
|
||||
typedef cl_int (CL_API_CALL* clSetProgramReleaseCallback_fn)(
|
||||
cl_program /* program */,
|
||||
void (CL_CALLBACK * /* pfn_notify */)(cl_program program, void * user_data),
|
||||
void * /* user_data */) CL_API_SUFFIX__VERSION_2_2;
|
||||
|
||||
typedef struct _cl_icd_dispatch_table {
|
||||
/* OpenCL 1.0 */
|
||||
clGetPlatformIDs_fn GetPlatformIDs;
|
||||
clGetPlatformInfo_fn GetPlatformInfo;
|
||||
clGetDeviceIDs_fn GetDeviceIDs;
|
||||
clGetDeviceInfo_fn GetDeviceInfo;
|
||||
clCreateContext_fn CreateContext;
|
||||
clCreateContextFromType_fn CreateContextFromType;
|
||||
clRetainContext_fn RetainContext;
|
||||
clReleaseContext_fn ReleaseContext;
|
||||
clGetContextInfo_fn GetContextInfo;
|
||||
clCreateCommandQueue_fn CreateCommandQueue;
|
||||
clRetainCommandQueue_fn RetainCommandQueue;
|
||||
clReleaseCommandQueue_fn ReleaseCommandQueue;
|
||||
clGetCommandQueueInfo_fn GetCommandQueueInfo;
|
||||
clSetCommandQueueProperty_fn SetCommandQueueProperty;
|
||||
clCreateBuffer_fn CreateBuffer;
|
||||
clCreateImage2D_fn CreateImage2D;
|
||||
clCreateImage3D_fn CreateImage3D;
|
||||
clRetainMemObject_fn RetainMemObject;
|
||||
clReleaseMemObject_fn ReleaseMemObject;
|
||||
clGetSupportedImageFormats_fn GetSupportedImageFormats;
|
||||
clGetMemObjectInfo_fn GetMemObjectInfo;
|
||||
clGetImageInfo_fn GetImageInfo;
|
||||
clCreateSampler_fn CreateSampler;
|
||||
clRetainSampler_fn RetainSampler;
|
||||
clReleaseSampler_fn ReleaseSampler;
|
||||
clGetSamplerInfo_fn GetSamplerInfo;
|
||||
clCreateProgramWithSource_fn CreateProgramWithSource;
|
||||
clCreateProgramWithBinary_fn CreateProgramWithBinary;
|
||||
clRetainProgram_fn RetainProgram;
|
||||
clReleaseProgram_fn ReleaseProgram;
|
||||
clBuildProgram_fn BuildProgram;
|
||||
clUnloadCompiler_fn UnloadCompiler;
|
||||
clGetProgramInfo_fn GetProgramInfo;
|
||||
clGetProgramBuildInfo_fn GetProgramBuildInfo;
|
||||
clCreateKernel_fn CreateKernel;
|
||||
clCreateKernelsInProgram_fn CreateKernelsInProgram;
|
||||
clRetainKernel_fn RetainKernel;
|
||||
clReleaseKernel_fn ReleaseKernel;
|
||||
clSetKernelArg_fn SetKernelArg;
|
||||
clGetKernelInfo_fn GetKernelInfo;
|
||||
clGetKernelWorkGroupInfo_fn GetKernelWorkGroupInfo;
|
||||
clWaitForEvents_fn WaitForEvents;
|
||||
clGetEventInfo_fn GetEventInfo;
|
||||
clRetainEvent_fn RetainEvent;
|
||||
clReleaseEvent_fn ReleaseEvent;
|
||||
clGetEventProfilingInfo_fn GetEventProfilingInfo;
|
||||
clFlush_fn Flush;
|
||||
clFinish_fn Finish;
|
||||
clEnqueueReadBuffer_fn EnqueueReadBuffer;
|
||||
clEnqueueWriteBuffer_fn EnqueueWriteBuffer;
|
||||
clEnqueueCopyBuffer_fn EnqueueCopyBuffer;
|
||||
clEnqueueReadImage_fn EnqueueReadImage;
|
||||
clEnqueueWriteImage_fn EnqueueWriteImage;
|
||||
clEnqueueCopyImage_fn EnqueueCopyImage;
|
||||
clEnqueueCopyImageToBuffer_fn EnqueueCopyImageToBuffer;
|
||||
clEnqueueCopyBufferToImage_fn EnqueueCopyBufferToImage;
|
||||
clEnqueueMapBuffer_fn EnqueueMapBuffer;
|
||||
clEnqueueMapImage_fn EnqueueMapImage;
|
||||
clEnqueueUnmapMemObject_fn EnqueueUnmapMemObject;
|
||||
clEnqueueNDRangeKernel_fn EnqueueNDRangeKernel;
|
||||
clEnqueueTask_fn EnqueueTask;
|
||||
clEnqueueNativeKernel_fn EnqueueNativeKernel;
|
||||
clEnqueueMarker_fn EnqueueMarker;
|
||||
clEnqueueWaitForEvents_fn EnqueueWaitForEvents;
|
||||
clEnqueueBarrier_fn EnqueueBarrier;
|
||||
clGetExtensionFunctionAddress_fn GetExtensionFunctionAddress;
|
||||
clCreateFromGLBuffer_fn CreateFromGLBuffer;
|
||||
clCreateFromGLTexture2D_fn CreateFromGLTexture2D;
|
||||
clCreateFromGLTexture3D_fn CreateFromGLTexture3D;
|
||||
clCreateFromGLRenderbuffer_fn CreateFromGLRenderbuffer;
|
||||
clGetGLObjectInfo_fn GetGLObjectInfo;
|
||||
clGetGLTextureInfo_fn GetGLTextureInfo;
|
||||
clEnqueueAcquireGLObjects_fn EnqueueAcquireGLObjects;
|
||||
clEnqueueReleaseGLObjects_fn EnqueueReleaseGLObjects;
|
||||
clGetGLContextInfoKHR_fn GetGLContextInfoKHR;
|
||||
void* _reservedForD3D10KHR[6];
|
||||
|
||||
/* OpenCL 1.1 */
|
||||
clSetEventCallback_fn SetEventCallback;
|
||||
clCreateSubBuffer_fn CreateSubBuffer;
|
||||
clSetMemObjectDestructorCallback_fn SetMemObjectDestructorCallback;
|
||||
clCreateUserEvent_fn CreateUserEvent;
|
||||
clSetUserEventStatus_fn SetUserEventStatus;
|
||||
clEnqueueReadBufferRect_fn EnqueueReadBufferRect;
|
||||
clEnqueueWriteBufferRect_fn EnqueueWriteBufferRect;
|
||||
clEnqueueCopyBufferRect_fn EnqueueCopyBufferRect;
|
||||
|
||||
void* _reservedForDeviceFissionEXT[3];
|
||||
clCreateEventFromGLsyncKHR_fn CreateEventFromGLsyncKHR;
|
||||
|
||||
/* OpenCL 1.2 */
|
||||
clCreateSubDevices_fn CreateSubDevices;
|
||||
clRetainDevice_fn RetainDevice;
|
||||
clReleaseDevice_fn ReleaseDevice;
|
||||
clCreateImage_fn CreateImage;
|
||||
clCreateProgramWithBuiltInKernels_fn CreateProgramWithBuiltInKernels;
|
||||
clCompileProgram_fn CompileProgram;
|
||||
clLinkProgram_fn LinkProgram;
|
||||
clUnloadPlatformCompiler_fn UnloadPlatformCompiler;
|
||||
clGetKernelArgInfo_fn GetKernelArgInfo;
|
||||
clEnqueueFillBuffer_fn EnqueueFillBuffer;
|
||||
clEnqueueFillImage_fn EnqueueFillImage;
|
||||
clEnqueueMigrateMemObjects_fn EnqueueMigrateMemObjects;
|
||||
clEnqueueMarkerWithWaitList_fn EnqueueMarkerWithWaitList;
|
||||
clEnqueueBarrierWithWaitList_fn EnqueueBarrierWithWaitList;
|
||||
clGetExtensionFunctionAddressForPlatform_fn GetExtensionFunctionAddressForPlatform;
|
||||
clCreateFromGLTexture_fn CreateFromGLTexture;
|
||||
|
||||
/* cl_khr_d3d11_sharing, cl_khr_dx9_media_sharing */
|
||||
void* _reservedForD3DExtensions[10];
|
||||
|
||||
/* cl_khr_egl_image, cl_khr_egl_event */
|
||||
void* _reservedForEGLExtensions[4];
|
||||
|
||||
/* OpenCL 2.0 */
|
||||
clCreateCommandQueueWithProperties_fn CreateCommandQueueWithProperties;
|
||||
clCreatePipe_fn CreatePipe;
|
||||
clGetPipeInfo_fn GetPipeInfo;
|
||||
clSVMAlloc_fn SVMAlloc;
|
||||
clSVMFree_fn SVMFree;
|
||||
clEnqueueSVMFree_fn EnqueueSVMFree;
|
||||
clEnqueueSVMMemcpy_fn EnqueueSVMMemcpy;
|
||||
clEnqueueSVMMemFill_fn EnqueueSVMMemFill;
|
||||
clEnqueueSVMMap_fn EnqueueSVMMap;
|
||||
clEnqueueSVMUnmap_fn EnqueueSVMUnmap;
|
||||
clCreateSamplerWithProperties_fn CreateSamplerWithProperties;
|
||||
clSetKernelArgSVMPointer_fn SetKernelArgSVMPointer;
|
||||
clSetKernelExecInfo_fn SetKernelExecInfo;
|
||||
/* cl_khr_sub_groups */
|
||||
clGetKernelSubGroupInfoKHR_fn GetKernelSubGroupInfoKHR;
|
||||
|
||||
/* OpenCL 2.1 */
|
||||
clCloneKernel_fn CloneKernel;
|
||||
clCreateProgramWithILKHR_fn CreateProgramWithILKHR;
|
||||
clEnqueueSVMMigrateMem_fn EnqueueSVMMigrateMem;
|
||||
clGetDeviceAndHostTimer_fn GetDeviceAndHostTimer;
|
||||
clGetHostTimer_fn GetHostTimer;
|
||||
clGetKernelSubGroupInfoKHR_fn GetKernelSubGroupInfo;
|
||||
clSetDefaultDeviceCommandQueue_fn SetDefaultDeviceCommandQueue;
|
||||
|
||||
/* OpenCL 2.2 */
|
||||
clSetProgramReleaseCallback_fn SetProgramReleaseCallback;
|
||||
clSetProgramSpecializationConstant_fn SetProgramSpecializationConstant;
|
||||
|
||||
} cl_icd_dispatch_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __OPENCL_CL_ICD_H */
|
||||
@@ -0,0 +1,165 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef CL_KERNEL_H_
|
||||
#define CL_KERNEL_H_
|
||||
|
||||
struct clk_builtins_t;
|
||||
|
||||
// This must be a multiple of sizeof(cl_ulong16)
|
||||
#define __CPU_SCRATCH_SIZE 128
|
||||
|
||||
#define CLK_PRIVATE_MEMORY_SIZE (16 * 1024)
|
||||
|
||||
struct clk_thread_info_block_t {
|
||||
// Warning! The size of this struct needs to be a multiple
|
||||
// of 16 when compiling 64 bit
|
||||
|
||||
struct clk_builtins_t const* builtins;
|
||||
void* local_mem_base;
|
||||
void* local_scratch;
|
||||
const void* table_base;
|
||||
size_t pad;
|
||||
|
||||
uint work_dim;
|
||||
size_t global_offset[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||
size_t global_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||
|
||||
size_t enqueued_local_size[4];
|
||||
size_t local_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||
size_t local_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||
size_t group_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||
};
|
||||
|
||||
typedef enum clk_value_type_t {
|
||||
T_VOID,
|
||||
T_CHAR,
|
||||
T_SHORT,
|
||||
T_INT,
|
||||
T_LONG,
|
||||
T_FLOAT,
|
||||
T_DOUBLE,
|
||||
T_POINTER,
|
||||
T_CHAR2,
|
||||
T_CHAR3,
|
||||
T_CHAR4,
|
||||
T_CHAR8,
|
||||
T_CHAR16,
|
||||
T_SHORT2,
|
||||
T_SHORT3,
|
||||
T_SHORT4,
|
||||
T_SHORT8,
|
||||
T_SHORT16,
|
||||
T_INT2,
|
||||
T_INT3,
|
||||
T_INT4,
|
||||
T_INT8,
|
||||
T_INT16,
|
||||
T_LONG2,
|
||||
T_LONG3,
|
||||
T_LONG4,
|
||||
T_LONG8,
|
||||
T_LONG16,
|
||||
T_FLOAT2,
|
||||
T_FLOAT3,
|
||||
T_FLOAT4,
|
||||
T_FLOAT8,
|
||||
T_FLOAT16,
|
||||
T_DOUBLE2,
|
||||
T_DOUBLE3,
|
||||
T_DOUBLE4,
|
||||
T_DOUBLE8,
|
||||
T_DOUBLE16,
|
||||
T_SAMPLER,
|
||||
T_SEMA,
|
||||
T_STRUCT,
|
||||
T_QUEUE,
|
||||
T_PAD
|
||||
} clk_value_type_t;
|
||||
|
||||
typedef enum clk_address_space_t {
|
||||
A_PRIVATE,
|
||||
A_LOCAL,
|
||||
A_CONSTANT,
|
||||
A_GLOBAL,
|
||||
A_REGION
|
||||
} clk_address_space_t;
|
||||
|
||||
// kernel arg access qualifier and type qualifier
|
||||
typedef enum clk_arg_qualifier_t {
|
||||
Q_NONE = 0,
|
||||
|
||||
// for image type only, access qualifier
|
||||
Q_READ = 1,
|
||||
Q_WRITE = 2,
|
||||
|
||||
// for pointer type only
|
||||
Q_CONST = 4, // pointee
|
||||
Q_RESTRICT = 8,
|
||||
Q_VOLATILE = 16, // pointee
|
||||
Q_PIPE = 32 // pipe
|
||||
|
||||
} clk_arg_qualifier_t;
|
||||
|
||||
#pragma pack(push, 4)
|
||||
struct clk_parameter_descriptor_t {
|
||||
clk_value_type_t type;
|
||||
clk_address_space_t space;
|
||||
uint qualifier;
|
||||
const char* name;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
//#define CLK_LOCAL_MEM_FENCE (1 << 0)
|
||||
//#define CLK_GLOBAL_MEM_FENCE (1 << 1)
|
||||
|
||||
struct clk_builtins_t {
|
||||
/* Synchronization functions */
|
||||
void (*barrier_ptr)(cl_mem_fence_flags flags);
|
||||
|
||||
/* AMD Only builtins: FIXME_lmoriche (extension) */
|
||||
void* reserved;
|
||||
int (*printf_ptr)(const char* format, ...);
|
||||
};
|
||||
|
||||
enum clk_natures_t { KN_HAS_BARRIER = 1 << 0, KN_WG_LEVEL = 1 << 1 };
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4200)
|
||||
#endif
|
||||
|
||||
#if !defined(__OPENCL_VERSION__) || __OPENCL_VERSION__ >= 200
|
||||
|
||||
typedef struct clk_pipe_t {
|
||||
size_t read_idx;
|
||||
size_t write_idx;
|
||||
size_t end_idx;
|
||||
char padding[128 - 3 * sizeof(size_t)];
|
||||
char packets[];
|
||||
} clk_pipe_t;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /*CL_KERNEL_H_*/
|
||||
@@ -0,0 +1,134 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "cl_kernel_info_amd.h"
|
||||
#include "platform/kernel.hpp"
|
||||
#include "platform/ndrange.hpp"
|
||||
#include "platform/command.hpp"
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup AMD_Extensions
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \brief Retrieves the kernel information.
|
||||
*
|
||||
* \param kernel specifies the kernel object being queried.
|
||||
*
|
||||
* \param device identifies a specific device in the list of devices associated
|
||||
* with \a kernel. The list of devices is the list of devices in the OpenCL
|
||||
* context that is associated with \a kernel. If the list of devices associated
|
||||
* with kernel is a single device, \a device can be a NULL value.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result
|
||||
* being queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data copied
|
||||
* to \a param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully
|
||||
* - CL_INVALID_VALUE if \a param_name is not valid, or if size in bytes
|
||||
* specified by \a param_value_size is < size of return type and
|
||||
* \a param_value is not NULL
|
||||
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetKernelInfoAMD,
|
||||
(cl_kernel kernel, cl_device_id device, cl_kernel_info_amd param_name,
|
||||
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||
// Check if we have a valid device
|
||||
if (!is_valid(device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
// Check if we have a valid performance counter
|
||||
if (!is_valid(kernel)) {
|
||||
return CL_INVALID_KERNEL;
|
||||
}
|
||||
|
||||
// Find the kernel, associated with the specified device
|
||||
const device::Kernel* devKernel = as_amd(kernel)->getDeviceKernel(*as_amd(device));
|
||||
|
||||
// Make sure we found a valid kernel
|
||||
if (devKernel == NULL) {
|
||||
return CL_INVALID_KERNEL;
|
||||
}
|
||||
|
||||
// Get the corresponded parameters
|
||||
switch (param_name) {
|
||||
case CL_KERNELINFO_SCRATCH_REGS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->scratchRegs_, param_value_size, param_value,
|
||||
param_value_size_ret);
|
||||
case CL_KERNELINFO_WAVEFRONT_PER_SIMD:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontPerSIMD_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_WAVEFRONT_SIZE:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontSize_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_AVAILABLE_GPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->availableGPRs_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_USED_GPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->usedGPRs_, param_value_size, param_value,
|
||||
param_value_size_ret);
|
||||
case CL_KERNELINFO_AVAILABLE_SGPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->availableSGPRs_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_USED_SGPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->usedSGPRs_, param_value_size, param_value,
|
||||
param_value_size_ret);
|
||||
case CL_KERNELINFO_AVAILABLE_VGPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->availableVGPRs_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_USED_VGPRS:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->usedVGPRs_, param_value_size, param_value,
|
||||
param_value_size_ret);
|
||||
case CL_KERNELINFO_AVAILABLE_LDS_SIZE:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->availableLDSSize_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_USED_LDS_SIZE:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->usedLDSSize_, param_value_size, param_value,
|
||||
param_value_size_ret);
|
||||
case CL_KERNELINFO_AVAILABLE_STACK_SIZE:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->availableStackSize_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
case CL_KERNELINFO_USED_STACK_SIZE:
|
||||
return amd::clGetInfo(devKernel->workGroupInfo()->usedStackSize_, param_value_size,
|
||||
param_value, param_value_size_ret);
|
||||
default:
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,87 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_KERNEL_INFO_AMD_H
|
||||
#define __CL_KERNEL_INFO_AMD_H
|
||||
|
||||
#include "CL/cl_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
typedef cl_uint cl_kernel_info_amd;
|
||||
|
||||
/* cl_kernel_info */
|
||||
enum KernelInfoAMD {
|
||||
CL_KERNELINFO_NONE = 0x0,
|
||||
CL_KERNELINFO_SCRATCH_REGS,
|
||||
CL_KERNELINFO_WAVEFRONT_PER_SIMD,
|
||||
CL_KERNELINFO_WAVEFRONT_SIZE,
|
||||
CL_KERNELINFO_AVAILABLE_GPRS,
|
||||
CL_KERNELINFO_USED_GPRS,
|
||||
CL_KERNELINFO_AVAILABLE_LDS_SIZE,
|
||||
CL_KERNELINFO_USED_LDS_SIZE,
|
||||
CL_KERNELINFO_AVAILABLE_STACK_SIZE,
|
||||
CL_KERNELINFO_USED_STACK_SIZE,
|
||||
CL_KERNELINFO_AVAILABLE_SGPRS,
|
||||
CL_KERNELINFO_USED_SGPRS,
|
||||
CL_KERNELINFO_AVAILABLE_VGPRS,
|
||||
CL_KERNELINFO_USED_VGPRS,
|
||||
CL_KERNELINFO_LAST
|
||||
};
|
||||
|
||||
/*! \brief Retrieves the kernel information.
|
||||
*
|
||||
* \param kernel specifies the kernel object being queried.
|
||||
*
|
||||
* \param device identifies a specific device in the list of devices associated
|
||||
* with \a kernel. The list of devices is the list of devices in the OpenCL
|
||||
* context that is associated with \a kernel. If the list of devices associated
|
||||
* with kernel is a single device, \a device can be a NULL value.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result
|
||||
* being queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data copied
|
||||
* to \a param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully
|
||||
* - CL_INVALID_VALUE if \a param_name is not valid, or if size in bytes
|
||||
* specified by \a param_value_size is < size of return type and
|
||||
* \a param_value is not NULL
|
||||
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfoAMD(
|
||||
cl_kernel /* kernel */, cl_device_id /* device */, cl_kernel_info_amd /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */, size_t* /* param_value_size_ret */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /*__CL_KERNEL_INFO_AMD_H*/
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,106 @@
|
||||
/* Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#include "cl_p2p_amd.h"
|
||||
#include "platform/object.hpp"
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueCopyBufferP2PAMD,
|
||||
(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
|
||||
size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if (!is_valid(src_buffer) || !is_valid(dst_buffer)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
amd::Buffer* srcBuffer = as_amd(src_buffer)->asBuffer();
|
||||
amd::Buffer* dstBuffer = as_amd(dst_buffer)->asBuffer();
|
||||
if (srcBuffer == NULL || dstBuffer == NULL) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == queue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
amd::HostQueue& hostQueue = *queue;
|
||||
|
||||
if ((hostQueue.context() != srcBuffer->getContext()) &&
|
||||
(hostQueue.context() != dstBuffer->getContext())) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
amd::Coord3D srcOffset(src_offset, 0, 0);
|
||||
amd::Coord3D dstOffset(dst_offset, 0, 0);
|
||||
amd::Coord3D size(cb, 1, 1);
|
||||
|
||||
if (!srcBuffer->validateRegion(srcOffset, size) || !dstBuffer->validateRegion(dstOffset, size)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (srcBuffer == dstBuffer &&
|
||||
((src_offset <= dst_offset && dst_offset < src_offset + cb) ||
|
||||
(dst_offset <= src_offset && src_offset < dst_offset + cb))) {
|
||||
return CL_MEM_COPY_OVERLAP;
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
if ((num_events_in_wait_list == 0 && event_wait_list != NULL) ||
|
||||
(num_events_in_wait_list != 0 && event_wait_list == NULL)) {
|
||||
return CL_INVALID_EVENT_WAIT_LIST;
|
||||
}
|
||||
|
||||
while (num_events_in_wait_list-- > 0) {
|
||||
cl_event event = *event_wait_list++;
|
||||
amd::Event* amdEvent = as_amd(event);
|
||||
if (!is_valid(event)) {
|
||||
return CL_INVALID_EVENT_WAIT_LIST;
|
||||
}
|
||||
eventWaitList.push_back(amdEvent);
|
||||
}
|
||||
|
||||
amd::CopyMemoryP2PCommand* command =
|
||||
new amd::CopyMemoryP2PCommand(hostQueue, CL_COMMAND_COPY_BUFFER, eventWaitList, *srcBuffer,
|
||||
*dstBuffer, srcOffset, dstOffset, size);
|
||||
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure we have memory for the command execution
|
||||
if (!command->validateMemory()) {
|
||||
delete command;
|
||||
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||
}
|
||||
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Copyright (c) 2017 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_P2P_AMD_H
|
||||
#define __CL_P2P_AMD_H
|
||||
|
||||
#include "CL/cl_ext.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferP2PAMD(
|
||||
cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
|
||||
size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,190 @@
|
||||
/* Copyright (c) 2013 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup CL_Pipes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief creates a pipe object.
|
||||
*
|
||||
* \param context is a valid OpenCL context used to create the pipe object.
|
||||
*
|
||||
* \param flags is a bit-field that is used to specify allocation and usage
|
||||
* information such as the memory arena that should be used to allocate the pipe
|
||||
* object and how it will be used. Only CL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY,
|
||||
* CL_MEM_READ_WRITE and CL_MEM_HOST_NO_ACCESS can be specified when creating a
|
||||
* pipe object. If value specified for flags is 0, the default is used which is
|
||||
* CL_MEM_READ_WRITE.
|
||||
*
|
||||
* \param pipe_packet_size is the size in bytes of a pipe packet.
|
||||
*
|
||||
* \param pipe_max_packets specifies the pipe capacity by specifying the maximum
|
||||
* number of packets the pipe can hold.
|
||||
*
|
||||
* \param properties specifies a list of properties for the pipe and their
|
||||
* corresponding values. Each property name is immediately followed by the
|
||||
* corresponding desired value. The list is terminated with 0.
|
||||
*
|
||||
* In OpenCL 2.0, properties must be NULL.
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code.
|
||||
* If \a errcode_ret is NULL, no error code is returned.
|
||||
*
|
||||
* \return a valid non-zero pipe object and \a errcode_ret is set to CL_SUCCESS
|
||||
* if the pipe object is created successfully. Otherwise, it returns a NULL
|
||||
* value with one of the following error values returned in errcode_ret:
|
||||
* - CL_INVALID_CONTEXT if context is not a valid context.
|
||||
* - CL_INVALID_VALUE if values specified in flags are not as defined above.
|
||||
* - CL_INVALID_VALUE if properties is not NULL.
|
||||
* - CL_INVALID_PIPE_SIZE if pipe_packet_size is 0 or the pipe_packet_size
|
||||
* exceeds CL_DEVICE_PIPE_MAX_PACKET_SIZE value for all devices in context
|
||||
* or if pipe_max_packets is 0.
|
||||
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory
|
||||
* for the pipe object.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required
|
||||
* by the OpenCL implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
||||
* by the OpenCL implementation on the host.
|
||||
*
|
||||
* \version 2.0r19
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_mem, clCreatePipe,
|
||||
(cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size,
|
||||
cl_uint pipe_max_packets, const cl_pipe_properties* properties,
|
||||
cl_int* errcode_ret)) {
|
||||
if (!is_valid(context)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check flags for validity
|
||||
cl_bitfield temp =
|
||||
flags & (CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
|
||||
|
||||
if (temp &&
|
||||
!(CL_MEM_READ_WRITE == temp || CL_MEM_WRITE_ONLY == temp || CL_MEM_READ_ONLY == temp ||
|
||||
CL_MEM_HOST_NO_ACCESS == temp)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid parameter \"flags\"");
|
||||
return (cl_mem)0;
|
||||
}
|
||||
|
||||
size_t size = sizeof(struct clk_pipe_t) + pipe_packet_size * pipe_max_packets;
|
||||
|
||||
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
||||
bool sizePass = false;
|
||||
for (const auto& it : devices) {
|
||||
if (it->info().maxMemAllocSize_ >= size) {
|
||||
sizePass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check size
|
||||
if (pipe_packet_size == 0 || pipe_max_packets == 0 || !sizePass) {
|
||||
*not_null(errcode_ret) = CL_INVALID_PIPE_SIZE;
|
||||
LogWarning("invalid parameter \"size = 0 or size > CL_DEVICE_PIPE_MAX_PACKET_SIZE\"");
|
||||
return (cl_mem)0;
|
||||
}
|
||||
|
||||
amd::Context& amdContext = *as_amd(context);
|
||||
amd::Memory* mem = new (amdContext)
|
||||
amd::Pipe(amdContext, flags, size, (size_t)pipe_packet_size, (size_t)pipe_max_packets);
|
||||
if (mem == NULL) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
return (cl_mem)0;
|
||||
}
|
||||
|
||||
if (!mem->create()) {
|
||||
*not_null(errcode_ret) = CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||
mem->release();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(mem);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Get information specific to a pipe object created with clCreatePipe.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result being
|
||||
* queried is returned. If param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by param_value. If param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. Otherwise, it
|
||||
* returns one of the following errors:
|
||||
* - CL_INVALID_VALUE if param_name is not valid, or if size in bytes specified
|
||||
* by param_value_size is < size of return type and param_value is not NULL.
|
||||
* - CL_INVALID_MEM_OBJECT if pipe is a not a valid pipe object.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required
|
||||
* by the OpenCL implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
||||
* by the OpenCL implementation on the host.
|
||||
*
|
||||
* \version 2.0r19
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetPipeInfo,
|
||||
(cl_mem memobj, cl_image_info param_name, size_t param_value_size, void* param_value,
|
||||
size_t* param_value_size_ret)) {
|
||||
if (!is_valid(memobj)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::Pipe* pipe = as_amd(memobj)->asPipe();
|
||||
if (pipe == NULL) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
switch (param_name) {
|
||||
case CL_PIPE_PACKET_SIZE: {
|
||||
cl_uint packetSize = pipe->getPacketSize();
|
||||
return amd::clGetInfo(packetSize, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_PIPE_MAX_PACKETS: {
|
||||
cl_uint count = pipe->getMaxNumPackets();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "vdi_common.hpp"
|
||||
#include "cl_platform_amd.h"
|
||||
#include <cstring>
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup AMD_Extensions
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clUnloadPlatformAMD, (cl_platform_id platform)) {
|
||||
if (AMD_PLATFORM == platform) {
|
||||
amd::Runtime::tearDown();
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
// AMD-specific platform management extensions
|
||||
|
||||
#ifndef __CL_PLATFORM_AMD_H
|
||||
#define __CL_PLATFORM_AMD_H
|
||||
|
||||
#include "CL/cl_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
/*! \brief Unloads the specified platform, handling all required cleanup.
|
||||
*
|
||||
* @todo This is still somewhat of a stub. It only works for the AMD
|
||||
* platform and just forces shutdown of all devices (to get PM4
|
||||
* capture working). It should handle ICD unregistration as well.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformAMD(cl_platform_id platform)
|
||||
CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /*__CL_AMD_PROFILE_H*/
|
||||
@@ -0,0 +1,386 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "cl_profile_amd.h"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
#include "platform/perfctr.hpp"
|
||||
#include "device/device.hpp"
|
||||
#include <cstring>
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup AMD_Extensions
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \brief Creates a new HW performance counter
|
||||
* for the specified OpenCL context.
|
||||
*
|
||||
* \param device must be a valid OpenCL device.
|
||||
*
|
||||
* \param block_index index of the HW block to configure.
|
||||
*
|
||||
* \param counter_index index of the hardware counter
|
||||
* within the block to configure.
|
||||
*
|
||||
* \param event_index Event you wish to count with
|
||||
* the counter specified by block_index + counter_index
|
||||
*
|
||||
* \param perf_counter the created perfcounter object
|
||||
*
|
||||
* \param errcode_ret A non zero value if OpenCL failed to create PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_DEVICE if the specified context is invalid.
|
||||
* - CL_INVALID_OPERATION if we couldn't create the object
|
||||
*
|
||||
* \return Created perfcounter object
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_perfcounter_amd, clCreatePerfCounterAMD,
|
||||
(cl_device_id device, cl_perfcounter_property* properties, cl_int* errcode_ret)) {
|
||||
// Make sure we have a valid device object
|
||||
if (!is_valid(device)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Make sure we have a valid pointer to the performance counter properties
|
||||
if (NULL == properties) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
amd::PerfCounter::Properties perfProperties;
|
||||
size_t size = 0;
|
||||
while (properties[size] != CL_PERFCOUNTER_NONE) {
|
||||
if (properties[size] < CL_PERFCOUNTER_LAST) {
|
||||
perfProperties[properties[size]] = static_cast<ulong>(properties[size + 1]);
|
||||
size += 2;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the device perf counter
|
||||
amd::PerfCounter* perfCounter = new amd::PerfCounter(*as_amd(device), perfProperties);
|
||||
|
||||
if (perfCounter == NULL) {
|
||||
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(perfCounter);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Destroy a performance counter object.
|
||||
*
|
||||
* \param perf_counter the perfcounter object for release
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to release the object
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleasePerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
|
||||
if (!is_valid(perf_counter)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
as_amd(perf_counter)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increments the perfcounter object reference count.
|
||||
*
|
||||
* \param perf_counter the perfcounter object for retain
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to retain PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to release the object
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainPerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
|
||||
if (!is_valid(perf_counter)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
as_amd(perf_counter)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Enqueues the begin command for the specified counters.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param num_perf_counters the number of perfcounter objects in the array.
|
||||
*
|
||||
* \param perf_counters specifies an array of perfcounter objects.
|
||||
*
|
||||
* \param event_wait_list specify [is a pointer to] events that need to
|
||||
* complete before this particular command can be executed.
|
||||
* If \a event_wait_list is NULL, then this particular command does not wait
|
||||
* on any event to complete. If \a event_wait_list is NULL,
|
||||
* \a num_events_in_wait_list must be 0. If \a event_wait_list is not NULL,
|
||||
* the list of events pointed to by \a event_wait_list must be valid and
|
||||
* \a num_events_in_wait_list must be greater than 0. The events specified in
|
||||
* \a event_wait_list act as synchronization points.
|
||||
*
|
||||
* \param num_events_in_wait_list specify the number of events in
|
||||
* \a event_wait_list. It must be 0 if \a event_wait_list is NULL. It must be
|
||||
* greater than 0 if \a event_wait_list is not NULL.
|
||||
*
|
||||
* \param event returns an event object that identifies this particular
|
||||
* command and can be used to query or queue a wait for this particular
|
||||
* command to complete. \a event can be NULL in which case it will not be
|
||||
* possible for the application to query the status of this command or queue a
|
||||
* wait for this command to complete.
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
||||
* - CL_INVALID_COMMAND_QUEUE if the queue is
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueBeginPerfCounterAMD,
|
||||
(cl_command_queue command_queue, cl_uint num_perf_counters,
|
||||
cl_perfcounter_amd* perf_counters, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == hostQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
amd::PerfCounterCommand::PerfCounterList counters;
|
||||
|
||||
// Place all counters into the list
|
||||
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
||||
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
||||
if (&hostQueue->device() == &amdPerf->device()) {
|
||||
counters.push_back(amdPerf);
|
||||
} else {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err = amd::clSetEventWaitList(eventWaitList, *hostQueue, num_events_in_wait_list,
|
||||
event_wait_list);
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// Create a new command for the performance counters
|
||||
amd::PerfCounterCommand* command = new amd::PerfCounterCommand(
|
||||
*hostQueue, eventWaitList, counters, amd::PerfCounterCommand::Begin);
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Submit the command to the device
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Enqueues the end command for the specified counters.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param num_perf_counters the number of perfcounter objects in the array.
|
||||
*
|
||||
* \param perf_counters specifies an array of perfcounter objects.
|
||||
*
|
||||
* \param event_wait_list specify [is a pointer to] events that need to
|
||||
* complete before this particular command can be executed.
|
||||
* If \a event_wait_list is NULL, then this particular command does not wait
|
||||
* on any event to complete. If \a event_wait_list is NULL,
|
||||
* \a num_events_in_wait_list must be 0. If \a event_wait_list is not NULL,
|
||||
* the list of events pointed to by \a event_wait_list must be valid and
|
||||
* \a num_events_in_wait_list must be greater than 0. The events specified in
|
||||
* \a event_wait_list act as synchronization points.
|
||||
*
|
||||
* \param num_events_in_wait_list specify the number of events in
|
||||
* \a event_wait_list. It must be 0 if \a event_wait_list is NULL. It must be
|
||||
* greater than 0 if \a event_wait_list is not NULL.
|
||||
*
|
||||
* \param event returns an event object that identifies this particular
|
||||
* command and can be used to query or queue a wait for this particular
|
||||
* command to complete. \a event can be NULL in which case it will not be
|
||||
* possible for the application to query the status of this command or queue a
|
||||
* wait for this command to complete.
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueEndPerfCounterAMD,
|
||||
(cl_command_queue command_queue, cl_uint num_perf_counters,
|
||||
cl_perfcounter_amd* perf_counters, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == hostQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
amd::PerfCounterCommand::PerfCounterList counters;
|
||||
|
||||
// Place all counters into the list
|
||||
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
||||
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
||||
if (&hostQueue->device() == &amdPerf->device()) {
|
||||
counters.push_back(amdPerf);
|
||||
} else {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err = amd::clSetEventWaitList(eventWaitList, *hostQueue, num_events_in_wait_list,
|
||||
event_wait_list);
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// Create a new command for the performance counters
|
||||
amd::PerfCounterCommand* command = new amd::PerfCounterCommand(
|
||||
*hostQueue, eventWaitList, counters, amd::PerfCounterCommand::End);
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Submit the command to the device
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Retrieves the results from the counter objects.
|
||||
*
|
||||
* \param num_perf_counter the perfcounter object for the information query.
|
||||
*
|
||||
* \param perf_counters specifies an array of perfcounter objects.
|
||||
*
|
||||
* \param wait_event specifies the wait event, returned in
|
||||
* the clEnqueueEndPerfCounterAMD.
|
||||
*
|
||||
* \param wait true if OpenCL should wait for the perfcounter data.
|
||||
*
|
||||
* \param values must be a valid pointer to an array of 64-bit values
|
||||
* and the array size must be equal to num_perf_counters.
|
||||
*
|
||||
* \return
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
||||
* - CL_INVALID_OPERATION if we failed to get the data
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetPerfCounterInfoAMD,
|
||||
(cl_perfcounter_amd perf_counter, cl_perfcounter_info param_name,
|
||||
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||
// Check if we have a valid performance counter
|
||||
if (!is_valid(perf_counter)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// Find the kernel, associated with the specified device
|
||||
const device::PerfCounter* devCounter = as_amd(perf_counter)->getDeviceCounter();
|
||||
|
||||
// Make sure we found a valid performance counter
|
||||
if (devCounter == NULL) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// Get the corresponded parameters
|
||||
switch (param_name) {
|
||||
case CL_PERFCOUNTER_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(perf_counter)->referenceCount();
|
||||
// Return the reference counter
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_PERFCOUNTER_GPU_BLOCK_INDEX:
|
||||
case CL_PERFCOUNTER_GPU_COUNTER_INDEX:
|
||||
case CL_PERFCOUNTER_GPU_EVENT_INDEX: {
|
||||
cl_ulong data = devCounter->getInfo(param_name);
|
||||
// Return the device performance counter information
|
||||
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_PERFCOUNTER_DATA: {
|
||||
cl_ulong data = devCounter->getInfo(param_name);
|
||||
if (static_cast<cl_ulong>(0xffffffffffffffffULL) == data) {
|
||||
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
||||
}
|
||||
// Return the device performance counter result
|
||||
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clSetDeviceClockModeAMD,
|
||||
(cl_device_id device, cl_set_device_clock_mode_input_amd set_clock_mode_input,
|
||||
cl_set_device_clock_mode_output_amd* set_clock_mode_output)) {
|
||||
// Make sure we have a valid device object
|
||||
if (!is_valid(device)) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
if (set_clock_mode_input.clock_mode >= CL_DEVICE_CLOCK_MODE_COUNT_AMD) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
amd::Device* amdDevice = as_amd(device);
|
||||
bool ret = amdDevice->SetClockMode(set_clock_mode_input, set_clock_mode_output);
|
||||
return (ret == true)? CL_SUCCESS : CL_INVALID_OPERATION;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,189 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_PROFILE_AMD_H
|
||||
#define __CL_PROFILE_AMD_H
|
||||
|
||||
#include "CL/cl_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
typedef struct _cl_perfcounter_amd* cl_perfcounter_amd;
|
||||
typedef cl_ulong cl_perfcounter_property;
|
||||
typedef cl_uint cl_perfcounter_info;
|
||||
|
||||
/* cl_perfcounter_info */
|
||||
enum PerfcounterInfo {
|
||||
CL_PERFCOUNTER_NONE = 0x0,
|
||||
CL_PERFCOUNTER_REFERENCE_COUNT = 0x1,
|
||||
CL_PERFCOUNTER_DATA = 0x2,
|
||||
CL_PERFCOUNTER_GPU_BLOCK_INDEX = 0x3,
|
||||
CL_PERFCOUNTER_GPU_COUNTER_INDEX = 0x4,
|
||||
CL_PERFCOUNTER_GPU_EVENT_INDEX = 0x5,
|
||||
CL_PERFCOUNTER_LAST
|
||||
};
|
||||
|
||||
/*********************************
|
||||
* Set device clock mode data
|
||||
*********************************/
|
||||
enum cl_DeviceClockMode_AMD {
|
||||
CL_DEVICE_CLOCK_MODE_DEFAULT_AMD = 0x0, /*Device clocks and other power settings are restored to default*/
|
||||
CL_DEVICE_CLOCK_MODE_QUERY_AMD = 0x1, /*Queries the current device clock ratios. Leaves the clock mode of the device unchanged*/
|
||||
CL_DEVICE_CLOCK_MODE_PROFILING_AMD = 0x2, /*Scale down from peak ratio*/
|
||||
CL_DEVICE_CLOCK_MODE_MINIMUMMEMORY_AMD = 0x3, /* Memory clock is set to the lowest available level*/
|
||||
CL_DEVICE_CLOCK_MODE_MINIMUMENGINE_AMD = 0x4, /*Engine clock is set to the lowest available level*/
|
||||
CL_DEVICE_CLOCK_MODE_PEAK_AMD = 0x5, /*Clocks set to maximum when possible. Fan set to maximum.*/
|
||||
CL_DEVICE_CLOCK_MODE_QUERYPROFILING_AMD = 0x6, /*Queries the profiling device clock ratios. Leaves the clock mode of the device unchanged*/
|
||||
CL_DEVICE_CLOCK_MODE_QUERYPEAK_AMD = 0x7, /*Queries the peak device clock ratios.Leaves the clock mode of the device unchanged*/
|
||||
CL_DEVICE_CLOCK_MODE_COUNT_AMD = 0x8, /*Maxmium count of device clock mode*/
|
||||
};
|
||||
|
||||
typedef struct _cl_set_device_clock_mode_input_amd
|
||||
{
|
||||
/* specify the clock mode for AMD GPU device*/
|
||||
cl_DeviceClockMode_AMD clock_mode;
|
||||
} cl_set_device_clock_mode_input_amd;
|
||||
|
||||
typedef struct _cl_set_device_clock_mode_output_amd
|
||||
{
|
||||
/*Ratio of current mem clock to peak clock as obtained from DeviceProperties::maxGpuClock*/
|
||||
cl_float memory_clock_ratio_to_peak;
|
||||
/*Ratio of current gpu core clock to peak clock as obtained from DeviceProperties::maxGpuClock*/
|
||||
cl_float engine_clock_ratio_to_peak;
|
||||
} cl_set_device_clock_mode_output_amd;
|
||||
|
||||
/*! \brief Creates a new HW performance counter
|
||||
* for the specified OpenCL context.
|
||||
*
|
||||
* \param device must be a valid OpenCL device.
|
||||
*
|
||||
* \param properties the list of properties of the hardware counter
|
||||
*
|
||||
* \param errcode_ret A non zero value if OpenCL failed to create PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_CONTEXT if the specified context is invalid.
|
||||
* - CL_OUT_OF_RESOURCES if we couldn't create the object
|
||||
*
|
||||
* \return the created perfcounter object
|
||||
*/
|
||||
extern CL_API_ENTRY cl_perfcounter_amd CL_API_CALL clCreatePerfCounterAMD(
|
||||
cl_device_id /* device */, cl_perfcounter_property* /* properties */, cl_int* /* errcode_ret */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Destroy a performance counter object.
|
||||
*
|
||||
* \param perf_counter the perfcounter object for release
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to release the object
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clReleasePerfCounterAMD(cl_perfcounter_amd /* perf_counter */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Increments the perfcounter object reference count.
|
||||
*
|
||||
* \param perf_counter the perfcounter object for retain
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to retain PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to release the object
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clRetainPerfCounterAMD(cl_perfcounter_amd /* perf_counter */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Enqueues the begin command for the specified counters.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param num_perf_counters the number of perfcounter objects in the array.
|
||||
*
|
||||
* \param perf_counters specifies an array of perfcounter objects.
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBeginPerfCounterAMD(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
|
||||
cl_perfcounter_amd* /* perf_counters */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Enqueues the end command for the specified counters.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param num_perf_counters the number of perfcounter objects in the array.
|
||||
*
|
||||
* \param perf_counters specifies an array of perfcounter objects.
|
||||
*
|
||||
* \param event the event object associated with the end operation.
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release PerfCounter
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueEndPerfCounterAMD(
|
||||
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
|
||||
cl_perfcounter_amd* /* perf_counters */, cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event* /* event_wait_list */, cl_event* /* event */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Retrieves the results from the counter objects.
|
||||
*
|
||||
* \param perf_counter specifies a perfcounter objects for query.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result
|
||||
* being queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data copied
|
||||
* to \a param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \param values must be a valid pointer to an array of 64-bit values
|
||||
* and the array size must be equal to num_perf_counters.
|
||||
*
|
||||
* \return
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
||||
* - CL_INVALID_OPERATION if we failed to get the data
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clGetPerfCounterInfoAMD(
|
||||
cl_perfcounter_amd /* perf_counter */, cl_perfcounter_info /* param_name */,
|
||||
size_t /* param_value_size */, void* /* param_value */, size_t* /* param_value_size_ret */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clSetDeviceClockModeAMD(
|
||||
cl_device_id /* device*/, cl_set_device_clock_mode_input_amd /* Clock_Mode_Input */,
|
||||
cl_set_device_clock_mode_output_amd* /* Clock_Mode_Output */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /*__CL_PROFILE_AMD_H*/
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,59 @@
|
||||
/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "thread/thread.hpp"
|
||||
#include "platform/runtime.hpp"
|
||||
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef DEBUG
|
||||
static int reportHook(int reportType, char* message, int* returnValue) {
|
||||
if (returnValue) {
|
||||
*returnValue = 1;
|
||||
}
|
||||
std::cerr << message;
|
||||
::exit(3);
|
||||
return TRUE;
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
#ifdef DEBUG
|
||||
if (!::getenv("AMD_OCL_ENABLE_MESSAGE_BOX")) {
|
||||
_CrtSetReportHook(reportHook);
|
||||
_set_error_mode(_OUT_TO_STDERR);
|
||||
}
|
||||
#endif // DEBUG
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
amd::Runtime::setLibraryDetached();
|
||||
break;
|
||||
case DLL_THREAD_DETACH: {
|
||||
amd::Thread* thread = amd::Thread::current();
|
||||
delete thread;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/sampler.hpp"
|
||||
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup CL_Samplers
|
||||
*
|
||||
* A sampler object describes how to sample an image when the image is read
|
||||
* in the kernel. The built-in functions to read from an image in a kernel
|
||||
* take a sampler as an argument. The sampler arguments to the image read
|
||||
* function can be sampler objects created using OpenCL functions and passed
|
||||
* as argument values to the kernel or can be samplers declared inside
|
||||
* a kernel.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \brief Create a sampler object.
|
||||
*
|
||||
* \param context must be a valid OpenCL context.
|
||||
*
|
||||
* \param specifies a list of sampler property names and their corresponding
|
||||
* values. Each sampler property name is immediately followed by the
|
||||
* corresponding desired value. The list is terminated with 0. If a supported
|
||||
* property and its value is not specified in sampler_properties, its default
|
||||
* value will be used. sampler_properties can be NULL in which case the default
|
||||
* values for supported sampler properties will be used.
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code. If \a errcode_ret
|
||||
* is NULL, no error code is returned.
|
||||
*
|
||||
* \return A valid non-zero sampler object and \a errcode_ret is set to
|
||||
* CL_SUCCESS if the sampler object is created successfully. It returns a NULL
|
||||
* value with one of the following error values returned in \a errcode_ret:
|
||||
* - CL_INVALID_CONTEXT if \a context is not a valid context.
|
||||
* - CL_INVALID_VALUE if the property name in sampler_properties is not a
|
||||
* supported property name, if the value specified for a supported property
|
||||
* name is not valid, or if the same property name is specified more than
|
||||
* once
|
||||
* - CL_INVALID_OPERATION if images are not supported by any device associated
|
||||
* with context
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
||||
* by the runtime.
|
||||
*
|
||||
* \version 2.0r19
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_sampler, clCreateSamplerWithProperties,
|
||||
(cl_context context, const cl_sampler_properties* sampler_properties,
|
||||
cl_int* errcode_ret)) {
|
||||
if (!is_valid(context)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||
LogWarning("invalid parameter \"context\"");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
|
||||
cl_bool normalizedCoords = CL_TRUE;
|
||||
cl_addressing_mode addressingMode = CL_ADDRESS_CLAMP;
|
||||
cl_filter_mode filterMode = CL_FILTER_NEAREST;
|
||||
#ifndef CL_FILTER_NONE
|
||||
#define CL_FILTER_NONE 0x1142
|
||||
#endif
|
||||
cl_filter_mode mipFilterMode = CL_FILTER_NONE;
|
||||
float minLod = 0.f;
|
||||
float maxLod = CL_MAXFLOAT;
|
||||
|
||||
const struct SamplerProperty {
|
||||
cl_sampler_properties name;
|
||||
union {
|
||||
cl_sampler_properties raw;
|
||||
cl_bool normalizedCoords;
|
||||
cl_addressing_mode addressingMode;
|
||||
cl_filter_mode filterMode;
|
||||
cl_float lod;
|
||||
} value;
|
||||
}* p = reinterpret_cast<const SamplerProperty*>(sampler_properties);
|
||||
|
||||
if (p != NULL)
|
||||
while (p->name != 0) {
|
||||
switch (p->name) {
|
||||
case CL_SAMPLER_NORMALIZED_COORDS:
|
||||
normalizedCoords = p->value.normalizedCoords;
|
||||
break;
|
||||
case CL_SAMPLER_ADDRESSING_MODE:
|
||||
addressingMode = p->value.addressingMode;
|
||||
break;
|
||||
case CL_SAMPLER_FILTER_MODE:
|
||||
filterMode = p->value.filterMode;
|
||||
break;
|
||||
case CL_SAMPLER_MIP_FILTER_MODE:
|
||||
mipFilterMode = p->value.filterMode;
|
||||
break;
|
||||
case CL_SAMPLER_LOD_MIN:
|
||||
minLod = p->value.lod;
|
||||
break;
|
||||
case CL_SAMPLER_LOD_MAX:
|
||||
maxLod = p->value.lod;
|
||||
break;
|
||||
default:
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid property name");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
// Check sampler validity
|
||||
// Check addressing mode
|
||||
switch (addressingMode) {
|
||||
case CL_ADDRESS_NONE:
|
||||
case CL_ADDRESS_CLAMP_TO_EDGE:
|
||||
case CL_ADDRESS_CLAMP:
|
||||
break;
|
||||
case CL_ADDRESS_REPEAT:
|
||||
if (!normalizedCoords) {
|
||||
// repeat mode cannot be used with unnormalized coordinates
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid combination for sampler");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
break;
|
||||
case CL_ADDRESS_MIRRORED_REPEAT:
|
||||
if (!normalizedCoords) {
|
||||
// repeat mode cannot be used with unnormalized coordinates
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid combination for sampler");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid addressing mode");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
// Check filter mode
|
||||
switch (filterMode) {
|
||||
case CL_FILTER_NEAREST:
|
||||
case CL_FILTER_LINEAR:
|
||||
break;
|
||||
default:
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid filter mode");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
switch (mipFilterMode) {
|
||||
case CL_FILTER_NONE:
|
||||
case CL_FILTER_NEAREST:
|
||||
case CL_FILTER_LINEAR:
|
||||
break;
|
||||
default:
|
||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||
LogWarning("invalid filter mode");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
// Create instance of Sampler
|
||||
amd::Sampler* sampler =
|
||||
new amd::Sampler(*as_amd(context),
|
||||
normalizedCoords == CL_TRUE, // To get rid of VS warning C4800
|
||||
addressingMode, filterMode, mipFilterMode, minLod, maxLod);
|
||||
if (!sampler) {
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
LogWarning("not enough host memory");
|
||||
return (cl_sampler)0;
|
||||
}
|
||||
|
||||
if (!sampler->create()) {
|
||||
delete sampler;
|
||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||
LogWarning("Runtime failed sampler creation!");
|
||||
return as_cl<amd::Sampler>(0);
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl<amd::Sampler>(sampler);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Create a sampler object.
|
||||
*
|
||||
* \param context must be a valid OpenCL context.
|
||||
*
|
||||
* \param addressing_mode specifies how out of range image coordinates are
|
||||
* handled when reading from an image. This can be set to CL_ADDRESS_REPEAT,
|
||||
* CL_ADDRESS_CLAMP_TO_EDGE, CL_ADDRESS_CLAMP and CL_ADDRESS_NONE.
|
||||
*
|
||||
* \param filter_mode specifies the type of filter that must be applied when
|
||||
* reading an image. This can be CL_FILTER_NEAREST or CL_FILTER_LINEAR.
|
||||
*
|
||||
* \param normalized_coords determines if the image coordinates specified are
|
||||
* normalized (if \a normalized_coords is not zero) or not (if
|
||||
* \a normalized_coords is zero).
|
||||
*
|
||||
* \param errcode_ret will return an appropriate error code. If \a errcode_ret
|
||||
* is NULL, no error code is returned.
|
||||
*
|
||||
* \return A valid non-zero sampler object and \a errcode_ret is set to
|
||||
* CL_SUCCESS if the sampler object is created successfully. It returns a NULL
|
||||
* value with one of the following error values returned in \a errcode_ret:
|
||||
* - CL_INVALID_CONTEXT if \a context is not a valid context.
|
||||
* - CL_INVALID_VALUE if \a addressing_mode, \a filter_mode or
|
||||
* \a normalized_coords or combination of these argument values are not
|
||||
* valid.
|
||||
* - CL_INVALID_OPERATION if images are not supported by any device associated
|
||||
* with context
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
||||
* by the runtime.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_sampler, clCreateSampler, (cl_context context, cl_bool normalized_coords,
|
||||
cl_addressing_mode addressing_mode,
|
||||
cl_filter_mode filter_mode, cl_int* errcode_ret)) {
|
||||
const cl_sampler_properties sprops[] = {CL_SAMPLER_NORMALIZED_COORDS,
|
||||
static_cast<cl_sampler_properties>(normalized_coords),
|
||||
CL_SAMPLER_ADDRESSING_MODE,
|
||||
static_cast<cl_sampler_properties>(addressing_mode),
|
||||
CL_SAMPLER_FILTER_MODE,
|
||||
static_cast<cl_sampler_properties>(filter_mode),
|
||||
0};
|
||||
return clCreateSamplerWithProperties(context, sprops, errcode_ret);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Increment the sampler reference count.
|
||||
*
|
||||
* clCreateSampler does an implicit retain.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_SAMPLER if \a sampler is not a valid sampler object.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clRetainSampler, (cl_sampler sampler)) {
|
||||
if (!is_valid(sampler)) {
|
||||
return CL_INVALID_SAMPLER;
|
||||
}
|
||||
as_amd(sampler)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Decrement the sampler reference count.
|
||||
*
|
||||
* The sampler object is deleted after the reference count becomes zero and
|
||||
* commands queued for execution on a command-queue(s) that use sampler have
|
||||
* finished.
|
||||
*
|
||||
* \return CL_SUCCESS if the function is executed successfully. It returns
|
||||
* CL_INVALID_SAMPLER if \a sampler is not a valid sampler object.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clReleaseSampler, (cl_sampler sampler)) {
|
||||
if (!is_valid(sampler)) {
|
||||
return CL_INVALID_SAMPLER;
|
||||
}
|
||||
as_amd(sampler)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Return information about the sampler object.
|
||||
*
|
||||
* \param sampler specifies the sampler being queried.
|
||||
*
|
||||
* \param param_name specifies the information to query.
|
||||
*
|
||||
* \param param_value is a pointer to memory where the appropriate result
|
||||
* being queried is returned. If \a param_value is NULL, it is ignored.
|
||||
*
|
||||
* \param param_value_size is used to specify the size in bytes of memory
|
||||
* pointed to by \a param_value. This size must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data copied
|
||||
* to \a param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* - CL_SUCCESS if the function is executed successfully
|
||||
* - CL_INVALID_VALUE if \a param_name is not valid, or if size in bytes
|
||||
* specified by \a param_value_size is < size of return type and
|
||||
* \a param_value is not NULL
|
||||
* - CL_INVALID_SAMPLER if \a sampler is a not a valid sampler object.
|
||||
*
|
||||
* \version 1.0r33
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetSamplerInfo,
|
||||
(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
if (!is_valid(sampler)) {
|
||||
return CL_INVALID_SAMPLER;
|
||||
}
|
||||
|
||||
switch (param_name) {
|
||||
case CL_SAMPLER_REFERENCE_COUNT: {
|
||||
cl_uint count = as_amd(sampler)->referenceCount();
|
||||
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_CONTEXT: {
|
||||
cl_context context = as_cl(&as_amd(sampler)->context());
|
||||
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_ADDRESSING_MODE: {
|
||||
cl_addressing_mode addressing = as_amd(sampler)->addressingMode();
|
||||
return amd::clGetInfo(addressing, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_FILTER_MODE: {
|
||||
cl_filter_mode filter = as_amd(sampler)->filterMode();
|
||||
return amd::clGetInfo(filter, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_NORMALIZED_COORDS: {
|
||||
cl_bool normalized = as_amd(sampler)->normalizedCoords();
|
||||
return amd::clGetInfo(normalized, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_MIP_FILTER_MODE: {
|
||||
cl_filter_mode mipFilter = as_amd(sampler)->mipFilter();
|
||||
return amd::clGetInfo(mipFilter, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_LOD_MIN: {
|
||||
cl_float minLod = as_amd(sampler)->minLod();
|
||||
return amd::clGetInfo(minLod, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_SAMPLER_LOD_MAX: {
|
||||
cl_float maxLod = as_amd(sampler)->maxLod();
|
||||
return amd::clGetInfo(maxLod, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,241 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "cl_sdi_amd.h"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueWaitSignalAMD,
|
||||
(cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_uint num_events,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if (!is_valid(mem_object)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
||||
if (buffer == NULL) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == queue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
amd::HostQueue& hostQueue = *queue;
|
||||
|
||||
if (hostQueue.context() != buffer->getContext()) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err =
|
||||
amd::clSetEventWaitList(eventWaitList, hostQueue, num_events, event_wait_list);
|
||||
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
amd::SignalCommand* command =
|
||||
new amd::SignalCommand(hostQueue, CL_COMMAND_WAIT_SIGNAL_AMD, eventWaitList, *buffer, value);
|
||||
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure we have memory for the command execution
|
||||
if (!command->validateMemory()) {
|
||||
delete command;
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueWriteSignalAMD,
|
||||
(cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_ulong offset,
|
||||
cl_uint num_events, const cl_event* event_wait_list, cl_event* event))
|
||||
|
||||
{
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if (!is_valid(mem_object)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
||||
if (buffer == NULL) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if (!(buffer->getMemFlags() & CL_MEM_EXTERNAL_PHYSICAL_AMD)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if ((offset + sizeof(value)) > (buffer->getSize() + amd::Os::pageSize())) {
|
||||
return CL_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == queue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
amd::HostQueue& hostQueue = *queue;
|
||||
|
||||
if (hostQueue.context() != buffer->getContext()) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err =
|
||||
amd::clSetEventWaitList(eventWaitList, hostQueue, num_events, event_wait_list);
|
||||
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
amd::SignalCommand* command = new amd::SignalCommand(hostQueue, CL_COMMAND_WRITE_SIGNAL_AMD,
|
||||
eventWaitList, *buffer, value, offset);
|
||||
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure we have memory for the command execution
|
||||
if (!command->validateMemory()) {
|
||||
delete command;
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueMakeBuffersResidentAMD,
|
||||
(cl_command_queue command_queue, cl_uint num_mem_objs, cl_mem* mem_objects,
|
||||
cl_bool blocking_make_resident, cl_bus_address_amd* bus_addresses,
|
||||
cl_uint num_events, const cl_event* event_wait_list, cl_event* event)) {
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
if (mem_objects == 0) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if (bus_addresses == 0 || num_mem_objs == 0) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
memset(bus_addresses, 0, sizeof(cl_bus_address_amd) * num_mem_objs);
|
||||
|
||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == queue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
amd::HostQueue& hostQueue = *queue;
|
||||
|
||||
std::vector<amd::Memory*> memObjects;
|
||||
for (unsigned int i = 0; i < num_mem_objs; ++i) {
|
||||
if (!is_valid(mem_objects[i])) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
amd::Buffer* buffer = as_amd(mem_objects[i])->asBuffer();
|
||||
if (buffer == NULL) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
|
||||
if (hostQueue.context() != buffer->getContext()) {
|
||||
return CL_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
memObjects.push_back(buffer);
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err =
|
||||
amd::clSetEventWaitList(eventWaitList, hostQueue, num_events, event_wait_list);
|
||||
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
amd::MakeBuffersResidentCommand* command = new amd::MakeBuffersResidentCommand(
|
||||
hostQueue, CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD, eventWaitList, memObjects, bus_addresses);
|
||||
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure we have memory for the command execution
|
||||
if (!command->validateMemory()) {
|
||||
delete command;
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
command->enqueue();
|
||||
|
||||
if (blocking_make_resident) {
|
||||
command->awaitCompletion();
|
||||
}
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_SDI_AMD_H
|
||||
#define __CL_SDI_AMD_H
|
||||
|
||||
#include "CL/cl_ext.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitSignalAMD(
|
||||
cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_uint num_events,
|
||||
const cl_event* event_wait_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteSignalAMD(
|
||||
cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_ulong offset,
|
||||
cl_uint num_events, const cl_event* event_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueMakeBuffersResidentAMD(
|
||||
cl_command_queue command_queue, cl_uint num_mem_objs, cl_mem* mem_objects,
|
||||
cl_bool blocking_make_resident, cl_bus_address_amd* bus_addresses, cl_uint num_events,
|
||||
const cl_event* event_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_SEMAPHORE_AMD_H
|
||||
#define __CL_SEMAPHORE_AMD_H
|
||||
/*******************************************
|
||||
* AMD Extension cl_amd_semaphore
|
||||
*******************************************/
|
||||
#define cl_amd_semaphore 1
|
||||
|
||||
#if cl_amd_semaphore
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* cl_device_info */
|
||||
#define CL_DEVICE_MAX_SEMAPHORES_AMD 0xF050
|
||||
#define CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD 0xF051
|
||||
|
||||
/* cl_kernel_work_group_info */
|
||||
#define CL_KERNEL_MAX_SEMAPHORE_SIZE_AMD 0xF052
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* cl_amd_semaphore */
|
||||
|
||||
#endif /* __CL_SEMAPHORE_AMD_H */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,534 @@
|
||||
/* Copyright (c) 2009 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "cl_common.hpp"
|
||||
#include "cl_thread_trace_amd.h"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/command.hpp"
|
||||
#include "platform/threadtrace.hpp"
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
/*! \addtogroup API
|
||||
* @{
|
||||
*
|
||||
* \addtogroup AMD_Extensions
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \brief Creates a new HW threadTrace
|
||||
*
|
||||
* \param device must be a valid OpenCL device.
|
||||
*
|
||||
* \param threadTrace the created cl_threadtrace_amd object
|
||||
*
|
||||
* \param errcode_ret A non zero value if OpenCL failed to create cl_threadtrace_amd
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
* - CL_INVALID_DEVICE if the specified context is invalid.
|
||||
* - CL_INVALID_OPERATION if we couldn't create the object
|
||||
*
|
||||
* \return Created cl_threadtrace_amd object
|
||||
*/
|
||||
RUNTIME_ENTRY_RET(cl_threadtrace_amd, clCreateThreadTraceAMD,
|
||||
(cl_device_id device, cl_int* errcode_ret)) {
|
||||
// Make sure we have a valid device object
|
||||
if (!is_valid(device)) {
|
||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the device thread trace object
|
||||
amd::ThreadTrace* threadTrace = new amd::ThreadTrace(*as_amd(device));
|
||||
|
||||
if (threadTrace == NULL) {
|
||||
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*not_null(errcode_ret) = CL_SUCCESS;
|
||||
return as_cl(threadTrace);
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
///*! \brief Destroy a threadTrace object.
|
||||
// *
|
||||
// * \param threadTrace the cl_threadtrace_amd object for release
|
||||
// *
|
||||
// * \return A non zero value if OpenCL failed to release cl_threadtrace_amd
|
||||
// * - CL_SUCCESS if the function is executed successfully.
|
||||
// * - CL_INVALID_OPERATION if we failed to release the object
|
||||
// */
|
||||
RUNTIME_ENTRY(cl_int, clReleaseThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
|
||||
if (!is_valid(threadTrace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
as_amd(threadTrace)->release();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
//
|
||||
// *! \brief Increments the cl_threadtrace_amd object reference count.
|
||||
// *
|
||||
// * \param threadTrace the cl_threadtrace_amd object for retain
|
||||
// *
|
||||
// * \return A non zero value if OpenCL failed to retain cl_threadtrace_amd
|
||||
// * - CL_SUCCESS if the function is executed successfully.
|
||||
// * - CL_INVALID_OPERATION if we failed to release the object
|
||||
// */
|
||||
RUNTIME_ENTRY(cl_int, clRetainThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
|
||||
if (!is_valid(threadTrace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
as_amd(threadTrace)->retain();
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
//
|
||||
// *! \brief Sets the cl_threadtrace_amd object configuration parameter.
|
||||
// *
|
||||
// * \param thread_trace the cl_threadtrace_amd object to set configuration parameter
|
||||
// *
|
||||
// * \param config_param the cl_thread_trace_param
|
||||
// *
|
||||
// * \param param_value corresponding to configParam
|
||||
// *
|
||||
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||
// * - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
||||
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
// event_wait_list is not NULL and num_events_in_wait_list is 0,
|
||||
// * - or if event objects in event_wait_list are not valid events.
|
||||
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
// implementation on the device.
|
||||
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
// OpenCL implementation on the host.
|
||||
// */
|
||||
RUNTIME_ENTRY(cl_int, clSetThreadTraceParamAMD,
|
||||
(cl_threadtrace_amd thread_trace, cl_thread_trace_param config_param,
|
||||
cl_uint param_value)) {
|
||||
if (!is_valid(thread_trace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
switch (config_param) {
|
||||
case CL_THREAD_TRACE_PARAM_TOKEN_MASK:
|
||||
if (param_value > CL_THREAD_TRACE_TOKEN_MASK_ALL_SI) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
as_amd(thread_trace)->setTokenMask(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_REG_MASK:
|
||||
if (param_value > CL_THREAD_TRACE_REG_MASK_ALL_SI) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
as_amd(thread_trace)->setRegMask(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_VM_ID_MASK:
|
||||
if (param_value > CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
as_amd(thread_trace)->setVmIdMask(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK:
|
||||
if (param_value > CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
as_amd(thread_trace)->setInstMask(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET:
|
||||
as_amd(thread_trace)->setCU(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET:
|
||||
as_amd(thread_trace)->setSH(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_SIMD_MASK:
|
||||
as_amd(thread_trace)->setSIMD(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_USER_DATA:
|
||||
as_amd(thread_trace)->setUserData(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_CAPTURE_MODE:
|
||||
if (param_value > CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
as_amd(thread_trace)->setCaptureMode(param_value);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_IS_WRAPPED:
|
||||
as_amd(thread_trace)->setIsWrapped(true);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PARAM_RANDOM_SEED:
|
||||
as_amd(thread_trace)->setRandomSeed(param_value);
|
||||
break;
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! \brief Get specific information about the OpenCL Thread Trace.
|
||||
*
|
||||
* \param threadTrace_info_param is an enum that identifies the Thread Trace information being
|
||||
* queried.
|
||||
*
|
||||
* \param param_value is a pointer to memory location where appropriate values
|
||||
* for a given \a threadTrace_info_param will be returned. If \a param_value is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \param param_value_size specifies the size in bytes of memory pointed to by
|
||||
* \a param_value. This size in bytes must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* CL_INVALID_OPERATION if cl_threadtrace_amd object is not valid
|
||||
* - CL_INVALID_VALUE if \a param_name is not one of the supported
|
||||
* values or if size in bytes specified by \a param_value_size is < size of
|
||||
* return type and \a param_value is not a NULL value.
|
||||
* - CL_SUCCESS if the function is executed successfully.
|
||||
*
|
||||
*/
|
||||
RUNTIME_ENTRY(cl_int, clGetThreadTraceInfoAMD,
|
||||
(cl_threadtrace_amd thread_trace /* threadTrace */,
|
||||
cl_threadtrace_info thread_trace_info_param, size_t param_value_size,
|
||||
void* param_value, size_t* param_value_size_ret)) {
|
||||
if (!is_valid(thread_trace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// Find the thread trace object, associated with the specified device
|
||||
const device::ThreadTrace* devThreadTrace = as_amd(thread_trace)->getDeviceThreadTrace();
|
||||
|
||||
const size_t seNum = as_amd(thread_trace)->deviceSeNumThreadTrace();
|
||||
switch (thread_trace_info_param) {
|
||||
case CL_THREAD_TRACE_SE: {
|
||||
return amd::clGetInfo(seNum, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
case CL_THREAD_TRACE_BUFFERS_SIZE: {
|
||||
// Make sure we found a valid thread trace object
|
||||
if (devThreadTrace == NULL) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint> bufSize2Se(new uint[seNum]);
|
||||
|
||||
if (bufSize2Se.get() == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
if (!devThreadTrace->info(thread_trace_info_param, bufSize2Se.get(), seNum)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
const size_t valueSize = seNum * sizeof(unsigned int);
|
||||
|
||||
if (param_value != NULL && param_value_size < valueSize) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
*not_null(param_value_size_ret) = valueSize;
|
||||
|
||||
if (param_value != NULL) {
|
||||
::memcpy(param_value, bufSize2Se.get(), valueSize);
|
||||
if (param_value_size > valueSize) {
|
||||
::memset(static_cast<address>(param_value) + valueSize, '\0',
|
||||
param_value_size - valueSize);
|
||||
}
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/* \brief Enqueues the command for the specified thread trace object.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param thread_trace specifies the cl_threadtrace_amd object.
|
||||
*
|
||||
* \param event_wait_list specify [is a pointer to] events that need to
|
||||
* complete before this particular command can be executed.
|
||||
* If \a event_wait_list is NULL, then this particular command does not wait
|
||||
* on any event to complete. If \a event_wait_list is NULL,
|
||||
* \a num_events_in_wait_list must be 0. If \a event_wait_list is not NULL,
|
||||
* the list of events pointed to by \a event_wait_list must be valid and
|
||||
* \a num_events_in_wait_list must be greater than 0. The events specified in
|
||||
* \a event_wait_list act as synchronization points.
|
||||
*
|
||||
* \param num_events_in_wait_list specify the number of events in
|
||||
* \a event_wait_list. It must be 0 if \a event_wait_list is NULL. It must be
|
||||
* greater than 0 if \a event_wait_list is not NULL.
|
||||
*
|
||||
* \param event returns an event object that identifies this particular
|
||||
* command and can be used to query or queue a wait for this particular
|
||||
* command to complete. \a event can be NULL in which case it will not be
|
||||
* possible for the application to query the status of this command or queue a
|
||||
* wait for this command to complete.
|
||||
* \return A non zero value if OpenCL failed to release threadTrace
|
||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||
* are not the same.
|
||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
||||
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the
|
||||
* cl_threadtrace_command_name_amd, is used.
|
||||
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
||||
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not
|
||||
* bound..
|
||||
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
||||
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
|
||||
* queued.
|
||||
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
|
||||
* queued.
|
||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||
* event_wait_list are not valid events.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
* implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
|
||||
* implementation on the host.
|
||||
*/
|
||||
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueThreadTraceCommandAMD,
|
||||
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace,
|
||||
cl_threadtrace_command_name_amd command_name, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
// Check if command queue is valid
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
// Check if thread trace is valid
|
||||
if (!is_valid(thread_trace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == hostQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
// Check that device associated with the command queue is the same as with thread trace
|
||||
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err = amd::clSetEventWaitList(eventWaitList, *hostQueue, num_events_in_wait_list,
|
||||
event_wait_list);
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// Create a new command for the threadTraces
|
||||
amd::ThreadTraceCommand* command = NULL;
|
||||
switch (command_name) {
|
||||
case CL_THREAD_TRACE_BEGIN_COMMAND:
|
||||
if ((amdThreadTrace->getState() != amd::ThreadTrace::MemoryBound) &&
|
||||
(amdThreadTrace->getState() != amd::ThreadTrace::End)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
||||
command = new amd::ThreadTraceCommand(
|
||||
*hostQueue, eventWaitList, static_cast<const void*>(&amdThreadTrace->threadTraceConfig()),
|
||||
*amdThreadTrace, amd::ThreadTraceCommand::Begin, CL_COMMAND_THREAD_TRACE);
|
||||
break;
|
||||
case CL_THREAD_TRACE_END_COMMAND:
|
||||
if ((amdThreadTrace->getState() != amd::ThreadTrace::Begin) &&
|
||||
(amdThreadTrace->getState() != amd::ThreadTrace::Pause)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
amdThreadTrace->setState(amd::ThreadTrace::End);
|
||||
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,
|
||||
&amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||
amd::ThreadTraceCommand::End, CL_COMMAND_THREAD_TRACE);
|
||||
break;
|
||||
case CL_THREAD_TRACE_PAUSE_COMMAND:
|
||||
if (amdThreadTrace->getState() != amd::ThreadTrace::Begin) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
amdThreadTrace->setState(amd::ThreadTrace::Pause);
|
||||
command = new amd::ThreadTraceCommand(
|
||||
*hostQueue, eventWaitList, &amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||
amd::ThreadTraceCommand::Pause, CL_COMMAND_THREAD_TRACE);
|
||||
break;
|
||||
case CL_THREAD_TRACE_RESUME_COMMAND:
|
||||
if (amdThreadTrace->getState() != amd::ThreadTrace::Pause) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
||||
command = new amd::ThreadTraceCommand(
|
||||
*hostQueue, eventWaitList, &amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||
amd::ThreadTraceCommand::Resume, CL_COMMAND_THREAD_TRACE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Submit the command to the device
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
//
|
||||
///*! \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace
|
||||
///recording..
|
||||
// *
|
||||
// * \param command_queue must be a valid OpenCL command queue.
|
||||
// *
|
||||
// * \param thread_trace specifies the cl_threadtrace_amd object.
|
||||
// *
|
||||
// * \param mem_objects the cl_mem objects for trace recording
|
||||
// *
|
||||
// * \param mem_objects_num the number of cl_mem objects in the mem_objects
|
||||
// *
|
||||
// * \param buffer_size the size of each cl_mem object from mem_objects
|
||||
// *
|
||||
// * \param event_wait_list specify [is a pointer to] events that need to
|
||||
// * complete before this particular command can be executed.
|
||||
// * If \a event_wait_list is NULL, then this particular command does not wait
|
||||
// * on any event to complete. If \a event_wait_list is NULL,
|
||||
// * \a num_events_in_wait_list must be 0. If \a event_wait_list is not NULL,
|
||||
// * the list of events pointed to by \a event_wait_list must be valid and
|
||||
// * \a num_events_in_wait_list must be greater than 0. The events specified in
|
||||
// * \a event_wait_list act as synchronization points.
|
||||
// *
|
||||
// * \param num_events_in_wait_list specify the number of events in
|
||||
// * \a event_wait_list. It must be 0 if \a event_wait_list is NULL. It must be
|
||||
// * greater than 0 if \a event_wait_list is not NULL.
|
||||
// *
|
||||
// * \param event returns an event object that identifies this particular
|
||||
// * command and can be used to query or queue a wait for this particular
|
||||
// * command to complete. \a event can be NULL in which case it will not be
|
||||
// * possible for the application to query the status of this command or queue a
|
||||
// * wait for this command to complete.
|
||||
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||
// * - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||
// * - CL_INVALID_CONTEXT if the context associated with command_queue and events in
|
||||
// event_wait_list are not the same.
|
||||
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||
// * - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
||||
// * - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
||||
// * - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
|
||||
// the [GPU] device.
|
||||
// * - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid
|
||||
// memory object or memory_objects is NULL.
|
||||
// * - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store
|
||||
// associated from the memory objects of the mem_objects array.
|
||||
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
// event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||
// event_wait_list are not valid events.
|
||||
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
// implementation on the device.
|
||||
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
// * OpenCL implementation on the host.
|
||||
// */
|
||||
RUNTIME_ENTRY(cl_int, clEnqueueBindThreadTraceBufferAMD,
|
||||
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace, cl_mem* mem_objects,
|
||||
cl_uint mem_objects_num, cl_uint buffer_size, cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list, cl_event* event)) {
|
||||
// Check if command queue is valid
|
||||
if (!is_valid(command_queue)) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
// Check if thread trace is valid
|
||||
if (!is_valid(thread_trace)) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// Check if input values are valid
|
||||
if ((mem_objects == NULL) || (buffer_size <= 0)) {
|
||||
return CL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
||||
|
||||
// Check if the number of bound memory objects is the same as the number of SEs
|
||||
if (amdThreadTrace->deviceSeNumThreadTrace() != mem_objects_num) {
|
||||
return CL_INVALID_OPERATION;
|
||||
}
|
||||
// Check if memory objects ,bound the thread trace,are valid
|
||||
for (size_t i = 0; i < mem_objects_num; ++i) {
|
||||
cl_mem obj = mem_objects[i];
|
||||
if (!is_valid(obj)) {
|
||||
return CL_INVALID_MEM_OBJECT;
|
||||
}
|
||||
}
|
||||
|
||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||
if (NULL == hostQueue) {
|
||||
return CL_INVALID_COMMAND_QUEUE;
|
||||
}
|
||||
|
||||
// Check that device associated with the command queue is the same as with thread trace
|
||||
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
||||
return CL_INVALID_DEVICE;
|
||||
}
|
||||
|
||||
amd::Command::EventWaitList eventWaitList;
|
||||
cl_int err = amd::clSetEventWaitList(eventWaitList, *hostQueue, num_events_in_wait_list,
|
||||
event_wait_list);
|
||||
if (err != CL_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
|
||||
amdThreadTrace->setState(amd::ThreadTrace::MemoryBound);
|
||||
// Create a new ThreadTraceMemObjectsCommand command
|
||||
amd::ThreadTraceMemObjectsCommand* command = new amd::ThreadTraceMemObjectsCommand(
|
||||
*hostQueue, eventWaitList, mem_objects_num, mem_objects, buffer_size, *amdThreadTrace,
|
||||
CL_COMMAND_THREAD_TRACE_MEM);
|
||||
if (command == NULL) {
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure we have memory for the command execution
|
||||
if (!command->validateMemory()) {
|
||||
delete command;
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
// Submit the command to the device
|
||||
command->enqueue();
|
||||
|
||||
*not_null(event) = as_cl(&command->event());
|
||||
if (event == NULL) {
|
||||
command->release();
|
||||
}
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,363 @@
|
||||
/* Copyright (c) 2012 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#ifndef __CL_THREAD_TRACE_AMD_H
|
||||
#define __CL_THREAD_TRACE_AMD_H
|
||||
|
||||
#include "CL/cl_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
typedef struct _cl_threadtrace_amd* cl_threadtrace_amd;
|
||||
typedef cl_uint cl_thread_trace_param;
|
||||
typedef cl_uint cl_threadtrace_info;
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_THREAD_TRACE_MEM 0x4500
|
||||
#define CL_COMMAND_THREAD_TRACE 0x4501
|
||||
|
||||
/* cl_threadtrace_command_name_amd enumeration */
|
||||
typedef enum _cl_threadtrace_command_name_amd {
|
||||
CL_THREAD_TRACE_BEGIN_COMMAND,
|
||||
CL_THREAD_TRACE_END_COMMAND,
|
||||
CL_THREAD_TRACE_PAUSE_COMMAND,
|
||||
CL_THREAD_TRACE_RESUME_COMMAND
|
||||
} cl_threadtrace_command_name_amd;
|
||||
|
||||
// Thread trace parameters
|
||||
enum ThreadTraceParameter {
|
||||
CL_THREAD_TRACE_PARAM_TOKEN_MASK,
|
||||
CL_THREAD_TRACE_PARAM_REG_MASK,
|
||||
CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET,
|
||||
CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET,
|
||||
CL_THREAD_TRACE_PARAM_SIMD_MASK,
|
||||
CL_THREAD_TRACE_PARAM_VM_ID_MASK,
|
||||
CL_THREAD_TRACE_PARAM_RANDOM_SEED,
|
||||
CL_THREAD_TRACE_PARAM_CAPTURE_MODE,
|
||||
CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK,
|
||||
CL_THREAD_TRACE_PARAM_USER_DATA,
|
||||
CL_THREAD_TRACE_PARAM_IS_WRAPPED
|
||||
};
|
||||
|
||||
// CL_THREAD_TRACE_PARAM_TOKEN_MASK data selects for SI
|
||||
enum CL_THREAD_TRACE_TOKEN_MASK {
|
||||
// Time passed
|
||||
CL_THREAD_TRACE_TOKEN_MASK_TIME_SI = 0x00000001,
|
||||
// Resync the timestamp
|
||||
CL_THREAD_TRACE_TOKEN_MASK_TIMESTAMP_SI = 0x00000002,
|
||||
// A register write has occurred
|
||||
CL_THREAD_TRACE_TOKEN_MASK_REG_SI = 0x00000004,
|
||||
// A wavefront has started
|
||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_START_SI = 0x00000008,
|
||||
// Output space has been allocated for color/Z [Should be used for cl-gl]
|
||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_PS_ALLOC_SI = 0x00000010,
|
||||
// Output space has been allocated for vertex position [Should be used for cl-gl]
|
||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_VS_ALLOC_SI = 0x00000020,
|
||||
// Wavefront completion
|
||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_END_SI = 0x00000040,
|
||||
// An event has reached the top of a shader stage. In-order with WAVE_START
|
||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_SI = 0x00000080,
|
||||
// An event has reached the top of a compute shader stage. In-order with WAVE_START
|
||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_CS_SI = 0x00000100,
|
||||
// An event has reached the top of a shader stage for the second GFX pipe. In-order with
|
||||
// WAVE_START.
|
||||
//[Should be used for cl-gl]
|
||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_GFX_SI = 0x00000200,
|
||||
// The kernel has executed an instruction
|
||||
CL_THREAD_TRACE_TOKEN_MASK_INST_SI = 0x00000400,
|
||||
// The kernel has explicitly written the PC value
|
||||
CL_THREAD_TRACE_TOKEN_MASK_INST_PC_SI = 0x00000800,
|
||||
// The kernel has written user data into the thread trace buffer
|
||||
CL_THREAD_TRACE_TOKEN_MASK_INST_USERDATA_SI = 0x00001000,
|
||||
// Provides information about instruction scheduling
|
||||
CL_THREAD_TRACE_TOKEN_MASK_ISSUE_SI = 0x00002000,
|
||||
// The performance counter delta has been updated
|
||||
CL_THREAD_TRACE_TOKEN_MASK_PERF_SI = 0x00004000,
|
||||
// A miscellaneous event has been sent
|
||||
CL_THREAD_TRACE_TOKEN_MASK_MISC_SI = 0x00008000,
|
||||
// All possible tokens
|
||||
CL_THREAD_TRACE_TOKEN_MASK_ALL_SI = 0x0000ffff,
|
||||
};
|
||||
|
||||
// CL_THREAD_TRACE_PARAM_REG_MASK data selects
|
||||
enum CL_THREAD_TRACE_REG_MASK {
|
||||
// Event initiator
|
||||
CL_THREAD_TRACE_REG_MASK_EVENT_SI = 0x00000001,
|
||||
// Draw initiator [Should be used for cl-gl]
|
||||
CL_THREAD_TRACE_REG_MASK_DRAW_SI = 0x00000002,
|
||||
// Dispatch initiator
|
||||
CL_THREAD_TRACE_REG_MASK_DISPATCH_SI = 0x00000004,
|
||||
// User data from host
|
||||
CL_THREAD_TRACE_REG_MASK_USERDATA_SI = 0x00000008,
|
||||
// GFXDEC register (8-state) [Should be used for cl-gl]
|
||||
CL_THREAD_TRACE_REG_MASK_GFXDEC_SI = 0x00000020,
|
||||
// SHDEC register (many state)
|
||||
CL_THREAD_TRACE_REG_MASK_SHDEC_SI = 0x00000040,
|
||||
// Other registers
|
||||
CL_THREAD_TRACE_REG_MASK_OTHER_SI = 0x00000080,
|
||||
// All possible registers types
|
||||
CL_THREAD_TRACE_REG_MASK_ALL_SI = 0x000000ff,
|
||||
};
|
||||
|
||||
// CL_THREAD_TRACE_PARAM_VM_ID_MASK data selects
|
||||
enum CL_THREAD_TRACE_VM_ID_MASK {
|
||||
// Capture only data from the VM_ID used to write {SQTT}_BASE
|
||||
CL_THREAD_TRACE_VM_ID_MASK_SINGLE = 0,
|
||||
// Capture all data from all VM_IDs
|
||||
CL_THREAD_TRACE_VM_ID_MASK_ALL = 1,
|
||||
// Capture all data but only get target (a.k.a. detail) data from VM_ID used to write {SQTT}_BASE
|
||||
CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL = 2
|
||||
};
|
||||
|
||||
// CL_THREAD_TRACE_PARAM_CAPTURE_MODE data
|
||||
enum CL_THREAD_TRACE_CAPTURE_MODE {
|
||||
// Capture all data in the thread trace buffer
|
||||
CL_THREAD_TRACE_CAPTURE_ALL = 0,
|
||||
// Capture only data between THREAD_TRACE_START and THREAD_TRACE_STOP events
|
||||
CL_THREAD_TRACE_CAPTURE_SELECT = 1,
|
||||
// Capture data between THREAD_TRACE_START and THREAD_TRACE_/STOP events,
|
||||
// and global/reference data at all times
|
||||
CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL = 2
|
||||
};
|
||||
|
||||
// CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK data selects
|
||||
enum CL_THREAD_TRACE_INSTRUCTION_MASK {
|
||||
// Generate {SQTT}_TOKEN_INST tokens for all instructions
|
||||
CL_THREAD_TRACE_INST_MASK_ALL,
|
||||
// Generate {SQTT}_TOKEN_INST tokens for stalled instructions only
|
||||
CL_THREAD_TRACE_INST_MASK_STALLED,
|
||||
// Generate {SQTT}_TOKEN_INST messages for stalled and other (no op/wait/set prio/etc)
|
||||
// instructions
|
||||
CL_THREAD_TRACE_INST_MASK_STALLED_AND_IMMEDIATE,
|
||||
// Generate {SQTT}_TOKEN_INST messages for immediate instructions only only [ Should be used only
|
||||
// for CI]
|
||||
CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI,
|
||||
};
|
||||
|
||||
enum ThreadTraceInfo {
|
||||
CL_THREAD_TRACE_SE,
|
||||
CL_THREAD_TRACE_BUFFERS_FILLED,
|
||||
CL_THREAD_TRACE_BUFFERS_SIZE
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Creates a new cl_threadtrace_amd object
|
||||
*
|
||||
* \param device must be a valid OpenCL device.
|
||||
*
|
||||
* \param errcode_ret A non zero value if OpenCL failed to create threadTrace
|
||||
* -CL_INVALID_DEVICE if devices contains an invalid device.
|
||||
* -CL_DEVICE_NOT_AVAILABLE if a device is currently not available even
|
||||
* though the device was returned by clGetDeviceIDs.
|
||||
* -CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the
|
||||
* OpenCL implementation on the device.
|
||||
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
OpenCL implementation on the host.
|
||||
*
|
||||
* \return the created threadTrace object
|
||||
*/
|
||||
extern CL_API_ENTRY cl_threadtrace_amd CL_API_CALL clCreateThreadTraceAMD(
|
||||
cl_device_id /* device */, cl_int* /* errcode_ret */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Destroys a cl_threadtrace_amd object.
|
||||
*
|
||||
* \param threadTrace the cl_threadtrace_amd object for release
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release threadTrace
|
||||
* -CL_INVALID_VALUE if the thread_trace is not a valid OpenCL thread trace object
|
||||
(cl_threadtrace_amd) .
|
||||
* -CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the
|
||||
* OpenCL implementation on the device.
|
||||
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
OpenCL implementation on the host.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clReleaseThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Increments the cl_threadtrace_amd object reference count.
|
||||
*
|
||||
* \param threadTrace the cl_threadtrace_amd object for retain
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to retain threadTrace
|
||||
* -CL_INVALID_VALUE if the thread_trace is not a valid thread trace object (cl_threadtrace_amd) .
|
||||
* -CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the
|
||||
OpenCL implementation on the device.
|
||||
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
OpenCL implementation on the host.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clRetainThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Sets the cl_threadtrace_amd object configuration parameter.
|
||||
*
|
||||
* \param thread_trace the cl_threadtrace_amd object to set configuration parameter
|
||||
*
|
||||
* \param config_param the cl_thread_trace_param
|
||||
*
|
||||
* \param param_value corresponding to configParam
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||
* - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
event_wait_list is not NULL and num_events_in_wait_list is 0,
|
||||
* - or if event objects in event_wait_list are not valid events.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
OpenCL implementation on the host.
|
||||
*/
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clSetThreadTraceParamAMD(
|
||||
cl_threadtrace_amd /*thread_trace*/, cl_thread_trace_param /*config_param*/,
|
||||
cl_uint /*param_value*/
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace
|
||||
* recording..
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param thread_trace specifies the cl_threadtrace_amd object.
|
||||
*
|
||||
* \param mem_objects the cl_mem objects for trace recording
|
||||
*
|
||||
* \param mem_objects_num the number of cl_mem objects in the mem_objects
|
||||
*
|
||||
* \param buffer_size the size of each cl_mem object from mem_objects
|
||||
*
|
||||
* \param event_wait_list specify [is a pointer to] events that need to
|
||||
* complete before this particular command can be executed.
|
||||
* If \a event_wait_list is NULL, then this particular command does not wait
|
||||
* on any event to complete. If \a event_wait_list is NULL,
|
||||
* \a num_events_in_wait_list must be 0. If \a event_wait_list is not NULL,
|
||||
* the list of events pointed to by \a event_wait_list must be valid and
|
||||
* \a num_events_in_wait_list must be greater than 0. The events specified in
|
||||
* \a event_wait_list act as synchronization points.
|
||||
*
|
||||
* \param num_events_in_wait_list specify the number of events in
|
||||
* \a event_wait_list. It must be 0 if \a event_wait_list is NULL. It must be
|
||||
* greater than 0 if \a event_wait_list is not NULL.
|
||||
*
|
||||
* \param event returns an event object that identifies this particular
|
||||
* command and can be used to query or queue a wait for this particular
|
||||
* command to complete. \a event can be NULL in which case it will not be
|
||||
* possible for the application to query the status of this command or queue a
|
||||
* wait for this command to complete.
|
||||
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||
* are not the same.
|
||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||
* - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
||||
* - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
||||
* - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
|
||||
* the [GPU] device.
|
||||
* - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory
|
||||
* object or memory_objects is NULL.
|
||||
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store
|
||||
* associated from the memory objects of the mem_objects array.
|
||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||
* event_wait_list are not valid events.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
* implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
* OpenCL implementation on the host.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBindThreadTraceBufferAMD(
|
||||
cl_command_queue command_queue, cl_threadtrace_amd /*thread_trace*/, cl_mem* /*mem_objects*/,
|
||||
cl_uint /*mem_objects_num*/, cl_uint /*buffer_size*/, cl_uint /*num_events_in_wait_list*/,
|
||||
const cl_event* /*event_wait_list*/, cl_event* /*event*/
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Get specific information about the OpenCL Thread Trace.
|
||||
*
|
||||
* \param thread_trace_info_param is an enum that identifies the Thread Trace information being
|
||||
* queried.
|
||||
*
|
||||
* \param param_value is a pointer to memory location where appropriate values
|
||||
* for a given \a threadTrace_info_param will be returned. If \a param_value is NULL,
|
||||
* it is ignored.
|
||||
*
|
||||
* \param param_value_size specifies the size in bytes of memory pointed to by
|
||||
* \a param_value. This size in bytes must be >= size of return type.
|
||||
*
|
||||
* \param param_value_size_ret returns the actual size in bytes of data being
|
||||
* queried by param_value. If \a param_value_size_ret is NULL, it is ignored.
|
||||
*
|
||||
* \return One of the following values:
|
||||
* CL_INVALID_OPERATION if cl_threadtrace_amd object is not valid
|
||||
* - CL_INVALID_VALUE if \a param_name is not one of the supported
|
||||
* values or if size in bytes specified by \a param_value_size is < size of
|
||||
* return type and \a param_value is not a NULL value.
|
||||
* CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||
* OpenCL implementation on the host.
|
||||
* CL_SUCCESS if the function is executed successfully.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clGetThreadTraceInfoAMD(
|
||||
cl_threadtrace_amd /* thread_trace */, cl_threadtrace_info /*thread_trace_info_param*/,
|
||||
size_t /*param_value_size*/, void* /*param_value*/, size_t* /*param_value_size_ret*/
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/*! \brief Enqueues the thread trace command for the specified thread trace object.
|
||||
*
|
||||
* \param command_queue must be a valid OpenCL command queue.
|
||||
*
|
||||
* \param threadTraces specifies an array of cl_threadtrace_amd objects.
|
||||
*
|
||||
* \return A non zero value if OpenCL failed to release threadTrace
|
||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||
* are not the same.
|
||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
||||
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the
|
||||
* cl_threadtrace_command_name_amd, is used.
|
||||
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
||||
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not
|
||||
* bound..
|
||||
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
||||
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
|
||||
* queued.
|
||||
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
|
||||
* queued.
|
||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||
* event_wait_list are not valid events.
|
||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||
* implementation on the device.
|
||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
|
||||
* implementation on the host.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueThreadTraceCommandAMD(
|
||||
cl_command_queue /*command_queue*/, cl_threadtrace_amd /*thread_trace*/,
|
||||
cl_threadtrace_command_name_amd /*command_name*/, cl_uint /*num_events_in_wait_list*/,
|
||||
const cl_event* /*event_wait_list*/, cl_event* /*event*/
|
||||
) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /*__CL_THREAD_TRACE_AMD_H*/
|
||||
@@ -0,0 +1,119 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/memory.hpp"
|
||||
|
||||
namespace amd
|
||||
{
|
||||
class VkObject : public InteropObject
|
||||
{
|
||||
protected:
|
||||
amd::Os::FileDesc handleVk_;
|
||||
|
||||
public:
|
||||
//! GLObject constructor initializes member variables
|
||||
VkObject(
|
||||
amd::Os::FileDesc handle
|
||||
) // Initialization of member variables
|
||||
|
||||
{
|
||||
handleVk_ = handle;
|
||||
}
|
||||
|
||||
virtual ~VkObject() {}
|
||||
VkObject* asVkObject() { return this; }
|
||||
amd::Os::FileDesc getVkSharedHandle() const { return handleVk_; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
class BufferVk : public Buffer, public VkObject
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'BufferVk' object in memory layout.
|
||||
void initDeviceMemory() {
|
||||
deviceMemories_ =
|
||||
reinterpret_cast<DeviceMemory*>(reinterpret_cast<char*>(this) + sizeof(BufferVk));
|
||||
memset(deviceMemories_, 0, context_().devices().size() * sizeof(DeviceMemory));
|
||||
}
|
||||
public:
|
||||
//! BufferVk constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
BufferVk(
|
||||
Context& amdContext,
|
||||
size_t uiSizeInBytes,
|
||||
amd::Os::FileDesc handle)
|
||||
: // Call base classes constructors
|
||||
Buffer(
|
||||
amdContext,
|
||||
0,
|
||||
uiSizeInBytes
|
||||
),
|
||||
VkObject(
|
||||
handle
|
||||
)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~BufferVk() {}
|
||||
|
||||
BufferVk* asBufferVk() { return this; }
|
||||
};
|
||||
|
||||
// to be modified once image requirments are known, for now, implement like buffer
|
||||
|
||||
class ImageVk : public Buffer, public VkObject
|
||||
{
|
||||
protected:
|
||||
//! Initializes the device memory array which is nested
|
||||
// after'ImageVk' object in memory layout.
|
||||
void initDeviceMemory() {
|
||||
deviceMemories_ =
|
||||
reinterpret_cast<DeviceMemory*>(reinterpret_cast<char*>(this) + sizeof(ImageVk));
|
||||
memset(deviceMemories_, 0, context_().devices().size() * sizeof(DeviceMemory));
|
||||
}
|
||||
public:
|
||||
//! ImageVk constructor just calls constructors of base classes
|
||||
//! to pass down the parameters
|
||||
ImageVk(
|
||||
Context& amdContext,
|
||||
size_t uiSizeInBytes,
|
||||
amd::Os::FileDesc handle)
|
||||
: // Call base classes constructors
|
||||
Buffer(
|
||||
amdContext,
|
||||
0,
|
||||
uiSizeInBytes
|
||||
),
|
||||
VkObject(
|
||||
handle
|
||||
)
|
||||
{
|
||||
setInteropObj(this);
|
||||
}
|
||||
virtual ~ImageVk() {}
|
||||
|
||||
ImageVk* asImageVk() { return this; }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2020 - 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if(ROCCLR_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(ROCCLR_INCLUDE_DIR top.hpp
|
||||
HINTS
|
||||
${ROCCLR_PATH}
|
||||
PATHS
|
||||
# gerrit repo name
|
||||
${CMAKE_SOURCE_DIR}/vdi
|
||||
${CMAKE_SOURCE_DIR}/../vdi
|
||||
${CMAKE_SOURCE_DIR}/../../vdi
|
||||
# github repo name
|
||||
${CMAKE_SOURCE_DIR}/ROCclr
|
||||
${CMAKE_SOURCE_DIR}/../ROCclr
|
||||
${CMAKE_SOURCE_DIR}/../../ROCclr
|
||||
# jenkins repo name
|
||||
${CMAKE_SOURCE_DIR}/rocclr
|
||||
${CMAKE_SOURCE_DIR}/../rocclr
|
||||
${CMAKE_SOURCE_DIR}/../../rocclr
|
||||
PATH_SUFFIXES
|
||||
include)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROCclr
|
||||
"\nROCclr not found"
|
||||
ROCCLR_INCLUDE_DIR)
|
||||
mark_as_advanced(ROCCLR_INCLUDE_DIR)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${ROCCLR_INCLUDE_DIR}/../cmake")
|
||||
include(ROCclr)
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Copyright (c) 2010 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
GLPREFIX(GLubyte*, glGetString, (GLenum name))
|
||||
|
||||
GLPREFIX(void, glBindBuffer, (GLenum target, GLuint buffer))
|
||||
//GLPREFIX(void, glBindFramebufferEXT, (GLenum target, GLuint framebuffer))
|
||||
GLPREFIX(void, glBindRenderbuffer, (GLenum target, GLuint renderbuffer))
|
||||
GLPREFIX(void, glBindTexture, (GLenum target, GLuint texture))
|
||||
GLPREFIX(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage))
|
||||
|
||||
GLPREFIX(GLenum, glCheckFramebufferStatusEXT, (GLenum target))
|
||||
|
||||
GLPREFIX(void, glDeleteBuffers, (GLsizei n, const GLuint* buffers))
|
||||
GLPREFIX(void, glDrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
|
||||
|
||||
//GLPREFIX(void, glFramebufferRenderbufferEXT, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer))
|
||||
|
||||
GLPREFIX(void, glGenBuffers, (GLsizei n, GLuint* buffers))
|
||||
//GLPREFIX(void, glGenFramebuffersEXT, (GLsizei n, GLuint* framebuffers))
|
||||
//10
|
||||
GLPREFIX(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint* params))
|
||||
GLPREFIX(GLenum, glGetError, (void))
|
||||
GLPREFIX(void, glFinish, (void))
|
||||
GLPREFIX(void, glFlush, (void))
|
||||
GLPREFIX(GLenum, glClientWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout))
|
||||
GLPREFIX(void, glGetIntegerv, (GLenum pname, GLint *params))
|
||||
GLPREFIX(void, glGetRenderbufferParameterivEXT, (GLenum target, GLenum pname, GLint* params))
|
||||
//GLPREFIX(GLubyte*, glGetString, (GLenum name))
|
||||
GLPREFIX(void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels))
|
||||
GLPREFIX(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params))
|
||||
GLPREFIX(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params))
|
||||
|
||||
GLPREFIX(GLboolean, glIsBuffer, (GLuint buffer))
|
||||
GLPREFIX(GLboolean, glIsRenderbufferEXT, (GLuint renderbuffer))
|
||||
GLPREFIX(GLboolean, glIsTexture, (GLuint texture))
|
||||
//20
|
||||
GLPREFIX(GLvoid*, glMapBuffer, (GLenum target, GLenum access))
|
||||
|
||||
GLPREFIX(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))
|
||||
|
||||
GLPREFIX(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
|
||||
GLPREFIX(void, glTexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
|
||||
|
||||
GLPREFIX(GLboolean, glUnmapBuffer, (GLenum target))
|
||||
|
||||
#undef GLPREFIX
|
||||
@@ -0,0 +1,41 @@
|
||||
/* Copyright (c) 2008 - 2021 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(_LP64)
|
||||
asm (".symver memcpy, memcpy@GLIBC_2.2.5");
|
||||
void *__wrap_memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
#endif // _LP64
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // __cplusplus)
|
||||
|
||||
#endif // __linux__
|
||||
@@ -0,0 +1 @@
|
||||
libamdocl32.so
|
||||
@@ -0,0 +1 @@
|
||||
libamdocl64.so
|
||||
Vendored
@@ -0,0 +1,329 @@
|
||||
/* -*- mode: c; tab-width: 8; -*- */
|
||||
/* vi: set sw=4 ts=8: */
|
||||
/* Reference version of egl.h for EGL 1.4.
|
||||
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
|
||||
*/
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_
|
||||
|
||||
/* All platform-dependent types and macro boilerplate (such as EGLAPI
|
||||
* and EGLAPIENTRY) should go in eglplatform.h.
|
||||
*/
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* EGL Types */
|
||||
/* EGLint is defined in eglplatform.h */
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef unsigned int EGLenum;
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLContext;
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLClientBuffer;
|
||||
|
||||
/* EGL Versioning */
|
||||
#define EGL_VERSION_1_0 1
|
||||
#define EGL_VERSION_1_1 1
|
||||
#define EGL_VERSION_1_2 1
|
||||
#define EGL_VERSION_1_3 1
|
||||
#define EGL_VERSION_1_4 1
|
||||
|
||||
/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
|
||||
* enums are assigned unique values starting at 0x3000.
|
||||
*/
|
||||
|
||||
/* EGL aliases */
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
|
||||
/* Out-of-band handle values */
|
||||
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
|
||||
/* Out-of-band attribute value */
|
||||
#define EGL_DONT_CARE ((EGLint)-1)
|
||||
|
||||
/* Errors / GetError return values */
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
|
||||
|
||||
/* Reserved 0x300F-0x301F for additional errors */
|
||||
|
||||
/* Config attributes */
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_NONE 0x3038 /* Attrib list terminator */
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
|
||||
/* Reserved 0x3041-0x304F for additional config attributes */
|
||||
|
||||
/* Config attribute values */
|
||||
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
|
||||
#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
|
||||
|
||||
/* More config attribute values, for EGL_TEXTURE_FORMAT */
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
|
||||
/* Config attribute mask bits */
|
||||
#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
|
||||
|
||||
#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
|
||||
/* QueryString targets */
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
|
||||
/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
|
||||
/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
|
||||
/* OpenVG color spaces */
|
||||
#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
|
||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
|
||||
|
||||
/* OpenVG alpha formats */
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
|
||||
|
||||
/* Constant scale factor by which fractional display resolutions &
|
||||
* aspect ratio are scaled when queried as integer values.
|
||||
*/
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
|
||||
/* Unknown display resolution/aspect ratio */
|
||||
#define EGL_UNKNOWN ((EGLint)-1)
|
||||
|
||||
/* Back buffer swap behaviors */
|
||||
#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
|
||||
#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
|
||||
|
||||
/* CreatePbufferFromClientBuffer buffer types */
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
|
||||
/* QueryContext targets */
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
|
||||
/* CreateContext attributes */
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
|
||||
/* Multisample resolution behaviors */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
|
||||
/* BindAPI/QueryAPI targets */
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
|
||||
/* GetCurrentSurface targets */
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_READ 0x305A
|
||||
|
||||
/* WaitNative engines */
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
|
||||
/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
|
||||
#define EGL_COLORSPACE EGL_VG_COLORSPACE
|
||||
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
|
||||
#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
|
||||
#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
|
||||
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
|
||||
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
|
||||
|
||||
/* EGL extensions must request enum blocks from the Khronos
|
||||
* API Registrar, who maintains the enumerant registry. Submit
|
||||
* a bug in Khronos Bugzilla against task "Registry".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* EGL Functions */
|
||||
|
||||
EGLAPI EGLint EGLAPIENTRY eglGetError(void);
|
||||
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
|
||||
|
||||
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
|
||||
EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
|
||||
EGLConfig *configs, EGLint config_size,
|
||||
EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativeWindowType win,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativePixmapType pixmap,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
|
||||
EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
|
||||
EGLContext share_context,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
|
||||
EGLSurface read, EGLContext ctx);
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLNativePixmapType target);
|
||||
|
||||
/* This is a generic function pointer type, whose name indicates it must
|
||||
* be cast to the proper type *and calling convention* before use.
|
||||
*/
|
||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
|
||||
/* Now, define eglGetProcAddress using the generic function ptr. type */
|
||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
||||
eglGetProcAddress(const char *procname);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __egl_h_ */
|
||||
@@ -0,0 +1,645 @@
|
||||
#ifndef __eglext_h_
|
||||
#define __eglext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 24350 $ on $Date: 2013-12-04 12:46:23 -0800 (Wed, 04 Dec 2013) $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#define EGL_EGLEXT_VERSION 20131204
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: egl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef EGL_KHR_cl_event
|
||||
#define EGL_KHR_cl_event 1
|
||||
#define EGL_CL_EVENT_HANDLE_KHR 0x309C
|
||||
#define EGL_SYNC_CL_EVENT_KHR 0x30FE
|
||||
#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
|
||||
#endif /* EGL_KHR_cl_event */
|
||||
|
||||
#ifndef EGL_KHR_cl_event2
|
||||
#define EGL_KHR_cl_event2 1
|
||||
typedef void *EGLSyncKHR;
|
||||
typedef intptr_t EGLAttribKHR;
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_KHR_cl_event2 */
|
||||
|
||||
#ifndef EGL_KHR_client_get_all_proc_addresses
|
||||
#define EGL_KHR_client_get_all_proc_addresses 1
|
||||
#endif /* EGL_KHR_client_get_all_proc_addresses */
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
#define EGL_CONFORMANT_KHR 0x3042
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
|
||||
#endif /* EGL_KHR_config_attribs */
|
||||
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
|
||||
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
||||
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
||||
#endif /* EGL_KHR_create_context */
|
||||
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_fence_sync */
|
||||
|
||||
#ifndef EGL_KHR_get_all_proc_addresses
|
||||
#define EGL_KHR_get_all_proc_addresses 1
|
||||
#endif /* EGL_KHR_get_all_proc_addresses */
|
||||
|
||||
#ifndef EGL_KHR_gl_renderbuffer_image
|
||||
#define EGL_KHR_gl_renderbuffer_image 1
|
||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9
|
||||
#endif /* EGL_KHR_gl_renderbuffer_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_2D_image
|
||||
#define EGL_KHR_gl_texture_2D_image 1
|
||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1
|
||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
|
||||
#endif /* EGL_KHR_gl_texture_2D_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_3D_image
|
||||
#define EGL_KHR_gl_texture_3D_image 1
|
||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2
|
||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
|
||||
#endif /* EGL_KHR_gl_texture_3D_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
|
||||
#endif /* EGL_KHR_gl_texture_cubemap_image */
|
||||
|
||||
#ifndef EGL_KHR_image
|
||||
#define EGL_KHR_image 1
|
||||
typedef void *EGLImageKHR;
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
#endif /* EGL_KHR_image */
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
|
||||
#endif /* EGL_KHR_image_base */
|
||||
|
||||
#ifndef EGL_KHR_image_pixmap
|
||||
#define EGL_KHR_image_pixmap 1
|
||||
#endif /* EGL_KHR_image_pixmap */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface
|
||||
#define EGL_KHR_lock_surface 1
|
||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001
|
||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
|
||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
||||
#define EGL_MATCH_FORMAT_KHR 0x3043
|
||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
|
||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1
|
||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
|
||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
|
||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
|
||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
|
||||
#define EGL_BITMAP_POINTER_KHR 0x30C6
|
||||
#define EGL_BITMAP_PITCH_KHR 0x30C7
|
||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8
|
||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
|
||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
|
||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
|
||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
|
||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
|
||||
#define EGL_LOWER_LEFT_KHR 0x30CE
|
||||
#define EGL_UPPER_LEFT_KHR 0x30CF
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
|
||||
#endif
|
||||
#endif /* EGL_KHR_lock_surface */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface2
|
||||
#define EGL_KHR_lock_surface2 1
|
||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
#endif /* EGL_KHR_lock_surface2 */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface3
|
||||
#define EGL_KHR_lock_surface3 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
|
||||
#endif
|
||||
#endif /* EGL_KHR_lock_surface3 */
|
||||
|
||||
#ifndef EGL_KHR_reusable_sync
|
||||
#define EGL_KHR_reusable_sync 1
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
||||
#define EGL_SIGNALED_KHR 0x30F2
|
||||
#define EGL_UNSIGNALED_KHR 0x30F3
|
||||
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
||||
#define EGL_SYNC_TYPE_KHR 0x30F7
|
||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_reusable_sync */
|
||||
|
||||
#ifndef EGL_KHR_stream
|
||||
#define EGL_KHR_stream 1
|
||||
typedef void *EGLStreamKHR;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
||||
#define EGL_STREAM_STATE_KHR 0x3214
|
||||
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
|
||||
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
|
||||
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
|
||||
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
|
||||
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
|
||||
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
|
||||
#define EGL_BAD_STREAM_KHR 0x321B
|
||||
#define EGL_BAD_STATE_KHR 0x321C
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_stream */
|
||||
|
||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
||||
#define EGL_KHR_stream_consumer_gltexture 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_consumer_gltexture */
|
||||
|
||||
#ifndef EGL_KHR_stream_cross_process_fd
|
||||
#define EGL_KHR_stream_cross_process_fd 1
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_cross_process_fd */
|
||||
|
||||
#ifndef EGL_KHR_stream_fifo
|
||||
#define EGL_KHR_stream_fifo 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
|
||||
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
|
||||
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
|
||||
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_fifo */
|
||||
|
||||
#ifndef EGL_KHR_stream_producer_aldatalocator
|
||||
#define EGL_KHR_stream_producer_aldatalocator 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_producer_aldatalocator */
|
||||
|
||||
#ifndef EGL_KHR_stream_producer_eglsurface
|
||||
#define EGL_KHR_stream_producer_eglsurface 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_STREAM_BIT_KHR 0x0800
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_producer_eglsurface */
|
||||
|
||||
#ifndef EGL_KHR_surfaceless_context
|
||||
#define EGL_KHR_surfaceless_context 1
|
||||
#endif /* EGL_KHR_surfaceless_context */
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
|
||||
#endif /* EGL_KHR_vg_parent_image */
|
||||
|
||||
#ifndef EGL_KHR_wait_sync
|
||||
#define EGL_KHR_wait_sync 1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#endif
|
||||
#endif /* EGL_KHR_wait_sync */
|
||||
|
||||
#ifndef EGL_ANDROID_blob_cache
|
||||
#define EGL_ANDROID_blob_cache 1
|
||||
typedef khronos_ssize_t EGLsizeiANDROID;
|
||||
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
|
||||
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
|
||||
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_blob_cache */
|
||||
|
||||
#ifndef EGL_ANDROID_framebuffer_target
|
||||
#define EGL_ANDROID_framebuffer_target 1
|
||||
#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
|
||||
#endif /* EGL_ANDROID_framebuffer_target */
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
|
||||
#endif /* EGL_ANDROID_image_native_buffer */
|
||||
|
||||
#ifndef EGL_ANDROID_native_fence_sync
|
||||
#define EGL_ANDROID_native_fence_sync 1
|
||||
#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
|
||||
#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
|
||||
#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
|
||||
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_native_fence_sync */
|
||||
|
||||
#ifndef EGL_ANDROID_recordable
|
||||
#define EGL_ANDROID_recordable 1
|
||||
#define EGL_RECORDABLE_ANDROID 0x3142
|
||||
#endif /* EGL_ANDROID_recordable */
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
|
||||
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_query_surface_pointer */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
|
||||
|
||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
||||
#define EGL_ARM_pixmap_multisample_discard 1
|
||||
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
||||
#endif /* EGL_ARM_pixmap_multisample_discard */
|
||||
|
||||
#ifndef EGL_EXT_buffer_age
|
||||
#define EGL_EXT_buffer_age 1
|
||||
#define EGL_BUFFER_AGE_EXT 0x313D
|
||||
#endif /* EGL_EXT_buffer_age */
|
||||
|
||||
#ifndef EGL_EXT_client_extensions
|
||||
#define EGL_EXT_client_extensions 1
|
||||
#endif /* EGL_EXT_client_extensions */
|
||||
|
||||
#ifndef EGL_EXT_create_context_robustness
|
||||
#define EGL_EXT_create_context_robustness 1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
|
||||
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
|
||||
#endif /* EGL_EXT_create_context_robustness */
|
||||
|
||||
#ifndef EGL_EXT_image_dma_buf_import
|
||||
#define EGL_EXT_image_dma_buf_import 1
|
||||
#define EGL_LINUX_DMA_BUF_EXT 0x3270
|
||||
#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
|
||||
#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
|
||||
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
|
||||
#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
|
||||
#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
|
||||
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
|
||||
#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
|
||||
#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
|
||||
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
|
||||
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
|
||||
#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
|
||||
#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
|
||||
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
|
||||
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
|
||||
#define EGL_ITU_REC601_EXT 0x327F
|
||||
#define EGL_ITU_REC709_EXT 0x3280
|
||||
#define EGL_ITU_REC2020_EXT 0x3281
|
||||
#define EGL_YUV_FULL_RANGE_EXT 0x3282
|
||||
#define EGL_YUV_NARROW_RANGE_EXT 0x3283
|
||||
#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
|
||||
#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
|
||||
#endif /* EGL_EXT_image_dma_buf_import */
|
||||
|
||||
#ifndef EGL_EXT_multiview_window
|
||||
#define EGL_EXT_multiview_window 1
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
#endif /* EGL_EXT_multiview_window */
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
#define EGL_EXT_platform_base 1
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_EXT_platform_base */
|
||||
|
||||
#ifndef EGL_EXT_platform_wayland
|
||||
#define EGL_EXT_platform_wayland 1
|
||||
#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
|
||||
#endif /* EGL_EXT_platform_wayland */
|
||||
|
||||
#ifndef EGL_EXT_platform_x11
|
||||
#define EGL_EXT_platform_x11 1
|
||||
#define EGL_PLATFORM_X11_EXT 0x31D5
|
||||
#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
|
||||
#endif /* EGL_EXT_platform_x11 */
|
||||
|
||||
#ifndef EGL_EXT_swap_buffers_with_damage
|
||||
#define EGL_EXT_swap_buffers_with_damage 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#endif
|
||||
#endif /* EGL_EXT_swap_buffers_with_damage */
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
struct EGLClientPixmapHI {
|
||||
void *pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
||||
#endif
|
||||
#endif /* EGL_HI_clientpixmap */
|
||||
|
||||
#ifndef EGL_HI_colorformats
|
||||
#define EGL_HI_colorformats 1
|
||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
||||
#define EGL_COLOR_RGB_HI 0x8F71
|
||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
||||
#endif /* EGL_HI_colorformats */
|
||||
|
||||
#ifndef EGL_IMG_context_priority
|
||||
#define EGL_IMG_context_priority 1
|
||||
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
|
||||
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
|
||||
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif /* EGL_IMG_context_priority */
|
||||
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
|
||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1
|
||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
|
||||
#define EGL_DRM_BUFFER_MESA 0x31D3
|
||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
|
||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif
|
||||
#endif /* EGL_MESA_drm_image */
|
||||
|
||||
#ifndef EGL_MESA_platform_gbm
|
||||
#define EGL_MESA_platform_gbm 1
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif /* EGL_MESA_platform_gbm */
|
||||
|
||||
#ifndef EGL_NV_3dvision_surface
|
||||
#define EGL_NV_3dvision_surface 1
|
||||
#define EGL_AUTO_STEREO_NV 0x3136
|
||||
#endif /* EGL_NV_3dvision_surface */
|
||||
|
||||
#ifndef EGL_NV_coverage_sample
|
||||
#define EGL_NV_coverage_sample 1
|
||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
||||
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
|
||||
#endif /* EGL_NV_coverage_sample */
|
||||
|
||||
#ifndef EGL_NV_coverage_sample_resolve
|
||||
#define EGL_NV_coverage_sample_resolve 1
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif /* EGL_NV_coverage_sample_resolve */
|
||||
|
||||
#ifndef EGL_NV_depth_nonlinear
|
||||
#define EGL_NV_depth_nonlinear 1
|
||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
||||
#define EGL_DEPTH_ENCODING_NONE_NV 0
|
||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif /* EGL_NV_depth_nonlinear */
|
||||
|
||||
#ifndef EGL_NV_native_query
|
||||
#define EGL_NV_native_query 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
||||
#endif
|
||||
#endif /* EGL_NV_native_query */
|
||||
|
||||
#ifndef EGL_NV_post_convert_rounding
|
||||
#define EGL_NV_post_convert_rounding 1
|
||||
#endif /* EGL_NV_post_convert_rounding */
|
||||
|
||||
#ifndef EGL_NV_post_sub_buffer
|
||||
#define EGL_NV_post_sub_buffer 1
|
||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif
|
||||
#endif /* EGL_NV_post_sub_buffer */
|
||||
|
||||
#ifndef EGL_NV_stream_sync
|
||||
#define EGL_NV_stream_sync 1
|
||||
#define EGL_SYNC_NEW_FRAME_NV 0x321F
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_NV_stream_sync */
|
||||
|
||||
#ifndef EGL_NV_sync
|
||||
#define EGL_NV_sync 1
|
||||
typedef void *EGLSyncNV;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
||||
#define EGL_SYNC_STATUS_NV 0x30E7
|
||||
#define EGL_SIGNALED_NV 0x30E8
|
||||
#define EGL_UNSIGNALED_NV 0x30E9
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
|
||||
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_ALREADY_SIGNALED_NV 0x30EA
|
||||
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
|
||||
#define EGL_CONDITION_SATISFIED_NV 0x30EC
|
||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_NV_sync */
|
||||
|
||||
#ifndef EGL_NV_system_time
|
||||
#define EGL_NV_system_time 1
|
||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_NV_system_time */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2013 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
* $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
||||
* by filing a bug against product "EGL" component "Registry".
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* Macros used in EGL function prototype declarations.
|
||||
*
|
||||
* EGL functions should be prototyped as:
|
||||
*
|
||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
||||
*
|
||||
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
|
||||
*/
|
||||
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef EGLAPIENTRY
|
||||
#define EGLAPIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
#define EGLAPIENTRYP EGLAPIENTRY*
|
||||
|
||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
||||
* are aliases of window-system-dependent types, such as X Display * or
|
||||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*
|
||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
||||
* provided below, since these changes affect both binary and source
|
||||
* portability of applications using EGL running on different EGL
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
typedef HWND EGLNativeWindowType;
|
||||
|
||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
|
||||
#elif defined(__ANDROID__) || defined(ANDROID)
|
||||
|
||||
#include <android/native_window.h>
|
||||
|
||||
struct egl_native_pixmap_t;
|
||||
|
||||
typedef struct ANativeWindow* EGLNativeWindowType;
|
||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||
typedef void* EGLNativeDisplayType;
|
||||
|
||||
#elif defined(__unix__)
|
||||
|
||||
/* X11 (tentative) */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
typedef Display *EGLNativeDisplayType;
|
||||
typedef Pixmap EGLNativePixmapType;
|
||||
typedef Window EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
#endif
|
||||
|
||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
||||
typedef EGLNativeDisplayType NativeDisplayType;
|
||||
typedef EGLNativePixmapType NativePixmapType;
|
||||
typedef EGLNativeWindowType NativeWindowType;
|
||||
|
||||
|
||||
/* Define EGLint. This must be a signed integral type large enough to contain
|
||||
* all legal attribute names and values passed into and out of EGL, whether
|
||||
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
|
||||
* handle, or other. While in general a 32-bit integer will suffice, if
|
||||
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
|
||||
* integer type.
|
||||
*/
|
||||
typedef khronos_int32_t EGLint;
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,282 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D10_H
|
||||
#define __OPENCL_CL_D3D10_H
|
||||
|
||||
#include <d3d10.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d10_sharing */
|
||||
#define cl_khr_d3d10_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d10_device_source_khr;
|
||||
typedef cl_uint cl_d3d10_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D10_DEVICE_KHR -1002
|
||||
#define CL_INVALID_D3D10_RESOURCE_KHR -1003
|
||||
#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
|
||||
#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
|
||||
|
||||
/* cl_d3d10_device_source_nv */
|
||||
#define CL_D3D10_DEVICE_KHR 0x4010
|
||||
#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
|
||||
|
||||
/* cl_d3d10_device_set_nv */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
|
||||
#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
|
||||
#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
|
||||
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d10_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d10_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D10_H */
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D11_H
|
||||
#define __OPENCL_CL_D3D11_H
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d11_sharing */
|
||||
#define cl_khr_d3d11_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d11_device_source_khr;
|
||||
typedef cl_uint cl_d3d11_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D11_DEVICE_KHR -1006
|
||||
#define CL_INVALID_D3D11_RESOURCE_KHR -1007
|
||||
#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
|
||||
#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
|
||||
|
||||
/* cl_d3d11_device_source */
|
||||
#define CL_D3D11_DEVICE_KHR 0x4019
|
||||
#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
|
||||
|
||||
/* cl_d3d11_device_set */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
|
||||
#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
|
||||
#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
|
||||
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d11_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d11_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D11_H */
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
#define __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
/* cl_khr_dx9_media_sharing */
|
||||
#define cl_khr_dx9_media_sharing 1
|
||||
|
||||
typedef cl_uint cl_dx9_media_adapter_type_khr;
|
||||
typedef cl_uint cl_dx9_media_adapter_set_khr;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <d3d9.h>
|
||||
typedef struct _cl_dx9_surface_info_khr
|
||||
{
|
||||
IDirect3DSurface9 *resource;
|
||||
HANDLE shared_handle;
|
||||
} cl_dx9_surface_info_khr;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
|
||||
#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
|
||||
#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
|
||||
#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
|
||||
|
||||
/* cl_media_adapter_type_khr */
|
||||
#define CL_ADAPTER_D3D9_KHR 0x2020
|
||||
#define CL_ADAPTER_D3D9EX_KHR 0x2021
|
||||
#define CL_ADAPTER_DXVA_KHR 0x2022
|
||||
|
||||
/* cl_media_adapter_set_khr */
|
||||
#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
|
||||
#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
|
||||
#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
|
||||
#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
|
||||
#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
|
||||
#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_uint num_media_adapters,
|
||||
cl_dx9_media_adapter_type_khr * media_adapter_type,
|
||||
void * media_adapters,
|
||||
cl_dx9_media_adapter_set_khr media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
void * surface_info,
|
||||
cl_uint plane,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
|
||||
|
||||
@@ -0,0 +1,661 @@
|
||||
/* Modifications Copyright (C) 2010-2021 Advanced Micro Devices, Inc. */
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
|
||||
|
||||
/* cl_ext.h contains OpenCL extensions which don't have external */
|
||||
/* (OpenGL, D3D) dependencies. */
|
||||
|
||||
#ifndef __CL_EXT_H
|
||||
#define __CL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
/* cl_khr_fp16 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
|
||||
|
||||
/* Memory object destruction
|
||||
*
|
||||
* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
|
||||
*
|
||||
* Registers a user callback function that will be called when the memory object is deleted and its resources
|
||||
* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
|
||||
* stack associated with memobj. The registered user callback functions are called in the reverse order in
|
||||
* which they were registered. The user callback functions are called and then the memory object is deleted
|
||||
* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
|
||||
* notified when the memory referenced by host_ptr, specified when the memory object is created and used as
|
||||
* the storage bits for the memory object, can be reused or freed.
|
||||
*
|
||||
* The application may not call CL api's with the cl_mem object passed to the pfn_notify.
|
||||
*
|
||||
* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*/
|
||||
#define cl_APPLE_SetMemObjectDestructor 1
|
||||
cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
|
||||
void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Context Logging Functions
|
||||
*
|
||||
* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
|
||||
* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*
|
||||
* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
|
||||
*/
|
||||
#define cl_APPLE_ContextLoggingFunctions 1
|
||||
extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
|
||||
extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
|
||||
extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/************************
|
||||
* cl_khr_icd extension *
|
||||
************************/
|
||||
#define cl_khr_icd 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_PLATFORM_NOT_FOUND_KHR -1001
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
|
||||
cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
|
||||
/* Extension: cl_khr_image2D_buffer
|
||||
*
|
||||
* This extension allows a 2D image to be created from a cl_mem buffer without a copy.
|
||||
* The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
|
||||
* Both the sampler and sampler-less read_image built-in functions are supported for 2D images
|
||||
* and 2D images created from a buffer. Similarly, the write_image built-ins are also supported
|
||||
* for 2D images created from a buffer.
|
||||
*
|
||||
* When the 2D image from buffer is created, the client must specify the width,
|
||||
* height, image format (i.e. channel order and channel data type) and optionally the row pitch
|
||||
*
|
||||
* The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
|
||||
* The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
* cl_khr_initalize_memory extension *
|
||||
*************************************/
|
||||
|
||||
#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E
|
||||
|
||||
|
||||
/**************************************
|
||||
* cl_khr_terminate_context extension *
|
||||
**************************************/
|
||||
|
||||
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F
|
||||
#define CL_CONTEXT_TERMINATE_KHR 0x2010
|
||||
|
||||
#define cl_khr_terminate_context 1
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
/*
|
||||
* Extension: cl_khr_spir
|
||||
*
|
||||
* This extension adds support to create an OpenCL program object from a
|
||||
* Standard Portable Intermediate Representation (SPIR) instance
|
||||
*/
|
||||
|
||||
#define CL_DEVICE_SPIR_VERSIONS 0x40E0
|
||||
#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
|
||||
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_memory_flags *
|
||||
*********************************/
|
||||
#define cl_amd_device_memory_flags 1
|
||||
#define CL_MEM_USE_PERSISTENT_MEM_AMD (1 << 6) // Alloc from GPU's CPU visible heap
|
||||
|
||||
/* cl_device_info */
|
||||
#define CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT 0x4032
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
#define CL_DEVICE_TOPOLOGY_AMD 0x4037
|
||||
#define CL_DEVICE_BOARD_NAME_AMD 0x4038
|
||||
#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
|
||||
#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
|
||||
#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
|
||||
#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
|
||||
#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
|
||||
#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
|
||||
#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
|
||||
#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
|
||||
#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
|
||||
#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
|
||||
#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
|
||||
#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030
|
||||
#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031
|
||||
#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033
|
||||
#define CL_DEVICE_PCIE_ID_AMD 0x4034
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct { cl_uint type; cl_uint data[5]; } raw;
|
||||
struct { cl_uint type; cl_uchar unused[17]; cl_uchar bus; cl_uchar device; cl_uchar function; } pcie;
|
||||
} cl_device_topology_amd;
|
||||
|
||||
#define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1
|
||||
|
||||
/**************************
|
||||
* cl_amd_offline_devices *
|
||||
**************************/
|
||||
#define CL_CONTEXT_OFFLINE_DEVICES_AMD 0x403F
|
||||
|
||||
/********************************
|
||||
* cl_amd_bus_addressable_memory *
|
||||
********************************/
|
||||
|
||||
/* cl_mem flag - bitfield */
|
||||
#define CL_MEM_BUS_ADDRESSABLE_AMD (1<<30)
|
||||
#define CL_MEM_EXTERNAL_PHYSICAL_AMD (1<<31)
|
||||
|
||||
#define CL_COMMAND_WAIT_SIGNAL_AMD 0x4080
|
||||
#define CL_COMMAND_WRITE_SIGNAL_AMD 0x4081
|
||||
#define CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD 0x4082
|
||||
|
||||
typedef struct _cl_bus_address_amd
|
||||
{
|
||||
cl_ulong surface_bus_address;
|
||||
cl_ulong marker_bus_address;
|
||||
} cl_bus_address_amd;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWaitSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_wait_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWriteSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_ulong /*offset*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueMakeBuffersResidentAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_uint /*num_mem_objs*/,
|
||||
cl_mem * /*mem_objects*/,
|
||||
cl_bool /*blocking_make_resident*/,
|
||||
cl_bus_address_amd * /*bus_addresses*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/*************************
|
||||
* cl_amd_copy_buffer_p2p *
|
||||
**************************/
|
||||
#define CL_DEVICE_NUM_P2P_DEVICES_AMD 0x4088
|
||||
#define CL_DEVICE_P2P_DEVICES_AMD 0x4089
|
||||
|
||||
#define cl_amd_copy_buffer_p2p 1
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueCopyBufferP2PAMD_fn)(cl_command_queue /*command_queue*/,
|
||||
cl_mem /*src_buffer*/,
|
||||
cl_mem /*dst_buffer*/,
|
||||
size_t /*src_offset*/,
|
||||
size_t /*dst_offset*/,
|
||||
size_t /*cb*/,
|
||||
cl_uint /*num_events_in_wait_list*/,
|
||||
const cl_event* /*event_wait_list*/,
|
||||
cl_event* /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/***********************************
|
||||
* cl_amd_assembly_program extension *
|
||||
***********************************/
|
||||
#define cl_amd_assembly_program 1
|
||||
|
||||
typedef CL_API_ENTRY cl_program (CL_API_CALL * clCreateProgramWithAssemblyAMD_fn) (
|
||||
cl_context /* context */,
|
||||
cl_uint /* count */,
|
||||
const char** /* strings */,
|
||||
const size_t* /* lengths */,
|
||||
cl_int* /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
// <amd_internal>
|
||||
/**************************
|
||||
* cl_amd_command_queue_info *
|
||||
**************************/
|
||||
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
|
||||
|
||||
/* cl_kernel_exec_info for DVR DOPP texture support */
|
||||
#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120
|
||||
#define CL_KERNEL_EXEC_INFO_PFPA_VCOP_AMD 0x4121
|
||||
// </amd_internal>
|
||||
|
||||
/*********************************
|
||||
* cl_arm_printf extension
|
||||
*********************************/
|
||||
#define CL_PRINTF_CALLBACK_ARM 0x40B0
|
||||
#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
|
||||
|
||||
#ifdef CL_VERSION_1_1
|
||||
/***********************************
|
||||
* cl_ext_device_fission extension *
|
||||
***********************************/
|
||||
#define cl_ext_device_fission 1
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_ulong cl_device_partition_property_ext;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateSubDevicesEXT( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* cl_device_partition_property_ext */
|
||||
#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
|
||||
#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
|
||||
#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
|
||||
#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
|
||||
|
||||
/* clDeviceGetInfo selectors */
|
||||
#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
|
||||
#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
|
||||
#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
|
||||
#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
|
||||
#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
|
||||
|
||||
/* clGetImageInfo enum */
|
||||
#define CL_IMAGE_BYTE_PITCH_AMD 0x4059
|
||||
|
||||
/* error codes */
|
||||
#define CL_DEVICE_PARTITION_FAILED_EXT -1057
|
||||
#define CL_INVALID_PARTITION_COUNT_EXT -1058
|
||||
#define CL_INVALID_PARTITION_NAME_EXT -1059
|
||||
|
||||
/* CL_AFFINITY_DOMAINs */
|
||||
#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
|
||||
#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
|
||||
#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
|
||||
#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
|
||||
#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
|
||||
#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
|
||||
|
||||
/* cl_device_partition_property_ext list terminators */
|
||||
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ext_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
|
||||
|
||||
#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
|
||||
#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
|
||||
#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
|
||||
#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
|
||||
#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
|
||||
#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
|
||||
#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
|
||||
#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
|
||||
|
||||
typedef cl_uint cl_image_pitch_info_qcom;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceImageInfoQCOM(cl_device_id device,
|
||||
size_t image_width,
|
||||
size_t image_height,
|
||||
const cl_image_format *image_format,
|
||||
cl_image_pitch_info_qcom param_name,
|
||||
size_t param_value_size,
|
||||
void *param_value,
|
||||
size_t *param_value_size_ret);
|
||||
|
||||
typedef struct _cl_mem_ext_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Legal values will be defined in layered extensions. */
|
||||
cl_uint allocation_type;
|
||||
|
||||
/* Host cache policy for this external memory allocation. */
|
||||
cl_uint host_cache_policy;
|
||||
|
||||
} cl_mem_ext_host_ptr;
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ion_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
|
||||
|
||||
typedef struct _cl_mem_ion_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
|
||||
cl_mem_ext_host_ptr ext_host_ptr;
|
||||
|
||||
/* ION file descriptor */
|
||||
int ion_filedesc;
|
||||
|
||||
/* Host pointer to the ION allocated memory */
|
||||
void* ion_hostptr;
|
||||
|
||||
} cl_mem_ion_host_ptr;
|
||||
|
||||
#endif /* CL_VERSION_1_1 */
|
||||
|
||||
#if defined(CL_VERSION_1_2)
|
||||
|
||||
/******************************************
|
||||
* cl_img_yuv_image extension *
|
||||
******************************************/
|
||||
|
||||
/* Image formats used in clCreateImage */
|
||||
#define CL_NV21_IMG 0x40D0
|
||||
#define CL_YV12_IMG 0x40D1
|
||||
|
||||
/******************************************
|
||||
* cl_img_cached_allocations extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
|
||||
#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
|
||||
|
||||
/******************************************
|
||||
* cl_img_use_gralloc_ptr extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
|
||||
#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
|
||||
|
||||
/* Error code from clEnqueueReleaseGrallocObjectsIMG */
|
||||
#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
/**********************************
|
||||
* cl_arm_import_memory extension *
|
||||
**********************************/
|
||||
|
||||
#ifdef CL_VERSION_1_0
|
||||
|
||||
typedef intptr_t cl_import_properties_arm;
|
||||
|
||||
/* Default and valid proporties name for cl_arm_import_memory */
|
||||
#define CL_IMPORT_TYPE_ARM 0x40B2
|
||||
|
||||
/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
|
||||
|
||||
/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
|
||||
|
||||
/* Secure DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_SECURE_ARM 0x40B5
|
||||
|
||||
/* This extension adds a new function that allows for direct memory import into
|
||||
* OpenCL via the clImportMemoryARM function.
|
||||
*
|
||||
* Memory imported through this interface will be mapped into the device's page
|
||||
* tables directly, providing zero copy access. It will never fall back to copy
|
||||
* operations and aliased buffers.
|
||||
*
|
||||
* Types of memory supported for import are specified as additional extension
|
||||
* strings.
|
||||
*
|
||||
* This extension produces cl_mem allocations which are compatible with all other
|
||||
* users of cl_mem in the standard API.
|
||||
*
|
||||
* This extension maps pages with the same properties as the normal buffer creation
|
||||
* function clCreateBuffer.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clImportMemoryARM( cl_context context,
|
||||
cl_mem_flags flags,
|
||||
const cl_import_properties_arm *properties,
|
||||
void *memory,
|
||||
size_t size,
|
||||
cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
#endif /* CL_VERSION_1_0 */
|
||||
|
||||
/******************************************
|
||||
* cl_arm_shared_virtual_memory extension *
|
||||
******************************************/
|
||||
|
||||
#ifdef CL_VERSION_1_2
|
||||
|
||||
/* Used by clGetDeviceInfo */
|
||||
#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
|
||||
|
||||
/* Used by clGetMemObjectInfo */
|
||||
#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
|
||||
|
||||
/* Used by clSetKernelExecInfoARM: */
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_SVM_FREE_ARM 0x40BA
|
||||
#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
|
||||
#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
|
||||
#define CL_COMMAND_SVM_MAP_ARM 0x40BD
|
||||
#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
|
||||
|
||||
/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
|
||||
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
|
||||
#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
|
||||
|
||||
/* Flag values used by clSVMAllocARM: */
|
||||
#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
|
||||
#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
|
||||
|
||||
typedef cl_bitfield cl_svm_mem_flags_arm;
|
||||
typedef cl_uint cl_kernel_exec_info_arm;
|
||||
typedef cl_bitfield cl_device_svm_capabilities_arm;
|
||||
|
||||
extern CL_API_ENTRY void * CL_API_CALL
|
||||
clSVMAllocARM(cl_context /* context */,
|
||||
cl_svm_mem_flags_arm /* flags */,
|
||||
size_t /* size */,
|
||||
cl_uint /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY void CL_API_CALL
|
||||
clSVMFreeARM(cl_context /* context */,
|
||||
void * /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMFreeARM(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void * /* user_data */),
|
||||
void * /* user_data */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemcpyARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_copy */,
|
||||
void * /* dst_ptr */,
|
||||
const void * /* src_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemFillARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
const void * /* pattern */,
|
||||
size_t /* pattern_size */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMapARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_map */,
|
||||
cl_map_flags /* flags */,
|
||||
void * /* svm_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMUnmapARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelArgSVMPointerARM(cl_kernel /* kernel */,
|
||||
cl_uint /* arg_index */,
|
||||
const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelExecInfoARM(cl_kernel /* kernel */,
|
||||
cl_kernel_exec_info_arm /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
const void * /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __CL_EXT_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_GL_H
|
||||
#define __OPENCL_CL_GL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef struct __GLsync *cl_GLsync;
|
||||
|
||||
/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
|
||||
#define CL_GL_OBJECT_BUFFER 0x2000
|
||||
#define CL_GL_OBJECT_TEXTURE2D 0x2001
|
||||
#define CL_GL_OBJECT_TEXTURE3D 0x2002
|
||||
#define CL_GL_OBJECT_RENDERBUFFER 0x2003
|
||||
#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
|
||||
#define CL_GL_OBJECT_TEXTURE1D 0x200F
|
||||
#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
|
||||
#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
|
||||
|
||||
/* cl_gl_texture_info */
|
||||
#define CL_GL_TEXTURE_TARGET 0x2004
|
||||
#define CL_GL_MIPMAP_LEVEL 0x2005
|
||||
#define CL_GL_NUM_SAMPLES 0x2012
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* bufobj */,
|
||||
int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLRenderbuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* renderbuffer */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLObjectInfo(cl_mem /* memobj */,
|
||||
cl_gl_object_type * /* gl_object_type */,
|
||||
cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLTextureInfo(cl_mem /* memobj */,
|
||||
cl_gl_texture_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Deprecated OpenCL 1.1 APIs */
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
/* cl_khr_gl_sharing extension */
|
||||
|
||||
#define cl_khr_gl_sharing 1
|
||||
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
|
||||
|
||||
/* cl_gl_context_info */
|
||||
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
|
||||
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
|
||||
|
||||
/* Additional cl_context_properties */
|
||||
#define CL_GL_CONTEXT_KHR 0x2008
|
||||
#define CL_EGL_DISPLAY_KHR 0x2009
|
||||
#define CL_GLX_DISPLAY_KHR 0x200A
|
||||
#define CL_WGL_HDC_KHR 0x200B
|
||||
#define CL_CGL_SHAREGROUP_KHR 0x200C
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
|
||||
cl_gl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
|
||||
const cl_context_properties * properties,
|
||||
cl_gl_context_info param_name,
|
||||
size_t param_value_size,
|
||||
void * param_value,
|
||||
size_t * param_value_size_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_H */
|
||||
@@ -0,0 +1,74 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
|
||||
/* OpenGL dependencies. */
|
||||
|
||||
#ifndef __OPENCL_CL_GL_EXT_H
|
||||
#define __OPENCL_CL_GL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#else
|
||||
#include <CL/cl_gl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For each extension, follow this template
|
||||
* cl_VEN_extname extension */
|
||||
/* #define cl_VEN_extname 1
|
||||
* ... define new types, if any
|
||||
* ... define new tokens, if any
|
||||
* ... define new APIs, if any
|
||||
*
|
||||
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
|
||||
* This allows us to avoid having to decide whether to include GL headers or GLES here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
* See section 9.9 in the OpenCL 1.1 spec for more information
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromGLsyncKHR(cl_context /* context */,
|
||||
cl_GLsync /* cl_GLsync */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_EXT_H */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_H
|
||||
#define __OPENCL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#include <OpenCL/cl_gl_ext.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_gl.h>
|
||||
#include <CL/cl_gl_ext.h>
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_H */
|
||||
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D10_H
|
||||
#define __OPENCL_CL_D3D10_H
|
||||
|
||||
#include <d3d10.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d10_sharing */
|
||||
#define cl_khr_d3d10_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d10_device_source_khr;
|
||||
typedef cl_uint cl_d3d10_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D10_DEVICE_KHR -1002
|
||||
#define CL_INVALID_D3D10_RESOURCE_KHR -1003
|
||||
#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
|
||||
#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
|
||||
|
||||
/* cl_d3d10_device_source_nv */
|
||||
#define CL_D3D10_DEVICE_KHR 0x4010
|
||||
#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
|
||||
|
||||
/* cl_d3d10_device_set_nv */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
|
||||
#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
|
||||
#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
|
||||
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d10_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d10_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D10_H */
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D11_H
|
||||
#define __OPENCL_CL_D3D11_H
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d11_sharing */
|
||||
#define cl_khr_d3d11_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d11_device_source_khr;
|
||||
typedef cl_uint cl_d3d11_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D11_DEVICE_KHR -1006
|
||||
#define CL_INVALID_D3D11_RESOURCE_KHR -1007
|
||||
#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
|
||||
#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
|
||||
|
||||
/* cl_d3d11_device_source */
|
||||
#define CL_D3D11_DEVICE_KHR 0x4019
|
||||
#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
|
||||
|
||||
/* cl_d3d11_device_set */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
|
||||
#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
|
||||
#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
|
||||
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d11_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d11_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D11_H */
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
#define __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* cl_khr_dx9_media_sharing */
|
||||
#define cl_khr_dx9_media_sharing 1
|
||||
|
||||
typedef cl_uint cl_dx9_media_adapter_type_khr;
|
||||
typedef cl_uint cl_dx9_media_adapter_set_khr;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <d3d9.h>
|
||||
typedef struct _cl_dx9_surface_info_khr
|
||||
{
|
||||
IDirect3DSurface9 *resource;
|
||||
HANDLE shared_handle;
|
||||
} cl_dx9_surface_info_khr;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
|
||||
#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
|
||||
#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
|
||||
#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
|
||||
|
||||
/* cl_media_adapter_type_khr */
|
||||
#define CL_ADAPTER_D3D9_KHR 0x2020
|
||||
#define CL_ADAPTER_D3D9EX_KHR 0x2021
|
||||
#define CL_ADAPTER_DXVA_KHR 0x2022
|
||||
|
||||
/* cl_media_adapter_set_khr */
|
||||
#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
|
||||
#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
|
||||
#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
|
||||
#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
|
||||
#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
|
||||
#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_uint num_media_adapters,
|
||||
cl_dx9_media_adapter_type_khr * media_adapter_type,
|
||||
void * media_adapters,
|
||||
cl_dx9_media_adapter_set_khr media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
void * surface_info,
|
||||
cl_uint plane,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_EGL_H
|
||||
#define __OPENCL_CL_EGL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
|
||||
#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F
|
||||
#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D
|
||||
#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E
|
||||
|
||||
/* Error type for clCreateFromEGLImageKHR */
|
||||
#define CL_INVALID_EGL_OBJECT_KHR -1093
|
||||
#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092
|
||||
|
||||
/* CLeglImageKHR is an opaque handle to an EGLImage */
|
||||
typedef void* CLeglImageKHR;
|
||||
|
||||
/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
|
||||
typedef void* CLeglDisplayKHR;
|
||||
|
||||
/* CLeglSyncKHR is an opaque handle to an EGLSync object */
|
||||
typedef void* CLeglSyncKHR;
|
||||
|
||||
/* properties passed to clCreateFromEGLImageKHR */
|
||||
typedef intptr_t cl_egl_image_properties_khr;
|
||||
|
||||
|
||||
#define cl_khr_egl_image 1
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromEGLImageKHR(cl_context /* context */,
|
||||
CLeglDisplayKHR /* egldisplay */,
|
||||
CLeglImageKHR /* eglimage */,
|
||||
cl_mem_flags /* flags */,
|
||||
const cl_egl_image_properties_khr * /* properties */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
|
||||
cl_context context,
|
||||
CLeglDisplayKHR egldisplay,
|
||||
CLeglImageKHR eglimage,
|
||||
cl_mem_flags flags,
|
||||
const cl_egl_image_properties_khr * properties,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireEGLObjectsKHR(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event);
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseEGLObjectsKHR(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event);
|
||||
|
||||
|
||||
#define cl_khr_egl_event 1
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromEGLSyncKHR(cl_context /* context */,
|
||||
CLeglSyncKHR /* sync */,
|
||||
CLeglDisplayKHR /* display */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
|
||||
cl_context context,
|
||||
CLeglSyncKHR sync,
|
||||
CLeglDisplayKHR display,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_EGL_H */
|
||||
@@ -0,0 +1,729 @@
|
||||
/* Modifications Copyright (C) 2010-2021 Advanced Micro Devices, Inc. */
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
|
||||
|
||||
/* cl_ext.h contains OpenCL extensions which don't have external */
|
||||
/* (OpenGL, D3D) dependencies. */
|
||||
|
||||
#ifndef __CL_EXT_H
|
||||
#define __CL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
/* cl_khr_fp16 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
|
||||
|
||||
/* Memory object destruction
|
||||
*
|
||||
* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
|
||||
*
|
||||
* Registers a user callback function that will be called when the memory object is deleted and its resources
|
||||
* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
|
||||
* stack associated with memobj. The registered user callback functions are called in the reverse order in
|
||||
* which they were registered. The user callback functions are called and then the memory object is deleted
|
||||
* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
|
||||
* notified when the memory referenced by host_ptr, specified when the memory object is created and used as
|
||||
* the storage bits for the memory object, can be reused or freed.
|
||||
*
|
||||
* The application may not call CL api's with the cl_mem object passed to the pfn_notify.
|
||||
*
|
||||
* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*/
|
||||
#define cl_APPLE_SetMemObjectDestructor 1
|
||||
cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
|
||||
void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Context Logging Functions
|
||||
*
|
||||
* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
|
||||
* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*
|
||||
* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
|
||||
*/
|
||||
#define cl_APPLE_ContextLoggingFunctions 1
|
||||
extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
|
||||
extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
|
||||
extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/************************
|
||||
* cl_khr_icd extension *
|
||||
************************/
|
||||
#define cl_khr_icd 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_PLATFORM_NOT_FOUND_KHR -1001
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
|
||||
cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
|
||||
/* Extension: cl_khr_image2D_buffer
|
||||
*
|
||||
* This extension allows a 2D image to be created from a cl_mem buffer without a copy.
|
||||
* The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
|
||||
* Both the sampler and sampler-less read_image built-in functions are supported for 2D images
|
||||
* and 2D images created from a buffer. Similarly, the write_image built-ins are also supported
|
||||
* for 2D images created from a buffer.
|
||||
*
|
||||
* When the 2D image from buffer is created, the client must specify the width,
|
||||
* height, image format (i.e. channel order and channel data type) and optionally the row pitch
|
||||
*
|
||||
* The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
|
||||
* The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
* cl_khr_initalize_memory extension *
|
||||
*************************************/
|
||||
|
||||
#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030
|
||||
|
||||
|
||||
/**************************************
|
||||
* cl_khr_terminate_context extension *
|
||||
**************************************/
|
||||
|
||||
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031
|
||||
#define CL_CONTEXT_TERMINATE_KHR 0x2032
|
||||
|
||||
#define cl_khr_terminate_context 1
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
/*
|
||||
* Extension: cl_khr_spir
|
||||
*
|
||||
* This extension adds support to create an OpenCL program object from a
|
||||
* Standard Portable Intermediate Representation (SPIR) instance
|
||||
*/
|
||||
|
||||
#define CL_DEVICE_SPIR_VERSIONS 0x40E0
|
||||
#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
|
||||
|
||||
#ifdef CL_VERSION_2_0
|
||||
/*********************************
|
||||
* cl_khr_il_program extension
|
||||
*********************************/
|
||||
#define cl_khr_il_program 1
|
||||
|
||||
extern CL_API_ENTRY cl_program CL_API_CALL
|
||||
clCreateProgramWithILKHR(cl_context /* context */,
|
||||
const void * /* strings */,
|
||||
size_t /* lengths */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_program
|
||||
( CL_API_CALL * clCreateProgramWithILKHR_fn)(cl_context /* context */,
|
||||
const void * /* strings */,
|
||||
size_t /* lengths */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
|
||||
#endif /* CL_VERSION_2_0 */
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_memory_flags *
|
||||
*********************************/
|
||||
#define cl_amd_device_memory_flags 1
|
||||
#define CL_MEM_USE_PERSISTENT_MEM_AMD (1 << 6) // Alloc from GPU's CPU visible heap
|
||||
|
||||
/* cl_device_info */
|
||||
#define CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT 0x4032
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
#define CL_DEVICE_TOPOLOGY_AMD 0x4037
|
||||
#define CL_DEVICE_BOARD_NAME_AMD 0x4038
|
||||
#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
|
||||
#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
|
||||
#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
|
||||
#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
|
||||
#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
|
||||
#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
|
||||
#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
|
||||
#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
|
||||
#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
|
||||
#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
|
||||
#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
|
||||
#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030
|
||||
#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031
|
||||
#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033
|
||||
#define CL_DEVICE_PCIE_ID_AMD 0x4034
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct { cl_uint type; cl_uint data[5]; } raw;
|
||||
struct { cl_uint type; cl_uchar unused[17]; cl_uchar bus; cl_uchar device; cl_uchar function; } pcie;
|
||||
} cl_device_topology_amd;
|
||||
|
||||
#define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1
|
||||
|
||||
/**************************
|
||||
* cl_amd_offline_devices *
|
||||
**************************/
|
||||
#define CL_CONTEXT_OFFLINE_DEVICES_AMD 0x403F
|
||||
|
||||
/********************************
|
||||
* cl_amd_bus_addressable_memory *
|
||||
********************************/
|
||||
|
||||
/* cl_mem flag - bitfield */
|
||||
#define CL_MEM_BUS_ADDRESSABLE_AMD (1<<30)
|
||||
#define CL_MEM_EXTERNAL_PHYSICAL_AMD (1<<31)
|
||||
|
||||
#define CL_COMMAND_WAIT_SIGNAL_AMD 0x4080
|
||||
#define CL_COMMAND_WRITE_SIGNAL_AMD 0x4081
|
||||
#define CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD 0x4082
|
||||
|
||||
typedef struct _cl_bus_address_amd
|
||||
{
|
||||
cl_ulong surface_bus_address;
|
||||
cl_ulong marker_bus_address;
|
||||
} cl_bus_address_amd;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWaitSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_wait_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWriteSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_ulong /*offset*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueMakeBuffersResidentAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_uint /*num_mem_objs*/,
|
||||
cl_mem * /*mem_objects*/,
|
||||
cl_bool /*blocking_make_resident*/,
|
||||
cl_bus_address_amd * /*bus_addresses*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/*************************
|
||||
* cl_amd_copy_buffer_p2p *
|
||||
**************************/
|
||||
#define CL_DEVICE_NUM_P2P_DEVICES_AMD 0x4088
|
||||
#define CL_DEVICE_P2P_DEVICES_AMD 0x4089
|
||||
|
||||
#define cl_amd_copy_buffer_p2p 1
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueCopyBufferP2PAMD_fn)(cl_command_queue /*command_queue*/,
|
||||
cl_mem /*src_buffer*/,
|
||||
cl_mem /*dst_buffer*/,
|
||||
size_t /*src_offset*/,
|
||||
size_t /*dst_offset*/,
|
||||
size_t /*cb*/,
|
||||
cl_uint /*num_events_in_wait_list*/,
|
||||
const cl_event* /*event_wait_list*/,
|
||||
cl_event* /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/***********************************
|
||||
* cl_amd_assembly_program extension *
|
||||
***********************************/
|
||||
#define cl_amd_assembly_program 1
|
||||
|
||||
typedef CL_API_ENTRY cl_program (CL_API_CALL * clCreateProgramWithAssemblyAMD_fn) (
|
||||
cl_context /* context */,
|
||||
cl_uint /* count */,
|
||||
const char** /* strings */,
|
||||
const size_t* /* lengths */,
|
||||
cl_int* /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef CL_VERSION_2_0
|
||||
/********************************
|
||||
* cl_amd_planar_yuv *
|
||||
********************************/
|
||||
|
||||
/* cl_mem flag - bitfield */
|
||||
#define CL_YUV_IMAGE_Y_PLANE_AMD 0x0
|
||||
#define CL_YUV_IMAGE_UV_PLANE_AMD 0x1
|
||||
|
||||
typedef CL_API_ENTRY cl_mem
|
||||
(CL_API_CALL * clGetPlaneFromImageAMD_fn)(cl_context /*context*/,
|
||||
cl_mem /*mem*/,
|
||||
cl_uint /*plane*/,
|
||||
cl_int * /*errcode_ret*/) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
#endif
|
||||
|
||||
// <amd_internal>
|
||||
/**************************
|
||||
* cl_amd_command_queue_info *
|
||||
**************************/
|
||||
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
|
||||
|
||||
/* cl_kernel_exec_info for DVR DOPP texture support */
|
||||
#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120
|
||||
#define CL_KERNEL_EXEC_INFO_PFPA_VCOP_AMD 0x4121
|
||||
// </amd_internal>
|
||||
|
||||
/*********************************
|
||||
* cl_arm_printf extension
|
||||
*********************************/
|
||||
#define CL_PRINTF_CALLBACK_ARM 0x40B0
|
||||
#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
|
||||
|
||||
#ifdef CL_VERSION_1_1
|
||||
/***********************************
|
||||
* cl_ext_device_fission extension *
|
||||
***********************************/
|
||||
#define cl_ext_device_fission 1
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_ulong cl_device_partition_property_ext;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateSubDevicesEXT( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* cl_device_partition_property_ext */
|
||||
#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
|
||||
#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
|
||||
#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
|
||||
#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
|
||||
|
||||
/* clDeviceGetInfo selectors */
|
||||
#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
|
||||
#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
|
||||
#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
|
||||
#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
|
||||
#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
|
||||
|
||||
/* clGetImageInfo enum */
|
||||
#define CL_IMAGE_BYTE_PITCH_AMD 0x4059
|
||||
|
||||
/* error codes */
|
||||
#define CL_DEVICE_PARTITION_FAILED_EXT -1057
|
||||
#define CL_INVALID_PARTITION_COUNT_EXT -1058
|
||||
#define CL_INVALID_PARTITION_NAME_EXT -1059
|
||||
|
||||
/* CL_AFFINITY_DOMAINs */
|
||||
#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
|
||||
#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
|
||||
#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
|
||||
#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
|
||||
#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
|
||||
#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
|
||||
|
||||
/* cl_device_partition_property_ext list terminators */
|
||||
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ext_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
|
||||
|
||||
#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
|
||||
#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
|
||||
#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
|
||||
#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
|
||||
#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
|
||||
#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
|
||||
#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
|
||||
#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
|
||||
|
||||
typedef cl_uint cl_image_pitch_info_qcom;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceImageInfoQCOM(cl_device_id device,
|
||||
size_t image_width,
|
||||
size_t image_height,
|
||||
const cl_image_format *image_format,
|
||||
cl_image_pitch_info_qcom param_name,
|
||||
size_t param_value_size,
|
||||
void *param_value,
|
||||
size_t *param_value_size_ret);
|
||||
|
||||
typedef struct _cl_mem_ext_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Legal values will be defined in layered extensions. */
|
||||
cl_uint allocation_type;
|
||||
|
||||
/* Host cache policy for this external memory allocation. */
|
||||
cl_uint host_cache_policy;
|
||||
|
||||
} cl_mem_ext_host_ptr;
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ion_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
|
||||
|
||||
typedef struct _cl_mem_ion_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
|
||||
cl_mem_ext_host_ptr ext_host_ptr;
|
||||
|
||||
/* ION file descriptor */
|
||||
int ion_filedesc;
|
||||
|
||||
/* Host pointer to the ION allocated memory */
|
||||
void* ion_hostptr;
|
||||
|
||||
} cl_mem_ion_host_ptr;
|
||||
|
||||
#endif /* CL_VERSION_1_1 */
|
||||
|
||||
#if defined(CL_VERSION_1_2)
|
||||
|
||||
/******************************************
|
||||
* cl_img_yuv_image extension *
|
||||
******************************************/
|
||||
|
||||
/* Image formats used in clCreateImage */
|
||||
#define CL_NV21_IMG 0x40D0
|
||||
#define CL_YV12_IMG 0x40D1
|
||||
|
||||
/******************************************
|
||||
* cl_img_cached_allocations extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
|
||||
#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
|
||||
|
||||
/******************************************
|
||||
* cl_img_use_gralloc_ptr extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
|
||||
#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
|
||||
|
||||
/* Error code from clEnqueueReleaseGrallocObjectsIMG */
|
||||
#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
#ifdef CL_VERSION_2_0
|
||||
/*********************************
|
||||
* cl_khr_subgroups extension
|
||||
*********************************/
|
||||
#define cl_khr_subgroups 1
|
||||
|
||||
typedef cl_uint cl_kernel_sub_group_info;
|
||||
|
||||
/* cl_kernel_sub_group_info */
|
||||
#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033
|
||||
#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */,
|
||||
cl_device_id /*in_device*/,
|
||||
cl_kernel_sub_group_info /* param_name */,
|
||||
size_t /*input_value_size*/,
|
||||
const void * /*input_value*/,
|
||||
size_t /*param_value_size*/,
|
||||
void* /*param_value*/,
|
||||
size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */,
|
||||
cl_device_id /*in_device*/,
|
||||
cl_kernel_sub_group_info /* param_name */,
|
||||
size_t /*input_value_size*/,
|
||||
const void * /*input_value*/,
|
||||
size_t /*param_value_size*/,
|
||||
void* /*param_value*/,
|
||||
size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
#endif /* CL_VERSION_2_0 */
|
||||
|
||||
|
||||
/******************************************
|
||||
* cl_arm_shared_virtual_memory extension *
|
||||
******************************************/
|
||||
|
||||
#ifdef CL_VERSION_1_2
|
||||
|
||||
/* Used by clGetDeviceInfo */
|
||||
#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
|
||||
|
||||
/* Used by clGetMemObjectInfo */
|
||||
#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
|
||||
|
||||
/* Used by clSetKernelExecInfoARM: */
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_SVM_FREE_ARM 0x40BA
|
||||
#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
|
||||
#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
|
||||
#define CL_COMMAND_SVM_MAP_ARM 0x40BD
|
||||
#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
|
||||
|
||||
/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
|
||||
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
|
||||
#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
|
||||
|
||||
/* Flag values used by clSVMAllocARM: */
|
||||
#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
|
||||
#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
|
||||
|
||||
typedef cl_bitfield cl_svm_mem_flags_arm;
|
||||
typedef cl_uint cl_kernel_exec_info_arm;
|
||||
typedef cl_bitfield cl_device_svm_capabilities_arm;
|
||||
|
||||
extern CL_API_ENTRY void * CL_API_CALL
|
||||
clSVMAllocARM(cl_context /* context */,
|
||||
cl_svm_mem_flags_arm /* flags */,
|
||||
size_t /* size */,
|
||||
cl_uint /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY void CL_API_CALL
|
||||
clSVMFreeARM(cl_context /* context */,
|
||||
void * /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMFreeARM(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void * /* user_data */),
|
||||
void * /* user_data */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemcpyARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_copy */,
|
||||
void * /* dst_ptr */,
|
||||
const void * /* src_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemFillARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
const void * /* pattern */,
|
||||
size_t /* pattern_size */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMapARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_map */,
|
||||
cl_map_flags /* flags */,
|
||||
void * /* svm_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMUnmapARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelArgSVMPointerARM(cl_kernel /* kernel */,
|
||||
cl_uint /* arg_index */,
|
||||
const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelExecInfoARM(cl_kernel /* kernel */,
|
||||
cl_kernel_exec_info_arm /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
const void * /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
/**********************************
|
||||
* cl_arm_import_memory extension *
|
||||
**********************************/
|
||||
|
||||
#ifdef CL_VERSION_1_0
|
||||
|
||||
typedef intptr_t cl_import_properties_arm;
|
||||
|
||||
/* Default and valid proporties name for cl_arm_import_memory */
|
||||
#define CL_IMPORT_TYPE_ARM 0x40B2
|
||||
|
||||
/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
|
||||
|
||||
/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
|
||||
|
||||
/* Secure DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_SECURE_ARM 0x40B5
|
||||
|
||||
/* This extension adds a new function that allows for direct memory import into
|
||||
* OpenCL via the clImportMemoryARM function.
|
||||
*
|
||||
* Memory imported through this interface will be mapped into the device's page
|
||||
* tables directly, providing zero copy access. It will never fall back to copy
|
||||
* operations and aliased buffers.
|
||||
*
|
||||
* Types of memory supported for import are specified as additional extension
|
||||
* strings.
|
||||
*
|
||||
* This extension produces cl_mem allocations which are compatible with all other
|
||||
* users of cl_mem in the standard API.
|
||||
*
|
||||
* This extension maps pages with the same properties as the normal buffer creation
|
||||
* function clCreateBuffer.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clImportMemoryARM( cl_context context,
|
||||
cl_mem_flags flags,
|
||||
const cl_import_properties_arm *properties,
|
||||
void *memory,
|
||||
size_t size,
|
||||
cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
#endif /* CL_VERSION_1_0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __CL_EXT_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_GL_H
|
||||
#define __OPENCL_CL_GL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef struct __GLsync *cl_GLsync;
|
||||
|
||||
/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
|
||||
#define CL_GL_OBJECT_BUFFER 0x2000
|
||||
#define CL_GL_OBJECT_TEXTURE2D 0x2001
|
||||
#define CL_GL_OBJECT_TEXTURE3D 0x2002
|
||||
#define CL_GL_OBJECT_RENDERBUFFER 0x2003
|
||||
#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
|
||||
#define CL_GL_OBJECT_TEXTURE1D 0x200F
|
||||
#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
|
||||
#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
|
||||
|
||||
/* cl_gl_texture_info */
|
||||
#define CL_GL_TEXTURE_TARGET 0x2004
|
||||
#define CL_GL_MIPMAP_LEVEL 0x2005
|
||||
#define CL_GL_NUM_SAMPLES 0x2012
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* bufobj */,
|
||||
int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLRenderbuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* renderbuffer */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLObjectInfo(cl_mem /* memobj */,
|
||||
cl_gl_object_type * /* gl_object_type */,
|
||||
cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLTextureInfo(cl_mem /* memobj */,
|
||||
cl_gl_texture_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Deprecated OpenCL 1.1 APIs */
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
/* cl_khr_gl_sharing extension */
|
||||
|
||||
#define cl_khr_gl_sharing 1
|
||||
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
|
||||
|
||||
/* cl_gl_context_info */
|
||||
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
|
||||
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
|
||||
|
||||
/* Additional cl_context_properties */
|
||||
#define CL_GL_CONTEXT_KHR 0x2008
|
||||
#define CL_EGL_DISPLAY_KHR 0x2009
|
||||
#define CL_GLX_DISPLAY_KHR 0x200A
|
||||
#define CL_WGL_HDC_KHR 0x200B
|
||||
#define CL_CGL_SHAREGROUP_KHR 0x200C
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
|
||||
cl_gl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
|
||||
const cl_context_properties * properties,
|
||||
cl_gl_context_info param_name,
|
||||
size_t param_value_size,
|
||||
void * param_value,
|
||||
size_t * param_value_size_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_H */
|
||||
@@ -0,0 +1,74 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
|
||||
/* OpenGL dependencies. */
|
||||
|
||||
#ifndef __OPENCL_CL_GL_EXT_H
|
||||
#define __OPENCL_CL_GL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#else
|
||||
#include <CL/cl_gl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For each extension, follow this template
|
||||
* cl_VEN_extname extension */
|
||||
/* #define cl_VEN_extname 1
|
||||
* ... define new types, if any
|
||||
* ... define new tokens, if any
|
||||
* ... define new APIs, if any
|
||||
*
|
||||
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
|
||||
* This allows us to avoid having to decide whether to include GL headers or GLES here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
* See section 9.9 in the OpenCL 1.1 spec for more information
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromGLsyncKHR(cl_context /* context */,
|
||||
cl_GLsync /* cl_GLsync */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_EXT_H */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_H
|
||||
#define __OPENCL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#include <OpenCL/cl_gl_ext.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_gl.h>
|
||||
#include <CL/cl_gl_ext.h>
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_H */
|
||||
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D10_H
|
||||
#define __OPENCL_CL_D3D10_H
|
||||
|
||||
#include <d3d10.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d10_sharing */
|
||||
#define cl_khr_d3d10_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d10_device_source_khr;
|
||||
typedef cl_uint cl_d3d10_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D10_DEVICE_KHR -1002
|
||||
#define CL_INVALID_D3D10_RESOURCE_KHR -1003
|
||||
#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
|
||||
#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
|
||||
|
||||
/* cl_d3d10_device_source_nv */
|
||||
#define CL_D3D10_DEVICE_KHR 0x4010
|
||||
#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
|
||||
|
||||
/* cl_d3d10_device_set_nv */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
|
||||
#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
|
||||
#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
|
||||
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d10_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d10_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D10_H */
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D11_H
|
||||
#define __OPENCL_CL_D3D11_H
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d11_sharing */
|
||||
#define cl_khr_d3d11_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d11_device_source_khr;
|
||||
typedef cl_uint cl_d3d11_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_D3D11_DEVICE_KHR -1006
|
||||
#define CL_INVALID_D3D11_RESOURCE_KHR -1007
|
||||
#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
|
||||
#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
|
||||
|
||||
/* cl_d3d11_device_source */
|
||||
#define CL_D3D11_DEVICE_KHR 0x4019
|
||||
#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
|
||||
|
||||
/* cl_d3d11_device_set */
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
|
||||
#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
|
||||
#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
|
||||
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d11_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d11_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_D3D11_H */
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
#define __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* cl_khr_dx9_media_sharing */
|
||||
#define cl_khr_dx9_media_sharing 1
|
||||
|
||||
typedef cl_uint cl_dx9_media_adapter_type_khr;
|
||||
typedef cl_uint cl_dx9_media_adapter_set_khr;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <d3d9.h>
|
||||
typedef struct _cl_dx9_surface_info_khr
|
||||
{
|
||||
IDirect3DSurface9 *resource;
|
||||
HANDLE shared_handle;
|
||||
} cl_dx9_surface_info_khr;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
|
||||
#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
|
||||
#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
|
||||
#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
|
||||
|
||||
/* cl_media_adapter_type_khr */
|
||||
#define CL_ADAPTER_D3D9_KHR 0x2020
|
||||
#define CL_ADAPTER_D3D9EX_KHR 0x2021
|
||||
#define CL_ADAPTER_DXVA_KHR 0x2022
|
||||
|
||||
/* cl_media_adapter_set_khr */
|
||||
#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
|
||||
#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
|
||||
#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
|
||||
#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
|
||||
#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
|
||||
#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_uint num_media_adapters,
|
||||
cl_dx9_media_adapter_type_khr * media_adapter_type,
|
||||
void * media_adapters,
|
||||
cl_dx9_media_adapter_set_khr media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
void * surface_info,
|
||||
cl_uint plane,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_EGL_H
|
||||
#define __OPENCL_CL_EGL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
|
||||
#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F
|
||||
#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D
|
||||
#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E
|
||||
|
||||
/* Error type for clCreateFromEGLImageKHR */
|
||||
#define CL_INVALID_EGL_OBJECT_KHR -1093
|
||||
#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092
|
||||
|
||||
/* CLeglImageKHR is an opaque handle to an EGLImage */
|
||||
typedef void* CLeglImageKHR;
|
||||
|
||||
/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
|
||||
typedef void* CLeglDisplayKHR;
|
||||
|
||||
/* CLeglSyncKHR is an opaque handle to an EGLSync object */
|
||||
typedef void* CLeglSyncKHR;
|
||||
|
||||
/* properties passed to clCreateFromEGLImageKHR */
|
||||
typedef intptr_t cl_egl_image_properties_khr;
|
||||
|
||||
|
||||
#define cl_khr_egl_image 1
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromEGLImageKHR(cl_context /* context */,
|
||||
CLeglDisplayKHR /* egldisplay */,
|
||||
CLeglImageKHR /* eglimage */,
|
||||
cl_mem_flags /* flags */,
|
||||
const cl_egl_image_properties_khr * /* properties */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
|
||||
cl_context context,
|
||||
CLeglDisplayKHR egldisplay,
|
||||
CLeglImageKHR eglimage,
|
||||
cl_mem_flags flags,
|
||||
const cl_egl_image_properties_khr * properties,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireEGLObjectsKHR(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event);
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseEGLObjectsKHR(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event);
|
||||
|
||||
|
||||
#define cl_khr_egl_event 1
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromEGLSyncKHR(cl_context /* context */,
|
||||
CLeglSyncKHR /* sync */,
|
||||
CLeglDisplayKHR /* display */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
|
||||
cl_context context,
|
||||
CLeglSyncKHR sync,
|
||||
CLeglDisplayKHR display,
|
||||
cl_int * errcode_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_EGL_H */
|
||||
@@ -0,0 +1,745 @@
|
||||
/* Modifications Copyright (C) 2010-2021 Advanced Micro Devices, Inc. */
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
|
||||
|
||||
/* cl_ext.h contains OpenCL extensions which don't have external */
|
||||
/* (OpenGL, D3D) dependencies. */
|
||||
|
||||
#ifndef __CL_EXT_H
|
||||
#define __CL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
/* cl_khr_fp16 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
|
||||
|
||||
/* Memory object destruction
|
||||
*
|
||||
* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
|
||||
*
|
||||
* Registers a user callback function that will be called when the memory object is deleted and its resources
|
||||
* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
|
||||
* stack associated with memobj. The registered user callback functions are called in the reverse order in
|
||||
* which they were registered. The user callback functions are called and then the memory object is deleted
|
||||
* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
|
||||
* notified when the memory referenced by host_ptr, specified when the memory object is created and used as
|
||||
* the storage bits for the memory object, can be reused or freed.
|
||||
*
|
||||
* The application may not call CL api's with the cl_mem object passed to the pfn_notify.
|
||||
*
|
||||
* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*/
|
||||
#define cl_APPLE_SetMemObjectDestructor 1
|
||||
cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
|
||||
void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Context Logging Functions
|
||||
*
|
||||
* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
|
||||
* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*
|
||||
* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
|
||||
*/
|
||||
#define cl_APPLE_ContextLoggingFunctions 1
|
||||
extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
|
||||
extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
|
||||
extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/************************
|
||||
* cl_khr_icd extension *
|
||||
************************/
|
||||
#define cl_khr_icd 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_PLATFORM_NOT_FOUND_KHR -1001
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
|
||||
cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
|
||||
/* Extension: cl_khr_image2D_buffer
|
||||
*
|
||||
* This extension allows a 2D image to be created from a cl_mem buffer without a copy.
|
||||
* The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
|
||||
* Both the sampler and sampler-less read_image built-in functions are supported for 2D images
|
||||
* and 2D images created from a buffer. Similarly, the write_image built-ins are also supported
|
||||
* for 2D images created from a buffer.
|
||||
*
|
||||
* When the 2D image from buffer is created, the client must specify the width,
|
||||
* height, image format (i.e. channel order and channel data type) and optionally the row pitch
|
||||
*
|
||||
* The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
|
||||
* The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
* cl_khr_initalize_memory extension *
|
||||
*************************************/
|
||||
|
||||
#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030
|
||||
|
||||
|
||||
/**************************************
|
||||
* cl_khr_terminate_context extension *
|
||||
**************************************/
|
||||
|
||||
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031
|
||||
#define CL_CONTEXT_TERMINATE_KHR 0x2032
|
||||
|
||||
#define cl_khr_terminate_context 1
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
/*
|
||||
* Extension: cl_khr_spir
|
||||
*
|
||||
* This extension adds support to create an OpenCL program object from a
|
||||
* Standard Portable Intermediate Representation (SPIR) instance
|
||||
*/
|
||||
|
||||
#define CL_DEVICE_SPIR_VERSIONS 0x40E0
|
||||
#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
|
||||
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_memory_flags *
|
||||
*********************************/
|
||||
#define cl_amd_device_memory_flags 1
|
||||
#define CL_MEM_USE_PERSISTENT_MEM_AMD (1 << 6) // Alloc from GPU's CPU visible heap
|
||||
|
||||
/* cl_device_info */
|
||||
#define CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT 0x4032
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
#define CL_DEVICE_TOPOLOGY_AMD 0x4037
|
||||
#define CL_DEVICE_BOARD_NAME_AMD 0x4038
|
||||
#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
|
||||
#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
|
||||
#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
|
||||
#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
|
||||
#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
|
||||
#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
|
||||
#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
|
||||
#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
|
||||
#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
|
||||
#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
|
||||
#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
|
||||
#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
|
||||
#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030
|
||||
#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031
|
||||
#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033
|
||||
#define CL_DEVICE_PCIE_ID_AMD 0x4034
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct { cl_uint type; cl_uint data[5]; } raw;
|
||||
struct { cl_uint type; cl_uchar unused[17]; cl_uchar bus; cl_uchar device; cl_uchar function; } pcie;
|
||||
} cl_device_topology_amd;
|
||||
|
||||
#define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1
|
||||
|
||||
/**************************
|
||||
* cl_amd_offline_devices *
|
||||
**************************/
|
||||
#define CL_CONTEXT_OFFLINE_DEVICES_AMD 0x403F
|
||||
|
||||
/********************************
|
||||
* cl_amd_bus_addressable_memory *
|
||||
********************************/
|
||||
|
||||
/* cl_mem flag - bitfield */
|
||||
#define CL_MEM_BUS_ADDRESSABLE_AMD (1<<30)
|
||||
#define CL_MEM_EXTERNAL_PHYSICAL_AMD (1<<31)
|
||||
|
||||
#define CL_COMMAND_WAIT_SIGNAL_AMD 0x4080
|
||||
#define CL_COMMAND_WRITE_SIGNAL_AMD 0x4081
|
||||
#define CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD 0x4082
|
||||
|
||||
typedef struct _cl_bus_address_amd
|
||||
{
|
||||
cl_ulong surface_bus_address;
|
||||
cl_ulong marker_bus_address;
|
||||
} cl_bus_address_amd;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWaitSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_wait_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueWriteSignalAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_mem /*mem_object*/,
|
||||
cl_uint /*value*/,
|
||||
cl_ulong /*offset*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueMakeBuffersResidentAMD_fn)( cl_command_queue /*command_queue*/,
|
||||
cl_uint /*num_mem_objs*/,
|
||||
cl_mem * /*mem_objects*/,
|
||||
cl_bool /*blocking_make_resident*/,
|
||||
cl_bus_address_amd * /*bus_addresses*/,
|
||||
cl_uint /*num_events*/,
|
||||
const cl_event * /*event_list*/,
|
||||
cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/*************************
|
||||
* cl_amd_copy_buffer_p2p *
|
||||
**************************/
|
||||
#define CL_DEVICE_NUM_P2P_DEVICES_AMD 0x4088
|
||||
#define CL_DEVICE_P2P_DEVICES_AMD 0x4089
|
||||
|
||||
#define cl_amd_copy_buffer_p2p 1
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL * clEnqueueCopyBufferP2PAMD_fn)(cl_command_queue /*command_queue*/,
|
||||
cl_mem /*src_buffer*/,
|
||||
cl_mem /*dst_buffer*/,
|
||||
size_t /*src_offset*/,
|
||||
size_t /*dst_offset*/,
|
||||
size_t /*cb*/,
|
||||
cl_uint /*num_events_in_wait_list*/,
|
||||
const cl_event* /*event_wait_list*/,
|
||||
cl_event* /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
/***********************************
|
||||
* cl_amd_assembly_program extension *
|
||||
***********************************/
|
||||
#define cl_amd_assembly_program 1
|
||||
|
||||
typedef CL_API_ENTRY cl_program (CL_API_CALL * clCreateProgramWithAssemblyAMD_fn) (
|
||||
cl_context /* context */,
|
||||
cl_uint /* count */,
|
||||
const char** /* strings */,
|
||||
const size_t* /* lengths */,
|
||||
cl_int* /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef CL_VERSION_2_0
|
||||
/********************************
|
||||
* cl_amd_planar_yuv *
|
||||
********************************/
|
||||
|
||||
/* cl_mem flag - bitfield */
|
||||
#define CL_YUV_IMAGE_Y_PLANE_AMD 0x0
|
||||
#define CL_YUV_IMAGE_UV_PLANE_AMD 0x1
|
||||
|
||||
typedef CL_API_ENTRY cl_mem
|
||||
(CL_API_CALL * clGetPlaneFromImageAMD_fn)(cl_context /*context*/,
|
||||
cl_mem /*mem*/,
|
||||
cl_uint /*plane*/,
|
||||
cl_int * /*errcode_ret*/) CL_EXT_SUFFIX__VERSION_2_0;
|
||||
#endif
|
||||
|
||||
// <amd_internal>
|
||||
/**************************
|
||||
* cl_amd_command_queue_info *
|
||||
**************************/
|
||||
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
|
||||
|
||||
/* cl_kernel_exec_info for DVR DOPP texture support */
|
||||
#define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD 0x4120
|
||||
#define CL_KERNEL_EXEC_INFO_PFPA_VCOP_AMD 0x4121
|
||||
// </amd_internal>
|
||||
|
||||
/*********************************
|
||||
* cl_arm_printf extension
|
||||
*********************************/
|
||||
#define CL_PRINTF_CALLBACK_ARM 0x40B0
|
||||
#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
|
||||
|
||||
#ifdef CL_VERSION_1_1
|
||||
/***********************************
|
||||
* cl_ext_device_fission extension *
|
||||
***********************************/
|
||||
#define cl_ext_device_fission 1
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_ulong cl_device_partition_property_ext;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateSubDevicesEXT( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* cl_device_partition_property_ext */
|
||||
#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
|
||||
#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
|
||||
#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
|
||||
#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
|
||||
|
||||
/* clDeviceGetInfo selectors */
|
||||
#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
|
||||
#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
|
||||
#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
|
||||
#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
|
||||
#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
|
||||
|
||||
/* clGetImageInfo enum */
|
||||
#define CL_IMAGE_BYTE_PITCH_AMD 0x4059
|
||||
|
||||
/* error codes */
|
||||
#define CL_DEVICE_PARTITION_FAILED_EXT -1057
|
||||
#define CL_INVALID_PARTITION_COUNT_EXT -1058
|
||||
#define CL_INVALID_PARTITION_NAME_EXT -1059
|
||||
|
||||
/* CL_AFFINITY_DOMAINs */
|
||||
#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
|
||||
#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
|
||||
#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
|
||||
#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
|
||||
#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
|
||||
#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
|
||||
|
||||
/* cl_device_partition_property_ext list terminators */
|
||||
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ext_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
|
||||
|
||||
#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
|
||||
#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
|
||||
#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
|
||||
#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
|
||||
#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
|
||||
#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
|
||||
#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
|
||||
#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
|
||||
|
||||
typedef cl_uint cl_image_pitch_info_qcom;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceImageInfoQCOM(cl_device_id device,
|
||||
size_t image_width,
|
||||
size_t image_height,
|
||||
const cl_image_format *image_format,
|
||||
cl_image_pitch_info_qcom param_name,
|
||||
size_t param_value_size,
|
||||
void *param_value,
|
||||
size_t *param_value_size_ret);
|
||||
|
||||
typedef struct _cl_mem_ext_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Legal values will be defined in layered extensions. */
|
||||
cl_uint allocation_type;
|
||||
|
||||
/* Host cache policy for this external memory allocation. */
|
||||
cl_uint host_cache_policy;
|
||||
|
||||
} cl_mem_ext_host_ptr;
|
||||
|
||||
/*********************************
|
||||
* cl_qcom_ion_host_ptr extension
|
||||
*********************************/
|
||||
|
||||
#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
|
||||
|
||||
typedef struct _cl_mem_ion_host_ptr
|
||||
{
|
||||
/* Type of external memory allocation. */
|
||||
/* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
|
||||
cl_mem_ext_host_ptr ext_host_ptr;
|
||||
|
||||
/* ION file descriptor */
|
||||
int ion_filedesc;
|
||||
|
||||
/* Host pointer to the ION allocated memory */
|
||||
void* ion_hostptr;
|
||||
|
||||
} cl_mem_ion_host_ptr;
|
||||
|
||||
#endif /* CL_VERSION_1_1 */
|
||||
|
||||
#if defined(CL_VERSION_1_2)
|
||||
|
||||
/******************************************
|
||||
* cl_img_yuv_image extension *
|
||||
******************************************/
|
||||
|
||||
/* Image formats used in clCreateImage */
|
||||
#define CL_NV21_IMG 0x40D0
|
||||
#define CL_YV12_IMG 0x40D1
|
||||
|
||||
/******************************************
|
||||
* cl_img_cached_allocations extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
|
||||
#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
|
||||
|
||||
/******************************************
|
||||
* cl_img_use_gralloc_ptr extension *
|
||||
******************************************/
|
||||
|
||||
/* Flag values used by clCreteBuffer */
|
||||
#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
|
||||
#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
|
||||
|
||||
/* Error code from clEnqueueReleaseGrallocObjectsIMG */
|
||||
#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGrallocObjectsIMG(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
#ifdef CL_VERSION_2_0
|
||||
/*********************************
|
||||
* cl_khr_subgroups extension
|
||||
*********************************/
|
||||
#define cl_khr_subgroups 1
|
||||
|
||||
/* cl_kernel_sub_group_info is declared in CL.h. */
|
||||
|
||||
/* cl_kernel_sub_group_info */
|
||||
#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033
|
||||
#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */,
|
||||
cl_device_id /*in_device*/,
|
||||
cl_kernel_sub_group_info /* param_name */,
|
||||
size_t /*input_value_size*/,
|
||||
const void * /*input_value*/,
|
||||
size_t /*param_value_size*/,
|
||||
void* /*param_value*/,
|
||||
size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */,
|
||||
cl_device_id /*in_device*/,
|
||||
cl_kernel_sub_group_info /* param_name */,
|
||||
size_t /*input_value_size*/,
|
||||
const void * /*input_value*/,
|
||||
size_t /*param_value_size*/,
|
||||
void* /*param_value*/,
|
||||
size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
|
||||
#endif /* CL_VERSION_2_0 */
|
||||
|
||||
#ifdef CL_VERSION_2_1
|
||||
/*********************************
|
||||
* cl_khr_priority_hints extension
|
||||
*********************************/
|
||||
#define cl_khr_priority_hints 1
|
||||
|
||||
typedef cl_uint cl_queue_priority_khr;
|
||||
|
||||
/* cl_command_queue_properties */
|
||||
#define CL_QUEUE_PRIORITY_KHR 0x1096
|
||||
|
||||
/* cl_queue_priority_khr */
|
||||
#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
|
||||
#define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
|
||||
#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
|
||||
|
||||
#endif /* CL_VERSION_2_1 */
|
||||
|
||||
#ifdef CL_VERSION_2_1
|
||||
/*********************************
|
||||
* cl_khr_throttle_hints extension
|
||||
*********************************/
|
||||
#define cl_khr_throttle_hints 1
|
||||
|
||||
typedef cl_uint cl_queue_throttle_khr;
|
||||
|
||||
/* cl_command_queue_properties */
|
||||
#define CL_QUEUE_THROTTLE_KHR 0x1097
|
||||
|
||||
/* cl_queue_throttle_khr */
|
||||
#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
|
||||
#define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
|
||||
#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
|
||||
|
||||
#endif /* CL_VERSION_2_1 */
|
||||
|
||||
/**********************************
|
||||
* cl_arm_import_memory extension *
|
||||
**********************************/
|
||||
|
||||
#ifdef CL_VERSION_1_0
|
||||
|
||||
typedef intptr_t cl_import_properties_arm;
|
||||
|
||||
/* Default and valid proporties name for cl_arm_import_memory */
|
||||
#define CL_IMPORT_TYPE_ARM 0x40B2
|
||||
|
||||
/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
|
||||
|
||||
/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
|
||||
|
||||
/* Secure DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
|
||||
#define CL_IMPORT_TYPE_SECURE_ARM 0x40B5
|
||||
|
||||
/* This extension adds a new function that allows for direct memory import into
|
||||
* OpenCL via the clImportMemoryARM function.
|
||||
*
|
||||
* Memory imported through this interface will be mapped into the device's page
|
||||
* tables directly, providing zero copy access. It will never fall back to copy
|
||||
* operations and aliased buffers.
|
||||
*
|
||||
* Types of memory supported for import are specified as additional extension
|
||||
* strings.
|
||||
*
|
||||
* This extension produces cl_mem allocations which are compatible with all other
|
||||
* users of cl_mem in the standard API.
|
||||
*
|
||||
* This extension maps pages with the same properties as the normal buffer creation
|
||||
* function clCreateBuffer.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clImportMemoryARM( cl_context context,
|
||||
cl_mem_flags flags,
|
||||
const cl_import_properties_arm *properties,
|
||||
void *memory,
|
||||
size_t size,
|
||||
cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
#endif /* CL_VERSION_1_0 */
|
||||
|
||||
/******************************************
|
||||
* cl_arm_shared_virtual_memory extension *
|
||||
******************************************/
|
||||
|
||||
#ifdef CL_VERSION_1_2
|
||||
|
||||
/* Used by clGetDeviceInfo */
|
||||
#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
|
||||
|
||||
/* Used by clGetMemObjectInfo */
|
||||
#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
|
||||
|
||||
/* Used by clSetKernelExecInfoARM: */
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
|
||||
#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
|
||||
|
||||
/* To be used by clGetEventInfo: */
|
||||
#define CL_COMMAND_SVM_FREE_ARM 0x40BA
|
||||
#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
|
||||
#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
|
||||
#define CL_COMMAND_SVM_MAP_ARM 0x40BD
|
||||
#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
|
||||
|
||||
/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
|
||||
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
|
||||
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
|
||||
#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
|
||||
|
||||
/* Flag values used by clSVMAllocARM: */
|
||||
#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
|
||||
#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
|
||||
|
||||
typedef cl_bitfield cl_svm_mem_flags_arm;
|
||||
typedef cl_uint cl_kernel_exec_info_arm;
|
||||
typedef cl_bitfield cl_device_svm_capabilities_arm;
|
||||
|
||||
extern CL_API_ENTRY void * CL_API_CALL
|
||||
clSVMAllocARM(cl_context /* context */,
|
||||
cl_svm_mem_flags_arm /* flags */,
|
||||
size_t /* size */,
|
||||
cl_uint /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY void CL_API_CALL
|
||||
clSVMFreeARM(cl_context /* context */,
|
||||
void * /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMFreeARM(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
|
||||
cl_uint /* num_svm_pointers */,
|
||||
void *[] /* svm_pointers[] */,
|
||||
void * /* user_data */),
|
||||
void * /* user_data */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemcpyARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_copy */,
|
||||
void * /* dst_ptr */,
|
||||
const void * /* src_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMemFillARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
const void * /* pattern */,
|
||||
size_t /* pattern_size */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMMapARM(cl_command_queue /* command_queue */,
|
||||
cl_bool /* blocking_map */,
|
||||
cl_map_flags /* flags */,
|
||||
void * /* svm_ptr */,
|
||||
size_t /* size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueSVMUnmapARM(cl_command_queue /* command_queue */,
|
||||
void * /* svm_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelArgSVMPointerARM(cl_kernel /* kernel */,
|
||||
cl_uint /* arg_index */,
|
||||
const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelExecInfoARM(cl_kernel /* kernel */,
|
||||
cl_kernel_exec_info_arm /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
const void * /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#endif /* CL_VERSION_1_2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __CL_EXT_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_GL_H
|
||||
#define __OPENCL_CL_GL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef struct __GLsync *cl_GLsync;
|
||||
|
||||
/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
|
||||
#define CL_GL_OBJECT_BUFFER 0x2000
|
||||
#define CL_GL_OBJECT_TEXTURE2D 0x2001
|
||||
#define CL_GL_OBJECT_TEXTURE3D 0x2002
|
||||
#define CL_GL_OBJECT_RENDERBUFFER 0x2003
|
||||
#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
|
||||
#define CL_GL_OBJECT_TEXTURE1D 0x200F
|
||||
#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
|
||||
#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
|
||||
|
||||
/* cl_gl_texture_info */
|
||||
#define CL_GL_TEXTURE_TARGET 0x2004
|
||||
#define CL_GL_MIPMAP_LEVEL 0x2005
|
||||
#define CL_GL_NUM_SAMPLES 0x2012
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* bufobj */,
|
||||
int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLRenderbuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* renderbuffer */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLObjectInfo(cl_mem /* memobj */,
|
||||
cl_gl_object_type * /* gl_object_type */,
|
||||
cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLTextureInfo(cl_mem /* memobj */,
|
||||
cl_gl_texture_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Deprecated OpenCL 1.1 APIs */
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
/* cl_khr_gl_sharing extension */
|
||||
|
||||
#define cl_khr_gl_sharing 1
|
||||
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
|
||||
|
||||
/* cl_gl_context_info */
|
||||
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
|
||||
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
|
||||
|
||||
/* Additional cl_context_properties */
|
||||
#define CL_GL_CONTEXT_KHR 0x2008
|
||||
#define CL_EGL_DISPLAY_KHR 0x2009
|
||||
#define CL_GLX_DISPLAY_KHR 0x200A
|
||||
#define CL_WGL_HDC_KHR 0x200B
|
||||
#define CL_CGL_SHAREGROUP_KHR 0x200C
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
|
||||
cl_gl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
|
||||
const cl_context_properties * properties,
|
||||
cl_gl_context_info param_name,
|
||||
size_t param_value_size,
|
||||
void * param_value,
|
||||
size_t * param_value_size_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_H */
|
||||
@@ -0,0 +1,74 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
|
||||
/* OpenGL dependencies. */
|
||||
|
||||
#ifndef __OPENCL_CL_GL_EXT_H
|
||||
#define __OPENCL_CL_GL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#else
|
||||
#include <CL/cl_gl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For each extension, follow this template
|
||||
* cl_VEN_extname extension */
|
||||
/* #define cl_VEN_extname 1
|
||||
* ... define new types, if any
|
||||
* ... define new tokens, if any
|
||||
* ... define new APIs, if any
|
||||
*
|
||||
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
|
||||
* This allows us to avoid having to decide whether to include GL headers or GLES here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
* See section 9.9 in the OpenCL 1.1 spec for more information
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromGLsyncKHR(cl_context /* context */,
|
||||
cl_GLsync /* cl_GLsync */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_EXT_H */
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
* https://www.khronos.org/registry/
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_H
|
||||
#define __OPENCL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#include <OpenCL/cl_gl_ext.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_gl.h>
|
||||
#include <CL/cl_gl_ext.h>
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_H */
|
||||
|
||||
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Filskillnaden har hållits tillbaka eftersom den är för stor
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Referens i nytt ärende
Block a user