diff options
author | clayjohn <claynjohn@gmail.com> | 2022-06-20 21:56:26 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-10-06 11:24:45 -0700 |
commit | 154b9c1c913ee04b603989db8664481d4df1aaee (patch) | |
tree | 6cc754761fb942a4931b63e052c583cfd951b112 /drivers/gles3/storage | |
parent | 0c23a2cfe3ad897e1e49008629c135764b2c155c (diff) |
Use a giant UBO to optimize performance in 2D
This removes the countless small UBO writes we had before
and replaces them with a single large write per render pass.
This results in much faster rendering on low-end devices
but improves speed on all devices.
Diffstat (limited to 'drivers/gles3/storage')
-rw-r--r-- | drivers/gles3/storage/config.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/storage/config.h | 2 | ||||
-rw-r--r-- | drivers/gles3/storage/texture_storage.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/storage/texture_storage.h | 5 |
4 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp index 6cc65e7bb2..242c1ce0a9 100644 --- a/drivers/gles3/storage/config.cpp +++ b/drivers/gles3/storage/config.cpp @@ -86,6 +86,8 @@ Config::Config() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_uniform_buffer_size); + glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &uniform_buffer_offset_alignment); + // the use skeleton software path should be used if either float texture is not supported, // OR max_vertex_texture_image_units is zero use_skeleton_software = (float_texture_supported == false) || (max_vertex_texture_image_units == 0); diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h index b83c83f425..fe18345775 100644 --- a/drivers/gles3/storage/config.h +++ b/drivers/gles3/storage/config.h @@ -64,6 +64,8 @@ public: int max_renderable_lights = 0; int max_lights_per_object = 0; + int uniform_buffer_offset_alignment = 0; + // TODO implement wireframe in OpenGL // bool generate_wireframes; diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 5950997f9b..442bd69b55 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -1533,9 +1533,11 @@ void TextureStorage::render_target_do_clear_request(RID p_render_target) { if (!rt->clear_requested) { return; } + glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo); glClearBufferfv(GL_COLOR, 0, rt->clear_color.components); rt->clear_requested = false; + glBindFramebuffer(GL_FRAMEBUFFER, system_fbo); } void TextureStorage::render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) { diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h index 0d4cd9c7e3..7e083e48e8 100644 --- a/drivers/gles3/storage/texture_storage.h +++ b/drivers/gles3/storage/texture_storage.h @@ -126,11 +126,6 @@ struct CanvasTexture { RS::CanvasItemTextureFilter texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT; RS::CanvasItemTextureRepeat texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT; - - Size2i size_cache = Size2i(1, 1); - bool use_normal_cache = false; - bool use_specular_cache = false; - bool cleared_cache = true; }; /* CANVAS SHADOW */ |