git.s-ol.nu ~forks/DiligentTools / 6f9c2dd
GLTF loader: reworked loading of checker board stub texture assiduous 10 months ago
1 changed file(s) with 13 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
875875 TexDesc.Height = 32;
876876 TexDesc.Format = TEX_FORMAT_RGBA8_UNORM;
877877 TexDesc.MipLevels = 1;
878 TexDesc.Usage = USAGE_IMMUTABLE;
878 TexDesc.Usage = USAGE_DEFAULT;
879879 TexDesc.BindFlags = BIND_SHADER_RESOURCE;
880880
881 std::vector<Uint8> Data(TexDesc.Width * TexDesc.Height * 4);
882 TextureSubResData Mip0Data{Data.data(), TexDesc.Width * 4};
883 GenerateCheckerBoardPattern(TexDesc.Width, TexDesc.Height, TexDesc.Format, 4, 4, Data.data(), Mip0Data.Stride);
884 TextureData Level0SubresData{&Mip0Data, 1};
885 pDevice->CreateTexture(TexDesc, &Level0SubresData, &TexInfo.pTexture);
881 RefCntAutoPtr<TextureInitData> pTexInitData{MakeNewRCObj<TextureInitData>()()};
882
883 pTexInitData->Levels.resize(1);
884 auto& Level0 = pTexInitData->Levels[0];
885 Level0.Width = TexDesc.Width;
886 Level0.Height = TexDesc.Height;
887 Level0.Stride = Level0.Width * 4;
888 Level0.Data.resize(Level0.Stride * TexDesc.Height);
889 GenerateCheckerBoardPattern(TexDesc.Width, TexDesc.Height, TexDesc.Format, 4, 4, Level0.Data.data(), Level0.Stride);
890
891 pDevice->CreateTexture(TexDesc, nullptr, &TexInfo.pTexture);
892 TexInfo.pTexture->SetUserData(pTexInitData);
886893 }
887894
888895 if (TexInfo.pTexture && pTextureCache != nullptr)