summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics_framebuffer.cpp
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2015-07-13 23:05:04 +0200
committerGravatar Tony Wasserka2015-07-13 23:05:04 +0200
commitbf80ae6a1ad328814df332c1136fe14e836053c6 (patch)
treedd61e70261a8f3488344f0ce90df6c5bb67e6c81 /src/citra_qt/debugger/graphics_framebuffer.cpp
parentMerge pull request #702 from neobrain/citrace (diff)
parentPica: Implement stencil testing. (diff)
downloadyuzu-bf80ae6a1ad328814df332c1136fe14e836053c6.tar.gz
yuzu-bf80ae6a1ad328814df332c1136fe14e836053c6.tar.xz
yuzu-bf80ae6a1ad328814df332c1136fe14e836053c6.zip
Merge pull request #793 from neobrain/stencil
Pica: Implement stencil testing.
Diffstat (limited to 'src/citra_qt/debugger/graphics_framebuffer.cpp')
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp62
1 files changed, 56 insertions, 6 deletions
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index 6bbe7572c..39eefbf75 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -55,7 +55,9 @@ GraphicsFramebufferWidget::GraphicsFramebufferWidget(std::shared_ptr<Pica::Debug
55 framebuffer_format_control->addItem(tr("RGBA4")); 55 framebuffer_format_control->addItem(tr("RGBA4"));
56 framebuffer_format_control->addItem(tr("D16")); 56 framebuffer_format_control->addItem(tr("D16"));
57 framebuffer_format_control->addItem(tr("D24")); 57 framebuffer_format_control->addItem(tr("D24"));
58 framebuffer_format_control->addItem(tr("D24S8")); 58 framebuffer_format_control->addItem(tr("D24X8"));
59 framebuffer_format_control->addItem(tr("X24S8"));
60 framebuffer_format_control->addItem(tr("(unknown)"));
59 61
60 // TODO: This QLabel should shrink the image to the available space rather than just expanding... 62 // TODO: This QLabel should shrink the image to the available space rather than just expanding...
61 framebuffer_picture_label = new QLabel; 63 framebuffer_picture_label = new QLabel;
@@ -184,8 +186,32 @@ void GraphicsFramebufferWidget::OnUpdate()
184 framebuffer_address = framebuffer.GetColorBufferPhysicalAddress(); 186 framebuffer_address = framebuffer.GetColorBufferPhysicalAddress();
185 framebuffer_width = framebuffer.GetWidth(); 187 framebuffer_width = framebuffer.GetWidth();
186 framebuffer_height = framebuffer.GetHeight(); 188 framebuffer_height = framebuffer.GetHeight();
187 // TODO: It's unknown how this format is actually specified 189
188 framebuffer_format = Format::RGBA8; 190 switch (framebuffer.color_format) {
191 case Pica::Regs::ColorFormat::RGBA8:
192 framebuffer_format = Format::RGBA8;
193 break;
194
195 case Pica::Regs::ColorFormat::RGB8:
196 framebuffer_format = Format::RGB8;
197 break;
198
199 case Pica::Regs::ColorFormat::RGB5A1:
200 framebuffer_format = Format::RGB5A1;
201 break;
202
203 case Pica::Regs::ColorFormat::RGB565:
204 framebuffer_format = Format::RGB565;
205 break;
206
207 case Pica::Regs::ColorFormat::RGBA4:
208 framebuffer_format = Format::RGBA4;
209 break;
210
211 default:
212 framebuffer_format = Format::Unknown;
213 break;
214 }
189 215
190 break; 216 break;
191 } 217 }
@@ -197,7 +223,24 @@ void GraphicsFramebufferWidget::OnUpdate()
197 framebuffer_address = framebuffer.GetDepthBufferPhysicalAddress(); 223 framebuffer_address = framebuffer.GetDepthBufferPhysicalAddress();
198 framebuffer_width = framebuffer.GetWidth(); 224 framebuffer_width = framebuffer.GetWidth();
199 framebuffer_height = framebuffer.GetHeight(); 225 framebuffer_height = framebuffer.GetHeight();
200 framebuffer_format = Format::D16; 226
227 switch (framebuffer.depth_format) {
228 case Pica::Regs::DepthFormat::D16:
229 framebuffer_format = Format::D16;
230 break;
231
232 case Pica::Regs::DepthFormat::D24:
233 framebuffer_format = Format::D24;
234 break;
235
236 case Pica::Regs::DepthFormat::D24S8:
237 framebuffer_format = Format::D24X8;
238 break;
239
240 default:
241 framebuffer_format = Format::Unknown;
242 break;
243 }
201 244
202 break; 245 break;
203 } 246 }
@@ -258,7 +301,7 @@ void GraphicsFramebufferWidget::OnUpdate()
258 color.b() = (data >> 16) & 0xFF; 301 color.b() = (data >> 16) & 0xFF;
259 break; 302 break;
260 } 303 }
261 case Format::D24S8: 304 case Format::D24X8:
262 { 305 {
263 Math::Vec2<u32> data = Color::DecodeD24S8(pixel); 306 Math::Vec2<u32> data = Color::DecodeD24S8(pixel);
264 color.r() = data.x & 0xFF; 307 color.r() = data.x & 0xFF;
@@ -266,6 +309,12 @@ void GraphicsFramebufferWidget::OnUpdate()
266 color.b() = (data.x >> 16) & 0xFF; 309 color.b() = (data.x >> 16) & 0xFF;
267 break; 310 break;
268 } 311 }
312 case Format::X24S8:
313 {
314 Math::Vec2<u32> data = Color::DecodeD24S8(pixel);
315 color.r() = color.g() = color.b() = data.y;
316 break;
317 }
269 default: 318 default:
270 qDebug() << "Unknown fb color format " << static_cast<int>(framebuffer_format); 319 qDebug() << "Unknown fb color format " << static_cast<int>(framebuffer_format);
271 break; 320 break;
@@ -286,7 +335,8 @@ void GraphicsFramebufferWidget::OnUpdate()
286u32 GraphicsFramebufferWidget::BytesPerPixel(GraphicsFramebufferWidget::Format format) { 335u32 GraphicsFramebufferWidget::BytesPerPixel(GraphicsFramebufferWidget::Format format) {
287 switch (format) { 336 switch (format) {
288 case Format::RGBA8: 337 case Format::RGBA8:
289 case Format::D24S8: 338 case Format::D24X8:
339 case Format::X24S8:
290 return 4; 340 return 4;
291 case Format::RGB8: 341 case Format::RGB8:
292 case Format::D24: 342 case Format::D24: