diff options
| author | 2017-02-08 22:07:34 -0800 | |
|---|---|---|
| committer | 2017-02-08 22:07:34 -0800 | |
| commit | 2889372e47624e368df0d0361cb38b8100f047dd (patch) | |
| tree | 183cd1cd6edb60ab566bd1fe181b712643bef30c /src/citra_qt/debugger | |
| parent | Merge pull request #2539 from Kloen/re-killing-warnings (diff) | |
| parent | VideoCore: Move Regs to its own file (diff) | |
| download | yuzu-2889372e47624e368df0d0361cb38b8100f047dd.tar.gz yuzu-2889372e47624e368df0d0361cb38b8100f047dd.tar.xz yuzu-2889372e47624e368df0d0361cb38b8100f047dd.zip | |
Merge pull request #2482 from yuriks/pica-refactor
Split up monolithic Regs struct
Diffstat (limited to 'src/citra_qt/debugger')
4 files changed, 31 insertions, 30 deletions
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp index ee79f0edf..536548f36 100644 --- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #include "citra_qt/util/util.h" | 18 | #include "citra_qt/util/util.h" |
| 19 | #include "common/vector_math.h" | 19 | #include "common/vector_math.h" |
| 20 | #include "video_core/debug_utils/debug_utils.h" | 20 | #include "video_core/debug_utils/debug_utils.h" |
| 21 | #include "video_core/pica.h" | ||
| 22 | #include "video_core/pica_state.h" | 21 | #include "video_core/pica_state.h" |
| 22 | #include "video_core/regs.h" | ||
| 23 | #include "video_core/texture/texture_decode.h" | 23 | #include "video_core/texture/texture_decode.h" |
| 24 | 24 | ||
| 25 | namespace { | 25 | namespace { |
| @@ -123,15 +123,16 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& | |||
| 123 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | 123 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { |
| 124 | const unsigned int command_id = | 124 | const unsigned int command_id = |
| 125 | list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); | 125 | list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 126 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || | 126 | if (COMMAND_IN_RANGE(command_id, texturing.texture0) || |
| 127 | COMMAND_IN_RANGE(command_id, texture2)) { | 127 | COMMAND_IN_RANGE(command_id, texturing.texture1) || |
| 128 | COMMAND_IN_RANGE(command_id, texturing.texture2)) { | ||
| 128 | 129 | ||
| 129 | unsigned texture_index; | 130 | unsigned texture_index; |
| 130 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 131 | if (COMMAND_IN_RANGE(command_id, texturing.texture0)) { |
| 131 | texture_index = 0; | 132 | texture_index = 0; |
| 132 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | 133 | } else if (COMMAND_IN_RANGE(command_id, texturing.texture1)) { |
| 133 | texture_index = 1; | 134 | texture_index = 1; |
| 134 | } else if (COMMAND_IN_RANGE(command_id, texture2)) { | 135 | } else if (COMMAND_IN_RANGE(command_id, texturing.texture2)) { |
| 135 | texture_index = 2; | 136 | texture_index = 2; |
| 136 | } else { | 137 | } else { |
| 137 | UNREACHABLE_MSG("Unknown texture command"); | 138 | UNREACHABLE_MSG("Unknown texture command"); |
| @@ -146,19 +147,20 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 146 | 147 | ||
| 147 | const unsigned int command_id = | 148 | const unsigned int command_id = |
| 148 | list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); | 149 | list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 149 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || | 150 | if (COMMAND_IN_RANGE(command_id, texturing.texture0) || |
| 150 | COMMAND_IN_RANGE(command_id, texture2)) { | 151 | COMMAND_IN_RANGE(command_id, texturing.texture1) || |
| 152 | COMMAND_IN_RANGE(command_id, texturing.texture2)) { | ||
| 151 | 153 | ||
| 152 | unsigned texture_index; | 154 | unsigned texture_index; |
| 153 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 155 | if (COMMAND_IN_RANGE(command_id, texturing.texture0)) { |
| 154 | texture_index = 0; | 156 | texture_index = 0; |
| 155 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | 157 | } else if (COMMAND_IN_RANGE(command_id, texturing.texture1)) { |
| 156 | texture_index = 1; | 158 | texture_index = 1; |
| 157 | } else { | 159 | } else { |
| 158 | texture_index = 2; | 160 | texture_index = 2; |
| 159 | } | 161 | } |
| 160 | 162 | ||
| 161 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; | 163 | const auto texture = Pica::g_state.regs.texturing.GetTextures()[texture_index]; |
| 162 | const auto config = texture.config; | 164 | const auto config = texture.config; |
| 163 | const auto format = texture.format; | 165 | const auto format = texture.format; |
| 164 | 166 | ||
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp index bd82b00d4..f83c1f96c 100644 --- a/src/citra_qt/debugger/graphics/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp | |||
| @@ -16,8 +16,8 @@ | |||
| 16 | #include "common/color.h" | 16 | #include "common/color.h" |
| 17 | #include "core/hw/gpu.h" | 17 | #include "core/hw/gpu.h" |
| 18 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| 19 | #include "video_core/pica.h" | ||
| 20 | #include "video_core/pica_state.h" | 19 | #include "video_core/pica_state.h" |
| 20 | #include "video_core/regs.h" | ||
| 21 | #include "video_core/texture/texture_decode.h" | 21 | #include "video_core/texture/texture_decode.h" |
| 22 | #include "video_core/utils.h" | 22 | #include "video_core/utils.h" |
| 23 | 23 | ||
| @@ -414,30 +414,30 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 414 | // TODO: Store a reference to the registers in the debug context instead of accessing them | 414 | // TODO: Store a reference to the registers in the debug context instead of accessing them |
| 415 | // directly... | 415 | // directly... |
| 416 | 416 | ||
| 417 | const auto& framebuffer = Pica::g_state.regs.framebuffer; | 417 | const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer; |
| 418 | 418 | ||
| 419 | surface_address = framebuffer.GetColorBufferPhysicalAddress(); | 419 | surface_address = framebuffer.GetColorBufferPhysicalAddress(); |
| 420 | surface_width = framebuffer.GetWidth(); | 420 | surface_width = framebuffer.GetWidth(); |
| 421 | surface_height = framebuffer.GetHeight(); | 421 | surface_height = framebuffer.GetHeight(); |
| 422 | 422 | ||
| 423 | switch (framebuffer.color_format) { | 423 | switch (framebuffer.color_format) { |
| 424 | case Pica::Regs::ColorFormat::RGBA8: | 424 | case Pica::FramebufferRegs::ColorFormat::RGBA8: |
| 425 | surface_format = Format::RGBA8; | 425 | surface_format = Format::RGBA8; |
| 426 | break; | 426 | break; |
| 427 | 427 | ||
| 428 | case Pica::Regs::ColorFormat::RGB8: | 428 | case Pica::FramebufferRegs::ColorFormat::RGB8: |
| 429 | surface_format = Format::RGB8; | 429 | surface_format = Format::RGB8; |
| 430 | break; | 430 | break; |
| 431 | 431 | ||
| 432 | case Pica::Regs::ColorFormat::RGB5A1: | 432 | case Pica::FramebufferRegs::ColorFormat::RGB5A1: |
| 433 | surface_format = Format::RGB5A1; | 433 | surface_format = Format::RGB5A1; |
| 434 | break; | 434 | break; |
| 435 | 435 | ||
| 436 | case Pica::Regs::ColorFormat::RGB565: | 436 | case Pica::FramebufferRegs::ColorFormat::RGB565: |
| 437 | surface_format = Format::RGB565; | 437 | surface_format = Format::RGB565; |
| 438 | break; | 438 | break; |
| 439 | 439 | ||
| 440 | case Pica::Regs::ColorFormat::RGBA4: | 440 | case Pica::FramebufferRegs::ColorFormat::RGBA4: |
| 441 | surface_format = Format::RGBA4; | 441 | surface_format = Format::RGBA4; |
| 442 | break; | 442 | break; |
| 443 | 443 | ||
| @@ -450,22 +450,22 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | case Source::DepthBuffer: { | 452 | case Source::DepthBuffer: { |
| 453 | const auto& framebuffer = Pica::g_state.regs.framebuffer; | 453 | const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer; |
| 454 | 454 | ||
| 455 | surface_address = framebuffer.GetDepthBufferPhysicalAddress(); | 455 | surface_address = framebuffer.GetDepthBufferPhysicalAddress(); |
| 456 | surface_width = framebuffer.GetWidth(); | 456 | surface_width = framebuffer.GetWidth(); |
| 457 | surface_height = framebuffer.GetHeight(); | 457 | surface_height = framebuffer.GetHeight(); |
| 458 | 458 | ||
| 459 | switch (framebuffer.depth_format) { | 459 | switch (framebuffer.depth_format) { |
| 460 | case Pica::Regs::DepthFormat::D16: | 460 | case Pica::FramebufferRegs::DepthFormat::D16: |
| 461 | surface_format = Format::D16; | 461 | surface_format = Format::D16; |
| 462 | break; | 462 | break; |
| 463 | 463 | ||
| 464 | case Pica::Regs::DepthFormat::D24: | 464 | case Pica::FramebufferRegs::DepthFormat::D24: |
| 465 | surface_format = Format::D24; | 465 | surface_format = Format::D24; |
| 466 | break; | 466 | break; |
| 467 | 467 | ||
| 468 | case Pica::Regs::DepthFormat::D24S8: | 468 | case Pica::FramebufferRegs::DepthFormat::D24S8: |
| 469 | surface_format = Format::D24X8; | 469 | surface_format = Format::D24X8; |
| 470 | break; | 470 | break; |
| 471 | 471 | ||
| @@ -478,14 +478,14 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | case Source::StencilBuffer: { | 480 | case Source::StencilBuffer: { |
| 481 | const auto& framebuffer = Pica::g_state.regs.framebuffer; | 481 | const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer; |
| 482 | 482 | ||
| 483 | surface_address = framebuffer.GetDepthBufferPhysicalAddress(); | 483 | surface_address = framebuffer.GetDepthBufferPhysicalAddress(); |
| 484 | surface_width = framebuffer.GetWidth(); | 484 | surface_width = framebuffer.GetWidth(); |
| 485 | surface_height = framebuffer.GetHeight(); | 485 | surface_height = framebuffer.GetHeight(); |
| 486 | 486 | ||
| 487 | switch (framebuffer.depth_format) { | 487 | switch (framebuffer.depth_format) { |
| 488 | case Pica::Regs::DepthFormat::D24S8: | 488 | case Pica::FramebufferRegs::DepthFormat::D24S8: |
| 489 | surface_format = Format::X24S8; | 489 | surface_format = Format::X24S8; |
| 490 | break; | 490 | break; |
| 491 | 491 | ||
| @@ -512,7 +512,7 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 512 | break; | 512 | break; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; | 515 | const auto texture = Pica::g_state.regs.texturing.GetTextures()[texture_index]; |
| 516 | auto info = Pica::Texture::TextureInfo::FromPicaRegister(texture.config, texture.format); | 516 | auto info = Pica::Texture::TextureInfo::FromPicaRegister(texture.config, texture.format); |
| 517 | 517 | ||
| 518 | surface_address = info.physical_address; | 518 | surface_address = info.physical_address; |
| @@ -574,7 +574,7 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 574 | info.physical_address = surface_address; | 574 | info.physical_address = surface_address; |
| 575 | info.width = surface_width; | 575 | info.width = surface_width; |
| 576 | info.height = surface_height; | 576 | info.height = surface_height; |
| 577 | info.format = static_cast<Pica::Regs::TextureFormat>(surface_format); | 577 | info.format = static_cast<Pica::TexturingRegs::TextureFormat>(surface_format); |
| 578 | info.SetDefaultStride(); | 578 | info.SetDefaultStride(); |
| 579 | 579 | ||
| 580 | for (unsigned int y = 0; y < surface_height; ++y) { | 580 | for (unsigned int y = 0; y < surface_height; ++y) { |
| @@ -689,7 +689,8 @@ void GraphicsSurfaceWidget::SaveSurface() { | |||
| 689 | 689 | ||
| 690 | unsigned int GraphicsSurfaceWidget::NibblesPerPixel(GraphicsSurfaceWidget::Format format) { | 690 | unsigned int GraphicsSurfaceWidget::NibblesPerPixel(GraphicsSurfaceWidget::Format format) { |
| 691 | if (format <= Format::MaxTextureFormat) { | 691 | if (format <= Format::MaxTextureFormat) { |
| 692 | return Pica::Regs::NibblesPerPixel(static_cast<Pica::Regs::TextureFormat>(format)); | 692 | return Pica::TexturingRegs::NibblesPerPixel( |
| 693 | static_cast<Pica::TexturingRegs::TextureFormat>(format)); | ||
| 693 | } | 694 | } |
| 694 | 695 | ||
| 695 | switch (format) { | 696 | switch (format) { |
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.cpp b/src/citra_qt/debugger/graphics/graphics_tracing.cpp index 17f1c5ce2..40d5bed51 100644 --- a/src/citra_qt/debugger/graphics/graphics_tracing.cpp +++ b/src/citra_qt/debugger/graphics/graphics_tracing.cpp | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include "core/hw/lcd.h" | 18 | #include "core/hw/lcd.h" |
| 19 | #include "core/tracer/recorder.h" | 19 | #include "core/tracer/recorder.h" |
| 20 | #include "nihstro/float24.h" | 20 | #include "nihstro/float24.h" |
| 21 | #include "video_core/pica.h" | ||
| 22 | #include "video_core/pica_state.h" | 21 | #include "video_core/pica_state.h" |
| 23 | 22 | ||
| 24 | GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context, | 23 | GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context, |
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp index 489ec5f21..e3f3194db 100644 --- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <QTreeView> | 16 | #include <QTreeView> |
| 17 | #include "citra_qt/debugger/graphics/graphics_vertex_shader.h" | 17 | #include "citra_qt/debugger/graphics/graphics_vertex_shader.h" |
| 18 | #include "citra_qt/util/util.h" | 18 | #include "citra_qt/util/util.h" |
| 19 | #include "video_core/pica.h" | ||
| 20 | #include "video_core/pica_state.h" | 19 | #include "video_core/pica_state.h" |
| 21 | #include "video_core/shader/debug_data.h" | 20 | #include "video_core/shader/debug_data.h" |
| 22 | #include "video_core/shader/shader.h" | 21 | #include "video_core/shader/shader.h" |
| @@ -359,7 +358,7 @@ void GraphicsVertexShaderWidget::DumpShader() { | |||
| 359 | auto& config = Pica::g_state.regs.vs; | 358 | auto& config = Pica::g_state.regs.vs; |
| 360 | 359 | ||
| 361 | Pica::DebugUtils::DumpShader(filename.toStdString(), config, setup, | 360 | Pica::DebugUtils::DumpShader(filename.toStdString(), config, setup, |
| 362 | Pica::g_state.regs.vs_output_attributes); | 361 | Pica::g_state.regs.rasterizer.vs_output_attributes); |
| 363 | } | 362 | } |
| 364 | 363 | ||
| 365 | GraphicsVertexShaderWidget::GraphicsVertexShaderWidget( | 364 | GraphicsVertexShaderWidget::GraphicsVertexShaderWidget( |