Project

General

Profile

Actions

Emulator Issues #7015

closed

Failure to grab function addresses in OGL prevents application usage

Added by NeoBrainX about 10 years ago.

Status:
Fixed
Priority:
High
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Part of the OpenGL initialization procedure is GLExtensions::Init(), which checks for GL version and extension support:
if (success && !init_gl_1_1()) success = false;
if (success && !init_gl_1_2()) success = false;
if (success && !init_gl_1_3()) success = false;
if (success && !init_gl_1_4()) success = false;
if (success && !init_gl_1_5()) success = false;
if (success && !init_gl_2_0()) success = false;
if (success && !init_gl_3_0()) success = false;
if (success && !init_gl_3_1()) success = false;
if (success && !init_gl_3_2()) success = false;
if (success && !init_arb_uniform_buffer_object()) success = false;
if (success && !init_arb_sampler_objects()) success = false;
if (success && !init_arb_map_buffer_range()) success = false;
if (success && !init_arb_vertex_array_object()) success = false;
if (success && !init_arb_framebuffer_object()) success = false;
if (success && !init_arb_get_program_binary()) success = false;
if (success && !init_arb_sync()) success = false;
if (success && !init_arb_es2_compatibility()) success = false;
if (success && !init_nv_primitive_restart()) success = false;
if (success && !init_arb_blend_func_extended()) success = false;
if (success && !init_arb_viewport_array()) success = false;
if (success && !init_arb_draw_elements_base_vertex()) success = false;
if (success && !init_arb_sample_shading()) success = false;
if (success && !init_arb_debug_output()) success = false;
if (success && !init_nv_framebuffer_multisample_coverage()) success = false;
if (success && !init_khr_debug()) success = false;
if (success && !init_arb_buffer_storage()) success = false;

This means that if one of the extension checks fails (i.e. init_arb_buffer_storage), Dolphin fails to run because it reports "success = false"). Looking at the specific implementation of e.g. init_arb_buffer_storage, we have:
bool init_arb_buffer_storage()
{
if (!Supports("GL_ARB_buffer_storage"))
return true;
return GrabFunction(glBufferStorage)
&& GrabFunction(glNamedBufferStorageEXT);
}

So this means the function returns success if the extension is reported to be unsupported and fails if function grabbing fails.

This is completely retarded, for various reasons:
a) If drivers report extensions as supported, but don't actually expose the required functions - init_arb_buffer_storage returns failure
b) If the implementation of init_arb_buffer_storage makes incorrect assumptions (in this case it assumes that the presence of GL_ARB_buffer_storage implies the presence of glNamedBufferStorageEXT - which by the GL specification is only required under certain circumstances.

In both cases, failure of the extension initializer is treated as a failure of GLExtensions::Init(), hence completely preventing usage of Dolphin (Dolphin will error out, asking the user a useless question like "does your GPU support OpenGL 2.0?" even when it's actually the GL 4.4 extension causing troubles).

As a solution, the extension should be reported to be unavailable if our extension detection code returns failure. Program execution may continue as usual, just that no use will be made of that particular extension.

As a counterargument, one might bring up a) that drivers shouldn't expose extensions they don't actually support and b) that our extension detection code should be fixed. However, while both are valid arguments, they shouldn't be used to refuse application usage altogether.

Actions #1

Updated by Sonicadvance1 about 10 years ago

Will be fixed in a hour or two.

Actions #2

Updated by Sonicadvance1 about 10 years ago

  • Status changed from New to Fixed

merged

Actions #3

Updated by NeoBrainX about 10 years ago

Please specify the fixing commit in the future.

In this case, the issue was fixed by commit 0030784cbf6059c.

Actions

Also available in: Atom PDF