Hm.
I have to admit, this is way beyond my current knowledge.
I am reading a lot about D3D11 at the moment, navigating the MSDN around OMSetRenderTarget.
Even managed to get something that compiles. But I am missing something about the way it's working yet.
Here is my current code for the binding function. It compiles but the result is not really here yet.
I have to find out the way to create the array of RenderTargetviews..
void UXAMLComponent::bindRenderTarget(UTextureRenderTarget2D *target, Ptr<IRenderTarget2D> source)
{
ID3D11Device *device = (ID3D11Device *)GDynamicRHI->RHIGetNativeDevice();
ID3D11Texture2D *depthStencil = NULL;
ID3D11Texture2D *renderTarget = NULL;
ID3D11RenderTargetView *rtv = NULL;
ID3D11DepthStencilView *dsv = NULL;
ID3D11DeviceContext *context = NULL;
device->GetImmediateContext(&context);
FRHITexture *baseTexture = (FRHITexture*)target->Resource->TextureRHI->GetTexture2D();
FD3D11TextureBase *d3dTexture = GetD3D11TextureFromRHITexture(baseTexture);
//rtv = d3dTexture->GetRenderTargetView(0, -1);
//dsv = d3dTexture->GetDepthStencilView(DSAT_Writable);
DX11Texture2D *dx11Texture = (DX11Texture2D*)source->GetResolveTexture();
renderTarget = dx11Texture->mTexture;
if (renderTarget)
if (FAILED(device->CreateRenderTargetView(renderTarget, NULL, &rtv)))
exit(-1);
if (depthStencil)
if (FAILED(device->CreateDepthStencilView(depthStencil, NULL, &dsv)))
exit(-1);
context->OMSetRenderTargets(1, &rtv, dsv);
//delete boundRenderTargets;
if (dsv)
dsv->Release();
if (rtv)
rtv->Release();
context->Release();
}
I am also wondering a lot about something:
I don't really understand the way it binds them.. I mean. I have two render targets.. But I don't get how to say that the source view must be used in the target view for example..
I found my ways to get pretty much all the D3D11 COM objects I do need. But I am a bit lost about the "what to do with them" yet. I lack general knowledges about the whole render pipeline.
If I bind them. Giving the OMSetRenderTargets function the right array of rendertargetview.. Will it somehow blend them ? Will they be at the same "3D space" ? Will they render on the same surface ? Or maybe will one of them be set as the "target view" and the other will be outprinting there ?
I have absolutely no answers about these and am a bit confused at the moment about it.
I will keep working on it a little bit before going to sleep.
I apologize to require such help and will update the thread before going to sleep with the latest code I have and it's result.
EDIT: I can get everything I want from the two render targets but I have no idea of the procedure to bind the two of them correctly. If you could help me with the binding part, I should be able to feed them the correct datas.

Nothing changed in the code (or at least got reversed to the same point). I am going to sleep. I think I need it.
