gl_common: implement image_op

Implement image processing in gl_compose using a frag shader.
gl_image_op is used to set flags corresponds to what processing is
needed for a texture.

Also implement proper reference counting for textures.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-03-09 14:12:53 +00:00
parent 6ff0facae6
commit 0a2dd8aa72
3 changed files with 48 additions and 40 deletions

View File

@@ -43,7 +43,7 @@ typedef struct {
/// @brief Wrapper of a binded GLX texture.
typedef struct gl_texture {
double opacity;
int refcount;
int *refcount;
GLuint texture;
GLenum target;
unsigned width;
@@ -89,12 +89,7 @@ GLuint gl_create_program_from_str(const char *vert_shader_str, const char *frag_
void gl_compose(backend_t *, void *ptex, int dst_x, int dst_y, const region_t *reg_tgt,
const region_t *reg_visible);
bool gl_load_prog_main(session_t *ps, const char *vshader_str, const char *fshader_str,
gl_win_shader_t *pprogram);
unsigned char *gl_take_screenshot(session_t *ps, int *out_length);
void gl_resize(struct gl_data *, int width, int height);
//bool gl_create_blur_filters(session_t *ps, gl_blur_shader_t *passes, const gl_cap_t *cap);
GLuint glGetUniformLocationChecked(GLuint p, const char *name);
@@ -106,8 +101,6 @@ GLuint gl_new_texture(GLenum target);
bool gl_image_op(backend_t *base, enum image_operations op, void *image_data,
const region_t *reg_op, const region_t *reg_visible, void *arg);
void *gl_copy(backend_t *base, const void *image_data, const region_t *reg_visible);
bool gl_blur(backend_t *base, double opacity, const region_t *reg_blur,
const region_t *reg_visible);