8000 metal: render-target color textures must use the view's pixel format by benface · Pull Request #639 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/graphics/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,14 @@ impl RenderingBackend for MetalContext {

if access == TextureAccess::RenderTarget {
if params.format != TextureFormat::Depth {
let pixel_format: MTLPixelFormat = params.format.into();
msg_send_![descriptor, setPixelFormat: pixel_format];
// Match the view's `colorPixelFormat` — pipelines
// bake it and reject mismatched attachments, and
// MTKView's presentable formats are all `BGRA*` /
// `RGBA16Float` so honoring `RGBA8` literally
// would break every offscreen color target.
let view_pixel_format: MTLPixelFormat =
msg_send![self.view, colorPixelFormat];
msg_send_![descriptor, setPixelFormat: view_pixel_format];
}
msg_send_![descriptor, setStorageMode: MTLStorageMode::Private];
msg_send_![
Expand Down
Loading
0