Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBornToCode

Posted 01 June 2013 - 11:02 AM

Now to answer your other question, the reason why I want to access it. Let's say I have a buffer X that has been updated and outputted in an OuputStream. How do I read that output stream back on the CPU if I want to that since the CPU cannot read the resource.

You use a staging buffer - that is its whole purpose for existing, just to give  you CPU read access to the GPU based resource objects.  You can write to buffers directly with the appropriate flags, but reading requires a separate buffer.  If you don't like hassling with the copy, then just write a small wrapper for your buffers that handles the copying and mirroring of the buffer data for you.

 

However, I would invest in a technique that could just directly use the stream output buffers without CPU intervention.  That will make the whole thing much faster, reducing bandwidth requirements, and eliminating the need for a staging buffer altogether.  This of course assumes that you don't need to store the data for whatever reason, but if you are only going to consume the contents then it would be far better just to use it directly.

That is what i meant in my first post. I would need to have a staging buffer and and dynamic buffer. Why do i need t o create two buffers. If i did not care about reading the ouput stream, then what you mention would have work and i would not have posted this in the first place. But i want to be able to access the buffer on the CPU for Read Access with a Bind Flag, without having to duplicate anything similar to how DirectX9 works. But it seems like there is no way to do what i want to do in DX11 without having the darn staging buffer. I need to read that buffer on the CPU because after the ouputStream is filled up i am doing something with it on the CPU side. For now i will just do the two buffer route just to get this working. Thanks everyone for the help.


#3BornToCode

Posted 01 June 2013 - 11:01 AM

Now to answer your other question, the reason why I want to access it. Let's say I have a buffer X that has been updated and outputted in an OuputStream. How do I read that output stream back on the CPU if I want to that since the CPU cannot read the resource.

You use a staging buffer - that is its whole purpose for existing, just to give  you CPU read access to the GPU based resource objects.  You can write to buffers directly with the appropriate flags, but reading requires a separate buffer.  If you don't like hassling with the copy, then just write a small wrapper for your buffers that handles the copying and mirroring of the buffer data for you.

 

However, I would invest in a technique that could just directly use the stream output buffers without CPU intervention.  That will make the whole thing much faster, reducing bandwidth requirements, and eliminating the need for a staging buffer altogether.  This of course assumes that you don't need to store the data for whatever reason, but if you are only going to consume the contents then it would be far better just to use it directly.

That is what i meant in my first post. I would need to have a staging buffer and and dynamic buffer. Why do i need t o create two buffers. If i did not care about reading the ouput stream, then what you mention would have work and i would not have posted this in the first place. But i want to be able to access the buffer on the CPU for Read Access with a Bind Flag, without having to duplicate anything similar to how DirectX9 works. But it seems like there is no way to do what i want to do in DX11 without having the darn staging buffer. I need to read that buffer on the CPU because after the ouputStream is filled up i am doing something with int on the CPU side.


#2BornToCode

Posted 01 June 2013 - 11:00 AM

Now to answer your other question, the reason why I want to access it. Let's say I have a buffer X that has been updated and outputted in an OuputStream. How do I read that output stream back on the CPU if I want to that since the CPU cannot read the resource.

You use a staging buffer - that is its whole purpose for existing, just to give  you CPU read access to the GPU based resource objects.  You can write to buffers directly with the appropriate flags, but reading requires a separate buffer.  If you don't like hassling with the copy, then just write a small wrapper for your buffers that handles the copying and mirroring of the buffer data for you.

 

However, I would invest in a technique that could just directly use the stream output buffers without CPU intervention.  That will make the whole thing much faster, reducing bandwidth requirements, and eliminating the need for a staging buffer altogether.  This of course assumes that you don't need to store the data for whatever reason, but if you are only going to consume the contents then it would be far better just to use it directly.

That is what i meant in my first post. I would need to have a staging buffer and and dynamic buffer. Why do i need t o create two buffers. If i did not care about reading the ouput stream, then what you mention would have work and i would not have posted this in the first place. But i want to be able to access the buffer on the CPU for Read Access with a Bind Flag, without having to duplicate anything similar to how DirectX9 works. But it seems like there is no way to do what i want to do in DX11 without having the darn staging buffer.


#1BornToCode

Posted 01 June 2013 - 10:59 AM

Now to answer your other question, the reason why I want to access it. Let's say I have a buffer X that has been updated and outputted in an OuputStream. How do I read that output stream back on the CPU if I want to that since the CPU cannot read the resource.

You use a staging buffer - that is its whole purpose for existing, just to give  you CPU read access to the GPU based resource objects.  You can write to buffers directly with the appropriate flags, but reading requires a separate buffer.  If you don't like hassling with the copy, then just write a small wrapper for your buffers that handles the copying and mirroring of the buffer data for you.

 

However, I would invest in a technique that could just directly use the stream output buffers without CPU intervention.  That will make the whole thing much faster, reducing bandwidth requirements, and eliminating the need for a staging buffer altogether.  This of course assumes that you don't need to store the data for whatever reason, but if you are only going to consume the contents then it would be far better just to use it directly.

That is what i meant in my first post. I would need to have a staging buffer and and dynamic buffer. Why do i need t o create two buffers. If i did not care about reading the ouput stream, then what you mention would have work and i would not have posted this in the first place. But i want to be able to access the buffer on the CPU, without having to duplicate anything similar to how DirectX9 works. But it seems like there is no way to do what i want to do in DX11 without having the darn staging buffer.


PARTNERS