gpu: Return type mismatch with interface - adapter/device -> getLimits/hasFeature #1117

Open
opened 2023-11-22 22:19:15 +00:00 by NewbLuck · 0 comments
NewbLuck commented 2023-11-22 22:19:15 +00:00 (Migrated from github.com)

There appears to be function signature mismatches between the getLimits and hasFeature functions for both adapter and device.

Source Locations

mach-gpu:src/adapter.zig:74

pub inline fn getLimits(adapter: *Adapter, limits: *SupportedLimits) bool {
    return Impl.adapterGetLimits(adapter, limits);
}

mach-gpu:/src/interface.zig:61

assertDecl(T, "adapterGetLimits", fn (adapter: *gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) u32);

mach-gpu:src/adapter.zig:82

pub inline fn hasFeature(adapter: *Adapter, feature: FeatureName) bool {
    return Impl.adapterHasFeature(adapter, feature);
}

mach-gpu:/src/interface.zig:63

assertDecl(T, "adapterHasFeature", fn (adapter: *gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) u32);

mach-gpu:/src/device.zig:250

pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool {
    return Impl.deviceGetLimits(device, limits);
}

mach-gpu:/src/interface.zig:148

assertDecl(T, "deviceGetLimits", fn (device: *gpu.Device, limits: *gpu.SupportedLimits) callconv(.Inline) u32);

mach-gpu:/src/device.zig:258

pub inline fn hasFeature(device: *Device, feature: FeatureName) bool {
    return Impl.deviceHasFeature(device, feature);
}

mach-gpu:/src/interface.zig:150

assertDecl(T, "deviceHasFeature", fn (device: *gpu.Device, feature: gpu.FeatureName) callconv(.Inline) u32);

Example

var lim: gpu.SupportedLimits = .{};
if (device.getLimits(&lim)) {
    new.max_size = lim.limits.max_texture_dimension_2d;
    new.max_layers = lim.limits.max_texture_array_layers;
}
run transitive failure
└─ run myapp transitive failure
   ├─ zig build-exe myapp Debug native 2 errors
   └─ install myapp transitive failure
      └─ zig build-exe myapp Debug native (+23 more reused dependencies)
C:\Users\#####\AppData\Local\zig\p\1220fbe0d105e6cb85c02572cb7510057c3fa7aceee4f0d877dccbd76d484709d892\src\device.zig:251:36: error: expected type 'bool', found 'u32'
        return Impl.deviceGetLimits(device, limits);
               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
C:\Users\#####\AppData\Local\zig\p\1220fbe0d105e6cb85c02572cb7510057c3fa7aceee4f0d877dccbd76d484709d892\src\device.zig:250:72: note: function return type declared here
    pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool {
                                                                       ^~~~
src\TextureStore.zig:84:25: note: called from here
    if (device.getLimits(&lim)) {
        ~~~~~~~~~~~~~~~~^~~~~~
There appears to be function signature mismatches between the `getLimits` and `hasFeature` functions for both `adapter` and `device`. ## Source Locations [mach-gpu:src/adapter.zig:74](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/adapter.zig#L74) ```zig pub inline fn getLimits(adapter: *Adapter, limits: *SupportedLimits) bool { return Impl.adapterGetLimits(adapter, limits); } ``` [mach-gpu:/src/interface.zig:61](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/interface.zig#L61) ```zig assertDecl(T, "adapterGetLimits", fn (adapter: *gpu.Adapter, limits: *gpu.SupportedLimits) callconv(.Inline) u32); ``` --- [mach-gpu:src/adapter.zig:82](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/adapter.zig#L82) ```zig pub inline fn hasFeature(adapter: *Adapter, feature: FeatureName) bool { return Impl.adapterHasFeature(adapter, feature); } ``` [mach-gpu:/src/interface.zig:63](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/interface.zig#L63) ```zig assertDecl(T, "adapterHasFeature", fn (adapter: *gpu.Adapter, feature: gpu.FeatureName) callconv(.Inline) u32); ``` --- [mach-gpu:/src/device.zig:250](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/device.zig#L250) ```zig pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool { return Impl.deviceGetLimits(device, limits); } ``` [mach-gpu:/src/interface.zig:148](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/interface.zig#L148) ```zig assertDecl(T, "deviceGetLimits", fn (device: *gpu.Device, limits: *gpu.SupportedLimits) callconv(.Inline) u32); ``` --- [mach-gpu:/src/device.zig:258](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/device.zig#L258) ```zig pub inline fn hasFeature(device: *Device, feature: FeatureName) bool { return Impl.deviceHasFeature(device, feature); } ``` [mach-gpu:/src/interface.zig:150](https://github.com/hexops/mach-gpu/blob/7306c2c9ff4c4fa74582b232278df2302f60c0ee/src/interface.zig#L150) ```zig assertDecl(T, "deviceHasFeature", fn (device: *gpu.Device, feature: gpu.FeatureName) callconv(.Inline) u32); ``` ## Example ```zig var lim: gpu.SupportedLimits = .{}; if (device.getLimits(&lim)) { new.max_size = lim.limits.max_texture_dimension_2d; new.max_layers = lim.limits.max_texture_array_layers; } ``` ``` run transitive failure └─ run myapp transitive failure ├─ zig build-exe myapp Debug native 2 errors └─ install myapp transitive failure └─ zig build-exe myapp Debug native (+23 more reused dependencies) C:\Users\#####\AppData\Local\zig\p\1220fbe0d105e6cb85c02572cb7510057c3fa7aceee4f0d877dccbd76d484709d892\src\device.zig:251:36: error: expected type 'bool', found 'u32' return Impl.deviceGetLimits(device, limits); ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ C:\Users\#####\AppData\Local\zig\p\1220fbe0d105e6cb85c02572cb7510057c3fa7aceee4f0d877dccbd76d484709d892\src\device.zig:250:72: note: function return type declared here pub inline fn getLimits(device: *Device, limits: *SupportedLimits) bool { ^~~~ src\TextureStore.zig:84:25: note: called from here if (device.getLimits(&lim)) { ~~~~~~~~~~~~~~~~^~~~~~ ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1117
No description provided.