VirtualBox

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

Last change on this file since 106061 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • 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 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * DevVMWare - VMWare SVGA device
4 */
5
6/*
7 * Copyright (C) 2013-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#define LOG_GROUP LOG_GROUP_DEV_VMSVGA
33#include <VBox/vmm/pdmdev.h>
34#include <VBox/version.h>
35#include <iprt/errcore.h>
36#include <VBox/log.h>
37#include <VBox/vmm/pgm.h>
38
39#include <iprt/assert.h>
40#include <iprt/semaphore.h>
41#include <iprt/uuid.h>
42#include <iprt/mem.h>
43#include <iprt/avl.h>
44
45#include <VBoxVideo.h> /* required by DevVGA.h */
46
47/* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
48#include "DevVGA.h"
49
50#include "DevVGA-SVGA.h"
51#include "DevVGA-SVGA3d.h"
52#define VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
53#include "DevVGA-SVGA3d-internal.h"
54
55/* VMSVGA header with information about pixel formats. Declares a static array. */
56#include "vmsvga_headers_begin.h"
57#pragma pack(1) /* VMSVGA structures are '__packed'. */
58#include <svga3d_surfacedefs.h>
59#pragma pack()
60#include "vmsvga_headers_end.h"
61
62
63#ifdef RT_OS_WINDOWS
64# define VMSVGA3D_WNDCLASSNAME L"VMSVGA3DWNDCLS"
65
66static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
67
68
69/**
70 * Send a message to the async window thread and wait for a reply
71 *
72 * @returns VBox status code.
73 * @param pWindowThread Thread handle
74 * @param WndRequestSem Semaphore handle for waiting
75 * @param msg Message id
76 * @param wParam First parameter
77 * @param lParam Second parameter
78 */
79int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam)
80{
81 int rc;
82 BOOL ret;
83
84 ret = PostThreadMessage(RTThreadGetNative(pWindowThread), msg, wParam, lParam);
85 AssertMsgReturn(ret, ("PostThreadMessage %x failed with %d\n", RTThreadGetNative(pWindowThread), GetLastError()), VERR_INTERNAL_ERROR);
86
87 rc = RTSemEventWait(WndRequestSem, RT_INDEFINITE_WAIT);
88 Assert(RT_SUCCESS(rc));
89
90 return rc;
91}
92
93/**
94 * The async window handling thread
95 *
96 * @returns VBox status code.
97 * @param hThreadSelf This thread.
98 * @param pvUser Request sempahore handle.
99 */
100DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD hThreadSelf, void *pvUser)
101{
102 RT_NOREF(hThreadSelf);
103 RTSEMEVENT WndRequestSem = (RTSEMEVENT)pvUser;
104 WNDCLASSEXW wc;
105
106 /* Register our own window class. */
107 wc.cbSize = sizeof(wc);
108 wc.style = CS_OWNDC;
109 wc.lpfnWndProc = (WNDPROC)vmsvga3dWndProc;
110 wc.cbClsExtra = 0;
111 wc.cbWndExtra = 0;
112 wc.hInstance = GetModuleHandle("VBoxDD.dll"); /** @todo hardcoded name.. */
113 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
114 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
115 wc.hbrBackground = NULL;
116 wc.lpszMenuName = NULL;
117 wc.lpszClassName = VMSVGA3D_WNDCLASSNAME;
118 wc.hIconSm = NULL;
119
120 if (!RegisterClassExW(&wc))
121 {
122 Log(("RegisterClass failed with %x\n", GetLastError()));
123 return VERR_INTERNAL_ERROR;
124 }
125
126 LogFlow(("vmsvga3dWindowThread: started loop\n"));
127 while (true)
128 {
129 MSG msg;
130 if (GetMessage(&msg, 0, 0, 0))
131 {
132 if (msg.message == WM_VMSVGA3D_EXIT)
133 {
134 /* Signal to the caller that we're done. */
135 RTSemEventSignal(WndRequestSem);
136 break;
137 }
138
139 if (msg.message == WM_VMSVGA3D_WAKEUP)
140 {
141 continue;
142 }
143
144 if (msg.message == WM_VMSVGA3D_CREATEWINDOW)
145 {
146 /* Create a context window with minimal 4x4 size. We will never use the swapchain
147 * to present the rendered image. Rendered images from the guest will be copied to
148 * the VMSVGA SCREEN object, which can be either an offscreen render target or
149 * system memory in the guest VRAM. */
150 HWND *phWnd = (HWND *)msg.wParam;
151 HWND hWnd;
152 *phWnd = hWnd = CreateWindowExW(WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY,
153 VMSVGA3D_WNDCLASSNAME,
154 NULL /*pwszName*/,
155 WS_DISABLED,
156 0 /*x*/,
157 0 /*y*/,
158 4 /*cx*/,
159 4 /*cy*/,
160 HWND_DESKTOP /*hwndParent*/,
161 NULL /*hMenu*/,
162 (HINSTANCE)msg.lParam /*hInstance*/,
163 NULL /*WM_CREATE param*/);
164 AssertMsg(hWnd, ("CreateWindowEx %ls, WS_EX_NOACTIVATE | WS_EX_NOPARENTNOTIFY, WS_DISABLED, (0,0)(4,4), HWND_DESKTOP hInstance=%p -> error=%x\n",
165 VMSVGA3D_WNDCLASSNAME, msg.lParam, GetLastError()));
166
167#ifdef VBOX_STRICT
168 /* Must have a non-zero client rectangle! */
169 RECT ClientRect;
170 GetClientRect(hWnd, &ClientRect);
171 Assert(ClientRect.right > ClientRect.left);
172 Assert(ClientRect.bottom > ClientRect.top);
173#endif
174
175 /* Signal to the caller that we're done. */
176 RTSemEventSignal(WndRequestSem);
177 continue;
178 }
179
180 if (msg.message == WM_VMSVGA3D_DESTROYWINDOW)
181 {
182 BOOL fRc = DestroyWindow((HWND)msg.wParam);
183 Assert(fRc); NOREF(fRc);
184
185 /* Signal to the caller that we're done. */
186 RTSemEventSignal(WndRequestSem);
187 continue;
188 }
189
190#if 0 /* in case CreateDeviceEx fails again and we want to eliminat wrong-thread. */
191 if (msg.message == WM_VMSVGA3D_CREATE_DEVICE)
192 {
193 VMSVGA3DCREATEDEVICEPARAMS *pParams = (VMSVGA3DCREATEDEVICEPARAMS *)msg.lParam;
194 pParams->hrc = pParams->pState->pD3D9->CreateDeviceEx(D3DADAPTER_DEFAULT,
195 D3DDEVTYPE_HAL,
196 pParams->pContext->hwnd,
197 D3DCREATE_MULTITHREADED | D3DCREATE_MIXED_VERTEXPROCESSING, //D3DCREATE_HARDWARE_VERTEXPROCESSING,
198 pParams->pPresParams,
199 NULL,
200 &pParams->pContext->pDevice);
201 AssertMsg(pParams->hrc == D3D_OK, ("WM_VMSVGA3D_CREATE_DEVICE: CreateDevice failed with %x\n", pParams->hrc));
202
203 RTSemEventSignal(WndRequestSem);
204 continue;
205 }
206#endif
207
208 TranslateMessage(&msg);
209 DispatchMessage(&msg);
210 }
211 else
212 {
213 Log(("GetMessage failed with %x\n", GetLastError()));
214 break;
215 }
216 }
217
218 Log(("vmsvga3dWindowThread: end loop\n"));
219 return VINF_SUCCESS;
220}
221
222/* Window procedure for our top level window overlays. */
223static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
224{
225 switch (uMsg)
226 {
227 case WM_CREATE:
228 {
229 /* Ditch the title bar (caption) to avoid having a zero height
230 client area as that makes IDirect3D9Ex::CreateDeviceEx fail.
231 For the style adjustment to take place, we must apply the
232 SWP_FRAMECHANGED thru SetWindowPos. */
233 LONG flStyle = GetWindowLongW(hwnd, GWL_STYLE);
234 flStyle &= ~(WS_CAPTION /* both titlebar and border. Some paranoia: */ | WS_THICKFRAME | WS_SYSMENU);
235 SetWindowLong(hwnd, GWL_STYLE, flStyle);
236 SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
237 SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
238 break;
239 }
240
241 case WM_CLOSE:
242 Log7(("vmsvga3dWndProc(%p): WM_CLOSE\n", hwnd));
243 break;
244
245 case WM_DESTROY:
246 Log7(("vmsvga3dWndProc(%p): WM_DESTROY\n", hwnd));
247 break;
248
249 case WM_NCHITTEST:
250 Log7(("vmsvga3dWndProc(%p): WM_NCHITTEST\n", hwnd));
251 return HTNOWHERE;
252
253# if 0 /* flicker experiment, no help here. */
254 case WM_PAINT:
255 Log7(("vmsvga3dWndProc(%p): WM_PAINT %p %p\n", hwnd, wParam, lParam));
256 ValidateRect(hwnd, NULL);
257 return 0;
258 case WM_ERASEBKGND:
259 Log7(("vmsvga3dWndProc(%p): WM_ERASEBKGND %p %p\n", hwnd, wParam, lParam));
260 return TRUE;
261 case WM_NCPAINT:
262 Log7(("vmsvga3dWndProc(%p): WM_NCPAINT %p %p\n", hwnd, wParam, lParam));
263 break;
264 case WM_WINDOWPOSCHANGING:
265 {
266 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
267 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGING %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
268 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
269 break;
270 }
271 case WM_WINDOWPOSCHANGED:
272 {
273 PWINDOWPOS pPos = (PWINDOWPOS)lParam;
274 Log7(("vmsvga3dWndProc(%p): WM_WINDOWPOSCHANGED %p %p pos=(%d,%d) size=(%d,%d) flags=%#x\n",
275 hwnd, wParam, lParam, pPos->x, pPos->y, pPos->cx, pPos->cy, pPos->flags));
276 break;
277 }
278 case WM_MOVE:
279 Log7(("vmsvga3dWndProc(%p): WM_MOVE %p %p\n", hwnd, wParam, lParam));
280 break;
281 case WM_SIZE:
282 Log7(("vmsvga3dWndProc(%p): WM_SIZE %p %p\n", hwnd, wParam, lParam));
283 break;
284
285 default:
286 Log7(("vmsvga3dWndProc(%p): %#x %p %p\n", hwnd, uMsg, wParam, lParam));
287# endif
288 }
289 return DefWindowProc(hwnd, uMsg, wParam, lParam);
290}
291
292int vmsvga3dContextWindowCreate(HINSTANCE hInstance, RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, HWND *pHwnd)
293{
294 return vmsvga3dSendThreadMessage(pWindowThread, WndRequestSem, WM_VMSVGA3D_CREATEWINDOW, (WPARAM)pHwnd, (LPARAM)hInstance);
295}
296
297#endif /* RT_OS_WINDOWS */
298
299
300/**
301 * Calculate the size and dimensions of one block.
302 */
303uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
304 uint32_t *pcxBlock,
305 uint32_t *pcyBlock,
306 uint32_t *pcbPitchBlock)
307{
308 const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
309 *pcxBlock = desc->block_size.width;
310 *pcyBlock = desc->block_size.height;
311 *pcbPitchBlock = desc->pitch_bytes_per_block;
312 return desc->bytes_per_block;
313}
314
315void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, uint32_t multisampleCount,
316 uint32_t *pcBlocksX,
317 uint32_t *pcBlocksY,
318 uint32_t *pcbSurfacePitch,
319 uint32_t *pcbSurfacePlane,
320 uint32_t *pcbSurface)
321{
322 const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
323
324 uint32_t const cxBlocks = (mipmapSize.width + desc->block_size.width - 1) / desc->block_size.width;
325 uint32_t const cyBlocks = (mipmapSize.height + desc->block_size.height - 1) / desc->block_size.height;
326 uint32_t const czBlocks = (mipmapSize.depth + desc->block_size.depth - 1) / desc->block_size.depth;
327
328 uint32_t const cbPitch = cxBlocks * desc->pitch_bytes_per_block;
329
330 uint32_t cbSurfacePlane = clamped_umul32(cxBlocks, cyBlocks);
331 cbSurfacePlane = clamped_umul32(cbSurfacePlane, desc->bytes_per_block);
332
333 uint32_t const cbSurfaceResolved = clamped_umul32(cbSurfacePlane, czBlocks);
334
335 uint32_t const cbSurface = clamped_umul32(cbSurfaceResolved, RT_MAX(multisampleCount, 1));
336
337 *pcBlocksX = cxBlocks;
338 *pcBlocksY = cyBlocks;
339 *pcbSurfacePitch = cbPitch;
340 *pcbSurfacePlane = cbSurfacePlane;
341 *pcbSurface = cbSurface;
342}
343
344#ifdef LOG_ENABLED
345
346const char *vmsvga3dGetCapString(uint32_t idxCap)
347{
348 switch (idxCap)
349 {
350 case SVGA3D_DEVCAP_3D:
351 return "SVGA3D_DEVCAP_3D";
352 case SVGA3D_DEVCAP_MAX_LIGHTS:
353 return "SVGA3D_DEVCAP_MAX_LIGHTS";
354 case SVGA3D_DEVCAP_MAX_TEXTURES:
355 return "SVGA3D_DEVCAP_MAX_TEXTURES";
356 case SVGA3D_DEVCAP_MAX_CLIP_PLANES:
357 return "SVGA3D_DEVCAP_MAX_CLIP_PLANES";
358 case SVGA3D_DEVCAP_VERTEX_SHADER_VERSION:
359 return "SVGA3D_DEVCAP_VERTEX_SHADER_VERSION";
360 case SVGA3D_DEVCAP_VERTEX_SHADER:
361 return "SVGA3D_DEVCAP_VERTEX_SHADER";
362 case SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION:
363 return "SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION";
364 case SVGA3D_DEVCAP_FRAGMENT_SHADER:
365 return "SVGA3D_DEVCAP_FRAGMENT_SHADER";
366 case SVGA3D_DEVCAP_MAX_RENDER_TARGETS:
367 return "SVGA3D_DEVCAP_MAX_RENDER_TARGETS";
368 case SVGA3D_DEVCAP_S23E8_TEXTURES:
369 return "SVGA3D_DEVCAP_S23E8_TEXTURES";
370 case SVGA3D_DEVCAP_S10E5_TEXTURES:
371 return "SVGA3D_DEVCAP_S10E5_TEXTURES";
372 case SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND:
373 return "SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND";
374 case SVGA3D_DEVCAP_D16_BUFFER_FORMAT:
375 return "SVGA3D_DEVCAP_D16_BUFFER_FORMAT";
376 case SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT:
377 return "SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT";
378 case SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT:
379 return "SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT";
380 case SVGA3D_DEVCAP_QUERY_TYPES:
381 return "SVGA3D_DEVCAP_QUERY_TYPES";
382 case SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING:
383 return "SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING";
384 case SVGA3D_DEVCAP_MAX_POINT_SIZE:
385 return "SVGA3D_DEVCAP_MAX_POINT_SIZE";
386 case SVGA3D_DEVCAP_MAX_SHADER_TEXTURES:
387 return "SVGA3D_DEVCAP_MAX_SHADER_TEXTURES";
388 case SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH:
389 return "SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH";
390 case SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT:
391 return "SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT";
392 case SVGA3D_DEVCAP_MAX_VOLUME_EXTENT:
393 return "SVGA3D_DEVCAP_MAX_VOLUME_EXTENT";
394 case SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT:
395 return "SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT";
396 case SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO:
397 return "SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO";
398 case SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY:
399 return "SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY";
400 case SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT:
401 return "SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT";
402 case SVGA3D_DEVCAP_MAX_VERTEX_INDEX:
403 return "SVGA3D_DEVCAP_MAX_VERTEX_INDEX";
404 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS:
405 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS";
406 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS:
407 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS";
408 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS:
409 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS";
410 case SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS:
411 return "SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS";
412 case SVGA3D_DEVCAP_TEXTURE_OPS:
413 return "SVGA3D_DEVCAP_TEXTURE_OPS";
414 case SVGA3D_DEVCAP_DEAD4: /* SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES */
415 return "SVGA3D_DEVCAP_MULTISAMPLE_NONMASKABLESAMPLES";
416 case SVGA3D_DEVCAP_DEAD5: /* SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES */
417 return "SVGA3D_DEVCAP_MULTISAMPLE_MASKABLESAMPLES";
418 case SVGA3D_DEVCAP_DEAD7: /* SVGA3D_DEVCAP_ALPHATOCOVERAGE */
419 return "SVGA3D_DEVCAP_ALPHATOCOVERAGE";
420 case SVGA3D_DEVCAP_DEAD6: /* SVGA3D_DEVCAP_SUPERSAMPLE */
421 return "SVGA3D_DEVCAP_SUPERSAMPLE";
422 case SVGA3D_DEVCAP_AUTOGENMIPMAPS:
423 return "SVGA3D_DEVCAP_AUTOGENMIPMAPS";
424 case SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES:
425 return "SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES";
426 case SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS:
427 return "SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS";
428 case SVGA3D_DEVCAP_MAX_CONTEXT_IDS:
429 return "SVGA3D_DEVCAP_MAX_CONTEXT_IDS";
430 case SVGA3D_DEVCAP_MAX_SURFACE_IDS:
431 return "SVGA3D_DEVCAP_MAX_SURFACE_IDS";
432 case SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8:
433 return "SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8";
434 case SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8:
435 return "SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8";
436 case SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10:
437 return "SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10";
438 case SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5:
439 return "SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5";
440 case SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5:
441 return "SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5";
442 case SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4:
443 return "SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4";
444 case SVGA3D_DEVCAP_SURFACEFMT_R5G6B5:
445 return "SVGA3D_DEVCAP_SURFACEFMT_R5G6B5";
446 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16:
447 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16";
448 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8:
449 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8";
450 case SVGA3D_DEVCAP_SURFACEFMT_ALPHA8:
451 return "SVGA3D_DEVCAP_SURFACEFMT_ALPHA8";
452 case SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8:
453 return "SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8";
454 case SVGA3D_DEVCAP_SURFACEFMT_Z_D16:
455 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D16";
456 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8:
457 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8";
458 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8:
459 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8";
460 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
461 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF16";
462 case SVGA3D_DEVCAP_SURFACEFMT_Z_DF24:
463 return "SVGA3D_DEVCAP_SURFACEFMT_Z_DF24";
464 case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT:
465 return "SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT";
466 case SVGA3D_DEVCAP_SURFACEFMT_DXT1:
467 return "SVGA3D_DEVCAP_SURFACEFMT_DXT1";
468 case SVGA3D_DEVCAP_SURFACEFMT_DXT2:
469 return "SVGA3D_DEVCAP_SURFACEFMT_DXT2";
470 case SVGA3D_DEVCAP_SURFACEFMT_DXT3:
471 return "SVGA3D_DEVCAP_SURFACEFMT_DXT3";
472 case SVGA3D_DEVCAP_SURFACEFMT_DXT4:
473 return "SVGA3D_DEVCAP_SURFACEFMT_DXT4";
474 case SVGA3D_DEVCAP_SURFACEFMT_DXT5:
475 return "SVGA3D_DEVCAP_SURFACEFMT_DXT5";
476 case SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8:
477 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8";
478 case SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10:
479 return "SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10";
480 case SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8:
481 return "SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8";
482 case SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8:
483 return "SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8";
484 case SVGA3D_DEVCAP_SURFACEFMT_CxV8U8:
485 return "SVGA3D_DEVCAP_SURFACEFMT_CxV8U8";
486 case SVGA3D_DEVCAP_SURFACEFMT_R_S10E5:
487 return "SVGA3D_DEVCAP_SURFACEFMT_R_S10E5";
488 case SVGA3D_DEVCAP_SURFACEFMT_R_S23E8:
489 return "SVGA3D_DEVCAP_SURFACEFMT_R_S23E8";
490 case SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5:
491 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5";
492 case SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8:
493 return "SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8";
494 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5:
495 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5";
496 case SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8:
497 return "SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8";
498 case SVGA3D_DEVCAP_SURFACEFMT_V16U16:
499 return "SVGA3D_DEVCAP_SURFACEFMT_V16U16";
500 case SVGA3D_DEVCAP_SURFACEFMT_G16R16:
501 return "SVGA3D_DEVCAP_SURFACEFMT_G16R16";
502 case SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16:
503 return "SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16";
504 case SVGA3D_DEVCAP_SURFACEFMT_UYVY:
505 return "SVGA3D_DEVCAP_SURFACEFMT_UYVY";
506 case SVGA3D_DEVCAP_SURFACEFMT_YUY2:
507 return "SVGA3D_DEVCAP_SURFACEFMT_YUY2";
508 case SVGA3D_DEVCAP_SURFACEFMT_NV12:
509 return "SVGA3D_DEVCAP_SURFACEFMT_NV12";
510 case SVGA3D_DEVCAP_DEAD10: /* SVGA3D_DEVCAP_SURFACEFMT_AYUV */
511 return "SVGA3D_DEVCAP_SURFACEFMT_AYUV";
512 case SVGA3D_DEVCAP_SURFACEFMT_ATI1:
513 return "SVGA3D_DEVCAP_SURFACEFMT_ATI1";
514 case SVGA3D_DEVCAP_SURFACEFMT_ATI2:
515 return "SVGA3D_DEVCAP_SURFACEFMT_ATI2";
516 default:
517 return "UNEXPECTED";
518 }
519}
520
521const char *vmsvga3dGet3dFormatString(uint32_t format)
522{
523 static char szFormat[1024];
524
525 szFormat[0] = 0;
526
527 if (format & SVGA3DFORMAT_OP_TEXTURE)
528 strcat(szFormat, " - SVGA3DFORMAT_OP_TEXTURE\n");
529 if (format & SVGA3DFORMAT_OP_VOLUMETEXTURE)
530 strcat(szFormat, " - SVGA3DFORMAT_OP_VOLUMETEXTURE\n");
531 if (format & SVGA3DFORMAT_OP_CUBETEXTURE)
532 strcat(szFormat, " - SVGA3DFORMAT_OP_CUBETEXTURE\n");
533 if (format & SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET)
534 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET\n");
535 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET)
536 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET\n");
537 if (format & SVGA3DFORMAT_OP_ZSTENCIL)
538 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL\n");
539 if (format & SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH)
540 strcat(szFormat, " - SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH\n");
541 if (format & SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET)
542 strcat(szFormat, " - SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET\n");
543 if (format & SVGA3DFORMAT_OP_DISPLAYMODE)
544 strcat(szFormat, " - SVGA3DFORMAT_OP_DISPLAYMODE\n");
545 if (format & SVGA3DFORMAT_OP_3DACCELERATION)
546 strcat(szFormat, " - SVGA3DFORMAT_OP_3DACCELERATION\n");
547 if (format & SVGA3DFORMAT_OP_PIXELSIZE)
548 strcat(szFormat, " - SVGA3DFORMAT_OP_PIXELSIZE\n");
549 if (format & SVGA3DFORMAT_OP_CONVERT_TO_ARGB)
550 strcat(szFormat, " - SVGA3DFORMAT_OP_CONVERT_TO_ARGB\n");
551 if (format & SVGA3DFORMAT_OP_OFFSCREENPLAIN)
552 strcat(szFormat, " - SVGA3DFORMAT_OP_OFFSCREENPLAIN\n");
553 if (format & SVGA3DFORMAT_OP_SRGBREAD)
554 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBREAD\n");
555 if (format & SVGA3DFORMAT_OP_BUMPMAP)
556 strcat(szFormat, " - SVGA3DFORMAT_OP_BUMPMAP\n");
557 if (format & SVGA3DFORMAT_OP_DMAP)
558 strcat(szFormat, " - SVGA3DFORMAT_OP_DMAP\n");
559 if (format & SVGA3DFORMAT_OP_NOFILTER)
560 strcat(szFormat, " - SVGA3DFORMAT_OP_NOFILTER\n");
561 if (format & SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB)
562 strcat(szFormat, " - SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB\n");
563 if (format & SVGA3DFORMAT_OP_SRGBWRITE)
564 strcat(szFormat, " - SVGA3DFORMAT_OP_SRGBWRITE\n");
565 if (format & SVGA3DFORMAT_OP_NOALPHABLEND)
566 strcat(szFormat, " - SVGA3DFORMAT_OP_NOALPHABLEND\n");
567 if (format & SVGA3DFORMAT_OP_AUTOGENMIPMAP)
568 strcat(szFormat, " - SVGA3DFORMAT_OP_AUTOGENMIPMAP\n");
569 if (format & SVGA3DFORMAT_OP_VERTEXTEXTURE)
570 strcat(szFormat, " - SVGA3DFORMAT_OP_VERTEXTEXTURE\n");
571 if (format & SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP)
572 strcat(szFormat, " - SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP\n");
573 return szFormat;
574}
575
576const char *vmsvga3dGetRenderStateName(uint32_t state)
577{
578 switch (state)
579 {
580 case SVGA3D_RS_ZENABLE: /* SVGA3dBool */
581 return "SVGA3D_RS_ZENABLE";
582 case SVGA3D_RS_ZWRITEENABLE: /* SVGA3dBool */
583 return "SVGA3D_RS_ZWRITEENABLE";
584 case SVGA3D_RS_ALPHATESTENABLE: /* SVGA3dBool */
585 return "SVGA3D_RS_ALPHATESTENABLE";
586 case SVGA3D_RS_DITHERENABLE: /* SVGA3dBool */
587 return "SVGA3D_RS_DITHERENABLE";
588 case SVGA3D_RS_BLENDENABLE: /* SVGA3dBool */
589 return "SVGA3D_RS_BLENDENABLE";
590 case SVGA3D_RS_FOGENABLE: /* SVGA3dBool */
591 return "SVGA3D_RS_FOGENABLE";
592 case SVGA3D_RS_SPECULARENABLE: /* SVGA3dBool */
593 return "SVGA3D_RS_SPECULARENABLE";
594 case SVGA3D_RS_STENCILENABLE: /* SVGA3dBool */
595 return "SVGA3D_RS_STENCILENABLE";
596 case SVGA3D_RS_LIGHTINGENABLE: /* SVGA3dBool */
597 return "SVGA3D_RS_LIGHTINGENABLE";
598 case SVGA3D_RS_NORMALIZENORMALS: /* SVGA3dBool */
599 return "SVGA3D_RS_NORMALIZENORMALS";
600 case SVGA3D_RS_POINTSPRITEENABLE: /* SVGA3dBool */
601 return "SVGA3D_RS_POINTSPRITEENABLE";
602 case SVGA3D_RS_POINTSCALEENABLE: /* SVGA3dBool */
603 return "SVGA3D_RS_POINTSCALEENABLE";
604 case SVGA3D_RS_STENCILREF: /* uint32_t */
605 return "SVGA3D_RS_STENCILREF";
606 case SVGA3D_RS_STENCILMASK: /* uint32_t */
607 return "SVGA3D_RS_STENCILMASK";
608 case SVGA3D_RS_STENCILWRITEMASK: /* uint32_t */
609 return "SVGA3D_RS_STENCILWRITEMASK";
610 case SVGA3D_RS_POINTSIZE: /* float */
611 return "SVGA3D_RS_POINTSIZE";
612 case SVGA3D_RS_POINTSIZEMIN: /* float */
613 return "SVGA3D_RS_POINTSIZEMIN";
614 case SVGA3D_RS_POINTSIZEMAX: /* float */
615 return "SVGA3D_RS_POINTSIZEMAX";
616 case SVGA3D_RS_POINTSCALE_A: /* float */
617 return "SVGA3D_RS_POINTSCALE_A";
618 case SVGA3D_RS_POINTSCALE_B: /* float */
619 return "SVGA3D_RS_POINTSCALE_B";
620 case SVGA3D_RS_POINTSCALE_C: /* float */
621 return "SVGA3D_RS_POINTSCALE_C";
622 case SVGA3D_RS_AMBIENT: /* SVGA3dColor - identical */
623 return "SVGA3D_RS_AMBIENT";
624 case SVGA3D_RS_CLIPPLANEENABLE: /* SVGA3dClipPlanes - identical */
625 return "SVGA3D_RS_CLIPPLANEENABLE";
626 case SVGA3D_RS_FOGCOLOR: /* SVGA3dColor - identical */
627 return "SVGA3D_RS_FOGCOLOR";
628 case SVGA3D_RS_FOGSTART: /* float */
629 return "SVGA3D_RS_FOGSTART";
630 case SVGA3D_RS_FOGEND: /* float */
631 return "SVGA3D_RS_FOGEND";
632 case SVGA3D_RS_FOGDENSITY: /* float */
633 return "SVGA3D_RS_FOGDENSITY";
634 case SVGA3D_RS_RANGEFOGENABLE: /* SVGA3dBool */
635 return "SVGA3D_RS_RANGEFOGENABLE";
636 case SVGA3D_RS_FOGMODE: /* SVGA3dFogMode */
637 return "SVGA3D_RS_FOGMODE";
638 case SVGA3D_RS_FILLMODE: /* SVGA3dFillMode */
639 return "SVGA3D_RS_FILLMODE";
640 case SVGA3D_RS_SHADEMODE: /* SVGA3dShadeMode */
641 return "SVGA3D_RS_SHADEMODE";
642 case SVGA3D_RS_LINEPATTERN: /* SVGA3dLinePattern */
643 return "SVGA3D_RS_LINEPATTERN";
644 case SVGA3D_RS_SRCBLEND: /* SVGA3dBlendOp */
645 return "SVGA3D_RS_SRCBLEND";
646 case SVGA3D_RS_DSTBLEND: /* SVGA3dBlendOp */
647 return "SVGA3D_RS_DSTBLEND";
648 case SVGA3D_RS_BLENDEQUATION: /* SVGA3dBlendEquation */
649 return "SVGA3D_RS_BLENDEQUATION";
650 case SVGA3D_RS_CULLMODE: /* SVGA3dFace */
651 return "SVGA3D_RS_CULLMODE";
652 case SVGA3D_RS_ZFUNC: /* SVGA3dCmpFunc */
653 return "SVGA3D_RS_ZFUNC";
654 case SVGA3D_RS_ALPHAFUNC: /* SVGA3dCmpFunc */
655 return "SVGA3D_RS_ALPHAFUNC";
656 case SVGA3D_RS_STENCILFUNC: /* SVGA3dCmpFunc */
657 return "SVGA3D_RS_STENCILFUNC";
658 case SVGA3D_RS_STENCILFAIL: /* SVGA3dStencilOp */
659 return "SVGA3D_RS_STENCILFAIL";
660 case SVGA3D_RS_STENCILZFAIL: /* SVGA3dStencilOp */
661 return "SVGA3D_RS_STENCILZFAIL";
662 case SVGA3D_RS_STENCILPASS: /* SVGA3dStencilOp */
663 return "SVGA3D_RS_STENCILPASS";
664 case SVGA3D_RS_ALPHAREF: /* float (0.0 .. 1.0) */
665 return "SVGA3D_RS_ALPHAREF";
666 case SVGA3D_RS_FRONTWINDING: /* SVGA3dFrontWinding */
667 return "SVGA3D_RS_FRONTWINDING";
668 case SVGA3D_RS_COORDINATETYPE: /* SVGA3dCoordinateType */
669 return "SVGA3D_RS_COORDINATETYPE";
670 case SVGA3D_RS_ZBIAS: /* float */
671 return "SVGA3D_RS_ZBIAS";
672 case SVGA3D_RS_COLORWRITEENABLE: /* SVGA3dColorMask */
673 return "SVGA3D_RS_COLORWRITEENABLE";
674 case SVGA3D_RS_VERTEXMATERIALENABLE: /* SVGA3dBool */
675 return "SVGA3D_RS_VERTEXMATERIALENABLE";
676 case SVGA3D_RS_DIFFUSEMATERIALSOURCE: /* SVGA3dVertexMaterial */
677 return "SVGA3D_RS_DIFFUSEMATERIALSOURCE";
678 case SVGA3D_RS_SPECULARMATERIALSOURCE: /* SVGA3dVertexMaterial */
679 return "SVGA3D_RS_SPECULARMATERIALSOURCE";
680 case SVGA3D_RS_AMBIENTMATERIALSOURCE: /* SVGA3dVertexMaterial */
681 return "SVGA3D_RS_AMBIENTMATERIALSOURCE";
682 case SVGA3D_RS_EMISSIVEMATERIALSOURCE: /* SVGA3dVertexMaterial */
683 return "SVGA3D_RS_EMISSIVEMATERIALSOURCE";
684 case SVGA3D_RS_TEXTUREFACTOR: /* SVGA3dColor */
685 return "SVGA3D_RS_TEXTUREFACTOR";
686 case SVGA3D_RS_LOCALVIEWER: /* SVGA3dBool */
687 return "SVGA3D_RS_LOCALVIEWER";
688 case SVGA3D_RS_SCISSORTESTENABLE: /* SVGA3dBool */
689 return "SVGA3D_RS_SCISSORTESTENABLE";
690 case SVGA3D_RS_BLENDCOLOR: /* SVGA3dColor */
691 return "SVGA3D_RS_BLENDCOLOR";
692 case SVGA3D_RS_STENCILENABLE2SIDED: /* SVGA3dBool */
693 return "SVGA3D_RS_STENCILENABLE2SIDED";
694 case SVGA3D_RS_CCWSTENCILFUNC: /* SVGA3dCmpFunc */
695 return "SVGA3D_RS_CCWSTENCILFUNC";
696 case SVGA3D_RS_CCWSTENCILFAIL: /* SVGA3dStencilOp */
697 return "SVGA3D_RS_CCWSTENCILFAIL";
698 case SVGA3D_RS_CCWSTENCILZFAIL: /* SVGA3dStencilOp */
699 return "SVGA3D_RS_CCWSTENCILZFAIL";
700 case SVGA3D_RS_CCWSTENCILPASS: /* SVGA3dStencilOp */
701 return "SVGA3D_RS_CCWSTENCILPASS";
702 case SVGA3D_RS_VERTEXBLEND: /* SVGA3dVertexBlendFlags */
703 return "SVGA3D_RS_VERTEXBLEND";
704 case SVGA3D_RS_SLOPESCALEDEPTHBIAS: /* float */
705 return "SVGA3D_RS_SLOPESCALEDEPTHBIAS";
706 case SVGA3D_RS_DEPTHBIAS: /* float */
707 return "SVGA3D_RS_DEPTHBIAS";
708 case SVGA3D_RS_OUTPUTGAMMA: /* float */
709 return "SVGA3D_RS_OUTPUTGAMMA";
710 case SVGA3D_RS_ZVISIBLE: /* SVGA3dBool */
711 return "SVGA3D_RS_ZVISIBLE";
712 case SVGA3D_RS_LASTPIXEL: /* SVGA3dBool */
713 return "SVGA3D_RS_LASTPIXEL";
714 case SVGA3D_RS_CLIPPING: /* SVGA3dBool */
715 return "SVGA3D_RS_CLIPPING";
716 case SVGA3D_RS_WRAP0: /* SVGA3dWrapFlags */
717 return "SVGA3D_RS_WRAP0";
718 case SVGA3D_RS_WRAP1: /* SVGA3dWrapFlags */
719 return "SVGA3D_RS_WRAP1";
720 case SVGA3D_RS_WRAP2: /* SVGA3dWrapFlags */
721 return "SVGA3D_RS_WRAP2";
722 case SVGA3D_RS_WRAP3: /* SVGA3dWrapFlags */
723 return "SVGA3D_RS_WRAP3";
724 case SVGA3D_RS_WRAP4: /* SVGA3dWrapFlags */
725 return "SVGA3D_RS_WRAP4";
726 case SVGA3D_RS_WRAP5: /* SVGA3dWrapFlags */
727 return "SVGA3D_RS_WRAP5";
728 case SVGA3D_RS_WRAP6: /* SVGA3dWrapFlags */
729 return "SVGA3D_RS_WRAP6";
730 case SVGA3D_RS_WRAP7: /* SVGA3dWrapFlags */
731 return "SVGA3D_RS_WRAP7";
732 case SVGA3D_RS_WRAP8: /* SVGA3dWrapFlags */
733 return "SVGA3D_RS_WRAP8";
734 case SVGA3D_RS_WRAP9: /* SVGA3dWrapFlags */
735 return "SVGA3D_RS_WRAP9";
736 case SVGA3D_RS_WRAP10: /* SVGA3dWrapFlags */
737 return "SVGA3D_RS_WRAP10";
738 case SVGA3D_RS_WRAP11: /* SVGA3dWrapFlags */
739 return "SVGA3D_RS_WRAP11";
740 case SVGA3D_RS_WRAP12: /* SVGA3dWrapFlags */
741 return "SVGA3D_RS_WRAP12";
742 case SVGA3D_RS_WRAP13: /* SVGA3dWrapFlags */
743 return "SVGA3D_RS_WRAP13";
744 case SVGA3D_RS_WRAP14: /* SVGA3dWrapFlags */
745 return "SVGA3D_RS_WRAP14";
746 case SVGA3D_RS_WRAP15: /* SVGA3dWrapFlags */
747 return "SVGA3D_RS_WRAP15";
748 case SVGA3D_RS_MULTISAMPLEANTIALIAS: /* SVGA3dBool */
749 return "SVGA3D_RS_MULTISAMPLEANTIALIAS";
750 case SVGA3D_RS_MULTISAMPLEMASK: /* uint32_t */
751 return "SVGA3D_RS_MULTISAMPLEMASK";
752 case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: /* SVGA3dBool */
753 return "SVGA3D_RS_INDEXEDVERTEXBLENDENABLE";
754 case SVGA3D_RS_TWEENFACTOR: /* float */
755 return "SVGA3D_RS_TWEENFACTOR";
756 case SVGA3D_RS_ANTIALIASEDLINEENABLE: /* SVGA3dBool */
757 return "SVGA3D_RS_ANTIALIASEDLINEENABLE";
758 case SVGA3D_RS_COLORWRITEENABLE1: /* SVGA3dColorMask */
759 return "SVGA3D_RS_COLORWRITEENABLE1";
760 case SVGA3D_RS_COLORWRITEENABLE2: /* SVGA3dColorMask */
761 return "SVGA3D_RS_COLORWRITEENABLE2";
762 case SVGA3D_RS_COLORWRITEENABLE3: /* SVGA3dColorMask */
763 return "SVGA3D_RS_COLORWRITEENABLE3";
764 case SVGA3D_RS_SEPARATEALPHABLENDENABLE: /* SVGA3dBool */
765 return "SVGA3D_RS_SEPARATEALPHABLENDENABLE";
766 case SVGA3D_RS_SRCBLENDALPHA: /* SVGA3dBlendOp */
767 return "SVGA3D_RS_SRCBLENDALPHA";
768 case SVGA3D_RS_DSTBLENDALPHA: /* SVGA3dBlendOp */
769 return "SVGA3D_RS_DSTBLENDALPHA";
770 case SVGA3D_RS_BLENDEQUATIONALPHA: /* SVGA3dBlendEquation */
771 return "SVGA3D_RS_BLENDEQUATIONALPHA";
772 case SVGA3D_RS_TRANSPARENCYANTIALIAS: /* SVGA3dTransparencyAntialiasType */
773 return "SVGA3D_RS_TRANSPARENCYANTIALIAS";
774 case SVGA3D_RS_LINEWIDTH: /* float */
775 return "SVGA3D_RS_LINEWIDTH";
776 default:
777 return "UNKNOWN";
778 }
779}
780
781const char *vmsvga3dTextureStateToString(SVGA3dTextureStateName textureState)
782{
783 switch (textureState)
784 {
785 case SVGA3D_TS_BIND_TEXTURE:
786 return "SVGA3D_TS_BIND_TEXTURE";
787 case SVGA3D_TS_COLOROP:
788 return "SVGA3D_TS_COLOROP";
789 case SVGA3D_TS_COLORARG1:
790 return "SVGA3D_TS_COLORARG1";
791 case SVGA3D_TS_COLORARG2:
792 return "SVGA3D_TS_COLORARG2";
793 case SVGA3D_TS_ALPHAOP:
794 return "SVGA3D_TS_ALPHAOP";
795 case SVGA3D_TS_ALPHAARG1:
796 return "SVGA3D_TS_ALPHAARG1";
797 case SVGA3D_TS_ALPHAARG2:
798 return "SVGA3D_TS_ALPHAARG2";
799 case SVGA3D_TS_ADDRESSU:
800 return "SVGA3D_TS_ADDRESSU";
801 case SVGA3D_TS_ADDRESSV:
802 return "SVGA3D_TS_ADDRESSV";
803 case SVGA3D_TS_MIPFILTER:
804 return "SVGA3D_TS_MIPFILTER";
805 case SVGA3D_TS_MAGFILTER:
806 return "SVGA3D_TS_MAGFILTER";
807 case SVGA3D_TS_MINFILTER:
808 return "SVGA3D_TS_MINFILTER";
809 case SVGA3D_TS_BORDERCOLOR:
810 return "SVGA3D_TS_BORDERCOLOR";
811 case SVGA3D_TS_TEXCOORDINDEX:
812 return "SVGA3D_TS_TEXCOORDINDEX";
813 case SVGA3D_TS_TEXTURETRANSFORMFLAGS:
814 return "SVGA3D_TS_TEXTURETRANSFORMFLAGS";
815 case SVGA3D_TS_TEXCOORDGEN:
816 return "SVGA3D_TS_TEXCOORDGEN";
817 case SVGA3D_TS_BUMPENVMAT00:
818 return "SVGA3D_TS_BUMPENVMAT00";
819 case SVGA3D_TS_BUMPENVMAT01:
820 return "SVGA3D_TS_BUMPENVMAT01";
821 case SVGA3D_TS_BUMPENVMAT10:
822 return "SVGA3D_TS_BUMPENVMAT10";
823 case SVGA3D_TS_BUMPENVMAT11:
824 return "SVGA3D_TS_BUMPENVMAT11";
825 case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL:
826 return "SVGA3D_TS_TEXTURE_MIPMAP_LEVEL";
827 case SVGA3D_TS_TEXTURE_LOD_BIAS:
828 return "SVGA3D_TS_TEXTURE_LOD_BIAS";
829 case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL:
830 return "SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL";
831 case SVGA3D_TS_ADDRESSW:
832 return "SVGA3D_TS_ADDRESSW";
833 case SVGA3D_TS_GAMMA:
834 return "SVGA3D_TS_GAMMA";
835 case SVGA3D_TS_BUMPENVLSCALE:
836 return "SVGA3D_TS_BUMPENVLSCALE";
837 case SVGA3D_TS_BUMPENVLOFFSET:
838 return "SVGA3D_TS_BUMPENVLOFFSET";
839 case SVGA3D_TS_COLORARG0:
840 return "SVGA3D_TS_COLORARG0";
841 case SVGA3D_TS_ALPHAARG0:
842 return "SVGA3D_TS_ALPHAARG0";
843 default:
844 return "UNKNOWN";
845 }
846}
847
848const char *vmsvgaTransformToString(SVGA3dTransformType type)
849{
850 switch (type)
851 {
852 case SVGA3D_TRANSFORM_INVALID:
853 return "SVGA3D_TRANSFORM_INVALID";
854 case SVGA3D_TRANSFORM_WORLD:
855 return "SVGA3D_TRANSFORM_WORLD";
856 case SVGA3D_TRANSFORM_VIEW:
857 return "SVGA3D_TRANSFORM_VIEW";
858 case SVGA3D_TRANSFORM_PROJECTION:
859 return "SVGA3D_TRANSFORM_PROJECTION";
860 case SVGA3D_TRANSFORM_TEXTURE0:
861 return "SVGA3D_TRANSFORM_TEXTURE0";
862 case SVGA3D_TRANSFORM_TEXTURE1:
863 return "SVGA3D_TRANSFORM_TEXTURE1";
864 case SVGA3D_TRANSFORM_TEXTURE2:
865 return "SVGA3D_TRANSFORM_TEXTURE2";
866 case SVGA3D_TRANSFORM_TEXTURE3:
867 return "SVGA3D_TRANSFORM_TEXTURE3";
868 case SVGA3D_TRANSFORM_TEXTURE4:
869 return "SVGA3D_TRANSFORM_TEXTURE4";
870 case SVGA3D_TRANSFORM_TEXTURE5:
871 return "SVGA3D_TRANSFORM_TEXTURE5";
872 case SVGA3D_TRANSFORM_TEXTURE6:
873 return "SVGA3D_TRANSFORM_TEXTURE6";
874 case SVGA3D_TRANSFORM_TEXTURE7:
875 return "SVGA3D_TRANSFORM_TEXTURE7";
876 case SVGA3D_TRANSFORM_WORLD1:
877 return "SVGA3D_TRANSFORM_WORLD1";
878 case SVGA3D_TRANSFORM_WORLD2:
879 return "SVGA3D_TRANSFORM_WORLD2";
880 case SVGA3D_TRANSFORM_WORLD3:
881 return "SVGA3D_TRANSFORM_WORLD3";
882 default:
883 return "UNKNOWN";
884 }
885}
886
887const char *vmsvgaDeclUsage2String(SVGA3dDeclUsage usage)
888{
889 switch (usage)
890 {
891 case SVGA3D_DECLUSAGE_POSITION:
892 return "SVGA3D_DECLUSAGE_POSITION";
893 case SVGA3D_DECLUSAGE_BLENDWEIGHT:
894 return "SVGA3D_DECLUSAGE_BLENDWEIGHT";
895 case SVGA3D_DECLUSAGE_BLENDINDICES:
896 return "SVGA3D_DECLUSAGE_BLENDINDICES";
897 case SVGA3D_DECLUSAGE_NORMAL:
898 return "SVGA3D_DECLUSAGE_NORMAL";
899 case SVGA3D_DECLUSAGE_PSIZE:
900 return "SVGA3D_DECLUSAGE_PSIZE";
901 case SVGA3D_DECLUSAGE_TEXCOORD:
902 return "SVGA3D_DECLUSAGE_TEXCOORD";
903 case SVGA3D_DECLUSAGE_TANGENT:
904 return "SVGA3D_DECLUSAGE_TANGENT";
905 case SVGA3D_DECLUSAGE_BINORMAL:
906 return "SVGA3D_DECLUSAGE_BINORMAL";
907 case SVGA3D_DECLUSAGE_TESSFACTOR:
908 return "SVGA3D_DECLUSAGE_TESSFACTOR";
909 case SVGA3D_DECLUSAGE_POSITIONT:
910 return "SVGA3D_DECLUSAGE_POSITIONT";
911 case SVGA3D_DECLUSAGE_COLOR:
912 return "SVGA3D_DECLUSAGE_COLOR";
913 case SVGA3D_DECLUSAGE_FOG:
914 return "SVGA3D_DECLUSAGE_FOG";
915 case SVGA3D_DECLUSAGE_DEPTH:
916 return "SVGA3D_DECLUSAGE_DEPTH";
917 case SVGA3D_DECLUSAGE_SAMPLE:
918 return "SVGA3D_DECLUSAGE_SAMPLE";
919 default:
920 return "UNKNOWN!!";
921 }
922}
923
924const char *vmsvgaDeclMethod2String(SVGA3dDeclMethod method)
925{
926 switch (method)
927 {
928 case SVGA3D_DECLMETHOD_DEFAULT:
929 return "SVGA3D_DECLMETHOD_DEFAULT";
930 case SVGA3D_DECLMETHOD_PARTIALU:
931 return "SVGA3D_DECLMETHOD_PARTIALU";
932 case SVGA3D_DECLMETHOD_PARTIALV:
933 return "SVGA3D_DECLMETHOD_PARTIALV";
934 case SVGA3D_DECLMETHOD_CROSSUV:
935 return "SVGA3D_DECLMETHOD_CROSSUV";
936 case SVGA3D_DECLMETHOD_UV:
937 return "SVGA3D_DECLMETHOD_UV";
938 case SVGA3D_DECLMETHOD_LOOKUP:
939 return "SVGA3D_DECLMETHOD_LOOKUP";
940 case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED:
941 return "SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED";
942 default:
943 return "UNKNOWN!!";
944 }
945}
946
947const char *vmsvgaDeclType2String(SVGA3dDeclType type)
948{
949 switch (type)
950 {
951 case SVGA3D_DECLTYPE_FLOAT1:
952 return "SVGA3D_DECLTYPE_FLOAT1";
953 case SVGA3D_DECLTYPE_FLOAT2:
954 return "SVGA3D_DECLTYPE_FLOAT2";
955 case SVGA3D_DECLTYPE_FLOAT3:
956 return "SVGA3D_DECLTYPE_FLOAT3";
957 case SVGA3D_DECLTYPE_FLOAT4:
958 return "SVGA3D_DECLTYPE_FLOAT4";
959 case SVGA3D_DECLTYPE_D3DCOLOR:
960 return "SVGA3D_DECLTYPE_D3DCOLOR";
961 case SVGA3D_DECLTYPE_UBYTE4:
962 return "SVGA3D_DECLTYPE_UBYTE4";
963 case SVGA3D_DECLTYPE_SHORT2:
964 return "SVGA3D_DECLTYPE_SHORT2";
965 case SVGA3D_DECLTYPE_SHORT4:
966 return "SVGA3D_DECLTYPE_SHORT4";
967 case SVGA3D_DECLTYPE_UBYTE4N:
968 return "SVGA3D_DECLTYPE_UBYTE4N";
969 case SVGA3D_DECLTYPE_SHORT2N:
970 return "SVGA3D_DECLTYPE_SHORT2N";
971 case SVGA3D_DECLTYPE_SHORT4N:
972 return "SVGA3D_DECLTYPE_SHORT4N";
973 case SVGA3D_DECLTYPE_USHORT2N:
974 return "SVGA3D_DECLTYPE_USHORT2N";
975 case SVGA3D_DECLTYPE_USHORT4N:
976 return "SVGA3D_DECLTYPE_USHORT4N";
977 case SVGA3D_DECLTYPE_UDEC3:
978 return "SVGA3D_DECLTYPE_UDEC3";
979 case SVGA3D_DECLTYPE_DEC3N:
980 return "SVGA3D_DECLTYPE_DEC3N";
981 case SVGA3D_DECLTYPE_FLOAT16_2:
982 return "SVGA3D_DECLTYPE_FLOAT16_2";
983 case SVGA3D_DECLTYPE_FLOAT16_4:
984 return "SVGA3D_DECLTYPE_FLOAT16_4";
985 default:
986 return "UNKNOWN!!";
987 }
988}
989
990const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType)
991{
992 switch (PrimitiveType)
993 {
994 case SVGA3D_PRIMITIVE_TRIANGLELIST:
995 return "SVGA3D_PRIMITIVE_TRIANGLELIST";
996 case SVGA3D_PRIMITIVE_POINTLIST:
997 return "SVGA3D_PRIMITIVE_POINTLIST";
998 case SVGA3D_PRIMITIVE_LINELIST:
999 return "SVGA3D_PRIMITIVE_LINELIST";
1000 case SVGA3D_PRIMITIVE_LINESTRIP:
1001 return "SVGA3D_PRIMITIVE_LINESTRIP";
1002 case SVGA3D_PRIMITIVE_TRIANGLESTRIP:
1003 return "SVGA3D_PRIMITIVE_TRIANGLESTRIP";
1004 case SVGA3D_PRIMITIVE_TRIANGLEFAN:
1005 return "SVGA3D_PRIMITIVE_TRIANGLEFAN";
1006 default:
1007 return "UNKNOWN";
1008 }
1009}
1010
1011#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