1 
2 #include "nine_debug.h"
3 #include "nine_pipe.h"
4 
5 #include <stdio.h>
6 #include "util/u_memory.h"
7 #include "util/u_math.h"
8 
9 #include "nine_dump.h"
10 
11 #if defined(DEBUG) || !defined(NDEBUG)
12 
13 static char __thread tls[128];
14 
nine_D3DDEVTYPE_to_str(D3DDEVTYPE type)15 const char *nine_D3DDEVTYPE_to_str(D3DDEVTYPE type)
16 {
17     switch (type) {
18     case D3DDEVTYPE_HAL: return "HAL";
19     case D3DDEVTYPE_NULLREF: return "NULLREF";
20     case D3DDEVTYPE_REF: return "REF";
21     case D3DDEVTYPE_SW: return "SW";
22     default:
23        return "(D3DDEVTYPE_?)";
24     }
25 }
26 
nine_D3DPOOL_to_str(D3DPOOL pool)27 const char *nine_D3DPOOL_to_str(D3DPOOL pool)
28 {
29     switch (pool) {
30     case D3DPOOL_DEFAULT: return "DEFAULT";
31     case D3DPOOL_MANAGED: return "MANAGED";
32     case D3DPOOL_SYSTEMMEM: return "SYSTEMMEM";
33     case D3DPOOL_SCRATCH: return "SCRATCH";
34     default:
35         return "(D3DPOOL_?)";
36     }
37 }
38 
nine_D3DSAMP_to_str(DWORD samp)39 const char *nine_D3DSAMP_to_str(DWORD samp)
40 {
41     switch (samp) {
42     case D3DSAMP_ADDRESSU: return "ADDRESSU";
43     case D3DSAMP_ADDRESSV: return "ADDRESSV";
44     case D3DSAMP_ADDRESSW: return "ADDRESSW";
45     case D3DSAMP_BORDERCOLOR: return "BORDERCOLOR";
46     case D3DSAMP_MAGFILTER: return "MAGFILTER";
47     case D3DSAMP_MINFILTER: return "MINFILTER";
48     case D3DSAMP_MIPFILTER: return "MIPFILTER";
49     case D3DSAMP_MIPMAPLODBIAS: return "MIPMAPLODBIAS";
50     case D3DSAMP_MAXMIPLEVEL: return "MAXMIPLEVEL";
51     case D3DSAMP_MAXANISOTROPY: return "MAXANISOTROPY";
52     case D3DSAMP_SRGBTEXTURE: return "SRGBTEXTURE";
53     case D3DSAMP_ELEMENTINDEX: return "ELEMENTINDEX";
54     case D3DSAMP_DMAPOFFSET: return "DMAPOFFSET";
55     default:
56         return "(D3DSAMP_?)";
57     }
58 }
59 
60 #define C2S(n,s) \
61     do { \
62         if (usage & D3DUSAGE_##n) p += snprintf(&tls[p], sizeof(tls) - p, s); \
63     } while(0)
nine_D3DUSAGE_to_str(DWORD usage)64 const char *nine_D3DUSAGE_to_str(DWORD usage)
65 {
66     int p = 0;
67     tls[0] = 0;
68     C2S(AUTOGENMIPMAP, "MIPGEN");
69     C2S(WRITEONLY, "WO");
70     C2S(DYNAMIC, "DYNAMIC");
71     C2S(DEPTHSTENCIL, "DS");
72     C2S(RENDERTARGET, "RT");
73     C2S(SOFTWAREPROCESSING, "SW");
74     C2S(DONOTCLIP, "NOCLIP");
75     C2S(POINTS, "POINTS");
76     C2S(DMAP, "DMAP");
77     C2S(NPATCHES, "NPATCHES");
78     C2S(RTPATCHES, "RTPATCHES");
79     C2S(TEXTAPI, "TEXTAPI");
80     C2S(NONSECURE, "NONSECURE");
81     C2S(RESTRICTED_CONTENT, "RESTRICTED_CONTENT");
82     C2S(RESTRICT_SHARED_RESOURCE, "RESTRICT_SHARED_RESOURCE");
83     C2S(RESTRICT_SHARED_RESOURCE_DRIVER, "RESTRICT_SHARED_RESOURCE_DRIVER");
84     return tls;
85 }
86 #undef C2S
87 
88 #define C2S(n) \
89     do { \
90         if (flags & D3DPRESENTFLAG_##n) \
91             p += snprintf(&tls[p], sizeof(tls) - p, #n); \
92     } while(0)
nine_D3DPRESENTFLAG_to_str(DWORD flags)93 const char *nine_D3DPRESENTFLAG_to_str(DWORD flags)
94 {
95     int p = 0;
96     tls[0] = 0;
97     C2S(DEVICECLIP);
98     C2S(DISCARD_DEPTHSTENCIL);
99     C2S(LOCKABLE_BACKBUFFER);
100     C2S(NOAUTOROTATE);
101     C2S(UNPRUNEDMODE);
102     C2S(VIDEO);
103     C2S(OVERLAY_LIMITEDRGB);
104     C2S(OVERLAY_YCbCr_BT709);
105     C2S(OVERLAY_YCbCr_xvYCC);
106     C2S(RESTRICTED_CONTENT);
107     C2S(RESTRICT_SHARED_RESOURCE_DRIVER);
108     return tls;
109 }
110 #undef C2S
111 
112 #define C2S(n) \
113     do { \
114         if (lock & D3DLOCK_##n) p += snprintf(&tls[p], sizeof(tls) - p, #n"|"); \
115     } while(0)
nine_D3DLOCK_to_str(DWORD lock)116 const char *nine_D3DLOCK_to_str(DWORD lock)
117 {
118     int p = 0;
119     tls[0] = 0;
120     C2S(DISCARD);
121     C2S(DONOTWAIT);
122     C2S(NO_DIRTY_UPDATE);
123     C2S(NOOVERWRITE);
124     C2S(NOSYSLOCK);
125     C2S(READONLY);
126     return tls;
127 }
128 #undef C2S
129 
nine_D3DRTYPE_to_str(D3DRESOURCETYPE type)130 const char *nine_D3DRTYPE_to_str(D3DRESOURCETYPE type)
131 {
132     switch (type) {
133     case D3DRTYPE_SURFACE: return "SURFACE";
134     case D3DRTYPE_VOLUME: return "VOLUME";
135     case D3DRTYPE_TEXTURE: return "TEXTURE";
136     case D3DRTYPE_VOLUMETEXTURE: return "VOLUMETEXTURE";
137     case D3DRTYPE_CUBETEXTURE: return "CUBETEXTURE";
138     case D3DRTYPE_VERTEXBUFFER: return "VERTEXBUFFER";
139     case D3DRTYPE_INDEXBUFFER: return "INDEXBUFFER";
140     default:
141         return "(D3DRTYPE_?)";
142     }
143 }
144 
nine_D3DQUERYTYPE_to_str(D3DQUERYTYPE type)145 const char *nine_D3DQUERYTYPE_to_str(D3DQUERYTYPE type)
146 {
147     switch (type) {
148     case D3DQUERYTYPE_VCACHE: return "VCACHE";
149     case D3DQUERYTYPE_RESOURCEMANAGER: return "RESOURCEMANAGER";
150     case D3DQUERYTYPE_VERTEXSTATS: return "VERTEXSTATS";
151     case D3DQUERYTYPE_EVENT: return "EVENT";
152     case D3DQUERYTYPE_OCCLUSION: return "OCCLUSION";
153     case D3DQUERYTYPE_TIMESTAMP: return "TIMESTAMP";
154     case D3DQUERYTYPE_TIMESTAMPDISJOINT: return "TIMESTAMPDISJOINT";
155     case D3DQUERYTYPE_TIMESTAMPFREQ: return "TIMESTAMPFREQ";
156     case D3DQUERYTYPE_PIPELINETIMINGS: return "PIPELINETIMINGS";
157     case D3DQUERYTYPE_INTERFACETIMINGS: return "INTERFACETIMINGS";
158     case D3DQUERYTYPE_VERTEXTIMINGS: return "VERTEXTIMINGS";
159     case D3DQUERYTYPE_PIXELTIMINGS: return "PIXELTIMINGS";
160     case D3DQUERYTYPE_BANDWIDTHTIMINGS: return "BANDWIDTHTIMINGS";
161     case D3DQUERYTYPE_CACHEUTILIZATION: return "CACHEUTILIZATION";
162     default:
163         return "(D3DQUERYTYPE_?)";
164     }
165 }
166 
nine_D3DTSS_to_str(D3DTEXTURESTAGESTATETYPE type)167 const char *nine_D3DTSS_to_str(D3DTEXTURESTAGESTATETYPE type)
168 {
169     switch (type) {
170     case D3DTSS_COLOROP: return "COLOROP";
171     case D3DTSS_ALPHAOP: return "ALPHAOP";
172     case D3DTSS_COLORARG0: return "COLORARG0";
173     case D3DTSS_COLORARG1: return "COLORARG1";
174     case D3DTSS_COLORARG2: return "COLORARG2";
175     case D3DTSS_ALPHAARG0: return "ALPHAARG0";
176     case D3DTSS_ALPHAARG1: return "ALPHAARG1";
177     case D3DTSS_ALPHAARG2: return "ALPHAARG2";
178     case D3DTSS_RESULTARG: return "RESULTARG";
179     case D3DTSS_BUMPENVMAT00: return "BUMPENVMAT00";
180     case D3DTSS_BUMPENVMAT01: return "BUMPENVMAT01";
181     case D3DTSS_BUMPENVMAT10: return "BUMPENVMAT10";
182     case D3DTSS_BUMPENVMAT11: return "BUMPENVMAT11";
183     case D3DTSS_BUMPENVLSCALE: return "BUMPENVLSCALE";
184     case D3DTSS_BUMPENVLOFFSET: return "BUMPENVLOFFSET";
185     case D3DTSS_TEXCOORDINDEX: return "TEXCOORDINDEX";
186     case D3DTSS_TEXTURETRANSFORMFLAGS: return "TEXTURETRANSFORMFLAGS";
187     case D3DTSS_CONSTANT: return "CONSTANT";
188     default:
189         return "(D3DTSS_?)";
190     }
191 }
192 
193 #define D3DTOP_TO_STR_CASE(n) case D3DTOP_##n: return #n
nine_D3DTOP_to_str(D3DTEXTUREOP top)194 const char *nine_D3DTOP_to_str(D3DTEXTUREOP top)
195 {
196     switch (top) {
197     D3DTOP_TO_STR_CASE(DISABLE);
198     D3DTOP_TO_STR_CASE(SELECTARG1);
199     D3DTOP_TO_STR_CASE(SELECTARG2);
200     D3DTOP_TO_STR_CASE(MODULATE);
201     D3DTOP_TO_STR_CASE(MODULATE2X);
202     D3DTOP_TO_STR_CASE(MODULATE4X);
203     D3DTOP_TO_STR_CASE(ADD);
204     D3DTOP_TO_STR_CASE(ADDSIGNED);
205     D3DTOP_TO_STR_CASE(ADDSIGNED2X);
206     D3DTOP_TO_STR_CASE(SUBTRACT);
207     D3DTOP_TO_STR_CASE(ADDSMOOTH);
208     D3DTOP_TO_STR_CASE(BLENDDIFFUSEALPHA);
209     D3DTOP_TO_STR_CASE(BLENDTEXTUREALPHA);
210     D3DTOP_TO_STR_CASE(BLENDFACTORALPHA);
211     D3DTOP_TO_STR_CASE(BLENDTEXTUREALPHAPM);
212     D3DTOP_TO_STR_CASE(BLENDCURRENTALPHA);
213     D3DTOP_TO_STR_CASE(PREMODULATE);
214     D3DTOP_TO_STR_CASE(MODULATEALPHA_ADDCOLOR);
215     D3DTOP_TO_STR_CASE(MODULATECOLOR_ADDALPHA);
216     D3DTOP_TO_STR_CASE(MODULATEINVALPHA_ADDCOLOR);
217     D3DTOP_TO_STR_CASE(MODULATEINVCOLOR_ADDALPHA);
218     D3DTOP_TO_STR_CASE(BUMPENVMAP);
219     D3DTOP_TO_STR_CASE(BUMPENVMAPLUMINANCE);
220     D3DTOP_TO_STR_CASE(DOTPRODUCT3);
221     D3DTOP_TO_STR_CASE(MULTIPLYADD);
222     D3DTOP_TO_STR_CASE(LERP);
223     default:
224         return "(D3DTOP_?)";
225     }
226 }
227 
228 static const char *
nine_D3DLIGHTTYPE_to_str(D3DLIGHTTYPE type)229 nine_D3DLIGHTTYPE_to_str(D3DLIGHTTYPE type)
230 {
231     switch (type) {
232     case D3DLIGHT_POINT: return "POINT";
233     case D3DLIGHT_SPOT: return "SPOT";
234     case D3DLIGHT_DIRECTIONAL: return "DIRECTIONAL";
235     default:
236         return "(D3DLIGHT_?)";
237     }
238 }
239 
240 static const char *
nine_D3DTA_to_str(DWORD value)241 nine_D3DTA_to_str(DWORD value)
242 {
243     switch (value & D3DTA_SELECTMASK) {
244     case D3DTA_DIFFUSE: return "DIFFUSE";
245     case D3DTA_CURRENT: return "CURRENT";
246     case D3DTA_TEXTURE: return "TEXTURE";
247     case D3DTA_TFACTOR: return "TFACTOR";
248     case D3DTA_SPECULAR: return "SPECULAR";
249     case D3DTA_TEMP: return "TEMP";
250     case D3DTA_CONSTANT: return "CONSTANT";
251     default:
252         return "(D3DTA_?)";
253     }
254 }
255 
256 static const char *
nine_D3DTSS_TCI_to_str(DWORD value)257 nine_D3DTSS_TCI_to_str(DWORD value)
258 {
259     switch (value & 0xf0000) {
260     case D3DTSS_TCI_PASSTHRU: return "PASSTHRU";
261     case D3DTSS_TCI_CAMERASPACENORMAL: return "CAMERASPACENORMAL";
262     case D3DTSS_TCI_CAMERASPACEPOSITION: return "CAMERASPACEPOSITION";
263     case D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
264         return "CAMERASPACEREFLECTIONVECTOR";
265     case D3DTSS_TCI_SPHEREMAP: return "SPHEREMAP";
266     default:
267         return "(D3DTSS_TCI_?)";
268     }
269 }
270 
271 static const char *
nine_D3DTTFF_to_str(DWORD value)272 nine_D3DTTFF_to_str(DWORD value)
273 {
274     switch (value) {
275     case D3DTTFF_DISABLE: return "DISABLE";
276     case D3DTTFF_COUNT1: return "COUNT1";
277     case D3DTTFF_COUNT2: return "COUNT2";
278     case D3DTTFF_COUNT3: return "COUNT3";
279     case D3DTTFF_COUNT4: return "COUNT4";
280     case D3DTTFF_PROJECTED: return "PROJECTED";
281     default:
282         return "(D3DTTFF_?)";
283     }
284 }
285 
286 void
nine_dump_D3DLIGHT9(unsigned ch,const D3DLIGHT9 * lit)287 nine_dump_D3DLIGHT9(unsigned ch, const D3DLIGHT9 *lit)
288 {
289     DBG_FLAG(ch, "D3DLIGHT9(%p):\n"
290              "Type: %s\n"
291              "Diffuse: (%f %f %f %f)\n"
292              "Specular: (%f %f %f %f)\n"
293              "Ambient: (%f %f %f %f)\n"
294              "Position: (%f %f %f)\n"
295              "Direction: (%f %f %f)\n"
296              "Range: %f\n"
297              "Falloff: %f\n"
298              "Attenuation: %f + %f * d + %f * d^2\n"
299              "Theta: %f deg\n"
300              "Phi: %f deg\n", lit,
301              nine_D3DLIGHTTYPE_to_str(lit->Type),
302              lit->Diffuse.r,lit->Diffuse.r,lit->Diffuse.g,lit->Diffuse.a,
303              lit->Specular.r,lit->Specular.r,lit->Specular.g,lit->Specular.a,
304              lit->Ambient.r,lit->Ambient.r,lit->Ambient.g,lit->Ambient.a,
305              lit->Position.x,lit->Position.y,lit->Position.z,
306              lit->Direction.x,lit->Direction.y,lit->Direction.z,
307              lit->Range,lit->Falloff,
308              lit->Attenuation0,lit->Attenuation1,lit->Attenuation2,
309              lit->Theta * 360.0f / M_PI,lit->Phi * 360.0f / M_PI);
310 }
311 
312 void
nine_dump_D3DMATERIAL9(unsigned ch,const D3DMATERIAL9 * mat)313 nine_dump_D3DMATERIAL9(unsigned ch, const D3DMATERIAL9 *mat)
314 {
315     DBG_FLAG(ch, "D3DMATERIAL9(%p):\n"
316              "Diffuse: (%f %f %f %f)\n"
317              "Specular: (%f %f %f %f)\n"
318              "Ambient: (%f %f %f %f)\n"
319              "Emissive: (%f %f %f %f)\n"
320              "Power: %f\n", mat,
321              mat->Diffuse.r,mat->Diffuse.r,mat->Diffuse.g,mat->Diffuse.a,
322              mat->Specular.r,mat->Specular.r,mat->Specular.g,mat->Specular.a,
323              mat->Ambient.r,mat->Ambient.r,mat->Ambient.g,mat->Ambient.a,
324              mat->Emissive.r,mat->Emissive.r,mat->Emissive.g,mat->Emissive.a,
325              mat->Power);
326 }
327 
328 void
nine_dump_D3DTSS_value(unsigned ch,D3DTEXTURESTAGESTATETYPE type,DWORD value)329 nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE type, DWORD value)
330 {
331     float rgba[4];
332 
333     switch (type) {
334     case D3DTSS_COLOROP:
335     case D3DTSS_ALPHAOP:
336         DBG_FLAG(ch, "D3DTSS_%s = %s\n",
337                  nine_D3DTSS_to_str(type), nine_D3DTOP_to_str(value));
338         break;
339     case D3DTSS_COLORARG0:
340     case D3DTSS_COLORARG1:
341     case D3DTSS_COLORARG2:
342     case D3DTSS_ALPHAARG0:
343     case D3DTSS_ALPHAARG1:
344     case D3DTSS_ALPHAARG2:
345     case D3DTSS_RESULTARG:
346         DBG_FLAG(ch, "D3DTSS_%s = %s%s%s\n",
347                  nine_D3DTSS_to_str(type),
348                  (value & D3DTA_COMPLEMENT) ? "COMPLEMENT " : "",
349                  (value & D3DTA_ALPHAREPLICATE) ? "ALPHAREPLICATE " : "",
350                  nine_D3DTA_to_str(value));
351         break;
352     case D3DTSS_BUMPENVMAT00:
353     case D3DTSS_BUMPENVMAT01:
354     case D3DTSS_BUMPENVMAT10:
355     case D3DTSS_BUMPENVMAT11:
356     case D3DTSS_BUMPENVLSCALE:
357     case D3DTSS_BUMPENVLOFFSET:
358         DBG_FLAG(ch, "D3DTSS_%s = %f\n",
359                  nine_D3DTSS_to_str(type), asfloat(value));
360         break;
361     case D3DTSS_TEXCOORDINDEX:
362         DBG_FLAG(ch, "D3DTSS_TEXCOORDINDEX = %s %u\n",
363                  nine_D3DTSS_TCI_to_str(value),
364                  value & 0xffff);
365         break;
366     case D3DTSS_TEXTURETRANSFORMFLAGS:
367         DBG_FLAG(ch, "D3DTSS_TEXTURETRANSFORMFLAGS = %s\n",
368                  nine_D3DTTFF_to_str(value));
369         break;
370     case D3DTSS_CONSTANT:
371         d3dcolor_to_rgba(rgba, value);
372         DBG_FLAG(ch, "D3DTSS_CONSTANT = %f %f %f %F\n",
373                  rgba[0],rgba[1],rgba[2],rgba[3]);
374         break;
375     default:
376         DBG_FLAG(ch, "D3DTSS_? = 0x%08x\n", value);
377         break;
378     }
379 }
380 
381 void
nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch,const D3DADAPTER_IDENTIFIER9 * id)382 nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id)
383 {
384     DBG_FLAG(ch, "D3DADAPTER_IDENTIFIER9(%p):\n"
385              "Driver: %s\n"
386              "Description: %s\n"
387              "DeviceName: %s\n"
388              "DriverVersion: %08x.%08x\n"
389              "VendorId: %x\n"
390              "DeviceId: %x\n"
391              "SubSysId: %x\n"
392              "Revision: %u\n"
393              "GUID: %08x.%04x.%04x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x\n"
394              "WHQLLevel: %u\n", id, id->Driver, id->Description,
395              id->DeviceName,
396              id->DriverVersionLowPart, id->DriverVersionHighPart,
397              id->VendorId, id->DeviceId, id->SubSysId,
398              id->Revision,
399              id->DeviceIdentifier.Data1,
400              id->DeviceIdentifier.Data2,
401              id->DeviceIdentifier.Data3,
402              id->DeviceIdentifier.Data4[0],
403              id->DeviceIdentifier.Data4[1],
404              id->DeviceIdentifier.Data4[2],
405              id->DeviceIdentifier.Data4[3],
406              id->DeviceIdentifier.Data4[4],
407              id->DeviceIdentifier.Data4[5],
408              id->DeviceIdentifier.Data4[6],
409              id->DeviceIdentifier.Data4[7],
410              id->WHQLLevel);
411 }
412 
413 #define C2S(args...) p += snprintf(&s[p],c-p,args)
414 
415 #define CAP_CASE(m,p,n) \
416     do {                     \
417         if (caps->m & p##_##n) \
418             C2S(" "#n); \
419         else \
420             C2S(" ("#n")"); \
421     } while(0)
422 
423 void
nine_dump_D3DCAPS9(unsigned ch,const D3DCAPS9 * caps)424 nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps)
425 {
426     const int c = 1 << 17;
427     int p = 0;
428     char *s = (char *)MALLOC(c);
429 
430     if (!s) {
431         DBG_FLAG(ch, "D3DCAPS9(%p): (out of memory)\n", caps);
432         return;
433     }
434 
435     C2S("DeviceType: %s\n", nine_D3DDEVTYPE_to_str(caps->DeviceType));
436 
437     C2S("AdapterOrdinal: %u\nCaps:", caps->AdapterOrdinal);
438     if (caps->Caps & 0x20000)
439         C2S(" READ_SCANLINE");
440     if (caps->Caps & ~0x20000)
441         C2S(" %x", caps->Caps & ~0x20000);
442 
443     C2S("\nCaps2:");
444     CAP_CASE(Caps2, D3DCAPS2, CANAUTOGENMIPMAP);
445     CAP_CASE(Caps2, D3DCAPS2, CANCALIBRATEGAMMA);
446     CAP_CASE(Caps2, D3DCAPS2, CANSHARERESOURCE);
447     CAP_CASE(Caps2, D3DCAPS2, CANMANAGERESOURCE);
448     CAP_CASE(Caps2, D3DCAPS2, DYNAMICTEXTURES);
449     CAP_CASE(Caps2, D3DCAPS2, FULLSCREENGAMMA);
450 
451     C2S("\nCaps3:");
452     CAP_CASE(Caps3, D3DCAPS3, ALPHA_FULLSCREEN_FLIP_OR_DISCARD);
453     CAP_CASE(Caps3, D3DCAPS3, COPY_TO_VIDMEM);
454     CAP_CASE(Caps3, D3DCAPS3, COPY_TO_SYSTEMMEM);
455     CAP_CASE(Caps3, D3DCAPS3, DXVAHD);
456     CAP_CASE(Caps3, D3DCAPS3, LINEAR_TO_SRGB_PRESENTATION);
457 
458     C2S("\nPresentationIntervals:");
459     CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, ONE);
460     CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, TWO);
461     CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, THREE);
462     CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, FOUR);
463     CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, IMMEDIATE);
464 
465     C2S("\nCursorCaps:");
466     CAP_CASE(CursorCaps, D3DCURSORCAPS, COLOR);
467     CAP_CASE(CursorCaps, D3DCURSORCAPS, LOWRES);
468 
469     C2S("\nDevCaps:");
470     CAP_CASE(DevCaps, D3DDEVCAPS, CANBLTSYSTONONLOCAL);
471     CAP_CASE(DevCaps, D3DDEVCAPS, CANRENDERAFTERFLIP);
472     CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMITIVES2);
473     CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMITIVES2EX);
474     CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMTLVERTEX);
475     CAP_CASE(DevCaps, D3DDEVCAPS, EXECUTESYSTEMMEMORY);
476     CAP_CASE(DevCaps, D3DDEVCAPS, EXECUTEVIDEOMEMORY);
477     CAP_CASE(DevCaps, D3DDEVCAPS, HWRASTERIZATION);
478     CAP_CASE(DevCaps, D3DDEVCAPS, HWTRANSFORMANDLIGHT);
479     CAP_CASE(DevCaps, D3DDEVCAPS, NPATCHES);
480     CAP_CASE(DevCaps, D3DDEVCAPS, PUREDEVICE);
481     CAP_CASE(DevCaps, D3DDEVCAPS, QUINTICRTPATCHES);
482     CAP_CASE(DevCaps, D3DDEVCAPS, RTPATCHES);
483     CAP_CASE(DevCaps, D3DDEVCAPS, RTPATCHHANDLEZERO);
484     CAP_CASE(DevCaps, D3DDEVCAPS, SEPARATETEXTUREMEMORIES);
485     CAP_CASE(DevCaps, D3DDEVCAPS, TEXTURENONLOCALVIDMEM);
486     CAP_CASE(DevCaps, D3DDEVCAPS, TEXTURESYSTEMMEMORY);
487     CAP_CASE(DevCaps, D3DDEVCAPS, TEXTUREVIDEOMEMORY);
488     CAP_CASE(DevCaps, D3DDEVCAPS, TLVERTEXSYSTEMMEMORY);
489     CAP_CASE(DevCaps, D3DDEVCAPS, TLVERTEXVIDEOMEMORY);
490 
491     C2S("\nPrimitiveMiscCaps:");
492     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MASKZ);
493     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLNONE);
494     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLCW);
495     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLCCW);
496     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, COLORWRITEENABLE);
497     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CLIPPLANESCALEDPOINTS);
498     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CLIPTLVERTS);
499     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, TSSARGTEMP);
500     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, BLENDOP);
501     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, NULLREFERENCE);
502     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, INDEPENDENTWRITEMASKS);
503     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, PERSTAGECONSTANT);
504     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, POSTBLENDSRGBCONVERT);
505     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, FOGANDSPECULARALPHA);
506     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, SEPARATEALPHABLEND);
507     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MRTINDEPENDENTBITDEPTHS);
508     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MRTPOSTPIXELSHADERBLENDING);
509     CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, FOGVERTEXCLAMPED);
510 
511     C2S("\nRasterCaps:");
512     CAP_CASE(RasterCaps, D3DPRASTERCAPS, ANISOTROPY);
513     CAP_CASE(RasterCaps, D3DPRASTERCAPS, COLORPERSPECTIVE);
514     CAP_CASE(RasterCaps, D3DPRASTERCAPS, DITHER);
515     CAP_CASE(RasterCaps, D3DPRASTERCAPS, DEPTHBIAS);
516     CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGRANGE);
517     CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGTABLE);
518     CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGVERTEX);
519     CAP_CASE(RasterCaps, D3DPRASTERCAPS, MIPMAPLODBIAS);
520     CAP_CASE(RasterCaps, D3DPRASTERCAPS, MULTISAMPLE_TOGGLE);
521     CAP_CASE(RasterCaps, D3DPRASTERCAPS, SCISSORTEST);
522     CAP_CASE(RasterCaps, D3DPRASTERCAPS, SLOPESCALEDEPTHBIAS);
523     CAP_CASE(RasterCaps, D3DPRASTERCAPS, WBUFFER);
524     CAP_CASE(RasterCaps, D3DPRASTERCAPS, WFOG);
525     CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZBUFFERLESSHSR);
526     CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZFOG);
527     CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZTEST);
528 
529     C2S("\nZCmpCaps:");
530     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, ALWAYS);
531     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, EQUAL);
532     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, GREATER);
533     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, GREATEREQUAL);
534     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, LESS);
535     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, LESSEQUAL);
536     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, NEVER);
537     CAP_CASE(ZCmpCaps, D3DPCMPCAPS, NOTEQUAL);
538 
539     C2S("\nSrcBlendCaps");
540     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BLENDFACTOR);
541     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BOTHINVSRCALPHA);
542     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BOTHSRCALPHA);
543     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, DESTALPHA);
544     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, DESTCOLOR);
545     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVDESTALPHA);
546     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVDESTCOLOR);
547     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCALPHA);
548     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR);
549     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR2);
550     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, ONE);
551     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCALPHA);
552     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCALPHASAT);
553     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCCOLOR);
554     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCCOLOR2);
555     CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, ZERO);
556 
557     C2S("\nDestBlendCaps");
558     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BLENDFACTOR);
559     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BOTHINVSRCALPHA);
560     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BOTHSRCALPHA);
561     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, DESTALPHA);
562     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, DESTCOLOR);
563     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVDESTALPHA);
564     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVDESTCOLOR);
565     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCALPHA);
566     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR);
567     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR2);
568     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, ONE);
569     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCALPHA);
570     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCALPHASAT);
571     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCCOLOR);
572     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCCOLOR2);
573     CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, ZERO);
574 
575     C2S("\nAlphaCmpCaps:");
576     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, ALWAYS);
577     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, EQUAL);
578     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, GREATER);
579     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, GREATEREQUAL);
580     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, LESS);
581     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, LESSEQUAL);
582     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, NEVER);
583     CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, NOTEQUAL);
584 
585     C2S("\nShadeCaps:");
586     CAP_CASE(ShadeCaps, D3DPSHADECAPS, ALPHAGOURAUDBLEND);
587     CAP_CASE(ShadeCaps, D3DPSHADECAPS, COLORGOURAUDRGB);
588     CAP_CASE(ShadeCaps, D3DPSHADECAPS, FOGGOURAUD);
589     CAP_CASE(ShadeCaps, D3DPSHADECAPS, SPECULARGOURAUDRGB);
590 
591     C2S("\nTextureCaps:");
592     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, ALPHA);
593     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, ALPHAPALETTE);
594     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, CUBEMAP);
595     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, CUBEMAP_POW2);
596     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPCUBEMAP);
597     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPMAP);
598     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPVOLUMEMAP);
599     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, NONPOW2CONDITIONAL);
600     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, NOPROJECTEDBUMPENV);
601     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, PERSPECTIVE);
602     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, POW2);
603     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, PROJECTED);
604     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, SQUAREONLY);
605     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, TEXREPEATNOTSCALEDBYSIZE);
606     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, VOLUMEMAP);
607     CAP_CASE(TextureCaps, D3DPTEXTURECAPS, VOLUMEMAP_POW2);
608 
609     C2S("\nTextureFilterCaps:");
610  /* CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */
611     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT);
612     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR);
613     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC);
614     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD);
615     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD);
616     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT);
617     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR);
618     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC);
619     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD);
620     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD);
621     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT);
622     CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR);
623 
624     C2S("\nCubeTextureFilterCaps:");
625  /* CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */
626     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT);
627     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR);
628     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC);
629     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD);
630     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD);
631     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT);
632     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR);
633     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC);
634     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD);
635     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD);
636     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT);
637     CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR);
638 
639     C2S("\nVolumeTextureFilterCaps:");
640  /* CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */
641     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT);
642     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR);
643     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC);
644     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD);
645     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD);
646     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT);
647     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR);
648     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC);
649     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD);
650     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD);
651     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT);
652     CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR);
653 
654     C2S("\nTextureAddressCaps:");
655     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, BORDER);
656     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, CLAMP);
657     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, INDEPENDENTUV);
658     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, MIRROR);
659     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, MIRRORONCE);
660     CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, WRAP);
661 
662     C2S("\nVolumeTextureAddressCaps:");
663     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, BORDER);
664     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, CLAMP);
665     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, INDEPENDENTUV);
666     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, MIRROR);
667     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, MIRRORONCE);
668     CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, WRAP);
669 
670     C2S("\nLineCaps:");
671     CAP_CASE(LineCaps, D3DLINECAPS, ALPHACMP);
672     CAP_CASE(LineCaps, D3DLINECAPS, ANTIALIAS);
673     CAP_CASE(LineCaps, D3DLINECAPS, BLEND);
674     CAP_CASE(LineCaps, D3DLINECAPS, FOG);
675     CAP_CASE(LineCaps, D3DLINECAPS, TEXTURE);
676     CAP_CASE(LineCaps, D3DLINECAPS, ZTEST);
677 
678     C2S("\nMaxTextureWidth: %u", caps->MaxTextureWidth);
679     C2S("\nMaxTextureHeight: %u", caps->MaxTextureHeight);
680     C2S("\nMaxVolumeExtent: %u", caps->MaxVolumeExtent);
681     C2S("\nMaxTextureRepeat: %u", caps->MaxTextureRepeat);
682     C2S("\nMaxTextureAspectRatio: %u", caps->MaxTextureAspectRatio);
683     C2S("\nMaxAnisotropy: %u", caps->MaxAnisotropy);
684     C2S("\nMaxVertexW: %f", caps->MaxVertexW);
685 
686     C2S("\nGuardBandLef,Top,Right,Bottom: %f %f %f %f",
687         caps->GuardBandLeft, caps->GuardBandTop,
688         caps->GuardBandRight, caps->GuardBandBottom);
689 
690     C2S("\nExtentsAdjust: %f", caps->ExtentsAdjust);
691 
692     C2S("\nStencilCaps:");
693     CAP_CASE(StencilCaps, D3DSTENCILCAPS, KEEP);
694     CAP_CASE(StencilCaps, D3DSTENCILCAPS, ZERO);
695     CAP_CASE(StencilCaps, D3DSTENCILCAPS, REPLACE);
696     CAP_CASE(StencilCaps, D3DSTENCILCAPS, INCRSAT);
697     CAP_CASE(StencilCaps, D3DSTENCILCAPS, DECRSAT);
698     CAP_CASE(StencilCaps, D3DSTENCILCAPS, INVERT);
699     CAP_CASE(StencilCaps, D3DSTENCILCAPS, INCR);
700     CAP_CASE(StencilCaps, D3DSTENCILCAPS, DECR);
701     CAP_CASE(StencilCaps, D3DSTENCILCAPS, TWOSIDED);
702 
703     C2S("\nFVFCaps:");
704     CAP_CASE(FVFCaps, D3DFVFCAPS, DONOTSTRIPELEMENTS);
705     CAP_CASE(FVFCaps, D3DFVFCAPS, PSIZE);
706     CAP_CASE(FVFCaps, D3DFVFCAPS, TEXCOORDCOUNTMASK);
707 
708     C2S("\nTextureOpCaps:");
709     CAP_CASE(TextureOpCaps, D3DTEXOPCAPS, ADD);
710     CAP_CASE(TextureOpCaps, D3DTEXOPCAPS, ADDSIGNED);
711     C2S(" ...");
712 
713     C2S("\nMaxTextureBlendStages: %u", caps->MaxTextureBlendStages);
714     C2S("\nMaxSimultaneousTextures: %u", caps->MaxTextureBlendStages);
715 
716     C2S("\nVertexProcessingCaps:");
717     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, DIRECTIONALLIGHTS);
718     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, LOCALVIEWER);
719     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, MATERIALSOURCE7);
720     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, NO_TEXGEN_NONLOCALVIEWER);
721     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, POSITIONALLIGHTS);
722     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TEXGEN);
723     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TEXGEN_SPHEREMAP);
724     CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TWEENING);
725 
726     C2S("\nMaxActiveLights: %u", caps->MaxActiveLights);
727     C2S("\nMaxUserClipPlanes: %u", caps->MaxUserClipPlanes);
728     C2S("\nMaxVertexBlendMatrices: %u", caps->MaxVertexBlendMatrices);
729     C2S("\nMaxVertexBlendMatrixIndex: %u", caps->MaxVertexBlendMatrixIndex);
730     C2S("\nMaxPointSize: %f", caps->MaxPointSize);
731     C2S("\nMaxPrimitiveCount: 0x%x", caps->MaxPrimitiveCount);
732     C2S("\nMaxVertexIndex: 0x%x", caps->MaxVertexIndex);
733     C2S("\nMaxStreams: %u", caps->MaxStreams);
734     C2S("\nMaxStreamStride: 0x%x", caps->MaxStreamStride);
735 
736     C2S("\nVertexShaderVersion: %08x", caps->VertexShaderVersion);
737     C2S("\nMaxVertexShaderConst: %u", caps->MaxVertexShaderConst);
738     C2S("\nPixelShaderVersion: %08x", caps->PixelShaderVersion);
739     C2S("\nPixelShader1xMaxValue: %f", caps->PixelShader1xMaxValue);
740 
741     DBG_FLAG(ch, "D3DCAPS9(%p) part 1:\n%s\n", caps, s);
742     p = 0;
743 
744     C2S("DevCaps2:");
745     CAP_CASE(DevCaps2, D3DDEVCAPS2, ADAPTIVETESSRTPATCH);
746     CAP_CASE(DevCaps2, D3DDEVCAPS2, ADAPTIVETESSNPATCH);
747     CAP_CASE(DevCaps2, D3DDEVCAPS2, CAN_STRETCHRECT_FROM_TEXTURES);
748     CAP_CASE(DevCaps2, D3DDEVCAPS2, DMAPNPATCH);
749     CAP_CASE(DevCaps2, D3DDEVCAPS2, PRESAMPLEDDMAPNPATCH);
750     CAP_CASE(DevCaps2, D3DDEVCAPS2, STREAMOFFSET);
751     CAP_CASE(DevCaps2, D3DDEVCAPS2, VERTEXELEMENTSCANSHARESTREAMOFFSET);
752 
753     C2S("\nMasterAdapterOrdinal: %u", caps->MasterAdapterOrdinal);
754     C2S("\nAdapterOrdinalInGroup: %u", caps->AdapterOrdinalInGroup);
755     C2S("\nNumberOfAdaptersInGroup: %u", caps->NumberOfAdaptersInGroup);
756 
757     C2S("\nDeclTypes:");
758     CAP_CASE(DeclTypes, D3DDTCAPS, UBYTE4);
759     CAP_CASE(DeclTypes, D3DDTCAPS, UBYTE4N);
760     CAP_CASE(DeclTypes, D3DDTCAPS, SHORT2N);
761     CAP_CASE(DeclTypes, D3DDTCAPS, SHORT4N);
762     CAP_CASE(DeclTypes, D3DDTCAPS, USHORT2N);
763     CAP_CASE(DeclTypes, D3DDTCAPS, USHORT4N);
764     CAP_CASE(DeclTypes, D3DDTCAPS, UDEC3);
765     CAP_CASE(DeclTypes, D3DDTCAPS, DEC3N);
766     CAP_CASE(DeclTypes, D3DDTCAPS, FLOAT16_2);
767     CAP_CASE(DeclTypes, D3DDTCAPS, FLOAT16_4);
768 
769     C2S("\nNumSimultaneousRTs: %u", caps->NumSimultaneousRTs);
770 
771     C2S("\nStretchRectFilterCaps:");
772     CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MINFPOINT);
773     CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MINFLINEAR);
774     CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MAGFPOINT);
775     CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR);
776 
777     C2S("\nVS20Caps.Caps: Predication=%s", caps->VS20Caps.Caps ? "yes" : "no");
778     C2S("\nVS20Caps.DynamicFlowControlDepth: %u", caps->VS20Caps.DynamicFlowControlDepth);
779     C2S("\nVS20Caps.NumTemps: %u", caps->VS20Caps.NumTemps);
780     C2S("\nVS20Caps.StaticFlowControlDepth: %u", caps->VS20Caps.StaticFlowControlDepth);
781 
782     C2S("\nPS20Caps.Caps: Predication=%s", caps->VS20Caps.Caps ? "yes" : "no");
783     C2S("\nPS20Caps.DynamicFlowControlDepth: %u", caps->PS20Caps.DynamicFlowControlDepth);
784     C2S("\nPS20Caps.NumTemps: %u", caps->PS20Caps.NumTemps);
785     C2S("\nPS20Caps.StaticFlowControlDepth: %u", caps->PS20Caps.StaticFlowControlDepth);
786     C2S("\nPS20Caps.NumInstructionSlots: %u", caps->PS20Caps.NumInstructionSlots);
787 
788     C2S("\nVertexTextureFilterCaps");
789  /* CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */
790     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT);
791     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR);
792     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC);
793     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD);
794     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD);
795     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT);
796     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR);
797     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC);
798     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD);
799     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD);
800     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT);
801     CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR);
802 
803     C2S("\nMaxVShaderInstructionsExecuted: %u", caps->MaxVShaderInstructionsExecuted);
804     C2S("\nMaxPShaderInstructionsExecuted: %u", caps->MaxPShaderInstructionsExecuted);
805     C2S("\nMaxVertexShader30InstructionSlots: %u >= 512", caps->MaxVertexShader30InstructionSlots);
806     C2S("\nMaxPixelShader30InstructionSlots: %u >= 512", caps->MaxPixelShader30InstructionSlots);
807 
808     DBG_FLAG(ch, "D3DCAPS9(%p) part 2:\n%s\n", caps, s);
809 
810     FREE(s);
811 }
812 
813 #endif /* DEBUG || !NDEBUG */
814