render/gles: add support for some 16-bpc unsigned shm formats

These formats require EXT_texture_norm16, which in turn needs OpenGL
ES 3.1. The EXT_texture_norm16 extension does not support passing
gl_internalformat = GL_RGBA to glTexImage2D, as can be done for
formats available in OpenGL ES 2.0, so this commit adds a field to
wlr_gles2_pixel_format to provide a more specific internalformat
parameter to glTexImage2D.
This commit is contained in:
Manuel Stoeckl 2022-04-30 22:43:49 -04:00 committed by Simon Ser
parent cb012c5cb5
commit 7ad67e0f1d
5 changed files with 42 additions and 1 deletions

View file

@ -93,6 +93,20 @@ static const struct wlr_gles2_pixel_format formats[] = {
.gl_type = GL_HALF_FLOAT_OES,
.has_alpha = true,
},
{
.drm_format = DRM_FORMAT_XBGR16161616,
.gl_internalformat = GL_RGBA16_EXT,
.gl_format = GL_RGBA,
.gl_type = GL_UNSIGNED_SHORT,
.has_alpha = false,
},
{
.drm_format = DRM_FORMAT_ABGR16161616,
.gl_internalformat = GL_RGBA16_EXT,
.gl_format = GL_RGBA,
.gl_type = GL_UNSIGNED_SHORT,
.has_alpha = true,
},
#endif
};
@ -112,6 +126,10 @@ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
&& !renderer->exts.OES_texture_half_float_linear) {
return false;
}
if (format->gl_type == GL_UNSIGNED_SHORT
&& !renderer->exts.EXT_texture_norm16) {
return false;
}
/*
* Note that we don't need to check for GL_EXT_texture_format_BGRA8888
* here, since we've already checked if we have it at renderer creation