My MTLBuffer is created with the standard MTLResourceStorageModeShared option and I get the pointer to the system memory using the contents method. This works fine on Catalina and Big Sur but my testers on Sierra and High Sierra report that the application crashes. Evaluating the crash reports tell me that the contents method returns a Null pointer.
What am I missing?
What am I missing?
Code Block typedef struct KaroMetalLineData KaroMetalLineData; struct KaroMetalLineData{ packed_float2 p1; packed_float2 p2; packed_float4 color; float arg1; float arg2; float blend; int32_t type; }; ... size_t inputBufferSize = sizeof(KaroMetalLineData) * lineCount; /* is guaranteed to be not zero! */ id<MTLBuffer> lineInputBuffer = [metal->device newBufferWithLength:inputBufferSize options:(MTLResourceOptions)0]; KaroMetalLineData* localInput = [lineInputBuffer contents]; memcpy(localInput, someSource, inputBufferSize); /* someSource is guaranteed to exist and have enough space*/ ...