Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Declaring RuntimeArray without `Capability::RuntimeDescriptorArray` set on `SpirvBuilder` emits an unintuitive error message.

Offen
#108 0 Kommentare 1 Reaktion 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/879
Old labels: t: enhancement
Originally creatd by SiebenCorgie on 2022-06-07T13:28:24Z


When trying to compile a shader with a runtime array descriptor without having Capability::RuntimeDescriptorArray enabled on SpirvBuilder emits an unintuitive error.

For instance the following main function:

#[spirv(fragment)]
pub fn main_fs(
   ...,
   #[spirv(push_constant)] push: &PushConst,
    #[spirv(descriptor_set = 0, binding = 0)] sampled_images: &RuntimeArray<SampledImage<Image!(2D, type=f32, sampled)>>,
    ...
) {
    //...
    let img = unsafe { sampled_images.index(push.texture_indices[0] as usize) };
    //...    
}

emits this error:

error: OpVariable, <id> '19[%sampled_images]', is attempting to create memory for an illegal type, OpTypeRuntimeArray.
       For Vulkan OpTypeRuntimeArray can only appear as the final member of an OpTypeStruct, thus cannot be instantiated via OpVariable
         %sampled_images = OpVariable %_ptr_UniformConstant__runtimearr_40 UniformConstant

While the error is correct without the capability, the use of RuntimeArray probably indicates that RuntimeDescriptorArrays is assumed to be present.

A small hint like: "Do you need to enabled the RuntimeDescriptorArray capability?" would be appropriate,

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 damit, den gemeldeten Shader-Einstiegspunkt main_fs mit einem RuntimeArray zu reproduzieren, während SpirvBuilder Capability::RuntimeDescriptorArray nicht besitzt, und untersuche, wo diese Diagnose erzeugt wird. Als erledigt gilt die Aufgabe, wenn die nicht unterstützte Capability mit einem klaren Hinweis zum Aktivieren von RuntimeDescriptorArray identifiziert wird, während der vorhandene Kontext für ungültige Typen weiterhin verfügbar bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

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