software-mansion / software-mansion/TypeGPU

[RFC] feat: Immediates

Open
#2,688 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

  • #2812 by @reczkok — closed without merging
Dominant language
TypeScript
Stars
3.2k
Forks
122
Avg merge
3d 5h
Merged PRs (30d)
34

Description

Intro to immediates

API sketch:

const Props = d.struct({
  color: d.vec3f,
});

// DEFINITION
const props = tgpu.immediateVar(Props);

// USAGE
const renderPipeline = root.createRenderPipeline({
  vertex: common.fullScreenTriangle,
  fragment: () => {
    'use gpu';
    return d.vec4f(props.$.color);
  },
});

// SUPPLYING
renderPipeline
  .withImmediates(props, { color: d.vec3f(1, 0, 0) })
  .draw(3);

Additional TypeGPU niceities:

  • Our immediates can be used to provide an accessor, meaning a library can indirectly use an immediate through the user's decision.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked “Intro to immediates” and compare it with the API sketch in this issue. The work is done when the proposed immediateVar and withImmediates flow is implemented, including accessor support for indirect library use.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.