Skip to content

Commit 98e4002

Browse files
committed
Make ForceShaderModelToken’s functions const.
1 parent c82600f commit 98e4002

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

wgpu-hal/src/dx12/shader_compilation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ impl CompilerContainer {
9393
}
9494

9595
pub(super) fn max_shader_model(&self) -> Option<wgt::DxcShaderModel> {
96-
match self {
96+
match *self {
9797
CompilerContainer::Fxc(..) => None,
9898
CompilerContainer::DynamicDxc(CompilerDynamicDxc {
9999
max_shader_model, ..
100100
})
101101
| CompilerContainer::StaticDxc(CompilerStaticDxc {
102102
max_shader_model, ..
103-
}) => Some(max_shader_model.clone()),
103+
}) => Some(max_shader_model),
104104
}
105105
}
106106

wgpu-types/src/backend.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,13 @@ impl ForceShaderModelToken {
389389
/// # Safety
390390
/// Do not make use in runtime-compiled shaders of any features that may not be supported by the FXC or DXC
391391
/// version you use.
392-
pub unsafe fn with_shader_model(sm: DxcShaderModel) -> Self {
392+
pub const unsafe fn with_shader_model(sm: DxcShaderModel) -> Self {
393393
Self { inner: Some(sm) }
394394
}
395395

396396
/// Returns the shader model version, if any, in this token.
397-
pub fn get(&self) -> Option<DxcShaderModel> {
398-
self.inner.clone()
397+
pub const fn get(&self) -> Option<DxcShaderModel> {
398+
self.inner
399399
}
400400
}
401401

@@ -740,7 +740,7 @@ impl Dx12SwapchainKind {
740740
}
741741

742742
/// DXC shader model.
743-
#[derive(Clone, Debug)]
743+
#[derive(Clone, Copy, Debug)]
744744
#[allow(missing_docs)]
745745
pub enum DxcShaderModel {
746746
V6_0,

0 commit comments

Comments
 (0)