Changeset 95168 in vbox
- Timestamp:
- Jun 2, 2022 5:46:52 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151666
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp
r95151 r95168 1329 1329 pDst->SemanticName = NULL; /* Semantic name and index will be taken from the shader output declaration. */ 1330 1330 pDst->SemanticIndex = 0; 1331 /* A geometry shader may return an attribute as a component: 1332 * Name Index Mask Register 1333 * ATTRIB 3 z 2 1334 * In this case SO declaration expects StartComponent = 0 and ComponentCount = 1 1335 * (not StartComponent = 2 and ComponentCount = 1) 1336 * This 'StartComponent = iFirstBit > 0 ? iFirstBit - 1 : 0;' did not work with a sample from a D3D11 book. 1337 */ 1338 pDst->StartComponent = 0; 1331 pDst->StartComponent = iFirstBit > 0 ? iFirstBit - 1 : 0; 1339 1332 pDst->ComponentCount = iFirstBit > 0 ? iLastBit - (iFirstBit - 1) : 0; 1340 1333 pDst->OutputSlot = pSrc->outputSlot; 1341 1334 } 1342 1335 1336 uint32_t MaxSemanticIndex = 0; 1343 1337 for (uint32_t i = 0; i < pDXStreamOutput->cDeclarationEntry; ++i) 1344 1338 { … … 1364 1358 pDeclarationEntry->SemanticName = pOutputSemantic->pcszSemanticName; 1365 1359 pDeclarationEntry->SemanticIndex = pOutputSemantic->SemanticIndex; 1360 MaxSemanticIndex = RT_MAX(MaxSemanticIndex, pOutputSemantic->SemanticIndex); 1366 1361 } 1367 1362 else 1368 1363 AssertFailed(); 1364 } 1365 1366 /* A geometry shader may return components of the same register as different attributes: 1367 * 1368 * Output signature 1369 * Name Index Mask Register 1370 * ATTRIB 2 xy 2 1371 * ATTRIB 3 z 2 1372 * 1373 * For ATTRIB 3 the stream output declaration expects StartComponent = 0 and ComponentCount = 1 1374 * (not StartComponent = 2 and ComponentCount = 1): 1375 * 1376 * Stream output declaration 1377 * SemanticName SemanticIndex StartComponent ComponentCount 1378 * ATTRIB 2 0 2 1379 * ATTRIB 3 0 1 1380 * 1381 * Stream output declaration can have multiple entries for the same attribute. 1382 * In this case StartComponent is the offset within the attribute. 1383 * 1384 * Output signature 1385 * Name Index Mask Register 1386 * ATTRIB 0 xyzw 0 1387 * 1388 * Stream output declaration 1389 * SemanticName SemanticIndex StartComponent ComponentCount 1390 * ATTRIB 0 0 1 1391 * ATTRIB 0 1 1 1392 * 1393 * StartComponent has been computed as the component offset in a register: 1394 * 'StartComponent = iFirstBit > 0 ? iFirstBit - 1 : 0;'. 1395 * 1396 * StartComponent must be the offset in an attribute. 1397 */ 1398 for (uint32_t SemanticIndex = 0; SemanticIndex <= MaxSemanticIndex; ++SemanticIndex) 1399 { 1400 /* Find minimum StartComponent value for this attribute. */ 1401 uint32_t MinStartComponent = UINT32_MAX; 1402 for (uint32_t i = 0; i < pDXStreamOutput->cDeclarationEntry; ++i) 1403 { 1404 D3D11_SO_DECLARATION_ENTRY *pDeclarationEntry = &pDXStreamOutput->aDeclarationEntry[i]; 1405 if (pDeclarationEntry->SemanticIndex == SemanticIndex) 1406 MinStartComponent = RT_MIN(MinStartComponent, pDeclarationEntry->StartComponent); 1407 } 1408 1409 AssertContinue(MinStartComponent != UINT32_MAX); 1410 1411 /* Adjust the StartComponent to start from 0 for this attribute. */ 1412 for (uint32_t i = 0; i < pDXStreamOutput->cDeclarationEntry; ++i) 1413 { 1414 D3D11_SO_DECLARATION_ENTRY *pDeclarationEntry = &pDXStreamOutput->aDeclarationEntry[i]; 1415 if (pDeclarationEntry->SemanticIndex == SemanticIndex) 1416 pDeclarationEntry->StartComponent -= MinStartComponent; 1417 } 1369 1418 } 1370 1419 … … 5638 5687 int rc = dxDefineStreamOutput(pThisCC, pDXContext, soid, pStreamOutputEntry, pDXShader); 5639 5688 AssertRCReturnVoid(rc); 5689 #ifdef LOG_ENABLED 5690 Log6(("Stream output declaration:\n\n")); 5691 Log6(("Stream SemanticName SemanticIndex StartComponent ComponentCount OutputSlot\n")); 5692 Log6(("------ -------------- ------------- -------------- -------------- ----------\n")); 5693 for (unsigned i = 0; i < pDXStreamOutput->cDeclarationEntry; ++i) 5694 { 5695 D3D11_SO_DECLARATION_ENTRY *p = &pDXStreamOutput->aDeclarationEntry[i]; 5696 Log6(("%d %-14s %d %d %d %d\n", 5697 p->Stream, p->SemanticName, p->SemanticIndex, p->StartComponent, p->ComponentCount, p->OutputSlot)); 5698 } 5699 Log6(("\n")); 5700 #endif 5701 5640 5702 } 5641 5703 }
Note:
See TracChangeset
for help on using the changeset viewer.