VirtualBox

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

Last change on this file since 55705 was 55401, checked in by vboxsync, 10 years ago

added a couple of missing Id headers

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