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

gpu gaussian surface fixes and tweaks

parent 47d801ea
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
const delta = getDelta(Box3D.expand(Box3D.empty(), box, Vec3.create(pad, pad, pad)), resolution)
const dim = Vec3.zero()
Vec3.ceil(dim, Vec3.mul(dim, extent, delta))
// console.log('grid dim', dim)
// console.log('grid dim cpu', dim)
const space = Tensor.Space(dim, [0, 1, 2], Float32Array)
const data = space.create()
......
......@@ -281,9 +281,9 @@ function getTexture2dSize(maxTexSize: number, gridDim: Vec3) {
let texDimX = 0
let texDimY = gridDim[1]
let texRows = 1
let texCols = gridDim[0]
let texCols = gridDim[2]
if (maxTexSize < gridDim[0] * gridDim[2]) {
texCols = Math.floor(maxTexSize / gridDim[0])
texCols = Math.floor(maxTexSize / gridDim[0])
texRows = Math.ceil(gridDim[2] / texCols)
texDimX = texCols * gridDim[0]
texDimY *= texRows
......@@ -311,7 +311,11 @@ async function fieldFromTexture2d(ctx: WebGLContext, texture: Texture, dim: Vec3
const framebuffer = framebufferCache.get(ctx, FramebufferName).value
framebuffer.bind()
texture.attachFramebuffer(framebuffer, 0)
await ctx.readPixelsAsync(0, 0, width, height, image)
// TODO too slow, why? Too many checks if gpu ready???
// await ctx.readPixelsAsync(0, 0, width, height, image)
ctx.readPixels(0, 0, width, height, image)
// debugTexture(createImageData(image, width, height), 1/3)
let j = 0
let tmpCol = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment