Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/opencl/make_opencl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/opencl/make_opencl b/dlls/opencl/make_opencl index 088120c8081..a93946b2d2b 100755 --- a/dlls/opencl/make_opencl +++ b/dlls/opencl/make_opencl @@ -297,8 +297,8 @@ sub generate_spec_entry($$) }
my %core_functions; -my %cl_enums; -my (%cl_types, @cl_types); # also use an array to preserve declaration order +my %header_enums; +my (%header_types, @header_types); # also use an array to preserve declaration order
# some functions need a hand-written wrapper sub needs_pe_wrapper($) @@ -440,13 +440,13 @@ sub parse_file($) } foreach my $enum ($feature->findnodes("./require/enum")) { - $cl_enums{$enum->{name}} = $enums{$enum->{name}}; + $header_enums{$enum->{name}} = $enums{$enum->{name}}; } foreach my $type ($feature->findnodes("./require/type")) { next unless $types{$type->{name}}; - push @cl_types, $type->{name} unless $cl_types{$type->{name}}; - $cl_types{$type->{name}} = $types{$type->{name}}; + push @header_types, $type->{name} unless $header_types{$type->{name}}; + $header_types{$type->{name}} = $types{$type->{name}}; } }
@@ -588,9 +588,9 @@ typedef uint64_t DECLSPEC_ALIGN(8) cl_ulong; END ;
-foreach (@cl_types) +foreach (@header_types) { - my $type = $cl_types{$_}; + my $type = $header_types{$_}; if ($type->{category} eq "define") { print TYPES $type->textContent() . "\n"; @@ -603,9 +603,9 @@ foreach (@cl_types)
print TYPES "\n";
-foreach (sort keys %cl_enums) +foreach (sort keys %header_enums) { - printf TYPES "#define %s %s\n", $_, $cl_enums{$_}; + printf TYPES "#define %s %s\n", $_, $header_enums{$_}; }
close(TYPES);
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/opencl/make_opencl | 53 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/dlls/opencl/make_opencl b/dlls/opencl/make_opencl index a93946b2d2b..c2c4d7f6e63 100755 --- a/dlls/opencl/make_opencl +++ b/dlls/opencl/make_opencl @@ -369,13 +369,34 @@ sub generate_struct($) return $ret; }
+my %all_functions; +my %all_enums; +my %all_types; + +sub parse_feature($) +{ + my $feature = shift; + + foreach my $cmd ($feature->findnodes("./require/command")) + { + $core_functions{$cmd->{name}} = $all_functions{$cmd->{name}}; + } + foreach my $enum ($feature->findnodes("./require/enum")) + { + $header_enums{$enum->{name}} = $all_enums{$enum->{name}}; + } + foreach my $type ($feature->findnodes("./require/type")) + { + next unless $all_types{$type->{name}}; + push @header_types, $type->{name} unless $header_types{$type->{name}}; + $header_types{$type->{name}} = $all_types{$type->{name}}; + } +} + sub parse_file($) { my $file = shift; my $xml = XML::LibXML->load_xml( location => $file ); - my %functions; - my %enums; - my %types;
# save all functions foreach my $command ($xml->findnodes("/registry/commands/command")) @@ -384,7 +405,7 @@ sub parse_file($) my $name = @{$command->findnodes("./proto/name")}[0]; $proto->removeChild( $name ); my @params = $command->findnodes("./param"); - $functions{$name->textContent()} = [ $proto, @params ]; + $all_functions{$name->textContent()} = [ $proto, @params ]; }
# save all enums @@ -392,11 +413,11 @@ sub parse_file($) { if (defined $enum->{value}) { - $enums{$enum->{name}} = $enum->{value}; + $all_enums{$enum->{name}} = $enum->{value}; } else { - $enums{$enum->{name}} = "(1 << " . $enum->{bitpos} . ")"; + $all_enums{$enum->{name}} = "(1 << " . $enum->{bitpos} . ")"; } }
@@ -407,7 +428,7 @@ sub parse_file($) { my $name = @{$type->findnodes("./name")}[0]; $name = $name->textContent; - $types{$name} = $type; + $all_types{$name} = $type;
my $basetype = @{$type->findnodes("./type")}[0]; if ($type->textContent() =~ /[[*]/) @@ -426,28 +447,14 @@ sub parse_file($) elsif ($type->{category} eq "struct") { my $name = $type->{name}; - $types{$name} = $type; + $all_types{$name} = $type; } }
# generate core functions foreach my $feature ($xml->findnodes("/registry/feature")) { - next unless defined $core_categories{$feature->{name}}; - foreach my $cmd ($feature->findnodes("./require/command")) - { - $core_functions{$cmd->{name}} = $functions{$cmd->{name}}; - } - foreach my $enum ($feature->findnodes("./require/enum")) - { - $header_enums{$enum->{name}} = $enums{$enum->{name}}; - } - foreach my $type ($feature->findnodes("./require/type")) - { - next unless $types{$type->{name}}; - push @header_types, $type->{name} unless $header_types{$type->{name}}; - $header_types{$type->{name}} = $types{$type->{name}}; - } + parse_feature($feature) if defined $core_categories{$feature->{name}}; }
# generate extension list
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46470 Signed-off-by: Zebediah Figura zfigura@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)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=106969
Your paranoid android.
=== debian11 (build log) ===
../wine/dlls/opencl/pe_wrappers.c:266:49: error: unknown type name ‘cl_gl_object_type’; did you mean ‘cl_mem_object_type’? ../wine/dlls/opencl/pe_wrappers.c:273:50: error: unknown type name ‘cl_gl_texture_info’; did you mean ‘cl_context_info’? Task: The win32 Wine build failed
=== debian11 (build log) ===
../wine/dlls/opencl/pe_wrappers.c:266:49: error: unknown type name ‘cl_gl_object_type’; did you mean ‘cl_mem_object_type’? ../wine/dlls/opencl/pe_wrappers.c:273:50: error: unknown type name ‘cl_gl_texture_info’; did you mean ‘cl_context_info’? Task: The wow64 Wine build failed
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@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)