Skip to content

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

Description

@bhouston

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;
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions