Jump to content

  • Log In with Google      Sign In   
  • Create Account


DX11 - Updating global buffers?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

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

#1 Migi0027   Crossbones+   -  Reputation: 1536

Like
0Likes
Like

Posted 10 November 2013 - 09:50 AM

Hi guys! happy.png

 

So I'm in the process of improving my material system, and what I'm trying to accomplish now, using the reflection api, is to make the user able to assign their variable values by their name, going well for now, but!

 

Whenever I define a global variable in my shader, let us call it _mSize,  I can retrieve all kinds of information from it, it's offset, size, etc... These variables which aren't assigned to a buffer are put inside a global buffer (denoted as $Global in the docs), but is there any kind of way that I can modify/update this buffer, is it even possible?

 

Thank you, as usual. smile.png

-MIGI0027


Edited by Migi0027, 10 November 2013 - 09:52 AM.

Hi! Cuboid Zone

The Rule: Be polite, be professional, but have a plan to kill everyone you meet


Sponsor:

#2 tonemgub   Members   -  Reputation: 775

Like
0Likes
Like

Posted 10 November 2013 - 02:11 PM

The Effects framework allows you to update global shader variables by variable name.

 

Another way (the preffered way in DX11?) would be to use shader reflection to update the variables: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476591%28v=vs.85%29.aspx .



#3 Starnick   Members   -  Reputation: 1167

Like
1Likes
Like

Posted 10 November 2013 - 04:47 PM

The $Globals constant buffer is not anymore special than the ones you explicitly declare, it'll show up through the reflection interfaces (probably always index 0). So if you already have a scheme going with querying meta data, and updating buffers with your variables, it's the same exact procedure.


Edited by Starnick, 10 November 2013 - 04:48 PM.


#4 tonemgub   Members   -  Reputation: 775

Like
1Likes
Like

Posted 11 November 2013 - 01:16 AM


(probably always index 0)

Not if there's another buffer specifically declared at cb0. For this and other reasons, the compiler gives no guarantee that $Globals will be at a specific index, so you have to query it by name.



#5 Migi0027   Crossbones+   -  Reputation: 1536

Like
0Likes
Like

Posted 11 November 2013 - 07:56 AM

Alright, thanks for the input, really appreciate it! wink.png

 

I'll try and see if I can succeed in fetching the variables from the global buffer. What I guess that I do is simply query the variable by name, then find the buffer from that variable, and go on from there.

 

Thanks guys!

-MIGI0027


Edited by Migi0027, 11 November 2013 - 07:56 AM.

Hi! Cuboid Zone

The Rule: Be polite, be professional, but have a plan to kill everyone you meet


#6 Starnick   Members   -  Reputation: 1167

Like
0Likes
Like

Posted 11 November 2013 - 09:24 AM

 


(probably always index 0)

Not if there's another buffer specifically declared at cb0. For this and other reasons, the compiler gives no guarantee that $Globals will be at a specific index, so you have to query it by name.

 

 

True, true. I was thinking if you didn't explicitly assign any CB's to a register. But yeah "always" doesn't fit :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS