declare const _default: "\n\n var pos : array = array(\n vec2(-1.0, 1.0), vec2(1.0, 1.0), vec2(-1.0, -1.0), vec2(1.0, -1.0)\n );\n\n struct VertexOutput {\n @builtin(position) position : vec4f,\n @location(0) texCoord : vec2f,\n @location(1) @interpolate(flat) slice : u32\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex : u32, @builtin(instance_index) instanceIndex : u32) -> VertexOutput {\n var output : VertexOutput;\n output.texCoord = pos[vertexIndex] * vec2f(0.5, -0.5) + vec2f(0.5);\n output.position = vec4f(pos[vertexIndex], 0, 1);\n output.slice = instanceIndex;\n return output;\n }\n\n #ifdef UNFILTERABLE\n @group(0) @binding(0) var img : texture_3d;\n\n fn texel(x : i32, y : i32, z : i32) -> vec4f {\n return textureLoad(img, vec3i(x, y, z), 0);\n }\n #else\n @group(0) @binding(0) var imgSampler : sampler;\n @group(0) @binding(1) var img : texture_3d;\n #endif\n\n @fragment\n fn fragmentMain(input : VertexOutput) -> @location(0) vec4f {\n #ifdef UNFILTERABLE\n // the position the sampler samples at, in the texels of the previous mip level, which\n // for an odd size is not at the corner of two texels\n let srcSize = vec3f(textureDimensions(img));\n let dstSize = max(vec3f(1.0), floor(srcSize * 0.5));\n let pos = vec3f(input.position.xy, f32(input.slice) + 0.5) * srcSize / dstSize - 0.5;\n\n // trilinear filtering of the 2x2x2 texels around it\n let base = floor(pos);\n let f = pos - base;\n let i0 = vec3i(base);\n let i1 = min(i0 + 1, vec3i(srcSize) - 1);\n let slice0 = mix(\n mix(texel(i0.x, i0.y, i0.z), texel(i1.x, i0.y, i0.z), f.x),\n mix(texel(i0.x, i1.y, i0.z), texel(i1.x, i1.y, i0.z), f.x),\n f.y\n );\n let slice1 = mix(\n mix(texel(i0.x, i0.y, i1.z), texel(i1.x, i0.y, i1.z), f.x),\n mix(texel(i0.x, i1.y, i1.z), texel(i1.x, i1.y, i1.z), f.x),\n f.y\n );\n return mix(slice0, slice1, f.z);\n #else\n // the center of the destination depth slice, in the normalized coordinates shared by\n // all mip levels - the linear filtering then averages the two source slices it lies\n // between\n let sourceDepth = f32(textureDimensions(img).z);\n let destDepth = max(1.0, floor(sourceDepth * 0.5));\n let w = (f32(input.slice) + 0.5) / destDepth;\n\n return textureSampleLevel(img, imgSampler, vec3f(input.texCoord, w), 0.0);\n #endif\n }\n"; export default _default;