From 13d19c1bb8ab6007dfc780a2b169da602888c9cd Mon Sep 17 00:00:00 2001 From: payonel Date: Fri, 22 May 2020 10:12:05 -0700 Subject: [PATCH] insure minimal bitblt cost when writing to screen --- .../scala/li/cil/oc/server/component/GraphicsCard.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala b/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala index a2ade576c..1e7c0c18a 100644 --- a/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala +++ b/src/main/scala/li/cil/oc/server/component/GraphicsCard.scala @@ -31,7 +31,7 @@ import scala.util.matching.Regex // the save file - a Bad Thing (TM). class GraphicsCard(val tier: Int) extends prefab.ManagedEnvironment with DeviceInfo with component.traits.VideoRamAware { - override val node = Network.newNode(this, Visibility.Neighbors). + override val node: Connector = Network.newNode(this, Visibility.Neighbors). withComponent("gpu"). withConnector(). create() @@ -196,13 +196,14 @@ class GraphicsCard(val tier: Int) extends prefab.ManagedEnvironment with DeviceI // large dirty buffers need throttling so their budget cost is more // clean buffers have no budget cost. src match { - case page: GpuTextBuffer if page.dirty => dst match { + case page: GpuTextBuffer => dst match { case _: GpuTextBuffer => 0.0 // no cost to write to ram - case _ => // screen target will need the new buffer + case _ if page.dirty => // screen target will need the new buffer // small buffers are cheap, so increase with size of buffer source bitbltCost * (src.getWidth * src.getHeight) / (maxResolution._1 * maxResolution._2) + case _ => .001 // bitblt a clean page to screen has a minimal cost } - case _ => 0.0 // from screen or from clean buffer is free + case _ => 0.0 // from screen is free } }