more meaningful bitblt budget cost scaling

This commit is contained in:
payonel 2020-05-18 23:36:14 -07:00
parent dcc96e9133
commit 687bf569a0
2 changed files with 8 additions and 7 deletions

View File

@ -116,15 +116,12 @@ while term.isAvailable() do
else else
local ok, why = pcall(function() local ok, why = pcall(function()
for i = 2, result.n do for i = 2, result.n do
io.write(require("serialization").serialize(result[i], true) .. "\t") io.write(require("serialization").serialize(result[i], true), i < result.n and "\t" or "\n")
end end
end) end)
if not ok then if not ok then
io.stderr:write("crashed serializing result: ", tostring(why)) io.stderr:write("crashed serializing result: ", tostring(why))
end end
if term.getCursor() > 1 then
io.write("\n")
end
end end
else else
io.stderr:write(tostring(reason) .. "\n") io.stderr:write(tostring(reason) .. "\n")

View File

@ -70,8 +70,12 @@ class GraphicsCard(val tier: Int) extends prefab.ManagedEnvironment with DeviceI
final val setCosts = Array(1.0 / 64, 1.0 / 128, 1.0 / 256) final val setCosts = Array(1.0 / 64, 1.0 / 128, 1.0 / 256)
final val copyCosts = Array(1.0 / 16, 1.0 / 32, 1.0 / 64) final val copyCosts = Array(1.0 / 16, 1.0 / 32, 1.0 / 64)
final val fillCosts = Array(1.0 / 32, 1.0 / 64, 1.0 / 128) final val fillCosts = Array(1.0 / 32, 1.0 / 64, 1.0 / 128)
final val bitbltCosts = Array(32, 16, 8) // These are dirty page bitblt budget costs
final val totalVRAM: Int = (maxResolution._1 * maxResolution._2) * Settings.get.vramSizes(0 max tier min Settings.get.vramSizes.length) // a single bitblt can send a screen of data, which is n*set calls where set is writing an entire line
// So for each tier, we multiple the set cost with the number of lines the screen may have
// Additionally, we multiply by 4 for the packet size which is generally 4x larger than a set call
final val bitbltCosts = Array(setCosts(0) * 16 * 4, setCosts(1) * 25 * 4, setCosts(1) * 50 * 4)
final val totalVRAM: Int = (maxResolution._1 * maxResolution._2) * Settings.get.vramSizes(0 max tier min Settings.get.vramSizes.length) * 1000
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //
@ -208,7 +212,7 @@ class GraphicsCard(val tier: Int) extends prefab.ManagedEnvironment with DeviceI
// rasterizing to the screen has the same cost as copy (in fact, screen-to-screen blt _is_ a copy // rasterizing to the screen has the same cost as copy (in fact, screen-to-screen blt _is_ a copy
dst match { dst match {
case _: GpuTextBuffer => 0 case _: GpuTextBuffer => 0
case _ => Settings.get.gpuCopyCost / (maxResolution._1 * maxResolution._2) case _ => Settings.get.gpuCopyCost
} }
} }