summaryrefslogtreecommitdiff
path: root/src/video_core/pica.h
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-08-16 14:06:40 +0200
committerGravatar Tony Wasserka2014-08-25 22:03:18 +0200
commitc4691b784bd7746c5845df00a82ea0909b37ec0f (patch)
tree635fa4cea0fa7c487217c8799cb90c45ebc12841 /src/video_core/pica.h
parentPica/Math: Improved the design of the Vec2/Vec3/Vec4 classes and simplified r... (diff)
downloadyuzu-c4691b784bd7746c5845df00a82ea0909b37ec0f.tar.gz
yuzu-c4691b784bd7746c5845df00a82ea0909b37ec0f.tar.xz
yuzu-c4691b784bd7746c5845df00a82ea0909b37ec0f.zip
Pica: Add support for dumping textures.
Diffstat (limited to 'src/video_core/pica.h')
-rw-r--r--src/video_core/pica.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index fe886c16f..f288615b8 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -94,7 +94,46 @@ struct Regs {
94 BitField<16, 16, u32> y; 94 BitField<16, 16, u32> y;
95 } viewport_corner; 95 } viewport_corner;
96 96
97 INSERT_PADDING_WORDS(0xa7); 97 INSERT_PADDING_WORDS(0x18);
98
99 struct TextureConfig {
100 INSERT_PADDING_WORDS(0x1);
101
102 union {
103 BitField< 0, 16, u32> height;
104 BitField<16, 16, u32> width;
105 };
106
107 INSERT_PADDING_WORDS(0x2);
108
109 u32 address;
110
111 u32 GetPhysicalAddress() {
112 return DecodeAddressRegister(address) - Memory::FCRAM_PADDR + Memory::HEAP_GSP_VADDR;
113 }
114
115 // texture1 and texture2 store the texture format directly after the address
116 // whereas texture0 inserts some additional flags inbetween.
117 // Hence, we store the format separately so that all other parameters can be described
118 // in a single structure.
119 };
120
121 enum class TextureFormat : u32 {
122 RGBA8 = 0,
123 RGB8 = 1,
124 RGBA5551 = 2,
125 RGB565 = 3,
126 RGBA4 = 4,
127
128 // TODO: Support for the other formats is not implemented, yet.
129 // Seems like they are luminance formats and compressed textures.
130 };
131
132 TextureConfig texture0;
133 INSERT_PADDING_WORDS(0x8);
134 BitField<0, 4, TextureFormat> texture0_format;
135
136 INSERT_PADDING_WORDS(0x81);
98 137
99 struct { 138 struct {
100 enum ColorFormat : u32 { 139 enum ColorFormat : u32 {
@@ -403,6 +442,8 @@ struct Regs {
403 ADD_FIELD(viewport_depth_range); 442 ADD_FIELD(viewport_depth_range);
404 ADD_FIELD(viewport_depth_far_plane); 443 ADD_FIELD(viewport_depth_far_plane);
405 ADD_FIELD(viewport_corner); 444 ADD_FIELD(viewport_corner);
445 ADD_FIELD(texture0);
446 ADD_FIELD(texture0_format);
406 ADD_FIELD(framebuffer); 447 ADD_FIELD(framebuffer);
407 ADD_FIELD(vertex_attributes); 448 ADD_FIELD(vertex_attributes);
408 ADD_FIELD(index_array); 449 ADD_FIELD(index_array);
@@ -460,6 +501,8 @@ ASSERT_REG_POSITION(viewport_depth_far_plane, 0x4e);
460ASSERT_REG_POSITION(vs_output_attributes[0], 0x50); 501ASSERT_REG_POSITION(vs_output_attributes[0], 0x50);
461ASSERT_REG_POSITION(vs_output_attributes[1], 0x51); 502ASSERT_REG_POSITION(vs_output_attributes[1], 0x51);
462ASSERT_REG_POSITION(viewport_corner, 0x68); 503ASSERT_REG_POSITION(viewport_corner, 0x68);
504ASSERT_REG_POSITION(texture0, 0x81);
505ASSERT_REG_POSITION(texture0_format, 0x8e);
463ASSERT_REG_POSITION(framebuffer, 0x110); 506ASSERT_REG_POSITION(framebuffer, 0x110);
464ASSERT_REG_POSITION(vertex_attributes, 0x200); 507ASSERT_REG_POSITION(vertex_attributes, 0x200);
465ASSERT_REG_POSITION(index_array, 0x227); 508ASSERT_REG_POSITION(index_array, 0x227);