LukasBanana / LLGL

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
BSD 3-Clause "New" or "Revised" License
2.05k stars 139 forks source link

Add *optional* resolve attachments to "RenderTarget" interface #46

Closed LukasBanana closed 1 year ago

LukasBanana commented 5 years ago

Instead of automatic generation of multi-sampled attachments that get resolved into the actual render target attachments, the user should be able to specify their custom multi-sampled textures. For OpenGL, a Texture that has not the BindFlags::Sampled flag bit, a renderbuffer should be used internally, which is currently only done in GLRenderTarget for the auto.-generated multi-sampled attachments. This feature should be optional, though, and not required for convenience.

Before:

struct RenderTargetDescriptor
{
    const RenderPass*                   renderPass          = nullptr;
    Extent2D                            resolution;
    std::uint32_t                       samples             = 1;
    bool                                customMultiSampling = false;
    std::vector<AttachmentDescriptor>   attachments;
};

After:

struct RenderTargetDescriptor
{
    const RenderPass*       renderPass                      = nullptr;
    Extent2D                resolution;
    AttachmentDescriptor    colorAttachments[8];
    AttachmentDescriptor    resolveAttachments[8];
    AttachmentDescriptor    depthStencilAttachment;
};

The samples parameter is taken from the specified (or default) render pass, i.e. RenderPassDescriptor::samples.

LukasBanana commented 1 year ago

Fixed with 13b8af5.