Changeset 98052 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jan 11, 2023 5:57:27 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp
r97722 r98052 2442 2442 dxgiFormat = dxgiFormatTypeless; 2443 2443 2444 /* Format for staging resource is always the typeless one. */ 2445 DXGI_FORMAT const dxgiFormatStaging = dxgiFormatTypeless; 2446 2447 DXGI_FORMAT dxgiFormatDynamic; 2448 /* Some drivers do not allow to use depth typeless formats for dynamic resources. 2449 * Create a placeholder texture (it does not work with CopySubresource). 2450 */ 2451 /** @todo Implement upload from such textures. */ 2452 if (dxgiFormatTypeless == DXGI_FORMAT_R24G8_TYPELESS) 2453 dxgiFormatDynamic = DXGI_FORMAT_R32_UINT; 2454 else if (dxgiFormatTypeless == DXGI_FORMAT_R32G8X24_TYPELESS) 2455 dxgiFormatDynamic = DXGI_FORMAT_R32G32_UINT; 2456 else 2457 dxgiFormatDynamic = dxgiFormatTypeless; 2458 2444 2459 /* 2445 2460 * Create D3D11 texture object. … … 2489 2504 { 2490 2505 /* Map-able texture. */ 2491 td.Format = dxgiFormat Typeless;2506 td.Format = dxgiFormatDynamic; 2492 2507 td.Usage = D3D11_USAGE_DYNAMIC; 2493 2508 td.BindFlags = D3D11_BIND_SHADER_RESOURCE; /* Have to specify a supported flag, otherwise E_INVALIDARG will be returned. */ … … 2501 2516 { 2502 2517 /* Staging texture. */ 2518 td.Format = dxgiFormatStaging; 2503 2519 td.Usage = D3D11_USAGE_STAGING; 2504 2520 td.BindFlags = 0; /* No flags allowed. */ … … 2545 2561 { 2546 2562 /* Map-able texture. */ 2547 td.Format = dxgiFormat Typeless;2563 td.Format = dxgiFormatDynamic; 2548 2564 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2549 2565 td.ArraySize = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ … … 2559 2575 { 2560 2576 /* Staging texture. */ 2577 td.Format = dxgiFormatStaging; 2561 2578 td.Usage = D3D11_USAGE_STAGING; 2562 2579 td.BindFlags = 0; /* No flags allowed. */ … … 2601 2618 { 2602 2619 /* Map-able texture. */ 2603 td.Format = dxgiFormat Typeless;2620 td.Format = dxgiFormatDynamic; 2604 2621 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2605 2622 td.ArraySize = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ … … 2615 2632 { 2616 2633 /* Staging texture. */ 2634 td.Format = dxgiFormatStaging; 2617 2635 td.Usage = D3D11_USAGE_STAGING; 2618 2636 td.BindFlags = 0; /* No flags allowed. */ … … 2661 2679 { 2662 2680 /* Map-able texture. */ 2663 td.Format = dxgiFormat Typeless;2681 td.Format = dxgiFormatDynamic; 2664 2682 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2665 2683 td.Usage = D3D11_USAGE_DYNAMIC; … … 2674 2692 { 2675 2693 /* Staging texture. */ 2694 td.Format = dxgiFormatStaging; 2676 2695 td.Usage = D3D11_USAGE_STAGING; 2677 2696 td.BindFlags = 0; /* No flags allowed. */ … … 2720 2739 { 2721 2740 /* Map-able texture. */ 2722 td.Format = dxgiFormat Typeless;2741 td.Format = dxgiFormatDynamic; 2723 2742 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2724 2743 td.ArraySize = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ … … 2734 2753 { 2735 2754 /* Staging texture. */ 2755 td.Format = dxgiFormatStaging; 2736 2756 td.Usage = D3D11_USAGE_STAGING; 2737 2757 td.BindFlags = 0; /* No flags allowed. */ … … 2750 2770 } 2751 2771 } 2772 } 2773 2774 if (hr == DXGI_ERROR_DEVICE_REMOVED) 2775 { 2776 DEBUG_BREAKPOINT_TEST(); 2777 hr = pDXDevice->pDevice->GetDeviceRemovedReason(); 2752 2778 } 2753 2779 … … 3775 3801 else if (pBackendSurface->enmResType == VMSVGA3D_RESTYPE_BUFFER) 3776 3802 { 3803 Log4(("Unmap buffer sid = %u:\n%.*Rhxd\n", pSurface->id, pMap->cbRow, pMap->pvData)); 3804 3777 3805 /* Unmap the staging buffer. */ 3778 3806 UINT const Subresource = 0; /* Buffers have only one subresource. */ … … 5970 5998 || pBufferContext->offset != pBufferPipeline->offset) 5971 5999 { 5972 LogFunc(("vertex buffer: [%u]: sid = %u, %p -> %p\n", 5973 i, pDXContext->svgaDXContext.inputAssembly.vertexBuffers[i].bufferId, pBufferPipeline->pBuffer, pBufferContext->pBuffer)); 6000 LogFunc(("vertex buffer: [%u]: sid = %u, %p (stride %d, off %d) -> %p (stride %d, off %d)\n", 6001 i, pDXContext->svgaDXContext.inputAssembly.vertexBuffers[i].bufferId, 6002 pBufferPipeline->pBuffer, pBufferPipeline->stride, pBufferPipeline->offset, 6003 pBufferContext->pBuffer, pBufferContext->stride, pBufferContext->offset)); 5974 6004 5975 6005 if (pBufferContext->pBuffer != pBufferPipeline->pBuffer) … … 5983 6013 idxMaxSlot = i; 5984 6014 } 6015 #ifdef LOG_ENABLED 6016 else if (pBufferContext->pBuffer) 6017 { 6018 LogFunc(("vertex buffer: [%u]: sid = %u, %p (stride %d, off %d)\n", 6019 i, pDXContext->svgaDXContext.inputAssembly.vertexBuffers[i].bufferId, 6020 pBufferContext->pBuffer, pBufferContext->stride, pBufferContext->offset)); 6021 } 6022 #endif 5985 6023 5986 6024 paResources[i] = pBufferContext->pBuffer; … … 5997 6035 } 5998 6036 6037 LogFunc(("idxMaxSlot = %d\n", idxMaxSlot)); 5999 6038 if (idxMaxSlot >= 0) 6000 6039 pDXDevice->pImmediateContext->IASetVertexBuffers(0, idxMaxSlot + 1, paResources, paStride, paOffset); … … 7611 7650 pDevice->pImmediateContext->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ, 7612 7651 pSrcResource, SrcSubresource, &SrcBox); 7652 7653 #ifdef DUMP_BITMAPS 7654 SVGA3dSurfaceImageId image; 7655 image.sid = pDstSurface->id; 7656 image.face = 0; 7657 image.mipmap = 0; 7658 VMSVGA3D_MAPPED_SURFACE map; 7659 int rc2 = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map); 7660 if (RT_SUCCESS(rc2)) 7661 { 7662 vmsvga3dMapWriteBmpFile(&map, "copyregion-"); 7663 vmsvga3dSurfaceUnmap(pThisCC, &image, &map, /* fWritten = */ false); 7664 } 7665 else 7666 Log(("Map failed %Rrc\n", rc)); 7667 #endif 7613 7668 7614 7669 pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
Note:
See TracChangeset
for help on using the changeset viewer.