| 262 | #endif |
| 263 | |
| 264 | void GPUTextureWebGPU::InitHandles() |
| 265 | { |
| 266 | WGPUTextureViewDescriptor viewDesc = WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT; |
| 267 | #if GPU_ENABLE_RESOURCE_NAMING |
| 268 | viewDesc.label = { _name.Get(), (size_t)_name.Length() }; |
| 269 | #endif |
| 270 | viewDesc.format = _format; |
| 271 | viewDesc.usage = Usage; |
| 272 | viewDesc.dimension = _viewDimension; |
| 273 | viewDesc.mipLevelCount = MipLevels(); |
| 274 | viewDesc.arrayLayerCount = ArraySize(); |
| 275 | viewDesc.aspect = WGPUTextureAspect_All; |
| 276 | |
| 277 | auto format = Format(); |
| 278 | auto msaa = MultiSampleLevel(); |
| 279 | |
| 280 | if (IsVolume()) |
| 281 | { |
| 282 | // Create handle for whole 3d texture |
| 283 | { |
| 284 | auto& view = _handleVolume; |
| 285 | view.Init(this, format, msaa); |
| 286 | view.Create(Texture, viewDesc, _version); |
| 287 | } |
| 288 | |
| 289 | // Init per slice views |
| 290 | _handlesPerSlice.Resize(Depth(), false); |
| 291 | if (_desc.HasPerSliceViews() && IsRenderTarget()) |
| 292 | { |
| 293 | for (int32 sliceIndex = 0; sliceIndex < Depth(); sliceIndex++) |
| 294 | { |
| 295 | auto& view = _handlesPerSlice[sliceIndex]; |
| 296 | view.Init(this, format, msaa); |
| 297 | view.Create(Texture, viewDesc, _version); |
| 298 | view.DepthSlice = sliceIndex; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | else if (IsArray()) |
| 303 | { |
| 304 | // Create whole array handle |
| 305 | { |
| 306 | auto& view = _handleArray; |
| 307 | view.Init(this, format, msaa); |
| 308 | view.Create(Texture, viewDesc, _version); |
| 309 | } |
| 310 | |
| 311 | // Create per array slice handles |
| 312 | _handlesPerSlice.Resize(ArraySize(), false); |
| 313 | viewDesc.dimension = WGPUTextureViewDimension_2D; |
| 314 | for (int32 arrayIndex = 0; arrayIndex < _handlesPerSlice.Count(); arrayIndex++) |
| 315 | { |
| 316 | viewDesc.baseArrayLayer = arrayIndex; |
| 317 | viewDesc.arrayLayerCount = 1; |
| 318 | auto& view = _handlesPerSlice[arrayIndex]; |
| 319 | view.Init(this, format, msaa); |
| 320 | view.Create(Texture, viewDesc, _version); |
| 321 | } |
nothing calls this directly
no test coverage detected