how to implement native rendering plugin #2812
-
|
Subject: Implementing Native Rendering Plugin in Stride Engine Using STRIDE Goal: Replicate Unity’s Native Rendering Plugin workflow in Stride for cross-platform GPU optimization. Background Context In Unity, the NativeRenderingPlugin enables direct C++ GPU communication, bypassing managed-code overhead. Key features include: Low-level API access (DirectX/Vulkan/Metal/OpenGL) for custom rendering pipelines . Thread-safe rendering via GL.IssuePluginEvent to sync Unity’s render thread with native code . Multi-platform support (Windows, Android, iOS, WebGL) . Challenge in Stride Stride’s documentation lacks explicit guidance for native plugin integration at the rendering-thread level. Specific hurdles: Context Sharing Unity Approach: Uses Texture.GetNativeTexturePtr / Mesh.GetNativeVertexBufferPtr . Stride Gap: Equivalent APIs or interop methods are unclear. Thread Synchronization Unity Approach: GL.IssuePluginEvent triggers native callbacks on the render thread . Stride Gap: No documented equivalent event system. Platform-Specific Backends Unity Approach: Backend-specific RenderAPI implementations (e.g., RenderAPIMetal.mm ) . Stride Gap: Stride’s GraphicsDevice abstraction may require adapter patterns. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
I think this is already supported, although it can be improved and documented better. I'm currently in the process of rewriting the DirectX part of Here you can see the NativeBuffer property of While this is For example, this method retrieves the With these, it should be quite simple to interop with any native system, whether in C# or another language. Is that what you were referring to? |
Beta Was this translation helpful? Give feedback.
I think this is already supported, although it can be improved and documented better.
I'm currently in the process of rewriting the DirectX part of
Stride.Graphicsto use Silk.NET (which is a set of lighter, more modern bindings to OpenGL, Vulkan, DX, etc.). In the current state, the graphics objects already have an internal way of accessing the underlying native resource:Here you can see the NativeBuffer property of
Buffer.While this is
internal, there is also apublicset of methods that can be used for marshalling between native types and Stride types:For example, this method retrieves the
ID3D11Resourcefrom any StrideGraphicsResource.With these, it should be quite simple to inte…