We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3362

Summary: OpenGL renderer doesn't check if framebuffers are supported when creating target textures
Product: SDL Reporter: Simon Hug <chli.hug>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: Patch that adds some checks for render target support in the opengl renderer.

Description Simon Hug 2016-06-13 15:22:31 UTC
Created attachment 2495 [details]
Patch that adds some checks for render target support in the opengl renderer.

The GL_CreateTexture function doesn't have any checks for the case where the driver doesn't support the framebuffer object extension. It will call into GL_GetFBO which will call the non-existent glGenFramebuffersEXT.

Also, for some reason GL_CreateContext always sets the SDL_RENDERER_TARGETTEXTURE info flag, even if it is not supported. Changeset 6e6bd53feff0 [1] makes this change, but doesn't explain why. It seems to me like the code would already have taken care of this [2].

The attached patch adds some checks and stops SDL from reporting render target support if there is none. The application can then properly inform the user instead of just crashing.

[1] http://hg.libsdl.org/SDL/rev/6e6bd53feff0
[2] http://hg.libsdl.org/SDL/file/6e6bd53feff0/src/render/opengl/SDL_render_gl.c#l553
Comment 1 Sam Lantinga 2016-10-01 17:52:43 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/5ceaeb95972e