progrium / darwinkit

Native Mac APIs for Go. Previously known as MacDriver
MIT License
4.42k stars 147 forks source link

possible issue with protocol-based types #211

Closed tmc closed 10 months ago

tmc commented 10 months ago

Given a sample test (in macos/mps/metal_test.go):

func TestMPSMatrixMultiplication(t *testing.T) {
    d := metal.CreateSystemDefaultDevice()
    cq := d.NewCommandQueue()
    cb := cq.CommandBuffer()

    mm := NewMatrixMultiplication()
    mm.EncodeToCommandBufferLeftMatrixRightMatrixResultMatrix(cb, NewMatrix(), NewMatrix(), NewMatrix())
}

This fails to typecheck with:

./mps_test.go:22:60: cannot use cb (variable of type metal.CommandBufferWrapper) as metal.PCommandBuffer value in argument to mm.EncodeToCommandBufferLeftMatrixRightMatrixResultMatrix: metal.CommandBufferWrapper does not implement metal.PCommandBuffer (wrong type for method AccelerationStructureCommandEncoder)
        have AccelerationStructureCommandEncoder() metal.AccelerationStructureCommandEncoderWrapper
        want AccelerationStructureCommandEncoder() metal.PAccelerationStructureCommandEncoder
FAIL    github.com/progrium/macdriver/macos/mps [build failed]