From 7228e22098dd97ac89b78484a4f3ee855e37f799 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Thu, 5 Sep 2019 23:25:15 -0300
Subject: [PATCH] texture_cache: Minor changes

---
 src/video_core/texture_cache/surface_base.h   | 12 +++++------
 src/video_core/texture_cache/surface_params.h |  2 --
 src/video_core/texture_cache/surface_view.cpp |  2 +-
 src/video_core/texture_cache/surface_view.h   | 20 +++++++++----------
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h
index bcce8d8634..5e497e49f8 100644
--- a/src/video_core/texture_cache/surface_base.h
+++ b/src/video_core/texture_cache/surface_base.h
@@ -195,18 +195,18 @@ public:
 
     virtual void DownloadTexture(std::vector<u8>& staging_buffer) = 0;
 
-    void MarkAsModified(const bool is_modified_, const u64 tick) {
+    void MarkAsModified(bool is_modified_, u64 tick) {
         is_modified = is_modified_ || is_target;
         modification_tick = tick;
     }
 
-    void MarkAsRenderTarget(const bool is_target, const u32 index) {
-        this->is_target = is_target;
-        this->index = index;
+    void MarkAsRenderTarget(bool is_target_, u32 index_) {
+        is_target = is_target_;
+        index = index_;
     }
 
-    void MarkAsPicked(const bool is_picked) {
-        this->is_picked = is_picked;
+    void MarkAsPicked(bool is_picked_) {
+        is_picked = is_picked_;
     }
 
     bool IsModified() const {
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h
index 1011a4d8e7..c58e7f8a47 100644
--- a/src/video_core/texture_cache/surface_params.h
+++ b/src/video_core/texture_cache/surface_params.h
@@ -4,8 +4,6 @@
 
 #pragma once
 
-#include <map>
-
 #include "common/alignment.h"
 #include "common/bit_util.h"
 #include "common/cityhash.h"
diff --git a/src/video_core/texture_cache/surface_view.cpp b/src/video_core/texture_cache/surface_view.cpp
index 467696a4cf..57a1f5803d 100644
--- a/src/video_core/texture_cache/surface_view.cpp
+++ b/src/video_core/texture_cache/surface_view.cpp
@@ -10,7 +10,7 @@
 namespace VideoCommon {
 
 std::size_t ViewParams::Hash() const {
-    return static_cast<std::size_t>(base_layer) ^ static_cast<std::size_t>(num_layers << 16) ^
+    return static_cast<std::size_t>(base_layer) ^ (static_cast<std::size_t>(num_layers) << 16) ^
            (static_cast<std::size_t>(base_level) << 24) ^
            (static_cast<std::size_t>(num_levels) << 32) ^ (static_cast<std::size_t>(target) << 36);
 }
diff --git a/src/video_core/texture_cache/surface_view.h b/src/video_core/texture_cache/surface_view.h
index 04ca5639bc..b17fd11a9a 100644
--- a/src/video_core/texture_cache/surface_view.h
+++ b/src/video_core/texture_cache/surface_view.h
@@ -13,8 +13,8 @@
 namespace VideoCommon {
 
 struct ViewParams {
-    ViewParams(VideoCore::Surface::SurfaceTarget target, u32 base_layer, u32 num_layers,
-               u32 base_level, u32 num_levels)
+    constexpr explicit ViewParams(VideoCore::Surface::SurfaceTarget target, u32 base_layer,
+                                  u32 num_layers, u32 base_level, u32 num_levels)
         : target{target}, base_layer{base_layer}, num_layers{num_layers}, base_level{base_level},
           num_levels{num_levels} {}
 
@@ -22,12 +22,6 @@ struct ViewParams {
 
     bool operator==(const ViewParams& rhs) const;
 
-    VideoCore::Surface::SurfaceTarget target{};
-    u32 base_layer{};
-    u32 num_layers{};
-    u32 base_level{};
-    u32 num_levels{};
-
     bool IsLayered() const {
         switch (target) {
         case VideoCore::Surface::SurfaceTarget::Texture1DArray:
@@ -39,13 +33,19 @@ struct ViewParams {
             return false;
         }
     }
+
+    VideoCore::Surface::SurfaceTarget target{};
+    u32 base_layer{};
+    u32 num_layers{};
+    u32 base_level{};
+    u32 num_levels{};
 };
 
 class ViewBase {
 public:
-    ViewBase(const ViewParams& params) : params{params} {}
+    constexpr explicit ViewBase(const ViewParams& params) : params{params} {}
 
-    const ViewParams& GetViewParams() const {
+    constexpr const ViewParams& GetViewParams() const {
         return params;
     }