I'm trying to use my gpu for computations only (I don't even create a swap chain). But I'm not sure how to retrieve a data after shader do it's job. I want to modify the same data I passed. For this I'm using single structured buffer binded as D3D11_BIND_UNORDERED_ACCESS.
As far as I know I need to use D3D11_CPU_ACCESS_READ together with D3D11_USAGE_STAGING. But in this case I have an error:
A D3D11_USAGE_STAGING Resource cannot be bound to any parts of the graphics pipeline, so therefore cannot have any BindFlags bits set.
My next approach was to create a structured unordered buffer with D3D11_USAGE_DEFAULT usage. I applied calculations on it, next I called
to copy this buffer to the one with D3D11_CPU_ACCESS_READ and finally read the data. But I'm not sure this is a correct way - I don't like this extra copying between resources.
@ninnghazad, I see you misunderstood a question. I know how to obtain all the information I need (btw, why are you strongly suggest not do so?). All I want to know how to use this info or how other do it.
One more example - I have a laptop with 2 gpus. Obviously that only one - integrated gpu have an output. The more powerful discrete gpu don't have outputs. Following your words I should ignore it. But of course I shouldn't and in fact I'm using only it for games. But how does system knows where to output a picture in that case. Personally for me EnumOutputs() looks useless for the scenario with more that one gpu.
I know how to setup for basic rendering. My next step in learning is to understand this low level stuff.
Description for GLFW states that it's a library for OpenGL or OpenGL ES. And we're in DirectX section, so this is not very helpful for me. Thought I got an idea, there's still a question - what to do if the user selected an adapter with zero outputs?
We all saw that every game allows to select a resolution. It looks simple but some questions doesn't give me to sleep.
How can I obtain available resolutions? Just take the most popular and hardcode?
I can iterate over available outputs and find supported resolutions as well as sync intervals. But what if the user selected an adapter that is not have any output bounded (actually how does this works at all - I have 2 GPUs, I can switch between them, and I always have a picture, even if a card doesn't have an output)?
What if the user have several monitors. How should I choose correct one (and should I at all)?
In Starcraft 2 I noticed that in windowed mode there's no resolution selection at all - I can resize a window and picture scales accordingly. How it is done? Do they have fixed resolution for the windowed mode?
Update. Everything is much more simple. It turned out that dds format supports several textures in one file. And CreateDDSTextureFromMemory() do all the job. All we need to do is just create dds with texassemble tool (https://directxtex.codeplex.com/wikipage?title=Texassemble) and supply to texture creation function.
Nevertheless, you could implement this in a shader, just discard the pixels which are not inside the bounding rect of the parent element.
If you have only axis-aligned rectangles you can simply clip them when filling up your vertex buffer.
As I wrote in PS, I have rotating quads. Also quads can have round corners (and maybe holes) so it will be difficult to calculate it analytically. It was my mistake that I wrote about quads. I probably have to write arbitrary geometry.
For non-rectangular regions, you could use a second texture as a mask and do manual blending (so to speak) in the pixel shader. This can of course be combined with the above approach.
This sounds interesting. Can you give more insights please?