diff options
| author | 2017-01-27 20:51:59 -0800 | |
|---|---|---|
| committer | 2017-02-04 13:59:09 -0800 | |
| commit | 9017093f58fb08b85cfb842f305efa667d62cecb (patch) | |
| tree | 98a1e77b197a562a8f13565e62f2e8bb9220ff94 /src/video_core/debug_utils | |
| parent | VideoCore: Split rasterizer regs from Regs struct (diff) | |
| download | yuzu-9017093f58fb08b85cfb842f305efa667d62cecb.tar.gz yuzu-9017093f58fb08b85cfb842f305efa667d62cecb.tar.xz yuzu-9017093f58fb08b85cfb842f305efa667d62cecb.zip | |
VideoCore: Split texturing regs from Regs struct
Diffstat (limited to 'src/video_core/debug_utils')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 35 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 8 |
2 files changed, 24 insertions, 19 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 618268654..81cd35cd9 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -331,7 +331,7 @@ static void FlushIOFile(png_structp png_ptr) { | |||
| 331 | } | 331 | } |
| 332 | #endif | 332 | #endif |
| 333 | 333 | ||
| 334 | void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { | 334 | void DumpTexture(const TexturingRegs::TextureConfig& texture_config, u8* data) { |
| 335 | #ifndef HAVE_PNG | 335 | #ifndef HAVE_PNG |
| 336 | return; | 336 | return; |
| 337 | #else | 337 | #else |
| @@ -396,7 +396,7 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { | |||
| 396 | info.width = texture_config.width; | 396 | info.width = texture_config.width; |
| 397 | info.height = texture_config.height; | 397 | info.height = texture_config.height; |
| 398 | info.stride = row_stride; | 398 | info.stride = row_stride; |
| 399 | info.format = g_state.regs.texture0_format; | 399 | info.format = g_state.regs.texturing.texture0_format; |
| 400 | Math::Vec4<u8> texture_color = Pica::Texture::LookupTexture(data, x, y, info); | 400 | Math::Vec4<u8> texture_color = Pica::Texture::LookupTexture(data, x, y, info); |
| 401 | buf[3 * x + y * row_stride] = texture_color.r(); | 401 | buf[3 * x + y * row_stride] = texture_color.r(); |
| 402 | buf[3 * x + y * row_stride + 1] = texture_color.g(); | 402 | buf[3 * x + y * row_stride + 1] = texture_color.g(); |
| @@ -434,8 +434,10 @@ static std::string ReplacePattern(const std::string& input, const std::string& p | |||
| 434 | return ret; | 434 | return ret; |
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | static std::string GetTevStageConfigSourceString(const Pica::Regs::TevStageConfig::Source& source) { | 437 | static std::string GetTevStageConfigSourceString( |
| 438 | using Source = Pica::Regs::TevStageConfig::Source; | 438 | const TexturingRegs::TevStageConfig::Source& source) { |
| 439 | |||
| 440 | using Source = TexturingRegs::TevStageConfig::Source; | ||
| 439 | static const std::map<Source, std::string> source_map = { | 441 | static const std::map<Source, std::string> source_map = { |
| 440 | {Source::PrimaryColor, "PrimaryColor"}, | 442 | {Source::PrimaryColor, "PrimaryColor"}, |
| 441 | {Source::PrimaryFragmentColor, "PrimaryFragmentColor"}, | 443 | {Source::PrimaryFragmentColor, "PrimaryFragmentColor"}, |
| @@ -457,9 +459,10 @@ static std::string GetTevStageConfigSourceString(const Pica::Regs::TevStageConfi | |||
| 457 | } | 459 | } |
| 458 | 460 | ||
| 459 | static std::string GetTevStageConfigColorSourceString( | 461 | static std::string GetTevStageConfigColorSourceString( |
| 460 | const Pica::Regs::TevStageConfig::Source& source, | 462 | const TexturingRegs::TevStageConfig::Source& source, |
| 461 | const Pica::Regs::TevStageConfig::ColorModifier modifier) { | 463 | const TexturingRegs::TevStageConfig::ColorModifier modifier) { |
| 462 | using ColorModifier = Pica::Regs::TevStageConfig::ColorModifier; | 464 | |
| 465 | using ColorModifier = TexturingRegs::TevStageConfig::ColorModifier; | ||
| 463 | static const std::map<ColorModifier, std::string> color_modifier_map = { | 466 | static const std::map<ColorModifier, std::string> color_modifier_map = { |
| 464 | {ColorModifier::SourceColor, "%source.rgb"}, | 467 | {ColorModifier::SourceColor, "%source.rgb"}, |
| 465 | {ColorModifier::OneMinusSourceColor, "(1.0 - %source.rgb)"}, | 468 | {ColorModifier::OneMinusSourceColor, "(1.0 - %source.rgb)"}, |
| @@ -483,9 +486,10 @@ static std::string GetTevStageConfigColorSourceString( | |||
| 483 | } | 486 | } |
| 484 | 487 | ||
| 485 | static std::string GetTevStageConfigAlphaSourceString( | 488 | static std::string GetTevStageConfigAlphaSourceString( |
| 486 | const Pica::Regs::TevStageConfig::Source& source, | 489 | const TexturingRegs::TevStageConfig::Source& source, |
| 487 | const Pica::Regs::TevStageConfig::AlphaModifier modifier) { | 490 | const TexturingRegs::TevStageConfig::AlphaModifier modifier) { |
| 488 | using AlphaModifier = Pica::Regs::TevStageConfig::AlphaModifier; | 491 | |
| 492 | using AlphaModifier = TexturingRegs::TevStageConfig::AlphaModifier; | ||
| 489 | static const std::map<AlphaModifier, std::string> alpha_modifier_map = { | 493 | static const std::map<AlphaModifier, std::string> alpha_modifier_map = { |
| 490 | {AlphaModifier::SourceAlpha, "%source.a"}, | 494 | {AlphaModifier::SourceAlpha, "%source.a"}, |
| 491 | {AlphaModifier::OneMinusSourceAlpha, "(1.0 - %source.a)"}, | 495 | {AlphaModifier::OneMinusSourceAlpha, "(1.0 - %source.a)"}, |
| @@ -507,8 +511,9 @@ static std::string GetTevStageConfigAlphaSourceString( | |||
| 507 | } | 511 | } |
| 508 | 512 | ||
| 509 | static std::string GetTevStageConfigOperationString( | 513 | static std::string GetTevStageConfigOperationString( |
| 510 | const Pica::Regs::TevStageConfig::Operation& operation) { | 514 | const TexturingRegs::TevStageConfig::Operation& operation) { |
| 511 | using Operation = Pica::Regs::TevStageConfig::Operation; | 515 | |
| 516 | using Operation = TexturingRegs::TevStageConfig::Operation; | ||
| 512 | static const std::map<Operation, std::string> combiner_map = { | 517 | static const std::map<Operation, std::string> combiner_map = { |
| 513 | {Operation::Replace, "%source1"}, | 518 | {Operation::Replace, "%source1"}, |
| 514 | {Operation::Modulate, "(%source1 * %source2)"}, | 519 | {Operation::Modulate, "(%source1 * %source2)"}, |
| @@ -528,7 +533,7 @@ static std::string GetTevStageConfigOperationString( | |||
| 528 | return op_it->second; | 533 | return op_it->second; |
| 529 | } | 534 | } |
| 530 | 535 | ||
| 531 | std::string GetTevStageConfigColorCombinerString(const Pica::Regs::TevStageConfig& tev_stage) { | 536 | std::string GetTevStageConfigColorCombinerString(const TexturingRegs::TevStageConfig& tev_stage) { |
| 532 | auto op_str = GetTevStageConfigOperationString(tev_stage.color_op); | 537 | auto op_str = GetTevStageConfigOperationString(tev_stage.color_op); |
| 533 | op_str = ReplacePattern( | 538 | op_str = ReplacePattern( |
| 534 | op_str, "%source1", | 539 | op_str, "%source1", |
| @@ -541,7 +546,7 @@ std::string GetTevStageConfigColorCombinerString(const Pica::Regs::TevStageConfi | |||
| 541 | GetTevStageConfigColorSourceString(tev_stage.color_source3, tev_stage.color_modifier3)); | 546 | GetTevStageConfigColorSourceString(tev_stage.color_source3, tev_stage.color_modifier3)); |
| 542 | } | 547 | } |
| 543 | 548 | ||
| 544 | std::string GetTevStageConfigAlphaCombinerString(const Pica::Regs::TevStageConfig& tev_stage) { | 549 | std::string GetTevStageConfigAlphaCombinerString(const TexturingRegs::TevStageConfig& tev_stage) { |
| 545 | auto op_str = GetTevStageConfigOperationString(tev_stage.alpha_op); | 550 | auto op_str = GetTevStageConfigOperationString(tev_stage.alpha_op); |
| 546 | op_str = ReplacePattern( | 551 | op_str = ReplacePattern( |
| 547 | op_str, "%source1", | 552 | op_str, "%source1", |
| @@ -554,7 +559,7 @@ std::string GetTevStageConfigAlphaCombinerString(const Pica::Regs::TevStageConfi | |||
| 554 | GetTevStageConfigAlphaSourceString(tev_stage.alpha_source3, tev_stage.alpha_modifier3)); | 559 | GetTevStageConfigAlphaSourceString(tev_stage.alpha_source3, tev_stage.alpha_modifier3)); |
| 555 | } | 560 | } |
| 556 | 561 | ||
| 557 | void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig, 6>& stages) { | 562 | void DumpTevStageConfig(const std::array<TexturingRegs::TevStageConfig, 6>& stages) { |
| 558 | std::string stage_info = "Tev setup:\n"; | 563 | std::string stage_info = "Tev setup:\n"; |
| 559 | for (size_t index = 0; index < stages.size(); ++index) { | 564 | for (size_t index = 0; index < stages.size(); ++index) { |
| 560 | const auto& tev_stage = stages[index]; | 565 | const auto& tev_stage = stages[index]; |
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 51270bc9c..e58b76d41 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -205,13 +205,13 @@ inline bool IsPicaTracing() { | |||
| 205 | void OnPicaRegWrite(PicaTrace::Write write); | 205 | void OnPicaRegWrite(PicaTrace::Write write); |
| 206 | std::unique_ptr<PicaTrace> FinishPicaTracing(); | 206 | std::unique_ptr<PicaTrace> FinishPicaTracing(); |
| 207 | 207 | ||
| 208 | void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); | 208 | void DumpTexture(const TexturingRegs::TextureConfig& texture_config, u8* data); |
| 209 | 209 | ||
| 210 | std::string GetTevStageConfigColorCombinerString(const Pica::Regs::TevStageConfig& tev_stage); | 210 | std::string GetTevStageConfigColorCombinerString(const TexturingRegs::TevStageConfig& tev_stage); |
| 211 | std::string GetTevStageConfigAlphaCombinerString(const Pica::Regs::TevStageConfig& tev_stage); | 211 | std::string GetTevStageConfigAlphaCombinerString(const TexturingRegs::TevStageConfig& tev_stage); |
| 212 | 212 | ||
| 213 | /// Dumps the Tev stage config to log at trace level | 213 | /// Dumps the Tev stage config to log at trace level |
| 214 | void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig, 6>& stages); | 214 | void DumpTevStageConfig(const std::array<TexturingRegs::TevStageConfig, 6>& stages); |
| 215 | 215 | ||
| 216 | /** | 216 | /** |
| 217 | * Used in the vertex loader to merge access records. TODO: Investigate if actually useful. | 217 | * Used in the vertex loader to merge access records. TODO: Investigate if actually useful. |