| 63 | |
| 64 | #ifdef DAEDALUS_DEBUG_DISPLAYLIST |
| 65 | static void TextureCacheHandler(void * arg, WebDebugConnection * connection) |
| 66 | { |
| 67 | connection->BeginResponse(200, -1, "text/html" ); |
| 68 | |
| 69 | WriteStandardHeader(connection, "Texture Cache"); |
| 70 | |
| 71 | connection->WriteString( |
| 72 | "<div class=\"container\">\n" |
| 73 | " <div class=\"row\">\n" |
| 74 | " <div class=\"span12\">\n" |
| 75 | ); |
| 76 | connection->WriteString("<h1>Texture Cache</h1>\n"); |
| 77 | connection->WriteString("<table class=\"table table-condensed\">"); |
| 78 | connection->WriteString("<thead>"); |
| 79 | |
| 80 | connection->WriteF( |
| 81 | "<tr>" |
| 82 | "<th>Format</th>" |
| 83 | "<th>Pitch</th>" |
| 84 | "<th>Width</th>" |
| 85 | "<th>Height</th>" |
| 86 | "<th>Image</th>" |
| 87 | "</tr>" |
| 88 | "\n" ); |
| 89 | |
| 90 | connection->WriteString("</thead>"); |
| 91 | connection->WriteString("<tbody>"); |
| 92 | |
| 93 | // NB: maintain a lock for as long as we have a ref to any textures. |
| 94 | // If we delete textures on this thread, we'll crash OpenGL. |
| 95 | { |
| 96 | MutexLock lock(CTextureCache::Get()->GetDebugMutex()); |
| 97 | |
| 98 | std::vector<CTextureCache::STextureInfoSnapshot> textures; |
| 99 | CTextureCache::Get()->Snapshot(lock, textures); |
| 100 | |
| 101 | for (size_t i {}; i < textures.size(); ++i) |
| 102 | { |
| 103 | CTextureCache::STextureInfoSnapshot & snap = textures[i]; |
| 104 | const TextureInfo & ti = snap.Info; |
| 105 | |
| 106 | connection->WriteF( |
| 107 | "<tr>" |
| 108 | "<td>%s/%dbpp</td>" |
| 109 | "<td>%d</td>" |
| 110 | "<td>%d</td>" |
| 111 | "<td>%d</td>" |
| 112 | "<td><a href=\"/texture?ptr=%p\"><img src=\"/texture?ptr=%p\" width=%d height=%d></a></td>" |
| 113 | "</tr>" |
| 114 | "\n", |
| 115 | ti.GetFormatName(), |
| 116 | ti.GetSizeInBits(), |
| 117 | ti.GetPitch(), |
| 118 | ti.GetWidth(), |
| 119 | ti.GetHeight(), |
| 120 | (CNativeTexture *)snap.Texture, |
| 121 | (CNativeTexture *)snap.Texture, |
| 122 | snap.Texture->GetWidth(), |
nothing calls this directly
no test coverage detected