Skip to content

Commit

Permalink
Refactor device enumeration assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
chances committed Feb 10, 2024
1 parent 83c07f3 commit d6acf52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/enumerate/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ void main() {
writefln("Preferred backend type: %s", preferredBackend);
auto adapters = instance.adapters;
writefln("Found %d suitable adapter(s):", adapters.length);
if (adapters.length == 0) assert(0, "WebGPU is not supported on this device. Try updating your graphics drivers.");

for (int i = 0; i < adapters.length; i++) {
auto adapter = adapters[i];
auto props = adapter.properties;
Expand All @@ -31,8 +33,6 @@ void main() {
if (adapter.ready) adapter.destroy();
}

if (adapters.length == 0) assert(0, "WebGPU is not supported on this device. Try updating your graphics drivers.");

auto adapter = instance.requestAdapter(PowerPreference.lowPower, preferredBackend);
assert(adapter.ready, "Adapter instance was not initialized: Adapter status: " ~ adapter.status.text);
writefln("Adapter limits:\n%s", adapter.limits.toString);
Expand Down

0 comments on commit d6acf52

Please sign in to comment.