1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Use idiomatic templating vargs in a few places to reduce code.

This commit is contained in:
Lukas Tenbrink
2025-03-10 11:59:17 +01:00
parent 42c7f14422
commit df7dab4946
3 changed files with 4 additions and 38 deletions

View File

@@ -137,16 +137,6 @@ class FramebufferCacheRD : public Object {
return _compare_args(idx + 1, textures, args...);
}
_FORCE_INLINE_ void _create_args(Vector<RID> &textures, const RID &arg) {
textures.push_back(arg);
}
template <typename... Args>
_FORCE_INLINE_ void _create_args(Vector<RID> &textures, const RID &arg, Args... args) {
textures.push_back(arg);
_create_args(textures, args...);
}
static FramebufferCacheRD *singleton;
uint32_t cache_instances_used = 0;
@@ -216,10 +206,7 @@ public:
// Not in cache, create:
Vector<RID> textures;
_create_args(textures, args...);
return _allocate_from_data(1, h, table_idx, textures, Vector<RD::FramebufferPass>());
return _allocate_from_data(1, h, table_idx, Vector<RID>{ args... }, Vector<RD::FramebufferPass>());
}
template <typename... Args>
@@ -244,10 +231,7 @@ public:
// Not in cache, create:
Vector<RID> textures;
_create_args(textures, args...);
return _allocate_from_data(p_views, h, table_idx, textures, Vector<RD::FramebufferPass>());
return _allocate_from_data(p_views, h, table_idx, Vector<RID>{ args... }, Vector<RD::FramebufferPass>());
}
RID get_cache_multipass(const Vector<RID> &p_textures, const Vector<RD::FramebufferPass> &p_passes, uint32_t p_views = 1) {