Skip to content

Commit 4489979

Browse files
committed
feat(attribute): integrate handle warning into disable attribute
1 parent 3450c7f commit 4489979

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/attribute/disable-attribute.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { BaseOptions } from "../option"
22

33
import { validateAttribute } from "../attribute"
4+
import { handleWarning } from "../utility/handle-warning"
45

56
/**
67
* Configuration options for disabling a vertex attribute
@@ -39,8 +40,18 @@ export function disableAttribute(
3940
// Validate attribute location using shared helper
4041
const location = validateAttribute(context, program, options)
4142

42-
// If attribute is valid, disable it
4343
if (location !== -1) {
44+
// If attribute is valid, disable it
4445
context.disableVertexAttribArray(location)
46+
} else if (options.strict) {
47+
// If strict mode is enabled and attribute is missing → delegate to handle warning
48+
handleWarning({
49+
subject : "attribute",
50+
context : {
51+
action : "disable",
52+
result : `Attribute "${options.name}" not found in program`
53+
},
54+
strict : true
55+
})
4556
}
46-
}
57+
}

0 commit comments

Comments
 (0)