Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Supporting Image Operands in spirv-std

Offen
#137 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Rust
Sterne
3.4k
Forks
126
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/364
Old labels: t: enhancement,c: spirv-std,a: image
Originally creatd by XAMPPRocky on 2021-01-05T12:34:20Z


A lot of image operations (mainly those around sampling, or getting/setting texels from images) support additional optional operands. At the SPIR-V level this comes in the form of an operand at the end of each instruction which is a 8 bit integer that acts as a bit mask for indicating the how many operands follow and what they are used for. Additionally certain operands can only be used with certain image parameters, (such as the Bias operand only being available for single sampled 1D, 2D, 3D, and Cube image.)

The question becomes how to best support using these operands at the Rust level and validate these constraints.

Possibilities
  • Have a different function for each operand.
    • Advantage Simplest to implement.
    • Drawback Requires dozens if not hundreds of functions to cover every possible combination for each instruction, leading to a lot of repetition.
  • Use const generics on the functions for each instruction.
    • Advantage Potential to avoid a lot of repetition
    • Drawback Unclear how generic it could be at this point.

One example of where it's unclear with constant generics is the Grad operand. Which allows you to pass 2 vectors or scalars of the same size as the Dim, so right now I'm unsure how we'd allow that to generically while also validating the length.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Lesen der verlinkten Spezifikation zu SPIR-V Image Operands und der Überprüfung der vorhandenen spirv-std-APIs für Bildoperationen. Ermittle, wie optionale Operanden und Einschränkungen auf Rust-Ebene dargestellt werden sollten, einschließlich der Vektor- oder Skalarlängen des Grad-Operands. Als abgeschlossen gilt die Festlegung eines API- und Validierungsdesigns für die unterstützten Bildoperanden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.