VirtualBox

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

Last change on this file since 78273 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

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