1 | /* $Id: VBoxDXDDI.cpp 102809 2024-01-10 08:18:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox D3D11 user mode DDI interface.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020-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 | #define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
|
---|
29 |
|
---|
30 | #include <iprt/alloc.h>
|
---|
31 | #include <iprt/errcore.h>
|
---|
32 | #include <iprt/initterm.h>
|
---|
33 | #include <VBox/log.h>
|
---|
34 |
|
---|
35 | #include <iprt/win/windows.h>
|
---|
36 | #include <iprt/win/d3dkmthk.h>
|
---|
37 |
|
---|
38 | #include <d3d10umddi.h>
|
---|
39 | #include <Psapi.h>
|
---|
40 |
|
---|
41 | #include "VBoxDX.h"
|
---|
42 |
|
---|
43 | #include <VBoxWddmUmHlp.h>
|
---|
44 |
|
---|
45 | RTDECL(void) RTLogWriteUser(const char* pachChars, size_t cbChars)
|
---|
46 | {
|
---|
47 | RT_NOREF(cbChars);
|
---|
48 |
|
---|
49 | if (pachChars)
|
---|
50 | VBoxWddmUmLog(pachChars /*, cbChars */);
|
---|
51 | }
|
---|
52 | //RT_EXPORT_SYMBOL(RTLogWriteUser);
|
---|
53 |
|
---|
54 |
|
---|
55 | static uint64_t const g_aSupportedDDIInterfaceVersions[] =
|
---|
56 | {
|
---|
57 | D3D10_0_DDI_SUPPORTED,
|
---|
58 | D3D10_1_DDI_SUPPORTED,
|
---|
59 | D3D11_0_DDI_SUPPORTED,
|
---|
60 | D3D11_1_DDI_SUPPORTED
|
---|
61 | };
|
---|
62 |
|
---|
63 |
|
---|
64 | static bool isInterfaceSupported(UINT uInterface)
|
---|
65 | {
|
---|
66 | for (unsigned i = 0; i < RT_ELEMENTS(g_aSupportedDDIInterfaceVersions); ++i)
|
---|
67 | {
|
---|
68 | uint32_t const uSupportedInterface = (uint32_t)(g_aSupportedDDIInterfaceVersions[i] >> 32);
|
---|
69 | if (uSupportedInterface == uInterface)
|
---|
70 | return true;
|
---|
71 | }
|
---|
72 | return false;
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * Helpers.
|
---|
78 | */
|
---|
79 |
|
---|
80 | static HRESULT vboxDXQueryAdapterInfo(D3D10DDIARG_OPENADAPTER const *pOpenData, VBOXWDDM_QAI **ppAdapterInfo)
|
---|
81 | {
|
---|
82 | VBOXWDDM_QAI *pAdapterInfo = (VBOXWDDM_QAI *)RTMemAllocZ(sizeof(VBOXWDDM_QAI));
|
---|
83 | AssertReturn(pAdapterInfo, E_OUTOFMEMORY);
|
---|
84 |
|
---|
85 | D3DDDICB_QUERYADAPTERINFO DdiQuery;
|
---|
86 | DdiQuery.PrivateDriverDataSize = sizeof(VBOXWDDM_QAI);
|
---|
87 | DdiQuery.pPrivateDriverData = pAdapterInfo;
|
---|
88 | HRESULT hr = pOpenData->pAdapterCallbacks->pfnQueryAdapterInfoCb(pOpenData->hRTAdapter.handle, &DdiQuery);
|
---|
89 | AssertReturnStmt(SUCCEEDED(hr), RTMemFree(pAdapterInfo), hr);
|
---|
90 |
|
---|
91 | /** @todo Check that the miniport version matches display version. */
|
---|
92 | *ppAdapterInfo = pAdapterInfo;
|
---|
93 |
|
---|
94 | return hr;
|
---|
95 | }
|
---|
96 |
|
---|
97 | static HRESULT vboxDXAdapterInit(D3D10DDIARG_OPENADAPTER const* pOpenData, VBOXWDDM_QAI* pAdapterInfo,
|
---|
98 | PVBOXDXADAPTER* ppAdapter)
|
---|
99 | {
|
---|
100 | VBOXGAHWINFO *pHWInfo = &pAdapterInfo->u.vmsvga.HWInfo;
|
---|
101 | if ( pHWInfo->u32HwType != VBOX_GA_HW_TYPE_VMSVGA
|
---|
102 | || pHWInfo->u.svga.au32Caps[SVGA3D_DEVCAP_DXCONTEXT] == 0)
|
---|
103 | {
|
---|
104 | /* The host does not support DX. */
|
---|
105 | AssertFailedReturn(E_FAIL);
|
---|
106 | }
|
---|
107 |
|
---|
108 | PVBOXDXADAPTER pAdapter = (PVBOXDXADAPTER)RTMemAllocZ(sizeof(VBOXDXADAPTER));
|
---|
109 |
|
---|
110 | AssertReturn(pAdapter, E_OUTOFMEMORY);
|
---|
111 |
|
---|
112 | pAdapter->hRTAdapter = pOpenData->hRTAdapter.handle;
|
---|
113 | pAdapter->uIfVersion = pOpenData->Interface;
|
---|
114 | pAdapter->uRtVersion = pOpenData->Version;
|
---|
115 | pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks;
|
---|
116 | pAdapter->enmHwType = pAdapterInfo->enmHwType;
|
---|
117 |
|
---|
118 | pAdapter->AdapterInfo = *pAdapterInfo;
|
---|
119 | pAdapter->f3D = true;
|
---|
120 |
|
---|
121 | pAdapter->fVBoxCaps = pHWInfo->u.svga.au32Caps[SVGA3D_DEVCAP_3D];
|
---|
122 |
|
---|
123 | *ppAdapter = pAdapter;
|
---|
124 |
|
---|
125 | return S_OK;
|
---|
126 | }
|
---|
127 |
|
---|
128 |
|
---|
129 | /*
|
---|
130 | * Device functions.
|
---|
131 | */
|
---|
132 |
|
---|
133 | static void APIENTRY ddi11_1DefaultConstantBufferUpdateSubresourceUP(
|
---|
134 | D3D10DDI_HDEVICE hDevice,
|
---|
135 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
136 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
137 | const D3D10_DDI_BOX* pDstBox, // The region of the destination subresource to copy data to.
|
---|
138 | const VOID* pSysMemUP, // A pointer to the source data used to update the dest subresouce.
|
---|
139 | UINT RowPitch, // The offset, in bytes, to move to the next row of source data.
|
---|
140 | UINT DepthPitch, // The offset, in bytes, to move to the next depth slice of source data.
|
---|
141 | UINT CopyFlags // A bitwise OR of the values in the D3D11_1_DDI_COPY_FLAGS
|
---|
142 | )
|
---|
143 | {
|
---|
144 | //DEBUG_BREAKPOINT_TEST();
|
---|
145 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
146 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
147 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, pDstBox %p, pSysMemUP %p, RowPitch %d, DepthPitch %d, CopyFlags 0x%x",
|
---|
148 | pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, CopyFlags));
|
---|
149 |
|
---|
150 | vboxDXResourceUpdateSubresourceUP(pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, CopyFlags);
|
---|
151 | }
|
---|
152 |
|
---|
153 | static void APIENTRY ddi10DefaultConstantBufferUpdateSubresourceUP(
|
---|
154 | D3D10DDI_HDEVICE hDevice,
|
---|
155 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
156 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
157 | const D3D10_DDI_BOX* pDstBox, // The region of the destination subresource to copy data to.
|
---|
158 | const VOID* pSysMemUP, // A pointer to the source data used to update the dest subresouce.
|
---|
159 | UINT RowPitch, // The offset, in bytes, to move to the next row of source data.
|
---|
160 | UINT DepthPitch // The offset, in bytes, to move to the next depth slice of source data.
|
---|
161 | )
|
---|
162 | {
|
---|
163 | //DEBUG_BREAKPOINT_TEST();
|
---|
164 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
165 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
166 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, pDstBox %p, pSysMemUP %p, RowPitch %d, DepthPitch %d",
|
---|
167 | pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch));
|
---|
168 |
|
---|
169 | vboxDXResourceUpdateSubresourceUP(pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, 0);
|
---|
170 | }
|
---|
171 |
|
---|
172 | static void APIENTRY ddi11_1VsSetConstantBuffers(
|
---|
173 | D3D10DDI_HDEVICE hDevice,
|
---|
174 | UINT StartSlot, // The starting constant buffer to set.
|
---|
175 | UINT NumBuffers, // The total number of buffers to set.
|
---|
176 | const D3D10DDI_HRESOURCE* phBuffers, // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
177 | const UINT* pFirstConstant, // A pointer to the first constant in the buffer pointed to by StartBuffer.
|
---|
178 | const UINT* pNumConstants // The number of constants in the buffer pointed to by StartBuffer.
|
---|
179 | )
|
---|
180 | {
|
---|
181 | //DEBUG_BREAKPOINT_TEST();
|
---|
182 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
183 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
184 |
|
---|
185 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_VS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
186 | }
|
---|
187 |
|
---|
188 | static void APIENTRY ddi10VsSetConstantBuffers(
|
---|
189 | D3D10DDI_HDEVICE hDevice,
|
---|
190 | UINT StartSlot, // The starting constant buffer to set.
|
---|
191 | UINT NumBuffers, // The total number of buffers to set.
|
---|
192 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
193 | )
|
---|
194 | {
|
---|
195 | //DEBUG_BREAKPOINT_TEST();
|
---|
196 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
197 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
198 |
|
---|
199 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_VS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
200 | }
|
---|
201 |
|
---|
202 | static void APIENTRY ddi10PsSetShaderResources(
|
---|
203 | D3D10DDI_HDEVICE hDevice,
|
---|
204 | UINT StartSlot, // The offset to the first view to set.
|
---|
205 | UINT NumViews, // The total number of views to set.
|
---|
206 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews // An array of handles to the shader resource views
|
---|
207 | )
|
---|
208 | {
|
---|
209 | //DEBUG_BREAKPOINT_TEST();
|
---|
210 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
211 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
212 |
|
---|
213 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_PS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
214 | }
|
---|
215 |
|
---|
216 | static void APIENTRY ddi10PsSetShader(
|
---|
217 | D3D10DDI_HDEVICE hDevice,
|
---|
218 | D3D10DDI_HSHADER hShader // A handle to the pixel shader code object.
|
---|
219 | )
|
---|
220 | {
|
---|
221 | //DEBUG_BREAKPOINT_TEST();
|
---|
222 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
223 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
224 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
225 |
|
---|
226 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_PS, pShader);
|
---|
227 | }
|
---|
228 |
|
---|
229 | static void APIENTRY ddi10PsSetSamplers(
|
---|
230 | D3D10DDI_HDEVICE hDevice,
|
---|
231 | UINT StartSlot, // The offset to the first sampler to set.
|
---|
232 | UINT NumSamplers, // The total number of samplers to set.
|
---|
233 | const D3D10DDI_HSAMPLER* phSamplers // An array of handles to the samplers.
|
---|
234 | )
|
---|
235 | {
|
---|
236 | //DEBUG_BREAKPOINT_TEST();
|
---|
237 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
238 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
239 |
|
---|
240 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
241 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
242 |
|
---|
243 | /* Fetch sampler ids. */
|
---|
244 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
245 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
246 | {
|
---|
247 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
248 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
249 | }
|
---|
250 |
|
---|
251 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_PS, StartSlot, NumSamplers, aSamplerIds);
|
---|
252 | }
|
---|
253 |
|
---|
254 | static void APIENTRY ddi10VsSetShader(
|
---|
255 | D3D10DDI_HDEVICE hDevice,
|
---|
256 | D3D10DDI_HSHADER hShader // A handle to the vertex shader code object.
|
---|
257 | )
|
---|
258 | {
|
---|
259 | //DEBUG_BREAKPOINT_TEST();
|
---|
260 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
261 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
262 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
263 |
|
---|
264 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_VS, pShader);
|
---|
265 | }
|
---|
266 |
|
---|
267 | static void APIENTRY ddi10DrawIndexed(
|
---|
268 | D3D10DDI_HDEVICE hDevice,
|
---|
269 | UINT IndexCount, // The number of indexes in the index buffer that indexes are read from to draw the primitives.
|
---|
270 | UINT StartIndexLocation, // The first index in the index buffer that indexes are read from to draw the primitives.
|
---|
271 | INT BaseVertexLocation // The number that should be added to each index that is referenced by the various primitives
|
---|
272 | // to determine the actual index of the vertex elements in each vertex stream.
|
---|
273 | )
|
---|
274 | {
|
---|
275 | //DEBUG_BREAKPOINT_TEST();
|
---|
276 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
277 | LogFlowFunc(("pDevice = %p, StartIndexLocation = %u, BaseVertexLocation = %u, IndexCount = %u\n", pDevice, StartIndexLocation, BaseVertexLocation, IndexCount));
|
---|
278 |
|
---|
279 | vboxDXDrawIndexed(pDevice, IndexCount, StartIndexLocation, BaseVertexLocation);
|
---|
280 | }
|
---|
281 |
|
---|
282 | static void APIENTRY ddi10Draw(
|
---|
283 | D3D10DDI_HDEVICE hDevice,
|
---|
284 | UINT VertexCount, // The number of vertices in the vertex buffer to draw the primitives.
|
---|
285 | UINT StartVertexLocation // The first vertex in the vertex buffer to draw the primitives.
|
---|
286 | )
|
---|
287 | {
|
---|
288 | //DEBUG_BREAKPOINT_TEST();
|
---|
289 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
290 | LogFlowFunc(("pDevice = %p, VertexCount = %u, StartVertexLocation = %u\n", pDevice, VertexCount, StartVertexLocation));
|
---|
291 |
|
---|
292 | vboxDXDraw(pDevice, VertexCount, StartVertexLocation);
|
---|
293 | }
|
---|
294 |
|
---|
295 | static void APIENTRY ddi10DynamicIABufferMapNoOverwrite(
|
---|
296 | D3D10DDI_HDEVICE hDevice,
|
---|
297 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
298 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
299 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
300 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
301 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
302 | )
|
---|
303 | {
|
---|
304 | //DEBUG_BREAKPOINT_TEST();
|
---|
305 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
306 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
307 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
308 |
|
---|
309 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
310 | }
|
---|
311 |
|
---|
312 | static void APIENTRY ddi10DynamicIABufferUnmap(
|
---|
313 | D3D10DDI_HDEVICE hDevice,
|
---|
314 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to unmap.
|
---|
315 | UINT Subresource // An index that indicates the subresource to unmap.
|
---|
316 | )
|
---|
317 | {
|
---|
318 | //DEBUG_BREAKPOINT_TEST();
|
---|
319 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
320 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
321 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, Subresource));
|
---|
322 |
|
---|
323 | vboxDXResourceUnmap(pDevice, pResource, Subresource);
|
---|
324 | }
|
---|
325 |
|
---|
326 | static void APIENTRY ddi10DynamicConstantBufferMapDiscard(
|
---|
327 | D3D10DDI_HDEVICE hDevice,
|
---|
328 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
329 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
330 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
331 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
332 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
333 | )
|
---|
334 | {
|
---|
335 | //DEBUG_BREAKPOINT_TEST();
|
---|
336 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
337 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
338 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
339 |
|
---|
340 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
341 | }
|
---|
342 |
|
---|
343 | static void APIENTRY ddi10DynamicIABufferMapDiscard(
|
---|
344 | D3D10DDI_HDEVICE hDevice,
|
---|
345 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
346 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
347 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
348 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
349 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
350 | )
|
---|
351 | {
|
---|
352 | //DEBUG_BREAKPOINT_TEST();
|
---|
353 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
354 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
355 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
356 |
|
---|
357 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
358 | }
|
---|
359 |
|
---|
360 | static void APIENTRY ddi10DynamicConstantBufferUnmap(
|
---|
361 | D3D10DDI_HDEVICE hDevice,
|
---|
362 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to unmap.
|
---|
363 | UINT Subresource // An index that indicates the subresource to unmap.
|
---|
364 | )
|
---|
365 | {
|
---|
366 | //DEBUG_BREAKPOINT_TEST();
|
---|
367 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
368 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
369 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, Subresource));
|
---|
370 |
|
---|
371 | vboxDXResourceUnmap(pDevice, pResource, Subresource);
|
---|
372 | }
|
---|
373 |
|
---|
374 | static void APIENTRY ddi11_1PsSetConstantBuffers(
|
---|
375 | D3D10DDI_HDEVICE hDevice,
|
---|
376 | UINT StartSlot, // The starting constant buffer to set.
|
---|
377 | UINT NumBuffers, // The total number of buffers to set.
|
---|
378 | const D3D10DDI_HRESOURCE* phBuffers, // An array of handles to the constant buffers.
|
---|
379 | const UINT* pFirstConstant, // A pointer to the first constant in the buffer pointed to by StartBuffer.
|
---|
380 | const UINT* pNumConstants // The number of constants in the buffer pointed to by StartBuffer.
|
---|
381 | )
|
---|
382 | {
|
---|
383 | //DEBUG_BREAKPOINT_TEST();
|
---|
384 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
385 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
386 |
|
---|
387 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_PS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
388 | }
|
---|
389 |
|
---|
390 | static void APIENTRY ddi10PsSetConstantBuffers(
|
---|
391 | D3D10DDI_HDEVICE hDevice,
|
---|
392 | UINT StartSlot, // The starting constant buffer to set.
|
---|
393 | UINT NumBuffers, // The total number of buffers to set.
|
---|
394 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
395 | )
|
---|
396 | {
|
---|
397 | //DEBUG_BREAKPOINT_TEST();
|
---|
398 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
399 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
400 |
|
---|
401 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_PS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
402 | }
|
---|
403 |
|
---|
404 | static void APIENTRY ddi10IaSetInputLayout(
|
---|
405 | D3D10DDI_HDEVICE hDevice,
|
---|
406 | D3D10DDI_HELEMENTLAYOUT hInputLayout // A handle to the input layout object.
|
---|
407 | )
|
---|
408 | {
|
---|
409 | //DEBUG_BREAKPOINT_TEST();
|
---|
410 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
411 | PVBOXDXELEMENTLAYOUT pInputLayout = (PVBOXDXELEMENTLAYOUT)hInputLayout.pDrvPrivate;
|
---|
412 | LogFlowFunc(("pDevice 0x%p, pInputLayout 0x%p", pDevice, pInputLayout));
|
---|
413 |
|
---|
414 | vboxDXSetInputLayout(pDevice, pInputLayout);
|
---|
415 | }
|
---|
416 |
|
---|
417 | static void APIENTRY ddi10IaSetVertexBuffers(
|
---|
418 | D3D10DDI_HDEVICE hDevice,
|
---|
419 | UINT StartSlot, // The starting vertex buffer to set.
|
---|
420 | UINT NumBuffers, // The total number of buffers to set.
|
---|
421 | const D3D10DDI_HRESOURCE* phBuffers, // An array of handles to the vertex buffers, beginning with the buffer that StartBuffer specifies.
|
---|
422 | const UINT* pStrides, // An array of values that indicate the sizes, in bytes, from one vertex to the next vertex for each buffer
|
---|
423 | const UINT* pOffsets // An array of values that indicate the offsets, in bytes, into each vertex buffer.
|
---|
424 | )
|
---|
425 | {
|
---|
426 | //DEBUG_BREAKPOINT_TEST();
|
---|
427 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
428 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
429 |
|
---|
430 | vboxDXSetVertexBuffers(pDevice, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pStrides, pOffsets);
|
---|
431 | }
|
---|
432 |
|
---|
433 | static void APIENTRY ddi10IaSetIndexBuffer(
|
---|
434 | D3D10DDI_HDEVICE hDevice,
|
---|
435 | D3D10DDI_HRESOURCE hBuffer, // A handle to the index buffer to set.
|
---|
436 | DXGI_FORMAT Format, // A DXGI_FORMAT-typed value that indicates the pixel format of the index buffer.
|
---|
437 | // Only the DXGI_FORMAT_R16_UINT and DXGI_FORMAT_R32_UINT formats are valid.
|
---|
438 | UINT Offset // The offset, in bytes, into the index buffer.
|
---|
439 | )
|
---|
440 | {
|
---|
441 | //DEBUG_BREAKPOINT_TEST();
|
---|
442 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
443 | LogFlowFunc(("pDevice = %p, Format = %u, Offset = %u\n", pDevice, Format, Offset));
|
---|
444 |
|
---|
445 | vboxDXSetIndexBuffer(pDevice, (PVBOXDX_RESOURCE)hBuffer.pDrvPrivate, Format, Offset);
|
---|
446 | }
|
---|
447 |
|
---|
448 | static void APIENTRY ddi10DrawIndexedInstanced(
|
---|
449 | D3D10DDI_HDEVICE hDevice,
|
---|
450 | UINT IndexCountPerInstance, // The number of indexes per instance.
|
---|
451 | UINT InstanceCount, // The number of instances of the index buffer that indexes are read from.
|
---|
452 | UINT StartIndexLocation, // The first index in the index buffer that indexes are read from to draw the primitives.
|
---|
453 | INT BaseVertexLocation, // The number that should be added to each index that is referenced by the various primitives to determine
|
---|
454 | // the actual index of the vertex elements in each vertex stream.
|
---|
455 | UINT StartInstanceLocation // The first instance of the index buffer that indexes are read from to draw the primitives.
|
---|
456 | )
|
---|
457 | {
|
---|
458 | //DEBUG_BREAKPOINT_TEST();
|
---|
459 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
460 | LogFlowFunc(("pDevice = %p, IndexCountPerInstance = %u, InstanceCount = %u, StartIndexLocation = %u, BaseVertexLocation = %u, StartInstanceLocation = %u\n", pDevice, IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation));
|
---|
461 |
|
---|
462 | vboxDXDrawIndexedInstanced(pDevice, IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation);
|
---|
463 | }
|
---|
464 |
|
---|
465 | static void APIENTRY ddi10DrawInstanced(
|
---|
466 | D3D10DDI_HDEVICE hDevice,
|
---|
467 | UINT VertexCountPerInstance, // The number of vertices per instance of the buffer that vertices are read from to draw the primitives.
|
---|
468 | UINT InstanceCount, // The number of instances of the buffer that vertices are read from to draw the primitives.
|
---|
469 | UINT StartVertexLocation, // The first vertex in the buffer that vertices are read from to draw the primitives.
|
---|
470 | UINT StartInstanceLocation // The first instance of the buffer that vertices are read from to draw the primitives.
|
---|
471 | )
|
---|
472 | {
|
---|
473 | //DEBUG_BREAKPOINT_TEST();
|
---|
474 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
475 | LogFlowFunc(("pDevice = %p, VertexCountPerInstance = %u, InstanceCount = %u, StartVertexLocation = %u, StartInstanceLocation = %u\n", pDevice, VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation));
|
---|
476 |
|
---|
477 | vboxDXDrawInstanced(pDevice, VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
|
---|
478 | }
|
---|
479 |
|
---|
480 | static void APIENTRY ddi10DynamicResourceMapDiscard(
|
---|
481 | D3D10DDI_HDEVICE hDevice,
|
---|
482 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
483 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
484 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
485 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
486 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
487 | )
|
---|
488 | {
|
---|
489 | //DEBUG_BREAKPOINT_TEST();
|
---|
490 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
491 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
492 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
493 |
|
---|
494 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
495 | }
|
---|
496 |
|
---|
497 | static void APIENTRY ddi10DynamicResourceUnmap(
|
---|
498 | D3D10DDI_HDEVICE hDevice,
|
---|
499 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to unmap.
|
---|
500 | UINT Subresource // An index that indicates the subresource to unmap.
|
---|
501 | )
|
---|
502 | {
|
---|
503 | //DEBUG_BREAKPOINT_TEST();
|
---|
504 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
505 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
506 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, Subresource));
|
---|
507 |
|
---|
508 | vboxDXResourceUnmap(pDevice, pResource, Subresource);
|
---|
509 | }
|
---|
510 |
|
---|
511 | static void APIENTRY ddi11_1GsSetConstantBuffers(
|
---|
512 | D3D10DDI_HDEVICE hDevice,
|
---|
513 | UINT StartSlot, // The starting constant buffer to set.
|
---|
514 | UINT NumBuffers, // The total number of buffers to set.
|
---|
515 | const D3D10DDI_HRESOURCE* phBuffers, // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
516 | const UINT* pFirstConstant, // A pointer to the first constant in the buffer pointed to by StartBuffer.
|
---|
517 | const UINT* pNumConstants // The number of constants in the buffer pointed to by StartBuffer.
|
---|
518 | )
|
---|
519 | {
|
---|
520 | //DEBUG_BREAKPOINT_TEST();
|
---|
521 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
522 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
523 |
|
---|
524 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_GS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
525 | }
|
---|
526 |
|
---|
527 | static void APIENTRY ddi10GsSetConstantBuffers(
|
---|
528 | D3D10DDI_HDEVICE hDevice,
|
---|
529 | UINT StartSlot, // The starting constant buffer to set.
|
---|
530 | UINT NumBuffers, // The total number of buffers to set.
|
---|
531 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
532 | )
|
---|
533 | {
|
---|
534 | //DEBUG_BREAKPOINT_TEST();
|
---|
535 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
536 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
537 |
|
---|
538 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_GS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
539 | }
|
---|
540 |
|
---|
541 | static void APIENTRY ddi10GsSetShader(
|
---|
542 | D3D10DDI_HDEVICE hDevice,
|
---|
543 | D3D10DDI_HSHADER hShader // A handle to the shader code object.
|
---|
544 | )
|
---|
545 | {
|
---|
546 | //DEBUG_BREAKPOINT_TEST();
|
---|
547 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
548 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
549 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
550 |
|
---|
551 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader);
|
---|
552 | }
|
---|
553 |
|
---|
554 | static void APIENTRY ddi10IaSetTopology(
|
---|
555 | D3D10DDI_HDEVICE hDevice,
|
---|
556 | D3D10_DDI_PRIMITIVE_TOPOLOGY PrimitiveTopology // The primitive topology to set.
|
---|
557 | )
|
---|
558 | {
|
---|
559 | //DEBUG_BREAKPOINT_TEST();
|
---|
560 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
561 | LogFlowFunc(("pDevice = %p, PrimitiveTopology = %u\n", pDevice, PrimitiveTopology));
|
---|
562 |
|
---|
563 | if (PrimitiveTopology == D3D10_DDI_PRIMITIVE_TOPOLOGY_UNDEFINED)
|
---|
564 | return;
|
---|
565 |
|
---|
566 | vboxDXIaSetTopology(pDevice, PrimitiveTopology);
|
---|
567 | }
|
---|
568 |
|
---|
569 | static void APIENTRY ddi10StagingResourceMap(
|
---|
570 | D3D10DDI_HDEVICE hDevice,
|
---|
571 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
572 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
573 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
574 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
575 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
576 | )
|
---|
577 | {
|
---|
578 | //DEBUG_BREAKPOINT_TEST();
|
---|
579 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
580 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
581 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
582 |
|
---|
583 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
584 | }
|
---|
585 |
|
---|
586 | static void APIENTRY ddi10StagingResourceUnmap(
|
---|
587 | D3D10DDI_HDEVICE hDevice,
|
---|
588 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to unmap.
|
---|
589 | UINT Subresource // An index that indicates the subresource to unmap.
|
---|
590 | )
|
---|
591 | {
|
---|
592 | //DEBUG_BREAKPOINT_TEST();
|
---|
593 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
594 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
595 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, Subresource));
|
---|
596 |
|
---|
597 | vboxDXResourceUnmap(pDevice, pResource, Subresource);
|
---|
598 | }
|
---|
599 |
|
---|
600 | static void APIENTRY ddi10VsSetShaderResources(
|
---|
601 | D3D10DDI_HDEVICE hDevice,
|
---|
602 | UINT StartSlot, // The offset to the first view to set.
|
---|
603 | UINT NumViews, // The total number of views to set.
|
---|
604 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews // An array of handles to the shader resource views
|
---|
605 | )
|
---|
606 | {
|
---|
607 | //DEBUG_BREAKPOINT_TEST();
|
---|
608 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
609 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
610 |
|
---|
611 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_VS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
612 | }
|
---|
613 |
|
---|
614 | static void APIENTRY ddi10VsSetSamplers(
|
---|
615 | D3D10DDI_HDEVICE hDevice,
|
---|
616 | UINT StartSlot, // The offset to the first sampler to set.
|
---|
617 | UINT NumSamplers, // The total number of samplers to set.
|
---|
618 | const D3D10DDI_HSAMPLER* phSamplers // An array of handles to the samplers.
|
---|
619 | )
|
---|
620 | {
|
---|
621 | //DEBUG_BREAKPOINT_TEST();
|
---|
622 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
623 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
624 |
|
---|
625 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
626 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
627 |
|
---|
628 | /* Fetch sampler ids. */
|
---|
629 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
630 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
631 | {
|
---|
632 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
633 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
634 | }
|
---|
635 |
|
---|
636 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_VS, StartSlot, NumSamplers, aSamplerIds);
|
---|
637 | }
|
---|
638 |
|
---|
639 | static void APIENTRY ddi10GsSetShaderResources(
|
---|
640 | D3D10DDI_HDEVICE hDevice,
|
---|
641 | UINT StartSlot, // The offset to the first view to set.
|
---|
642 | UINT NumViews, // The total number of views to set.
|
---|
643 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews // An array of handles to the shader resource views
|
---|
644 | )
|
---|
645 | {
|
---|
646 | //DEBUG_BREAKPOINT_TEST();
|
---|
647 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
648 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
649 |
|
---|
650 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_GS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
651 | }
|
---|
652 |
|
---|
653 | static void APIENTRY ddi10GsSetSamplers(
|
---|
654 | D3D10DDI_HDEVICE hDevice,
|
---|
655 | UINT StartSlot, // The offset to the first sampler to set.
|
---|
656 | UINT NumSamplers, // The total number of samplers to set.
|
---|
657 | const D3D10DDI_HSAMPLER* phSamplers // An array of handles to the samplers.
|
---|
658 | )
|
---|
659 | {
|
---|
660 | //DEBUG_BREAKPOINT_TEST();
|
---|
661 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
662 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
663 |
|
---|
664 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
665 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
666 |
|
---|
667 | /* Fetch sampler ids. */
|
---|
668 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
669 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
670 | {
|
---|
671 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
672 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
673 | }
|
---|
674 |
|
---|
675 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_GS, StartSlot, NumSamplers, aSamplerIds);
|
---|
676 | }
|
---|
677 |
|
---|
678 | static void APIENTRY ddi11SetRenderTargets(
|
---|
679 | D3D10DDI_HDEVICE hDevice,
|
---|
680 | const D3D10DDI_HRENDERTARGETVIEW* phRenderTargetView, // An array of handles to the render target view (RTV) objects to set. Note that some handle values can be NULL.
|
---|
681 | UINT NumRTVs, // The number of elements in the array provided in phRenderTargetView for the RTVs to set.
|
---|
682 | UINT ClearSlots, // The number of RTV objects to unbind; that is, those render target view objects that were previously bound but no longer need to be bound.
|
---|
683 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView, // A handle to the depth-stencil buffer to set.
|
---|
684 | const D3D11DDI_HUNORDEREDACCESSVIEW* phUnorderedAccessView, // An array of handles to the unordered access view (UAV) objects to set.
|
---|
685 | const UINT* pUAVInitialCounts, // An array of appendand consume buffer offsets.
|
---|
686 | UINT UAVStartSlot, // Index of the first UAV to bind. UAVStartSlot must be at least as great as the NumRTVs parameter.
|
---|
687 | UINT NumUAVs, // The number of UAVs to bind.
|
---|
688 | UINT UAVRangeStart, // The first UAV in the set of all updated UAVs (which includes NULL bindings).
|
---|
689 | UINT UAVRangeSize // The number of UAVs in the set of all updated UAVs (which includes NULL bindings).
|
---|
690 | )
|
---|
691 | {
|
---|
692 | //DEBUG_BREAKPOINT_TEST();
|
---|
693 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
694 | LogFlowFunc(("pDevice %p, NumRTVs %u, ClearSlots %u, UAVStartSlot %u, NumUAVs %u, UAVRangeStart %u, UAVRangeSize %u\n",
|
---|
695 | pDevice, NumRTVs, ClearSlots, UAVStartSlot, NumUAVs, UAVRangeStart, UAVRangeSize));
|
---|
696 |
|
---|
697 | AssertReturnVoid( NumRTVs <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS
|
---|
698 | && ClearSlots <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS
|
---|
699 | && NumRTVs + ClearSlots <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS);
|
---|
700 |
|
---|
701 | /* UAVs take slots right after render targets.
|
---|
702 | *
|
---|
703 | * For example Windows calls this as:
|
---|
704 | * NumRTVs = 0, ClearSlots = 0, UAVStartSlot = 0, NumUAVs = 1,
|
---|
705 | * even if there was a render target at slot 0 already.
|
---|
706 | * And then:
|
---|
707 | * NumRTVs 3, ClearSlots 0, UAVStartSlot 3, NumUAVs 0
|
---|
708 | * NumRTVs 1, ClearSlots 2, UAVStartSlot 3, NumUAVs 0
|
---|
709 | * NumRTVs 1, ClearSlots 0, UAVStartSlot 3, NumUAVs 0
|
---|
710 | *
|
---|
711 | * There are 2 separate commands (SetRenderTargets and SetUnorderedAccessViews) for this one operation.
|
---|
712 | *
|
---|
713 | * SetRenderTargets: clear all slots of previously set render targets to make free slots for UAVs.
|
---|
714 | * SetUnorderedAccessViews: always send the command.
|
---|
715 | */
|
---|
716 | if (NumUAVs)
|
---|
717 | ClearSlots = RT_MAX(ClearSlots, pDevice->pipeline.cRenderTargetViews - NumRTVs);
|
---|
718 |
|
---|
719 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
720 |
|
---|
721 | vboxDXSetRenderTargets(pDevice, pDepthStencilView, NumRTVs, ClearSlots, (PVBOXDXRENDERTARGETVIEW *)phRenderTargetView);
|
---|
722 |
|
---|
723 | AssertReturnVoidStmt( NumUAVs <= D3D11_1_UAV_SLOT_COUNT
|
---|
724 | && UAVStartSlot <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS,
|
---|
725 | vboxDXDeviceSetError(pDevice, E_INVALIDARG));
|
---|
726 |
|
---|
727 | vboxDXSetUnorderedAccessViews(pDevice, UAVStartSlot, NumUAVs, (PVBOXDXUNORDEREDACCESSVIEW *)phUnorderedAccessView, pUAVInitialCounts);
|
---|
728 |
|
---|
729 | RT_NOREF(UAVRangeStart, UAVRangeSize); /* These are hints and not used by the driver. */
|
---|
730 | }
|
---|
731 |
|
---|
732 | static void APIENTRY ddi10SetRenderTargets(
|
---|
733 | D3D10DDI_HDEVICE hDevice,
|
---|
734 | const D3D10DDI_HRENDERTARGETVIEW* phRenderTargetView, // An array of handles to the render target view (RTV) objects to set. Note that some handle values can be NULL.
|
---|
735 | UINT NumRTVs, // The number of elements in the array provided in phRenderTargetView for the RTVs to set.
|
---|
736 | UINT ClearSlots, // The number of RTV objects to unbind; that is, those render target view objects that were previously bound but no longer need to be bound.
|
---|
737 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView // A handle to the depth-stencil buffer to set.
|
---|
738 | )
|
---|
739 | {
|
---|
740 | //DEBUG_BREAKPOINT_TEST();
|
---|
741 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
742 | LogFlowFunc(("pDevice %p, NumRTVs %u, ClearSlots %u\n",
|
---|
743 | pDevice, NumRTVs, ClearSlots));
|
---|
744 |
|
---|
745 | AssertReturnVoid( NumRTVs <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS
|
---|
746 | && ClearSlots <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS
|
---|
747 | && NumRTVs + ClearSlots <= SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS);
|
---|
748 |
|
---|
749 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
750 |
|
---|
751 | vboxDXSetRenderTargets(pDevice, pDepthStencilView, NumRTVs, ClearSlots, (PVBOXDXRENDERTARGETVIEW *)phRenderTargetView);
|
---|
752 | }
|
---|
753 |
|
---|
754 | static void APIENTRY ddi10ShaderResourceViewReadAfterWriteHazard(
|
---|
755 | D3D10DDI_HDEVICE hDevice,
|
---|
756 | D3D10DDI_HSHADERRESOURCEVIEW hResource, // A handle to the resource.
|
---|
757 | D3D10DDI_HRESOURCE hShaderResourceView // A handle to the driver's private data for a shader resource view object.
|
---|
758 | )
|
---|
759 | {
|
---|
760 | //DEBUG_BREAKPOINT_TEST();
|
---|
761 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
762 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
763 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
764 | LogFlowFunc(("pDevice %p, pResource %p, pShaderResourceView %p\n", pDevice, pResource, pShaderResourceView));
|
---|
765 | RT_NOREF(pDevice, pResource, pShaderResourceView);
|
---|
766 | }
|
---|
767 |
|
---|
768 | static void APIENTRY ddi10ResourceReadAfterWriteHazard(
|
---|
769 | D3D10DDI_HDEVICE hDevice,
|
---|
770 | D3D10DDI_HRESOURCE hResource // A handle to the resource.
|
---|
771 | )
|
---|
772 | {
|
---|
773 | //DEBUG_BREAKPOINT_TEST();
|
---|
774 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
775 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
776 | LogFlowFunc(("pDevice %p, pResource %p\n", pDevice, pResource));
|
---|
777 | RT_NOREF(pDevice, pResource);
|
---|
778 | }
|
---|
779 |
|
---|
780 | static void APIENTRY ddi10SetBlendState(
|
---|
781 | D3D10DDI_HDEVICE hDevice,
|
---|
782 | D3D10DDI_HBLENDSTATE hBlendState, // A handle to the blend state to set.
|
---|
783 | const FLOAT BlendFactor[4], // Array of blend factors, one for each RGBA component.
|
---|
784 | UINT SampleMask // A sample format mask.
|
---|
785 | )
|
---|
786 | {
|
---|
787 | //DEBUG_BREAKPOINT_TEST();
|
---|
788 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
789 | PVBOXDX_BLENDSTATE pBlendState = (PVBOXDX_BLENDSTATE)hBlendState.pDrvPrivate;
|
---|
790 | LogFlowFunc(("pDevice 0x%p, pBlendState 0x%p, SampleMask 0x%x", pDevice, pBlendState, SampleMask));
|
---|
791 |
|
---|
792 | vboxDXSetBlendState(pDevice, pBlendState, BlendFactor, SampleMask);
|
---|
793 | }
|
---|
794 |
|
---|
795 | static void APIENTRY ddi10SetDepthStencilState(
|
---|
796 | D3D10DDI_HDEVICE hDevice,
|
---|
797 | D3D10DDI_HDEPTHSTENCILSTATE hDepthStencilState, // A handle to the depth-stencil state to set.
|
---|
798 | UINT StencilRef // A stencil reference value to compare against.
|
---|
799 | )
|
---|
800 | {
|
---|
801 | //DEBUG_BREAKPOINT_TEST();
|
---|
802 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
803 | PVBOXDX_DEPTHSTENCIL_STATE pDepthStencilState = (PVBOXDX_DEPTHSTENCIL_STATE)hDepthStencilState.pDrvPrivate;
|
---|
804 | LogFlowFunc(("pDevice 0x%p, pDepthStencilState 0x%p, StencilRef %d", pDevice, pDepthStencilState, StencilRef));
|
---|
805 |
|
---|
806 | vboxDXSetDepthStencilState(pDevice, pDepthStencilState, StencilRef);
|
---|
807 | }
|
---|
808 |
|
---|
809 | static void APIENTRY ddi10SetRasterizerState(
|
---|
810 | D3D10DDI_HDEVICE hDevice,
|
---|
811 | D3D10DDI_HRASTERIZERSTATE hRasterizerState // A handle to the rasterizer state object.
|
---|
812 | )
|
---|
813 | {
|
---|
814 | //DEBUG_BREAKPOINT_TEST();
|
---|
815 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
816 | PVBOXDX_RASTERIZER_STATE pRasterizerState = (PVBOXDX_RASTERIZER_STATE)hRasterizerState.pDrvPrivate;
|
---|
817 | LogFlowFunc(("pDevice 0x%p, pRasterizerState 0x%p", pDevice, pRasterizerState));
|
---|
818 |
|
---|
819 | vboxDXSetRasterizerState(pDevice, pRasterizerState);
|
---|
820 | }
|
---|
821 |
|
---|
822 | static void APIENTRY ddi10QueryEnd(
|
---|
823 | D3D10DDI_HDEVICE hDevice,
|
---|
824 | D3D10DDI_HQUERY hQuery // A handle to the query object to end.
|
---|
825 | )
|
---|
826 | {
|
---|
827 | //DEBUG_BREAKPOINT_TEST();
|
---|
828 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
829 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
830 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
831 |
|
---|
832 | vboxDXQueryEnd(pDevice, pQuery);
|
---|
833 | }
|
---|
834 |
|
---|
835 | static void APIENTRY ddi10QueryBegin(
|
---|
836 | D3D10DDI_HDEVICE hDevice,
|
---|
837 | D3D10DDI_HQUERY hQuery // A handle to the query object to begin.
|
---|
838 | )
|
---|
839 | {
|
---|
840 | //DEBUG_BREAKPOINT_TEST();
|
---|
841 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
842 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
843 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
844 |
|
---|
845 | vboxDXQueryBegin(pDevice, pQuery);
|
---|
846 | }
|
---|
847 |
|
---|
848 | static void APIENTRY ddi11_1ResourceCopyRegion(
|
---|
849 | D3D10DDI_HDEVICE hDevice,
|
---|
850 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
851 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
852 | UINT DstX, // The x-coordinate of the destination subresource.
|
---|
853 | UINT DstY, // The y-coordinate of the destination subresource. For one-dimensional (1-D) subresources, DstY is set to zero.
|
---|
854 | UINT DstZ, // The z-coordinate of the destination subresource. For one-dimensional (1-D) and two-dimensional (2-D) subresources, DstZ is set to zero.
|
---|
855 | D3D10DDI_HRESOURCE hSrcResource, // A handle to the source resource to copy from.
|
---|
856 | UINT SrcSubresource, // An index that indicates the source subresource to copy from.
|
---|
857 | const D3D10_DDI_BOX* pSrcBox, // A pointer to a D3D10_DDI_BOX structure that specifies a box that fits on either the source or destination subresource.
|
---|
858 | // If pSrcBox is NULL, the driver should copy the entire source subresouce to the destination.
|
---|
859 | UINT CopyFlags // A value that specifies characteristics of copy operation as a bitwise OR of the values in the D3D11_1_DDI_COPY_FLAGS enumeration type.
|
---|
860 | )
|
---|
861 | {
|
---|
862 | //DEBUG_BREAKPOINT_TEST();
|
---|
863 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
864 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
865 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)hSrcResource.pDrvPrivate;
|
---|
866 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, Dst %d,%d,%d, pSrcResource 0x%p, SrcSubresource %d, pSrcBox %p, CopyFlags 0x%x",
|
---|
867 | pDevice, pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox, CopyFlags));
|
---|
868 |
|
---|
869 | vboxDXResourceCopyRegion(pDevice, pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox, CopyFlags);
|
---|
870 | }
|
---|
871 |
|
---|
872 | static void APIENTRY ddi10ResourceCopyRegion(
|
---|
873 | D3D10DDI_HDEVICE hDevice,
|
---|
874 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
875 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
876 | UINT DstX, // The x-coordinate of the destination subresource.
|
---|
877 | UINT DstY, // The y-coordinate of the destination subresource. For one-dimensional (1-D) subresources, DstY is set to zero.
|
---|
878 | UINT DstZ, // The z-coordinate of the destination subresource. For one-dimensional (1-D) and two-dimensional (2-D) subresources, DstZ is set to zero.
|
---|
879 | D3D10DDI_HRESOURCE hSrcResource, // A handle to the source resource to copy from.
|
---|
880 | UINT SrcSubresource, // An index that indicates the source subresource to copy from.
|
---|
881 | const D3D10_DDI_BOX* pSrcBox // A pointer to a D3D10_DDI_BOX structure that specifies a box that fits on either the source or destination subresource.
|
---|
882 | // If pSrcBox is NULL, the driver should copy the entire source subresouce to the destination.
|
---|
883 | )
|
---|
884 | {
|
---|
885 | //DEBUG_BREAKPOINT_TEST();
|
---|
886 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
887 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
888 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)hSrcResource.pDrvPrivate;
|
---|
889 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, Dst %d,%d,%d, pSrcResource 0x%p, SrcSubresource %d, pSrcBox %p",
|
---|
890 | pDevice, pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox));
|
---|
891 |
|
---|
892 | vboxDXResourceCopyRegion(pDevice, pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox, 0);
|
---|
893 | }
|
---|
894 |
|
---|
895 | static void APIENTRY ddi11_1ResourceUpdateSubresourceUP(
|
---|
896 | D3D10DDI_HDEVICE hDevice,
|
---|
897 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
898 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
899 | const D3D10_DDI_BOX* pDstBox, // The region of the destination subresource to copy data to.
|
---|
900 | const VOID* pSysMemUP, // A pointer to the source data used to update the dest subresouce.
|
---|
901 | UINT RowPitch, // The offset, in bytes, to move to the next row of source data.
|
---|
902 | UINT DepthPitch, // The offset, in bytes, to move to the next depth slice of source data.
|
---|
903 | UINT CopyFlags // A bitwise OR of the values in the D3D11_1_DDI_COPY_FLAGS
|
---|
904 | )
|
---|
905 | {
|
---|
906 | //DEBUG_BREAKPOINT_TEST();
|
---|
907 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
908 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
909 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, pDstBox %p, pSysMemUP %p, RowPitch %d, DepthPitch %d, CopyFlags 0x%x",
|
---|
910 | pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, CopyFlags));
|
---|
911 |
|
---|
912 | vboxDXResourceUpdateSubresourceUP(pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, CopyFlags);
|
---|
913 | }
|
---|
914 |
|
---|
915 | static void APIENTRY ddi10ResourceUpdateSubresourceUP(
|
---|
916 | D3D10DDI_HDEVICE hDevice,
|
---|
917 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
918 | UINT DstSubresource, // An index that indicates the destination subresource to copy to.
|
---|
919 | const D3D10_DDI_BOX* pDstBox, // The region of the destination subresource to copy data to.
|
---|
920 | const VOID* pSysMemUP, // A pointer to the source data used to update the dest subresouce.
|
---|
921 | UINT RowPitch, // The offset, in bytes, to move to the next row of source data.
|
---|
922 | UINT DepthPitch // The offset, in bytes, to move to the next depth slice of source data.
|
---|
923 | )
|
---|
924 | {
|
---|
925 | //DEBUG_BREAKPOINT_TEST();
|
---|
926 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
927 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
928 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, DstSubresource %d, pDstBox %p, pSysMemUP %p, RowPitch %d, DepthPitch %d",
|
---|
929 | pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch));
|
---|
930 |
|
---|
931 | vboxDXResourceUpdateSubresourceUP(pDevice, pDstResource, DstSubresource, pDstBox, pSysMemUP, RowPitch, DepthPitch, 0);
|
---|
932 | }
|
---|
933 |
|
---|
934 | static void APIENTRY ddi10SoSetTargets(
|
---|
935 | D3D10DDI_HDEVICE hDevice,
|
---|
936 | UINT NumBuffers, // The number of elements in the array that phResource specifies.
|
---|
937 | UINT ClearTargets, // The number of handles to stream output target resources that represents the difference between
|
---|
938 | // the previous number of stream output target resources (before the Microsoft Direct3D runtime calls SoSetTargets) and
|
---|
939 | // the new number of stream output target resources.
|
---|
940 | const D3D10DDI_HRESOURCE* phResource, // An array of handles to the stream output target resources to set.Note that some handle values can be NULL.
|
---|
941 | const UINT* pOffsets // An array of offsets, in bytes, into the stream output target resources in the array that phResource specifies.
|
---|
942 | )
|
---|
943 | {
|
---|
944 | //DEBUG_BREAKPOINT_TEST();
|
---|
945 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
946 | LogFlowFunc(("pDevice = %p, NumBuffers = %u, ClearTargets = %u\n", pDevice, NumBuffers, ClearTargets));
|
---|
947 |
|
---|
948 | AssertReturnVoid(NumBuffers <= SVGA3D_DX_MAX_SOTARGETS && ClearTargets <= SVGA3D_DX_MAX_SOTARGETS);
|
---|
949 |
|
---|
950 | uint32_t NumTargets = NumBuffers + ClearTargets;
|
---|
951 | Assert(NumTargets <= SVGA3D_DX_MAX_SOTARGETS);
|
---|
952 | NumTargets = RT_MIN(NumTargets, SVGA3D_DX_MAX_SOTARGETS);
|
---|
953 |
|
---|
954 | /* Fetch allocation handles. */
|
---|
955 | D3DKMT_HANDLE aAllocations[SVGA3D_DX_MAX_SOTARGETS];
|
---|
956 | uint32_t aOffsets[SVGA3D_DX_MAX_SOTARGETS];
|
---|
957 | uint32_t aSizes[SVGA3D_DX_MAX_SOTARGETS];
|
---|
958 | for (unsigned i = 0; i < NumTargets; ++i)
|
---|
959 | {
|
---|
960 | if (i < NumBuffers)
|
---|
961 | {
|
---|
962 | VBOXDX_RESOURCE *pResource = (PVBOXDX_RESOURCE)phResource[i].pDrvPrivate;
|
---|
963 | aAllocations[i] = vboxDXGetAllocation(pResource);
|
---|
964 | aOffsets[i] = pOffsets[i];
|
---|
965 | aSizes[i] = pResource ? pResource->AllocationDesc.cbAllocation : 0;
|
---|
966 | }
|
---|
967 | else
|
---|
968 | {
|
---|
969 | aAllocations[i] = 0;
|
---|
970 | aOffsets[i] = 0;
|
---|
971 | aSizes[i] = 0;
|
---|
972 | }
|
---|
973 | }
|
---|
974 |
|
---|
975 | vboxDXSoSetTargets(pDevice, NumTargets, aAllocations, aOffsets, aSizes);
|
---|
976 | }
|
---|
977 |
|
---|
978 | static void APIENTRY ddi10DrawAuto(D3D10DDI_HDEVICE hDevice)
|
---|
979 | {
|
---|
980 | //DEBUG_BREAKPOINT_TEST();
|
---|
981 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
982 | LogFlowFunc(("pDevice = %p\n", pDevice));
|
---|
983 |
|
---|
984 | vboxDXDrawAuto(pDevice);
|
---|
985 | }
|
---|
986 |
|
---|
987 | static void APIENTRY ddi10SetViewports(
|
---|
988 | D3D10DDI_HDEVICE hDevice,
|
---|
989 | UINT NumViewports, // The total number of viewports that the pViewports parameter specifies.
|
---|
990 | UINT ClearViewports, // The number of viewports after the number of viewports that NumViewports specifies to be set to NULL.
|
---|
991 | const D3D10_DDI_VIEWPORT* pViewports // An array of D3D10_DDI_VIEWPORT structures for the viewports to set.
|
---|
992 | )
|
---|
993 | {
|
---|
994 | //DEBUG_BREAKPOINT_TEST();
|
---|
995 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
996 | LogFlowFunc(("pDevice = %p, NumViewports %u, ClearViewports %u\n", pDevice, NumViewports, ClearViewports));
|
---|
997 |
|
---|
998 | vboxDXSetViewports(pDevice, NumViewports, ClearViewports, pViewports);
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | static void APIENTRY ddi10SetScissorRects(
|
---|
1002 | D3D10DDI_HDEVICE hDevice,
|
---|
1003 | UINT NumRects, // The total number of render-target portions that the pRects parameter specifies.
|
---|
1004 | UINT ClearRects, // The number of render-target portions after the number of render-target portions that NumScissorRects specifies to be set to NULL.
|
---|
1005 | const D3D10_DDI_RECT* pRects // An array of scissor rectangles.
|
---|
1006 | )
|
---|
1007 | {
|
---|
1008 | //DEBUG_BREAKPOINT_TEST();
|
---|
1009 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1010 | LogFlowFunc(("pDevice = %p, NumRects %u, ClearRects %u\n", pDevice, NumRects, ClearRects));
|
---|
1011 |
|
---|
1012 | vboxDXSetScissorRects(pDevice, NumRects, ClearRects, pRects);
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | static void APIENTRY ddi10ClearRenderTargetView(
|
---|
1016 | D3D10DDI_HDEVICE hDevice,
|
---|
1017 | D3D10DDI_HRENDERTARGETVIEW hRenderTargetView, // A handle to the render-target view to clear.
|
---|
1018 | FLOAT ColorRGBA[4] // A four-element array of single-precision float vectors that the driver uses to clear a render-target view.
|
---|
1019 | )
|
---|
1020 | {
|
---|
1021 | //DEBUG_BREAKPOINT_TEST();
|
---|
1022 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1023 | PVBOXDXRENDERTARGETVIEW pRenderTargetView = (PVBOXDXRENDERTARGETVIEW)hRenderTargetView.pDrvPrivate;
|
---|
1024 | LogFlowFunc(("pDevice 0x%p, pRenderTargetView 0x%p", pDevice, pRenderTargetView));
|
---|
1025 |
|
---|
1026 | vboxDXClearRenderTargetView(pDevice, pRenderTargetView, ColorRGBA);
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | static void APIENTRY ddi10ClearDepthStencilView(
|
---|
1030 | D3D10DDI_HDEVICE hDevice,
|
---|
1031 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView, // A handle to the depth-stencil view to clear.
|
---|
1032 | UINT Flags, // A value that specifies which parts of the buffer to affect - D3D10_DDI_CLEAR_DEPTH or D3D10_DDI_CLEAR_STENCIL.
|
---|
1033 | FLOAT Depth, // A single-precision float vector to set the depth to.
|
---|
1034 | UINT8 Stencil // An unsigned 8-bit integer value to set the stencil to.
|
---|
1035 | )
|
---|
1036 | {
|
---|
1037 | //DEBUG_BREAKPOINT_TEST();
|
---|
1038 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1039 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
1040 | LogFlowFunc(("pDevice 0x%p, pDepthStencilView 0x%p", pDevice, pDepthStencilView));
|
---|
1041 |
|
---|
1042 | vboxDXClearDepthStencilView(pDevice, pDepthStencilView, Flags, Depth, Stencil);
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | static void APIENTRY ddi10SetPredication(
|
---|
1046 | D3D10DDI_HDEVICE hDevice,
|
---|
1047 | D3D10DDI_HQUERY hQuery, // A handle to the query object to set as a predicate.
|
---|
1048 | BOOL PredicateValue // A Boolean value to compare with query data.
|
---|
1049 | )
|
---|
1050 | {
|
---|
1051 | //DEBUG_BREAKPOINT_TEST();
|
---|
1052 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1053 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
1054 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
1055 |
|
---|
1056 | vboxDXSetPredication(pDevice, pQuery, PredicateValue);
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | static void APIENTRY ddi10QueryGetData(
|
---|
1060 | D3D10DDI_HDEVICE hDevice,
|
---|
1061 | D3D10DDI_HQUERY hQuery, // A handle to the query object to poll.
|
---|
1062 | VOID* pData, // A pointer to a region of memory that receives the data from a query operation.
|
---|
1063 | UINT DataSize, // The size, in bytes, of the query data that the pData parameter points to.
|
---|
1064 | UINT Flags // Can be 0 or any combination of the flags enumerated by D3D11_ASYNC_GETDATA_FLAG.
|
---|
1065 | )
|
---|
1066 | {
|
---|
1067 | //DEBUG_BREAKPOINT_TEST();
|
---|
1068 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1069 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
1070 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
1071 |
|
---|
1072 | vboxDXQueryGetData(pDevice, pQuery, pData, DataSize, Flags);
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | static BOOL APIENTRY ddi11_1Flush(
|
---|
1076 | D3D10DDI_HDEVICE hDevice,
|
---|
1077 | UINT FlushFlags // A value from the D3D11_1_DDI_FLUSH_FLAGS enumeration that indicates whether
|
---|
1078 | // the driver should continue to submit command buffers if there have been no new commands.
|
---|
1079 | )
|
---|
1080 | {
|
---|
1081 | //DEBUG_BREAKPOINT_TEST();
|
---|
1082 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1083 | LogFlowFunc(("pDevice = %p, Flags = 0x%x\n", pDevice, FlushFlags));
|
---|
1084 |
|
---|
1085 | HRESULT hr = vboxDXFlush(pDevice, !RT_BOOL(FlushFlags & D3D11_1DDI_FLUSH_UNLESS_NO_COMMANDS));
|
---|
1086 | return SUCCEEDED(hr);
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | static VOID APIENTRY ddi10Flush(
|
---|
1090 | D3D10DDI_HDEVICE hDevice
|
---|
1091 | )
|
---|
1092 | {
|
---|
1093 | //DEBUG_BREAKPOINT_TEST();
|
---|
1094 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1095 | LogFlowFunc(("pDevice = %p\n", pDevice));
|
---|
1096 |
|
---|
1097 | vboxDXFlush(pDevice, true);
|
---|
1098 | }
|
---|
1099 |
|
---|
1100 | static void APIENTRY ddi10GenMips(
|
---|
1101 | D3D10DDI_HDEVICE hDevice,
|
---|
1102 | D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView // A handle to the MIP-map texture surface.
|
---|
1103 | )
|
---|
1104 | {
|
---|
1105 | //DEBUG_BREAKPOINT_TEST();
|
---|
1106 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1107 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
1108 | LogFlowFunc(("pDevice 0x%p, pShaderResourceView 0x%p", pDevice, pShaderResourceView));
|
---|
1109 |
|
---|
1110 | vboxDXGenMips(pDevice, pShaderResourceView);
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 | static void APIENTRY ddi10ResourceCopy(
|
---|
1114 | D3D10DDI_HDEVICE hDevice,
|
---|
1115 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to copy to.
|
---|
1116 | D3D10DDI_HRESOURCE hSrcResource // A handle to the source resource to copy from.
|
---|
1117 | )
|
---|
1118 | {
|
---|
1119 | //DEBUG_BREAKPOINT_TEST();
|
---|
1120 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1121 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
1122 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)hSrcResource.pDrvPrivate;
|
---|
1123 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, pSrcResource 0x%p",
|
---|
1124 | pDevice, pDstResource, pSrcResource));
|
---|
1125 |
|
---|
1126 | vboxDXResourceCopy(pDevice, pDstResource, pSrcResource);
|
---|
1127 | }
|
---|
1128 |
|
---|
1129 | static void APIENTRY ddi10ResourceResolveSubresource(
|
---|
1130 | D3D10DDI_HDEVICE hDevice,
|
---|
1131 | D3D10DDI_HRESOURCE hDstResource, // A handle to the destination resource to resolve to. This resource must have been created as D3D10_USAGE_DEFAULT and single sampled.
|
---|
1132 | UINT DstSubresource, // An index that indicates the destination subresource to resolve to.
|
---|
1133 | D3D10DDI_HRESOURCE hSrcResource, // A handle to the source resource to resolve from.
|
---|
1134 | UINT SrcSubresource, // An index that indicates the source subresource to resolve from.
|
---|
1135 | DXGI_FORMAT ResolveFormat // A DXGI_FORMAT-typed value that indicates how to interpret the contents of the resolved resource.
|
---|
1136 | )
|
---|
1137 | {
|
---|
1138 | //DEBUG_BREAKPOINT_TEST();
|
---|
1139 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1140 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)hDstResource.pDrvPrivate;
|
---|
1141 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)hSrcResource.pDrvPrivate;
|
---|
1142 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p, pSrcResource 0x%p",
|
---|
1143 | pDevice, pDstResource, pSrcResource));
|
---|
1144 |
|
---|
1145 | vboxDXResourceResolveSubresource(pDevice, pDstResource, DstSubresource,
|
---|
1146 | pSrcResource, SrcSubresource, ResolveFormat);
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | static void APIENTRY ddi10ResourceMap(
|
---|
1150 | D3D10DDI_HDEVICE hDevice,
|
---|
1151 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to map.
|
---|
1152 | UINT Subresource, // An index that indicates the subresource to map.
|
---|
1153 | D3D10_DDI_MAP DDIMap, // A D3D10_DDI_MAP-typed value that indicates the access level to map the subresource to.
|
---|
1154 | UINT Flags, // A D3D10_DDI_MAP_FLAG-typed value that indicates how to map the subresource.
|
---|
1155 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource // A pointer to a D3D10DDI_MAPPED_SUBRESOURCE structure that receives the information about the mapped subresource.
|
---|
1156 | )
|
---|
1157 | {
|
---|
1158 | //DEBUG_BREAKPOINT_TEST();
|
---|
1159 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1160 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1161 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
1162 |
|
---|
1163 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
1164 | }
|
---|
1165 |
|
---|
1166 | static void APIENTRY ddi10ResourceUnmap(
|
---|
1167 | D3D10DDI_HDEVICE hDevice,
|
---|
1168 | D3D10DDI_HRESOURCE hResource, // A handle to the resource to unmap.
|
---|
1169 | UINT Subresource // An index that indicates the subresource to unmap.
|
---|
1170 | )
|
---|
1171 | {
|
---|
1172 | //DEBUG_BREAKPOINT_TEST();
|
---|
1173 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1174 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1175 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, Subresource));
|
---|
1176 |
|
---|
1177 | vboxDXResourceUnmap(pDevice, pResource, Subresource);
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | BOOL APIENTRY vboxDXResourceIsStagingBusy(
|
---|
1181 | D3D10DDI_HDEVICE hDevice,
|
---|
1182 | D3D10DDI_HRESOURCE hResource
|
---|
1183 | )
|
---|
1184 | {
|
---|
1185 | DEBUG_BREAKPOINT_TEST();
|
---|
1186 | RT_NOREF(hDevice, hResource);
|
---|
1187 | LogFlowFuncEnter();
|
---|
1188 | return TRUE;
|
---|
1189 | }
|
---|
1190 |
|
---|
1191 | static void APIENTRY ddi11_1RelocateDeviceFuncs(
|
---|
1192 | D3D10DDI_HDEVICE hDevice,
|
---|
1193 | D3D11_1DDI_DEVICEFUNCS* pDeviceFunctions // The new location of the driver function table.
|
---|
1194 | )
|
---|
1195 | {
|
---|
1196 | /* This is usually a sign of trouble. Break into debugger. */
|
---|
1197 | DEBUG_BREAKPOINT_TEST();
|
---|
1198 | RT_NOREF(hDevice, pDeviceFunctions);
|
---|
1199 | LogFlowFunc(("pDeviceFunctions %p", pDeviceFunctions));
|
---|
1200 | /* Nothing to do in this driver. */
|
---|
1201 | }
|
---|
1202 |
|
---|
1203 | static void APIENTRY ddi11RelocateDeviceFuncs(
|
---|
1204 | D3D10DDI_HDEVICE hDevice,
|
---|
1205 | D3D11DDI_DEVICEFUNCS* pDeviceFunctions // The new location of the driver function table.
|
---|
1206 | )
|
---|
1207 | {
|
---|
1208 | DEBUG_BREAKPOINT_TEST();
|
---|
1209 | RT_NOREF(hDevice, pDeviceFunctions);
|
---|
1210 | LogFlowFunc(("pDeviceFunctions %p", pDeviceFunctions));
|
---|
1211 | /* Nothing to do in this driver. */
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | static void APIENTRY ddi10_1RelocateDeviceFuncs(
|
---|
1215 | D3D10DDI_HDEVICE hDevice,
|
---|
1216 | D3D10_1DDI_DEVICEFUNCS* pDeviceFunctions // The new location of the driver function table.
|
---|
1217 | )
|
---|
1218 | {
|
---|
1219 | DEBUG_BREAKPOINT_TEST();
|
---|
1220 | RT_NOREF(hDevice, pDeviceFunctions);
|
---|
1221 | LogFlowFunc(("pDeviceFunctions %p", pDeviceFunctions));
|
---|
1222 | /* Nothing to do in this driver. */
|
---|
1223 | }
|
---|
1224 |
|
---|
1225 | static void APIENTRY ddi10RelocateDeviceFuncs(
|
---|
1226 | D3D10DDI_HDEVICE hDevice,
|
---|
1227 | D3D10DDI_DEVICEFUNCS* pDeviceFunctions // The new location of the driver function table.
|
---|
1228 | )
|
---|
1229 | {
|
---|
1230 | DEBUG_BREAKPOINT_TEST();
|
---|
1231 | RT_NOREF(hDevice, pDeviceFunctions);
|
---|
1232 | LogFlowFunc(("pDeviceFunctions %p", pDeviceFunctions));
|
---|
1233 | /* Nothing to do in this driver. */
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | static SIZE_T APIENTRY ddi11CalcPrivateResourceSize(
|
---|
1237 | D3D10DDI_HDEVICE hDevice,
|
---|
1238 | const D3D11DDIARG_CREATERESOURCE* pCreateResource // The parameters to calculate the size of the memory region.
|
---|
1239 | )
|
---|
1240 | {
|
---|
1241 | //DEBUG_BREAKPOINT_TEST();
|
---|
1242 | RT_NOREF(hDevice);
|
---|
1243 | return RT_UOFFSETOF(VBOXDX_RESOURCE, aMipInfoList) + pCreateResource->MipLevels * sizeof(D3D10DDI_MIPINFO);
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | static SIZE_T APIENTRY ddi10CalcPrivateResourceSize(
|
---|
1247 | D3D10DDI_HDEVICE hDevice,
|
---|
1248 | const D3D10DDIARG_CREATERESOURCE* pCreateResource // The parameters to calculate the size of the memory region.
|
---|
1249 | )
|
---|
1250 | {
|
---|
1251 | //DEBUG_BREAKPOINT_TEST();
|
---|
1252 | RT_NOREF(hDevice);
|
---|
1253 | return RT_UOFFSETOF(VBOXDX_RESOURCE, aMipInfoList) + pCreateResource->MipLevels * sizeof(D3D10DDI_MIPINFO);
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | static SIZE_T APIENTRY ddi10CalcPrivateOpenedResourceSize(
|
---|
1257 | D3D10DDI_HDEVICE hDevice,
|
---|
1258 | const D3D10DDIARG_OPENRESOURCE* pOpenResource // The parameters to calculate the size of the memory region.
|
---|
1259 | )
|
---|
1260 | {
|
---|
1261 | //DEBUG_BREAKPOINT_TEST();
|
---|
1262 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1263 |
|
---|
1264 | AssertReturnStmt(pOpenResource->NumAllocations == 1,
|
---|
1265 | vboxDXDeviceSetError(pDevice, E_INVALIDARG), 0);
|
---|
1266 | AssertReturnStmt(pOpenResource->pOpenAllocationInfo2[0].PrivateDriverDataSize == sizeof(VBOXDXALLOCATIONDESC),
|
---|
1267 | vboxDXDeviceSetError(pDevice, E_INVALIDARG), 0);
|
---|
1268 |
|
---|
1269 | VBOXDXALLOCATIONDESC const *pDesc = (VBOXDXALLOCATIONDESC *)pOpenResource->pOpenAllocationInfo2[0].pPrivateDriverData;
|
---|
1270 | return RT_UOFFSETOF(VBOXDX_RESOURCE, aMipInfoList) + pDesc->surfaceInfo.numMipLevels * sizeof(D3D10DDI_MIPINFO);
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | static const char* ResourceUsage2Str(D3D10_DDI_RESOURCE_USAGE usage)
|
---|
1274 | {
|
---|
1275 | switch(usage)
|
---|
1276 | {
|
---|
1277 | case D3D10_DDI_USAGE_DEFAULT:
|
---|
1278 | return "DEFAULT";
|
---|
1279 | case D3D10_DDI_USAGE_IMMUTABLE:
|
---|
1280 | return "IMMUTABLE";
|
---|
1281 | case D3D10_DDI_USAGE_DYNAMIC:
|
---|
1282 | return "DYNAMIC";
|
---|
1283 | case D3D10_DDI_USAGE_STAGING:
|
---|
1284 | return "STAGING";
|
---|
1285 | default:
|
---|
1286 | return "UNKNOWN";
|
---|
1287 | }
|
---|
1288 | }
|
---|
1289 |
|
---|
1290 | static const char* ResourceMap2Str(D3D10_DDI_MAP map)
|
---|
1291 | {
|
---|
1292 | if (map == 0)
|
---|
1293 | return "";
|
---|
1294 |
|
---|
1295 | switch(map)
|
---|
1296 | {
|
---|
1297 | case D3D10_DDI_MAP_READ:
|
---|
1298 | return "R";
|
---|
1299 | case D3D10_DDI_MAP_WRITE:
|
---|
1300 | return "W";
|
---|
1301 | case D3D10_DDI_MAP_READWRITE:
|
---|
1302 | return "RW";
|
---|
1303 | case D3D10_DDI_MAP_WRITE_DISCARD:
|
---|
1304 | return "WD";
|
---|
1305 | case D3D10_DDI_MAP_WRITE_NOOVERWRITE:
|
---|
1306 | return "WN";
|
---|
1307 | default:
|
---|
1308 | return "UNKNOWN";
|
---|
1309 | }
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 |
|
---|
1313 | static void APIENTRY ddi11CreateResource(
|
---|
1314 | D3D10DDI_HDEVICE hDevice,
|
---|
1315 | const D3D11DDIARG_CREATERESOURCE* pCreateResource, // The parameters that the user-mode display driver uses to create a resource.
|
---|
1316 | D3D10DDI_HRESOURCE hResource, // A handle to the driver's private data for the resource.
|
---|
1317 | D3D10DDI_HRTRESOURCE hRTResource // A handle to the resource to use for calls back into the Direct3D runtime.
|
---|
1318 | )
|
---|
1319 | {
|
---|
1320 | //DEBUG_BREAKPOINT_TEST();
|
---|
1321 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1322 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1323 | LogFlowFunc(("pDevice 0x%p pResource 0x%p, mipinfo (%d %d %d), pInitData 0x%p, resdim %d, usage %d %s, bind 0x%X, map 0x%X %s, misc 0x%X, format %d, miplevels %d, arraysize %d, stride %d",
|
---|
1324 | pDevice, pResource,
|
---|
1325 | pCreateResource->pMipInfoList[0].TexelWidth,
|
---|
1326 | pCreateResource->pMipInfoList[0].TexelHeight,
|
---|
1327 | pCreateResource->pMipInfoList[0].TexelDepth,
|
---|
1328 | pCreateResource->pInitialDataUP,
|
---|
1329 | pCreateResource->ResourceDimension,
|
---|
1330 | pCreateResource->Usage, ResourceUsage2Str((D3D10_DDI_RESOURCE_USAGE)pCreateResource->Usage),
|
---|
1331 | pCreateResource->BindFlags,
|
---|
1332 | pCreateResource->MapFlags, ResourceMap2Str((D3D10_DDI_MAP) pCreateResource->MapFlags),
|
---|
1333 | pCreateResource->MiscFlags,
|
---|
1334 | pCreateResource->Format,
|
---|
1335 | pCreateResource->MipLevels,
|
---|
1336 | pCreateResource->ArraySize,
|
---|
1337 | pCreateResource->ByteStride));
|
---|
1338 |
|
---|
1339 | pResource->hRTResource = hRTResource;
|
---|
1340 | int rc = vboxDXInitResourceData(pResource, pCreateResource);
|
---|
1341 | if (RT_SUCCESS(rc))
|
---|
1342 | vboxDXCreateResource(pDevice, pResource, pCreateResource);
|
---|
1343 | }
|
---|
1344 |
|
---|
1345 | static void APIENTRY ddi10CreateResource(
|
---|
1346 | D3D10DDI_HDEVICE hDevice,
|
---|
1347 | const D3D10DDIARG_CREATERESOURCE* pCreateResource, // The parameters that the user-mode display driver uses to create a resource.
|
---|
1348 | D3D10DDI_HRESOURCE hResource, // A handle to the driver's private data for the resource.
|
---|
1349 | D3D10DDI_HRTRESOURCE hRTResource // A handle to the resource to use for calls back into the Direct3D runtime.
|
---|
1350 | )
|
---|
1351 | {
|
---|
1352 | //DEBUG_BREAKPOINT_TEST();
|
---|
1353 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1354 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1355 | LogFlowFunc(("pDevice 0x%p pResource 0x%p, mipinfo (%d %d %d), pInitData 0x%p, resdim %d, usage %d %s, bind 0x%X, map 0x%X %s, misc 0x%X, format %d, miplevels %d, arraysize %d",
|
---|
1356 | pDevice, pResource,
|
---|
1357 | pCreateResource->pMipInfoList[0].TexelWidth,
|
---|
1358 | pCreateResource->pMipInfoList[0].TexelHeight,
|
---|
1359 | pCreateResource->pMipInfoList[0].TexelDepth,
|
---|
1360 | pCreateResource->pInitialDataUP,
|
---|
1361 | pCreateResource->ResourceDimension,
|
---|
1362 | pCreateResource->Usage, ResourceUsage2Str((D3D10_DDI_RESOURCE_USAGE)pCreateResource->Usage),
|
---|
1363 | pCreateResource->BindFlags,
|
---|
1364 | pCreateResource->MapFlags, ResourceMap2Str((D3D10_DDI_MAP) pCreateResource->MapFlags),
|
---|
1365 | pCreateResource->MiscFlags,
|
---|
1366 | pCreateResource->Format,
|
---|
1367 | pCreateResource->MipLevels,
|
---|
1368 | pCreateResource->ArraySize));
|
---|
1369 |
|
---|
1370 | D3D11DDIARG_CREATERESOURCE CreateResource;
|
---|
1371 | CreateResource.pMipInfoList = pCreateResource->pMipInfoList;
|
---|
1372 | CreateResource.pInitialDataUP = pCreateResource->pInitialDataUP;
|
---|
1373 | CreateResource.ResourceDimension = pCreateResource->ResourceDimension;
|
---|
1374 | CreateResource.Usage = pCreateResource->Usage;
|
---|
1375 | CreateResource.BindFlags = pCreateResource->BindFlags;
|
---|
1376 | CreateResource.MapFlags = pCreateResource->MapFlags;
|
---|
1377 | CreateResource.MiscFlags = pCreateResource->MiscFlags;
|
---|
1378 | CreateResource.Format = pCreateResource->Format;
|
---|
1379 | CreateResource.SampleDesc = pCreateResource->SampleDesc;
|
---|
1380 | CreateResource.MipLevels = pCreateResource->MipLevels;
|
---|
1381 | CreateResource.ArraySize = pCreateResource->ArraySize;
|
---|
1382 | CreateResource.pPrimaryDesc = pCreateResource->pPrimaryDesc;
|
---|
1383 | CreateResource.ByteStride = 0;
|
---|
1384 | CreateResource.DecoderBufferType = D3D11_1DDI_VIDEO_DECODER_BUFFER_UNKNOWN;
|
---|
1385 | CreateResource.TextureLayout = D3DWDDM2_0DDI_TL_UNDEFINED;
|
---|
1386 |
|
---|
1387 | pResource->hRTResource = hRTResource;
|
---|
1388 | int rc = vboxDXInitResourceData(pResource, &CreateResource);
|
---|
1389 | if (RT_SUCCESS(rc))
|
---|
1390 | vboxDXCreateResource(pDevice, pResource, &CreateResource);
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | static void APIENTRY ddi10OpenResource(
|
---|
1394 | D3D10DDI_HDEVICE hDevice,
|
---|
1395 | const D3D10DDIARG_OPENRESOURCE* pOpenResource, // The parameters that the user-mode display driver uses to open a shared resource.
|
---|
1396 | D3D10DDI_HRESOURCE hResource, // A handle to the driver's private data for the resource.
|
---|
1397 | D3D10DDI_HRTRESOURCE hRTResource // A handle to the resource to use for calls back into the Direct3D runtime.
|
---|
1398 | )
|
---|
1399 | {
|
---|
1400 | //DEBUG_BREAKPOINT_TEST();
|
---|
1401 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1402 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1403 | LogFlowFunc(("pDevice 0x%p pResource 0x%p, NumAllocations %d", pDevice, pResource, pOpenResource->NumAllocations));
|
---|
1404 |
|
---|
1405 | pResource->hRTResource = hRTResource;
|
---|
1406 | vboxDXOpenResource(pDevice, pResource, pOpenResource);
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | static void APIENTRY ddi10DestroyResource(
|
---|
1410 | D3D10DDI_HDEVICE hDevice,
|
---|
1411 | D3D10DDI_HRESOURCE hResource // A handle to the driver's private data for the resource.
|
---|
1412 | )
|
---|
1413 | {
|
---|
1414 | //DEBUG_BREAKPOINT_TEST();
|
---|
1415 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1416 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
1417 | LogFlowFunc(("pDevice 0x%p pResource 0x%p", pDevice, pResource));
|
---|
1418 |
|
---|
1419 | vboxDXDestroyResource(pDevice, pResource);
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | static SIZE_T APIENTRY ddi11CalcPrivateShaderResourceViewSize(
|
---|
1423 | D3D10DDI_HDEVICE hDevice,
|
---|
1424 | const D3D11DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView // Describes the shader resource view to create.
|
---|
1425 | )
|
---|
1426 | {
|
---|
1427 | RT_NOREF(hDevice, pCreateShaderResourceView);
|
---|
1428 | return sizeof(VBOXDXSHADERRESOURCEVIEW);
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | static SIZE_T APIENTRY ddi10_1CalcPrivateShaderResourceViewSize(
|
---|
1432 | D3D10DDI_HDEVICE hDevice,
|
---|
1433 | const D3D10_1DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView // Describes the shader resource view to create.
|
---|
1434 | )
|
---|
1435 | {
|
---|
1436 | RT_NOREF(hDevice, pCreateShaderResourceView);
|
---|
1437 | return sizeof(VBOXDXSHADERRESOURCEVIEW);
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | static SIZE_T APIENTRY ddi10CalcPrivateShaderResourceViewSize(
|
---|
1441 | D3D10DDI_HDEVICE hDevice,
|
---|
1442 | const D3D10DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView // Describes the shader resource view to create.
|
---|
1443 | )
|
---|
1444 | {
|
---|
1445 | RT_NOREF(hDevice, pCreateShaderResourceView);
|
---|
1446 | return sizeof(VBOXDXSHADERRESOURCEVIEW);
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | static void APIENTRY ddi11CreateShaderResourceView(
|
---|
1450 | D3D10DDI_HDEVICE hDevice,
|
---|
1451 | const D3D11DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView,
|
---|
1452 | D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView, // A handle to the driver's private data for the shader.
|
---|
1453 | D3D10DDI_HRTSHADERRESOURCEVIEW hRTShaderResourceView // A handle to the shader to use for calls back into the Direct3D runtime.
|
---|
1454 | )
|
---|
1455 | {
|
---|
1456 | //DEBUG_BREAKPOINT_TEST();
|
---|
1457 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1458 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateShaderResourceView->hDrvResource.pDrvPrivate;
|
---|
1459 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
1460 | LogFlowFunc(("pDevice 0x%p, pResource %p, pShaderResourceView 0x%p", pDevice, pResource, pShaderResourceView));
|
---|
1461 |
|
---|
1462 | pShaderResourceView->hRTShaderResourceView = hRTShaderResourceView;
|
---|
1463 | pShaderResourceView->pResource = pResource;
|
---|
1464 | pShaderResourceView->Format = pCreateShaderResourceView->Format;
|
---|
1465 | pShaderResourceView->ResourceDimension = pCreateShaderResourceView->ResourceDimension;
|
---|
1466 | switch (pShaderResourceView->ResourceDimension)
|
---|
1467 | {
|
---|
1468 | case D3D10DDIRESOURCE_BUFFER:
|
---|
1469 | pShaderResourceView->DimensionDesc.Buffer = pCreateShaderResourceView->Buffer;
|
---|
1470 | break;
|
---|
1471 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1472 | pShaderResourceView->DimensionDesc.Tex1D = pCreateShaderResourceView->Tex1D;
|
---|
1473 | break;
|
---|
1474 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1475 | pShaderResourceView->DimensionDesc.Tex2D = pCreateShaderResourceView->Tex2D;
|
---|
1476 | break;
|
---|
1477 | case D3D10DDIRESOURCE_TEXTURE3D:
|
---|
1478 | pShaderResourceView->DimensionDesc.Tex3D = pCreateShaderResourceView->Tex3D;
|
---|
1479 | break;
|
---|
1480 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1481 | pShaderResourceView->DimensionDesc.TexCube = pCreateShaderResourceView->TexCube;
|
---|
1482 | break;
|
---|
1483 | case D3D11DDIRESOURCE_BUFFEREX:
|
---|
1484 | pShaderResourceView->DimensionDesc.BufferEx = pCreateShaderResourceView->BufferEx;
|
---|
1485 | break;
|
---|
1486 | default:
|
---|
1487 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1488 | return;
|
---|
1489 | }
|
---|
1490 |
|
---|
1491 | vboxDXCreateShaderResourceView(pDevice, pShaderResourceView);
|
---|
1492 | }
|
---|
1493 |
|
---|
1494 | static void APIENTRY ddi10_1CreateShaderResourceView(
|
---|
1495 | D3D10DDI_HDEVICE hDevice,
|
---|
1496 | const D3D10_1DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView,
|
---|
1497 | D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView, // A handle to the driver's private data for the shader.
|
---|
1498 | D3D10DDI_HRTSHADERRESOURCEVIEW hRTShaderResourceView // A handle to the shader to use for calls back into the Direct3D runtime.
|
---|
1499 | )
|
---|
1500 | {
|
---|
1501 | //DEBUG_BREAKPOINT_TEST();
|
---|
1502 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1503 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateShaderResourceView->hDrvResource.pDrvPrivate;
|
---|
1504 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
1505 | LogFlowFunc(("pDevice 0x%p, pResource %p, pShaderResourceView 0x%p", pDevice, pResource, pShaderResourceView));
|
---|
1506 |
|
---|
1507 | pShaderResourceView->hRTShaderResourceView = hRTShaderResourceView;
|
---|
1508 | pShaderResourceView->pResource = pResource;
|
---|
1509 | pShaderResourceView->Format = pCreateShaderResourceView->Format;
|
---|
1510 | pShaderResourceView->ResourceDimension = pCreateShaderResourceView->ResourceDimension;
|
---|
1511 | switch (pShaderResourceView->ResourceDimension)
|
---|
1512 | {
|
---|
1513 | case D3D10DDIRESOURCE_BUFFER:
|
---|
1514 | pShaderResourceView->DimensionDesc.Buffer = pCreateShaderResourceView->Buffer;
|
---|
1515 | break;
|
---|
1516 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1517 | pShaderResourceView->DimensionDesc.Tex1D = pCreateShaderResourceView->Tex1D;
|
---|
1518 | break;
|
---|
1519 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1520 | pShaderResourceView->DimensionDesc.Tex2D = pCreateShaderResourceView->Tex2D;
|
---|
1521 | break;
|
---|
1522 | case D3D10DDIRESOURCE_TEXTURE3D:
|
---|
1523 | pShaderResourceView->DimensionDesc.Tex3D = pCreateShaderResourceView->Tex3D;
|
---|
1524 | break;
|
---|
1525 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1526 | pShaderResourceView->DimensionDesc.TexCube = pCreateShaderResourceView->TexCube;
|
---|
1527 | break;
|
---|
1528 | default:
|
---|
1529 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1530 | return;
|
---|
1531 | }
|
---|
1532 |
|
---|
1533 | vboxDXCreateShaderResourceView(pDevice, pShaderResourceView);
|
---|
1534 | }
|
---|
1535 |
|
---|
1536 | static void APIENTRY ddi10CreateShaderResourceView(
|
---|
1537 | D3D10DDI_HDEVICE hDevice,
|
---|
1538 | const D3D10DDIARG_CREATESHADERRESOURCEVIEW* pCreateShaderResourceView,
|
---|
1539 | D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView, // A handle to the driver's private data for the shader.
|
---|
1540 | D3D10DDI_HRTSHADERRESOURCEVIEW hRTShaderResourceView // A handle to the shader to use for calls back into the Direct3D runtime.
|
---|
1541 | )
|
---|
1542 | {
|
---|
1543 | //DEBUG_BREAKPOINT_TEST();
|
---|
1544 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1545 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateShaderResourceView->hDrvResource.pDrvPrivate;
|
---|
1546 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
1547 | LogFlowFunc(("pDevice 0x%p, pResource %p, pShaderResourceView 0x%p", pDevice, pResource, pShaderResourceView));
|
---|
1548 |
|
---|
1549 | pShaderResourceView->hRTShaderResourceView = hRTShaderResourceView;
|
---|
1550 | pShaderResourceView->pResource = pResource;
|
---|
1551 | pShaderResourceView->Format = pCreateShaderResourceView->Format;
|
---|
1552 | pShaderResourceView->ResourceDimension = pCreateShaderResourceView->ResourceDimension;
|
---|
1553 | switch (pShaderResourceView->ResourceDimension)
|
---|
1554 | {
|
---|
1555 | case D3D10DDIRESOURCE_BUFFER:
|
---|
1556 | pShaderResourceView->DimensionDesc.Buffer = pCreateShaderResourceView->Buffer;
|
---|
1557 | break;
|
---|
1558 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1559 | pShaderResourceView->DimensionDesc.Tex1D = pCreateShaderResourceView->Tex1D;
|
---|
1560 | break;
|
---|
1561 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1562 | pShaderResourceView->DimensionDesc.Tex2D = pCreateShaderResourceView->Tex2D;
|
---|
1563 | break;
|
---|
1564 | case D3D10DDIRESOURCE_TEXTURE3D:
|
---|
1565 | pShaderResourceView->DimensionDesc.Tex3D = pCreateShaderResourceView->Tex3D;
|
---|
1566 | break;
|
---|
1567 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1568 | pShaderResourceView->DimensionDesc.TexCube.MostDetailedMip = pCreateShaderResourceView->TexCube.MostDetailedMip;
|
---|
1569 | pShaderResourceView->DimensionDesc.TexCube.MipLevels = pCreateShaderResourceView->TexCube.MipLevels;
|
---|
1570 | pShaderResourceView->DimensionDesc.TexCube.First2DArrayFace = 0;
|
---|
1571 | pShaderResourceView->DimensionDesc.TexCube.NumCubes = 1;
|
---|
1572 | break;
|
---|
1573 | default:
|
---|
1574 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1575 | return;
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | vboxDXCreateShaderResourceView(pDevice, pShaderResourceView);
|
---|
1579 | }
|
---|
1580 |
|
---|
1581 | static void APIENTRY ddi10DestroyShaderResourceView(
|
---|
1582 | D3D10DDI_HDEVICE hDevice,
|
---|
1583 | D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView // A handle to the driver's private data for the shader resource view object to destroy.
|
---|
1584 | )
|
---|
1585 | {
|
---|
1586 | //DEBUG_BREAKPOINT_TEST();
|
---|
1587 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1588 | PVBOXDXSHADERRESOURCEVIEW pShaderResourceView = (PVBOXDXSHADERRESOURCEVIEW)hShaderResourceView.pDrvPrivate;
|
---|
1589 | LogFlowFunc(("pDevice 0x%p, pShaderResourceView 0x%p", pDevice, pShaderResourceView));
|
---|
1590 |
|
---|
1591 | vboxDXDestroyShaderResourceView(pDevice, pShaderResourceView);
|
---|
1592 | }
|
---|
1593 |
|
---|
1594 | static SIZE_T APIENTRY ddi10CalcPrivateRenderTargetViewSize(
|
---|
1595 | D3D10DDI_HDEVICE hDevice,
|
---|
1596 | const D3D10DDIARG_CREATERENDERTARGETVIEW* pCreateRenderTargetView // Describes the render target view to create.
|
---|
1597 | )
|
---|
1598 | {
|
---|
1599 | RT_NOREF(hDevice, pCreateRenderTargetView);
|
---|
1600 | return sizeof(VBOXDXRENDERTARGETVIEW);
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | static void APIENTRY ddi10CreateRenderTargetView(
|
---|
1604 | D3D10DDI_HDEVICE hDevice,
|
---|
1605 | const D3D10DDIARG_CREATERENDERTARGETVIEW* pCreateRenderTargetView,
|
---|
1606 | D3D10DDI_HRENDERTARGETVIEW hRenderTargetView,
|
---|
1607 | D3D10DDI_HRTRENDERTARGETVIEW hRTRenderTargetView
|
---|
1608 | )
|
---|
1609 | {
|
---|
1610 | //DEBUG_BREAKPOINT_TEST();
|
---|
1611 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1612 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateRenderTargetView->hDrvResource.pDrvPrivate;
|
---|
1613 | PVBOXDXRENDERTARGETVIEW pRenderTargetView = (PVBOXDXRENDERTARGETVIEW)hRenderTargetView.pDrvPrivate;
|
---|
1614 | LogFlowFunc(("pDevice 0x%p, pResource %p, pRenderTargetView 0x%p", pDevice, pResource, pRenderTargetView));
|
---|
1615 |
|
---|
1616 | pRenderTargetView->hRTRenderTargetView = hRTRenderTargetView;
|
---|
1617 | pRenderTargetView->pResource = pResource;
|
---|
1618 | pRenderTargetView->Format = pCreateRenderTargetView->Format;
|
---|
1619 | pRenderTargetView->ResourceDimension = pCreateRenderTargetView->ResourceDimension;
|
---|
1620 | switch (pRenderTargetView->ResourceDimension)
|
---|
1621 | {
|
---|
1622 | case D3D10DDIRESOURCE_BUFFER:
|
---|
1623 | pRenderTargetView->DimensionDesc.Buffer = pCreateRenderTargetView->Buffer;
|
---|
1624 | break;
|
---|
1625 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1626 | pRenderTargetView->DimensionDesc.Tex1D = pCreateRenderTargetView->Tex1D;
|
---|
1627 | break;
|
---|
1628 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1629 | pRenderTargetView->DimensionDesc.Tex2D = pCreateRenderTargetView->Tex2D;
|
---|
1630 | break;
|
---|
1631 | case D3D10DDIRESOURCE_TEXTURE3D:
|
---|
1632 | pRenderTargetView->DimensionDesc.Tex3D = pCreateRenderTargetView->Tex3D;
|
---|
1633 | break;
|
---|
1634 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1635 | pRenderTargetView->DimensionDesc.TexCube = pCreateRenderTargetView->TexCube;
|
---|
1636 | break;
|
---|
1637 | default:
|
---|
1638 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1639 | return;
|
---|
1640 | }
|
---|
1641 |
|
---|
1642 | vboxDXCreateRenderTargetView(pDevice, pRenderTargetView);
|
---|
1643 | }
|
---|
1644 |
|
---|
1645 | static void APIENTRY ddi10DestroyRenderTargetView(
|
---|
1646 | D3D10DDI_HDEVICE hDevice,
|
---|
1647 | D3D10DDI_HRENDERTARGETVIEW hRenderTargetView
|
---|
1648 | )
|
---|
1649 | {
|
---|
1650 | //DEBUG_BREAKPOINT_TEST();
|
---|
1651 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1652 | PVBOXDXRENDERTARGETVIEW pRenderTargetView = (PVBOXDXRENDERTARGETVIEW)hRenderTargetView.pDrvPrivate;
|
---|
1653 | LogFlowFunc(("pDevice 0x%p, pRenderTargetView 0x%p", pDevice, pRenderTargetView));
|
---|
1654 |
|
---|
1655 | vboxDXDestroyRenderTargetView(pDevice, pRenderTargetView);
|
---|
1656 | }
|
---|
1657 |
|
---|
1658 | static SIZE_T APIENTRY ddi11CalcPrivateDepthStencilViewSize(
|
---|
1659 | D3D10DDI_HDEVICE hDevice,
|
---|
1660 | const D3D11DDIARG_CREATEDEPTHSTENCILVIEW* pCreateDepthStencilView
|
---|
1661 | )
|
---|
1662 | {
|
---|
1663 | //DEBUG_BREAKPOINT_TEST();
|
---|
1664 | RT_NOREF(hDevice, pCreateDepthStencilView);
|
---|
1665 | return sizeof(VBOXDXDEPTHSTENCILVIEW);
|
---|
1666 | }
|
---|
1667 |
|
---|
1668 | static SIZE_T APIENTRY ddi10CalcPrivateDepthStencilViewSize(
|
---|
1669 | D3D10DDI_HDEVICE hDevice,
|
---|
1670 | const D3D10DDIARG_CREATEDEPTHSTENCILVIEW* pCreateDepthStencilView
|
---|
1671 | )
|
---|
1672 | {
|
---|
1673 | //DEBUG_BREAKPOINT_TEST();
|
---|
1674 | RT_NOREF(hDevice, pCreateDepthStencilView);
|
---|
1675 | return sizeof(VBOXDXDEPTHSTENCILVIEW);
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | static void APIENTRY ddi11CreateDepthStencilView(
|
---|
1679 | D3D10DDI_HDEVICE hDevice,
|
---|
1680 | const D3D11DDIARG_CREATEDEPTHSTENCILVIEW* pCreateDepthStencilView,
|
---|
1681 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView,
|
---|
1682 | D3D10DDI_HRTDEPTHSTENCILVIEW hRTDepthStencilView
|
---|
1683 | )
|
---|
1684 | {
|
---|
1685 | //DEBUG_BREAKPOINT_TEST();
|
---|
1686 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1687 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateDepthStencilView->hDrvResource.pDrvPrivate;
|
---|
1688 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
1689 | LogFlowFunc(("pDevice 0x%p, pResource %p, pDepthStencilView 0x%p", pDevice, pResource, pDepthStencilView));
|
---|
1690 |
|
---|
1691 | pDepthStencilView->hRTDepthStencilView = hRTDepthStencilView;
|
---|
1692 | pDepthStencilView->pResource = pResource;
|
---|
1693 | pDepthStencilView->Format = pCreateDepthStencilView->Format;
|
---|
1694 | pDepthStencilView->ResourceDimension = pCreateDepthStencilView->ResourceDimension;
|
---|
1695 | pDepthStencilView->Flags = pCreateDepthStencilView->Flags;
|
---|
1696 | switch (pDepthStencilView->ResourceDimension)
|
---|
1697 | {
|
---|
1698 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1699 | pDepthStencilView->DimensionDesc.Tex1D = pCreateDepthStencilView->Tex1D;
|
---|
1700 | break;
|
---|
1701 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1702 | pDepthStencilView->DimensionDesc.Tex2D = pCreateDepthStencilView->Tex2D;
|
---|
1703 | break;
|
---|
1704 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1705 | pDepthStencilView->DimensionDesc.TexCube = pCreateDepthStencilView->TexCube;
|
---|
1706 | break;
|
---|
1707 | default:
|
---|
1708 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1709 | return;
|
---|
1710 | }
|
---|
1711 |
|
---|
1712 | vboxDXCreateDepthStencilView(pDevice, pDepthStencilView);
|
---|
1713 | }
|
---|
1714 |
|
---|
1715 | static void APIENTRY ddi10CreateDepthStencilView(
|
---|
1716 | D3D10DDI_HDEVICE hDevice,
|
---|
1717 | const D3D10DDIARG_CREATEDEPTHSTENCILVIEW* pCreateDepthStencilView,
|
---|
1718 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView,
|
---|
1719 | D3D10DDI_HRTDEPTHSTENCILVIEW hRTDepthStencilView
|
---|
1720 | )
|
---|
1721 | {
|
---|
1722 | //DEBUG_BREAKPOINT_TEST();
|
---|
1723 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1724 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateDepthStencilView->hDrvResource.pDrvPrivate;
|
---|
1725 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
1726 | LogFlowFunc(("pDevice 0x%p, pResource %p, pDepthStencilView 0x%p", pDevice, pResource, pDepthStencilView));
|
---|
1727 |
|
---|
1728 | pDepthStencilView->hRTDepthStencilView = hRTDepthStencilView;
|
---|
1729 | pDepthStencilView->pResource = pResource;
|
---|
1730 | pDepthStencilView->Format = pCreateDepthStencilView->Format;
|
---|
1731 | pDepthStencilView->ResourceDimension = pCreateDepthStencilView->ResourceDimension;
|
---|
1732 | switch (pDepthStencilView->ResourceDimension)
|
---|
1733 | {
|
---|
1734 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
1735 | pDepthStencilView->DimensionDesc.Tex1D = pCreateDepthStencilView->Tex1D;
|
---|
1736 | break;
|
---|
1737 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
1738 | pDepthStencilView->DimensionDesc.Tex2D = pCreateDepthStencilView->Tex2D;
|
---|
1739 | break;
|
---|
1740 | case D3D10DDIRESOURCE_TEXTURECUBE:
|
---|
1741 | pDepthStencilView->DimensionDesc.TexCube = pCreateDepthStencilView->TexCube;
|
---|
1742 | break;
|
---|
1743 | default:
|
---|
1744 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
1745 | return;
|
---|
1746 | }
|
---|
1747 |
|
---|
1748 | vboxDXCreateDepthStencilView(pDevice, pDepthStencilView);
|
---|
1749 | }
|
---|
1750 |
|
---|
1751 | static void APIENTRY ddi10DestroyDepthStencilView(
|
---|
1752 | D3D10DDI_HDEVICE hDevice,
|
---|
1753 | D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView
|
---|
1754 | )
|
---|
1755 | {
|
---|
1756 | //DEBUG_BREAKPOINT_TEST();
|
---|
1757 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1758 | PVBOXDXDEPTHSTENCILVIEW pDepthStencilView = (PVBOXDXDEPTHSTENCILVIEW)hDepthStencilView.pDrvPrivate;
|
---|
1759 | LogFlowFunc(("pDevice 0x%p, pDepthStencilView 0x%p", pDevice, pDepthStencilView));
|
---|
1760 |
|
---|
1761 | vboxDXDestroyDepthStencilView(pDevice, pDepthStencilView);
|
---|
1762 | }
|
---|
1763 |
|
---|
1764 | static SIZE_T APIENTRY ddi10CalcPrivateElementLayoutSize(
|
---|
1765 | D3D10DDI_HDEVICE hDevice,
|
---|
1766 | const D3D10DDIARG_CREATEELEMENTLAYOUT* pCreateElementLayout
|
---|
1767 | )
|
---|
1768 | {
|
---|
1769 | //DEBUG_BREAKPOINT_TEST();
|
---|
1770 | RT_NOREF(hDevice);
|
---|
1771 | return RT_UOFFSETOF(VBOXDXELEMENTLAYOUT, aVertexElements)
|
---|
1772 | + pCreateElementLayout->NumElements * sizeof(D3D10DDIARG_INPUT_ELEMENT_DESC);
|
---|
1773 | }
|
---|
1774 |
|
---|
1775 | static void APIENTRY ddi10CreateElementLayout(
|
---|
1776 | D3D10DDI_HDEVICE hDevice,
|
---|
1777 | const D3D10DDIARG_CREATEELEMENTLAYOUT* pCreateElementLayout,
|
---|
1778 | D3D10DDI_HELEMENTLAYOUT hElementLayout,
|
---|
1779 | D3D10DDI_HRTELEMENTLAYOUT hRTElementLayout
|
---|
1780 | )
|
---|
1781 | {
|
---|
1782 | //DEBUG_BREAKPOINT_TEST();
|
---|
1783 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1784 | PVBOXDXELEMENTLAYOUT pElementLayout = (PVBOXDXELEMENTLAYOUT)hElementLayout.pDrvPrivate;
|
---|
1785 | LogFlowFunc(("pDevice 0x%p, pElementLayout 0x%p", pDevice, pElementLayout));
|
---|
1786 |
|
---|
1787 | pElementLayout->hRTElementLayout = hRTElementLayout;
|
---|
1788 | pElementLayout->NumElements = pCreateElementLayout->NumElements;
|
---|
1789 | for (unsigned i = 0; i < pCreateElementLayout->NumElements; ++i)
|
---|
1790 | pElementLayout->aVertexElements[i] = pCreateElementLayout->pVertexElements[i];
|
---|
1791 |
|
---|
1792 | vboxDXCreateElementLayout(pDevice, pElementLayout);
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 | static void APIENTRY ddi10DestroyElementLayout(
|
---|
1796 | D3D10DDI_HDEVICE hDevice,
|
---|
1797 | D3D10DDI_HELEMENTLAYOUT hElementLayout
|
---|
1798 | )
|
---|
1799 | {
|
---|
1800 | //DEBUG_BREAKPOINT_TEST();
|
---|
1801 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1802 | PVBOXDXELEMENTLAYOUT pElementLayout = (PVBOXDXELEMENTLAYOUT)hElementLayout.pDrvPrivate;
|
---|
1803 | LogFlowFunc(("pDevice 0x%p, pElementLayout 0x%p", pDevice, pElementLayout));
|
---|
1804 |
|
---|
1805 | vboxDXDestroyElementLayout(pDevice, pElementLayout);
|
---|
1806 | }
|
---|
1807 |
|
---|
1808 | static SIZE_T APIENTRY ddi11_1CalcPrivateBlendStateSize(
|
---|
1809 | D3D10DDI_HDEVICE hDevice,
|
---|
1810 | const D3D11_1_DDI_BLEND_DESC* pBlendDesc
|
---|
1811 | )
|
---|
1812 | {
|
---|
1813 | //DEBUG_BREAKPOINT_TEST();
|
---|
1814 | RT_NOREF(hDevice, pBlendDesc);
|
---|
1815 | return sizeof(VBOXDX_BLENDSTATE);
|
---|
1816 | }
|
---|
1817 |
|
---|
1818 | static SIZE_T APIENTRY ddi10_1CalcPrivateBlendStateSize(
|
---|
1819 | D3D10DDI_HDEVICE hDevice,
|
---|
1820 | const D3D10_1_DDI_BLEND_DESC* pBlendDesc
|
---|
1821 | )
|
---|
1822 | {
|
---|
1823 | //DEBUG_BREAKPOINT_TEST();
|
---|
1824 | RT_NOREF(hDevice, pBlendDesc);
|
---|
1825 | return sizeof(VBOXDX_BLENDSTATE);
|
---|
1826 | }
|
---|
1827 |
|
---|
1828 | static SIZE_T APIENTRY ddi10CalcPrivateBlendStateSize(
|
---|
1829 | D3D10DDI_HDEVICE hDevice,
|
---|
1830 | const D3D10_DDI_BLEND_DESC* pBlendDesc
|
---|
1831 | )
|
---|
1832 | {
|
---|
1833 | //DEBUG_BREAKPOINT_TEST();
|
---|
1834 | RT_NOREF(hDevice, pBlendDesc);
|
---|
1835 | return sizeof(VBOXDX_BLENDSTATE);
|
---|
1836 | }
|
---|
1837 |
|
---|
1838 | static void APIENTRY ddi11_1CreateBlendState(
|
---|
1839 | D3D10DDI_HDEVICE hDevice,
|
---|
1840 | const D3D11_1_DDI_BLEND_DESC* pBlendDesc,
|
---|
1841 | D3D10DDI_HBLENDSTATE hBlendState,
|
---|
1842 | D3D10DDI_HRTBLENDSTATE hRTBlendState
|
---|
1843 | )
|
---|
1844 | {
|
---|
1845 | //DEBUG_BREAKPOINT_TEST();
|
---|
1846 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1847 | PVBOXDX_BLENDSTATE pBlendState = (PVBOXDX_BLENDSTATE)hBlendState.pDrvPrivate;
|
---|
1848 | LogFlowFunc(("pDevice 0x%p, pBlendState 0x%p, RT[0] BlendEnable %d\n", pDevice, pBlendState, pBlendDesc->RenderTarget[0].BlendEnable));
|
---|
1849 |
|
---|
1850 | /* Init the blend state and allocate blend id. */
|
---|
1851 | pBlendState->hRTBlendState = hRTBlendState;
|
---|
1852 | pBlendState->BlendDesc = *pBlendDesc;
|
---|
1853 |
|
---|
1854 | vboxDXCreateBlendState(pDevice, pBlendState);
|
---|
1855 | }
|
---|
1856 |
|
---|
1857 | static void APIENTRY ddi10_1CreateBlendState(
|
---|
1858 | D3D10DDI_HDEVICE hDevice,
|
---|
1859 | const D3D10_1_DDI_BLEND_DESC* pBlendDesc,
|
---|
1860 | D3D10DDI_HBLENDSTATE hBlendState,
|
---|
1861 | D3D10DDI_HRTBLENDSTATE hRTBlendState
|
---|
1862 | )
|
---|
1863 | {
|
---|
1864 | //DEBUG_BREAKPOINT_TEST();
|
---|
1865 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1866 | PVBOXDX_BLENDSTATE pBlendState = (PVBOXDX_BLENDSTATE)hBlendState.pDrvPrivate;
|
---|
1867 | LogFlowFunc(("pDevice 0x%p, pBlendState 0x%p, RT[0] BlendEnable %d\n", pDevice, pBlendState, pBlendDesc->RenderTarget[0].BlendEnable));
|
---|
1868 |
|
---|
1869 | /* Init the blend state and allocate blend id. */
|
---|
1870 | pBlendState->hRTBlendState = hRTBlendState;
|
---|
1871 | pBlendState->BlendDesc.AlphaToCoverageEnable = pBlendDesc->AlphaToCoverageEnable;
|
---|
1872 | pBlendState->BlendDesc.IndependentBlendEnable = pBlendDesc->IndependentBlendEnable;
|
---|
1873 | for (unsigned i = 0; i < D3D10_DDI_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
|
---|
1874 | {
|
---|
1875 | D3D10_DDI_RENDER_TARGET_BLEND_DESC1 const *src = &pBlendDesc->RenderTarget[i];
|
---|
1876 | D3D11_1_DDI_RENDER_TARGET_BLEND_DESC *dst = &pBlendState->BlendDesc.RenderTarget[i];
|
---|
1877 | dst->BlendEnable = src->BlendEnable;
|
---|
1878 | dst->LogicOpEnable = FALSE;
|
---|
1879 | dst->SrcBlend = src->SrcBlend;
|
---|
1880 | dst->DestBlend = src->DestBlend;
|
---|
1881 | dst->BlendOp = src->BlendOp;
|
---|
1882 | dst->SrcBlendAlpha = src->SrcBlendAlpha;
|
---|
1883 | dst->DestBlendAlpha = src->DestBlendAlpha;
|
---|
1884 | dst->BlendOpAlpha = src->BlendOpAlpha;
|
---|
1885 | dst->LogicOp = D3D11_1_DDI_LOGIC_OP_CLEAR;
|
---|
1886 | dst->RenderTargetWriteMask = src->RenderTargetWriteMask;
|
---|
1887 | }
|
---|
1888 |
|
---|
1889 | vboxDXCreateBlendState(pDevice, pBlendState);
|
---|
1890 | }
|
---|
1891 |
|
---|
1892 | static void APIENTRY ddi10CreateBlendState(
|
---|
1893 | D3D10DDI_HDEVICE hDevice,
|
---|
1894 | const D3D10_DDI_BLEND_DESC* pBlendDesc,
|
---|
1895 | D3D10DDI_HBLENDSTATE hBlendState,
|
---|
1896 | D3D10DDI_HRTBLENDSTATE hRTBlendState
|
---|
1897 | )
|
---|
1898 | {
|
---|
1899 | //DEBUG_BREAKPOINT_TEST();
|
---|
1900 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1901 | PVBOXDX_BLENDSTATE pBlendState = (PVBOXDX_BLENDSTATE)hBlendState.pDrvPrivate;
|
---|
1902 | LogFlowFunc(("pDevice 0x%p, pBlendState 0x%p, RT[0] BlendEnable %d", pDevice, pBlendState, pBlendDesc->BlendEnable[0]));
|
---|
1903 |
|
---|
1904 | /* Init the blend state and allocate blend id. */
|
---|
1905 | pBlendState->hRTBlendState = hRTBlendState;
|
---|
1906 | pBlendState->BlendDesc.AlphaToCoverageEnable = pBlendDesc->AlphaToCoverageEnable;
|
---|
1907 | for (unsigned i = 0; i < D3D10_DDI_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
|
---|
1908 | {
|
---|
1909 | D3D11_1_DDI_RENDER_TARGET_BLEND_DESC *dst = &pBlendState->BlendDesc.RenderTarget[i];
|
---|
1910 | dst->BlendEnable = pBlendDesc->BlendEnable[i];
|
---|
1911 | dst->LogicOpEnable = FALSE;
|
---|
1912 | dst->SrcBlend = pBlendDesc->SrcBlend;
|
---|
1913 | dst->DestBlend = pBlendDesc->DestBlend;
|
---|
1914 | dst->BlendOp = pBlendDesc->BlendOp;
|
---|
1915 | dst->SrcBlendAlpha = pBlendDesc->SrcBlendAlpha;
|
---|
1916 | dst->DestBlendAlpha = pBlendDesc->DestBlendAlpha;
|
---|
1917 | dst->BlendOpAlpha = pBlendDesc->BlendOpAlpha;
|
---|
1918 | dst->LogicOp = D3D11_1_DDI_LOGIC_OP_CLEAR;
|
---|
1919 | dst->RenderTargetWriteMask = pBlendDesc->RenderTargetWriteMask[i];
|
---|
1920 | }
|
---|
1921 |
|
---|
1922 | vboxDXCreateBlendState(pDevice, pBlendState);
|
---|
1923 | }
|
---|
1924 |
|
---|
1925 | static void APIENTRY ddi10DestroyBlendState(
|
---|
1926 | D3D10DDI_HDEVICE hDevice,
|
---|
1927 | D3D10DDI_HBLENDSTATE hBlendState
|
---|
1928 | )
|
---|
1929 | {
|
---|
1930 | //DEBUG_BREAKPOINT_TEST();
|
---|
1931 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1932 | PVBOXDX_BLENDSTATE pBlendState = (PVBOXDX_BLENDSTATE)hBlendState.pDrvPrivate;
|
---|
1933 | LogFlowFunc(("pDevice 0x%p, hBlendState 0x%p", pDevice, pBlendState));
|
---|
1934 |
|
---|
1935 | vboxDXDestroyBlendState(pDevice, pBlendState);
|
---|
1936 | }
|
---|
1937 |
|
---|
1938 | static SIZE_T APIENTRY ddi10CalcPrivateDepthStencilStateSize(
|
---|
1939 | D3D10DDI_HDEVICE hDevice,
|
---|
1940 | const D3D10_DDI_DEPTH_STENCIL_DESC* pDepthStencilDesc
|
---|
1941 | )
|
---|
1942 | {
|
---|
1943 | //DEBUG_BREAKPOINT_TEST();
|
---|
1944 | RT_NOREF(hDevice, pDepthStencilDesc);
|
---|
1945 | return sizeof(VBOXDX_DEPTHSTENCIL_STATE);
|
---|
1946 | }
|
---|
1947 |
|
---|
1948 | static void APIENTRY ddi10CreateDepthStencilState(
|
---|
1949 | D3D10DDI_HDEVICE hDevice,
|
---|
1950 | const D3D10_DDI_DEPTH_STENCIL_DESC* pDepthStencilDesc,
|
---|
1951 | D3D10DDI_HDEPTHSTENCILSTATE hDepthStencilState,
|
---|
1952 | D3D10DDI_HRTDEPTHSTENCILSTATE hRTDepthStencilState
|
---|
1953 | )
|
---|
1954 | {
|
---|
1955 | //DEBUG_BREAKPOINT_TEST();
|
---|
1956 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1957 | PVBOXDX_DEPTHSTENCIL_STATE pDepthStencilState = (PVBOXDX_DEPTHSTENCIL_STATE)hDepthStencilState.pDrvPrivate;
|
---|
1958 | LogFlowFunc(("pDevice 0x%p, hDepthStencilState 0x%p, DepthEnable %d, StencilEnable %d", pDevice, hDepthStencilState, pDepthStencilDesc->DepthEnable, pDepthStencilDesc->StencilEnable));
|
---|
1959 |
|
---|
1960 | pDepthStencilState->hRTDepthStencilState = hRTDepthStencilState;
|
---|
1961 | pDepthStencilState->DepthStencilDesc = *pDepthStencilDesc;
|
---|
1962 |
|
---|
1963 | vboxDXCreateDepthStencilState(pDevice, pDepthStencilState);
|
---|
1964 | }
|
---|
1965 |
|
---|
1966 | static void APIENTRY ddi10DestroyDepthStencilState(
|
---|
1967 | D3D10DDI_HDEVICE hDevice,
|
---|
1968 | D3D10DDI_HDEPTHSTENCILSTATE hDepthStencilState
|
---|
1969 | )
|
---|
1970 | {
|
---|
1971 | //DEBUG_BREAKPOINT_TEST();
|
---|
1972 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
1973 | PVBOXDX_DEPTHSTENCIL_STATE pDepthStencilState = (PVBOXDX_DEPTHSTENCIL_STATE)hDepthStencilState.pDrvPrivate;
|
---|
1974 | LogFlowFunc(("pDevice 0x%p, pDepthStencilState 0x%p", pDevice, pDepthStencilState));
|
---|
1975 |
|
---|
1976 | vboxDXDestroyDepthStencilState(pDevice, pDepthStencilState);
|
---|
1977 | }
|
---|
1978 |
|
---|
1979 | static SIZE_T APIENTRY ddi11_1CalcPrivateRasterizerStateSize(
|
---|
1980 | D3D10DDI_HDEVICE hDevice,
|
---|
1981 | const D3D11_1_DDI_RASTERIZER_DESC* pRasterizerDesc
|
---|
1982 | )
|
---|
1983 | {
|
---|
1984 | //DEBUG_BREAKPOINT_TEST();
|
---|
1985 | RT_NOREF(hDevice, pRasterizerDesc);
|
---|
1986 | return sizeof(VBOXDX_RASTERIZER_STATE);
|
---|
1987 | }
|
---|
1988 |
|
---|
1989 | static SIZE_T APIENTRY ddi10CalcPrivateRasterizerStateSize(
|
---|
1990 | D3D10DDI_HDEVICE hDevice,
|
---|
1991 | const D3D10_DDI_RASTERIZER_DESC* pRasterizerDesc
|
---|
1992 | )
|
---|
1993 | {
|
---|
1994 | //DEBUG_BREAKPOINT_TEST();
|
---|
1995 | RT_NOREF(hDevice, pRasterizerDesc);
|
---|
1996 | return sizeof(VBOXDX_RASTERIZER_STATE);
|
---|
1997 | }
|
---|
1998 |
|
---|
1999 | static void APIENTRY ddi11_1CreateRasterizerState(
|
---|
2000 | D3D10DDI_HDEVICE hDevice,
|
---|
2001 | const D3D11_1_DDI_RASTERIZER_DESC* pRasterizerDesc,
|
---|
2002 | D3D10DDI_HRASTERIZERSTATE hRasterizerState,
|
---|
2003 | D3D10DDI_HRTRASTERIZERSTATE hRTRasterizerState
|
---|
2004 | )
|
---|
2005 | {
|
---|
2006 | //DEBUG_BREAKPOINT_TEST();
|
---|
2007 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2008 | PVBOXDX_RASTERIZER_STATE pRasterizerState = (PVBOXDX_RASTERIZER_STATE)hRasterizerState.pDrvPrivate;
|
---|
2009 | LogFlowFunc(("pDevice 0x%p, hRasterizerState 0x%p, FillMode %d, CullMode %d", pDevice, hRasterizerState, pRasterizerDesc->FillMode, pRasterizerDesc->CullMode));
|
---|
2010 |
|
---|
2011 | pRasterizerState->hRTRasterizerState = hRTRasterizerState;
|
---|
2012 | pRasterizerState->RasterizerDesc = *pRasterizerDesc;
|
---|
2013 |
|
---|
2014 | vboxDXCreateRasterizerState(pDevice, pRasterizerState);
|
---|
2015 | }
|
---|
2016 |
|
---|
2017 | static void APIENTRY ddi10CreateRasterizerState(
|
---|
2018 | D3D10DDI_HDEVICE hDevice,
|
---|
2019 | const D3D10_DDI_RASTERIZER_DESC* pRasterizerDesc,
|
---|
2020 | D3D10DDI_HRASTERIZERSTATE hRasterizerState,
|
---|
2021 | D3D10DDI_HRTRASTERIZERSTATE hRTRasterizerState
|
---|
2022 | )
|
---|
2023 | {
|
---|
2024 | //DEBUG_BREAKPOINT_TEST();
|
---|
2025 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2026 | PVBOXDX_RASTERIZER_STATE pRasterizerState = (PVBOXDX_RASTERIZER_STATE)hRasterizerState.pDrvPrivate;
|
---|
2027 | LogFlowFunc(("pDevice 0x%p, hRasterizerState 0x%p, FillMode %d, CullMode %d", pDevice, hRasterizerState, pRasterizerDesc->FillMode, pRasterizerDesc->CullMode));
|
---|
2028 |
|
---|
2029 | pRasterizerState->hRTRasterizerState = hRTRasterizerState;
|
---|
2030 | pRasterizerState->RasterizerDesc.FillMode = pRasterizerDesc->FillMode;
|
---|
2031 | pRasterizerState->RasterizerDesc.CullMode = pRasterizerDesc->CullMode;
|
---|
2032 | pRasterizerState->RasterizerDesc.FrontCounterClockwise = pRasterizerDesc->FrontCounterClockwise;
|
---|
2033 | pRasterizerState->RasterizerDesc.DepthBias = pRasterizerDesc->DepthBias;
|
---|
2034 | pRasterizerState->RasterizerDesc.DepthBiasClamp = pRasterizerDesc->DepthBiasClamp;
|
---|
2035 | pRasterizerState->RasterizerDesc.SlopeScaledDepthBias = pRasterizerDesc->SlopeScaledDepthBias;
|
---|
2036 | pRasterizerState->RasterizerDesc.DepthClipEnable = pRasterizerDesc->DepthClipEnable;
|
---|
2037 | pRasterizerState->RasterizerDesc.ScissorEnable = pRasterizerDesc->ScissorEnable;
|
---|
2038 | pRasterizerState->RasterizerDesc.MultisampleEnable = pRasterizerDesc->MultisampleEnable;
|
---|
2039 | pRasterizerState->RasterizerDesc.AntialiasedLineEnable = pRasterizerDesc->AntialiasedLineEnable;
|
---|
2040 | pRasterizerState->RasterizerDesc.ForcedSampleCount = 0;
|
---|
2041 |
|
---|
2042 | vboxDXCreateRasterizerState(pDevice, pRasterizerState);
|
---|
2043 | }
|
---|
2044 |
|
---|
2045 | static void APIENTRY ddi10DestroyRasterizerState(
|
---|
2046 | D3D10DDI_HDEVICE hDevice,
|
---|
2047 | D3D10DDI_HRASTERIZERSTATE hRasterizerState
|
---|
2048 | )
|
---|
2049 | {
|
---|
2050 | //DEBUG_BREAKPOINT_TEST();
|
---|
2051 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2052 | PVBOXDX_RASTERIZER_STATE pRasterizerState = (PVBOXDX_RASTERIZER_STATE)hRasterizerState.pDrvPrivate;
|
---|
2053 | LogFlowFunc(("pDevice 0x%p, hRasterizerState 0x%p", pDevice, pRasterizerState));
|
---|
2054 |
|
---|
2055 | vboxDXDestroyRasterizerState(pDevice, pRasterizerState);
|
---|
2056 | }
|
---|
2057 |
|
---|
2058 | static SIZE_T APIENTRY ddi11_1CalcPrivateShaderSize(
|
---|
2059 | D3D10DDI_HDEVICE hDevice,
|
---|
2060 | const UINT* pShaderCode, // A pointer to an array of CONST UINT tokens that make up the shader code.
|
---|
2061 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2062 | )
|
---|
2063 | {
|
---|
2064 | //DEBUG_BREAKPOINT_TEST();
|
---|
2065 | RT_NOREF(hDevice);
|
---|
2066 | return sizeof(VBOXDXSHADER)
|
---|
2067 | + pShaderCode[1] * sizeof(UINT)
|
---|
2068 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
2069 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
2070 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
2071 | }
|
---|
2072 |
|
---|
2073 | static SIZE_T APIENTRY ddi10CalcPrivateShaderSize(
|
---|
2074 | D3D10DDI_HDEVICE hDevice,
|
---|
2075 | const UINT* pShaderCode, // A pointer to an array of CONST UINT tokens that make up the shader code.
|
---|
2076 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2077 | )
|
---|
2078 | {
|
---|
2079 | //DEBUG_BREAKPOINT_TEST();
|
---|
2080 | RT_NOREF(hDevice);
|
---|
2081 | return sizeof(VBOXDXSHADER)
|
---|
2082 | + pShaderCode[1] * sizeof(UINT)
|
---|
2083 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
2084 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
2085 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
2086 | }
|
---|
2087 |
|
---|
2088 | static void APIENTRY ddi11_1CreateVertexShader(
|
---|
2089 | D3D10DDI_HDEVICE hDevice,
|
---|
2090 | const UINT* pShaderCode,
|
---|
2091 | D3D10DDI_HSHADER hShader,
|
---|
2092 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2093 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2094 | )
|
---|
2095 | {
|
---|
2096 | //DEBUG_BREAKPOINT_TEST();
|
---|
2097 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2098 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2099 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2100 |
|
---|
2101 | pShader->hRTShader = hRTShader;
|
---|
2102 |
|
---|
2103 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_VS, pShader, pShaderCode,
|
---|
2104 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2105 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2106 | }
|
---|
2107 |
|
---|
2108 | static void APIENTRY ddi10CreateVertexShader(
|
---|
2109 | D3D10DDI_HDEVICE hDevice,
|
---|
2110 | const UINT* pShaderCode,
|
---|
2111 | D3D10DDI_HSHADER hShader,
|
---|
2112 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2113 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2114 | )
|
---|
2115 | {
|
---|
2116 | //DEBUG_BREAKPOINT_TEST();
|
---|
2117 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2118 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2119 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2120 |
|
---|
2121 | pShader->hRTShader = hRTShader;
|
---|
2122 |
|
---|
2123 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
2124 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
2125 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
2126 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries;
|
---|
2127 | if (cSignatures)
|
---|
2128 | {
|
---|
2129 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
2130 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2131 | paInputSignature = paSignature;
|
---|
2132 | paOutputSignature = &paSignature[pSignatures->NumInputSignatureEntries];
|
---|
2133 |
|
---|
2134 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
2135 | {
|
---|
2136 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
2137 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
2138 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
2139 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2140 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2141 | }
|
---|
2142 |
|
---|
2143 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
2144 | {
|
---|
2145 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
2146 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
2147 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
2148 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2149 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2150 | }
|
---|
2151 | }
|
---|
2152 |
|
---|
2153 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_VS, pShader, pShaderCode,
|
---|
2154 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2155 | paOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2156 | RTMemTmpFree(paSignature);
|
---|
2157 | }
|
---|
2158 |
|
---|
2159 | static void APIENTRY ddi11_1CreateGeometryShader(
|
---|
2160 | D3D10DDI_HDEVICE hDevice,
|
---|
2161 | const UINT* pShaderCode,
|
---|
2162 | D3D10DDI_HSHADER hShader,
|
---|
2163 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2164 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2165 | )
|
---|
2166 | {
|
---|
2167 | //DEBUG_BREAKPOINT_TEST();
|
---|
2168 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2169 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2170 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2171 |
|
---|
2172 | pShader->hRTShader = hRTShader;
|
---|
2173 |
|
---|
2174 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader, pShaderCode,
|
---|
2175 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2176 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2177 | }
|
---|
2178 |
|
---|
2179 | static void APIENTRY ddi10CreateGeometryShader(
|
---|
2180 | D3D10DDI_HDEVICE hDevice,
|
---|
2181 | const UINT* pShaderCode,
|
---|
2182 | D3D10DDI_HSHADER hShader,
|
---|
2183 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2184 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2185 | )
|
---|
2186 | {
|
---|
2187 | //DEBUG_BREAKPOINT_TEST();
|
---|
2188 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2189 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2190 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2191 |
|
---|
2192 | pShader->hRTShader = hRTShader;
|
---|
2193 |
|
---|
2194 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
2195 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
2196 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
2197 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries;
|
---|
2198 | if (cSignatures)
|
---|
2199 | {
|
---|
2200 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
2201 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2202 | paInputSignature = paSignature;
|
---|
2203 | paOutputSignature = &paSignature[pSignatures->NumInputSignatureEntries];
|
---|
2204 |
|
---|
2205 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
2206 | {
|
---|
2207 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
2208 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
2209 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
2210 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2211 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2212 | }
|
---|
2213 |
|
---|
2214 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
2215 | {
|
---|
2216 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
2217 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
2218 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
2219 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2220 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2221 | }
|
---|
2222 | }
|
---|
2223 |
|
---|
2224 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader, pShaderCode,
|
---|
2225 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2226 | paOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2227 | RTMemTmpFree(paSignature);
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 |
|
---|
2231 | static void APIENTRY ddi11_1CreatePixelShader(
|
---|
2232 | D3D10DDI_HDEVICE hDevice,
|
---|
2233 | const UINT* pShaderCode,
|
---|
2234 | D3D10DDI_HSHADER hShader,
|
---|
2235 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2236 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2237 | )
|
---|
2238 | {
|
---|
2239 | //DEBUG_BREAKPOINT_TEST();
|
---|
2240 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2241 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2242 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2243 |
|
---|
2244 | pShader->hRTShader = hRTShader;
|
---|
2245 |
|
---|
2246 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_PS, pShader, pShaderCode,
|
---|
2247 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2248 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2249 | }
|
---|
2250 |
|
---|
2251 | static void APIENTRY ddi10CreatePixelShader(
|
---|
2252 | D3D10DDI_HDEVICE hDevice,
|
---|
2253 | const UINT* pShaderCode,
|
---|
2254 | D3D10DDI_HSHADER hShader,
|
---|
2255 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2256 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2257 | )
|
---|
2258 | {
|
---|
2259 | //DEBUG_BREAKPOINT_TEST();
|
---|
2260 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2261 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2262 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
2263 |
|
---|
2264 | pShader->hRTShader = hRTShader;
|
---|
2265 |
|
---|
2266 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
2267 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
2268 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
2269 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries;
|
---|
2270 | if (cSignatures)
|
---|
2271 | {
|
---|
2272 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
2273 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2274 | paInputSignature = paSignature;
|
---|
2275 | paOutputSignature = &paSignature[pSignatures->NumInputSignatureEntries];
|
---|
2276 |
|
---|
2277 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
2278 | {
|
---|
2279 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
2280 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
2281 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
2282 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2283 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2284 | }
|
---|
2285 |
|
---|
2286 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
2287 | {
|
---|
2288 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
2289 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
2290 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
2291 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2292 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2293 | }
|
---|
2294 | }
|
---|
2295 |
|
---|
2296 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_PS, pShader, pShaderCode,
|
---|
2297 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2298 | paOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2299 | RTMemTmpFree(paSignature);
|
---|
2300 | }
|
---|
2301 |
|
---|
2302 |
|
---|
2303 | static SIZE_T APIENTRY ddi11_1CalcPrivateGeometryShaderWithStreamOutput(
|
---|
2304 | D3D10DDI_HDEVICE hDevice,
|
---|
2305 | const D3D11DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2306 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2307 | )
|
---|
2308 | {
|
---|
2309 | //DEBUG_BREAKPOINT_TEST();
|
---|
2310 | RT_NOREF(hDevice);
|
---|
2311 | return sizeof(VBOXDXSHADER)
|
---|
2312 | + (pCreateGSWithSO->pShaderCode ? pCreateGSWithSO->pShaderCode[1] * sizeof(UINT) : 0)
|
---|
2313 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
2314 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
2315 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
2316 | }
|
---|
2317 |
|
---|
2318 | static SIZE_T APIENTRY ddi11CalcPrivateGeometryShaderWithStreamOutput(
|
---|
2319 | D3D10DDI_HDEVICE hDevice,
|
---|
2320 | const D3D11DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2321 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2322 | )
|
---|
2323 | {
|
---|
2324 | //DEBUG_BREAKPOINT_TEST();
|
---|
2325 | RT_NOREF(hDevice);
|
---|
2326 | return sizeof(VBOXDXSHADER)
|
---|
2327 | + (pCreateGSWithSO->pShaderCode ? pCreateGSWithSO->pShaderCode[1] * sizeof(UINT) : 0)
|
---|
2328 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
2329 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
2330 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
2331 | }
|
---|
2332 |
|
---|
2333 | static SIZE_T APIENTRY ddi10CalcPrivateGeometryShaderWithStreamOutput(
|
---|
2334 | D3D10DDI_HDEVICE hDevice,
|
---|
2335 | const D3D10DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2336 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2337 | )
|
---|
2338 | {
|
---|
2339 | //DEBUG_BREAKPOINT_TEST();
|
---|
2340 | RT_NOREF(hDevice);
|
---|
2341 | return sizeof(VBOXDXSHADER)
|
---|
2342 | + (pCreateGSWithSO->pShaderCode ? pCreateGSWithSO->pShaderCode[1] * sizeof(UINT) : 0)
|
---|
2343 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
2344 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
2345 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
2346 | }
|
---|
2347 |
|
---|
2348 | static void APIENTRY ddi11_1CreateGeometryShaderWithStreamOutput(
|
---|
2349 | D3D10DDI_HDEVICE hDevice,
|
---|
2350 | const D3D11DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2351 | D3D10DDI_HSHADER hShader,
|
---|
2352 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2353 | const D3D11_1DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2354 | )
|
---|
2355 | {
|
---|
2356 | //DEBUG_BREAKPOINT_TEST();
|
---|
2357 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2358 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2359 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, pShaderCode 0x%p", pDevice, pShader, pCreateGSWithSO->pShaderCode));
|
---|
2360 |
|
---|
2361 | pShader->hRTShader = hRTShader;
|
---|
2362 |
|
---|
2363 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader, pCreateGSWithSO->pShaderCode,
|
---|
2364 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2365 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2366 |
|
---|
2367 | vboxDXCreateStreamOutput(pDevice, pShader, pCreateGSWithSO->pOutputStreamDecl, pCreateGSWithSO->NumEntries,
|
---|
2368 | pCreateGSWithSO->BufferStridesInBytes, pCreateGSWithSO->NumStrides,
|
---|
2369 | pCreateGSWithSO->RasterizedStream);
|
---|
2370 | }
|
---|
2371 |
|
---|
2372 | static void APIENTRY ddi11CreateGeometryShaderWithStreamOutput(
|
---|
2373 | D3D10DDI_HDEVICE hDevice,
|
---|
2374 | const D3D11DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2375 | D3D10DDI_HSHADER hShader,
|
---|
2376 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2377 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2378 | )
|
---|
2379 | {
|
---|
2380 | //DEBUG_BREAKPOINT_TEST();
|
---|
2381 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2382 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2383 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, pShaderCode 0x%p", pDevice, pShader, pCreateGSWithSO->pShaderCode));
|
---|
2384 |
|
---|
2385 | pShader->hRTShader = hRTShader;
|
---|
2386 |
|
---|
2387 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
2388 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
2389 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
2390 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries;
|
---|
2391 | if (cSignatures)
|
---|
2392 | {
|
---|
2393 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
2394 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2395 | paInputSignature = paSignature;
|
---|
2396 | paOutputSignature = &paSignature[pSignatures->NumInputSignatureEntries];
|
---|
2397 |
|
---|
2398 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
2399 | {
|
---|
2400 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
2401 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
2402 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
2403 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2404 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2405 | }
|
---|
2406 |
|
---|
2407 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
2408 | {
|
---|
2409 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
2410 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
2411 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
2412 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2413 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2414 | }
|
---|
2415 | }
|
---|
2416 |
|
---|
2417 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader, pCreateGSWithSO->pShaderCode,
|
---|
2418 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2419 | paOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2420 | RTMemTmpFree(paSignature);
|
---|
2421 |
|
---|
2422 | vboxDXCreateStreamOutput(pDevice, pShader, pCreateGSWithSO->pOutputStreamDecl, pCreateGSWithSO->NumEntries,
|
---|
2423 | pCreateGSWithSO->BufferStridesInBytes, pCreateGSWithSO->NumStrides,
|
---|
2424 | pCreateGSWithSO->RasterizedStream);
|
---|
2425 | }
|
---|
2426 |
|
---|
2427 | static void APIENTRY ddi10CreateGeometryShaderWithStreamOutput(
|
---|
2428 | D3D10DDI_HDEVICE hDevice,
|
---|
2429 | const D3D10DDIARG_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT* pCreateGSWithSO,
|
---|
2430 | D3D10DDI_HSHADER hShader,
|
---|
2431 | D3D10DDI_HRTSHADER hRTShader,
|
---|
2432 | const D3D10DDIARG_STAGE_IO_SIGNATURES* pSignatures
|
---|
2433 | )
|
---|
2434 | {
|
---|
2435 | //DEBUG_BREAKPOINT_TEST();
|
---|
2436 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2437 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2438 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, pShaderCode 0x%p", pDevice, pShader, pCreateGSWithSO->pShaderCode));
|
---|
2439 |
|
---|
2440 | pShader->hRTShader = hRTShader;
|
---|
2441 |
|
---|
2442 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
2443 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
2444 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
2445 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries;
|
---|
2446 | if (cSignatures)
|
---|
2447 | {
|
---|
2448 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
2449 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2450 | paInputSignature = paSignature;
|
---|
2451 | paOutputSignature = &paSignature[pSignatures->NumInputSignatureEntries];
|
---|
2452 |
|
---|
2453 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
2454 | {
|
---|
2455 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
2456 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
2457 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
2458 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2459 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2460 | }
|
---|
2461 |
|
---|
2462 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
2463 | {
|
---|
2464 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
2465 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
2466 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
2467 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
2468 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
2469 | }
|
---|
2470 | }
|
---|
2471 |
|
---|
2472 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_GS, pShader, pCreateGSWithSO->pShaderCode,
|
---|
2473 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
2474 | paOutputSignature, pSignatures->NumOutputSignatureEntries, NULL, 0);
|
---|
2475 | RTMemTmpFree(paSignature);
|
---|
2476 |
|
---|
2477 | D3D11DDIARG_STREAM_OUTPUT_DECLARATION_ENTRY *pOutputStreamDecl = NULL;
|
---|
2478 | if (pCreateGSWithSO->NumEntries)
|
---|
2479 | {
|
---|
2480 | pOutputStreamDecl = (D3D11DDIARG_STREAM_OUTPUT_DECLARATION_ENTRY *)RTMemTmpAlloc(sizeof(D3D11DDIARG_STREAM_OUTPUT_DECLARATION_ENTRY));
|
---|
2481 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
2482 |
|
---|
2483 | for (unsigned i = 0; i < pCreateGSWithSO->NumEntries; ++i)
|
---|
2484 | {
|
---|
2485 | pOutputStreamDecl[i].Stream = 0;
|
---|
2486 | pOutputStreamDecl[i].OutputSlot = pCreateGSWithSO->pOutputStreamDecl[i].OutputSlot;
|
---|
2487 | pOutputStreamDecl[i].RegisterIndex = pCreateGSWithSO->pOutputStreamDecl[i].RegisterIndex;
|
---|
2488 | pOutputStreamDecl[i].RegisterMask = pCreateGSWithSO->pOutputStreamDecl[i].RegisterMask;
|
---|
2489 | }
|
---|
2490 | }
|
---|
2491 |
|
---|
2492 | vboxDXCreateStreamOutput(pDevice, pShader, pOutputStreamDecl, pCreateGSWithSO->NumEntries,
|
---|
2493 | &pCreateGSWithSO->StreamOutputStrideInBytes, 1, 0);
|
---|
2494 | RTMemTmpFree(pOutputStreamDecl);
|
---|
2495 | }
|
---|
2496 |
|
---|
2497 | static void APIENTRY ddi10DestroyShader(
|
---|
2498 | D3D10DDI_HDEVICE hDevice,
|
---|
2499 | D3D10DDI_HSHADER hShader
|
---|
2500 | )
|
---|
2501 | {
|
---|
2502 | //DEBUG_BREAKPOINT_TEST();
|
---|
2503 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2504 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2505 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
2506 |
|
---|
2507 | vboxDXDestroyShader(pDevice, pShader);
|
---|
2508 | }
|
---|
2509 |
|
---|
2510 | static SIZE_T APIENTRY ddi10CalcPrivateSamplerSize(
|
---|
2511 | D3D10DDI_HDEVICE hDevice,
|
---|
2512 | const D3D10_DDI_SAMPLER_DESC* pSamplerDesc
|
---|
2513 | )
|
---|
2514 | {
|
---|
2515 | //DEBUG_BREAKPOINT_TEST();
|
---|
2516 | RT_NOREF(hDevice, pSamplerDesc);
|
---|
2517 | return sizeof(VBOXDX_SAMPLER_STATE);
|
---|
2518 | }
|
---|
2519 |
|
---|
2520 | static void APIENTRY ddi10CreateSampler(
|
---|
2521 | D3D10DDI_HDEVICE hDevice,
|
---|
2522 | const D3D10_DDI_SAMPLER_DESC* pSamplerDesc,
|
---|
2523 | D3D10DDI_HSAMPLER hSampler,
|
---|
2524 | D3D10DDI_HRTSAMPLER hRTSampler
|
---|
2525 | )
|
---|
2526 | {
|
---|
2527 | //DEBUG_BREAKPOINT_TEST();
|
---|
2528 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2529 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)hSampler.pDrvPrivate;
|
---|
2530 | LogFlowFunc(("pDevice 0x%p, hSampler 0x%p, Filter %d", pDevice, hSampler, pSamplerDesc->Filter));
|
---|
2531 |
|
---|
2532 | pSamplerState->hRTSampler = hRTSampler;
|
---|
2533 | pSamplerState->SamplerDesc = *pSamplerDesc;
|
---|
2534 |
|
---|
2535 | vboxDXCreateSamplerState(pDevice, pSamplerState);
|
---|
2536 | }
|
---|
2537 |
|
---|
2538 | static void APIENTRY ddi10DestroySampler(
|
---|
2539 | D3D10DDI_HDEVICE hDevice,
|
---|
2540 | D3D10DDI_HSAMPLER hSampler
|
---|
2541 | )
|
---|
2542 | {
|
---|
2543 | //DEBUG_BREAKPOINT_TEST();
|
---|
2544 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2545 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)hSampler.pDrvPrivate;
|
---|
2546 | LogFlowFunc(("pDevice 0x%p, hSampler 0x%p", pDevice, hSampler));
|
---|
2547 |
|
---|
2548 | vboxDXDestroySamplerState(pDevice, pSamplerState);
|
---|
2549 | }
|
---|
2550 |
|
---|
2551 | static SIZE_T APIENTRY ddi10CalcPrivateQuerySize(
|
---|
2552 | D3D10DDI_HDEVICE hDevice,
|
---|
2553 | const D3D10DDIARG_CREATEQUERY* pCreateQuery
|
---|
2554 | )
|
---|
2555 | {
|
---|
2556 | RT_NOREF(hDevice, pCreateQuery);
|
---|
2557 | return sizeof(VBOXDXQUERY);
|
---|
2558 | }
|
---|
2559 |
|
---|
2560 | static void APIENTRY ddi10CreateQuery(
|
---|
2561 | D3D10DDI_HDEVICE hDevice,
|
---|
2562 | const D3D10DDIARG_CREATEQUERY* pCreateQuery,
|
---|
2563 | D3D10DDI_HQUERY hQuery,
|
---|
2564 | D3D10DDI_HRTQUERY hRTQuery
|
---|
2565 | )
|
---|
2566 | {
|
---|
2567 | //DEBUG_BREAKPOINT_TEST();
|
---|
2568 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2569 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
2570 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
2571 |
|
---|
2572 | pQuery->hRTQuery = hRTQuery;
|
---|
2573 | vboxDXCreateQuery(pDevice, pQuery, pCreateQuery->Query, pCreateQuery->MiscFlags);
|
---|
2574 | }
|
---|
2575 |
|
---|
2576 | static void APIENTRY ddi10DestroyQuery(
|
---|
2577 | D3D10DDI_HDEVICE hDevice,
|
---|
2578 | D3D10DDI_HQUERY hQuery
|
---|
2579 | )
|
---|
2580 | {
|
---|
2581 | //DEBUG_BREAKPOINT_TEST();
|
---|
2582 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2583 | PVBOXDXQUERY pQuery = (PVBOXDXQUERY)hQuery.pDrvPrivate;
|
---|
2584 | LogFlowFunc(("pDevice 0x%p, pQuery 0x%p", pDevice, pQuery));
|
---|
2585 |
|
---|
2586 | vboxDXDestroyQuery(pDevice, pQuery);
|
---|
2587 | }
|
---|
2588 |
|
---|
2589 | static SVGA3dDevCapIndex vboxDXGIFormat2CapIdx(DXGI_FORMAT format)
|
---|
2590 | {
|
---|
2591 | switch (format)
|
---|
2592 | {
|
---|
2593 | case DXGI_FORMAT_R32G32B32A32_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32G32B32A32_TYPELESS;
|
---|
2594 | case DXGI_FORMAT_R32G32B32A32_FLOAT: return SVGA3D_DEVCAP_DXFMT_R32G32B32A32_FLOAT;
|
---|
2595 | case DXGI_FORMAT_R32G32B32A32_UINT: return SVGA3D_DEVCAP_DXFMT_R32G32B32A32_UINT;
|
---|
2596 | case DXGI_FORMAT_R32G32B32A32_SINT: return SVGA3D_DEVCAP_DXFMT_R32G32B32A32_SINT;
|
---|
2597 |
|
---|
2598 | case DXGI_FORMAT_R32G32B32_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32G32B32_TYPELESS;
|
---|
2599 | case DXGI_FORMAT_R32G32B32_FLOAT: return SVGA3D_DEVCAP_DXFMT_R32G32B32_FLOAT;
|
---|
2600 | case DXGI_FORMAT_R32G32B32_UINT: return SVGA3D_DEVCAP_DXFMT_R32G32B32_UINT;
|
---|
2601 | case DXGI_FORMAT_R32G32B32_SINT: return SVGA3D_DEVCAP_DXFMT_R32G32B32_SINT;
|
---|
2602 |
|
---|
2603 | case DXGI_FORMAT_R16G16B16A16_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_TYPELESS;
|
---|
2604 | case DXGI_FORMAT_R16G16B16A16_FLOAT: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_FLOAT;
|
---|
2605 | case DXGI_FORMAT_R16G16B16A16_UNORM: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UNORM;
|
---|
2606 | case DXGI_FORMAT_R16G16B16A16_UINT: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_UINT;
|
---|
2607 | case DXGI_FORMAT_R16G16B16A16_SNORM: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SNORM;
|
---|
2608 | case DXGI_FORMAT_R16G16B16A16_SINT: return SVGA3D_DEVCAP_DXFMT_R16G16B16A16_SINT;
|
---|
2609 |
|
---|
2610 | case DXGI_FORMAT_R32G32_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32G32_TYPELESS;
|
---|
2611 | case DXGI_FORMAT_R32G32_FLOAT: return SVGA3D_DEVCAP_DXFMT_R32G32_FLOAT;
|
---|
2612 | case DXGI_FORMAT_R32G32_UINT: return SVGA3D_DEVCAP_DXFMT_R32G32_UINT;
|
---|
2613 | case DXGI_FORMAT_R32G32_SINT: return SVGA3D_DEVCAP_DXFMT_R32G32_SINT;
|
---|
2614 |
|
---|
2615 | case DXGI_FORMAT_R32G8X24_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32G8X24_TYPELESS;
|
---|
2616 |
|
---|
2617 | case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return SVGA3D_DEVCAP_DXFMT_D32_FLOAT_S8X24_UINT;
|
---|
2618 | case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32_FLOAT_X8X24;
|
---|
2619 | case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: return SVGA3D_DEVCAP_DXFMT_X32_G8X24_UINT;
|
---|
2620 |
|
---|
2621 | case DXGI_FORMAT_R10G10B10A2_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R10G10B10A2_TYPELESS;
|
---|
2622 | case DXGI_FORMAT_R10G10B10A2_UNORM: return SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UNORM;
|
---|
2623 | case DXGI_FORMAT_R10G10B10A2_UINT: return SVGA3D_DEVCAP_DXFMT_R10G10B10A2_UINT;
|
---|
2624 |
|
---|
2625 | case DXGI_FORMAT_R11G11B10_FLOAT: return SVGA3D_DEVCAP_DXFMT_R11G11B10_FLOAT;
|
---|
2626 |
|
---|
2627 | case DXGI_FORMAT_R8G8B8A8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_TYPELESS;
|
---|
2628 | case DXGI_FORMAT_R8G8B8A8_UNORM: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM;
|
---|
2629 | case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UNORM_SRGB;
|
---|
2630 | case DXGI_FORMAT_R8G8B8A8_UINT: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_UINT;
|
---|
2631 | case DXGI_FORMAT_R8G8B8A8_SNORM: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SNORM;
|
---|
2632 | case DXGI_FORMAT_R8G8B8A8_SINT: return SVGA3D_DEVCAP_DXFMT_R8G8B8A8_SINT;
|
---|
2633 |
|
---|
2634 | case DXGI_FORMAT_R16G16_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R16G16_TYPELESS;
|
---|
2635 | case DXGI_FORMAT_R16G16_FLOAT: return SVGA3D_DEVCAP_DXFMT_R16G16_FLOAT;
|
---|
2636 | case DXGI_FORMAT_R16G16_UNORM: return SVGA3D_DEVCAP_DXFMT_R16G16_UNORM;
|
---|
2637 | case DXGI_FORMAT_R16G16_UINT: return SVGA3D_DEVCAP_DXFMT_R16G16_UINT;
|
---|
2638 | case DXGI_FORMAT_R16G16_SNORM: return SVGA3D_DEVCAP_DXFMT_R16G16_SNORM;
|
---|
2639 | case DXGI_FORMAT_R16G16_SINT: return SVGA3D_DEVCAP_DXFMT_R16G16_SINT;
|
---|
2640 |
|
---|
2641 | case DXGI_FORMAT_R32_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R32_TYPELESS;
|
---|
2642 | case DXGI_FORMAT_D32_FLOAT: return SVGA3D_DEVCAP_DXFMT_D32_FLOAT;
|
---|
2643 | case DXGI_FORMAT_R32_FLOAT: return SVGA3D_DEVCAP_DXFMT_R32_FLOAT;
|
---|
2644 | case DXGI_FORMAT_R32_UINT: return SVGA3D_DEVCAP_DXFMT_R32_UINT;
|
---|
2645 | case DXGI_FORMAT_R32_SINT: return SVGA3D_DEVCAP_DXFMT_R32_SINT;
|
---|
2646 |
|
---|
2647 | case DXGI_FORMAT_R24G8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R24G8_TYPELESS;
|
---|
2648 | case DXGI_FORMAT_D24_UNORM_S8_UINT: return SVGA3D_DEVCAP_DXFMT_D24_UNORM_S8_UINT;
|
---|
2649 | case DXGI_FORMAT_R24_UNORM_X8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R24_UNORM_X8;
|
---|
2650 | case DXGI_FORMAT_X24_TYPELESS_G8_UINT: return SVGA3D_DEVCAP_DXFMT_X24_G8_UINT;
|
---|
2651 |
|
---|
2652 | case DXGI_FORMAT_R8G8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R8G8_TYPELESS;
|
---|
2653 | case DXGI_FORMAT_R8G8_UNORM: return SVGA3D_DEVCAP_DXFMT_R8G8_UNORM;
|
---|
2654 | case DXGI_FORMAT_R8G8_UINT: return SVGA3D_DEVCAP_DXFMT_R8G8_UINT;
|
---|
2655 | case DXGI_FORMAT_R8G8_SNORM: return SVGA3D_DEVCAP_DXFMT_R8G8_SNORM;
|
---|
2656 | case DXGI_FORMAT_R8G8_SINT: return SVGA3D_DEVCAP_DXFMT_R8G8_SINT;
|
---|
2657 |
|
---|
2658 | case DXGI_FORMAT_R16_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R16_TYPELESS;
|
---|
2659 | case DXGI_FORMAT_R16_FLOAT: return SVGA3D_DEVCAP_DXFMT_R16_FLOAT;
|
---|
2660 | case DXGI_FORMAT_D16_UNORM: return SVGA3D_DEVCAP_DXFMT_D16_UNORM;
|
---|
2661 | case DXGI_FORMAT_R16_UNORM: return SVGA3D_DEVCAP_DXFMT_R16_UNORM;
|
---|
2662 | case DXGI_FORMAT_R16_UINT: return SVGA3D_DEVCAP_DXFMT_R16_UINT;
|
---|
2663 | case DXGI_FORMAT_R16_SNORM: return SVGA3D_DEVCAP_DXFMT_R16_SNORM;
|
---|
2664 | case DXGI_FORMAT_R16_SINT: return SVGA3D_DEVCAP_DXFMT_R16_SINT;
|
---|
2665 |
|
---|
2666 | case DXGI_FORMAT_R8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_R8_TYPELESS;
|
---|
2667 | case DXGI_FORMAT_R8_UNORM: return SVGA3D_DEVCAP_DXFMT_R8_UNORM;
|
---|
2668 | case DXGI_FORMAT_R8_UINT: return SVGA3D_DEVCAP_DXFMT_R8_UINT;
|
---|
2669 | case DXGI_FORMAT_R8_SNORM: return SVGA3D_DEVCAP_DXFMT_R8_SNORM;
|
---|
2670 | case DXGI_FORMAT_R8_SINT: return SVGA3D_DEVCAP_DXFMT_R8_SINT;
|
---|
2671 |
|
---|
2672 | case DXGI_FORMAT_A8_UNORM: return SVGA3D_DEVCAP_DXFMT_A8_UNORM;
|
---|
2673 | case DXGI_FORMAT_R1_UNORM: return SVGA3D_DEVCAP_INVALID;
|
---|
2674 |
|
---|
2675 | case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: return SVGA3D_DEVCAP_DXFMT_R9G9B9E5_SHAREDEXP;
|
---|
2676 | case DXGI_FORMAT_R8G8_B8G8_UNORM: return SVGA3D_DEVCAP_DXFMT_R8G8_B8G8_UNORM;
|
---|
2677 | case DXGI_FORMAT_G8R8_G8B8_UNORM: return SVGA3D_DEVCAP_DXFMT_G8R8_G8B8_UNORM;
|
---|
2678 |
|
---|
2679 | case DXGI_FORMAT_BC1_TYPELESS: return SVGA3D_DEVCAP_DXFMT_BC1_TYPELESS;
|
---|
2680 | case DXGI_FORMAT_BC1_UNORM: return SVGA3D_DEVCAP_DXFMT_BC1_UNORM;
|
---|
2681 | case DXGI_FORMAT_BC1_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_BC1_UNORM_SRGB;
|
---|
2682 |
|
---|
2683 | case DXGI_FORMAT_BC2_TYPELESS: return SVGA3D_DEVCAP_DXFMT_BC2_TYPELESS;
|
---|
2684 | case DXGI_FORMAT_BC2_UNORM: return SVGA3D_DEVCAP_DXFMT_BC2_UNORM;
|
---|
2685 | case DXGI_FORMAT_BC2_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_BC2_UNORM_SRGB;
|
---|
2686 | case DXGI_FORMAT_BC3_TYPELESS: return SVGA3D_DEVCAP_DXFMT_BC3_TYPELESS;
|
---|
2687 | case DXGI_FORMAT_BC3_UNORM: return SVGA3D_DEVCAP_DXFMT_BC3_UNORM;
|
---|
2688 | case DXGI_FORMAT_BC3_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_BC3_UNORM_SRGB;
|
---|
2689 | case DXGI_FORMAT_BC4_TYPELESS: return SVGA3D_DEVCAP_DXFMT_BC4_TYPELESS;
|
---|
2690 | case DXGI_FORMAT_BC4_UNORM: return SVGA3D_DEVCAP_DXFMT_BC4_UNORM;
|
---|
2691 | case DXGI_FORMAT_BC4_SNORM: return SVGA3D_DEVCAP_DXFMT_BC4_SNORM;
|
---|
2692 | case DXGI_FORMAT_BC5_TYPELESS: return SVGA3D_DEVCAP_DXFMT_BC5_TYPELESS;
|
---|
2693 | case DXGI_FORMAT_BC5_UNORM: return SVGA3D_DEVCAP_DXFMT_BC5_UNORM;
|
---|
2694 | case DXGI_FORMAT_BC5_SNORM: return SVGA3D_DEVCAP_DXFMT_BC5_SNORM;
|
---|
2695 |
|
---|
2696 | case DXGI_FORMAT_B5G6R5_UNORM: return SVGA3D_DEVCAP_DXFMT_B5G6R5_UNORM;
|
---|
2697 | case DXGI_FORMAT_B5G5R5A1_UNORM: return SVGA3D_DEVCAP_DXFMT_B5G5R5A1_UNORM;
|
---|
2698 | case DXGI_FORMAT_B8G8R8A8_UNORM: return SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM;
|
---|
2699 | case DXGI_FORMAT_B8G8R8X8_UNORM: return SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM;
|
---|
2700 |
|
---|
2701 | case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: return SVGA3D_DEVCAP_DXFMT_R10G10B10_XR_BIAS_A2_UNORM;
|
---|
2702 | case DXGI_FORMAT_B8G8R8A8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_B8G8R8A8_TYPELESS;
|
---|
2703 | case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_B8G8R8A8_UNORM_SRGB;
|
---|
2704 | case DXGI_FORMAT_B8G8R8X8_TYPELESS: return SVGA3D_DEVCAP_DXFMT_B8G8R8X8_TYPELESS;
|
---|
2705 | case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: return SVGA3D_DEVCAP_DXFMT_B8G8R8X8_UNORM_SRGB;
|
---|
2706 |
|
---|
2707 | case DXGI_FORMAT_BC6H_TYPELESS: return SVGA3D_DEVCAP_INVALID;
|
---|
2708 | case DXGI_FORMAT_BC6H_UF16: return SVGA3D_DEVCAP_INVALID;
|
---|
2709 | case DXGI_FORMAT_BC6H_SF16: return SVGA3D_DEVCAP_INVALID;
|
---|
2710 | case DXGI_FORMAT_BC7_TYPELESS: return SVGA3D_DEVCAP_INVALID;
|
---|
2711 | case DXGI_FORMAT_BC7_UNORM: return SVGA3D_DEVCAP_INVALID;
|
---|
2712 | case DXGI_FORMAT_BC7_UNORM_SRGB: return SVGA3D_DEVCAP_INVALID;
|
---|
2713 |
|
---|
2714 | case DXGI_FORMAT_AYUV: return SVGA3D_DEVCAP_DXFMT_FORMAT_DEAD2; /* Was SVGA3D_DEVCAP_DXFMT_AYUV */
|
---|
2715 | case DXGI_FORMAT_Y410: return SVGA3D_DEVCAP_INVALID;
|
---|
2716 | case DXGI_FORMAT_Y416: return SVGA3D_DEVCAP_INVALID;
|
---|
2717 | case DXGI_FORMAT_NV12: return SVGA3D_DEVCAP_DXFMT_NV12;
|
---|
2718 | case DXGI_FORMAT_P010: return SVGA3D_DEVCAP_INVALID;
|
---|
2719 | case DXGI_FORMAT_P016: return SVGA3D_DEVCAP_INVALID;
|
---|
2720 | case DXGI_FORMAT_420_OPAQUE: return SVGA3D_DEVCAP_INVALID;
|
---|
2721 | case DXGI_FORMAT_YUY2: return SVGA3D_DEVCAP_DXFMT_YUY2;
|
---|
2722 | case DXGI_FORMAT_Y210: return SVGA3D_DEVCAP_INVALID;
|
---|
2723 | case DXGI_FORMAT_Y216: return SVGA3D_DEVCAP_INVALID;
|
---|
2724 | case DXGI_FORMAT_NV11: return SVGA3D_DEVCAP_INVALID;
|
---|
2725 | case DXGI_FORMAT_AI44: return SVGA3D_DEVCAP_INVALID;
|
---|
2726 | case DXGI_FORMAT_IA44: return SVGA3D_DEVCAP_INVALID;
|
---|
2727 | case DXGI_FORMAT_P8: return SVGA3D_DEVCAP_DXFMT_P8;
|
---|
2728 | case DXGI_FORMAT_A8P8: return SVGA3D_DEVCAP_INVALID;
|
---|
2729 | case DXGI_FORMAT_B4G4R4A4_UNORM: return SVGA3D_DEVCAP_INVALID;
|
---|
2730 |
|
---|
2731 | default:
|
---|
2732 | break;
|
---|
2733 | }
|
---|
2734 |
|
---|
2735 | return SVGA3D_DEVCAP_INVALID;
|
---|
2736 | }
|
---|
2737 |
|
---|
2738 | void APIENTRY vboxDXCheckFormatSupport(
|
---|
2739 | D3D10DDI_HDEVICE hDevice,
|
---|
2740 | DXGI_FORMAT Format,
|
---|
2741 | UINT* pFormatCaps
|
---|
2742 | )
|
---|
2743 | {
|
---|
2744 | //DEBUG_BREAKPOINT_TEST();
|
---|
2745 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2746 | PVBOXDXADAPTER pVBoxAdapter = pDevice->pAdapter;
|
---|
2747 | LogFlowFunc(("pDevice 0x%p, Format %d", pDevice, Format));
|
---|
2748 | SVGA3dDevCapIndex idxDevCap = vboxDXGIFormat2CapIdx(Format);
|
---|
2749 |
|
---|
2750 | *pFormatCaps = 0;
|
---|
2751 |
|
---|
2752 | if (idxDevCap != SVGA3D_DEVCAP_INVALID)
|
---|
2753 | {
|
---|
2754 | uint32_t *au32Caps = pVBoxAdapter->AdapterInfo.u.vmsvga.HWInfo.u.svga.au32Caps;
|
---|
2755 | uint32_t u32Cap = au32Caps[idxDevCap];
|
---|
2756 | LogFlowFunc(("DXGI Format %d is SVGA %d, caps 0x%X", Format, idxDevCap, u32Cap));
|
---|
2757 |
|
---|
2758 | if (u32Cap & SVGA3D_DXFMT_SUPPORTED)
|
---|
2759 | {
|
---|
2760 | if (u32Cap & SVGA3D_DXFMT_SHADER_SAMPLE)
|
---|
2761 | *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_SHADER_SAMPLE;
|
---|
2762 |
|
---|
2763 | if (u32Cap & SVGA3D_DXFMT_COLOR_RENDERTARGET)
|
---|
2764 | *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_RENDERTARGET;
|
---|
2765 |
|
---|
2766 | if (u32Cap & SVGA3D_DXFMT_BLENDABLE)
|
---|
2767 | *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_BLENDABLE;
|
---|
2768 |
|
---|
2769 | if (u32Cap & SVGA3D_DXFMT_DX_VERTEX_BUFFER)
|
---|
2770 | *pFormatCaps |= D3D11_1DDI_FORMAT_SUPPORT_VERTEX_BUFFER;
|
---|
2771 |
|
---|
2772 | /* The SVGA values below do not have exact equivalents in DX11 (that is strange).
|
---|
2773 | https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/d3d10umddi/nc-d3d10umddi-pfnd3d10ddi_checkformatsupport
|
---|
2774 |
|
---|
2775 | if (u32Cap & SVGA3D_DXFMT_DEPTH_RENDERTARGET)
|
---|
2776 | if (u32Cap & SVGA3D_DXFMT_MIPS)
|
---|
2777 | if (u32Cap & SVGA3D_DXFMT_ARRAY)
|
---|
2778 | if (u32Cap & SVGA3D_DXFMT_VOLUME)*/
|
---|
2779 |
|
---|
2780 | if (u32Cap & SVGA3D_DXFMT_MULTISAMPLE)
|
---|
2781 | *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET;
|
---|
2782 | }
|
---|
2783 | } else {
|
---|
2784 | LogFlowFunc(("Format %d is not supported", Format));
|
---|
2785 | }
|
---|
2786 | }
|
---|
2787 |
|
---|
2788 | void APIENTRY vboxDXCheckMultisampleQualityLevels(
|
---|
2789 | D3D10DDI_HDEVICE hDevice,
|
---|
2790 | DXGI_FORMAT Format,
|
---|
2791 | UINT SampleCount,
|
---|
2792 | UINT* pNumQualityLevels
|
---|
2793 | )
|
---|
2794 | {
|
---|
2795 | //DEBUG_BREAKPOINT_TEST();
|
---|
2796 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2797 | //LogFlowFunc(("pDevice 0x%p, Format %d, SampleCount %d", pDevice, Format, SampleCount));
|
---|
2798 |
|
---|
2799 | if (SampleCount == 1)
|
---|
2800 | *pNumQualityLevels = 1;
|
---|
2801 | else
|
---|
2802 | {
|
---|
2803 | *pNumQualityLevels = 0;
|
---|
2804 |
|
---|
2805 | SVGA3dDevCapIndex const idxDevCap = vboxDXGIFormat2CapIdx(Format);
|
---|
2806 | if (idxDevCap != SVGA3D_DEVCAP_INVALID)
|
---|
2807 | {
|
---|
2808 | PVBOXDXADAPTER pVBoxAdapter = pDevice->pAdapter;
|
---|
2809 | uint32_t const *au32Caps = pVBoxAdapter->AdapterInfo.u.vmsvga.HWInfo.u.svga.au32Caps;
|
---|
2810 | uint32_t const u32Cap = au32Caps[idxDevCap];
|
---|
2811 | if (u32Cap & SVGA3D_DXFMT_MULTISAMPLE)
|
---|
2812 | {
|
---|
2813 | bool fSampleCountSupported = false;
|
---|
2814 | if (SampleCount == 2)
|
---|
2815 | fSampleCountSupported = RT_BOOL(au32Caps[SVGA3D_DEVCAP_MULTISAMPLE_2X]);
|
---|
2816 | else if (SampleCount == 4)
|
---|
2817 | fSampleCountSupported = RT_BOOL(au32Caps[SVGA3D_DEVCAP_MULTISAMPLE_4X]);
|
---|
2818 | else if (SampleCount == 8)
|
---|
2819 | fSampleCountSupported = RT_BOOL(au32Caps[SVGA3D_DEVCAP_MULTISAMPLE_8X]);
|
---|
2820 | *pNumQualityLevels = fSampleCountSupported ? 1 : 0;
|
---|
2821 | }
|
---|
2822 | }
|
---|
2823 | }
|
---|
2824 | }
|
---|
2825 |
|
---|
2826 | static void APIENTRY ddi10CheckCounterInfo(
|
---|
2827 | D3D10DDI_HDEVICE hDevice,
|
---|
2828 | D3D10DDI_COUNTER_INFO* pCounterInfo
|
---|
2829 | )
|
---|
2830 | {
|
---|
2831 | //DEBUG_BREAKPOINT_TEST();
|
---|
2832 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2833 | RT_NOREF(pDevice);
|
---|
2834 |
|
---|
2835 | /* No "device-dependent" counters. */
|
---|
2836 | RT_ZERO(*pCounterInfo);
|
---|
2837 | }
|
---|
2838 |
|
---|
2839 | static void APIENTRY ddi10CheckCounter(
|
---|
2840 | D3D10DDI_HDEVICE hDevice,
|
---|
2841 | D3D10DDI_QUERY Query,
|
---|
2842 | D3D10DDI_COUNTER_TYPE* pCounterType,
|
---|
2843 | UINT* pActiveCounters,
|
---|
2844 | LPSTR pDescription,
|
---|
2845 | UINT* pNameLength,
|
---|
2846 | LPSTR pName,
|
---|
2847 | UINT* pUnitsLength,
|
---|
2848 | LPSTR pUnits,
|
---|
2849 | UINT* pDescriptionLength
|
---|
2850 | )
|
---|
2851 | {
|
---|
2852 | //DEBUG_BREAKPOINT_TEST();
|
---|
2853 | RT_NOREF(hDevice, Query, pCounterType, pActiveCounters, pDescription, pNameLength, pName,
|
---|
2854 | pUnitsLength, pUnits, pDescriptionLength);
|
---|
2855 | /* No "device-dependent" counters. */
|
---|
2856 | }
|
---|
2857 |
|
---|
2858 | static void APIENTRY ddi10SetTextFilterSize(
|
---|
2859 | D3D10DDI_HDEVICE hDevice,
|
---|
2860 | UINT Width,
|
---|
2861 | UINT Height
|
---|
2862 | )
|
---|
2863 | {
|
---|
2864 | //DEBUG_BREAKPOINT_TEST();
|
---|
2865 | RT_NOREF(hDevice, Width, Height);
|
---|
2866 | LogFlowFunc(("%dx%d", Width, Height));
|
---|
2867 | /* Not implemented because "text filtering D3D10_FILTER_TEXT_1BIT was removed from Direct3D 11" */
|
---|
2868 | }
|
---|
2869 |
|
---|
2870 | void APIENTRY vboxDXResourceConvert(
|
---|
2871 | D3D10DDI_HDEVICE hDevice,
|
---|
2872 | D3D10DDI_HRESOURCE hDstResource,
|
---|
2873 | D3D10DDI_HRESOURCE hSrcResource
|
---|
2874 | )
|
---|
2875 | {
|
---|
2876 | DEBUG_BREAKPOINT_TEST();
|
---|
2877 | RT_NOREF(hDevice, hDstResource, hSrcResource);
|
---|
2878 | LogFlowFuncEnter();
|
---|
2879 | }
|
---|
2880 |
|
---|
2881 | void APIENTRY vboxDXResourceConvertRegion(
|
---|
2882 | D3D10DDI_HDEVICE hDevice,
|
---|
2883 | D3D10DDI_HRESOURCE hDstResource,
|
---|
2884 | UINT DstSubresource,
|
---|
2885 | UINT DstX,
|
---|
2886 | UINT DstY,
|
---|
2887 | UINT DstZ,
|
---|
2888 | D3D10DDI_HRESOURCE hSrcResource,
|
---|
2889 | UINT SrcSubresource,
|
---|
2890 | const D3D10_DDI_BOX* pSrcBox,
|
---|
2891 | UINT CopyFlags
|
---|
2892 | )
|
---|
2893 | {
|
---|
2894 | DEBUG_BREAKPOINT_TEST();
|
---|
2895 | RT_NOREF(hDevice, hDstResource, DstSubresource, DstX, DstY, DstZ, hSrcResource, SrcSubresource, pSrcBox, CopyFlags);
|
---|
2896 | LogFlowFuncEnter();
|
---|
2897 | }
|
---|
2898 |
|
---|
2899 | static void APIENTRY ddi10ResourceConvertRegion(
|
---|
2900 | D3D10DDI_HDEVICE hDevice,
|
---|
2901 | D3D10DDI_HRESOURCE hDstResource,
|
---|
2902 | UINT DstSubresource,
|
---|
2903 | UINT DstX,
|
---|
2904 | UINT DstY,
|
---|
2905 | UINT DstZ,
|
---|
2906 | D3D10DDI_HRESOURCE hSrcResource,
|
---|
2907 | UINT SrcSubresource,
|
---|
2908 | const D3D10_DDI_BOX* pSrcBox
|
---|
2909 | )
|
---|
2910 | {
|
---|
2911 | DEBUG_BREAKPOINT_TEST();
|
---|
2912 | RT_NOREF(hDevice, hDstResource, DstSubresource, DstX, DstY, DstZ, hSrcResource, SrcSubresource, pSrcBox);
|
---|
2913 | LogFlowFuncEnter();
|
---|
2914 | }
|
---|
2915 |
|
---|
2916 | static void APIENTRY ddi11DrawIndexedInstancedIndirect(
|
---|
2917 | D3D10DDI_HDEVICE hDevice,
|
---|
2918 | D3D10DDI_HRESOURCE hBufferForArgs,
|
---|
2919 | UINT AlignedByteOffsetForArgs
|
---|
2920 | )
|
---|
2921 | {
|
---|
2922 | //DEBUG_BREAKPOINT_TEST();
|
---|
2923 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2924 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hBufferForArgs.pDrvPrivate;
|
---|
2925 | LogFlowFunc(("pDevice 0x%p, pResource %p, AlignedByteOffsetForArgs %u", pDevice, pResource, AlignedByteOffsetForArgs));
|
---|
2926 |
|
---|
2927 | vboxDXDrawIndexedInstancedIndirect(pDevice, pResource, AlignedByteOffsetForArgs);
|
---|
2928 | }
|
---|
2929 |
|
---|
2930 | static void APIENTRY ddi11DrawInstancedIndirect(
|
---|
2931 | D3D10DDI_HDEVICE hDevice,
|
---|
2932 | D3D10DDI_HRESOURCE hBufferForArgs,
|
---|
2933 | UINT AlignedByteOffsetForArgs
|
---|
2934 | )
|
---|
2935 | {
|
---|
2936 | //DEBUG_BREAKPOINT_TEST();
|
---|
2937 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2938 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hBufferForArgs.pDrvPrivate;
|
---|
2939 | LogFlowFunc(("pDevice 0x%p, pResource %p, AlignedByteOffsetForArgs %u", pDevice, pResource, AlignedByteOffsetForArgs));
|
---|
2940 |
|
---|
2941 | vboxDXDrawInstancedIndirect(pDevice, pResource, AlignedByteOffsetForArgs);
|
---|
2942 | }
|
---|
2943 |
|
---|
2944 | static void APIENTRY ddi10HsSetShaderResources(
|
---|
2945 | D3D10DDI_HDEVICE hDevice,
|
---|
2946 | UINT StartSlot,
|
---|
2947 | UINT NumViews,
|
---|
2948 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews
|
---|
2949 | )
|
---|
2950 | {
|
---|
2951 | //DEBUG_BREAKPOINT_TEST();
|
---|
2952 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2953 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
2954 |
|
---|
2955 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_HS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
2956 | }
|
---|
2957 |
|
---|
2958 | static void APIENTRY ddi10HsSetShader(
|
---|
2959 | D3D10DDI_HDEVICE hDevice,
|
---|
2960 | D3D10DDI_HSHADER hShader
|
---|
2961 | )
|
---|
2962 | {
|
---|
2963 | //DEBUG_BREAKPOINT_TEST();
|
---|
2964 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2965 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
2966 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
2967 |
|
---|
2968 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_HS, pShader);
|
---|
2969 | }
|
---|
2970 |
|
---|
2971 | static void APIENTRY ddi10HsSetSamplers(
|
---|
2972 | D3D10DDI_HDEVICE hDevice,
|
---|
2973 | UINT StartSlot,
|
---|
2974 | UINT NumSamplers,
|
---|
2975 | const D3D10DDI_HSAMPLER* phSamplers
|
---|
2976 | )
|
---|
2977 | {
|
---|
2978 | //DEBUG_BREAKPOINT_TEST();
|
---|
2979 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
2980 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
2981 |
|
---|
2982 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
2983 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
2984 |
|
---|
2985 | /* Fetch sampler ids. */
|
---|
2986 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
2987 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
2988 | {
|
---|
2989 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
2990 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
2991 | }
|
---|
2992 |
|
---|
2993 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_HS, StartSlot, NumSamplers, aSamplerIds);
|
---|
2994 | }
|
---|
2995 |
|
---|
2996 | static void APIENTRY ddi11_1HsSetConstantBuffers(
|
---|
2997 | D3D10DDI_HDEVICE hDevice,
|
---|
2998 | UINT StartSlot,
|
---|
2999 | UINT NumBuffers,
|
---|
3000 | const D3D10DDI_HRESOURCE* phBuffers,
|
---|
3001 | const UINT* pFirstConstant,
|
---|
3002 | const UINT* pNumConstants
|
---|
3003 | )
|
---|
3004 | {
|
---|
3005 | //DEBUG_BREAKPOINT_TEST();
|
---|
3006 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3007 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3008 |
|
---|
3009 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_HS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
3010 | }
|
---|
3011 |
|
---|
3012 | static void APIENTRY ddi10HsSetConstantBuffers(
|
---|
3013 | D3D10DDI_HDEVICE hDevice,
|
---|
3014 | UINT StartSlot, // The starting constant buffer to set.
|
---|
3015 | UINT NumBuffers, // The total number of buffers to set.
|
---|
3016 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
3017 | )
|
---|
3018 | {
|
---|
3019 | //DEBUG_BREAKPOINT_TEST();
|
---|
3020 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3021 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3022 |
|
---|
3023 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_HS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
3024 | }
|
---|
3025 |
|
---|
3026 | static void APIENTRY ddi10DsSetShaderResources(
|
---|
3027 | D3D10DDI_HDEVICE hDevice,
|
---|
3028 | UINT StartSlot,
|
---|
3029 | UINT NumViews,
|
---|
3030 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews
|
---|
3031 | )
|
---|
3032 | {
|
---|
3033 | //DEBUG_BREAKPOINT_TEST();
|
---|
3034 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3035 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
3036 |
|
---|
3037 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_DS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
3038 | }
|
---|
3039 |
|
---|
3040 | static void APIENTRY ddi10DsSetShader(
|
---|
3041 | D3D10DDI_HDEVICE hDevice,
|
---|
3042 | D3D10DDI_HSHADER hShader
|
---|
3043 | )
|
---|
3044 | {
|
---|
3045 | //DEBUG_BREAKPOINT_TEST();
|
---|
3046 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3047 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3048 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
3049 |
|
---|
3050 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_DS, pShader);
|
---|
3051 | }
|
---|
3052 |
|
---|
3053 | static void APIENTRY ddi10DsSetSamplers(
|
---|
3054 | D3D10DDI_HDEVICE hDevice,
|
---|
3055 | UINT StartSlot,
|
---|
3056 | UINT NumSamplers,
|
---|
3057 | const D3D10DDI_HSAMPLER* phSamplers
|
---|
3058 | )
|
---|
3059 | {
|
---|
3060 | //DEBUG_BREAKPOINT_TEST();
|
---|
3061 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3062 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
3063 |
|
---|
3064 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
3065 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
3066 |
|
---|
3067 | /* Fetch sampler ids. */
|
---|
3068 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
3069 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
3070 | {
|
---|
3071 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
3072 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
3073 | }
|
---|
3074 |
|
---|
3075 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_DS, StartSlot, NumSamplers, aSamplerIds);
|
---|
3076 | }
|
---|
3077 |
|
---|
3078 | static void APIENTRY ddi11_1DsSetConstantBuffers(
|
---|
3079 | D3D10DDI_HDEVICE hDevice,
|
---|
3080 | UINT StartSlot,
|
---|
3081 | UINT NumBuffers,
|
---|
3082 | const D3D10DDI_HRESOURCE* phBuffers,
|
---|
3083 | const UINT* pFirstConstant,
|
---|
3084 | const UINT* pNumConstants
|
---|
3085 | )
|
---|
3086 | {
|
---|
3087 | //DEBUG_BREAKPOINT_TEST();
|
---|
3088 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3089 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3090 |
|
---|
3091 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_DS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
3092 | }
|
---|
3093 |
|
---|
3094 | static void APIENTRY ddi10DsSetConstantBuffers(
|
---|
3095 | D3D10DDI_HDEVICE hDevice,
|
---|
3096 | UINT StartSlot, // The starting constant buffer to set.
|
---|
3097 | UINT NumBuffers, // The total number of buffers to set.
|
---|
3098 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
3099 | )
|
---|
3100 | {
|
---|
3101 | //DEBUG_BREAKPOINT_TEST();
|
---|
3102 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3103 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3104 |
|
---|
3105 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_DS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
3106 | }
|
---|
3107 |
|
---|
3108 | static void APIENTRY ddi11_1CreateHullShader(
|
---|
3109 | D3D10DDI_HDEVICE hDevice,
|
---|
3110 | const UINT* pShaderCode,
|
---|
3111 | D3D10DDI_HSHADER hShader,
|
---|
3112 | D3D10DDI_HRTSHADER hRTShader,
|
---|
3113 | const D3D11_1DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3114 | )
|
---|
3115 | {
|
---|
3116 | //DEBUG_BREAKPOINT_TEST();
|
---|
3117 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3118 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3119 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
3120 |
|
---|
3121 | pShader->hRTShader = hRTShader;
|
---|
3122 |
|
---|
3123 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_HS, pShader, pShaderCode,
|
---|
3124 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
3125 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries,
|
---|
3126 | pSignatures->pPatchConstantSignature, pSignatures->NumPatchConstantSignatureEntries);
|
---|
3127 | }
|
---|
3128 |
|
---|
3129 | static void APIENTRY ddi11CreateHullShader(
|
---|
3130 | D3D10DDI_HDEVICE hDevice,
|
---|
3131 | const UINT* pShaderCode,
|
---|
3132 | D3D10DDI_HSHADER hShader,
|
---|
3133 | D3D10DDI_HRTSHADER hRTShader,
|
---|
3134 | const D3D11DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3135 | )
|
---|
3136 | {
|
---|
3137 | //DEBUG_BREAKPOINT_TEST();
|
---|
3138 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3139 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3140 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
3141 |
|
---|
3142 | pShader->hRTShader = hRTShader;
|
---|
3143 |
|
---|
3144 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
3145 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
3146 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paPatchConstantSignature = NULL;
|
---|
3147 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
3148 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries + pSignatures->NumPatchConstantSignatureEntries;
|
---|
3149 | if (cSignatures)
|
---|
3150 | {
|
---|
3151 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
3152 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
3153 | paInputSignature = paSignature;
|
---|
3154 | paOutputSignature = &paInputSignature[pSignatures->NumInputSignatureEntries];
|
---|
3155 | paPatchConstantSignature = &paOutputSignature[pSignatures->NumOutputSignatureEntries];
|
---|
3156 |
|
---|
3157 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
3158 | {
|
---|
3159 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
3160 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
3161 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
3162 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3163 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3164 | }
|
---|
3165 |
|
---|
3166 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
3167 | {
|
---|
3168 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
3169 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
3170 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
3171 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3172 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3173 | }
|
---|
3174 |
|
---|
3175 | for (unsigned i = 0; i < pSignatures->NumPatchConstantSignatureEntries; ++i)
|
---|
3176 | {
|
---|
3177 | paPatchConstantSignature[i].SystemValue = pSignatures->pPatchConstantSignature[i].SystemValue;
|
---|
3178 | paPatchConstantSignature[i].Register = pSignatures->pPatchConstantSignature[i].Register;
|
---|
3179 | paPatchConstantSignature[i].Mask = pSignatures->pPatchConstantSignature[i].Mask;
|
---|
3180 | paPatchConstantSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3181 | paPatchConstantSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3182 | }
|
---|
3183 | }
|
---|
3184 |
|
---|
3185 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_HS, pShader, pShaderCode,
|
---|
3186 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
3187 | paOutputSignature, pSignatures->NumOutputSignatureEntries,
|
---|
3188 | paPatchConstantSignature, pSignatures->NumPatchConstantSignatureEntries);
|
---|
3189 | RTMemTmpFree(paSignature);
|
---|
3190 | }
|
---|
3191 |
|
---|
3192 | static void APIENTRY ddi11_1CreateDomainShader(
|
---|
3193 | D3D10DDI_HDEVICE hDevice,
|
---|
3194 | const UINT* pShaderCode,
|
---|
3195 | D3D10DDI_HSHADER hShader,
|
---|
3196 | D3D10DDI_HRTSHADER hRTShader,
|
---|
3197 | const D3D11_1DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3198 | )
|
---|
3199 | {
|
---|
3200 | //DEBUG_BREAKPOINT_TEST();
|
---|
3201 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3202 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3203 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
3204 |
|
---|
3205 | pShader->hRTShader = hRTShader;
|
---|
3206 |
|
---|
3207 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_DS, pShader, pShaderCode,
|
---|
3208 | pSignatures->pInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
3209 | pSignatures->pOutputSignature, pSignatures->NumOutputSignatureEntries,
|
---|
3210 | pSignatures->pPatchConstantSignature, pSignatures->NumPatchConstantSignatureEntries);
|
---|
3211 | }
|
---|
3212 |
|
---|
3213 | static void APIENTRY ddi11CreateDomainShader(
|
---|
3214 | D3D10DDI_HDEVICE hDevice,
|
---|
3215 | const UINT* pShaderCode,
|
---|
3216 | D3D10DDI_HSHADER hShader,
|
---|
3217 | D3D10DDI_HRTSHADER hRTShader,
|
---|
3218 | const D3D11DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3219 | )
|
---|
3220 | {
|
---|
3221 | //DEBUG_BREAKPOINT_TEST();
|
---|
3222 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3223 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3224 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
3225 |
|
---|
3226 | pShader->hRTShader = hRTShader;
|
---|
3227 |
|
---|
3228 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paInputSignature = NULL;
|
---|
3229 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paOutputSignature = NULL;
|
---|
3230 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paPatchConstantSignature = NULL;
|
---|
3231 | D3D11_1DDIARG_SIGNATURE_ENTRY2 *paSignature = NULL;
|
---|
3232 | uint32_t const cSignatures = pSignatures->NumInputSignatureEntries + pSignatures->NumOutputSignatureEntries + pSignatures->NumPatchConstantSignatureEntries;
|
---|
3233 | if (cSignatures)
|
---|
3234 | {
|
---|
3235 | paSignature = (D3D11_1DDIARG_SIGNATURE_ENTRY2 *)RTMemTmpAlloc(cSignatures * (sizeof(D3D11_1DDIARG_SIGNATURE_ENTRY2)));
|
---|
3236 | AssertReturnVoidStmt(paSignature, vboxDXDeviceSetError(pDevice, E_OUTOFMEMORY));
|
---|
3237 | paInputSignature = paSignature;
|
---|
3238 | paOutputSignature = &paInputSignature[pSignatures->NumInputSignatureEntries];
|
---|
3239 | paPatchConstantSignature = &paOutputSignature[pSignatures->NumOutputSignatureEntries];
|
---|
3240 |
|
---|
3241 | for (unsigned i = 0; i < pSignatures->NumInputSignatureEntries; ++i)
|
---|
3242 | {
|
---|
3243 | paInputSignature[i].SystemValue = pSignatures->pInputSignature[i].SystemValue;
|
---|
3244 | paInputSignature[i].Register = pSignatures->pInputSignature[i].Register;
|
---|
3245 | paInputSignature[i].Mask = pSignatures->pInputSignature[i].Mask;
|
---|
3246 | paInputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3247 | paInputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3248 | }
|
---|
3249 |
|
---|
3250 | for (unsigned i = 0; i < pSignatures->NumOutputSignatureEntries; ++i)
|
---|
3251 | {
|
---|
3252 | paOutputSignature[i].SystemValue = pSignatures->pOutputSignature[i].SystemValue;
|
---|
3253 | paOutputSignature[i].Register = pSignatures->pOutputSignature[i].Register;
|
---|
3254 | paOutputSignature[i].Mask = pSignatures->pOutputSignature[i].Mask;
|
---|
3255 | paOutputSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3256 | paOutputSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3257 | }
|
---|
3258 |
|
---|
3259 | for (unsigned i = 0; i < pSignatures->NumPatchConstantSignatureEntries; ++i)
|
---|
3260 | {
|
---|
3261 | paPatchConstantSignature[i].SystemValue = pSignatures->pPatchConstantSignature[i].SystemValue;
|
---|
3262 | paPatchConstantSignature[i].Register = pSignatures->pPatchConstantSignature[i].Register;
|
---|
3263 | paPatchConstantSignature[i].Mask = pSignatures->pPatchConstantSignature[i].Mask;
|
---|
3264 | paPatchConstantSignature[i].RegisterComponentType = D3D10_SB_REGISTER_COMPONENT_UNKNOWN;
|
---|
3265 | paPatchConstantSignature[i].MinPrecision = D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT;
|
---|
3266 | }
|
---|
3267 | }
|
---|
3268 |
|
---|
3269 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_DS, pShader, pShaderCode,
|
---|
3270 | paInputSignature, pSignatures->NumInputSignatureEntries,
|
---|
3271 | paOutputSignature, pSignatures->NumOutputSignatureEntries,
|
---|
3272 | paPatchConstantSignature, pSignatures->NumPatchConstantSignatureEntries);
|
---|
3273 | RTMemTmpFree(paSignature);
|
---|
3274 | }
|
---|
3275 |
|
---|
3276 | static SIZE_T APIENTRY ddi11_1CalcPrivateTessellationShaderSize(
|
---|
3277 | D3D10DDI_HDEVICE hDevice,
|
---|
3278 | const UINT* pShaderCode,
|
---|
3279 | const D3D11_1DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3280 | )
|
---|
3281 | {
|
---|
3282 | RT_NOREF(hDevice);
|
---|
3283 | return sizeof(VBOXDXSHADER)
|
---|
3284 | + pShaderCode[1] * sizeof(UINT)
|
---|
3285 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
3286 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
3287 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
3288 | + pSignatures->NumPatchConstantSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
3289 | }
|
---|
3290 |
|
---|
3291 | static SIZE_T APIENTRY ddi11CalcPrivateTessellationShaderSize(
|
---|
3292 | D3D10DDI_HDEVICE hDevice,
|
---|
3293 | const UINT* pShaderCode,
|
---|
3294 | const D3D11DDIARG_TESSELLATION_IO_SIGNATURES* pSignatures
|
---|
3295 | )
|
---|
3296 | {
|
---|
3297 | RT_NOREF(hDevice);
|
---|
3298 | return sizeof(VBOXDXSHADER)
|
---|
3299 | + pShaderCode[1] * sizeof(UINT)
|
---|
3300 | + sizeof(SVGA3dDXSignatureHeader)
|
---|
3301 | + pSignatures->NumInputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
3302 | + pSignatures->NumOutputSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry)
|
---|
3303 | + pSignatures->NumPatchConstantSignatureEntries * sizeof(SVGA3dDXShaderSignatureEntry);
|
---|
3304 | }
|
---|
3305 |
|
---|
3306 | void APIENTRY vboxDXPsSetShaderWithIfaces(
|
---|
3307 | D3D10DDI_HDEVICE hDevice,
|
---|
3308 | D3D10DDI_HSHADER hShader,
|
---|
3309 | UINT NumClassInstances,
|
---|
3310 | const UINT* pPointerData,
|
---|
3311 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3312 | )
|
---|
3313 | {
|
---|
3314 | DEBUG_BREAKPOINT_TEST();
|
---|
3315 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3316 | LogFlowFuncEnter();
|
---|
3317 | }
|
---|
3318 |
|
---|
3319 | void APIENTRY vboxDXVsSetShaderWithIfaces(
|
---|
3320 | D3D10DDI_HDEVICE hDevice,
|
---|
3321 | D3D10DDI_HSHADER hShader,
|
---|
3322 | UINT NumClassInstances,
|
---|
3323 | const UINT* pPointerData,
|
---|
3324 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3325 | )
|
---|
3326 | {
|
---|
3327 | DEBUG_BREAKPOINT_TEST();
|
---|
3328 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3329 | LogFlowFuncEnter();
|
---|
3330 | }
|
---|
3331 |
|
---|
3332 | void APIENTRY vboxDXGsSetShaderWithIfaces(
|
---|
3333 | D3D10DDI_HDEVICE hDevice,
|
---|
3334 | D3D10DDI_HSHADER hShader,
|
---|
3335 | UINT NumClassInstances,
|
---|
3336 | const UINT* pPointerData,
|
---|
3337 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3338 | )
|
---|
3339 | {
|
---|
3340 | DEBUG_BREAKPOINT_TEST();
|
---|
3341 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3342 | LogFlowFuncEnter();
|
---|
3343 | }
|
---|
3344 |
|
---|
3345 | void APIENTRY vboxDXHsSetShaderWithIfaces(
|
---|
3346 | D3D10DDI_HDEVICE hDevice,
|
---|
3347 | D3D10DDI_HSHADER hShader,
|
---|
3348 | UINT NumClassInstances,
|
---|
3349 | const UINT* pPointerData,
|
---|
3350 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3351 | )
|
---|
3352 | {
|
---|
3353 | DEBUG_BREAKPOINT_TEST();
|
---|
3354 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3355 | LogFlowFuncEnter();
|
---|
3356 | }
|
---|
3357 |
|
---|
3358 | void APIENTRY vboxDXDsSetShaderWithIfaces(
|
---|
3359 | D3D10DDI_HDEVICE hDevice,
|
---|
3360 | D3D10DDI_HSHADER hShader,
|
---|
3361 | UINT NumClassInstances,
|
---|
3362 | const UINT* pPointerData,
|
---|
3363 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3364 | )
|
---|
3365 | {
|
---|
3366 | DEBUG_BREAKPOINT_TEST();
|
---|
3367 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3368 | LogFlowFuncEnter();
|
---|
3369 | }
|
---|
3370 |
|
---|
3371 | void APIENTRY vboxDXCsSetShaderWithIfaces(
|
---|
3372 | D3D10DDI_HDEVICE hDevice,
|
---|
3373 | D3D10DDI_HSHADER hShader,
|
---|
3374 | UINT NumClassInstances,
|
---|
3375 | const UINT* pPointerData,
|
---|
3376 | const D3D11DDIARG_POINTERDATA* pIfaces
|
---|
3377 | )
|
---|
3378 | {
|
---|
3379 | DEBUG_BREAKPOINT_TEST();
|
---|
3380 | RT_NOREF(hDevice, hShader, NumClassInstances, pPointerData, pIfaces);
|
---|
3381 | LogFlowFuncEnter();
|
---|
3382 | }
|
---|
3383 |
|
---|
3384 | static void APIENTRY ddi11CreateComputeShader(
|
---|
3385 | D3D10DDI_HDEVICE hDevice,
|
---|
3386 | const UINT* pShaderCode,
|
---|
3387 | D3D10DDI_HSHADER hShader,
|
---|
3388 | D3D10DDI_HRTSHADER hRTShader
|
---|
3389 | )
|
---|
3390 | {
|
---|
3391 | //DEBUG_BREAKPOINT_TEST();
|
---|
3392 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3393 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3394 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, ShaderCode: %X %X ...", pDevice, pShader, pShaderCode[0], pShaderCode[1]));
|
---|
3395 |
|
---|
3396 | pShader->hRTShader = hRTShader;
|
---|
3397 |
|
---|
3398 | vboxDXCreateShader(pDevice, SVGA3D_SHADERTYPE_CS, pShader, pShaderCode, NULL, 0, NULL, 0, NULL, 0);
|
---|
3399 | }
|
---|
3400 |
|
---|
3401 | static void APIENTRY ddi10CsSetShader(
|
---|
3402 | D3D10DDI_HDEVICE hDevice,
|
---|
3403 | D3D10DDI_HSHADER hShader
|
---|
3404 | )
|
---|
3405 | {
|
---|
3406 | //DEBUG_BREAKPOINT_TEST();
|
---|
3407 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3408 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3409 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p", pDevice, pShader));
|
---|
3410 |
|
---|
3411 | vboxDXSetShader(pDevice, SVGA3D_SHADERTYPE_CS, pShader);
|
---|
3412 | }
|
---|
3413 |
|
---|
3414 | static void APIENTRY ddi10CsSetShaderResources(
|
---|
3415 | D3D10DDI_HDEVICE hDevice,
|
---|
3416 | UINT StartSlot,
|
---|
3417 | UINT NumViews,
|
---|
3418 | const D3D10DDI_HSHADERRESOURCEVIEW* phShaderResourceViews
|
---|
3419 | )
|
---|
3420 | {
|
---|
3421 | //DEBUG_BREAKPOINT_TEST();
|
---|
3422 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3423 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
3424 |
|
---|
3425 | vboxDXSetShaderResourceViews(pDevice, SVGA3D_SHADERTYPE_CS, StartSlot, NumViews, (PVBOXDXSHADERRESOURCEVIEW *)phShaderResourceViews);
|
---|
3426 | }
|
---|
3427 |
|
---|
3428 | static void APIENTRY ddi10CsSetSamplers(
|
---|
3429 | D3D10DDI_HDEVICE hDevice,
|
---|
3430 | UINT StartSlot,
|
---|
3431 | UINT NumSamplers,
|
---|
3432 | const D3D10DDI_HSAMPLER* phSamplers
|
---|
3433 | )
|
---|
3434 | {
|
---|
3435 | //DEBUG_BREAKPOINT_TEST();
|
---|
3436 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3437 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumSamplers = %u\n", pDevice, StartSlot, NumSamplers));
|
---|
3438 |
|
---|
3439 | Assert(NumSamplers <= SVGA3D_DX_MAX_SAMPLERS);
|
---|
3440 | NumSamplers = RT_MIN(NumSamplers, SVGA3D_DX_MAX_SAMPLERS);
|
---|
3441 |
|
---|
3442 | /* Fetch sampler ids. */
|
---|
3443 | uint32_t aSamplerIds[SVGA3D_DX_MAX_SAMPLERS];
|
---|
3444 | for (unsigned i = 0; i < NumSamplers; ++i)
|
---|
3445 | {
|
---|
3446 | VBOXDX_SAMPLER_STATE *pSamplerState = (PVBOXDX_SAMPLER_STATE)phSamplers[i].pDrvPrivate;
|
---|
3447 | aSamplerIds[i] = pSamplerState ? pSamplerState->uSamplerId : SVGA3D_INVALID_ID;
|
---|
3448 | }
|
---|
3449 |
|
---|
3450 | vboxDXSetSamplers(pDevice, SVGA3D_SHADERTYPE_CS, StartSlot, NumSamplers, aSamplerIds);
|
---|
3451 | }
|
---|
3452 |
|
---|
3453 | static void APIENTRY ddi11_1CsSetConstantBuffers(
|
---|
3454 | D3D10DDI_HDEVICE hDevice,
|
---|
3455 | UINT StartSlot,
|
---|
3456 | UINT NumBuffers,
|
---|
3457 | const D3D10DDI_HRESOURCE* phBuffers,
|
---|
3458 | const UINT* pFirstConstant,
|
---|
3459 | const UINT* pNumConstants
|
---|
3460 | )
|
---|
3461 | {
|
---|
3462 | //DEBUG_BREAKPOINT_TEST();
|
---|
3463 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3464 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3465 |
|
---|
3466 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_CS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, pFirstConstant, pNumConstants);
|
---|
3467 | }
|
---|
3468 |
|
---|
3469 | static void APIENTRY ddi10CsSetConstantBuffers(
|
---|
3470 | D3D10DDI_HDEVICE hDevice,
|
---|
3471 | UINT StartSlot, // The starting constant buffer to set.
|
---|
3472 | UINT NumBuffers, // The total number of buffers to set.
|
---|
3473 | const D3D10DDI_HRESOURCE* phBuffers // An array of handles to the constant buffers, beginning with the buffer that StartBuffer specifies.
|
---|
3474 | )
|
---|
3475 | {
|
---|
3476 | //DEBUG_BREAKPOINT_TEST();
|
---|
3477 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3478 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumBuffers = %u\n", pDevice, StartSlot, NumBuffers));
|
---|
3479 |
|
---|
3480 | vboxDXSetConstantBuffers(pDevice, SVGA3D_SHADERTYPE_CS, StartSlot, NumBuffers, (PVBOXDX_RESOURCE *)phBuffers, NULL, NULL);
|
---|
3481 | }
|
---|
3482 |
|
---|
3483 | static SIZE_T APIENTRY ddi11CalcPrivateUnorderedAccessViewSize(
|
---|
3484 | D3D10DDI_HDEVICE hDevice,
|
---|
3485 | const D3D11DDIARG_CREATEUNORDEREDACCESSVIEW* pCreateUnorderedAccessView
|
---|
3486 | )
|
---|
3487 | {
|
---|
3488 | RT_NOREF(hDevice, pCreateUnorderedAccessView);
|
---|
3489 | return sizeof(VBOXDXUNORDEREDACCESSVIEW);
|
---|
3490 | }
|
---|
3491 |
|
---|
3492 | static void APIENTRY ddi11CreateUnorderedAccessView(
|
---|
3493 | D3D10DDI_HDEVICE hDevice,
|
---|
3494 | const D3D11DDIARG_CREATEUNORDEREDACCESSVIEW* pCreateUnorderedAccessView,
|
---|
3495 | D3D11DDI_HUNORDEREDACCESSVIEW hUnorderedAccessView,
|
---|
3496 | D3D11DDI_HRTUNORDEREDACCESSVIEW hRTUnorderedAccessView
|
---|
3497 | )
|
---|
3498 | {
|
---|
3499 | //DEBUG_BREAKPOINT_TEST();
|
---|
3500 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3501 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pCreateUnorderedAccessView->hDrvResource.pDrvPrivate;
|
---|
3502 | PVBOXDXUNORDEREDACCESSVIEW pUnorderedAccessView = (PVBOXDXUNORDEREDACCESSVIEW)hUnorderedAccessView.pDrvPrivate;
|
---|
3503 | LogFlowFunc(("pDevice 0x%p, pResource %p, pUnorderedAccessView 0x%p", pDevice, pResource, pUnorderedAccessView));
|
---|
3504 |
|
---|
3505 | pUnorderedAccessView->hRTUnorderedAccessView = hRTUnorderedAccessView;
|
---|
3506 | pUnorderedAccessView->pResource = pResource;
|
---|
3507 | pUnorderedAccessView->Format = pCreateUnorderedAccessView->Format;
|
---|
3508 | pUnorderedAccessView->ResourceDimension = pCreateUnorderedAccessView->ResourceDimension;
|
---|
3509 | switch (pUnorderedAccessView->ResourceDimension)
|
---|
3510 | {
|
---|
3511 | case D3D10DDIRESOURCE_BUFFER:
|
---|
3512 | pUnorderedAccessView->DimensionDesc.Buffer = pCreateUnorderedAccessView->Buffer;
|
---|
3513 | break;
|
---|
3514 | case D3D10DDIRESOURCE_TEXTURE1D:
|
---|
3515 | pUnorderedAccessView->DimensionDesc.Tex1D = pCreateUnorderedAccessView->Tex1D;
|
---|
3516 | break;
|
---|
3517 | case D3D10DDIRESOURCE_TEXTURE2D:
|
---|
3518 | pUnorderedAccessView->DimensionDesc.Tex2D = pCreateUnorderedAccessView->Tex2D;
|
---|
3519 | break;
|
---|
3520 | case D3D10DDIRESOURCE_TEXTURE3D:
|
---|
3521 | pUnorderedAccessView->DimensionDesc.Tex3D = pCreateUnorderedAccessView->Tex3D;
|
---|
3522 | break;
|
---|
3523 | default:
|
---|
3524 | vboxDXDeviceSetError(pDevice, E_INVALIDARG);
|
---|
3525 | return;
|
---|
3526 | }
|
---|
3527 |
|
---|
3528 | vboxDXCreateUnorderedAccessView(pDevice, pUnorderedAccessView);
|
---|
3529 | }
|
---|
3530 |
|
---|
3531 | static void APIENTRY ddi11DestroyUnorderedAccessView(
|
---|
3532 | D3D10DDI_HDEVICE hDevice,
|
---|
3533 | D3D11DDI_HUNORDEREDACCESSVIEW hUnorderedAccessView
|
---|
3534 | )
|
---|
3535 | {
|
---|
3536 | //DEBUG_BREAKPOINT_TEST();
|
---|
3537 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3538 | PVBOXDXUNORDEREDACCESSVIEW pUnorderedAccessView = (PVBOXDXUNORDEREDACCESSVIEW)hUnorderedAccessView.pDrvPrivate;
|
---|
3539 | LogFlowFunc(("pDevice 0x%p, pUnorderedAccessView 0x%p", pDevice, pUnorderedAccessView));
|
---|
3540 |
|
---|
3541 | vboxDXDestroyUnorderedAccessView(pDevice, pUnorderedAccessView);
|
---|
3542 | }
|
---|
3543 |
|
---|
3544 | static void APIENTRY ddi11ClearUnorderedAccessViewUint(
|
---|
3545 | D3D10DDI_HDEVICE hDevice,
|
---|
3546 | D3D11DDI_HUNORDEREDACCESSVIEW hUnorderedAccessView,
|
---|
3547 | const UINT Values[4]
|
---|
3548 | )
|
---|
3549 | {
|
---|
3550 | DEBUG_BREAKPOINT_TEST();
|
---|
3551 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3552 | PVBOXDXUNORDEREDACCESSVIEW pUnorderedAccessView = (PVBOXDXUNORDEREDACCESSVIEW)hUnorderedAccessView.pDrvPrivate;
|
---|
3553 | LogFlowFunc(("pDevice 0x%p, pUnorderedAccessView 0x%p", pDevice, pUnorderedAccessView));
|
---|
3554 |
|
---|
3555 | vboxDXClearUnorderedAccessViewUint(pDevice, pUnorderedAccessView, Values);
|
---|
3556 | }
|
---|
3557 |
|
---|
3558 | static void APIENTRY ddi11ClearUnorderedAccessViewFloat(
|
---|
3559 | D3D10DDI_HDEVICE hDevice,
|
---|
3560 | D3D11DDI_HUNORDEREDACCESSVIEW hUnorderedAccessView,
|
---|
3561 | const FLOAT Values[4]
|
---|
3562 | )
|
---|
3563 | {
|
---|
3564 | DEBUG_BREAKPOINT_TEST();
|
---|
3565 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3566 | PVBOXDXUNORDEREDACCESSVIEW pUnorderedAccessView = (PVBOXDXUNORDEREDACCESSVIEW)hUnorderedAccessView.pDrvPrivate;
|
---|
3567 | LogFlowFunc(("pDevice 0x%p, pUnorderedAccessView 0x%p", pDevice, pUnorderedAccessView));
|
---|
3568 |
|
---|
3569 | vboxDXClearUnorderedAccessViewFloat(pDevice, pUnorderedAccessView, Values);
|
---|
3570 | }
|
---|
3571 |
|
---|
3572 | static void APIENTRY ddi11CsSetUnorderedAccessViews(
|
---|
3573 | D3D10DDI_HDEVICE hDevice,
|
---|
3574 | UINT StartSlot,
|
---|
3575 | UINT NumViews,
|
---|
3576 | const D3D11DDI_HUNORDEREDACCESSVIEW* phUnorderedAccessView,
|
---|
3577 | const UINT* pUAVInitialCounts
|
---|
3578 | )
|
---|
3579 | {
|
---|
3580 | //DEBUG_BREAKPOINT_TEST();
|
---|
3581 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3582 | LogFlowFunc(("pDevice = %p, StartSlot = %u, NumViews = %u\n", pDevice, StartSlot, NumViews));
|
---|
3583 |
|
---|
3584 | AssertReturnVoidStmt( NumViews <= SVGA3D_DX11_1_MAX_UAVIEWS
|
---|
3585 | && StartSlot < SVGA3D_DX11_1_MAX_UAVIEWS
|
---|
3586 | && NumViews + StartSlot <= SVGA3D_DX11_1_MAX_UAVIEWS,
|
---|
3587 | vboxDXDeviceSetError(pDevice, E_INVALIDARG));
|
---|
3588 |
|
---|
3589 | /* Fetch View ids. */
|
---|
3590 | uint32_t aViewIds[SVGA3D_DX11_1_MAX_UAVIEWS];
|
---|
3591 | for (unsigned i = 0; i < NumViews; ++i)
|
---|
3592 | {
|
---|
3593 | VBOXDXUNORDEREDACCESSVIEW *pView = (PVBOXDXUNORDEREDACCESSVIEW)phUnorderedAccessView[i].pDrvPrivate;
|
---|
3594 | aViewIds[i] = pView ? pView->uUnorderedAccessViewId : SVGA3D_INVALID_ID;
|
---|
3595 | }
|
---|
3596 |
|
---|
3597 | vboxDXCsSetUnorderedAccessViews(pDevice, StartSlot, NumViews, aViewIds, pUAVInitialCounts);
|
---|
3598 | }
|
---|
3599 |
|
---|
3600 | static void APIENTRY ddi11Dispatch(
|
---|
3601 | D3D10DDI_HDEVICE hDevice,
|
---|
3602 | UINT ThreadGroupCountX,
|
---|
3603 | UINT ThreadGroupCountY,
|
---|
3604 | UINT ThreadGroupCountZ
|
---|
3605 | )
|
---|
3606 | {
|
---|
3607 | //DEBUG_BREAKPOINT_TEST();
|
---|
3608 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3609 | LogFlowFunc(("pDevice = %p, ThreadGroupCountX %u, ThreadGroupCountY %u, ThreadGroupCountZ %u\n", pDevice, ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ));
|
---|
3610 |
|
---|
3611 | vboxDXDispatch(pDevice, ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
|
---|
3612 | }
|
---|
3613 |
|
---|
3614 | static void APIENTRY ddi11DispatchIndirect(
|
---|
3615 | D3D10DDI_HDEVICE hDevice,
|
---|
3616 | D3D10DDI_HRESOURCE hBufferForArgs,
|
---|
3617 | UINT AlignedByteOffsetForArgs
|
---|
3618 | )
|
---|
3619 | {
|
---|
3620 | DEBUG_BREAKPOINT_TEST();
|
---|
3621 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3622 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hBufferForArgs.pDrvPrivate;
|
---|
3623 | LogFlowFunc(("pDevice 0x%p, pResource %p, AlignedByteOffsetForArgs %u", pDevice, pResource, AlignedByteOffsetForArgs));
|
---|
3624 |
|
---|
3625 | vboxDXDispatchIndirect(pDevice, pResource, AlignedByteOffsetForArgs);
|
---|
3626 | }
|
---|
3627 |
|
---|
3628 | void APIENTRY vboxDXSetResourceMinLOD(
|
---|
3629 | D3D10DDI_HDEVICE hDevice,
|
---|
3630 | D3D10DDI_HRESOURCE hResource,
|
---|
3631 | FLOAT MinLOD
|
---|
3632 | )
|
---|
3633 | {
|
---|
3634 | DEBUG_BREAKPOINT_TEST();
|
---|
3635 | RT_NOREF(hDevice, hResource, MinLOD);
|
---|
3636 | LogFlowFuncEnter();
|
---|
3637 | }
|
---|
3638 |
|
---|
3639 | static void APIENTRY ddi11CopyStructureCount(
|
---|
3640 | D3D10DDI_HDEVICE hDevice,
|
---|
3641 | D3D10DDI_HRESOURCE hDstBuffer,
|
---|
3642 | UINT DstAlignedByteOffset,
|
---|
3643 | D3D11DDI_HUNORDEREDACCESSVIEW hSrcView
|
---|
3644 | )
|
---|
3645 | {
|
---|
3646 | //DEBUG_BREAKPOINT_TEST();
|
---|
3647 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3648 | PVBOXDX_RESOURCE pDstBuffer = (PVBOXDX_RESOURCE)hDstBuffer.pDrvPrivate;
|
---|
3649 | PVBOXDXUNORDEREDACCESSVIEW pSrcView = (PVBOXDXUNORDEREDACCESSVIEW)hSrcView.pDrvPrivate;
|
---|
3650 | LogFlowFunc(("pDevice 0x%p, pDstBuffer 0x%p, pSrcView %p, DstAlignedByteOffset %d", pDevice, pDstBuffer, pSrcView, DstAlignedByteOffset));
|
---|
3651 |
|
---|
3652 | vboxDXCopyStructureCount(pDevice, pDstBuffer, DstAlignedByteOffset, pSrcView);
|
---|
3653 | }
|
---|
3654 |
|
---|
3655 | static void APIENTRY ddi11_1Discard(
|
---|
3656 | D3D10DDI_HDEVICE hDevice,
|
---|
3657 | D3D11DDI_HANDLETYPE HandleType,
|
---|
3658 | VOID* hResourceOrView,
|
---|
3659 | const D3D10_DDI_RECT* pRects,
|
---|
3660 | UINT NumRects
|
---|
3661 | )
|
---|
3662 | {
|
---|
3663 | //DEBUG_BREAKPOINT_TEST();
|
---|
3664 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3665 | LogFlowFunc(("pDevice %p, HandleType %u, hResourceOrView %p, NumRect %u\n", pDevice, HandleType, hResourceOrView, NumRects));
|
---|
3666 |
|
---|
3667 | RT_NOREF(pDevice, HandleType, hResourceOrView, pRects, NumRects);
|
---|
3668 | /** @todo "Discards (evicts) an allocation from video display memory" */
|
---|
3669 | }
|
---|
3670 |
|
---|
3671 | static void APIENTRY ddi11_1AssignDebugBinary(
|
---|
3672 | D3D10DDI_HDEVICE hDevice,
|
---|
3673 | D3D10DDI_HSHADER hShader,
|
---|
3674 | UINT uBinarySize,
|
---|
3675 | const VOID* pBinary
|
---|
3676 | )
|
---|
3677 | {
|
---|
3678 | //DEBUG_BREAKPOINT_TEST();
|
---|
3679 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3680 | PVBOXDXSHADER pShader = (PVBOXDXSHADER)hShader.pDrvPrivate;
|
---|
3681 | LogFlowFunc(("pDevice 0x%p, pShader 0x%p, uBinarySize %u", pDevice, pShader, uBinarySize));
|
---|
3682 | RT_NOREF(pDevice, pShader, uBinarySize, pBinary);
|
---|
3683 | /* Not used by this driver. */
|
---|
3684 | }
|
---|
3685 |
|
---|
3686 | static void APIENTRY ddi10DynamicConstantBufferMapNoOverwrite(
|
---|
3687 | D3D10DDI_HDEVICE hDevice,
|
---|
3688 | D3D10DDI_HRESOURCE hResource,
|
---|
3689 | UINT Subresource,
|
---|
3690 | D3D10_DDI_MAP DDIMap,
|
---|
3691 | UINT Flags,
|
---|
3692 | D3D10DDI_MAPPED_SUBRESOURCE* pMappedSubResource
|
---|
3693 | )
|
---|
3694 | {
|
---|
3695 | //DEBUG_BREAKPOINT_TEST();
|
---|
3696 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3697 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
3698 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d, map %d, flags 0x%X", pDevice, pResource, Subresource, DDIMap, Flags));
|
---|
3699 |
|
---|
3700 | vboxDXResourceMap(pDevice, pResource, Subresource, DDIMap, Flags, pMappedSubResource);
|
---|
3701 | }
|
---|
3702 |
|
---|
3703 | static void APIENTRY ddi11_1CheckDirectFlipSupport(
|
---|
3704 | D3D10DDI_HDEVICE hDevice,
|
---|
3705 | D3D10DDI_HRESOURCE hResource,
|
---|
3706 | D3D10DDI_HRESOURCE hResourceDWM,
|
---|
3707 | UINT CheckDirectFlipFlags,
|
---|
3708 | BOOL* pSupported
|
---|
3709 | )
|
---|
3710 | {
|
---|
3711 | //DEBUG_BREAKPOINT_TEST();
|
---|
3712 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3713 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)hResource.pDrvPrivate;
|
---|
3714 | PVBOXDX_RESOURCE pResourceDWM = (PVBOXDX_RESOURCE)hResourceDWM.pDrvPrivate;
|
---|
3715 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, pResourceDWM 0x%p, CheckDirectFlipFlags 0x%X", pDevice, pResource, pResourceDWM, CheckDirectFlipFlags));
|
---|
3716 | RT_NOREF(pDevice, pResource, pResourceDWM, CheckDirectFlipFlags);
|
---|
3717 |
|
---|
3718 | if (pSupported)
|
---|
3719 | pSupported = FALSE; /* Not supported. Maybe later. */
|
---|
3720 | }
|
---|
3721 |
|
---|
3722 | static void APIENTRY ddi11_1ClearView(
|
---|
3723 | D3D10DDI_HDEVICE hDevice,
|
---|
3724 | D3D11DDI_HANDLETYPE ViewType,
|
---|
3725 | VOID* hView,
|
---|
3726 | const FLOAT Color[4],
|
---|
3727 | const D3D10_DDI_RECT* pRect,
|
---|
3728 | UINT NumRects
|
---|
3729 | )
|
---|
3730 | {
|
---|
3731 | //DEBUG_BREAKPOINT_TEST();
|
---|
3732 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
3733 | LogFlowFunc(("pDevice 0x%p, ViewType %d, pView %p, pRect %p, NumRects %u", pDevice, ViewType, hView, pRect, NumRects));
|
---|
3734 |
|
---|
3735 | if (pDevice->pAdapter->fVBoxCaps & VBSVGA3D_CAP_VIDEO)
|
---|
3736 | {
|
---|
3737 | uint32_t ViewId = SVGA3D_INVALID_ID;
|
---|
3738 |
|
---|
3739 | /* "Possible types are the following.
|
---|
3740 | * D3D10DDI_HT_RENDERTARGETVIEW
|
---|
3741 | * D3D11DDI_HT_UNORDEREDACCESSVIEW
|
---|
3742 | * Any D3D11_1DDI_HT_VIDEOXXX type"
|
---|
3743 | */
|
---|
3744 | switch (ViewType)
|
---|
3745 | {
|
---|
3746 | case D3D10DDI_HT_RENDERTARGETVIEW:
|
---|
3747 | {
|
---|
3748 | PVBOXDXRENDERTARGETVIEW pRenderTargetView = (PVBOXDXRENDERTARGETVIEW)hView;
|
---|
3749 | ViewId = pRenderTargetView->uRenderTargetViewId;
|
---|
3750 | break;
|
---|
3751 | }
|
---|
3752 | case D3D11DDI_HT_UNORDEREDACCESSVIEW:
|
---|
3753 | {
|
---|
3754 | PVBOXDXUNORDEREDACCESSVIEW pUnorderedAccessView = (PVBOXDXUNORDEREDACCESSVIEW)hView;
|
---|
3755 | ViewId = pUnorderedAccessView->uUnorderedAccessViewId;
|
---|
3756 | break;
|
---|
3757 | }
|
---|
3758 | case D3D11_1DDI_HT_VIDEODECODEROUTPUTVIEW:
|
---|
3759 | {
|
---|
3760 | PVBOXDXVIDEODECODEROUTPUTVIEW pVideoDecoderOutputView = (PVBOXDXVIDEODECODEROUTPUTVIEW)hView;
|
---|
3761 | ViewId = pVideoDecoderOutputView->uVideoDecoderOutputViewId;
|
---|
3762 | break;
|
---|
3763 | }
|
---|
3764 | case D3D11_1DDI_HT_VIDEOPROCESSORINPUTVIEW:
|
---|
3765 | {
|
---|
3766 | PVBOXDXVIDEOPROCESSORINPUTVIEW pVideoProcessorInputView = (PVBOXDXVIDEOPROCESSORINPUTVIEW)hView;
|
---|
3767 | ViewId = pVideoProcessorInputView->uVideoProcessorInputViewId;
|
---|
3768 | break;
|
---|
3769 | }
|
---|
3770 | case D3D11_1DDI_HT_VIDEOPROCESSOROUTPUTVIEW:
|
---|
3771 | {
|
---|
3772 | PVBOXDXVIDEOPROCESSOROUTPUTVIEW pVideoProcessorOutputView = (PVBOXDXVIDEOPROCESSOROUTPUTVIEW)hView;
|
---|
3773 | ViewId = pVideoProcessorOutputView->uVideoProcessorOutputViewId;
|
---|
3774 | break;
|
---|
3775 | }
|
---|
3776 | default:
|
---|
3777 | {
|
---|
3778 | DEBUG_BREAKPOINT_TEST();
|
---|
3779 | break;
|
---|
3780 | }
|
---|
3781 | }
|
---|
3782 | if (ViewId != SVGA3D_INVALID_ID)
|
---|
3783 | vboxDXClearView(pDevice, ViewType, ViewId, Color, pRect, NumRects);
|
---|
3784 | return;
|
---|
3785 | }
|
---|
3786 |
|
---|
3787 | if (ViewType == D3D10DDI_HT_RENDERTARGETVIEW)
|
---|
3788 | {
|
---|
3789 | PVBOXDXRENDERTARGETVIEW pRenderTargetView = (PVBOXDXRENDERTARGETVIEW)hView;
|
---|
3790 | if (pRect == NULL)
|
---|
3791 | vboxDXClearRenderTargetView(pDevice, pRenderTargetView, Color);
|
---|
3792 | else
|
---|
3793 | vboxDXClearRenderTargetViewRegion(pDevice, pRenderTargetView, Color, pRect, NumRects);
|
---|
3794 | }
|
---|
3795 | else
|
---|
3796 | DEBUG_BREAKPOINT_TEST();
|
---|
3797 | }
|
---|
3798 |
|
---|
3799 | static HRESULT APIENTRY dxgiPresent(DXGI_DDI_ARG_PRESENT *pPresentArg)
|
---|
3800 | {
|
---|
3801 | //DEBUG_BREAKPOINT_TEST();
|
---|
3802 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pPresentArg->hDevice;
|
---|
3803 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)pPresentArg->hSurfaceToPresent;
|
---|
3804 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)pPresentArg->hDstResource;
|
---|
3805 | LogFlowFunc(("pDevice 0x%p, pSrcResource 0x%p[%d], pDstResource 0x%p[%d], pDXGIContext %p, Flags 0x%08X, FlipInterval %d",
|
---|
3806 | pDevice, pSrcResource, pPresentArg->SrcSubResourceIndex,
|
---|
3807 | pDstResource, pPresentArg->DstSubResourceIndex, pPresentArg->pDXGIContext,
|
---|
3808 | pPresentArg->Flags.Value, pPresentArg->FlipInterval));
|
---|
3809 |
|
---|
3810 | HRESULT hr = vboxDXFlush(pDevice, true);
|
---|
3811 | AssertReturnStmt(SUCCEEDED(hr), vboxDXDeviceSetError(pDevice, hr), hr);
|
---|
3812 |
|
---|
3813 | DXGIDDICB_PRESENT ddiPresent;
|
---|
3814 | RT_ZERO(ddiPresent);
|
---|
3815 | ddiPresent.hSrcAllocation = vboxDXGetAllocation(pSrcResource);
|
---|
3816 | ddiPresent.hDstAllocation = vboxDXGetAllocation(pDstResource);
|
---|
3817 | ddiPresent.pDXGIContext = pPresentArg->pDXGIContext;
|
---|
3818 | ddiPresent.hContext = pDevice->hContext;
|
---|
3819 |
|
---|
3820 | hr = pDevice->pDXGIBaseCallbacks->pfnPresentCb(pDevice->hRTDevice.handle, &ddiPresent);
|
---|
3821 | AssertReturnStmt(SUCCEEDED(hr), vboxDXDeviceSetError(pDevice, hr), hr);
|
---|
3822 |
|
---|
3823 | return STATUS_SUCCESS;
|
---|
3824 | }
|
---|
3825 |
|
---|
3826 | static HRESULT APIENTRY dxgiGetGammaCaps(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS *pGammaArg)
|
---|
3827 | {
|
---|
3828 | //DEBUG_BREAKPOINT_TEST();
|
---|
3829 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pGammaArg->hDevice;
|
---|
3830 | LogFlowFunc(("pDevice 0x%p\n", pDevice));
|
---|
3831 | RT_NOREF(pDevice);
|
---|
3832 |
|
---|
3833 | pGammaArg->pGammaCapabilities->ScaleAndOffsetSupported = FALSE;
|
---|
3834 | pGammaArg->pGammaCapabilities->MaxConvertedValue = 0.0f;
|
---|
3835 | pGammaArg->pGammaCapabilities->MinConvertedValue = 0.0f;
|
---|
3836 | pGammaArg->pGammaCapabilities->NumGammaControlPoints = 0;
|
---|
3837 | RT_ZERO(pGammaArg->pGammaCapabilities->ControlPointPositions);
|
---|
3838 |
|
---|
3839 | return S_OK;
|
---|
3840 | }
|
---|
3841 |
|
---|
3842 | static HRESULT APIENTRY dxgiSetDisplayMode(DXGI_DDI_ARG_SETDISPLAYMODE *pDisplayModeData)
|
---|
3843 | {
|
---|
3844 | //DEBUG_BREAKPOINT_TEST();
|
---|
3845 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pDisplayModeData->hDevice;
|
---|
3846 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pDisplayModeData->hResource;
|
---|
3847 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p, subres %d", pDevice, pResource, pDisplayModeData->SubResourceIndex));
|
---|
3848 |
|
---|
3849 | AssertReturn(pResource->AllocationDesc.fPrimary && pDisplayModeData->SubResourceIndex == 0, E_INVALIDARG);
|
---|
3850 |
|
---|
3851 | D3DDDICB_SETDISPLAYMODE ddiSetDisplayMode;
|
---|
3852 | RT_ZERO(ddiSetDisplayMode);
|
---|
3853 | ddiSetDisplayMode.hPrimaryAllocation = vboxDXGetAllocation(pResource);
|
---|
3854 | HRESULT hr = pDevice->pRTCallbacks->pfnSetDisplayModeCb(pDevice->hRTDevice.handle, &ddiSetDisplayMode);
|
---|
3855 | AssertReturn(SUCCEEDED(hr), hr);
|
---|
3856 |
|
---|
3857 | return STATUS_SUCCESS;
|
---|
3858 | }
|
---|
3859 |
|
---|
3860 | HRESULT APIENTRY vboxDXGISetResourcePriority(DXGI_DDI_ARG_SETRESOURCEPRIORITY *)
|
---|
3861 | {
|
---|
3862 | DEBUG_BREAKPOINT_TEST();
|
---|
3863 | LogFlowFuncEnter();
|
---|
3864 | return S_OK;
|
---|
3865 | }
|
---|
3866 |
|
---|
3867 | static HRESULT APIENTRY dxgiQueryResourceResidency(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY *pQueryResourceResidency)
|
---|
3868 | {
|
---|
3869 | //DEBUG_BREAKPOINT_TEST();
|
---|
3870 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pQueryResourceResidency->hDevice;
|
---|
3871 | PVBOXDX_RESOURCE *papResources = (PVBOXDX_RESOURCE *)pQueryResourceResidency->pResources;
|
---|
3872 | LogFlowFunc(("pDevice 0x%p, Resources %d", pDevice, pQueryResourceResidency->Resources));
|
---|
3873 |
|
---|
3874 | /* "If pfnQueryResidencyCb returns D3DDDI_RESIDENCYSTATUS_NOTRESIDENT for any query,
|
---|
3875 | * QueryResourceResidencyDXGI must return S_NOT_RESIDENT."
|
---|
3876 | */
|
---|
3877 | bool fNotResident = false;
|
---|
3878 |
|
---|
3879 | /* "If pfnQueryResidencyCb returns D3DDDI_RESIDENCYSTATUS_RESIDENTINSHAREDMEMORY for any query
|
---|
3880 | * and does not return D3DDDI_RESIDENCYSTATUS_NOTRESIDENT for any query, QueryResourceResidencyDXGI
|
---|
3881 | * must return S_RESIDENT_IN_SHARED_MEMORY."
|
---|
3882 | */
|
---|
3883 | bool fResidentInSharedMemory = false;
|
---|
3884 |
|
---|
3885 | /* "QueryResourceResidencyDXGI must return S_OK only if all calls to pfnQueryResidencyCb for all
|
---|
3886 | * queries return D3DDDI_RESIDENCYSTATUS_RESIDENTINGPUMEMORY."
|
---|
3887 | */
|
---|
3888 |
|
---|
3889 | for (SIZE_T i = 0; i < pQueryResourceResidency->Resources; ++i)
|
---|
3890 | {
|
---|
3891 | D3DDDI_RESIDENCYSTATUS ResidencyStatus = (D3DDDI_RESIDENCYSTATUS)0;
|
---|
3892 |
|
---|
3893 | D3DKMT_HANDLE const hAllocation = vboxDXGetAllocation(papResources[i]);
|
---|
3894 |
|
---|
3895 | D3DDDICB_QUERYRESIDENCY ddiQueryResidency;
|
---|
3896 | RT_ZERO(ddiQueryResidency);
|
---|
3897 | ddiQueryResidency.NumAllocations = 1;
|
---|
3898 | ddiQueryResidency.HandleList = &hAllocation;
|
---|
3899 | ddiQueryResidency.pResidencyStatus = &ResidencyStatus;
|
---|
3900 |
|
---|
3901 | HRESULT hr = pDevice->pRTCallbacks->pfnQueryResidencyCb(pDevice->hRTDevice.handle, &ddiQueryResidency);
|
---|
3902 | AssertReturn(SUCCEEDED(hr), hr);
|
---|
3903 |
|
---|
3904 | if (ResidencyStatus == D3DDDI_RESIDENCYSTATUS_RESIDENTINGPUMEMORY)
|
---|
3905 | {
|
---|
3906 | pQueryResourceResidency->pStatus[i] = DXGI_DDI_RESIDENCY_FULLY_RESIDENT;
|
---|
3907 | }
|
---|
3908 | else if (ResidencyStatus == D3DDDI_RESIDENCYSTATUS_RESIDENTINSHAREDMEMORY)
|
---|
3909 | {
|
---|
3910 | fResidentInSharedMemory = true;
|
---|
3911 | pQueryResourceResidency->pStatus[i] = DXGI_DDI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY;
|
---|
3912 | }
|
---|
3913 | else if (ResidencyStatus == D3DDDI_RESIDENCYSTATUS_NOTRESIDENT)
|
---|
3914 | {
|
---|
3915 | fNotResident = true;
|
---|
3916 | pQueryResourceResidency->pStatus[i] = DXGI_DDI_RESIDENCY_EVICTED_TO_DISK;
|
---|
3917 | }
|
---|
3918 | else
|
---|
3919 | AssertFailedReturn(E_FAIL);
|
---|
3920 | }
|
---|
3921 |
|
---|
3922 | if (fNotResident)
|
---|
3923 | return S_NOT_RESIDENT;
|
---|
3924 |
|
---|
3925 | if (fResidentInSharedMemory)
|
---|
3926 | return S_RESIDENT_IN_SHARED_MEMORY;
|
---|
3927 |
|
---|
3928 | return S_OK;
|
---|
3929 | }
|
---|
3930 |
|
---|
3931 | static HRESULT APIENTRY dxgiRotateResourceIdentities(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES *pRotateResourceIdentities)
|
---|
3932 | {
|
---|
3933 | // DEBUG_BREAKPOINT_TEST();
|
---|
3934 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pRotateResourceIdentities->hDevice;
|
---|
3935 | LogFlowFunc(("pDevice 0x%p, Resources %d", pDevice, pRotateResourceIdentities->Resources));
|
---|
3936 |
|
---|
3937 | if (pRotateResourceIdentities->Resources <= 1)
|
---|
3938 | return S_OK;
|
---|
3939 |
|
---|
3940 | return vboxDXRotateResourceIdentities(pDevice, pRotateResourceIdentities->Resources, (PVBOXDX_RESOURCE *)pRotateResourceIdentities->pResources);
|
---|
3941 | }
|
---|
3942 |
|
---|
3943 | static HRESULT APIENTRY dxgiBlt(DXGI_DDI_ARG_BLT *pBlt)
|
---|
3944 | {
|
---|
3945 | //DEBUG_BREAKPOINT_TEST();
|
---|
3946 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pBlt->hDevice;
|
---|
3947 | PVBOXDX_RESOURCE pDstResource = (PVBOXDX_RESOURCE)pBlt->hDstResource;
|
---|
3948 | PVBOXDX_RESOURCE pSrcResource = (PVBOXDX_RESOURCE)pBlt->hSrcResource;
|
---|
3949 | LogFlowFunc(("pDevice 0x%p, pDstResource 0x%p[%u], pSrcResource 0x%p[%u], %d,%d %d,%d, flags 0x%x, rotate %u",
|
---|
3950 | pDevice, pDstResource, pBlt->DstSubresource, pSrcResource, pBlt->SrcSubresource,
|
---|
3951 | pBlt->DstLeft, pBlt->DstTop, pBlt->DstRight, pBlt->DstBottom, pBlt->Flags, pBlt->Rotate));
|
---|
3952 |
|
---|
3953 | return vboxDXBlt(pDevice, pDstResource, pBlt->DstSubresource, pSrcResource, pBlt->SrcSubresource,
|
---|
3954 | pBlt->DstLeft, pBlt->DstTop, pBlt->DstRight, pBlt->DstBottom, pBlt->Flags, pBlt->Rotate);
|
---|
3955 | }
|
---|
3956 |
|
---|
3957 | static HRESULT APIENTRY dxgiResolveSharedResource(DXGI_DDI_ARG_RESOLVESHAREDRESOURCE *pResolveSharedResource)
|
---|
3958 | {
|
---|
3959 | //DEBUG_BREAKPOINT_TEST();
|
---|
3960 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pResolveSharedResource->hDevice;
|
---|
3961 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pResolveSharedResource->hResource;
|
---|
3962 | LogFlowFunc(("pDevice 0x%p, pResource 0x%p", pDevice, pResource));
|
---|
3963 |
|
---|
3964 | vboxDXFlush(pDevice, true);
|
---|
3965 |
|
---|
3966 | RT_NOREF(pResource);
|
---|
3967 |
|
---|
3968 | return S_OK;
|
---|
3969 | }
|
---|
3970 |
|
---|
3971 | HRESULT APIENTRY vboxDXGIBlt1(DXGI_DDI_ARG_BLT1 *)
|
---|
3972 | {
|
---|
3973 | DEBUG_BREAKPOINT_TEST();
|
---|
3974 | LogFlowFuncEnter();
|
---|
3975 | return S_OK;
|
---|
3976 | }
|
---|
3977 |
|
---|
3978 | static HRESULT APIENTRY dxgiOfferResources(DXGI_DDI_ARG_OFFERRESOURCES *pOfferResources)
|
---|
3979 | {
|
---|
3980 | //DEBUG_BREAKPOINT_TEST();
|
---|
3981 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pOfferResources->hDevice;
|
---|
3982 | LogFlowFunc(("pDevice 0x%p, Resources %d, Priority %d", pDevice, pOfferResources->Resources, pOfferResources->Priority));
|
---|
3983 |
|
---|
3984 | #ifdef LOG_ENABLED
|
---|
3985 | for (unsigned i = 0; i < pOfferResources->Resources; ++i)
|
---|
3986 | {
|
---|
3987 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pOfferResources->pResources[i];
|
---|
3988 | LogFlowFunc(("Resources[%d]: pResource %p, hAllocation 0x%08x", i, pResource, vboxDXGetAllocation(pResource)));
|
---|
3989 | }
|
---|
3990 | #endif
|
---|
3991 |
|
---|
3992 | return vboxDXOfferResources(pDevice, pOfferResources->Resources, (PVBOXDX_RESOURCE *)pOfferResources->pResources, pOfferResources->Priority);
|
---|
3993 | }
|
---|
3994 |
|
---|
3995 | static HRESULT APIENTRY dxgiReclaimResources(DXGI_DDI_ARG_RECLAIMRESOURCES *pReclaimResources)
|
---|
3996 | {
|
---|
3997 | //DEBUG_BREAKPOINT_TEST();
|
---|
3998 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pReclaimResources->hDevice;
|
---|
3999 | LogFlowFunc(("pDevice 0x%p, Resources %d", pDevice, pReclaimResources->Resources));
|
---|
4000 |
|
---|
4001 | #ifdef LOG_ENABLED
|
---|
4002 | for (unsigned i = 0; i < pReclaimResources->Resources; ++i)
|
---|
4003 | {
|
---|
4004 | PVBOXDX_RESOURCE pResource = (PVBOXDX_RESOURCE)pReclaimResources->pResources[i];
|
---|
4005 | LogFlowFunc(("Resources[%d]: pResource %p, hAllocation 0x%08x, Discarded %d",
|
---|
4006 | i, pResource, vboxDXGetAllocation(pResource), pReclaimResources->pDiscarded ? pReclaimResources->pDiscarded[i] : 0));
|
---|
4007 | }
|
---|
4008 | #endif
|
---|
4009 |
|
---|
4010 | return vboxDXReclaimResources(pDevice, pReclaimResources->Resources, (PVBOXDX_RESOURCE *)pReclaimResources->pResources, pReclaimResources->pDiscarded);
|
---|
4011 | }
|
---|
4012 |
|
---|
4013 |
|
---|
4014 | static void APIENTRY ddi10DestroyDevice(D3D10DDI_HDEVICE hDevice)
|
---|
4015 | {
|
---|
4016 | //DEBUG_BREAKPOINT_TEST();
|
---|
4017 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
4018 | LogFlowFunc(("pDevice 0x%p", pDevice));
|
---|
4019 |
|
---|
4020 | vboxDXDestroyDevice(pDevice);
|
---|
4021 | }
|
---|
4022 |
|
---|
4023 |
|
---|
4024 | static HRESULT APIENTRY ddi10RetrieveSubObject(
|
---|
4025 | D3D10DDI_HDEVICE hDevice,
|
---|
4026 | UINT32 SubDeviceID,
|
---|
4027 | SIZE_T ParamSize,
|
---|
4028 | void *pParams,
|
---|
4029 | SIZE_T OutputParamSize,
|
---|
4030 | void *pOutputParamsBuffer
|
---|
4031 | )
|
---|
4032 | {
|
---|
4033 | RT_NOREF(OutputParamSize, pOutputParamsBuffer);
|
---|
4034 |
|
---|
4035 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)hDevice.pDrvPrivate;
|
---|
4036 | LogFlowFunc(("pDevice 0x%p, SubDeviceID %u, ParamSize %u, OutputParamSize %u", pDevice, SubDeviceID, ParamSize, OutputParamSize));
|
---|
4037 |
|
---|
4038 | if (SubDeviceID == D3D11_1DDI_VIDEO_FUNCTIONS)
|
---|
4039 | {
|
---|
4040 | AssertReturn(ParamSize >= sizeof(D3D11_1DDI_VIDEO_INPUT), E_INVALIDARG);
|
---|
4041 |
|
---|
4042 | if (pDevice->pAdapter->fVBoxCaps & VBSVGA3D_CAP_VIDEO)
|
---|
4043 | {
|
---|
4044 | D3D11_1DDI_VIDEO_INPUT *pVideoInput = (D3D11_1DDI_VIDEO_INPUT *)pParams;
|
---|
4045 | return ddi11_1RetrieveVideoFunctions(pDevice, pVideoInput);
|
---|
4046 | }
|
---|
4047 | return E_FAIL;
|
---|
4048 | }
|
---|
4049 |
|
---|
4050 | DEBUG_BREAKPOINT_TEST();
|
---|
4051 | return E_FAIL;
|
---|
4052 | }
|
---|
4053 |
|
---|
4054 |
|
---|
4055 | /*
|
---|
4056 | * Adapter functions.
|
---|
4057 | */
|
---|
4058 |
|
---|
4059 | static SIZE_T APIENTRY vboxDXCalcPrivateDeviceSize(D3D10DDI_HADAPTER hAdapter, const D3D10DDIARG_CALCPRIVATEDEVICESIZE* pData)
|
---|
4060 | {
|
---|
4061 | RT_NOREF(hAdapter, pData);
|
---|
4062 | LogFlow(("vboxDXCalcPrivateDeviceSize: Interface 0x%08x, Version 0x%08x, Flags 0x%08x", pData->Interface, pData->Version, pData->Flags));
|
---|
4063 |
|
---|
4064 | return sizeof(VBOXDX_DEVICE);
|
---|
4065 | }
|
---|
4066 |
|
---|
4067 | static HRESULT APIENTRY vboxDXCreateDevice(D3D10DDI_HADAPTER hAdapter, D3D10DDIARG_CREATEDEVICE *pCreateData)
|
---|
4068 | {
|
---|
4069 | //DEBUG_BREAKPOINT_TEST();
|
---|
4070 | LogFlowFunc(("Interface 0x%08x, Version 0x%08x, PipelineLevel %d",
|
---|
4071 | pCreateData->Interface, pCreateData->Version, D3D11DDI_EXTRACT_3DPIPELINELEVEL_FROM_FLAGS(pCreateData->Flags)));
|
---|
4072 |
|
---|
4073 | PVBOXDXADAPTER pAdapter = (PVBOXDXADAPTER)hAdapter.pDrvPrivate;
|
---|
4074 | PVBOXDX_DEVICE pDevice = (PVBOXDX_DEVICE)pCreateData->hDrvDevice.pDrvPrivate;
|
---|
4075 | RT_ZERO(*pDevice);
|
---|
4076 |
|
---|
4077 | /* Verify that the requested device level is supported. */
|
---|
4078 | AssertReturn(isInterfaceSupported(pCreateData->Interface), E_FAIL);
|
---|
4079 |
|
---|
4080 | /* Remember which adapter has created this device. */
|
---|
4081 | pDevice->pAdapter = pAdapter;
|
---|
4082 |
|
---|
4083 | /* Fetch the supplied Direct3D runtime data. */
|
---|
4084 | pDevice->hRTDevice = pCreateData->hRTDevice;
|
---|
4085 | pDevice->uDDIVersion = pCreateData->Interface;
|
---|
4086 | pDevice->uCreateDeviceFlags = pCreateData->Flags;
|
---|
4087 | pDevice->pRTCallbacks = pCreateData->pKTCallbacks;
|
---|
4088 | pDevice->pDXGIBaseCallbacks = pCreateData->DXGIBaseDDI.pDXGIBaseCallbacks;
|
---|
4089 | pDevice->hRTCoreLayer = pCreateData->hRTCoreLayer;
|
---|
4090 | pDevice->pUMCallbacks = pCreateData->p11UMCallbacks;
|
---|
4091 |
|
---|
4092 | /* Create the kernel mode context for this device. */
|
---|
4093 | HRESULT hr = vboxDXDeviceInit(pDevice);
|
---|
4094 | AssertReturn(SUCCEEDED(hr), hr);
|
---|
4095 |
|
---|
4096 | /* Success. Fill the return data for the Direct3D runtime. */
|
---|
4097 |
|
---|
4098 | if (pCreateData->Interface == D3D11_1_DDI_INTERFACE_VERSION)
|
---|
4099 | {
|
---|
4100 | /*
|
---|
4101 | * 11.1
|
---|
4102 | */
|
---|
4103 | D3D11_1DDI_DEVICEFUNCS *p11_1DeviceFuncs = pCreateData->p11_1DeviceFuncs;
|
---|
4104 |
|
---|
4105 | /* Order of functions is in decreasing order of priority ( as far as performance is concerned ). */
|
---|
4106 | /* High frequency functions. */
|
---|
4107 | p11_1DeviceFuncs->pfnDefaultConstantBufferUpdateSubresourceUP = ddi11_1DefaultConstantBufferUpdateSubresourceUP;
|
---|
4108 | p11_1DeviceFuncs->pfnVsSetConstantBuffers = ddi11_1VsSetConstantBuffers;
|
---|
4109 | p11_1DeviceFuncs->pfnPsSetShaderResources = ddi10PsSetShaderResources;
|
---|
4110 | p11_1DeviceFuncs->pfnPsSetShader = ddi10PsSetShader;
|
---|
4111 | p11_1DeviceFuncs->pfnPsSetSamplers = ddi10PsSetSamplers;
|
---|
4112 | p11_1DeviceFuncs->pfnVsSetShader = ddi10VsSetShader;
|
---|
4113 | p11_1DeviceFuncs->pfnDrawIndexed = ddi10DrawIndexed;
|
---|
4114 | p11_1DeviceFuncs->pfnDraw = ddi10Draw;
|
---|
4115 | p11_1DeviceFuncs->pfnDynamicIABufferMapNoOverwrite = ddi10DynamicIABufferMapNoOverwrite;
|
---|
4116 | p11_1DeviceFuncs->pfnDynamicIABufferUnmap = ddi10DynamicIABufferUnmap;
|
---|
4117 | p11_1DeviceFuncs->pfnDynamicConstantBufferMapDiscard = ddi10DynamicConstantBufferMapDiscard;
|
---|
4118 | p11_1DeviceFuncs->pfnDynamicIABufferMapDiscard = ddi10DynamicIABufferMapDiscard;
|
---|
4119 | p11_1DeviceFuncs->pfnDynamicConstantBufferUnmap = ddi10DynamicConstantBufferUnmap;
|
---|
4120 | p11_1DeviceFuncs->pfnPsSetConstantBuffers = ddi11_1PsSetConstantBuffers;
|
---|
4121 | p11_1DeviceFuncs->pfnIaSetInputLayout = ddi10IaSetInputLayout;
|
---|
4122 | p11_1DeviceFuncs->pfnIaSetVertexBuffers = ddi10IaSetVertexBuffers;
|
---|
4123 | p11_1DeviceFuncs->pfnIaSetIndexBuffer = ddi10IaSetIndexBuffer;
|
---|
4124 |
|
---|
4125 | /* Middle frequency functions. */
|
---|
4126 | p11_1DeviceFuncs->pfnDrawIndexedInstanced = ddi10DrawIndexedInstanced;
|
---|
4127 | p11_1DeviceFuncs->pfnDrawInstanced = ddi10DrawInstanced;
|
---|
4128 | p11_1DeviceFuncs->pfnDynamicResourceMapDiscard = ddi10DynamicResourceMapDiscard;
|
---|
4129 | p11_1DeviceFuncs->pfnDynamicResourceUnmap = ddi10DynamicResourceUnmap;
|
---|
4130 | p11_1DeviceFuncs->pfnGsSetConstantBuffers = ddi11_1GsSetConstantBuffers;
|
---|
4131 | p11_1DeviceFuncs->pfnGsSetShader = ddi10GsSetShader;
|
---|
4132 | p11_1DeviceFuncs->pfnIaSetTopology = ddi10IaSetTopology;
|
---|
4133 | p11_1DeviceFuncs->pfnStagingResourceMap = ddi10StagingResourceMap;
|
---|
4134 | p11_1DeviceFuncs->pfnStagingResourceUnmap = ddi10StagingResourceUnmap;
|
---|
4135 | p11_1DeviceFuncs->pfnVsSetShaderResources = ddi10VsSetShaderResources;
|
---|
4136 | p11_1DeviceFuncs->pfnVsSetSamplers = ddi10VsSetSamplers;
|
---|
4137 | p11_1DeviceFuncs->pfnGsSetShaderResources = ddi10GsSetShaderResources;
|
---|
4138 | p11_1DeviceFuncs->pfnGsSetSamplers = ddi10GsSetSamplers;
|
---|
4139 | p11_1DeviceFuncs->pfnSetRenderTargets = ddi11SetRenderTargets;
|
---|
4140 | p11_1DeviceFuncs->pfnShaderResourceViewReadAfterWriteHazard = ddi10ShaderResourceViewReadAfterWriteHazard;
|
---|
4141 | p11_1DeviceFuncs->pfnResourceReadAfterWriteHazard = ddi10ResourceReadAfterWriteHazard;
|
---|
4142 | p11_1DeviceFuncs->pfnSetBlendState = ddi10SetBlendState;
|
---|
4143 | p11_1DeviceFuncs->pfnSetDepthStencilState = ddi10SetDepthStencilState;
|
---|
4144 | p11_1DeviceFuncs->pfnSetRasterizerState = ddi10SetRasterizerState;
|
---|
4145 | p11_1DeviceFuncs->pfnQueryEnd = ddi10QueryEnd;
|
---|
4146 | p11_1DeviceFuncs->pfnQueryBegin = ddi10QueryBegin;
|
---|
4147 | p11_1DeviceFuncs->pfnResourceCopyRegion = ddi11_1ResourceCopyRegion;
|
---|
4148 | p11_1DeviceFuncs->pfnResourceUpdateSubresourceUP = ddi11_1ResourceUpdateSubresourceUP;
|
---|
4149 | p11_1DeviceFuncs->pfnSoSetTargets = ddi10SoSetTargets;
|
---|
4150 | p11_1DeviceFuncs->pfnDrawAuto = ddi10DrawAuto;
|
---|
4151 | p11_1DeviceFuncs->pfnSetViewports = ddi10SetViewports;
|
---|
4152 | p11_1DeviceFuncs->pfnSetScissorRects = ddi10SetScissorRects;
|
---|
4153 | p11_1DeviceFuncs->pfnClearRenderTargetView = ddi10ClearRenderTargetView;
|
---|
4154 | p11_1DeviceFuncs->pfnClearDepthStencilView = ddi10ClearDepthStencilView;
|
---|
4155 | p11_1DeviceFuncs->pfnSetPredication = ddi10SetPredication;
|
---|
4156 | p11_1DeviceFuncs->pfnQueryGetData = ddi10QueryGetData;
|
---|
4157 | p11_1DeviceFuncs->pfnFlush = ddi11_1Flush;
|
---|
4158 | p11_1DeviceFuncs->pfnGenMips = ddi10GenMips;
|
---|
4159 | p11_1DeviceFuncs->pfnResourceCopy = ddi10ResourceCopy;
|
---|
4160 | p11_1DeviceFuncs->pfnResourceResolveSubresource = ddi10ResourceResolveSubresource;
|
---|
4161 |
|
---|
4162 | /* Infrequent paths. */
|
---|
4163 | p11_1DeviceFuncs->pfnResourceMap = ddi10ResourceMap;
|
---|
4164 | p11_1DeviceFuncs->pfnResourceUnmap = ddi10ResourceUnmap;
|
---|
4165 | p11_1DeviceFuncs->pfnResourceIsStagingBusy = vboxDXResourceIsStagingBusy;
|
---|
4166 | p11_1DeviceFuncs->pfnRelocateDeviceFuncs = ddi11_1RelocateDeviceFuncs;
|
---|
4167 | p11_1DeviceFuncs->pfnCalcPrivateResourceSize = ddi11CalcPrivateResourceSize;
|
---|
4168 | p11_1DeviceFuncs->pfnCalcPrivateOpenedResourceSize = ddi10CalcPrivateOpenedResourceSize;
|
---|
4169 | p11_1DeviceFuncs->pfnCreateResource = ddi11CreateResource;
|
---|
4170 | p11_1DeviceFuncs->pfnOpenResource = ddi10OpenResource;
|
---|
4171 | p11_1DeviceFuncs->pfnDestroyResource = ddi10DestroyResource;
|
---|
4172 | p11_1DeviceFuncs->pfnCalcPrivateShaderResourceViewSize = ddi11CalcPrivateShaderResourceViewSize;
|
---|
4173 | p11_1DeviceFuncs->pfnCreateShaderResourceView = ddi11CreateShaderResourceView;
|
---|
4174 | p11_1DeviceFuncs->pfnDestroyShaderResourceView = ddi10DestroyShaderResourceView;
|
---|
4175 | p11_1DeviceFuncs->pfnCalcPrivateRenderTargetViewSize = ddi10CalcPrivateRenderTargetViewSize;
|
---|
4176 | p11_1DeviceFuncs->pfnCreateRenderTargetView = ddi10CreateRenderTargetView;
|
---|
4177 | p11_1DeviceFuncs->pfnDestroyRenderTargetView = ddi10DestroyRenderTargetView;
|
---|
4178 | p11_1DeviceFuncs->pfnCalcPrivateDepthStencilViewSize = ddi11CalcPrivateDepthStencilViewSize;
|
---|
4179 | p11_1DeviceFuncs->pfnCreateDepthStencilView = ddi11CreateDepthStencilView;
|
---|
4180 | p11_1DeviceFuncs->pfnDestroyDepthStencilView = ddi10DestroyDepthStencilView;
|
---|
4181 | p11_1DeviceFuncs->pfnCalcPrivateElementLayoutSize = ddi10CalcPrivateElementLayoutSize;
|
---|
4182 | p11_1DeviceFuncs->pfnCreateElementLayout = ddi10CreateElementLayout;
|
---|
4183 | p11_1DeviceFuncs->pfnDestroyElementLayout = ddi10DestroyElementLayout;
|
---|
4184 | p11_1DeviceFuncs->pfnCalcPrivateBlendStateSize = ddi11_1CalcPrivateBlendStateSize;
|
---|
4185 | p11_1DeviceFuncs->pfnCreateBlendState = ddi11_1CreateBlendState;
|
---|
4186 | p11_1DeviceFuncs->pfnDestroyBlendState = ddi10DestroyBlendState;
|
---|
4187 | p11_1DeviceFuncs->pfnCalcPrivateDepthStencilStateSize = ddi10CalcPrivateDepthStencilStateSize;
|
---|
4188 | p11_1DeviceFuncs->pfnCreateDepthStencilState = ddi10CreateDepthStencilState;
|
---|
4189 | p11_1DeviceFuncs->pfnDestroyDepthStencilState = ddi10DestroyDepthStencilState;
|
---|
4190 | p11_1DeviceFuncs->pfnCalcPrivateRasterizerStateSize = ddi11_1CalcPrivateRasterizerStateSize;
|
---|
4191 | p11_1DeviceFuncs->pfnCreateRasterizerState = ddi11_1CreateRasterizerState;
|
---|
4192 | p11_1DeviceFuncs->pfnDestroyRasterizerState = ddi10DestroyRasterizerState;
|
---|
4193 | p11_1DeviceFuncs->pfnCalcPrivateShaderSize = ddi11_1CalcPrivateShaderSize;
|
---|
4194 | p11_1DeviceFuncs->pfnCreateVertexShader = ddi11_1CreateVertexShader;
|
---|
4195 | p11_1DeviceFuncs->pfnCreateGeometryShader = ddi11_1CreateGeometryShader;
|
---|
4196 | p11_1DeviceFuncs->pfnCreatePixelShader = ddi11_1CreatePixelShader;
|
---|
4197 | p11_1DeviceFuncs->pfnCalcPrivateGeometryShaderWithStreamOutput = ddi11_1CalcPrivateGeometryShaderWithStreamOutput;
|
---|
4198 | p11_1DeviceFuncs->pfnCreateGeometryShaderWithStreamOutput = ddi11_1CreateGeometryShaderWithStreamOutput;
|
---|
4199 | p11_1DeviceFuncs->pfnDestroyShader = ddi10DestroyShader;
|
---|
4200 | p11_1DeviceFuncs->pfnCalcPrivateSamplerSize = ddi10CalcPrivateSamplerSize;
|
---|
4201 | p11_1DeviceFuncs->pfnCreateSampler = ddi10CreateSampler;
|
---|
4202 | p11_1DeviceFuncs->pfnDestroySampler = ddi10DestroySampler;
|
---|
4203 | p11_1DeviceFuncs->pfnCalcPrivateQuerySize = ddi10CalcPrivateQuerySize;
|
---|
4204 | p11_1DeviceFuncs->pfnCreateQuery = ddi10CreateQuery;
|
---|
4205 | p11_1DeviceFuncs->pfnDestroyQuery = ddi10DestroyQuery;
|
---|
4206 |
|
---|
4207 | p11_1DeviceFuncs->pfnCheckFormatSupport = vboxDXCheckFormatSupport;
|
---|
4208 | p11_1DeviceFuncs->pfnCheckMultisampleQualityLevels = vboxDXCheckMultisampleQualityLevels;
|
---|
4209 | p11_1DeviceFuncs->pfnCheckCounterInfo = ddi10CheckCounterInfo;
|
---|
4210 | p11_1DeviceFuncs->pfnCheckCounter = ddi10CheckCounter;
|
---|
4211 |
|
---|
4212 | p11_1DeviceFuncs->pfnDestroyDevice = ddi10DestroyDevice;
|
---|
4213 | p11_1DeviceFuncs->pfnSetTextFilterSize = ddi10SetTextFilterSize;
|
---|
4214 |
|
---|
4215 | /* Additional 10.1 entries */
|
---|
4216 | p11_1DeviceFuncs->pfnResourceConvert = vboxDXResourceConvert;
|
---|
4217 | p11_1DeviceFuncs->pfnResourceConvertRegion = vboxDXResourceConvertRegion;
|
---|
4218 |
|
---|
4219 | /* Additional 11.0 entries */
|
---|
4220 | p11_1DeviceFuncs->pfnDrawIndexedInstancedIndirect = ddi11DrawIndexedInstancedIndirect;
|
---|
4221 | p11_1DeviceFuncs->pfnDrawInstancedIndirect = ddi11DrawInstancedIndirect;
|
---|
4222 | p11_1DeviceFuncs->pfnCommandListExecute = 0;
|
---|
4223 | p11_1DeviceFuncs->pfnHsSetShaderResources = ddi10HsSetShaderResources;
|
---|
4224 | p11_1DeviceFuncs->pfnHsSetShader = ddi10HsSetShader;
|
---|
4225 | p11_1DeviceFuncs->pfnHsSetSamplers = ddi10HsSetSamplers;
|
---|
4226 | p11_1DeviceFuncs->pfnHsSetConstantBuffers = ddi11_1HsSetConstantBuffers;
|
---|
4227 | p11_1DeviceFuncs->pfnDsSetShaderResources = ddi10DsSetShaderResources;
|
---|
4228 | p11_1DeviceFuncs->pfnDsSetShader = ddi10DsSetShader;
|
---|
4229 | p11_1DeviceFuncs->pfnDsSetSamplers = ddi10DsSetSamplers;
|
---|
4230 | p11_1DeviceFuncs->pfnDsSetConstantBuffers = ddi11_1DsSetConstantBuffers;
|
---|
4231 | p11_1DeviceFuncs->pfnCreateHullShader = ddi11_1CreateHullShader;
|
---|
4232 | p11_1DeviceFuncs->pfnCreateDomainShader = ddi11_1CreateDomainShader;
|
---|
4233 | p11_1DeviceFuncs->pfnCheckDeferredContextHandleSizes = 0;
|
---|
4234 | p11_1DeviceFuncs->pfnCalcDeferredContextHandleSize = 0;
|
---|
4235 | p11_1DeviceFuncs->pfnCalcPrivateDeferredContextSize = 0;
|
---|
4236 | p11_1DeviceFuncs->pfnCreateDeferredContext = 0;
|
---|
4237 | p11_1DeviceFuncs->pfnAbandonCommandList = 0;
|
---|
4238 | p11_1DeviceFuncs->pfnCalcPrivateCommandListSize = 0;
|
---|
4239 | p11_1DeviceFuncs->pfnCreateCommandList = 0;
|
---|
4240 | p11_1DeviceFuncs->pfnDestroyCommandList = 0;
|
---|
4241 | p11_1DeviceFuncs->pfnCalcPrivateTessellationShaderSize = ddi11_1CalcPrivateTessellationShaderSize;
|
---|
4242 | p11_1DeviceFuncs->pfnPsSetShaderWithIfaces = vboxDXPsSetShaderWithIfaces;
|
---|
4243 | p11_1DeviceFuncs->pfnVsSetShaderWithIfaces = vboxDXVsSetShaderWithIfaces;
|
---|
4244 | p11_1DeviceFuncs->pfnGsSetShaderWithIfaces = vboxDXGsSetShaderWithIfaces;
|
---|
4245 | p11_1DeviceFuncs->pfnHsSetShaderWithIfaces = vboxDXHsSetShaderWithIfaces;
|
---|
4246 | p11_1DeviceFuncs->pfnDsSetShaderWithIfaces = vboxDXDsSetShaderWithIfaces;
|
---|
4247 | p11_1DeviceFuncs->pfnCsSetShaderWithIfaces = vboxDXCsSetShaderWithIfaces;
|
---|
4248 | p11_1DeviceFuncs->pfnCreateComputeShader = ddi11CreateComputeShader;
|
---|
4249 | p11_1DeviceFuncs->pfnCsSetShader = ddi10CsSetShader;
|
---|
4250 | p11_1DeviceFuncs->pfnCsSetShaderResources = ddi10CsSetShaderResources;
|
---|
4251 | p11_1DeviceFuncs->pfnCsSetSamplers = ddi10CsSetSamplers;
|
---|
4252 | p11_1DeviceFuncs->pfnCsSetConstantBuffers = ddi11_1CsSetConstantBuffers;
|
---|
4253 | p11_1DeviceFuncs->pfnCalcPrivateUnorderedAccessViewSize = ddi11CalcPrivateUnorderedAccessViewSize;
|
---|
4254 | p11_1DeviceFuncs->pfnCreateUnorderedAccessView = ddi11CreateUnorderedAccessView;
|
---|
4255 | p11_1DeviceFuncs->pfnDestroyUnorderedAccessView = ddi11DestroyUnorderedAccessView;
|
---|
4256 | p11_1DeviceFuncs->pfnClearUnorderedAccessViewUint = ddi11ClearUnorderedAccessViewUint;
|
---|
4257 | p11_1DeviceFuncs->pfnClearUnorderedAccessViewFloat = ddi11ClearUnorderedAccessViewFloat;
|
---|
4258 | p11_1DeviceFuncs->pfnCsSetUnorderedAccessViews = ddi11CsSetUnorderedAccessViews;
|
---|
4259 | p11_1DeviceFuncs->pfnDispatch = ddi11Dispatch;
|
---|
4260 | p11_1DeviceFuncs->pfnDispatchIndirect = ddi11DispatchIndirect;
|
---|
4261 | p11_1DeviceFuncs->pfnSetResourceMinLOD = vboxDXSetResourceMinLOD;
|
---|
4262 | p11_1DeviceFuncs->pfnCopyStructureCount = ddi11CopyStructureCount;
|
---|
4263 | p11_1DeviceFuncs->pfnRecycleCommandList = 0;
|
---|
4264 | p11_1DeviceFuncs->pfnRecycleCreateCommandList = 0;
|
---|
4265 | p11_1DeviceFuncs->pfnRecycleCreateDeferredContext = 0;
|
---|
4266 | p11_1DeviceFuncs->pfnRecycleDestroyCommandList = 0;
|
---|
4267 |
|
---|
4268 | /* Additional 11.1 entries */
|
---|
4269 | p11_1DeviceFuncs->pfnDiscard = ddi11_1Discard;
|
---|
4270 | p11_1DeviceFuncs->pfnAssignDebugBinary = ddi11_1AssignDebugBinary;
|
---|
4271 | p11_1DeviceFuncs->pfnDynamicConstantBufferMapNoOverwrite = ddi10DynamicConstantBufferMapNoOverwrite;
|
---|
4272 | p11_1DeviceFuncs->pfnCheckDirectFlipSupport = ddi11_1CheckDirectFlipSupport;
|
---|
4273 | p11_1DeviceFuncs->pfnClearView = ddi11_1ClearView;
|
---|
4274 | }
|
---|
4275 | else if (pCreateData->Interface == D3D11_0_DDI_INTERFACE_VERSION)
|
---|
4276 | {
|
---|
4277 | /*
|
---|
4278 | * 11.0
|
---|
4279 | */
|
---|
4280 | D3D11DDI_DEVICEFUNCS *p11DeviceFuncs = pCreateData->p11DeviceFuncs;
|
---|
4281 |
|
---|
4282 | /* Order of functions is in decreasing order of priority ( as far as performance is concerned ). */
|
---|
4283 | /* High frequency functions. */
|
---|
4284 | p11DeviceFuncs->pfnDefaultConstantBufferUpdateSubresourceUP = ddi10DefaultConstantBufferUpdateSubresourceUP;
|
---|
4285 | p11DeviceFuncs->pfnVsSetConstantBuffers = ddi10VsSetConstantBuffers;
|
---|
4286 | p11DeviceFuncs->pfnPsSetShaderResources = ddi10PsSetShaderResources;
|
---|
4287 | p11DeviceFuncs->pfnPsSetShader = ddi10PsSetShader;
|
---|
4288 | p11DeviceFuncs->pfnPsSetSamplers = ddi10PsSetSamplers;
|
---|
4289 | p11DeviceFuncs->pfnVsSetShader = ddi10VsSetShader;
|
---|
4290 | p11DeviceFuncs->pfnDrawIndexed = ddi10DrawIndexed;
|
---|
4291 | p11DeviceFuncs->pfnDraw = ddi10Draw;
|
---|
4292 | p11DeviceFuncs->pfnDynamicIABufferMapNoOverwrite = ddi10DynamicIABufferMapNoOverwrite;
|
---|
4293 | p11DeviceFuncs->pfnDynamicIABufferUnmap = ddi10DynamicIABufferUnmap;
|
---|
4294 | p11DeviceFuncs->pfnDynamicConstantBufferMapDiscard = ddi10DynamicConstantBufferMapDiscard;
|
---|
4295 | p11DeviceFuncs->pfnDynamicIABufferMapDiscard = ddi10DynamicIABufferMapDiscard;
|
---|
4296 | p11DeviceFuncs->pfnDynamicConstantBufferUnmap = ddi10DynamicConstantBufferUnmap;
|
---|
4297 | p11DeviceFuncs->pfnPsSetConstantBuffers = ddi10PsSetConstantBuffers;
|
---|
4298 | p11DeviceFuncs->pfnIaSetInputLayout = ddi10IaSetInputLayout;
|
---|
4299 | p11DeviceFuncs->pfnIaSetVertexBuffers = ddi10IaSetVertexBuffers;
|
---|
4300 | p11DeviceFuncs->pfnIaSetIndexBuffer = ddi10IaSetIndexBuffer;
|
---|
4301 |
|
---|
4302 | /* Middle frequency functions. */
|
---|
4303 | p11DeviceFuncs->pfnDrawIndexedInstanced = ddi10DrawIndexedInstanced;
|
---|
4304 | p11DeviceFuncs->pfnDrawInstanced = ddi10DrawInstanced;
|
---|
4305 | p11DeviceFuncs->pfnDynamicResourceMapDiscard = ddi10DynamicResourceMapDiscard;
|
---|
4306 | p11DeviceFuncs->pfnDynamicResourceUnmap = ddi10DynamicResourceUnmap;
|
---|
4307 | p11DeviceFuncs->pfnGsSetConstantBuffers = ddi10GsSetConstantBuffers;
|
---|
4308 | p11DeviceFuncs->pfnGsSetShader = ddi10GsSetShader;
|
---|
4309 | p11DeviceFuncs->pfnIaSetTopology = ddi10IaSetTopology;
|
---|
4310 | p11DeviceFuncs->pfnStagingResourceMap = ddi10StagingResourceMap;
|
---|
4311 | p11DeviceFuncs->pfnStagingResourceUnmap = ddi10StagingResourceUnmap;
|
---|
4312 | p11DeviceFuncs->pfnVsSetShaderResources = ddi10VsSetShaderResources;
|
---|
4313 | p11DeviceFuncs->pfnVsSetSamplers = ddi10VsSetSamplers;
|
---|
4314 | p11DeviceFuncs->pfnGsSetShaderResources = ddi10GsSetShaderResources;
|
---|
4315 | p11DeviceFuncs->pfnGsSetSamplers = ddi10GsSetSamplers;
|
---|
4316 | p11DeviceFuncs->pfnSetRenderTargets = ddi11SetRenderTargets;
|
---|
4317 | p11DeviceFuncs->pfnShaderResourceViewReadAfterWriteHazard = ddi10ShaderResourceViewReadAfterWriteHazard;
|
---|
4318 | p11DeviceFuncs->pfnResourceReadAfterWriteHazard = ddi10ResourceReadAfterWriteHazard;
|
---|
4319 | p11DeviceFuncs->pfnSetBlendState = ddi10SetBlendState;
|
---|
4320 | p11DeviceFuncs->pfnSetDepthStencilState = ddi10SetDepthStencilState;
|
---|
4321 | p11DeviceFuncs->pfnSetRasterizerState = ddi10SetRasterizerState;
|
---|
4322 | p11DeviceFuncs->pfnQueryEnd = ddi10QueryEnd;
|
---|
4323 | p11DeviceFuncs->pfnQueryBegin = ddi10QueryBegin;
|
---|
4324 | p11DeviceFuncs->pfnResourceCopyRegion = ddi10ResourceCopyRegion;
|
---|
4325 | p11DeviceFuncs->pfnResourceUpdateSubresourceUP = ddi10ResourceUpdateSubresourceUP;
|
---|
4326 | p11DeviceFuncs->pfnSoSetTargets = ddi10SoSetTargets;
|
---|
4327 | p11DeviceFuncs->pfnDrawAuto = ddi10DrawAuto;
|
---|
4328 | p11DeviceFuncs->pfnSetViewports = ddi10SetViewports;
|
---|
4329 | p11DeviceFuncs->pfnSetScissorRects = ddi10SetScissorRects;
|
---|
4330 | p11DeviceFuncs->pfnClearRenderTargetView = ddi10ClearRenderTargetView;
|
---|
4331 | p11DeviceFuncs->pfnClearDepthStencilView = ddi10ClearDepthStencilView;
|
---|
4332 | p11DeviceFuncs->pfnSetPredication = ddi10SetPredication;
|
---|
4333 | p11DeviceFuncs->pfnQueryGetData = ddi10QueryGetData;
|
---|
4334 | p11DeviceFuncs->pfnFlush = ddi10Flush;
|
---|
4335 | p11DeviceFuncs->pfnGenMips = ddi10GenMips;
|
---|
4336 | p11DeviceFuncs->pfnResourceCopy = ddi10ResourceCopy;
|
---|
4337 | p11DeviceFuncs->pfnResourceResolveSubresource = ddi10ResourceResolveSubresource;
|
---|
4338 |
|
---|
4339 | /* Infrequent paths. */
|
---|
4340 | p11DeviceFuncs->pfnResourceMap = ddi10ResourceMap;
|
---|
4341 | p11DeviceFuncs->pfnResourceUnmap = ddi10ResourceUnmap;
|
---|
4342 | p11DeviceFuncs->pfnResourceIsStagingBusy = vboxDXResourceIsStagingBusy;
|
---|
4343 | p11DeviceFuncs->pfnRelocateDeviceFuncs = ddi11RelocateDeviceFuncs;
|
---|
4344 | p11DeviceFuncs->pfnCalcPrivateResourceSize = ddi11CalcPrivateResourceSize;
|
---|
4345 | p11DeviceFuncs->pfnCalcPrivateOpenedResourceSize = ddi10CalcPrivateOpenedResourceSize;
|
---|
4346 | p11DeviceFuncs->pfnCreateResource = ddi11CreateResource;
|
---|
4347 | p11DeviceFuncs->pfnOpenResource = ddi10OpenResource;
|
---|
4348 | p11DeviceFuncs->pfnDestroyResource = ddi10DestroyResource;
|
---|
4349 | p11DeviceFuncs->pfnCalcPrivateShaderResourceViewSize = ddi11CalcPrivateShaderResourceViewSize;
|
---|
4350 | p11DeviceFuncs->pfnCreateShaderResourceView = ddi11CreateShaderResourceView;
|
---|
4351 | p11DeviceFuncs->pfnDestroyShaderResourceView = ddi10DestroyShaderResourceView;
|
---|
4352 | p11DeviceFuncs->pfnCalcPrivateRenderTargetViewSize = ddi10CalcPrivateRenderTargetViewSize;
|
---|
4353 | p11DeviceFuncs->pfnCreateRenderTargetView = ddi10CreateRenderTargetView;
|
---|
4354 | p11DeviceFuncs->pfnDestroyRenderTargetView = ddi10DestroyRenderTargetView;
|
---|
4355 | p11DeviceFuncs->pfnCalcPrivateDepthStencilViewSize = ddi11CalcPrivateDepthStencilViewSize;
|
---|
4356 | p11DeviceFuncs->pfnCreateDepthStencilView = ddi11CreateDepthStencilView;
|
---|
4357 | p11DeviceFuncs->pfnDestroyDepthStencilView = ddi10DestroyDepthStencilView;
|
---|
4358 | p11DeviceFuncs->pfnCalcPrivateElementLayoutSize = ddi10CalcPrivateElementLayoutSize;
|
---|
4359 | p11DeviceFuncs->pfnCreateElementLayout = ddi10CreateElementLayout;
|
---|
4360 | p11DeviceFuncs->pfnDestroyElementLayout = ddi10DestroyElementLayout;
|
---|
4361 | p11DeviceFuncs->pfnCalcPrivateBlendStateSize = ddi10_1CalcPrivateBlendStateSize;
|
---|
4362 | p11DeviceFuncs->pfnCreateBlendState = ddi10_1CreateBlendState;
|
---|
4363 | p11DeviceFuncs->pfnDestroyBlendState = ddi10DestroyBlendState;
|
---|
4364 | p11DeviceFuncs->pfnCalcPrivateDepthStencilStateSize = ddi10CalcPrivateDepthStencilStateSize;
|
---|
4365 | p11DeviceFuncs->pfnCreateDepthStencilState = ddi10CreateDepthStencilState;
|
---|
4366 | p11DeviceFuncs->pfnDestroyDepthStencilState = ddi10DestroyDepthStencilState;
|
---|
4367 | p11DeviceFuncs->pfnCalcPrivateRasterizerStateSize = ddi10CalcPrivateRasterizerStateSize;
|
---|
4368 | p11DeviceFuncs->pfnCreateRasterizerState = ddi10CreateRasterizerState;
|
---|
4369 | p11DeviceFuncs->pfnDestroyRasterizerState = ddi10DestroyRasterizerState;
|
---|
4370 | p11DeviceFuncs->pfnCalcPrivateShaderSize = ddi10CalcPrivateShaderSize;
|
---|
4371 | p11DeviceFuncs->pfnCreateVertexShader = ddi10CreateVertexShader;
|
---|
4372 | p11DeviceFuncs->pfnCreateGeometryShader = ddi10CreateGeometryShader;
|
---|
4373 | p11DeviceFuncs->pfnCreatePixelShader = ddi10CreatePixelShader;
|
---|
4374 | p11DeviceFuncs->pfnCalcPrivateGeometryShaderWithStreamOutput = ddi11CalcPrivateGeometryShaderWithStreamOutput;
|
---|
4375 | p11DeviceFuncs->pfnCreateGeometryShaderWithStreamOutput = ddi11CreateGeometryShaderWithStreamOutput;
|
---|
4376 | p11DeviceFuncs->pfnDestroyShader = ddi10DestroyShader;
|
---|
4377 | p11DeviceFuncs->pfnCalcPrivateSamplerSize = ddi10CalcPrivateSamplerSize;
|
---|
4378 | p11DeviceFuncs->pfnCreateSampler = ddi10CreateSampler;
|
---|
4379 | p11DeviceFuncs->pfnDestroySampler = ddi10DestroySampler;
|
---|
4380 | p11DeviceFuncs->pfnCalcPrivateQuerySize = ddi10CalcPrivateQuerySize;
|
---|
4381 | p11DeviceFuncs->pfnCreateQuery = ddi10CreateQuery;
|
---|
4382 | p11DeviceFuncs->pfnDestroyQuery = ddi10DestroyQuery;
|
---|
4383 |
|
---|
4384 | p11DeviceFuncs->pfnCheckFormatSupport = vboxDXCheckFormatSupport;
|
---|
4385 | p11DeviceFuncs->pfnCheckMultisampleQualityLevels = vboxDXCheckMultisampleQualityLevels;
|
---|
4386 | p11DeviceFuncs->pfnCheckCounterInfo = ddi10CheckCounterInfo;
|
---|
4387 | p11DeviceFuncs->pfnCheckCounter = ddi10CheckCounter;
|
---|
4388 |
|
---|
4389 | p11DeviceFuncs->pfnDestroyDevice = ddi10DestroyDevice;
|
---|
4390 | p11DeviceFuncs->pfnSetTextFilterSize = ddi10SetTextFilterSize;
|
---|
4391 |
|
---|
4392 | /* Additional 10.1 entries */
|
---|
4393 | p11DeviceFuncs->pfnResourceConvert = vboxDXResourceConvert;
|
---|
4394 | p11DeviceFuncs->pfnResourceConvertRegion = ddi10ResourceConvertRegion;
|
---|
4395 |
|
---|
4396 | /* Additional 11.0 entries */
|
---|
4397 | p11DeviceFuncs->pfnDrawIndexedInstancedIndirect = ddi11DrawIndexedInstancedIndirect;
|
---|
4398 | p11DeviceFuncs->pfnDrawInstancedIndirect = ddi11DrawInstancedIndirect;
|
---|
4399 | p11DeviceFuncs->pfnCommandListExecute = 0;
|
---|
4400 | p11DeviceFuncs->pfnHsSetShaderResources = ddi10HsSetShaderResources;
|
---|
4401 | p11DeviceFuncs->pfnHsSetShader = ddi10HsSetShader;
|
---|
4402 | p11DeviceFuncs->pfnHsSetSamplers = ddi10HsSetSamplers;
|
---|
4403 | p11DeviceFuncs->pfnHsSetConstantBuffers = ddi10HsSetConstantBuffers;
|
---|
4404 | p11DeviceFuncs->pfnDsSetShaderResources = ddi10DsSetShaderResources;
|
---|
4405 | p11DeviceFuncs->pfnDsSetShader = ddi10DsSetShader;
|
---|
4406 | p11DeviceFuncs->pfnDsSetSamplers = ddi10DsSetSamplers;
|
---|
4407 | p11DeviceFuncs->pfnDsSetConstantBuffers = ddi10DsSetConstantBuffers;
|
---|
4408 | p11DeviceFuncs->pfnCreateHullShader = ddi11CreateHullShader;
|
---|
4409 | p11DeviceFuncs->pfnCreateDomainShader = ddi11CreateDomainShader;
|
---|
4410 | p11DeviceFuncs->pfnCheckDeferredContextHandleSizes = 0;
|
---|
4411 | p11DeviceFuncs->pfnCalcDeferredContextHandleSize = 0;
|
---|
4412 | p11DeviceFuncs->pfnCalcPrivateDeferredContextSize = 0;
|
---|
4413 | p11DeviceFuncs->pfnCreateDeferredContext = 0;
|
---|
4414 | p11DeviceFuncs->pfnAbandonCommandList = 0;
|
---|
4415 | p11DeviceFuncs->pfnCalcPrivateCommandListSize = 0;
|
---|
4416 | p11DeviceFuncs->pfnCreateCommandList = 0;
|
---|
4417 | p11DeviceFuncs->pfnDestroyCommandList = 0;
|
---|
4418 | p11DeviceFuncs->pfnCalcPrivateTessellationShaderSize = ddi11CalcPrivateTessellationShaderSize;
|
---|
4419 | p11DeviceFuncs->pfnPsSetShaderWithIfaces = vboxDXPsSetShaderWithIfaces;
|
---|
4420 | p11DeviceFuncs->pfnVsSetShaderWithIfaces = vboxDXVsSetShaderWithIfaces;
|
---|
4421 | p11DeviceFuncs->pfnGsSetShaderWithIfaces = vboxDXGsSetShaderWithIfaces;
|
---|
4422 | p11DeviceFuncs->pfnHsSetShaderWithIfaces = vboxDXHsSetShaderWithIfaces;
|
---|
4423 | p11DeviceFuncs->pfnDsSetShaderWithIfaces = vboxDXDsSetShaderWithIfaces;
|
---|
4424 | p11DeviceFuncs->pfnCsSetShaderWithIfaces = vboxDXCsSetShaderWithIfaces;
|
---|
4425 | p11DeviceFuncs->pfnCreateComputeShader = ddi11CreateComputeShader;
|
---|
4426 | p11DeviceFuncs->pfnCsSetShader = ddi10CsSetShader;
|
---|
4427 | p11DeviceFuncs->pfnCsSetShaderResources = ddi10CsSetShaderResources;
|
---|
4428 | p11DeviceFuncs->pfnCsSetSamplers = ddi10CsSetSamplers;
|
---|
4429 | p11DeviceFuncs->pfnCsSetConstantBuffers = ddi10CsSetConstantBuffers;
|
---|
4430 | p11DeviceFuncs->pfnCalcPrivateUnorderedAccessViewSize = ddi11CalcPrivateUnorderedAccessViewSize;
|
---|
4431 | p11DeviceFuncs->pfnCreateUnorderedAccessView = ddi11CreateUnorderedAccessView;
|
---|
4432 | p11DeviceFuncs->pfnDestroyUnorderedAccessView = ddi11DestroyUnorderedAccessView;
|
---|
4433 | p11DeviceFuncs->pfnClearUnorderedAccessViewUint = ddi11ClearUnorderedAccessViewUint;
|
---|
4434 | p11DeviceFuncs->pfnClearUnorderedAccessViewFloat = ddi11ClearUnorderedAccessViewFloat;
|
---|
4435 | p11DeviceFuncs->pfnCsSetUnorderedAccessViews = ddi11CsSetUnorderedAccessViews;
|
---|
4436 | p11DeviceFuncs->pfnDispatch = ddi11Dispatch;
|
---|
4437 | p11DeviceFuncs->pfnDispatchIndirect = ddi11DispatchIndirect;
|
---|
4438 | p11DeviceFuncs->pfnSetResourceMinLOD = vboxDXSetResourceMinLOD;
|
---|
4439 | p11DeviceFuncs->pfnCopyStructureCount = ddi11CopyStructureCount;
|
---|
4440 | p11DeviceFuncs->pfnRecycleCommandList = 0;
|
---|
4441 | p11DeviceFuncs->pfnRecycleCreateCommandList = 0;
|
---|
4442 | p11DeviceFuncs->pfnRecycleCreateDeferredContext = 0;
|
---|
4443 | p11DeviceFuncs->pfnRecycleDestroyCommandList = 0;
|
---|
4444 | }
|
---|
4445 | else if (pCreateData->Interface == D3D10_1_DDI_INTERFACE_VERSION)
|
---|
4446 | {
|
---|
4447 | /*
|
---|
4448 | * 10.1
|
---|
4449 | */
|
---|
4450 | D3D10_1DDI_DEVICEFUNCS *p10_1DeviceFuncs = pCreateData->p10_1DeviceFuncs;
|
---|
4451 |
|
---|
4452 | /* Order of functions is in decreasing order of priority ( as far as performance is concerned ). */
|
---|
4453 | /* High frequency functions. */
|
---|
4454 | p10_1DeviceFuncs->pfnDefaultConstantBufferUpdateSubresourceUP = ddi10DefaultConstantBufferUpdateSubresourceUP;
|
---|
4455 | p10_1DeviceFuncs->pfnVsSetConstantBuffers = ddi10VsSetConstantBuffers;
|
---|
4456 | p10_1DeviceFuncs->pfnPsSetShaderResources = ddi10PsSetShaderResources;
|
---|
4457 | p10_1DeviceFuncs->pfnPsSetShader = ddi10PsSetShader;
|
---|
4458 | p10_1DeviceFuncs->pfnPsSetSamplers = ddi10PsSetSamplers;
|
---|
4459 | p10_1DeviceFuncs->pfnVsSetShader = ddi10VsSetShader;
|
---|
4460 | p10_1DeviceFuncs->pfnDrawIndexed = ddi10DrawIndexed;
|
---|
4461 | p10_1DeviceFuncs->pfnDraw = ddi10Draw;
|
---|
4462 | p10_1DeviceFuncs->pfnDynamicIABufferMapNoOverwrite = ddi10DynamicIABufferMapNoOverwrite;
|
---|
4463 | p10_1DeviceFuncs->pfnDynamicIABufferUnmap = ddi10DynamicIABufferUnmap;
|
---|
4464 | p10_1DeviceFuncs->pfnDynamicConstantBufferMapDiscard = ddi10DynamicConstantBufferMapDiscard;
|
---|
4465 | p10_1DeviceFuncs->pfnDynamicIABufferMapDiscard = ddi10DynamicIABufferMapDiscard;
|
---|
4466 | p10_1DeviceFuncs->pfnDynamicConstantBufferUnmap = ddi10DynamicConstantBufferUnmap;
|
---|
4467 | p10_1DeviceFuncs->pfnPsSetConstantBuffers = ddi10PsSetConstantBuffers;
|
---|
4468 | p10_1DeviceFuncs->pfnIaSetInputLayout = ddi10IaSetInputLayout;
|
---|
4469 | p10_1DeviceFuncs->pfnIaSetVertexBuffers = ddi10IaSetVertexBuffers;
|
---|
4470 | p10_1DeviceFuncs->pfnIaSetIndexBuffer = ddi10IaSetIndexBuffer;
|
---|
4471 |
|
---|
4472 | /* Middle frequency functions. */
|
---|
4473 | p10_1DeviceFuncs->pfnDrawIndexedInstanced = ddi10DrawIndexedInstanced;
|
---|
4474 | p10_1DeviceFuncs->pfnDrawInstanced = ddi10DrawInstanced;
|
---|
4475 | p10_1DeviceFuncs->pfnDynamicResourceMapDiscard = ddi10DynamicResourceMapDiscard;
|
---|
4476 | p10_1DeviceFuncs->pfnDynamicResourceUnmap = ddi10DynamicResourceUnmap;
|
---|
4477 | p10_1DeviceFuncs->pfnGsSetConstantBuffers = ddi10GsSetConstantBuffers;
|
---|
4478 | p10_1DeviceFuncs->pfnGsSetShader = ddi10GsSetShader;
|
---|
4479 | p10_1DeviceFuncs->pfnIaSetTopology = ddi10IaSetTopology;
|
---|
4480 | p10_1DeviceFuncs->pfnStagingResourceMap = ddi10StagingResourceMap;
|
---|
4481 | p10_1DeviceFuncs->pfnStagingResourceUnmap = ddi10StagingResourceUnmap;
|
---|
4482 | p10_1DeviceFuncs->pfnVsSetShaderResources = ddi10VsSetShaderResources;
|
---|
4483 | p10_1DeviceFuncs->pfnVsSetSamplers = ddi10VsSetSamplers;
|
---|
4484 | p10_1DeviceFuncs->pfnGsSetShaderResources = ddi10GsSetShaderResources;
|
---|
4485 | p10_1DeviceFuncs->pfnGsSetSamplers = ddi10GsSetSamplers;
|
---|
4486 | p10_1DeviceFuncs->pfnSetRenderTargets = ddi10SetRenderTargets;
|
---|
4487 | p10_1DeviceFuncs->pfnShaderResourceViewReadAfterWriteHazard = ddi10ShaderResourceViewReadAfterWriteHazard;
|
---|
4488 | p10_1DeviceFuncs->pfnResourceReadAfterWriteHazard = ddi10ResourceReadAfterWriteHazard;
|
---|
4489 | p10_1DeviceFuncs->pfnSetBlendState = ddi10SetBlendState;
|
---|
4490 | p10_1DeviceFuncs->pfnSetDepthStencilState = ddi10SetDepthStencilState;
|
---|
4491 | p10_1DeviceFuncs->pfnSetRasterizerState = ddi10SetRasterizerState;
|
---|
4492 | p10_1DeviceFuncs->pfnQueryEnd = ddi10QueryEnd;
|
---|
4493 | p10_1DeviceFuncs->pfnQueryBegin = ddi10QueryBegin;
|
---|
4494 | p10_1DeviceFuncs->pfnResourceCopyRegion = ddi10ResourceCopyRegion;
|
---|
4495 | p10_1DeviceFuncs->pfnResourceUpdateSubresourceUP = ddi10ResourceUpdateSubresourceUP;
|
---|
4496 | p10_1DeviceFuncs->pfnSoSetTargets = ddi10SoSetTargets;
|
---|
4497 | p10_1DeviceFuncs->pfnDrawAuto = ddi10DrawAuto;
|
---|
4498 | p10_1DeviceFuncs->pfnSetViewports = ddi10SetViewports;
|
---|
4499 | p10_1DeviceFuncs->pfnSetScissorRects = ddi10SetScissorRects;
|
---|
4500 | p10_1DeviceFuncs->pfnClearRenderTargetView = ddi10ClearRenderTargetView;
|
---|
4501 | p10_1DeviceFuncs->pfnClearDepthStencilView = ddi10ClearDepthStencilView;
|
---|
4502 | p10_1DeviceFuncs->pfnSetPredication = ddi10SetPredication;
|
---|
4503 | p10_1DeviceFuncs->pfnQueryGetData = ddi10QueryGetData;
|
---|
4504 | p10_1DeviceFuncs->pfnFlush = ddi10Flush;
|
---|
4505 | p10_1DeviceFuncs->pfnGenMips = ddi10GenMips;
|
---|
4506 | p10_1DeviceFuncs->pfnResourceCopy = ddi10ResourceCopy;
|
---|
4507 | p10_1DeviceFuncs->pfnResourceResolveSubresource = ddi10ResourceResolveSubresource;
|
---|
4508 |
|
---|
4509 | /* Infrequent paths. */
|
---|
4510 | p10_1DeviceFuncs->pfnResourceMap = ddi10ResourceMap;
|
---|
4511 | p10_1DeviceFuncs->pfnResourceUnmap = ddi10ResourceUnmap;
|
---|
4512 | p10_1DeviceFuncs->pfnResourceIsStagingBusy = vboxDXResourceIsStagingBusy;
|
---|
4513 | p10_1DeviceFuncs->pfnRelocateDeviceFuncs = ddi10_1RelocateDeviceFuncs;
|
---|
4514 | p10_1DeviceFuncs->pfnCalcPrivateResourceSize = ddi10CalcPrivateResourceSize;
|
---|
4515 | p10_1DeviceFuncs->pfnCalcPrivateOpenedResourceSize = ddi10CalcPrivateOpenedResourceSize;
|
---|
4516 | p10_1DeviceFuncs->pfnCreateResource = ddi10CreateResource;
|
---|
4517 | p10_1DeviceFuncs->pfnOpenResource = ddi10OpenResource;
|
---|
4518 | p10_1DeviceFuncs->pfnDestroyResource = ddi10DestroyResource;
|
---|
4519 | p10_1DeviceFuncs->pfnCalcPrivateShaderResourceViewSize = ddi10_1CalcPrivateShaderResourceViewSize;
|
---|
4520 | p10_1DeviceFuncs->pfnCreateShaderResourceView = ddi10_1CreateShaderResourceView;
|
---|
4521 | p10_1DeviceFuncs->pfnDestroyShaderResourceView = ddi10DestroyShaderResourceView;
|
---|
4522 | p10_1DeviceFuncs->pfnCalcPrivateRenderTargetViewSize = ddi10CalcPrivateRenderTargetViewSize;
|
---|
4523 | p10_1DeviceFuncs->pfnCreateRenderTargetView = ddi10CreateRenderTargetView;
|
---|
4524 | p10_1DeviceFuncs->pfnDestroyRenderTargetView = ddi10DestroyRenderTargetView;
|
---|
4525 | p10_1DeviceFuncs->pfnCalcPrivateDepthStencilViewSize = ddi10CalcPrivateDepthStencilViewSize;
|
---|
4526 | p10_1DeviceFuncs->pfnCreateDepthStencilView = ddi10CreateDepthStencilView;
|
---|
4527 | p10_1DeviceFuncs->pfnDestroyDepthStencilView = ddi10DestroyDepthStencilView;
|
---|
4528 | p10_1DeviceFuncs->pfnCalcPrivateElementLayoutSize = ddi10CalcPrivateElementLayoutSize;
|
---|
4529 | p10_1DeviceFuncs->pfnCreateElementLayout = ddi10CreateElementLayout;
|
---|
4530 | p10_1DeviceFuncs->pfnDestroyElementLayout = ddi10DestroyElementLayout;
|
---|
4531 | p10_1DeviceFuncs->pfnCalcPrivateBlendStateSize = ddi10_1CalcPrivateBlendStateSize;
|
---|
4532 | p10_1DeviceFuncs->pfnCreateBlendState = ddi10_1CreateBlendState;
|
---|
4533 | p10_1DeviceFuncs->pfnDestroyBlendState = ddi10DestroyBlendState;
|
---|
4534 | p10_1DeviceFuncs->pfnCalcPrivateDepthStencilStateSize = ddi10CalcPrivateDepthStencilStateSize;
|
---|
4535 | p10_1DeviceFuncs->pfnCreateDepthStencilState = ddi10CreateDepthStencilState;
|
---|
4536 | p10_1DeviceFuncs->pfnDestroyDepthStencilState = ddi10DestroyDepthStencilState;
|
---|
4537 | p10_1DeviceFuncs->pfnCalcPrivateRasterizerStateSize = ddi10CalcPrivateRasterizerStateSize;
|
---|
4538 | p10_1DeviceFuncs->pfnCreateRasterizerState = ddi10CreateRasterizerState;
|
---|
4539 | p10_1DeviceFuncs->pfnDestroyRasterizerState = ddi10DestroyRasterizerState;
|
---|
4540 | p10_1DeviceFuncs->pfnCalcPrivateShaderSize = ddi10CalcPrivateShaderSize;
|
---|
4541 | p10_1DeviceFuncs->pfnCreateVertexShader = ddi10CreateVertexShader;
|
---|
4542 | p10_1DeviceFuncs->pfnCreateGeometryShader = ddi10CreateGeometryShader;
|
---|
4543 | p10_1DeviceFuncs->pfnCreatePixelShader = ddi10CreatePixelShader;
|
---|
4544 | p10_1DeviceFuncs->pfnCalcPrivateGeometryShaderWithStreamOutput = ddi10CalcPrivateGeometryShaderWithStreamOutput;
|
---|
4545 | p10_1DeviceFuncs->pfnCreateGeometryShaderWithStreamOutput = ddi10CreateGeometryShaderWithStreamOutput;
|
---|
4546 | p10_1DeviceFuncs->pfnDestroyShader = ddi10DestroyShader;
|
---|
4547 | p10_1DeviceFuncs->pfnCalcPrivateSamplerSize = ddi10CalcPrivateSamplerSize;
|
---|
4548 | p10_1DeviceFuncs->pfnCreateSampler = ddi10CreateSampler;
|
---|
4549 | p10_1DeviceFuncs->pfnDestroySampler = ddi10DestroySampler;
|
---|
4550 | p10_1DeviceFuncs->pfnCalcPrivateQuerySize = ddi10CalcPrivateQuerySize;
|
---|
4551 | p10_1DeviceFuncs->pfnCreateQuery = ddi10CreateQuery;
|
---|
4552 | p10_1DeviceFuncs->pfnDestroyQuery = ddi10DestroyQuery;
|
---|
4553 |
|
---|
4554 | p10_1DeviceFuncs->pfnCheckFormatSupport = vboxDXCheckFormatSupport;
|
---|
4555 | p10_1DeviceFuncs->pfnCheckMultisampleQualityLevels = vboxDXCheckMultisampleQualityLevels;
|
---|
4556 | p10_1DeviceFuncs->pfnCheckCounterInfo = ddi10CheckCounterInfo;
|
---|
4557 | p10_1DeviceFuncs->pfnCheckCounter = ddi10CheckCounter;
|
---|
4558 |
|
---|
4559 | p10_1DeviceFuncs->pfnDestroyDevice = ddi10DestroyDevice;
|
---|
4560 | p10_1DeviceFuncs->pfnSetTextFilterSize = ddi10SetTextFilterSize;
|
---|
4561 |
|
---|
4562 | /* Additional 10.1 entries */
|
---|
4563 | p10_1DeviceFuncs->pfnResourceConvert = vboxDXResourceConvert;
|
---|
4564 | p10_1DeviceFuncs->pfnResourceConvertRegion = ddi10ResourceConvertRegion;
|
---|
4565 | }
|
---|
4566 | else
|
---|
4567 | {
|
---|
4568 | /*
|
---|
4569 | * 10.0
|
---|
4570 | */
|
---|
4571 | D3D10DDI_DEVICEFUNCS *p10DeviceFuncs = pCreateData->pDeviceFuncs;
|
---|
4572 |
|
---|
4573 | /* Order of functions is in decreasing order of priority ( as far as performance is concerned ). */
|
---|
4574 | /* High frequency functions. */
|
---|
4575 | p10DeviceFuncs->pfnDefaultConstantBufferUpdateSubresourceUP = ddi10DefaultConstantBufferUpdateSubresourceUP;
|
---|
4576 | p10DeviceFuncs->pfnVsSetConstantBuffers = ddi10VsSetConstantBuffers;
|
---|
4577 | p10DeviceFuncs->pfnPsSetShaderResources = ddi10PsSetShaderResources;
|
---|
4578 | p10DeviceFuncs->pfnPsSetShader = ddi10PsSetShader;
|
---|
4579 | p10DeviceFuncs->pfnPsSetSamplers = ddi10PsSetSamplers;
|
---|
4580 | p10DeviceFuncs->pfnVsSetShader = ddi10VsSetShader;
|
---|
4581 | p10DeviceFuncs->pfnDrawIndexed = ddi10DrawIndexed;
|
---|
4582 | p10DeviceFuncs->pfnDraw = ddi10Draw;
|
---|
4583 | p10DeviceFuncs->pfnDynamicIABufferMapNoOverwrite = ddi10DynamicIABufferMapNoOverwrite;
|
---|
4584 | p10DeviceFuncs->pfnDynamicIABufferUnmap = ddi10DynamicIABufferUnmap;
|
---|
4585 | p10DeviceFuncs->pfnDynamicConstantBufferMapDiscard = ddi10DynamicConstantBufferMapDiscard;
|
---|
4586 | p10DeviceFuncs->pfnDynamicIABufferMapDiscard = ddi10DynamicIABufferMapDiscard;
|
---|
4587 | p10DeviceFuncs->pfnDynamicConstantBufferUnmap = ddi10DynamicConstantBufferUnmap;
|
---|
4588 | p10DeviceFuncs->pfnPsSetConstantBuffers = ddi10PsSetConstantBuffers;
|
---|
4589 | p10DeviceFuncs->pfnIaSetInputLayout = ddi10IaSetInputLayout;
|
---|
4590 | p10DeviceFuncs->pfnIaSetVertexBuffers = ddi10IaSetVertexBuffers;
|
---|
4591 | p10DeviceFuncs->pfnIaSetIndexBuffer = ddi10IaSetIndexBuffer;
|
---|
4592 |
|
---|
4593 | /* Middle frequency functions. */
|
---|
4594 | p10DeviceFuncs->pfnDrawIndexedInstanced = ddi10DrawIndexedInstanced;
|
---|
4595 | p10DeviceFuncs->pfnDrawInstanced = ddi10DrawInstanced;
|
---|
4596 | p10DeviceFuncs->pfnDynamicResourceMapDiscard = ddi10DynamicResourceMapDiscard;
|
---|
4597 | p10DeviceFuncs->pfnDynamicResourceUnmap = ddi10DynamicResourceUnmap;
|
---|
4598 | p10DeviceFuncs->pfnGsSetConstantBuffers = ddi10GsSetConstantBuffers;
|
---|
4599 | p10DeviceFuncs->pfnGsSetShader = ddi10GsSetShader;
|
---|
4600 | p10DeviceFuncs->pfnIaSetTopology = ddi10IaSetTopology;
|
---|
4601 | p10DeviceFuncs->pfnStagingResourceMap = ddi10StagingResourceMap;
|
---|
4602 | p10DeviceFuncs->pfnStagingResourceUnmap = ddi10StagingResourceUnmap;
|
---|
4603 | p10DeviceFuncs->pfnVsSetShaderResources = ddi10VsSetShaderResources;
|
---|
4604 | p10DeviceFuncs->pfnVsSetSamplers = ddi10VsSetSamplers;
|
---|
4605 | p10DeviceFuncs->pfnGsSetShaderResources = ddi10GsSetShaderResources;
|
---|
4606 | p10DeviceFuncs->pfnGsSetSamplers = ddi10GsSetSamplers;
|
---|
4607 | p10DeviceFuncs->pfnSetRenderTargets = ddi10SetRenderTargets;
|
---|
4608 | p10DeviceFuncs->pfnShaderResourceViewReadAfterWriteHazard = ddi10ShaderResourceViewReadAfterWriteHazard;
|
---|
4609 | p10DeviceFuncs->pfnResourceReadAfterWriteHazard = ddi10ResourceReadAfterWriteHazard;
|
---|
4610 | p10DeviceFuncs->pfnSetBlendState = ddi10SetBlendState;
|
---|
4611 | p10DeviceFuncs->pfnSetDepthStencilState = ddi10SetDepthStencilState;
|
---|
4612 | p10DeviceFuncs->pfnSetRasterizerState = ddi10SetRasterizerState;
|
---|
4613 | p10DeviceFuncs->pfnQueryEnd = ddi10QueryEnd;
|
---|
4614 | p10DeviceFuncs->pfnQueryBegin = ddi10QueryBegin;
|
---|
4615 | p10DeviceFuncs->pfnResourceCopyRegion = ddi10ResourceCopyRegion;
|
---|
4616 | p10DeviceFuncs->pfnResourceUpdateSubresourceUP = ddi10ResourceUpdateSubresourceUP;
|
---|
4617 | p10DeviceFuncs->pfnSoSetTargets = ddi10SoSetTargets;
|
---|
4618 | p10DeviceFuncs->pfnDrawAuto = ddi10DrawAuto;
|
---|
4619 | p10DeviceFuncs->pfnSetViewports = ddi10SetViewports;
|
---|
4620 | p10DeviceFuncs->pfnSetScissorRects = ddi10SetScissorRects;
|
---|
4621 | p10DeviceFuncs->pfnClearRenderTargetView = ddi10ClearRenderTargetView;
|
---|
4622 | p10DeviceFuncs->pfnClearDepthStencilView = ddi10ClearDepthStencilView;
|
---|
4623 | p10DeviceFuncs->pfnSetPredication = ddi10SetPredication;
|
---|
4624 | p10DeviceFuncs->pfnQueryGetData = ddi10QueryGetData;
|
---|
4625 | p10DeviceFuncs->pfnFlush = ddi10Flush;
|
---|
4626 | p10DeviceFuncs->pfnGenMips = ddi10GenMips;
|
---|
4627 | p10DeviceFuncs->pfnResourceCopy = ddi10ResourceCopy;
|
---|
4628 | p10DeviceFuncs->pfnResourceResolveSubresource = ddi10ResourceResolveSubresource;
|
---|
4629 |
|
---|
4630 | /* Infrequent paths. */
|
---|
4631 | p10DeviceFuncs->pfnResourceMap = ddi10ResourceMap;
|
---|
4632 | p10DeviceFuncs->pfnResourceUnmap = ddi10ResourceUnmap;
|
---|
4633 | p10DeviceFuncs->pfnResourceIsStagingBusy = vboxDXResourceIsStagingBusy;
|
---|
4634 | p10DeviceFuncs->pfnRelocateDeviceFuncs = ddi10RelocateDeviceFuncs;
|
---|
4635 | p10DeviceFuncs->pfnCalcPrivateResourceSize = ddi10CalcPrivateResourceSize;
|
---|
4636 | p10DeviceFuncs->pfnCalcPrivateOpenedResourceSize = ddi10CalcPrivateOpenedResourceSize;
|
---|
4637 | p10DeviceFuncs->pfnCreateResource = ddi10CreateResource;
|
---|
4638 | p10DeviceFuncs->pfnOpenResource = ddi10OpenResource;
|
---|
4639 | p10DeviceFuncs->pfnDestroyResource = ddi10DestroyResource;
|
---|
4640 | p10DeviceFuncs->pfnCalcPrivateShaderResourceViewSize = ddi10CalcPrivateShaderResourceViewSize;
|
---|
4641 | p10DeviceFuncs->pfnCreateShaderResourceView = ddi10CreateShaderResourceView;
|
---|
4642 | p10DeviceFuncs->pfnDestroyShaderResourceView = ddi10DestroyShaderResourceView;
|
---|
4643 | p10DeviceFuncs->pfnCalcPrivateRenderTargetViewSize = ddi10CalcPrivateRenderTargetViewSize;
|
---|
4644 | p10DeviceFuncs->pfnCreateRenderTargetView = ddi10CreateRenderTargetView;
|
---|
4645 | p10DeviceFuncs->pfnDestroyRenderTargetView = ddi10DestroyRenderTargetView;
|
---|
4646 | p10DeviceFuncs->pfnCalcPrivateDepthStencilViewSize = ddi10CalcPrivateDepthStencilViewSize;
|
---|
4647 | p10DeviceFuncs->pfnCreateDepthStencilView = ddi10CreateDepthStencilView;
|
---|
4648 | p10DeviceFuncs->pfnDestroyDepthStencilView = ddi10DestroyDepthStencilView;
|
---|
4649 | p10DeviceFuncs->pfnCalcPrivateElementLayoutSize = ddi10CalcPrivateElementLayoutSize;
|
---|
4650 | p10DeviceFuncs->pfnCreateElementLayout = ddi10CreateElementLayout;
|
---|
4651 | p10DeviceFuncs->pfnDestroyElementLayout = ddi10DestroyElementLayout;
|
---|
4652 | p10DeviceFuncs->pfnCalcPrivateBlendStateSize = ddi10CalcPrivateBlendStateSize;
|
---|
4653 | p10DeviceFuncs->pfnCreateBlendState = ddi10CreateBlendState;
|
---|
4654 | p10DeviceFuncs->pfnDestroyBlendState = ddi10DestroyBlendState;
|
---|
4655 | p10DeviceFuncs->pfnCalcPrivateDepthStencilStateSize = ddi10CalcPrivateDepthStencilStateSize;
|
---|
4656 | p10DeviceFuncs->pfnCreateDepthStencilState = ddi10CreateDepthStencilState;
|
---|
4657 | p10DeviceFuncs->pfnDestroyDepthStencilState = ddi10DestroyDepthStencilState;
|
---|
4658 | p10DeviceFuncs->pfnCalcPrivateRasterizerStateSize = ddi10CalcPrivateRasterizerStateSize;
|
---|
4659 | p10DeviceFuncs->pfnCreateRasterizerState = ddi10CreateRasterizerState;
|
---|
4660 | p10DeviceFuncs->pfnDestroyRasterizerState = ddi10DestroyRasterizerState;
|
---|
4661 | p10DeviceFuncs->pfnCalcPrivateShaderSize = ddi10CalcPrivateShaderSize;
|
---|
4662 | p10DeviceFuncs->pfnCreateVertexShader = ddi10CreateVertexShader;
|
---|
4663 | p10DeviceFuncs->pfnCreateGeometryShader = ddi10CreateGeometryShader;
|
---|
4664 | p10DeviceFuncs->pfnCreatePixelShader = ddi10CreatePixelShader;
|
---|
4665 | p10DeviceFuncs->pfnCalcPrivateGeometryShaderWithStreamOutput = ddi10CalcPrivateGeometryShaderWithStreamOutput;
|
---|
4666 | p10DeviceFuncs->pfnCreateGeometryShaderWithStreamOutput = ddi10CreateGeometryShaderWithStreamOutput;
|
---|
4667 | p10DeviceFuncs->pfnDestroyShader = ddi10DestroyShader;
|
---|
4668 | p10DeviceFuncs->pfnCalcPrivateSamplerSize = ddi10CalcPrivateSamplerSize;
|
---|
4669 | p10DeviceFuncs->pfnCreateSampler = ddi10CreateSampler;
|
---|
4670 | p10DeviceFuncs->pfnDestroySampler = ddi10DestroySampler;
|
---|
4671 | p10DeviceFuncs->pfnCalcPrivateQuerySize = ddi10CalcPrivateQuerySize;
|
---|
4672 | p10DeviceFuncs->pfnCreateQuery = ddi10CreateQuery;
|
---|
4673 | p10DeviceFuncs->pfnDestroyQuery = ddi10DestroyQuery;
|
---|
4674 |
|
---|
4675 | p10DeviceFuncs->pfnCheckFormatSupport = vboxDXCheckFormatSupport;
|
---|
4676 | p10DeviceFuncs->pfnCheckMultisampleQualityLevels = vboxDXCheckMultisampleQualityLevels;
|
---|
4677 | p10DeviceFuncs->pfnCheckCounterInfo = ddi10CheckCounterInfo;
|
---|
4678 | p10DeviceFuncs->pfnCheckCounter = ddi10CheckCounter;
|
---|
4679 |
|
---|
4680 | p10DeviceFuncs->pfnDestroyDevice = ddi10DestroyDevice;
|
---|
4681 | p10DeviceFuncs->pfnSetTextFilterSize = ddi10SetTextFilterSize;
|
---|
4682 | }
|
---|
4683 |
|
---|
4684 | /* DXGI functions. */
|
---|
4685 | if (IS_DXGI1_2_BASE_FUNCTIONS(pCreateData->Interface, pCreateData->Version))
|
---|
4686 | {
|
---|
4687 | DXGI1_2_DDI_BASE_FUNCTIONS *pDXGIFuncs = pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions3;
|
---|
4688 | pDXGIFuncs->pfnPresent = dxgiPresent;
|
---|
4689 | pDXGIFuncs->pfnGetGammaCaps = dxgiGetGammaCaps;
|
---|
4690 | pDXGIFuncs->pfnSetDisplayMode = dxgiSetDisplayMode;
|
---|
4691 | pDXGIFuncs->pfnSetResourcePriority = vboxDXGISetResourcePriority;
|
---|
4692 | pDXGIFuncs->pfnQueryResourceResidency = dxgiQueryResourceResidency;
|
---|
4693 | pDXGIFuncs->pfnRotateResourceIdentities = dxgiRotateResourceIdentities;
|
---|
4694 | pDXGIFuncs->pfnBlt = dxgiBlt;
|
---|
4695 | pDXGIFuncs->pfnResolveSharedResource = dxgiResolveSharedResource;
|
---|
4696 | pDXGIFuncs->pfnBlt1 = vboxDXGIBlt1;
|
---|
4697 | pDXGIFuncs->pfnOfferResources = dxgiOfferResources;
|
---|
4698 | pDXGIFuncs->pfnReclaimResources = dxgiReclaimResources;
|
---|
4699 |
|
---|
4700 | if (IS_DXGI_MULTIPLANE_OVERLAY_FUNCTIONS(pCreateData->Interface, pCreateData->Version))
|
---|
4701 | {
|
---|
4702 | // TBD: Implement MultiplaneOverlay callbacks
|
---|
4703 | }
|
---|
4704 | }
|
---|
4705 | else if (IS_DXGI1_1_BASE_FUNCTIONS(pCreateData->Interface, pCreateData->Version))
|
---|
4706 | {
|
---|
4707 | DXGI1_1_DDI_BASE_FUNCTIONS *pDXGIFuncs = pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions2;
|
---|
4708 | pDXGIFuncs->pfnPresent = dxgiPresent;
|
---|
4709 | pDXGIFuncs->pfnGetGammaCaps = dxgiGetGammaCaps;
|
---|
4710 | pDXGIFuncs->pfnSetDisplayMode = dxgiSetDisplayMode;
|
---|
4711 | pDXGIFuncs->pfnSetResourcePriority = vboxDXGISetResourcePriority;
|
---|
4712 | pDXGIFuncs->pfnQueryResourceResidency = dxgiQueryResourceResidency;
|
---|
4713 | pDXGIFuncs->pfnRotateResourceIdentities = dxgiRotateResourceIdentities;
|
---|
4714 | pDXGIFuncs->pfnBlt = dxgiBlt;
|
---|
4715 | pDXGIFuncs->pfnResolveSharedResource = dxgiResolveSharedResource;
|
---|
4716 | }
|
---|
4717 | else
|
---|
4718 | {
|
---|
4719 | DXGI_DDI_BASE_FUNCTIONS *pDXGIFuncs = pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions;
|
---|
4720 | pDXGIFuncs->pfnPresent = dxgiPresent;
|
---|
4721 | pDXGIFuncs->pfnGetGammaCaps = dxgiGetGammaCaps;
|
---|
4722 | pDXGIFuncs->pfnSetDisplayMode = dxgiSetDisplayMode;
|
---|
4723 | pDXGIFuncs->pfnSetResourcePriority = vboxDXGISetResourcePriority;
|
---|
4724 | pDXGIFuncs->pfnQueryResourceResidency = dxgiQueryResourceResidency;
|
---|
4725 | pDXGIFuncs->pfnRotateResourceIdentities = dxgiRotateResourceIdentities;
|
---|
4726 | pDXGIFuncs->pfnBlt = dxgiBlt;
|
---|
4727 | }
|
---|
4728 |
|
---|
4729 | if (pCreateData->Interface == D3D11_1_DDI_INTERFACE_VERSION)
|
---|
4730 | *pCreateData->ppfnRetrieveSubObject = ddi10RetrieveSubObject;
|
---|
4731 |
|
---|
4732 | return S_OK;
|
---|
4733 | }
|
---|
4734 |
|
---|
4735 | static HRESULT APIENTRY vboxDXCloseAdapter(D3D10DDI_HADAPTER hAdapter)
|
---|
4736 | {
|
---|
4737 | RT_NOREF(hAdapter);
|
---|
4738 | LogFlowFuncEnter();
|
---|
4739 |
|
---|
4740 | return S_OK;
|
---|
4741 | }
|
---|
4742 |
|
---|
4743 |
|
---|
4744 | static HRESULT APIENTRY vboxDXGetSupportedVersions(D3D10DDI_HADAPTER hAdapter, UINT32* puEntries, UINT64* pSupportedDDIInterfaceVersions)
|
---|
4745 | {
|
---|
4746 | RT_NOREF(hAdapter);
|
---|
4747 | LogFlowFuncEnter();
|
---|
4748 |
|
---|
4749 | if (puEntries)
|
---|
4750 | *puEntries = RT_ELEMENTS(g_aSupportedDDIInterfaceVersions);
|
---|
4751 |
|
---|
4752 | if (pSupportedDDIInterfaceVersions)
|
---|
4753 | {
|
---|
4754 | for (unsigned i = 0; i < RT_ELEMENTS(g_aSupportedDDIInterfaceVersions); ++i)
|
---|
4755 | pSupportedDDIInterfaceVersions[i] = g_aSupportedDDIInterfaceVersions[i];
|
---|
4756 | }
|
---|
4757 |
|
---|
4758 | return S_OK;
|
---|
4759 | }
|
---|
4760 |
|
---|
4761 | static HRESULT APIENTRY vboxDXGetCaps(D3D10DDI_HADAPTER hAdapter, const D3D10_2DDIARG_GETCAPS* pArg)
|
---|
4762 | {
|
---|
4763 | //DEBUG_BREAKPOINT_TEST();
|
---|
4764 | PVBOXDXADAPTER pAdapter = (PVBOXDXADAPTER)hAdapter.pDrvPrivate;
|
---|
4765 | RT_NOREF(pAdapter);
|
---|
4766 | LogFlow(("vboxDXGetCaps: Type %d", pArg->Type));
|
---|
4767 |
|
---|
4768 | switch (pArg->Type)
|
---|
4769 | {
|
---|
4770 | case D3D11DDICAPS_THREADING:
|
---|
4771 | {
|
---|
4772 | D3D11DDI_THREADING_CAPS *pCaps = (D3D11DDI_THREADING_CAPS *)pArg->pData;
|
---|
4773 | pCaps->Caps = 0;
|
---|
4774 | break;
|
---|
4775 | }
|
---|
4776 |
|
---|
4777 | case D3D11DDICAPS_SHADER:
|
---|
4778 | {
|
---|
4779 | D3D11DDI_SHADER_CAPS *pCaps = (D3D11DDI_SHADER_CAPS *)pArg->pData;
|
---|
4780 | pCaps->Caps = D3D11DDICAPS_SHADER_COMPUTE_PLUS_RAW_AND_STRUCTURED_BUFFERS_IN_SHADER_4_X;
|
---|
4781 | break;
|
---|
4782 | }
|
---|
4783 |
|
---|
4784 | case D3D11_1DDICAPS_D3D11_OPTIONS:
|
---|
4785 | {
|
---|
4786 | D3D11_1DDI_D3D11_OPTIONS_DATA *pCaps = (D3D11_1DDI_D3D11_OPTIONS_DATA *)pArg->pData;
|
---|
4787 | pCaps->OutputMergerLogicOp = TRUE; /* Required for 11.1 driver. */
|
---|
4788 | pCaps->AssignDebugBinarySupport = FALSE;
|
---|
4789 | break;
|
---|
4790 | }
|
---|
4791 |
|
---|
4792 | case D3D11_1DDICAPS_ARCHITECTURE_INFO:
|
---|
4793 | {
|
---|
4794 | D3DDDICAPS_ARCHITECTURE_INFO *pCaps = (D3DDDICAPS_ARCHITECTURE_INFO *)pArg->pData;
|
---|
4795 | pCaps->TileBasedDeferredRenderer = FALSE;
|
---|
4796 | break;
|
---|
4797 | }
|
---|
4798 |
|
---|
4799 | case D3D11_1DDICAPS_SHADER_MIN_PRECISION_SUPPORT:
|
---|
4800 | {
|
---|
4801 | D3DDDICAPS_SHADER_MIN_PRECISION_SUPPORT *pCaps = (D3DDDICAPS_SHADER_MIN_PRECISION_SUPPORT *)pArg->pData;
|
---|
4802 | /* The driver supports only the default precision for the shader model, and not a lower precision. */
|
---|
4803 | pCaps->VertexShaderMinPrecision = 0;
|
---|
4804 | pCaps->PixelShaderMinPrecision = 0;
|
---|
4805 | break;
|
---|
4806 | }
|
---|
4807 |
|
---|
4808 | case D3D11DDICAPS_3DPIPELINESUPPORT:
|
---|
4809 | {
|
---|
4810 | D3D11DDI_3DPIPELINESUPPORT_CAPS *pCaps = (D3D11DDI_3DPIPELINESUPPORT_CAPS *)pArg->pData;
|
---|
4811 |
|
---|
4812 | /* Support of 11.1 pipeline assumes the support of 11.0, 10.1 and 10.0 pipelines. */
|
---|
4813 | pCaps->Caps =
|
---|
4814 | D3D11DDI_ENCODE_3DPIPELINESUPPORT_CAP(D3D11_1DDI_3DPIPELINELEVEL_11_1) |
|
---|
4815 | D3D11DDI_ENCODE_3DPIPELINESUPPORT_CAP(D3D11DDI_3DPIPELINELEVEL_11_0) |
|
---|
4816 | D3D11DDI_ENCODE_3DPIPELINESUPPORT_CAP(D3D11DDI_3DPIPELINELEVEL_10_1) |
|
---|
4817 | D3D11DDI_ENCODE_3DPIPELINESUPPORT_CAP(D3D11DDI_3DPIPELINELEVEL_10_0);
|
---|
4818 | break;
|
---|
4819 | }
|
---|
4820 | default:
|
---|
4821 | break;
|
---|
4822 | }
|
---|
4823 |
|
---|
4824 | return S_OK;
|
---|
4825 | }
|
---|
4826 |
|
---|
4827 |
|
---|
4828 | HRESULT APIENTRY OpenAdapter10_2(D3D10DDIARG_OPENADAPTER *pOpenData)
|
---|
4829 | {
|
---|
4830 | //DEBUG_BREAKPOINT_TEST();
|
---|
4831 | LogFlow(("OpenAdapter10_2: Interface 0x%08x, Version 0x%08x", pOpenData->Interface, pOpenData->Version));
|
---|
4832 |
|
---|
4833 | PVBOXDXADAPTER pAdapter = NULL;
|
---|
4834 |
|
---|
4835 | /* Query the miniport about virtual hardware capabilities. */
|
---|
4836 | VBOXWDDM_QAI *pAdapterInfo = NULL;
|
---|
4837 | HRESULT hr = vboxDXQueryAdapterInfo(pOpenData, &pAdapterInfo);
|
---|
4838 | if (SUCCEEDED(hr))
|
---|
4839 | {
|
---|
4840 | hr = vboxDXAdapterInit(pOpenData, pAdapterInfo, &pAdapter);
|
---|
4841 | if (SUCCEEDED(hr))
|
---|
4842 | {
|
---|
4843 | Log(("SUCCESS 3D Enabled, pAdapter (0x%p)", pAdapter));
|
---|
4844 | }
|
---|
4845 | }
|
---|
4846 |
|
---|
4847 | if (SUCCEEDED(hr))
|
---|
4848 | {
|
---|
4849 | /* Return data to the OS. */
|
---|
4850 | if (pAdapter->enmHwType == VBOXVIDEO_HWTYPE_VBOX)
|
---|
4851 | {
|
---|
4852 | /* Not supposed to work with this. */
|
---|
4853 | hr = E_FAIL;
|
---|
4854 | }
|
---|
4855 | else if (pAdapter->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA)
|
---|
4856 | {
|
---|
4857 | pOpenData->hAdapter.pDrvPrivate = pAdapter;
|
---|
4858 | pOpenData->pAdapterFuncs_2->pfnCalcPrivateDeviceSize = vboxDXCalcPrivateDeviceSize;
|
---|
4859 | pOpenData->pAdapterFuncs_2->pfnCreateDevice = vboxDXCreateDevice;
|
---|
4860 | pOpenData->pAdapterFuncs_2->pfnCloseAdapter = vboxDXCloseAdapter;
|
---|
4861 | pOpenData->pAdapterFuncs_2->pfnGetSupportedVersions = vboxDXGetSupportedVersions;
|
---|
4862 | pOpenData->pAdapterFuncs_2->pfnGetCaps = vboxDXGetCaps;
|
---|
4863 | }
|
---|
4864 | else
|
---|
4865 | hr = E_FAIL;
|
---|
4866 | }
|
---|
4867 |
|
---|
4868 | if (FAILED(hr))
|
---|
4869 | {
|
---|
4870 | LogRel(("WDDM: WARNING! OpenAdapter10_2 failed hr 0x%x", hr));
|
---|
4871 | RTMemFree(pAdapter);
|
---|
4872 | }
|
---|
4873 |
|
---|
4874 | RTMemFree(pAdapterInfo);
|
---|
4875 |
|
---|
4876 | LogFlowFuncLeaveRC(hr);
|
---|
4877 | return hr;
|
---|
4878 | }
|
---|
4879 |
|
---|
4880 |
|
---|
4881 | HRESULT APIENTRY OpenAdapter10(D3D10DDIARG_OPENADAPTER *pOpenData)
|
---|
4882 | {
|
---|
4883 | //DEBUG_BREAKPOINT_TEST();
|
---|
4884 | LogFlow(("OpenAdapter10: Interface 0x%08x, Version 0x%08x", pOpenData->Interface, pOpenData->Version));
|
---|
4885 |
|
---|
4886 | if (!isInterfaceSupported(pOpenData->Interface))
|
---|
4887 | return E_FAIL;
|
---|
4888 |
|
---|
4889 | PVBOXDXADAPTER pAdapter = NULL;
|
---|
4890 |
|
---|
4891 | /* Query the miniport about virtual hardware capabilities. */
|
---|
4892 | VBOXWDDM_QAI *pAdapterInfo = NULL;
|
---|
4893 | HRESULT hr = vboxDXQueryAdapterInfo(pOpenData, &pAdapterInfo);
|
---|
4894 | if (SUCCEEDED(hr))
|
---|
4895 | {
|
---|
4896 | hr = vboxDXAdapterInit(pOpenData, pAdapterInfo, &pAdapter);
|
---|
4897 | if (SUCCEEDED(hr))
|
---|
4898 | {
|
---|
4899 | Log(("SUCCESS 3D Enabled, pAdapter (0x%p)", pAdapter));
|
---|
4900 | }
|
---|
4901 | }
|
---|
4902 |
|
---|
4903 | if (SUCCEEDED(hr))
|
---|
4904 | {
|
---|
4905 | /* Return data to the OS. */
|
---|
4906 | if (pAdapter->enmHwType == VBOXVIDEO_HWTYPE_VBOX)
|
---|
4907 | {
|
---|
4908 | /* Not supposed to work with this. */
|
---|
4909 | hr = E_FAIL;
|
---|
4910 | }
|
---|
4911 | else if (pAdapter->enmHwType == VBOXVIDEO_HWTYPE_VMSVGA)
|
---|
4912 | {
|
---|
4913 | pOpenData->hAdapter.pDrvPrivate = pAdapter;
|
---|
4914 | pOpenData->pAdapterFuncs->pfnCalcPrivateDeviceSize = vboxDXCalcPrivateDeviceSize;
|
---|
4915 | pOpenData->pAdapterFuncs->pfnCreateDevice = vboxDXCreateDevice;
|
---|
4916 | pOpenData->pAdapterFuncs->pfnCloseAdapter = vboxDXCloseAdapter;
|
---|
4917 | }
|
---|
4918 | else
|
---|
4919 | hr = E_FAIL;
|
---|
4920 | }
|
---|
4921 |
|
---|
4922 | if (FAILED(hr))
|
---|
4923 | {
|
---|
4924 | LogRel(("WDDM: WARNING! OpenAdapter10 failed hr 0x%x", hr));
|
---|
4925 | RTMemFree(pAdapter);
|
---|
4926 | }
|
---|
4927 |
|
---|
4928 | RTMemFree(pAdapterInfo);
|
---|
4929 |
|
---|
4930 | LogFlowFuncLeaveRC(hr);
|
---|
4931 | return hr;
|
---|
4932 | }
|
---|
4933 |
|
---|
4934 |
|
---|
4935 | #ifdef DEBUG
|
---|
4936 | /* Verify the function prototype. */
|
---|
4937 | static PFND3D10DDI_OPENADAPTER pOpenAdapter10_2 = OpenAdapter10_2;
|
---|
4938 | static PFND3D10DDI_OPENADAPTER pOpenAdapter10 = OpenAdapter10;
|
---|
4939 |
|
---|
4940 | typedef BOOL WINAPI FNGetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb);
|
---|
4941 | typedef FNGetModuleInformation *PFNGetModuleInformation;
|
---|
4942 |
|
---|
4943 | static PFNGetModuleInformation g_pfnGetModuleInformation = NULL;
|
---|
4944 | static HMODULE g_hModPsapi = NULL;
|
---|
4945 | static PVOID g_VBoxWDbgVEHandler = NULL;
|
---|
4946 |
|
---|
4947 | static bool vboxVDbgIsAddressInModule(PVOID pv, const char *pszModuleName)
|
---|
4948 | {
|
---|
4949 | HMODULE hMod = GetModuleHandleA(pszModuleName);
|
---|
4950 | if (!hMod)
|
---|
4951 | return false;
|
---|
4952 |
|
---|
4953 | if (!g_pfnGetModuleInformation)
|
---|
4954 | return false;
|
---|
4955 |
|
---|
4956 | HANDLE hProcess = GetCurrentProcess();
|
---|
4957 | MODULEINFO ModuleInfo = {0};
|
---|
4958 | if (!g_pfnGetModuleInformation(hProcess, hMod, &ModuleInfo, sizeof(ModuleInfo)))
|
---|
4959 | return false;
|
---|
4960 |
|
---|
4961 | return (uintptr_t)ModuleInfo.lpBaseOfDll <= (uintptr_t)pv
|
---|
4962 | && (uintptr_t)pv < (uintptr_t)ModuleInfo.lpBaseOfDll + ModuleInfo.SizeOfImage;
|
---|
4963 | }
|
---|
4964 |
|
---|
4965 | static bool vboxVDbgIsExceptionIgnored(PEXCEPTION_RECORD pExceptionRecord)
|
---|
4966 | {
|
---|
4967 | /* Module (dll) names for GetModuleHandle.
|
---|
4968 | * Exceptions originated from these modules will be ignored.
|
---|
4969 | */
|
---|
4970 | static const char *apszIgnoredModuleNames[] =
|
---|
4971 | {
|
---|
4972 | NULL
|
---|
4973 | };
|
---|
4974 |
|
---|
4975 | int i = 0;
|
---|
4976 | while (apszIgnoredModuleNames[i])
|
---|
4977 | {
|
---|
4978 | if (vboxVDbgIsAddressInModule(pExceptionRecord->ExceptionAddress, apszIgnoredModuleNames[i]))
|
---|
4979 | return true;
|
---|
4980 |
|
---|
4981 | ++i;
|
---|
4982 | }
|
---|
4983 |
|
---|
4984 | return false;
|
---|
4985 | }
|
---|
4986 |
|
---|
4987 | static LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo) RT_NOTHROW_DEF
|
---|
4988 | {
|
---|
4989 | static volatile bool g_fAllowIgnore = true; /* Might be changed in kernel debugger. */
|
---|
4990 |
|
---|
4991 | PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;
|
---|
4992 | /* PCONTEXT pContextRecord = pExceptionInfo->ContextRecord; */
|
---|
4993 |
|
---|
4994 | switch (pExceptionRecord->ExceptionCode)
|
---|
4995 | {
|
---|
4996 | default:
|
---|
4997 | break;
|
---|
4998 | case EXCEPTION_BREAKPOINT:
|
---|
4999 | case EXCEPTION_ACCESS_VIOLATION:
|
---|
5000 | case EXCEPTION_STACK_OVERFLOW:
|
---|
5001 | case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
---|
5002 | case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
---|
5003 | case EXCEPTION_FLT_INVALID_OPERATION:
|
---|
5004 | case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
---|
5005 | case EXCEPTION_ILLEGAL_INSTRUCTION:
|
---|
5006 | if (g_fAllowIgnore && vboxVDbgIsExceptionIgnored(pExceptionRecord))
|
---|
5007 | break;
|
---|
5008 | ASMBreakpoint();
|
---|
5009 | break;
|
---|
5010 | case 0x40010006: /* OutputDebugStringA? */
|
---|
5011 | case 0x4001000a: /* OutputDebugStringW? */
|
---|
5012 | break;
|
---|
5013 | }
|
---|
5014 | return EXCEPTION_CONTINUE_SEARCH;
|
---|
5015 | }
|
---|
5016 |
|
---|
5017 | static void vboxVDbgVEHandlerRegister(void)
|
---|
5018 | {
|
---|
5019 | Assert(!g_VBoxWDbgVEHandler);
|
---|
5020 | g_VBoxWDbgVEHandler = AddVectoredExceptionHandler(1, vboxVDbgVectoredHandler);
|
---|
5021 | Assert(g_VBoxWDbgVEHandler);
|
---|
5022 |
|
---|
5023 | g_hModPsapi = GetModuleHandleA("Psapi.dll"); /* Usually already loaded. */
|
---|
5024 | if (g_hModPsapi)
|
---|
5025 | g_pfnGetModuleInformation = (PFNGetModuleInformation)GetProcAddress(g_hModPsapi, "GetModuleInformation");
|
---|
5026 | }
|
---|
5027 |
|
---|
5028 | static void vboxVDbgVEHandlerUnregister(void)
|
---|
5029 | {
|
---|
5030 | Assert(g_VBoxWDbgVEHandler);
|
---|
5031 | ULONG uResult = RemoveVectoredExceptionHandler(g_VBoxWDbgVEHandler);
|
---|
5032 | Assert(uResult); RT_NOREF(uResult);
|
---|
5033 | g_VBoxWDbgVEHandler = NULL;
|
---|
5034 |
|
---|
5035 | g_hModPsapi = NULL;
|
---|
5036 | g_pfnGetModuleInformation = NULL;
|
---|
5037 | }
|
---|
5038 | #endif /* DEBUG */
|
---|
5039 |
|
---|
5040 |
|
---|
5041 | /**
|
---|
5042 | * DLL entry point.
|
---|
5043 | */
|
---|
5044 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
---|
5045 | {
|
---|
5046 | RT_NOREF(hInstance, lpReserved);
|
---|
5047 |
|
---|
5048 | switch (dwReason)
|
---|
5049 | {
|
---|
5050 | case DLL_PROCESS_ATTACH:
|
---|
5051 | {
|
---|
5052 | #ifdef DEBUG
|
---|
5053 | vboxVDbgVEHandlerRegister();
|
---|
5054 | #endif
|
---|
5055 | D3DKMTLoad(); /* For logging via the miniport driver. */
|
---|
5056 |
|
---|
5057 | int rc = RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
|
---|
5058 | AssertRC(rc);
|
---|
5059 | if (RT_SUCCESS(rc))
|
---|
5060 | {
|
---|
5061 | /* Create a logger. Ignore failure to do so. */
|
---|
5062 | static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
|
---|
5063 | PRTLOGGER pLogger;
|
---|
5064 | int rc2 = RTLogCreate(&pLogger, RTLOGFLAGS_USECRLF, "+default.e.l.f", "VBOX_LOG",
|
---|
5065 | RT_ELEMENTS(s_apszGroups), &s_apszGroups[0], RTLOGDEST_USER /* backdoor */, NULL);
|
---|
5066 | AssertRC(rc2);
|
---|
5067 | if (RT_SUCCESS(rc2))
|
---|
5068 | {
|
---|
5069 | RTLogSetDefaultInstance(pLogger);
|
---|
5070 | RTLogRelSetDefaultInstance(pLogger);
|
---|
5071 | }
|
---|
5072 |
|
---|
5073 | LogFlow(("VBoxDX: Built %s %s", __DATE__, __TIME__));
|
---|
5074 | return TRUE;
|
---|
5075 | }
|
---|
5076 |
|
---|
5077 | #ifdef DEBUG
|
---|
5078 | vboxVDbgVEHandlerUnregister();
|
---|
5079 | #endif
|
---|
5080 | break;
|
---|
5081 | }
|
---|
5082 |
|
---|
5083 | case DLL_PROCESS_DETACH:
|
---|
5084 | {
|
---|
5085 | LogFlow(("VBoxDX: DLL_PROCESS_DETACH"));
|
---|
5086 | /// @todo RTR3Term();
|
---|
5087 | #ifdef DEBUG
|
---|
5088 | vboxVDbgVEHandlerUnregister();
|
---|
5089 | #endif
|
---|
5090 | return TRUE;
|
---|
5091 | }
|
---|
5092 |
|
---|
5093 | default:
|
---|
5094 | return TRUE;
|
---|
5095 | }
|
---|
5096 | return FALSE;
|
---|
5097 | }
|
---|