diff --git a/gpu/src/Adapter.zig b/gpu/src/Adapter.zig index be073b55..fdf4c1b9 100644 --- a/gpu/src/Adapter.zig +++ b/gpu/src/Adapter.zig @@ -19,14 +19,14 @@ //! https://gpuweb.github.io/gpuweb/#gpuadapter const std = @import("std"); -const FeatureName = @import("enums.zig").FeatureName; +const Feature = @import("enums.zig").Feature; const Limits = @import("Limits.zig"); const Device = @import("Device.zig"); const Adapter = @This(); /// The features which can be used to create devices on this adapter. -features: []FeatureName, +features: []Feature, /// The best limits which can be used to create devices on this adapter. /// @@ -71,7 +71,7 @@ pub inline fn release(adapter: Adapter) void { } /// Tests of the given feature can be used to create devices on this adapter. -pub fn hasFeature(adapter: Adapter, feature: FeatureName) bool { +pub fn hasFeature(adapter: Adapter, feature: Feature) bool { for (adapter.features) |f| { if (f == feature) return true; } diff --git a/gpu/src/Device.zig b/gpu/src/Device.zig index acf9abeb..8e2585b0 100644 --- a/gpu/src/Device.zig +++ b/gpu/src/Device.zig @@ -6,7 +6,7 @@ //! //! https://gpuweb.github.io/gpuweb/#devices //! https://gpuweb.github.io/gpuweb/#gpuadapter -const FeatureName = @import("enums.zig").FeatureName; +const Feature = @import("enums.zig").Feature; const Limits = @import("Limits.zig"); const Queue = @import("Queue.zig"); const ShaderModule = @import("ShaderModule.zig"); @@ -40,10 +40,10 @@ pub const VTable = struct { nativeCreateSwapChain: fn (ptr: *anyopaque, surface: ?Surface, descriptor: *const SwapChain.Descriptor) SwapChain, // WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor); // WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device); - // WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features); + // WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeature * features); // WGPU_EXPORT bool wgpuDeviceGetLimits(WGPUDevice device, WGPUSupportedLimits * limits); getQueue: fn (ptr: *anyopaque) Queue, - // WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature); + // WGPU_EXPORT bool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeature feature); // WGPU_EXPORT void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, char const * message); // WGPU_EXPORT void wgpuDeviceLoseForTesting(WGPUDevice device); // WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback callback, void * userdata); @@ -80,7 +80,7 @@ pub inline fn nativeCreateSwapChain(device: Device, surface: ?Surface, descripto // TODO: docs pub const Descriptor = struct { label: ?[]const u8 = null, - required_features: ?[]FeatureName = null, + required_features: ?[]Feature = null, required_limits: ?Limits = null, }; diff --git a/gpu/src/NativeInstance.zig b/gpu/src/NativeInstance.zig index ce24609e..2b9ce9c3 100644 --- a/gpu/src/NativeInstance.zig +++ b/gpu/src/NativeInstance.zig @@ -202,8 +202,8 @@ fn wrapAdapter(adapter: c.WGPUAdapter) Adapter { }; // TODO: implement Adapter interface: - // WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeatureName * features); - // WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature); + // WGPU_EXPORT size_t wgpuAdapterEnumerateFeatures(WGPUAdapter adapter, WGPUFeature * features); + // WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeature feature); // WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits); return .{ diff --git a/gpu/src/enums.zig b/gpu/src/enums.zig index 988590df..7b962614 100644 --- a/gpu/src/enums.zig +++ b/gpu/src/enums.zig @@ -1,4 +1,4 @@ -pub const FeatureName = enum(u32) { +pub const Feature = enum(u32) { depth24_unorm_stencil8 = 0x00000002, depth32_float_stencil8 = 0x00000003, timestamp_query = 0x00000004, @@ -14,9 +14,8 @@ pub const FeatureName = enum(u32) { dawn_native = 0x000003ec, }; -// TODO: add featureNameString method -// TODO: should featureName be renamed to just feature? +// TODO: add featureName stringer method test "syntax" { - _ = FeatureName; + _ = Feature; } diff --git a/gpu/src/main.zig b/gpu/src/main.zig index a5e8dfa1..27d8367b 100644 --- a/gpu/src/main.zig +++ b/gpu/src/main.zig @@ -36,7 +36,7 @@ pub const CommandBuffer = @import("CommandBuffer.zig"); pub const ShaderModule = @import("ShaderModule.zig"); pub const SwapChain = @import("SwapChain.zig"); -pub const FeatureName = @import("enums.zig").FeatureName; +pub const Feature = @import("enums.zig").Feature; pub const TextureUsage = @import("texture_usage.zig").TextureUsage; pub const TextureFormat = @import("texture_format.zig").TextureFormat; pub const PresentMode = @import("present_mode.zig").PresentMode; @@ -55,5 +55,5 @@ test "syntax" { _ = ShaderModule; _ = SwapChain; - _ = FeatureName; + _ = Feature; }