mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 05:51:03 +01:00
Move compilation_info into wgc
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
45dd6c7c9c
commit
31f1b0cd81
8 files changed
+240
-171
No files matched your search
@@ -481,8 +481,11 @@ impl GPUDevice {
|
||||
)),
|
||||
);
|
||||
|
||||
let compilation_info =
|
||||
GPUCompilationInfo::new(scope, err.iter(), &descriptor.code);
|
||||
let compilation_info = GPUCompilationInfo::new(
|
||||
scope,
|
||||
wgpu_shader_module.compilation_info(),
|
||||
&descriptor.code,
|
||||
);
|
||||
let compilation_info = make_cppgc_object(scope, compilation_info);
|
||||
let compilation_info = v8::Global::new(scope, compilation_info);
|
||||
self.error_handler.push_error(err);
|
||||
|
||||
+9
-15
@@ -8,7 +8,6 @@ use deno_core::v8;
|
||||
use deno_core::webidl::WebIdlInterfaceConverter;
|
||||
use deno_core::GarbageCollected;
|
||||
use deno_core::WebIDL;
|
||||
use wgpu_core::pipeline;
|
||||
|
||||
use crate::error::GPUGenericError;
|
||||
|
||||
@@ -123,16 +122,10 @@ impl GPUCompilationMessage {
|
||||
}
|
||||
|
||||
impl GPUCompilationMessage {
|
||||
fn new(error: &pipeline::CreateShaderModuleError, source: &str) -> Self {
|
||||
let message = error.to_string();
|
||||
fn new(error: &wgpu_types::CompilationMessage, source: &str) -> Self {
|
||||
let message = error.message.clone();
|
||||
|
||||
let loc = match error {
|
||||
pipeline::CreateShaderModuleError::Parsing(e) => e.inner.location(source),
|
||||
pipeline::CreateShaderModuleError::Validation(e) => {
|
||||
e.inner.location(source)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let loc = error.location.as_ref();
|
||||
|
||||
match loc {
|
||||
Some(loc) => {
|
||||
@@ -188,13 +181,14 @@ impl GPUCompilationInfo {
|
||||
impl GPUCompilationInfo {
|
||||
pub fn new<'args, 'scope>(
|
||||
scope: &mut v8::HandleScope<'scope>,
|
||||
messages: impl ExactSizeIterator<
|
||||
Item = &'args pipeline::CreateShaderModuleError,
|
||||
>,
|
||||
compilation_info: &wgpu_types::CompilationInfo,
|
||||
source: &'args str,
|
||||
) -> Self {
|
||||
let array = v8::Array::new(scope, messages.len().try_into().unwrap());
|
||||
for (i, message) in messages.enumerate() {
|
||||
let array = v8::Array::new(
|
||||
scope,
|
||||
compilation_info.messages.len().try_into().unwrap(),
|
||||
);
|
||||
for (i, message) in compilation_info.messages.iter().enumerate() {
|
||||
let message_object =
|
||||
make_cppgc_object(scope, GPUCompilationMessage::new(message, source));
|
||||
array.set_index(scope, i.try_into().unwrap(), message_object.into());
|
||||
|
||||
@@ -654,6 +654,15 @@ impl Global {
|
||||
(id, error)
|
||||
}
|
||||
|
||||
pub fn shader_module_compilation_info(
|
||||
&self,
|
||||
shader_module_id: id::ShaderModuleId,
|
||||
) -> wgt::CompilationInfo {
|
||||
let hub = self.hub.borrow();
|
||||
let shader_module = hub.shader_modules.get(shader_module_id);
|
||||
shader_module.compilation_info().clone()
|
||||
}
|
||||
|
||||
pub fn shader_module_remove(
|
||||
&self,
|
||||
shader_module_id: id::ShaderModuleId,
|
||||
|
||||
@@ -46,7 +46,7 @@ use crate::{
|
||||
},
|
||||
instance::{Adapter, RequestDeviceError},
|
||||
lock::{rank, Mutex, RwLock},
|
||||
pipeline::{self, ColorStateError},
|
||||
pipeline::{self, shader_module_error_into_compilation_info, ColorStateError},
|
||||
pool::ResourcePool,
|
||||
resource::{
|
||||
self, Buffer, BufferState, ExternalTexture, ExternalTextureState, Labeled, ParentDevice,
|
||||
@@ -2446,8 +2446,11 @@ impl Device {
|
||||
let (shader, error) = match self.create_shader_module_inner(desc, source) {
|
||||
Ok(shader) => (shader, None),
|
||||
Err(e) => {
|
||||
let shader =
|
||||
pipeline::ShaderModule::invalid(Arc::clone(self), desc.label.to_string());
|
||||
let shader = pipeline::ShaderModule::invalid(
|
||||
Arc::clone(self),
|
||||
desc.label.to_string(),
|
||||
shader_module_error_into_compilation_info(&e),
|
||||
);
|
||||
(shader, Some(e))
|
||||
}
|
||||
};
|
||||
@@ -2601,6 +2604,7 @@ impl Device {
|
||||
}),
|
||||
device: self.clone(),
|
||||
label: desc.label.to_string(),
|
||||
compilation_info: wgt::CompilationInfo::default(),
|
||||
};
|
||||
|
||||
let module = Arc::new(module);
|
||||
@@ -2624,8 +2628,11 @@ impl Device {
|
||||
let (shader, error) = match unsafe { self.create_shader_module_passthrough_inner(desc) } {
|
||||
Ok(shader) => (shader, None),
|
||||
Err(e) => {
|
||||
let shader =
|
||||
pipeline::ShaderModule::invalid(Arc::clone(self), desc.label.to_string());
|
||||
let shader = pipeline::ShaderModule::invalid(
|
||||
Arc::clone(self),
|
||||
desc.label.to_string(),
|
||||
shader_module_error_into_compilation_info(&e),
|
||||
);
|
||||
(shader, Some(e))
|
||||
}
|
||||
};
|
||||
@@ -2762,6 +2769,7 @@ impl Device {
|
||||
}),
|
||||
device: self.clone(),
|
||||
label: descriptor.label.to_string(),
|
||||
compilation_info: wgt::CompilationInfo::default(),
|
||||
};
|
||||
|
||||
Ok(Arc::new(module))
|
||||
|
||||
+119
-1
@@ -1,3 +1,4 @@
|
||||
use alloc::string::ToString as _;
|
||||
use alloc::{
|
||||
borrow::{Cow, ToOwned},
|
||||
boxed::Box,
|
||||
@@ -78,6 +79,7 @@ pub struct ShaderModule {
|
||||
pub(crate) device: Arc<Device>,
|
||||
/// The `label` from the descriptor used to create the resource.
|
||||
pub(crate) label: String,
|
||||
pub(crate) compilation_info: wgt::CompilationInfo,
|
||||
}
|
||||
|
||||
impl Drop for ShaderModule {
|
||||
@@ -116,14 +118,23 @@ impl ShaderModule {
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
pub(crate) fn invalid(device: Arc<Device>, label: String) -> Arc<Self> {
|
||||
pub(crate) fn invalid(
|
||||
device: Arc<Device>,
|
||||
label: String,
|
||||
compilation_info: wgt::CompilationInfo,
|
||||
) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
state: ResourceState::Invalid,
|
||||
device,
|
||||
label,
|
||||
compilation_info,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compilation_info(&self) -> &wgt::CompilationInfo {
|
||||
&self.compilation_info
|
||||
}
|
||||
|
||||
/// Select an entry point name, given an optional name and a shader stage.
|
||||
///
|
||||
/// This function takes care of turning the `Option<&str>`
|
||||
@@ -243,6 +254,113 @@ impl WebGpuError for CreateShaderModuleError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wgsl")]
|
||||
pub(crate) fn wgsl_to_compilation_info(
|
||||
value: &ShaderError<naga::front::wgsl::ParseError>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
wgt::CompilationInfo {
|
||||
messages: vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: value
|
||||
.inner
|
||||
.location(&value.source)
|
||||
.as_ref()
|
||||
.map(naga_to_source_location),
|
||||
}],
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "glsl")]
|
||||
pub(crate) fn glsl_to_compilation_info(
|
||||
value: &ShaderError<naga::front::glsl::ParseErrors>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::string::ToString;
|
||||
let messages = value
|
||||
.inner
|
||||
.errors
|
||||
.iter()
|
||||
.map(|err| wgt::CompilationMessage {
|
||||
message: err.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: err
|
||||
.location(&value.source)
|
||||
.as_ref()
|
||||
.map(naga_to_source_location),
|
||||
})
|
||||
.collect();
|
||||
wgt::CompilationInfo { messages }
|
||||
}
|
||||
|
||||
#[cfg(feature = "spirv")]
|
||||
pub(crate) fn spirv_to_compilation_info(
|
||||
value: &ShaderError<naga::front::spv::Error>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
wgt::CompilationInfo {
|
||||
messages: vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: None,
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn naga_to_compilation_info(
|
||||
value: &ShaderError<naga::WithSpan<naga::valid::ValidationError>>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
wgt::CompilationInfo {
|
||||
messages: vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: value
|
||||
.inner
|
||||
.location(&value.source)
|
||||
.as_ref()
|
||||
.map(naga_to_source_location),
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
fn naga_to_source_location(value: &naga::SourceLocation) -> wgt::SourceLocation {
|
||||
wgt::SourceLocation {
|
||||
length: value.length,
|
||||
offset: value.offset,
|
||||
line_number: value.line_number,
|
||||
line_position: value.line_position,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn shader_module_error_into_compilation_info(
|
||||
value: &CreateShaderModuleError,
|
||||
) -> wgt::CompilationInfo {
|
||||
match value {
|
||||
#[cfg(feature = "wgsl")]
|
||||
CreateShaderModuleError::Parsing(v) => wgsl_to_compilation_info(v),
|
||||
#[cfg(feature = "glsl")]
|
||||
CreateShaderModuleError::ParsingGlsl(v) => glsl_to_compilation_info(v),
|
||||
#[cfg(feature = "spirv")]
|
||||
CreateShaderModuleError::ParsingSpirV(v) => spirv_to_compilation_info(v),
|
||||
CreateShaderModuleError::Validation(v) => naga_to_compilation_info(v),
|
||||
// Device errors are reported through the error sink, and are not compilation errors.
|
||||
// Same goes for native shader module generation errors.
|
||||
CreateShaderModuleError::Device(_) | CreateShaderModuleError::Generation => {
|
||||
wgt::CompilationInfo {
|
||||
messages: Vec::new(),
|
||||
}
|
||||
}
|
||||
// Everything else is an error message without location information.
|
||||
_ => wgt::CompilationInfo {
|
||||
messages: alloc::vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: None,
|
||||
}],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a programmable pipeline stage.
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
|
||||
@@ -33,83 +33,6 @@ impl ShaderModule {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wgsl", wgpu_core))]
|
||||
pub(crate) fn wgsl_to_compilation_info(
|
||||
value: crate::naga::error::ShaderError<crate::naga::front::wgsl::ParseError>,
|
||||
) -> CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
CompilationInfo {
|
||||
messages: vec![CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: CompilationMessageType::Error,
|
||||
location: value
|
||||
.inner
|
||||
.location(&value.source)
|
||||
.map(naga_to_source_location),
|
||||
}],
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "glsl")]
|
||||
pub(crate) fn glsl_to_compilation_info(
|
||||
value: naga::error::ShaderError<naga::front::glsl::ParseErrors>,
|
||||
) -> CompilationInfo {
|
||||
use alloc::string::ToString;
|
||||
let messages = value
|
||||
.inner
|
||||
.errors
|
||||
.into_iter()
|
||||
.map(|err| CompilationMessage {
|
||||
message: err.to_string(),
|
||||
message_type: CompilationMessageType::Error,
|
||||
location: err.location(&value.source).map(naga_to_source_location),
|
||||
})
|
||||
.collect();
|
||||
CompilationInfo { messages }
|
||||
}
|
||||
|
||||
#[cfg(feature = "spirv")]
|
||||
pub(crate) fn spirv_to_compilation_info(
|
||||
value: naga::error::ShaderError<naga::front::spv::Error>,
|
||||
) -> CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
CompilationInfo {
|
||||
messages: vec![CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: CompilationMessageType::Error,
|
||||
location: None,
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(wgpu_core, naga))]
|
||||
pub(crate) fn naga_to_compilation_info(
|
||||
value: crate::naga::error::ShaderError<
|
||||
crate::naga::WithSpan<crate::naga::valid::ValidationError>,
|
||||
>,
|
||||
) -> CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
CompilationInfo {
|
||||
messages: vec![CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: CompilationMessageType::Error,
|
||||
location: value
|
||||
.inner
|
||||
.location(&value.source)
|
||||
.map(naga_to_source_location),
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(wgpu_core, naga))]
|
||||
fn naga_to_source_location(value: crate::naga::SourceLocation) -> SourceLocation {
|
||||
SourceLocation {
|
||||
length: value.length,
|
||||
offset: value.offset,
|
||||
line_number: value.line_number,
|
||||
line_position: value.line_position,
|
||||
}
|
||||
}
|
||||
|
||||
/// Source of a shader module.
|
||||
///
|
||||
/// The source will be parsed and validated.
|
||||
|
||||
@@ -1972,6 +1972,67 @@ impl WebDevice {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "glsl")]
|
||||
pub(crate) fn glsl_to_compilation_info(
|
||||
value: naga::error::ShaderError<naga::front::glsl::ParseErrors>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::string::ToString;
|
||||
let messages = value
|
||||
.inner
|
||||
.errors
|
||||
.into_iter()
|
||||
.map(|err| wgt::CompilationMessage {
|
||||
message: err.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: err.location(&value.source).map(naga_to_source_location),
|
||||
})
|
||||
.collect();
|
||||
wgt::CompilationInfo { messages }
|
||||
}
|
||||
|
||||
#[cfg(feature = "spirv")]
|
||||
pub(crate) fn spirv_to_compilation_info(
|
||||
value: naga::error::ShaderError<naga::front::spv::Error>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
wgt::CompilationInfo {
|
||||
messages: vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: None,
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(naga)]
|
||||
pub(crate) fn naga_to_compilation_info(
|
||||
value: crate::naga::error::ShaderError<
|
||||
crate::naga::WithSpan<crate::naga::valid::ValidationError>,
|
||||
>,
|
||||
) -> wgt::CompilationInfo {
|
||||
use alloc::{string::ToString, vec};
|
||||
wgt::CompilationInfo {
|
||||
messages: vec![wgt::CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: wgt::CompilationMessageType::Error,
|
||||
location: value
|
||||
.inner
|
||||
.location(&value.source)
|
||||
.map(naga_to_source_location),
|
||||
}],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(naga)]
|
||||
fn naga_to_source_location(value: crate::naga::SourceLocation) -> wgt::SourceLocation {
|
||||
wgt::SourceLocation {
|
||||
length: value.length,
|
||||
offset: value.offset,
|
||||
line_number: value.line_number,
|
||||
line_position: value.line_position,
|
||||
}
|
||||
}
|
||||
|
||||
impl dispatch::DeviceInterface for WebDevice {
|
||||
fn features(&self) -> crate::Features {
|
||||
map_wgt_features(self.inner.features())
|
||||
@@ -2004,7 +2065,7 @@ impl dispatch::DeviceInterface for WebDevice {
|
||||
spv_parser
|
||||
.parse()
|
||||
.map_err(|inner| {
|
||||
crate::spirv_to_compilation_info(naga::error::ShaderError {
|
||||
spirv_to_compilation_info(naga::error::ShaderError {
|
||||
source: String::new(),
|
||||
label: desc.label.map(|s| s.to_string()),
|
||||
inner: Box::new(inner),
|
||||
@@ -2041,7 +2102,7 @@ impl dispatch::DeviceInterface for WebDevice {
|
||||
parser
|
||||
.parse(&options, shader)
|
||||
.map_err(|inner| {
|
||||
crate::glsl_to_compilation_info(naga::error::ShaderError {
|
||||
glsl_to_compilation_info(naga::error::ShaderError {
|
||||
source: shader.to_string(),
|
||||
label: desc.label.map(|s| s.to_string()),
|
||||
inner: Box::new(inner),
|
||||
@@ -2094,7 +2155,7 @@ impl dispatch::DeviceInterface for WebDevice {
|
||||
let mut validator =
|
||||
valid::Validator::new(valid::ValidationFlags::all(), valid::Capabilities::all());
|
||||
let module_info = validator.validate(module).map_err(|err| {
|
||||
crate::naga_to_compilation_info(naga::error::ShaderError {
|
||||
naga_to_compilation_info(naga::error::ShaderError {
|
||||
source: source.to_string(),
|
||||
label: desc.label.map(|s| s.to_string()),
|
||||
inner: err,
|
||||
|
||||
@@ -2,9 +2,8 @@ use alloc::borrow::ToOwned;
|
||||
use alloc::{
|
||||
borrow::Cow::{self, Borrowed},
|
||||
boxed::Box,
|
||||
string::{String, ToString as _},
|
||||
string::String,
|
||||
sync::Arc,
|
||||
vec,
|
||||
vec::Vec,
|
||||
};
|
||||
use core::{
|
||||
@@ -21,15 +20,14 @@ use wgt::error::WebGpuError;
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use smallvec::SmallVec;
|
||||
use wgc::{pipeline::CreateShaderModuleError, resource::BlasPrepareCompactResult};
|
||||
use wgc::resource::BlasPrepareCompactResult;
|
||||
use wgt::WasmNotSendSync;
|
||||
|
||||
use crate::{
|
||||
api,
|
||||
dispatch::{self, BlasCompactCallback, BufferMappedRangeInterface},
|
||||
BindingResource, Blas, BufferBinding, BufferDescriptor, CompilationInfo, CompilationMessage,
|
||||
CompilationMessageType, Features, LoadOp, MapMode, Operations, ShaderSource,
|
||||
SurfaceTargetUnsafe, TextureDescriptor, Tlas, WriteOnly,
|
||||
BindingResource, Blas, BufferBinding, BufferDescriptor, Features, LoadOp, MapMode, Operations,
|
||||
ShaderSource, SurfaceTargetUnsafe, TextureDescriptor, Tlas, WriteOnly,
|
||||
};
|
||||
use crate::{dispatch::DispatchAdapter, util::Mutex};
|
||||
|
||||
@@ -281,7 +279,6 @@ impl CoreBuffer {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CoreShaderModule {
|
||||
pub(crate) wgpu_shader_module: Arc<wgc::pipeline::ShaderModule>,
|
||||
compilation_info: CompilationInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -479,33 +476,6 @@ impl fmt::Debug for CoreSurfaceOutputDetail {
|
||||
}
|
||||
}
|
||||
|
||||
fn shader_module_error_into_compilation_info(value: CreateShaderModuleError) -> CompilationInfo {
|
||||
match value {
|
||||
#[cfg(feature = "wgsl")]
|
||||
CreateShaderModuleError::Parsing(v) => crate::wgsl_to_compilation_info(v),
|
||||
#[cfg(feature = "glsl")]
|
||||
CreateShaderModuleError::ParsingGlsl(v) => crate::glsl_to_compilation_info(v),
|
||||
#[cfg(feature = "spirv")]
|
||||
CreateShaderModuleError::ParsingSpirV(v) => crate::spirv_to_compilation_info(v),
|
||||
CreateShaderModuleError::Validation(v) => crate::naga_to_compilation_info(v),
|
||||
// Device errors are reported through the error sink, and are not compilation errors.
|
||||
// Same goes for native shader module generation errors.
|
||||
CreateShaderModuleError::Device(_) | CreateShaderModuleError::Generation => {
|
||||
CompilationInfo {
|
||||
messages: Vec::new(),
|
||||
}
|
||||
}
|
||||
// Everything else is an error message without location information.
|
||||
_ => CompilationInfo {
|
||||
messages: vec![CompilationMessage {
|
||||
message: value.to_string(),
|
||||
message_type: CompilationMessageType::Error,
|
||||
location: None,
|
||||
}],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CoreQueueWriteBuffer {
|
||||
wgpu_staging_buffer: wgc::resource::StagingBuffer,
|
||||
@@ -827,23 +797,15 @@ impl dispatch::DeviceInterface for CoreDevice {
|
||||
};
|
||||
let (wgpu_shader_module, error) =
|
||||
self.wgpu_device.create_shader_module(&descriptor, source);
|
||||
let compilation_info = match error {
|
||||
Some(cause) => {
|
||||
self.wgpu_device.handle_error(
|
||||
cause.clone(),
|
||||
desc.label,
|
||||
"Device::create_shader_module",
|
||||
);
|
||||
shader_module_error_into_compilation_info(cause)
|
||||
}
|
||||
None => CompilationInfo { messages: vec![] },
|
||||
};
|
||||
|
||||
CoreShaderModule {
|
||||
wgpu_shader_module,
|
||||
compilation_info,
|
||||
if let Some(cause) = error {
|
||||
self.wgpu_device.handle_error(
|
||||
cause.clone(),
|
||||
desc.label,
|
||||
"Device::create_shader_module",
|
||||
);
|
||||
}
|
||||
.into()
|
||||
|
||||
CoreShaderModule { wgpu_shader_module }.into()
|
||||
}
|
||||
|
||||
unsafe fn create_shader_module_passthrough(
|
||||
@@ -853,24 +815,15 @@ impl dispatch::DeviceInterface for CoreDevice {
|
||||
let desc = desc.map_label(|l| l.map(Cow::from));
|
||||
let (wgpu_shader_module, error) =
|
||||
unsafe { self.wgpu_device.create_shader_module_passthrough(&desc) };
|
||||
|
||||
let compilation_info = match error {
|
||||
Some(cause) => {
|
||||
self.wgpu_device.handle_error(
|
||||
cause.clone(),
|
||||
desc.label.as_deref(),
|
||||
"Device::create_shader_module_passthrough",
|
||||
);
|
||||
shader_module_error_into_compilation_info(cause)
|
||||
}
|
||||
None => CompilationInfo { messages: vec![] },
|
||||
};
|
||||
|
||||
CoreShaderModule {
|
||||
wgpu_shader_module,
|
||||
compilation_info,
|
||||
if let Some(cause) = error {
|
||||
self.wgpu_device.handle_error(
|
||||
cause.clone(),
|
||||
desc.label.as_deref(),
|
||||
"Device::create_shader_module_passthrough",
|
||||
);
|
||||
}
|
||||
.into()
|
||||
|
||||
CoreShaderModule { wgpu_shader_module }.into()
|
||||
}
|
||||
|
||||
fn create_bind_group_layout(
|
||||
@@ -1649,7 +1602,7 @@ impl dispatch::QueueInterface for CoreQueue {
|
||||
|
||||
impl dispatch::ShaderModuleInterface for CoreShaderModule {
|
||||
fn get_compilation_info(&self) -> Pin<Box<dyn dispatch::ShaderCompilationInfoFuture>> {
|
||||
Box::pin(ready(self.compilation_info.clone()))
|
||||
Box::pin(ready(self.wgpu_shader_module.compilation_info().clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user