You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm using an SKGLView on macOS to render some SKImage objects - since the latest preview build introduces ToTextureImage i wanted to use this to create the SKImage object on the GPU. This causes the following native crash for me
Code
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x109680d38 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MacOS/test : mono_dump_native_crash_info
0x109674555 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MacOS/test : mono_handle_native_crash
0x1099bfb33 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MacOS/test : altstack_handle_and_restore.cold.1
0x1095f26ac - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MacOS/test : altstack_handle_and_restore
0x7fff3a333980 - /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib : glGenTextures
0x10a28226c - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a281e76 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1a672c - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1a67d4 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1cdecb - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1b3006 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1cd9f6 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1b4b3f - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1e5b17 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1b345c - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1eab72 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a0fcf0d - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a0fcfba - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1a8d11 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1e776c - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a1e88ff - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a2b831b - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x10a2b81d1 - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : gr_backendrendertarget_get_gl_framebufferinfo
0x109fc065a - /Users/dev/test.MacOS/bin/Debug/test.app/Contents/MonoBundle/libSkiaSharp.dylib : sk_image_make_texture_image
0x13f30f4dc - Unknown
=================================================================
Telemetry Dumper:
=================================================================
Pkilling 0x70000a93f000 from 0x700007971000
Pkilling 0x700007d77000 from 0x700007971000
Pkilling 0x70000572c000 from 0x700007971000
Pkilling 0x700008380000 from 0x700007971000
Pkilling 0x700008d15000 from 0x700007971000
Pkilling 0x700005dc1000 from 0x700007971000
Pkilling 0x70000931e000 from 0x700007971000
Pkilling 0x700005a35000 from 0x700007971000
Pkilling 0x1112c7dc0 from 0x700007971000
Pkilling 0x7000063ca000 from 0x700007971000
Pkilling 0x700009927000 from 0x700007971000
Pkilling 0x700006d5f000 from 0x700007971000
Pkilling 0x7000069d3000 from 0x700007971000
Pkilling 0x700009f30000 from 0x700007971000
Pkilling 0x700007368000 from 0x700007971000
Pkilling 0x70000a539000 from 0x700007971000
Pkilling 0x700007f7a000 from 0x700007971000
Pkilling 0x70000890f000 from 0x700007971000
Pkilling 0x700008583000 from 0x700007971000
Pkilling 0x700008f18000 from 0x700007971000
Pkilling 0x700005fc4000 from 0x700007971000
Pkilling 0x700009521000 from 0x700007971000
Pkilling 0x7000065cd000 from 0x700007971000
Pkilling 0x700009b2a000 from 0x700007971000
Pkilling 0x700006f62000 from 0x700007971000
Pkilling 0x70000a133000 from 0x700007971000
Pkilling 0x70000756b000 from 0x700007971000
Pkilling 0x70000a73c000 from 0x700007971000
Pkilling 0x700007b74000 from 0x700007971000
Pkilling 0x700005529000 from 0x700007971000
Pkilling 0x70000817d000 from 0x700007971000
Pkilling 0x700008b12000 from 0x700007971000
Pkilling 0x700005bbe000 from 0x700007971000
Pkilling 0x70000911b000 from 0x700007971000
Pkilling 0x7000061c7000 from 0x700007971000
* Assertion: should not be reached at /Users/builder/jenkins/workspace/archive-mono/2019-08/mac/release/mono/metadata/threads.c:6254
Pkilling 0x700009724000 from 0x700007971000
Pkilling 0x7000067d0000 from 0x700007971000
Pkilling 0x700009d2d000 from 0x700007971000
Pkilling 0x700007165000 from 0x700007971000
Pkilling 0x70000a336000 from 0x700007971000
Pkilling 0x70000776e000 from 0x700007971000
Entering thread summarizer pause from 0x700007971000
Thread started: <Thread Pool> #44
Thread started: <Thread Pool> #45
Finished thread summarizer pause from 0x700007971000.
Waiting for dumping threads to resume
=================================================================
External Debugger Dump:
=================================================================
(lldb) command source -s 0 '/tmp/mono-gdb-commands.22028'
Executing commands in '/tmp/mono-gdb-commands.22028'.
(lldb) process attach --pid 22028
Expected Behavior
image object should be created on the GPU without errors
Actual Behavior
application crashes
Basic Information
Version with issue: 1.68.2-preview.29
IDE: Visual Studio for Mac
Platform Target Frameworks:
macOS: 10.15.3 (19D76)
Target Devices:
MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports) | 16 GB 2133 MHz LPDDR3 | 2,3 GHz Quad-Core Intel Core i5 | Intel Iris Plus Graphics 655 1536 MB
This is a very late reply, but I looked into this and the crash is because macOS doesn't do the correct checks that it should.
However, the reason for any error is that what is happening is that the ToTextureImage is trying to copy the image to the GPU via the current OpenGL context. But, on a button click, the context is not set/valid. This might be because the OS is using the GL context, or some other control is has changed to its own context. Before calling this, you have to make sure that you have set the view to be in control.
Right now, there is no way to indicate that the view must set its GL context to be current, so I would suggest adjusting the logic to rather queue the copy and then wait until the next draw operation to actually copy.
In fact, the way you have your code, you can do this with minimal code changes. Just 2 places:
voidAddImage_Clicked(){// var im = SKImage.FromEncodedData(_buffer.ElementAt(index)).ToTextureImage(SkiaView.GRContext);varim=SKImage.FromEncodedData(_buffer.ElementAt(index));}
voidHandle_PaintSurface(){// convert all images to texturesif(!img.Image.IsTextureBacked)img.Image=img.Image.ToTextureImage(SkiaView.GRContext);e.Surface.Canvas.DrawImage(img.Image,img.Destination,p);}
Obviously, we should look into the crash part and see if we can either throw a native exception or return null.
Description
I'm using an
SKGLView
on macOS to render someSKImage
objects - since the latest preview build introducesToTextureImage
i wanted to use this to create theSKImage
object on the GPU. This causes the following native crash for meCode
Expected Behavior
image object should be created on the GPU without errors
Actual Behavior
application crashes
Basic Information
Version with issue: 1.68.2-preview.29
IDE: Visual Studio for Mac
Platform Target Frameworks:
Target Devices:
Reproduction Link
https://github.com/nor0x/SkiaSharp_PerfomanceExperiments/tree/master/Xamarin.Forms
The text was updated successfully, but these errors were encountered: