diff options
author | Joakim Sindholt <[email protected]> | 2011-08-04 15:14:06 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2014-11-18 02:02:54 +0000 |
commit | fdd96578ef2dfe9c4ad5aab5858036298d444a64 (patch) | |
tree | 3230b0fb321381250a506503825318facb10ca73 /src/gallium/state_trackers/nine/nine_debug.c | |
parent | 7d2573b5376bb4f9ce9a50e0b965e06032b135a9 (diff) |
nine: Add state tracker nine for Direct3D9 (v3)
Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
DRI3 port done by Axel Davy (mannerov).
v2: - nine_debug.c: klass extended from 32 chars to 96 (for sure) by glennk
- Nine improvements by Axel Davy (which also fixed some wine tests)
- by Emil Velikov:
- convert to static/shared drivers
- Sort and cleanup the includes
- Use AM_CPPFLAGS for the defines
- Add the linker garbage collector
- Restrict the exported symbols (think llvm)
v3: - small nine fixes
- build system improvements by Emil Velikov
v4: [Emil Velikov]
- Do no link against libudev. No longer needed.
Acked-by: Jose Fonseca <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Axel Davy <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/nine_debug.c')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_debug.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/nine_debug.c b/src/gallium/state_trackers/nine/nine_debug.c new file mode 100644 index 00000000000..4779192ecc3 --- /dev/null +++ b/src/gallium/state_trackers/nine/nine_debug.c @@ -0,0 +1,104 @@ +/* + * Copyright 2011 Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "nine_debug.h" + +#include <ctype.h> + +static const struct debug_named_value nine_debug_flags[] = { + { "unknown", DBG_UNKNOWN, "IUnknown implementation." }, + { "adapter", DBG_ADAPTER, "ID3D9Adapter implementation." }, + { "overlay", DBG_OVERLAYEXTENSION, "IDirect3D9ExOverlayExtension implementation." }, + { "auth", DBG_AUTHENTICATEDCHANNEL, "IDirect3DAuthenticatedChannel9 implementation." }, + { "basetex", DBG_BASETEXTURE, "IDirect3DBaseTexture9 implementation." }, + { "crypto", DBG_CRYPTOSESSION, "IDirect3DCryptoSession9 implementation." }, + { "cubetex", DBG_CUBETEXTURE, "IDirect3DCubeTexture9 implementation." }, + { "device", DBG_DEVICE, "IDirect3DDevice9(Ex) implementation." }, + { "video", DBG_DEVICEVIDEO, "IDirect3DDeviceVideo9 implementation." }, + { "ibuf", DBG_INDEXBUFFER, "IDirect3DIndexBuffer9 implementation." }, + { "ps", DBG_PIXELSHADER, "IDirect3DPixelShader9 implementation." }, + { "query", DBG_QUERY, "IDirect3DQuery9 implementation." }, + { "res", DBG_RESOURCE, "IDirect3DResource9 implementation." }, + { "state", DBG_STATEBLOCK, "IDirect3DStateBlock9 implementation." }, + { "surf", DBG_SURFACE, "IDirect3DSurface9 implementation." }, + { "swap", DBG_SWAPCHAIN, "IDirect3DSwapChain9(Ex) implementation." }, + { "tex", DBG_TEXTURE, "IDirect3DTexture9 implementation." }, + { "vbuf", DBG_VERTEXBUFFER, "IDirect3DVertexBuffer9 implementation." }, + { "vdecl", DBG_VERTEXDECLARATION, "IDirect3DVertexDeclaration9 implementation." }, + { "vs", DBG_VERTEXSHADER, "IDirect3DVertexShader9 implementation." }, + { "3dsurf", DBG_VOLUME, "IDirect3DVolume9 implementation." }, + { "3dtex", DBG_VOLUMETEXTURE, "IDirect3DVolumeTexture9 implementation." }, + { "shader", DBG_SHADER, "Shader token stream translator." }, + { "ff", DBG_FF, "Fixed function emulation." }, + { "user", DBG_USER, "User errors, both fixable and unfixable." }, + { "error", DBG_ERROR, "Driver errors, always visible." }, + { "warn", DBG_WARN, "Driver warnings, always visible in debug builds." }, + DEBUG_NAMED_VALUE_END +}; + +void +_nine_debug_printf( unsigned long flag, + const char *func, + const char *fmt, + ... ) +{ + static boolean first = TRUE; + static unsigned long dbg_flags = DBG_ERROR | DBG_WARN; + + if (first) { + first = FALSE; + dbg_flags |= debug_get_flags_option("NINE_DEBUG", nine_debug_flags, 0); + } + if (dbg_flags & flag) { + const char *f = func ? strrchr(func, '_') : NULL; + va_list ap; + + /* inside a class this will print nine:classinlowercase:func: while + * outside a class (rarely used) it will just print nine:func: + * the reason for lower case is simply to match the filenames, as it + * will also strip off the "Nine" */ + if (f && strncmp(func, "Nine", 4) == 0) { + char klass[96]; /* no class name is this long */ + char *ptr = klass; + for (func += 4; func != f; ++func) { *ptr++ = tolower(*func); } + *ptr = '\0'; + + debug_printf("nine:%s:%s: ", klass, ++f); + } else if (func) { + debug_printf("nine:%s: ", func); + } + + va_start(ap, fmt); + debug_vprintf(fmt, ap); + va_end(ap); + } +} + +void +_nine_stub( const char *file, + const char *func, + unsigned line ) +{ + const char *r = strrchr(file, '/'); + if (r == NULL) { r = strrchr(file, '\\'); } + debug_printf("nine:%s:%d: %s STUB!\n", r ? ++r : file, line, func); +} |