   What's the point of DrawPrimitiveUP?
  I was just reading through the DX9 docs and saw the DrawPrimitiveUP function. I was wondering what it is commonly used for as it is described as "intended for use in applications that are unable to store their vertex data in vertex buffers," and so I assume it is slower than if vertex buffers were used. Is this a correct assumption? What are some examples of cases where vb''s can''t be used? 
  My understanding is that yes, it is slower (and much slower at that).  I think that vertex buffers can be stored in the graphics accelerator memory, while user pointers (UPs) are always in main memory.I''m not sure when vertex buffers would be unavailable, but I have been tempted to use UPs to try to simplify going from non-DX-specific code to DX code.  For example, if I have just read in a bunch of vertices to my physics engine, it''s tempting to just use the same array for graphics. ;  There's not a case where VBs truly can't be used.  If you have the pointer and other information to pass into DPUP, then you have the information you need to copy the vertices into a vertex buffer (which is what DPUP does internally).If you find yourself in a situation where you have a small number of vertices that you're going to have to copy into a vertex buffer and you can't avoid the copy -- maybe the vertices are generated by a library or something -- then you might as well call DPUP for simplicity.  Maybe the number of vertices is too small to bother about, like for UI buttons and such.  DPUP saves you some trouble and makes your code simpler.  Just don't use it for heavy lifting because it always involves making a copy of the vertex data (EDIT: each time you call it).   [edited by - donavon keithley on February 8, 2004 11:43:38 PM];  I know DrawPrimitiveUP is suposed to be alot slower that the standard DrawPrimitive, but I was having trouble rendering the graphics of my 2d game on an old computer using UP and I then switched everthing over to vertex buffers (with the least possible locks per frame). I was alarmed to find that I had gained a mere 1-3 frames. I then concluded that for a 2d game that does not require much graphics power it was simply not worth the trouble of managing vertex buffers. ;  I can imagine cases in a 3D app where using DPUP instead of vertex buffers might very well make no difference whatsoever.  For instance if you''re doing lots of complex pixel shading on the GPU and all the time''s being spent on the back end of the GPU pipeline, then the CPU''s going to be sitting around idle part of the time anyway.  The extra time spent in DPUP will be masked.That''s why the first rule of optimizing is: Find The Bottleneck.  There''s no point in optimizing one part of the pipeline when another part is taking up all the time.  Your optimizations might be perfectly good but you''ll measure and scratch your head wondering why it didn''t seem to make much difference.I don''t mean to encourage cozying up to DPUP.  The second rule of optimizing is: Don''t Be a Fool by Creating Unnecessary Bottlenecks. :-)  Use vertex buffers for all but the simplest meshes. ;  For what it''s worth I tend to use DPUP for situations where I want quick results; e.g. prototyping a quick game idea or physics simulation where awesome rendering performance is not necessary. The DPUP is also useful when porting graphics code to DirectX from some other API.Regards,Sharky   ---< Sharky''s Coding Corner >< Coder @ Strangelite >--- ;  I just used it in my most recent game engine update. I used it in my terrain rendering class. I created a terrain class that is generated using a heightmap. I started drawing 2 triangles at a time while looping through all the rows/columns, meaning I was basically just drawing one quad at a time. Instead of initializing a vertex buffer, and having to update it every loop iteration I used DPUP with my terrain vert information.I assumed that when I initialized my terrain, all the information for the terrain was kept in my 2D array of verts, and that it would be much faster then copying and replacing a vert buffer every loop iteration then to memcpy my values over to a simple array.The array is actually very inefficient in my current iteration because I use 6 verts and draw using a triangle list instead of a strip.   In the making Tread Wars - Tank Battle gamePowered by SKEnginehttp://www.highendgaming.com;  I use it in a lot of tools where I am trying to display 3D data that changes every frame both in vertex position and vertex count. ;quote:Original post by jack_1313   I know DrawPrimitiveUP is suposed to be alot slower that the standard DrawPrimitive, but I was having trouble rendering the graphics of my 2d game on an old computer using UP and I then switched everthing over to vertex buffers (with the least possible locks per frame). I was alarmed to find that I had gained a mere 1-3 frames. I then concluded that for a 2d game that does not require much graphics power it was simply not worth the trouble of managing vertex buffers.   That's because you were doing something horribly wrong. Never ever ever use DrawPrimitiveUP for anything other than testing.[edit] And it's spelled "a lot"...   [edited by - Raloth on February 9, 2004 9:54:41 PM];quote:That's because you were doing something horribly wrong.No, it's because he's not CPU bound or he's not pushing a lot of vertices relative to the rest of the load per frame.  Maybe you didn't read my response before posting?   [edited by - donavon keithley on February 9, 2004 12:36:32 AM]