Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup optimization: In scene cache compiler: write directly into UniformBuffer. #287

Open
bhouston opened this issue Jan 19, 2023 · 0 comments

Comments

@bhouston
Copy link
Owner

This part of scene compiler is very slow:

 // make material uniforms
  if (materialIdToUniforms.get(material.id) === undefined) {
    const materialParameters = material.getParameters();
    const materialUniforms: UniformValueMap = {};
    for (const uniformName of Object.keys(materialParameters)) {
      const uniformValue = materialParameters[uniformName];
      // convert from Parameters to Uniforms
      if (uniformValue instanceof Texture) {
        const texture = uniformValue as Texture;
        const textureId = texture.id;
        let texImage2D = textureIdToTexImage2D.get(textureId);
        if (texImage2D === undefined) {
          texImage2D = makeTexImage2DFromTexture(context, texture);
          textureIdToTexImage2D.set(textureId, texImage2D);
        }
        materialUniforms[uniformName] = texImage2D;
      } else {
        materialUniforms[uniformName] = uniformValue;
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant