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

Optionally disable srgb decode gles3 feature (globally or per vendor) #46964

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

jkb0o
Copy link
Contributor

@jkb0o jkb0o commented Mar 13, 2021

This fixes dark textures on android+mali devices. closes #39279, closes #43342

Actually, Mali devices don't like mipmaps + internal srgb based format. I dive into some research but did not find anything directly related to the problem. I've tested on iPhone6, Xiaomi Redmi 5 (Adreno) and Kindle Fire HDX (Mali).

Extensions per device may be useful for diving in:
# iPhone 6s
GL_APPLE_clip_distance
GL_APPLE_color_buffer_packed_float
GL_APPLE_copy_texture_levels
GL_APPLE_rgb_422
GL_APPLE_texture_format_BGRA8888
GL_EXT_color_buffer_half_float
GL_EXT_debug_label
GL_EXT_debug_marker
GL_EXT_pvrtc_sRGB
GL_EXT_read_format_bgra
GL_EXT_separate_shader_objects
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_texture_lod
GL_EXT_shadow_samplers
GL_EXT_texture_filter_anisotropic
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
GL_KHR_texture_compression_astc_ldr
GL_OES_standard_derivatives
# Xiaomi Redmi 5 (Adreno)
GL_AMD_compressed_ATC_texture
GL_ANDROID_extension_pack_es31a
GL_ARM_shader_framebuffer_fetch_depth_stencil
GL_EXT_EGL_image_array
GL_EXT_YUV_target
GL_EXT_blit_framebuffer_params
GL_EXT_buffer_storage
GL_EXT_clip_cull_distance
GL_EXT_color_buffer_float
GL_EXT_color_buffer_half_float
GL_EXT_copy_image
GL_EXT_debug_label
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_disjoint_timer_query
GL_EXT_draw_buffers_indexed
GL_EXT_external_buffer
GL_EXT_geometry_shader
GL_EXT_gpu_shader5
GL_EXT_memory_object
GL_EXT_memory_object_fd
GL_EXT_multisampled_render_to_texture
GL_EXT_multisampled_render_to_texture2
GL_EXT_primitive_bounding_box
GL_EXT_protected_textures
GL_EXT_robustness
GL_EXT_sRGB
GL_EXT_sRGB_write_control
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_io_blocks
GL_EXT_shader_non_constant_global_initializers
GL_EXT_tessellation_shader
GL_EXT_texture_border_clamp
GL_EXT_texture_buffer
GL_EXT_texture_cube_map_array
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_norm16
GL_EXT_texture_sRGB_R8
GL_EXT_texture_sRGB_decode
GL_EXT_texture_type_2_10_10_10_REV
GL_KHR_blend_equation_advanced
GL_KHR_blend_equation_advanced_coherent
GL_KHR_debug
GL_KHR_no_error
GL_KHR_texture_compression_astc_hdr
GL_KHR_texture_compression_astc_ldr
GL_NV_shader_noperspective_interpolation
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_EGL_image_external_essl3
GL_OES_EGL_sync
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_depth_texture_cube_map
GL_OES_element_index_uint
GL_OES_framebuffer_object
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_sample_shading
GL_OES_sample_variables
GL_OES_shader_image_atomic
GL_OES_shader_multisample_interpolation
GL_OES_standard_derivatives
GL_OES_surfaceless_context
GL_OES_texture_3D
GL_OES_texture_compression_astc
GL_OES_texture_float
GL_OES_texture_float_linear
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_texture_npot
GL_OES_texture_stencil8
GL_OES_texture_storage_multisample_2d_array
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_OVR_multiview
GL_OVR_multiview2
GL_OVR_multiview_multisampled_render_to_texture
GL_QCOM_alpha_test
GL_QCOM_shader_framebuffer_fetch_noncoherent
GL_QCOM_texture_foveated
GL_QCOM_tiled_rendering
# Kindle Fire HDX (Mali)
GL_ANDROID_extension_pack_es31a
GL_ARM_mali_program_binary
GL_ARM_mali_shader_binary
GL_ARM_rgba8
GL_ARM_shader_framebuffer_fetch
GL_ARM_shader_framebuffer_fetch_depth_stencil
GL_EXT_EGL_image_array
GL_EXT_YUV_target
GL_EXT_blend_minmax
GL_EXT_buffer_storage
GL_EXT_color_buffer_float
GL_EXT_color_buffer_half_float
GL_EXT_copy_image
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_disjoint_timer_query
GL_EXT_draw_buffers_indexed
GL_EXT_draw_elements_base_vertex
GL_EXT_geometry_shader
GL_EXT_gpu_shader5
GL_EXT_multisampled_render_to_texture
GL_EXT_multisampled_render_to_texture2
GL_EXT_occlusion_query_boolean
GL_EXT_primitive_bounding_box
GL_EXT_protected_textures
GL_EXT_read_format_bgra
GL_EXT_robustness
GL_EXT_sRGB
GL_EXT_sRGB_write_control
GL_EXT_shader_io_blocks
GL_EXT_shader_non_constant_global_initializers
GL_EXT_shader_pixel_local_storage
GL_EXT_shadow_samplers
GL_EXT_tessellation_shader
GL_EXT_texture_border_clamp
GL_EXT_texture_buffer
GL_EXT_texture_cube_map_array
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_rg
GL_EXT_texture_sRGB_R8
GL_EXT_texture_sRGB_RG8
GL_EXT_texture_sRGB_decode
GL_EXT_texture_storage
GL_EXT_texture_type_2_10_10_10_REV
GL_KHR_blend_equation_advanced
GL_KHR_blend_equation_advanced_coherent
GL_KHR_debug
GL_KHR_robust_buffer_access_behavior
GL_KHR_robustness
GL_KHR_texture_compression_astc_hdr
GL_KHR_texture_compression_astc_ldr
GL_KHR_texture_compression_astc_sliced_3d
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_EGL_image_external_essl3
GL_OES_EGL_sync
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_compressed_paletted_texture
GL_OES_copy_image
GL_OES_depth24
GL_OES_depth_texture
GL_OES_depth_texture_cube_map
GL_OES_draw_buffers_indexed
GL_OES_draw_elements_base_vertex
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_geometry_shader
GL_OES_get_program_binary
GL_OES_gpu_shader5
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_primitive_bounding_box
GL_OES_required_internalformat
GL_OES_rgb8_rgba8
GL_OES_sample_shading
GL_OES_sample_variables
GL_OES_shader_image_atomic
GL_OES_shader_io_blocks
GL_OES_shader_multisample_interpolation
GL_OES_standard_derivatives
GL_OES_surfaceless_context
GL_OES_tessellation_shader
GL_OES_texture_3D
GL_OES_texture_border_clamp
GL_OES_texture_buffer
GL_OES_texture_compression_astc
GL_OES_texture_cube_map_array
GL_OES_texture_npot
GL_OES_texture_stencil8
GL_OES_texture_storage_multisample_2d_array
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_OVR_multiview
GL_OVR_multiview2
GL_OVR_multiview_multisampled_render_to_texture

As far as this PR is only about GLES3 backend, there is nothing to do with master.

@jkb0o jkb0o requested a review from a team as a code owner March 13, 2021 12:22
* this fixes dark textures on android+mali devices
@jkb0o jkb0o force-pushed the disable-srgb-encode branch from f2d9aa9 to dfc3958 Compare March 13, 2021 12:51
@jkb0o jkb0o changed the title Optionally disable srgb encode gles3 feature (globally or per vendor) Optionally disable srgb decode gles3 feature (globally or per vendor) Mar 13, 2021
@lawnjelly
Copy link
Member

That's a pain, if it is a hardware issue. The approach in general doesn't seem bad if it is the only way around it.

If we go for this maybe we should take the opportunity to consider whether quality is the best place for such a setting, whether we should keep stuffing quality or have another tab like we have for GLES2, as it is difficult to move settings, and a degree of future proofing is a good idea.

@jkb0o
Copy link
Contributor Author

jkb0o commented Mar 13, 2021

@lawnjelly I've tried a lot of things: played with texture size, different allocation methods, and texture parameters in RasterizerStorageGLES3::texture_set_data, tried to track down a different gl extension and lay on it, etc. For our case, it is only an option to completely disable srgb decoding and share the same behavior on all devices.

quality location still looks good for this one btw. It fits the way how I use it: if something goes wrong, the first thing to inspect is quality settings. But I'm also ok with moving this setting to whatever place it fits better.

@akien-mga akien-mga added this to the 3.2 milestone Mar 13, 2021
Base automatically changed from 3.2 to 3.x March 16, 2021 11:12
@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@akien-mga akien-mga modified the milestones: 3.3, 3.4 Mar 26, 2021
@Chaosus Chaosus modified the milestones: 3.4, 3.5 Nov 8, 2021
@akien-mga akien-mga force-pushed the 3.x branch 2 times, most recently from 71cb8d3 to c58391c Compare January 6, 2022 22:40
@akien-mga akien-mga modified the milestones: 3.5, 3.x Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants