VirtualBox

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

Last change on this file since 55394 was 55297, checked in by vboxsync, 10 years ago

two gcc warnings

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