Jump to content
  • Advertisement
Sign in to follow this  
martinperry

[SOLVED] SlimDX - Instancing problem

This topic is 3025 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have succesfully implementted HW SM3 instancing. However, i got this error
error: [5220] Direct3D9: (ERROR) :Frequency divider is not allowed with hardware vertex processing for non-indexed primitives. DrawPrimitive fails. (DrawIndexedPrimitive may work better.)  
After instancing i do this:
device.SetStreamSource(0, null, 0, 0);
device.SetStreamSource(1, null, 0, 0);

device.SetStreamSourceFrequency(0, 0, StreamSource.IndexedData); 
device.SetStreamSourceFrequency(1, 0, StreamSource.InstanceData);
When i want to draw pointList in particle engine... what can i do about it ? If I turn off DX Debug mode, everything look correct and worked, but in debug mode its error.. I am using latest SlimDX under C# [Edited by - martinperry on March 8, 2010 9:52:43 AM]

Share this post


Link to post
Share on other sites
Advertisement
You have to use indexed primitives with hw instancing. In other words, you need to use an index buffer.

Share this post


Link to post
Share on other sites
So if i use instancing i can never use primitives without IB ? Even if i am done with instancing ?

I want to draw particles at the end of the scene as point list, but there can not be used IB :/

Share this post


Link to post
Share on other sites
Sorry, I misunderstood what the problem was. I think you're just not properly deactivating instancing. Try setting the frequency to 1 instead of 0.

Share this post


Link to post
Share on other sites
Okay so I'm looking through the SlimDX source code, and it looks like it's an issue with their SetStreamSourceFrequency wrapper. In native DX9 to deactivate instancing you do something like this:

device->SetStreamSourceFreq(0, 1);
device->SetStreamSourceFreq(1, 1);


However in SlimDX you have this:

Result Device::SetStreamSourceFrequency( int stream, int frequency, StreamSource source )
{
int value;
if( source == StreamSource::IndexedData )
value = D3DSTREAMSOURCE_INDEXEDDATA;
else
value = D3DSTREAMSOURCE_INSTANCEDATA;

HRESULT hr = InternalPointer->SetStreamSourceFreq( stream, value | frequency );
return RECORD_D3D9( hr );
}


The problem here is that you could never get that function to pass a value of 1 to the native implementation. I'm not super-familiar with SlimDX so it's possible that I'm not aware of something that would allow you do that, but from my cursory glance it looks like this functionality is missing.

I would suggest that you edit the title of your thread to include "SlimDX", so that one of the SlimDX developers can come in here and comment on this. I'll also PM one of them to ask about it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!