From af653906d0cf38556acae1f8e5d3f8968ff7074a Mon Sep 17 00:00:00 2001 From: FernandoS27 Date: Mon, 8 Oct 2018 14:34:55 -0400 Subject: Fixed block height settings for RenderTargets and Depth Buffers, and added block width and block depth --- src/video_core/engines/fermi_2d.h | 14 ++++++++++++-- src/video_core/engines/maxwell_3d.h | 12 ++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/video_core/engines') diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index 81d15c62a..2a6e8bbbb 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h @@ -36,9 +36,9 @@ public: RenderTargetFormat format; BitField<0, 1, u32> linear; union { - BitField<0, 4, u32> block_depth; + BitField<0, 4, u32> block_width; BitField<4, 4, u32> block_height; - BitField<8, 4, u32> block_width; + BitField<8, 4, u32> block_depth; }; u32 depth; u32 layer; @@ -53,10 +53,20 @@ public: address_low); } + u32 BlockWidth() const { + // The block width is stored in log2 format. + return 1 << block_width; + } + u32 BlockHeight() const { // The block height is stored in log2 format. return 1 << block_height; } + + u32 BlockDepth() const { + // The block depth is stored in log2 format. + return 1 << block_depth; + } }; static_assert(sizeof(Surface) == 0x28, "Surface has incorrect size"); diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 4290da33f..896498b89 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -432,7 +432,11 @@ public: u32 width; u32 height; Tegra::RenderTargetFormat format; - u32 block_dimensions; + union { + BitField<0, 3, u32> block_width; + BitField<4, 3, u32> block_height; + BitField<8, 3, u32> block_depth; + } block_dimensions; u32 array_mode; u32 layer_stride; u32 base_layer; @@ -548,7 +552,11 @@ public: u32 address_high; u32 address_low; Tegra::DepthFormat format; - u32 block_dimensions; + union { + BitField<0, 4, u32> block_width; + BitField<4, 4, u32> block_height; + BitField<8, 4, u32> block_depth; + } block_dimensions; u32 layer_stride; GPUVAddr Address() const { -- cgit v1.2.3 From 5f4ee6f0c8c7b2532bc5be841fcee4670495d7f7 Mon Sep 17 00:00:00 2001 From: FernandoS27 Date: Tue, 9 Oct 2018 22:28:19 -0400 Subject: Add memory Layout to Render Targets and Depth Buffers --- src/video_core/engines/maxwell_3d.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/video_core/engines') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 896498b89..68831a1ac 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -347,6 +347,16 @@ public: DecrWrap = 8, }; + enum class MemoryLayout : u32 { + Linear = 0, + BlockLinear = 1, + }; + + enum class InvMemoryLayout : u32 { + BlockLinear = 0, + Linear = 1, + }; + struct Cull { enum class FrontFace : u32 { ClockWise = 0x0900, @@ -436,7 +446,8 @@ public: BitField<0, 3, u32> block_width; BitField<4, 3, u32> block_height; BitField<8, 3, u32> block_depth; - } block_dimensions; + BitField<12, 1, InvMemoryLayout> type; + } memory_layout; u32 array_mode; u32 layer_stride; u32 base_layer; @@ -556,7 +567,8 @@ public: BitField<0, 4, u32> block_width; BitField<4, 4, u32> block_height; BitField<8, 4, u32> block_depth; - } block_dimensions; + BitField<20, 1, InvMemoryLayout> type; + } memory_layout; u32 layer_stride; GPUVAddr Address() const { -- cgit v1.2.3