renderer: fix gles30/webgl breakage

This commit is contained in:
Andrei Alexeyev 2021-07-18 11:16:16 +03:00
parent a6bb29529b
commit d10c5d0e7e
No known key found for this signature in database
GPG key ID: 72D26128040B9690
6 changed files with 15 additions and 1 deletions

View file

@ -593,6 +593,9 @@ bool gl33_texture_sampler_compatible(Texture *tex, UniformType sampler_type) {
}
bool gl33_texture_dump(Texture *tex, uint mipmap, uint layer, Pixmap *dst) {
#ifdef STATIC_GLES3
UNREACHABLE;
#else
if(tex->fmt_info->flags & GLTEX_COMPRESSED) {
// TODO
return false;
@ -617,4 +620,5 @@ bool gl33_texture_dump(Texture *tex, uint mipmap, uint layer, Pixmap *dst) {
);
return true;
#endif
}

View file

@ -223,7 +223,7 @@ struct glext_s {
#undef GLES_ATLEAST
#define GLES_ATLEAST(mjr, mnr) (glext.version.is_es && GLANY_ATLEAST(mjr, mnr))
#ifdef STATIC_GLESS
#ifdef STATIC_GLES3
#define HAVE_GL_FUNC(func) (&(func) != NULL)
#else
#define HAVE_GL_FUNC(func) ((func) != NULL)

View file

@ -59,6 +59,7 @@ RendererBackend _r_backend_gles20 = {
.name = "gles20",
.funcs = {
.init = gles20_init,
.texture_dump = gles_texture_dump,
.screenshot = gles_screenshot,
.index_buffer_create = gles20_index_buffer_create,
.index_buffer_get_capacity = gles20_index_buffer_get_capacity,

View file

@ -19,6 +19,7 @@ RendererBackend _r_backend_gles30 = {
.name = "gles30",
.funcs = {
.init = gles30_init,
.texture_dump = gles_texture_dump,
.screenshot = gles_screenshot,
},
.custom = &(GLBackendData) {

View file

@ -59,3 +59,10 @@ bool gles_screenshot(Pixmap *out) {
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?
log_warn("FIXME: not implemented");
return false;
}

View file

@ -16,5 +16,6 @@
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);
#endif // IGUARD_renderer_glescommon_gles_h