v3dv/debug: add v3dv_print_v3d_key

Useful to print which v3d keys were used for each variant.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Alejandro Piñeiro 2020-08-06 15:45:59 +02:00 committed by Marge Bot
parent ee605bdf3e
commit edec743e8d
2 changed files with 21 additions and 0 deletions

View file

@ -33,4 +33,7 @@
void
v3dv_print_spirv(const char *data, uint32_t size, FILE *fp);
void
v3dv_print_v3d_key(struct v3d_key *key, uint32_t v3d_key_size);
#endif

View file

@ -39,6 +39,24 @@
#include "broadcom/cle/v3dx_pack.h"
void
v3dv_print_v3d_key(struct v3d_key *key,
uint32_t v3d_key_size)
{
struct mesa_sha1 ctx;
unsigned char sha1[20];
char sha1buf[41];
_mesa_sha1_init(&ctx);
_mesa_sha1_update(&ctx, key, v3d_key_size);
_mesa_sha1_final(&ctx, sha1);
_mesa_sha1_format(sha1buf, sha1);
fprintf(stderr, "key %p: %s\n", key, sha1buf);
}
VkResult
v3dv_CreateShaderModule(VkDevice _device,
const VkShaderModuleCreateInfo *pCreateInfo,