1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-20 17:54:17 +01:00

added some debug options

This commit is contained in:
yours3lf 2020-06-18 19:07:01 +01:00
parent 79af38f711
commit 288969afbf
4 changed files with 71 additions and 8 deletions

View File

@ -596,7 +596,15 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
submitCl.shader_rec_count = marker->shaderRecCount;
submitCl.uniforms_size = marker->uniformsSize;
/**
#ifndef RPI_PRINT_COMMAND_LISTS
#define RPI_PRINT_COMMAND_LISTS 0
#endif
#ifndef RPI_PRINT_COMMAND_LISTS_ATTRIBS
#define RPI_PRINT_COMMAND_LISTS_ATTRIBS 1
#endif
#if RPI_PRINT_COMMAND_LISTS == 1
printf("BCL:\n");
uint8_t* mem = malloc(marker->size);
memcpy(mem, marker+1, marker->size);
@ -619,7 +627,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
for(int d = 0; d < marker->shaderRecCount; ++d)
{
printf("\nShader rec handle indices: ");
int numIndices = 3 + 1;
int numIndices = 3 + RPI_PRINT_COMMAND_LISTS_ATTRIBS;
for(int d = 0; d < numIndices; ++d)
{
printf("%u ", *ptr);
@ -705,7 +713,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
printf("clear s %u\n", submitCl.clear_s);
printf("flags %u\n", submitCl.flags);
printf("perfmonID %u\n", submitCl.perfmonid);
/**/
#endif
assert(marker->numDrawCallsSubmitted <= VC4_HW_2116_COUNT);

View File

@ -37,8 +37,18 @@
#include "vkCaps.h"
#define PROFILESTART(x)// startMeasure((x), (#x))
#define PROFILEEND(x)// endMeasure((x))
#ifndef RPI_PROFILE
#define RPI_PROFILE 0
#endif
#if RPI_PROFILE == 1
#define PROFILESTART(x) startMeasure((x), (#x))
#define PROFILEEND(x) endMeasure((x))
#else
#define PROFILESTART(x)
#define PROFILEEND(x)
#endif
/**
//scope

View File

@ -7,7 +7,9 @@ extern "C" {
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#define EXPOSE_DRIVER 0
#ifndef EXPOSE_DRIVER
#define EXPOSE_DRIVER 0
#endif
#if EXPOSE_DRIVER == 0
#define RPIFUNC(x) rpi_##x

View File

@ -366,14 +366,57 @@ VkResult RPIFUNC(vkCreateShaderModule)(VkDevice device, const VkShaderModuleCrea
shader->sizes[c] = ci->numInstructions[c]*sizeof(uint64_t);
/**
#ifndef RPI_DUMP_SHADER_INFO
#define RPI_DUMP_SHADER_INFO 0
#endif
#if RPI_DUMP_SHADER_INFO == 1
if(c == VK_RPI_ASSEMBLY_TYPE_VERTEX)
{
printf("\nShader Dump Vertex\n");
printf("shader->numVertUniformReads %u\n", shader->numVertUniformReads);
printf("shader->numVertVPMreads %u\n", shader->numVertVPMreads);
printf("shader->numVertVPMwrites %u\n", shader->numVertVPMwrites);
printf("shader->numVertCycles %u\n", shader->numVertCycles);
printf("shader->numVertALUcycles %u\n", shader->numVertALUcycles);
printf("shader->numEmptyVertALUinstructions %u\n", shader->numEmptyVertALUinstructions);
printf("shader->numVertBranches %u\n", shader->numVertBranches);
printf("shader->numVertSFUoperations %u\n", shader->numVertSFUoperations);
}
else if(c == VK_RPI_ASSEMBLY_TYPE_COORDINATE)
{
printf("\nShader Dump Coordinate\n");
printf("shader->numCoordUniformReads %u\n", shader->numCoordUniformReads);
printf("shader->numCoordVPMreads %u\n", shader->numCoordVPMreads);
printf("shader->numCoordVPMwrites %u\n", shader->numCoordVPMwrites);
printf("shader->numCoordCycles %u\n", shader->numCoordCycles);
printf("shader->numCoordALUcycles %u\n", shader->numCoordALUcycles);
printf("shader->numEmptyCoordALUinstructions %u\n", shader->numEmptyCoordALUinstructions);
printf("shader->numCoordBranches %u\n", shader->numCoordBranches);
}
else if(c == VK_RPI_ASSEMBLY_TYPE_FRAGMENT)
{
printf("\nShader Dump Fragment\n");
printf("shader->hasThreadSwitch %u\n", shader->hasThreadSwitch);
printf("shader->numTextureSamples %u\n", shader->numTextureSamples);
printf("shader->numVaryings %u\n", shader->numVaryings);
printf("shader->numFragUniformReads %u\n", shader->numFragUniformReads);
printf("shader->numFragCycles %u\n", shader->numFragCycles);
printf("shader->numFragALUcycles %u\n", shader->numFragALUcycles);
printf("shader->numEmptyFragALUinstructions %u\n", shader->numEmptyFragALUinstructions);
printf("shader->numFragBranches %u\n", shader->numFragBranches);
printf("shader->numFragSFUoperations %u\n", shader->numFragSFUoperations);
printf("shader->numCoordSFUoperations %u\n", shader->numCoordSFUoperations);
}
for(uint64_t e = 0; e < shader->sizes[c] / 8; ++e)
{
printf("%#llx ", ci->instructions[c][e]);
disassemble_qpu_asm(ci->instructions[c][e]);
}
printf("\n");
/**/
#endif
shader->bos[c] = vc4_bo_alloc_shader(controlFd, ci->instructions[c], &shader->sizes[c]);
assert(shader->bos[c]);