public DX11FileTexturePoolElement(DX11RenderContext context, string path, bool mips, bool async = false) { this.FileName = path; this.DoMips = mips; this.refcount = 1; if (async) { this.m_task = new FileTexture2dLoadTask(context, path, mips); m_task.StatusChanged += task_StatusChanged; context.ResourceScheduler.AddTask(m_task); } else { try { ImageLoadInformation info = ImageLoadInformation.FromDefaults(); if (!this.DoMips) { info.MipLevels = 1; } this.Texture = DX11Texture2D.FromFile(context, path, info); this.Status = eDX11SheduleTaskStatus.Completed; } catch { this.Status = eDX11SheduleTaskStatus.Error; } } }