aconstlink / natus

[Discontinued] Software Framework for Audio/Visual/Interactive Real-Time Applications
https://aconstlink.de
MIT License
0 stars 0 forks source link

Reading from Streamout Object as Buffer fails #328

Closed aconstlink closed 1 year ago

aconstlink commented 1 year ago

When reading from a streamout_object bound as a buffer to a HLSL shader for data access, there seems to be missing some data. This is not the case when using a buffer from an array_object. The image is from a more complex test that uses nsl and performs a particle simulation loop using a streamout/feedback shader.

image

The left side shows the d3d11 version where some particles(points) are missing as the data is rendered using quads and read from a buffer.

This should be fixed immediately due to the streamout techniques central usability.

aconstlink commented 1 year ago

The error was due to a wrong setting in the D3D11_SHADER_RESOURCE_VIEW_DESCs buffer field, where the number of elements needed to be set to the number of elements in the streamout buffer times the number of layout elements.

res_desc.Buffer.NumElements = UINT( obj.size() * obj.get_buffer(i).get_num_layout_elements() ) ; 
image