[PATCH 3/3] opencl: Export unsuffixed KHR_gl_sharing functions.

Sveinar Søpler cybermax at dexter.no
Fri Feb 4 10:53:43 CST 2022


Compiled without errors after i ran dlls/opencl/make_opencl script, and 
worked with DAZ Studio dForce. Also ran the OpenCL demo's in GPU Caps 
Viewer.

Sveinar

On 03.02.2022 22:08, Zebediah Figura wrote:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46470
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>   dlls/opencl/make_opencl   | 52 ++++++++++++++++++++++++--
>   dlls/opencl/pe_wrappers.c | 77 +++++++++++++++++++++++++++++++++++++++
>   2 files changed, 125 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/opencl/make_opencl b/dlls/opencl/make_opencl
> index c2c4d7f6e63..6d9881c84b3 100755
> --- a/dlls/opencl/make_opencl
> +++ b/dlls/opencl/make_opencl
> @@ -315,6 +315,17 @@ sub needs_pe_wrapper($)
>   
>               # deprecated and absent from headers
>               "clSetCommandQueueProperty" => 1,
> +
> +            # needs GL object unwrapping
> +            "clCreateFromGLBuffer" => 1,
> +            "clCreateFromGLRenderbuffer" => 1,
> +            "clCreateFromGLTexture" => 1,
> +            "clCreateFromGLTexture2D" => 1,
> +            "clCreateFromGLTexture3D" => 1,
> +            "clEnqueueAcquireGLObjects" => 1,
> +            "clEnqueueReleaseGLObjects" => 1,
> +            "clGetGLObjectInfo" => 1,
> +            "clGetGLTextureInfo" => 1,
>           );
>       my $name = shift;
>   
> @@ -349,6 +360,17 @@ sub needs_unix_function($)
>               "clGetExtensionFunctionAddress" => 1,
>               "clGetExtensionFunctionAddressForPlatform" => 1,
>               "clSetCommandQueueProperty" => 1,
> +
> +            # not yet implemented
> +            "clCreateFromGLBuffer" => 1,
> +            "clCreateFromGLRenderbuffer" => 1,
> +            "clCreateFromGLTexture" => 1,
> +            "clCreateFromGLTexture2D" => 1,
> +            "clCreateFromGLTexture3D" => 1,
> +            "clEnqueueAcquireGLObjects" => 1,
> +            "clEnqueueReleaseGLObjects" => 1,
> +            "clGetGLObjectInfo" => 1,
> +            "clGetGLTextureInfo" => 1,
>           );
>       my $name = shift;
>   
> @@ -373,12 +395,29 @@ my %all_functions;
>   my %all_enums;
>   my %all_types;
>   
> -sub parse_feature($)
> +sub parse_feature($$)
>   {
> -    my $feature = shift;
> +    my ($feature, $is_core) = @_;
> +
> +    my %extra_core_functions =
> +        (
> +            # these are not core, but exported from the loader anyway
> +            "clCreateFromGLBuffer" => 1,
> +            "clCreateFromGLRenderbuffer" => 1,
> +            "clCreateFromGLTexture" => 1,
> +            "clCreateFromGLTexture2D" => 1,
> +            "clCreateFromGLTexture3D" => 1,
> +            "clEnqueueAcquireGLObjects" => 1,
> +            "clEnqueueReleaseGLObjects" => 1,
> +            "clGetGLObjectInfo" => 1,
> +            "clGetGLTextureInfo" => 1,
> +        );
>   
>       foreach my $cmd ($feature->findnodes("./require/command"))
>       {
> +        # TODO: store these in a separate list
> +        next unless $is_core or defined $extra_core_functions{$cmd->{name}};
> +
>           $core_functions{$cmd->{name}} = $all_functions{$cmd->{name}};
>       }
>       foreach my $enum ($feature->findnodes("./require/enum"))
> @@ -454,10 +493,10 @@ sub parse_file($)
>       # generate core functions
>       foreach my $feature ($xml->findnodes("/registry/feature"))
>       {
> -        parse_feature($feature) if defined $core_categories{$feature->{name}};
> +        parse_feature($feature, 1) if defined $core_categories{$feature->{name}};
>       }
>   
> -    # generate extension list
> +    # generate extension list and functions
>       foreach my $ext ($xml->findnodes("/registry/extensions/extension"))
>       {
>           # we currently don't support clGetExtensionFunctionAddress, and
> @@ -465,6 +504,11 @@ sub parse_file($)
>           # we need to generate a table of thunks per platform and retrieve the
>           # platform from the called object
>           $unsupported_extensions{lc($ext->{name})} = 1 if $ext->findnodes("./require/command");
> +
> +        # FIXME: Parse all supported extensions. Note that we don't actually
> +        # support KHR_gl_sharing yet, but we need to export the functions anyway
> +        # (some applications expect them to be present).
> +        parse_feature($ext, 0) if lc($ext->{name}) eq "cl_khr_gl_sharing";
>       }
>   }
>   
> diff --git a/dlls/opencl/pe_wrappers.c b/dlls/opencl/pe_wrappers.c
> index 158f255d4e6..29ae1afaaff 100644
> --- a/dlls/opencl/pe_wrappers.c
> +++ b/dlls/opencl/pe_wrappers.c
> @@ -21,6 +21,7 @@
>   #include "opencl_private.h"
>   #include "opencl_types.h"
>   #include "unixlib.h"
> +#include "wine/wgl.h"
>   
>   WINE_DEFAULT_DEBUG_CHANNEL(opencl);
>   
> @@ -202,6 +203,82 @@ void * WINAPI clGetExtensionFunctionAddressForPlatform( cl_platform_id platform,
>   }
>   
>   
> +cl_mem WINAPI clCreateFromGLBuffer( cl_context *context, cl_mem_flags flags, GLuint bufobj, int *errcode_ret )
> +{
> +    FIXME( "(%p, %s, %u, %p) stub!\n", context, wine_dbgstr_longlong(flags), bufobj, errcode_ret );
> +    return NULL;
> +}
> +
> +
> +cl_mem WINAPI clCreateFromGLRenderbuffer( cl_context *context,
> +        cl_mem_flags flags, GLuint renderbuffer, int *errcode_ret )
> +{
> +    FIXME( "(%p, %s, %u, %p) stub!\n", context, wine_dbgstr_longlong(flags), renderbuffer, errcode_ret );
> +    return NULL;
> +}
> +
> +
> +cl_mem WINAPI clCreateFromGLTexture( cl_context *context, cl_mem_flags flags,
> +        GLenum target, GLint miplevel, GLuint texture, cl_int *errcode_ret )
> +{
> +    FIXME( "(%p, %s, %u, %d, %u, %p) stub!\n",
> +            context, wine_dbgstr_longlong(flags), target, miplevel, texture, errcode_ret );
> +    return NULL;
> +}
> +
> +
> +cl_mem WINAPI clCreateFromGLTexture2D( cl_context *context, cl_mem_flags flags,
> +        GLenum target, GLint miplevel, GLuint texture, cl_int *errcode_ret )
> +{
> +    FIXME( "(%p, %s, %u, %d, %u, %p) stub!\n",
> +            context, wine_dbgstr_longlong(flags), target, miplevel, texture, errcode_ret );
> +    return NULL;
> +}
> +
> +
> +cl_mem WINAPI clCreateFromGLTexture3D( cl_context *context, cl_mem_flags flags,
> +        GLenum target, GLint miplevel, GLuint texture, cl_int *errcode_ret )
> +{
> +    FIXME( "(%p, %s, %u, %d, %u, %p) stub!\n",
> +            context, wine_dbgstr_longlong(flags), target, miplevel, texture, errcode_ret );
> +    return NULL;
> +}
> +
> +
> +cl_int WINAPI clEnqueueAcquireGLObjects( cl_command_queue 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 )
> +{
> +    FIXME( "(%p, %u, %p, %u, %p, %p) stub!\n",
> +            queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event );
> +    return CL_INVALID_DEVICE;
> +}
> +
> +
> +cl_int WINAPI clEnqueueReleaseGLObjects( cl_command_queue 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 )
> +{
> +    FIXME( "(%p, %u, %p, %u, %p, %p) stub!\n",
> +            queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event );
> +    return CL_INVALID_DEVICE;
> +}
> +
> +
> +cl_int WINAPI clGetGLObjectInfo( cl_mem memobj, cl_gl_object_type *gl_object_type, GLuint *gl_object_name )
> +{
> +    FIXME( "(%p, %p, %p) stub!\n", memobj, gl_object_type, gl_object_name );
> +    return CL_INVALID_DEVICE;
> +}
> +
> +
> +cl_int WINAPI clGetGLTextureInfo( cl_mem memobj, cl_gl_texture_info param_name,
> +        size_t param_value_size, void *param_value, size_t param_value_size_ret )
> +{
> +    FIXME( "(%p, %#x, %Iu, %p, %Iu) stub!\n",
> +            memobj, param_name, param_value_size, param_value, param_value_size_ret );
> +    return CL_INVALID_DEVICE;
> +}
> +
> +
>   BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
>   {
>       if (reason == DLL_PROCESS_ATTACH)




More information about the wine-devel mailing list