Skip to content
Snippets Groups Projects
Commit fc948d8b authored by Alexander Rose's avatar Alexander Rose
Browse files

fix gpu mc use of float16

parent 8774658f
Branches
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ Note that since we don't clearly distinguish between a public and private interf ...@@ -18,6 +18,7 @@ Note that since we don't clearly distinguish between a public and private interf
- Add `Segmentation` custom volume property - Add `Segmentation` custom volume property
- Add `SegmentRepresentation` representation - Add `SegmentRepresentation` representation
- Add `volume-segment` color theme - 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 ## [v3.27.0] - 2022-12-15
......
...@@ -204,8 +204,7 @@ export function createHistogramPyramid(ctx: WebGLContext, inputTexture: Texture, ...@@ -204,8 +204,7 @@ export function createHistogramPyramid(ctx: WebGLContext, inputTexture: Texture,
// return at least a count of one to avoid issues downstram // return at least a count of one to avoid issues downstram
const count = Math.max(1, getHistopyramidSum(ctx, levelTexturesFramebuffers[0].texture)); const count = Math.max(1, getHistopyramidSum(ctx, levelTexturesFramebuffers[0].texture));
const height = Math.ceil(count / Math.pow(2, levels)); const height = Math.ceil(count / Math.pow(2, levels));
// const scale = Vec2.create(maxSize / inputTexture.width, maxSize / inputTexture.height); // console.log({ height, count, scale });
// console.log('height', height, 'finalCount', count, 'scale', scale);
return { pyramidTex, count, height, levels, scale }; return { pyramidTex, count, height, levels, scale };
} }
\ No newline at end of file
...@@ -142,9 +142,7 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex ...@@ -142,9 +142,7 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex
if (isWebGL2(gl)) { if (isWebGL2(gl)) {
if (!vertexTexture) { if (!vertexTexture) {
vertexTexture = extensions.colorBufferHalfFloat && extensions.textureHalfFloat vertexTexture = resources.texture('image-float32', 'rgba', 'float', 'nearest');
? resources.texture('image-float16', 'rgba', 'fp16', 'nearest')
: resources.texture('image-float32', 'rgba', 'float', 'nearest');
} }
if (!groupTexture) { if (!groupTexture) {
...@@ -199,9 +197,9 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex ...@@ -199,9 +197,9 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex
gl.finish(); gl.finish();
if (isTimingMode) ctx.timer.markEnd('createIsosurfaceBuffers'); if (isTimingMode) ctx.timer.markEnd('createIsosurfaceBuffers');
// printTextureImage(readTexture(ctx, vertexTexture, 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 }); // 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 }); // printTextureImage(readTexture(ctx, normalTexture, new Float32Array(width * height * 4)), { scale: 0.75, normalize: true });
return { vertexTexture, groupTexture, normalTexture, vertexCount: count }; return { vertexTexture, groupTexture, normalTexture, vertexCount: count };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment