/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ import e from"../../core/Error.js";import{unwrapOrThrow as t}from"../../core/maybe.js";import{PixelType as r,TextureSamplingMode as a,PixelFormat as o,SizedPixelFormat as l}from"./enums.js";function n(n,i){const{textureFloat:f,colorBufferFloat:s}=n.capabilities,u=f?.textureFloat,m=f?.textureFloatLinear,_=f?.textureHalfFloat,p=f?.textureHalfFloatLinear,d=f?.HALF_FLOAT,x=s?.textureFloat,b=s?.textureHalfFloat,c=s?.floatBlend,{floatBufferBlendWorking:h}=t(n.driverTest);if(!u&&!_)throw new e("heatmap:missing-texture-float","HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float or OES_texture_half_float.");if(!x&&!b)throw new e("heatmap:missing-color-buffer-float","HeatmapRenderer requires the WebGL extension EXT_color_buffer_float or EXT_color_buffer_half_float or WEBGL_color_buffer_float.");if(!(c&&h||b))throw new e("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend or EXT_color_buffer_half_float."+(h?"":" This device claims support for EXT_float_blend, but does not actually support it."));const E=u&&x&&c&&h,F=_&&b,R=m,L=p,T=!!s?.R32F,w=!!s?.R16F;if(E&&(R||!L))return R||i.warnOnce("Missing WebGL extension OES_texture_float_linear. Heatmap quality may be reduced."),{dataType:r.FLOAT,samplingMode:R?a.LINEAR:a.NEAREST,pixelFormat:T?o.RED:o.RGBA,internalFormat:T?l.R32F:o.RGBA};if(F)return L||i.warnOnce("Missing WebGL extension OES_texture_half_float_linear. Heatmap quality may be reduced."),{dataType:d,samplingMode:L?a.LINEAR:a.NEAREST,pixelFormat:w?o.RED:o.RGBA,internalFormat:w?l.R16F:o.RGBA};throw new e("heatmap:missing-hardware-support","HeatmapRenderer requires WebGL extensions that allow it to render and blend to float or half float textures.")}export{n as loadHeatmapTextureConfiguration};