Skip to content

Commit

Permalink
renderer: remove old r_screenshot() API
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Apr 30, 2024
1 parent f11a096 commit 8d5ffe4
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 39 deletions.
4 changes: 0 additions & 4 deletions src/renderer/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,6 @@ void r_swap(SDL_Window *window) {
B.swap(window);
}

bool r_screenshot(Pixmap *out) {
return B.screenshot(out);
}

// uniforms garbage; hope your compiler is smart enough to inline most of this

// TODO: verify sampler-to-texture type consistency?
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,6 @@ VsyncMode r_vsync_current(void);

void r_swap(SDL_Window *window);

bool r_screenshot(Pixmap *dest) attr_nodiscard attr_nonnull(1);

void r_mat_mv_push(void);
void r_mat_mv_push_premade(mat4 mat);
void r_mat_mv_push_identity(void);
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/common/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ typedef struct RendererFuncs {
VsyncMode (*vsync_current)(void);

void (*swap)(SDL_Window *window);

bool (*screenshot)(Pixmap *dst);
} RendererFuncs;

typedef struct RendererBackend {
Expand Down
13 changes: 0 additions & 13 deletions src/renderer/gl33/gl33.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,18 +1426,6 @@ static DepthTestFunc gl33_depth_func_current(void) {
return R.depth_test.func.pending;
}

static bool gl33_screenshot(Pixmap *out) {
FloatRect *vp = &R.viewport.default_framebuffer;
out->width = vp->w;
out->height = vp->h;
out->format = PIXMAP_FORMAT_RGB8;
out->origin = PIXMAP_ORIGIN_BOTTOMLEFT;
out->data.untyped = pixmap_alloc_buffer_for_copy(out, &out->data_size);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glReadPixels(vp->x, vp->y, vp->w, vp->h, GL_RGB, GL_UNSIGNED_BYTE, out->data.untyped);
return true;
}

static void gl33_scissor(IntRect scissor) {
R.scissor.pending = scissor;
}
Expand Down Expand Up @@ -1542,7 +1530,6 @@ RendererBackend _r_backend_gl33 = {
.vsync = gl33_vsync,
.vsync_current = gl33_vsync_current,
.swap = gl33_swap,
.screenshot = gl33_screenshot,
},
.custom = &(GLBackendData) {
.vtable = {
Expand Down
1 change: 0 additions & 1 deletion src/renderer/gles30/gles30.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ RendererBackend _r_backend_gles30 = {
.funcs = {
.init = gles30_init,
.texture_dump = gles_texture_dump,
.screenshot = gles_screenshot,

#if BROKEN_GL_BLIT_FRAMEBUFFER
.shutdown = gles30_shutdown,
Expand Down
13 changes: 0 additions & 13 deletions src/renderer/glescommon/gles.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,6 @@ void gles_init_context(SDL_Window *w) {
GLVT_OF(_r_backend_gl33).init_context(w);
}

bool gles_screenshot(Pixmap *out) {
FloatRect vp;
r_framebuffer_viewport_current(NULL, &vp);
out->width = vp.w;
out->height = vp.h;
out->format = PIXMAP_FORMAT_RGBA8;
out->origin = PIXMAP_ORIGIN_BOTTOMLEFT;
out->data.untyped = pixmap_alloc_buffer_for_copy(out, &out->data_size);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glReadPixels(vp.x, vp.y, vp.w, vp.h, GL_RGBA, GL_UNSIGNED_BYTE, out->data.untyped);
return true;
}

bool gles_texture_dump(Texture *tex, uint mipmap, uint layer, Pixmap *dst) {
// No glGetTexImage in GLES
// TODO maybe set up a transient framebuffer to read from?
Expand Down
1 change: 0 additions & 1 deletion src/renderer/glescommon/gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@

void gles_init(RendererBackend *gles_backend, int major, int minor);
void gles_init_context(SDL_Window *w);
bool gles_screenshot(Pixmap *out);
bool gles_texture_dump(Texture *tex, uint mipmap, uint layer, Pixmap *dst);
3 changes: 0 additions & 3 deletions src/renderer/null/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ static VsyncMode null_vsync_current(void) { return VSYNC_NONE; }

static void null_swap(SDL_Window *window) { }

static bool null_screenshot(Pixmap *dest) { return false; }

RendererBackend _r_backend_null = {
.name = "null",
.funcs = {
Expand Down Expand Up @@ -292,6 +290,5 @@ RendererBackend _r_backend_null = {
.vsync = null_vsync,
.vsync_current = null_vsync_current,
.swap = null_swap,
.screenshot = null_screenshot,
},
};

0 comments on commit 8d5ffe4

Please sign in to comment.