Jump to content

  • Log In with Google      Sign In   
  • Create Account


Magic function called DrawIndexedInstancedIndirect


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
5 replies to this topic

#1 wh1sp3rik   Members   -  Reputation: 248

Like
0Likes
Like

Posted 15 February 2013 - 02:55 PM

Hello,

 

I am trying to get more information about this function and how to use it.

 

From very few information, i found on the internet, i should be able to pass some parameters.

In my case, i would like to say, i want to render INSTANCES with index 5 to 20, 25 to 65 from one buffer.

 

Is it possible with this function ?

 

Thank you very much.


DirectX 11, C++


Sponsor:

#2 MJP   Moderators   -  Reputation: 10945

Like
2Likes
Like

Posted 15 February 2013 - 04:31 PM

It is not magic. It executes a DrawIndexedInstanced call, but with the arguments coming from a buffer instead of being passed in. The buffer should contain the same arguments passed to DrawIndexedInstanced, in the same order. The easiest way to do it is with a structured buffer that uses this as its struct:

 

struct DrawArgs
{
   uint IndexCountPerInstance;
   uint InstanceCount;
   uint StartIndexLocation;
   int BaseVertexLocation;
   uint StartInstanceLocation;
};


#3 wh1sp3rik   Members   -  Reputation: 248

Like
0Likes
Like

Posted 15 February 2013 - 04:38 PM

Thank you :)

 

How about performace ?  is it better to use DrawIndexedInstancedIndirect or call DrawIndexedInstanced X times ?

I don't know how DrawIndexedInstancedIndirect works internaly, but i thought, i just pass these buffers and GPU will do that instead this function calls DrawIndexedInstanced several times.


DirectX 11, C++


#4 Jason Z   Crossbones+   -  Reputation: 4905

Like
1Likes
Like

Posted 15 February 2013 - 05:26 PM

The intent of the function is to allow using GPU generated data to control the execution of the draw call.  The CPU still calls the function, but the args reside in a buffer which can be controlled by the GPU (presumably through the Compute Shader).  So it would be hard to say which one is more performant, but I would guess that the non-indirect version would be slightly faster.  That's only a guess though, so you should try it out both ways and determine which one works best in your scene / driver / GPU configuration.



#5 wh1sp3rik   Members   -  Reputation: 248

Like
0Likes
Like

Posted 15 February 2013 - 05:41 PM

Thanks.

 

Ah, it killed my idea :) It will be nice to pass Index buffer, where you can store instance index. So it will work same way like index buffer for vertex buffer.

Is this possible ?


DirectX 11, C++


#6 MJP   Moderators   -  Reputation: 10945

Like
0Likes
Like

Posted 15 February 2013 - 05:43 PM

It's possible, you would just have to do it yourself in the vertex shader instead of letting the Input Assembler do it all for you.






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