light/modules/engine/src/graphics/framebuffer.cpp

39 lines
977 B
C++
Raw Normal View History

2025-07-05 13:28:41 +03:30
#include <engine/graphics/framebuffer.hpp>
#include <engine/platform/graphics/opengl/framebuffers.hpp>
#ifdef LIGHT_PLATFORM_WINDOWS
#include <engine/platform/graphics/directx/framebuffer.hpp>
#include <engine/platform/graphics/directx/sharedcontext.hpp>
#endif
#include <engine/graphics/graphics_context.hpp>
namespace Light {
Ref<Framebuffer> Framebuffer::create(
2025-07-05 13:28:41 +03:30
const FramebufferSpecification &specification,
Ref<SharedContext> sharedContext
)
{
switch (GraphicsContext::get_graphics_api())
2025-07-05 13:28:41 +03:30
{
case GraphicsAPI::OpenGL: return create_ref<glFramebuffer>(specification);
2025-07-05 13:28:41 +03:30
case GraphicsAPI::DirectX:
lt_win(return create_ref<dxFramebuffer>(
2025-07-05 13:28:41 +03:30
specification,
std::static_pointer_cast<dxSharedContext>(sharedContext)
);)
default:
lt_assert(
2025-07-05 13:28:41 +03:30
false,
"Invalid/unsupported 'GraphicsAPI' {}",
static_cast<uint32_t>(GraphicsContext::get_graphics_api())
2025-07-05 13:28:41 +03:30
);
return nullptr;
}
}
} // namespace Light