FUnorderedAccessViewRHIRef FVulkanDynamicRHI::RHICreateUnorderedAccessView(FTextureRHIParamRef TextureRHI, uint32 MipLevel) { #if 0 FVulkanTextureBase* Base = nullptr; if (auto* Tex2D = TextureRHI->GetTexture2D()) { Base = ResourceCast(Tex2D); } else if (auto* Tex3D = TextureRHI->GetTexture3D()) { Base = ResourceCast(Tex3D); } else if (auto* TexCube = TextureRHI->GetTextureCube()) { Base = ResourceCast(TexCube); } else { ensure(0); } #endif FVulkanUnorderedAccessView* UAV = new FVulkanUnorderedAccessView; UAV->SourceTexture = TextureRHI; UAV->MipIndex = MipLevel; return UAV; }
FUnorderedAccessViewRHIRef FD3D11DynamicRHI::RHICreateUnorderedAccessView(FTextureRHIParamRef TextureRHI) { FD3D11TextureBase* Texture = GetD3D11TextureFromRHITexture(TextureRHI); D3D11_UNORDERED_ACCESS_VIEW_DESC UAVDesc; if (TextureRHI->GetTexture3D() != NULL) { FD3D11Texture3D* Texture3D = (FD3D11Texture3D*)Texture; UAVDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D; UAVDesc.Texture3D.MipSlice = 0; UAVDesc.Texture3D.FirstWSlice = 0; UAVDesc.Texture3D.WSize = Texture3D->GetSizeZ(); } else { UAVDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D; UAVDesc.Texture2D.MipSlice = 0; } UAVDesc.Format = FindShaderResourceDXGIFormat((DXGI_FORMAT)GPixelFormats[TextureRHI->GetFormat()].PlatformFormat, false); TRefCountPtr<ID3D11UnorderedAccessView> UnorderedAccessView; VERIFYD3D11RESULT(Direct3DDevice->CreateUnorderedAccessView(Texture->GetResource(),&UAVDesc,(ID3D11UnorderedAccessView**)UnorderedAccessView.GetInitReference())); return new FD3D11UnorderedAccessView(UnorderedAccessView,Texture); }
FUnorderedAccessViewRHIRef FD3D12DynamicRHI::RHICreateUnorderedAccessView(FTextureRHIParamRef TextureRHI, uint32 MipLevel) { FD3D12TextureBase* Texture = GetD3D11TextureFromRHITexture(TextureRHI); D3D12_UNORDERED_ACCESS_VIEW_DESC UAVDesc ={}; const DXGI_FORMAT PlatformResourceFormat = (DXGI_FORMAT)GPixelFormats[TextureRHI->GetFormat()].PlatformFormat; UAVDesc.Format = FindShaderResourceDXGIFormat(PlatformResourceFormat, false); if (TextureRHI->GetTexture3D() != NULL) { FD3D12Texture3D* Texture3D = (FD3D12Texture3D*)Texture; UAVDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE3D; UAVDesc.Texture3D.MipSlice = MipLevel; UAVDesc.Texture3D.FirstWSlice = 0; UAVDesc.Texture3D.WSize = Texture3D->GetSizeZ() >> MipLevel; }
FUnorderedAccessViewRHIRef FD3D11DynamicRHI::RHICreateUnorderedAccessView(FTextureRHIParamRef TextureRHI, uint32 MipLevel) { FD3D11TextureBase* Texture = GetD3D11TextureFromRHITexture(TextureRHI); D3D11_UNORDERED_ACCESS_VIEW_DESC UAVDesc; if (TextureRHI->GetTexture3D() != NULL) { FD3D11Texture3D* Texture3D = (FD3D11Texture3D*)Texture; UAVDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D; UAVDesc.Texture3D.MipSlice = MipLevel; UAVDesc.Texture3D.FirstWSlice = 0; UAVDesc.Texture3D.WSize = Texture3D->GetSizeZ() >> MipLevel; }