DX11 - Updating global buffers?

Started by
4 comments, last by Starnick 10 years, 5 months ago

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

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Advertisement

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 .

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.


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

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

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/


(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 :)

This topic is closed to new replies.

Advertisement