summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-05-10 04:17:48 -0300
committerGravatar ReinUsesLisp2019-06-20 21:36:12 -0300
commit345e73f2feb0701e3c3099d002a1c21fb524eae4 (patch)
treec8c934dfec804d04a29f8ee27124274f5f999fb8 /src/video_core/engines
parenttexture_cache: Change internal cache from lists to vectors (diff)
downloadyuzu-345e73f2feb0701e3c3099d002a1c21fb524eae4.tar.gz
yuzu-345e73f2feb0701e3c3099d002a1c21fb524eae4.tar.xz
yuzu-345e73f2feb0701e3c3099d002a1c21fb524eae4.zip
video_core: Use un-shifted block sizes to avoid integer divisions
Instead of storing all block width, height and depths in their shifted form: block_width = 1U << block_shift; Store them like they are provided by the emulated hardware (their block_shift form). This way we can avoid doing the costly Common::AlignUp operation to align texture sizes and drop CPU integer divisions with bitwise logic (defined in Common::AlignBits).
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/fermi_2d.h9
-rw-r--r--src/video_core/engines/maxwell_dma.h4
2 files changed, 5 insertions, 8 deletions
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h
index 45f59a4d9..3d28afa91 100644
--- a/src/video_core/engines/fermi_2d.h
+++ b/src/video_core/engines/fermi_2d.h
@@ -63,18 +63,15 @@ public:
63 } 63 }
64 64
65 u32 BlockWidth() const { 65 u32 BlockWidth() const {
66 // The block width is stored in log2 format. 66 return block_width;
67 return 1 << block_width;
68 } 67 }
69 68
70 u32 BlockHeight() const { 69 u32 BlockHeight() const {
71 // The block height is stored in log2 format. 70 return block_height;
72 return 1 << block_height;
73 } 71 }
74 72
75 u32 BlockDepth() const { 73 u32 BlockDepth() const {
76 // The block depth is stored in log2 format. 74 return block_depth;
77 return 1 << block_depth;
78 } 75 }
79 }; 76 };
80 static_assert(sizeof(Surface) == 0x28, "Surface has incorrect size"); 77 static_assert(sizeof(Surface) == 0x28, "Surface has incorrect size");
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index e5942f671..522fa97dc 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -59,11 +59,11 @@ public:
59 }; 59 };
60 60
61 u32 BlockHeight() const { 61 u32 BlockHeight() const {
62 return 1 << block_height; 62 return block_height;
63 } 63 }
64 64
65 u32 BlockDepth() const { 65 u32 BlockDepth() const {
66 return 1 << block_depth; 66 return block_depth;
67 } 67 }
68 }; 68 };
69 69