I was looking at my generated JS after I switched to the ES modules.
It was all nicely minified until I reached code like:
`),e.fragment.uniforms.add("ovInnerColorTex","sampler2D"),e.fragment.uniforms.add("ovOuterColorTex","sampler2D"),e.fragment.uniforms.add("overlayOpacity","float"),e.fragment.code.add(PG`
vec4 getOverlayColor(sampler2D ov0Tex, sampler2D ov1Tex, vec4 texCoords) {
// read textures outside of conditions, to avoid artifacts likely related to non-uniform flow control:
// - https://www.khronos.org/opengl/wiki/Sampler_(GLSL)#Non-uniform_flow_control
// - https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/13657
vec4 color0 = texture2D(ov0Tex, texCoords.xy);
vec4 color1 = texture2D(ov1Tex, texCoords.zw);
float valid0 = float((texCoords.x >= 0.0) && (texCoords.x <= 1.0) && (texCoords.y >= 0.0) && (texCoords.y <= 1.0));
float valid1 = float((texCoords.z >= 0.0) && (texCoords.z <= 1.0) && (texCoords.w >= 0.0) && (texCoords.w <= 1.0));
// Pick color0 if valid, otherwise color1 if valid, otherwise vec4(0)
return mix(color1 * valid1, color0, valid0);
}
Solved! Go to Solution.
Quick follow-up, we've opened an issue to look into minifying the GLSL files. It won't happen immediately, but it's now something that's on our radar, thanks.
@VictorBerchet Thanks for reporting. It looks like the template literals aren't minified. We're taking a look.
Quick follow-up, we've opened an issue to look into minifying the GLSL files. It won't happen immediately, but it's now something that's on our radar, thanks.
Thanks a lot Andy for the update.
I don't think there is any rush and it's great to know it will be handled.