public IBorrowedRtvTexture BorrowRtv(string debugName, int width, int height, Format format, int samplesCount = 1, int samplesQuality = 0) { MyBorrowedTextureKey key = new MyBorrowedTextureKey { Width = width, Height = height, Format = format, SamplesCount = samplesCount, SamplesQuality = samplesQuality, }; if (!m_dictionaryRtvTextures.ContainsKey(key)) { AddNewRtvsList(key); } List <MyBorrowedRtvTexture> list = m_dictionaryRtvTextures[key]; foreach (var texIt in list) { if (!texIt.IsBorrowed) { texIt.SetBorrowed(debugName, m_currentFrameNum); return(texIt); } } MyBorrowedRtvTexture createdTex = CreateRtv(debugName, key); createdTex.SetBorrowed(debugName, m_currentFrameNum); return(createdTex); }
void DisposeTexture(MyBorrowedRtvTexture rtv) { IRtvTexture rtvTexture = rtv.RtvTexture; MyManagers.RwTextures.DisposeTex(ref rtvTexture); MyBorrowedTextureKey key = rtv.Key; m_dictionaryRtvTextures[key].Remove(rtv); m_objectPoolRtv.Deallocate(rtv); }