internal void OnRenderCommandAdded(RenderChainCommand firstCommand) { if (firstCommand.prev == null) { m_FirstCommand = firstCommand; } }
internal void OnRenderCommandRemoved(RenderChainCommand firstCommand, RenderChainCommand lastCommand) { if (firstCommand.prev == null) { m_FirstCommand = lastCommand.next; } }
internal void FreeCommand(RenderChainCommand cmd) { if (cmd.state.material != null) { m_CustomMaterialCommands--; } m_CommandPool.Return(cmd); }
internal Action callback; // Immediate render command only internal void Reset() { owner = null; prev = next = null; closing = false; type = CommandType.Draw; state = new State(); mesh = null; indexOffset = indexCount = 0; callback = null; }
internal void OnRenderCommandAdded(RenderChainCommand command) { if (command.prev == null) { m_FirstCommand = command; } if (command.state.material != null) { m_CustomMaterialCommands++; } }
internal void Reset() { this.owner = null; this.prev = (this.next = null); this.closing = false; this.type = CommandType.Draw; this.state = default(State); this.mesh = null; this.indexOffset = (this.indexCount = 0); this.callback = null; }
internal void FreeCommand(RenderChainCommand cmd) { m_CommandPool.Return(cmd); }
private static void OnRegisterIntermediateRenderers(Camera camera) { int commandOrder = 0; var panels = UIElementsUtility.GetPanelsIterator(); while (panels.MoveNext()) { var p = panels.Current.Value; RenderChain renderChain = (p.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater)?.renderChain; if (renderChain == null || renderChain.m_StaticIndex < 0 || renderChain.m_FirstCommand == null) { continue; } RuntimePanel rtp = (RuntimePanel)p; Material standardMaterial = renderChain.GetStandardWorldSpaceMaterial(); RenderNodeData rndSource = new RenderNodeData(); rndSource.device = renderChain.device; rndSource.standardMaterial = standardMaterial; rndSource.atlas = renderChain.atlasManager?.atlas; rndSource.vectorAtlas = renderChain.vectorImageManager?.atlas; rndSource.shaderInfoAtlas = renderChain.shaderInfoAllocator.atlas; rndSource.dpiScale = rtp.scaledPixelsPerPoint; rndSource.transformConstants = renderChain.shaderInfoAllocator.transformConstants; rndSource.clipRectConstants = renderChain.shaderInfoAllocator.clipRectConstants; if (renderChain.m_CustomMaterialCommands == 0) { // Trivial case, custom materials not used, so we don't have to chop the chain // to multiple intermediate renderers rndSource.initialMaterial = standardMaterial; rndSource.firstCommand = renderChain.m_FirstCommand; OnRegisterIntermediateRendererMat(rtp, renderChain, ref rndSource, camera, commandOrder++); continue; } // Complex case, custom materials used // TODO: Early out once all custom materials have been counted Material lastMaterial = null; var command = renderChain.m_FirstCommand; RenderChainCommand commandToStartWith = command; while (command != null) { if (command.type != CommandType.Draw) { command = command.next; continue; } Material commandMat = command.state.material == null ? standardMaterial : command.state.material; if (commandMat != lastMaterial) { if (lastMaterial != null) { rndSource.initialMaterial = lastMaterial; rndSource.firstCommand = commandToStartWith; OnRegisterIntermediateRendererMat(rtp, renderChain, ref rndSource, camera, commandOrder++); commandToStartWith = command; } lastMaterial = commandMat; } command = command.next; } // While render chain commands to execute if (commandToStartWith != null) { rndSource.initialMaterial = lastMaterial; rndSource.firstCommand = commandToStartWith; OnRegisterIntermediateRendererMat(rtp, renderChain, ref rndSource, camera, commandOrder++); } } // For each panel }
internal void ExecuteNonDrawMesh(DrawParams drawParams, float pixelsPerPoint, ref Exception immediateException) { switch (this.type) { case CommandType.ImmediateCull: { bool flag = !RenderChainCommand.RectPointsToPixelsAndFlipYAxis(this.owner.worldBound, pixelsPerPoint).Overlaps(Utility.GetActiveViewport()); if (flag) { return; } break; } case CommandType.Immediate: break; case CommandType.PushView: { ViewTransform viewTransform = new ViewTransform { transform = this.owner.worldTransform, clipRect = RenderChainCommand.RectToClipSpace(this.owner.worldClip) }; drawParams.view.Push(viewTransform); GL.modelview = viewTransform.transform; return; } case CommandType.PopView: drawParams.view.Pop(); GL.modelview = drawParams.view.Peek().transform; return; case CommandType.PushScissor: { Rect rect = RenderChainCommand.CombineScissorRects(this.owner.worldClip, drawParams.scissor.Peek()); drawParams.scissor.Push(rect); Utility.SetScissorRect(RenderChainCommand.RectPointsToPixelsAndFlipYAxis(rect, pixelsPerPoint)); return; } case CommandType.PopScissor: { drawParams.scissor.Pop(); Rect rect2 = drawParams.scissor.Peek(); bool flag2 = rect2.x == DrawParams.k_UnlimitedRect.x; if (flag2) { Utility.DisableScissor(); } else { Utility.SetScissorRect(RenderChainCommand.RectPointsToPixelsAndFlipYAxis(rect2, pixelsPerPoint)); } return; } default: return; } bool flag3 = immediateException != null; if (!flag3) { Matrix4x4 unityProjectionMatrix = Utility.GetUnityProjectionMatrix(); bool flag4 = drawParams.scissor.Count > 1; bool flag5 = flag4; if (flag5) { Utility.DisableScissor(); } Utility.ProfileImmediateRendererBegin(); try { using (new GUIClip.ParentClipScope(this.owner.worldTransform, this.owner.worldClip)) { this.callback(); } } catch (Exception ex) { immediateException = ex; } GL.modelview = drawParams.view.Peek().transform; GL.LoadProjectionMatrix(unityProjectionMatrix); Utility.ProfileImmediateRendererEnd(); bool flag6 = flag4; if (flag6) { Utility.SetScissorRect(RenderChainCommand.RectPointsToPixelsAndFlipYAxis(drawParams.scissor.Peek(), pixelsPerPoint)); } } }