Merge pull request #1458 from FernandoS27/fix-render-target-block-settings

Fixed block height settings for RenderTargets and Depth Buffers
This commit is contained in:
bunnei 2018-10-10 21:24:07 -04:00 committed by GitHub
commit 6d82c4adf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 18 deletions

View file

@ -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");

View file

@ -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,
@ -432,7 +442,12 @@ 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;
BitField<12, 1, InvMemoryLayout> type;
} memory_layout;
u32 array_mode;
u32 layer_stride;
u32 base_layer;
@ -562,7 +577,12 @@ 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;
BitField<20, 1, InvMemoryLayout> type;
} memory_layout;
u32 layer_stride;
GPUVAddr Address() const {