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

RenderCache缓存无法命中 #1826

Open
re-ovo opened this issue Nov 10, 2024 · 0 comments · May be fixed by #1839
Open

RenderCache缓存无法命中 #1826

re-ovo opened this issue Nov 10, 2024 · 0 comments · May be fixed by #1839
Labels

Comments

@re-ovo
Copy link

re-ovo commented Nov 10, 2024

问题

Debug的时候发现RenderPipeline一直在创建,看了下RenderCache, copy了描述符以后又更新了描述符,导致缓存无法命中

// RenderCache.ts
createRenderPipeline(descriptor: RenderPipelineDescriptor): RenderPipeline {
    let renderPipeline = this.renderPipelinesCache.get(descriptor);
    if (renderPipeline === null) {
      const descriptorCopy = renderPipelineDescriptorCopy(descriptor);
      // 这里更新了descriptorCopy,导致缓存实际上无法命中
      descriptorCopy.colorAttachmentFormats =
        descriptorCopy.colorAttachmentFormats.filter((f) => f); 
      renderPipeline = this.device.createRenderPipeline(descriptorCopy);
      this.renderPipelinesCache.add(descriptorCopy, renderPipeline);
    }
    return renderPipeline;
  }

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants