Constify SpritePipelineKey implementation. (#6976)
# Objective - Describe the objective or issue this PR addresses. SpritePipelineKey could use more constification. ## Solution Constify SpritePipelineKey implementation. ## Changelog Co-authored-by: AxiomaticSemantics <117950168+AxiomaticSemantics@users.noreply.github.com>
This commit is contained in:
parent
c7791ad9b3
commit
d3d635b64f
@ -160,17 +160,20 @@ impl SpritePipelineKey {
|
|||||||
const MSAA_MASK_BITS: u32 = 0b111;
|
const MSAA_MASK_BITS: u32 = 0b111;
|
||||||
const MSAA_SHIFT_BITS: u32 = 32 - Self::MSAA_MASK_BITS.count_ones();
|
const MSAA_SHIFT_BITS: u32 = 32 - Self::MSAA_MASK_BITS.count_ones();
|
||||||
|
|
||||||
pub fn from_msaa_samples(msaa_samples: u32) -> Self {
|
#[inline]
|
||||||
|
pub const fn from_msaa_samples(msaa_samples: u32) -> Self {
|
||||||
let msaa_bits =
|
let msaa_bits =
|
||||||
(msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
|
(msaa_samples.trailing_zeros() & Self::MSAA_MASK_BITS) << Self::MSAA_SHIFT_BITS;
|
||||||
Self::from_bits(msaa_bits).unwrap()
|
Self::from_bits_truncate(msaa_bits)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn msaa_samples(&self) -> u32 {
|
#[inline]
|
||||||
|
pub const fn msaa_samples(&self) -> u32 {
|
||||||
1 << ((self.bits >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
1 << ((self.bits >> Self::MSAA_SHIFT_BITS) & Self::MSAA_MASK_BITS)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_colored(colored: bool) -> Self {
|
#[inline]
|
||||||
|
pub const fn from_colored(colored: bool) -> Self {
|
||||||
if colored {
|
if colored {
|
||||||
SpritePipelineKey::COLORED
|
SpritePipelineKey::COLORED
|
||||||
} else {
|
} else {
|
||||||
@ -178,7 +181,8 @@ impl SpritePipelineKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_hdr(hdr: bool) -> Self {
|
#[inline]
|
||||||
|
pub const fn from_hdr(hdr: bool) -> Self {
|
||||||
if hdr {
|
if hdr {
|
||||||
SpritePipelineKey::HDR
|
SpritePipelineKey::HDR
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user