Exception when using 32-bit Skia under Windows

148 views
Skip to first unread message

frankjosep...@gmail.com

unread,
Jan 29, 2018, 5:59:02 PM1/29/18
to skia-discuss

Out of the box 64-bit Skia for Windows built fine on my system (Using Visual Studio 2017 Community on a x64 system).

I know a 32-bit Windows build is not supported but I was able to get Skia to compile by manually editing the toolchain.ninja file and using a script to setup the MSVC x64_x86 environment variables.

Everything compiles fine but when attempting to run HelloWorld.exe it throws an access violation exception.

Comparing the 32-bit version of HelloWorld.exe with the 64-bit version (which runs fine) the exception can be traced to this line in GrGLMakeAssembledGLInterface :

    if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString, display)) { 

These GrGLFunction objects are constructed with the function pointer constructor in the 64-bit version but the 32-bit version is using the "small closure" constructor.

Anyone have any ideas what could cause this difference in the compiled code?

Thanks,

Frank

Alexander Vostres

unread,
Apr 29, 2018, 4:56:09 PM4/29/18
to skia-discuss
The difference is that x64 has only fastcall calling convention, see here:

So all functions and pointers to them are fastcall thus choosing correct constructor while x86 is not so simple as constructor choise depends on calling convention too - template is only for default calling convention while GL functions must be __stdcall.

I've managed to build and run it just fine (although hacky - I'm not really C++ dev so I'm not sure how to work around calling convention in templates). In case someone needs it - see here:
Reply all
Reply to author
Forward
0 new messages