Skip to content

Commit

Permalink
handle requestAdapter returning null better
Browse files Browse the repository at this point in the history
I'm not sure this is better? The old way printed errors
about trying to look at properties of null. The new way
says "WebGPU looks disabled". This means `navigator.gpu` exists
but `requestAdapter` returned null for all cases
  • Loading branch information
greggman committed Jan 16, 2024
1 parent ed96690 commit bfe6e20
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function makeTable(members, defaults, table) {
const result = {};
for (const [k, v] of Object.entries(table)) {
Expand Down Expand Up @@ -456,8 +455,8 @@ async function checkWorkers() {

function adapterOptionsToDesc(requestAdapterOptions, adapter) {
const parts = [
...(adapter.isFallbackAdapter ? ['fallback'] : []),
...(adapter.isCompatibilityMode ? ['compatibilityMode'] : []),
...(adapter?.isFallbackAdapter ? ['fallback'] : []),
...(adapter?.isCompatibilityMode ? ['compatibilityMode'] : []),
];
return parts.length > 0
? parts.join(' ')
Expand Down

0 comments on commit bfe6e20

Please sign in to comment.