st/nine: Print GUID instead of pointer
authorPatrick Rudolph <siro@das-labor.org>
Sat, 14 Nov 2015 11:59:46 +0000 (12:59 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 4 Feb 2016 21:12:17 +0000 (22:12 +0100)
To ease debugging print the GUID instead of the pointer to it.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/guid.c
src/gallium/state_trackers/nine/guid.h
src/gallium/state_trackers/nine/resource9.c

index 5034feb4d712c19268a31621add7e5b9079df2a2..5e63d2f6629dca3ac47274a066232def47a04df2 100644 (file)
@@ -20,6 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#include <stdio.h>
 #include "guid.h"
 
 const GUID IID_IUnknown = { 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
@@ -64,3 +65,20 @@ GUID_equal( const GUID *a,
     }
     return TRUE;
 }
+
+char* GUID_sprintf(char *guid_str, REFGUID id) {
+    sprintf( guid_str,
+             "{%08X,%04X,%04X,%02X%02X%02X%02X%02X%02X%02X%02X}",
+             id->Data1,
+             id->Data2,
+             id->Data3,
+             id->Data4[0],
+             id->Data4[1],
+             id->Data4[2],
+             id->Data4[3],
+             id->Data4[4],
+             id->Data4[5],
+             id->Data4[6],
+             id->Data4[7]);
+    return guid_str;
+}
index 1f9ff009ad8c73304b078729152f1b2c64841c4b..af8f081bfb5eb01d044eacb1689d2c150a393fda 100644 (file)
@@ -33,4 +33,8 @@ boolean
 GUID_equal( const GUID *a,
             const GUID *b );
 
+char*
+GUID_sprintf( char *guid_str,
+              REFGUID id );
+
 #endif /* _NINE_GUID_H_ */
index 6d915338b24e86346828bb1d79f9b060fe1e9652..f3c26896aaf67fd0d553b3ac3990e90af75386ef 100644 (file)
@@ -34,7 +34,6 @@
 
 #define DBG_CHANNEL DBG_RESOURCE
 
-
 HRESULT
 NineResource9_ctor( struct NineResource9 *This,
                     struct NineUnknownParams *pParams,
@@ -117,9 +116,10 @@ NineResource9_SetPrivateData( struct NineResource9 *This,
     enum pipe_error err;
     struct pheader *header;
     const void *user_data = pData;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p pData=%p SizeOfData=%u Flags=%x\n",
-        This, refguid, pData, SizeOfData, Flags);
+    DBG("This=%p GUID=%s pData=%p SizeOfData=%u Flags=%x\n",
+        This, GUID_sprintf(guid_str, refguid), pData, SizeOfData, Flags);
 
     if (Flags & D3DSPD_IUNKNOWN)
         user_assert(SizeOfData == sizeof(IUnknown *), D3DERR_INVALIDCALL);
@@ -162,9 +162,10 @@ NineResource9_GetPrivateData( struct NineResource9 *This,
 {
     struct pheader *header;
     DWORD sizeofdata;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p pData=%p pSizeOfData=%p\n",
-        This, refguid, pData, pSizeOfData);
+    DBG("This=%p GUID=%s pData=%p pSizeOfData=%p\n",
+        This, GUID_sprintf(guid_str, refguid), pData, pSizeOfData);
 
     header = util_hash_table_get(This->pdata, refguid);
     if (!header) { return D3DERR_NOTFOUND; }
@@ -191,8 +192,9 @@ NineResource9_FreePrivateData( struct NineResource9 *This,
                                REFGUID refguid )
 {
     struct pheader *header;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p\n", This, refguid);
+    DBG("This=%p GUID=%s\n", This, GUID_sprintf(guid_str, refguid));
 
     header = util_hash_table_get(This->pdata, refguid);
     if (!header)