include: sync OpenCL headers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35241>
This commit is contained in:
Karol Herbst 2025-05-29 14:15:08 +02:00 committed by Marge Bot
parent 034ac06c64
commit 924c76b7e5
3 changed files with 48 additions and 32 deletions

View file

@ -24,6 +24,12 @@
extern "C" { extern "C" {
#endif #endif
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
/******************************************************************************/ /******************************************************************************/
typedef struct _cl_platform_id * cl_platform_id; typedef struct _cl_platform_id * cl_platform_id;
@ -133,39 +139,14 @@ typedef struct _cl_image_desc {
size_t image_slice_pitch; size_t image_slice_pitch;
cl_uint num_mip_levels; cl_uint num_mip_levels;
cl_uint num_samples; cl_uint num_samples;
#ifdef CL_VERSION_2_0 #if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__
#if defined(__GNUC__) __CL_ANON_STRUCT__ union {
__extension__ /* Prevents warnings about anonymous union in -pedantic builds */
#endif
#if defined(_MSC_VER) && !defined(__STDC__)
#pragma warning( push )
#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 builds */
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc11-extensions" /* Prevents warning about nameless union being C11 extension*/
#endif
#if defined(_MSC_VER) && defined(__STDC__)
/* Anonymous unions are not supported in /Za builds */
#else
union {
#endif
#endif #endif
cl_mem buffer; cl_mem buffer;
#ifdef CL_VERSION_2_0 #if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__
#if defined(_MSC_VER) && defined(__STDC__)
/* Anonymous unions are not supported in /Za builds */
#else
cl_mem mem_object; cl_mem mem_object;
}; };
#endif #endif
#if defined(_MSC_VER) && !defined(__STDC__)
#pragma warning( pop )
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
} cl_image_desc; } cl_image_desc;
#endif #endif
@ -1932,4 +1913,8 @@ clEnqueueTask(cl_command_queue command_queue,
} }
#endif #endif
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
#endif
#endif /* __OPENCL_CL_H */ #endif /* __OPENCL_CL_H */

View file

@ -22,6 +22,7 @@
#include <CL/cl_egl.h> #include <CL/cl_egl.h>
#include <CL/cl_ext.h> #include <CL/cl_ext.h>
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#include <CL/cl_platform.h>
#if defined(_WIN32) #if defined(_WIN32)
#include <CL/cl_d3d11.h> #include <CL/cl_d3d11.h>
@ -29,6 +30,12 @@
#include <CL/cl_dx9_media_sharing.h> #include <CL/cl_dx9_media_sharing.h>
#endif #endif
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -37,7 +44,15 @@ extern "C" {
typedef struct _cl_icd_dispatch { typedef struct _cl_icd_dispatch {
/* OpenCL 1.0 */ /* OpenCL 1.0 */
clGetPlatformIDs_t *clGetPlatformIDs; #if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ union {
#endif
clGetPlatformIDs_t *clGetPlatformIDs;
#if __CL_HAS_ANON_STRUCT__
/* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */
intptr_t clGetPlatformIDs_icd2_tag;
};
#endif
clGetPlatformInfo_t *clGetPlatformInfo; clGetPlatformInfo_t *clGetPlatformInfo;
clGetDeviceIDs_t *clGetDeviceIDs; clGetDeviceIDs_t *clGetDeviceIDs;
clGetDeviceInfo_t *clGetDeviceInfo; clGetDeviceInfo_t *clGetDeviceInfo;
@ -68,7 +83,15 @@ typedef struct _cl_icd_dispatch {
clRetainProgram_t *clRetainProgram; clRetainProgram_t *clRetainProgram;
clReleaseProgram_t *clReleaseProgram; clReleaseProgram_t *clReleaseProgram;
clBuildProgram_t *clBuildProgram; clBuildProgram_t *clBuildProgram;
clUnloadCompiler_t *clUnloadCompiler; #if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ union {
#endif
clUnloadCompiler_t *clUnloadCompiler;
#if __CL_HAS_ANON_STRUCT__
/* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */
intptr_t clUnloadCompiler_icd2_tag;
};
#endif
clGetProgramInfo_t *clGetProgramInfo; clGetProgramInfo_t *clGetProgramInfo;
clGetProgramBuildInfo_t *clGetProgramBuildInfo; clGetProgramBuildInfo_t *clGetProgramBuildInfo;
clCreateKernel_t *clCreateKernel; clCreateKernel_t *clCreateKernel;
@ -312,4 +335,8 @@ typedef struct _cl_icd_dispatch {
} }
#endif #endif
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
#endif
#endif /* #ifndef OPENCL_CL_ICD_H */ #endif /* #ifndef OPENCL_CL_ICD_H */

View file

@ -22,7 +22,9 @@ use std::ptr;
use std::sync::Arc; use std::sync::Arc;
pub static DISPATCH: cl_icd_dispatch = cl_icd_dispatch { pub static DISPATCH: cl_icd_dispatch = cl_icd_dispatch {
clGetPlatformIDs: Some(clGetPlatformIDs), anon_1: _cl_icd_dispatch__bindgen_ty_1 {
clGetPlatformIDs: Some(clGetPlatformIDs),
},
clGetPlatformInfo: Some(clGetPlatformInfo), clGetPlatformInfo: Some(clGetPlatformInfo),
clGetDeviceIDs: Some(clGetDeviceIDs), clGetDeviceIDs: Some(clGetDeviceIDs),
clGetDeviceInfo: Some(clGetDeviceInfo), clGetDeviceInfo: Some(clGetDeviceInfo),
@ -53,7 +55,9 @@ pub static DISPATCH: cl_icd_dispatch = cl_icd_dispatch {
clRetainProgram: Some(clRetainProgram), clRetainProgram: Some(clRetainProgram),
clReleaseProgram: Some(clReleaseProgram), clReleaseProgram: Some(clReleaseProgram),
clBuildProgram: Some(clBuildProgram), clBuildProgram: Some(clBuildProgram),
clUnloadCompiler: None, anon_2: _cl_icd_dispatch__bindgen_ty_2 {
clUnloadCompiler: None,
},
clGetProgramInfo: Some(clGetProgramInfo), clGetProgramInfo: Some(clGetProgramInfo),
clGetProgramBuildInfo: Some(clGetProgramBuildInfo), clGetProgramBuildInfo: Some(clGetProgramBuildInfo),
clCreateKernel: Some(clCreateKernel), clCreateKernel: Some(clCreateKernel),