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 3169 - GLES2_CreateRenderer does not check SDL_GL_GetAttribute result, causing use of uninitialized data
Summary: GLES2_CreateRenderer does not check SDL_GL_GetAttribute result, causing use o...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.2
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-09 16:38 UTC by Yann Dirson
Modified: 2016-10-01 20:33 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Dirson 2015-11-09 16:38:34 UTC
When attempting to force use of opengles2 renderer with:

    int wanted_renderer = -1;
     for (int i = 0; i < numrenderers; i++) {
 	SDL_RendererInfo renderer_info;
 	if (SDL_GetRenderDriverInfo(i, &renderer_info) != 0) {
 	    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get renderer driver info: %s\n",
 			 SDL_GetError());
 	    quit(2);
 	}
 	std::cerr << "Renderer " << i << " '" << renderer_info.name << "': flags=0x"
 		  << std::hex << renderer_info.flags << std::dec
 		  << ", " << renderer_info.num_texture_formats << " texture formats, max="
 		  << renderer_info.max_texture_width << "x"
 		  << renderer_info.max_texture_height << "\n";
	if (!strcmp(renderer_info.name, "opengles2")) {
	    std::cerr << " selecting!\n";
	    wanted_renderer = i;
	}
     }

    renderer = SDL_CreateRenderer(window, wanted_renderer, 0);

... on banana pi or raspberry pi I get an error like the following (the actual
context profile value varies, being used uninitialized)

 ERROR: Couldn't create renderer: Unknown OpenGL context profile 900

With this patch I get the following, which should help more pointing to a real problem:

 ERROR: Couldn't create renderer: Failed getting OpenGL glGetString entry point

I pushed a patch (based on master branch of unofficial git mirror):

https://github.com/O-Computers/SDL/commit/550389c89f4e73a0a5294f95b9f6e6c18ba48509


I'll be opening a different bug for the underlying issue.
Comment 1 Sam Lantinga 2016-10-01 20:33:55 UTC
Your patch is applied, thanks!
https://hg.libsdl.org/SDL/rev/581bf4dc2783