render/gles2: move shaders to render_xxx_pass

Stop storing the shader on the renderer and instead create a
dedicated shader per wlr_render_xxx_pass.
This commit is contained in:
YaoBing Xiao 2026-03-18 15:08:47 +08:00
parent fb6cfcf809
commit e78131f3d3
5 changed files with 132 additions and 111 deletions

View file

@ -73,18 +73,6 @@ struct wlr_gles2_renderer {
PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT;
} procs;
struct {
struct {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
} quad;
struct wlr_gles2_tex_shader tex_rgba;
struct wlr_gles2_tex_shader tex_rgbx;
struct wlr_gles2_tex_shader tex_ext;
} shaders;
struct wl_list buffers; // wlr_gles2_buffer.link
struct wl_list textures; // wlr_gles2_texture.link
};
@ -175,6 +163,13 @@ struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *b
struct wlr_gles2_render_rect_pass {
struct wlr_render_rect_pass base;
struct wlr_gles2_renderer *renderer;
struct {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
} shader;
};
bool wlr_render_rect_pass_is_gles2(const struct wlr_render_rect_pass *rect_pass);
@ -183,6 +178,12 @@ struct wlr_gles2_render_rect_pass *wlr_gles2_render_rect_pass_from_pass(
struct wlr_gles2_render_texture_pass {
struct wlr_render_texture_pass base;
struct wlr_gles2_renderer *renderer;
struct {
struct wlr_gles2_tex_shader tex_rgba;
struct wlr_gles2_tex_shader tex_rgbx;
struct wlr_gles2_tex_shader tex_ext;
} shaders;
};
bool wlr_render_texture_pass_is_gles2(const struct wlr_render_texture_pass *texture_pass);
@ -197,4 +198,7 @@ bool wlr_render_submit_pass_is_gles2(const struct wlr_render_submit_pass *submit
struct wlr_gles2_render_submit_pass *wlr_gles2_render_submit_pass_from_pass(
struct wlr_render_submit_pass *submit_pass);
GLuint gles2_link_program(struct wlr_gles2_renderer *renderer,
const GLchar *vert_src, const GLchar *frag_src);
#endif