VirtualBox

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

Last change on this file since 86899 was 86024, checked in by vboxsync, 4 years ago

Devices/Graphics: use current VMSVGA headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 42.4 KB
Line 
1/* $Id: DevVGA-SVGA3d-shared.cpp 86024 2020-09-03 14:37:31Z 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 case SVGA3D_A8R8G8B8:
298 *pcxBlock = 1;
299 *pcyBlock = 1;
300 return 4;
301
302 case SVGA3D_R5G6B5:
303 case SVGA3D_X1R5G5B5:
304 case SVGA3D_A1R5G5B5:
305 case SVGA3D_A4R4G4B4:
306 *pcxBlock = 1;
307 *pcyBlock = 1;
308 return 2;
309
310 case SVGA3D_Z_D32:
311 case SVGA3D_Z_D24S8:
312 case SVGA3D_Z_D24X8:
313 case SVGA3D_Z_DF24:
314 case SVGA3D_Z_D24S8_INT:
315 *pcxBlock = 1;
316 *pcyBlock = 1;
317 return 4;
318
319 case SVGA3D_Z_D16:
320 case SVGA3D_Z_DF16:
321 case SVGA3D_Z_D15S1:
322 *pcxBlock = 1;
323 *pcyBlock = 1;
324 return 2;
325
326 case SVGA3D_LUMINANCE8:
327 case SVGA3D_LUMINANCE4_ALPHA4:
328 *pcxBlock = 1;
329 *pcyBlock = 1;
330 return 1;
331
332 case SVGA3D_LUMINANCE16:
333 case SVGA3D_LUMINANCE8_ALPHA8:
334 *pcxBlock = 1;
335 *pcyBlock = 1;
336 return 2;
337
338 case SVGA3D_DXT1:
339 *pcxBlock = 4;
340 *pcyBlock = 4;
341 return 8;
342
343 case SVGA3D_DXT2:
344 case SVGA3D_DXT3:
345 case SVGA3D_DXT4:
346 case SVGA3D_DXT5:
347 *pcxBlock = 4;
348 *pcyBlock = 4;
349 return 16;
350
351 case SVGA3D_BUMPU8V8:
352 case SVGA3D_BUMPL6V5U5:
353 *pcxBlock = 1;
354 *pcyBlock = 1;
355 return 2;
356
357 case SVGA3D_BUMPX8L8V8U8:
358 case SVGA3D_Q8W8V8U8:
359 *pcxBlock = 1;
360 *pcyBlock = 1;
361 return 4;
362
363 case SVGA3D_V8U8:
364 case SVGA3D_CxV8U8:
365 *pcxBlock = 1;
366 *pcyBlock = 1;
367 return 2;
368
369 case SVGA3D_X8L8V8U8:
370 case SVGA3D_A2W10V10U10:
371 *pcxBlock = 1;
372 *pcyBlock = 1;
373 return 4;
374
375 case SVGA3D_ARGB_S10E5: /* 16-bit floating-point ARGB */
376 *pcxBlock = 1;
377 *pcyBlock = 1;
378 return 8;
379 case SVGA3D_ARGB_S23E8: /* 32-bit floating-point ARGB */
380 *pcxBlock = 1;
381 *pcyBlock = 1;
382 return 16;
383
384 case SVGA3D_A2R10G10B10:
385 *pcxBlock = 1;
386 *pcyBlock = 1;
387 return 4;
388
389 case SVGA3D_ALPHA8:
390 *pcxBlock = 1;
391 *pcyBlock = 1;
392 return 1;
393
394 case SVGA3D_R_S10E5:
395 *pcxBlock = 1;
396 *pcyBlock = 1;
397 return 2;
398
399 case SVGA3D_R_S23E8:
400 case SVGA3D_RG_S10E5:
401 *pcxBlock = 1;
402 *pcyBlock = 1;
403 return 4;
404
405 case SVGA3D_RG_S23E8:
406 *pcxBlock = 1;
407 *pcyBlock = 1;
408 return 8;
409
410 /*
411 * Any surface can be used as a buffer object, but SVGA3D_BUFFER is
412 * the most efficient format to use when creating new surfaces
413 * expressly for index or vertex data.
414 */
415 case SVGA3D_BUFFER:
416 *pcxBlock = 1;
417 *pcyBlock = 1;
418 return 1;
419
420 case SVGA3D_UYVY:
421 *pcxBlock = 2;
422 *pcyBlock = 1;
423 return 4;
424
425 case SVGA3D_YUY2:
426 *pcxBlock = 2;
427 *pcyBlock = 1;
428 return 4;
429
430 case SVGA3D_V16U16:
431 *pcxBlock = 1;
432 *pcyBlock = 1;
433 return 4;
434
435 case SVGA3D_G16R16:
436 *pcxBlock = 1;
437 *pcyBlock = 1;
438 return 4;
439 case SVGA3D_A16B16G16R16:
440 *pcxBlock = 1;
441 *pcyBlock = 1;
442 return 8;
443 case SVGA3D_R8G8B8A8_UNORM:
444 case SVGA3D_R8G8B8A8_SNORM:
445 *pcxBlock = 1;
446 *pcyBlock = 1;
447 return 4;
448 case SVGA3D_R16G16_UNORM:
449 *pcxBlock = 1;
450 *pcyBlock = 1;
451 return 4;
452
453 default:
454 *pcxBlock = 1;
455 *pcyBlock = 1;
456 AssertFailedReturn(4);
457 }
458}
459
460#ifdef LOG_ENABLED
461
462const char *vmsvga3dGetCapString(uint32_t idxCap)
463{
464 switch (idxCap)
465 {
466 case SVGA3D_DEVCAP_3D:
467 return "SVGA3D_DEVCAP_3D";
468 case SVGA3D_DEVCAP_MAX_LIGHTS:
469 return "SVGA3D_DEVCAP_MAX_LIGHTS";
470 case SVGA3D_DEVCAP_MAX_TEXTURES:
471 return "SVGA3D_DEVCAP_MAX_TEXTURES";
472 case SVGA3D_DEVCAP_MAX_CLIP_PLANES:
473 return "SVGA3D_DEVCAP_MAX_CLIP_PLANES";
474 case SVGA3D_DEVCAP_VERTEX_SHADER_VERSION:
475 return "SVGA3D_DEVCAP_VERTEX_SHADER_VERSION";
476 case SVGA3D_DEVCAP_VERTEX_SHADER:
477 return "SVGA3D_DEVCAP_VERTEX_SHADER";
478 case SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION:
479 return "SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION";
480 case SVGA3D_DEVCAP_FRAGMENT_SHADER:
481 return "SVGA3D_DEVCAP_FRAGMENT_SHADER";
482 case SVGA3D_DEVCAP_MAX_RENDER_TARGETS:
483 return "SVGA3D_DEVCAP_MAX_RENDER_TARGETS";
484 case SVGA3D_DEVCAP_S23E8_TEXTURES:
485 return "SVGA3D_DEVCAP_S23E8_TEXTURES";
486 case SVGA3D_DEVCAP_S10E5_TEXTURES:
487 return "SVGA3D_DEVCAP_S10E5_TEXTURES";
488 case SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND:
489 return "SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND";
490 case SVGA3D_DEVCAP_D16_BUFFER_FORMAT:
491 return "SVGA3D_DEVCAP_D16_BUFFER_FORMAT";
492 case SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT:
493 return "SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT";
494 case SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT:
495 return "SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT";
496 case SVGA3D_DEVCAP_QUERY_TYPES:
497 return "SVGA3D_DEVCAP_QUERY_TYPES";
498 case SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING:
499 return "SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING";
500 case SVGA3D_DEVCAP_MAX_POINT_SIZE:
501 return "SVGA3D_DEVCAP_MAX_POINT_SIZE";
502 case SVGA3D_DEVCAP_MAX_SHADER_TEXTURES:
503 return "SVGA3D_DEVCAP_MAX_SHADER_TEXTURES";
504 case SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH:
505 return "SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH";
506 case SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT:
507 return "SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT";
508 case SVGA3D_DEVCAP_MAX_VOLUME_EXTENT:
509 return "SVGA3D_DEVCAP_MAX_VOLUME_EXTENT";
510 case SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT:
511 return "SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT";
512 case SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO:
513 return "SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO";
514 case SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY:
515 return "SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY";
516 case SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT:
517 return "SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT";
518 case SVGA3D_DEVCAP_MAX_VERTEX_INDEX:
519 return "SVGA3D_DEVCAP_MAX_VERTEX_INDEX";
520 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS:
521 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS";
522 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS:
523 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS";
524 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS:
525 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS";
526 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS:
527 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS";
528 case SVGA3D_DEVCAP_TEXTURE_OPS:
529 return "SVGA3D_DEVCAP_TEXTURE_OPS";
530 case SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES:
531 return "SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES";
532 case SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES:
533 return "SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES";
534 case SVGA3D_DEVCAP_ALPHATOCOVERAGE:
535 return "SVGA3D_DEVCAP_ALPHATOCOVERAGE";
536 case SVGA3D_DEVCAP_SUPERSAMPLE:
537 return "SVGA3D_DEVCAP_SUPERSAMPLE";
538 case SVGA3D_DEVCAP_AUTOGENMIPMAPS:
539 return "SVGA3D_DEVCAP_AUTOGENMIPMAPS";
540 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES:
541 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES";
542 case SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS:
543 return "SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS";
544 case SVGA3D_DEVCAP_MAX_CONTEXT_IDS:
545 return "SVGA3D_DEVCAP_MAX_CONTEXT_IDS";
546 case SVGA3D_DEVCAP_MAX_SURFACE_IDS:
547 return "SVGA3D_DEVCAP_MAX_SURFACE_IDS";
548 case SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8:
549 return "SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8";
550 case SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8:
551 return "SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8";
552 case SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10:
553 return "SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10";
554 case SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5:
555 return "SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5";
556 case SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5:
557 return "SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5";
558 case SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4:
559 return "SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4";
560 case SVGA3D_DEVCAP_SURFACEFMT_R5G6B5:
561 return "SVGA3D_DEVCAP_SURFACEFMT_R5G6B5";
562 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16:
563 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16";
564 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8:
565 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8";
566 case SVGA3D_DEVCAP_SURFACEFMT_ALPHA8:
567 return "SVGA3D_DEVCAP_SURFACEFMT_ALPHA8";
568 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8:
569 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8";
570 case SVGA3D_DEVCAP_SURFACEFMT_Z_D16:
571 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D16";
572 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8:
573 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8";
574 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8:
575 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8";
576 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
577 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF16";
578 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF24:
579 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF24";
580 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT:
581 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT";
582 case SVGA3D_DEVCAP_SURFACEFMT_DXT1:
583 return "SVGA3D_DEVCAP_SURFACEFMT_DXT1";
584 case SVGA3D_DEVCAP_SURFACEFMT_DXT2:
585 return "SVGA3D_DEVCAP_SURFACEFMT_DXT2";
586 case SVGA3D_DEVCAP_SURFACEFMT_DXT3:
587 return "SVGA3D_DEVCAP_SURFACEFMT_DXT3";
588 case SVGA3D_DEVCAP_SURFACEFMT_DXT4:
589 return "SVGA3D_DEVCAP_SURFACEFMT_DXT4";
590 case SVGA3D_DEVCAP_SURFACEFMT_DXT5:
591 return "SVGA3D_DEVCAP_SURFACEFMT_DXT5";
592 case SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8:
593 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8";
594 case SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10:
595 return "SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10";
596 case SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8:
597 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8";
598 case SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8:
599 return "SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8";
600 case SVGA3D_DEVCAP_SURFACEFMT_CxV8U8:
601 return "SVGA3D_DEVCAP_SURFACEFMT_CxV8U8";
602 case SVGA3D_DEVCAP_SURFACEFMT_R_S10E5:
603 return "SVGA3D_DEVCAP_SURFACEFMT_R_S10E5";
604 case SVGA3D_DEVCAP_SURFACEFMT_R_S23E8:
605 return "SVGA3D_DEVCAP_SURFACEFMT_R_S23E8";
606 case SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5:
607 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5";
608 case SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8:
609 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8";
610 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5:
611 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5";
612 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8:
613 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8";
614 case SVGA3D_DEVCAP_SURFACEFMT_V16U16:
615 return "SVGA3D_DEVCAP_SURFACEFMT_V16U16";
616 case SVGA3D_DEVCAP_SURFACEFMT_G16R16:
617 return "SVGA3D_DEVCAP_SURFACEFMT_G16R16";
618 case SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16:
619 return "SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16";
620 case SVGA3D_DEVCAP_SURFACEFMT_UYVY:
621 return "SVGA3D_DEVCAP_SURFACEFMT_UYVY";
622 case SVGA3D_DEVCAP_SURFACEFMT_YUY2:
623 return "SVGA3D_DEVCAP_SURFACEFMT_YUY2";
624 case SVGA3D_DEVCAP_SURFACEFMT_NV12:
625 return "SVGA3D_DEVCAP_SURFACEFMT_NV12";
626 case SVGA3D_DEVCAP_SURFACEFMT_AYUV:
627 return "SVGA3D_DEVCAP_SURFACEFMT_AYUV";
628 case SVGA3D_DEVCAP_SURFACEFMT_ATI1:
629 return "SVGA3D_DEVCAP_SURFACEFMT_ATI1";
630 case SVGA3D_DEVCAP_SURFACEFMT_ATI2:
631 return "SVGA3D_DEVCAP_SURFACEFMT_ATI2";
632 default:
633 return "UNEXPECTED";
634 }
635}
636
637const char *vmsvga3dGet3dFormatString(uint32_t format)
638{
639 static char szFormat[1024];
640
641 szFormat[0] = 0;
642
643 if (format & SVGA3DFORMAT_OP_TEXTURE)
644 strcat(szFormat, " - SVGA3DFORMAT_OP_TEXTURE\n");
645 if (format & SVGA3DFORMAT_OP_VOLUMETEXTURE)
646 strcat(szFormat, " - SVGA3DFORMAT_OP_VOLUMETEXTURE\n");
647 if (format & SVGA3DFORMAT_OP_CUBETEXTURE)
648 strcat(szFormat, " - SVGA3DFORMAT_OP_CUBETEXTURE\n");
649 if (format & SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET)
650 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET\n");
651 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET)
652 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET\n");
653 if (format & SVGA3DFORMAT_OP_ZSTENCIL)
654 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL\n");
655 if (format & SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH)
656 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH\n");
657 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET)
658 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET\n");
659 if (format & SVGA3DFORMAT_OP_DISPLAYMODE)
660 strcat(szFormat, " - SVGA3DFORMAT_OP_DISPLAYMODE\n");
661 if (format & SVGA3DFORMAT_OP_3DACCELERATION)
662 strcat(szFormat, " - SVGA3DFORMAT_OP_3DACCELERATION\n");
663 if (format & SVGA3DFORMAT_OP_PIXELSIZE)
664 strcat(szFormat, " - SVGA3DFORMAT_OP_PIXELSIZE\n");
665 if (format & SVGA3DFORMAT_OP_CONVERT_TO_ARGB)
666 strcat(szFormat, " - SVGA3DFORMAT_OP_CONVERT_TO_ARGB\n");
667 if (format & SVGA3DFORMAT_OP_OFFSCREENPLAIN)
668 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREENPLAIN\n");
669 if (format & SVGA3DFORMAT_OP_SRGBREAD)
670 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBREAD\n");
671 if (format & SVGA3DFORMAT_OP_BUMPMAP)
672 strcat(szFormat, " - SVGA3DFORMAT_OP_BUMPMAP\n");
673 if (format & SVGA3DFORMAT_OP_DMAP)
674 strcat(szFormat, " - SVGA3DFORMAT_OP_DMAP\n");
675 if (format & SVGA3DFORMAT_OP_NOFILTER)
676 strcat(szFormat, " - SVGA3DFORMAT_OP_NOFILTER\n");
677 if (format & SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB)
678 strcat(szFormat, " - SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB\n");
679 if (format & SVGA3DFORMAT_OP_SRGBWRITE)
680 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBWRITE\n");
681 if (format & SVGA3DFORMAT_OP_NOALPHABLEND)
682 strcat(szFormat, " - SVGA3DFORMAT_OP_NOALPHABLEND\n");
683 if (format & SVGA3DFORMAT_OP_AUTOGENMIPMAP)
684 strcat(szFormat, " - SVGA3DFORMAT_OP_AUTOGENMIPMAP\n");
685 if (format & SVGA3DFORMAT_OP_VERTEXTEXTURE)
686 strcat(szFormat, " - SVGA3DFORMAT_OP_VERTEXTEXTURE\n");
687 if (format & SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
688 strcat(szFormat, " - SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP\n");
689 return szFormat;
690}
691
692const char *vmsvga3dGetRenderStateName(uint32_t state)
693{
694 switch (state)
695 {
696 case SVGA3D_RS_ZENABLE: /* SVGA3dBool */
697 return "SVGA3D_RS_ZENABLE";
698 case SVGA3D_RS_ZWRITEENABLE: /* SVGA3dBool */
699 return "SVGA3D_RS_ZWRITEENABLE";
700 case SVGA3D_RS_ALPHATESTENABLE: /* SVGA3dBool */
701 return "SVGA3D_RS_ALPHATESTENABLE";
702 case SVGA3D_RS_DITHERENABLE: /* SVGA3dBool */
703 return "SVGA3D_RS_DITHERENABLE";
704 case SVGA3D_RS_BLENDENABLE: /* SVGA3dBool */
705 return "SVGA3D_RS_BLENDENABLE";
706 case SVGA3D_RS_FOGENABLE: /* SVGA3dBool */
707 return "SVGA3D_RS_FOGENABLE";
708 case SVGA3D_RS_SPECULARENABLE: /* SVGA3dBool */
709 return "SVGA3D_RS_SPECULARENABLE";
710 case SVGA3D_RS_STENCILENABLE: /* SVGA3dBool */
711 return "SVGA3D_RS_STENCILENABLE";
712 case SVGA3D_RS_LIGHTINGENABLE: /* SVGA3dBool */
713 return "SVGA3D_RS_LIGHTINGENABLE";
714 case SVGA3D_RS_NORMALIZENORMALS: /* SVGA3dBool */
715 return "SVGA3D_RS_NORMALIZENORMALS";
716 case SVGA3D_RS_POINTSPRITEENABLE: /* SVGA3dBool */
717 return "SVGA3D_RS_POINTSPRITEENABLE";
718 case SVGA3D_RS_POINTSCALEENABLE: /* SVGA3dBool */
719 return "SVGA3D_RS_POINTSCALEENABLE";
720 case SVGA3D_RS_STENCILREF: /* uint32_t */
721 return "SVGA3D_RS_STENCILREF";
722 case SVGA3D_RS_STENCILMASK: /* uint32_t */
723 return "SVGA3D_RS_STENCILMASK";
724 case SVGA3D_RS_STENCILWRITEMASK: /* uint32_t */
725 return "SVGA3D_RS_STENCILWRITEMASK";
726 case SVGA3D_RS_POINTSIZE: /* float */
727 return "SVGA3D_RS_POINTSIZE";
728 case SVGA3D_RS_POINTSIZEMIN: /* float */
729 return "SVGA3D_RS_POINTSIZEMIN";
730 case SVGA3D_RS_POINTSIZEMAX: /* float */
731 return "SVGA3D_RS_POINTSIZEMAX";
732 case SVGA3D_RS_POINTSCALE_A: /* float */
733 return "SVGA3D_RS_POINTSCALE_A";
734 case SVGA3D_RS_POINTSCALE_B: /* float */
735 return "SVGA3D_RS_POINTSCALE_B";
736 case SVGA3D_RS_POINTSCALE_C: /* float */
737 return "SVGA3D_RS_POINTSCALE_C";
738 case SVGA3D_RS_AMBIENT: /* SVGA3dColor - identical */
739 return "SVGA3D_RS_AMBIENT";
740 case SVGA3D_RS_CLIPPLANEENABLE: /* SVGA3dClipPlanes - identical */
741 return "SVGA3D_RS_CLIPPLANEENABLE";
742 case SVGA3D_RS_FOGCOLOR: /* SVGA3dColor - identical */
743 return "SVGA3D_RS_FOGCOLOR";
744 case SVGA3D_RS_FOGSTART: /* float */
745 return "SVGA3D_RS_FOGSTART";
746 case SVGA3D_RS_FOGEND: /* float */
747 return "SVGA3D_RS_FOGEND";
748 case SVGA3D_RS_FOGDENSITY: /* float */
749 return "SVGA3D_RS_FOGDENSITY";
750 case SVGA3D_RS_RANGEFOGENABLE: /* SVGA3dBool */
751 return "SVGA3D_RS_RANGEFOGENABLE";
752 case SVGA3D_RS_FOGMODE: /* SVGA3dFogMode */
753 return "SVGA3D_RS_FOGMODE";
754 case SVGA3D_RS_FILLMODE: /* SVGA3dFillMode */
755 return "SVGA3D_RS_FILLMODE";
756 case SVGA3D_RS_SHADEMODE: /* SVGA3dShadeMode */
757 return "SVGA3D_RS_SHADEMODE";
758 case SVGA3D_RS_LINEPATTERN: /* SVGA3dLinePattern */
759 return "SVGA3D_RS_LINEPATTERN";
760 case SVGA3D_RS_SRCBLEND: /* SVGA3dBlendOp */
761 return "SVGA3D_RS_SRCBLEND";
762 case SVGA3D_RS_DSTBLEND: /* SVGA3dBlendOp */
763 return "SVGA3D_RS_DSTBLEND";
764 case SVGA3D_RS_BLENDEQUATION: /* SVGA3dBlendEquation */
765 return "SVGA3D_RS_BLENDEQUATION";
766 case SVGA3D_RS_CULLMODE: /* SVGA3dFace */
767 return "SVGA3D_RS_CULLMODE";
768 case SVGA3D_RS_ZFUNC: /* SVGA3dCmpFunc */
769 return "SVGA3D_RS_ZFUNC";
770 case SVGA3D_RS_ALPHAFUNC: /* SVGA3dCmpFunc */
771 return "SVGA3D_RS_ALPHAFUNC";
772 case SVGA3D_RS_STENCILFUNC: /* SVGA3dCmpFunc */
773 return "SVGA3D_RS_STENCILFUNC";
774 case SVGA3D_RS_STENCILFAIL: /* SVGA3dStencilOp */
775 return "SVGA3D_RS_STENCILFAIL";
776 case SVGA3D_RS_STENCILZFAIL: /* SVGA3dStencilOp */
777 return "SVGA3D_RS_STENCILZFAIL";
778 case SVGA3D_RS_STENCILPASS: /* SVGA3dStencilOp */
779 return "SVGA3D_RS_STENCILPASS";
780 case SVGA3D_RS_ALPHAREF: /* float (0.0 .. 1.0) */
781 return "SVGA3D_RS_ALPHAREF";
782 case SVGA3D_RS_FRONTWINDING: /* SVGA3dFrontWinding */
783 return "SVGA3D_RS_FRONTWINDING";
784 case SVGA3D_RS_COORDINATETYPE: /* SVGA3dCoordinateType */
785 return "SVGA3D_RS_COORDINATETYPE";
786 case SVGA3D_RS_ZBIAS: /* float */
787 return "SVGA3D_RS_ZBIAS";
788 case SVGA3D_RS_COLORWRITEENABLE: /* SVGA3dColorMask */
789 return "SVGA3D_RS_COLORWRITEENABLE";
790 case SVGA3D_RS_VERTEXMATERIALENABLE: /* SVGA3dBool */
791 return "SVGA3D_RS_VERTEXMATERIALENABLE";
792 case SVGA3D_RS_DIFFUSEMATERIALSOURCE: /* SVGA3dVertexMaterial */
793 return "SVGA3D_RS_DIFFUSEMATERIALSOURCE";
794 case SVGA3D_RS_SPECULARMATERIALSOURCE: /* SVGA3dVertexMaterial */
795 return "SVGA3D_RS_SPECULARMATERIALSOURCE";
796 case SVGA3D_RS_AMBIENTMATERIALSOURCE: /* SVGA3dVertexMaterial */
797 return "SVGA3D_RS_AMBIENTMATERIALSOURCE";
798 case SVGA3D_RS_EMISSIVEMATERIALSOURCE: /* SVGA3dVertexMaterial */
799 return "SVGA3D_RS_EMISSIVEMATERIALSOURCE";
800 case SVGA3D_RS_TEXTUREFACTOR: /* SVGA3dColor */
801 return "SVGA3D_RS_TEXTUREFACTOR";
802 case SVGA3D_RS_LOCALVIEWER: /* SVGA3dBool */
803 return "SVGA3D_RS_LOCALVIEWER";
804 case SVGA3D_RS_SCISSORTESTENABLE: /* SVGA3dBool */
805 return "SVGA3D_RS_SCISSORTESTENABLE";
806 case SVGA3D_RS_BLENDCOLOR: /* SVGA3dColor */
807 return "SVGA3D_RS_BLENDCOLOR";
808 case SVGA3D_RS_STENCILENABLE2SIDED: /* SVGA3dBool */
809 return "SVGA3D_RS_STENCILENABLE2SIDED";
810 case SVGA3D_RS_CCWSTENCILFUNC: /* SVGA3dCmpFunc */
811 return "SVGA3D_RS_CCWSTENCILFUNC";
812 case SVGA3D_RS_CCWSTENCILFAIL: /* SVGA3dStencilOp */
813 return "SVGA3D_RS_CCWSTENCILFAIL";
814 case SVGA3D_RS_CCWSTENCILZFAIL: /* SVGA3dStencilOp */
815 return "SVGA3D_RS_CCWSTENCILZFAIL";
816 case SVGA3D_RS_CCWSTENCILPASS: /* SVGA3dStencilOp */
817 return "SVGA3D_RS_CCWSTENCILPASS";
818 case SVGA3D_RS_VERTEXBLEND: /* SVGA3dVertexBlendFlags */
819 return "SVGA3D_RS_VERTEXBLEND";
820 case SVGA3D_RS_SLOPESCALEDEPTHBIAS: /* float */
821 return "SVGA3D_RS_SLOPESCALEDEPTHBIAS";
822 case SVGA3D_RS_DEPTHBIAS: /* float */
823 return "SVGA3D_RS_DEPTHBIAS";
824 case SVGA3D_RS_OUTPUTGAMMA: /* float */
825 return "SVGA3D_RS_OUTPUTGAMMA";
826 case SVGA3D_RS_ZVISIBLE: /* SVGA3dBool */
827 return "SVGA3D_RS_ZVISIBLE";
828 case SVGA3D_RS_LASTPIXEL: /* SVGA3dBool */
829 return "SVGA3D_RS_LASTPIXEL";
830 case SVGA3D_RS_CLIPPING: /* SVGA3dBool */
831 return "SVGA3D_RS_CLIPPING";
832 case SVGA3D_RS_WRAP0: /* SVGA3dWrapFlags */
833 return "SVGA3D_RS_WRAP0";
834 case SVGA3D_RS_WRAP1: /* SVGA3dWrapFlags */
835 return "SVGA3D_RS_WRAP1";
836 case SVGA3D_RS_WRAP2: /* SVGA3dWrapFlags */
837 return "SVGA3D_RS_WRAP2";
838 case SVGA3D_RS_WRAP3: /* SVGA3dWrapFlags */
839 return "SVGA3D_RS_WRAP3";
840 case SVGA3D_RS_WRAP4: /* SVGA3dWrapFlags */
841 return "SVGA3D_RS_WRAP4";
842 case SVGA3D_RS_WRAP5: /* SVGA3dWrapFlags */
843 return "SVGA3D_RS_WRAP5";
844 case SVGA3D_RS_WRAP6: /* SVGA3dWrapFlags */
845 return "SVGA3D_RS_WRAP6";
846 case SVGA3D_RS_WRAP7: /* SVGA3dWrapFlags */
847 return "SVGA3D_RS_WRAP7";
848 case SVGA3D_RS_WRAP8: /* SVGA3dWrapFlags */
849 return "SVGA3D_RS_WRAP8";
850 case SVGA3D_RS_WRAP9: /* SVGA3dWrapFlags */
851 return "SVGA3D_RS_WRAP9";
852 case SVGA3D_RS_WRAP10: /* SVGA3dWrapFlags */
853 return "SVGA3D_RS_WRAP10";
854 case SVGA3D_RS_WRAP11: /* SVGA3dWrapFlags */
855 return "SVGA3D_RS_WRAP11";
856 case SVGA3D_RS_WRAP12: /* SVGA3dWrapFlags */
857 return "SVGA3D_RS_WRAP12";
858 case SVGA3D_RS_WRAP13: /* SVGA3dWrapFlags */
859 return "SVGA3D_RS_WRAP13";
860 case SVGA3D_RS_WRAP14: /* SVGA3dWrapFlags */
861 return "SVGA3D_RS_WRAP14";
862 case SVGA3D_RS_WRAP15: /* SVGA3dWrapFlags */
863 return "SVGA3D_RS_WRAP15";
864 case SVGA3D_RS_MULTISAMPLEANTIALIAS: /* SVGA3dBool */
865 return "SVGA3D_RS_MULTISAMPLEANTIALIAS";
866 case SVGA3D_RS_MULTISAMPLEMASK: /* uint32_t */
867 return "SVGA3D_RS_MULTISAMPLEMASK";
868 case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: /* SVGA3dBool */
869 return "SVGA3D_RS_INDEXEDVERTEXBLENDENABLE";
870 case SVGA3D_RS_TWEENFACTOR: /* float */
871 return "SVGA3D_RS_TWEENFACTOR";
872 case SVGA3D_RS_ANTIALIASEDLINEENABLE: /* SVGA3dBool */
873 return "SVGA3D_RS_ANTIALIASEDLINEENABLE";
874 case SVGA3D_RS_COLORWRITEENABLE1: /* SVGA3dColorMask */
875 return "SVGA3D_RS_COLORWRITEENABLE1";
876 case SVGA3D_RS_COLORWRITEENABLE2: /* SVGA3dColorMask */
877 return "SVGA3D_RS_COLORWRITEENABLE2";
878 case SVGA3D_RS_COLORWRITEENABLE3: /* SVGA3dColorMask */
879 return "SVGA3D_RS_COLORWRITEENABLE3";
880 case SVGA3D_RS_SEPARATEALPHABLENDENABLE: /* SVGA3dBool */
881 return "SVGA3D_RS_SEPARATEALPHABLENDENABLE";
882 case SVGA3D_RS_SRCBLENDALPHA: /* SVGA3dBlendOp */
883 return "SVGA3D_RS_SRCBLENDALPHA";
884 case SVGA3D_RS_DSTBLENDALPHA: /* SVGA3dBlendOp */
885 return "SVGA3D_RS_DSTBLENDALPHA";
886 case SVGA3D_RS_BLENDEQUATIONALPHA: /* SVGA3dBlendEquation */
887 return "SVGA3D_RS_BLENDEQUATIONALPHA";
888 case SVGA3D_RS_TRANSPARENCYANTIALIAS: /* SVGA3dTransparencyAntialiasType */
889 return "SVGA3D_RS_TRANSPARENCYANTIALIAS";
890 case SVGA3D_RS_LINEWIDTH: /* float */
891 return "SVGA3D_RS_LINEWIDTH";
892 default:
893 return "UNKNOWN";
894 }
895}
896
897const char *vmsvga3dTextureStateToString(SVGA3dTextureStateName textureState)
898{
899 switch (textureState)
900 {
901 case SVGA3D_TS_BIND_TEXTURE:
902 return "SVGA3D_TS_BIND_TEXTURE";
903 case SVGA3D_TS_COLOROP:
904 return "SVGA3D_TS_COLOROP";
905 case SVGA3D_TS_COLORARG1:
906 return "SVGA3D_TS_COLORARG1";
907 case SVGA3D_TS_COLORARG2:
908 return "SVGA3D_TS_COLORARG2";
909 case SVGA3D_TS_ALPHAOP:
910 return "SVGA3D_TS_ALPHAOP";
911 case SVGA3D_TS_ALPHAARG1:
912 return "SVGA3D_TS_ALPHAARG1";
913 case SVGA3D_TS_ALPHAARG2:
914 return "SVGA3D_TS_ALPHAARG2";
915 case SVGA3D_TS_ADDRESSU:
916 return "SVGA3D_TS_ADDRESSU";
917 case SVGA3D_TS_ADDRESSV:
918 return "SVGA3D_TS_ADDRESSV";
919 case SVGA3D_TS_MIPFILTER:
920 return "SVGA3D_TS_MIPFILTER";
921 case SVGA3D_TS_MAGFILTER:
922 return "SVGA3D_TS_MAGFILTER";
923 case SVGA3D_TS_MINFILTER:
924 return "SVGA3D_TS_MINFILTER";
925 case SVGA3D_TS_BORDERCOLOR:
926 return "SVGA3D_TS_BORDERCOLOR";
927 case SVGA3D_TS_TEXCOORDINDEX:
928 return "SVGA3D_TS_TEXCOORDINDEX";
929 case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
930 return "SVGA3D_TS_TEXTURETRANSFORMFLAGS";
931 case SVGA3D_TS_TEXCOORDGEN:
932 return "SVGA3D_TS_TEXCOORDGEN";
933 case SVGA3D_TS_BUMPENVMAT00:
934 return "SVGA3D_TS_BUMPENVMAT00";
935 case SVGA3D_TS_BUMPENVMAT01:
936 return "SVGA3D_TS_BUMPENVMAT01";
937 case SVGA3D_TS_BUMPENVMAT10:
938 return "SVGA3D_TS_BUMPENVMAT10";
939 case SVGA3D_TS_BUMPENVMAT11:
940 return "SVGA3D_TS_BUMPENVMAT11";
941 case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
942 return "SVGA3D_TS_TEXTURE_MIPMAP_LEVEL";
943 case SVGA3D_TS_TEXTURE_LOD_BIAS:
944 return "SVGA3D_TS_TEXTURE_LOD_BIAS";
945 case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
946 return "SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL";
947 case SVGA3D_TS_ADDRESSW:
948 return "SVGA3D_TS_ADDRESSW";
949 case SVGA3D_TS_GAMMA:
950 return "SVGA3D_TS_GAMMA";
951 case SVGA3D_TS_BUMPENVLSCALE:
952 return "SVGA3D_TS_BUMPENVLSCALE";
953 case SVGA3D_TS_BUMPENVLOFFSET:
954 return "SVGA3D_TS_BUMPENVLOFFSET";
955 case SVGA3D_TS_COLORARG0:
956 return "SVGA3D_TS_COLORARG0";
957 case SVGA3D_TS_ALPHAARG0:
958 return "SVGA3D_TS_ALPHAARG0";
959 default:
960 return "UNKNOWN";
961 }
962}
963
964const char *vmsvgaTransformToString(SVGA3dTransformType type)
965{
966 switch (type)
967 {
968 case SVGA3D_TRANSFORM_INVALID:
969 return "SVGA3D_TRANSFORM_INVALID";
970 case SVGA3D_TRANSFORM_WORLD:
971 return "SVGA3D_TRANSFORM_WORLD";
972 case SVGA3D_TRANSFORM_VIEW:
973 return "SVGA3D_TRANSFORM_VIEW";
974 case SVGA3D_TRANSFORM_PROJECTION:
975 return "SVGA3D_TRANSFORM_PROJECTION";
976 case SVGA3D_TRANSFORM_TEXTURE0:
977 return "SVGA3D_TRANSFORM_TEXTURE0";
978 case SVGA3D_TRANSFORM_TEXTURE1:
979 return "SVGA3D_TRANSFORM_TEXTURE1";
980 case SVGA3D_TRANSFORM_TEXTURE2:
981 return "SVGA3D_TRANSFORM_TEXTURE2";
982 case SVGA3D_TRANSFORM_TEXTURE3:
983 return "SVGA3D_TRANSFORM_TEXTURE3";
984 case SVGA3D_TRANSFORM_TEXTURE4:
985 return "SVGA3D_TRANSFORM_TEXTURE4";
986 case SVGA3D_TRANSFORM_TEXTURE5:
987 return "SVGA3D_TRANSFORM_TEXTURE5";
988 case SVGA3D_TRANSFORM_TEXTURE6:
989 return "SVGA3D_TRANSFORM_TEXTURE6";
990 case SVGA3D_TRANSFORM_TEXTURE7:
991 return "SVGA3D_TRANSFORM_TEXTURE7";
992 case SVGA3D_TRANSFORM_WORLD1:
993 return "SVGA3D_TRANSFORM_WORLD1";
994 case SVGA3D_TRANSFORM_WORLD2:
995 return "SVGA3D_TRANSFORM_WORLD2";
996 case SVGA3D_TRANSFORM_WORLD3:
997 return "SVGA3D_TRANSFORM_WORLD3";
998 default:
999 return "UNKNOWN";
1000 }
1001}
1002
1003const char *vmsvgaDeclUsage2String(SVGA3dDeclUsage usage)
1004{
1005 switch (usage)
1006 {
1007 case SVGA3D_DECLUSAGE_POSITION:
1008 return "SVGA3D_DECLUSAGE_POSITION";
1009 case SVGA3D_DECLUSAGE_BLENDWEIGHT:
1010 return "SVGA3D_DECLUSAGE_BLENDWEIGHT";
1011 case SVGA3D_DECLUSAGE_BLENDINDICES:
1012 return "SVGA3D_DECLUSAGE_BLENDINDICES";
1013 case SVGA3D_DECLUSAGE_NORMAL:
1014 return "SVGA3D_DECLUSAGE_NORMAL";
1015 case SVGA3D_DECLUSAGE_PSIZE:
1016 return "SVGA3D_DECLUSAGE_PSIZE";
1017 case SVGA3D_DECLUSAGE_TEXCOORD:
1018 return "SVGA3D_DECLUSAGE_TEXCOORD";
1019 case SVGA3D_DECLUSAGE_TANGENT:
1020 return "SVGA3D_DECLUSAGE_TANGENT";
1021 case SVGA3D_DECLUSAGE_BINORMAL:
1022 return "SVGA3D_DECLUSAGE_BINORMAL";
1023 case SVGA3D_DECLUSAGE_TESSFACTOR:
1024 return "SVGA3D_DECLUSAGE_TESSFACTOR";
1025 case SVGA3D_DECLUSAGE_POSITIONT:
1026 return "SVGA3D_DECLUSAGE_POSITIONT";
1027 case SVGA3D_DECLUSAGE_COLOR:
1028 return "SVGA3D_DECLUSAGE_COLOR";
1029 case SVGA3D_DECLUSAGE_FOG:
1030 return "SVGA3D_DECLUSAGE_FOG";
1031 case SVGA3D_DECLUSAGE_DEPTH:
1032 return "SVGA3D_DECLUSAGE_DEPTH";
1033 case SVGA3D_DECLUSAGE_SAMPLE:
1034 return "SVGA3D_DECLUSAGE_SAMPLE";
1035 default:
1036 return "UNKNOWN!!";
1037 }
1038}
1039
1040const char *vmsvgaDeclMethod2String(SVGA3dDeclMethod method)
1041{
1042 switch (method)
1043 {
1044 case SVGA3D_DECLMETHOD_DEFAULT:
1045 return "SVGA3D_DECLMETHOD_DEFAULT";
1046 case SVGA3D_DECLMETHOD_PARTIALU:
1047 return "SVGA3D_DECLMETHOD_PARTIALU";
1048 case SVGA3D_DECLMETHOD_PARTIALV:
1049 return "SVGA3D_DECLMETHOD_PARTIALV";
1050 case SVGA3D_DECLMETHOD_CROSSUV:
1051 return "SVGA3D_DECLMETHOD_CROSSUV";
1052 case SVGA3D_DECLMETHOD_UV:
1053 return "SVGA3D_DECLMETHOD_UV";
1054 case SVGA3D_DECLMETHOD_LOOKUP:
1055 return "SVGA3D_DECLMETHOD_LOOKUP";
1056 case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
1057 return "SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED";
1058 default:
1059 return "UNKNOWN!!";
1060 }
1061}
1062
1063const char *vmsvgaDeclType2String(SVGA3dDeclType type)
1064{
1065 switch (type)
1066 {
1067 case SVGA3D_DECLTYPE_FLOAT1:
1068 return "SVGA3D_DECLTYPE_FLOAT1";
1069 case SVGA3D_DECLTYPE_FLOAT2:
1070 return "SVGA3D_DECLTYPE_FLOAT2";
1071 case SVGA3D_DECLTYPE_FLOAT3:
1072 return "SVGA3D_DECLTYPE_FLOAT3";
1073 case SVGA3D_DECLTYPE_FLOAT4:
1074 return "SVGA3D_DECLTYPE_FLOAT4";
1075 case SVGA3D_DECLTYPE_D3DCOLOR:
1076 return "SVGA3D_DECLTYPE_D3DCOLOR";
1077 case SVGA3D_DECLTYPE_UBYTE4:
1078 return "SVGA3D_DECLTYPE_UBYTE4";
1079 case SVGA3D_DECLTYPE_SHORT2:
1080 return "SVGA3D_DECLTYPE_SHORT2";
1081 case SVGA3D_DECLTYPE_SHORT4:
1082 return "SVGA3D_DECLTYPE_SHORT4";
1083 case SVGA3D_DECLTYPE_UBYTE4N:
1084 return "SVGA3D_DECLTYPE_UBYTE4N";
1085 case SVGA3D_DECLTYPE_SHORT2N:
1086 return "SVGA3D_DECLTYPE_SHORT2N";
1087 case SVGA3D_DECLTYPE_SHORT4N:
1088 return "SVGA3D_DECLTYPE_SHORT4N";
1089 case SVGA3D_DECLTYPE_USHORT2N:
1090 return "SVGA3D_DECLTYPE_USHORT2N";
1091 case SVGA3D_DECLTYPE_USHORT4N:
1092 return "SVGA3D_DECLTYPE_USHORT4N";
1093 case SVGA3D_DECLTYPE_UDEC3:
1094 return "SVGA3D_DECLTYPE_UDEC3";
1095 case SVGA3D_DECLTYPE_DEC3N:
1096 return "SVGA3D_DECLTYPE_DEC3N";
1097 case SVGA3D_DECLTYPE_FLOAT16_2:
1098 return "SVGA3D_DECLTYPE_FLOAT16_2";
1099 case SVGA3D_DECLTYPE_FLOAT16_4:
1100 return "SVGA3D_DECLTYPE_FLOAT16_4";
1101 default:
1102 return "UNKNOWN!!";
1103 }
1104}
1105
1106const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType)
1107{
1108 switch (PrimitiveType)
1109 {
1110 case SVGA3D_PRIMITIVE_TRIANGLELIST:
1111 return "SVGA3D_PRIMITIVE_TRIANGLELIST";
1112 case SVGA3D_PRIMITIVE_POINTLIST:
1113 return "SVGA3D_PRIMITIVE_POINTLIST";
1114 case SVGA3D_PRIMITIVE_LINELIST:
1115 return "SVGA3D_PRIMITIVE_LINELIST";
1116 case SVGA3D_PRIMITIVE_LINESTRIP:
1117 return "SVGA3D_PRIMITIVE_LINESTRIP";
1118 case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
1119 return "SVGA3D_PRIMITIVE_TRIANGLESTRIP";
1120 case SVGA3D_PRIMITIVE_TRIANGLEFAN:
1121 return "SVGA3D_PRIMITIVE_TRIANGLEFAN";
1122 default:
1123 return "UNKNOWN";
1124 }
1125}
1126
1127#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