# Adding Sub-Region to Game Capture



## Beast96GT (Nov 2, 2015)

As the title suggests, I only want to capture a portion of the 6000x1080 resolution in full screen mode.   I've been digging into the GraphicsCaptureHook and the D3D11Capture, but the symbols aren't loading for me to set breakpoints in these classes unlike in the main OBS app.  

From what I can gather looking at the code, it seems like we're creating a D3D Texture and then doing a memcopy from a pointer to the graphics data on the GPU to the texture.  Does that sound right?

Any pointers (no pun intended) on this and/or getting symbols to load for the Capture classes to set breakpoints?


----------



## Beast96GT (Nov 2, 2015)

I feel like I'm close on this as I have it partially working.

In D3D11Capture.cpp, in the DoD3D11Capture() function, I'm trying this:

if(SUCCEEDED(hRes = swap->GetBuffer(0, IID_ID3D11Resource, (void**)&backBuffer)))
{
     if (bIsMultisampled) {

           context->ResolveSubresource(*tempTextureGame*, 0, backBuffer, 0, dxgiFormat);

*D3D11_BOX box;
           box.left = 0;
           box.right = 1000;
           box.top = 0;
           box.bottom = 600;
           box.front = 0;
           box.back = 1;
           context->CopySubresourceRegion(copyTextureGame, 0, 50, 50, 0, tempTextureGame, 0, &box);*
           RUNEVERYRESET logOutput << "ResizeBuffer SUCCESS!" << endl;
...

My thought was that since the ResolveSubresource() was changing the multi-sampled resource to a non-multi-sampled resource, I would use an intermediary temp resource then copy out just a region.   This is working, but it looks like OBS is drawing both the copyTextureGame AND either the tempTextureGame or backBuffer.   But at least it's drawing the copied region!


----------



## Osiris (Nov 2, 2015)

You know you can just crop right?


----------



## Beast96GT (Nov 2, 2015)

I've tried that and I can't make it work in this scenario--unless I'm doing something wrong.

My requirements are:
- OBS Game Capture (Not Window Capture or Monitor Capture, because it's D3D or OGL)
- FullScreen Mode in game (not windowed or borderless)
- Only capture the middle section of a 6000 x 1080 resolution.

If there's a way this can be accomplished without modifying the code, I'm all for it, but I don't think there is.


----------



## Beast96GT (Nov 2, 2015)

Thanks, Osiris, the other devs think you're right and I'm just using the cropping wrong.   I'll give it a shot.  Thanks!   :crossesfingers:


----------



## Beast96GT (Nov 3, 2015)

Do anyone know if there performance implications capturing 6000x1080 and cropping instead of just sub-region the 6000 to 1920?


----------



## dodgepong (Nov 3, 2015)

The thing in my mind is that I don't think there is any way around capturing the full texture either way, so you might as well just crop. I don't think it's possible to only capture a sub-region of the texture from VRAM.


----------

