// luma.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { glsl } from "../glsl-utils/highlight.js"; /** Adds defines to help identify GPU architecture / platform */ export function getPlatformShaderDefines(platformInfo) { switch (platformInfo?.gpu.toLowerCase()) { case 'apple': return `\ #define APPLE_GPU #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 `; case 'nvidia': return `\ #define NVIDIA_GPU #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 `; case 'intel': return `\ #define INTEL_GPU #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 `; case 'amd': // AMD Does not eliminate fp64 code return `\ #define AMD_GPU `; default: // We don't know what GPU it is, could be that the GPU driver or // browser is not implementing UNMASKED_RENDERER constant and not // reporting a correct name return `\ #define DEFAULT_GPU #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 `; } }