Lag spikes or crash when the the screen's refresh rate is too fast
kamitojaeger opened this issue ยท 0 comments
This issue has been tested by me and one of my friend.
Here's how to reproduce this bug:
- have a 4 * 4 screen link to a computer
- run the code below
- lag spikes happen
- right click the computer -> game crash
you can also reproduce the lagSpike by deleting the "yield()" without adding "sleep()" to the code.
Lag spikes would also happen, and would stop due to [too long without yielding]
local gpu = peripheral.wrap("tm_gpu_0")
local start = os.epoch("utc")
local function yield()
if (os.epoch("utc") - start > 1000) then
os.queueEvent("yield")
os.pullEvent("yield")
start = os.epoch("utc")
end
end
gpu.setSize(64,64,4,4,16)
gpu.refreshSize()
gpu.fill(0x006400)
gpu.filledRectangle(197, 1, 60, 256, 0x006400)
gpu.line(64,1,64,256,0x32cd32)
gpu.line(196,1,196,256,0x32cd32)
gpu.line(65,192,196,194,0x32cd32)
gpu.line(65,128,196,128,0x32cd32)
gpu.line(65,64,196,64,0x32cd32)
gpu.drawText(10,3,"512m",0x00ff00,0x008000,2)
gpu.drawText(10,64,"384m",0x00ff00,0x008000,2)
gpu.drawText(10,128,"256m",0x00ff00,0x008000,2)
gpu.drawText(10,194,"128m",0x00ff00,0x008000,2)
gpu.drawText(200,30,"VS",0x00ff00,0x006400,2)
gpu.drawText(200,91,"Entity",0x00ff00,0x006400,2)
gpu.drawText(200,155,"VS-E",0x00ff00,0x006400,2)
gpu.drawText(200,221,"SRC",0x00ff00,0x006400,2)
gpu.refreshSize()
gpu.sync()
local function regularLines()
gpu.line(64,1,64,256,0x32cd32)
gpu.line(196,1,196,256,0x32cd32)
gpu.line(65,192,196,194,0x32cd32)
gpu.line(65,128,196,128,0x32cd32)
gpu.line(65,64,196,64,0x32cd32)
end
while true do
for i = 65, 195 do
if i == 65 then
gpu.line(65,1,65,256,0x32cd32)
else
gpu.line(i,1,i,256,0x32cd32)
gpu.line(i-1,1,i-1,256,0x006400)
regularLines()
end
gpu.sync()
yield()
end
end
Here's my crash logs. Hope this issue can be fixed soon : D