Jump to content

  • Log In with Google      Sign In   
  • Create Account

help with creating a structured buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 champloo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 09 January 2013 - 01:11 AM

Hi,
 
here is what I am trying to do, which is just to create a structured buffer.


    D3D11_BUFFER_DESC sb_desc;
    sb_desc.ByteWidth = stride * numElements;
    sb_desc.Usage = D3D11_USAGE_DEFAULT;
    sb_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
    sb_desc.CPUAccessFlags = 0;
    sb_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
    sb_desc.MiscFlags |= drawIndirect ? D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS : 0;
    sb_desc.StructureByteStride = stride;
    DXCall( device->CreateBuffer( &sb_desc, NULL, &sb ) );

It fails every time, and if I remove the D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS flag, the error goes away.

 

I've tried different parameters but no luck at this point.

Any help is appreciated.



Sponsor:

#2 MJP   Moderators   -  Reputation: 11347

Like
0Likes
Like

Posted 09 January 2013 - 03:15 AM

Create your device with the D3D11_CREATE_DEVICE_DEBUG flag and it will tell you why it's failing. If i recall correctly you can't use a structured buffer as an indirect args buffer, you have to make it a raw buffer instead (ByteAddressBuffer).



#3 champloo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 09 January 2013 - 02:18 PM

Create your device with the D3D11_CREATE_DEVICE_DEBUG flag and it will tell you why it's failing. If i recall correctly you can't use a structured buffer as an indirect args buffer, you have to make it a raw buffer instead (ByteAddressBuffer).

 

Thank you so much. you are right, structured buffer cannot be used as an indirect args buffer.

didn't know I can create device with the debug flag, it's very helpful.



#4 Jason Z   Crossbones+   -  Reputation: 5062

Like
0Likes
Like

Posted 09 January 2013 - 08:16 PM

Create your device with the D3D11_CREATE_DEVICE_DEBUG flag and it will tell you why it's failing. If i recall correctly you can't use a structured buffer as an indirect args buffer, you have to make it a raw buffer instead (ByteAddressBuffer).

 

Thank you so much. you are right, structured buffer cannot be used as an indirect args buffer.

didn't know I can create device with the debug flag, it's very helpful.

 

It is usually a good idea to add the flag in debug builds, and to not add it in release builds, since the end user may or may not have the ability to create a device with the debug flag active.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS