citra-emu
/
citra-canary
Archived
1
0
Fork 0

GPU/DisplayTransfer: Implemented bit 5 in the transfer flags.

It tells the GPU to not swizzle/de-swizzle the input during the transfer.
This commit is contained in:
Subv 2015-07-19 21:30:42 -05:00
parent 1c81813b72
commit 63dbff9b1f
2 changed files with 29 additions and 10 deletions

View File

@ -217,6 +217,7 @@ inline void Write(u32 addr, const T data) {
u32 dst_offset; u32 dst_offset;
if (config.output_tiled) { if (config.output_tiled) {
if (!config.dont_swizzle) {
// Interpret the input as linear and the output as tiled // Interpret the input as linear and the output as tiled
u32 coarse_y = y & ~7; u32 coarse_y = y & ~7;
u32 stride = output_width * dst_bytes_per_pixel; u32 stride = output_width * dst_bytes_per_pixel;
@ -224,12 +225,29 @@ inline void Write(u32 addr, const T data) {
src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel; src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel;
dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride; dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride;
} else { } else {
// Both input and output are linear
src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel;
dst_offset = (x + y * output_width) * dst_bytes_per_pixel;
}
} else {
if (!config.dont_swizzle) {
// Interpret the input as tiled and the output as linear // Interpret the input as tiled and the output as linear
u32 coarse_y = input_y & ~7; u32 coarse_y = input_y & ~7;
u32 stride = config.input_width * src_bytes_per_pixel; u32 stride = config.input_width * src_bytes_per_pixel;
src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + coarse_y * stride; src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + coarse_y * stride;
dst_offset = (x + y * output_width) * dst_bytes_per_pixel; dst_offset = (x + y * output_width) * dst_bytes_per_pixel;
} else {
// Both input and output are tiled
u32 out_coarse_y = y & ~7;
u32 out_stride = output_width * dst_bytes_per_pixel;
u32 in_coarse_y = input_y & ~7;
u32 in_stride = config.input_width * src_bytes_per_pixel;
src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + in_coarse_y * in_stride;
dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + out_coarse_y * out_stride;
}
} }
const u8* src_pixel = src_pointer + src_offset; const u8* src_pixel = src_pointer + src_offset;

View File

@ -203,6 +203,7 @@ struct Regs {
BitField< 0, 1, u32> flip_vertically; // flips input data vertically BitField< 0, 1, u32> flip_vertically; // flips input data vertically
BitField< 1, 1, u32> output_tiled; // Converts from linear to tiled format BitField< 1, 1, u32> output_tiled; // Converts from linear to tiled format
BitField< 3, 1, u32> raw_copy; // Copies the data without performing any processing BitField< 3, 1, u32> raw_copy; // Copies the data without performing any processing
BitField< 5, 1, u32> dont_swizzle;
BitField< 8, 3, PixelFormat> input_format; BitField< 8, 3, PixelFormat> input_format;
BitField<12, 3, PixelFormat> output_format; BitField<12, 3, PixelFormat> output_format;