Jump to content


Help using constant buffer


  • You cannot reply to this topic
No replies to this topic

#1 XVincentX

    Valued Member

  • Members
  • PipPipPip
  • 115 posts

Posted 11 December 2008 - 01:39 PM

Hello.
After a lot of work with shaders without taking care of constant buffer, i decided to use it in order to improve my software rendering speed.

I'm using ID3D10Effect interface, that let me get CostantBuffer by name and by index.

So i thought "I do not need to create a my own costant buffer, i can update the one i can get from effect interface:"

ID3D10Buffer *CBuffer;
Effet->GetConstantBufferByIndex(0)->GetConstantBuffer(&CBuffer);




Now, how can i update it in the quickly possible way? Map or UpdateSubResource?

Device->UpdateSubresource(CBuffer,0,0,&data,0,0);




Anyway, after update or map, have i to bind again to the Effect using SetConstantBuffer? Or the reference will take care automatically?

Question 2:
If i've got a constant buffer with 3 matrices, if i update only 1 using ->SetMatrix function, will the GPU update ENTIRE buffer? Or will wait for the Apply(0) function to bind entire new buffer?

Thank you!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users