#include #include #include #include #ifdef LIGHT_PLATFORM_WINDOWS #include #include #endif #include namespace lt { auto ConstantBuffer::create( ConstantBufferIndex index, unsigned int size, const Ref & /*sharedContext*/ ) -> Scope { switch (GraphicsContext::get_graphics_api()) { case GraphicsAPI::OpenGL: return create_scope(index, size); case GraphicsAPI::DirectX: lt_win( return create_scope( index, size, std::static_pointer_cast(sharedContext) ); ) default : ensure( false, "Invalid/unsupported 'GraphicsAPI' {}", static_cast(GraphicsContext::get_graphics_api()) ); return nullptr; } } auto VertexBuffer::create( float *vertices, unsigned int stride, unsigned int count, const Ref & /*sharedContext*/ ) -> Ref { switch (GraphicsContext::get_graphics_api()) { case GraphicsAPI::OpenGL: return create_ref(vertices, stride, count); case GraphicsAPI::DirectX: lt_win( return create_ref( vertices, stride, count, std::static_pointer_cast(sharedContext) ); ) default : ensure( false, "Invalid/unsupported 'GraphicsAPI' {}", static_cast(GraphicsContext::get_graphics_api()) ); return nullptr; } } auto IndexBuffer::create( unsigned int *indices, unsigned int count, const Ref & /*sharedContext*/ ) -> Ref { switch (GraphicsContext::get_graphics_api()) { case GraphicsAPI::OpenGL: return create_ref(indices, count); case GraphicsAPI::DirectX: lt_win( return create_ref( indices, count, std::dynamic_pointer_cast(sharedContext) ); ) default : ensure( false, "Invalid/unsupported 'GraphicsAPI' {}", static_cast(GraphicsContext::get_graphics_api()) ); return nullptr; } } } // namespace lt