0

hi these day i am stumbling with resource binding problem on directx 11. what i want to do is to write new color info into the back buffer.

so as you can check the code below.

with my intuition, i just simply copy 'outputTex' resource into back buffer. and, it is not doing anything. and i already checked outputTex has the right value in it. so it seems that i can't use CopyResource().

    Microsoft::WRL::ComPtr<ID3D11Texture2D> backBuffer;
    swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(backBuffer.GetAddressOf()));

    dContext->CopyResource(backBuffer.Get(), outputTex.Get());

so for alternative, i managed to just pass the 'outputTex' resource to Pixel shader instead of dealing with back buffer.

    dContext->PSSetShaderResources(0, 1, outputSRV.GetAddressOf());

and this is still not working as well.

i hope this is just my silly mistake.

KIM CHANGJUN
  • 99
  • 11
  • CopyResource has many restrictions, did you checked that your texture and backbuffer met all of them? (https://learn.microsoft.com/en-us/windows/desktop/api/d3d11/nf-d3d11-id3d11devicecontext-copyresource) I am not sure what your target is, but as an alternative you could draw a full screen quad with the texture to fill the backbuffer as well. – Gnietschow May 20 '19 at 13:35
  • it is showing no debug error log, so it seems to meet all of them right. but i just wonder that copying data to backbuffer texture is proper way to render on screen? i guess that using render target view would be proper way instead. – KIM CHANGJUN May 21 '19 at 03:00
  • 1
    If you just want to render something on screen copying is indeed not the intended way. You should render some geometry with your texture on it to the backbuffer. It will be far more efficient. – Gnietschow May 21 '19 at 11:04
  • oh thanks @Gnietschow. so just drawing another geometry using Draw() would be way. guessing there might not be way to modify backbuffer directly. – KIM CHANGJUN May 22 '19 at 01:43

0 Answers0