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

added profiler but it crashes for some reason

This commit is contained in:
yours3lf 2020-05-18 19:39:33 +01:00
parent 6c5b4a065b
commit b4b4e38354
21 changed files with 837 additions and 4 deletions

View File

@ -24,6 +24,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
const VkAllocationCallbacks* pAllocator,
VkCommandPool* pCommandPool)
{
PROFILESTART(rpi_vkCreateCommandPool);
assert(device);
assert(pCreateInfo);
@ -38,6 +40,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
if(!cp)
{
PROFILEEND(rpi_vkCreateCommandPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -64,6 +67,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
void* pamem = ALLOCATE(numCommandBufs * sizeof(_commandBuffer), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pamem)
{
PROFILEEND(rpi_vkCreateCommandPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
cp->pa = createPoolAllocator(pamem, sizeof(_commandBuffer), numCommandBufs * sizeof(_commandBuffer));
@ -71,6 +75,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
void* cpamem = ALLOCATE(consecutivePoolSize, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!cpamem)
{
PROFILEEND(rpi_vkCreateCommandPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
cp->cpa = createConsecutivePoolAllocator(cpamem, consecutiveBlockSize, consecutivePoolSize);
@ -78,6 +83,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
*pCommandPool = (VkCommandPool)cp;
PROFILEEND(rpi_vkCreateCommandPool);
return VK_SUCCESS;
}
@ -91,6 +97,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAllocateCommandBuffers(
const VkCommandBufferAllocateInfo* pAllocateInfo,
VkCommandBuffer* pCommandBuffers)
{
PROFILESTART(rpi_vkAllocateCommandBuffers);
assert(device);
assert(pAllocateInfo);
assert(pCommandBuffers);
@ -193,6 +201,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAllocateCommandBuffers(
}
}
PROFILEEND(rpi_vkAllocateCommandBuffers);
return res;
}
@ -203,6 +212,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBeginCommandBuffer(
VkCommandBuffer commandBuffer,
const VkCommandBufferBeginInfo* pBeginInfo)
{
PROFILESTART(rpi_vkBeginCommandBuffer);
assert(commandBuffer);
assert(pBeginInfo);
@ -225,6 +236,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBeginCommandBuffer(
rpi_vkResetCommandBuffer(commandBuffer, 0);
}
PROFILEEND(rpi_vkBeginCommandBuffer);
return VK_SUCCESS;
}
@ -237,10 +249,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBeginCommandBuffer(
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEndCommandBuffer(
VkCommandBuffer commandBuffer)
{
PROFILESTART(rpi_vkEndCommandBuffer);
assert(commandBuffer);
commandBuffer->state = CMDBUF_STATE_EXECUTABLE;
PROFILEEND(rpi_vkEndCommandBuffer);
return VK_SUCCESS;
}
@ -268,6 +283,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
const VkSubmitInfo* pSubmits,
VkFence fence)
{
PROFILESTART(rpi_vkQueueSubmit);
assert(queue);
//TODO this is incorrect
@ -662,6 +679,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
f->seqno = queue->lastEmitSeqno;
}
PROFILEEND(rpi_vkQueueSubmit);
return VK_SUCCESS;
}
@ -675,6 +693,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkFreeCommandBuffers(
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
PROFILESTART(rpi_vkFreeCommandBuffers);
assert(device);
assert(commandPool);
assert(pCommandBuffers);
@ -692,6 +712,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkFreeCommandBuffers(
poolFree(&cp->pa, pCommandBuffers[c]);
}
}
PROFILEEND(rpi_vkFreeCommandBuffers);
}
/*
@ -705,6 +727,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyCommandPool(
VkCommandPool commandPool,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyCommandPool);
assert(device);
_commandPool* cp = (_commandPool*)commandPool;
@ -717,6 +741,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyCommandPool(
destroyConsecutivePoolAllocator(&cp->cpa);
FREE(cp);
}
PROFILEEND(rpi_vkDestroyCommandPool);
}
/*
@ -727,6 +753,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkTrimCommandPool(
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags)
{
PROFILESTART(rpi_vkTrimCommandPool);
assert(device);
assert(commandPool);
@ -735,6 +763,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkTrimCommandPool(
//TODO trim cp's pool allocator and consecutive pool allocator
//by reallocating to just used size
//kinda silly, as if you need memory afterwards we need to reallocate again...
PROFILEEND(rpi_vkTrimCommandPool);
}
/*
@ -745,6 +775,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetCommandPool(
VkCommandPool commandPool,
VkCommandPoolResetFlags flags)
{
PROFILESTART(rpi_vkResetCommandPool);
assert(device);
assert(commandPool);
@ -776,6 +808,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetCommandPool(
//TODO secondary command buffers
//TODO reset flag --> free all pool resources
PROFILEEND(rpi_vkResetCommandPool);
}
/*
@ -785,6 +819,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetCommandBuffer(
VkCommandBuffer commandBuffer,
VkCommandBufferResetFlags flags)
{
PROFILESTART(rpi_vkResetCommandBuffer);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -847,6 +883,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetCommandBuffer(
commandBuffer->currRenderPass = 0;
commandBuffer->perfmonID = 0;
PROFILEEND(rpi_vkResetCommandBuffer);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdExecuteCommands(
@ -854,7 +892,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdExecuteCommands(
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
PROFILESTART(rpi_vkCmdExecuteCommands);
PROFILEEND(rpi_vkCmdExecuteCommands);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDeviceMask(

View File

@ -4,6 +4,8 @@
#include "brcm/cle/v3d_decoder.h"
#include "brcm/clif/clif_dump.h"
#include "declarations.h"
uint32_t getFormatBpp(VkFormat f)
{
switch(f)

View File

@ -37,6 +37,9 @@
#include "vkCaps.h"
#define PROFILESTART(x) startMeasure((x), (#x))
#define PROFILEEND(x) endMeasure((x))
/**
//scope
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND

View File

@ -951,6 +951,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyBufferToImage(
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
PROFILESTART(rpi_vkCmdCopyBufferToImage);
_commandBuffer* cmdBuf = commandBuffer;
_device* device = cmdBuf->dev;
_buffer* buf = srcBuffer;
@ -1076,6 +1078,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyBufferToImage(
}
img->layout = dstImageLayout;
PROFILEEND(rpi_vkCmdCopyBufferToImage);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
@ -1088,6 +1092,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
const VkImageBlit* pRegions,
VkFilter filter)
{
PROFILESTART(rpi_vkCmdBlitImage);
_commandBuffer* cmdBuf = commandBuffer;
_device* device = cmdBuf->dev;
_image* srcImg = srcImage;
@ -1236,6 +1242,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
rpi_vkDestroyRenderPass(device, offscreenRenderPass, 0);
rpi_vkDestroyFramebuffer(device, offscreenFramebuffer, 0);
}
PROFILEEND(rpi_vkCmdBlitImage);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdResolveImage(
@ -1247,7 +1255,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdResolveImage(
uint32_t regionCount,
const VkImageResolve* pRegions)
{
PROFILESTART(rpi_vkCmdResolveImage);
//TODO
PROFILEEND(rpi_vkCmdResolveImage);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyImageToBuffer(
@ -1258,7 +1268,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyImageToBuffer(
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
PROFILESTART(rpi_vkCmdCopyImageToBuffer);
//TODO
PROFILEEND(rpi_vkCmdCopyImageToBuffer);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyImage(
@ -1270,7 +1282,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyImage(
uint32_t regionCount,
const VkImageCopy* pRegions)
{
PROFILESTART(rpi_vkCmdCopyImage);
rpi_vkCmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, VK_FILTER_NEAREST);
PROFILEEND(rpi_vkCmdCopyImage);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyBuffer(
@ -1280,5 +1294,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyBuffer(
uint32_t regionCount,
const VkBufferCopy* pRegions)
{
PROFILESTART(rpi_vkCmdCopyBuffer);
//TODO
PROFILEEND(rpi_vkCmdCopyImage);
}

View File

@ -6,6 +6,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
const VkAllocationCallbacks* pAllocator,
VkDescriptorPool* pDescriptorPool)
{
PROFILESTART(rpi_vkCreateDescriptorPool);
assert(device);
assert(pCreateInfo);
@ -13,6 +15,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
if(!dp)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -48,6 +51,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
void* dsmem = ALLOCATE(sizeof(_descriptorSet)*pCreateInfo->maxSets, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!dsmem)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -59,6 +63,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
void* memem = ALLOCATE(mapBufSize, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!memem)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
dp->mapElementCPA = createConsecutivePoolAllocator(memem, mapElemBlockSize, mapBufSize);
@ -69,6 +74,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
void* mem = ALLOCATE(blockSize*imageDescriptorCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!mem)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
dp->imageDescriptorCPA = createConsecutivePoolAllocator(mem, blockSize, blockSize * imageDescriptorCount);
@ -80,6 +86,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
void* mem = ALLOCATE(blockSize*bufferDescriptorCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!mem)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
dp->bufferDescriptorCPA = createConsecutivePoolAllocator(mem, blockSize, blockSize * bufferDescriptorCount);
@ -91,6 +98,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
void* mem = ALLOCATE(blockSize*texelBufferDescriptorCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!mem)
{
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
dp->texelBufferDescriptorCPA = createConsecutivePoolAllocator(mem, blockSize, blockSize * texelBufferDescriptorCount);
@ -98,6 +106,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
*pDescriptorPool = dp;
PROFILEEND(rpi_vkCreateDescriptorPool);
return VK_SUCCESS;
}
@ -106,6 +115,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAllocateDescriptorSets(
const VkDescriptorSetAllocateInfo* pAllocateInfo,
VkDescriptorSet* pDescriptorSets)
{
PROFILESTART(rpi_vkAllocateDescriptorSets);
assert(device);
_descriptorPool* dp = pAllocateInfo->descriptorPool;
@ -210,6 +221,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAllocateDescriptorSets(
}
}
PROFILEEND(rpi_vkAllocateDescriptorSets);
return VK_SUCCESS;
}
@ -219,6 +231,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorSetLayout(
const VkAllocationCallbacks* pAllocator,
VkDescriptorSetLayout* pSetLayout)
{
PROFILESTART(rpi_vkCreateDescriptorSetLayout);
assert(device);
assert(pCreateInfo);
@ -228,6 +242,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorSetLayout(
if(!dsl)
{
PROFILEEND(rpi_vkCreateDescriptorSetLayout);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -235,6 +250,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorSetLayout(
if(!dsl->bindings)
{
PROFILEEND(rpi_vkCreateDescriptorSetLayout);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -245,6 +261,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorSetLayout(
*pSetLayout = dsl;
PROFILEEND(rpi_vkCreateDescriptorSetLayout);
return VK_SUCCESS;
}
@ -255,6 +272,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkUpdateDescriptorSets(
uint32_t descriptorCopyCount,
const VkCopyDescriptorSet* pDescriptorCopies)
{
PROFILESTART(rpi_vkUpdateDescriptorSets);
assert(device);
for(uint32_t c = 0; c < descriptorWriteCount; ++c)
@ -340,6 +359,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkUpdateDescriptorSets(
memcpy(ddtb, sdtb, sizeof(_descriptorTexelBuffer) * pDescriptorCopies[c].descriptorCount);
}
}
PROFILEEND(rpi_vkUpdateDescriptorSets);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetDescriptorPool(
@ -347,7 +368,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetDescriptorPool(
VkDescriptorPool descriptorPool,
VkDescriptorPoolResetFlags flags)
{
PROFILESTART(rpi_vkResetDescriptorPool);
//TODO
PROFILEEND(rpi_vkResetDescriptorPool);
return VK_SUCCESS;
}
@ -356,6 +379,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorPool(
VkDescriptorPool descriptorPool,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyDescriptorPool);
assert(device);
assert(descriptorPool);
@ -368,6 +393,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorPool(
FREE(dp->bufferDescriptorCPA.buf);
FREE(dp);
PROFILEEND(rpi_vkDestroyDescriptorPool);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindDescriptorSets(
@ -380,6 +407,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindDescriptorSets(
uint32_t dynamicOffsetCount,
const uint32_t* pDynamicOffsets)
{
PROFILESTART(rpi_vkCmdBindDescriptorSets);
//TODO dynamic offsets
assert(commandBuffer);
@ -399,6 +428,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindDescriptorSets(
}
cb->descriptorSetDirty = 1;
PROFILEEND(rpi_vkCmdBindDescriptorSets);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorSetLayout(
@ -406,6 +437,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorSetLayout(
VkDescriptorSetLayout descriptorSetLayout,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyDescriptorSetLayout);
assert(device);
assert(descriptorSetLayout);
@ -414,6 +447,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorSetLayout(
FREE(dsl->bindings);
FREE(dsl);
PROFILEEND(rpi_vkDestroyDescriptorSetLayout);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFreeDescriptorSets(
@ -422,6 +457,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFreeDescriptorSets(
uint32_t descriptorSetCount,
const VkDescriptorSet* pDescriptorSets)
{
PROFILESTART(rpi_vkFreeDescriptorSets);
assert(device);
assert(descriptorPool);
@ -453,6 +490,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFreeDescriptorSets(
poolFree(&dp->descriptorSetPA, ds);
}
PROFILEEND(rpi_vkFreeDescriptorSets);
return VK_SUCCESS;
}
@ -463,7 +501,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorUpdateTemplate(
const VkAllocationCallbacks* pAllocator,
VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
PROFILESTART(rpi_vkCreateDescriptorUpdateTemplate);
//TODO
PROFILEEND(rpi_vkCreateDescriptorUpdateTemplate);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorUpdateTemplate(
@ -471,7 +511,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorUpdateTemplate(
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyDescriptorUpdateTemplate);
//TODO
PROFILEEND(rpi_vkDestroyDescriptorUpdateTemplate);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkUpdateDescriptorSetWithTemplate(
@ -480,7 +522,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkUpdateDescriptorSetWithTemplate(
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const void* pData)
{
PROFILESTART(rpi_vkUpdateDescriptorSetWithTemplate);
//TODO
PROFILEEND(rpi_vkUpdateDescriptorSetWithTemplate);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetDescriptorSetLayoutSupport(
@ -488,5 +532,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDescriptorSetLayoutSupport(
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
VkDescriptorSetLayoutSupport* pSupport)
{
PROFILESTART(rpi_vkGetDescriptorSetLayoutSupport);
//TODO
PROFILEEND(rpi_vkGetDescriptorSetLayoutSupport);
}

View File

@ -15,6 +15,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDevices(
uint32_t* pPhysicalDeviceCount,
VkPhysicalDevice* pPhysicalDevices)
{
PROFILESTART(rpi_vkEnumeratePhysicalDevices);
assert(instance);
int numGPUs = 1;
@ -24,6 +26,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDevices(
if(!pPhysicalDevices)
{
*pPhysicalDeviceCount = numGPUs;
PROFILEEND(rpi_vkEnumeratePhysicalDevices);
return VK_SUCCESS;
}
@ -39,10 +42,12 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDevices(
if(arraySize < numGPUs)
{
PROFILEEND(rpi_vkEnumeratePhysicalDevices);
return VK_INCOMPLETE;
}
else
{
PROFILEEND(rpi_vkEnumeratePhysicalDevices);
return VK_SUCCESS;
}
}
@ -54,6 +59,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceProperties);
assert(physicalDevice);
assert(pProperties);
@ -74,6 +81,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceProperties(
strcpy(pProperties->deviceName, "VideoCore IV HW");
pProperties->limits = _limits;
pProperties->sparseProperties = sparseProps;
PROFILEEND(rpi_vkGetPhysicalDeviceProperties);
}
/*
@ -83,10 +92,14 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFeatures(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures* pFeatures)
{
PROFILESTART(rpi_vkGetPhysicalDeviceFeatures);
assert(physicalDevice);
assert(pFeatures);
*pFeatures = _features;
PROFILEEND(rpi_vkGetPhysicalDeviceFeatures);
}
/*
@ -98,12 +111,15 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceExtensionProperties(
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
PROFILESTART(rpi_vkEnumerateDeviceExtensionProperties);
assert(physicalDevice);
assert(pPropertyCount);
if(!pProperties)
{
*pPropertyCount = numDeviceExtensions;
PROFILEEND(rpi_vkEnumerateDeviceExtensionProperties);
return VK_SUCCESS;
}
@ -119,9 +135,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceExtensionProperties(
if(arraySize < numDeviceExtensions)
{
PROFILEEND(rpi_vkEnumerateDeviceExtensionProperties);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkEnumerateDeviceExtensionProperties);
return VK_SUCCESS;
}
@ -137,12 +155,15 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties(
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceQueueFamilyProperties);
assert(physicalDevice);
assert(pQueueFamilyPropertyCount);
if(!pQueueFamilyProperties)
{
*pQueueFamilyPropertyCount = 1;
PROFILEEND(rpi_vkGetPhysicalDeviceQueueFamilyProperties);
return;
}
@ -155,6 +176,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties(
}
*pQueueFamilyPropertyCount = elementsWritten;
PROFILEEND(rpi_vkGetPhysicalDeviceQueueFamilyProperties);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
@ -164,12 +187,15 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDeviceQueueFamilyPerforman
VkPerformanceCounterKHR* pCounters,
VkPerformanceCounterDescriptionKHR* pCounterDescriptions)
{
PROFILESTART(rpi_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR);
assert(physicalDevice);
assert(pCounterCount);
if(!pCounters && !pCounterDescriptions)
{
*pCounterCount = numPerformanceCounterTypes;
PROFILEEND(rpi_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR);
return VK_SUCCESS;
}
@ -186,9 +212,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDeviceQueueFamilyPerforman
if(arraySize < numPerformanceCounterTypes)
{
PROFILEEND(rpi_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR);
return VK_SUCCESS;
}
@ -197,11 +225,15 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPas
const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo,
uint32_t* pNumPasses)
{
PROFILESTART(rpi_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR);
assert(physicalDevice);
assert(pPerformanceQueryCreateInfo);
assert(pNumPasses);
*pNumPasses = pPerformanceQueryCreateInfo->counterIndexCount / DRM_VC4_MAX_PERF_COUNTERS + 1;
PROFILEEND(rpi_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR);
}
/*
@ -221,6 +253,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice)
{
PROFILESTART(rpi_vkCreateDevice);
assert(physicalDevice);
assert(pDevice);
assert(pCreateInfo);
@ -231,6 +265,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
int findres = findDeviceExtension(pCreateInfo->ppEnabledExtensionNames[c]);
if(findres == -1)
{
PROFILEEND(rpi_vkCreateDevice);
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
}
@ -245,6 +280,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
{
if(requestedFeatures[c] && !supportedFeatures[c])
{
PROFILEEND(rpi_vkCreateDevice);
return VK_ERROR_FEATURE_NOT_PRESENT;
}
}
@ -253,6 +289,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
*pDevice = ALLOCATE(sizeof(_device), 1, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if(!*pDevice)
{
PROFILEEND(rpi_vkCreateDevice);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -278,6 +315,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
{
if(requestedFeatures[c] && !supportedFeatures[c])
{
PROFILEEND(rpi_vkCreateDevice);
return VK_ERROR_FEATURE_NOT_PRESENT;
}
}
@ -305,6 +343,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
if(!(*pDevice)->queues[pCreateInfo->pQueueCreateInfos[c].queueFamilyIndex])
{
PROFILEEND(rpi_vkCreateDevice);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -322,6 +361,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
setupEmulationResources(*pDevice);
setupClearEmulationResources(*pDevice);
PROFILEEND(rpi_vkCreateDevice);
return VK_SUCCESS;
}
@ -336,6 +376,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue(
uint32_t queueIndex,
VkQueue* pQueue)
{
PROFILESTART(rpi_vkGetDeviceQueue);
assert(device);
assert(pQueue);
@ -343,6 +385,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue(
assert(queueIndex < device->numQueues[queueFamilyIndex]);
*pQueue = &device->queues[queueFamilyIndex][queueIndex];
PROFILEEND(rpi_vkGetDeviceQueue);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue2(
@ -350,6 +394,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue2(
const VkDeviceQueueInfo2* pQueueInfo,
VkQueue* pQueue)
{
PROFILESTART(rpi_vkGetDeviceQueue2);
assert(device);
assert(pQueueInfo);
assert(pQueue);
@ -357,6 +403,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetDeviceQueue2(
//TODO handle pNext
rpi_vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue);
PROFILEEND(rpi_vkGetDeviceQueue2);
}
/*
@ -369,6 +417,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDevice(
VkDevice device,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyDevice);
_device* dev = device;
if(dev)
@ -382,6 +432,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDevice(
}
FREE(dev);
}
PROFILEEND(rpi_vkDestroyDevice);
}
/*
@ -392,12 +444,15 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDeviceGroups(
uint32_t* pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
{
PROFILESTART(rpi_vkEnumeratePhysicalDeviceGroups);
assert(instance);
assert(pPhysicalDeviceGroupCount);
if(!pPhysicalDeviceGroupProperties)
{
*pPhysicalDeviceGroupCount = 1;
PROFILEEND(rpi_vkEnumeratePhysicalDeviceGroups);
return VK_SUCCESS;
}
@ -414,9 +469,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumeratePhysicalDeviceGroups(
if(c < 1)
{
PROFILEEND(rpi_vkEnumeratePhysicalDeviceGroups);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkEnumeratePhysicalDeviceGroups);
return VK_SUCCESS;
}
@ -427,6 +484,8 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetDeviceProcAddr(
VkDevice device,
const char* pName)
{
PROFILESTART(rpi_vkGetDeviceProcAddr);
if(
!strcmp("vkDestroyInstance", pName) ||
!strcmp("vkEnumeratePhysicalDevices", pName) ||
@ -453,19 +512,24 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetDeviceProcAddr(
!strcmp("vkGetPhysicalDeviceExternalSemaphoreProperties", pName)
)
{
PROFILEEND(rpi_vkGetDeviceProcAddr);
return 0;
}
//there can't be any other device, so this will do fine...
_device* d = device;
return rpi_vkGetInstanceProcAddr(d->dev->instance, pName);
PFN_vkVoidFunction retval = rpi_vkGetInstanceProcAddr(d->dev->instance, pName);
PROFILEEND(rpi_vkGetDeviceProcAddr);
return retval;
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceProperties2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2* pProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceProperties2);
assert(physicalDevice);
assert(pProperties);
rpi_vkGetPhysicalDeviceProperties(physicalDevice, &pProperties->properties);
@ -487,6 +551,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceProperties2(
ptr->conformanceVersion.patch = 1;
}
}
PROFILEEND(rpi_vkGetPhysicalDeviceProperties2);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties(
@ -494,6 +560,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties(
VkFormat format,
VkFormatProperties* pFormatProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceFormatProperties);
assert(physicalDevice);
assert(pFormatProperties);
@ -611,6 +679,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties(
pFormatProperties->bufferFeatures = 0;
break;
}
PROFILEEND(rpi_vkGetPhysicalDeviceFormatProperties);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties2(
@ -618,9 +688,13 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFormatProperties2(
VkFormat format,
VkFormatProperties2* pFormatProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceFormatProperties2);
assert(physicalDevice);
assert(pFormatProperties);
rpi_vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties);
PROFILEEND(rpi_vkGetPhysicalDeviceFormatProperties2);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties(
@ -632,6 +706,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties(
VkImageCreateFlags flags,
VkImageFormatProperties* pImageFormatProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceImageFormatProperties);
assert(physicalDevice);
assert(pImageFormatProperties);
@ -686,6 +762,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties(
if(!supported)
{
PROFILEEND(rpi_vkGetPhysicalDeviceImageFormatProperties);
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
@ -741,6 +818,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties(
//2^31
pImageFormatProperties->maxResourceSize = 1<<31;
PROFILEEND(rpi_vkGetPhysicalDeviceImageFormatProperties);
return VK_SUCCESS;
}
@ -749,19 +827,23 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceImageFormatProperties2(
const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceImageFormatProperties2);
assert(physicalDevice);
assert(pImageFormatProperties);
assert(pImageFormatInfo);
//TODO handle pNext
return rpi_vkGetPhysicalDeviceImageFormatProperties(physicalDevice,
VkResult retval = rpi_vkGetPhysicalDeviceImageFormatProperties(physicalDevice,
pImageFormatInfo->format,
pImageFormatInfo->type,
pImageFormatInfo->tiling,
pImageFormatInfo->usage,
pImageFormatInfo->flags,
&pImageFormatProperties->imageFormatProperties);
PROFILEEND(rpi_vkGetPhysicalDeviceImageFormatProperties2);
return retval;
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceLayerProperties(
@ -769,17 +851,25 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceLayerProperties(
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
{
PROFILESTART(rpi_vkEnumerateDeviceLayerProperties);
//deprecated, just return instance layers
return rpi_vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties);
VkResult retval = rpi_vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties);
PROFILEEND(rpi_vkEnumerateDeviceLayerProperties);
return retval;
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceFeatures2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2* pFeatures)
{
PROFILESTART(rpi_vkGetPhysicalDeviceFeatures2);
assert(physicalDevice);
assert(pFeatures);
rpi_vkGetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
PROFILEEND(rpi_vkGetPhysicalDeviceFeatures2);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties2(
@ -787,6 +877,10 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetPhysicalDeviceQueueFamilyProperties2(
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties2* pQueueFamilyProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceQueueFamilyProperties2);
assert(physicalDevice);
rpi_vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
PROFILEEND(rpi_vkGetPhysicalDeviceQueueFamilyProperties2);
}

View File

@ -557,6 +557,8 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
*/
void rpi_vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
{
PROFILESTART(rpi_vkCmdDraw);
assert(commandBuffer);
if(instanceCount != 1 || firstInstance != 0)
@ -576,6 +578,8 @@ void rpi_vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t
cb->numDrawCallsSubmitted++;
assert(((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->memGuard == 0xDDDDDDDD);
PROFILEEND(rpi_vkCmdDraw);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndexed(
@ -586,6 +590,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndexed(
int32_t vertexOffset,
uint32_t firstInstance)
{
PROFILESTART(rpi_vkCmdDrawIndexed);
assert(commandBuffer);
if(instanceCount != 1 || firstInstance != 0)
@ -622,6 +628,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndexed(
cb->numDrawCallsSubmitted++;
assert(((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->memGuard == 0xDDDDDDDD);
PROFILEEND(rpi_vkCmdDrawIndexed);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdDrawIndexedIndirect(

View File

@ -59,11 +59,14 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceExtensionProperties(
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
PROFILESTART(rpi_vkEnumerateInstanceExtensionProperties);
assert(pPropertyCount);
if(!pProperties)
{
*pPropertyCount = numInstanceExtensions;
PROFILEEND(rpi_vkEnumerateInstanceExtensionProperties);
return VK_SUCCESS;
}
@ -79,10 +82,12 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceExtensionProperties(
if(arraySize < numInstanceExtensions)
{
PROFILEEND(rpi_vkEnumerateInstanceExtensionProperties);
return VK_INCOMPLETE;
}
else
{
PROFILEEND(rpi_vkEnumerateInstanceExtensionProperties);
return VK_SUCCESS;
}
}
@ -100,6 +105,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
const VkAllocationCallbacks* pAllocator,
VkInstance* pInstance)
{
PROFILESTART(rpi_vkCreateInstance);
assert(pInstance);
assert(pCreateInfo);
@ -107,6 +114,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
if(!*pInstance)
{
PROFILEEND(rpi_vkCreateInstance);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -131,6 +139,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
{
FREE(*pInstance);
*pInstance = 0;
PROFILEEND(rpi_vkCreateInstance);
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
}
@ -143,6 +152,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
if(!f)
{
PROFILEEND(rpi_vkCreateInstance);
return VK_ERROR_INITIALIZATION_FAILED;
}
@ -160,6 +170,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
strcmp(hw, "BCM2836") &&
strcmp(hw, "BCM2837"))
{
PROFILEEND(rpi_vkCreateInstance);
return VK_ERROR_INITIALIZATION_FAILED;
}
@ -235,6 +246,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
assert((*pInstance)->hasThreadedFs);
assert((*pInstance)->hasPerfmon);
PROFILEEND(rpi_vkCreateInstance);
return VK_SUCCESS;
}
@ -246,12 +258,14 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyInstance(
VkInstance instance,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyInstance);
if(instance)
{
closeIoctl();
FREE(instance);
}
PROFILEEND(rpi_vkDestroyInstance);
}
/*
@ -260,8 +274,10 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyInstance(
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceVersion(
uint32_t* pApiVersion)
{
PROFILESTART(rpi_vkEnumerateInstanceVersion);
assert(pApiVersion);
*pApiVersion = VK_DRIVER_VERSION; //
PROFILEEND(rpi_vkEnumerateInstanceVersion);
return VK_SUCCESS;
}
@ -272,6 +288,8 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetInstanceProcAddr(
VkInstance instance,
const char* pName)
{
PROFILESTART(rpi_vkGetInstanceProcAddr);
if(!instance && !(
!strcmp(pName, "vkEnumerateInstanceVersion") ||
!strcmp(pName, "vkEnumerateInstanceExtensionProperties") ||
@ -279,9 +297,12 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetInstanceProcAddr(
!strcmp(pName, "vkCreateInstance")
))
{
PROFILEEND(rpi_vkGetInstanceProcAddr);
return 0;
}
PROFILEEND(rpi_vkGetInstanceProcAddr);
RETFUNC(vkCreateInstance);
RETFUNC(vkEnumerateInstanceVersion);
RETFUNC(vkDestroyInstance);
@ -480,5 +501,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceLayerProperties(
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
{
PROFILESTART(rpi_vkEnumerateInstanceLayerProperties);
PROFILEEND(rpi_vkEnumerateInstanceLayerProperties);
return VK_SUCCESS;
}

View File

@ -7,6 +7,8 @@
*/
void rpi_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceMemoryProperties);
assert(physicalDevice);
assert(pMemoryProperties);
@ -54,6 +56,8 @@ void rpi_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, Vk
{
pMemoryProperties->memoryHeaps[c] = memoryHeaps[c];
}
PROFILEEND(rpi_vkGetPhysicalDeviceMemoryProperties);
}
/*
@ -61,6 +65,8 @@ void rpi_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, Vk
*/
VkResult rpi_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
{
PROFILESTART(rpi_vkAllocateMemory);
assert(device);
assert(pAllocateInfo);
assert(pMemory);
@ -68,12 +74,14 @@ VkResult rpi_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllo
uint32_t bo = vc4_bo_alloc(controlFd, pAllocateInfo->allocationSize, "vkAllocateMemory");
if(!bo)
{
PROFILEEND(rpi_vkAllocateMemory);
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
_deviceMemory* mem = ALLOCATE(sizeof(_deviceMemory), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!mem)
{
PROFILEEND(rpi_vkAllocateMemory);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -86,6 +94,7 @@ VkResult rpi_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllo
//TODO max number of allocations
PROFILEEND(rpi_vkAllocateMemory);
return VK_SUCCESS;
}
@ -94,6 +103,8 @@ VkResult rpi_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllo
*/
VkResult rpi_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData)
{
PROFILESTART(rpi_vkMapMemory);
assert(device);
assert(memory);
assert(size);
@ -117,6 +128,7 @@ VkResult rpi_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize of
void* ptr = vc4_bo_map(controlFd, ((_deviceMemory*)memory)->bo, offset, size);
if(!ptr)
{
PROFILEEND(rpi_vkMapMemory);
return VK_ERROR_MEMORY_MAP_FAILED;
}
@ -125,6 +137,7 @@ VkResult rpi_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize of
((_deviceMemory*)memory)->mappedSize = size;
*ppData = ptr;
PROFILEEND(rpi_vkMapMemory);
return VK_SUCCESS;
}
@ -133,6 +146,8 @@ VkResult rpi_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize of
*/
void rpi_vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
{
PROFILESTART(rpi_vkUnmapMemory);
assert(device);
assert(memory);
@ -140,10 +155,14 @@ void rpi_vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
((_deviceMemory*)memory)->mappedPtr = 0;
((_deviceMemory*)memory)->mappedSize = 0;
((_deviceMemory*)memory)->mappedOffset = 0;
PROFILEEND(rpi_vkUnmapMemory);
}
void rpi_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkFreeMemory);
assert(device);
_deviceMemory* mem = memory;
@ -152,6 +171,8 @@ void rpi_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocation
vc4_bo_free(controlFd, mem->bo, mem->mappedPtr, mem->size);
FREE(mem);
}
PROFILEEND(rpi_vkFreeMemory);
}
/*
@ -162,8 +183,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFlushMappedMemoryRanges(
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges)
{
PROFILESTART(rpi_vkFlushMappedMemoryRanges);
//TODO
PROFILEEND(rpi_vkFlushMappedMemoryRanges);
return VK_SUCCESS;
}

View File

@ -288,6 +288,8 @@ void modeset_present(int fd, _image *buf, modeset_display_surface* surface)
void modeset_destroy_surface(int fd, modeset_display_surface *surface)
{
return;
//restore old state
drmModeSetCrtc(fd, modeset_saved_states[surface->savedState].crtc->crtc_id,
modeset_saved_states[surface->savedState].crtc->buffer_id,

View File

@ -8,6 +8,8 @@
*/
void rpi_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
{
PROFILESTART(rpi_vkCmdBindPipeline);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -19,6 +21,8 @@ void rpi_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pi
{
cb->computePipeline = pipeline;
}
PROFILEEND(rpi_vkCmdBindPipeline);
}
//multiple attachments
@ -174,6 +178,8 @@ void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, co
*/
VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
{
PROFILESTART(rpi_vkCreateGraphicsPipelines);
assert(device);
assert(createInfoCount > 0);
assert(pCreateInfos);
@ -192,6 +198,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
_pipeline* pip = ALLOCATE(sizeof(_pipeline), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -208,6 +215,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->names[idx] = ALLOCATE(strlen(pCreateInfos[c].pStages[d].pName)+1, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->names[idx])
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -257,6 +265,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->vertexAttributeDescriptions = ALLOCATE(sizeof(VkVertexInputAttributeDescription) * pip->vertexAttributeDescriptionCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->vertexAttributeDescriptions)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -266,6 +275,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->vertexBindingDescriptions = ALLOCATE(sizeof(VkVertexInputBindingDescription) * pip->vertexBindingDescriptionCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->vertexBindingDescriptions)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -333,6 +343,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->viewports = ALLOCATE(sizeof(VkViewport) * pip->viewportCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->viewports)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -346,6 +357,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
if(!pip->scissors)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -425,6 +437,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->attachmentBlendStates = ALLOCATE(sizeof(VkPipelineColorBlendAttachmentState) * pip->attachmentCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->attachmentBlendStates)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -441,6 +454,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pip->dynamicStates = ALLOCATE(sizeof(VkDynamicState)*pip->dynamicStateCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip->dynamicStates)
{
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -461,11 +475,14 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
pPipelines[c] = pip;
}
PROFILEEND(rpi_vkCreateGraphicsPipelines);
return VK_SUCCESS;
}
void rpi_vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyPipeline);
assert(device);
_pipeline* pip = pipeline;
@ -485,6 +502,8 @@ void rpi_vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocat
}
FREE(pip);
}
PROFILEEND(rpi_vkDestroyPipeline);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkMergePipelineCaches(
@ -521,6 +540,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout(
const VkAllocationCallbacks* pAllocator,
VkPipelineLayout* pPipelineLayout)
{
PROFILESTART(rpi_vkCreatePipelineLayout);
assert(device);
assert(pCreateInfo);
assert(pPipelineLayout);
@ -529,6 +550,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout(
if(!pl)
{
PROFILEEND(rpi_vkCreatePipelineLayout);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -540,6 +562,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout(
pl->setLayouts = ALLOCATE(sizeof(VkDescriptorSetLayout)*pCreateInfo->setLayoutCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pl->setLayouts)
{
PROFILEEND(rpi_vkCreatePipelineLayout);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -551,6 +574,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout(
pl->pushConstantRanges = ALLOCATE(sizeof(VkPushConstantRange)*pCreateInfo->pushConstantRangeCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pl->pushConstantRanges)
{
PROFILEEND(rpi_vkCreatePipelineLayout);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -561,6 +585,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineLayout(
*pPipelineLayout = pl;
PROFILEEND(rpi_vkCreatePipelineLayout);
return VK_SUCCESS;
}
@ -569,6 +594,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyPipelineLayout(
VkPipelineLayout pipelineLayout,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyPipelineLayout);
assert(device);
assert(pipelineLayout);
@ -579,6 +606,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyPipelineLayout(
FREE(pl->setLayouts);
FREE(pl);
PROFILEEND(rpi_vkDestroyPipelineLayout);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineCache(

161
driver/profiler.c Normal file
View File

@ -0,0 +1,161 @@
#include "profiler.h"
#include <stdlib.h>
#include <string.h>
#include <stdatomic.h>
static profiler* globalProfiler = 0;
static atomic_int globalProfilerGuard = 0;
void initProfiler()
{
if(!globalProfiler)
{
while(globalProfilerGuard);
{
globalProfilerGuard = 1;
globalProfiler = (profiler*)malloc(sizeof(profiler));
globalProfiler->funcDatabase = createMap(malloc(sizeof(mapElem) * MAX_FUNCTIONS), MAX_FUNCTIONS);
globalProfilerGuard = 0;
}
}
}
void startMeasure(void* func, const char* funcName)
{
initProfiler();
while(globalProfilerGuard);
{
globalProfilerGuard = 1;
assert(globalProfiler);
assert(func);
assert(funcName);
funcData* data = getMapElement(globalProfiler->funcDatabase, func);
if(!data)
{
data = malloc(sizeof(funcData));
unsigned len = strlen(funcName)+1;
data->funcName = malloc(len);
memcpy(data->funcName, funcName, len);
data->timeSpent = 0.0;
data->inProgress = 0;
data->start.tv_nsec = 0;
data->start.tv_sec = 0;
setMapElement(&globalProfiler->funcDatabase, func, data);
}
assert(!data->inProgress);
data->inProgress = 1;
clock_gettime(CLOCK_REALTIME, &data->start);
globalProfilerGuard = 0;
}
}
void endMeasure(void* func)
{
struct timespec end;
clock_gettime(CLOCK_REALTIME, &end);
while(globalProfilerGuard);
{
globalProfilerGuard = 1;
assert(globalProfiler);
assert(func);
funcData* data = getMapElement(globalProfiler->funcDatabase, func);
assert(data);
assert(data->inProgress);
data->inProgress = 0;
data->timeSpent = (end.tv_nsec - data->start.tv_nsec) / MILLION;
globalProfilerGuard = 0;
}
}
double getTimeSpent(void* func)
{
assert(globalProfiler);
assert(func);
funcData* data = getMapElement(globalProfiler->funcDatabase, func);
if(!data)
{
return 0;
}
return data->timeSpent;
}
void profilePrintResults()
{
assert(globalProfiler);
funcData profileResults[MAX_FUNCTIONS];
memset(profileResults, 0, sizeof(profileResults));
int32_t numFunctions = 0;
//insertion sort, linear search
for(int32_t c = 0; c < globalProfiler->funcDatabase.maxData; ++c)
{
if(!globalProfiler->funcDatabase.elements[c].data)
{
continue;
}
funcData* data = globalProfiler->funcDatabase.elements[c].data;
for(int32_t d = 0; d < MAX_FUNCTIONS; ++d)
{
if(!profileResults[d].funcName)
{
//empty slot, just insert here
memcpy(&profileResults[d], data, sizeof(funcData));
numFunctions++;
break;
}
else
{
if(profileResults[d].timeSpent > data->timeSpent)
{
//found a function with more time spent, so we need to insert before it
//need to insert before d
//move all functions up one
for(int32_t e = numFunctions - 1; e >= d; e--)
{
memcpy(&profileResults[e+1], &profileResults[e], sizeof(funcData));
}
//insert in place of the function with more time spent
memcpy(&profileResults[d], data, sizeof(funcData));
numFunctions++;
break;
}
}
}
}
//print most time spent first
fprintf(stderr, "Num functions touched: %u\n", numFunctions);
uint32_t counter = 0;
for(int32_t c = numFunctions - 1; c >= 0; --c)
{
fprintf(stderr, "#%u %-30s: %lf ms\n", ++counter, profileResults[c].funcName, profileResults[c].timeSpent);
if(counter >= 10)
{
//break;
}
}
}

33
driver/profiler.h Normal file
View File

@ -0,0 +1,33 @@
#define _POSIX_C_SOURCE 199309L
#include <time.h>
#include <unistd.h>
#include "map.h"
#define MILLION 1000000.0
#define MAX_FUNCTIONS 8192
typedef struct
{
map funcDatabase;
} profiler;
typedef struct
{
char* funcName; //stores function name
double timeSpent; //stores time spent in function in milliseconds
struct timespec start; //for timekeeping
uint32_t inProgress;
} funcData;
void initProfiler();
void startMeasure(void* func, const char* funcName);
void endMeasure(void* func);
double getTimeSpent(void* func);
void profilePrintResults();

View File

@ -7,14 +7,18 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAcquireProfilingLockKHR(
VkDevice device,
const VkAcquireProfilingLockInfoKHR* pInfo)
{
PROFILESTART(rpi_vkAcquireProfilingLockKHR);
//TODO
PROFILEEND(rpi_vkAcquireProfilingLockKHR);
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL rpi_vkReleaseProfilingLockKHR(
VkDevice device)
{
PROFILESTART(rpi_vkReleaseProfilingLockKHR);
//TODO
PROFILEEND(rpi_vkReleaseProfilingLockKHR);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateQueryPool(
@ -23,6 +27,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateQueryPool(
const VkAllocationCallbacks* pAllocator,
VkQueryPool* pQueryPool)
{
PROFILESTART(rpi_vkCreateQueryPool);
assert(device);
assert(pQueryPool);
@ -64,6 +70,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateQueryPool(
*pQueryPool = qp;
}
PROFILEEND(rpi_vkCreateQueryPool);
return VK_SUCCESS;
}
@ -73,7 +80,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdResetQueryPool(
uint32_t firstQuery,
uint32_t queryCount)
{
PROFILESTART(rpi_vkCmdResetQueryPool);
//TODO
PROFILEEND(rpi_vkCmdResetQueryPool);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyQueryPool(
@ -81,6 +90,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyQueryPool(
VkQueryPool queryPool,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyQueryPool);
assert(device);
assert(queryPool);
@ -95,6 +106,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyQueryPool(
}
FREE(qp->queryPool);
PROFILEEND(rpi_vkDestroyQueryPool);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdEndQuery(
@ -102,12 +115,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdEndQuery(
VkQueryPool queryPool,
uint32_t query)
{
PROFILESTART(rpi_vkCmdEndQuery);
assert(commandBuffer);
assert(queryPool);
_commandBuffer* cmdBuf = commandBuffer;
cmdBuf->perfmonID = 0;
PROFILEEND(rpi_vkCmdEndQuery);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBeginQuery(
@ -116,6 +133,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBeginQuery(
uint32_t query,
VkQueryControlFlags flags)
{
PROFILESTART(rpi_vkCmdBeginQuery);
assert(commandBuffer);
assert(queryPool);
@ -127,6 +146,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBeginQuery(
//pass id will select the perfmon at submit
cmdBuf->perfmonID = qp->queryPool[query].perfmonIDs;
PROFILEEND(rpi_vkCmdBeginQuery);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyQueryPoolResults(
@ -139,7 +160,11 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyQueryPoolResults(
VkDeviceSize stride,
VkQueryResultFlags flags)
{
PROFILESTART(rpi_vkCmdCopyQueryPoolResults);
//TODO
PROFILEEND(rpi_vkCmdCopyQueryPoolResults);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetQueryPoolResults(
@ -152,6 +177,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetQueryPoolResults(
VkDeviceSize stride,
VkQueryResultFlags flags)
{
PROFILESTART(rpi_vkGetQueryPoolResults);
assert(device);
assert(queryPool);
@ -175,6 +202,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetQueryPoolResults(
}
}
PROFILEEND(rpi_vkGetQueryPoolResults);
return VK_SUCCESS;
}

View File

@ -7,6 +7,8 @@
*/
void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
{
PROFILESTART(rpi_vkCmdBeginRenderPass);
assert(commandBuffer);
assert(pRenderPassBegin);
@ -283,6 +285,8 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
cb->currRenderPass = rp;
assert(((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->memGuard == 0xDDDDDDDD);
PROFILEEND(rpi_vkCmdBeginRenderPass);
}
/*
@ -290,6 +294,8 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
*/
void rpi_vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
{
PROFILESTART(rpi_vkCmdEndRenderPass);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -309,6 +315,8 @@ void rpi_vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
cb->currRenderPass = 0;
assert(((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->memGuard == 0xDDDDDDDD);
PROFILEEND(rpi_vkCmdEndRenderPass);
}
/*
@ -316,6 +324,8 @@ void rpi_vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
*/
VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
{
PROFILESTART(rpi_vkCreateRenderPass);
assert(device);
assert(pCreateInfo);
assert(pRenderPass);
@ -326,6 +336,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
_renderpass* rp = ALLOCATE(sizeof(_renderpass), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -333,6 +344,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->attachments = ALLOCATE(sizeof(VkAttachmentDescription)*rp->numAttachments, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->attachments)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -342,6 +354,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses = ALLOCATE(sizeof(VkSubpassDescription)*rp->numSubpasses, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -358,6 +371,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses[c].pInputAttachments = ALLOCATE(sizeof(VkAttachmentReference)*rp->subpasses[c].inputAttachmentCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses[c].pInputAttachments)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -373,6 +387,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses[c].pColorAttachments = ALLOCATE(sizeof(VkAttachmentReference)*rp->subpasses[c].colorAttachmentCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses[c].pColorAttachments)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -388,6 +403,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses[c].pResolveAttachments = ALLOCATE(sizeof(VkAttachmentReference)*rp->subpasses[c].colorAttachmentCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses[c].pResolveAttachments)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -403,6 +419,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses[c].pDepthStencilAttachment = ALLOCATE(sizeof(VkAttachmentReference), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses[c].pDepthStencilAttachment)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -418,6 +435,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpasses[c].pPreserveAttachments = ALLOCATE(sizeof(uint32_t)*rp->subpasses[c].preserveAttachmentCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpasses[c].pPreserveAttachments)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -433,6 +451,7 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
rp->subpassDependencies = ALLOCATE(sizeof(VkSubpassDependency)*rp->numSubpassDependencies, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!rp->subpassDependencies)
{
PROFILEEND(rpi_vkCreateRenderPass);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -440,11 +459,14 @@ VkResult rpi_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* p
*pRenderPass = rp;
PROFILEEND(rpi_vkCreateRenderPass);
return VK_SUCCESS;
}
void rpi_vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyRenderPass);
assert(device);
_renderpass* rp = renderPass;
@ -468,6 +490,8 @@ void rpi_vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkA
FREE(rp);
}
PROFILEEND(rpi_vkDestroyRenderPass);
}
/*
@ -475,6 +499,8 @@ void rpi_vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkA
*/
VkResult rpi_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
PROFILESTART(rpi_vkCreateFramebuffer);
assert(device);
assert(pCreateInfo);
assert(pFramebuffer);
@ -483,6 +509,7 @@ VkResult rpi_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo*
if(!fb)
{
PROFILEEND(rpi_vkCreateFramebuffer);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -493,6 +520,7 @@ VkResult rpi_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo*
if(!fb->attachmentViews)
{
PROFILEEND(rpi_vkCreateFramebuffer);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -507,11 +535,14 @@ VkResult rpi_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo*
*pFramebuffer = fb;
PROFILEEND(rpi_vkCreateFramebuffer);
return VK_SUCCESS;
}
void rpi_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyFramebuffer);
assert(device);
_framebuffer* fb = framebuffer;
@ -520,6 +551,8 @@ void rpi_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const
FREE(fb->attachmentViews);
FREE(fb);
}
PROFILEEND(rpi_vkDestroyFramebuffer);
}
/*
@ -529,12 +562,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdNextSubpass(
VkCommandBuffer commandBuffer,
VkSubpassContents contents)
{
PROFILESTART(rpi_vkCmdNextSubpass);
assert(commandBuffer);
//TODO contents, everything else...
_commandBuffer* cb = commandBuffer;
//cb->currentSubpass++; //TODO check max subpass?
PROFILEEND(rpi_vkCmdNextSubpass);
}
/*
@ -545,6 +582,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetRenderAreaGranularity(
VkRenderPass renderPass,
VkExtent2D* pGranularity)
{
PROFILESTART(rpi_vkGetRenderAreaGranularity);
assert(device);
assert(renderPass);
assert(pGranularity);
@ -569,4 +608,6 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetRenderAreaGranularity(
pGranularity->width = tileSizeW;
pGranularity->height = tileSizeH;
PROFILEEND(rpi_vkGetRenderAreaGranularity);
}

View File

@ -7,6 +7,8 @@
*/
VkResult rpi_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
PROFILESTART(rpi_vkCreateImageView);
assert(device);
assert(pCreateInfo);
assert(pView);
@ -15,6 +17,7 @@ VkResult rpi_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCr
if(!view)
{
PROFILEEND(rpi_vkCreateImageView);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -26,6 +29,7 @@ VkResult rpi_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCr
*pView = view;
PROFILEEND(rpi_vkCreateImageView);
return VK_SUCCESS;
}
@ -34,6 +38,8 @@ VkResult rpi_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCr
*/
VkResult rpi_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
{
PROFILESTART(rpi_vkCreateBuffer);
assert(device);
assert(pCreateInfo);
assert(pBuffer);
@ -41,6 +47,7 @@ VkResult rpi_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateIn
_buffer* buf = ALLOCATE(sizeof(_buffer), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!buf)
{
PROFILEEND(rpi_vkCreateBuffer);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -52,6 +59,7 @@ VkResult rpi_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateIn
*pBuffer = buf;
PROFILEEND(rpi_vkCreateBuffer);
return VK_SUCCESS;
}
@ -60,6 +68,8 @@ VkResult rpi_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateIn
*/
void rpi_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
{
PROFILESTART(rpi_vkGetBufferMemoryRequirements);
assert(device);
assert(buffer);
assert(pMemoryRequirements);
@ -68,6 +78,8 @@ void rpi_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemor
pMemoryRequirements->size = getBOAlignedSize(((_buffer*)buffer)->size, ARM_PAGE_SIZE);
//there's only one memory type so that's gonna be it...
pMemoryRequirements->memoryTypeBits = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
PROFILEEND(rpi_vkGetBufferMemoryRequirements);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetBufferMemoryRequirements2(
@ -75,11 +87,15 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetBufferMemoryRequirements2(
const VkBufferMemoryRequirementsInfo2* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
PROFILESTART(rpi_vkGetBufferMemoryRequirements2);
assert(device);
assert(pInfo);
assert(pMemoryRequirements);
rpi_vkGetBufferMemoryRequirements(device, pInfo->buffer, &pMemoryRequirements->memoryRequirements);
PROFILEEND(rpi_vkGetBufferMemoryRequirements2);
}
/*
@ -87,6 +103,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetBufferMemoryRequirements2(
*/
VkResult rpi_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
{
PROFILESTART(rpi_vkBindBufferMemory);
assert(device);
assert(buffer);
assert(memory);
@ -102,11 +120,14 @@ VkResult rpi_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory
buf->boundMem = mem;
buf->boundOffset = memoryOffset;
PROFILEEND(rpi_vkBindBufferMemory);
return VK_SUCCESS;
}
void rpi_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyBuffer);
assert(device);
_buffer* buf = buffer;
@ -114,10 +135,14 @@ void rpi_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCal
{
FREE(buf);
}
PROFILEEND(rpi_vkDestroyBuffer);
}
void rpi_vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyImageView);
assert(device);
_imageView* view = imageView;
@ -125,6 +150,8 @@ void rpi_vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllo
{
FREE(view);
}
PROFILEEND(rpi_vkDestroyImageView);
}
@ -137,6 +164,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateBufferView(
const VkAllocationCallbacks* pAllocator,
VkBufferView* pView)
{
PROFILESTART(rpi_vkCreateBufferView);
assert(device);
assert(pCreateInfo);
assert(pView);
@ -145,6 +174,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateBufferView(
if(!bv)
{
PROFILEEND(rpi_vkCreateBufferView);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -155,6 +185,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateBufferView(
*pView = bv;
PROFILEEND(rpi_vkCreateBufferView);
return VK_SUCCESS;
}
@ -166,6 +197,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyBufferView(
VkBufferView bufferView,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyBufferView);
assert(device);
_bufferView* bv = bufferView;
@ -173,6 +206,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyBufferView(
{
FREE(bv);
}
PROFILEEND(rpi_vkDestroyBufferView);
}
/*
@ -184,6 +219,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
const VkAllocationCallbacks* pAllocator,
VkImage* pImage)
{
PROFILESTART(rpi_vkCreateImage);
assert(device);
assert(pCreateInfo);
assert(pImage);
@ -191,6 +228,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
_image* i = ALLOCATE(sizeof(_image), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!i)
{
PROFILEEND(rpi_vkCreateImage);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -239,6 +277,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
i->queueFamiliesWithAccess = ALLOCATE(sizeof(uint32_t) * i->numQueueFamiliesWithAccess, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!i->queueFamiliesWithAccess)
{
PROFILEEND(rpi_vkCreateImage);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
memcpy(i->queueFamiliesWithAccess, pCreateInfo->pQueueFamilyIndices, sizeof(uint32_t) * i->numQueueFamiliesWithAccess);
@ -251,6 +290,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
*pImage = i;
PROFILEEND(rpi_vkCreateImage);
return VK_SUCCESS;
}
@ -262,6 +302,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyImage(
VkImage image,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyImage);
assert(device);
_image* i = image;
@ -274,6 +316,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyImage(
}
FREE(i);
}
PROFILEEND(rpi_vkDestroyImage);
}
/*
@ -284,6 +328,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
VkImage image,
VkMemoryRequirements* pMemoryRequirements)
{
PROFILESTART(rpi_vkGetImageMemoryRequirements);
assert(device);
assert(image);
assert(pMemoryRequirements);
@ -378,6 +424,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
pMemoryRequirements->alignment = ARM_PAGE_SIZE;
pMemoryRequirements->memoryTypeBits = memoryTypes[0].propertyFlags; //TODO
pMemoryRequirements->size = i->size;
PROFILEEND(rpi_vkGetImageMemoryRequirements);
}
/*
@ -389,6 +437,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory(
VkDeviceMemory memory,
VkDeviceSize memoryOffset)
{
PROFILESTART(rpi_vkBindImageMemory);
assert(device);
assert(image);
assert(memory);
@ -414,6 +464,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory(
int ret = vc4_bo_set_tiling(controlFd, i->boundMem->bo, DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED); assert(ret);
}
PROFILEEND(rpi_vkBindImageMemory);
return VK_SUCCESS;
}
@ -422,6 +473,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindBufferMemory2(
uint32_t bindInfoCount,
const VkBindBufferMemoryInfo* pBindInfos)
{
PROFILESTART(rpi_vkBindBufferMemory2);
assert(device);
assert(pBindInfos);
@ -436,6 +489,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindBufferMemory2(
}
}
PROFILEEND(rpi_vkBindBufferMemory2);
return ret;
}
@ -444,10 +498,14 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements2(
const VkImageMemoryRequirementsInfo2* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
PROFILESTART(rpi_vkGetImageMemoryRequirements2);
assert(device);
assert(pInfo);
assert(pMemoryRequirements);
rpi_vkGetImageMemoryRequirements(device, pInfo->image, pMemoryRequirements);
PROFILEEND(rpi_vkGetImageMemoryRequirements2);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory2(
@ -455,6 +513,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory2(
uint32_t bindInfoCount,
const VkBindImageMemoryInfo* pBindInfos)
{
PROFILESTART(rpi_vkBindImageMemory2);
assert(device);
assert(pBindInfos);
@ -469,6 +529,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory2(
}
}
PROFILEEND(rpi_vkBindImageMemory2);
return ret;
}
@ -480,6 +541,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPushConstants(
uint32_t size,
const void* pValues)
{
PROFILESTART(rpi_vkCmdPushConstants);
assert(commandBuffer);
assert(layout);
@ -497,6 +560,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPushConstants(
}
cb->pushConstantDirty = 1;
PROFILEEND(rpi_vkCmdPushConstants);
}
VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSubresourceLayout(
@ -505,5 +570,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageSubresourceLayout(
const VkImageSubresource* pSubresource,
VkSubresourceLayout* pLayout)
{
PROFILESTART(rpi_vkGetImageSubresourceLayout);
//TODO
PROFILEEND(rpi_vkGetImageSubresourceLayout);
}

View File

@ -6,6 +6,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSampler(
const VkAllocationCallbacks* pAllocator,
VkSampler* pSampler)
{
PROFILESTART(rpi_vkCreateSampler);
assert(device);
assert(pCreateInfo);
assert(pSampler);
@ -14,6 +16,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSampler(
if(!s)
{
PROFILEEND(rpi_vkCreateSampler);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -36,6 +39,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSampler(
*pSampler = s;
PROFILEEND(rpi_vkCreateSampler);
return VK_SUCCESS;
}
@ -44,9 +48,13 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySampler(
VkSampler sampler,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroySampler);
assert(device);
FREE(sampler);
PROFILEEND(rpi_vkDestroySampler);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSamplerYcbcrConversion(
@ -55,7 +63,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSamplerYcbcrConversion(
const VkAllocationCallbacks* pAllocator,
VkSamplerYcbcrConversion* pYcbcrConversion)
{
PROFILESTART(rpi_vkCreateSamplerYcbcrConversion);
//TODO
PROFILEEND(rpi_vkCreateSamplerYcbcrConversion);
return VK_SUCCESS;
}
@ -64,5 +76,9 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySamplerYcbcrConversion(
VkSamplerYcbcrConversion ycbcrConversion,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroySamplerYcbcrConversion);
//TODO
PROFILEEND(rpi_vkDestroySamplerYcbcrConversion);
}

View File

@ -15,12 +15,15 @@
*/
VkResult rpi_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
PROFILESTART(rpi_vkCreateShaderModule);
uint32_t magic = pCreateInfo->pCode[2];
VkRpiShaderModuleAssemblyCreateInfoEXT* ci = pCreateInfo->pCode[4];
//shader magic doesn't add up
if(magic != 0x14E45250)
{
PROFILEEND(rpi_vkCreateShaderModule);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -32,6 +35,7 @@ VkResult rpi_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInf
if(!shader)
{
PROFILEEND(rpi_vkCreateShaderModule);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -388,6 +392,7 @@ VkResult rpi_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInf
if(!shader->mappings[c])
{
PROFILEEND(rpi_vkCreateShaderModule);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -405,11 +410,14 @@ VkResult rpi_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInf
*pShaderModule = shader;
PROFILEEND(rpi_vkCreateShaderModule);
return VK_SUCCESS;
}
void rpi_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyShaderModule);
assert(device);
_shaderModule* shader = shaderModule;
@ -431,4 +439,6 @@ void rpi_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, con
FREE(shader);
}
PROFILEEND(rpi_vkDestroyShaderModule);
}

View File

@ -416,6 +416,8 @@ void setupClearEmulationResources(VkDevice device)
*/
void rpi_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports)
{
PROFILESTART(rpi_vkCmdSetViewport);
assert(commandBuffer);
assert(firstViewport == 0);
assert(viewportCount == 1);
@ -427,6 +429,8 @@ void rpi_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
cb->viewport = pViewports[0];
cb->viewportDirty = 1;
PROFILEEND(rpi_vkCmdSetViewport);
}
/*
@ -434,6 +438,8 @@ void rpi_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
*/
void rpi_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors)
{
PROFILESTART(rpi_vkCmdSetScissor);
assert(commandBuffer);
assert(firstScissor == 0);
assert(scissorCount == 1);
@ -445,6 +451,8 @@ void rpi_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, u
cb->scissor = pScissors[0];
cb->scissorDirty = 1;
PROFILEEND(rpi_vkCmdSetScissor);
}
/*
@ -452,6 +460,8 @@ void rpi_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, u
*/
void rpi_vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
{
PROFILESTART(rpi_vkCmdBindVertexBuffers);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -463,6 +473,8 @@ void rpi_vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBin
}
cb->vertexBufferDirty = 1;
PROFILEEND(rpi_vkCmdBindVertexBuffers);
}
/*
@ -478,6 +490,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearColorImage(
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
PROFILESTART(rpi_vkCmdClearColorImage);
assert(commandBuffer);
assert(image);
assert(pColor);
@ -551,6 +565,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearColorImage(
assert(((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->memGuard == 0xDDDDDDDD);
}
PROFILEEND(rpi_vkCmdClearColorImage);
}
/*
@ -564,11 +580,15 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearDepthStencilImage(
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
PROFILESTART(rpi_vkCmdClearDepthStencilImage);
assert(commandBuffer);
assert(image);
assert(pDepthStencil);
//TODO
PROFILEEND(rpi_vkCmdClearDepthStencilImage);
}
/*
@ -581,6 +601,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearAttachments(
uint32_t rectCount,
const VkClearRect* pRects)
{
PROFILESTART(rpi_vkCmdClearAttachments);
assert(commandBuffer);
assert(pAttachments);
assert(pRects);
@ -591,6 +613,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearAttachments(
if(!cmdBuf->currRenderPass)
{
//no active render pass
PROFILEEND(rpi_vkCmdClearAttachments);
return;
}
@ -705,6 +728,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdClearAttachments(
memcpy(cmdBuf->vertexBuffers, oldVertexBuffers, sizeof(oldVertexBuffers));
memcpy(cmdBuf->pushConstantBufferVertex, oldPushConstantBufferVertex, sizeof(oldPushConstantBufferVertex));
memcpy(cmdBuf->pushConstantBufferPixel, oldPushConstantBufferPixel, sizeof(oldPushConstantBufferPixel));
PROFILEEND(rpi_vkCmdClearAttachments);
}
/*
@ -717,7 +742,11 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdFillBuffer(
VkDeviceSize size,
uint32_t data)
{
PROFILESTART(rpi_vkCmdFillBuffer);
//TODO
PROFILEEND(rpi_vkCmdFillBuffer);
}
/*
@ -730,7 +759,11 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdUpdateBuffer(
VkDeviceSize dataSize,
const void* pData)
{
PROFILESTART(rpi_vkCmdUpdateBuffer);
//TODO
PROFILEEND(rpi_vkCmdUpdateBuffer);
}
/*
@ -742,6 +775,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindIndexBuffer(
VkDeviceSize offset,
VkIndexType indexType)
{
PROFILESTART(rpi_vkCmdBindIndexBuffer);
assert(commandBuffer);
if(indexType == VK_INDEX_TYPE_UINT32)
@ -755,6 +790,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindIndexBuffer(
cb->indexBufferOffset = offset;
cb->indexBufferDirty = 1;
PROFILEEND(rpi_vkCmdBindIndexBuffer);
}
/*
@ -764,12 +801,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetLineWidth(
VkCommandBuffer commandBuffer,
float lineWidth)
{
PROFILESTART(rpi_vkCmdSetLineWidth);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
cb->lineWidth = lineWidth;
cb->lineWidthDirty = 1;
PROFILEEND(rpi_vkCmdSetLineWidth);
}
/*
@ -781,6 +822,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDepthBias(
float depthBiasClamp,
float depthBiasSlopeFactor)
{
PROFILESTART(rpi_vkCmdSetDepthBias);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -789,6 +832,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDepthBias(
cb->depthBiasSlopeFactor = depthBiasSlopeFactor;
cb->depthBiasDirty = 1;
PROFILEEND(rpi_vkCmdSetDepthBias);
}
/*
@ -798,12 +843,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetBlendConstants(
VkCommandBuffer commandBuffer,
const float blendConstants[4])
{
PROFILESTART(rpi_vkCmdSetBlendConstants);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
memcpy(cb->blendConstants, blendConstants, 4 * sizeof(float));
cb->blendConstantsDirty = 1;
PROFILEEND(rpi_vkCmdSetBlendConstants);
}
/*
@ -814,6 +863,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDepthBounds(
float minDepthBounds,
float maxDepthBounds)
{
PROFILESTART(rpi_vkCmdSetDepthBounds);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -821,6 +872,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetDepthBounds(
cb->maxDepthBounds = maxDepthBounds;
cb->depthBoundsDirty = 1;
PROFILEEND(rpi_vkCmdSetDepthBounds);
}
/*
@ -831,6 +884,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilCompareMask(
VkStencilFaceFlags faceMask,
uint32_t compareMask)
{
PROFILESTART(rpi_vkCmdSetStencilCompareMask);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -846,6 +901,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilCompareMask(
}
cb->stencilCompareMaskDirty = 1;
PROFILEEND(rpi_vkCmdSetStencilCompareMask);
}
/*
@ -856,6 +913,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilWriteMask(
VkStencilFaceFlags faceMask,
uint32_t writeMask)
{
PROFILESTART(rpi_vkCmdSetStencilWriteMask);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -871,6 +930,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilWriteMask(
}
cb->stencilWriteMaskDirty = 1;
PROFILEEND(rpi_vkCmdSetStencilWriteMask);
}
/*
@ -881,6 +942,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilReference(
VkStencilFaceFlags faceMask,
uint32_t reference)
{
PROFILESTART(rpi_vkCmdSetStencilReference);
assert(commandBuffer);
_commandBuffer* cb = commandBuffer;
@ -896,4 +959,6 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdSetStencilReference(
}
cb->stencilReferenceDirty = 1;
PROFILEEND(rpi_vkCmdSetStencilReference);
}

View File

@ -58,6 +58,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSemaphore(
const VkAllocationCallbacks* pAllocator,
VkSemaphore* pSemaphore)
{
PROFILESTART(rpi_vkCreateSemaphore);
assert(device);
assert(pSemaphore);
@ -65,12 +67,14 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSemaphore(
sem_t* s = ALLOCATE(sizeof(sem_t), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!s)
{
PROFILEEND(rpi_vkCreateSemaphore);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
sem_init(s, 0, 0); //create semaphore unsignalled, shared between threads
*pSemaphore = (VkSemaphore)s;
PROFILEEND(rpi_vkCreateSemaphore);
return VK_SUCCESS;
}
@ -109,6 +113,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPipelineBarrier(
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers)
{
PROFILESTART(rpi_vkCmdPipelineBarrier);
assert(commandBuffer);
//TODO pipeline stage flags
@ -194,6 +200,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPipelineBarrier(
//transition to new layout
i->layout = pImageMemoryBarriers[c].newLayout;
}
PROFILEEND(rpi_vkCmdPipelineBarrier);
}
/*
@ -203,6 +211,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdPipelineBarrier(
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkDeviceWaitIdle(
VkDevice device)
{
PROFILESTART(rpi_vkDeviceWaitIdle);
assert(device);
for(int c = 0; c < numQueueFamilies; ++c)
@ -215,6 +225,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkDeviceWaitIdle(
}
}
PROFILEEND(rpi_vkDeviceWaitIdle);
return VK_SUCCESS;
}
@ -224,6 +235,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkDeviceWaitIdle(
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueWaitIdle(
VkQueue queue)
{
PROFILESTART(rpi_vkQueueWaitIdle);
assert(queue);
_queue* q = queue;
@ -231,6 +244,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueWaitIdle(
uint64_t timeout = WAIT_TIMEOUT_INFINITE;
vc4_seqno_wait(controlFd, &lastFinishedSeqno, q->lastEmitSeqno, &timeout);
PROFILEEND(rpi_vkQueueWaitIdle);
return VK_SUCCESS;
}
@ -242,6 +256,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySemaphore(
VkSemaphore semaphore,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroySemaphore);
assert(device);
if(semaphore)
@ -249,6 +265,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySemaphore(
sem_destroy((sem_t*)semaphore);
FREE(semaphore);
}
PROFILEEND(rpi_vkDestroySemaphore);
}
/*
@ -260,6 +278,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateFence(
const VkAllocationCallbacks* pAllocator,
VkFence* pFence)
{
PROFILESTART(rpi_vkCreateFence);
assert(device);
assert(pCreateInfo);
assert(pFence);
@ -268,6 +288,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateFence(
if(!f)
{
PROFILEEND(rpi_vkCreateFence);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -276,6 +297,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateFence(
*pFence = f;
PROFILEEND(rpi_vkCreateFence);
return VK_SUCCESS;
}
@ -287,12 +309,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyFence(
VkFence fence,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroyFence);
assert(device);
if(fence)
{
FREE(fence);
}
PROFILEEND(rpi_vkDestroyFence);
}
/*
@ -302,13 +328,18 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetFenceStatus(
VkDevice device,
VkFence fence)
{
PROFILESTART(rpi_vkGetFenceStatus);
assert(device);
assert(fence);
//TODO update fence status based on last completed seqno?
_fence* f = fence;
return f->signaled ? VK_SUCCESS : VK_NOT_READY;
VkResult retval = f->signaled ? VK_SUCCESS : VK_NOT_READY;
PROFILEEND(rpi_vkGetFenceStatus);
return retval;
}
/*
@ -319,6 +350,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetFences(
uint32_t fenceCount,
const VkFence* pFences)
{
PROFILESTART(rpi_vkResetFences);
assert(device);
assert(pFences);
assert(fenceCount > 0);
@ -330,6 +363,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkResetFences(
f->seqno = 0;
}
PROFILEEND(rpi_vkResetFences);
return VK_SUCCESS;
}
@ -343,6 +377,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkWaitForFences(
VkBool32 waitAll,
uint64_t timeout)
{
PROFILESTART(rpi_vkWaitForFences);
assert(device);
assert(pFences);
assert(fenceCount > 0);
@ -356,9 +392,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkWaitForFences(
_fence* f = pFences[c];
if(!f->signaled) //if any unsignaled
{
PROFILEEND(rpi_vkWaitForFences);
return VK_TIMEOUT;
}
PROFILEEND(rpi_vkWaitForFences);
return VK_SUCCESS;
}
}
@ -374,6 +412,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkWaitForFences(
if(ret < 0)
{
PROFILEEND(rpi_vkWaitForFences);
return VK_TIMEOUT;
}
@ -391,9 +430,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkWaitForFences(
_fence* f = pFences[c];
if(f->signaled) //if any signaled
{
PROFILEEND(rpi_vkWaitForFences);
return VK_SUCCESS;
}
PROFILEEND(rpi_vkWaitForFences);
return VK_TIMEOUT;
}
}
@ -414,18 +455,22 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkWaitForFences(
f->signaled = 1;
f->seqno = 0;
PROFILEEND(rpi_vkWaitForFences);
return VK_SUCCESS;
}
else
{
//already signaled
PROFILEEND(rpi_vkWaitForFences);
return VK_SUCCESS;
}
}
PROFILEEND(rpi_vkWaitForFences);
return VK_TIMEOUT;
}
PROFILEEND(rpi_vkWaitForFences);
return VK_SUCCESS;
}

View File

@ -14,6 +14,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
uint32_t* pPropertyCount,
VkDisplayPlanePropertiesKHR* pProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR);
assert(physicalDevice);
assert(pPropertyCount);
@ -24,6 +26,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
if(!pProperties)
{
*pPropertyCount = numPlanes;
PROFILEEND(rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR);
return VK_SUCCESS;
}
@ -36,6 +39,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
pProperties[c].currentStackIndex = c; //TODO dunno?
}
PROFILEEND(rpi_vkGetPhysicalDeviceDisplayPlanePropertiesKHR);
return VK_SUCCESS;
}
@ -45,6 +49,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayPlaneSupportedDisplaysKHR(
uint32_t* pDisplayCount,
VkDisplayKHR* pDisplays)
{
PROFILESTART(rpi_vkGetDisplayPlaneSupportedDisplaysKHR);
assert(physicalDevice);
assert(pDisplayCount);
@ -55,6 +61,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayPlaneSupportedDisplaysKHR(
if(!pDisplays)
{
*pDisplayCount = planes[planeIndex].numPossibleConnectors;
PROFILEEND(rpi_vkGetDisplayPlaneSupportedDisplaysKHR);
return VK_SUCCESS;
}
@ -70,9 +78,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayPlaneSupportedDisplaysKHR(
if(arraySize < planes[planeIndex].numPossibleConnectors)
{
PROFILEEND(rpi_vkGetDisplayPlaneSupportedDisplaysKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetDisplayPlaneSupportedDisplaysKHR);
return VK_SUCCESS;
}
@ -81,6 +91,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPropertiesKHR(
uint32_t* pPropertyCount,
VkDisplayPropertiesKHR* pProperties)
{
PROFILESTART(rpi_vkGetPhysicalDeviceDisplayPropertiesKHR);
assert(physicalDevice);
assert(pPropertyCount);
@ -91,6 +103,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPropertiesKHR(
if(!pProperties)
{
*pPropertyCount = numDisplays;
PROFILEEND(rpi_vkGetPhysicalDeviceDisplayPropertiesKHR);
return VK_SUCCESS;
}
@ -114,9 +128,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceDisplayPropertiesKHR(
if(arraySize < numDisplays)
{
PROFILEEND(rpi_vkGetPhysicalDeviceDisplayPropertiesKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetPhysicalDeviceDisplayPropertiesKHR);
return VK_SUCCESS;
}
@ -126,6 +142,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayModePropertiesKHR(
uint32_t* pPropertyCount,
VkDisplayModePropertiesKHR* pProperties)
{
PROFILESTART(rpi_vkGetDisplayModePropertiesKHR);
assert(physicalDevice);
assert(display);
assert(pPropertyCount);
@ -137,6 +155,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayModePropertiesKHR(
if(!pProperties)
{
*pPropertyCount = numModes;
PROFILEEND(rpi_vkGetDisplayModePropertiesKHR);
return VK_SUCCESS;
}
@ -156,9 +176,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetDisplayModePropertiesKHR(
if(arraySize < numModes)
{
PROFILEEND(rpi_vkGetDisplayModePropertiesKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetDisplayModePropertiesKHR);
return VK_SUCCESS;
}
@ -169,6 +191,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDisplayModeKHR(
const VkAllocationCallbacks* pAllocator,
VkDisplayModeKHR* pMode)
{
PROFILESTART(rpi_vkCreateDisplayModeKHR);
assert(physicalDevice);
assert(display);
@ -188,6 +212,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDisplayModeKHR(
break;
}
}
PROFILEEND(rpi_vkCreateDisplayModeKHR);
}
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDisplayPlaneSurfaceKHR(
@ -196,6 +222,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDisplayPlaneSurfaceKHR(
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
PROFILESTART(rpi_vkCreateDisplayPlaneSurfaceKHR);
assert(instance);
assert(pSurface);
@ -206,6 +234,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDisplayPlaneSurfaceKHR(
modeset_create_surface_for_mode(controlFd, mode.connectorID, mode.modeID, surface);
*pSurface = surface;
PROFILEEND(rpi_vkCreateDisplayPlaneSurfaceKHR);
}
/*
@ -219,6 +249,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySurfaceKHR(
VkSurfaceKHR surface,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroySurfaceKHR);
assert(instance);
if(surface)
@ -227,6 +259,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySurfaceKHR(
}
FREE(surface);
PROFILEEND(rpi_vkDestroySurfaceKHR);
}
/*
@ -244,6 +278,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities)
{
PROFILESTART(rpi_vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
assert(physicalDevice);
assert(surface);
assert(pSurfaceCapabilities);
@ -270,6 +306,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
VK_IMAGE_USAGE_TRANSFER_DST_BIT | //for clears
VK_IMAGE_USAGE_TRANSFER_SRC_BIT; //for screenshots
PROFILEEND(rpi_vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
return VK_SUCCESS;
}
@ -288,6 +325,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceFormatsKHR(
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats)
{
PROFILESTART(rpi_vkGetPhysicalDeviceSurfaceFormatsKHR);
assert(physicalDevice);
assert(surface);
assert(pSurfaceFormatCount);
@ -297,6 +336,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceFormatsKHR(
if(!pSurfaceFormats)
{
*pSurfaceFormatCount = numFormats;
PROFILEEND(rpi_vkGetPhysicalDeviceSurfaceFormatsKHR);
return VK_SUCCESS;
}
@ -312,9 +353,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceFormatsKHR(
if(elementsWritten < numFormats)
{
PROFILEEND(rpi_vkGetPhysicalDeviceSurfaceFormatsKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetPhysicalDeviceSurfaceFormatsKHR);
return VK_SUCCESS;
}
@ -333,6 +376,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfacePresentModesKHR(
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes)
{
PROFILESTART(rpi_vkGetPhysicalDeviceSurfacePresentModesKHR);
assert(physicalDevice);
assert(surface);
assert(pPresentModeCount);
@ -340,6 +385,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfacePresentModesKHR(
if(!pPresentModes)
{
*pPresentModeCount = numSupportedPresentModes;
PROFILEEND(rpi_vkGetPhysicalDeviceSurfacePresentModesKHR);
return VK_SUCCESS;
}
@ -356,9 +403,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfacePresentModesKHR(
if(elementsWritten < numSupportedPresentModes)
{
PROFILEEND(rpi_vkGetPhysicalDeviceSurfacePresentModesKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetPhysicalDeviceSurfacePresentModesKHR);
return VK_SUCCESS;
}
@ -371,6 +420,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR(
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchain)
{
PROFILESTART(rpi_vkCreateSwapchainKHR);
assert(device);
assert(pCreateInfo);
assert(pSwapchain);
@ -378,6 +429,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR(
*pSwapchain = ALLOCATE(sizeof(_swapchain), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!*pSwapchain)
{
PROFILEEND(rpi_vkCreateSwapchainKHR);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -389,6 +441,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR(
s->images = ALLOCATE(sizeof(_image) * pCreateInfo->minImageCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!s->images)
{
PROFILEEND(rpi_vkCreateSwapchainKHR);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
@ -451,6 +504,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR(
modeset_create_fb_for_surface(controlFd, &s->images[c], pCreateInfo->surface); assert(s->images[c].fb);
}
PROFILEEND(rpi_vkCreateSwapchainKHR);
return VK_SUCCESS;
}
@ -469,6 +523,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetSwapchainImagesKHR(
uint32_t* pSwapchainImageCount,
VkImage* pSwapchainImages)
{
PROFILESTART(rpi_vkGetSwapchainImagesKHR);
assert(device);
assert(swapchain);
assert(pSwapchainImageCount);
@ -478,6 +534,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetSwapchainImagesKHR(
if(!pSwapchainImages)
{
*pSwapchainImageCount = s->numImages;
PROFILEEND(rpi_vkGetSwapchainImagesKHR);
return VK_SUCCESS;
}
@ -493,9 +551,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetSwapchainImagesKHR(
if(elementsWritten < s->numImages)
{
PROFILEEND(rpi_vkGetSwapchainImagesKHR);
return VK_INCOMPLETE;
}
PROFILEEND(rpi_vkGetSwapchainImagesKHR);
return VK_SUCCESS;
}
@ -510,6 +570,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAcquireNextImageKHR(
VkFence fence,
uint32_t* pImageIndex)
{
PROFILESTART(rpi_vkAcquireNextImageKHR);
assert(device);
assert(swapchain);
@ -533,6 +595,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAcquireNextImageKHR(
f->signaled = 1;
}
PROFILEEND(rpi_vkAcquireNextImageKHR);
return VK_SUCCESS;
}
@ -553,6 +616,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo)
{
PROFILESTART(rpi_vkQueuePresentKHR);
assert(queue);
assert(pPresentInfo);
@ -569,6 +634,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueuePresentKHR(
s->backbufferIdx = (s->backbufferIdx + 1) % s->numImages;
}
PROFILEEND(rpi_vkQueuePresentKHR);
return VK_SUCCESS;
}
@ -580,6 +646,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySwapchainKHR(
VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator)
{
PROFILESTART(rpi_vkDestroySwapchainKHR);
assert(device);
//TODO flush all ops
@ -598,6 +666,10 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroySwapchainKHR(
}
FREE(s);
PROFILEEND(rpi_vkDestroySwapchainKHR);
profilePrintResults();
}
/*
@ -610,6 +682,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceSupportKHR(
VkSurfaceKHR surface,
VkBool32* pSupported)
{
PROFILESTART(rpi_vkGetPhysicalDeviceSurfaceSupportKHR);
assert(pSupported);
assert(surface);
assert(physicalDevice);
@ -620,6 +694,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfaceSupportKHR(
//one using /dev/dri/card0 which has modesetting
//other using /dev/dri/renderD128 which does not support modesetting, this would say false here
*pSupported = VK_TRUE;
PROFILEEND(rpi_vkGetPhysicalDeviceSurfaceSupportKHR);
return VK_SUCCESS;
}