plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

SimGoGo avatar image
SimGoGo asked SimGoGo answered

Get texture created in outside exe in c++ WASM module

Dear ASOBO, dear MSFS developers!

First of all - thanks for your efforts in developing SDK and supporting this community.

May I ask You to reveal possible ways to get textures in WASM module (for next drawing to gauges/panel) created in an external EXE. Sure, no problem to render any 2D gauges in external exe module using any of OpenGL/DirectX/Vulcan/GDI+ to some texture/framebuffer. But is it possible and how to practically get this texture or framebuffer using nanoVG c++ code within gauge WASM module?

And if several ways are possible - please advise the best one in Your opinion.

gaugeswasmc++nanovg
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered FlyingRaccoon commented

Hello @SimGoGo

The first question I'd ask would be: what prevents you from rendering that texture directly in your WASM module rather than trying to pass it from an external exe to the module?

If you are accessing data you can't have access to through WASM, I'd say there's no solution at the moment. You could technically render this texture to a file and load it in your module but I doubt it will be efficient.

Maybe a better solution will come with the network API we are working on as it will allow you to pass information between an external exe and your module.

Regards,
Sylvain

2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

SimGoGo avatar image SimGoGo commented ·

what prevents you from rendering that texture directly in your WASM module

Thank you for your answer, Sylvain. I am care about performance aspect in this case. The concept may be different (I mean "heavy" aircraft with very complex displays in this case):

1.

- Calculate aircraft systems in exe with minimum performance loss

- Calculate and draw all displays in exe

- Use WASM to render on panel that predrawed textures (need a way to transfer it from exe->WASM)

2.

- Calculate systems and displays in WASM and render 2D displays in WASM to panel

3.

- Some "Mixed" approach of 1 and 2.


So, as WASM limited with functions/memory/multithreading/performance - do some part of job in external exe - is a good idea. So, at least All systems and drawing data may be calculated in exe. But if use WASM for drawing as next step - need transfer precalculated drawing data for displays (color and positions of graphic primitives, values and so on) from EXE->WASM. This is not trivial task to send drawing data flow from one module to another.

As I see - Fenix A320 show a mixed way with very good results - most of job executed in exe - and some - in WASM.

So, be good if ASOBO may explain a native or advanced way to use similar "mixed" approach, at least for heavy drawing purpose. If texture rendering in external exe with "reading" it in WASM for next panel drawing not possible - what will be better way to calculate and draw very complex displays on your opinion, please? I mean without performance loss, for sure.

0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ SimGoGo commented ·
Hello @SimGoGo


Have you actually tried to run your systems in a WASM module and experienced performance issue you can report?
Several studios also have ported their whole systems (complex ones) to WASM with success so unless you have experienced some issues already, I'd say you should give it a try and we will be interested to know and help if you encounter performance issues.

If you want to stick to the external exe, I'd say the best option at the moment would be a mix where the rendering is done in WASM and you pass the data needed for it using SimConnect Client Data. But the time you think you gained by running your logic in an external exe will be lost waiting for the data to reach the WASM module so don't expect any miracle.

Let us know what solution you chose in the end and what result you got.

Regards,
Sylvain


0 Likes 0 ·
SimGoGo avatar image
SimGoGo answered

the best option at the moment would be a mix where the rendering is done in WASM and you pass the data needed for it using SimConnect

Thank you, Sylvain. Already done some part of job with WASM only, but look like I need to try both this ways to determinate better concept. I will inform about result.


10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.