Fix various issues in WebGPU backend

This commit is contained in:
Wojtek Figat
2026-03-16 16:39:18 +01:00
parent a5bbf0dbde
commit 427f4647fc
9 changed files with 53 additions and 5 deletions

View File

@@ -20,6 +20,16 @@ GPUConstantBufferWebGPU::GPUConstantBufferWebGPU(GPUDeviceWebGPU* device, uint32
GPUShaderProgram* GPUShaderWebGPU::CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, Span<byte> bytecode, MemoryReadStream& stream)
{
// Fix issue with unaligned loads if bytecode
// TODO: fix issue at cook time by adding padding before shader bytecode to ensure it's aligned (eg. to 8 bytes)
BytesContainer bytecoddAligned;
uintptr align = (uintptr)bytecode.Get() % sizeof(uintptr);
if (align != 0)
{
bytecoddAligned.Copy(bytecode);
bytecode = bytecoddAligned;
}
// Extract the SPIR-V shader header from the cache
SpirvShaderHeader* header = (SpirvShaderHeader*)bytecode.Get();
bytecode = bytecode.Slice(sizeof(SpirvShaderHeader));