summaryrefslogtreecommitdiff
path: root/src/video_core/debug_utils
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-12-19 19:15:47 +0100
committerGravatar Tony Wasserka2014-12-20 18:06:55 +0100
commit6e275778c9e7e55cabadb14fdabaa51a55348663 (patch)
tree1cfb3e0ae96847987e1340905e55c4c0b10c32f6 /src/video_core/debug_utils
parentPica/Rasterizer: Get rid of C-style casts. (diff)
downloadyuzu-6e275778c9e7e55cabadb14fdabaa51a55348663.tar.gz
yuzu-6e275778c9e7e55cabadb14fdabaa51a55348663.tar.xz
yuzu-6e275778c9e7e55cabadb14fdabaa51a55348663.zip
Pica/DebugUtils: Better document LookupTexture.
Diffstat (limited to 'src/video_core/debug_utils')
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp12
-rw-r--r--src/video_core/debug_utils/debug_utils.h11
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
392 { 392 {
393 const u8* source_ptr = source + coarse_x * block_height * 2 + coarse_y * info.stride + texel_index_within_tile * 2; 393 const u8* source_ptr = source + coarse_x * block_height * 2 + coarse_y * info.stride + texel_index_within_tile * 2;
394 394
395 // TODO: Better control this... 395 // TODO: compoent order not verified
396
396 if (disable_alpha) { 397 if (disable_alpha) {
398 // Show intensity as red, alpha as green
397 return { *source_ptr, *(source_ptr+1), 0, 255 }; 399 return { *source_ptr, *(source_ptr+1), 0, 255 };
398 } else { 400 } else {
399 return { *source_ptr, *source_ptr, *source_ptr, *(source_ptr+1)}; 401 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
403 case Regs::TextureFormat::I8: 405 case Regs::TextureFormat::I8:
404 { 406 {
405 const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile; 407 const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile;
406
407 // TODO: Better control this...
408 return { *source_ptr, *source_ptr, *source_ptr, 255 }; 408 return { *source_ptr, *source_ptr, *source_ptr, 255 };
409 } 409 }
410 410
@@ -412,7 +412,6 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
412 { 412 {
413 const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile; 413 const u8* source_ptr = source + coarse_x * block_height + coarse_y * info.stride + texel_index_within_tile;
414 414
415 // TODO: Better control this...
416 if (disable_alpha) { 415 if (disable_alpha) {
417 return { *source_ptr, *source_ptr, *source_ptr, 255 }; 416 return { *source_ptr, *source_ptr, *source_ptr, 255 };
418 } else { 417 } else {
@@ -424,14 +423,15 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
424 { 423 {
425 const u8* source_ptr = source + coarse_x * block_height / 2 + coarse_y * info.stride + texel_index_within_tile / 2; 424 const u8* source_ptr = source + coarse_x * block_height / 2 + coarse_y * info.stride + texel_index_within_tile / 2;
426 425
427 // TODO: Order? 426 // TODO: compoent order not verified
427
428 u8 i = (*source_ptr)&0xF; 428 u8 i = (*source_ptr)&0xF;
429 u8 a = ((*source_ptr) & 0xF0) >> 4; 429 u8 a = ((*source_ptr) & 0xF0) >> 4;
430 a |= a << 4; 430 a |= a << 4;
431 i |= i << 4; 431 i |= i << 4;
432 432
433 // TODO: Better control this...
434 if (disable_alpha) { 433 if (disable_alpha) {
434 // Show intensity as red, alpha as green
435 return { i, a, 0, 255 }; 435 return { i, a, 0, 255 };
436 } else { 436 } else {
437 return { i, i, i, a }; 437 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 {
203 const Pica::Regs::TextureFormat& format); 203 const Pica::Regs::TextureFormat& format);
204}; 204};
205 205
206const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info, 206/**
207 * Lookup texel located at the given coordinates and return an RGBA vector of its color.
208 * @param source Source pointer to read data from
209 * @param s,t Texture coordinates to read from
210 * @param info TextureInfo object describing the texture setup
211 * @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.
212 * @todo Eventually we should get rid of the disable_alpha parameter.
213 */
214const Math::Vec4<u8> LookupTexture(const u8* source, int s, int t, const TextureInfo& info,
207 bool disable_alpha = false); 215 bool disable_alpha = false);
216
208void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); 217void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data);
209 218
210void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages); 219void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages);