Issue with getting GrGLMakeNativeInterface

199 views
Skip to first unread message

Krithika Balasubramanian

unread,
Apr 28, 2023, 9:36:36 AM4/28/23
to skia-discuss
Hi,

The following lines of code result in segmentation fault after migrating to Skia version m114. 
const auto interface = GrGLMakeNativeInterface();
sk_sp<GrDirectContext> grContext = GrDirectContext::MakeGL(interface);


Open GL version in my macOS is
OpenGL version string: 2.1 Metal - 83.1

Please help me to fix this and let me know the reason.

Regards,
BK

Brian Osman

unread,
Apr 28, 2023, 9:38:21 AM4/28/23
to skia-d...@googlegroups.com
That's not really enough for anyone to help you. Where does it crash, exactly? Have you tried running it in a debugger to get more information?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/a77abf11-3f70-4f99-83d8-ddff28de2468n%40googlegroups.com.

Krithika Balasubramanian

unread,
May 2, 2023, 8:43:37 AM5/2/23
to skia-discuss

Hi Brian, 

I am trying to render shapes with animation in my C++ project using Skia and SDL.

I have used OpenGL context to get the Skia surface by referring to the code from the official example, SkiaSDLExample. The code was working fine with a very old version of Skia. I upgraded to a recent version, m114 and the code crashes while getting GrGLInterface.

Code used to get GrContext
const auto interface = GrGLMakeNativeInterface();
sk_sp<GrDirectContext> grContext = GrDirectContext::MakeGL(interface);
|
Facing EXC_BAD_ACCESS at the line
GrGLVersion glVer = GrGLGetVersion(this); in GrGLInterface::validate() (GrGLInterfaceAutogen.cpp)
-------------------

Also tried to get the surface by leaving the interface as nullptr as recommended here (https://skia.org/docs/user/api/skcanvas_creation/)
In this approach, code crashes at the following line.

GR_GL_GetIntegerv(interface.get(), GR_GL_FRAMEBUFFER_BINDING, &buffer);
|
Facing EXC_BAD_ACCESS at the line
R operator()(Args... args) const {(GrGLFunctions.h)
SkASSERT(fCall);
return fCall(fBuf, std::forward<Args>(args)...);
}

interface is found to be a null pointer on debugging.

I would like to know if Skia doesn't support OpenGL 2.1 in the recent versions and if that is the cause of the issue I am facing.

Please let me know how to fix this.


Regards,
BK



Brian Salomon

unread,
May 2, 2023, 9:39:21 AM5/2/23
to skia-d...@googlegroups.com
Hi,

Ex skia-team member here. I don't think there was any intentional removal of support for OpenGL 2.1. Pretty much any change that affected the required OpenGL version or features would affect the history of this file:

My first step would be to check that src/gpu/ganesh/gl/mac/GrGLMakeNativeInterface_mac.cpp and not src/gpu/ganesh/gl/GrGLMakeNativeInterface_none.cpp is in your build. The latter always returns nullptr.

Best regards,
Brian

Reply all
Reply to author
Forward
0 new messages