2025-07-10 13:29:03 +03:30
|
|
|
#include <renderer/framebuffer.hpp>
|
|
|
|
#include <renderer/gl/framebuffers.hpp>
|
2025-07-05 13:28:41 +03:30
|
|
|
|
|
|
|
#ifdef LIGHT_PLATFORM_WINDOWS
|
2025-07-10 13:29:03 +03:30
|
|
|
#include <renderer/dx/framebuffer.hpp>
|
|
|
|
#include <renderer/dx/sharedcontext.hpp>
|
2025-07-05 13:28:41 +03:30
|
|
|
#endif
|
|
|
|
|
2025-07-10 13:29:03 +03:30
|
|
|
#include <renderer/graphics_context.hpp>
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
namespace lt {
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto Framebuffer::create(
|
2025-07-05 13:28:41 +03:30
|
|
|
const FramebufferSpecification &specification,
|
2025-07-06 16:52:50 +03:30
|
|
|
const Ref<SharedContext>& /*sharedContext*/
|
2025-07-06 14:02:50 +03:30
|
|
|
) -> Ref<Framebuffer>
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 15:36:53 +03:30
|
|
|
switch (GraphicsContext::get_graphics_api())
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 15:36:53 +03:30
|
|
|
case GraphicsAPI::OpenGL: return create_ref<glFramebuffer>(specification);
|
2025-07-05 13:28:41 +03:30
|
|
|
|
|
|
|
case GraphicsAPI::DirectX:
|
2025-07-05 15:36:53 +03:30
|
|
|
lt_win(return create_ref<dxFramebuffer>(
|
2025-07-05 13:28:41 +03:30
|
|
|
specification,
|
|
|
|
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
2025-07-06 16:30:38 +03:30
|
|
|
););
|
|
|
|
|
|
|
|
default:
|
|
|
|
lt_assert(
|
|
|
|
false,
|
|
|
|
"Invalid/unsupported 'GraphicsAPI' {}",
|
|
|
|
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
|
|
|
|
);
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
} // namespace lt
|