-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add metal demo * Remove Vulkan import
- Loading branch information
Showing
5 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#if FRB_GRAPHICS_METAL | ||
|
||
import FirebladePAL | ||
import Metal | ||
|
||
Platform.initialize() | ||
print("Platform version: \(Platform.version)") | ||
|
||
func makeMTLSurface(in window: Window) throws -> MTLWindowSurface { | ||
let surface = try MTLWindowSurface(in: window, device: MTLCreateSystemDefaultDevice()) | ||
surface.mtlLayer?.backgroundColor = .init(red: 1.0, green: 0.0, blue: 1.0, alpha: 1.0) | ||
return surface | ||
} | ||
|
||
let props = WindowProperties(title: "Metal Window", frame: .init(0, 0, 800, 600)) | ||
|
||
let window = try Window(properties: props, | ||
surface: makeMTLSurface) | ||
|
||
var event = Event() | ||
var quit = false | ||
|
||
while !quit { | ||
Events.pumpEvents() | ||
|
||
while Events.pollEvent(&event) { | ||
switch event.variant { | ||
case .userQuit: | ||
quit = true | ||
|
||
default: | ||
break | ||
} | ||
} | ||
} | ||
|
||
Platform.quit() | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters