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

Render Graphs #315

Open
vorg opened this issue Aug 11, 2022 · 1 comment
Open

Render Graphs #315

vorg opened this issue Aug 11, 2022 · 1 comment

Comments

@vorg
Copy link
Member

vorg commented Aug 11, 2022

I've started working on MVP for Render Graphs b17d58d

Screenshot 2022-08-12 at 00 38 00

It's a very basic implementation where all the resources are allocated manually and there is no actual dependencies between passes in the render graph. We simply pass textures by value to whenever they should be used.

resourceCache.beginFrame();
renderGraph.beginFrame();

// duplicate pass descriptor to get unique texture
let passDesc = {
  ...passes.directionalLightShadows.pass,
};
passDesc.color[0] = colorMap;
passDesc.depth = shadowMap;

let shadowMapPass = resourceCache.pass(passDesc);

renderGraph.renderPass({
  name: "RenderShadowMap",
  pass: shadowMapPass,
  render: () => {
    drawMeshes(null, true, light, entities, shadowCastingEntities);
  },
});

...

const mainPass = resourceCache.pass({
  color: [mainPassOutputTexture],
  depth: outputDepthTexture,
  clearColor: [0, 0, 0, 1],
  clearDepth: 1,
});
renderGraph.renderPass({
  name: "MainPass",
  uses: [...shadowMaps], //declare pass render graph resources used
  pass: mainPass,
  render: () => {
    drawMeshes(
      camera,
      false,
      null,
      entities,
      entitiesToDraw,
      skyboxEntities[0]?._skybox,
      true
    );
  },
});

...

renderGraph.endFrame();  //passes get executed
resourceCache.endFrame();
@dmnsgn dmnsgn added the type/feat A new feature label Oct 19, 2022
@dmnsgn dmnsgn added this to the 4.0.0 milestone Oct 19, 2022
@vorg
Copy link
Member Author

vorg commented Aug 30, 2023

There is a seed of a solution but hardcoded into Render Pipeline System. Needs review.

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

No branches or pull requests

2 participants