Checkpoint: Get basic workspace rendering
This commit is contained in:
parent
c57e19c8fa
commit
d995192dde
3 changed files with 29 additions and 91 deletions
|
@ -1,37 +1,3 @@
|
||||||
// How can I fix this?
|
|
||||||
// -[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
|
|
||||||
// For depth attachment, the render pipeline's pixelFormat (MTLPixelFormatInvalid) does not match the framebuffer's pixelFormat (MTLPixelFormatDepth32Float).
|
|
||||||
// '
|
|
||||||
// -[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
|
|
||||||
// For depth attachment, the render pipeline's pixelFormat (MTLPixelFormatInvalid) does not match the framebuffer's pixelFormat (MTLPixelFormatDepth32Float).
|
|
||||||
// // It seems like the error you're facing has to do with the difference between the
|
|
||||||
// pixel format of the render pipeline and the framebuffer. If the pixel format of
|
|
||||||
// those two doesn't match, Metal throws an error. To resolve this issue, you need
|
|
||||||
// to set the pixel format of your depth attachment and your render pipeline state
|
|
||||||
// to the same value.
|
|
||||||
|
|
||||||
// In this code:
|
|
||||||
// ---
|
|
||||||
/*
|
|
||||||
descriptor.set_depth_attachment_pixel_format(MTLPixelFormat::Depth32Float);
|
|
||||||
*/
|
|
||||||
// ---
|
|
||||||
// you've commented out the line where you set the depth attachment pixel format
|
|
||||||
// to MTLPixelFormat::Depth32Float. If you uncomment this line, it should resolve
|
|
||||||
// the error as your depth attachment's pixel format will then match your framebuffer's.
|
|
||||||
|
|
||||||
// If you still encounter the same problem, you might be configuring another render
|
|
||||||
// pipeline state elsewhere in your code with a different depth pixel format. Make
|
|
||||||
// sure all configurations have matching pixel formats.
|
|
||||||
|
|
||||||
// Additionally, be aware of the limitations of certain pixel formats. For example,
|
|
||||||
// not all pixel formats support depth stencil attachments, and some are only
|
|
||||||
// compatible with certain types of GPU hardware. Implementation of pixel formats
|
|
||||||
// can vary between different versions of iOS, so ensure that your choice of pixel
|
|
||||||
// format is compatible with your minimum target version.
|
|
||||||
//
|
|
||||||
// I want it to be UANorm
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
point, size, AtlasTextureId, DevicePixels, GlyphRasterParams, MetalAtlas, MonochromeSprite,
|
point, size, AtlasTextureId, DevicePixels, GlyphRasterParams, MetalAtlas, MonochromeSprite,
|
||||||
Quad, Scene, Size,
|
Quad, Scene, Size,
|
||||||
|
@ -182,19 +148,6 @@ impl MetalRenderer {
|
||||||
let command_buffer = command_queue.new_command_buffer();
|
let command_buffer = command_queue.new_command_buffer();
|
||||||
|
|
||||||
let render_pass_descriptor = metal::RenderPassDescriptor::new();
|
let render_pass_descriptor = metal::RenderPassDescriptor::new();
|
||||||
|
|
||||||
// let depth_texture_desc = metal::TextureDescriptor::new();
|
|
||||||
// depth_texture_desc.set_pixel_format(metal::MTLPixelFormat::Depth32Float);
|
|
||||||
// depth_texture_desc.set_storage_mode(metal::MTLStorageMode::Private);
|
|
||||||
// depth_texture_desc.set_usage(metal::MTLTextureUsage::RenderTarget);
|
|
||||||
// depth_texture_desc.set_width(i32::from(viewport_size.width) as u64);
|
|
||||||
// depth_texture_desc.set_height(i32::from(viewport_size.height) as u64);
|
|
||||||
// let depth_texture = self.device.new_texture(&depth_texture_desc);
|
|
||||||
// let depth_attachment = render_pass_descriptor.depth_attachment().unwrap();
|
|
||||||
// depth_attachment.set_texture(Some(&depth_texture));
|
|
||||||
// depth_attachment.set_clear_depth(1.);
|
|
||||||
// depth_attachment.set_store_action(metal::MTLStoreAction::Store);
|
|
||||||
|
|
||||||
let color_attachment = render_pass_descriptor
|
let color_attachment = render_pass_descriptor
|
||||||
.color_attachments()
|
.color_attachments()
|
||||||
.object_at(0)
|
.object_at(0)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![allow(dead_code, unused_variables)]
|
#![allow(dead_code, unused_variables)]
|
||||||
|
|
||||||
use gpui3::{Bounds, WindowBounds, WindowOptions};
|
use gpui3::{px, size, Bounds, WindowBounds, WindowOptions};
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use simplelog::SimpleLogger;
|
use simplelog::SimpleLogger;
|
||||||
|
|
||||||
|
@ -23,11 +23,8 @@ fn main() {
|
||||||
let window = cx.open_window(
|
let window = cx.open_window(
|
||||||
WindowOptions {
|
WindowOptions {
|
||||||
bounds: WindowBounds::Fixed(Bounds {
|
bounds: WindowBounds::Fixed(Bounds {
|
||||||
size: gpui3::Size {
|
origin: Default::default(),
|
||||||
width: 800_f32.into(),
|
size: size(px(800.), px(600.)),
|
||||||
height: 600_f32.into(),
|
|
||||||
},
|
|
||||||
..Default::default()
|
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
collab_panel::{collab_panel, CollabPanel},
|
collab_panel::{collab_panel, CollabPanel},
|
||||||
theme::theme,
|
theme::{theme, themed},
|
||||||
themes::rose_pine_dawn,
|
themes::rose_pine_dawn,
|
||||||
};
|
};
|
||||||
use gpui3::{
|
use gpui3::{
|
||||||
|
@ -27,43 +27,31 @@ impl Workspace {
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
|
||||||
let theme = rose_pine_dawn();
|
let theme = rose_pine_dawn();
|
||||||
div()
|
themed(rose_pine_dawn(), cx, |cx| {
|
||||||
.size_full()
|
div()
|
||||||
.font("Helvetica")
|
.size_full()
|
||||||
.text_base()
|
.flex()
|
||||||
.fill(white())
|
.flex_col()
|
||||||
.text_color(black())
|
.font("Zed Sans Extended")
|
||||||
.child("The quick brown fox ran over the lazy dog.")
|
.gap_0()
|
||||||
|
.justify_start()
|
||||||
// TODO: Implement style.
|
.items_start()
|
||||||
//.size_full().fill(gpui3::hsla(0.83, 1., 0.5, 1.))
|
.text_color(theme.lowest.base.default.foreground)
|
||||||
|
.fill(theme.middle.base.default.background)
|
||||||
// themed(rose_pine_dawn(), cx, |cx| {
|
.child(titlebar(cx))
|
||||||
// div()
|
.child(
|
||||||
// .size_full()
|
div()
|
||||||
// .flex()
|
.flex_1()
|
||||||
// .flex_col()
|
.w_full()
|
||||||
// .font("Zed Sans Extended")
|
.flex()
|
||||||
// .gap_0()
|
.flex_row()
|
||||||
// .justify_start()
|
.overflow_hidden()
|
||||||
// .items_start()
|
.child(self.left_panel.clone())
|
||||||
// .text_color(theme.lowest.base.default.foreground)
|
.child(div().h_full().flex_1())
|
||||||
// // .fill(theme.middle.base.default.background)
|
.child(self.right_panel.clone()),
|
||||||
// .fill(gpui3::hsla(0.83, 1., 0.5, 1.))
|
)
|
||||||
// .child(titlebar(cx))
|
.child(statusbar::statusbar(cx))
|
||||||
// .child(
|
})
|
||||||
// div()
|
|
||||||
// .flex_1()
|
|
||||||
// .w_full()
|
|
||||||
// .flex()
|
|
||||||
// .flex_row()
|
|
||||||
// .overflow_hidden()
|
|
||||||
// .child(self.left_panel.clone())
|
|
||||||
// .child(div().h_full().flex_1())
|
|
||||||
// .child(self.right_panel.clone()),
|
|
||||||
// )
|
|
||||||
// .child(statusbar::statusbar(cx))
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue