1 | /* $Id: GaDrvTest.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Gallium backend test for for early development stages.
|
---|
4 | * Use it only with kernel debugger attached to the VM.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2017-2023 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
27 | */
|
---|
28 |
|
---|
29 | #include "../VBoxDispD3DCmn.h"
|
---|
30 | #include "../VBoxDispD3D.h"
|
---|
31 |
|
---|
32 | #include "test/d3d9render.h"
|
---|
33 |
|
---|
34 | #include <iprt/asm.h>
|
---|
35 |
|
---|
36 | void GaDrvTest(IGalliumStack *pGalliumStack, PVBOXWDDMDISP_DEVICE pDevice)
|
---|
37 | {
|
---|
38 | ASMBreakpoint();
|
---|
39 |
|
---|
40 | DWORD fFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING
|
---|
41 | | D3DCREATE_FPU_PRESERVE;
|
---|
42 |
|
---|
43 | D3DPRESENT_PARAMETERS pp;
|
---|
44 | RT_ZERO(pp);
|
---|
45 | pp.BackBufferWidth = 1024;
|
---|
46 | pp.BackBufferHeight = 768;
|
---|
47 | pp.BackBufferFormat = D3DFMT_X8R8G8B8;
|
---|
48 | pp.BackBufferCount = 1;
|
---|
49 | pp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
---|
50 | pp.MultiSampleQuality = 0;
|
---|
51 | pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
---|
52 | pp.hDeviceWindow = 0;
|
---|
53 | pp.Windowed = TRUE;
|
---|
54 | pp.EnableAutoDepthStencil = TRUE;
|
---|
55 | pp.AutoDepthStencilFormat = D3DFMT_D24S8;
|
---|
56 | pp.Flags = 0;
|
---|
57 | pp.FullScreen_RefreshRateInHz = 0;
|
---|
58 | pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
---|
59 |
|
---|
60 | IDirect3DDevice9Ex *pDevice9 = NULL;
|
---|
61 | HRESULT hr = pGalliumStack->GaCreateDeviceEx(D3DDEVTYPE_HAL, NULL, fFlags, &pp, NULL,
|
---|
62 | pDevice->pAdapter->hAdapter, pDevice->hDevice, &pDevice->RtCallbacks,
|
---|
63 | &pDevice->pAdapter->AdapterInfo.u.vmsvga.HWInfo,
|
---|
64 | &pDevice9);
|
---|
65 | GaAssertHR(hr);
|
---|
66 |
|
---|
67 | if (SUCCEEDED(hr))
|
---|
68 | {
|
---|
69 | D3D9Render *pRender = CreateRender(3);
|
---|
70 |
|
---|
71 | if (pRender)
|
---|
72 | {
|
---|
73 | hr = pRender->InitRender(pDevice9);
|
---|
74 | GaAssertHR(hr);
|
---|
75 |
|
---|
76 | if (SUCCEEDED(hr))
|
---|
77 | {
|
---|
78 | /* Five times should be enough for a debugging session. */
|
---|
79 | int i;
|
---|
80 | for (i = 0; i < 5; ++i)
|
---|
81 | {
|
---|
82 | ASMBreakpoint();
|
---|
83 |
|
---|
84 | hr = pRender->DoRender(pDevice9);
|
---|
85 | GaAssertHR(hr);
|
---|
86 |
|
---|
87 | ASMBreakpoint();
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | DeleteRender(pRender);
|
---|
92 | }
|
---|
93 | else
|
---|
94 | {
|
---|
95 | AssertFailed();
|
---|
96 | }
|
---|
97 |
|
---|
98 | pDevice9->Release();
|
---|
99 | }
|
---|
100 |
|
---|
101 | ASMBreakpoint();
|
---|
102 | }
|
---|