gpu: RenderTarget.Valid and Epoch treat a depth-only target as invalid

Aperta Adatta ai principianti
#2,184 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli

Direzione di ricerca

Il bug è in RenderTarget.Valid (gpu/device.go:586) e RenderTarget.Epoch (gpu/device.go:578), che controllano solo l'attachment di colore. Inizia da questi due metodi e dal percorso CreateRenderTarget che costruisce un target solo profondità. Il lavoro è completo quando il repro stampa true e l'epoch del device per un target solo profondità, Valid diventa false dopo la perdita del device, e un test copre target solo profondità, solo colore e colore+profondità.

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

Descrizione

Context

CreateRenderTarget accepts a depth-only target (no color texture, a DepthFormat), which shadow maps use. But RenderTarget.Valid (gpu/device.go:586) returns false whenever rt.Color == nil, and RenderTarget.Epoch (gpu/device.go:578) returns 0 in that case, because both only look at the color attachment.

Why it matters

Any caller that checks Valid() before using a target, or compares Epoch() against the device's to detect a lost device, treats every depth-only target as invalid or as belonging to no device. A shadow-map pass can be skipped, or a lost depth-only target can go undetected after a device reset.

Repro
rt, _ := dev.CreateRenderTarget(nil, gpu.RenderTargetDesc{Width: 8, Height: 8, DepthFormat: gpu.FormatDepth32Float})
fmt.Println(rt.Valid(), rt.Epoch()) // false 0, want true and the device epoch
Proposal

Base Valid and Epoch on whichever attachments exist: a target is valid when it's open, has at least one of color or depth, and every attachment it has is valid. Epoch returns the color texture's epoch, falling back to the depth texture's.

Acceptance
  • The repro reports true and the device's epoch, and false/stale after the device is lost.
  • A test covers depth-only, color-only and color+depth targets.
Lingua principale
Go
Stelle
684
Fork
41
Merge medio
8h 8m
PR unite (30g)
911

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 nsgo-dev/nsgo

Tutte le issue di nsgo-dev/nsgo

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.