From d74b25a655582953f4a983c7e1ba7c9773a2fb7c Mon Sep 17 00:00:00 2001 From: whitebelyash Date: Sun, 15 Feb 2026 16:39:27 +0400 Subject: [PATCH 1/3] Feat[clear]: implement glClearTexImage --- ltw/src/main/tinywrapper/of_buffer_copier.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ltw/src/main/tinywrapper/of_buffer_copier.c b/ltw/src/main/tinywrapper/of_buffer_copier.c index 2eaae00..1bf9213 100644 --- a/ltw/src/main/tinywrapper/of_buffer_copier.c +++ b/ltw/src/main/tinywrapper/of_buffer_copier.c @@ -169,5 +169,20 @@ void glCopyTexSubImage2D(GLenum target, texture_blit_framebuffer(target, level, xoffset, yoffset, x, y, width, height, true); } } +} + +void glClearTexImage(GLuint texture, + GLint level, + GLenum format, + GLenum type, + const void * data) { + if(!current_context) return; + framebuffer_copier_t* copier = ¤t_context->framebuffer_copier; + if(!copier->ready) return; + es3_functions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, copier->tempfb); + es3_functions.glFramebufferTexture2D(copier->tempfb, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, level); + es3_functions.glClearBufferiv(GL_COLOR, GL_COLOR_ATTACHMENT0, data); + es3_functions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + printf("LTW: Cleared framebuffer texture\n"); } \ No newline at end of file From b2f656a7634b27488273970e0108a5b88bb5630c Mon Sep 17 00:00:00 2001 From: whitebelyash Date: Sun, 15 Feb 2026 16:55:49 +0400 Subject: [PATCH 2/3] Feat[egl]: expose GL_ARB_clear_texture --- ltw/src/main/tinywrapper/egl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ltw/src/main/tinywrapper/egl.c b/ltw/src/main/tinywrapper/egl.c index 2d6ce2e..ad4bdb3 100644 --- a/ltw/src/main/tinywrapper/egl.c +++ b/ltw/src/main/tinywrapper/egl.c @@ -122,6 +122,7 @@ void build_extension_string(context_t* context) { // Required by Iris. Indexed variants are available since ES3.2 or with OES/EXT_draw_buffers_indexed extensions if(context->blending.available) add_extra_extension(context, &length, "GL_ARB_draw_buffers_blend"); + add_extra_extension(context, &length, "GL_ARB_clear_texture"); // Used by Minecraft for the GPU usage counter (see Blaze3D TimerQuery) add_extra_extension(context, &length, "GL_ARB_timer_query"); // More extensions are possible, but will need way more wraps and tracking. From 0c5a75f54381a3ad13d8224a9fe3bf8f5792defe Mon Sep 17 00:00:00 2001 From: whitebelyash Date: Sun, 15 Feb 2026 17:12:28 +0400 Subject: [PATCH 3/3] Fix[of_buffer_copier]: remove debug printf --- ltw/src/main/tinywrapper/of_buffer_copier.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ltw/src/main/tinywrapper/of_buffer_copier.c b/ltw/src/main/tinywrapper/of_buffer_copier.c index 1bf9213..8c6b447 100644 --- a/ltw/src/main/tinywrapper/of_buffer_copier.c +++ b/ltw/src/main/tinywrapper/of_buffer_copier.c @@ -184,5 +184,4 @@ void glClearTexImage(GLuint texture, es3_functions.glFramebufferTexture2D(copier->tempfb, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, level); es3_functions.glClearBufferiv(GL_COLOR, GL_COLOR_ATTACHMENT0, data); es3_functions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - printf("LTW: Cleared framebuffer texture\n"); } \ No newline at end of file