[Migrated] Declaring RuntimeArray without `Capability::RuntimeDescriptorArray` set on `SpirvBuilder` emits an unintuitive error message.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 3.4k
- Fork
- 126
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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,
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l’entry point dello shader segnalato, main_fs, con un RuntimeArray, mentre SpirvBuilder non dispone di Capability::RuntimeDescriptorArray, e verifica dove viene prodotto quel diagnostico. Il lavoro è completato quando la capability non supportata viene identificata con un’indicazione chiara per abilitare RuntimeDescriptorArray, mentre il contesto esistente del tipo non valido rimane disponibile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100