1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Add a Framebuffer cache

Adds a FramebufferCache singletion that operates the same way as UniformSetCache.

Allows creating framebuffers on the fly (and keep them cached if re-requested) such as:

```C++
RID fb = FramebufferCache::get_singleton()->get_cache(texture1,texture2);
```
This commit is contained in:
Juan Linietsky
2022-08-05 11:59:58 +02:00
parent 9c8e7031bf
commit f999f52f0a
11 changed files with 436 additions and 23 deletions

View File

@@ -163,7 +163,7 @@ public:
const Cache *c = hash_table[table_idx];
while (c) {
if (c->hash == h && c->set == p_set && c->shader == p_shader && _compare_args(0, c->uniforms, args...)) {
if (c->hash == h && c->set == p_set && c->shader == p_shader && sizeof...(Args) == c->uniforms.size() && _compare_args(0, c->uniforms, args...)) {
return c->cache;
}
c = c->next;
@@ -193,7 +193,7 @@ public:
const Cache *c = hash_table[table_idx];
while (c) {
if (c->hash == h && c->set == p_set && c->shader == p_shader) {
if (c->hash == h && c->set == p_set && c->shader == p_shader && (uint32_t)p_uniforms.size() == c->uniforms.size()) {
bool all_ok = true;
for (int i = 0; i < p_uniforms.size(); i++) {
if (!_compare_uniform(p_uniforms[i], c->uniforms[i])) {