[Flex] Direct3D11 Get/Set buffer issues

Hello, I started to use Flex 1.1 and had the following issues.

I create a Flexlibrary instance and a Solver with Compute11 flag.

Function works when using a buffer created with host, but when trying to pass a Direct3D11 Buffer using
NvFlexRegisterD3DBuffer some are working, some throw an access violation:

I used either Default/Staging structured buffers for the tests (and made sure that size is big enough in every case.
If needed I can provide repro

the following work passing a Direct3D Buffer
NvFlexGetActive
NvFlexGetParticles
NvFlexGetPhases
NvFlexGetSmoothParticles

the following ones throw an access violation
NvFlexGetVelocities

NvFlexSetParticles
NvFlexSetVelocities
NvFlexSetPhases
NvFlexSetActive

Thanks
Julien

Thanks for the report Julien,

We will take a look at this and try to repro this here. One issue may be that the structured buffers would need to have the expected layout, e.g.: float3 for velocities, int32 for active set, etc.

Cheers,
Miles

Hello, thanks for the answer

I made sure that for velocities buffers are set to float3 indeed (I actually tried both with float3 float4, but I generally made sure buffers are large enough too, since CopySubresourceRegion should normally be ok with buffer description .

Please note I’m using 64 bits version (I did not try 32 bits), both debug and release give the same errors

I tried with all type of buffers (raw/vertex/staging) and the methods that works do with any type (as long as NvFlexRegisterD3DBuffer elemetncout/stride is set accordingly.

Also NvFlexGetSprings in that case does not crash, but does not copy back any data.
I also have NvFlexGetNormals that gets me an Access violation as well (I made sure to use float4 in that case, copying back on an Host buffer was no problem).

Also speaking about Direct3D11 interop, I was curious if it would be possible to use :
NvFlexUpdateDistanceField by passing a Volume texture at some point (Since I guess it gets copied into one anyway, but in my use cases a lot of my distance fields are already generated in compute shader, so that would save a round trip)

In case of NvFlexUpdateTriangleMesh I guess the bounding volumes are done on cpu so it’s probably a non option.

Hi Julien,

I have sent you a private message.

Cheers,
Cheng

a have similar problem with NvFlexRegisterD3DBuffer for StructuredBuffer

This is happening on NvFlexGetSmoothParticles
i feel like some of that difficulty was because of memory pool of structured buffer (default pool)

As a side note, I did update to 1.2 beta, and with the new copy api the Get/Set specified above are working as intended.

@mira :

NvFlexGetSmoothParticles requires float4 (16 byte aligned).