Changeset 100066 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 4, 2023 10:32:59 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp
r100008 r100066 6268 6268 break; 6269 6269 } 6270 case DXGI_FORMAT_R32G32_SINT: 6271 { 6272 int32_t const *pValues = (int32_t const *)pvElementData; 6273 Log8(("{ %d, %d },", 6274 pValues[0], pValues[1])); 6275 break; 6276 } 6277 case DXGI_FORMAT_R32G32_UINT: 6278 { 6279 uint32_t const *pValues = (uint32_t const *)pvElementData; 6280 Log8(("{ %u, %u },", 6281 pValues[0], pValues[1])); 6282 break; 6283 } 6284 case DXGI_FORMAT_R32_SINT: 6285 { 6286 int32_t const *pValues = (int32_t const *)pvElementData; 6287 Log8(("{ %d },", 6288 pValues[0])); 6289 break; 6290 } 6291 case DXGI_FORMAT_R32_UINT: 6292 { 6293 uint32_t const *pValues = (uint32_t const *)pvElementData; 6294 Log8(("{ %u },", 6295 pValues[0])); 6296 break; 6297 } 6270 6298 case DXGI_FORMAT_R16G16_SINT: 6271 6299 { … … 6304 6332 6305 6333 6306 static void dxDbgDumpVert ices_Draw(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t vertexCount, uint32_t startVertexLocation)6334 static void dxDbgDumpVertexData(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t vertexCount, uint32_t startVertexLocation) 6307 6335 { 6308 6336 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; … … 6366 6394 6367 6395 6368 static void dxDbgDump Vertices_DrawIndexed(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t indexCount, uint32_t startIndexLocation, int32_t baseVertexLocation)6396 static void dxDbgDumpIndexedVertexData(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t indexCount, uint32_t startIndexLocation, int32_t baseVertexLocation) 6369 6397 { 6370 6398 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 6371 6399 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 6372 6400 SVGA3dSurfaceImageId image; 6373 //DEBUG_BREAKPOINT_TEST(); 6401 6374 6402 DXBOUNDINDEXBUFFER *pIB = &pBackend->resources.inputAssembly.indexBuffer; 6375 6403 uint32_t const sidIB = pDXContext->svgaDXContext.inputAssembly.indexBufferSid; … … 6436 6464 { 6437 6465 D3D11_INPUT_ELEMENT_DESC *pElement = &pDXElementLayout->aElementDesc[iElement]; 6466 if (pElement->InputSlotClass != D3D11_INPUT_PER_VERTEX_DATA) 6467 continue; 6468 6438 6469 if (pElement->InputSlot == iSlot) 6439 6470 { … … 6455 6486 RTMemFree(pvIndexBuffer); 6456 6487 } 6488 } 6489 6490 6491 static void dxDbgDumpInstanceData(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t instanceCount, uint32_t startInstanceLocation) 6492 { 6493 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 6494 SVGA3dSurfaceImageId image; 6495 6496 /* 6497 * Dump per-instance data. 6498 */ 6499 for (uint32_t iInstance = 0; iInstance < instanceCount; ++iInstance) 6500 { 6501 for (uint32_t iSlot = 0; iSlot < SVGA3D_DX_MAX_VERTEXBUFFERS; ++iSlot) 6502 { 6503 DXBOUNDVERTEXBUFFER *pVB = &pBackend->resources.inputAssembly.vertexBuffers[iSlot]; 6504 uint32_t const sidVB = pDXContext->svgaDXContext.inputAssembly.vertexBuffers[iSlot].bufferId; 6505 if (sidVB == SVGA3D_INVALID_ID) 6506 { 6507 Assert(pVB->pBuffer == 0); 6508 continue; 6509 } 6510 6511 Assert(pVB->pBuffer); 6512 6513 image.sid = sidVB; 6514 image.face = 0; 6515 image.mipmap = 0; 6516 6517 VMSVGA3D_MAPPED_SURFACE mapVB; 6518 int rc = vmsvga3dBackSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapVB); 6519 AssertRC(rc); 6520 if (RT_SUCCESS(rc)) 6521 { 6522 uint8_t const *pu8VertexData = (uint8_t *)mapVB.pvData; 6523 pu8VertexData += pVB->offset; 6524 pu8VertexData += startInstanceLocation * pVB->stride; 6525 6526 SVGA3dElementLayoutId const elementLayoutId = pDXContext->svgaDXContext.inputAssembly.layoutId; 6527 DXELEMENTLAYOUT *pDXElementLayout = &pDXContext->pBackendDXContext->paElementLayout[elementLayoutId]; 6528 Assert(pDXElementLayout->cElementDesc > 0); 6529 6530 Log8(("Instance data dump: sid = %u, iInstance %u, startInstanceLocation %d, offset = %d, stride = %d:\n", 6531 sidVB, iInstance, startInstanceLocation, pVB->offset, pVB->stride)); 6532 6533 Log8(("slot[%u] i%u { ", iSlot, iInstance)); 6534 for (uint32_t iElement = 0; iElement < pDXElementLayout->cElementDesc; ++iElement) 6535 { 6536 D3D11_INPUT_ELEMENT_DESC *pElement = &pDXElementLayout->aElementDesc[iElement]; 6537 if (pElement->InputSlotClass != D3D11_INPUT_PER_INSTANCE_DATA) 6538 continue; 6539 6540 if (pElement->InputSlot == iSlot) 6541 { 6542 uint8_t const *pu8Vertex = pu8VertexData + iInstance * pVB->stride; 6543 dxDbgLogVertexElement(pElement->Format, pu8Vertex + pElement->AlignedByteOffset); 6544 } 6545 } 6546 Log8((" }\n")); 6547 6548 vmsvga3dBackSurfaceUnmap(pThisCC, &image, &mapVB, /* fWritten = */ false); 6549 } 6550 } 6551 } 6552 } 6553 6554 static void dxDbgDumpVertices_Draw(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t vertexCount, uint32_t startVertexLocation) 6555 { 6556 dxDbgDumpVertexData(pThisCC, pDXContext, vertexCount, startVertexLocation); 6557 } 6558 6559 6560 static void dxDbgDumpVertices_DrawIndexed(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t indexCount, uint32_t startIndexLocation, int32_t baseVertexLocation) 6561 { 6562 dxDbgDumpIndexedVertexData(pThisCC, pDXContext, indexCount, startIndexLocation, baseVertexLocation); 6563 } 6564 6565 6566 static void dxDbgDumpVertices_DrawInstanced(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, 6567 uint32_t vertexCountPerInstance, uint32_t instanceCount, 6568 uint32_t startVertexLocation, uint32_t startInstanceLocation) 6569 { 6570 dxDbgDumpVertexData(pThisCC, pDXContext, vertexCountPerInstance, startVertexLocation); 6571 dxDbgDumpInstanceData(pThisCC, pDXContext, instanceCount, startInstanceLocation); 6572 } 6573 6574 6575 static void dxDbgDumpVertices_DrawIndexedInstanced(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, 6576 uint32_t indexCountPerInstance, uint32_t instanceCount, 6577 uint32_t startIndexLocation, int32_t baseVertexLocation, 6578 uint32_t startInstanceLocation) 6579 { 6580 dxDbgDumpIndexedVertexData(pThisCC, pDXContext, indexCountPerInstance, startIndexLocation, baseVertexLocation); 6581 dxDbgDumpInstanceData(pThisCC, pDXContext, instanceCount, startInstanceLocation); 6457 6582 } 6458 6583 #endif … … 7226 7351 dxSetupPipeline(pThisCC, pDXContext); 7227 7352 7353 #ifdef LOG_ENABLED 7354 if (LogIs8Enabled()) 7355 dxDbgDumpVertices_DrawInstanced(pThisCC, pDXContext, vertexCountPerInstance, instanceCount, startVertexLocation, startInstanceLocation); 7356 #endif 7357 7228 7358 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN); 7229 7359 … … 7251 7381 7252 7382 dxSetupPipeline(pThisCC, pDXContext); 7383 7384 #ifdef LOG_ENABLED 7385 if (LogIs8Enabled()) 7386 dxDbgDumpVertices_DrawIndexedInstanced(pThisCC, pDXContext, indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation); 7387 #endif 7253 7388 7254 7389 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN);
Note:
See TracChangeset
for help on using the changeset viewer.