Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srgb unsupported on Vivante openGL (embedded) #1991

Closed
flukejones opened this issue Aug 31, 2022 · 7 comments · Fixed by #2007
Closed

srgb unsupported on Vivante openGL (embedded) #1991

flukejones opened this issue Aug 31, 2022 · 7 comments · Fixed by #2007

Comments

@flukejones
Copy link
Contributor

I'm trying to prototype use of egui on an STM32MP1 based board here at work to try and move off QT and C++. I notice that in many cases egui defaults to use of SRGB format - for example in the egui_glium crate, painter uses SrgbFormat.

If I try to use other integrations such as glow or eframe I get a blank window (except for shader path), which I'm assuming is due to this.

The following is a dump of info:

GL version = 2.0

[egui/crates/egui_glium/src/painter.rs:258] facade.get_capabilities() = Capabilities {
    supported_glsl_versions: [
        Version(
            GlEs,
            1,
            0,
        ),
        Version(
            Gl,
            1,
            1,
        ),
    ],
    version: "2.0 Mesa 22.1.6",
    vendor: "etnaviv",
    renderer: "Vivante GC400 rev 4652",
    profile: None,
    debug: false,
    forward_compatible: false,
    robustness: false,
    can_lose_context: false,
    release_behavior: Flush,
    stereo: false,
    srgb: false,
    depth_bits: Some(
        24,
    ),
    stencil_bits: Some(
        8,
    ),
    internal_formats_textures: {
        DepthFormat(
            I32,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U12U12U12U12,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        DepthFormat(
            I16,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U2U2U2U2,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U5U5U5U1,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U12U12U12,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U3U3U2,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        DepthStencilFormat(
            I24I8,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U5U5U5,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U8U8U8U8,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        DepthFormat(
            I24,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U10U10U10U2,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U4U4U4U4,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U10U10U10,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U4U4U4,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U16U16U16U16,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
        UncompressedFloat(
            U8U8U8,
        ): FormatInfos {
            multisamples: Some(
                [],
            ),
        },
    },
    internal_formats_renderbuffers: {
        DepthFormat(
            I32,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U12U12U12U12,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        DepthFormat(
            I16,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U2U2U2U2,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        StencilFormat(
            I1,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U5U5U5U1,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U12U12U12,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U3U3U2,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        DepthStencilFormat(
            I24I8,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U5U5U5,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U8U8U8U8,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        DepthFormat(
            I24,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U10U10U10U2,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        StencilFormat(
            I4,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        StencilFormat(
            I16,
        ): FormatInfos {
            multisamples: Some(
                [
                    16,
                    15,
                    14,
                    13,
                    12,
                    11,
                    10,
                    9,
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                ],
            ),
        },
        UncompressedFloat(
            U4U4U4U4,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U10U10U10,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U4U4U4,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U16U16U16U16,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
        UncompressedFloat(
            U8U8U8,
        ): FormatInfos {
            multisamples: Some(
                [
                    1,
                ],
            ),
        },
    },
    max_combined_texture_image_units: 8,
    max_texture_max_anisotropy: None,
    max_texture_size: 8192,
    max_texture_buffer_size: None,
    max_viewport_dims: (
        8192,
        8192,
    ),
    max_draw_buffers: 1,
    max_patch_vertices: None,
    max_indexed_atomic_counter_buffer: 0,
    max_indexed_shader_storage_buffer: 0,
    max_indexed_transform_feedback_buffer: 0,
    max_indexed_uniform_buffer: 0,
    max_compute_work_group_count: (
        0,
        0,
        0,
    ),
    max_color_attachments: 1,
    max_framebuffer_width: None,
    max_framebuffer_height: None,
    max_framebuffer_layers: None,
    max_framebuffer_samples: None,
[egui/crates/egui_glium/src/painter.rs:259] facade.get_extensions() = ExtensionsList {
    gl_amd_depth_clamp_separate: false,
    gl_amd_query_buffer_object: false,
    gl_angle_framebuffer_multisample: false,
    gl_apple_framebuffer_multisample: false,
    gl_apple_sync: false,
    gl_apple_vertex_array_object: false,
    gl_arb_bindless_texture: false,
    gl_arb_buffer_storage: false,
    gl_arb_compute_shader: false,
    gl_arb_copy_buffer: true,
    gl_arb_debug_output: true,
    gl_arb_depth_clamp: false,
    gl_arb_depth_texture: true,
    gl_arb_direct_state_access: false,
    gl_arb_draw_buffers: true,
    gl_arb_draw_elements_base_vertex: true,
    gl_arb_compatibility: false,
    gl_arb_es2_compatibility: true,
    gl_arb_es3_compatibility: false,
    gl_arb_es3_1_compatibility: false,
    gl_arb_es3_2_compatibility: false,
    gl_arb_fragment_shader: true,
    gl_arb_framebuffer_no_attachments: false,
    gl_arb_framebuffer_object: true,
    gl_arb_framebuffer_srgb: false,
    gl_arb_geometry_shader4: false,
    gl_arb_get_programy_binary: true,
    gl_arb_gl_spirv: false,
    gl_arb_gpu_shader_fp64: false,
    gl_arb_gpu_shader_int64: false,
    gl_arb_instanced_arrays: false,
    gl_arb_internalformat_query: true,
    gl_arb_invalidate_subdata: true,
    gl_arb_occlusion_query: true,
    gl_arb_occlusion_query2: false,
    gl_arb_pixel_buffer_object: true,
    gl_arb_program_interface_query: true,
    gl_arb_query_buffer_object: false,
    gl_arb_map_buffer_range: true,
    gl_arb_multi_draw_indirect: false,
    gl_arb_provoking_vertex: true,
    gl_arb_robustness: true,
    gl_arb_robust_buffer_access_behavior: false,
    gl_arb_sampler_objects: true,
    gl_arb_seamless_cube_map: false,
    gl_arb_shader_atomic_counters: false,
    gl_arb_shader_image_load_store: false,
    gl_arb_shader_objects: true,
    gl_arb_shader_storage_buffer_object: false,
    gl_arb_shader_subroutine: false,
    gl_arb_sync: true,
    gl_arb_tessellation_shader: false,
    gl_arb_texture_buffer_object: false,
    gl_arb_texture_buffer_object_rgb32: false,
    gl_arb_texture_compression_bptc: false,
    gl_arb_texture_cube_map: true,
    gl_arb_texture_cube_map_array: false,
    gl_arb_texture_float: false,
    gl_arb_texture_multisample: false,
    gl_arb_texture_non_power_of_two: true,
    gl_arb_texture_rg: false,
    gl_arb_texture_rgb10_a2ui: false,
    gl_arb_texture_stencil8: false,
    gl_arb_texture_storage: true,
    gl_arb_timer_query: false,
    gl_arb_transform_feedback3: false,
    gl_arb_uniform_buffer_object: false,
    gl_arb_vertex_array_object: true,
    gl_arb_vertex_buffer_object: true,
    gl_arb_vertex_half_float: false,
    gl_arb_vertex_shader: true,
    gl_arb_vertex_type_10f_11f_11f_rev: false,
    gl_arb_vertex_type_2_10_10_10_rev: false,
    gl_arm_rgba8: false,
    gl_ati_meminfo: false,
    gl_ati_draw_buffers: true,
    gl_ati_texture_float: false,
    gl_ext_blend_minmax: true,
    gl_ext_buffer_storage: false,
    gl_ext_debug_marker: false,
    gl_ext_direct_state_access: true,
    gl_ext_memory_object: false,
    gl_ext_memory_object_fd: false,
    gl_ext_disjoint_timer_query: false,
    gl_ext_framebuffer_blit: true,
    gl_ext_framebuffer_object: true,
    gl_ext_framebuffer_multisample: false,
    gl_ext_framebuffer_srgb: false,
    gl_ext_geometry_shader: false,
    gl_ext_geometry_shader4: false,
    gl_ext_gpu_shader4: false,
    gl_ext_multi_draw_indirect: false,
    gl_ext_multisampled_render_to_texture: false,
    gl_ext_occlusion_query_boolean: false,
    gl_ext_packed_depth_stencil: true,
    gl_ext_packed_float: false,
    gl_ext_primitive_bounding_box: false,
    gl_ext_provoking_vertex: true,
    gl_ext_robustness: false,
    gl_ext_srgb_write_control: false,
    gl_ext_texture3d: true,
    gl_ext_semaphore: false,
    gl_ext_semaphore_fd: false,
    gl_ext_texture_array: true,
    gl_ext_texture_buffer: false,
    gl_ext_texture_buffer_object: false,
    gl_ext_texture_compression_s3tc: false,
    gl_ext_texture_cube_map: true,
    gl_ext_texture_cube_map_array: false,
    gl_ext_texture_filter_anisotropic: false,
    gl_ext_texture_integer: false,
    gl_ext_texture_shared_exponent: false,
    gl_ext_texture_snorm: false,
    gl_ext_texture_srgb: false,
    gl_ext_transform_feedback: false,
    gl_gremedy_string_marker: false,
    gl_khr_debug: true,
    gl_khr_context_flush_control: true,
    gl_khr_robustness: false,
    gl_khr_robust_buffer_access_behavior: false,
    gl_nv_fbo_color_attachments: false,
    gl_nv_conditional_render: false,
    gl_nv_copy_buffer: false,
    gl_nv_depth_clamp: false,
    gl_nv_framebuffer_multisample: false,
    gl_nv_half_float: true,
    gl_nv_internalformat_sample_query: false,
    gl_nv_pixel_buffer_object: false,
    gl_nv_read_depth: false,
    gl_nv_read_stencil: false,
    gl_nv_read_depth_stencil: false,
    gl_nv_shader_atomic_counters: false,
    gl_nv_shader_storage_buffer_object: false,
    gl_nv_texture_array: false,
    gl_nv_transform_feedback: false,
    gl_nv_vertex_attrib_integer_64bit: false,
    gl_nvx_gpu_memory_info: false,
    gl_oes_depth_texture: false,
    gl_oes_draw_elements_base_vertex: false,
    gl_oes_element_index_uint: false,
    gl_oes_fixed_point: false,
    gl_oes_geometry_shader: false,
    gl_oes_packed_depth_stencil: false,
    gl_oes_primitive_bounding_box: false,
    gl_oes_rgb8_rgba8: false,
    gl_oes_stencil1: false,
    gl_oes_stencil4: false,
    gl_oes_tessellation_shader: false,
    gl_oes_texture_3d: false,
    gl_oes_texture_buffer: false,
    gl_oes_texture_cube_map_array: false,
    gl_oes_texture_stencil8: false,
    gl_oes_texture_storage_multisample_2d_array: false,
    gl_oes_vertex_array_object: false,
    gl_oes_vertex_half_float: false,
    gl_oes_vertex_type_10_10_10_2: false,
}

I'm willing to put in the work, I'm just unsure where to start.

@coderedart
Copy link
Contributor

In order to narrow down the cause,

  1. you can try using white theme (egui::Visuals::light()) just to check that egui rendering is working.
    your window might not actually be empty (black), but just that due color mixing issues, dark theme just appears black? if it works, then, its an srgb rendering issue.
  2. try running https://github.com/emilk/egui/tree/master/examples/custom_3d_glow to draw a custom triangle to again check that glow is actually rendering to the screen (regardless of whether egui pipeline working properly). if you can see triangle, its an egui rendering issue on old opengl 2.0.
  3. try running a basic triangle without egui https://github.com/grovesNL/glow/tree/main/examples/hello just to be sure that its not a glow issue. most people test with GL ES 3, but GL 2.0 is too old and might need workarounds.

screen shots might help :)

@flukejones
Copy link
Contributor Author

1. you can try using white theme (`egui::Visuals::light()`) just to check that egui rendering is working.
   your window might not actually be empty (black), but just that due color mixing issues, dark theme just appears black? if it works, then, its an srgb rendering issue.

Totally dark. As in it looks like nothing is drawn to twhe window (using eframe)

2. try running https://github.com/emilk/egui/tree/master/examples/custom_3d_glow to draw a custom triangle to again check that glow is actually rendering to the screen (regardless of whether egui pipeline working properly). if you can see triangle, its an egui rendering issue on old opengl 2.0.

Had to change it up a bit due to shader version but yeah, triangles draw fine. Same is true for the basic hello-triangle in glium examples.

3. try running a basic triangle without egui https://github.com/grovesNL/glow/tree/main/examples/hello just to be sure that its not a glow issue.  most people test with GL ES 3, but GL 2.0 is too old and might need workarounds.

A quick shader adjustment to fill the BG with blue instead to verify, yeah, that runs fine. Same is true for glium

screen shots might help :)

Gonna have to be photos. But I'll see if I can get remote display working.

This is what glow tells me in dbg:

[src/main.rs:19] window.get_api() = OpenGl
[src/main.rs:20] window.get_pixel_format() = PixelFormat {
    hardware_accelerated: true,
    color_bits: 24,
    alpha_bits: 8,
    depth_bits: 24,
    stencil_bits: 8,
    stereoscopy: false,
    double_buffer: true,
    multisampling: None,
    srgb: false,
}

weston log:

[01:46:21.355] weston 10.0.1
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 2022.08-rc1-159-g5894ab0107+
[01:46:21.355] Command line: /usr/bin/weston
[01:46:21.356] OS: Linux, 5.10.116, #1 SMP PREEMPT Wed Aug 31 18:57:39 NZST 2022, armv7l
[01:46:21.356] Flight recorder: enabled
[01:46:21.358] warning: XDG_RUNTIME_DIR "/tmp/wayland" is not configured
correctly.  Unix access mode must be 0700 (current mode is 0755),
and must be owned by the user UID 0 (current owner is UID 0).
Refer to your distribution on how to get it, or
http://www.freedesktop.org/wiki/Specifications/basedir-spec
on how to implement it.
[01:46:21.362] Using config file '/etc/xdg/weston/weston.ini'
[01:46:21.364] Output repaint window is 5 ms maximum.
[01:46:21.365] Loading module '/usr/lib/libweston-10/drm-backend.so'
[01:46:21.370] initializing drm backend
[01:46:21.371] Trying weston_launch launcher...
[01:46:21.378] using /dev/dri/card1
[01:46:21.380] DRM: supports atomic modesetting
[01:46:21.380] DRM: supports GBM modifiers
[01:46:21.381] DRM: supports picture aspect ratio
[01:46:21.382] Loading module '/usr/lib/libweston-10/gl-renderer.so'
[01:46:21.485] EGL client extensions: EGL_EXT_device_base
               EGL_EXT_device_enumeration EGL_EXT_device_query
               EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses
               EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device
               EGL_EXT_platform_wayland EGL_KHR_platform_wayland
               EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_xcb
               EGL_MESA_platform_gbm EGL_KHR_platform_gbm
               EGL_MESA_platform_surfaceless
[01:46:21.499] EGL device extensions: EGL_EXT_device_drm
[01:46:21.500] EGL version: 1.4
[01:46:21.501] EGL vendor: Mesa Project
[01:46:21.502] EGL client APIs: OpenGL OpenGL_ES 
[01:46:21.503] EGL extensions: EGL_ANDROID_blob_cache
               EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age
               EGL_EXT_image_dma_buf_import
               EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2
               EGL_KHR_config_attribs EGL_KHR_create_context
               EGL_KHR_create_context_no_error EGL_KHR_fence_sync
               EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image
               EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
               EGL_KHR_gl_texture_cubemap_image EGL_KHR_image
               EGL_KHR_image_base EGL_KHR_image_pixmap
               EGL_KHR_no_config_context EGL_KHR_reusable_sync
               EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float
               EGL_KHR_wait_sync EGL_MESA_configless_context
               EGL_MESA_drm_image EGL_MESA_image_dma_buf_export
               EGL_MESA_query_driver EGL_WL_bind_wayland_display
[01:46:21.513] EGL_KHR_surfaceless_context available
[01:46:21.531] GL version: OpenGL ES 2.0 Mesa 22.1.6
[01:46:21.532] GLSL version: OpenGL ES GLSL ES 1.0.16
[01:46:21.533] GL vendor: etnaviv
[01:46:21.534] GL renderer: Vivante GC400 rev 4652
[01:46:21.535] GL extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays
               GL_EXT_texture_format_BGRA8888
               GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24
               GL_OES_element_index_uint GL_OES_fbo_render_mipmap
               GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
               GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot
               GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture
               GL_AMD_performance_monitor GL_OES_packed_depth_stencil
               GL_OES_get_program_binary GL_APPLE_texture_max_level
               GL_EXT_discard_framebuffer GL_EXT_read_format_bgra
               GL_NV_pack_subimage GL_EXT_frag_depth
               GL_NV_fbo_color_attachments GL_OES_EGL_image_external
               GL_OES_EGL_sync GL_OES_vertex_array_object
               GL_ANGLE_pack_reverse_row_order GL_EXT_unpack_subimage
               GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth
               GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers
               GL_EXT_map_buffer_range GL_KHR_debug GL_NV_pixel_buffer_object
               GL_OES_required_internalformat GL_OES_surfaceless_context
               GL_EXT_separate_shader_objects
               GL_EXT_compressed_ETC1_RGB8_sub_texture
               GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp
               GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex
               GL_OES_texture_border_clamp GL_KHR_no_error
               GL_KHR_parallel_shader_compile GL_INTEL_blackhole_render
               GL_MESA_bgra
[01:46:21.616] GL ES 2.0 - renderer features:
               read-back format: BGRA

so, GL_EXT_texture_format_BGRA8888?

@coderedart
Copy link
Contributor

what does egui-glow output when running with RUST_LOG=debug?

egui debugs shader version + srgb support etc..

@ar37-rs
Copy link
Contributor

ar37-rs commented Sep 1, 2022

Related to #1982

@flukejones
Copy link
Contributor Author

flukejones commented Sep 2, 2022

Debug output is:

# 2000-01-01T21:57:31.994420Z DEBUG eframe: Using the glow renderer
xkbcommon: ERROR: couldn't find a Compose file for locale "C" (mapped to "C")
2000-01-01T21:57:32.005321Z DEBUG eframe::native::run: event_loop.run_return
2000-01-01T21:57:32.060513Z DEBUG crossfont::ft: Loaded Face Face { ft_face: Font Face: Book, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 }    
2000-01-01T21:57:32.249489Z DEBUG egui_glow::shader_version: Shader version: Gl120 ("1.20").
2000-01-01T21:57:32.249680Z DEBUG egui_glow::painter: Shader header: "#version 120\n".
2000-01-01T21:57:32.322541Z DEBUG egui_glow::vao: GL version: "2.0 Mesa 22.1.6".
2000-01-01T21:57:32.322765Z DEBUG egui_glow::vao: Supported OpenGL extensions: {"GL_EXT_subtexture", "GL_EXT_compiled_vertex_array", "GL_SGIS_texture_edge_clamp", "GL_ARB_texture_non_power_of_two", "GL_EXT_texture_env_dot3", "GL_EXT_texture_cube_map", "GL_ARB_fragment_shader", "GL_EXT_secondary_color", "GL_ARB_framebuffer_object", "GL_ARB_vertex_shader", "GL_ARB_shading_language_include", "GL_ARB_texture_barrier", "GL_EXT_blend_subtract", "GL_ARB_vertex_buffer_object", "GL_ARB_internalformat_query", "GL_EXT_texture_env_combine", "GL_EXT_bgra", "GL_ARB_point_parameters", "GL_ATI_blend_equation_separate", "GL_ARB_parallel_shader_compile", "GL_ARB_map_buffer_range", "GL_SGIS_texture_border_clamp", "GL_ARB_window_pos", "GL_MESA_ycbcr_texture", "GL_ARB_draw_elements_base_vertex", "GL_KHR_context_flush_control", "GL_EXT_direct_state_access", "GL_EXT_texture", "GL_ARB_shader_texture_lod", "GL_NV_half_float", "GL_ARB_shadow", "GL_MESA_pack_invert", "GL_ARB_vertex_array_object", "GL_EXT_blend_func_separate", "GL_ARB_copy_buffer", "GL_NV_texture_env_combine4", "GL_KHR_no_error", "GL_EXT_draw_range_elements", "GL_EXT_separate_specular_color", "GL_EXT_packed_depth_stencil", "GL_ARB_half_float_pixel", "GL_ARB_half_float_vertex", "GL_ARB_get_program_binary", "GL_ARB_invalidate_subdata", "GL_ATI_fragment_shader", "GL_EXT_blend_minmax", "GL_ARB_occlusion_query", "GL_ARB_draw_buffers", "GL_ATI_texture_env_combine3", "GL_ARB_robustness", "GL_ARB_multisample", "GL_ARB_texture_env_crossbar", "GL_ARB_depth_texture", "GL_EXT_blend_equation_separate", "GL_ARB_separate_shader_objects", "GL_EXT_texture_object", "GL_EXT_EGL_sync", "GL_INGR_blend_func_separate", "GL_SUN_multi_draw_arrays", "GL_KHR_debug", "GL_ARB_multitexture", "GL_ARB_texture_rectangle", "GL_AMD_shader_trinary_minmax", "GL_EXT_stencil_wrap", "GL_ATI_draw_buffers", "GL_SGIS_generate_mipmap", "GL_ARB_texture_env_add", "GL_OES_EGL_image", "GL_NV_blend_square", "GL_NV_packed_depth_stencil", "GL_EXT_point_parameters", "GL_ARB_sync", "GL_EXT_packed_pixels", "GL_EXT_texture3D", "GL_ARB_vertex_program", "GL_NV_fog_distance", "GL_EXT_texture_array", "GL_ARB_fragment_coord_conventions", "GL_ARB_multi_bind", "GL_ARB_get_texture_sub_image", "GL_NV_texture_barrier", "GL_ARB_transpose_matrix", "GL_ARB_pixel_buffer_object", "GL_IBM_multimode_draw_arrays", "GL_ARB_debug_output", "GL_EXT_rescale_normal", "GL_EXT_fog_coord", "GL_APPLE_packed_pixels", "GL_ARB_shader_objects", "GL_ARB_point_sprite", "GL_ARB_shading_language_100", "GL_EXT_blend_color", "GL_ARB_texture_border_clamp", "GL_EXT_framebuffer_blit", "GL_ARB_sampler_objects", "GL_ARB_explicit_uniform_location", "GL_ARB_program_interface_query", "GL_NV_texture_rectangle", "GL_ARB_provoking_vertex", "GL_ARB_vertex_attrib_binding", "GL_OES_read_format", "GL_NV_copy_image", "GL_EXT_abgr", "GL_ARB_texture_compression", "GL_EXT_copy_texture", "", "GL_ARB_internalformat_query2", "GL_EXT_texture_lod_bias", "GL_ARB_texture_storage", "GL_SGIS_texture_lod", "GL_EXT_provoking_vertex", "GL_ARB_texture_env_combine", "GL_EXT_texture_edge_clamp", "GL_ARB_ES2_compatibility", "GL_IBM_texture_mirrored_repeat", "GL_NV_light_max_exponent", "GL_ARB_texture_env_dot3", "GL_MESA_window_pos", "GL_AMD_performance_monitor", "GL_EXT_pixel_buffer_object", "GL_EXT_stencil_two_side", "GL_ARB_map_buffer_alignment", "GL_EXT_shadow_funcs", "GL_EXT_gpu_program_parameters", "GL_ARB_clear_buffer_object", "GL_ATI_separate_stencil", "GL_ARB_explicit_attrib_location", "GL_ARB_texture_mirrored_repeat", "GL_EXT_multi_draw_arrays", "GL_ARB_compressed_texture_pixel_storage", "GL_EXT_texture_env_add", "GL_NV_texgen_reflection", "GL_ARB_fragment_program", "GL_IBM_rasterpos_clip", "GL_KHR_parallel_shader_compile", "GL_EXT_EGL_image_storage", "GL_EXT_framebuffer_object", "GL_ARB_texture_cube_map", "GL_ARB_fragment_program_shadow", "GL_EXT_texture_rectangle", "GL_EXT_vertex_array", "GL_ARB_color_buffer_float"}
2000-01-01T21:57:32.325023Z DEBUG egui_glow::vao: VAO not supported
2000-01-01T21:57:32.326270Z ERROR egui_winit::clipboard: Failed to initialize clipboard: Unknown error while interacting with the clipboard: Display parsing error
2000-01-01T21:57:32.326419Z ERROR egui_winit::clipboard: Cannot initialize smithay clipboard without a display handle!
2000-01-01T21:57:32.329613Z DEBUG eframe::native::run: Repaint caused by winit::Event: Resumed
2000-01-01T21:57:32.330052Z DEBUG eframe::native::run: Repaint caused by winit::Event: WindowEvent { window_id: WindowId(WindowId(36071192)), event: Focused(false) }
2000-01-01T21:57:32.778953Z DEBUG eframe::native::run: Repaint caused by winit::Event: RedrawRequested(WindowId(WindowId(36071192)))
2000-01-01T21:57:32.780332Z DEBUG eframe::native::run: Repaint caused by winit::Event: WindowEvent { window_id: WindowId(WindowId(36071192)), event: Focused(true) }
2000-01-01T21:57:32.780541Z DEBUG eframe::native::run: Repaint caused by winit::Event: WindowEvent { window_id: WindowId(WindowId(36071192)), event: ModifiersChanged((empty)) }

VAO not supported is the issue I guess.

@AsmPrgmC3
Copy link
Contributor

Looks like it's a feature detection issue.
All reported OpenGL extensions have a GL_ prefix. This means that while the extension list does include GL_ARB_vertex_array_object, it isn't detected as egui_glow is looking for ARB_vertex_array_object.

@flukejones
Copy link
Contributor Author

Okay so I got it working, these are the changes I needed to make for egui_glow:

diff --git a/crates/egui_glow/src/painter.rs b/crates/egui_glow/src/painter.rs
index 5a383562..f4c918df 100644
--- a/crates/egui_glow/src/painter.rs
+++ b/crates/egui_glow/src/painter.rs
@@ -117,6 +117,7 @@ impl Painter {
         let header = shader_version.version_declaration();
         tracing::debug!("Shader header: {:?}.", header);
         let srgb_support = gl.supported_extensions().contains("EXT_sRGB");
+        tracing::debug!("SRGB Support: {:?}.", srgb_support);
 
         let (post_process, srgb_support_define) = match (shader_version, srgb_support) {
             // WebGL2 support sRGB default
@@ -591,6 +592,8 @@ impl Painter {
                     glow::RGBA
                 };
                 (format, format)
+            } else if !self.srgb_support {
+                (glow::RGBA8, glow::RGBA)
             } else {
                 (glow::SRGB8_ALPHA8, glow::RGBA)
             };
diff --git a/crates/egui_glow/src/vao.rs b/crates/egui_glow/src/vao.rs
index 0a6e53d3..0e0439e1 100644
--- a/crates/egui_glow/src/vao.rs
+++ b/crates/egui_glow/src/vao.rs
@@ -147,6 +147,7 @@ fn supports_vao(gl: &glow::Context) -> bool {
             let supported_extensions = gl.supported_extensions();
             tracing::debug!("Supported OpenGL extensions: {:?}", supported_extensions);
             supported_extensions.contains("ARB_vertex_array_object")
+            || supported_extensions.contains("GL_ARB_vertex_array_object")
         } else {
             true
         }

I don't think it is realistic to set everyone to glow::RGBA8, but it does look like there needs to be a configurable option to set the internal_format at least. Maybe glow::RGBA8 is a good safe fallback?

flukejones added a commit to flukejones/egui that referenced this issue Sep 5, 2022
The Vivante GPU on many STM32MP1 based boards does not support sRGB
as an internal format.

Introduce a check for sRGB support and default to `RGBA8` internal format
if not supported.

Additionally the STM32MP1 needs to be checked for `GL_ARB_vertex_array_object`

Closes emilk#1991
emilk pushed a commit that referenced this issue Sep 6, 2022
The Vivante GPU on many STM32MP1 based boards does not support sRGB
as an internal format.

Introduce a check for sRGB support and default to `RGBA8` internal format
if not supported.

Additionally the STM32MP1 needs to be checked for `GL_ARB_vertex_array_object`

Closes #1991
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants