Sign in to follow this  
martinperry

[SOLVED] SlimDX - Instancing problem

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this