VirtualBox

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

Last change on this file since 84677 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.7 KB
Line 
1/* $Id: DevVGA-SVGA3d-shared.cpp 82968 2020-02-04 10:35:17Z 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 "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 WNDCLASSEX 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 (!RegisterClassEx(&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 HWND *pHwnd = (HWND *)msg.wParam;
130 LPCREATESTRUCT pCS = (LPCREATESTRUCT) msg.lParam;
131
132 *pHwnd = CreateWindowEx(pCS->dwExStyle,
133 VMSVGA3D_WNDCLASSNAME,
134 pCS->lpszName,
135 pCS->style,
136 pCS->x,
137 pCS->y,
138 pCS->cx,
139 pCS->cy,
140 pCS->hwndParent,
141 pCS->hMenu,
142 pCS->hInstance,
143 NULL);
144 AssertMsg(*pHwnd, ("CreateWindowEx %x %s %s %x (%d,%d)(%d,%d), %x %x %x error=%x\n", pCS->dwExStyle, pCS->lpszName, VMSVGA3D_WNDCLASSNAME, pCS->style, pCS->x,
145 pCS->y, pCS->cx, pCS->cy,pCS->hwndParent, pCS->hMenu, pCS->hInstance, GetLastError()));
146
147 /* Signal to the caller that we're done. */
148 RTSemEventSignal(WndRequestSem);
149 continue;
150 }
151
152 if (msg.message == WM_VMSVGA3D_DESTROYWINDOW)
153 {
154 BOOL fRc = DestroyWindow((HWND)msg.wParam);
155 Assert(fRc); NOREF(fRc);
156
157 /* Signal to the caller that we're done. */
158 RTSemEventSignal(WndRequestSem);
159 continue;
160 }
161
162 TranslateMessage(&msg);
163 DispatchMessage(&msg);
164 }
165 else
166 {
167 Log(("GetMessage failed with %x\n", GetLastError()));
168 break;
169 }
170 }
171
172 Log(("vmsvga3dWindowThread: end loop\n"));
173 return VINF_SUCCESS;
174}
175
176/* Window procedure for our top level window overlays. */
177static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
178{
179 switch (uMsg)
180 {
181 case WM_CLOSE:
182 Log7(("vmsvga3dWndProc(%p): WM_CLOSE\n", hwnd));
183 break;
184
185 case WM_DESTROY:
186 Log7(("vmsvga3dWndProc(%p): WM_DESTROY\n", hwnd));
187 break;
188
189 case WM_NCHITTEST:
190 Log7(("vmsvga3dWndProc(%p): WM_NCHITTEST\n", hwnd));
191 return HTNOWHERE;
192
193# if 0 /* flicker experiment, no help here. */
194 case WM_PAINT:
195 Log7(("vmsvga3dWndProc(%p): WM_PAINT %p %p\n", hwnd, wParam, lParam));
196 ValidateRect(hwnd, NULL);
197 return 0;
198 case WM_ERASEBKGND:
199 Log7(("vmsvga3dWndProc(%p): WM_ERASEBKGND %p %p\n", hwnd, wParam, lParam));
200 return TRUE;
201 case WM_NCPAINT:
202 Log7(("vmsvga3dWndProc(%p): WM_NCPAINT %p %p\n", hwnd, wParam, lParam));
203 break;
204 case WM_WINDOWPOSCHANGING:
205 {
206 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
207 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGING %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
208 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
209 break;
210 }
211 case WM_WINDOWPOSCHANGED:
212 {
213 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
214 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGED %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
215 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
216 break;
217 }
218 case WM_MOVE:
219 Log7(("vmsvga3dWndProc(%p): WM_MOVE %p %p\n", hwnd, wParam, lParam));
220 break;
221 case WM_SIZE:
222 Log7(("vmsvga3dWndProc(%p): WM_SIZE %p %p\n", hwnd, wParam, lParam));
223 break;
224
225 default:
226 Log7(("vmsvga3dWndProc(%p): %#x %p %p\n", hwnd, uMsg, wParam, lParam));
227# endif
228 }
229 return DefWindowProc(hwnd, uMsg, wParam, lParam);
230}
231
232int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd)
233{
234 /* Create a context window with minimal 4x4 size. We will never use the swapchain
235 * to present the rendered image. Rendered images from the guest will be copied to
236 * the VMSVGA SCREEN object, which can be either an offscreen render target or
237 * system memory in the guest VRAM.
238 */
239 CREATESTRUCT cs;
240 cs.lpCreateParams = NULL;
241 cs.hInstance = hInstance;
242 cs.hMenu = NULL;
243 cs.hwndParent = HWND_DESKTOP;
244 cs.cx = 4;
245 cs.cy = 4;
246 cs.x = 0;
247 cs.y = 0;
248 cs.style = WS_DISABLED;
249 cs.lpszName = NULL;
250 cs.lpszClass = 0;
251 cs.dwExStyle = WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY;
252
253 int rc = vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)&cs);
254 return rc;
255}
256
257#endif /* RT_OS_WINDOWS */
258
259
260/**
261 * Calculate the size and dimensions of one block.
262 */
263uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
264 uint32_t *pcxBlock,
265 uint32_t *pcyBlock)
266{
267 uint32_t u32 = 0;
268 if (!pcxBlock) pcxBlock = &u32;
269 if (!pcyBlock) pcyBlock = &u32;
270
271 switch (format)
272 {
273 case SVGA3D_X8R8G8B8:
274 case SVGA3D_A8R8G8B8:
275 *pcxBlock = 1;
276 *pcyBlock = 1;
277 return 4;
278
279 case SVGA3D_R5G6B5:
280 case SVGA3D_X1R5G5B5:
281 case SVGA3D_A1R5G5B5:
282 case SVGA3D_A4R4G4B4:
283 *pcxBlock = 1;
284 *pcyBlock = 1;
285 return 2;
286
287 case SVGA3D_Z_D32:
288 case SVGA3D_Z_D24S8:
289 case SVGA3D_Z_D24X8:
290 case SVGA3D_Z_DF24:
291 case SVGA3D_Z_D24S8_INT:
292 *pcxBlock = 1;
293 *pcyBlock = 1;
294 return 4;
295
296 case SVGA3D_Z_D16:
297 case SVGA3D_Z_DF16:
298 case SVGA3D_Z_D15S1:
299 *pcxBlock = 1;
300 *pcyBlock = 1;
301 return 2;
302
303 case SVGA3D_LUMINANCE8:
304 case SVGA3D_LUMINANCE4_ALPHA4:
305 *pcxBlock = 1;
306 *pcyBlock = 1;
307 return 1;
308
309 case SVGA3D_LUMINANCE16:
310 case SVGA3D_LUMINANCE8_ALPHA8:
311 *pcxBlock = 1;
312 *pcyBlock = 1;
313 return 2;
314
315 case SVGA3D_DXT1:
316 *pcxBlock = 4;
317 *pcyBlock = 4;
318 return 8;
319
320 case SVGA3D_DXT2:
321 case SVGA3D_DXT3:
322 case SVGA3D_DXT4:
323 case SVGA3D_DXT5:
324 *pcxBlock = 4;
325 *pcyBlock = 4;
326 return 16;
327
328 case SVGA3D_BUMPU8V8:
329 case SVGA3D_BUMPL6V5U5:
330 *pcxBlock = 1;
331 *pcyBlock = 1;
332 return 2;
333
334 case SVGA3D_BUMPX8L8V8U8:
335 case SVGA3D_Q8W8V8U8:
336 *pcxBlock = 1;
337 *pcyBlock = 1;
338 return 4;
339
340 case SVGA3D_V8U8:
341 case SVGA3D_CxV8U8:
342 *pcxBlock = 1;
343 *pcyBlock = 1;
344 return 2;
345
346 case SVGA3D_X8L8V8U8:
347 case SVGA3D_A2W10V10U10:
348 *pcxBlock = 1;
349 *pcyBlock = 1;
350 return 4;
351
352 case SVGA3D_ARGB_S10E5: /* 16-bit floating-point ARGB */
353 *pcxBlock = 1;
354 *pcyBlock = 1;
355 return 8;
356 case SVGA3D_ARGB_S23E8: /* 32-bit floating-point ARGB */
357 *pcxBlock = 1;
358 *pcyBlock = 1;
359 return 16;
360
361 case SVGA3D_A2R10G10B10:
362 *pcxBlock = 1;
363 *pcyBlock = 1;
364 return 4;
365
366 case SVGA3D_ALPHA8:
367 *pcxBlock = 1;
368 *pcyBlock = 1;
369 return 1;
370
371 case SVGA3D_R_S10E5:
372 *pcxBlock = 1;
373 *pcyBlock = 1;
374 return 2;
375
376 case SVGA3D_R_S23E8:
377 case SVGA3D_RG_S10E5:
378 *pcxBlock = 1;
379 *pcyBlock = 1;
380 return 4;
381
382 case SVGA3D_RG_S23E8:
383 *pcxBlock = 1;
384 *pcyBlock = 1;
385 return 8;
386
387 /*
388 * Any surface can be used as a buffer object, but SVGA3D_BUFFER is
389 * the most efficient format to use when creating new surfaces
390 * expressly for index or vertex data.
391 */
392 case SVGA3D_BUFFER:
393 *pcxBlock = 1;
394 *pcyBlock = 1;
395 return 1;
396
397 case SVGA3D_UYVY:
398 *pcxBlock = 2;
399 *pcyBlock = 1;
400 return 4;
401
402 case SVGA3D_YUY2:
403 *pcxBlock = 2;
404 *pcyBlock = 1;
405 return 4;
406
407 case SVGA3D_V16U16:
408 *pcxBlock = 1;
409 *pcyBlock = 1;
410 return 4;
411
412 case SVGA3D_G16R16:
413 *pcxBlock = 1;
414 *pcyBlock = 1;
415 return 4;
416 case SVGA3D_A16B16G16R16:
417 *pcxBlock = 1;
418 *pcyBlock = 1;
419 return 8;
420 case SVGA3D_R8G8B8A8_UNORM:
421 case SVGA3D_R8G8B8A8_SNORM:
422 *pcxBlock = 1;
423 *pcyBlock = 1;
424 return 4;
425 case SVGA3D_R16G16_UNORM:
426 *pcxBlock = 1;
427 *pcyBlock = 1;
428 return 4;
429
430 default:
431 *pcxBlock = 1;
432 *pcyBlock = 1;
433 AssertFailedReturn(4);
434 }
435}
436
437#ifdef LOG_ENABLED
438
439const char *vmsvga3dGetCapString(uint32_t idxCap)
440{
441 switch (idxCap)
442 {
443 case SVGA3D_DEVCAP_3D:
444 return "SVGA3D_DEVCAP_3D";
445 case SVGA3D_DEVCAP_MAX_LIGHTS:
446 return "SVGA3D_DEVCAP_MAX_LIGHTS";
447 case SVGA3D_DEVCAP_MAX_TEXTURES:
448 return "SVGA3D_DEVCAP_MAX_TEXTURES";
449 case SVGA3D_DEVCAP_MAX_CLIP_PLANES:
450 return "SVGA3D_DEVCAP_MAX_CLIP_PLANES";
451 case SVGA3D_DEVCAP_VERTEX_SHADER_VERSION:
452 return "SVGA3D_DEVCAP_VERTEX_SHADER_VERSION";
453 case SVGA3D_DEVCAP_VERTEX_SHADER:
454 return "SVGA3D_DEVCAP_VERTEX_SHADER";
455 case SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION:
456 return "SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION";
457 case SVGA3D_DEVCAP_FRAGMENT_SHADER:
458 return "SVGA3D_DEVCAP_FRAGMENT_SHADER";
459 case SVGA3D_DEVCAP_MAX_RENDER_TARGETS:
460 return "SVGA3D_DEVCAP_MAX_RENDER_TARGETS";
461 case SVGA3D_DEVCAP_S23E8_TEXTURES:
462 return "SVGA3D_DEVCAP_S23E8_TEXTURES";
463 case SVGA3D_DEVCAP_S10E5_TEXTURES:
464 return "SVGA3D_DEVCAP_S10E5_TEXTURES";
465 case SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND:
466 return "SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND";
467 case SVGA3D_DEVCAP_D16_BUFFER_FORMAT:
468 return "SVGA3D_DEVCAP_D16_BUFFER_FORMAT";
469 case SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT:
470 return "SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT";
471 case SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT:
472 return "SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT";
473 case SVGA3D_DEVCAP_QUERY_TYPES:
474 return "SVGA3D_DEVCAP_QUERY_TYPES";
475 case SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING:
476 return "SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING";
477 case SVGA3D_DEVCAP_MAX_POINT_SIZE:
478 return "SVGA3D_DEVCAP_MAX_POINT_SIZE";
479 case SVGA3D_DEVCAP_MAX_SHADER_TEXTURES:
480 return "SVGA3D_DEVCAP_MAX_SHADER_TEXTURES";
481 case SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH:
482 return "SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH";
483 case SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT:
484 return "SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT";
485 case SVGA3D_DEVCAP_MAX_VOLUME_EXTENT:
486 return "SVGA3D_DEVCAP_MAX_VOLUME_EXTENT";
487 case SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT:
488 return "SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT";
489 case SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO:
490 return "SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO";
491 case SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY:
492 return "SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY";
493 case SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT:
494 return "SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT";
495 case SVGA3D_DEVCAP_MAX_VERTEX_INDEX:
496 return "SVGA3D_DEVCAP_MAX_VERTEX_INDEX";
497 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS:
498 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS";
499 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS:
500 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS";
501 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS:
502 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS";
503 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS:
504 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS";
505 case SVGA3D_DEVCAP_TEXTURE_OPS:
506 return "SVGA3D_DEVCAP_TEXTURE_OPS";
507 case SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES:
508 return "SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES";
509 case SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES:
510 return "SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES";
511 case SVGA3D_DEVCAP_ALPHATOCOVERAGE:
512 return "SVGA3D_DEVCAP_ALPHATOCOVERAGE";
513 case SVGA3D_DEVCAP_SUPERSAMPLE:
514 return "SVGA3D_DEVCAP_SUPERSAMPLE";
515 case SVGA3D_DEVCAP_AUTOGENMIPMAPS:
516 return "SVGA3D_DEVCAP_AUTOGENMIPMAPS";
517 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES:
518 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES";
519 case SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS:
520 return "SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS";
521 case SVGA3D_DEVCAP_MAX_CONTEXT_IDS:
522 return "SVGA3D_DEVCAP_MAX_CONTEXT_IDS";
523 case SVGA3D_DEVCAP_MAX_SURFACE_IDS:
524 return "SVGA3D_DEVCAP_MAX_SURFACE_IDS";
525 case SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8:
526 return "SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8";
527 case SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8:
528 return "SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8";
529 case SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10:
530 return "SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10";
531 case SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5:
532 return "SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5";
533 case SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5:
534 return "SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5";
535 case SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4:
536 return "SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4";
537 case SVGA3D_DEVCAP_SURFACEFMT_R5G6B5:
538 return "SVGA3D_DEVCAP_SURFACEFMT_R5G6B5";
539 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16:
540 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16";
541 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8:
542 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8";
543 case SVGA3D_DEVCAP_SURFACEFMT_ALPHA8:
544 return "SVGA3D_DEVCAP_SURFACEFMT_ALPHA8";
545 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8:
546 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8";
547 case SVGA3D_DEVCAP_SURFACEFMT_Z_D16:
548 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D16";
549 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8:
550 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8";
551 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8:
552 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8";
553 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
554 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF16";
555 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF24:
556 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF24";
557 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT:
558 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT";
559 case SVGA3D_DEVCAP_SURFACEFMT_DXT1:
560 return "SVGA3D_DEVCAP_SURFACEFMT_DXT1";
561 case SVGA3D_DEVCAP_SURFACEFMT_DXT2:
562 return "SVGA3D_DEVCAP_SURFACEFMT_DXT2";
563 case SVGA3D_DEVCAP_SURFACEFMT_DXT3:
564 return "SVGA3D_DEVCAP_SURFACEFMT_DXT3";
565 case SVGA3D_DEVCAP_SURFACEFMT_DXT4:
566 return "SVGA3D_DEVCAP_SURFACEFMT_DXT4";
567 case SVGA3D_DEVCAP_SURFACEFMT_DXT5:
568 return "SVGA3D_DEVCAP_SURFACEFMT_DXT5";
569 case SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8:
570 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8";
571 case SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10:
572 return "SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10";
573 case SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8:
574 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8";
575 case SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8:
576 return "SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8";
577 case SVGA3D_DEVCAP_SURFACEFMT_CxV8U8:
578 return "SVGA3D_DEVCAP_SURFACEFMT_CxV8U8";
579 case SVGA3D_DEVCAP_SURFACEFMT_R_S10E5:
580 return "SVGA3D_DEVCAP_SURFACEFMT_R_S10E5";
581 case SVGA3D_DEVCAP_SURFACEFMT_R_S23E8:
582 return "SVGA3D_DEVCAP_SURFACEFMT_R_S23E8";
583 case SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5:
584 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5";
585 case SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8:
586 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8";
587 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5:
588 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5";
589 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8:
590 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8";
591 case SVGA3D_DEVCAP_SURFACEFMT_V16U16:
592 return "SVGA3D_DEVCAP_SURFACEFMT_V16U16";
593 case SVGA3D_DEVCAP_SURFACEFMT_G16R16:
594 return "SVGA3D_DEVCAP_SURFACEFMT_G16R16";
595 case SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16:
596 return "SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16";
597 case SVGA3D_DEVCAP_SURFACEFMT_UYVY:
598 return "SVGA3D_DEVCAP_SURFACEFMT_UYVY";
599 case SVGA3D_DEVCAP_SURFACEFMT_YUY2:
600 return "SVGA3D_DEVCAP_SURFACEFMT_YUY2";
601 case SVGA3D_DEVCAP_SURFACEFMT_NV12:
602 return "SVGA3D_DEVCAP_SURFACEFMT_NV12";
603 case SVGA3D_DEVCAP_SURFACEFMT_AYUV:
604 return "SVGA3D_DEVCAP_SURFACEFMT_AYUV";
605 case SVGA3D_DEVCAP_SURFACEFMT_BC4_UNORM:
606 return "SVGA3D_DEVCAP_SURFACEFMT_BC4_UNORM";
607 case SVGA3D_DEVCAP_SURFACEFMT_BC5_UNORM:
608 return "SVGA3D_DEVCAP_SURFACEFMT_BC5_UNORM";
609 default:
610 return "UNEXPECTED";
611 }
612}
613
614const char *vmsvga3dGet3dFormatString(uint32_t format)
615{
616 static char szFormat[1024];
617
618 szFormat[0] = 0;
619
620 if (format & SVGA3DFORMAT_OP_TEXTURE)
621 strcat(szFormat, " - SVGA3DFORMAT_OP_TEXTURE\n");
622 if (format & SVGA3DFORMAT_OP_VOLUMETEXTURE)
623 strcat(szFormat, " - SVGA3DFORMAT_OP_VOLUMETEXTURE\n");
624 if (format & SVGA3DFORMAT_OP_CUBETEXTURE)
625 strcat(szFormat, " - SVGA3DFORMAT_OP_CUBETEXTURE\n");
626 if (format & SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET)
627 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET\n");
628 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET)
629 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET\n");
630 if (format & SVGA3DFORMAT_OP_ZSTENCIL)
631 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL\n");
632 if (format & SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH)
633 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH\n");
634 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET)
635 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET\n");
636 if (format & SVGA3DFORMAT_OP_DISPLAYMODE)
637 strcat(szFormat, " - SVGA3DFORMAT_OP_DISPLAYMODE\n");
638 if (format & SVGA3DFORMAT_OP_3DACCELERATION)
639 strcat(szFormat, " - SVGA3DFORMAT_OP_3DACCELERATION\n");
640 if (format & SVGA3DFORMAT_OP_PIXELSIZE)
641 strcat(szFormat, " - SVGA3DFORMAT_OP_PIXELSIZE\n");
642 if (format & SVGA3DFORMAT_OP_CONVERT_TO_ARGB)
643 strcat(szFormat, " - SVGA3DFORMAT_OP_CONVERT_TO_ARGB\n");
644 if (format & SVGA3DFORMAT_OP_OFFSCREENPLAIN)
645 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREENPLAIN\n");
646 if (format & SVGA3DFORMAT_OP_SRGBREAD)
647 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBREAD\n");
648 if (format & SVGA3DFORMAT_OP_BUMPMAP)
649 strcat(szFormat, " - SVGA3DFORMAT_OP_BUMPMAP\n");
650 if (format & SVGA3DFORMAT_OP_DMAP)
651 strcat(szFormat, " - SVGA3DFORMAT_OP_DMAP\n");
652 if (format & SVGA3DFORMAT_OP_NOFILTER)
653 strcat(szFormat, " - SVGA3DFORMAT_OP_NOFILTER\n");
654 if (format & SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB)
655 strcat(szFormat, " - SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB\n");
656 if (format & SVGA3DFORMAT_OP_SRGBWRITE)
657 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBWRITE\n");
658 if (format & SVGA3DFORMAT_OP_NOALPHABLEND)
659 strcat(szFormat, " - SVGA3DFORMAT_OP_NOALPHABLEND\n");
660 if (format & SVGA3DFORMAT_OP_AUTOGENMIPMAP)
661 strcat(szFormat, " - SVGA3DFORMAT_OP_AUTOGENMIPMAP\n");
662 if (format & SVGA3DFORMAT_OP_VERTEXTEXTURE)
663 strcat(szFormat, " - SVGA3DFORMAT_OP_VERTEXTEXTURE\n");
664 if (format & SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
665 strcat(szFormat, " - SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP\n");
666 return szFormat;
667}
668
669const char *vmsvga3dGetRenderStateName(uint32_t state)
670{
671 switch (state)
672 {
673 case SVGA3D_RS_ZENABLE: /* SVGA3dBool */
674 return "SVGA3D_RS_ZENABLE";
675 case SVGA3D_RS_ZWRITEENABLE: /* SVGA3dBool */
676 return "SVGA3D_RS_ZWRITEENABLE";
677 case SVGA3D_RS_ALPHATESTENABLE: /* SVGA3dBool */
678 return "SVGA3D_RS_ALPHATESTENABLE";
679 case SVGA3D_RS_DITHERENABLE: /* SVGA3dBool */
680 return "SVGA3D_RS_DITHERENABLE";
681 case SVGA3D_RS_BLENDENABLE: /* SVGA3dBool */
682 return "SVGA3D_RS_BLENDENABLE";
683 case SVGA3D_RS_FOGENABLE: /* SVGA3dBool */
684 return "SVGA3D_RS_FOGENABLE";
685 case SVGA3D_RS_SPECULARENABLE: /* SVGA3dBool */
686 return "SVGA3D_RS_SPECULARENABLE";
687 case SVGA3D_RS_STENCILENABLE: /* SVGA3dBool */
688 return "SVGA3D_RS_STENCILENABLE";
689 case SVGA3D_RS_LIGHTINGENABLE: /* SVGA3dBool */
690 return "SVGA3D_RS_LIGHTINGENABLE";
691 case SVGA3D_RS_NORMALIZENORMALS: /* SVGA3dBool */
692 return "SVGA3D_RS_NORMALIZENORMALS";
693 case SVGA3D_RS_POINTSPRITEENABLE: /* SVGA3dBool */
694 return "SVGA3D_RS_POINTSPRITEENABLE";
695 case SVGA3D_RS_POINTSCALEENABLE: /* SVGA3dBool */
696 return "SVGA3D_RS_POINTSCALEENABLE";
697 case SVGA3D_RS_STENCILREF: /* uint32_t */
698 return "SVGA3D_RS_STENCILREF";
699 case SVGA3D_RS_STENCILMASK: /* uint32_t */
700 return "SVGA3D_RS_STENCILMASK";
701 case SVGA3D_RS_STENCILWRITEMASK: /* uint32_t */
702 return "SVGA3D_RS_STENCILWRITEMASK";
703 case SVGA3D_RS_POINTSIZE: /* float */
704 return "SVGA3D_RS_POINTSIZE";
705 case SVGA3D_RS_POINTSIZEMIN: /* float */
706 return "SVGA3D_RS_POINTSIZEMIN";
707 case SVGA3D_RS_POINTSIZEMAX: /* float */
708 return "SVGA3D_RS_POINTSIZEMAX";
709 case SVGA3D_RS_POINTSCALE_A: /* float */
710 return "SVGA3D_RS_POINTSCALE_A";
711 case SVGA3D_RS_POINTSCALE_B: /* float */
712 return "SVGA3D_RS_POINTSCALE_B";
713 case SVGA3D_RS_POINTSCALE_C: /* float */
714 return "SVGA3D_RS_POINTSCALE_C";
715 case SVGA3D_RS_AMBIENT: /* SVGA3dColor - identical */
716 return "SVGA3D_RS_AMBIENT";
717 case SVGA3D_RS_CLIPPLANEENABLE: /* SVGA3dClipPlanes - identical */
718 return "SVGA3D_RS_CLIPPLANEENABLE";
719 case SVGA3D_RS_FOGCOLOR: /* SVGA3dColor - identical */
720 return "SVGA3D_RS_FOGCOLOR";
721 case SVGA3D_RS_FOGSTART: /* float */
722 return "SVGA3D_RS_FOGSTART";
723 case SVGA3D_RS_FOGEND: /* float */
724 return "SVGA3D_RS_FOGEND";
725 case SVGA3D_RS_FOGDENSITY: /* float */
726 return "SVGA3D_RS_FOGDENSITY";
727 case SVGA3D_RS_RANGEFOGENABLE: /* SVGA3dBool */
728 return "SVGA3D_RS_RANGEFOGENABLE";
729 case SVGA3D_RS_FOGMODE: /* SVGA3dFogMode */
730 return "SVGA3D_RS_FOGMODE";
731 case SVGA3D_RS_FILLMODE: /* SVGA3dFillMode */
732 return "SVGA3D_RS_FILLMODE";
733 case SVGA3D_RS_SHADEMODE: /* SVGA3dShadeMode */
734 return "SVGA3D_RS_SHADEMODE";
735 case SVGA3D_RS_LINEPATTERN: /* SVGA3dLinePattern */
736 return "SVGA3D_RS_LINEPATTERN";
737 case SVGA3D_RS_SRCBLEND: /* SVGA3dBlendOp */
738 return "SVGA3D_RS_SRCBLEND";
739 case SVGA3D_RS_DSTBLEND: /* SVGA3dBlendOp */
740 return "SVGA3D_RS_DSTBLEND";
741 case SVGA3D_RS_BLENDEQUATION: /* SVGA3dBlendEquation */
742 return "SVGA3D_RS_BLENDEQUATION";
743 case SVGA3D_RS_CULLMODE: /* SVGA3dFace */
744 return "SVGA3D_RS_CULLMODE";
745 case SVGA3D_RS_ZFUNC: /* SVGA3dCmpFunc */
746 return "SVGA3D_RS_ZFUNC";
747 case SVGA3D_RS_ALPHAFUNC: /* SVGA3dCmpFunc */
748 return "SVGA3D_RS_ALPHAFUNC";
749 case SVGA3D_RS_STENCILFUNC: /* SVGA3dCmpFunc */
750 return "SVGA3D_RS_STENCILFUNC";
751 case SVGA3D_RS_STENCILFAIL: /* SVGA3dStencilOp */
752 return "SVGA3D_RS_STENCILFAIL";
753 case SVGA3D_RS_STENCILZFAIL: /* SVGA3dStencilOp */
754 return "SVGA3D_RS_STENCILZFAIL";
755 case SVGA3D_RS_STENCILPASS: /* SVGA3dStencilOp */
756 return "SVGA3D_RS_STENCILPASS";
757 case SVGA3D_RS_ALPHAREF: /* float (0.0 .. 1.0) */
758 return "SVGA3D_RS_ALPHAREF";
759 case SVGA3D_RS_FRONTWINDING: /* SVGA3dFrontWinding */
760 return "SVGA3D_RS_FRONTWINDING";
761 case SVGA3D_RS_COORDINATETYPE: /* SVGA3dCoordinateType */
762 return "SVGA3D_RS_COORDINATETYPE";
763 case SVGA3D_RS_ZBIAS: /* float */
764 return "SVGA3D_RS_ZBIAS";
765 case SVGA3D_RS_COLORWRITEENABLE: /* SVGA3dColorMask */
766 return "SVGA3D_RS_COLORWRITEENABLE";
767 case SVGA3D_RS_VERTEXMATERIALENABLE: /* SVGA3dBool */
768 return "SVGA3D_RS_VERTEXMATERIALENABLE";
769 case SVGA3D_RS_DIFFUSEMATERIALSOURCE: /* SVGA3dVertexMaterial */
770 return "SVGA3D_RS_DIFFUSEMATERIALSOURCE";
771 case SVGA3D_RS_SPECULARMATERIALSOURCE: /* SVGA3dVertexMaterial */
772 return "SVGA3D_RS_SPECULARMATERIALSOURCE";
773 case SVGA3D_RS_AMBIENTMATERIALSOURCE: /* SVGA3dVertexMaterial */
774 return "SVGA3D_RS_AMBIENTMATERIALSOURCE";
775 case SVGA3D_RS_EMISSIVEMATERIALSOURCE: /* SVGA3dVertexMaterial */
776 return "SVGA3D_RS_EMISSIVEMATERIALSOURCE";
777 case SVGA3D_RS_TEXTUREFACTOR: /* SVGA3dColor */
778 return "SVGA3D_RS_TEXTUREFACTOR";
779 case SVGA3D_RS_LOCALVIEWER: /* SVGA3dBool */
780 return "SVGA3D_RS_LOCALVIEWER";
781 case SVGA3D_RS_SCISSORTESTENABLE: /* SVGA3dBool */
782 return "SVGA3D_RS_SCISSORTESTENABLE";
783 case SVGA3D_RS_BLENDCOLOR: /* SVGA3dColor */
784 return "SVGA3D_RS_BLENDCOLOR";
785 case SVGA3D_RS_STENCILENABLE2SIDED: /* SVGA3dBool */
786 return "SVGA3D_RS_STENCILENABLE2SIDED";
787 case SVGA3D_RS_CCWSTENCILFUNC: /* SVGA3dCmpFunc */
788 return "SVGA3D_RS_CCWSTENCILFUNC";
789 case SVGA3D_RS_CCWSTENCILFAIL: /* SVGA3dStencilOp */
790 return "SVGA3D_RS_CCWSTENCILFAIL";
791 case SVGA3D_RS_CCWSTENCILZFAIL: /* SVGA3dStencilOp */
792 return "SVGA3D_RS_CCWSTENCILZFAIL";
793 case SVGA3D_RS_CCWSTENCILPASS: /* SVGA3dStencilOp */
794 return "SVGA3D_RS_CCWSTENCILPASS";
795 case SVGA3D_RS_VERTEXBLEND: /* SVGA3dVertexBlendFlags */
796 return "SVGA3D_RS_VERTEXBLEND";
797 case SVGA3D_RS_SLOPESCALEDEPTHBIAS: /* float */
798 return "SVGA3D_RS_SLOPESCALEDEPTHBIAS";
799 case SVGA3D_RS_DEPTHBIAS: /* float */
800 return "SVGA3D_RS_DEPTHBIAS";
801 case SVGA3D_RS_OUTPUTGAMMA: /* float */
802 return "SVGA3D_RS_OUTPUTGAMMA";
803 case SVGA3D_RS_ZVISIBLE: /* SVGA3dBool */
804 return "SVGA3D_RS_ZVISIBLE";
805 case SVGA3D_RS_LASTPIXEL: /* SVGA3dBool */
806 return "SVGA3D_RS_LASTPIXEL";
807 case SVGA3D_RS_CLIPPING: /* SVGA3dBool */
808 return "SVGA3D_RS_CLIPPING";
809 case SVGA3D_RS_WRAP0: /* SVGA3dWrapFlags */
810 return "SVGA3D_RS_WRAP0";
811 case SVGA3D_RS_WRAP1: /* SVGA3dWrapFlags */
812 return "SVGA3D_RS_WRAP1";
813 case SVGA3D_RS_WRAP2: /* SVGA3dWrapFlags */
814 return "SVGA3D_RS_WRAP2";
815 case SVGA3D_RS_WRAP3: /* SVGA3dWrapFlags */
816 return "SVGA3D_RS_WRAP3";
817 case SVGA3D_RS_WRAP4: /* SVGA3dWrapFlags */
818 return "SVGA3D_RS_WRAP4";
819 case SVGA3D_RS_WRAP5: /* SVGA3dWrapFlags */
820 return "SVGA3D_RS_WRAP5";
821 case SVGA3D_RS_WRAP6: /* SVGA3dWrapFlags */
822 return "SVGA3D_RS_WRAP6";
823 case SVGA3D_RS_WRAP7: /* SVGA3dWrapFlags */
824 return "SVGA3D_RS_WRAP7";
825 case SVGA3D_RS_WRAP8: /* SVGA3dWrapFlags */
826 return "SVGA3D_RS_WRAP8";
827 case SVGA3D_RS_WRAP9: /* SVGA3dWrapFlags */
828 return "SVGA3D_RS_WRAP9";
829 case SVGA3D_RS_WRAP10: /* SVGA3dWrapFlags */
830 return "SVGA3D_RS_WRAP10";
831 case SVGA3D_RS_WRAP11: /* SVGA3dWrapFlags */
832 return "SVGA3D_RS_WRAP11";
833 case SVGA3D_RS_WRAP12: /* SVGA3dWrapFlags */
834 return "SVGA3D_RS_WRAP12";
835 case SVGA3D_RS_WRAP13: /* SVGA3dWrapFlags */
836 return "SVGA3D_RS_WRAP13";
837 case SVGA3D_RS_WRAP14: /* SVGA3dWrapFlags */
838 return "SVGA3D_RS_WRAP14";
839 case SVGA3D_RS_WRAP15: /* SVGA3dWrapFlags */
840 return "SVGA3D_RS_WRAP15";
841 case SVGA3D_RS_MULTISAMPLEANTIALIAS: /* SVGA3dBool */
842 return "SVGA3D_RS_MULTISAMPLEANTIALIAS";
843 case SVGA3D_RS_MULTISAMPLEMASK: /* uint32_t */
844 return "SVGA3D_RS_MULTISAMPLEMASK";
845 case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: /* SVGA3dBool */
846 return "SVGA3D_RS_INDEXEDVERTEXBLENDENABLE";
847 case SVGA3D_RS_TWEENFACTOR: /* float */
848 return "SVGA3D_RS_TWEENFACTOR";
849 case SVGA3D_RS_ANTIALIASEDLINEENABLE: /* SVGA3dBool */
850 return "SVGA3D_RS_ANTIALIASEDLINEENABLE";
851 case SVGA3D_RS_COLORWRITEENABLE1: /* SVGA3dColorMask */
852 return "SVGA3D_RS_COLORWRITEENABLE1";
853 case SVGA3D_RS_COLORWRITEENABLE2: /* SVGA3dColorMask */
854 return "SVGA3D_RS_COLORWRITEENABLE2";
855 case SVGA3D_RS_COLORWRITEENABLE3: /* SVGA3dColorMask */
856 return "SVGA3D_RS_COLORWRITEENABLE3";
857 case SVGA3D_RS_SEPARATEALPHABLENDENABLE: /* SVGA3dBool */
858 return "SVGA3D_RS_SEPARATEALPHABLENDENABLE";
859 case SVGA3D_RS_SRCBLENDALPHA: /* SVGA3dBlendOp */
860 return "SVGA3D_RS_SRCBLENDALPHA";
861 case SVGA3D_RS_DSTBLENDALPHA: /* SVGA3dBlendOp */
862 return "SVGA3D_RS_DSTBLENDALPHA";
863 case SVGA3D_RS_BLENDEQUATIONALPHA: /* SVGA3dBlendEquation */
864 return "SVGA3D_RS_BLENDEQUATIONALPHA";
865 case SVGA3D_RS_TRANSPARENCYANTIALIAS: /* SVGA3dTransparencyAntialiasType */
866 return "SVGA3D_RS_TRANSPARENCYANTIALIAS";
867 case SVGA3D_RS_LINEAA: /* SVGA3dBool */
868 return "SVGA3D_RS_LINEAA";
869 case SVGA3D_RS_LINEWIDTH: /* float */
870 return "SVGA3D_RS_LINEWIDTH";
871 default:
872 return "UNKNOWN";
873 }
874}
875
876const char *vmsvga3dTextureStateToString(SVGA3dTextureStateName textureState)
877{
878 switch (textureState)
879 {
880 case SVGA3D_TS_BIND_TEXTURE:
881 return "SVGA3D_TS_BIND_TEXTURE";
882 case SVGA3D_TS_COLOROP:
883 return "SVGA3D_TS_COLOROP";
884 case SVGA3D_TS_COLORARG1:
885 return "SVGA3D_TS_COLORARG1";
886 case SVGA3D_TS_COLORARG2:
887 return "SVGA3D_TS_COLORARG2";
888 case SVGA3D_TS_ALPHAOP:
889 return "SVGA3D_TS_ALPHAOP";
890 case SVGA3D_TS_ALPHAARG1:
891 return "SVGA3D_TS_ALPHAARG1";
892 case SVGA3D_TS_ALPHAARG2:
893 return "SVGA3D_TS_ALPHAARG2";
894 case SVGA3D_TS_ADDRESSU:
895 return "SVGA3D_TS_ADDRESSU";
896 case SVGA3D_TS_ADDRESSV:
897 return "SVGA3D_TS_ADDRESSV";
898 case SVGA3D_TS_MIPFILTER:
899 return "SVGA3D_TS_MIPFILTER";
900 case SVGA3D_TS_MAGFILTER:
901 return "SVGA3D_TS_MAGFILTER";
902 case SVGA3D_TS_MINFILTER:
903 return "SVGA3D_TS_MINFILTER";
904 case SVGA3D_TS_BORDERCOLOR:
905 return "SVGA3D_TS_BORDERCOLOR";
906 case SVGA3D_TS_TEXCOORDINDEX:
907 return "SVGA3D_TS_TEXCOORDINDEX";
908 case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
909 return "SVGA3D_TS_TEXTURETRANSFORMFLAGS";
910 case SVGA3D_TS_TEXCOORDGEN:
911 return "SVGA3D_TS_TEXCOORDGEN";
912 case SVGA3D_TS_BUMPENVMAT00:
913 return "SVGA3D_TS_BUMPENVMAT00";
914 case SVGA3D_TS_BUMPENVMAT01:
915 return "SVGA3D_TS_BUMPENVMAT01";
916 case SVGA3D_TS_BUMPENVMAT10:
917 return "SVGA3D_TS_BUMPENVMAT10";
918 case SVGA3D_TS_BUMPENVMAT11:
919 return "SVGA3D_TS_BUMPENVMAT11";
920 case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
921 return "SVGA3D_TS_TEXTURE_MIPMAP_LEVEL";
922 case SVGA3D_TS_TEXTURE_LOD_BIAS:
923 return "SVGA3D_TS_TEXTURE_LOD_BIAS";
924 case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
925 return "SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL";
926 case SVGA3D_TS_ADDRESSW:
927 return "SVGA3D_TS_ADDRESSW";
928 case SVGA3D_TS_GAMMA:
929 return "SVGA3D_TS_GAMMA";
930 case SVGA3D_TS_BUMPENVLSCALE:
931 return "SVGA3D_TS_BUMPENVLSCALE";
932 case SVGA3D_TS_BUMPENVLOFFSET:
933 return "SVGA3D_TS_BUMPENVLOFFSET";
934 case SVGA3D_TS_COLORARG0:
935 return "SVGA3D_TS_COLORARG0";
936 case SVGA3D_TS_ALPHAARG0:
937 return "SVGA3D_TS_ALPHAARG0";
938 default:
939 return "UNKNOWN";
940 }
941}
942
943const char *vmsvgaTransformToString(SVGA3dTransformType type)
944{
945 switch (type)
946 {
947 case SVGA3D_TRANSFORM_INVALID:
948 return "SVGA3D_TRANSFORM_INVALID";
949 case SVGA3D_TRANSFORM_WORLD:
950 return "SVGA3D_TRANSFORM_WORLD";
951 case SVGA3D_TRANSFORM_VIEW:
952 return "SVGA3D_TRANSFORM_VIEW";
953 case SVGA3D_TRANSFORM_PROJECTION:
954 return "SVGA3D_TRANSFORM_PROJECTION";
955 case SVGA3D_TRANSFORM_TEXTURE0:
956 return "SVGA3D_TRANSFORM_TEXTURE0";
957 case SVGA3D_TRANSFORM_TEXTURE1:
958 return "SVGA3D_TRANSFORM_TEXTURE1";
959 case SVGA3D_TRANSFORM_TEXTURE2:
960 return "SVGA3D_TRANSFORM_TEXTURE2";
961 case SVGA3D_TRANSFORM_TEXTURE3:
962 return "SVGA3D_TRANSFORM_TEXTURE3";
963 case SVGA3D_TRANSFORM_TEXTURE4:
964 return "SVGA3D_TRANSFORM_TEXTURE4";
965 case SVGA3D_TRANSFORM_TEXTURE5:
966 return "SVGA3D_TRANSFORM_TEXTURE5";
967 case SVGA3D_TRANSFORM_TEXTURE6:
968 return "SVGA3D_TRANSFORM_TEXTURE6";
969 case SVGA3D_TRANSFORM_TEXTURE7:
970 return "SVGA3D_TRANSFORM_TEXTURE7";
971 case SVGA3D_TRANSFORM_WORLD1:
972 return "SVGA3D_TRANSFORM_WORLD1";
973 case SVGA3D_TRANSFORM_WORLD2:
974 return "SVGA3D_TRANSFORM_WORLD2";
975 case SVGA3D_TRANSFORM_WORLD3:
976 return "SVGA3D_TRANSFORM_WORLD3";
977 default:
978 return "UNKNOWN";
979 }
980}
981
982const char *vmsvgaDeclUsage2String(SVGA3dDeclUsage usage)
983{
984 switch (usage)
985 {
986 case SVGA3D_DECLUSAGE_POSITION:
987 return "SVGA3D_DECLUSAGE_POSITION";
988 case SVGA3D_DECLUSAGE_BLENDWEIGHT:
989 return "SVGA3D_DECLUSAGE_BLENDWEIGHT";
990 case SVGA3D_DECLUSAGE_BLENDINDICES:
991 return "SVGA3D_DECLUSAGE_BLENDINDICES";
992 case SVGA3D_DECLUSAGE_NORMAL:
993 return "SVGA3D_DECLUSAGE_NORMAL";
994 case SVGA3D_DECLUSAGE_PSIZE:
995 return "SVGA3D_DECLUSAGE_PSIZE";
996 case SVGA3D_DECLUSAGE_TEXCOORD:
997 return "SVGA3D_DECLUSAGE_TEXCOORD";
998 case SVGA3D_DECLUSAGE_TANGENT:
999 return "SVGA3D_DECLUSAGE_TANGENT";
1000 case SVGA3D_DECLUSAGE_BINORMAL:
1001 return "SVGA3D_DECLUSAGE_BINORMAL";
1002 case SVGA3D_DECLUSAGE_TESSFACTOR:
1003 return "SVGA3D_DECLUSAGE_TESSFACTOR";
1004 case SVGA3D_DECLUSAGE_POSITIONT:
1005 return "SVGA3D_DECLUSAGE_POSITIONT";
1006 case SVGA3D_DECLUSAGE_COLOR:
1007 return "SVGA3D_DECLUSAGE_COLOR";
1008 case SVGA3D_DECLUSAGE_FOG:
1009 return "SVGA3D_DECLUSAGE_FOG";
1010 case SVGA3D_DECLUSAGE_DEPTH:
1011 return "SVGA3D_DECLUSAGE_DEPTH";
1012 case SVGA3D_DECLUSAGE_SAMPLE:
1013 return "SVGA3D_DECLUSAGE_SAMPLE";
1014 default:
1015 return "UNKNOWN!!";
1016 }
1017}
1018
1019const char *vmsvgaDeclMethod2String(SVGA3dDeclMethod method)
1020{
1021 switch (method)
1022 {
1023 case SVGA3D_DECLMETHOD_DEFAULT:
1024 return "SVGA3D_DECLMETHOD_DEFAULT";
1025 case SVGA3D_DECLMETHOD_PARTIALU:
1026 return "SVGA3D_DECLMETHOD_PARTIALU";
1027 case SVGA3D_DECLMETHOD_PARTIALV:
1028 return "SVGA3D_DECLMETHOD_PARTIALV";
1029 case SVGA3D_DECLMETHOD_CROSSUV:
1030 return "SVGA3D_DECLMETHOD_CROSSUV";
1031 case SVGA3D_DECLMETHOD_UV:
1032 return "SVGA3D_DECLMETHOD_UV";
1033 case SVGA3D_DECLMETHOD_LOOKUP:
1034 return "SVGA3D_DECLMETHOD_LOOKUP";
1035 case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
1036 return "SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED";
1037 default:
1038 return "UNKNOWN!!";
1039 }
1040}
1041
1042const char *vmsvgaDeclType2String(SVGA3dDeclType type)
1043{
1044 switch (type)
1045 {
1046 case SVGA3D_DECLTYPE_FLOAT1:
1047 return "SVGA3D_DECLTYPE_FLOAT1";
1048 case SVGA3D_DECLTYPE_FLOAT2:
1049 return "SVGA3D_DECLTYPE_FLOAT2";
1050 case SVGA3D_DECLTYPE_FLOAT3:
1051 return "SVGA3D_DECLTYPE_FLOAT3";
1052 case SVGA3D_DECLTYPE_FLOAT4:
1053 return "SVGA3D_DECLTYPE_FLOAT4";
1054 case SVGA3D_DECLTYPE_D3DCOLOR:
1055 return "SVGA3D_DECLTYPE_D3DCOLOR";
1056 case SVGA3D_DECLTYPE_UBYTE4:
1057 return "SVGA3D_DECLTYPE_UBYTE4";
1058 case SVGA3D_DECLTYPE_SHORT2:
1059 return "SVGA3D_DECLTYPE_SHORT2";
1060 case SVGA3D_DECLTYPE_SHORT4:
1061 return "SVGA3D_DECLTYPE_SHORT4";
1062 case SVGA3D_DECLTYPE_UBYTE4N:
1063 return "SVGA3D_DECLTYPE_UBYTE4N";
1064 case SVGA3D_DECLTYPE_SHORT2N:
1065 return "SVGA3D_DECLTYPE_SHORT2N";
1066 case SVGA3D_DECLTYPE_SHORT4N:
1067 return "SVGA3D_DECLTYPE_SHORT4N";
1068 case SVGA3D_DECLTYPE_USHORT2N:
1069 return "SVGA3D_DECLTYPE_USHORT2N";
1070 case SVGA3D_DECLTYPE_USHORT4N:
1071 return "SVGA3D_DECLTYPE_USHORT4N";
1072 case SVGA3D_DECLTYPE_UDEC3:
1073 return "SVGA3D_DECLTYPE_UDEC3";
1074 case SVGA3D_DECLTYPE_DEC3N:
1075 return "SVGA3D_DECLTYPE_DEC3N";
1076 case SVGA3D_DECLTYPE_FLOAT16_2:
1077 return "SVGA3D_DECLTYPE_FLOAT16_2";
1078 case SVGA3D_DECLTYPE_FLOAT16_4:
1079 return "SVGA3D_DECLTYPE_FLOAT16_4";
1080 default:
1081 return "UNKNOWN!!";
1082 }
1083}
1084
1085const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType)
1086{
1087 switch (PrimitiveType)
1088 {
1089 case SVGA3D_PRIMITIVE_TRIANGLELIST:
1090 return "SVGA3D_PRIMITIVE_TRIANGLELIST";
1091 case SVGA3D_PRIMITIVE_POINTLIST:
1092 return "SVGA3D_PRIMITIVE_POINTLIST";
1093 case SVGA3D_PRIMITIVE_LINELIST:
1094 return "SVGA3D_PRIMITIVE_LINELIST";
1095 case SVGA3D_PRIMITIVE_LINESTRIP:
1096 return "SVGA3D_PRIMITIVE_LINESTRIP";
1097 case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
1098 return "SVGA3D_PRIMITIVE_TRIANGLESTRIP";
1099 case SVGA3D_PRIMITIVE_TRIANGLEFAN:
1100 return "SVGA3D_PRIMITIVE_TRIANGLEFAN";
1101 default:
1102 return "UNKNOWN";
1103 }
1104}
1105
1106#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