Post

Replies

Boosts

Views

Activity

Fragment Function(visualizeScalar): missing buffer binding at index 0 for bufferData[0] after modifying buffer
So I have changed StaticData from &#9;&#9;struct StaticData &#9;&#9;{ &#9;&#9;&#9;&#9;var positions: FloatTuple &#9;&#9;&#9;&#9;var impulses: FloatTuple var impulseScalar: SIMD2<Float> &#9;&#9;&#9;&#9;var offsets: SIMD2<Float> &#9;&#9;&#9;&#9;var screenSize: SIMD2<Float> &#9;&#9;&#9;&#9;var inkRadius: simd_float1 &#9;&#9;} into this &#9;&#9;struct StaticData &#9;&#9;{ &#9;&#9;&#9;&#9;var positions: FloatTuple &#9;&#9;&#9;&#9;var impulses: FloatTuple &#9;&#9;&#9;&#9;var impulseScalar: SIMD2<Float> &#9;&#9;&#9;&#9;var offsets: SIMD2<Float> &#9;&#9; &#9;&#9;&#9;&#9;var screenSize: SIMD2<Float> &#9;&#9;&#9;&#9;var inkRadius: simd_float1 &#9;&#9;&#9;&#9;var red: CFloat &#9;&#9;&#9;&#9;var green: CFloat &#9;&#9;&#9;&#9;var blue: CFloat &#9;&#9;} The problem is that when I use red/green/blue in visualiseScalar it shows the error Fragment Function(visualizeScalar): missing buffer binding at index 0 for bufferData[0] after modifying buffer I sincerely stuck at this. Follows code of bufferData and visualiseScalar, could be helpful probablyfragment half4 visualizeScalar(VertexOut fragmentIn [[stage_in]], texture2d<float, access::sample> tex2d [[texture(0)]], constant BufferData &bufferData [[buffer(0)]]) { &#9;&#9;constexpr sampler sampler2d(filter::nearest); half4 color = half4(tex2d.sample(sampler2d, fragmentIn.textureCoorinates)); return half4(half3(bufferData.red, bufferData.green, bufferData.blue) * abs(color.xxx), 1.0); } That's makeBuffer line (staticData = StaticData) let buffer = MetalDevice.sharedInstance.device.makeBuffer(bytes: &staticData, length: bufferSize, options: .storageModeShared)! uniformsBuffers.append(buffer)
2
0
1.6k
Jan ’21