| 5277 | } |
| 5278 | |
| 5279 | bool BufferViewer::eventFilter(QObject *watched, QEvent *event) |
| 5280 | { |
| 5281 | if(event->type() == QEvent::ToolTip) |
| 5282 | { |
| 5283 | RDTreeWidget *tree = qobject_cast<RDTreeWidget *>(watched); |
| 5284 | if(tree) |
| 5285 | { |
| 5286 | RDTreeWidgetItem *item = tree->itemAt(tree->viewport()->mapFromGlobal(QCursor::pos())); |
| 5287 | if(item) |
| 5288 | { |
| 5289 | FixedVarTag tag = item->tag().value<FixedVarTag>(); |
| 5290 | |
| 5291 | QString tooltip; |
| 5292 | |
| 5293 | Packing::Rules pack = m_ModelIn->getConfig().packing; |
| 5294 | |
| 5295 | if(tag.valid && tag.padding) |
| 5296 | { |
| 5297 | tooltip = tr("%1 bytes of padding. Packing rules in effect:\n\n") |
| 5298 | .arg(Formatter::HumanFormat(tag.byteSize, Formatter::OffsetSize)); |
| 5299 | |
| 5300 | if(pack == Packing::D3DCB) |
| 5301 | tooltip += tr("Standard D3D constant buffer packing.\n\n"); |
| 5302 | else if(pack == Packing::std140) |
| 5303 | tooltip += tr("Standard std140 buffer packing.\n\n"); |
| 5304 | else if(pack == Packing::std430) |
| 5305 | tooltip += tr("Standard std430 buffer packing.\n\n"); |
| 5306 | else if(pack == Packing::C) |
| 5307 | tooltip += tr("Standard C / D3D UAV packing.\n\n"); |
| 5308 | else if(pack == Packing::Scalar) |
| 5309 | tooltip += tr("Scalar packing.\n\n"); |
| 5310 | |
| 5311 | if(pack.vector_align_component) |
| 5312 | tooltip += |
| 5313 | tr("- Vectors are only aligned to their component (float4 to 4-byte boundary)\n"); |
| 5314 | else |
| 5315 | tooltip += |
| 5316 | tr("- 3- and 4-wide vectors must be aligned to a 4-wide boundary\n" |
| 5317 | " (vec3 and vec4 to 16-byte boundary)\n"); |
| 5318 | |
| 5319 | if(pack.tight_arrays) |
| 5320 | tooltip += tr("- Arrays are tightly packed to each element\n"); |
| 5321 | else |
| 5322 | tooltip += tr("- Arrays have a stride of a 16 bytes\n"); |
| 5323 | |
| 5324 | if(pack.trailing_overlap) |
| 5325 | tooltip += tr("- Variables can overlap the trailing padding in arrays or structs.\n"); |
| 5326 | else |
| 5327 | tooltip += |
| 5328 | tr("- Variables must not overlap the trailing padding in arrays or structs.\n"); |
| 5329 | |
| 5330 | if(pack.vector_straddle_16b) |
| 5331 | tooltip += tr("- Vectors can straddle 16-byte boundaries.\n"); |
| 5332 | else |
| 5333 | tooltip += tr("- Vectors must not straddle 16-byte boundaries.\n"); |
| 5334 | } |
| 5335 | else if(tag.valid && !tag.padding) |
| 5336 | { |
nothing calls this directly
no test coverage detected