Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Complexity with Other Graphic APIs #1701

Closed
wants to merge 7 commits into from
Closed

Handling Complexity with Other Graphic APIs #1701

wants to merge 7 commits into from

Conversation

Just-Feeshy
Copy link
Contributor

@Just-Feeshy Just-Feeshy commented Jul 24, 2023

**I plan to extend capabilities beyond OpenGL to new potential graphic APIs like Vulkan, DirectX, or Metal. As the first step, I plan to make the backend more modular using macro definitions. To showcase the concept, I've applied these changes in my project using a forked version of Lime called: lib-lime-project. This allows my project beyond GL APIs and paves the way for new graphical interfaces.

For illustration, please look at the following screenshot, where I've applied macro definitions for Vulkan.

Screen Shot 2023-07-24 at 11 01 12 AM**

@player-03
Copy link
Contributor

A promising start.

I wonder if we could find a more descriptive name for Definitions.h, though. GraphicsAPI.h? RenderBackend.h?

@Just-Feeshy
Copy link
Contributor Author

That's a good idea!

@loudoweb
Copy link
Member

Great! Looks interesting!

What is the easier way to test Vulkan with Lime?

@Just-Feeshy
Copy link
Contributor Author

Just-Feeshy commented Sep 29, 2023

Great! Looks interesting!

What is the easier way to test Vulkan with Lime?

The easier way I found was by putting these macro definitions (This is the sudo code for the example). It won't conflict with OpenGL bindings when using Vulkan or any other Graphics API.

#ifdef LIME_VULKAN
    #define Context std::shared_ptr<lime::vulkan::ContextVulkan>

    #define CreateContext lime::vulkan::GraphicsHandler::CreateContext
    #define DeleteContext lime::vulkan::GraphicsHandler::DestroyContext
    #define MakeCurrent lime::vulkan::GraphicsHandler::MakeCurrent
    #define SetSwapInterval lime::vulkan::GraphicsHandler::SwapInterval
    #define GetDrawableSize SDL_Vulkan_GetDrawableSize
    #define WINDOW_GRAPHICS SDL_WINDOW_VULKAN

    #define SetAttribute EMPTY
    #define SwapWindow EMPTY
#endif

While these macro definitions significantly contribute to the solution, further steps must be undertaken to implement it entirely, but I believe this is a promising starting point.

(This is a repost with the quote reply)

@Just-Feeshy Just-Feeshy closed this by deleting the head repository May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants