Multiple blade backends (Vulkan/Metal or GLES)#14931
Conversation
|
I think we’ll need to find an alternative approach that doesn’t rely on The approach is too magical and comes at the cost of code clarity. |
|
Other solutions for compiling the same code with different blade namespaces would be: Use symlinks or Another solution would be to use generics, so structs of the same module can be instantiated with Vulkan/Metal or GLES backend specified as type parameter. However, @kvark does not want to offer traits over multiple backends, also for "code clarity" reasons. Would you accept the large macro solution? Otherwise, you probably need to discuss this with @kvark. |
|
To clarify, Blade does have traits - https://github.com/kvark/blade/blob/main/blade-graphics/src/traits.rs
It could be useful for this situation to at least expose the traits in public, maybe expand to cover a bit more functionality. |
|
I’m going to close this until we decide it’s something we want to move forward with. |
This adds multiple blade backends to zed. Vulkan or Metal is used by default. The environment variable
USE_GLES=1can be set to switch to GLES. This depends on kvark/blade#148.The implementation uses a file-based polymorphism approach, where the same file is included twice in the default and gles module by using the same
pathattribute. This approach was chosen, because blade does not expose everything as traits. Both backends expose adyn BladeRenderertrait object, so there is little performance overhead, basically just one indirection on every draw scene call.