mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
Implement partial texture uploads
This commit is contained in:
parent
b109aecff9
commit
4de930542f
5 changed files with 100 additions and 6 deletions
|
|
@ -62,18 +62,34 @@ struct wlr_texture {
|
|||
};
|
||||
|
||||
/**
|
||||
* Uploads a pixel buffer to this texture. The buffer may be discarded after
|
||||
* calling this function.
|
||||
* Copies pixels to this texture. The buffer is not accessed after this function
|
||||
* returns.
|
||||
*/
|
||||
bool wlr_texture_upload_pixels(struct wlr_texture *surf,
|
||||
enum wl_shm_format format, int stride, int width, int height,
|
||||
const unsigned char *pixels);
|
||||
/**
|
||||
* Uploads pixels from a wl_shm_buffer to this texture. The shm buffer may be
|
||||
* invalidated after calling this function.
|
||||
* Copies pixels to this texture. The buffer is not accessed after this function
|
||||
* returns. Under some circumstances, this function may re-upload the entire
|
||||
* buffer - therefore, the entire buffer must be valid.
|
||||
*/
|
||||
bool wlr_texture_update_pixels(struct wlr_texture *surf,
|
||||
enum wl_shm_format format, int stride, int x, int y,
|
||||
int width, int height, const unsigned char *pixels);
|
||||
/**
|
||||
* Copies pixels from a wl_shm_buffer into this texture. The buffer is not
|
||||
* accessed after this function returns.
|
||||
*/
|
||||
bool wlr_texture_upload_shm(struct wlr_texture *surf, uint32_t format,
|
||||
struct wl_shm_buffer *shm);
|
||||
/**
|
||||
* Copies a rectangle of pixels from a wl_shm_buffer onto the texture. The
|
||||
* buffer is not accessed after this function returns. Under some circumstances,
|
||||
* this function may re-upload the entire buffer - therefore, the entire buffer
|
||||
* must be valid.
|
||||
*/
|
||||
bool wlr_texture_update_shm(struct wlr_texture *surf, uint32_t format,
|
||||
int x, int y, int width, int height, struct wl_shm_buffer *shm);
|
||||
/**
|
||||
* Prepares a matrix with the appropriate scale for the given texture and
|
||||
* multiplies it with the projection, producing a matrix that the shader can
|
||||
|
|
|
|||
|
|
@ -35,8 +35,13 @@ struct wlr_texture_impl {
|
|||
bool (*upload_pixels)(struct wlr_texture_state *state,
|
||||
enum wl_shm_format format, int stride, int width, int height,
|
||||
const unsigned char *pixels);
|
||||
bool (*update_pixels)(struct wlr_texture_state *state,
|
||||
enum wl_shm_format format, int stride, int x, int y,
|
||||
int width, int height, const unsigned char *pixels);
|
||||
bool (*upload_shm)(struct wlr_texture_state *state, uint32_t format,
|
||||
struct wl_shm_buffer *shm);
|
||||
bool (*update_shm)(struct wlr_texture_state *surf, uint32_t format,
|
||||
int x, int y, int width, int height, struct wl_shm_buffer *shm);
|
||||
// TODO: egl
|
||||
void (*get_matrix)(struct wlr_texture_state *state,
|
||||
float (*matrix)[16], const float (*projection)[16], int x, int y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue