Alexander Rose 2 лет назад
Родитель
Сommit
fc948d8b27

+ 1 - 0
CHANGELOG.md

@@ -18,6 +18,7 @@ Note that since we don't clearly distinguish between a public and private interf
     - Add `Segmentation` custom volume property
     - Add `SegmentRepresentation` representation
     - Add `volume-segment` color theme
+- Fix GPU marching cubes failing for large meshes with webgl2 (due to use of float16)
 
 ## [v3.27.0] - 2022-12-15
 

+ 1 - 2
src/mol-gl/compute/histogram-pyramid/reduction.ts

@@ -204,8 +204,7 @@ export function createHistogramPyramid(ctx: WebGLContext, inputTexture: Texture,
     // return at least a count of one to avoid issues downstram
     const count = Math.max(1, getHistopyramidSum(ctx, levelTexturesFramebuffers[0].texture));
     const height = Math.ceil(count / Math.pow(2, levels));
-    // const scale = Vec2.create(maxSize / inputTexture.width, maxSize / inputTexture.height);
-    // console.log('height', height, 'finalCount', count, 'scale', scale);
+    // console.log({ height, count, scale });
 
     return { pyramidTex, count, height, levels, scale };
 }

+ 4 - 6
src/mol-gl/compute/marching-cubes/isosurface.ts

@@ -142,9 +142,7 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex
 
     if (isWebGL2(gl)) {
         if (!vertexTexture) {
-            vertexTexture = extensions.colorBufferHalfFloat && extensions.textureHalfFloat
-                ? resources.texture('image-float16', 'rgba', 'fp16', 'nearest')
-                : resources.texture('image-float32', 'rgba', 'float', 'nearest');
+            vertexTexture = resources.texture('image-float32', 'rgba', 'float', 'nearest');
         }
 
         if (!groupTexture) {
@@ -199,9 +197,9 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex
     gl.finish();
     if (isTimingMode) ctx.timer.markEnd('createIsosurfaceBuffers');
 
-    // printTextureImage(readTexture(ctx, vertexTexture, new Float32Array(width * height * 4)), { scale: 0.75 });
-    // printTextureImage(readTexture(ctx, groupTexture, new Uint8Array(width * height * 4)), { scale: 0.75 });
-    // printTextureImage(readTexture(ctx, normalTexture, new Float32Array(width * height * 4)), { scale: 0.75 });
+    // printTextureImage(readTexture(ctx, vertexTexture, new Float32Array(width * height * 4)), { scale: 0.75, normalize: true });
+    // printTextureImage(readTexture(ctx, groupTexture, new Uint8Array(width * height * 4)), { scale: 0.75, normalize: true });
+    // printTextureImage(readTexture(ctx, normalTexture, new Float32Array(width * height * 4)), { scale: 0.75, normalize: true });
 
     return { vertexTexture, groupTexture, normalTexture, vertexCount: count };
 }