summaryrefslogtreecommitdiffstats
path: root/src/video_core/regs_texturing.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-05-30 16:21:05 +0200
committerGitHub <noreply@github.com>2017-05-30 16:21:05 +0200
commit54ea95cca74f76777aa156f6d750c9d1ba5b6f11 (patch)
treebe3f5d2d12c7e48293dda7a72699e514326e66e0 /src/video_core/regs_texturing.h
parentMerge pull request #2734 from yuriks/cmake-imported-libs (diff)
parentswrasterizer: implement TextureCube (diff)
downloadyuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar.gz
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar.bz2
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar.lz
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar.xz
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.tar.zst
yuzu-54ea95cca74f76777aa156f6d750c9d1ba5b6f11.zip
Diffstat (limited to 'src/video_core/regs_texturing.h')
-rw-r--r--src/video_core/regs_texturing.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/video_core/regs_texturing.h b/src/video_core/regs_texturing.h
index e4038b41b..3f5355fa9 100644
--- a/src/video_core/regs_texturing.h
+++ b/src/video_core/regs_texturing.h
@@ -133,7 +133,32 @@ struct TexturingRegs {
BitField<16, 1, u32> clear_texture_cache; // TODO: unimplemented
} main_config;
TextureConfig texture0;
- INSERT_PADDING_WORDS(0x8);
+
+ enum class CubeFace {
+ PositiveX = 0,
+ NegativeX = 1,
+ PositiveY = 2,
+ NegativeY = 3,
+ PositiveZ = 4,
+ NegativeZ = 5,
+ };
+
+ BitField<0, 22, u32> cube_address[5];
+
+ PAddr GetCubePhysicalAddress(CubeFace face) const {
+ PAddr address = texture0.address;
+ if (face != CubeFace::PositiveX) {
+ // Bits [22:27] from the main texture address is shared with all cubemap additional
+ // addresses.
+ auto& face_addr = cube_address[static_cast<size_t>(face) - 1];
+ address &= ~face_addr.mask;
+ address |= face_addr;
+ }
+ // A multiplier of 8 is also needed in the same way as the main address.
+ return address * 8;
+ }
+
+ INSERT_PADDING_WORDS(0x3);
BitField<0, 4, TextureFormat> texture0_format;
BitField<0, 1, u32> fragment_lighting_enable;
INSERT_PADDING_WORDS(0x1);