Fix Dx11/12 on Windows

This commit is contained in:
Joshua Yanovski 2022-08-30 21:29:57 -07:00
parent 83ca01e42d
commit 642a8df2db
5 changed files with 22 additions and 39 deletions

6
Cargo.lock generated
View File

@ -5493,8 +5493,7 @@ dependencies = [
[[package]]
name = "shaderc"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e6fe602a861622769530a23bc40bfba31adbf186d0c8412e83f5519c5d6bee"
source = "git+https://github.com/pythonesque/shaderc-rs?rev=f2605a02062834019bedff911aee2fd2998c49f9#f2605a02062834019bedff911aee2fd2998c49f9"
dependencies = [
"libc",
"shaderc-sys",
@ -5503,8 +5502,7 @@ dependencies = [
[[package]]
name = "shaderc-sys"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3794498651f8173d0afbc0bb8aca45ced111098227e755dde4c0ef2888c8d0bf"
source = "git+https://github.com/pythonesque/shaderc-rs?rev=f2605a02062834019bedff911aee2fd2998c49f9#f2605a02062834019bedff911aee2fd2998c49f9"
dependencies = [
"cmake",
"libc",

View File

@ -22,7 +22,7 @@ use std::{
sync::{Arc, Mutex},
time::Instant,
};
use tracing::{error, warn/* , Instrument */};
use tracing::{error, warn, Instrument};
pub type ThreadPool = ThreadPool_<StaticParker<LargeThreadData>>;
@ -275,7 +275,7 @@ impl InternalSlowJobPool {
where
F: /*FnOnce()*/Future<Output=()> + Send + 'static,
{
// let f = f.instrument(tracing::info_span!("{}", name));
let f = f.instrument(tracing::info_span!("slowjob", name));
let queue: Pin<Strong<Queue>> = Strong::pin(Task::new(f));
let mut deque = self.queue
.entry(name.to_owned())
@ -527,39 +527,22 @@ impl SlowJobPool {
// difference is minor and it makes it easier to assign metrics to canceled tasks
// (though maybe we don't want to do that?).
let execution_start = Instant::now();
{
// Run the task in its own scope so perf works correctly.
common_base::prof_span_alloc!(_guard, &name);
struct Job(Pin<Strong<Queue>>);
impl Future for Job {
type Output = ();
struct Job(Pin<Strong<Queue>>);
impl Future for Job {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Self::Output> {
if let Some(mut task) = Strong::try_pin_borrow_mut(&mut self.get_mut().0)
.ok()
.filter(|task| !task.is_canceled.load(Ordering::Relaxed)) {
// The task was not canceled.
task.as_mut()/* .instrument({
common_base::prof_span!(span, &name);
span
}) */.poll(cx)
} else {
task::Poll::Ready(())
}
}
}
executor::run_locally(/*async move {
if let Some(mut task) = Strong::try_pin_borrow_mut(&mut task)
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Self::Output> {
if let Some(mut task) = Strong::try_pin_borrow_mut(&mut self.get_mut().0)
.ok()
.filter(|task| !task.is_canceled.load(Ordering::Relaxed)) {
// The task was not canceled.
task.as_mut()/* .instrument({
common_base::prof_span!(span, &name);
span
}) */.await;
task.as_mut().poll(cx)
} else {
task::Poll::Ready(())
}
}*/Job(task)).detach();
}
}
executor::run_locally(Job(task)).detach();
let execution_end = Instant::now();
let metrics = JobMetrics {
queue_created,

View File

@ -60,7 +60,7 @@ wgpu = { version = "=0.8.0", features = ["trace", "cross"] }
# wgpu-profiler = { path = "../../wgpu-profiler" }
wgpu-profiler = { git = "https://github.com/pythonesque/wgpu-profiler", rev = "b6b16da077a1aca2fe3a2ceaa3bdcc1bdeb11d74" }
bytemuck = { version="1.4", features=["derive"] }
shaderc = "0.8.0"
shaderc = { git = "https://github.com/pythonesque/shaderc-rs", rev = "f2605a02062834019bedff911aee2fd2998c49f9" }
# cmake crate used by shaderc, newer version 0.1.46 uses a new cmake command that is not available in our CI cmake version
# see https://github.com/alexcrichton/cmake-rs/issues/131
cmake = "=0.1.45"

View File

@ -329,6 +329,7 @@ fn calc_light<'a,
type V = TerrainChunk;
#[tracing::instrument(skip_all, name = "<&VolGrid2d as Meshable<_, _>>::generate_mesh")]
#[allow(clippy::type_complexity)]
#[inline(always)]
pub async fn generate_mesh<'a/*, V: RectRasterableVol<Vox = Block> + ReadVol + Debug + 'static*/, F: Future<Output=Option<Model<[u8; 4]>>> + 'a>(
@ -346,11 +347,11 @@ pub async fn generate_mesh<'a/*, V: RectRasterableVol<Vox = Block> + ReadVol + D
Arc<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
),
> {
span!(
/* span!(
_guard,
"generate_mesh",
"<&VolGrid2d as Meshable<_, _>>::generate_mesh"
);
); */
let mut opaque_limits = None::<Limits>;
let mut fluid_limits = None::<Limits>;
@ -1016,8 +1017,8 @@ pub async fn generate_mesh<'a/*, V: RectRasterableVol<Vox = Block> + ReadVol + D
(
bounds,
(col_lights, col_lights_size),
Arc::new(light),
Arc::new(glow),
Arc::new(light) as Arc<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
Arc::new(glow) as Arc<dyn Fn(Vec3<i32>) -> f32 + Send + Sync>,
),
)
}

View File

@ -248,6 +248,7 @@ type V = TerrainChunk;
/// skip_remesh is either None (do the full remesh, including recomputing the
/// light map), or Some((light_map, glow_map)).
#[tracing::instrument(skip_all)]
async fn mesh_worker/*<V: BaseVol<Vox = Block> + RectRasterableVol + ReadVol + Debug + 'static>*/<'b>(
pos: Vec2<i32>,
z_bounds: (f32, f32),
@ -266,7 +267,7 @@ async fn mesh_worker/*<V: BaseVol<Vox = Block> + RectRasterableVol + ReadVol + D
/* create_locals: impl Fn() -> pipelines::terrain::BoundLocals, */
create_texture: impl for<'a> Fn(/* wgpu::TextureDescriptor<'a>, wgpu::TextureViewDescriptor<'a>, wgpu::SamplerDescriptor<'a>*//*&'a Mesh<[u8; 4]>*/usize) -> /*Texture + Send + Sync*/Option<Model<[u8; 4]>> + Send,
) -> MeshWorkerResponse {
span!(_guard, "mesh_worker");
// span!(_guard, "mesh_worker");
let (blocks_of_interest, sprite_kinds) = BlocksOfInterest::from_chunk(&chunk)/*default()*/;
let mut range = range;