Changeset 30563 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Jul 1, 2010 3:40:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30556 r30563 1645 1645 else 1646 1646 { 1647 AssertBreakpoint();1648 1647 hr = pDevice->pDevice9If->DrawPrimitive(pData->PrimitiveType, 1649 1648 pData->VStart, … … 2193 2192 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 2194 2193 { 2195 if (pRc->RcDesc.fFlags.Texture )2194 if (pRc->RcDesc.fFlags.Texture || pRc->RcDesc.fFlags.Value == 0) 2196 2195 { 2197 2196 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; … … 2396 2395 } 2397 2396 } 2397 else if (pRc->RcDesc.fFlags.IndexBuffer) 2398 { 2399 Assert(pData->SubResourceIndex < pRc->cAllocations); 2400 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 2401 IDirect3DIndexBuffer9 *pD3D9IBuf = (IDirect3DIndexBuffer9*)pAlloc->pD3DIf; 2402 BOOL bLocked = false; 2403 Assert(pD3D9IBuf); 2404 Assert(!pData->Flags.AreaValid); 2405 Assert(!pData->Flags.BoxValid); 2406 D3DDDIRANGE *pRange = NULL; 2407 if (pData->Flags.RangeValid) 2408 { 2409 pRange = &pData->Range; 2410 } 2411 2412 /* else - we lock the entire vertex buffer, pRect == NULL */ 2413 2414 Assert(!pAlloc->LockInfo.cLocks); 2415 if (!pAlloc->LockInfo.cLocks) 2416 { 2417 if (!pData->Flags.MightDrawFromLocked || (!pData->Flags.Discard && !pData->Flags.NoOverwrite)) 2418 { 2419 hr = pD3D9IBuf->Lock(pRange ? pRange->Offset : 0, 2420 pRange ? pRange->Size : 0, 2421 &pAlloc->LockInfo.LockedRect.pBits, 2422 vboxDDI2D3DLockFlags(pData->Flags)); 2423 bLocked = true; 2424 } 2425 2426 Assert(hr == S_OK); 2427 if (hr == S_OK) 2428 { 2429 pAlloc->LockInfo.LockedRect.Pitch = pAlloc->SurfDesc.width; 2430 // Assert(pLockAlloc->LockInfo.fFlags.Value == 0); 2431 pAlloc->LockInfo.fFlags = pData->Flags; 2432 if (pRange) 2433 { 2434 pAlloc->LockInfo.Range = *pRange; 2435 Assert(pAlloc->LockInfo.fFlags.RangeValid == 1); 2436 // pAlloc->LockInfo.fFlags.RangeValid = 1; 2437 } 2438 else 2439 { 2440 Assert(pAlloc->LockInfo.fFlags.RangeValid == 0); 2441 // pAlloc->LockInfo.fFlags.RangeValid = 0; 2442 } 2443 } 2444 } 2445 else 2446 { 2447 // Assert(pAlloc->LockInfo.fFlags.Value == pData->Flags.Value); 2448 // if (pAlloc->LockInfo.fFlags.Value != pData->Flags.Value) 2449 // { 2450 // } 2451 Assert(pAlloc->LockInfo.fFlags.RangeValid == pData->Flags.RangeValid); 2452 if (pAlloc->LockInfo.fFlags.RangeValid && pData->Flags.RangeValid) 2453 { 2454 Assert(pAlloc->LockInfo.Range.Offset == pData->Range.Offset); 2455 Assert(pAlloc->LockInfo.Range.Size == pData->Range.Size); 2456 } 2457 Assert(pAlloc->LockInfo.LockedRect.pBits); 2458 } 2459 2460 if (hr == S_OK) 2461 { 2462 ++pAlloc->LockInfo.cLocks; 2463 2464 if (!pData->Flags.NotifyOnly) 2465 { 2466 pData->pSurfData = pAlloc->LockInfo.LockedRect.pBits; 2467 pData->Pitch = pAlloc->LockInfo.LockedRect.Pitch; 2468 pData->SlicePitch = 0; 2469 Assert(pAlloc->SurfDesc.slicePitch == 0); 2470 Assert(!pAlloc->pvMem); 2471 } 2472 else 2473 { 2474 Assert(pAlloc->pvMem); 2475 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 2476 if (bLocked && !pData->Flags.Discard) 2477 { 2478 RECT r, *pr; 2479 if (pRange) 2480 { 2481 r.top = 0; 2482 r.left = pRange->Offset; 2483 r.bottom = 1; 2484 r.right = pRange->Offset + pRange->Size; 2485 pr = &r; 2486 } 2487 else 2488 pr = NULL; 2489 vboxWddmLockUnlockMemSynch(pAlloc, &pAlloc->LockInfo.LockedRect, pr, false /*bool bToLockInfo*/); 2490 } 2491 } 2492 } 2493 } 2398 2494 else 2399 2495 { … … 2485 2581 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 2486 2582 { 2487 if (pRc->RcDesc.fFlags.Texture )2583 if (pRc->RcDesc.fFlags.Texture || pRc->RcDesc.fFlags.Value == 0) 2488 2584 { 2489 2585 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2549 2645 Assert(hr == S_OK); 2550 2646 } 2647 else if (pRc->RcDesc.fFlags.IndexBuffer) 2648 { 2649 IDirect3DIndexBuffer9 *pD3D9IBuf = (IDirect3DIndexBuffer9*)pAlloc->pD3DIf; 2650 Assert(pD3D9IBuf); 2651 /* this is a sysmem texture, update */ 2652 if (pAlloc->pvMem && !pAlloc->LockInfo.fFlags.ReadOnly) 2653 { 2654 RECT r, *pr; 2655 if (pAlloc->LockInfo.fFlags.RangeValid) 2656 { 2657 r.top = 0; 2658 r.left = pAlloc->LockInfo.Range.Offset; 2659 r.bottom = 1; 2660 r.right = pAlloc->LockInfo.Range.Offset + pAlloc->LockInfo.Range.Size; 2661 pr = &r; 2662 } 2663 else 2664 pr = NULL; 2665 vboxWddmLockUnlockMemSynch(pAlloc, &pAlloc->LockInfo.LockedRect, 2666 pr, 2667 true /*bool bToLockInfo*/); 2668 } 2669 hr = pD3D9IBuf->Unlock(); 2670 Assert(hr == S_OK); 2671 } 2551 2672 else 2552 2673 { … … 2702 2823 } 2703 2824 2704 if (pResource->Flags.RenderTarget) 2825 if (pResource->Flags.ZBuffer) 2826 { 2827 Assert(pDevice->pDevice9If); 2828 for (UINT i = 0; i < pResource->SurfCount; ++i) 2829 { 2830 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 2831 IDirect3DSurface9 *pD3D9Surf; 2832 hr = pDevice->pDevice9If->CreateDepthStencilSurface(pAllocation->SurfDesc.width, 2833 pAllocation->SurfDesc.height, 2834 vboxDDI2D3DFormat(pResource->Format), 2835 vboxDDI2D3DMultiSampleType(pResource->MultisampleType), 2836 pResource->MultisampleQuality, 2837 TRUE /* @todo: BOOL Discard */, 2838 &pD3D9Surf, 2839 NULL /*HANDLE* pSharedHandle*/); 2840 Assert(hr == S_OK); 2841 if (hr == S_OK) 2842 { 2843 Assert(pD3D9Surf); 2844 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 2845 { 2846 Assert(pAllocation->pvMem); 2847 D3DLOCKED_RECT lockInfo; 2848 hr = pD3D9Surf->LockRect(&lockInfo, NULL, D3DLOCK_DISCARD); 2849 Assert(hr == S_OK); 2850 if (hr == S_OK) 2851 { 2852 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 2853 HRESULT tmpHr = pD3D9Surf->UnlockRect(); 2854 Assert(tmpHr == S_OK); 2855 } 2856 } 2857 else 2858 { 2859 Assert(!pAllocation->pvMem); 2860 } 2861 pAllocation->pD3DIf = pD3D9Surf; 2862 } 2863 else 2864 { 2865 for (UINT j = 0; j < i; ++j) 2866 { 2867 pRc->aAllocations[j].pD3DIf->Release(); 2868 } 2869 break; 2870 } 2871 } 2872 } 2873 else if (pResource->Flags.VertexBuffer) 2874 { 2875 Assert(pDevice->pDevice9If); 2876 for (UINT i = 0; i < pResource->SurfCount; ++i) 2877 { 2878 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 2879 IDirect3DVertexBuffer9 *pD3D9VBuf; 2880 hr = pDevice->pDevice9If->CreateVertexBuffer(pAllocation->SurfDesc.width, 2881 vboxDDI2D3DUsage(pResource->Flags), 2882 pResource->Fvf, 2883 vboxDDI2D3DPool(pResource->Pool), 2884 &pD3D9VBuf, 2885 NULL /*HANDLE* pSharedHandle*/); 2886 Assert(hr == S_OK); 2887 if (hr == S_OK) 2888 { 2889 Assert(pD3D9VBuf); 2890 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 2891 { 2892 Assert(pAllocation->pvMem); 2893 D3DLOCKED_RECT lockInfo; 2894 hr = pD3D9VBuf->Lock(0, pAllocation->SurfDesc.width, &lockInfo.pBits, D3DLOCK_DISCARD); 2895 Assert(hr == S_OK); 2896 if (hr == S_OK) 2897 { 2898 lockInfo.Pitch = pAllocation->SurfDesc.pitch; 2899 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 2900 HRESULT tmpHr = pD3D9VBuf->Unlock(); 2901 Assert(tmpHr == S_OK); 2902 } 2903 } 2904 else 2905 { 2906 Assert(!pAllocation->pvMem); 2907 } 2908 pAllocation->pD3DIf = pD3D9VBuf; 2909 } 2910 else 2911 { 2912 for (UINT j = 0; j < i; ++j) 2913 { 2914 pRc->aAllocations[j].pD3DIf->Release(); 2915 } 2916 break; 2917 } 2918 } 2919 } 2920 else if (pResource->Flags.IndexBuffer) 2921 { 2922 Assert(pDevice->pDevice9If); 2923 for (UINT i = 0; i < pResource->SurfCount; ++i) 2924 { 2925 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 2926 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 2927 IDirect3DIndexBuffer9 *pD3D9IBuf; 2928 hr = pDevice->pDevice9If->CreateIndexBuffer(pSurf->Width, 2929 vboxDDI2D3DUsage(pResource->Flags), 2930 vboxDDI2D3DFormat(pResource->Format), 2931 vboxDDI2D3DPool(pResource->Pool), 2932 &pD3D9IBuf, 2933 NULL /*HANDLE* pSharedHandle*/ 2934 ); 2935 Assert(hr == S_OK); 2936 if (hr == S_OK) 2937 { 2938 Assert(pD3D9IBuf); 2939 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 2940 { 2941 Assert(pAllocation->pvMem); 2942 D3DLOCKED_RECT lockInfo; 2943 hr = pD3D9IBuf->Lock(0, pAllocation->SurfDesc.width, &lockInfo.pBits, D3DLOCK_DISCARD); 2944 Assert(hr == S_OK); 2945 if (hr == S_OK) 2946 { 2947 lockInfo.Pitch = pAllocation->SurfDesc.pitch; 2948 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 2949 HRESULT tmpHr = pD3D9IBuf->Unlock(); 2950 Assert(tmpHr == S_OK); 2951 } 2952 } 2953 else 2954 { 2955 Assert(!pAllocation->pvMem); 2956 } 2957 pAllocation->pD3DIf = pD3D9IBuf; 2958 } 2959 else 2960 { 2961 for (UINT j = 0; j < i; ++j) 2962 { 2963 pRc->aAllocations[j].pD3DIf->Release(); 2964 } 2965 break; 2966 } 2967 } 2968 } 2969 else if (pResource->Flags.Texture || pResource->Flags.Value == 0) 2970 { 2971 Assert(pDevice->pDevice9If); 2972 #ifdef DEBUG 2973 { 2974 uint32_t tstW = pResource->pSurfList[0].Width; 2975 uint32_t tstH = pResource->pSurfList[0].Height; 2976 for (UINT i = 1; i < pResource->SurfCount; ++i) 2977 { 2978 tstW /= 2; 2979 tstH /= 2; 2980 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 2981 Assert(pSurf->Width == tstW); 2982 Assert(pSurf->Height == tstH); 2983 } 2984 } 2985 #endif 2986 2987 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 2988 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0]; 2989 IDirect3DTexture9 *pD3DIfTex; 2990 hr = pDevice->pDevice9If->CreateTexture(pSurf->Width, 2991 pSurf->Height, 2992 pResource->SurfCount, 2993 vboxDDI2D3DUsage(pResource->Flags), 2994 vboxDDI2D3DFormat(pResource->Format), 2995 vboxDDI2D3DPool(pResource->Pool), 2996 &pD3DIfTex, 2997 NULL /* HANDLE* pSharedHandle */ 2998 ); 2999 Assert(hr == S_OK); 3000 if (hr == S_OK) 3001 { 3002 Assert(pD3DIfTex); 3003 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3004 { 3005 for (UINT i = 0; i < pResource->SurfCount; ++i) 3006 { 3007 D3DLOCKED_RECT lockInfo; 3008 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 3009 Assert(pAllocation->pvMem); 3010 hr = pD3DIfTex->LockRect(i, &lockInfo, NULL, D3DLOCK_DISCARD); 3011 Assert(hr == S_OK); 3012 if (hr == S_OK) 3013 { 3014 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/); 3015 HRESULT tmpHr = pD3DIfTex->UnlockRect(i); 3016 Assert(tmpHr == S_OK); 3017 } 3018 else 3019 { 3020 pD3DIfTex->Release(); 3021 break; 3022 } 3023 } 3024 } 3025 pAllocation->pD3DIf = pD3DIfTex; 3026 } 3027 #ifdef DEBUG 3028 else 3029 { 3030 for (UINT i = 0; i < pResource->SurfCount; ++i) 3031 { 3032 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 3033 Assert(!pAllocation->pvMem); 3034 } 3035 } 3036 #endif 3037 } 3038 else if (pResource->Flags.RenderTarget) 2705 3039 { 2706 3040 HWND hWnd = NULL; … … 2815 3149 } 2816 3150 } 2817 else if (pResource->Flags.ZBuffer)2818 {2819 Assert(pDevice->pDevice9If);2820 for (UINT i = 0; i < pResource->SurfCount; ++i)2821 {2822 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];2823 IDirect3DSurface9 *pD3D9Surf;2824 hr = pDevice->pDevice9If->CreateDepthStencilSurface(pAllocation->SurfDesc.width,2825 pAllocation->SurfDesc.height,2826 vboxDDI2D3DFormat(pResource->Format),2827 vboxDDI2D3DMultiSampleType(pResource->MultisampleType),2828 pResource->MultisampleQuality,2829 TRUE /* @todo: BOOL Discard */,2830 &pD3D9Surf,2831 NULL /*HANDLE* pSharedHandle*/);2832 Assert(hr == S_OK);2833 if (hr == S_OK)2834 {2835 Assert(pD3D9Surf);2836 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)2837 {2838 Assert(pAllocation->pvMem);2839 D3DLOCKED_RECT lockInfo;2840 hr = pD3D9Surf->LockRect(&lockInfo, NULL, D3DLOCK_DISCARD);2841 Assert(hr == S_OK);2842 if (hr == S_OK)2843 {2844 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/);2845 HRESULT tmpHr = pD3D9Surf->UnlockRect();2846 Assert(tmpHr == S_OK);2847 }2848 }2849 else2850 {2851 Assert(!pAllocation->pvMem);2852 }2853 pAllocation->pD3DIf = pD3D9Surf;2854 }2855 else2856 {2857 for (UINT j = 0; j < i; ++j)2858 {2859 pRc->aAllocations[j].pD3DIf->Release();2860 }2861 break;2862 }2863 }2864 }2865 else if (pResource->Flags.VertexBuffer)2866 {2867 Assert(pDevice->pDevice9If);2868 for (UINT i = 0; i < pResource->SurfCount; ++i)2869 {2870 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];2871 IDirect3DVertexBuffer9 *pD3D9VBuf;2872 hr = pDevice->pDevice9If->CreateVertexBuffer(pAllocation->SurfDesc.width,2873 vboxDDI2D3DUsage(pResource->Flags),2874 pResource->Fvf,2875 vboxDDI2D3DPool(pResource->Pool),2876 &pD3D9VBuf,2877 NULL /*HANDLE* pSharedHandle*/);2878 Assert(hr == S_OK);2879 if (hr == S_OK)2880 {2881 Assert(pD3D9VBuf);2882 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)2883 {2884 Assert(pAllocation->pvMem);2885 D3DLOCKED_RECT lockInfo;2886 hr = pD3D9VBuf->Lock(0, pAllocation->SurfDesc.width, &lockInfo.pBits, D3DLOCK_DISCARD);2887 Assert(hr == S_OK);2888 if (hr == S_OK)2889 {2890 lockInfo.Pitch = pAllocation->SurfDesc.pitch;2891 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/);2892 HRESULT tmpHr = pD3D9VBuf->Unlock();2893 Assert(tmpHr == S_OK);2894 }2895 }2896 else2897 {2898 Assert(!pAllocation->pvMem);2899 }2900 pAllocation->pD3DIf = pD3D9VBuf;2901 }2902 else2903 {2904 for (UINT j = 0; j < i; ++j)2905 {2906 pRc->aAllocations[j].pD3DIf->Release();2907 }2908 break;2909 }2910 }2911 }2912 else if (pResource->Flags.IndexBuffer)2913 {2914 Assert(pDevice->pDevice9If);2915 for (UINT i = 0; i < pResource->SurfCount; ++i)2916 {2917 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];2918 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i];2919 IDirect3DIndexBuffer9 *pD3D9IBuf;2920 hr = pDevice->pDevice9If->CreateIndexBuffer(pSurf->Width,2921 vboxDDI2D3DUsage(pResource->Flags),2922 vboxDDI2D3DFormat(pResource->Format),2923 vboxDDI2D3DPool(pResource->Pool),2924 &pD3D9IBuf,2925 NULL /*HANDLE* pSharedHandle*/2926 );2927 Assert(hr == S_OK);2928 if (hr == S_OK)2929 {2930 Assert(pD3D9IBuf);2931 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)2932 {2933 Assert(pAllocation->pvMem);2934 D3DLOCKED_RECT lockInfo;2935 hr = pD3D9IBuf->Lock(0, pAllocation->SurfDesc.width, &lockInfo.pBits, D3DLOCK_DISCARD);2936 Assert(hr == S_OK);2937 if (hr == S_OK)2938 {2939 lockInfo.Pitch = pAllocation->SurfDesc.pitch;2940 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/);2941 HRESULT tmpHr = pD3D9IBuf->Unlock();2942 Assert(tmpHr == S_OK);2943 }2944 }2945 else2946 {2947 Assert(!pAllocation->pvMem);2948 }2949 pAllocation->pD3DIf = pD3D9IBuf;2950 }2951 else2952 {2953 for (UINT j = 0; j < i; ++j)2954 {2955 pRc->aAllocations[j].pD3DIf->Release();2956 }2957 break;2958 }2959 }2960 }2961 else if (pResource->Flags.Texture)2962 {2963 Assert(pDevice->pDevice9If);2964 #ifdef DEBUG2965 {2966 uint32_t tstW = pResource->pSurfList[0].Width;2967 uint32_t tstH = pResource->pSurfList[0].Height;2968 for (UINT i = 1; i < pResource->SurfCount; ++i)2969 {2970 tstW /= 2;2971 tstH /= 2;2972 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i];2973 Assert(pSurf->Width == tstW);2974 Assert(pSurf->Height == tstH);2975 }2976 }2977 #endif2978 2979 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];2980 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];2981 IDirect3DTexture9 *pD3DIfTex;2982 hr = pDevice->pDevice9If->CreateTexture(pSurf->Width,2983 pSurf->Height,2984 pResource->SurfCount,2985 vboxDDI2D3DUsage(pResource->Flags),2986 vboxDDI2D3DFormat(pResource->Format),2987 vboxDDI2D3DPool(pResource->Pool),2988 &pD3DIfTex,2989 NULL /* HANDLE* pSharedHandle */2990 );2991 Assert(hr == S_OK);2992 if (hr == S_OK)2993 {2994 Assert(pD3DIfTex);2995 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)2996 {2997 for (UINT i = 0; i < pResource->SurfCount; ++i)2998 {2999 D3DLOCKED_RECT lockInfo;3000 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];3001 Assert(pAllocation->pvMem);3002 hr = pD3DIfTex->LockRect(i, &lockInfo, NULL, D3DLOCK_DISCARD);3003 Assert(hr == S_OK);3004 if (hr == S_OK)3005 {3006 vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/);3007 HRESULT tmpHr = pD3DIfTex->UnlockRect(i);3008 Assert(tmpHr == S_OK);3009 }3010 else3011 {3012 pD3DIfTex->Release();3013 break;3014 }3015 }3016 }3017 pAllocation->pD3DIf = pD3DIfTex;3018 }3019 #ifdef DEBUG3020 else3021 {3022 for (UINT i = 0; i < pResource->SurfCount; ++i)3023 {3024 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];3025 Assert(!pAllocation->pvMem);3026 }3027 }3028 #endif3029 }3030 3151 else 3031 3152 { … … 3163 3284 Assert(pDevice->hWnd); 3164 3285 Assert(pDevice->pDevice9If); 3165 if (pDevice->pDevice9If)3166 {3167 pDevice->pDevice9If->Release();3168 HRESULT tmpHr = VBoxDispWndDestroy(pAdapter, pDevice->hWnd);3169 Assert(tmpHr == S_OK);3170 }3171 3286 } 3172 3287 … … 3500 3615 static HRESULT APIENTRY vboxWddmDDevBlt(HANDLE hDevice, CONST D3DDDIARG_BLT* pData) 3501 3616 { 3502 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3503 AssertBreakpoint(); 3504 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3505 return E_FAIL; 3617 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 3618 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 3619 Assert(pDevice); 3620 Assert(pDevice->pDevice9If); 3621 PVBOXWDDMDISP_RESOURCE pDstRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource; 3622 PVBOXWDDMDISP_RESOURCE pSrcRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource; 3623 HRESULT hr = S_OK; 3624 if ((pDstRc->RcDesc.fFlags.Texture || pDstRc->RcDesc.fFlags.Value == 0) 3625 && (pSrcRc->RcDesc.fFlags.Texture || pSrcRc->RcDesc.fFlags.Value == 0)) 3626 { 3627 IDirect3DTexture9 *pD3DIfSrcTex = (IDirect3DTexture9*)pSrcRc->aAllocations[0].pD3DIf; 3628 IDirect3DTexture9 *pD3DIfDstTex = (IDirect3DTexture9*)pDstRc->aAllocations[0].pD3DIf; 3629 Assert(pD3DIfSrcTex); 3630 Assert(pD3DIfDstTex); 3631 3632 if (pSrcRc->aAllocations[0].SurfDesc.width == pDstRc->aAllocations[0].SurfDesc.width 3633 && pSrcRc->aAllocations[0].SurfDesc.height == pDstRc->aAllocations[0].SurfDesc.height 3634 && pSrcRc->RcDesc.enmFormat == pDstRc->RcDesc.enmFormat) 3635 { 3636 /* first check if we can do IDirect3DDevice9::UpdateTexture */ 3637 if (pData->DstRect.left == 0 && pData->DstRect.top == 0 3638 && pData->SrcRect.left == 0 && pData->SrcRect.top == 0 3639 && pData->SrcRect.right - pData->SrcRect.left == pSrcRc->aAllocations[0].SurfDesc.width 3640 && pData->SrcRect.bottom - pData->SrcRect.top == pSrcRc->aAllocations[0].SurfDesc.height 3641 && pData->DstRect.right - pData->DstRect.left == pDstRc->aAllocations[0].SurfDesc.width 3642 && pData->DstRect.bottom - pData->DstRect.top == pDstRc->aAllocations[0].SurfDesc.height 3643 ) 3644 { 3645 hr = pDevice->pDevice9If->UpdateTexture(pD3DIfSrcTex, pD3DIfDstTex); 3646 Assert(hr == S_OK); 3647 } 3648 else 3649 { 3650 AssertBreakpoint(); 3651 /* @todo: impl */ 3652 } 3653 } 3654 else 3655 { 3656 AssertBreakpoint(); 3657 /* @todo: impl */ 3658 } 3659 } 3660 else 3661 { 3662 AssertBreakpoint(); 3663 /* @todo: impl */ 3664 } 3665 3666 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 3667 return hr; 3506 3668 } 3507 3669 static HRESULT APIENTRY vboxWddmDDevColorFill(HANDLE hDevice, CONST D3DDDIARG_COLORFILL* pData) … … 3758 3920 3759 3921 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 3922 PVBOXWDDMDISP_ADAPTER pAdapter = pDevice->pAdapter; 3923 if (pDevice->pDevice9If) 3924 { 3925 pDevice->pDevice9If->Release(); 3926 Assert(pDevice->hWnd); 3927 HRESULT tmpHr = VBoxDispWndDestroy(pAdapter, pDevice->hWnd); 3928 Assert(tmpHr == S_OK); 3929 } 3760 3930 HRESULT hr = vboxDispCmCtxDestroy(pDevice, &pDevice->DefaultContext); 3761 3931 Assert(hr == S_OK);
Note:
See TracChangeset
for help on using the changeset viewer.