sholloway / agents-playground

MIT License
4 stars 0 forks source link

Encapsulate WebGPU - 2D #96

Open sholloway opened 10 months ago

sholloway commented 10 months ago

Create a 2D API backed by WebGPU and WGSL


Define an API for drawing in a 2D Context.

2D API Operations

Operation Description Supports
get_context Provides a canvas that can be drawn on.
clear Clears the canvas with a provided color. color
pan Moves the 2D camera. direction, distance
circle Draws a circle. center, radius, stroke, fill
square Draws an axis-aligned square. origin=(CENTER, UPPER_LEFT, UPPER_RIGHT, ...) , edge_size: float, stroke, fill
rect Draws an axis-aligned rectangle. origin=(CENTER, UPPER_LEFT, UPPER_RIGHT, ...) , edge_size: float, stroke, fill
poly Draws a polygon
line Draws a line
bézier Draws a curve.
spline Draws a spline curve.
text Draws text.
grid Draws a grid

Advanced Features

Considerations

References

Resources

Rectangles

Lines

Curves

Engine Architecture

Text Rendering

Examples

WebGPU Information

Tooling

sholloway commented 8 months ago

Switching to a GPU based rendering is going to require making some changes to the overall architecture.

Compute Shader Potential

What part of the pipeline can leverage compute shaders?

sholloway commented 8 months ago

Debugging

Debugging shaders is a major pain in the Python ecosystem. The debug tools that work with Rust don't work with Python. I want a way to get debug information out of shaders.

Ideas

Challenges