/// <summary> /// Render depth and normals of windows to the specified target /// REMARK: Only on the windows with decals /// </summary> /// <returns>True if windows to be rendered found</returns> internal static bool RenderWindowsDepthOnly(MyDepthStencil depthStencil, MyBindableResource gbuffer1) { if (m_windowCount == 0) { return(false); } TransferDataBillboards(WindowCountSafe, ref m_arrayDataWindows); RC.BindDepthRT(depthStencil, DepthStencilAccess.ReadWrite, gbuffer1); BindResourcesCommon(); RC.SetBS(null); RC.SetVS(m_vsDepthOnly); RC.SetPS(m_psDepthOnly); if (!MyStereoRender.Enable) { RC.DeviceContext.DrawIndexed(m_windowCount * 6, 0, 0); } else { MyStereoRender.DrawIndexedBillboards(RC, m_windowCount * 6, 0, 0); } RC.SetRS(null); return(true); }
internal static void Resize(int width, int height, int samplesNum, int samplesQuality) { if (m_resolvedDepth != null) { m_resolvedDepth.Release(); m_ambientOcclusionHelper.Release(); m_ambientOcclusion.Release(); m_tileIndexes.Release(); } m_resolvedDepth = new MyDepthStencil(width, height, 1, 0); m_ambientOcclusionHelper = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0); m_ambientOcclusion = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0); int tilesNum = ((width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE) * ((height + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE); TilesNum = tilesNum; TilesX = (width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE; m_tileIndexes = new MyRWStructuredBuffer(tilesNum + tilesNum * MyRender11Constants.MAX_POINT_LIGHTS, sizeof(uint)); }
internal static void Resize(int width, int height, int samplesNum, int samplesQuality) { if (m_resolvedDepth != null) { m_resolvedDepth.Release(); m_ambientOcclusionHelper.Release(); m_ambientOcclusion.Release(); m_tileIndices.Release(); } m_resolvedDepth = new MyDepthStencil(width, height, 1, 0); m_ambientOcclusionHelper = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0); m_ambientOcclusion = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0); TilesX = (width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE; TilesY = ((height + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE); TilesNum = TilesX * TilesY; m_tileIndices = new MyRWStructuredBuffer(TilesNum + TilesNum * MyRender11Constants.MAX_POINT_LIGHTS, sizeof(uint), MyRWStructuredBuffer.UAVType.Default, true, "MyScreenDependants::tileIndices"); }
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; }
internal MyDepthView(MyDepthStencil from) { m_owner = from; }
internal void ClearDepthStencil(MyDepthStencil depthStencil, float depth, byte stencil) { DeviceContext.ClearDepthStencilView(depthStencil.m_DSV, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, depth, stencil); MyRender11.ProcessDebugOutput(); }
internal void ClearDepthStencil(MyDepthStencil depthStencil, float depth, byte stencil) { Context.ClearDepthStencilView(depthStencil.m_DSV, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, depth, stencil); }
/// <summary> /// Render depth and normals of windows to the specified target /// REMARK: Only on the windows with decals /// </summary> /// <returns>True if windows to be rendered found</returns> internal static bool RenderWindowsDepthOnly(MyDepthStencil depthStencil, MyBindableResource gbuffer1) { if (m_windowCount == 0) return false; TransferDataBillboards(WindowCountSafe, ref m_arrayDataWindows); RC.BindDepthRT(depthStencil, DepthStencilAccess.ReadWrite, gbuffer1); BindResourcesCommon(); RC.SetBS(null); RC.SetVS(m_vsDepthOnly); RC.SetPS(m_psDepthOnly); if (!MyStereoRender.Enable) RC.DeviceContext.DrawIndexed(m_windowCount * 6, 0, 0); else MyStereoRender.DrawIndexedBillboards(RC, m_windowCount * 6, 0, 0); RC.SetRS(null); return true; }