Skip to content

Instantly share code, notes, and snippets.

@cheako
Created October 14, 2023 01:07
Show Gist options
  • Save cheako/48c7f2d90423eb32f8b2559cfc62bd75 to your computer and use it in GitHub Desktop.
Save cheako/48c7f2d90423eb32f8b2559cfc62bd75 to your computer and use it in GitHub Desktop.
Starfield on i915 a770, oct 13 best setup to date
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 8
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9ec000c80,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 4
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 9
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9c0001290,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 7
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9cc001760,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9ec001290,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9d8001290,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 4
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 9
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9d8001860,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9cc001d30,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 9
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:126] unsafe {
dbg!(thread :: current().id().as_u64());
super::DEVICE.read().unwrap().get(&device).unwrap().device.create_compute_pipelines(pipeline_cache,
create_infos, { dbg!(); p_allocator.as_ref() })
} = Ok(
[
0x7fd9cc002510,
],
)
[src/handlers/pipelines.rs:148] successful = true
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 10
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 11
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 12
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 13
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 14
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 15
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 16
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 17
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 9
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 4
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 3
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 7
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 6
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 5
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 8
[src/handlers/pipelines.rs:135]
[src/handlers/pipelines.rs:127] thread::current().id().as_u64() = 2
[src/handlers/pipelines.rs:135]
// Copyright (C) 2023 Michael Mestnik <cheako@mikemestnik.net>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use std::sync::atomic::Ordering;
use std::{panic::catch_unwind, sync::atomic::AtomicUsize};
use std::{slice, thread};
use ash::vk::{
self, AllocationCallbacks, ComputePipelineCreateInfo, Device, GraphicsPipelineCreateInfo,
Pipeline, PipelineCache, PipelineShaderStageCreateFlags, ShaderModule, ShaderStageFlags,
};
static CTR: AtomicUsize = AtomicUsize::new(0);
struct MyDumber {
ctr: usize,
successful: bool,
my_data: (
Box<[u32]>,
ShaderModule,
ShaderStageFlags,
PipelineShaderStageCreateFlags,
),
}
impl std::fmt::Debug for MyDumber {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("MyDumber")
.field("ctr", &self.ctr)
.field("successful", &self.successful)
.field("my_data", &self.my_data.1)
.finish()
}
}
pub(crate) unsafe extern "system" fn create_graphics_pipelines(
device: Device,
pipeline_cache: PipelineCache,
create_info_count: u32,
p_create_infos: *const GraphicsPipelineCreateInfo,
p_allocator: *const AllocationCallbacks,
p_pipelines: *mut Pipeline,
) -> vk::Result {
let result = catch_unwind(|| {
let create_infos = unsafe { slice::from_raw_parts(p_create_infos, create_info_count as _) };
let ret = match unsafe {
super::DEVICE
.read()
.unwrap()
.get(&device)
.unwrap()
.device
.create_graphics_pipelines(pipeline_cache, create_infos, p_allocator.as_ref())
} {
Err((_, x)) => x,
Ok(x) => {
for (i, pipeline) in x.into_iter().enumerate() {
unsafe { *p_pipelines.add(i) = pipeline }
}
vk::Result::SUCCESS
}
};
let ctr = CTR.fetch_add(1, Ordering::SeqCst);
let successful = ret == vk::Result::SUCCESS;
create_infos
.iter()
.flat_map(|create_info| {
if !create_info.p_next.is_null() {
dbg!("GraphicsPipelineCreateInfo has next".len());
}
let stages = unsafe {
slice::from_raw_parts(create_info.p_stages, create_info.stage_count as _)
};
stages
.iter()
.filter_map(|stage_create_info| {
super::shader_module::get_spirv(&stage_create_info.module).map(|spirv| {
(
spirv,
stage_create_info.module,
stage_create_info.stage,
stage_create_info.flags,
)
})
})
.take_while(|_| create_info.p_next.is_null())
})
.for_each(|my_data| {
dbg!(MyDumber {
ctr,
successful,
my_data,
});
});
Ok(ret)
});
match result.unwrap() {
Ok(x) => x,
Err(x) => x,
}
}
pub(crate) unsafe extern "system" fn create_compute_pipelines(
device: Device,
pipeline_cache: PipelineCache,
create_info_count: u32,
p_create_infos: *const ComputePipelineCreateInfo,
p_allocator: *const AllocationCallbacks,
p_pipelines: *mut Pipeline,
) -> vk::Result {
let result = catch_unwind(|| {
let create_infos = unsafe { slice::from_raw_parts(p_create_infos, create_info_count as _) };
let ret = match dbg!(unsafe {
dbg!(thread::current().id().as_u64());
super::DEVICE
.read()
.unwrap()
.get(&device)
.unwrap()
.device
.create_compute_pipelines(pipeline_cache, create_infos, {
dbg!();
p_allocator.as_ref()
})
}) {
Err((_, x)) => x,
Ok(x) => {
for (i, pipeline) in x.into_iter().enumerate() {
unsafe { *p_pipelines.add(i) = pipeline }
}
vk::Result::SUCCESS
}
};
let successful = ret == vk::Result::SUCCESS;
dbg!(successful);
let ctr = CTR.fetch_add(1, Ordering::SeqCst);
create_infos
.iter()
.flat_map(|create_info| {
if !create_info.p_next.is_null() {
dbg!("ComputePipelineCreateInfo has next".len());
}
Some(create_info.stage)
.iter()
.filter_map(|stage_create_info| {
super::shader_module::get_spirv(&stage_create_info.module).map(|spirv| {
(
spirv,
stage_create_info.module,
stage_create_info.stage,
stage_create_info.flags,
)
})
})
.take_while(|_| create_info.p_next.is_null())
.next()
})
.for_each(|my_data| {
dbg!(MyDumber {
ctr,
successful,
my_data,
});
});
Ok(ret)
});
match result.unwrap() {
Ok(x) => x,
Err(x) => x,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment