Monogame content builder Compute Shader error loading

Hi,

I want to port my engine to Monogame. Currently my engine, is quite an empty engine. I did use physics in the past with the Jitter physics engine and bepu physics a little bit. My 2022 development was going great i thought, below is a picture of within Virtual Reality with the oculus rift cv1 and touch controllers, where i was able to contruct a scene with many individual voxel meshes, with a voxel virtual desktop and voxel keyboard and a voxel inverse kinematics player controller.

Capture-d-cran-2022-05-13-222134
Photo-GIF-5-22-2022-9-28-36-PM

After my development on Individual mesh Level of Detail and custom dot frustrum culling and distance culling, i decided to dive deep into trying to develop chunk voxel instancing and i succeeded, but it was hard to arrive there and i am not done.

Capture-d-cran-2022-07-07-225847

The problem is that, while i thought i was correctly using the GPU’s capabilities to render a scene, i wasn’t, since i wasn’t using compute shaders for fast GPU calculations. I tried searching for sharpdx compute shaders examples but i didn’t find anything except one example here //https://gist.github.com/oguna/624969e732a868ec17f05694012c1b63 which is a sample code on how to use a compute shader to make a vector sum. But there aren’t any vertex shaders or pixel shaders in that sample that could explain the code i would need to use to send directly from the compute shader towards the vertex shader. When i say that what i am coding isn’t using the GPU capabilities enough, is that i compared with others, for instance Sebastian Lagues Marching Cubes tutorial here, SebLague/Marching-Cubes: Coding Adventure (github.com) where in a scene where putting the ISO at the highest level to barely have lag, there are over 80 million vertices loaded in the scene at times, where if i try and load a big level in my engine i get 30fps and about 4-8 million vertices at most. And i’ve always thought the Sebastian Lagues finished projects very complicated to learn from scratch, but when done in parts, it was easier for me to learn, although i have been a while without using Unity3D and it would bother me to just leave almost everything that i have coded in low-level barebone c# and port to new engine with everything so different.

Monogame for instance, i have found very similar to barebone low-level c#, and i did try in the past Monogame’s engine to incorporate Virtual Reality from the AB3D.oculuswrap, and tried the jitter physics integration, and i enjoyed coding in Monogame. You can find my repositories of my earlier attempts at VR here:

ninekorn/SCCoreSystemsMono: Ab3d OVR wrapper Monogame with jitter physics (github.com)

and here:

ninekorn/monogame-with-physics—VR-and-non-VR: I tried using the repo here https://github.com/mattleibow/jitterphysics but it didn’t work out of the box. so i rebuilt it in monogame 3.8 3.8.0.1641 but using the Jitter physics from the google archive here https://code.google.com/archive/p/jitterphysics/ . It doesn’t include the fixes of github user mattleibow yet on some jitter physics code. The Jitter physics is MIT license and the jitter physics license is written all over the scripts inside of the jitter.dll. The mattleibow repo is probably still working but somehow i wasn’t able to make it work after a while anymore.

and here:

ninekorn/screen-capture-monogame: screen capture using sharpdx in monogame (github.com)

Now, to the root of the problem. I can’t make a single example that uses compute shaders work from here cpt-max/MonoGame-Shader-Samples: Compute, Tessellation and Geometry Shader Samples for MonoGame (github.com)

I tried to follow Monogames compute shader guide below but it doesn’t work. In my own development i could use a vertex and pixel shader and have them be loaded into the content manager mgcb but currently using monogame 3.8.2 and the content builder doesn’t recognize the compute shaders from any samples available.
Docs/MonoGame Compute Shader Guide.md at master · cpt-max/Docs (github.com)

I would really appreciate to have help from the community of monogame regarding how to load compute shaders in monogame 3.8.2, so that i could start learning how to use them properly and to port my engine in monogame, and finally see if my chunked voxel instancing technique with the addition of compute shaders really can be on par with other developers techniques so that i could continue developing on it.

I have tried also using the nugget MonoGame.Framework.Compute.WindowsDX 3.8.2 but to no avail as that either wouldn’t make the content builder work. Trying to load the compute shader example from MonoGame’s compute shader Guide gives the below error which is the same error if i try the samples in the github link i posted above.

thank you for the help,
steve chassé

Edit-2022dec30: i just noticed that the monogame links i posted above are actually coming from a custom fork.

What error messages do you get?

You are probably using the standard content builder, not the custom one with compute shader support.
Check the build requirements.

yeah, i realized it could be something of that nature when i noticed it was a custom fork. I must admit it looks great thought the custom fork but i thought it was the official monogame repository. I might try to use the custom fork and see if i can make it work later.

On another note, i am attempting to make the example of compute shader sharpdx work on my engine. I thought it was as simple as creating a structuredbuffer for the vertex shader inside of the vertex shader;

StructuredBuffer bufferInReadOnly : register(t1);

and assigning a ShaderResourceView to the vertex shader after the compute shader dispatch call in c# to read from the computebufferout of the compute shader:

deviceContext.Dispatch(10, 1, 1);
bufferforvertexshader[0] = new ShaderResourceView(sccsdirectx.D3D.Device, computebufferout[0], srvDesc);
deviceContext.VertexShader.SetShaderResource(1, bufferforvertexshader[0]);

But that isn’t working perfectly yet as accessing the buffer isn’t working as expected yet from the vertex shader.

It’s different than on monogame’s custom fork which resembles a lot how to do it in Unity3D with the ability to directly use strings to access variables within the compute shader.

My repositories are opensourced and MIT on github though, for those interested in looking at them, but keep in mind that without compute shaders, they won’t match anything in raycasting/raytracing or anything of the same kind using compute shaders when regarding voxel levels or voxels anything really.

Thank you Marcus for your time and for answering. It seems that by finding out how to use compute shaders in low-level, that i might be porting my engine a tid bit later, or wait for the official release of monogame 3.9 which might include compute shaders or not.

ninekorn