mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-26 08:56:29 -05:00
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:
parent
cb012c5cb5
commit
7ad67e0f1d
5 changed files with 42 additions and 1 deletions
|
|
@ -210,6 +210,11 @@ static struct wlr_texture *gles2_texture_from_pixels(
|
|||
texture->has_alpha = fmt->has_alpha;
|
||||
texture->drm_format = fmt->drm_format;
|
||||
|
||||
GLint internal_format = fmt->gl_internalformat;
|
||||
if (!internal_format) {
|
||||
internal_format = fmt->gl_format;
|
||||
}
|
||||
|
||||
struct wlr_egl_context prev_ctx;
|
||||
wlr_egl_save_context(&prev_ctx);
|
||||
wlr_egl_make_current(renderer->egl);
|
||||
|
|
@ -222,7 +227,7 @@ static struct wlr_texture *gles2_texture_from_pixels(
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride / (drm_fmt->bpp / 8));
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fmt->gl_format, width, height, 0,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0,
|
||||
fmt->gl_format, fmt->gl_type, data);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue