Hello, I'm following
https://eliemichel.github.io/LearnWebGPU/ and now going back to convert shaders to hlsl instead of wgsl. I'm using dxc to compile the shaders to spir-v and when using the wgpu backend this works just fine to load the shaders:
std::vector<uint32_t> vertex = ReadSPIRV("../vert.spv");
std::vector<uint32_t> fragment = ReadSPIRV("../frag.spv");
WGPUShaderModuleSPIRVDescriptor vsDesc = {};
WGPUShaderModuleSPIRVDescriptor fsDesc = {};
vsDesc.code = vertex.data();
vsDesc.codeSize = vertex.size();
vsDesc.chain.sType = WGPUSType_ShaderModuleSPIRVDescriptor;
fsDesc.code = fragment.data();
fsDesc.codeSize = fragment.size();
fsDesc.chain.sType = WGPUSType_ShaderModuleSPIRVDescriptor;
vsModuleDesc.nextInChain = (WGPUChainedStruct*)&vsDesc;
fsModuleDesc.nextInChain = (WGPUChainedStruct*)&fsDesc;
ShaderModule vsModule = device.createShaderModule(vsModuleDesc);
ShaderModule fsModule = device.createShaderModule(fsModuleDesc);
but when the backend is Dawn, I'm getting the following error:
Uncaptured device error: type 2 (Expected chain root to match one of the following branch types with optional extensions:
- [ SType::ShaderModuleWGSLDescriptor -> (SType::ShaderModuleCompilationOptions) ]
Instead found: ( SType::ShaderModuleSPIRVDescriptor, )
- While validating [ShaderModuleDescriptor]
- While calling [Device "My Device"].CreateShaderModule([ShaderModuleDescriptor]).
)
I suspect there is flag I'm not setting since I've seen other repos where basically identical code has worked. Can someone please provide me with some guidance on how to load spir-v with Dawn?
Thanks,
Matt