Skip to content

Commit

Permalink
Merge pull request #511 from evo-lua/rename-webgpu-library
Browse files Browse the repository at this point in the history
Rename the webgpu library to wgpu
  • Loading branch information
rdw-software authored Feb 19, 2024
2 parents 60d7032 + 9f61ecc commit 814de07
Show file tree
Hide file tree
Showing 21 changed files with 304 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .cppcheck
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ unusedStructMember:Runtime/Bindings/FFI/runtime/runtime_exports.hpp
unusedStructMember:Runtime/Bindings/FFI/stbi/stbi_exports.hpp
unusedStructMember:Runtime/Bindings/FFI/stduuid/stduuid_exports.hpp
unusedStructMember:Runtime/Bindings/FFI/uws/uws_exports.hpp
unusedStructMember:Runtime/Bindings/FFI/webgpu/webgpu_exports.hpp
unusedStructMember:Runtime/Bindings/FFI/wgpu/wgpu_exports.hpp

// PerSocketData is actually used, but cppcheck can't see it
unusedStructMember:Runtime/Bindings/FFI/WebServer.hpp
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ jobs:
- name: Build luajit
run: deps/luajit-unixbuild.sh && ls ninjabuild-unix

- name: Build webgpu
run: deps/webgpu-unixbuild.sh && ls ninjabuild-unix
- name: Build wgpu
run: deps/wgpu-unixbuild.sh && ls ninjabuild-unix

- name: Build luv and libuv
run: deps/luv-unixbuild.sh && ls ninjabuild-unix
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ jobs:
- name: Generate versions.lua # Required for those libraries that don't export versioning information
run: deps/discover-submodule-versions.sh && cat deps/versions.lua

- name: Build webgpu
run: deps/webgpu-unixbuild.sh && ls ninjabuild-unix
- name: Build wgpu
run: deps/wgpu-unixbuild.sh && ls ninjabuild-unix

- name: Build luv and libuv
run: deps/luv-unixbuild.sh && ls ninjabuild-unix
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
- name: Build luajit
run: deps/luajit-windowsbuild.sh && ls ninjabuild-windows

- name: Build webgpu
run: deps/webgpu-windowsbuild.sh && ls ninjabuild-windows
- name: Build wgpu
run: deps/wgpu-windowsbuild.sh && ls ninjabuild-windows

- name: Build luv and libuv
run: deps/luv-windowsbuild.sh && ls ninjabuild-windows
Expand Down
6 changes: 3 additions & 3 deletions BuildTools/Targets/EvoBuildTarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ local EvoBuildTarget = {
"Runtime/Bindings/FFI/stbi/stbi.lua",
"Runtime/Bindings/FFI/stduuid/stduuid.lua",
"Runtime/Bindings/FFI/uws/uws.lua",
"Runtime/Bindings/FFI/webgpu/webgpu.lua",
"Runtime/Bindings/FFI/wgpu/wgpu.lua",
"Runtime/Bindings/FFI/webview/webview.lua",
"Runtime/Extensions/debugx.lua",
"Runtime/Extensions/jsonx.lua",
Expand Down Expand Up @@ -81,7 +81,7 @@ local EvoBuildTarget = {
"Runtime/Bindings/FFI/stbi/stbi_ffi.cpp",
"Runtime/Bindings/FFI/stduuid/stduuid_ffi.cpp",
"Runtime/Bindings/FFI/uws/uws_ffi.cpp",
"Runtime/Bindings/FFI/webgpu/webgpu_ffi.cpp",
"Runtime/Bindings/FFI/wgpu/wgpu_ffi.cpp",
"Runtime/Bindings/FFI/webview/webview_ffi.cpp",
"Runtime/Bindings/lrexlib.cpp",
"Runtime/Bindings/lzlib.cpp",
Expand All @@ -103,7 +103,7 @@ local EvoBuildTarget = {
"Runtime/Bindings/FFI/stbi",
"Runtime/Bindings/FFI/stduuid",
"Runtime/Bindings/FFI/uws",
"Runtime/Bindings/FFI/webgpu",
"Runtime/Bindings/FFI/wgpu",
"Runtime/Bindings/FFI/webview",
"deps",
"deps/eliemichel/glfw3webgpu",
Expand Down
264 changes: 0 additions & 264 deletions Runtime/Bindings/FFI/webgpu/webgpu_ffi.cpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
local ffi = require("ffi")

local webgpu = {}
local wgpu = {}

-- WebGPU API (from webgpu.h)
webgpu.cdefs = [[
wgpu.cdefs = [[
// WebGPU API (from webgpu.h)
typedef uint32_t WGPUFlags;
typedef uint32_t WGPUBool;
Expand Down Expand Up @@ -1635,7 +1634,7 @@ typedef struct WGPUSurfaceConfigurationExtras {
typedef void (*WGPULogCallback)(WGPULogLevel level, char const* message, void* userdata);
struct static_webgpu_exports_table {
struct static_wgpu_exports_table {
// Custom methods
const char* (*wgpu_version)();
Expand Down Expand Up @@ -1900,12 +1899,12 @@ struct static_webgpu_exports_table {
]]

function webgpu.initialize()
ffi.cdef(webgpu.cdefs)
function wgpu.initialize()
ffi.cdef(wgpu.cdefs)
end

function webgpu.version()
return ffi.string(webgpu.bindings.wgpu_version())
function wgpu.version()
return ffi.string(wgpu.bindings.wgpu_version())
end

return webgpu
return wgpu
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct static_webgpu_exports_table {
struct static_wgpu_exports_table {

// Custom methods
const char* (*wgpu_version)();
Expand Down
264 changes: 264 additions & 0 deletions Runtime/Bindings/FFI/wgpu/wgpu_ffi.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <webgpu.h>
#include <wgpu.h>

#include "webgpu_exports.h"
#include "wgpu_exports.h"

namespace webgpu_ffi {
namespace wgpu_ffi {
void* getExportsTable();
}
4 changes: 2 additions & 2 deletions Runtime/evo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local transform = require("transform")
local uv = require("uv")
local uws = require("uws")
local vfs = require("vfs")
local webgpu = require("webgpu")
local wgpu = require("wgpu")
local webview = require("webview")
local zlib = require("zlib")

Expand Down Expand Up @@ -229,7 +229,7 @@ function evo.getVersionText()
stbi = stbi.version(),
stduuid = stduuid.version(),
uws = uws.version(),
wgpu = webgpu.version(),
wgpu = wgpu.version(),
webview = webview.version(),
zlib = semanticZlibVersionString,
-- Since the ordering of pairs isn't well-defined, enforce alphabetic order for the CLI output
Expand Down
4 changes: 2 additions & 2 deletions Runtime/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern "C" {
#include "stbi_ffi.hpp"
#include "stduuid_ffi.hpp"
#include "uws_ffi.hpp"
#include "webgpu_ffi.hpp"
#include "wgpu_ffi.hpp"
#include "webview_ffi.hpp"

#include "LuaVirtualMachine.hpp"
Expand Down Expand Up @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
luaVM->BindStaticLibraryExports("runtime", runtime_ffi::getExportsTable());
luaVM->BindStaticLibraryExports("stbi", stbi_ffi::getExportsTable());
luaVM->BindStaticLibraryExports("stduuid", stduuid_ffi::getExportsTable());
luaVM->BindStaticLibraryExports("webgpu", webgpu_ffi::getExportsTable());
luaVM->BindStaticLibraryExports("wgpu", wgpu_ffi::getExportsTable());

// Some namespaces cannot be created from Lua because they store info only available in C++ land (like #defines)
luaVM->CreateGlobalNamespace("C_Runtime");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local function assertStruct(cdata)
assertEquals(type(cdata), "cdata")
end

describe("webgpu", function()
describe("wgpu", function()
describe("bindings", function()
it("should export native wgpu extension enums", function()
-- WGPUNativeSType
Expand Down
14 changes: 7 additions & 7 deletions Tests/Integration/glfw-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 wgpu = require("wgpu")

local isMacOS = (ffi.os == "OSX")
if isMacOS then
Expand All @@ -9,7 +9,7 @@ if isMacOS then
end

local instanceDescriptor = ffi.new("WGPUInstanceDescriptor")
local instance = webgpu.bindings.wgpu_create_instance(instanceDescriptor)
local instance = wgpu.bindings.wgpu_create_instance(instanceDescriptor)
if not instance then
error("Could not initialize WebGPU!")
end
Expand Down Expand Up @@ -38,13 +38,13 @@ local function onAdapterRequested(status, adapter, message, pUserData)
assert(status == ffi.C.WGPURequestAdapterStatus_Success, "Failed to request adapter")
requestedAdapter = adapter
end
webgpu.bindings.wgpu_instance_request_adapter(instance, adapterOpts, onAdapterRequested, nil)
wgpu.bindings.wgpu_instance_request_adapter(instance, adapterOpts, onAdapterRequested, nil)
print("Got adapter: ", requestedAdapter)

local function inspectAdapter(adapter)
local featureCount = webgpu.bindings.wgpu_adapter_enumerate_features(adapter, nil)
local featureCount = wgpu.bindings.wgpu_adapter_enumerate_features(adapter, nil)
local features = ffi.new("WGPUFeatureName[?]", featureCount)
webgpu.bindings.wgpu_adapter_enumerate_features(adapter, features)
wgpu.bindings.wgpu_adapter_enumerate_features(adapter, features)

print("Adapter features:")
for index = 0, tonumber(featureCount) - 1 do
Expand All @@ -53,7 +53,7 @@ local function inspectAdapter(adapter)
end

local limits = ffi.new("WGPUSupportedLimits")
local success = webgpu.bindings.wgpu_adapter_get_limits(adapter, limits)
local success = wgpu.bindings.wgpu_adapter_get_limits(adapter, limits)
assert(success, "Failed to get adapter limits")

print("Adapter limits:")
Expand Down Expand Up @@ -85,7 +85,7 @@ local function inspectAdapter(adapter)
print("\tmaxComputeWorkgroupsPerDimension: ", limits.limits.maxComputeWorkgroupsPerDimension)

local properties = ffi.new("WGPUAdapterProperties")
webgpu.bindings.wgpu_adapter_get_properties(adapter, properties)
wgpu.bindings.wgpu_adapter_get_properties(adapter, properties)

print("Adapter properties:")
print("\tvendorID: ", properties.vendorID)
Expand Down
8 changes: 4 additions & 4 deletions Tests/Integration/rml-glfw-wgpu-setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local ffi = require("ffi")
local glfw = require("glfw")
local interop = require("interop")
local rml = require("rml")
local webgpu = require("webgpu")
local wgpu = require("wgpu")

local isMacOS = (ffi.os == "OSX")
if isMacOS then
Expand All @@ -27,7 +27,7 @@ end
-- WebGPU setup
local function createDevice(window)
local instanceDescriptor = ffi.new("WGPUInstanceDescriptor")
local instance = webgpu.bindings.wgpu_create_instance(instanceDescriptor)
local instance = wgpu.bindings.wgpu_create_instance(instanceDescriptor)
if not instance then
error("Could not initialize WebGPU!")
end
Expand All @@ -43,7 +43,7 @@ local function createDevice(window)
assert(status == ffi.C.WGPURequestAdapterStatus_Success, "Failed to request adapter")
requestedAdapter = adapter
end
webgpu.bindings.wgpu_instance_request_adapter(instance, adapterOptions, onAdapterRequested, nil)
wgpu.bindings.wgpu_instance_request_adapter(instance, adapterOptions, onAdapterRequested, nil)

local requestedDevice
local function onDeviceRequested(status, device, message, userdata)
Expand All @@ -61,7 +61,7 @@ local function createDevice(window)
end

local deviceDescriptor = ffi.new("WGPUDeviceDescriptor")
webgpu.bindings.wgpu_adapter_request_device(requestedAdapter, deviceDescriptor, onDeviceRequested, nil)
wgpu.bindings.wgpu_adapter_request_device(requestedAdapter, deviceDescriptor, onDeviceRequested, nil)
assert(requestedDevice, "onDeviceRequested did not trigger, but it should have")

return requestedDevice
Expand Down
2 changes: 1 addition & 1 deletion Tests/unit-test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local specFiles = {
"Tests/BDD/uv-library.spec.lua",
"Tests/BDD/v8-library.spec.lua",
"Tests/BDD/vfs-library.spec.lua",
"Tests/BDD/webgpu-library.spec.lua",
"Tests/BDD/wgpu-library.spec.lua",
"Tests/BDD/webview-library.spec.lua",
"Tests/BDD/zlib-library.spec.lua",
"Tests/BDD/commandline-namespace.spec.lua",
Expand Down
2 changes: 1 addition & 1 deletion deps/unixbuild-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
deps/discover-submodule-versions.sh

deps/luajit-unixbuild.sh
deps/webgpu-unixbuild.sh
deps/wgpu-unixbuild.sh
deps/openssl-unixbuild.sh
deps/luaopenssl-unixbuild.sh
deps/rapidjson-unixbuild.sh
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion deps/windowsbuild-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ deps/discover-submodule-versions.sh

deps/fetch-mswebview2.sh
deps/luajit-windowsbuild.sh
deps/webgpu-windowsbuild.sh
deps/wgpu-windowsbuild.sh
deps/openssl-windowsbuild.sh
deps/luaopenssl-windowsbuild.sh
deps/rapidjson-windowsbuild.sh
Expand Down

0 comments on commit 814de07

Please sign in to comment.