@@ -130,7 +130,9 @@ bool InitListHandler::tryToSplitStruct() {
130130 const QualType initType = init->getAstResultType ();
131131 if (!initType->isStructureType () ||
132132 // Sampler types will pass the above check but we cannot split it.
133- isSampler (initType))
133+ isSampler (initType) ||
134+ // Can not split structuredOrByteBuffer
135+ isAKindOfStructuredOrByteBuffer (initType))
134136 return false ;
135137
136138 // We are certain the current intializer will be replaced by now.
@@ -214,12 +216,11 @@ SpirvInstruction *InitListHandler::createInitForType(QualType type,
214216 // Samplers, (RW)Buffers, (RW)Textures
215217 // It is important that this happens before checking of structure types.
216218 if (isOpaqueType (type))
217- return createInitForSamplerImageType (type, srcLoc);
219+ return createInitForBufferOrImageType (type, srcLoc);
218220
219221 // This should happen before the check for normal struct types
220222 if (isAKindOfStructuredOrByteBuffer (type)) {
221- emitError (" cannot handle structured/byte buffer as initializer" , srcLoc);
222- return nullptr ;
223+ return createInitForBufferOrImageType (type, srcLoc);
223224 }
224225
225226 if (type->isStructureType ())
@@ -427,9 +428,9 @@ InitListHandler::createInitForConstantArrayType(QualType type,
427428}
428429
429430SpirvInstruction *
430- InitListHandler::createInitForSamplerImageType (QualType type,
431- SourceLocation srcLoc) {
432- assert (isOpaqueType (type));
431+ InitListHandler::createInitForBufferOrImageType (QualType type,
432+ SourceLocation srcLoc) {
433+ assert (isOpaqueType (type) || isAKindOfStructuredOrByteBuffer (type) );
433434
434435 // Samplers, (RW)Buffers, and (RW)Textures are translated into OpTypeSampler
435436 // and OpTypeImage. They should be treated similar as builtin types.
0 commit comments