VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp@ 98131

Last change on this file since 98131 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 53.6 KB
Line 
1/* $Id: DevVGA-SVGA3d-shared.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * DevVMWare - VMWare SVGA device
4 */
5
6/*
7 * Copyright (C) 2013-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
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#define LOG_GROUP LOG_GROUP_DEV_VMSVGA
33#include <VBox/vmm/pdmdev.h>
34#include <VBox/version.h>
35#include <iprt/errcore.h>
36#include <VBox/log.h>
37#include <VBox/vmm/pgm.h>
38
39#include <iprt/assert.h>
40#include <iprt/semaphore.h>
41#include <iprt/uuid.h>
42#include <iprt/mem.h>
43#include <iprt/avl.h>
44
45#include <VBoxVideo.h> /* required by DevVGA.h */
46
47/* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
48#include "DevVGA.h"
49
50#include "DevVGA-SVGA.h"
51#include "DevVGA-SVGA3d.h"
52#define VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
53#include "DevVGA-SVGA3d-internal.h"
54
55
56#ifdef RT_OS_WINDOWS
57# define VMSVGA3D_WNDCLASSNAME L"VMSVGA3DWNDCLS"
58
59static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
60
61
62/**
63 * Send a message to the async window thread and wait for a reply
64 *
65 * @returns VBox status code.
66 * @param pWindowThread Thread handle
67 * @param WndRequestSem Semaphore handle for waiting
68 * @param msg Message id
69 * @param wParam First parameter
70 * @param lParam Second parameter
71 */
72int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam)
73{
74 int rc;
75 BOOL ret;
76
77 ret = PostThreadMessage(RTThreadGetNative(pWindowThread), msg, wParam, lParam);
78 AssertMsgReturn(ret, ("PostThreadMessage %x failed with %d\n", RTThreadGetNative(pWindowThread), GetLastError()), VERR_INTERNAL_ERROR);
79
80 rc = RTSemEventWait(WndRequestSem, RT_INDEFINITE_WAIT);
81 Assert(RT_SUCCESS(rc));
82
83 return rc;
84}
85
86/**
87 * The async window handling thread
88 *
89 * @returns VBox status code.
90 * @param hThreadSelf This thread.
91 * @param pvUser Request sempahore handle.
92 */
93DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD hThreadSelf, void *pvUser)
94{
95 RT_NOREF(hThreadSelf);
96 RTSEMEVENT WndRequestSem = (RTSEMEVENT)pvUser;
97 WNDCLASSEXW wc;
98
99 /* Register our own window class. */
100 wc.cbSize = sizeof(wc);
101 wc.style = CS_OWNDC;
102 wc.lpfnWndProc = (WNDPROC)vmsvga3dWndProc;
103 wc.cbClsExtra = 0;
104 wc.cbWndExtra = 0;
105 wc.hInstance = GetModuleHandle("VBoxDD.dll"); /** @todo hardcoded name.. */
106 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
107 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
108 wc.hbrBackground = NULL;
109 wc.lpszMenuName = NULL;
110 wc.lpszClassName = VMSVGA3D_WNDCLASSNAME;
111 wc.hIconSm = NULL;
112
113 if (!RegisterClassExW(&wc))
114 {
115 Log(("RegisterClass failed with %x\n", GetLastError()));
116 return VERR_INTERNAL_ERROR;
117 }
118
119 LogFlow(("vmsvga3dWindowThread: started loop\n"));
120 while (true)
121 {
122 MSG msg;
123 if (GetMessage(&msg, 0, 0, 0))
124 {
125 if (msg.message == WM_VMSVGA3D_EXIT)
126 {
127 /* Signal to the caller that we're done. */
128 RTSemEventSignal(WndRequestSem);
129 break;
130 }
131
132 if (msg.message == WM_VMSVGA3D_WAKEUP)
133 {
134 continue;
135 }
136
137 if (msg.message == WM_VMSVGA3D_CREATEWINDOW)
138 {
139 /* Create a context window with minimal 4x4 size. We will never use the swapchain
140 * to present the rendered image. Rendered images from the guest will be copied to
141 * the VMSVGA SCREEN object, which can be either an offscreen render target or
142 * system memory in the guest VRAM. */
143 HWND *phWnd = (HWND *)msg.wParam;
144 HWND hWnd;
145 *phWnd = hWnd = CreateWindowExW(WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY,
146 VMSVGA3D_WNDCLASSNAME,
147 NULL /*pwszName*/,
148 WS_DISABLED,
149 0 /*x*/,
150 0 /*y*/,
151 4 /*cx*/,
152 4 /*cy*/,
153 HWND_DESKTOP /*hwndParent*/,
154 NULL /*hMenu*/,
155 (HINSTANCE)msg.lParam /*hInstance*/,
156 NULL /*WM_CREATE param*/);
157 AssertMsg(hWnd, ("CreateWindowEx %ls, WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY, WS_DISABLED, (0,0)(4,4), HWND_DESKTOP hInstance=%p -> error=%x\n",
158 VMSVGA3D_WNDCLASSNAME, msg.lParam, GetLastError()));
159
160#ifdef VBOX_STRICT
161 /* Must have a non-zero client rectangle! */
162 RECT ClientRect;
163 GetClientRect(hWnd, &ClientRect);
164 Assert(ClientRect.right > ClientRect.left);
165 Assert(ClientRect.bottom > ClientRect.top);
166#endif
167
168 /* Signal to the caller that we're done. */
169 RTSemEventSignal(WndRequestSem);
170 continue;
171 }
172
173 if (msg.message == WM_VMSVGA3D_DESTROYWINDOW)
174 {
175 BOOL fRc = DestroyWindow((HWND)msg.wParam);
176 Assert(fRc); NOREF(fRc);
177
178 /* Signal to the caller that we're done. */
179 RTSemEventSignal(WndRequestSem);
180 continue;
181 }
182
183#if 0 /* in case CreateDeviceEx fails again and we want to eliminat wrong-thread. */
184 if (msg.message == WM_VMSVGA3D_CREATE_DEVICE)
185 {
186 VMSVGA3DCREATEDEVICEPARAMS *pParams = (VMSVGA3DCREATEDEVICEPARAMS *)msg.lParam;
187 pParams->hrc = pParams->pState->pD3D9->CreateDeviceEx(D3DADAPTER_DEFAULT,
188 D3DDEVTYPE_HAL,
189 pParams->pContext->hwnd,
190 D3DCREATE_MULTITHREADED | D3DCREATE_MIXED_VERTEXPROCESSING, //D3DCREATE_HARDWARE_VERTEXPROCESSING,
191 pParams->pPresParams,
192 NULL,
193 &pParams->pContext->pDevice);
194 AssertMsg(pParams->hrc == D3D_OK, ("WM_VMSVGA3D_CREATE_DEVICE: CreateDevice failed with %x\n", pParams->hrc));
195
196 RTSemEventSignal(WndRequestSem);
197 continue;
198 }
199#endif
200
201 TranslateMessage(&msg);
202 DispatchMessage(&msg);
203 }
204 else
205 {
206 Log(("GetMessage failed with %x\n", GetLastError()));
207 break;
208 }
209 }
210
211 Log(("vmsvga3dWindowThread: end loop\n"));
212 return VINF_SUCCESS;
213}
214
215/* Window procedure for our top level window overlays. */
216static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
217{
218 switch (uMsg)
219 {
220 case WM_CREATE:
221 {
222 /* Ditch the title bar (caption) to avoid having a zero height
223 client area as that makes IDirect3D9Ex::CreateDeviceEx fail.
224 For the style adjustment to take place, we must apply the
225 SWP_FRAMECHANGED thru SetWindowPos. */
226 LONG flStyle = GetWindowLongW(hwnd, GWL_STYLE);
227 flStyle &= ~(WS_CAPTION /* both titlebar and border. Some paranoia: */ | WS_THICKFRAME | WS_SYSMENU);
228 SetWindowLong(hwnd, GWL_STYLE, flStyle);
229 SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
230 SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
231 break;
232 }
233
234 case WM_CLOSE:
235 Log7(("vmsvga3dWndProc(%p): WM_CLOSE\n", hwnd));
236 break;
237
238 case WM_DESTROY:
239 Log7(("vmsvga3dWndProc(%p): WM_DESTROY\n", hwnd));
240 break;
241
242 case WM_NCHITTEST:
243 Log7(("vmsvga3dWndProc(%p): WM_NCHITTEST\n", hwnd));
244 return HTNOWHERE;
245
246# if 0 /* flicker experiment, no help here. */
247 case WM_PAINT:
248 Log7(("vmsvga3dWndProc(%p): WM_PAINT %p %p\n", hwnd, wParam, lParam));
249 ValidateRect(hwnd, NULL);
250 return 0;
251 case WM_ERASEBKGND:
252 Log7(("vmsvga3dWndProc(%p): WM_ERASEBKGND %p %p\n", hwnd, wParam, lParam));
253 return TRUE;
254 case WM_NCPAINT:
255 Log7(("vmsvga3dWndProc(%p): WM_NCPAINT %p %p\n", hwnd, wParam, lParam));
256 break;
257 case WM_WINDOWPOSCHANGING:
258 {
259 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
260 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGING %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
261 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
262 break;
263 }
264 case WM_WINDOWPOSCHANGED:
265 {
266 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
267 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGED %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
268 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
269 break;
270 }
271 case WM_MOVE:
272 Log7(("vmsvga3dWndProc(%p): WM_MOVE %p %p\n", hwnd, wParam, lParam));
273 break;
274 case WM_SIZE:
275 Log7(("vmsvga3dWndProc(%p): WM_SIZE %p %p\n", hwnd, wParam, lParam));
276 break;
277
278 default:
279 Log7(("vmsvga3dWndProc(%p): %#x %p %p\n", hwnd, uMsg, wParam, lParam));
280# endif
281 }
282 return DefWindowProc(hwnd, uMsg, wParam, lParam);
283}
284
285int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd)
286{
287 return vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)hInstance);
288}
289
290#endif /* RT_OS_WINDOWS */
291
292
293/**
294 * Calculate the size and dimensions of one block.
295 */
296uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
297 uint32_t *pcxBlock,
298 uint32_t *pcyBlock)
299{
300 uint32_t u32 = 0;
301 if (!pcxBlock) pcxBlock = &u32;
302 if (!pcyBlock) pcyBlock = &u32;
303
304 switch (format)
305 {
306 case SVGA3D_X8R8G8B8:
307 *pcxBlock = 1;
308 *pcyBlock = 1;
309 return 4;
310
311 case SVGA3D_A8R8G8B8:
312 *pcxBlock = 1;
313 *pcyBlock = 1;
314 return 4;
315
316 case SVGA3D_R5G6B5:
317 *pcxBlock = 1;
318 *pcyBlock = 1;
319 return 2;
320
321 case SVGA3D_X1R5G5B5:
322 *pcxBlock = 1;
323 *pcyBlock = 1;
324 return 2;
325
326 case SVGA3D_A1R5G5B5:
327 *pcxBlock = 1;
328 *pcyBlock = 1;
329 return 2;
330
331 case SVGA3D_A4R4G4B4:
332 *pcxBlock = 1;
333 *pcyBlock = 1;
334 return 2;
335
336 case SVGA3D_Z_D32:
337 *pcxBlock = 1;
338 *pcyBlock = 1;
339 return 4;
340
341 case SVGA3D_Z_D16:
342 *pcxBlock = 1;
343 *pcyBlock = 1;
344 return 2;
345
346 case SVGA3D_Z_D24S8:
347 *pcxBlock = 1;
348 *pcyBlock = 1;
349 return 4;
350
351 case SVGA3D_Z_D15S1:
352 *pcxBlock = 1;
353 *pcyBlock = 1;
354 return 2;
355
356 case SVGA3D_LUMINANCE8:
357 *pcxBlock = 1;
358 *pcyBlock = 1;
359 return 1;
360
361 case SVGA3D_LUMINANCE4_ALPHA4:
362 *pcxBlock = 1;
363 *pcyBlock = 1;
364 return 1;
365
366 case SVGA3D_LUMINANCE16:
367 *pcxBlock = 1;
368 *pcyBlock = 1;
369 return 2;
370
371 case SVGA3D_LUMINANCE8_ALPHA8:
372 *pcxBlock = 1;
373 *pcyBlock = 1;
374 return 2;
375
376 case SVGA3D_DXT1:
377 *pcxBlock = 4;
378 *pcyBlock = 4;
379 return 8;
380
381 case SVGA3D_DXT2:
382 *pcxBlock = 4;
383 *pcyBlock = 4;
384 return 16;
385
386 case SVGA3D_DXT3:
387 *pcxBlock = 4;
388 *pcyBlock = 4;
389 return 16;
390
391 case SVGA3D_DXT4:
392 *pcxBlock = 4;
393 *pcyBlock = 4;
394 return 16;
395
396 case SVGA3D_DXT5:
397 *pcxBlock = 4;
398 *pcyBlock = 4;
399 return 16;
400
401 case SVGA3D_BUMPU8V8:
402 *pcxBlock = 1;
403 *pcyBlock = 1;
404 return 2;
405
406 case SVGA3D_BUMPL6V5U5:
407 *pcxBlock = 1;
408 *pcyBlock = 1;
409 return 2;
410
411 case SVGA3D_BUMPX8L8V8U8:
412 *pcxBlock = 1;
413 *pcyBlock = 1;
414 return 4;
415
416 case SVGA3D_FORMAT_DEAD1:
417 *pcxBlock = 1;
418 *pcyBlock = 1;
419 return 3;
420
421 case SVGA3D_ARGB_S10E5:
422 *pcxBlock = 1;
423 *pcyBlock = 1;
424 return 8;
425
426 case SVGA3D_ARGB_S23E8:
427 *pcxBlock = 1;
428 *pcyBlock = 1;
429 return 16;
430
431 case SVGA3D_A2R10G10B10:
432 *pcxBlock = 1;
433 *pcyBlock = 1;
434 return 4;
435
436 case SVGA3D_V8U8:
437 *pcxBlock = 1;
438 *pcyBlock = 1;
439 return 2;
440
441 case SVGA3D_Q8W8V8U8:
442 *pcxBlock = 1;
443 *pcyBlock = 1;
444 return 4;
445
446 case SVGA3D_CxV8U8:
447 *pcxBlock = 1;
448 *pcyBlock = 1;
449 return 2;
450
451 case SVGA3D_X8L8V8U8:
452 *pcxBlock = 1;
453 *pcyBlock = 1;
454 return 4;
455
456 case SVGA3D_A2W10V10U10:
457 *pcxBlock = 1;
458 *pcyBlock = 1;
459 return 4;
460
461 case SVGA3D_ALPHA8:
462 *pcxBlock = 1;
463 *pcyBlock = 1;
464 return 1;
465
466 case SVGA3D_R_S10E5:
467 *pcxBlock = 1;
468 *pcyBlock = 1;
469 return 2;
470
471 case SVGA3D_R_S23E8:
472 *pcxBlock = 1;
473 *pcyBlock = 1;
474 return 4;
475
476 case SVGA3D_RG_S10E5:
477 *pcxBlock = 1;
478 *pcyBlock = 1;
479 return 4;
480
481 case SVGA3D_RG_S23E8:
482 *pcxBlock = 1;
483 *pcyBlock = 1;
484 return 8;
485
486 case SVGA3D_BUFFER:
487 *pcxBlock = 1;
488 *pcyBlock = 1;
489 return 1;
490
491 case SVGA3D_Z_D24X8:
492 *pcxBlock = 1;
493 *pcyBlock = 1;
494 return 4;
495
496 case SVGA3D_V16U16:
497 *pcxBlock = 1;
498 *pcyBlock = 1;
499 return 4;
500
501 case SVGA3D_G16R16:
502 *pcxBlock = 1;
503 *pcyBlock = 1;
504 return 4;
505
506 case SVGA3D_A16B16G16R16:
507 *pcxBlock = 1;
508 *pcyBlock = 1;
509 return 8;
510
511 case SVGA3D_UYVY:
512 *pcxBlock = 2;
513 *pcyBlock = 1;
514 return 4;
515
516 case SVGA3D_YUY2:
517 *pcxBlock = 2;
518 *pcyBlock = 1;
519 return 4;
520
521 case SVGA3D_NV12:
522 *pcxBlock = 2;
523 *pcyBlock = 2;
524 return 6;
525
526 case SVGA3D_FORMAT_DEAD2:
527 *pcxBlock = 1;
528 *pcyBlock = 1;
529 return 4;
530
531 case SVGA3D_R32G32B32A32_TYPELESS:
532 *pcxBlock = 1;
533 *pcyBlock = 1;
534 return 16;
535
536 case SVGA3D_R32G32B32A32_UINT:
537 *pcxBlock = 1;
538 *pcyBlock = 1;
539 return 16;
540
541 case SVGA3D_R32G32B32A32_SINT:
542 *pcxBlock = 1;
543 *pcyBlock = 1;
544 return 16;
545
546 case SVGA3D_R32G32B32_TYPELESS:
547 *pcxBlock = 1;
548 *pcyBlock = 1;
549 return 12;
550
551 case SVGA3D_R32G32B32_FLOAT:
552 *pcxBlock = 1;
553 *pcyBlock = 1;
554 return 12;
555
556 case SVGA3D_R32G32B32_UINT:
557 *pcxBlock = 1;
558 *pcyBlock = 1;
559 return 12;
560
561 case SVGA3D_R32G32B32_SINT:
562 *pcxBlock = 1;
563 *pcyBlock = 1;
564 return 12;
565
566 case SVGA3D_R16G16B16A16_TYPELESS:
567 *pcxBlock = 1;
568 *pcyBlock = 1;
569 return 8;
570
571 case SVGA3D_R16G16B16A16_UINT:
572 *pcxBlock = 1;
573 *pcyBlock = 1;
574 return 8;
575
576 case SVGA3D_R16G16B16A16_SNORM:
577 *pcxBlock = 1;
578 *pcyBlock = 1;
579 return 8;
580
581 case SVGA3D_R16G16B16A16_SINT:
582 *pcxBlock = 1;
583 *pcyBlock = 1;
584 return 8;
585
586 case SVGA3D_R32G32_TYPELESS:
587 *pcxBlock = 1;
588 *pcyBlock = 1;
589 return 8;
590
591 case SVGA3D_R32G32_UINT:
592 *pcxBlock = 1;
593 *pcyBlock = 1;
594 return 8;
595
596 case SVGA3D_R32G32_SINT:
597 *pcxBlock = 1;
598 *pcyBlock = 1;
599 return 8;
600
601 case SVGA3D_R32G8X24_TYPELESS:
602 *pcxBlock = 1;
603 *pcyBlock = 1;
604 return 8;
605
606 case SVGA3D_D32_FLOAT_S8X24_UINT:
607 *pcxBlock = 1;
608 *pcyBlock = 1;
609 return 8;
610
611 case SVGA3D_R32_FLOAT_X8X24:
612 *pcxBlock = 1;
613 *pcyBlock = 1;
614 return 8;
615
616 case SVGA3D_X32_G8X24_UINT:
617 *pcxBlock = 1;
618 *pcyBlock = 1;
619 return 8;
620
621 case SVGA3D_R10G10B10A2_TYPELESS:
622 *pcxBlock = 1;
623 *pcyBlock = 1;
624 return 4;
625
626 case SVGA3D_R10G10B10A2_UINT:
627 *pcxBlock = 1;
628 *pcyBlock = 1;
629 return 4;
630
631 case SVGA3D_R11G11B10_FLOAT:
632 *pcxBlock = 1;
633 *pcyBlock = 1;
634 return 4;
635
636 case SVGA3D_R8G8B8A8_TYPELESS:
637 *pcxBlock = 1;
638 *pcyBlock = 1;
639 return 4;
640
641 case SVGA3D_R8G8B8A8_UNORM:
642 *pcxBlock = 1;
643 *pcyBlock = 1;
644 return 4;
645
646 case SVGA3D_R8G8B8A8_UNORM_SRGB:
647 *pcxBlock = 1;
648 *pcyBlock = 1;
649 return 4;
650
651 case SVGA3D_R8G8B8A8_UINT:
652 *pcxBlock = 1;
653 *pcyBlock = 1;
654 return 4;
655
656 case SVGA3D_R8G8B8A8_SINT:
657 *pcxBlock = 1;
658 *pcyBlock = 1;
659 return 4;
660
661 case SVGA3D_R16G16_TYPELESS:
662 *pcxBlock = 1;
663 *pcyBlock = 1;
664 return 4;
665
666 case SVGA3D_R16G16_UINT:
667 *pcxBlock = 1;
668 *pcyBlock = 1;
669 return 4;
670
671 case SVGA3D_R16G16_SINT:
672 *pcxBlock = 1;
673 *pcyBlock = 1;
674 return 4;
675
676 case SVGA3D_R32_TYPELESS:
677 *pcxBlock = 1;
678 *pcyBlock = 1;
679 return 4;
680
681 case SVGA3D_D32_FLOAT:
682 *pcxBlock = 1;
683 *pcyBlock = 1;
684 return 4;
685
686 case SVGA3D_R32_UINT:
687 *pcxBlock = 1;
688 *pcyBlock = 1;
689 return 4;
690
691 case SVGA3D_R32_SINT:
692 *pcxBlock = 1;
693 *pcyBlock = 1;
694 return 4;
695
696 case SVGA3D_R24G8_TYPELESS:
697 *pcxBlock = 1;
698 *pcyBlock = 1;
699 return 4;
700
701 case SVGA3D_D24_UNORM_S8_UINT:
702 *pcxBlock = 1;
703 *pcyBlock = 1;
704 return 4;
705
706 case SVGA3D_R24_UNORM_X8:
707 *pcxBlock = 1;
708 *pcyBlock = 1;
709 return 4;
710
711 case SVGA3D_X24_G8_UINT:
712 *pcxBlock = 1;
713 *pcyBlock = 1;
714 return 4;
715
716 case SVGA3D_R8G8_TYPELESS:
717 *pcxBlock = 1;
718 *pcyBlock = 1;
719 return 2;
720
721 case SVGA3D_R8G8_UNORM:
722 *pcxBlock = 1;
723 *pcyBlock = 1;
724 return 2;
725
726 case SVGA3D_R8G8_UINT:
727 *pcxBlock = 1;
728 *pcyBlock = 1;
729 return 2;
730
731 case SVGA3D_R8G8_SINT:
732 *pcxBlock = 1;
733 *pcyBlock = 1;
734 return 2;
735
736 case SVGA3D_R16_TYPELESS:
737 *pcxBlock = 1;
738 *pcyBlock = 1;
739 return 2;
740
741 case SVGA3D_R16_UNORM:
742 *pcxBlock = 1;
743 *pcyBlock = 1;
744 return 2;
745
746 case SVGA3D_R16_UINT:
747 *pcxBlock = 1;
748 *pcyBlock = 1;
749 return 2;
750
751 case SVGA3D_R16_SNORM:
752 *pcxBlock = 1;
753 *pcyBlock = 1;
754 return 2;
755
756 case SVGA3D_R16_SINT:
757 *pcxBlock = 1;
758 *pcyBlock = 1;
759 return 2;
760
761 case SVGA3D_R8_TYPELESS:
762 *pcxBlock = 1;
763 *pcyBlock = 1;
764 return 1;
765
766 case SVGA3D_R8_UNORM:
767 *pcxBlock = 1;
768 *pcyBlock = 1;
769 return 1;
770
771 case SVGA3D_R8_UINT:
772 *pcxBlock = 1;
773 *pcyBlock = 1;
774 return 1;
775
776 case SVGA3D_R8_SNORM:
777 *pcxBlock = 1;
778 *pcyBlock = 1;
779 return 1;
780
781 case SVGA3D_R8_SINT:
782 *pcxBlock = 1;
783 *pcyBlock = 1;
784 return 1;
785
786 case SVGA3D_P8:
787 *pcxBlock = 1;
788 *pcyBlock = 1;
789 return 1;
790
791 case SVGA3D_R9G9B9E5_SHAREDEXP:
792 *pcxBlock = 1;
793 *pcyBlock = 1;
794 return 4;
795
796 case SVGA3D_R8G8_B8G8_UNORM:
797 *pcxBlock = 2;
798 *pcyBlock = 1;
799 return 4;
800
801 case SVGA3D_G8R8_G8B8_UNORM:
802 *pcxBlock = 2;
803 *pcyBlock = 1;
804 return 4;
805
806 case SVGA3D_BC1_TYPELESS:
807 *pcxBlock = 4;
808 *pcyBlock = 4;
809 return 8;
810
811 case SVGA3D_BC1_UNORM_SRGB:
812 *pcxBlock = 4;
813 *pcyBlock = 4;
814 return 8;
815
816 case SVGA3D_BC2_TYPELESS:
817 *pcxBlock = 4;
818 *pcyBlock = 4;
819 return 16;
820
821 case SVGA3D_BC2_UNORM_SRGB:
822 *pcxBlock = 4;
823 *pcyBlock = 4;
824 return 16;
825
826 case SVGA3D_BC3_TYPELESS:
827 *pcxBlock = 4;
828 *pcyBlock = 4;
829 return 16;
830
831 case SVGA3D_BC3_UNORM_SRGB:
832 *pcxBlock = 4;
833 *pcyBlock = 4;
834 return 16;
835
836 case SVGA3D_BC4_TYPELESS:
837 *pcxBlock = 4;
838 *pcyBlock = 4;
839 return 8;
840
841 case SVGA3D_ATI1:
842 *pcxBlock = 4;
843 *pcyBlock = 4;
844 return 8;
845
846 case SVGA3D_BC4_SNORM:
847 *pcxBlock = 4;
848 *pcyBlock = 4;
849 return 8;
850
851 case SVGA3D_BC5_TYPELESS:
852 *pcxBlock = 4;
853 *pcyBlock = 4;
854 return 16;
855
856 case SVGA3D_ATI2:
857 *pcxBlock = 4;
858 *pcyBlock = 4;
859 return 16;
860
861 case SVGA3D_BC5_SNORM:
862 *pcxBlock = 4;
863 *pcyBlock = 4;
864 return 16;
865
866 case SVGA3D_R10G10B10_XR_BIAS_A2_UNORM:
867 *pcxBlock = 1;
868 *pcyBlock = 1;
869 return 4;
870
871 case SVGA3D_B8G8R8A8_TYPELESS:
872 *pcxBlock = 1;
873 *pcyBlock = 1;
874 return 4;
875
876 case SVGA3D_B8G8R8A8_UNORM_SRGB:
877 *pcxBlock = 1;
878 *pcyBlock = 1;
879 return 4;
880
881 case SVGA3D_B8G8R8X8_TYPELESS:
882 *pcxBlock = 1;
883 *pcyBlock = 1;
884 return 4;
885
886 case SVGA3D_B8G8R8X8_UNORM_SRGB:
887 *pcxBlock = 1;
888 *pcyBlock = 1;
889 return 4;
890
891 case SVGA3D_Z_DF16:
892 *pcxBlock = 1;
893 *pcyBlock = 1;
894 return 2;
895
896 case SVGA3D_Z_DF24:
897 *pcxBlock = 1;
898 *pcyBlock = 1;
899 return 4;
900
901 case SVGA3D_Z_D24S8_INT:
902 *pcxBlock = 1;
903 *pcyBlock = 1;
904 return 4;
905
906 case SVGA3D_YV12:
907 *pcxBlock = 2;
908 *pcyBlock = 2;
909 return 6;
910
911 case SVGA3D_R32G32B32A32_FLOAT:
912 *pcxBlock = 1;
913 *pcyBlock = 1;
914 return 16;
915
916 case SVGA3D_R16G16B16A16_FLOAT:
917 *pcxBlock = 1;
918 *pcyBlock = 1;
919 return 8;
920
921 case SVGA3D_R16G16B16A16_UNORM:
922 *pcxBlock = 1;
923 *pcyBlock = 1;
924 return 8;
925
926 case SVGA3D_R32G32_FLOAT:
927 *pcxBlock = 1;
928 *pcyBlock = 1;
929 return 8;
930
931 case SVGA3D_R10G10B10A2_UNORM:
932 *pcxBlock = 1;
933 *pcyBlock = 1;
934 return 4;
935
936 case SVGA3D_R8G8B8A8_SNORM:
937 *pcxBlock = 1;
938 *pcyBlock = 1;
939 return 4;
940
941 case SVGA3D_R16G16_FLOAT:
942 *pcxBlock = 1;
943 *pcyBlock = 1;
944 return 4;
945
946 case SVGA3D_R16G16_UNORM:
947 *pcxBlock = 1;
948 *pcyBlock = 1;
949 return 4;
950
951 case SVGA3D_R16G16_SNORM:
952 *pcxBlock = 1;
953 *pcyBlock = 1;
954 return 4;
955
956 case SVGA3D_R32_FLOAT:
957 *pcxBlock = 1;
958 *pcyBlock = 1;
959 return 4;
960
961 case SVGA3D_R8G8_SNORM:
962 *pcxBlock = 1;
963 *pcyBlock = 1;
964 return 2;
965
966 case SVGA3D_R16_FLOAT:
967 *pcxBlock = 1;
968 *pcyBlock = 1;
969 return 2;
970
971 case SVGA3D_D16_UNORM:
972 *pcxBlock = 1;
973 *pcyBlock = 1;
974 return 2;
975
976 case SVGA3D_A8_UNORM:
977 *pcxBlock = 1;
978 *pcyBlock = 1;
979 return 1;
980
981 case SVGA3D_BC1_UNORM:
982 *pcxBlock = 4;
983 *pcyBlock = 4;
984 return 8;
985
986 case SVGA3D_BC2_UNORM:
987 *pcxBlock = 4;
988 *pcyBlock = 4;
989 return 16;
990
991 case SVGA3D_BC3_UNORM:
992 *pcxBlock = 4;
993 *pcyBlock = 4;
994 return 16;
995
996 case SVGA3D_B5G6R5_UNORM:
997 *pcxBlock = 1;
998 *pcyBlock = 1;
999 return 2;
1000
1001 case SVGA3D_B5G5R5A1_UNORM:
1002 *pcxBlock = 1;
1003 *pcyBlock = 1;
1004 return 2;
1005
1006 case SVGA3D_B8G8R8A8_UNORM:
1007 *pcxBlock = 1;
1008 *pcyBlock = 1;
1009 return 4;
1010
1011 case SVGA3D_B8G8R8X8_UNORM:
1012 *pcxBlock = 1;
1013 *pcyBlock = 1;
1014 return 4;
1015
1016 case SVGA3D_BC4_UNORM:
1017 *pcxBlock = 4;
1018 *pcyBlock = 4;
1019 return 8;
1020
1021 case SVGA3D_BC5_UNORM:
1022 *pcxBlock = 4;
1023 *pcyBlock = 4;
1024 return 16;
1025
1026 case SVGA3D_B4G4R4A4_UNORM:
1027 *pcxBlock = 1;
1028 *pcyBlock = 1;
1029 return 2;
1030
1031 case SVGA3D_BC6H_TYPELESS:
1032 *pcxBlock = 4;
1033 *pcyBlock = 4;
1034 return 16;
1035
1036 case SVGA3D_BC6H_UF16:
1037 *pcxBlock = 4;
1038 *pcyBlock = 4;
1039 return 16;
1040
1041 case SVGA3D_BC6H_SF16:
1042 *pcxBlock = 4;
1043 *pcyBlock = 4;
1044 return 16;
1045
1046 case SVGA3D_BC7_TYPELESS:
1047 *pcxBlock = 4;
1048 *pcyBlock = 4;
1049 return 16;
1050
1051 case SVGA3D_BC7_UNORM:
1052 *pcxBlock = 4;
1053 *pcyBlock = 4;
1054 return 16;
1055
1056 case SVGA3D_BC7_UNORM_SRGB:
1057 *pcxBlock = 4;
1058 *pcyBlock = 4;
1059 return 16;
1060
1061 case SVGA3D_AYUV:
1062 *pcxBlock = 1;
1063 *pcyBlock = 1;
1064 return 4;
1065
1066 default:
1067 *pcxBlock = 1;
1068 *pcyBlock = 1;
1069 AssertFailedReturn(4);
1070 }
1071}
1072
1073#ifdef LOG_ENABLED
1074
1075const char *vmsvga3dGetCapString(uint32_t idxCap)
1076{
1077 switch (idxCap)
1078 {
1079 case SVGA3D_DEVCAP_3D:
1080 return "SVGA3D_DEVCAP_3D";
1081 case SVGA3D_DEVCAP_MAX_LIGHTS:
1082 return "SVGA3D_DEVCAP_MAX_LIGHTS";
1083 case SVGA3D_DEVCAP_MAX_TEXTURES:
1084 return "SVGA3D_DEVCAP_MAX_TEXTURES";
1085 case SVGA3D_DEVCAP_MAX_CLIP_PLANES:
1086 return "SVGA3D_DEVCAP_MAX_CLIP_PLANES";
1087 case SVGA3D_DEVCAP_VERTEX_SHADER_VERSION:
1088 return "SVGA3D_DEVCAP_VERTEX_SHADER_VERSION";
1089 case SVGA3D_DEVCAP_VERTEX_SHADER:
1090 return "SVGA3D_DEVCAP_VERTEX_SHADER";
1091 case SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION:
1092 return "SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION";
1093 case SVGA3D_DEVCAP_FRAGMENT_SHADER:
1094 return "SVGA3D_DEVCAP_FRAGMENT_SHADER";
1095 case SVGA3D_DEVCAP_MAX_RENDER_TARGETS:
1096 return "SVGA3D_DEVCAP_MAX_RENDER_TARGETS";
1097 case SVGA3D_DEVCAP_S23E8_TEXTURES:
1098 return "SVGA3D_DEVCAP_S23E8_TEXTURES";
1099 case SVGA3D_DEVCAP_S10E5_TEXTURES:
1100 return "SVGA3D_DEVCAP_S10E5_TEXTURES";
1101 case SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND:
1102 return "SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND";
1103 case SVGA3D_DEVCAP_D16_BUFFER_FORMAT:
1104 return "SVGA3D_DEVCAP_D16_BUFFER_FORMAT";
1105 case SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT:
1106 return "SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT";
1107 case SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT:
1108 return "SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT";
1109 case SVGA3D_DEVCAP_QUERY_TYPES:
1110 return "SVGA3D_DEVCAP_QUERY_TYPES";
1111 case SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING:
1112 return "SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING";
1113 case SVGA3D_DEVCAP_MAX_POINT_SIZE:
1114 return "SVGA3D_DEVCAP_MAX_POINT_SIZE";
1115 case SVGA3D_DEVCAP_MAX_SHADER_TEXTURES:
1116 return "SVGA3D_DEVCAP_MAX_SHADER_TEXTURES";
1117 case SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH:
1118 return "SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH";
1119 case SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT:
1120 return "SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT";
1121 case SVGA3D_DEVCAP_MAX_VOLUME_EXTENT:
1122 return "SVGA3D_DEVCAP_MAX_VOLUME_EXTENT";
1123 case SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT:
1124 return "SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT";
1125 case SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO:
1126 return "SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO";
1127 case SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY:
1128 return "SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY";
1129 case SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT:
1130 return "SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT";
1131 case SVGA3D_DEVCAP_MAX_VERTEX_INDEX:
1132 return "SVGA3D_DEVCAP_MAX_VERTEX_INDEX";
1133 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS:
1134 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS";
1135 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS:
1136 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS";
1137 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS:
1138 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS";
1139 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS:
1140 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS";
1141 case SVGA3D_DEVCAP_TEXTURE_OPS:
1142 return "SVGA3D_DEVCAP_TEXTURE_OPS";
1143 case SVGA3D_DEVCAP_DEAD4: /* SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES */
1144 return "SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES";
1145 case SVGA3D_DEVCAP_DEAD5: /* SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES */
1146 return "SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES";
1147 case SVGA3D_DEVCAP_DEAD7: /* SVGA3D_DEVCAP_ALPHATOCOVERAGE */
1148 return "SVGA3D_DEVCAP_ALPHATOCOVERAGE";
1149 case SVGA3D_DEVCAP_DEAD6: /* SVGA3D_DEVCAP_SUPERSAMPLE */
1150 return "SVGA3D_DEVCAP_SUPERSAMPLE";
1151 case SVGA3D_DEVCAP_AUTOGENMIPMAPS:
1152 return "SVGA3D_DEVCAP_AUTOGENMIPMAPS";
1153 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES:
1154 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES";
1155 case SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS:
1156 return "SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS";
1157 case SVGA3D_DEVCAP_MAX_CONTEXT_IDS:
1158 return "SVGA3D_DEVCAP_MAX_CONTEXT_IDS";
1159 case SVGA3D_DEVCAP_MAX_SURFACE_IDS:
1160 return "SVGA3D_DEVCAP_MAX_SURFACE_IDS";
1161 case SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8:
1162 return "SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8";
1163 case SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8:
1164 return "SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8";
1165 case SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10:
1166 return "SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10";
1167 case SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5:
1168 return "SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5";
1169 case SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5:
1170 return "SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5";
1171 case SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4:
1172 return "SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4";
1173 case SVGA3D_DEVCAP_SURFACEFMT_R5G6B5:
1174 return "SVGA3D_DEVCAP_SURFACEFMT_R5G6B5";
1175 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16:
1176 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16";
1177 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8:
1178 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8";
1179 case SVGA3D_DEVCAP_SURFACEFMT_ALPHA8:
1180 return "SVGA3D_DEVCAP_SURFACEFMT_ALPHA8";
1181 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8:
1182 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8";
1183 case SVGA3D_DEVCAP_SURFACEFMT_Z_D16:
1184 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D16";
1185 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8:
1186 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8";
1187 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8:
1188 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8";
1189 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
1190 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF16";
1191 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF24:
1192 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF24";
1193 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT:
1194 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT";
1195 case SVGA3D_DEVCAP_SURFACEFMT_DXT1:
1196 return "SVGA3D_DEVCAP_SURFACEFMT_DXT1";
1197 case SVGA3D_DEVCAP_SURFACEFMT_DXT2:
1198 return "SVGA3D_DEVCAP_SURFACEFMT_DXT2";
1199 case SVGA3D_DEVCAP_SURFACEFMT_DXT3:
1200 return "SVGA3D_DEVCAP_SURFACEFMT_DXT3";
1201 case SVGA3D_DEVCAP_SURFACEFMT_DXT4:
1202 return "SVGA3D_DEVCAP_SURFACEFMT_DXT4";
1203 case SVGA3D_DEVCAP_SURFACEFMT_DXT5:
1204 return "SVGA3D_DEVCAP_SURFACEFMT_DXT5";
1205 case SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8:
1206 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8";
1207 case SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10:
1208 return "SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10";
1209 case SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8:
1210 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8";
1211 case SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8:
1212 return "SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8";
1213 case SVGA3D_DEVCAP_SURFACEFMT_CxV8U8:
1214 return "SVGA3D_DEVCAP_SURFACEFMT_CxV8U8";
1215 case SVGA3D_DEVCAP_SURFACEFMT_R_S10E5:
1216 return "SVGA3D_DEVCAP_SURFACEFMT_R_S10E5";
1217 case SVGA3D_DEVCAP_SURFACEFMT_R_S23E8:
1218 return "SVGA3D_DEVCAP_SURFACEFMT_R_S23E8";
1219 case SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5:
1220 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5";
1221 case SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8:
1222 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8";
1223 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5:
1224 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5";
1225 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8:
1226 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8";
1227 case SVGA3D_DEVCAP_SURFACEFMT_V16U16:
1228 return "SVGA3D_DEVCAP_SURFACEFMT_V16U16";
1229 case SVGA3D_DEVCAP_SURFACEFMT_G16R16:
1230 return "SVGA3D_DEVCAP_SURFACEFMT_G16R16";
1231 case SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16:
1232 return "SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16";
1233 case SVGA3D_DEVCAP_SURFACEFMT_UYVY:
1234 return "SVGA3D_DEVCAP_SURFACEFMT_UYVY";
1235 case SVGA3D_DEVCAP_SURFACEFMT_YUY2:
1236 return "SVGA3D_DEVCAP_SURFACEFMT_YUY2";
1237 case SVGA3D_DEVCAP_SURFACEFMT_NV12:
1238 return "SVGA3D_DEVCAP_SURFACEFMT_NV12";
1239 case SVGA3D_DEVCAP_DEAD10: /* SVGA3D_DEVCAP_SURFACEFMT_AYUV */
1240 return "SVGA3D_DEVCAP_SURFACEFMT_AYUV";
1241 case SVGA3D_DEVCAP_SURFACEFMT_ATI1:
1242 return "SVGA3D_DEVCAP_SURFACEFMT_ATI1";
1243 case SVGA3D_DEVCAP_SURFACEFMT_ATI2:
1244 return "SVGA3D_DEVCAP_SURFACEFMT_ATI2";
1245 default:
1246 return "UNEXPECTED";
1247 }
1248}
1249
1250const char *vmsvga3dGet3dFormatString(uint32_t format)
1251{
1252 static char szFormat[1024];
1253
1254 szFormat[0] = 0;
1255
1256 if (format & SVGA3DFORMAT_OP_TEXTURE)
1257 strcat(szFormat, " - SVGA3DFORMAT_OP_TEXTURE\n");
1258 if (format & SVGA3DFORMAT_OP_VOLUMETEXTURE)
1259 strcat(szFormat, " - SVGA3DFORMAT_OP_VOLUMETEXTURE\n");
1260 if (format & SVGA3DFORMAT_OP_CUBETEXTURE)
1261 strcat(szFormat, " - SVGA3DFORMAT_OP_CUBETEXTURE\n");
1262 if (format & SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET)
1263 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET\n");
1264 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET)
1265 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET\n");
1266 if (format & SVGA3DFORMAT_OP_ZSTENCIL)
1267 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL\n");
1268 if (format & SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH)
1269 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH\n");
1270 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET)
1271 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET\n");
1272 if (format & SVGA3DFORMAT_OP_DISPLAYMODE)
1273 strcat(szFormat, " - SVGA3DFORMAT_OP_DISPLAYMODE\n");
1274 if (format & SVGA3DFORMAT_OP_3DACCELERATION)
1275 strcat(szFormat, " - SVGA3DFORMAT_OP_3DACCELERATION\n");
1276 if (format & SVGA3DFORMAT_OP_PIXELSIZE)
1277 strcat(szFormat, " - SVGA3DFORMAT_OP_PIXELSIZE\n");
1278 if (format & SVGA3DFORMAT_OP_CONVERT_TO_ARGB)
1279 strcat(szFormat, " - SVGA3DFORMAT_OP_CONVERT_TO_ARGB\n");
1280 if (format & SVGA3DFORMAT_OP_OFFSCREENPLAIN)
1281 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREENPLAIN\n");
1282 if (format & SVGA3DFORMAT_OP_SRGBREAD)
1283 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBREAD\n");
1284 if (format & SVGA3DFORMAT_OP_BUMPMAP)
1285 strcat(szFormat, " - SVGA3DFORMAT_OP_BUMPMAP\n");
1286 if (format & SVGA3DFORMAT_OP_DMAP)
1287 strcat(szFormat, " - SVGA3DFORMAT_OP_DMAP\n");
1288 if (format & SVGA3DFORMAT_OP_NOFILTER)
1289 strcat(szFormat, " - SVGA3DFORMAT_OP_NOFILTER\n");
1290 if (format & SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB)
1291 strcat(szFormat, " - SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB\n");
1292 if (format & SVGA3DFORMAT_OP_SRGBWRITE)
1293 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBWRITE\n");
1294 if (format & SVGA3DFORMAT_OP_NOALPHABLEND)
1295 strcat(szFormat, " - SVGA3DFORMAT_OP_NOALPHABLEND\n");
1296 if (format & SVGA3DFORMAT_OP_AUTOGENMIPMAP)
1297 strcat(szFormat, " - SVGA3DFORMAT_OP_AUTOGENMIPMAP\n");
1298 if (format & SVGA3DFORMAT_OP_VERTEXTEXTURE)
1299 strcat(szFormat, " - SVGA3DFORMAT_OP_VERTEXTEXTURE\n");
1300 if (format & SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
1301 strcat(szFormat, " - SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP\n");
1302 return szFormat;
1303}
1304
1305const char *vmsvga3dGetRenderStateName(uint32_t state)
1306{
1307 switch (state)
1308 {
1309 case SVGA3D_RS_ZENABLE: /* SVGA3dBool */
1310 return "SVGA3D_RS_ZENABLE";
1311 case SVGA3D_RS_ZWRITEENABLE: /* SVGA3dBool */
1312 return "SVGA3D_RS_ZWRITEENABLE";
1313 case SVGA3D_RS_ALPHATESTENABLE: /* SVGA3dBool */
1314 return "SVGA3D_RS_ALPHATESTENABLE";
1315 case SVGA3D_RS_DITHERENABLE: /* SVGA3dBool */
1316 return "SVGA3D_RS_DITHERENABLE";
1317 case SVGA3D_RS_BLENDENABLE: /* SVGA3dBool */
1318 return "SVGA3D_RS_BLENDENABLE";
1319 case SVGA3D_RS_FOGENABLE: /* SVGA3dBool */
1320 return "SVGA3D_RS_FOGENABLE";
1321 case SVGA3D_RS_SPECULARENABLE: /* SVGA3dBool */
1322 return "SVGA3D_RS_SPECULARENABLE";
1323 case SVGA3D_RS_STENCILENABLE: /* SVGA3dBool */
1324 return "SVGA3D_RS_STENCILENABLE";
1325 case SVGA3D_RS_LIGHTINGENABLE: /* SVGA3dBool */
1326 return "SVGA3D_RS_LIGHTINGENABLE";
1327 case SVGA3D_RS_NORMALIZENORMALS: /* SVGA3dBool */
1328 return "SVGA3D_RS_NORMALIZENORMALS";
1329 case SVGA3D_RS_POINTSPRITEENABLE: /* SVGA3dBool */
1330 return "SVGA3D_RS_POINTSPRITEENABLE";
1331 case SVGA3D_RS_POINTSCALEENABLE: /* SVGA3dBool */
1332 return "SVGA3D_RS_POINTSCALEENABLE";
1333 case SVGA3D_RS_STENCILREF: /* uint32_t */
1334 return "SVGA3D_RS_STENCILREF";
1335 case SVGA3D_RS_STENCILMASK: /* uint32_t */
1336 return "SVGA3D_RS_STENCILMASK";
1337 case SVGA3D_RS_STENCILWRITEMASK: /* uint32_t */
1338 return "SVGA3D_RS_STENCILWRITEMASK";
1339 case SVGA3D_RS_POINTSIZE: /* float */
1340 return "SVGA3D_RS_POINTSIZE";
1341 case SVGA3D_RS_POINTSIZEMIN: /* float */
1342 return "SVGA3D_RS_POINTSIZEMIN";
1343 case SVGA3D_RS_POINTSIZEMAX: /* float */
1344 return "SVGA3D_RS_POINTSIZEMAX";
1345 case SVGA3D_RS_POINTSCALE_A: /* float */
1346 return "SVGA3D_RS_POINTSCALE_A";
1347 case SVGA3D_RS_POINTSCALE_B: /* float */
1348 return "SVGA3D_RS_POINTSCALE_B";
1349 case SVGA3D_RS_POINTSCALE_C: /* float */
1350 return "SVGA3D_RS_POINTSCALE_C";
1351 case SVGA3D_RS_AMBIENT: /* SVGA3dColor - identical */
1352 return "SVGA3D_RS_AMBIENT";
1353 case SVGA3D_RS_CLIPPLANEENABLE: /* SVGA3dClipPlanes - identical */
1354 return "SVGA3D_RS_CLIPPLANEENABLE";
1355 case SVGA3D_RS_FOGCOLOR: /* SVGA3dColor - identical */
1356 return "SVGA3D_RS_FOGCOLOR";
1357 case SVGA3D_RS_FOGSTART: /* float */
1358 return "SVGA3D_RS_FOGSTART";
1359 case SVGA3D_RS_FOGEND: /* float */
1360 return "SVGA3D_RS_FOGEND";
1361 case SVGA3D_RS_FOGDENSITY: /* float */
1362 return "SVGA3D_RS_FOGDENSITY";
1363 case SVGA3D_RS_RANGEFOGENABLE: /* SVGA3dBool */
1364 return "SVGA3D_RS_RANGEFOGENABLE";
1365 case SVGA3D_RS_FOGMODE: /* SVGA3dFogMode */
1366 return "SVGA3D_RS_FOGMODE";
1367 case SVGA3D_RS_FILLMODE: /* SVGA3dFillMode */
1368 return "SVGA3D_RS_FILLMODE";
1369 case SVGA3D_RS_SHADEMODE: /* SVGA3dShadeMode */
1370 return "SVGA3D_RS_SHADEMODE";
1371 case SVGA3D_RS_LINEPATTERN: /* SVGA3dLinePattern */
1372 return "SVGA3D_RS_LINEPATTERN";
1373 case SVGA3D_RS_SRCBLEND: /* SVGA3dBlendOp */
1374 return "SVGA3D_RS_SRCBLEND";
1375 case SVGA3D_RS_DSTBLEND: /* SVGA3dBlendOp */
1376 return "SVGA3D_RS_DSTBLEND";
1377 case SVGA3D_RS_BLENDEQUATION: /* SVGA3dBlendEquation */
1378 return "SVGA3D_RS_BLENDEQUATION";
1379 case SVGA3D_RS_CULLMODE: /* SVGA3dFace */
1380 return "SVGA3D_RS_CULLMODE";
1381 case SVGA3D_RS_ZFUNC: /* SVGA3dCmpFunc */
1382 return "SVGA3D_RS_ZFUNC";
1383 case SVGA3D_RS_ALPHAFUNC: /* SVGA3dCmpFunc */
1384 return "SVGA3D_RS_ALPHAFUNC";
1385 case SVGA3D_RS_STENCILFUNC: /* SVGA3dCmpFunc */
1386 return "SVGA3D_RS_STENCILFUNC";
1387 case SVGA3D_RS_STENCILFAIL: /* SVGA3dStencilOp */
1388 return "SVGA3D_RS_STENCILFAIL";
1389 case SVGA3D_RS_STENCILZFAIL: /* SVGA3dStencilOp */
1390 return "SVGA3D_RS_STENCILZFAIL";
1391 case SVGA3D_RS_STENCILPASS: /* SVGA3dStencilOp */
1392 return "SVGA3D_RS_STENCILPASS";
1393 case SVGA3D_RS_ALPHAREF: /* float (0.0 .. 1.0) */
1394 return "SVGA3D_RS_ALPHAREF";
1395 case SVGA3D_RS_FRONTWINDING: /* SVGA3dFrontWinding */
1396 return "SVGA3D_RS_FRONTWINDING";
1397 case SVGA3D_RS_COORDINATETYPE: /* SVGA3dCoordinateType */
1398 return "SVGA3D_RS_COORDINATETYPE";
1399 case SVGA3D_RS_ZBIAS: /* float */
1400 return "SVGA3D_RS_ZBIAS";
1401 case SVGA3D_RS_COLORWRITEENABLE: /* SVGA3dColorMask */
1402 return "SVGA3D_RS_COLORWRITEENABLE";
1403 case SVGA3D_RS_VERTEXMATERIALENABLE: /* SVGA3dBool */
1404 return "SVGA3D_RS_VERTEXMATERIALENABLE";
1405 case SVGA3D_RS_DIFFUSEMATERIALSOURCE: /* SVGA3dVertexMaterial */
1406 return "SVGA3D_RS_DIFFUSEMATERIALSOURCE";
1407 case SVGA3D_RS_SPECULARMATERIALSOURCE: /* SVGA3dVertexMaterial */
1408 return "SVGA3D_RS_SPECULARMATERIALSOURCE";
1409 case SVGA3D_RS_AMBIENTMATERIALSOURCE: /* SVGA3dVertexMaterial */
1410 return "SVGA3D_RS_AMBIENTMATERIALSOURCE";
1411 case SVGA3D_RS_EMISSIVEMATERIALSOURCE: /* SVGA3dVertexMaterial */
1412 return "SVGA3D_RS_EMISSIVEMATERIALSOURCE";
1413 case SVGA3D_RS_TEXTUREFACTOR: /* SVGA3dColor */
1414 return "SVGA3D_RS_TEXTUREFACTOR";
1415 case SVGA3D_RS_LOCALVIEWER: /* SVGA3dBool */
1416 return "SVGA3D_RS_LOCALVIEWER";
1417 case SVGA3D_RS_SCISSORTESTENABLE: /* SVGA3dBool */
1418 return "SVGA3D_RS_SCISSORTESTENABLE";
1419 case SVGA3D_RS_BLENDCOLOR: /* SVGA3dColor */
1420 return "SVGA3D_RS_BLENDCOLOR";
1421 case SVGA3D_RS_STENCILENABLE2SIDED: /* SVGA3dBool */
1422 return "SVGA3D_RS_STENCILENABLE2SIDED";
1423 case SVGA3D_RS_CCWSTENCILFUNC: /* SVGA3dCmpFunc */
1424 return "SVGA3D_RS_CCWSTENCILFUNC";
1425 case SVGA3D_RS_CCWSTENCILFAIL: /* SVGA3dStencilOp */
1426 return "SVGA3D_RS_CCWSTENCILFAIL";
1427 case SVGA3D_RS_CCWSTENCILZFAIL: /* SVGA3dStencilOp */
1428 return "SVGA3D_RS_CCWSTENCILZFAIL";
1429 case SVGA3D_RS_CCWSTENCILPASS: /* SVGA3dStencilOp */
1430 return "SVGA3D_RS_CCWSTENCILPASS";
1431 case SVGA3D_RS_VERTEXBLEND: /* SVGA3dVertexBlendFlags */
1432 return "SVGA3D_RS_VERTEXBLEND";
1433 case SVGA3D_RS_SLOPESCALEDEPTHBIAS: /* float */
1434 return "SVGA3D_RS_SLOPESCALEDEPTHBIAS";
1435 case SVGA3D_RS_DEPTHBIAS: /* float */
1436 return "SVGA3D_RS_DEPTHBIAS";
1437 case SVGA3D_RS_OUTPUTGAMMA: /* float */
1438 return "SVGA3D_RS_OUTPUTGAMMA";
1439 case SVGA3D_RS_ZVISIBLE: /* SVGA3dBool */
1440 return "SVGA3D_RS_ZVISIBLE";
1441 case SVGA3D_RS_LASTPIXEL: /* SVGA3dBool */
1442 return "SVGA3D_RS_LASTPIXEL";
1443 case SVGA3D_RS_CLIPPING: /* SVGA3dBool */
1444 return "SVGA3D_RS_CLIPPING";
1445 case SVGA3D_RS_WRAP0: /* SVGA3dWrapFlags */
1446 return "SVGA3D_RS_WRAP0";
1447 case SVGA3D_RS_WRAP1: /* SVGA3dWrapFlags */
1448 return "SVGA3D_RS_WRAP1";
1449 case SVGA3D_RS_WRAP2: /* SVGA3dWrapFlags */
1450 return "SVGA3D_RS_WRAP2";
1451 case SVGA3D_RS_WRAP3: /* SVGA3dWrapFlags */
1452 return "SVGA3D_RS_WRAP3";
1453 case SVGA3D_RS_WRAP4: /* SVGA3dWrapFlags */
1454 return "SVGA3D_RS_WRAP4";
1455 case SVGA3D_RS_WRAP5: /* SVGA3dWrapFlags */
1456 return "SVGA3D_RS_WRAP5";
1457 case SVGA3D_RS_WRAP6: /* SVGA3dWrapFlags */
1458 return "SVGA3D_RS_WRAP6";
1459 case SVGA3D_RS_WRAP7: /* SVGA3dWrapFlags */
1460 return "SVGA3D_RS_WRAP7";
1461 case SVGA3D_RS_WRAP8: /* SVGA3dWrapFlags */
1462 return "SVGA3D_RS_WRAP8";
1463 case SVGA3D_RS_WRAP9: /* SVGA3dWrapFlags */
1464 return "SVGA3D_RS_WRAP9";
1465 case SVGA3D_RS_WRAP10: /* SVGA3dWrapFlags */
1466 return "SVGA3D_RS_WRAP10";
1467 case SVGA3D_RS_WRAP11: /* SVGA3dWrapFlags */
1468 return "SVGA3D_RS_WRAP11";
1469 case SVGA3D_RS_WRAP12: /* SVGA3dWrapFlags */
1470 return "SVGA3D_RS_WRAP12";
1471 case SVGA3D_RS_WRAP13: /* SVGA3dWrapFlags */
1472 return "SVGA3D_RS_WRAP13";
1473 case SVGA3D_RS_WRAP14: /* SVGA3dWrapFlags */
1474 return "SVGA3D_RS_WRAP14";
1475 case SVGA3D_RS_WRAP15: /* SVGA3dWrapFlags */
1476 return "SVGA3D_RS_WRAP15";
1477 case SVGA3D_RS_MULTISAMPLEANTIALIAS: /* SVGA3dBool */
1478 return "SVGA3D_RS_MULTISAMPLEANTIALIAS";
1479 case SVGA3D_RS_MULTISAMPLEMASK: /* uint32_t */
1480 return "SVGA3D_RS_MULTISAMPLEMASK";
1481 case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: /* SVGA3dBool */
1482 return "SVGA3D_RS_INDEXEDVERTEXBLENDENABLE";
1483 case SVGA3D_RS_TWEENFACTOR: /* float */
1484 return "SVGA3D_RS_TWEENFACTOR";
1485 case SVGA3D_RS_ANTIALIASEDLINEENABLE: /* SVGA3dBool */
1486 return "SVGA3D_RS_ANTIALIASEDLINEENABLE";
1487 case SVGA3D_RS_COLORWRITEENABLE1: /* SVGA3dColorMask */
1488 return "SVGA3D_RS_COLORWRITEENABLE1";
1489 case SVGA3D_RS_COLORWRITEENABLE2: /* SVGA3dColorMask */
1490 return "SVGA3D_RS_COLORWRITEENABLE2";
1491 case SVGA3D_RS_COLORWRITEENABLE3: /* SVGA3dColorMask */
1492 return "SVGA3D_RS_COLORWRITEENABLE3";
1493 case SVGA3D_RS_SEPARATEALPHABLENDENABLE: /* SVGA3dBool */
1494 return "SVGA3D_RS_SEPARATEALPHABLENDENABLE";
1495 case SVGA3D_RS_SRCBLENDALPHA: /* SVGA3dBlendOp */
1496 return "SVGA3D_RS_SRCBLENDALPHA";
1497 case SVGA3D_RS_DSTBLENDALPHA: /* SVGA3dBlendOp */
1498 return "SVGA3D_RS_DSTBLENDALPHA";
1499 case SVGA3D_RS_BLENDEQUATIONALPHA: /* SVGA3dBlendEquation */
1500 return "SVGA3D_RS_BLENDEQUATIONALPHA";
1501 case SVGA3D_RS_TRANSPARENCYANTIALIAS: /* SVGA3dTransparencyAntialiasType */
1502 return "SVGA3D_RS_TRANSPARENCYANTIALIAS";
1503 case SVGA3D_RS_LINEWIDTH: /* float */
1504 return "SVGA3D_RS_LINEWIDTH";
1505 default:
1506 return "UNKNOWN";
1507 }
1508}
1509
1510const char *vmsvga3dTextureStateToString(SVGA3dTextureStateName textureState)
1511{
1512 switch (textureState)
1513 {
1514 case SVGA3D_TS_BIND_TEXTURE:
1515 return "SVGA3D_TS_BIND_TEXTURE";
1516 case SVGA3D_TS_COLOROP:
1517 return "SVGA3D_TS_COLOROP";
1518 case SVGA3D_TS_COLORARG1:
1519 return "SVGA3D_TS_COLORARG1";
1520 case SVGA3D_TS_COLORARG2:
1521 return "SVGA3D_TS_COLORARG2";
1522 case SVGA3D_TS_ALPHAOP:
1523 return "SVGA3D_TS_ALPHAOP";
1524 case SVGA3D_TS_ALPHAARG1:
1525 return "SVGA3D_TS_ALPHAARG1";
1526 case SVGA3D_TS_ALPHAARG2:
1527 return "SVGA3D_TS_ALPHAARG2";
1528 case SVGA3D_TS_ADDRESSU:
1529 return "SVGA3D_TS_ADDRESSU";
1530 case SVGA3D_TS_ADDRESSV:
1531 return "SVGA3D_TS_ADDRESSV";
1532 case SVGA3D_TS_MIPFILTER:
1533 return "SVGA3D_TS_MIPFILTER";
1534 case SVGA3D_TS_MAGFILTER:
1535 return "SVGA3D_TS_MAGFILTER";
1536 case SVGA3D_TS_MINFILTER:
1537 return "SVGA3D_TS_MINFILTER";
1538 case SVGA3D_TS_BORDERCOLOR:
1539 return "SVGA3D_TS_BORDERCOLOR";
1540 case SVGA3D_TS_TEXCOORDINDEX:
1541 return "SVGA3D_TS_TEXCOORDINDEX";
1542 case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
1543 return "SVGA3D_TS_TEXTURETRANSFORMFLAGS";
1544 case SVGA3D_TS_TEXCOORDGEN:
1545 return "SVGA3D_TS_TEXCOORDGEN";
1546 case SVGA3D_TS_BUMPENVMAT00:
1547 return "SVGA3D_TS_BUMPENVMAT00";
1548 case SVGA3D_TS_BUMPENVMAT01:
1549 return "SVGA3D_TS_BUMPENVMAT01";
1550 case SVGA3D_TS_BUMPENVMAT10:
1551 return "SVGA3D_TS_BUMPENVMAT10";
1552 case SVGA3D_TS_BUMPENVMAT11:
1553 return "SVGA3D_TS_BUMPENVMAT11";
1554 case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
1555 return "SVGA3D_TS_TEXTURE_MIPMAP_LEVEL";
1556 case SVGA3D_TS_TEXTURE_LOD_BIAS:
1557 return "SVGA3D_TS_TEXTURE_LOD_BIAS";
1558 case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
1559 return "SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL";
1560 case SVGA3D_TS_ADDRESSW:
1561 return "SVGA3D_TS_ADDRESSW";
1562 case SVGA3D_TS_GAMMA:
1563 return "SVGA3D_TS_GAMMA";
1564 case SVGA3D_TS_BUMPENVLSCALE:
1565 return "SVGA3D_TS_BUMPENVLSCALE";
1566 case SVGA3D_TS_BUMPENVLOFFSET:
1567 return "SVGA3D_TS_BUMPENVLOFFSET";
1568 case SVGA3D_TS_COLORARG0:
1569 return "SVGA3D_TS_COLORARG0";
1570 case SVGA3D_TS_ALPHAARG0:
1571 return "SVGA3D_TS_ALPHAARG0";
1572 default:
1573 return "UNKNOWN";
1574 }
1575}
1576
1577const char *vmsvgaTransformToString(SVGA3dTransformType type)
1578{
1579 switch (type)
1580 {
1581 case SVGA3D_TRANSFORM_INVALID:
1582 return "SVGA3D_TRANSFORM_INVALID";
1583 case SVGA3D_TRANSFORM_WORLD:
1584 return "SVGA3D_TRANSFORM_WORLD";
1585 case SVGA3D_TRANSFORM_VIEW:
1586 return "SVGA3D_TRANSFORM_VIEW";
1587 case SVGA3D_TRANSFORM_PROJECTION:
1588 return "SVGA3D_TRANSFORM_PROJECTION";
1589 case SVGA3D_TRANSFORM_TEXTURE0:
1590 return "SVGA3D_TRANSFORM_TEXTURE0";
1591 case SVGA3D_TRANSFORM_TEXTURE1:
1592 return "SVGA3D_TRANSFORM_TEXTURE1";
1593 case SVGA3D_TRANSFORM_TEXTURE2:
1594 return "SVGA3D_TRANSFORM_TEXTURE2";
1595 case SVGA3D_TRANSFORM_TEXTURE3:
1596 return "SVGA3D_TRANSFORM_TEXTURE3";
1597 case SVGA3D_TRANSFORM_TEXTURE4:
1598 return "SVGA3D_TRANSFORM_TEXTURE4";
1599 case SVGA3D_TRANSFORM_TEXTURE5:
1600 return "SVGA3D_TRANSFORM_TEXTURE5";
1601 case SVGA3D_TRANSFORM_TEXTURE6:
1602 return "SVGA3D_TRANSFORM_TEXTURE6";
1603 case SVGA3D_TRANSFORM_TEXTURE7:
1604 return "SVGA3D_TRANSFORM_TEXTURE7";
1605 case SVGA3D_TRANSFORM_WORLD1:
1606 return "SVGA3D_TRANSFORM_WORLD1";
1607 case SVGA3D_TRANSFORM_WORLD2:
1608 return "SVGA3D_TRANSFORM_WORLD2";
1609 case SVGA3D_TRANSFORM_WORLD3:
1610 return "SVGA3D_TRANSFORM_WORLD3";
1611 default:
1612 return "UNKNOWN";
1613 }
1614}
1615
1616const char *vmsvgaDeclUsage2String(SVGA3dDeclUsage usage)
1617{
1618 switch (usage)
1619 {
1620 case SVGA3D_DECLUSAGE_POSITION:
1621 return "SVGA3D_DECLUSAGE_POSITION";
1622 case SVGA3D_DECLUSAGE_BLENDWEIGHT:
1623 return "SVGA3D_DECLUSAGE_BLENDWEIGHT";
1624 case SVGA3D_DECLUSAGE_BLENDINDICES:
1625 return "SVGA3D_DECLUSAGE_BLENDINDICES";
1626 case SVGA3D_DECLUSAGE_NORMAL:
1627 return "SVGA3D_DECLUSAGE_NORMAL";
1628 case SVGA3D_DECLUSAGE_PSIZE:
1629 return "SVGA3D_DECLUSAGE_PSIZE";
1630 case SVGA3D_DECLUSAGE_TEXCOORD:
1631 return "SVGA3D_DECLUSAGE_TEXCOORD";
1632 case SVGA3D_DECLUSAGE_TANGENT:
1633 return "SVGA3D_DECLUSAGE_TANGENT";
1634 case SVGA3D_DECLUSAGE_BINORMAL:
1635 return "SVGA3D_DECLUSAGE_BINORMAL";
1636 case SVGA3D_DECLUSAGE_TESSFACTOR:
1637 return "SVGA3D_DECLUSAGE_TESSFACTOR";
1638 case SVGA3D_DECLUSAGE_POSITIONT:
1639 return "SVGA3D_DECLUSAGE_POSITIONT";
1640 case SVGA3D_DECLUSAGE_COLOR:
1641 return "SVGA3D_DECLUSAGE_COLOR";
1642 case SVGA3D_DECLUSAGE_FOG:
1643 return "SVGA3D_DECLUSAGE_FOG";
1644 case SVGA3D_DECLUSAGE_DEPTH:
1645 return "SVGA3D_DECLUSAGE_DEPTH";
1646 case SVGA3D_DECLUSAGE_SAMPLE:
1647 return "SVGA3D_DECLUSAGE_SAMPLE";
1648 default:
1649 return "UNKNOWN!!";
1650 }
1651}
1652
1653const char *vmsvgaDeclMethod2String(SVGA3dDeclMethod method)
1654{
1655 switch (method)
1656 {
1657 case SVGA3D_DECLMETHOD_DEFAULT:
1658 return "SVGA3D_DECLMETHOD_DEFAULT";
1659 case SVGA3D_DECLMETHOD_PARTIALU:
1660 return "SVGA3D_DECLMETHOD_PARTIALU";
1661 case SVGA3D_DECLMETHOD_PARTIALV:
1662 return "SVGA3D_DECLMETHOD_PARTIALV";
1663 case SVGA3D_DECLMETHOD_CROSSUV:
1664 return "SVGA3D_DECLMETHOD_CROSSUV";
1665 case SVGA3D_DECLMETHOD_UV:
1666 return "SVGA3D_DECLMETHOD_UV";
1667 case SVGA3D_DECLMETHOD_LOOKUP:
1668 return "SVGA3D_DECLMETHOD_LOOKUP";
1669 case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
1670 return "SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED";
1671 default:
1672 return "UNKNOWN!!";
1673 }
1674}
1675
1676const char *vmsvgaDeclType2String(SVGA3dDeclType type)
1677{
1678 switch (type)
1679 {
1680 case SVGA3D_DECLTYPE_FLOAT1:
1681 return "SVGA3D_DECLTYPE_FLOAT1";
1682 case SVGA3D_DECLTYPE_FLOAT2:
1683 return "SVGA3D_DECLTYPE_FLOAT2";
1684 case SVGA3D_DECLTYPE_FLOAT3:
1685 return "SVGA3D_DECLTYPE_FLOAT3";
1686 case SVGA3D_DECLTYPE_FLOAT4:
1687 return "SVGA3D_DECLTYPE_FLOAT4";
1688 case SVGA3D_DECLTYPE_D3DCOLOR:
1689 return "SVGA3D_DECLTYPE_D3DCOLOR";
1690 case SVGA3D_DECLTYPE_UBYTE4:
1691 return "SVGA3D_DECLTYPE_UBYTE4";
1692 case SVGA3D_DECLTYPE_SHORT2:
1693 return "SVGA3D_DECLTYPE_SHORT2";
1694 case SVGA3D_DECLTYPE_SHORT4:
1695 return "SVGA3D_DECLTYPE_SHORT4";
1696 case SVGA3D_DECLTYPE_UBYTE4N:
1697 return "SVGA3D_DECLTYPE_UBYTE4N";
1698 case SVGA3D_DECLTYPE_SHORT2N:
1699 return "SVGA3D_DECLTYPE_SHORT2N";
1700 case SVGA3D_DECLTYPE_SHORT4N:
1701 return "SVGA3D_DECLTYPE_SHORT4N";
1702 case SVGA3D_DECLTYPE_USHORT2N:
1703 return "SVGA3D_DECLTYPE_USHORT2N";
1704 case SVGA3D_DECLTYPE_USHORT4N:
1705 return "SVGA3D_DECLTYPE_USHORT4N";
1706 case SVGA3D_DECLTYPE_UDEC3:
1707 return "SVGA3D_DECLTYPE_UDEC3";
1708 case SVGA3D_DECLTYPE_DEC3N:
1709 return "SVGA3D_DECLTYPE_DEC3N";
1710 case SVGA3D_DECLTYPE_FLOAT16_2:
1711 return "SVGA3D_DECLTYPE_FLOAT16_2";
1712 case SVGA3D_DECLTYPE_FLOAT16_4:
1713 return "SVGA3D_DECLTYPE_FLOAT16_4";
1714 default:
1715 return "UNKNOWN!!";
1716 }
1717}
1718
1719const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType)
1720{
1721 switch (PrimitiveType)
1722 {
1723 case SVGA3D_PRIMITIVE_TRIANGLELIST:
1724 return "SVGA3D_PRIMITIVE_TRIANGLELIST";
1725 case SVGA3D_PRIMITIVE_POINTLIST:
1726 return "SVGA3D_PRIMITIVE_POINTLIST";
1727 case SVGA3D_PRIMITIVE_LINELIST:
1728 return "SVGA3D_PRIMITIVE_LINELIST";
1729 case SVGA3D_PRIMITIVE_LINESTRIP:
1730 return "SVGA3D_PRIMITIVE_LINESTRIP";
1731 case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
1732 return "SVGA3D_PRIMITIVE_TRIANGLESTRIP";
1733 case SVGA3D_PRIMITIVE_TRIANGLEFAN:
1734 return "SVGA3D_PRIMITIVE_TRIANGLEFAN";
1735 default:
1736 return "UNKNOWN";
1737 }
1738}
1739
1740#endif /* LOG_ENABLED */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette