fa5b206d97
On MSL, the compiler refuses to allow access chains into a normal vector type. What happens in practice instead is a read-modify-write where a vector type is loaded, modified and written back. The workaround is to convert a vector into a pointer-to-scalar before the access chain continues to add the scalar index.
17 lines
239 B
Plaintext
17 lines
239 B
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBORow
|
|
{
|
|
float v;
|
|
float4x4 row_major0;
|
|
};
|
|
|
|
kernel void main0(device SSBORow& _4 [[buffer(0)]])
|
|
{
|
|
_4.v = ((device float*)&_4.row_major0[2u])[1];
|
|
}
|
|
|