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

Expose RenderingDevice::get_context_driver() #10081

Open
kroketio opened this issue Jun 30, 2024 · 0 comments
Open

Expose RenderingDevice::get_context_driver() #10081

kroketio opened this issue Jun 30, 2024 · 0 comments

Comments

@kroketio
Copy link

Describe the project you are working on

We are investigating the viability of developing UI middleware for Godot, similar to Scaleform or Coherent UI. Our solution would allow for quick development of complex user-interfaces using well-known technologies.

Describe the problem or limitation you are having in your project

For our Vulkan MVP we pass a VkInstance to our library via RenderingDevice::get_singleton()->get_context_driver()->instance. This device serves as rendering context in order to do graphics work.

auto ds = DisplayServer::get_singleton();
auto rd = RenderingDevice::get_singleton();
if(ds->get_name() == "X11" && [vulkan check]) {
  auto *rc = static_cast<RenderingContextDriverVulkanX11*>(rd->get_context_driver());
  UILib::init_vulkan(rc->instance);
  [...]

However RenderingDevice::get_context_driver() is not exposed in godot-cpp. Preferably our solution is distributed as a GDExtension that works with a vanilla Godot and does not require compilation.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

In order to get something exposed in godot-cpp, it has to first be exposed to scripting, so we propose to expose RenderingDevice::get_context_driver().

We believe context sharing is a valid mechanism and has previously been observed in Ogre3D, and Qt. It allows to mix/merge 2 separate (but similar) rendering engines.

An alternative for us is external memory (sharing VRAM, VkExportMemoryAllocateInfo) but this requires specific code per graphics backend, as well as making things more complex.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

If this enhancement will not be used often, can it be worked around with a few lines of script?

Is there a reason why this should be core and not an add-on in the asset library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants