NVIDIAGameWorks/Falcor

Cannot create UAV for 3D texture

Bundas102 opened this issue · 0 comments

Creating a UAV for any MIP level other than the base level fails.

auto tex = Texture::create3D(mpDevice, 32, 32, 32, ResourceFormat::R8Uint, 2, nullptr, ResourceBindFlags::AllColorViews);
auto uav = tex->getUAV(1);

The above code results in the following error.
D3D12 ERROR: ID3D12Device::CreateUnorderedAccessView: The Dimensions of the View are invalid. MipSlice (value = 1) must be between 0 and MipLevels-1 of the Texture Resource, 1, inclusively. FirstWSlice (value = 0) must be between 0 and the Depth size of the Mip Level, 15, inclusively. With the current FirstWSlice, WSize (value = 32) must be between 1 and 16, or -1 to default to all slices from MipSlice, inclusively, in order that the View fit on the Texture. [ STATE_CREATION ERROR #345: CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS]

The problem is WSize being 32 insted of 16 (since level 1 is half the size of the full texture). Similar things happen for larger MIP levels; WSize seems to be always set to the base size.