VirtualBox

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

Last change on this file since 91968 was 88787, checked in by vboxsync, 4 years ago

Devices/Graphics: a few DX commands. bugref:9830

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