summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-05-16 10:00:37 -0700
committerGravatar GitHub2017-05-16 10:00:37 -0700
commit8d558777a6484162b0cffe20b89bb486e88478a3 (patch)
tree0c5578f14ef73a191a5d492118018d6d9bff7389 /src
parentMerge pull request #2687 from yuriks/address-mappings (diff)
parentpica: correct bit field length for some registers (diff)
downloadyuzu-8d558777a6484162b0cffe20b89bb486e88478a3.tar.gz
yuzu-8d558777a6484162b0cffe20b89bb486e88478a3.tar.xz
yuzu-8d558777a6484162b0cffe20b89bb486e88478a3.zip
Merge pull request #2703 from wwylele/pica-reg-revise
pica: correct bit field length for some registers
Diffstat (limited to 'src')
-rw-r--r--src/video_core/regs_framebuffer.h7
-rw-r--r--src/video_core/regs_pipeline.h8
-rw-r--r--src/video_core/regs_rasterizer.h8
-rw-r--r--src/video_core/regs_texturing.h19
4 files changed, 25 insertions, 17 deletions
diff --git a/src/video_core/regs_framebuffer.h b/src/video_core/regs_framebuffer.h
index 9ddc79243..a50bd4111 100644
--- a/src/video_core/regs_framebuffer.h
+++ b/src/video_core/regs_framebuffer.h
@@ -211,13 +211,14 @@ struct FramebufferRegs {
211 BitField<0, 2, u32> allow_depth_stencil_write; // 0 = disable, else enable 211 BitField<0, 2, u32> allow_depth_stencil_write; // 0 = disable, else enable
212 }; 212 };
213 213
214 DepthFormat depth_format; // TODO: Should be a BitField! 214 BitField<0, 2, DepthFormat> depth_format;
215
215 BitField<16, 3, ColorFormat> color_format; 216 BitField<16, 3, ColorFormat> color_format;
216 217
217 INSERT_PADDING_WORDS(0x4); 218 INSERT_PADDING_WORDS(0x4);
218 219
219 u32 depth_buffer_address; 220 BitField<0, 28, u32> depth_buffer_address;
220 u32 color_buffer_address; 221 BitField<0, 28, u32> color_buffer_address;
221 222
222 union { 223 union {
223 // Apparently, the framebuffer width is stored as expected, 224 // Apparently, the framebuffer width is stored as expected,
diff --git a/src/video_core/regs_pipeline.h b/src/video_core/regs_pipeline.h
index 0a4ec6e1e..31c747d77 100644
--- a/src/video_core/regs_pipeline.h
+++ b/src/video_core/regs_pipeline.h
@@ -22,10 +22,10 @@ struct PipelineRegs {
22 }; 22 };
23 23
24 struct { 24 struct {
25 BitField<0, 29, u32> base_address; 25 BitField<1, 28, u32> base_address;
26 26
27 PAddr GetPhysicalBaseAddress() const { 27 PAddr GetPhysicalBaseAddress() const {
28 return base_address * 8; 28 return base_address * 16;
29 } 29 }
30 30
31 // Descriptor for internal vertex attributes 31 // Descriptor for internal vertex attributes
@@ -99,7 +99,7 @@ struct PipelineRegs {
99 // This e.g. allows to load different attributes from different memory locations 99 // This e.g. allows to load different attributes from different memory locations
100 struct { 100 struct {
101 // Source attribute data offset from the base address 101 // Source attribute data offset from the base address
102 u32 data_offset; 102 BitField<0, 28, u32> data_offset;
103 103
104 union { 104 union {
105 BitField<0, 4, u32> comp0; 105 BitField<0, 4, u32> comp0;
@@ -180,6 +180,8 @@ struct PipelineRegs {
180 // kicked off. 180 // kicked off.
181 // 2) Games can configure these registers to provide a command list subroutine mechanism. 181 // 2) Games can configure these registers to provide a command list subroutine mechanism.
182 182
183 // TODO: verify the bit length of these two fields
184 // According to 3dbrew, the bit length of them are 21 and 29, respectively
183 BitField<0, 20, u32> size[2]; ///< Size (in bytes / 8) of each channel's command buffer 185 BitField<0, 20, u32> size[2]; ///< Size (in bytes / 8) of each channel's command buffer
184 BitField<0, 28, u32> addr[2]; ///< Physical address / 8 of each channel's command buffer 186 BitField<0, 28, u32> addr[2]; ///< Physical address / 8 of each channel's command buffer
185 u32 trigger[2]; ///< Triggers execution of the channel's command buffer when written to 187 u32 trigger[2]; ///< Triggers execution of the channel's command buffer when written to
diff --git a/src/video_core/regs_rasterizer.h b/src/video_core/regs_rasterizer.h
index a471a3b38..2874fd127 100644
--- a/src/video_core/regs_rasterizer.h
+++ b/src/video_core/regs_rasterizer.h
@@ -92,13 +92,13 @@ struct RasterizerRegs {
92 BitField<0, 2, ScissorMode> mode; 92 BitField<0, 2, ScissorMode> mode;
93 93
94 union { 94 union {
95 BitField<0, 16, u32> x1; 95 BitField<0, 10, u32> x1;
96 BitField<16, 16, u32> y1; 96 BitField<16, 10, u32> y1;
97 }; 97 };
98 98
99 union { 99 union {
100 BitField<0, 16, u32> x2; 100 BitField<0, 10, u32> x2;
101 BitField<16, 16, u32> y2; 101 BitField<16, 10, u32> y2;
102 }; 102 };
103 } scissor_test; 103 } scissor_test;
104 104
diff --git a/src/video_core/regs_texturing.h b/src/video_core/regs_texturing.h
index 8a7c6efe4..3318812da 100644
--- a/src/video_core/regs_texturing.h
+++ b/src/video_core/regs_texturing.h
@@ -29,6 +29,11 @@ struct TexturingRegs {
29 ClampToBorder = 1, 29 ClampToBorder = 1,
30 Repeat = 2, 30 Repeat = 2,
31 MirroredRepeat = 3, 31 MirroredRepeat = 3,
32 // Mode 4-7 produces some weird result and may be just invalid:
33 // 4: Positive coord: clamp to edge; negative coord: repeat
34 // 5: Positive coord: clamp to border; negative coord: repeat
35 // 6: Repeat
36 // 7: Repeat
32 }; 37 };
33 38
34 enum TextureFilter : u32 { 39 enum TextureFilter : u32 {
@@ -45,22 +50,22 @@ struct TexturingRegs {
45 } border_color; 50 } border_color;
46 51
47 union { 52 union {
48 BitField<0, 16, u32> height; 53 BitField<0, 11, u32> height;
49 BitField<16, 16, u32> width; 54 BitField<16, 11, u32> width;
50 }; 55 };
51 56
52 union { 57 union {
53 BitField<1, 1, TextureFilter> mag_filter; 58 BitField<1, 1, TextureFilter> mag_filter;
54 BitField<2, 1, TextureFilter> min_filter; 59 BitField<2, 1, TextureFilter> min_filter;
55 BitField<8, 2, WrapMode> wrap_t; 60 BitField<8, 3, WrapMode> wrap_t;
56 BitField<12, 2, WrapMode> wrap_s; 61 BitField<12, 3, WrapMode> wrap_s;
57 BitField<28, 2, TextureType> 62 /// @note Only valid for texture 0 according to 3DBrew.
58 type; ///< @note Only valid for texture 0 according to 3DBrew. 63 BitField<28, 3, TextureType> type;
59 }; 64 };
60 65
61 INSERT_PADDING_WORDS(0x1); 66 INSERT_PADDING_WORDS(0x1);
62 67
63 u32 address; 68 BitField<0, 28, u32> address;
64 69
65 PAddr GetPhysicalAddress() const { 70 PAddr GetPhysicalAddress() const {
66 return address * 8; 71 return address * 8;