git.s-ol.nu ~forks/DiligentFX / 4114c13
GLTF PBR Renderer: fixed issue with non-array views of compressed textures assiduous 9 months ago
1 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
450450
451451 auto SetTexture = [&](GLTF::Material::TEXTURE_ID TexId, ITextureView* pDefaultTexSRV, const char* VarName) //
452452 {
453 ITextureView* pTexSRV = nullptr;
453 RefCntAutoPtr<ITextureView> pTexSRV;
454454
455455 auto TexIdx = Material.TextureIds[TexId];
456456 if (TexIdx >= 0)
457457 {
458458 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 }
460470 }
461471
462472 if (pTexSRV == nullptr)