mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 08:51:05 +01:00
Validate compute shader's presence
This commit is contained in:
1 parent
4db9a4522e
commit
fca72f54f9
7 files changed
+44
-3
No files matched your search
@@ -84,11 +84,13 @@ pub struct CommandAllocator<B: hal::Backend> {
|
||||
}
|
||||
|
||||
impl<B: GfxBackend> CommandAllocator<B> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn allocate(
|
||||
&self,
|
||||
device_id: Stored<DeviceId>,
|
||||
device: &B::Device,
|
||||
limits: wgt::Limits,
|
||||
downlevel: wgt::DownlevelProperties,
|
||||
private_features: PrivateFeatures,
|
||||
label: &crate::Label,
|
||||
#[cfg(feature = "trace")] enable_tracing: bool,
|
||||
@@ -131,6 +133,7 @@ impl<B: GfxBackend> CommandAllocator<B> {
|
||||
used_swap_chains: Default::default(),
|
||||
buffer_memory_init_actions: Default::default(),
|
||||
limits,
|
||||
downlevel,
|
||||
private_features,
|
||||
has_labels: label.is_some(),
|
||||
#[cfg(feature = "trace")]
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::{
|
||||
resource::{Buffer, BufferUse, Texture},
|
||||
track::{TrackerSet, UsageConflict},
|
||||
validation::{check_buffer_usage, MissingBufferUsageError},
|
||||
Label,
|
||||
Label, DOWNLEVEL_ERROR_WARNING_MESSAGE,
|
||||
};
|
||||
|
||||
use hal::command::CommandBuffer as _;
|
||||
@@ -153,6 +153,11 @@ pub enum ComputePassErrorInner {
|
||||
MissingBufferUsage(#[from] MissingBufferUsageError),
|
||||
#[error("cannot pop debug group, because number of pushed debug groups is zero")]
|
||||
InvalidPopDebugGroup,
|
||||
#[error(
|
||||
"Compute shaders are not supported by the underlying platform. {}",
|
||||
DOWNLEVEL_ERROR_WARNING_MESSAGE
|
||||
)]
|
||||
ComputeShadersUnsupported,
|
||||
#[error(transparent)]
|
||||
Dispatch(#[from] DispatchError),
|
||||
#[error(transparent)]
|
||||
@@ -270,6 +275,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
});
|
||||
}
|
||||
|
||||
if !cmd_buf.downlevel.compute_shaders {
|
||||
return Err(ComputePassError {
|
||||
scope: PassErrorScope::Pass(encoder_id),
|
||||
inner: ComputePassErrorInner::ComputeShadersUnsupported,
|
||||
})
|
||||
}
|
||||
|
||||
if let Some(ref label) = base.label {
|
||||
unsafe {
|
||||
raw.begin_debug_marker(label, 0);
|
||||
|
||||
@@ -48,6 +48,7 @@ pub struct CommandBuffer<B: hal::Backend> {
|
||||
pub(crate) used_swap_chains: SmallVec<[Stored<id::SwapChainId>; 1]>,
|
||||
pub(crate) buffer_memory_init_actions: Vec<MemoryInitTrackerAction<id::BufferId>>,
|
||||
limits: wgt::Limits,
|
||||
downlevel: wgt::DownlevelProperties,
|
||||
private_features: PrivateFeatures,
|
||||
has_labels: bool,
|
||||
#[cfg(feature = "trace")]
|
||||
|
||||
Reference in new issue
Block a user