Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

@typegpu/gl: support texture.write() options

Aperta
#3,214 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
47/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Start in packages/typegpu-gl at WebGLTexture.write() and compare its behavior with the WebGPU texture write path, especially the handling of 'render' textures. The issue lists WebGL 2 mappings for several options and calls out framebuffer blitting for resampling; identify which options can be supported and which need a specific error. Done means options work where supported and unsupported ones are named in the error; the issue does not name tests to run.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Description

On a root from @typegpu/gl, any texture.write() call that passes an options object throws:

WebGL fallback does not support texture.write() options yet.

Code that passes options on WebGPU, such as { premultipliedAlpha: false, fit: 'clip' } (added in #2641), has to check isGLRoot(root) and call write differently on each backend:

if (isGLRoot(root)) {
  texture.write(source);
} else {
  texture.write(source, { premultipliedAlpha: false, fit: 'clip' });
}

This defeats the point of a drop-in fallback.

Proposal

Support the options in WebGLTexture.write() in packages/typegpu-gl, or at least accept and ignore those that already match WebGL's behavior. Most of them map onto WebGL 2 directly:

  • premultipliedAlpha: UNPACK_PREMULTIPLY_ALPHA_WEBGL
  • flipY: UNPACK_FLIP_Y_WEBGL
  • origin / mipLevel: the xoffset/yoffset/level arguments of texSubImage2D
  • sourceOrigin and fit: 'clip': UNPACK_SKIP_PIXELS / UNPACK_SKIP_ROWS / UNPACK_ROW_LENGTH for buffers, or a sized texSubImage2D for image sources
  • fit: 'fill' / resampling: a blit through a framebuffer, as the WebGPU path does for 'render' textures

Options that can't be supported should throw a specific error naming the unsupported option rather than rejecting every options object.


Found in @typegpu/gl 0.12.6. Related: #2641, #2858, #1637.

Lingua principale
TypeScript
Stelle
3.3k
Fork
135
Merge medio
4g 1h
PR unite (30g)
64

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di software-mansion/TypeGPU

Tutte le issue di software-mansion/TypeGPU

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.