Mipmap flag on iOS simulator when using PROGRAMABLE_PIPELINE
jmasterx

When using the mipmap bitmap flag on the iOS simulator and ALLEGRO_PROGRAMABLE_PIPELINE is set, then no bitmaps load. I tried ex_shader and got the same results, works without the flag, but does not work with it.

Has anyone been able to get it to work this way on a real iOS device, or seen this failure case on simulator?

Even bitmaps not used for shader purposes do not load, and I even tried a small 64x64 bitmap.

It seems to be that this:
ALLEGRO_LOCKED_REGION *lock = al_lock_bitmap(bmp,
ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_WRITEONLY);
returns NULL.

SiegeLord

There shouldn't be any problems in locking a memory bitmap in that format... are you sure it returns NULL and that it's a memory bitmap? Wouldn't it just crash?

Also, check your allegro.log (it'll probably just tell you that it can't create a particular bitmap format).

jmasterx

The lock fails here:

#SelectExpand
1 ok = true; 2 3 /* Set up the pixel store state. We will need to match it when unlocking. 4 * There may be other pixel store state we should be setting. 5 * See also pitfalls 7 & 8 from: 6 * http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ 7 */ 8 { 9 const int pixel_size = al_get_pixel_size(real_format); 10 const int pixel_alignment = ogl_pixel_alignment(pixel_size); 11 GLenum e; 12 glPixelStorei(GL_PACK_ALIGNMENT, pixel_alignment); 13 e = glGetError(); 14 if (e) { 15 ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", 16 pixel_alignment, _al_gl_error_string(e)); 17 ok = false; 18 } 19 }

ok becomes false, pixel alignment = 4

and it does crash when it tries to access the lock since loading a bitmap seems to assume the lock will succeed.

Looking at the gl docs, I see that this really should not fail, but somehow it does... GL_INVALID_ENUM is generated if pname is not an accepted value. But it is...

SiegeLord

Could you stick a glGetError code before glPixelStorei? Perhaps the error happens earlier and just happens to be ignored.

jmasterx

It looks like you are correct, glGetLastError() has a value the moment before the call to glPixelStorei

Now for the fun part... tracking down which gl call is responsible :O

Update:
Allegro is not catching the issue, the issue happens here:
ogl_bitmap.c

#SelectExpand
1 if (bitmap_flags & ALLEGRO_MIPMAP) { 2 /* If using FBOs, use glGenerateMipmapEXT instead of the GL_GENERATE_MIPMAP 3 * texture parameter. GL_GENERATE_MIPMAP is deprecated in GL 3.0 so we 4 * may want to use the new method in other cases as well. 5 */ 6 if (al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object) { 7 post_generate_mipmap = true; 8 } 9 else { 10//THIS CALL FAILS 11 glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); 12 e = glGetError(); 13 if (e) { 14 ALLEGRO_ERROR("tex3 for texture %d failed (%s).\n", 15 ogl_bitmap->texture, _al_gl_error_string(e)); 16 printf("tex3 for texture %d failed (%s).\n", 17 ogl_bitmap->texture, _al_gl_error_string(e)); 18 } 19 } 20 }

The glTexParameteri call fails and returns GL_INVALID_ENUM
gl docs say: GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.
GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.

Hopefully this gives more insight into the problem.

I wonder if it is a simulator-only issue...

SiegeLord

Hmm, that can't be right since e = glGetError(); is right after it, which should clear the error flag.

jmasterx

No, I added that error checking code in, I modified allegro and added error checks everywhere where there was a gl call and recompiled and this is the first one that triggers and it makes sense because adding the mipmap flag when shaders are enabled triggers the problem.

SiegeLord

Ah, I see! Great work! Sounds like that function might be deprecated in some contexts, so perhaps that's why it fails. Could you stick a post_generate_mipmap = true; inside that error handling branch and see if the other mipmap generation option succeeds?

jmasterx

Well, the good news is that it worked, though I had to add a call to glgeterror in the OpenGL_ES case:

   else {
      unsigned char *buf;
      int pix_size = al_get_pixel_size(bitmap_format);
      buf = al_calloc(pix_size,
         ogl_bitmap->true_h * ogl_bitmap->true_w);
      glPixelStorei(GL_UNPACK_ALIGNMENT, pix_size);
      glTexImage2D(GL_TEXTURE_2D, 0, get_glformat(bitmap_format, 0),
         ogl_bitmap->true_w, ogl_bitmap->true_h, 0,
         get_glformat(bitmap_format, 2),
         get_glformat(bitmap_format, 1), buf);
       e = glGetError(); //here
      al_free(buf);
   }

and the call here succeeds:

   if (post_generate_mipmap) {
      glGenerateMipmapEXT(GL_TEXTURE_2D);
      e = glGetError();
      if (e) {
         ALLEGRO_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n",
            ogl_bitmap->texture, _al_gl_error_string(e));
          printf("glGenerateMipmapEXT for texture %d failed (%s).\n",
                        ogl_bitmap->texture, _al_gl_error_string(e));
      }
   }

But for some reason, the alpha of many of my textures is rendering incorrectly. It's as if, on select textures I decided to draw a tinted bitmap where alpha< 1. The alpha varies from about 0.5 to 0 on several textures. It creates some funny effects.

Any insight on what could cause that?
If I take off mipmapping all alphas are happy.

SiegeLord

Shotting a bit in the dark here, but how about trying this patch? It merely forces the OpenGL to rebuild the mipmaps after every unlock operation.

#SelectExpand
1diff --git a/src/opengl/ogl_lock_es.c b/src/opengl/ogl_lock_es.c 2index 777a954..8b5a234 100644 3--- a/src/opengl/ogl_lock_es.c 4+++ b/src/opengl/ogl_lock_es.c 5@@ -559,16 +559,16 @@ static void ogl_unlock_region_nonbb(ALLEGRO_BITMAP *bitmap, 6 7 /* If using FBOs, we need to regenerate mipmaps explicitly now. */ 8 /* XXX why don't we check ogl_bitmap->fbo_info? */ 9- if ((al_get_bitmap_flags(bitmap) & ALLEGRO_MIPMAP) && 10- al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object) 11- { 12+ //~ if ((al_get_bitmap_flags(bitmap) & ALLEGRO_MIPMAP) && 13+ //~ al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object) 14+ //~ { 15 glGenerateMipmapEXT(GL_TEXTURE_2D); 16 e = glGetError(); 17 if (e) { 18 ALLEGRO_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", 19 ogl_bitmap->texture, _al_gl_error_string(e)); 20 } 21- } 22+ //~ } 23 24 if (old_disp) { 25 _al_set_current_display_only(old_disp);

I should note that it's a little bizzare how there's no FBO extension...

jmasterx

Woo, that completely solved the problem!

So now the question is, how can this be implemented elegantly enough to be pushed to Allegro?

If you have some suggestions I'll be happy to send you a patch. In the state that it is in, it doesn't seem right because of the FBO stuff.

Though, if you made the patch and I tested it that would probably be better because the ide I use adds all kinds of tabs and such and I remember last time I contributed to Allegro this was a problem since Allegro uses space indentation.

I suspect what happens is, when GL_ES goes into PROGRAMMABLE_PIPELINE mode, then perhaps the old way of generating mipmaps becomes deprecated and it must go through the FBO extension method. Whereas when not using programmable pipeline, the GL_ES context is fine with using the old way of generating mipmaps.

SiegeLord

Yeah, so it's a little strange how you don't seem to have the FBO extension, yet the glGenerateMipmapEXT is loaded fine... I guess what could be done is to alter the check in `ogl_bitmap.c` from `if (post_generate_mipmap)` to `if (post_generate_mipmap && glGenerateMipmapExt != NULL)`. Then, if that call succeeds we could set a variable called generate_mipmaps_manually in ALLEGRO_BITMAP_EXTRA_OPENGL and then check that variable inside the unlocking code (and if its true, we call glGenerateMipmapExt again).

EDIT:

Actually, it occurs to me that the extension name might be different on GLES. Try this code:

if (al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object ||
    al_get_opengl_extension_list()->ALLEGRO_GL_OES_framebuffer_object) {
   post_generate_mipmap = true;
}

This is inside ogl_bitmap.c. This should trigger on the simulator and set post_generate_mipmap correctly.

EDIT2:

In fact, try the attached patch. If that works, then a combination of that patch and all the extra error checks you added would be great.

jmasterx

Unfortunately that extension does not appear to be = to 1.

Here is the extension list:

#SelectExpand
1ALLEGRO_GL_ARB_imaging int 0 0 2ALLEGRO_GL_ARB_multitexture int 1 1 3ALLEGRO_GL_ARB_transpose_matrix int 1 1 4ALLEGRO_GL_ARB_multisample int 1 1 5ALLEGRO_GL_ARB_texture_env_add int 1 1 6ALLEGRO_GL_ARB_texture_cube_map int 1 1 7ALLEGRO_GL_ARB_texture_compression int 1 1 8ALLEGRO_GL_ARB_texture_border_clamp int 1 1 9ALLEGRO_GL_ARB_point_parameters int 1 1 10ALLEGRO_GL_ARB_vertex_blend int 0 0 11ALLEGRO_GL_ARB_texture_env_combine int 1 1 12ALLEGRO_GL_ARB_texture_env_crossbar int 1 1 13ALLEGRO_GL_ARB_texture_env_dot3 int 1 1 14ALLEGRO_GL_ARB_texture_mirrored_repeat int 1 1 15ALLEGRO_GL_ARB_depth_texture int 1 1 16ALLEGRO_GL_ARB_shadow int 1 1 17ALLEGRO_GL_ARB_shadow_ambient int 0 0 18ALLEGRO_GL_ARB_window_pos int 1 1 19ALLEGRO_GL_ARB_vertex_program int 0 0 20ALLEGRO_GL_ARB_fragment_program int 0 0 21ALLEGRO_GL_ARB_vertex_buffer_object int 1 1 22ALLEGRO_GL_ARB_occlusion_query int 1 1 23ALLEGRO_GL_ARB_shader_objects int 0 0 24ALLEGRO_GL_ARB_vertex_shader int 0 0 25ALLEGRO_GL_ARB_fragment_shader int 0 0 26ALLEGRO_GL_ARB_shading_language_100 int 0 0 27ALLEGRO_GL_ARB_texture_non_power_of_two int 1 1 28ALLEGRO_GL_ARB_point_sprite int 1 1 29ALLEGRO_GL_ARB_fragment_program_shadow int 0 0 30ALLEGRO_GL_ARB_draw_buffers int 1 1 31ALLEGRO_GL_ARB_texture_rectangle int 0 0 32ALLEGRO_GL_ARB_color_buffer_float int 0 0 33ALLEGRO_GL_ARB_half_float_pixel int 0 0 34ALLEGRO_GL_ARB_texture_float int 0 0 35ALLEGRO_GL_ARB_pixel_buffer_object int 0 0 36ALLEGRO_GL_ARB_instanced_arrays int 0 0 37ALLEGRO_GL_ARB_draw_instanced int 0 0 38ALLEGRO_GL_ARB_geometry_shader4 int 0 0 39ALLEGRO_GL_ARB_texture_buffer_object int 0 0 40ALLEGRO_GL_ARB_depth_buffer_float int 0 0 41ALLEGRO_GL_ARB_framebuffer_object int 0 0 42ALLEGRO_GL_ARB_framebuffer_sRGB int 0 0 43ALLEGRO_GL_ARB_half_float_vertex int 0 0 44ALLEGRO_GL_ARB_map_buffer_range int 0 0 45ALLEGRO_GL_ARB_texture_compression_rgtc int 0 0 46ALLEGRO_GL_ARB_texture_rg int 0 0 47ALLEGRO_GL_ARB_vertex_array_object int 0 0 48ALLEGRO_GL_ARB_copy_buffer int 0 0 49ALLEGRO_GL_ARB_compatibility int 0 0 50ALLEGRO_GL_ARB_uniform_buffer_object int 0 0 51ALLEGRO_GL_ARB_shader_texture_lod int 0 0 52ALLEGRO_GL_ARB_depth_clamp int 0 0 53ALLEGRO_GL_ARB_draw_elements_base_vertex int 0 0 54ALLEGRO_GL_ARB_fragment_coord_conventions int 0 0 55ALLEGRO_GL_ARB_provoking_vertex int 0 0 56ALLEGRO_GL_ARB_seamless_cube_map int 0 0 57ALLEGRO_GL_ARB_sync int 0 0 58ALLEGRO_GL_ARB_texture_multisample int 0 0 59ALLEGRO_GL_ARB_vertex_array_bgra int 0 0 60ALLEGRO_GL_ARB_draw_buffers_blend int 0 0 61ALLEGRO_GL_ARB_sample_shading int 0 0 62ALLEGRO_GL_ARB_texture_cube_map_array int 0 0 63ALLEGRO_GL_ARB_texture_gather int 0 0 64ALLEGRO_GL_ARB_texture_query_lod int 0 0 65ALLEGRO_GL_ARB_shading_language_include int 0 0 66ALLEGRO_GL_ARB_texture_compression_bptc int 0 0 67ALLEGRO_GL_ARB_blend_func_extended int 0 0 68ALLEGRO_GL_ARB_explicit_attrib_location int 0 0 69ALLEGRO_GL_ARB_occlusion_query2 int 0 0 70ALLEGRO_GL_ARB_sampler_objects int 0 0 71ALLEGRO_GL_ARB_shader_bit_encoding int 0 0 72ALLEGRO_GL_ARB_texture_rgb10_a2ui int 0 0 73ALLEGRO_GL_ARB_texture_swizzle int 0 0 74ALLEGRO_GL_ARB_timer_query int 0 0 75ALLEGRO_GL_ARB_vertex_type_2_10_10_10_rev int 0 0 76ALLEGRO_GL_ARB_draw_indirect int 0 0 77ALLEGRO_GL_ARB_gpu_shader5 int 0 0 78ALLEGRO_GL_ARB_gpu_shader_fp64 int 0 0 79ALLEGRO_GL_ARB_shader_subroutine int 0 0 80ALLEGRO_GL_ARB_tessellation_shader int 0 0 81ALLEGRO_GL_ARB_texture_buffer_object_rgb32 int 0 0 82ALLEGRO_GL_ARB_transform_feedback2 int 0 0 83ALLEGRO_GL_ARB_transform_feedback3 int 0 0 84ALLEGRO_GL_EXT_abgr int 0 0 85ALLEGRO_GL_EXT_blend_color int 1 1 86ALLEGRO_GL_EXT_polygon_offset int 1 1 87ALLEGRO_GL_EXT_texture int 1 1 88ALLEGRO_GL_EXT_texture3D int 1 1 89ALLEGRO_GL_SGIS_texture_filter4 int 0 0 90ALLEGRO_GL_EXT_subtexture int 1 1 91ALLEGRO_GL_EXT_copy_texture int 1 1 92ALLEGRO_GL_EXT_histogram int 0 0 93ALLEGRO_GL_EXT_convolution int 0 0 94ALLEGRO_GL_SGI_color_matrix int 0 0 95ALLEGRO_GL_SGI_color_table int 0 0 96ALLEGRO_GL_SGIS_pixel_texture int 0 0 97ALLEGRO_GL_SGIX_pixel_texture int 0 0 98ALLEGRO_GL_SGIS_texture4D int 0 0 99ALLEGRO_GL_SGI_texture_color_table int 0 0 100ALLEGRO_GL_EXT_cmyka int 0 0 101ALLEGRO_GL_EXT_texture_object int 1 1 102ALLEGRO_GL_SGIS_detail_texture int 0 0 103ALLEGRO_GL_SGIS_sharpen_texture int 0 0 104ALLEGRO_GL_EXT_packed_pixels int 1 1 105ALLEGRO_GL_SGIS_texture_lod int 1 1 106ALLEGRO_GL_SGIS_multisample int 1 1 107ALLEGRO_GL_EXT_rescale_normal int 1 1 108ALLEGRO_GL_EXT_vertex_array int 1 1 109ALLEGRO_GL_EXT_misc_attribute int 0 0 110ALLEGRO_GL_SGIS_generate_mipmap int 1 1 111ALLEGRO_GL_SGIX_clipmap int 0 0 112ALLEGRO_GL_SGIX_shadow int 0 0 113ALLEGRO_GL_SGIS_texture_edge_clamp int 1 1 114ALLEGRO_GL_SGIS_texture_border_clamp int 0 0 115ALLEGRO_GL_EXT_blend_minmax int 1 1 116ALLEGRO_GL_EXT_blend_subtract int 0 0 117ALLEGRO_GL_EXT_blend_logic_op int 1 1 118ALLEGRO_GL_SGIX_interlace int 0 0 119ALLEGRO_GL_SGIS_texture_select int 0 0 120ALLEGRO_GL_SGIX_sprite int 0 0 121ALLEGRO_GL_SGIX_texture_multi_buffer int 0 0 122ALLEGRO_GL_EXT_point_parameters int 0 0 123ALLEGRO_GL_SGIX_instruments int 0 0 124ALLEGRO_GL_SGIX_texture_scale_bias int 0 0 125ALLEGRO_GL_SGIX_framezoom int 0 0 126ALLEGRO_GL_SGIX_tag_sample_buffer int 0 0 127ALLEGRO_GL_SGIX_reference_plane int 0 0 128ALLEGRO_GL_SGIX_flush_raster int 0 0 129ALLEGRO_GL_SGIX_depth_texture int 0 0 130ALLEGRO_GL_SGIS_fog_function int 0 0 131ALLEGRO_GL_SGIX_fog_offset int 0 0 132ALLEGRO_GL_HP_image_transform int 0 0 133ALLEGRO_GL_HP_convolution_border_modes int 0 0 134ALLEGRO_GL_SGIX_texture_add_env int 0 0 135ALLEGRO_GL_EXT_color_subtable int 0 0 136ALLEGRO_GL_PGI_vertex_hints int 0 0 137ALLEGRO_GL_PGI_misc_hints int 0 0 138ALLEGRO_GL_EXT_paletted_texture int 0 0 139ALLEGRO_GL_EXT_clip_volume_hint int 0 0 140ALLEGRO_GL_SGIX_list_priority int 0 0 141ALLEGRO_GL_SGIX_ir_instrument1 int 0 0 142ALLEGRO_GL_SGIX_texture_lod_bias int 0 0 143ALLEGRO_GL_SGIX_shadow_ambient int 0 0 144ALLEGRO_GL_EXT_index_texture int 0 0 145ALLEGRO_GL_EXT_index_material int 0 0 146ALLEGRO_GL_EXT_index_func int 0 0 147ALLEGRO_GL_EXT_index_array_formats int 0 0 148ALLEGRO_GL_EXT_compiled_vertex_array int 0 0 149ALLEGRO_GL_EXT_cull_vertex int 0 0 150ALLEGRO_GL_SGIX_ycrcb int 0 0 151ALLEGRO_GL_EXT_fragment_lighting int 0 0 152ALLEGRO_GL_IBM_rasterpos_clip int 0 0 153ALLEGRO_GL_HP_texture_lighting int 0 0 154ALLEGRO_GL_EXT_draw_range_elements int 0 0 155ALLEGRO_GL_WIN_phong_shading int 0 0 156ALLEGRO_GL_WIN_specular_fog int 0 0 157ALLEGRO_GL_EXT_light_texture int 0 0 158ALLEGRO_GL_SGIX_blend_alpha_minmax int 0 0 159ALLEGRO_GL_EXT_scene_marker int 0 0 160ALLEGRO_GL_SGIX_pixel_texture_bits int 0 0 161ALLEGRO_GL_EXT_bgra int 1 1 162ALLEGRO_GL_SGIX_async int 0 0 163ALLEGRO_GL_SGIX_async_pixel int 0 0 164ALLEGRO_GL_SGIX_async_histogram int 0 0 165ALLEGRO_GL_INTEL_texture_scissor int 0 0 166ALLEGRO_GL_INTEL_parallel_arrays int 0 0 167ALLEGRO_GL_HP_occlusion_test int 0 0 168ALLEGRO_GL_EXT_pixel_transform int 0 0 169ALLEGRO_GL_EXT_pixel_transform_color_table int 0 0 170ALLEGRO_GL_EXT_shared_texture_palette int 0 0 171ALLEGRO_GL_EXT_separate_specular_color int 1 1 172ALLEGRO_GL_EXT_secondary_color int 1 1 173ALLEGRO_GL_EXT_texture_env int 0 0 174ALLEGRO_GL_EXT_texture_perturb_normal int 0 0 175ALLEGRO_GL_EXT_multi_draw_arrays int 1 1 176ALLEGRO_GL_EXT_fog_coord int 1 1 177ALLEGRO_GL_REND_screen_coordinates int 0 0 178ALLEGRO_GL_EXT_coordinate_frame int 0 0 179ALLEGRO_GL_EXT_texture_env_combine int 0 0 180ALLEGRO_GL_APPLE_specular_vector int 0 0 181ALLEGRO_GL_APPLE_transform_hint int 0 0 182ALLEGRO_GL_SUNX_constant_data int 0 0 183ALLEGRO_GL_SUN_global_alpha int 0 0 184ALLEGRO_GL_SUN_triangle_list int 0 0 185ALLEGRO_GL_SUN_vertex int 0 0 186ALLEGRO_GL_EXT_blend_func_separate int 1 1 187ALLEGRO_GL_INGR_color_clamp int 0 0 188ALLEGRO_GL_INGR_interlace_read int 0 0 189ALLEGRO_GL_EXT_stencil_wrap int 1 1 190ALLEGRO_GL_EXT_422_pixels int 0 0 191ALLEGRO_GL_NV_texgen_reflection int 0 0 192ALLEGRO_GL_SGIX_texture_range int 0 0 193ALLEGRO_GL_SUN_convolution_border_modes int 0 0 194ALLEGRO_GL_EXT_texture_env_add int 0 0 195ALLEGRO_GL_EXT_texture_lod_bias int 1 1 196ALLEGRO_GL_EXT_texture_filter_anisotropic int 1 1 197ALLEGRO_GL_EXT_vertex_weighting int 0 0 198ALLEGRO_GL_NV_light_max_exponent int 0 0 199ALLEGRO_GL_NV_vertex_array_range int 0 0 200ALLEGRO_GL_NV_register_combiners int 0 0 201ALLEGRO_GL_NV_fog_distance int 0 0 202ALLEGRO_GL_NV_texgen_emboss int 0 0 203ALLEGRO_GL_NV_blend_square int 1 1 204ALLEGRO_GL_NV_texture_env_combine4 int 0 0 205ALLEGRO_GL_MESA_resize_buffers int 0 0 206ALLEGRO_GL_MESA_window_pos int 0 0 207ALLEGRO_GL_EXT_texture_compression_s3tc int 0 0 208ALLEGRO_GL_IBM_cull_vertex int 0 0 209ALLEGRO_GL_IBM_multimode_draw_arrays int 0 0 210ALLEGRO_GL_IBM_vertex_array_lists int 0 0 211ALLEGRO_GL_3DFX_texture_compression_FXT1 int 0 0 212ALLEGRO_GL_3DFX_multisample int 0 0 213ALLEGRO_GL_3DFX_tbuffer int 0 0 214ALLEGRO_GL_SGIX_vertex_preclip int 0 0 215ALLEGRO_GL_SGIX_resample int 0 0 216ALLEGRO_GL_SGIS_texture_color_mask int 0 0 217ALLEGRO_GL_EXT_texture_env_dot3 int 0 0 218ALLEGRO_GL_ATI_texture_mirror_once int 0 0 219ALLEGRO_GL_NV_fence int 0 0 220ALLEGRO_GL_IBM_static_data int 0 0 221ALLEGRO_GL_IBM_texture_mirrored_repeat int 0 0 222ALLEGRO_GL_NV_evaluators int 0 0 223ALLEGRO_GL_NV_packed_depth_stencil int 0 0 224ALLEGRO_GL_NV_register_combiners2 int 0 0 225ALLEGRO_GL_NV_texture_compression_vtc int 0 0 226ALLEGRO_GL_NV_texture_rectangle int 0 0 227ALLEGRO_GL_NV_texture_shader int 0 0 228ALLEGRO_GL_NV_texture_shader2 int 0 0 229ALLEGRO_GL_NV_vertex_array_range2 int 0 0 230ALLEGRO_GL_NV_vertex_program int 0 0 231ALLEGRO_GL_SGIX_texture_coordinate_clamp int 0 0 232ALLEGRO_GL_OML_interlace int 0 0 233ALLEGRO_GL_OML_subsample int 0 0 234ALLEGRO_GL_OML_resample int 0 0 235ALLEGRO_GL_NV_copy_depth_to_color int 0 0 236ALLEGRO_GL_ATI_envmap_bumpmap int 0 0 237ALLEGRO_GL_ATI_fragment_shader int 0 0 238ALLEGRO_GL_ATI_pn_triangles int 0 0 239ALLEGRO_GL_ATI_vertex_array_object int 0 0 240ALLEGRO_GL_EXT_vertex_shader int 0 0 241ALLEGRO_GL_ATI_vertex_streams int 0 0 242ALLEGRO_GL_ATI_element_array int 0 0 243ALLEGRO_GL_SUN_mesh_array int 0 0 244ALLEGRO_GL_SUN_slice_accum int 0 0 245ALLEGRO_GL_NV_multisample_filter_hint int 0 0 246ALLEGRO_GL_NV_depth_clamp int 0 0 247ALLEGRO_GL_NV_occlusion_query int 0 0 248ALLEGRO_GL_NV_point_sprite int 0 0 249ALLEGRO_GL_NV_texture_shader3 int 0 0 250ALLEGRO_GL_NV_vertex_program1_1 int 0 0 251ALLEGRO_GL_EXT_shadow_funcs int 1 1 252ALLEGRO_GL_EXT_stencil_two_side int 0 0 253ALLEGRO_GL_ATI_text_fragment_shader int 0 0 254ALLEGRO_GL_APPLE_client_storage int 0 0 255ALLEGRO_GL_APPLE_element_array int 0 0 256ALLEGRO_GL_APPLE_fence int 0 0 257ALLEGRO_GL_APPLE_vertex_array_object int 0 0 258ALLEGRO_GL_APPLE_vertex_array_range int 0 0 259ALLEGRO_GL_APPLE_ycbcr_422 int 0 0 260ALLEGRO_GL_S3_s3tc int 0 0 261ALLEGRO_GL_ATI_draw_buffers int 0 0 262ALLEGRO_GL_ATI_texture_env_combine3 int 0 0 263ALLEGRO_GL_ATI_texture_float int 0 0 264ALLEGRO_GL_NV_float_buffer int 0 0 265ALLEGRO_GL_NV_fragment_program int 0 0 266ALLEGRO_GL_NV_half_float int 0 0 267ALLEGRO_GL_NV_pixel_data_range int 0 0 268ALLEGRO_GL_NV_primitive_restart int 0 0 269ALLEGRO_GL_NV_texture_expand_normal int 0 0 270ALLEGRO_GL_NV_vertex_program2 int 0 0 271ALLEGRO_GL_ATI_map_object_buffer int 0 0 272ALLEGRO_GL_ATI_separate_stencil int 1 1 273ALLEGRO_GL_ATI_vertex_attrib_array_object int 0 0 274ALLEGRO_GL_OES_byte_coordinates int 0 0 275ALLEGRO_GL_OES_fixed_point int 0 0 276ALLEGRO_GL_OES_single_precision int 0 0 277ALLEGRO_GL_OES_compressed_paletted_texture int 0 0 278ALLEGRO_GL_OES_read_format int 0 0 279ALLEGRO_GL_OES_query_matrix int 0 0 280ALLEGRO_GL_OES_framebuffer_object int 0 0 281ALLEGRO_GL_OES_texture_npot int 0 0 282ALLEGRO_GL_EXT_depth_bounds_test int 0 0 283ALLEGRO_GL_EXT_texture_mirror_clamp int 0 0 284ALLEGRO_GL_EXT_blend_equation_separate int 0 0 285ALLEGRO_GL_MESA_pack_invert int 0 0 286ALLEGRO_GL_MESA_ycbcr_texture int 0 0 287ALLEGRO_GL_EXT_pixel_buffer_object int 0 0 288ALLEGRO_GL_NV_fragment_program_option int 0 0 289ALLEGRO_GL_NV_fragment_program2 int 0 0 290ALLEGRO_GL_NV_vertex_program2_option int 0 0 291ALLEGRO_GL_NV_vertex_program3 int 0 0 292ALLEGRO_GL_EXT_texture_compression_dxt1 int 0 0 293ALLEGRO_GL_EXT_framebuffer_object int 0 0 294ALLEGRO_GL_GREMEDY_string_marker int 0 0 295ALLEGRO_GL_EXT_packed_depth_stencil int 0 0 296ALLEGRO_GL_EXT_stencil_clear_tag int 0 0 297ALLEGRO_GL_EXT_texture_sRGB int 0 0 298ALLEGRO_GL_EXT_framebuffer_blit int 0 0 299ALLEGRO_GL_EXT_framebuffer_multisample int 0 0 300ALLEGRO_GL_MESAX_texture_stack int 0 0 301ALLEGRO_GL_EXT_timer_query int 0 0 302ALLEGRO_GL_EXT_gpu_program_parameters int 0 0 303ALLEGRO_GL_APPLE_flush_buffer_range int 0 0 304ALLEGRO_GL_EXT_bindable_uniform int 0 0 305ALLEGRO_GL_EXT_draw_buffers2 int 0 0 306ALLEGRO_GL_EXT_draw_instanced int 1 1 307ALLEGRO_GL_EXT_framebuffer_sRGB int 0 0 308ALLEGRO_GL_EXT_geometry_shader4 int 0 0 309ALLEGRO_GL_EXT_gpu_shader4 int 0 0 310ALLEGRO_GL_EXT_packed_float int 0 0 311ALLEGRO_GL_EXT_texture_array int 0 0 312ALLEGRO_GL_EXT_texture_buffer_object int 0 0 313ALLEGRO_GL_EXT_texture_compression_latc int 0 0 314ALLEGRO_GL_EXT_texture_compression_rgtc int 0 0 315ALLEGRO_GL_EXT_texture_integer int 0 0 316ALLEGRO_GL_EXT_texture_shared_exponent int 0 0 317ALLEGRO_GL_NV_depth_buffer_float int 0 0 318ALLEGRO_GL_NV_fragment_program4 int 0 0 319ALLEGRO_GL_NV_framebuffer_multisample_coverage int 0 0 320ALLEGRO_GL_NV_geometry_program4 int 0 0 321ALLEGRO_GL_NV_gpu_program4 int 0 0 322ALLEGRO_GL_NV_parameter_buffer_object int 0 0 323ALLEGRO_GL_NV_transform_feedback int 0 0 324ALLEGRO_GL_NV_vertex_program4 int 0 0 325ALLEGRO_GL_GREMEDY_frame_terminator int 0 0 326ALLEGRO_GL_NV_conditional_render int 0 0 327ALLEGRO_GL_NV_present_video int 0 0 328ALLEGRO_GL_EXT_direct_state_access int 0 0 329ALLEGRO_GL_EXT_transform_feedback int 0 0 330ALLEGRO_GL_EXT_texture_swizzle int 0 0 331ALLEGRO_GL_NV_explicit_multisample int 0 0 332ALLEGRO_GL_NV_transform_feedback2 int 0 0 333ALLEGRO_GL_ATI_meminfo int 0 0 334ALLEGRO_GL_AMD_performance_monitor int 0 0 335ALLEGRO_GL_AMD_texture_texture4 int 0 0 336ALLEGRO_GL_AMD_vertex_shader_tesselator int 0 0 337ALLEGRO_GL_EXT_provoking_vertex int 0 0 338ALLEGRO_GL_EXT_texture_snorm int 0 0 339ALLEGRO_GL_AMD_draw_buffers_blend int 0 0 340ALLEGRO_GL_APPLE_texture_range int 0 0 341ALLEGRO_GL_APPLE_float_pixels int 0 0 342ALLEGRO_GL_APPLE_vertex_program_evaluators int 0 0 343ALLEGRO_GL_APPLE_aux_depth_stencil int 0 0 344ALLEGRO_GL_APPLE_object_purgeable int 0 0 345ALLEGRO_GL_APPLE_row_bytes int 0 0 346ALLEGRO_GL_APPLE_rgb_422 int 1 1 347ALLEGRO_GL_NV_video_capture int 0 0 348ALLEGRO_GL_EXT_separate_shader_objects int 1 1 349ALLEGRO_GL_NV_parameter_buffer_object2 int 0 0 350ALLEGRO_GL_NV_shader_buffer_load int 0 0 351ALLEGRO_GL_NV_vertex_buffer_unified_memory int 0 0 352ALLEGRO_GL_NV_texture_barrier int 0 0 353ALLEGRO_GL_AMD_shader_stencil_export int 0 0 354ALLEGRO_GL_AMD_seamless_cubemap_per_texture int 0 0 355ALLEGRO_GL_AMD_conservative_depth int 0 0

If you see a 1 then it has it.

The extension we desire says 0:

 ALLEGRO_GL_OES_framebuffer_object  int  0  0

I wonder if this is an allegro problem or a simulator problem... it clearly has the extension but it says it does not....

This guy here uses the simulator and oes_framebuffer is supported for him on simulator... http://forum.openscenegraph.org/viewtopic.php?t=9063

Which leads me to think maybe allegro is not reporting correctly...

EDIT:

The extension string returns this:

#SelectExpand
1GL_OES_depth_texture GL_OES_depth24 GL_OES_element_index_uint 2 3GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil 4 5GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float 6 7GL_OES_texture_half_float GL_OES_texture_half_float_linear 8 9GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_color_buffer_half_float 10 11GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer 12 13GL_EXT_draw_instanced GL_EXT_instanced_arrays GL_EXT_map_buffer_range 14 15GL_EXT_occlusion_query_boolean GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra 16 17GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch 18 19GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_sRGB 20 21GL_EXT_texture_filter_anisotropic GL_EXT_texture_rg GL_EXT_texture_storage 22 23GL_APPLE_copy_texture_levels GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 24 25GL_APPLE_sync GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level 26 27GL_IMG_read_format GL_IMG_texture_compression_pvrtc

which has GL_OES_fbo_render_mipmap ...
It looks like Allegro does not check for that extension but I bet that's the one we need to use...

Edit:
actually GL_OES_fbo_render_mipmap does not do what I thought it did... but it's weird that the simulator is not saying it supports fbos

SiegeLord

Can you check what GLES version you have? Perhaps printing the output of glGetString(GL_VERSION)? What I think might be happening is that you have a relatively new version of GLES that has the extension built into the core API.

jmasterx

OpenGL ES 2.0 APPLE-10.1.5

I'm using xcode 6.1 and the ios 7 and ios 8 simulator on mac os x 10.9.4

Where should I check for the core api thing?

SiegeLord

No, the 2.0 gave me all the information I needed. If you look in the specification, GLES 2.0 has the frame buffer objects included in the core API. Allegro's extension loading mechanism, however, doesn't realize that and still tries to load it. The code for all of this is in opengl/extensions.c but it's not super-simple.

What is done for desktop GL, is that we parse the GL_VERSION string and get the version number. Then whenever checking for an extension, we check to see if its version is below the OpenGL version, and if so we just return true. The version parsing is not implemented for the GLES, and so if you look at all the GLES extensions (allegro5/opengl/GLext/gl_ext_list.h), they'll have a bogus OpenGL version (e.g. AGL_EXT(OES_framebuffer_object, 0)).

So what would need to be done is for all of those extensions to get proper versions (I'm not sure where to find that information) and for the GLES version parsing to be implemented as well.

jmasterx

Is my best bet to recompile allegro for GLES1 or is there some way we could 'fix' the mipmapping issue for now the way things currently work?

I guess we could do:
if mipmap fails, check to see if glGenerateMipmap is not null, if it is not null then we set post_gen_mipmap to true and if that is true we have an ogl_extra flag for needs_to_regen_mipmap and rather than check for the extension in gles_lock we check this flag.

I think that would work in theory. If adding a flag sound like a bad idea then in gles_lock we add || glGenerateMipmap != NULL or something...

SiegeLord

The 'proper' hack right now would be to apply the same patch as I made a post before but add a IS_OPENGLES || condition to it, as is done in a few other spots already (and please add a /* FIXME */ comment above :P).

jmasterx

I have attached 2 patches. The first is the fix as you described. I tested it as much as I could on the simulator and everything seems to be working correctly. I have not tested with GL_ES_1 but I do not see why that would not work.

The second patch fixes the iOS port crashing when iOS terminates your app. Trent in this commit https://github.com/liballeg/allegro5/commit/f6d9508941fab628c210007d23a55acdfdc821cf removed a selector called remove_observers, but it was still being called when the app is terminated.

Edit:
I bought an iPad 4th gen, and tested these changes. Everything works great on a real iPad.

SiegeLord

Awesome! I'm a bit busy right now, but I'll definitely take care of these patches this weekend. Thanks for your help!

EDIT: Now commited with one (hopefully) minor fix.

jmasterx

Thanks, that change is fine, no issues. My reason for keeping it in there was thinking maybe eventually when allegro correctly detects the es version, it can work that way but I guess the ext version will pick up the slack in that case.

Thread #615066. Printed from Allegro.cc