Sign in to follow this  
RCL

How to UnsetStreamSource()?

Recommended Posts

Hi, How do I unset stream source which is no longer needed? I thought it is done by passing NULL as pointer to vertex buffer in SetStreamSource, but this does not work. Debug runtime (9.0c) reports an error ('Stream 5 size is too small'), although SetStreamSource for stream 5 has been set to NULL (and vertex shader does not declare components from that stream). Even more weird, calling GetStreamSource() having called SetStreamSource( 5, NULL, 0, 0 ) returns pointer to vertex buffer == NULL, but stride == 12! I tried looking up documentation, but I failed to find how to unset stream source in DX9.0 help. DX8.1 SDK help tells that application should pass NULL to SetStreamSource when 'vertex buffer is no longer needed', but DX9.0 documentation tells absolutely nothing about that. Thanks in advance. Cheers, RCL

Share this post


Link to post
Share on other sites
Yes, you set it to NULL, but you also need to change the declaration - you cant reference a stream that isn't bound.

Also, for performance reasons, 6 streams is a lot of streams.

Share this post


Link to post
Share on other sites
Quote:
Original post by DBX
Yes, you set it to NULL, but you also need to change the declaration - you cant reference a stream that isn't bound.


Where can I find that statement in documentation? DIP calls do not fail (even with Debug runtime and Max Validation on) if the shader does not declare any components from that stream and if that stream was not set.

It is only after setting the stream once (for particular shader that requires components from that), when DIP (for next shader without that component) starts to fail (in Debug runtime).

Quote:
Original post by DBX
Also, for performance reasons, 6 streams is a lot of streams.


I haven't compared against single-stream version, but performance is sufficient for me :-) And I have some flexibility when locking buffers for particular components ;)

Cheers,
RCL

Share this post


Link to post
Share on other sites
Quote:
Original post by RCL
It is only after setting the stream once (for particular shader that requires components from that), when DIP (for next shader without that component) starts to fail (in Debug runtime).


What are your declarations for both cases? You need to make sure the stride of the bound vertex buffers match that specified in the declaration.

Quote:

I haven't compared against single-stream version, but performance is sufficient for me :-) And I have some flexibility when locking buffers for particular components ;)


It's not a major issue, but fewer sources are usually better - unless you are doing something which is more optimal with more sources.

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