dmitri.shuralyov.com/gpu/mtl/...

add minimal API to support interactive rendering in a window dmitri.shuralyov.com/gpu/mtl#1

Mergeddmitshur opened this change 5 years ago
Patch Set 4: move internal/{ca,ns} into example/movingtriangle

Also make minor tweaks to the documentation to make it more accurate.
dmitshur committed 5 years ago commit fd0055c9d2e6a8f68292877d85c2cb2405d031b3
Collapse all
Commit Message
FileFile
@@ -1,10 +1,10 @@
11
Parent:     7a718d8 (Add PixelFormatBGRA8UNormSRGB, SetVertexBytes.)
22
Author:     Dmitri Shuralyov <dmitri@shuralyov.com>
33
AuthorDate: Sat Jun 23 01:07:53 2018 -0400
44
Commit:     Dmitri Shuralyov <dmitri@shuralyov.com>
5
CommitDate: Sun Oct 21 13:22:10 2018 -0400
5
CommitDate: Sun Oct 21 23:20:25 2018 -0400
66

77
Add minimal API to support interactive rendering in a window.
88

99
The goal of this change is to make it possible to use package mtl
1010
to render to a window at interactive framerates (e.g., at 60 FPS,
internal/ca/ca.go → example/movingtriangle/internal/ca/ca.go
FileFile
@@ -2,11 +2,11 @@
22

33
// Package ca provides access to Apple's Core Animation API (https://developer.apple.com/documentation/quartzcore).
44
//
55
// This package is in very early stages of development.
66
// It's a minimal implementation with scope limited to
7
// supporting the ../../example/movingtriangle command.
7
// supporting the movingtriangle example.
88
package ca
99

1010
import (
1111
	"errors"
1212
	"unsafe"
internal/ca/ca.h → example/movingtriangle/internal/ca/ca.h
No modification.
internal/ca/ca.m → example/movingtriangle/internal/ca/ca.m
No modification.
internal/ns/ns.go → example/movingtriangle/internal/ns/ns.go
FileFile
@@ -1,18 +1,18 @@
11
// +build darwin
22

3
// Package ns provides access to Apple's Cocoa API (https://developer.apple.com/documentation/appkit).
3
// Package ns provides access to Apple's AppKit API (https://developer.apple.com/documentation/appkit).
44
//
55
// This package is in very early stages of development.
66
// It's a minimal implementation with scope limited to
7
// supporting the ../../example/movingtriangle command.
7
// supporting the movingtriangle example.
88
package ns
99

1010
import (
1111
	"unsafe"
1212

13
	"dmitri.shuralyov.com/gpu/mtl/internal/ca"
13
	"dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/ca"
1414
)
1515

1616
/*
1717
#include "ns.h"
1818
*/
internal/ns/ns.h → example/movingtriangle/internal/ns/ns.h
No modification.
internal/ns/ns.m → example/movingtriangle/internal/ns/ns.m
No modification.
example/movingtriangle/main.go
FileFile
@@ -1,8 +1,9 @@
11
// +build darwin
22

33
// movingtriangle is an example Metal program that displays a moving triangle in a window.
4
// It opens a window and renders a triangle that follows the mouse cursor.
45
package main
56

67
import (
78
	"flag"
89
	"fmt"
@@ -11,12 +12,12 @@ import (
1112
	"runtime"
1213
	"time"
1314
	"unsafe"
1415

1516
	"dmitri.shuralyov.com/gpu/mtl"
16
	"dmitri.shuralyov.com/gpu/mtl/internal/ca"
17
	"dmitri.shuralyov.com/gpu/mtl/internal/ns"
17
	"dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/ca"
18
	"dmitri.shuralyov.com/gpu/mtl/example/movingtriangle/internal/ns"
1819
	"github.com/go-gl/glfw/v3.2/glfw"
1920
	"golang.org/x/image/math/f32"
2021
)
2122

2223
func init() {