From 194ee366c12b88eb1ba00c3efe7adf5e2af6b916 Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 16 Aug 2025 20:11:26 +0200 Subject: [PATCH 1/4] Repo: Update the Lua runtime to v0.0.22 --- download-runtime.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download-runtime.sh b/download-runtime.sh index e2c1cbb8..0534d32a 100755 --- a/download-runtime.sh +++ b/download-runtime.sh @@ -2,7 +2,7 @@ set -e GITHUB_ORGANIZATION="evo-lua" GITHUB_REPOSITORY="evo-runtime" -REQUIRED_RUNTIME_VERSION="v0.0.20" +REQUIRED_RUNTIME_VERSION="v0.0.22" PLATFORM=$(uname) ARCHITECTURE=$(uname -m) From 177f4b5f6626f1022cc2f9bef69eac70207760f9 Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 16 Aug 2025 21:15:27 +0200 Subject: [PATCH 2/4] GRF: Port charset conversions to the v0.0.22 iconv API There doesn't seem to be any difference in performance, and even if there was - the approach originally chosen is deeply flawed and needs a rework, anyway. --- Core/FileFormats/RagnarokGRF.lua | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Core/FileFormats/RagnarokGRF.lua b/Core/FileFormats/RagnarokGRF.lua index 46d0f309..bd00ca9c 100644 --- a/Core/FileFormats/RagnarokGRF.lua +++ b/Core/FileFormats/RagnarokGRF.lua @@ -199,20 +199,13 @@ function RagnarokGRF:DecodeFileName(input) local pointerToNullTerminatedStringBytes = input local originalLength = cstring.size(pointerToNullTerminatedStringBytes) - self.preallocatedConversionBuffer:reset() - local ptr, len = self.preallocatedConversionBuffer:reserve(originalLength * 3) -- Worst case (no 4-byte chars exist for EUC-KR) - local result = - iconv.bindings.iconv_convert(pointerToNullTerminatedStringBytes, originalLength, "CP949", "UTF-8", ptr, len) - local numBytesWritten = tonumber(result.num_bytes_written) - self.preallocatedConversionBuffer:commit(numBytesWritten) - local decodedFileName, decodedLength = self.preallocatedConversionBuffer:ref() + local decodedFileName = + iconv.convert(ffi.string(pointerToNullTerminatedStringBytes, originalLength), "CP949", "UTF-8") + local decodedLength = #decodedFileName assert(decodedLength > 0, "Failed to decode file name (no bytes written while translating from CP949 to UTF-8)") - cstring.tolower(decodedFileName, decodedLength) - cstring.normalize(decodedFileName, decodedLength) - - return ffi_string(decodedFileName), originalLength + return self:GetNormalizedFilePath(decodedFileName), originalLength end -- To measure (and optimize) the worst-case decompression time, it'll be convenient to find the largest files easily From f076988dd59a2e380824738adca3aed1beaed00b Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 16 Aug 2025 21:26:10 +0200 Subject: [PATCH 3/4] Client: Port WebGPU renderer to the v0.0.22 glfw API **WARNING: THE RENDERER IS COMPLETELY BROKEN!** glfw3wgpu doesn't work in the latest version, because it uses outdated WGPU structures and fails to create the surface from a native window handle. This then yields a mountain of rust stack unwinding errors after wgpu-native dies with "invalid surface". I'm not sure if it's worth fixing here since the tools and renderer work fine on v0.0.020 (except for Wayland - oh, well). Will have to wait and see what the best course of action is. It might require FFI access to GLFW and X11/Wayland/Cocoa/Metal APIs? --- Core/NativeClient/WebGPU/GPU.lua | 16 +++++++++------- Core/NativeClient/WebGPU/Surface.lua | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Core/NativeClient/WebGPU/GPU.lua b/Core/NativeClient/WebGPU/GPU.lua index 8a7db747..4bb927a0 100644 --- a/Core/NativeClient/WebGPU/GPU.lua +++ b/Core/NativeClient/WebGPU/GPU.lua @@ -26,7 +26,7 @@ end function GPU:RequestAdapter(instance, window) local adapterOptions = new("WGPURequestAdapterOptions", { - compatibleSurface = glfw.bindings.glfw_get_wgpu_surface(instance, window), + compatibleSurface = glfw.bindings.glfw_create_window_wgpu_surface(instance, window), powerPreference = ffi.C.WGPUPowerPreference_HighPerformance, }) @@ -80,7 +80,7 @@ function GPU:RequestLogicalDevice(adapter, options) maxSampledTexturesPerShaderStage = GPU.MAX_TEXTURE_ARRAY_SIZE, maxSamplersPerShaderStage = GPU.MAX_TEXTURE_ARRAY_SIZE, maxUniformBufferBindingSize = GPU.MAX_UNIFORM_BUFFER_BINDING_SIZE, - maxBindingsPerBindGroup = 2, -- Max. allowed binding index + maxBindingsPerBindGroup = 3, -- Max. allowed binding index maxDynamicUniformBuffersPerPipelineLayout = 1, minStorageBufferOffsetAlignment = 32, minUniformBufferOffsetAlignment = ffi.sizeof("mesh_uniform_t"), @@ -102,17 +102,19 @@ function GPU:RequestLogicalDevice(adapter, options) end requestedDevice = device end - webgpu.bindings.wgpu_adapter_request_device(adapter, deviceDescriptor, onDeviceRequested, nil) - - -- This is blocking in the wgpu-native implementation, but it might change in the future... - assert(requestedDevice, "onDeviceRequested did not trigger, but it should have") local function onDeviceError(errorType, message, userdata) local errorDetails = format("Type: %s, Message: %s", tonumber(errorType), ffi_string(message)) error("Uncaptured device error - " .. errorDetails) end - webgpu.bindings.wgpu_device_set_uncaptured_error_callback(requestedDevice, onDeviceError, nil) + local jit = require("jit") + jit.off(onDeviceError) + + deviceDescriptor.uncapturedErrorCallbackInfo.callback = onDeviceError + webgpu.bindings.wgpu_adapter_request_device(adapter, deviceDescriptor, onDeviceRequested, nil) + + -- This is blocking in the wgpu-native implementation, but it might change in the future... local canUseTextureArrays = webgpu.bindings.wgpu_device_has_feature(requestedDevice, ffi.C.WGPUNativeFeature_TextureBindingArray) diff --git a/Core/NativeClient/WebGPU/Surface.lua b/Core/NativeClient/WebGPU/Surface.lua index d8d51e47..96905a3e 100644 --- a/Core/NativeClient/WebGPU/Surface.lua +++ b/Core/NativeClient/WebGPU/Surface.lua @@ -25,7 +25,7 @@ function Surface:Construct(wgpuInstance, wgpuAdapter, wgpuDevice, glfwWindow) self.wgpuDevice = wgpuDevice self.glfwWindow = glfwWindow - self.wgpuSurface = glfw.bindings.glfw_get_wgpu_surface(wgpuInstance, glfwWindow) + self.wgpuSurface = glfw.bindings.glfw_create_window_wgpu_surface(wgpuInstance, glfwWindow) self.wgpuSurfaceConfiguration = new("WGPUSurfaceConfiguration") self.wgpuSurfaceTexture = new("WGPUSurfaceTexture") self.wgpuTextureViewDescriptor = new("WGPUTextureViewDescriptor") From 280f1170ec7c5f6e2ece9dc3bb0a9fc68dc12195 Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 16 Aug 2025 23:40:51 +0200 Subject: [PATCH 4/4] CI: Adjust the Linux workflow to install webkit2gtk-4.1 The old package is no longer available since GitHub updated the runner image. --- .github/workflows/ci-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index f1c84b42..98e30a50 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt update && sudo apt install libgtk-3-0 libwebkit2gtk-4.0-37 --yes + run: sudo apt-get install gtk+-3.0-dev webkit2gtk-4.1-dev --yes - name: Download Lua runtime run: ./download-runtime.sh && ./evo version