VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11render.h

Last change on this file was 103983, checked in by vboxsync, 2 months ago

WDDM: D3D11 test

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: d3d11render.h 103983 2024-03-21 12:06:03Z vboxsync $ */
2/** @file
3 * Gallium D3D testcase. Interface for D3D11 tests.
4 */
5
6/*
7 * Copyright (C) 2017-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_test_d3d11render_h
29#define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_test_d3d11render_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <d3d11_1.h>
35
36#include <iprt/asm.h>
37#include <iprt/cdefs.h>
38#include <iprt/string.h>
39
40#define D3D_RELEASE(ptr) do { \
41 if (ptr) \
42 { \
43 (ptr)->Release(); \
44 (ptr) = 0; \
45 } \
46} while (0)
47
48#define D3D_RELEASE_ARRAY(a_Count, a_papArray) do { \
49 for (uint32_t i = 0; i < (a_Count); ++i) \
50 D3D_RELEASE((a_papArray)[i]); \
51} while (0)
52
53inline void D3DTestShowError(HRESULT hr, const char *pszString)
54{
55 (void)hr;
56 MessageBoxA(0, pszString, 0, 0);
57}
58
59/* Expand __LINE__ number to string. */
60#define D3DTEST_S(n) #n
61#define D3DTEST_N2S(n) D3DTEST_S(n)
62
63#define D3DAssertHR(_hr) do { if (FAILED(_hr)) D3DTestShowError((_hr), __FILE__ "@" D3DTEST_N2S(__LINE__)); } while(0)
64
65#define HTEST(a) do { \
66 hr = a; \
67 D3DAssertHR(hr); \
68} while (0)
69
70class D3D11DeviceProvider
71{
72public:
73 virtual ~D3D11DeviceProvider() {}
74 virtual ID3D11Device *Device() = 0;
75 virtual ID3D11DeviceContext *ImmediateContext() = 0;
76 virtual ID3D11RenderTargetView *RenderTargetView() = 0;
77 virtual ID3D11DepthStencilView *DepthStencilView() = 0;
78};
79
80class D3D11Render
81{
82public:
83 D3D11Render() {}
84 virtual ~D3D11Render() {}
85 virtual HRESULT InitRender(D3D11DeviceProvider *pDP) = 0;
86 virtual HRESULT DoRender(D3D11DeviceProvider *pDP) = 0;
87 virtual void TimeAdvance(float dt) { (void)dt; return; }
88 virtual bool IsDepthStencilBufferRequired(D3D11DeviceProvider *pDP) { (void)pDP; return true; }
89 virtual bool IsDirectOutputRequired(D3D11DeviceProvider *pDP) { (void)pDP; return false; }
90};
91
92D3D11Render *CreateRender(int iRenderId);
93void DeleteRender(D3D11Render *pRender);
94
95uint8_t *readBmpFile(char const *pszFilename, uint32_t cbPixel, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pcbData);
96
97#endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_test_d3d11render_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use