Can SDL_UpdateTexture() used in a thread?

Hi all

I have an issue that SDL_UpdateTexture() in a separate thread (i.e not in main thread) and its crashes with “Segmentation fault: 11 (core dumped)” when it is executing the SDL_UpdateTexture().

GDB shows following error on the core file developed:
#0? 0x299d6669 in glGetError () from /usr/local/lib/libGL.so.1

The SDL_Window, SDL_Renderer, and SDL_Textureare created in the main thread.

In another thread, I’m attempting to display using SDL_UpdateTexture, SDL_RenderCopy, and SDL_RenderPresent. The muxtes are used to protect SDL_Window, SDL_Renderer, and SDL_Texture.

Are the SDL_UpdateTexture, SDL_RenderCopy, and SDL_RenderPresent limited to the main thread? Is there any thing required to be done to use them in a separate thread?

Many thanks in advance.

Best regards
Unga

Yes, they’re limited to the main thread (pretty much anything related
to rendering or event handling is). There isn’t much SDL can do to
work around this, it’s a limitation of the underlying system APIs :confused:

2013/4/17, Unga :> Hi all

I have an issue that SDL_UpdateTexture() in a separate thread (i.e not in
main thread) and its crashes with "Segmentation fault: 11 (core dumped)"
when it is executing the SDL_UpdateTexture().

GDB shows following error on the core file developed:
#0? 0x299d6669 in glGetError () from /usr/local/lib/libGL.so.1

The SDL_Window, SDL_Renderer, and SDL_Textureare created in the main thread.

In another thread, I’m attempting to display using SDL_UpdateTexture,
SDL_RenderCopy, and SDL_RenderPresent. The muxtes are used to protect
SDL_Window, SDL_Renderer, and SDL_Texture.

Are the SDL_UpdateTexture, SDL_RenderCopy, and SDL_RenderPresent limited to
the main thread? Is there any thing required to be done to use them in a
separate thread?

Many thanks in advance.

Best regards
Unga

Cc:

Yes, they’re limited to the main thread (pretty much anything related
to rendering or event handling is). There isn’t much SDL can do to
work around this, it’s a limitation of the underlying system APIs :confused:

IC, then will stick to the main thread. Appreciate very much your reply.

Thank you.
Unga

----- Original Message -----
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: Unga <@Unga>; SDL Development List
Sent: Wednesday, April 17, 2013 6:19 PM
Subject: Re: [SDL] Can SDL_UpdateTexture() used in a thread?