diff options
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 12 | ||||
-rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 11 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 0085c117d..1c08ba350 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -392,8 +392,10 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture { const u8* source_ptr = source + coarse_x * block_height * 2 + coarse_y * info.stride + texel_index_within_tile * 2; - // TODO: Better control this... + // TODO: compoent order not verified + if (disable_alpha) { + // Show intensity as red, alpha as green return { *source_ptr, *(source_ptr+1), 0, 255 }; } else { return { *source_ptr, *source_ptr, *source_ptr, *(source_ptr+1)}; @@ -403,8 +405,6 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture case Regs::TextureFormat::I8: { const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile; - - // TODO: Better control this... return { *source_ptr, *source_ptr, *source_ptr, 255 }; } @@ -412,7 +412,6 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture { const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile; - // TODO: Better control this... if (disable_alpha) { return { *source_ptr, *source_ptr, *source_ptr, 255 }; } else { @@ -424,14 +423,15 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture { const u8* source_ptr = source + coarse_x * block_height / 2 + coarse_y * info.stride + texel_index_within_tile / 2; - // TODO: Order? + // TODO: compoent order not verified + u8 i = (*source_ptr)&0xF; u8 a = ((*source_ptr) & 0xF0) >> 4; a |= a << 4; i |= i << 4; - // TODO: Better control this... if (disable_alpha) { + // Show intensity as red, alpha as green return { i, a, 0, 255 }; } else { return { i, i, i, a }; diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index f9be90115..f361a5385 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -203,8 +203,17 @@ struct TextureInfo { const Pica::Regs::TextureFormat& format); }; -const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info, +/** + * Lookup texel located at the given coordinates and return an RGBA vector of its color. + * @param source Source pointer to read data from + * @param s,t Texture coordinates to read from + * @param info TextureInfo object describing the texture setup + * @param disable_alpha This is used for debug widgets which use this method to display textures without providing a good way to visualize alpha by themselves. If true, this will return 255 for the alpha component, and either drop the information entirely or store it in an "unused" color channel. + * @todo Eventually we should get rid of the disable_alpha parameter. + */ +const Math::Vec4<u8> LookupTexture(const u8* source, int s, int t, const TextureInfo& info, bool disable_alpha = false); + void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages); |