1/**************************************************************************
2 *
3 * Copyright 2012-2021 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 **************************************************************************/
27
28/*
29 * Device.cpp --
30 *    Functions that provide the 3D device functionality.
31 */
32
33
34#include "Draw.h"
35#include "DxgiFns.h"
36#include "InputAssembly.h"
37#include "OutputMerger.h"
38#include "Query.h"
39#include "Rasterizer.h"
40#include "Resource.h"
41#include "Shader.h"
42#include "State.h"
43#include "Format.h"
44
45#include "Debug.h"
46
47#include "util/u_sampler.h"
48
49
50static void APIENTRY DestroyDevice(D3D10DDI_HDEVICE hDevice);
51static void APIENTRY RelocateDeviceFuncs(D3D10DDI_HDEVICE hDevice,
52                                __in struct D3D10DDI_DEVICEFUNCS *pDeviceFunctions);
53static void APIENTRY RelocateDeviceFuncs1(D3D10DDI_HDEVICE hDevice,
54                                __in struct D3D10_1DDI_DEVICEFUNCS *pDeviceFunctions);
55static void APIENTRY Flush(D3D10DDI_HDEVICE hDevice);
56static void APIENTRY CheckFormatSupport(D3D10DDI_HDEVICE hDevice, DXGI_FORMAT Format,
57                               __out UINT *pFormatCaps);
58static void APIENTRY CheckMultisampleQualityLevels(D3D10DDI_HDEVICE hDevice,
59                                          DXGI_FORMAT Format,
60                                          UINT SampleCount,
61                                          __out UINT *pNumQualityLevels);
62static void APIENTRY SetTextFilterSize(D3D10DDI_HDEVICE hDevice, UINT Width, UINT Height);
63
64
65/*
66 * ----------------------------------------------------------------------
67 *
68 * CalcPrivateDeviceSize --
69 *
70 *    The CalcPrivateDeviceSize function determines the size of a memory
71 *    region that the user-mode display driver requires from the Microsoft
72 *    Direct3D runtime to store frequently-accessed data.
73 *
74 * ----------------------------------------------------------------------
75 */
76
77SIZE_T APIENTRY
78CalcPrivateDeviceSize(D3D10DDI_HADAPTER hAdapter,                          // IN
79                      __in const D3D10DDIARG_CALCPRIVATEDEVICESIZE *pData) // IN
80{
81   return sizeof(Device);
82}
83
84/*
85 * ----------------------------------------------------------------------
86 *
87 * CreateDevice --
88 *
89 *    The CreateDevice function creates a graphics context that is
90 *    referenced in subsequent calls.
91 *
92 * ----------------------------------------------------------------------
93 */
94
95HRESULT APIENTRY
96CreateDevice(D3D10DDI_HADAPTER hAdapter,                 // IN
97             __in D3D10DDIARG_CREATEDEVICE *pCreateData) // IN
98{
99   LOG_ENTRYPOINT();
100
101   if (0) {
102      DebugPrintf("hAdapter = %p\n", hAdapter);
103      DebugPrintf("pKTCallbacks = %p\n", pCreateData->pKTCallbacks);
104      DebugPrintf("p10_1DeviceFuncs = %p\n", pCreateData->p10_1DeviceFuncs);
105      DebugPrintf("hDrvDevice = %p\n", pCreateData->hDrvDevice);
106      DebugPrintf("DXGIBaseDDI = %p\n", pCreateData->DXGIBaseDDI);
107      DebugPrintf("hRTCoreLayer = %p\n", pCreateData->hRTCoreLayer);
108      DebugPrintf("pUMCallbacks = %p\n", pCreateData->pUMCallbacks);
109   }
110
111   switch (pCreateData->Interface) {
112   case D3D10_0_DDI_INTERFACE_VERSION:
113   case D3D10_0_x_DDI_INTERFACE_VERSION:
114   case D3D10_0_7_DDI_INTERFACE_VERSION:
115#if SUPPORT_D3D10_1
116   case D3D10_1_DDI_INTERFACE_VERSION:
117   case D3D10_1_x_DDI_INTERFACE_VERSION:
118   case D3D10_1_7_DDI_INTERFACE_VERSION:
119#endif
120      break;
121   default:
122      DebugPrintf("%s: unsupported interface version 0x%08x\n",
123                  __FUNCTION__, pCreateData->Interface);
124      return E_FAIL;
125   }
126
127   Adapter *pAdapter = CastAdapter(hAdapter);
128
129   Device *pDevice = CastDevice(pCreateData->hDrvDevice);
130   memset(pDevice, 0, sizeof *pDevice);
131
132   struct pipe_screen *screen = pAdapter->screen;
133   struct pipe_context *pipe = screen->context_create(screen, NULL, 0);
134   pDevice->pipe = pipe;
135
136   pDevice->empty_vs = CreateEmptyShader(pDevice, PIPE_SHADER_VERTEX);
137   pDevice->empty_fs = CreateEmptyShader(pDevice, PIPE_SHADER_FRAGMENT);
138
139   pipe->bind_vs_state(pipe, pDevice->empty_vs);
140   pipe->bind_fs_state(pipe, pDevice->empty_fs);
141
142   pDevice->max_dual_source_render_targets =
143         screen->get_param(screen, PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS);
144
145   pDevice->hRTCoreLayer = pCreateData->hRTCoreLayer;
146   pDevice->hDevice = (HANDLE)pCreateData->hRTDevice.handle;
147   pDevice->KTCallbacks = *pCreateData->pKTCallbacks;
148   pDevice->UMCallbacks = *pCreateData->pUMCallbacks;
149   pDevice->pDXGIBaseCallbacks = pCreateData->DXGIBaseDDI.pDXGIBaseCallbacks;
150
151   pDevice->draw_so_target = NULL;
152
153   if (0) {
154      DebugPrintf("pDevice = %p\n", pDevice);
155   }
156
157   st_debug_parse();
158
159   /*
160    * Fill in the D3D10 DDI functions
161    */
162   D3D10DDI_DEVICEFUNCS *pDeviceFuncs = pCreateData->pDeviceFuncs;
163   pDeviceFuncs->pfnDefaultConstantBufferUpdateSubresourceUP = ResourceUpdateSubResourceUP;
164   pDeviceFuncs->pfnVsSetConstantBuffers = VsSetConstantBuffers;
165   pDeviceFuncs->pfnPsSetShaderResources = PsSetShaderResources;
166   pDeviceFuncs->pfnPsSetShader = PsSetShader;
167   pDeviceFuncs->pfnPsSetSamplers = PsSetSamplers;
168   pDeviceFuncs->pfnVsSetShader = VsSetShader;
169   pDeviceFuncs->pfnDrawIndexed = DrawIndexed;
170   pDeviceFuncs->pfnDraw = Draw;
171   pDeviceFuncs->pfnDynamicIABufferMapNoOverwrite = ResourceMap;
172   pDeviceFuncs->pfnDynamicIABufferUnmap = ResourceUnmap;
173   pDeviceFuncs->pfnDynamicConstantBufferMapDiscard = ResourceMap;
174   pDeviceFuncs->pfnDynamicIABufferMapDiscard = ResourceMap;
175   pDeviceFuncs->pfnDynamicConstantBufferUnmap = ResourceUnmap;
176   pDeviceFuncs->pfnPsSetConstantBuffers = PsSetConstantBuffers;
177   pDeviceFuncs->pfnIaSetInputLayout = IaSetInputLayout;
178   pDeviceFuncs->pfnIaSetVertexBuffers = IaSetVertexBuffers;
179   pDeviceFuncs->pfnIaSetIndexBuffer = IaSetIndexBuffer;
180   pDeviceFuncs->pfnDrawIndexedInstanced = DrawIndexedInstanced;
181   pDeviceFuncs->pfnDrawInstanced = DrawInstanced;
182   pDeviceFuncs->pfnDynamicResourceMapDiscard = ResourceMap;
183   pDeviceFuncs->pfnDynamicResourceUnmap = ResourceUnmap;
184   pDeviceFuncs->pfnGsSetConstantBuffers = GsSetConstantBuffers;
185   pDeviceFuncs->pfnGsSetShader = GsSetShader;
186   pDeviceFuncs->pfnIaSetTopology = IaSetTopology;
187   pDeviceFuncs->pfnStagingResourceMap = ResourceMap;
188   pDeviceFuncs->pfnStagingResourceUnmap = ResourceUnmap;
189   pDeviceFuncs->pfnVsSetShaderResources = VsSetShaderResources;
190   pDeviceFuncs->pfnVsSetSamplers = VsSetSamplers;
191   pDeviceFuncs->pfnGsSetShaderResources = GsSetShaderResources;
192   pDeviceFuncs->pfnGsSetSamplers = GsSetSamplers;
193   pDeviceFuncs->pfnSetRenderTargets = SetRenderTargets;
194   pDeviceFuncs->pfnShaderResourceViewReadAfterWriteHazard = ShaderResourceViewReadAfterWriteHazard;
195   pDeviceFuncs->pfnResourceReadAfterWriteHazard = ResourceReadAfterWriteHazard;
196   pDeviceFuncs->pfnSetBlendState = SetBlendState;
197   pDeviceFuncs->pfnSetDepthStencilState = SetDepthStencilState;
198   pDeviceFuncs->pfnSetRasterizerState = SetRasterizerState;
199   pDeviceFuncs->pfnQueryEnd = QueryEnd;
200   pDeviceFuncs->pfnQueryBegin = QueryBegin;
201   pDeviceFuncs->pfnResourceCopyRegion = ResourceCopyRegion;
202   pDeviceFuncs->pfnResourceUpdateSubresourceUP = ResourceUpdateSubResourceUP;
203   pDeviceFuncs->pfnSoSetTargets = SoSetTargets;
204   pDeviceFuncs->pfnDrawAuto = DrawAuto;
205   pDeviceFuncs->pfnSetViewports = SetViewports;
206   pDeviceFuncs->pfnSetScissorRects = SetScissorRects;
207   pDeviceFuncs->pfnClearRenderTargetView = ClearRenderTargetView;
208   pDeviceFuncs->pfnClearDepthStencilView = ClearDepthStencilView;
209   pDeviceFuncs->pfnSetPredication = SetPredication;
210   pDeviceFuncs->pfnQueryGetData = QueryGetData;
211   pDeviceFuncs->pfnFlush = Flush;
212   pDeviceFuncs->pfnGenMips = GenMips;
213   pDeviceFuncs->pfnResourceCopy = ResourceCopy;
214   pDeviceFuncs->pfnResourceResolveSubresource = ResourceResolveSubResource;
215   pDeviceFuncs->pfnResourceMap = ResourceMap;
216   pDeviceFuncs->pfnResourceUnmap = ResourceUnmap;
217   pDeviceFuncs->pfnResourceIsStagingBusy = ResourceIsStagingBusy;
218   pDeviceFuncs->pfnRelocateDeviceFuncs = RelocateDeviceFuncs;
219   pDeviceFuncs->pfnCalcPrivateResourceSize = CalcPrivateResourceSize;
220   pDeviceFuncs->pfnCalcPrivateOpenedResourceSize = CalcPrivateOpenedResourceSize;
221   pDeviceFuncs->pfnCreateResource = CreateResource;
222   pDeviceFuncs->pfnOpenResource = OpenResource;
223   pDeviceFuncs->pfnDestroyResource = DestroyResource;
224   pDeviceFuncs->pfnCalcPrivateShaderResourceViewSize = CalcPrivateShaderResourceViewSize;
225   pDeviceFuncs->pfnCreateShaderResourceView = CreateShaderResourceView;
226   pDeviceFuncs->pfnDestroyShaderResourceView = DestroyShaderResourceView;
227   pDeviceFuncs->pfnCalcPrivateRenderTargetViewSize = CalcPrivateRenderTargetViewSize;
228   pDeviceFuncs->pfnCreateRenderTargetView = CreateRenderTargetView;
229   pDeviceFuncs->pfnDestroyRenderTargetView = DestroyRenderTargetView;
230   pDeviceFuncs->pfnCalcPrivateDepthStencilViewSize = CalcPrivateDepthStencilViewSize;
231   pDeviceFuncs->pfnCreateDepthStencilView = CreateDepthStencilView;
232   pDeviceFuncs->pfnDestroyDepthStencilView = DestroyDepthStencilView;
233   pDeviceFuncs->pfnCalcPrivateElementLayoutSize = CalcPrivateElementLayoutSize;
234   pDeviceFuncs->pfnCreateElementLayout = CreateElementLayout;
235   pDeviceFuncs->pfnDestroyElementLayout = DestroyElementLayout;
236   pDeviceFuncs->pfnCalcPrivateBlendStateSize = CalcPrivateBlendStateSize;
237   pDeviceFuncs->pfnCreateBlendState = CreateBlendState;
238   pDeviceFuncs->pfnDestroyBlendState = DestroyBlendState;
239   pDeviceFuncs->pfnCalcPrivateDepthStencilStateSize = CalcPrivateDepthStencilStateSize;
240   pDeviceFuncs->pfnCreateDepthStencilState = CreateDepthStencilState;
241   pDeviceFuncs->pfnDestroyDepthStencilState = DestroyDepthStencilState;
242   pDeviceFuncs->pfnCalcPrivateRasterizerStateSize = CalcPrivateRasterizerStateSize;
243   pDeviceFuncs->pfnCreateRasterizerState = CreateRasterizerState;
244   pDeviceFuncs->pfnDestroyRasterizerState = DestroyRasterizerState;
245   pDeviceFuncs->pfnCalcPrivateShaderSize = CalcPrivateShaderSize;
246   pDeviceFuncs->pfnCreateVertexShader = CreateVertexShader;
247   pDeviceFuncs->pfnCreateGeometryShader = CreateGeometryShader;
248   pDeviceFuncs->pfnCreatePixelShader = CreatePixelShader;
249   pDeviceFuncs->pfnCalcPrivateGeometryShaderWithStreamOutput = CalcPrivateGeometryShaderWithStreamOutput;
250   pDeviceFuncs->pfnCreateGeometryShaderWithStreamOutput = CreateGeometryShaderWithStreamOutput;
251   pDeviceFuncs->pfnDestroyShader = DestroyShader;
252   pDeviceFuncs->pfnCalcPrivateSamplerSize = CalcPrivateSamplerSize;
253   pDeviceFuncs->pfnCreateSampler = CreateSampler;
254   pDeviceFuncs->pfnDestroySampler = DestroySampler;
255   pDeviceFuncs->pfnCalcPrivateQuerySize = CalcPrivateQuerySize;
256   pDeviceFuncs->pfnCreateQuery = CreateQuery;
257   pDeviceFuncs->pfnDestroyQuery = DestroyQuery;
258   pDeviceFuncs->pfnCheckFormatSupport = CheckFormatSupport;
259   pDeviceFuncs->pfnCheckMultisampleQualityLevels = CheckMultisampleQualityLevels;
260   pDeviceFuncs->pfnCheckCounterInfo = CheckCounterInfo;
261   pDeviceFuncs->pfnCheckCounter = CheckCounter;
262   pDeviceFuncs->pfnDestroyDevice = DestroyDevice;
263   pDeviceFuncs->pfnSetTextFilterSize = SetTextFilterSize;
264   if (pCreateData->Interface == D3D10_1_DDI_INTERFACE_VERSION ||
265       pCreateData->Interface == D3D10_1_x_DDI_INTERFACE_VERSION ||
266       pCreateData->Interface == D3D10_1_7_DDI_INTERFACE_VERSION) {
267      D3D10_1DDI_DEVICEFUNCS *p10_1DeviceFuncs = pCreateData->p10_1DeviceFuncs;
268      p10_1DeviceFuncs->pfnRelocateDeviceFuncs = RelocateDeviceFuncs1;
269      p10_1DeviceFuncs->pfnCalcPrivateShaderResourceViewSize = CalcPrivateShaderResourceViewSize1;
270      p10_1DeviceFuncs->pfnCreateShaderResourceView = CreateShaderResourceView1;
271      p10_1DeviceFuncs->pfnCalcPrivateBlendStateSize = CalcPrivateBlendStateSize1;
272      p10_1DeviceFuncs->pfnCreateBlendState = CreateBlendState1;
273      p10_1DeviceFuncs->pfnResourceConvert = ResourceCopy;
274      p10_1DeviceFuncs->pfnResourceConvertRegion = ResourceCopyRegion;
275   }
276
277   /*
278    * Fill in DXGI DDI functions
279    */
280   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnPresent =
281      _Present;
282   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnGetGammaCaps =
283      _GetGammaCaps;
284   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnSetDisplayMode =
285      _SetDisplayMode;
286   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnSetResourcePriority =
287      _SetResourcePriority;
288   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnQueryResourceResidency =
289      _QueryResourceResidency;
290   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnRotateResourceIdentities =
291      _RotateResourceIdentities;
292   pCreateData->DXGIBaseDDI.pDXGIDDIBaseFunctions->pfnBlt =
293      _Blt;
294
295   if (0) {
296      return S_OK;
297   } else {
298      // Tell DXGI to not use the shared resource presentation path when
299      // communicating with DWM:
300      // http://msdn.microsoft.com/en-us/library/windows/hardware/ff569887(v=vs.85).aspx
301      return DXGI_STATUS_NO_REDIRECTION;
302   }
303}
304
305
306/*
307 * ----------------------------------------------------------------------
308 *
309 * DestroyDevice --
310 *
311 *    The DestroyDevice function destroys a graphics context.
312 *
313 * ----------------------------------------------------------------------
314 */
315
316void APIENTRY
317DestroyDevice(D3D10DDI_HDEVICE hDevice)   // IN
318{
319   unsigned i;
320
321   LOG_ENTRYPOINT();
322
323   Device *pDevice = CastDevice(hDevice);
324   struct pipe_context *pipe = pDevice->pipe;
325
326   pipe->flush(pipe, NULL, 0);
327
328   for (i = 0; i < PIPE_MAX_SO_BUFFERS; ++i) {
329      pipe_so_target_reference(&pDevice->so_targets[i], NULL);
330   }
331   if (pDevice->draw_so_target) {
332      pipe_so_target_reference(&pDevice->draw_so_target, NULL);
333   }
334
335   pipe->bind_fs_state(pipe, NULL);
336   pipe->bind_vs_state(pipe, NULL);
337
338   DeleteEmptyShader(pDevice, PIPE_SHADER_FRAGMENT, pDevice->empty_fs);
339   DeleteEmptyShader(pDevice, PIPE_SHADER_VERTEX, pDevice->empty_vs);
340
341   pipe_surface_reference(&pDevice->fb.zsbuf, NULL);
342   for (i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) {
343      pipe_surface_reference(&pDevice->fb.cbufs[i], NULL);
344   }
345
346   for (i = 0; i < PIPE_MAX_ATTRIBS; ++i) {
347      if (!pDevice->vertex_buffers[i].is_user_buffer) {
348         pipe_resource_reference(&pDevice->vertex_buffers[i].buffer.resource, NULL);
349      }
350   }
351
352   pipe_resource_reference(&pDevice->index_buffer, NULL);
353
354   static struct pipe_sampler_view * sampler_views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
355   memset(sampler_views, 0, sizeof sampler_views);
356   pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
357                           PIPE_MAX_SHADER_SAMPLER_VIEWS, 0, false, sampler_views);
358   pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0,
359                           PIPE_MAX_SHADER_SAMPLER_VIEWS, 0, false, sampler_views);
360   pipe->set_sampler_views(pipe, PIPE_SHADER_GEOMETRY, 0,
361                           PIPE_MAX_SHADER_SAMPLER_VIEWS, 0, false, sampler_views);
362
363   pipe->destroy(pipe);
364}
365
366
367/*
368 * ----------------------------------------------------------------------
369 *
370 * RelocateDeviceFuncs --
371 *
372 *    The RelocateDeviceFuncs function notifies the user-mode
373 *    display driver about the new location of the driver function table.
374 *
375 * ----------------------------------------------------------------------
376 */
377
378void APIENTRY
379RelocateDeviceFuncs(D3D10DDI_HDEVICE hDevice,                           // IN
380                    __in struct D3D10DDI_DEVICEFUNCS *pDeviceFunctions) // IN
381{
382   LOG_ENTRYPOINT();
383
384   /*
385    * Nothing to do as we don't store a pointer to this entity.
386    */
387}
388
389
390/*
391 * ----------------------------------------------------------------------
392 *
393 * RelocateDeviceFuncs1 --
394 *
395 *    The RelocateDeviceFuncs function notifies the user-mode
396 *    display driver about the new location of the driver function table.
397 *
398 * ----------------------------------------------------------------------
399 */
400
401void APIENTRY
402RelocateDeviceFuncs1(D3D10DDI_HDEVICE hDevice,                           // IN
403                    __in struct D3D10_1DDI_DEVICEFUNCS *pDeviceFunctions) // IN
404{
405   LOG_ENTRYPOINT();
406
407   /*
408    * Nothing to do as we don't store a pointer to this entity.
409    */
410}
411
412
413/*
414 * ----------------------------------------------------------------------
415 *
416 * Flush --
417 *
418 *    The Flush function submits outstanding hardware commands that
419 *    are in the hardware command buffer to the display miniport driver.
420 *
421 * ----------------------------------------------------------------------
422 */
423
424void APIENTRY
425Flush(D3D10DDI_HDEVICE hDevice)  // IN
426{
427   LOG_ENTRYPOINT();
428
429   struct pipe_context *pipe = CastPipeContext(hDevice);
430
431   pipe->flush(pipe, NULL, 0);
432}
433
434
435/*
436 * ----------------------------------------------------------------------
437 *
438 * CheckFormatSupport --
439 *
440 *    The CheckFormatSupport function retrieves the capabilites that
441 *    the device has with the specified format.
442 *
443 * ----------------------------------------------------------------------
444 */
445
446void APIENTRY
447CheckFormatSupport(D3D10DDI_HDEVICE hDevice, // IN
448                   DXGI_FORMAT Format,       // IN
449                   __out UINT *pFormatCaps)  // OUT
450{
451   //LOG_ENTRYPOINT();
452
453   struct pipe_context *pipe = CastPipeContext(hDevice);
454   struct pipe_screen *screen = pipe->screen;
455
456   *pFormatCaps = 0;
457
458   enum pipe_format format = FormatTranslate(Format, FALSE);
459   if (format == PIPE_FORMAT_NONE) {
460      *pFormatCaps = D3D10_DDI_FORMAT_SUPPORT_NOT_SUPPORTED;
461      return;
462   }
463
464   if (Format == DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) {
465      /*
466       * We only need to support creation.
467       * http://msdn.microsoft.com/en-us/library/windows/hardware/ff552818.aspx
468       */
469      return;
470   }
471
472   if (screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0,
473                                   PIPE_BIND_RENDER_TARGET)) {
474      *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_RENDERTARGET;
475      *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_BLENDABLE;
476
477#if SUPPORT_MSAA
478      if (screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 4, 4,
479                                      PIPE_BIND_RENDER_TARGET)) {
480         *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET;
481      }
482#endif
483   }
484
485   if (screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0,
486                                   PIPE_BIND_SAMPLER_VIEW)) {
487      *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_SHADER_SAMPLE;
488
489#if SUPPORT_MSAA
490      if (screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 4, 4,
491                                      PIPE_BIND_RENDER_TARGET)) {
492         *pFormatCaps |= D3D10_DDI_FORMAT_SUPPORT_MULTISAMPLE_LOAD;
493      }
494#endif
495   }
496}
497
498
499/*
500 * ----------------------------------------------------------------------
501 *
502 * CheckMultisampleQualityLevels --
503 *
504 *    The CheckMultisampleQualityLevels function retrieves the number
505 *    of quality levels that the device supports for the specified
506 *    number of samples.
507 *
508 * ----------------------------------------------------------------------
509 */
510
511void APIENTRY
512CheckMultisampleQualityLevels(D3D10DDI_HDEVICE hDevice,        // IN
513                              DXGI_FORMAT Format,              // IN
514                              UINT SampleCount,                // IN
515                              __out UINT *pNumQualityLevels)   // OUT
516{
517   //LOG_ENTRYPOINT();
518
519   /* XXX: Disable MSAA */
520   *pNumQualityLevels = 0;
521}
522
523
524/*
525 * ----------------------------------------------------------------------
526 *
527 * SetTextFilterSize --
528 *
529 *    The SetTextFilterSize function sets the width and height
530 *    of the monochrome convolution filter.
531 *
532 * ----------------------------------------------------------------------
533 */
534
535void APIENTRY
536SetTextFilterSize(D3D10DDI_HDEVICE hDevice,  // IN
537                  UINT Width,                // IN
538                  UINT Height)               // IN
539{
540   LOG_ENTRYPOINT();
541
542   LOG_UNSUPPORTED(Width != 1 || Height != 1);
543}
544