Attempt to fix layer for mesa (intel)

This commit is contained in:
hodasemi 2023-04-15 07:54:01 +02:00
parent b971e0d2a6
commit a5a3702153
3 changed files with 44 additions and 28 deletions

View file

@ -94,7 +94,6 @@ impl Pedals {
let descriptor_pool = DescriptorPool::builder() let descriptor_pool = DescriptorPool::builder()
.set_layout(pipeline.descriptor_layout().clone()) .set_layout(pipeline.descriptor_layout().clone())
.set_descriptor_set_count(2)
.build(device.clone())?; .build(device.clone())?;
let brake_color_buffer = Buffer::builder() let brake_color_buffer = Buffer::builder()
@ -116,7 +115,16 @@ impl Pedals {
write_log!("allocate throttle descriptor"); write_log!("allocate throttle descriptor");
let throttle_descriptor = descriptor_pool.prepare_set().allocate()?; let throttle_descriptor = match descriptor_pool.prepare_set().allocate() {
Ok(d) => d,
Err(err) => {
write_log!(format!("desc alloc {:?}, {}", err, err.backtrace()));
return Err(err);
}
};
write_log!("update throttle descriptor");
throttle_descriptor.update(&[DescriptorWrite::uniform_buffers( throttle_descriptor.update(&[DescriptorWrite::uniform_buffers(
0, 0,
&[&throttle_color_buffer], &[&throttle_color_buffer],
@ -130,6 +138,8 @@ impl Pedals {
brake_samples.push_overwrite(0.0); brake_samples.push_overwrite(0.0);
} }
write_log!(format!("create vertex buffers ({icon_width})"));
let brake_vertex_buffer = Self::create_vertex_buffer(&device, icon_width as VkDeviceSize)?; let brake_vertex_buffer = Self::create_vertex_buffer(&device, icon_width as VkDeviceSize)?;
let throttle_vertex_buffer = let throttle_vertex_buffer =
Self::create_vertex_buffer(&device, icon_width as VkDeviceSize)?; Self::create_vertex_buffer(&device, icon_width as VkDeviceSize)?;
@ -160,6 +170,8 @@ impl Pedals {
throttle_vertex_buffer, throttle_vertex_buffer,
}; };
write_log!("update vertex buffers");
me.update_vertex_buffers()?; me.update_vertex_buffers()?;
Ok(me) Ok(me)
@ -207,12 +219,12 @@ impl Pedals {
let command_buffer = let command_buffer =
CommandBuffer::new_primary().build(self.device.clone(), self.queue.clone())?; CommandBuffer::new_primary().build(self.device.clone(), self.queue.clone())?;
if self.enable { {
let mut recorder = command_buffer.begin(VkCommandBufferBeginInfo::new( let mut recorder = command_buffer.begin(VkCommandBufferBeginInfo::new(
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
| VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT,
))?; ))?;
if self.enable {
self.render_target self.render_target
.begin(&mut recorder, VK_SUBPASS_CONTENTS_INLINE, 0); .begin(&mut recorder, VK_SUBPASS_CONTENTS_INLINE, 0);
@ -228,6 +240,7 @@ impl Pedals {
self.render_target.end(&mut recorder); self.render_target.end(&mut recorder);
} }
}
Ok(command_buffer) Ok(command_buffer)
} }

View file

@ -29,6 +29,7 @@ impl HistoryPipeline {
VK_SHADER_STAGE_FRAGMENT_BIT, VK_SHADER_STAGE_FRAGMENT_BIT,
0, 0,
) )
.change_descriptor_count(2)
.build(device.clone())?; .build(device.clone())?;
let pipeline_layout = PipelineLayout::builder() let pipeline_layout = PipelineLayout::builder()

View file

@ -222,12 +222,13 @@ impl Radar {
let command_buffer = let command_buffer =
CommandBuffer::new_primary().build(self.device.clone(), self.queue.clone())?; CommandBuffer::new_primary().build(self.device.clone(), self.queue.clone())?;
if self.enable { {
let mut recorder = command_buffer.begin(VkCommandBufferBeginInfo::new( let mut recorder = command_buffer.begin(VkCommandBufferBeginInfo::new(
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
| VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, | VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT,
))?; ))?;
if self.enable {
self.render_target.begin( self.render_target.begin(
&mut recorder, &mut recorder,
VK_SUBPASS_CONTENTS_INLINE, VK_SUBPASS_CONTENTS_INLINE,
@ -246,6 +247,7 @@ impl Radar {
self.render_target.end(&mut recorder); self.render_target.end(&mut recorder);
} }
}
Ok(command_buffer) Ok(command_buffer)
} }