GLTF PBR Renderer: fixed issue with non-array views of compressed textures
assiduous
2 years ago
450 | 450 | |
451 | 451 | auto SetTexture = [&](GLTF::Material::TEXTURE_ID TexId, ITextureView* pDefaultTexSRV, const char* VarName) // |
452 | 452 | { |
453 | ITextureView* pTexSRV = nullptr; | |
453 | RefCntAutoPtr<ITextureView> pTexSRV; | |
454 | 454 | |
455 | 455 | auto TexIdx = Material.TextureIds[TexId]; |
456 | 456 | if (TexIdx >= 0) |
457 | 457 | { |
458 | 458 | if (auto* pTexture = Model.GetTexture(TexIdx)) |
459 | pTexSRV = pTexture->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE); | |
459 | { | |
460 | if (pTexture->GetDesc().Type == RESOURCE_DIM_TEX_2D_ARRAY) | |
461 | pTexSRV = pTexture->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE); | |
462 | else | |
463 | { | |
464 | TextureViewDesc SRVDesc; | |
465 | SRVDesc.ViewType = TEXTURE_VIEW_SHADER_RESOURCE; | |
466 | SRVDesc.TextureDim = RESOURCE_DIM_TEX_2D_ARRAY; | |
467 | pTexture->CreateView(SRVDesc, &pTexSRV); | |
468 | } | |
469 | } | |
460 | 470 | } |
461 | 471 | |
462 | 472 | if (pTexSRV == nullptr) |