Skip to content

Commit

Permalink
Merge pull request #380 from RagnarokResearchLab/runtime-update-v0.0.19
Browse files Browse the repository at this point in the history
Update the Lua runtime to v0.0.19
  • Loading branch information
rdw-software authored Feb 22, 2024
2 parents 99b52f6 + acec742 commit 083889b
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 38 deletions.
21 changes: 2 additions & 19 deletions Core/FileFormats/RagnarokGND.lua
Original file line number Diff line number Diff line change
Expand Up @@ -786,31 +786,14 @@ function RagnarokGND:ComputeFlatFaceNormalRight(gridU, gridV)
return rightFaceNormal
end

local function nextPowerOfTwo(n)
if n <= 0 then
return 1
end

if bit.band(n, (n - 1)) == 0 then
return n
end

local power = 1
while power < n do
power = power * 2
end

return power
end

function RagnarokGND:GenerateLightmapTextureImage(posterizationLevel)
posterizationLevel = posterizationLevel or RagnarokGND.LIGHTMAP_POSTERIZATION_LEVEL
console.startTimer("Generate combined lightmap texture image")

local width = 2048 -- TBD: Should use MAX_TEXTURE_DIMENSION?
local numSlicesPerRow = 2048 / 8
local numRows = math.ceil(self.lightmapFormat.numSlices / numSlicesPerRow)
local height = nextPowerOfTwo(numRows * 8)
local height = bit.ceil(numRows * 8)

printf("[RagnarokGND] Computed lightmap texture dimensions: %dx%d", width, height)
local numBytesWritten = 0
Expand Down Expand Up @@ -873,7 +856,7 @@ function RagnarokGND:ComputeLightmapTextureCoords(lightmapSliceID)
local textureWidth = 2048 -- TBD: Should use MAX_TEXTURE_DIMENSION?
local numSlicesPerRow = 2048 / 8
local numRows = math.ceil(self.lightmapFormat.numSlices / numSlicesPerRow)
local textureHeight = nextPowerOfTwo(numRows * 8)
local textureHeight = bit.ceil(numRows * 8)
local sliceSize = 8

local sliceU = lightmapSliceID % numSlicesPerRow
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/Renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local rml = require("rml")
local uv = require("uv")
local transform = require("transform")
local validation = require("validation")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local GPU = require("Core.NativeClient.WebGPU.GPU")
local WidgetDrawingPipeline = require("Core.NativeClient.WebGPU.Pipelines.WidgetDrawingPipeline")
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/Buffer.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Buffer = {
VERTEX_BUFFER_FLAGS = bit.bor(ffi.C.WGPUBufferUsage_CopyDst, ffi.C.WGPUBufferUsage_Vertex),
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/CommandEncoder.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local Device = require("Core.NativeClient.WebGPU.Device")
local Queue = require("Core.NativeClient.WebGPU.Queue")

local webgpu = require("webgpu")
local webgpu = require("wgpu")

local CommandEncoder = {}

Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/Device.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Device = {}

Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/GPU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local Texture = require("Core.NativeClient.WebGPU.Texture")

local ffi = require("ffi")
local glfw = require("glfw")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local new = ffi.new
local ffi_string = ffi.string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local ScreenshotCaptureTexture = require("Core.NativeClient.WebGPU.RenderTargets

local uuid = require("uuid")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local InvisibleBaseMaterial = {
diffuseColor = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local Texture = require("Core.NativeClient.WebGPU.Texture")
local UniformBuffer = require("Core.NativeClient.WebGPU.UniformBuffer")

local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local WaterSurfaceMaterial = {
pipeline = WaterPlaneDrawingPipeline,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Device = require("Core.NativeClient.WebGPU.Device")
local UniformBuffer = require("Core.NativeClient.WebGPU.UniformBuffer")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local BasicTriangleDrawingPipeline = require("Core.NativeClient.WebGPU.Pipelines.BasicTriangleDrawingPipeline")
local Device = require("Core.NativeClient.WebGPU.Device")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local BasicTriangleDrawingPipeline = require("Core.NativeClient.WebGPU.Pipelines.BasicTriangleDrawingPipeline")
local Device = require("Core.NativeClient.WebGPU.Device")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Device = require("Core.NativeClient.WebGPU.Device")

Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/Queue.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Queue = {}

Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/RenderPassEncoder.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local RenderPassEncoder = {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local bit = require("bit")
local console = require("console")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local Buffer = require("Core.NativeClient.WebGPU.Buffer")
local CommandEncoder = require("Core.NativeClient.WebGPU.CommandEncoder")
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/Surface.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local ffi = require("ffi")
local glfw = require("glfw")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local assert = assert
local tonumber = tonumber
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/Texture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local Color = require("Core.NativeClient.DebugDraw.Color")
local bit = require("bit")
local ffi = require("ffi")
local transform = require("transform")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local cast = ffi.cast
local new = ffi.new
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/UniformBuffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local _ = require("Core.VectorMath.Matrix4D") -- Only needed for the cdefs right

local bit = require("bit")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local new = ffi.new
local sizeof = ffi.sizeof
Expand Down
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/VirtualGPU.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local etrace = require("etrace")
local ffi = require("ffi")
local webgpu = require("webgpu")
local webgpu = require("wgpu")

local VirtualGPU = {
events = {
Expand Down
2 changes: 1 addition & 1 deletion download-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set -e

GITHUB_ORGANIZATION="evo-lua"
GITHUB_REPOSITORY="evo-runtime"
REQUIRED_RUNTIME_VERSION="v0.0.18"
REQUIRED_RUNTIME_VERSION="v0.0.19"

PLATFORM=$(uname)
ARCHITECTURE=$(uname -m)
Expand Down

0 comments on commit 083889b

Please sign in to comment.