function replaceDefine(defines, defineName, newDefineValue) {
  const n = defines.length;
  for (let i = 0; i < n; i++) {
    const define = defines[i];
    const tokens = define.trimStart().split(/\s+/);
    if (tokens[0] === defineName) {
      defines[i] = `${defineName} ${newDefineValue}`;
    }
  }
}
Replaces the value of the specified 'define' directive identifier
with the given value.

The given defines are the parts of the define directives that are
stored in the `ShaderSource`. For example, the defines may be
`["EXAMPLE", "EXAMPLE_VALUE 123"]`

Calling `replaceDefine(defines, "EXAMPLE", 999)` will result in
the defines being
`["EXAMPLE 999", "EXAMPLE_VALUE 123"]`

@param {string[]} defines The define directive identifiers
@param {string} defineName The name (identifier) of the define directive
@param {any} newDefineValue The new value whose string representation
will become the token string for the define directive
@private