render/gles: Simplify textures a bit

We don't need our own enum for types. Instead we just use
GL_TEXTURE_{2D,EXTERNAL_OES}, which already describes usage.

Also fixes a situation where we were using GL_TEXTURE_2D in a situation
we should not have. wl_drm buffers are always GL_TEXTURE_EXTERNAL_OES,
no matter if they're RGB or any other format.
This commit is contained in:
Scott Anderson 2019-11-06 21:28:43 +13:00 committed by Simon Ser
parent f2d3b1000f
commit 85a2ee6d30
3 changed files with 38 additions and 60 deletions

View file

@ -60,31 +60,24 @@ struct wlr_gles2_renderer {
uint32_t viewport_width, viewport_height;
};
enum wlr_gles2_texture_type {
WLR_GLES2_TEXTURE_GLTEX,
WLR_GLES2_TEXTURE_WL_DRM_GL,
WLR_GLES2_TEXTURE_WL_DRM_EXT,
WLR_GLES2_TEXTURE_DMABUF,
};
struct wlr_gles2_texture {
struct wlr_texture wlr_texture;
struct wlr_egl *egl;
enum wlr_gles2_texture_type type;
int width, height;
bool has_alpha;
enum wl_shm_format wl_format; // used to interpret upload data
bool inverted_y;
// Not set if WLR_GLES2_TEXTURE_GLTEX
// Basically:
// GL_TEXTURE_2D == mutable
// GL_TEXTURE_EXTERNAL_OES == immutable
GLenum target;
GLuint tex;
EGLImageKHR image;
GLuint image_tex;
union {
GLuint gl_tex;
struct wl_resource *wl_drm;
};
int width, height;
bool inverted_y;
bool has_alpha;
// Only affects target == GL_TEXTURE_2D
enum wl_shm_format wl_format; // used to interpret upload data
};
const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(