public IDepthStencil CreateDepthStencil(string debugName, int width, int height, Format resourceFormat = Format.R32G8X24_Typeless, Format dsvFormat = Format.D32_Float_S8X24_UInt, Format srvDepthFormat = Format.R32_Float_X8X24_Typeless, Format srvStencilFormat = Format.X32_Typeless_G8X24_UInt, int samplesCount = 1, int samplesQuality = 0) { MyRenderProxy.Assert(width > 0); MyRenderProxy.Assert(height > 0); MyDepthStencil tex = m_objectsPool.Allocate(); tex.Init(debugName, width, height, resourceFormat, dsvFormat, srvDepthFormat, srvStencilFormat, samplesCount, samplesQuality); if (m_isDeviceInit) { try { tex.OnDeviceInit(); } catch (System.Exception ex) { IDepthStencil t = tex; DisposeTex(ref t); throw; } } return(tex); }
internal void DisposeTex(ref IDepthStencil tex) { if (tex == null) { return; } MyDepthStencil texture = (MyDepthStencil)tex; if (m_isDeviceInit) { texture.OnDeviceEnd(); } m_objectsPool.Deallocate(texture); }
public IDepthStencil CreateDepthStencil(string debugName, int width, int height, Format resourceFormat = Format.R32G8X24_Typeless, Format dsvFormat = Format.D32_Float_S8X24_UInt, Format srvDepthFormat = Format.R32_Float_X8X24_Typeless, Format srvStencilFormat = Format.X32_Typeless_G8X24_UInt, int samplesCount = 1, int samplesQuality = 0) { MyDepthStencil tex = m_objectsPool.Allocate(); tex.Init(debugName, width, height, resourceFormat, dsvFormat, srvDepthFormat, srvStencilFormat, samplesCount, samplesQuality); if (m_isDeviceInit) { tex.OnDeviceInit(); } return(tex); }
public void OnDeviceInit(MyDepthStencil owner, ShaderResourceViewDescription desc) { m_owner = owner; m_srv = new ShaderResourceView(MyRender11.Device, m_owner.Resource, desc); m_srv.DebugName = owner.Name; }