How to create a FRHITexture2D?

Iv’e tried calling the “FRHITexture2D” constructor but when I try to get its native handle via: “GetNativeResource()”, it just returns NULL.

FYI I’m doing this on the RenderThread.

Creating the texture like so:
auto binding = FClearValueBinding();
ZeroMemory(&binding, sizeof(FClearValueBinding));
otherTexture = new FRHITexture2D(SrcTexture->GetSizeX(), SrcTexture->GetSizeY(), 1, 1, EPixelFormat::PF_B8G8R8A8, 0, binding);

You will want to use the RHICreateTexture2D function to create a FRHITexture2D as this will redirect the call to the appropriate rendering sub system ie. D3D11

Ok thanks. I also found that I can create the texture manually then pass it into: “FD3D11Texture2D”.
D3D11 is the only supported system for the plugin at the moment so both would work I guess.

How do I create a texture of: “DXGI_FORMAT_B8G8R8A8_UNORM_SRGB”.
EPixelFormat only has: “PF_B8G8R8A8” which creates a texture of “DXGI_FORMAT_B8G8R8A8_UNKOWN” I believe.

Based on the code, looks like you have to pass TexCreate_SRGB as a flag and format of PF_B8G8R8A8. This will create a texture of format DXGI_FORMAT_B8G8R8A8_TYPELESS and a shader resource view of DXGI_FORMAT_B8G8R8A8_UNORM_SRGB. If thats not enough then you will need to assign urself a new entry in the GPixelFormats array, and a new EPixelFormat.

Ok tnx. Got it working as needed.