mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Print errors in a more readable format in the player. (#4137)
Co-authored-by: Nicolas Silva <nical@fastnmail.com>
This commit is contained in:
parent
7fea9e934e
commit
90b022d437
@ -158,7 +158,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
let (cmd_buf, error) = self
|
||||
.command_encoder_finish::<A>(encoder, &wgt::CommandBufferDescriptor { label: None });
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
cmd_buf
|
||||
}
|
||||
@ -186,7 +186,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_buffer::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::FreeBuffer(id) => {
|
||||
@ -199,7 +199,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_texture::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::FreeTexture(id) => {
|
||||
@ -216,7 +216,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.texture_create_view::<A>(parent_id, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyTextureView(id) => {
|
||||
@ -226,7 +226,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_sampler::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroySampler(id) => {
|
||||
@ -242,7 +242,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
Action::CreateBindGroupLayout(id, desc) => {
|
||||
let (_, error) = self.device_create_bind_group_layout::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyBindGroupLayout(id) => {
|
||||
@ -252,7 +252,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_pipeline_layout::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyPipelineLayout(id) => {
|
||||
@ -262,7 +262,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_bind_group::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyBindGroup(id) => {
|
||||
@ -272,7 +272,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
log::info!("Creating shader from {}", data);
|
||||
let code = fs::read_to_string(dir.join(&data)).unwrap();
|
||||
let source = if data.ends_with(".wgsl") {
|
||||
wgc::pipeline::ShaderModuleSource::Wgsl(Cow::Owned(code))
|
||||
wgc::pipeline::ShaderModuleSource::Wgsl(Cow::Owned(code.clone()))
|
||||
} else if data.ends_with(".ron") {
|
||||
let module = ron::de::from_str(&code).unwrap();
|
||||
wgc::pipeline::ShaderModuleSource::Naga(module)
|
||||
@ -281,7 +281,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
};
|
||||
let (_, error) = self.device_create_shader_module::<A>(device, &desc, source, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
println!("shader compilation error:\n---{code}\n---\n{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyShaderModule(id) => {
|
||||
@ -303,7 +303,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
let (_, error) =
|
||||
self.device_create_compute_pipeline::<A>(device, &desc, id, implicit_ids);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyComputePipeline(id) => {
|
||||
@ -325,7 +325,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
let (_, error) =
|
||||
self.device_create_render_pipeline::<A>(device, &desc, id, implicit_ids);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyRenderPipeline(id) => {
|
||||
@ -340,7 +340,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
id,
|
||||
);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyRenderBundle(id) => {
|
||||
@ -350,7 +350,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
self.device_maintain_ids::<A>(device).unwrap();
|
||||
let (_, error) = self.device_create_query_set::<A>(device, &desc, id);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
}
|
||||
Action::DestroyQuerySet(id) => {
|
||||
@ -393,7 +393,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
comb_manager.alloc(device.backend()),
|
||||
);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
panic!("{e}");
|
||||
}
|
||||
let cmdbuf = self.encode_commands::<A>(encoder, commands);
|
||||
self.queue_submit::<A>(device, &[cmdbuf]).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user