MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / framebuffer_create

Method framebuffer_create

servers/rendering/rendering_device.cpp:2969–3000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2967}
2968
2969RID RenderingDevice::framebuffer_create(const Vector<RID> &p_texture_attachments, FramebufferFormatID p_format_check, uint32_t p_view_count) {
2970 _THREAD_SAFE_METHOD_
2971
2972 FramebufferPass pass;
2973
2974 for (int i = 0; i < p_texture_attachments.size(); i++) {
2975 Texture *texture = texture_owner.get_or_null(p_texture_attachments[i]);
2976
2977 ERR_FAIL_COND_V_MSG(texture && texture->layers != p_view_count, RID(), "Layers of our texture doesn't match view count for this framebuffer");
2978
2979 if (texture != nullptr) {
2980 _check_transfer_worker_texture(texture);
2981 }
2982
2983 if (texture && texture->usage_flags & TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
2984 pass.depth_attachment = i;
2985 } else if (texture && texture->usage_flags & TEXTURE_USAGE_VRS_ATTACHMENT_BIT) {
2986 // Prevent the VRS attachment from being added to the color_attachments.
2987 } else {
2988 if (texture && texture->is_resolve_buffer) {
2989 pass.resolve_attachments.push_back(i);
2990 } else {
2991 pass.color_attachments.push_back(texture ? i : ATTACHMENT_UNUSED);
2992 }
2993 }
2994 }
2995
2996 Vector<FramebufferPass> passes;
2997 passes.push_back(pass);
2998
2999 return framebuffer_create_multipass(p_texture_attachments, passes, p_format_check, p_view_count);
3000}
3001
3002RID RenderingDevice::framebuffer_create_multipass(const Vector<RID> &p_texture_attachments, const Vector<FramebufferPass> &p_passes, FramebufferFormatID p_format_check, uint32_t p_view_count) {
3003 _THREAD_SAFE_METHOD_

Calls 4

RIDClass · 0.85
sizeMethod · 0.65
get_or_nullMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected