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

Implement hooks into renderer

This commit is contained in:
Bastiaan Olij
2023-08-03 22:10:03 +10:00
parent 5f05e2b9b1
commit 5a98845655
64 changed files with 2432 additions and 132 deletions

View File

@@ -32,6 +32,10 @@
FramebufferCacheRD *FramebufferCacheRD::singleton = nullptr;
void FramebufferCacheRD::_bind_methods() {
ClassDB::bind_static_method("FramebufferCacheRD", D_METHOD("get_cache_multipass", "textures", "passes", "views"), &FramebufferCacheRD::get_cache_multipass_array);
}
void FramebufferCacheRD::_invalidate(Cache *p_cache) {
if (p_cache->prev) {
p_cache->prev->next = p_cache->next;
@@ -52,6 +56,25 @@ void FramebufferCacheRD::_framebuffer_invalidation_callback(void *p_userdata) {
singleton->_invalidate(reinterpret_cast<Cache *>(p_userdata));
}
RID FramebufferCacheRD::get_cache_multipass_array(const TypedArray<RID> &p_textures, const TypedArray<RDFramebufferPass> &p_passes, uint32_t p_views) {
Vector<RID> textures;
Vector<RD::FramebufferPass> passes;
for (int i = 0; i < p_textures.size(); i++) {
RID texture = p_textures[i];
textures.push_back(texture); // store even if NULL
}
for (int i = 0; i < p_passes.size(); i++) {
Ref<RDFramebufferPass> pass = p_passes[i];
if (pass.is_valid()) {
passes.push_back(pass->base);
}
}
return FramebufferCacheRD::get_singleton()->get_cache_multipass(textures, passes, p_views);
}
FramebufferCacheRD::FramebufferCacheRD() {
ERR_FAIL_COND(singleton != nullptr);
singleton = this;