Remove unnecessary mutability from ResourceMetadata field uses. (#3210)

This commit is contained in:
Jim Blandy 2022-11-15 13:52:12 -08:00 committed by GitHub
parent 18f3f5f6f0
commit f41a1c294b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -537,11 +537,11 @@ impl<A: hub::HalApi> BufferTracker<A> {
unsafe {
if self.metadata.owned.get(index).unwrap_unchecked() {
let existing_epoch = self.metadata.epochs.get_unchecked_mut(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked_mut(index);
let existing_epoch = self.metadata.epochs.get_unchecked(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked(index);
if *existing_epoch == epoch
&& existing_ref_count.as_mut().unwrap_unchecked().load() == 1
&& existing_ref_count.as_ref().unwrap_unchecked().load() == 1
{
self.metadata.reset(index);

View File

@ -191,11 +191,11 @@ impl<A: hub::HalApi, T: hub::Resource, Id: TypedId> StatelessTracker<A, T, Id> {
unsafe {
if self.metadata.owned.get(index).unwrap_unchecked() {
let existing_epoch = self.metadata.epochs.get_unchecked_mut(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked_mut(index);
let existing_epoch = self.metadata.epochs.get_unchecked(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked(index);
if *existing_epoch == epoch
&& existing_ref_count.as_mut().unwrap_unchecked().load() == 1
&& existing_ref_count.as_ref().unwrap_unchecked().load() == 1
{
self.metadata.reset(index);

View File

@ -754,11 +754,11 @@ impl<A: hub::HalApi> TextureTracker<A> {
unsafe {
if self.metadata.owned.get(index).unwrap_unchecked() {
let existing_epoch = self.metadata.epochs.get_unchecked_mut(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked_mut(index);
let existing_epoch = self.metadata.epochs.get_unchecked(index);
let existing_ref_count = self.metadata.ref_counts.get_unchecked(index);
if *existing_epoch == epoch
&& existing_ref_count.as_mut().unwrap_unchecked().load() == 1
&& existing_ref_count.as_ref().unwrap_unchecked().load() == 1
{
self.start_set.complex.remove(&index32);
self.end_set.complex.remove(&index32);