porting mat4