VirtualBox

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

Last change on this file since 62920 was 62514, checked in by vboxsync, 8 years ago

(C) 2016

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