1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-01-31 23:52:14 +01:00

cleaned up some compile warnings

This commit is contained in:
yours3lf 2020-06-08 18:54:57 +01:00
parent 7e54a42747
commit 922c6ff139
25 changed files with 649 additions and 639 deletions

View File

@ -713,7 +713,7 @@ void parse_op(char** str, qpu_alu_type* type, qpu_op_add* op_add, qpu_op_mul* op
*str += 1; *str += 1;
} }
void parse_args_alu(char** str, qpu_mux* in_a, qpu_mux* in_b, uint8_t* raddr_a, uint8_t* raddr_b, uint8_t is_si) void parse_args_alu(char** str, qpu_mux* in_a, qpu_mux* in_b, qpu_raddr* raddr_a, qpu_raddr* raddr_b, uint8_t is_si)
{ {
char* arg = strtok(*str, " \n\v\f\r\t,"); char* arg = strtok(*str, " \n\v\f\r\t,");
@ -835,7 +835,7 @@ void parse_args_sem(char** str, uint8_t* sem, uint32_t* imm32)
*str += 1; *str += 1;
} }
void parse_args_branch(char** str, uint32_t* imm32, qpu_branch_cond* branch_cond, uint8_t* raddr_a) void parse_args_branch(char** str, uint32_t* imm32, qpu_branch_cond* branch_cond, qpu_raddr* raddr_a)
{ {
char* arg = strtok(*str, " \n\v\f\r\t,"); char* arg = strtok(*str, " \n\v\f\r\t,");
@ -973,8 +973,8 @@ void assemble_qpu_asm(char* str, uint64_t* instructions)
qpu_cond cond_add = QPU_COND_NEVER; qpu_cond cond_add = QPU_COND_NEVER;
qpu_waddr waddr_add = QPU_W_NOP; qpu_waddr waddr_add = QPU_W_NOP;
qpu_waddr waddr_mul = QPU_W_NOP; qpu_waddr waddr_mul = QPU_W_NOP;
qpu_waddr raddr_a = QPU_R_NOP; qpu_raddr raddr_a = QPU_R_NOP;
qpu_waddr raddr_b = QPU_R_NOP; qpu_raddr raddr_b = QPU_R_NOP;
uint8_t pack_unpack_select = 0; uint8_t pack_unpack_select = 0;
uint8_t pack_mode = QPU_PACK_A_NOP; uint8_t pack_mode = QPU_PACK_A_NOP;
qpu_unpack unpack_mode = QPU_UNPACK_NOP; qpu_unpack unpack_mode = QPU_UNPACK_NOP;

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
ConsecutivePoolAllocator createConsecutivePoolAllocator(char* b, unsigned bs, unsigned s) ConsecutivePoolAllocator createConsecutivePoolAllocator(void* b, unsigned bs, unsigned s)
{ {
assert(b); //only allocated memory assert(b); //only allocated memory
assert(bs >= sizeof(void*)); //we need to be able to store assert(bs >= sizeof(void*)); //we need to be able to store
@ -15,7 +15,7 @@ ConsecutivePoolAllocator createConsecutivePoolAllocator(char* b, unsigned bs, un
ConsecutivePoolAllocator pa = ConsecutivePoolAllocator pa =
{ {
.buf = b, .buf = b,
.nextFreeBlock = (uint32_t*)b, .nextFreeBlock = b,
.blockSize = bs, .blockSize = bs,
.size = s, .size = s,
.numFreeBlocks = s / bs .numFreeBlocks = s / bs
@ -120,7 +120,7 @@ uint32_t consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlock
pa->numFreeBlocks -= numBlocks; pa->numFreeBlocks -= numBlocks;
return (char*)ptr - pa->buf; return (char*)ptr - (char*)pa->buf;
} }
//free numBlocks consecutive memory //free numBlocks consecutive memory
@ -228,7 +228,7 @@ uint32_t consecutivePoolReAllocate(ConsecutivePoolAllocator* pa, void* currentMe
pa->numFreeBlocks -= 1; pa->numFreeBlocks -= 1;
return (char*)currentMem - pa->buf; return (char*)currentMem - (char*)pa->buf;
} }
prevPtr = listPtr; prevPtr = listPtr;

View File

@ -10,14 +10,14 @@ extern "C" {
typedef struct ConsecutivePoolAllocator typedef struct ConsecutivePoolAllocator
{ {
char* buf; //preallocated buffer void* buf; //preallocated buffer
uint32_t* nextFreeBlock; void* nextFreeBlock;
unsigned blockSize; unsigned blockSize;
unsigned size; //size is exact multiple of block size unsigned size; //size is exact multiple of block size
unsigned numFreeBlocks; unsigned numFreeBlocks;
} ConsecutivePoolAllocator; } ConsecutivePoolAllocator;
ConsecutivePoolAllocator createConsecutivePoolAllocator(char* b, unsigned bs, unsigned s); ConsecutivePoolAllocator createConsecutivePoolAllocator(void* b, unsigned bs, unsigned s);
void destroyConsecutivePoolAllocator(ConsecutivePoolAllocator* pa); void destroyConsecutivePoolAllocator(ConsecutivePoolAllocator* pa);
uint32_t consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlocks); uint32_t consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlocks);
void consecutivePoolFree(ConsecutivePoolAllocator* pa, void* p, uint32_t numBlocks); void consecutivePoolFree(ConsecutivePoolAllocator* pa, void* p, uint32_t numBlocks);

View File

@ -54,7 +54,7 @@ void clInsertNewCLMarker(ControlList* cl,
assert(shaderRecCL); assert(shaderRecCL);
assert(uniformsCL); assert(uniformsCL);
CLMarker marker = {}; CLMarker marker = {0};
marker.memGuard = 0xDDDDDDDD; marker.memGuard = 0xDDDDDDDD;
marker.handlesBufOffset = 0; marker.handlesBufOffset = 0;
marker.shaderRecBufOffset = 0; marker.shaderRecBufOffset = 0;
@ -63,13 +63,13 @@ void clInsertNewCLMarker(ControlList* cl,
marker.numDrawCallsSubmitted = 0; marker.numDrawCallsSubmitted = 0;
//close current marker //close current marker
if(cl->currMarkerOffset != -1 && !((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->size) if(cl->currMarkerOffset != ~0u && !((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->size)
{ {
clCloseCurrentMarker(cl, handlesCL, shaderRecCL, shaderRecCount, uniformsCL); clCloseCurrentMarker(cl, handlesCL, shaderRecCL, shaderRecCount, uniformsCL);
} }
//if this is not the first marker //if this is not the first marker
if(cl->currMarkerOffset != -1) if(cl->currMarkerOffset != ~0u)
{ {
CLMarker* currMarker = getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset); CLMarker* currMarker = getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset);
marker.handlesBufOffset = currMarker->handlesBufOffset + currMarker->handlesSize; marker.handlesBufOffset = currMarker->handlesBufOffset + currMarker->handlesSize;
@ -79,7 +79,7 @@ void clInsertNewCLMarker(ControlList* cl,
} }
*(CLMarker*)getCPAptrFromOffset(cl->CPA, cl->nextFreeByteOffset) = marker; *(CLMarker*)getCPAptrFromOffset(cl->CPA, cl->nextFreeByteOffset) = marker;
if(cl->currMarkerOffset != -1) if(cl->currMarkerOffset != ~0u)
{ {
((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->nextMarkerOffset = (cl->nextFreeByteOffset - cl->offset); ((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->nextMarkerOffset = (cl->nextFreeByteOffset - cl->offset);
} }
@ -102,7 +102,7 @@ void clCloseCurrentMarker(ControlList* cl, ControlList* handlesCL, ControlList*
currMarker->shaderRecCount = shaderRecCount - currMarker->shaderRecCount; //update shader rec count to reflect added shader recs currMarker->shaderRecCount = shaderRecCount - currMarker->shaderRecCount; //update shader rec count to reflect added shader recs
} }
void clInsertData(ControlList* cl, uint32_t size, uint8_t* data) void clInsertData(ControlList* cl, uint32_t size, void* data)
{ {
assert(cl); assert(cl);
assert(cl->CPA); assert(cl->CPA);

View File

@ -93,7 +93,7 @@ void clInsertNewCLMarker(ControlList* cl,
uint32_t shaderRecCount, uint32_t shaderRecCount,
ControlList* uniformsCL); ControlList* uniformsCL);
void clCloseCurrentMarker(ControlList* cl, ControlList* handlesCL, ControlList* shaderRecCL, uint32_t shaderRecCount, ControlList* uniformsCL); void clCloseCurrentMarker(ControlList* cl, ControlList* handlesCL, ControlList* shaderRecCL, uint32_t shaderRecCount, ControlList* uniformsCL);
void clInsertData(ControlList* cl, uint32_t size, uint8_t* data); void clInsertData(ControlList* cl, uint32_t size, void* data);
void clInsertUniformConstant(ControlList* cl, uint32_t data); void clInsertUniformConstant(ControlList* cl, uint32_t data);
void clInsertUniformXYScale(ControlList* cl, float data); void clInsertUniformXYScale(ControlList* cl, float data);
void clInsertUniformZOffset(ControlList* cl, float data); void clInsertUniformZOffset(ControlList* cl, float data);

View File

@ -4,7 +4,7 @@
#include <stdint.h> #include <stdint.h>
PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s) PoolAllocator createPoolAllocator(void* b, unsigned bs, unsigned s)
{ {
assert(b); //only allocated memory assert(b); //only allocated memory
assert(bs >= sizeof(void*)); //we need to be able to store assert(bs >= sizeof(void*)); //we need to be able to store
@ -14,7 +14,7 @@ PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s)
PoolAllocator pa = PoolAllocator pa =
{ {
.buf = b, .buf = b,
.nextFreeBlock = (uint32_t*)b, .nextFreeBlock = b,
.blockSize = bs, .blockSize = bs,
.size = s .size = s
}; };
@ -55,7 +55,7 @@ void* poolAllocate(PoolAllocator* pa)
void* ret = pa->nextFreeBlock; void* ret = pa->nextFreeBlock;
//set next free block to the one the current next points to //set next free block to the one the current next points to
pa->nextFreeBlock = (uint32_t*)*pa->nextFreeBlock; pa->nextFreeBlock = *(uint32_t*)pa->nextFreeBlock;
return ret; return ret;
} }

View File

@ -10,13 +10,13 @@ extern "C" {
typedef struct PoolAllocator typedef struct PoolAllocator
{ {
char* buf; //preallocated buffer void* buf; //preallocated buffer
uint32_t* nextFreeBlock; void* nextFreeBlock;
unsigned blockSize; unsigned blockSize;
unsigned size; //size is exact multiple of block size unsigned size; //size is exact multiple of block size
} PoolAllocator; } PoolAllocator;
PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s); PoolAllocator createPoolAllocator(void* b, unsigned bs, unsigned s);
void destroyPoolAllocator(PoolAllocator* pa); void destroyPoolAllocator(PoolAllocator* pa);
void* poolAllocate(PoolAllocator* pa); void* poolAllocate(PoolAllocator* pa);
void poolFree(PoolAllocator* pa, void* p); void poolFree(PoolAllocator* pa, void* p);

View File

@ -54,8 +54,6 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateCommandPool)(
int consecutiveBlockNumber = 512; int consecutiveBlockNumber = 512;
int consecutivePoolSize = consecutiveBlockNumber * consecutiveBlockSize; int consecutivePoolSize = consecutiveBlockNumber * consecutiveBlockSize;
static int counter = 0;
//if(pCreateInfo->flags & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) //if(pCreateInfo->flags & VK_COMMAND_POOL_CREATE_TRANSIENT_BIT)
{ {
//use pool allocator //use pool allocator
@ -106,7 +104,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateCommandBuffers)(
//if(cp->usePoolAllocator) //if(cp->usePoolAllocator)
{ {
for(int c = 0; c < pAllocateInfo->commandBufferCount; ++c) for(uint32_t c = 0; c < pAllocateInfo->commandBufferCount; ++c)
{ {
pCommandBuffers[c] = poolAllocate(&cp->pa); pCommandBuffers[c] = poolAllocate(&cp->pa);
@ -153,25 +151,25 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateCommandBuffers)(
pCommandBuffers[c]->perfmonID = 0; pCommandBuffers[c]->perfmonID = 0;
if(pCommandBuffers[c]->binCl.offset == -1) if(pCommandBuffers[c]->binCl.offset == ~0u)
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY; res = VK_ERROR_OUT_OF_HOST_MEMORY;
break; break;
} }
if(pCommandBuffers[c]->handlesCl.offset == -1) if(pCommandBuffers[c]->handlesCl.offset == ~0u)
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY; res = VK_ERROR_OUT_OF_HOST_MEMORY;
break; break;
} }
if(pCommandBuffers[c]->shaderRecCl.offset == -1) if(pCommandBuffers[c]->shaderRecCl.offset == ~0u)
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY; res = VK_ERROR_OUT_OF_HOST_MEMORY;
break; break;
} }
if(pCommandBuffers[c]->uniformsCl.offset == -1) if(pCommandBuffers[c]->uniformsCl.offset == ~0u)
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY; res = VK_ERROR_OUT_OF_HOST_MEMORY;
break; break;
@ -183,7 +181,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateCommandBuffers)(
{ {
//if(cp->usePoolAllocator) //if(cp->usePoolAllocator)
{ {
for(int c = 0; c < pAllocateInfo->commandBufferCount; ++c) for(uint32_t c = 0; c < pAllocateInfo->commandBufferCount; ++c)
{ {
consecutivePoolFree(&cp->cpa, getCPAptrFromOffset(&cp->cpa, pCommandBuffers[c]->binCl.offset), pCommandBuffers[c]->binCl.numBlocks); consecutivePoolFree(&cp->cpa, getCPAptrFromOffset(&cp->cpa, pCommandBuffers[c]->binCl.offset), pCommandBuffers[c]->binCl.numBlocks);
consecutivePoolFree(&cp->cpa, getCPAptrFromOffset(&cp->cpa, pCommandBuffers[c]->handlesCl.offset), pCommandBuffers[c]->handlesCl.numBlocks); consecutivePoolFree(&cp->cpa, getCPAptrFromOffset(&cp->cpa, pCommandBuffers[c]->handlesCl.offset), pCommandBuffers[c]->handlesCl.numBlocks);
@ -283,27 +281,31 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
assert(queue); assert(queue);
for(uint32_t z = 0; z < submitCount; ++z)
{
const VkSubmitInfo* submitInfo = &pSubmits[z];
//TODO this is incorrect //TODO this is incorrect
//see sync.c //see sync.c
//TODO: deal with pSubmits->pWaitDstStageMask //TODO: deal with pSubmits->pWaitDstStageMask
for(int c = 0; c < pSubmits->waitSemaphoreCount; ++c) for(uint32_t c = 0; c < submitInfo->waitSemaphoreCount; ++c)
{ {
sem_wait((sem_t*)pSubmits->pWaitSemaphores[c]); sem_wait((sem_t*)submitInfo->pWaitSemaphores[c]);
} }
for(int c = 0; c < pSubmits->commandBufferCount; ++c) for(uint32_t c = 0; c < submitInfo->commandBufferCount; ++c)
{ {
if(pSubmits->pCommandBuffers[c]->state == CMDBUF_STATE_EXECUTABLE) if(submitInfo->pCommandBuffers[c]->state == CMDBUF_STATE_EXECUTABLE)
{ {
pSubmits->pCommandBuffers[c]->state = CMDBUF_STATE_PENDING; submitInfo->pCommandBuffers[c]->state = CMDBUF_STATE_PENDING;
} }
} }
for(int c = 0; c < pSubmits->commandBufferCount; ++c) for(uint32_t c = 0; c < submitInfo->commandBufferCount; ++c)
{ {
VkCommandBuffer cmdbuf = pSubmits->pCommandBuffers[c]; VkCommandBuffer cmdbuf = submitInfo->pCommandBuffers[c];
if(cmdbuf->binCl.currMarkerOffset == -1) if(cmdbuf->binCl.currMarkerOffset == ~0u)
{ {
//no markers recorded yet, skip //no markers recorded yet, skip
continue; continue;
@ -342,7 +344,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
uint32_t readMSAAdepthStencilImage = marker->readMSAAdepthStencilImage; uint32_t readMSAAdepthStencilImage = marker->readMSAAdepthStencilImage;
//This should not result in an insertion! //This should not result in an insertion!
clFit(cmdbuf, &cmdbuf->handlesCl, 4 * 6); //just to be safe clFit(&cmdbuf->handlesCl, 4 * 6); //just to be safe
uint32_t writeImageIdx = writeImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, writeImage->boundMem->bo) : 0; uint32_t writeImageIdx = writeImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, writeImage->boundMem->bo) : 0;
uint32_t readImageIdx = readImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, readImage->boundMem->bo) : 0; uint32_t readImageIdx = readImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, readImage->boundMem->bo) : 0;
uint32_t writeDepthStencilImageIdx = writeDepthStencilImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, writeDepthStencilImage->boundMem->bo) : 0; uint32_t writeDepthStencilImageIdx = writeDepthStencilImage ? clGetHandleIndex(&cmdbuf->handlesCl, marker->handlesBufOffset + cmdbuf->handlesCl.offset, marker->handlesSize, writeDepthStencilImage->boundMem->bo) : 0;
@ -535,9 +537,9 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
uint32_t perfmonSelector = 0; uint32_t perfmonSelector = 0;
uint32_t* perfmonIDptr = (uint32_t*)marker->perfmonID; uint32_t* perfmonIDptr = (uint32_t*)marker->perfmonID;
if(pSubmits->pNext) if(submitInfo->pNext)
{ {
VkPerformanceQuerySubmitInfoKHR* perfQuerySubmitInfo = pSubmits->pNext; const VkPerformanceQuerySubmitInfoKHR* perfQuerySubmitInfo = submitInfo->pNext;
perfmonSelector = perfQuerySubmitInfo->counterPassIndex; perfmonSelector = perfQuerySubmitInfo->counterPassIndex;
} }
@ -664,42 +666,41 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
assert(submitCl.bo_handle_count > 0); assert(submitCl.bo_handle_count > 0);
sem_wait(queue->seqnoSem);
{ {
//submit ioctl //submit ioctl
vc4_cl_submit(controlFd, &submitCl, &queue->lastEmitSeqno, &queue->lastFinishedSeqno); vc4_cl_submit(controlFd, &submitCl, &queue->lastEmitSeqno, &queue->lastFinishedSeqno);
} }
sem_post(queue->seqnoSem);
//see if it's a sync bug //see if it's a sync bug
//uint64_t timeout = WAIT_TIMEOUT_INFINITE; //uint64_t timeout = WAIT_TIMEOUT_INFINITE;
//vc4_seqno_wait(controlFd, &lastFinishedSeqno, queue->lastEmitSeqno, &timeout); //vc4_seqno_wait(controlFd, &lastFinishedSeqno, queue->lastEmitSeqno, &timeout);
//advance in linked list //advance in linked list
marker = marker->nextMarkerOffset == -1 ? 0 : getCPAptrFromOffset(cmdbuf->binCl.CPA, marker->nextMarkerOffset + cmdbuf->binCl.offset); marker = marker->nextMarkerOffset == ~0u ? 0 : getCPAptrFromOffset(cmdbuf->binCl.CPA, marker->nextMarkerOffset + cmdbuf->binCl.offset);
} }
//CPAdebugPrint(cmdbuf->binCl.CPA); //CPAdebugPrint(cmdbuf->binCl.CPA);
} }
for(int c = 0; c < pSubmits->commandBufferCount; ++c) for(uint32_t c = 0; c < submitInfo->commandBufferCount; ++c)
{ {
if(pSubmits->pCommandBuffers[c]->state == CMDBUF_STATE_PENDING) if(submitInfo->pCommandBuffers[c]->state == CMDBUF_STATE_PENDING)
{ {
if(pSubmits->pCommandBuffers[c]->usageFlags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) if(submitInfo->pCommandBuffers[c]->usageFlags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT)
{ {
pSubmits->pCommandBuffers[c]->state = CMDBUF_STATE_INVALID; submitInfo->pCommandBuffers[c]->state = CMDBUF_STATE_INVALID;
} }
else else
{ {
pSubmits->pCommandBuffers[c]->state = CMDBUF_STATE_EXECUTABLE; submitInfo->pCommandBuffers[c]->state = CMDBUF_STATE_EXECUTABLE;
} }
} }
} }
for(int c = 0; c < pSubmits->signalSemaphoreCount; ++c) for(uint32_t c = 0; c < submitInfo->signalSemaphoreCount; ++c)
{ {
sem_post((sem_t*)pSubmits->pSignalSemaphores[c]); sem_post((sem_t*)submitInfo->pSignalSemaphores[c]);
}
} }
_fence* f = fence; _fence* f = fence;
@ -730,7 +731,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkFreeCommandBuffers)(
_commandPool* cp = (_commandPool*)commandPool; _commandPool* cp = (_commandPool*)commandPool;
for(int c = 0; c < commandBufferCount; ++c) for(uint32_t c = 0; c < commandBufferCount; ++c)
{ {
if(pCommandBuffers[c]) if(pCommandBuffers[c])
{ {
@ -838,6 +839,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkResetCommandPool)(
//TODO reset flag --> free all pool resources //TODO reset flag --> free all pool resources
PROFILEEND(RPIFUNC(vkResetCommandPool)); PROFILEEND(RPIFUNC(vkResetCommandPool));
return VK_SUCCESS;
} }
/* /*
@ -914,6 +917,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkResetCommandBuffer)(
commandBuffer->perfmonID = 0; commandBuffer->perfmonID = 0;
PROFILEEND(RPIFUNC(vkResetCommandBuffer)); PROFILEEND(RPIFUNC(vkResetCommandBuffer));
return VK_SUCCESS;
} }
VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdExecuteCommands)( VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdExecuteCommands)(

View File

@ -182,9 +182,9 @@ uint32_t packVec4IntoABGR8(const float rgba[4])
return res; return res;
} }
int findInstanceExtension(char* name) int findInstanceExtension(const char* name)
{ {
for(int c = 0; c < numInstanceExtensions; ++c) for(uint32_t c = 0; c < numInstanceExtensions; ++c)
{ {
if(strcmp(instanceExtensions[c].extensionName, name) == 0) if(strcmp(instanceExtensions[c].extensionName, name) == 0)
{ {
@ -195,9 +195,9 @@ int findInstanceExtension(char* name)
return -1; return -1;
} }
int findDeviceExtension(char* name) int findDeviceExtension(const char* name)
{ {
for(int c = 0; c < numDeviceExtensions; ++c) for(uint32_t c = 0; c < numDeviceExtensions; ++c)
{ {
if(strcmp(deviceExtensions[c].extensionName, name) == 0) if(strcmp(deviceExtensions[c].extensionName, name) == 0)
{ {
@ -531,17 +531,17 @@ uint32_t ulog2(uint32_t v)
return ret; return ret;
} }
void clFit(VkCommandBuffer cb, ControlList* cl, uint32_t commandSize) void clFit(ControlList* cl, uint32_t commandSize)
{ {
if(!clHasEnoughSpace(cl, commandSize)) if(!clHasEnoughSpace(cl, commandSize))
{ {
uint32_t currSize = cl->nextFreeByteOffset - cl->offset; uint32_t currSize = cl->nextFreeByteOffset - cl->offset;
uint32_t currMarkerOffset = cl->currMarkerOffset - cl->offset; uint32_t currMarkerOffset = cl->currMarkerOffset - cl->offset;
cl->offset = consecutivePoolReAllocate(cl->CPA, getCPAptrFromOffset(cl->CPA, cl->offset), cl->numBlocks); assert(cl->offset != -1); cl->offset = consecutivePoolReAllocate(cl->CPA, getCPAptrFromOffset(cl->CPA, cl->offset), cl->numBlocks); assert(cl->offset != ~0u);
cl->nextFreeByteOffset = cl->offset + currSize; cl->nextFreeByteOffset = cl->offset + currSize;
cl->numBlocks++; cl->numBlocks++;
cl->currMarkerOffset = cl->currMarkerOffset == -1 ? -1 : cl->offset + currMarkerOffset; cl->currMarkerOffset = cl->currMarkerOffset == ~0u ? ~0u : cl->offset + currMarkerOffset;
if(cl->currMarkerOffset != -1) if(cl->currMarkerOffset != ~0u)
{ {
assert(((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->memGuard == 0xDDDDDDDD); assert(((CLMarker*)getCPAptrFromOffset(cl->CPA, cl->currMarkerOffset))->memGuard == 0xDDDDDDDD);
} }

View File

@ -63,7 +63,6 @@ typedef struct VkQueue_T
uint64_t lastEmitSeqno; uint64_t lastEmitSeqno;
uint64_t lastFinishedSeqno; uint64_t lastFinishedSeqno;
_device* dev; _device* dev;
struct sem_t* seqnoSem;
} _queue; } _queue;
typedef struct VkCommandPool_T typedef struct VkCommandPool_T
@ -134,7 +133,7 @@ typedef struct VkDevice_T
VkPhysicalDeviceFeatures enabledFeatures; VkPhysicalDeviceFeatures enabledFeatures;
_physicalDevice* dev; _physicalDevice* dev;
_queue* queues[numQueueFamilies]; _queue* queues[numQueueFamilies];
int numQueues[numQueueFamilies]; uint32_t numQueues[numQueueFamilies];
//emulation resources //emulation resources
VkBuffer emulFsqVertexBuffer; VkBuffer emulFsqVertexBuffer;
@ -548,8 +547,8 @@ typedef struct VkDisplayModeKHR_T
uint32_t getFormatBpp(VkFormat f); uint32_t getFormatBpp(VkFormat f);
uint32_t packVec4IntoABGR8(const float rgba[4]); uint32_t packVec4IntoABGR8(const float rgba[4]);
void createImageBO(_image* i); void createImageBO(_image* i);
int findInstanceExtension(char* name); int findInstanceExtension(const char* name);
int findDeviceExtension(char* name); int findDeviceExtension(const char* name);
uint32_t isLTformat(uint32_t bpp, uint32_t width, uint32_t height); uint32_t isLTformat(uint32_t bpp, uint32_t width, uint32_t height);
void getUTileDimensions(uint32_t bpp, uint32_t* tileW, uint32_t* tileH); void getUTileDimensions(uint32_t bpp, uint32_t* tileW, uint32_t* tileH);
uint32_t roundUp(uint32_t numToRound, uint32_t multiple); uint32_t roundUp(uint32_t numToRound, uint32_t multiple);
@ -583,7 +582,7 @@ uint8_t getTextureDataType(VkFormat format);
uint8_t getMinFilterType(VkFilter minFilter, VkSamplerMipmapMode mipFilter);//, float maxLod); uint8_t getMinFilterType(VkFilter minFilter, VkSamplerMipmapMode mipFilter);//, float maxLod);
uint8_t getWrapMode(VkSamplerAddressMode mode); uint8_t getWrapMode(VkSamplerAddressMode mode);
uint32_t getRenderTargetFormatVC4(VkFormat format); uint32_t getRenderTargetFormatVC4(VkFormat format);
void clFit(VkCommandBuffer cb, ControlList* cl, uint32_t commandSize); void clFit(ControlList* cl, uint32_t commandSize);
void clDump(void* cl, uint32_t size); void clDump(void* cl, uint32_t size);
void setupEmulationResources(VkDevice device); void setupEmulationResources(VkDevice device);
void setupClearEmulationResources(VkDevice device); void setupClearEmulationResources(VkDevice device);

View File

@ -42,24 +42,24 @@ void createFullscreenQuad(VkDevice device, VkBuffer* fsqVertexBuffer, VkDeviceMe
{ //create fsq vertex buffer { //create fsq vertex buffer
unsigned vboSize = sizeof(float) * 4 * 3 * 2; //4 * 3 x vec2 unsigned vboSize = sizeof(float) * 4 * 3 * 2; //4 * 3 x vec2
VkBufferCreateInfo ci = {}; VkBufferCreateInfo ci = {0};
ci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; ci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
ci.size = vboSize; ci.size = vboSize;
ci.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; ci.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
VkResult res = RPIFUNC(vkCreateBuffer)(device, &ci, 0, fsqVertexBuffer); RPIFUNC(vkCreateBuffer)(device, &ci, 0, fsqVertexBuffer);
RPIFUNC(vkGetBufferMemoryRequirements)(device, *fsqVertexBuffer, &mr); RPIFUNC(vkGetBufferMemoryRequirements)(device, *fsqVertexBuffer, &mr);
VkPhysicalDeviceMemoryProperties pdmp; VkPhysicalDeviceMemoryProperties pdmp;
RPIFUNC(vkGetPhysicalDeviceMemoryProperties)(((_device*)device)->dev, &pdmp); RPIFUNC(vkGetPhysicalDeviceMemoryProperties)(((_device*)device)->dev, &pdmp);
VkMemoryAllocateInfo mai = {}; VkMemoryAllocateInfo mai = {0};
mai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; mai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
mai.allocationSize = mr.size; mai.allocationSize = mr.size;
mai.memoryTypeIndex = getMemoryTypeIndex(pdmp, mr.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); mai.memoryTypeIndex = getMemoryTypeIndex(pdmp, mr.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
res = RPIFUNC(vkAllocateMemory)(device, &mai, 0, fsqVertexBufferMemory); RPIFUNC(vkAllocateMemory)(device, &mai, 0, fsqVertexBufferMemory);
float vertices[] = float vertices[] =
{ {
@ -73,11 +73,11 @@ void createFullscreenQuad(VkDevice device, VkBuffer* fsqVertexBuffer, VkDeviceMe
}; };
void* data; void* data;
res = RPIFUNC(vkMapMemory)(device, *fsqVertexBufferMemory, 0, mr.size, 0, &data); RPIFUNC(vkMapMemory)(device, *fsqVertexBufferMemory, 0, mr.size, 0, &data);
memcpy(data, vertices, vboSize); memcpy(data, vertices, vboSize);
RPIFUNC(vkUnmapMemory)(device, *fsqVertexBufferMemory); RPIFUNC(vkUnmapMemory)(device, *fsqVertexBufferMemory);
res = RPIFUNC(vkBindBufferMemory)(device, *fsqVertexBuffer, *fsqVertexBufferMemory, 0); RPIFUNC(vkBindBufferMemory)(device, *fsqVertexBuffer, *fsqVertexBufferMemory, 0);
} }
} }
@ -89,7 +89,7 @@ void createDescriptorPool(VkDevice device, VkDescriptorPool* descriptorPool)
descriptorPoolSizes[1].descriptorCount = 2048; descriptorPoolSizes[1].descriptorCount = 2048;
descriptorPoolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; descriptorPoolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
VkDescriptorPoolCreateInfo descriptorPoolCI = {}; VkDescriptorPoolCreateInfo descriptorPoolCI = {0};
descriptorPoolCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; descriptorPoolCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
descriptorPoolCI.poolSizeCount = 2; descriptorPoolCI.poolSizeCount = 2;
descriptorPoolCI.pPoolSizes = descriptorPoolSizes; descriptorPoolCI.pPoolSizes = descriptorPoolSizes;
@ -106,13 +106,13 @@ void createDescriptorSetLayouts(VkDevice device, VkDescriptorSetLayout* bufferDs
assert(textureDsl); assert(textureDsl);
//create blit dsl //create blit dsl
VkDescriptorSetLayoutBinding setLayoutBinding = {}; VkDescriptorSetLayoutBinding setLayoutBinding = {0};
setLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; setLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
setLayoutBinding.binding = 0; setLayoutBinding.binding = 0;
setLayoutBinding.descriptorCount = 1; setLayoutBinding.descriptorCount = 1;
setLayoutBinding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; setLayoutBinding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
VkDescriptorSetLayoutCreateInfo descriptorLayoutCI = {}; VkDescriptorSetLayoutCreateInfo descriptorLayoutCI = {0};
descriptorLayoutCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; descriptorLayoutCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
descriptorLayoutCI.bindingCount = 1; descriptorLayoutCI.bindingCount = 1;
descriptorLayoutCI.pBindings = &setLayoutBinding; descriptorLayoutCI.pBindings = &setLayoutBinding;
@ -125,7 +125,7 @@ void createDescriptorSetLayouts(VkDevice device, VkDescriptorSetLayout* bufferDs
void createSampler(VkDevice device, VkSampler* nearestTextureSampler, VkSampler* linearTextureSampler) void createSampler(VkDevice device, VkSampler* nearestTextureSampler, VkSampler* linearTextureSampler)
{ {
VkSamplerCreateInfo sampler = {}; VkSamplerCreateInfo sampler = {0};
sampler.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; sampler.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
sampler.magFilter = VK_FILTER_NEAREST; sampler.magFilter = VK_FILTER_NEAREST;
sampler.minFilter = VK_FILTER_NEAREST; sampler.minFilter = VK_FILTER_NEAREST;
@ -160,7 +160,7 @@ void createRendertarget(VkDevice device, uint32_t baseLayer, uint32_t baseMip, u
format = VK_FORMAT_R8G8B8A8_UNORM; format = VK_FORMAT_R8G8B8A8_UNORM;
} }
VkImageViewCreateInfo view = {}; VkImageViewCreateInfo view = {0};
view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
view.viewType = VK_IMAGE_VIEW_TYPE_2D; view.viewType = VK_IMAGE_VIEW_TYPE_2D;
view.format = format; view.format = format;
@ -176,7 +176,7 @@ void createRendertarget(VkDevice device, uint32_t baseLayer, uint32_t baseMip, u
view.image = textureImage; view.image = textureImage;
RPIFUNC(vkCreateImageView)(device, &view, 0, textureView); RPIFUNC(vkCreateImageView)(device, &view, 0, textureView);
VkAttachmentDescription attachmentDescription = {}; VkAttachmentDescription attachmentDescription = {0};
attachmentDescription.format = format; attachmentDescription.format = format;
attachmentDescription.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachmentDescription.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
attachmentDescription.finalLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; attachmentDescription.finalLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
@ -188,7 +188,7 @@ void createRendertarget(VkDevice device, uint32_t baseLayer, uint32_t baseMip, u
VkAttachmentReference colorReference = { 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL }; VkAttachmentReference colorReference = { 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
VkSubpassDescription subpassDescription = {}; VkSubpassDescription subpassDescription = {0};
subpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpassDescription.colorAttachmentCount = 1; subpassDescription.colorAttachmentCount = 1;
subpassDescription.pColorAttachments = &colorReference; subpassDescription.pColorAttachments = &colorReference;
@ -210,7 +210,7 @@ void createRendertarget(VkDevice device, uint32_t baseLayer, uint32_t baseMip, u
dependencies[1].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; dependencies[1].dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
dependencies[1].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT; dependencies[1].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
VkRenderPassCreateInfo renderPassInfo = {}; VkRenderPassCreateInfo renderPassInfo = {0};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
renderPassInfo.attachmentCount = 1; renderPassInfo.attachmentCount = 1;
renderPassInfo.pAttachments = &attachmentDescription; renderPassInfo.pAttachments = &attachmentDescription;
@ -223,7 +223,7 @@ void createRendertarget(VkDevice device, uint32_t baseLayer, uint32_t baseMip, u
VkImageView attachments = *textureView; VkImageView attachments = *textureView;
VkFramebufferCreateInfo framebufferCreateInfo = {}; VkFramebufferCreateInfo framebufferCreateInfo = {0};
framebufferCreateInfo.renderPass = *offscreenRenderPass; framebufferCreateInfo.renderPass = *offscreenRenderPass;
framebufferCreateInfo.attachmentCount = 1; framebufferCreateInfo.attachmentCount = 1;
framebufferCreateInfo.pAttachments = &attachments; framebufferCreateInfo.pAttachments = &attachments;
@ -265,32 +265,32 @@ void createPipeline(VkDevice device, uint32_t needTexcoords, uint32_t numVertUni
vertexInputAttributeDescription[1].format = VK_FORMAT_R32G32_SFLOAT; vertexInputAttributeDescription[1].format = VK_FORMAT_R32G32_SFLOAT;
} }
VkPipelineVertexInputStateCreateInfo vertexInputInfo = {}; VkPipelineVertexInputStateCreateInfo vertexInputInfo = {0};
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputInfo.vertexAttributeDescriptionCount = needTexcoords ? 2 : 1; vertexInputInfo.vertexAttributeDescriptionCount = needTexcoords ? 2 : 1;
vertexInputInfo.pVertexAttributeDescriptions = vertexInputAttributeDescription; vertexInputInfo.pVertexAttributeDescriptions = vertexInputAttributeDescription;
vertexInputInfo.vertexBindingDescriptionCount = 1; vertexInputInfo.vertexBindingDescriptionCount = 1;
vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription; vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription;
VkPipelineInputAssemblyStateCreateInfo pipelineIACreateInfo = {}; VkPipelineInputAssemblyStateCreateInfo pipelineIACreateInfo = {0};
pipelineIACreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; pipelineIACreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
pipelineIACreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; pipelineIACreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
VkPipelineRasterizationStateCreateInfo rastCreateInfo = {}; VkPipelineRasterizationStateCreateInfo rastCreateInfo = {0};
rastCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rastCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rastCreateInfo.polygonMode = VK_POLYGON_MODE_FILL; rastCreateInfo.polygonMode = VK_POLYGON_MODE_FILL;
rastCreateInfo.cullMode = VK_CULL_MODE_NONE; rastCreateInfo.cullMode = VK_CULL_MODE_NONE;
rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rastCreateInfo.lineWidth = 1.0f; rastCreateInfo.lineWidth = 1.0f;
VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {}; VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {0};
pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
VkPipelineColorBlendAttachmentState blendAttachState = {}; VkPipelineColorBlendAttachmentState blendAttachState = {0};
blendAttachState.colorWriteMask = 0xf; blendAttachState.colorWriteMask = 0xf;
blendAttachState.blendEnable = false; blendAttachState.blendEnable = false;
VkPipelineColorBlendStateCreateInfo blendCreateInfo = {}; VkPipelineColorBlendStateCreateInfo blendCreateInfo = {0};
blendCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; blendCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blendCreateInfo.attachmentCount = 1; blendCreateInfo.attachmentCount = 1;
blendCreateInfo.pAttachments = &blendAttachState; blendCreateInfo.pAttachments = &blendAttachState;
@ -320,7 +320,7 @@ void createPipeline(VkDevice device, uint32_t needTexcoords, uint32_t numVertUni
shaderStageCreateInfo[1].module = blitShaderModule; shaderStageCreateInfo[1].module = blitShaderModule;
shaderStageCreateInfo[1].pName = "main"; shaderStageCreateInfo[1].pName = "main";
VkPipelineLayoutCreateInfo pipelineLayoutCI = {}; VkPipelineLayoutCreateInfo pipelineLayoutCI = {0};
pipelineLayoutCI.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutCI.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutCI.setLayoutCount = 1; pipelineLayoutCI.setLayoutCount = 1;
pipelineLayoutCI.pSetLayouts = &blitDsl; pipelineLayoutCI.pSetLayouts = &blitDsl;
@ -330,17 +330,17 @@ void createPipeline(VkDevice device, uint32_t needTexcoords, uint32_t numVertUni
VkDynamicState dynState = VK_DYNAMIC_STATE_VIEWPORT; VkDynamicState dynState = VK_DYNAMIC_STATE_VIEWPORT;
VkPipelineDynamicStateCreateInfo pdsci = {}; VkPipelineDynamicStateCreateInfo pdsci = {0};
pdsci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; pdsci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
pdsci.dynamicStateCount = 1; pdsci.dynamicStateCount = 1;
pdsci.pDynamicStates = &dynState; pdsci.pDynamicStates = &dynState;
VkPipelineViewportStateCreateInfo pvsci = {}; VkPipelineViewportStateCreateInfo pvsci = {0};
pvsci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; pvsci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
pvsci.viewportCount = 0; pvsci.viewportCount = 0;
pvsci.scissorCount = 0; pvsci.scissorCount = 0;
VkGraphicsPipelineCreateInfo pipelineInfo = {}; VkGraphicsPipelineCreateInfo pipelineInfo = {0};
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipelineInfo.stageCount = 2; pipelineInfo.stageCount = 2;
pipelineInfo.pStages = &shaderStageCreateInfo[0]; pipelineInfo.pStages = &shaderStageCreateInfo[0];
@ -356,7 +356,7 @@ void createPipeline(VkDevice device, uint32_t needTexcoords, uint32_t numVertUni
pipelineInfo.pDepthStencilState = &depthStencilState; pipelineInfo.pDepthStencilState = &depthStencilState;
pipelineInfo.layout = *blitPipelineLayout; pipelineInfo.layout = *blitPipelineLayout;
VkResult res = RPIFUNC(vkCreateGraphicsPipelines)(device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, blitPipeline); RPIFUNC(vkCreateGraphicsPipelines)(device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, blitPipeline);
} }
void createBufferToTextureShaderModule(VkDevice device, VkShaderModule* blitShaderModule) void createBufferToTextureShaderModule(VkDevice device, VkShaderModule* blitShaderModule)
@ -507,11 +507,6 @@ void createBufferToTextureShaderModule(VkDevice device, VkShaderModule* blitShad
"sig_unlock_score ; nop = nop(r0, r0) ; nop = nop(r0, r0) ;" "sig_unlock_score ; nop = nop(r0, r0) ; nop = nop(r0, r0) ;"
"\0"; "\0";
char* blit_asm_strings[] =
{
(char*)cs_asm_code, (char*)vs_asm_code, (char*)blit_fs_asm_code, 0
};
VkRpiAssemblyMappingEXT vertexMappings[] = { VkRpiAssemblyMappingEXT vertexMappings[] = {
//vertex shader uniforms //vertex shader uniforms
{ {
@ -600,7 +595,7 @@ void createBufferToTextureShaderModule(VkDevice device, VkShaderModule* blitShad
VkRpiAssemblyMappingEXT* asm_mappings[4] = {}; VkRpiAssemblyMappingEXT* asm_mappings[4] = {};
uint32_t asm_mappings_sizes[4] = {}; uint32_t asm_mappings_sizes[4] = {};
VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {}; VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {0};
shaderModuleCreateInfo.instructions = asm_ptrs; shaderModuleCreateInfo.instructions = asm_ptrs;
shaderModuleCreateInfo.numInstructions = asm_sizes; shaderModuleCreateInfo.numInstructions = asm_sizes;
shaderModuleCreateInfo.mappings = asm_mappings; shaderModuleCreateInfo.mappings = asm_mappings;
@ -645,7 +640,7 @@ void createBufferToTextureShaderModule(VkDevice device, VkShaderModule* blitShad
//words start here //words start here
spirv[5] = 1 << 16; spirv[5] = 1 << 16;
VkShaderModuleCreateInfo smci = {}; VkShaderModuleCreateInfo smci = {0};
smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
smci.codeSize = sizeof(uint32_t)*6; smci.codeSize = sizeof(uint32_t)*6;
smci.pCode = spirv; smci.pCode = spirv;
@ -800,11 +795,6 @@ void createTextureToTextureShaderModule(VkDevice device, VkShaderModule* blitSha
"sig_unlock_score ; nop = nop(r0, r0) ; nop = nop(r0, r0) ;" "sig_unlock_score ; nop = nop(r0, r0) ; nop = nop(r0, r0) ;"
"\0"; "\0";
char* blit_asm_strings[] =
{
(char*)cs_asm_code, (char*)vs_asm_code, (char*)sample_fs_asm_code, 0
};
VkRpiAssemblyMappingEXT vertexMappings[] = { VkRpiAssemblyMappingEXT vertexMappings[] = {
//vertex shader uniforms //vertex shader uniforms
{ {
@ -902,7 +892,7 @@ void createTextureToTextureShaderModule(VkDevice device, VkShaderModule* blitSha
VkRpiAssemblyMappingEXT* asm_mappings[4] = {}; VkRpiAssemblyMappingEXT* asm_mappings[4] = {};
uint32_t asm_mappings_sizes[4] = {}; uint32_t asm_mappings_sizes[4] = {};
VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {}; VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {0};
shaderModuleCreateInfo.instructions = asm_ptrs; shaderModuleCreateInfo.instructions = asm_ptrs;
shaderModuleCreateInfo.numInstructions = asm_sizes; shaderModuleCreateInfo.numInstructions = asm_sizes;
shaderModuleCreateInfo.mappings = asm_mappings; shaderModuleCreateInfo.mappings = asm_mappings;
@ -947,7 +937,7 @@ void createTextureToTextureShaderModule(VkDevice device, VkShaderModule* blitSha
//words start here //words start here
spirv[5] = 1 << 16; spirv[5] = 1 << 16;
VkShaderModuleCreateInfo smci = {}; VkShaderModuleCreateInfo smci = {0};
smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
smci.codeSize = sizeof(uint32_t)*6; smci.codeSize = sizeof(uint32_t)*6;
smci.pCode = spirv; smci.pCode = spirv;
@ -1001,7 +991,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdCopyBufferToImage)(
uint32_t pixelBpp = getFormatBpp(img->format); uint32_t pixelBpp = getFormatBpp(img->format);
VkBufferView texelBufferView; VkBufferView texelBufferView;
VkBufferViewCreateInfo bvci = {}; VkBufferViewCreateInfo bvci = {0};
bvci.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; bvci.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
bvci.buffer = buf; bvci.buffer = buf;
bvci.format = img->format; bvci.format = img->format;
@ -1017,14 +1007,14 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdCopyBufferToImage)(
VkPipelineLayout blitPipelineLayout; VkPipelineLayout blitPipelineLayout;
//create blit descriptor set //create blit descriptor set
VkDescriptorSetAllocateInfo allocInfo = {}; VkDescriptorSetAllocateInfo allocInfo = {0};
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
allocInfo.descriptorPool = device->emulDescriptorPool; allocInfo.descriptorPool = device->emulDescriptorPool;
allocInfo.descriptorSetCount = 1; allocInfo.descriptorSetCount = 1;
allocInfo.pSetLayouts = &device->emulBufferDsl; allocInfo.pSetLayouts = &device->emulBufferDsl;
RPIFUNC(vkAllocateDescriptorSets)(device, &allocInfo, &blitDescriptorSet); RPIFUNC(vkAllocateDescriptorSets)(device, &allocInfo, &blitDescriptorSet);
VkWriteDescriptorSet writeDescriptorSet = {}; VkWriteDescriptorSet writeDescriptorSet = {0};
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeDescriptorSet.dstSet = blitDescriptorSet; writeDescriptorSet.dstSet = blitDescriptorSet;
writeDescriptorSet.dstBinding = 0; writeDescriptorSet.dstBinding = 0;
@ -1042,7 +1032,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdCopyBufferToImage)(
.color = { 1.0f, 0.0f, 1.0f, 1.0f } .color = { 1.0f, 0.0f, 1.0f, 1.0f }
}; };
VkRenderPassBeginInfo renderPassInfo = {}; VkRenderPassBeginInfo renderPassInfo = {0};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassInfo.renderArea.offset.x = 0; renderPassInfo.renderArea.offset.x = 0;
renderPassInfo.renderArea.offset.y = 0; renderPassInfo.renderArea.offset.y = 0;
@ -1057,7 +1047,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdCopyBufferToImage)(
RPIFUNC(vkCmdBindPipeline)(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, blitPipeline); RPIFUNC(vkCmdBindPipeline)(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, blitPipeline);
VkViewport vp = {}; VkViewport vp = {0};
vp.x = 0.0f; vp.x = 0.0f;
vp.y = 0.0f; vp.y = 0.0f;
vp.width = (float)width; vp.width = (float)width;
@ -1154,7 +1144,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
VkPipelineLayout blitPipelineLayout; VkPipelineLayout blitPipelineLayout;
VkSampler mipSampler; VkSampler mipSampler;
VkSamplerCreateInfo samplerCI = {}; VkSamplerCreateInfo samplerCI = {0};
samplerCI.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerCI.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
samplerCI.magFilter = filter == VK_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; samplerCI.magFilter = filter == VK_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
samplerCI.minFilter = filter == VK_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; samplerCI.minFilter = filter == VK_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
@ -1166,9 +1156,8 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
samplerCI.compareOp = VK_COMPARE_OP_NEVER; samplerCI.compareOp = VK_COMPARE_OP_NEVER;
samplerCI.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; samplerCI.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
RPIFUNC(vkCreateSampler)(device, &samplerCI, 0, &mipSampler); RPIFUNC(vkCreateSampler)(device, &samplerCI, 0, &mipSampler);
_sampler* s = mipSampler;
VkImageViewCreateInfo view = {}; VkImageViewCreateInfo view = {0};
view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
view.viewType = VK_IMAGE_VIEW_TYPE_2D; view.viewType = VK_IMAGE_VIEW_TYPE_2D;
view.format = srcImg->format; view.format = srcImg->format;
@ -1181,7 +1170,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
RPIFUNC(vkCreateImageView)(device, &view, 0, &srcTextureView); RPIFUNC(vkCreateImageView)(device, &view, 0, &srcTextureView);
//create blit descriptor set //create blit descriptor set
VkDescriptorSetAllocateInfo allocInfo = {}; VkDescriptorSetAllocateInfo allocInfo = {0};
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
allocInfo.descriptorPool = device->emulDescriptorPool; allocInfo.descriptorPool = device->emulDescriptorPool;
allocInfo.descriptorSetCount = 1; allocInfo.descriptorSetCount = 1;
@ -1193,7 +1182,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
imageInfo.sampler = mipSampler; imageInfo.sampler = mipSampler;
VkWriteDescriptorSet writeDescriptorSet = {}; VkWriteDescriptorSet writeDescriptorSet = {0};
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeDescriptorSet.dstSet = blitDescriptorSet; writeDescriptorSet.dstSet = blitDescriptorSet;
writeDescriptorSet.dstBinding = 0; writeDescriptorSet.dstBinding = 0;
@ -1211,7 +1200,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
.color = { 1.0f, 0.0f, 1.0f, 1.0f } .color = { 1.0f, 0.0f, 1.0f, 1.0f }
}; };
VkRenderPassBeginInfo renderPassInfo = {}; VkRenderPassBeginInfo renderPassInfo = {0};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassInfo.renderArea.offset.x = 0; renderPassInfo.renderArea.offset.x = 0;
renderPassInfo.renderArea.offset.y = 0; renderPassInfo.renderArea.offset.y = 0;
@ -1226,7 +1215,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdBlitImage)(
RPIFUNC(vkCmdBindPipeline)(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, blitPipeline); RPIFUNC(vkCmdBindPipeline)(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, blitPipeline);
VkViewport vp = {}; VkViewport vp = {0};
vp.x = (float)pRegions[c].dstOffsets[0].x; vp.x = (float)pRegions[c].dstOffsets[0].x;
vp.y = (float)pRegions[c].dstOffsets[0].y; vp.y = (float)pRegions[c].dstOffsets[0].y;
vp.width = (float)dstWidth; vp.width = (float)dstWidth;

View File

@ -47,6 +47,9 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDescriptorPool)(
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
texelBufferDescriptorCount += pCreateInfo->pPoolSizes[c].descriptorCount; texelBufferDescriptorCount += pCreateInfo->pPoolSizes[c].descriptorCount;
break; break;
default:
assert(0);
break;
} }
} }
@ -154,6 +157,9 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateDescriptorSets)(
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
texelBufferDescriptorCount += dsl->bindings[d].descriptorCount; texelBufferDescriptorCount += dsl->bindings[d].descriptorCount;
break; break;
default:
assert(0);
break;
} }
} }
@ -219,6 +225,9 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkAllocateDescriptorSets)(
ds->texelBufferDescriptors[texelBufferDescriptorCounter].stageFlags = dsl->bindings[d].stageFlags; ds->texelBufferDescriptors[texelBufferDescriptorCounter].stageFlags = dsl->bindings[d].stageFlags;
texelBufferDescriptorCounter += dsl->bindings[d].descriptorCount; texelBufferDescriptorCounter += dsl->bindings[d].descriptorCount;
break; break;
default:
assert(0);
break;
} }
} }
} }
@ -326,6 +335,11 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkUpdateDescriptorSets)(
} }
break; break;
} }
default:
{
assert(0);
break;
}
} }
} }
@ -506,6 +520,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDescriptorUpdateTemplate)(
PROFILESTART(RPIFUNC(vkCreateDescriptorUpdateTemplate)); PROFILESTART(RPIFUNC(vkCreateDescriptorUpdateTemplate));
//TODO //TODO
PROFILEEND(RPIFUNC(vkCreateDescriptorUpdateTemplate)); PROFILEEND(RPIFUNC(vkCreateDescriptorUpdateTemplate));
return VK_SUCCESS;
} }
VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkDestroyDescriptorUpdateTemplate)( VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkDestroyDescriptorUpdateTemplate)(

View File

@ -123,10 +123,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkEnumerateDeviceExtensionProperties)(
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pPropertyCount; uint32_t arraySize = *pPropertyCount;
int elementsWritten = min(numDeviceExtensions, arraySize); uint32_t elementsWritten = min(numDeviceExtensions, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pProperties[c] = deviceExtensions[c]; pProperties[c] = deviceExtensions[c];
} }
@ -199,10 +199,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkEnumeratePhysicalDeviceQueueFamilyPerfo
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pCounterCount; uint32_t arraySize = *pCounterCount;
int elementsWritten = min(numPerformanceCounterTypes, arraySize); uint32_t elementsWritten = min(numPerformanceCounterTypes, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pCounters[c] = performanceCounterTypes[c]; pCounters[c] = performanceCounterTypes[c];
pCounterDescriptions[c] = performanceCounterDescriptions[c]; pCounterDescriptions[c] = performanceCounterDescriptions[c];
@ -260,7 +260,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
assert(pCreateInfo); assert(pCreateInfo);
//check for enabled extensions //check for enabled extensions
for(int c = 0; c < pCreateInfo->enabledExtensionCount; ++c) for(uint32_t c = 0; c < pCreateInfo->enabledExtensionCount; ++c)
{ {
int findres = findDeviceExtension(pCreateInfo->ppEnabledExtensionNames[c]); int findres = findDeviceExtension(pCreateInfo->ppEnabledExtensionNames[c]);
if(findres == -1) if(findres == -1)
@ -276,7 +276,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
if(requestedFeatures) if(requestedFeatures)
{ {
for(int c = 0; c < numFeatures; ++c) for(uint32_t c = 0; c < numFeatures; ++c)
{ {
if(requestedFeatures[c] && !supportedFeatures[c]) if(requestedFeatures[c] && !supportedFeatures[c])
{ {
@ -299,7 +299,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
(*pDevice)->numEnabledExtensions = 0; (*pDevice)->numEnabledExtensions = 0;
for(int c = 0; c < pCreateInfo->enabledExtensionCount; ++c) for(uint32_t c = 0; c < pCreateInfo->enabledExtensionCount; ++c)
{ {
int findres = findDeviceExtension(pCreateInfo->ppEnabledExtensionNames[c]); int findres = findDeviceExtension(pCreateInfo->ppEnabledExtensionNames[c]);
if(findres > -1) if(findres > -1)
@ -311,7 +311,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
if(requestedFeatures) if(requestedFeatures)
{ {
for(int c = 0; c < numFeatures; ++c) for(uint32_t c = 0; c < numFeatures; ++c)
{ {
if(requestedFeatures[c] && !supportedFeatures[c]) if(requestedFeatures[c] && !supportedFeatures[c])
{ {
@ -330,14 +330,14 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
//layers ignored per spec //layers ignored per spec
//pCreateInfo->enabledLayerCount //pCreateInfo->enabledLayerCount
for(int c = 0; c < numQueueFamilies; ++c) for(uint32_t c = 0; c < numQueueFamilies; ++c)
{ {
(*pDevice)->queues[c] = 0; (*pDevice)->queues[c] = 0;
} }
if(pCreateInfo->queueCreateInfoCount > 0) if(pCreateInfo->queueCreateInfoCount > 0)
{ {
for(int c = 0; c < pCreateInfo->queueCreateInfoCount; ++c) for(uint32_t c = 0; c < pCreateInfo->queueCreateInfoCount; ++c)
{ {
(*pDevice)->queues[pCreateInfo->pQueueCreateInfos[c].queueFamilyIndex] = ALLOCATE(sizeof(_queue)*pCreateInfo->pQueueCreateInfos[c].queueCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); (*pDevice)->queues[pCreateInfo->pQueueCreateInfos[c].queueFamilyIndex] = ALLOCATE(sizeof(_queue)*pCreateInfo->pQueueCreateInfos[c].queueCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@ -347,17 +347,13 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDevice)(
return VK_ERROR_OUT_OF_HOST_MEMORY; return VK_ERROR_OUT_OF_HOST_MEMORY;
} }
for(int d = 0; d < pCreateInfo->pQueueCreateInfos[c].queueCount; ++d) for(uint32_t d = 0; d < pCreateInfo->pQueueCreateInfos[c].queueCount; ++d)
{ {
_queue* q = &(*pDevice)->queues[pCreateInfo->pQueueCreateInfos[c].queueFamilyIndex][d]; _queue* q = &(*pDevice)->queues[pCreateInfo->pQueueCreateInfos[c].queueFamilyIndex][d];
q->lastEmitSeqno = 0; q->lastEmitSeqno = 0;
q->lastFinishedSeqno = 0; q->lastFinishedSeqno = 0;
q->dev = *pDevice; q->dev = *pDevice;
q->seqnoSem = ALLOCATE(sizeof(sem_t), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
sem_init(q->seqnoSem, 0, 0);
sem_post(q->seqnoSem);
set_loader_magic_value(&q->loaderData); set_loader_magic_value(&q->loaderData);
} }
@ -430,11 +426,10 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkDestroyDevice)(
if(dev) if(dev)
{ {
for(int c = 0; c < numQueueFamilies; ++c) for(uint32_t c = 0; c < numQueueFamilies; ++c)
{ {
for(int d = 0; d < dev->numQueues[c]; ++d) for(uint32_t d = 0; d < dev->numQueues[c]; ++d)
{ {
FREE(dev->queues[d]->seqnoSem);
FREE(dev->queues[d]); FREE(dev->queues[d]);
} }
} }
@ -547,7 +542,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkGetPhysicalDeviceProperties2)(
VkPhysicalDeviceDriverPropertiesKHR* ptr = pProperties->pNext; VkPhysicalDeviceDriverPropertiesKHR* ptr = pProperties->pNext;
if(ptr->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR) if(ptr->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR)
{ {
ptr->driverID = 0x525049564b; //RPIVK in hex ptr->driverID = 0x5250564b; //RPVK in hex
const char* driverName = "RPi VK"; const char* driverName = "RPi VK";
const char* driverInfo = ""; //TODO maybe version number, git info? const char* driverInfo = ""; //TODO maybe version number, git info?
strcpy(ptr->driverName, driverName); strcpy(ptr->driverName, driverName);

View File

@ -55,7 +55,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//if(cb->lineWidthDirty) //if(cb->lineWidthDirty)
{ {
//Line width //Line width
clFit(commandBuffer, &commandBuffer->binCl, V3D21_LINE_WIDTH_length); clFit(&commandBuffer->binCl, V3D21_LINE_WIDTH_length);
clInsertLineWidth(&commandBuffer->binCl, cb->graphicsPipeline->lineWidth); clInsertLineWidth(&commandBuffer->binCl, cb->graphicsPipeline->lineWidth);
cb->lineWidthDirty = 0; cb->lineWidthDirty = 0;
@ -64,7 +64,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//if(cb->viewportDirty) //if(cb->viewportDirty)
{ {
//Clip Window //Clip Window
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIP_WINDOW_length); clFit(&commandBuffer->binCl, V3D21_CLIP_WINDOW_length);
clInsertClipWindow(&commandBuffer->binCl, clInsertClipWindow(&commandBuffer->binCl,
vp.width, vp.width,
vp.height, vp.height,
@ -73,11 +73,11 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//Vulkan conventions, Y flipped [1...-1] bottom->top //Vulkan conventions, Y flipped [1...-1] bottom->top
//Clipper XY Scaling //Clipper XY Scaling
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIPPER_XY_SCALING_length); clFit(&commandBuffer->binCl, V3D21_CLIPPER_XY_SCALING_length);
clInsertClipperXYScaling(&commandBuffer->binCl, (float)(vp.width) * 0.5f * 16.0f, 1.0f * (float)(vp.height) * 0.5f * 16.0f); clInsertClipperXYScaling(&commandBuffer->binCl, (float)(vp.width) * 0.5f * 16.0f, 1.0f * (float)(vp.height) * 0.5f * 16.0f);
//Viewport Offset //Viewport Offset
clFit(commandBuffer, &commandBuffer->binCl, V3D21_VIEWPORT_OFFSET_length); clFit(&commandBuffer->binCl, V3D21_VIEWPORT_OFFSET_length);
clInsertViewPortOffset(&commandBuffer->binCl, vp.width * 0.5f + vp.x, vp.height * 0.5f + vp.y); clInsertViewPortOffset(&commandBuffer->binCl, vp.width * 0.5f + vp.x, vp.height * 0.5f + vp.y);
cb->viewportDirty = 0; cb->viewportDirty = 0;
@ -86,7 +86,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//if(cb->depthBiasDirty || cb->depthBoundsDirty) //if(cb->depthBiasDirty || cb->depthBoundsDirty)
{ {
//Configuration Bits //Configuration Bits
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CONFIGURATION_BITS_length); clFit(&commandBuffer->binCl, V3D21_CONFIGURATION_BITS_length);
clInsertConfigurationBits(&commandBuffer->binCl, clInsertConfigurationBits(&commandBuffer->binCl,
1, //earlyz updates enable 1, //earlyz updates enable
cb->graphicsPipeline->depthTestEnable, //earlyz enable cb->graphicsPipeline->depthTestEnable, //earlyz enable
@ -102,7 +102,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
!(cb->graphicsPipeline->cullMode & VK_CULL_MODE_BACK_BIT), //enable back facing primitives !(cb->graphicsPipeline->cullMode & VK_CULL_MODE_BACK_BIT), //enable back facing primitives
!(cb->graphicsPipeline->cullMode & VK_CULL_MODE_FRONT_BIT)); //enable front facing primitives !(cb->graphicsPipeline->cullMode & VK_CULL_MODE_FRONT_BIT)); //enable front facing primitives
clFit(commandBuffer, &commandBuffer->binCl, V3D21_DEPTH_OFFSET_length); clFit(&commandBuffer->binCl, V3D21_DEPTH_OFFSET_length);
float depthBiasConstant = cb->graphicsPipeline->depthBiasConstantFactor; float depthBiasConstant = cb->graphicsPipeline->depthBiasConstantFactor;
float depthBiasSlope = cb->graphicsPipeline->depthBiasSlopeFactor; float depthBiasSlope = cb->graphicsPipeline->depthBiasSlopeFactor;
@ -122,7 +122,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//Vulkan conventions, we expect the resulting NDC space Z axis to be in range [0...1] close->far //Vulkan conventions, we expect the resulting NDC space Z axis to be in range [0...1] close->far
//cb->graphicsPipeline->minDepthBounds; //cb->graphicsPipeline->minDepthBounds;
//Clipper Z Scale and Offset //Clipper Z Scale and Offset
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIPPER_Z_SCALE_AND_OFFSET_length); clFit(&commandBuffer->binCl, V3D21_CLIPPER_Z_SCALE_AND_OFFSET_length);
//offset, scale //offset, scale
float scale = vp.maxDepth - vp.minDepth; float scale = vp.maxDepth - vp.minDepth;
float offset = vp.minDepth; float offset = vp.minDepth;
@ -133,16 +133,16 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
} }
//Point size //Point size
clFit(commandBuffer, &commandBuffer->binCl, V3D21_POINT_SIZE_length); clFit(&commandBuffer->binCl, V3D21_POINT_SIZE_length);
clInsertPointSize(&commandBuffer->binCl, 1.0f); clInsertPointSize(&commandBuffer->binCl, 1.0f);
//TODO? //TODO?
//Flat Shade Flags //Flat Shade Flags
clFit(commandBuffer, &commandBuffer->binCl, V3D21_FLAT_SHADE_FLAGS_length); clFit(&commandBuffer->binCl, V3D21_FLAT_SHADE_FLAGS_length);
clInsertFlatShadeFlags(&commandBuffer->binCl, 0); clInsertFlatShadeFlags(&commandBuffer->binCl, 0);
//GL Shader State //GL Shader State
clFit(commandBuffer, &commandBuffer->binCl, V3D21_GL_SHADER_STATE_length); clFit(&commandBuffer->binCl, V3D21_GL_SHADER_STATE_length);
clInsertShaderState(&commandBuffer->binCl, clInsertShaderState(&commandBuffer->binCl,
0, //shader state record address 0, //shader state record address
0, //extended shader state record 0, //extended shader state record
@ -200,7 +200,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
}; };
commandBuffer->shaderRecCount++; commandBuffer->shaderRecCount++;
clFit(commandBuffer, &commandBuffer->shaderRecCl, 12 * sizeof(uint32_t) + 104 + 8 * 32); clFit(&commandBuffer->shaderRecCl, 12 * sizeof(uint32_t) + 104 + 8 * 32);
ControlList relocCl = commandBuffer->shaderRecCl; ControlList relocCl = commandBuffer->shaderRecCl;
uint32_t attribCount = 0; uint32_t attribCount = 0;
@ -237,12 +237,12 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
//number of attribs //number of attribs
//3 is the number of type of possible shaders //3 is the number of type of possible shaders
for(int c = 0; c < (3 + attribCount)*4; ++c) for(uint32_t c = 0; c < (3 + attribCount)*4; ++c)
{ {
clInsertNop(&commandBuffer->shaderRecCl); clInsertNop(&commandBuffer->shaderRecCl);
} }
clFit(commandBuffer, &commandBuffer->handlesCl, (3 + 8)*4); clFit(&commandBuffer->handlesCl, (3 + 8)*4);
clInsertShaderRecord(&commandBuffer->shaderRecCl, clInsertShaderRecord(&commandBuffer->shaderRecCl,
&relocCl, &relocCl,
&commandBuffer->handlesCl, &commandBuffer->handlesCl,
@ -365,11 +365,11 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
di += mapping.descriptorArrayElement; di += mapping.descriptorArrayElement;
//emit reloc for texture BO //emit reloc for texture BO
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, di->imageView->image->boundMem->bo); uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, di->imageView->image->boundMem->bo);
//emit tex bo reloc index //emit tex bo reloc index
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, &idx); clInsertData(&commandBuffer->uniformsCl, 4, &idx);
numFragUniformReads++; numFragUniformReads++;
@ -384,11 +384,11 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
db += mapping.descriptorArrayElement; db += mapping.descriptorArrayElement;
//emit reloc for BO //emit reloc for BO
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, db->buffer->boundMem->bo); uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, db->buffer->boundMem->bo);
//emit bo reloc index //emit bo reloc index
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, &idx); clInsertData(&commandBuffer->uniformsCl, 4, &idx);
numFragUniformReads++; numFragUniformReads++;
@ -401,11 +401,11 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
dtb += mapping.descriptorArrayElement; dtb += mapping.descriptorArrayElement;
//emit reloc for BO //emit reloc for BO
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, dtb->bufferView->buffer->boundMem->bo); uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, dtb->bufferView->buffer->boundMem->bo);
//emit bo reloc index //emit bo reloc index
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, &idx); clInsertData(&commandBuffer->uniformsCl, 4, &idx);
numFragUniformReads++; numFragUniformReads++;
@ -428,7 +428,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
{ {
numFragUniformReads++; numFragUniformReads++;
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferPixel + mapping.resourceOffset); clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferPixel + mapping.resourceOffset);
} }
else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR) else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR)
@ -493,7 +493,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
numFragUniformReads += size >> 2; numFragUniformReads += size >> 2;
//emit tex parameters //emit tex parameters
clFit(commandBuffer, &commandBuffer->uniformsCl, size); clFit(&commandBuffer->uniformsCl, size);
clInsertData(&commandBuffer->uniformsCl, size, params); clInsertData(&commandBuffer->uniformsCl, size, params);
} }
} }
@ -517,7 +517,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
{ {
numVertUniformReads++; numVertUniformReads++;
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferVertex + mapping.resourceOffset); clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferVertex + mapping.resourceOffset);
} }
else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR) else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR)
@ -549,7 +549,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
{ {
numCoordUniformReads++; numCoordUniformReads++;
clFit(commandBuffer, &commandBuffer->uniformsCl, 4); clFit(&commandBuffer->uniformsCl, 4);
clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferVertex + mapping.resourceOffset); clInsertData(&commandBuffer->uniformsCl, 4, cb->pushConstantBufferVertex + mapping.resourceOffset);
} }
else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR) else if(mapping.mappingType == VK_RPI_ASSEMBLY_MAPPING_TYPE_DESCRIPTOR)
@ -591,7 +591,7 @@ void RPIFUNC(vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uin
_commandBuffer* cb = commandBuffer; _commandBuffer* cb = commandBuffer;
//Submit draw call: vertex Array Primitives //Submit draw call: vertex Array Primitives
clFit(commandBuffer, &commandBuffer->binCl, V3D21_VERTEX_ARRAY_PRIMITIVES_length); clFit(&commandBuffer->binCl, V3D21_VERTEX_ARRAY_PRIMITIVES_length);
clInsertVertexArrayPrimitives(&commandBuffer->binCl, firstVertex, vertexCount, getPrimitiveMode(cb->graphicsPipeline->topology)); clInsertVertexArrayPrimitives(&commandBuffer->binCl, firstVertex, vertexCount, getPrimitiveMode(cb->graphicsPipeline->topology));
((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->numDrawCallsSubmitted++; ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->numDrawCallsSubmitted++;
@ -623,13 +623,13 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdDrawIndexed)(
_commandBuffer* cb = commandBuffer; _commandBuffer* cb = commandBuffer;
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, cb->indexBuffer->boundMem->bo); uint32_t idx = clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, cb->indexBuffer->boundMem->bo);
clInsertGEMRelocations(&commandBuffer->binCl, idx, 0); clInsertGEMRelocations(&commandBuffer->binCl, idx, 0);
//Submit draw call: vertex Array Primitives //Submit draw call: vertex Array Primitives
clFit(commandBuffer, &commandBuffer->binCl, V3D21_VERTEX_ARRAY_PRIMITIVES_length); clFit(&commandBuffer->binCl, V3D21_VERTEX_ARRAY_PRIMITIVES_length);
clInsertIndexedPrimitiveList(&commandBuffer->binCl, clInsertIndexedPrimitiveList(&commandBuffer->binCl,
maxIndex, //max index maxIndex, //max index

View File

@ -1,5 +1,7 @@
#include "fifo.h" #include "fifo.h"
#include <string.h>
#if defined (__cplusplus) #if defined (__cplusplus)
extern "C" { extern "C" {
#endif #endif

View File

@ -5,9 +5,9 @@
#include "declarations.h" #include "declarations.h"
#if EXPOSE_DRIVER == 0 #if EXPOSE_DRIVER == 0
#define RETFUNC(f) if(!strcmp(pName, #f)) return &rpi_##f #define RETFUNC(f) if(!strcmp(pName, #f)) return (PFN_vkVoidFunction)&rpi_##f
#else #else
#define RETFUNC(f) if(!strcmp(pName, #f)) return &f #define RETFUNC(f) if(!strcmp(pName, #f)) return (PFN_vkVoidFunction)&f
#endif #endif
static uint32_t loaderVersion = -1; static uint32_t loaderVersion = -1;
@ -24,7 +24,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName) VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
{ {
if(loaderVersion == -1) if(loaderVersion == ~0u)
{ {
//dealing with legacy ICD loader, as vk_icdNegotiateLoaderICDInterfaceVersion has not been called //dealing with legacy ICD loader, as vk_icdNegotiateLoaderICDInterfaceVersion has not been called
loaderVersion = 1; loaderVersion = 1;
@ -74,10 +74,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkEnumerateInstanceExtensionProperties)(
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pPropertyCount; uint32_t arraySize = *pPropertyCount;
int elementsWritten = min(numInstanceExtensions, arraySize); uint32_t elementsWritten = min(numInstanceExtensions, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pProperties[c] = instanceExtensions[c]; pProperties[c] = instanceExtensions[c];
} }
@ -131,7 +131,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateInstance)(
assert(pCreateInfo->ppEnabledExtensionNames); assert(pCreateInfo->ppEnabledExtensionNames);
} }
for(int c = 0; c < pCreateInfo->enabledExtensionCount; ++c) for(uint32_t c = 0; c < pCreateInfo->enabledExtensionCount; ++c)
{ {
int findres = findInstanceExtension(pCreateInfo->ppEnabledExtensionNames[c]); int findres = findInstanceExtension(pCreateInfo->ppEnabledExtensionNames[c]);
if(findres > -1) if(findres > -1)

View File

@ -2,7 +2,7 @@
#include "kernelInterface.h" #include "kernelInterface.h"
#include <stdatomic.h> #include <stdatomic.h>
atomic_int refCounter = 0; static atomic_int refCounter = 0;
int controlFd = 0; int controlFd = 0;
//int renderFd = 0; //int renderFd = 0;
@ -26,7 +26,7 @@ int openIoctl()
} }
}*/ }*/
++refCounter; refCounter++;
return 0; return 0;
} }
@ -486,7 +486,7 @@ void vc4_bo_label(int fd, uint32_t bo, const char* name)
assert(fd); assert(fd);
assert(bo); assert(bo);
char* str = name; const char* str = name;
if(!str) str = ""; if(!str) str = "";
struct drm_vc4_label_bo label = { struct drm_vc4_label_bo label = {
@ -690,12 +690,12 @@ void vc4_print_hang_state(int fd)
fprintf(stderr, "ct0ra0: %u, ct1ra0: %u\n", arg.ct0ra0, arg.ct1ra0); fprintf(stderr, "ct0ra0: %u, ct1ra0: %u\n", arg.ct0ra0, arg.ct1ra0);
fprintf(stderr, "bpca: %u, bpcs: %u\n", arg.bpca, arg.bpcs); fprintf(stderr, "bpca: %u, bpcs: %u\n", arg.bpca, arg.bpcs);
fprintf(stderr, "bpoa: %u, bpos: %u\n", arg.bpoa, arg.bpos); fprintf(stderr, "bpoa: %u, bpos: %u\n", arg.bpoa, arg.bpos);
fprintf(stderr, "vpmbase: %u: %u\n", arg.vpmbase); fprintf(stderr, "vpmbase: %u\n", arg.vpmbase);
fprintf(stderr, "dbge: %u: %u\n", arg.dbge); fprintf(stderr, "dbge: %u\n", arg.dbge);
fprintf(stderr, "fdbgo: %u: %u\n", arg.fdbgo); fprintf(stderr, "fdbgo: %u\n", arg.fdbgo);
fprintf(stderr, "fdbgb: %u: %u\n", arg.fdbgb); fprintf(stderr, "fdbgb: %u\n", arg.fdbgb);
fprintf(stderr, "fdbgr: %u: %u\n", arg.fdbgr); fprintf(stderr, "fdbgr: %u\n", arg.fdbgr);
fprintf(stderr, "fdbgs: %u: %u\n", arg.fdbgs); fprintf(stderr, "fdbgs: %u\n", arg.fdbgs);
fprintf(stderr, "errstat: %u: %u\n", arg.errstat); fprintf(stderr, "errstat: %u\n", arg.errstat);
} }
} }

View File

@ -41,20 +41,20 @@ void RPIFUNC(vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevic
//printf("%i\n", amount); //printf("%i\n", amount);
//all heaps share the same memory //all heaps share the same memory
for(int c = 0; c < numMemoryHeaps; ++c) for(uint32_t c = 0; c < numMemoryHeaps; ++c)
{ {
memoryHeaps[c].size = amount * 1000; //kB to B memoryHeaps[c].size = amount * 1000; //kB to B
} }
} }
pMemoryProperties->memoryTypeCount = numMemoryTypes; pMemoryProperties->memoryTypeCount = numMemoryTypes;
for(int c = 0; c < numMemoryTypes; ++c) for(uint32_t c = 0; c < numMemoryTypes; ++c)
{ {
pMemoryProperties->memoryTypes[c] = memoryTypes[c]; pMemoryProperties->memoryTypes[c] = memoryTypes[c];
} }
pMemoryProperties->memoryHeapCount = numMemoryHeaps; pMemoryProperties->memoryHeapCount = numMemoryHeaps;
for(int c = 0; c < numMemoryHeaps; ++c) for(uint32_t c = 0; c < numMemoryHeaps; ++c)
{ {
pMemoryProperties->memoryHeaps[c] = memoryHeaps[c]; pMemoryProperties->memoryHeaps[c] = memoryHeaps[c];
} }

View File

@ -87,7 +87,7 @@ void modeset_enum_displays(int fd, uint32_t* numDisplays, modeset_display* displ
uint32_t tmpNumDisplays = 0; uint32_t tmpNumDisplays = 0;
modeset_display tmpDisplays[16]; modeset_display tmpDisplays[16];
for(uint32_t c = 0; c < resPtr->count_connectors; ++c) for(int c = 0; c < resPtr->count_connectors; ++c)
{ {
drmModeConnectorPtr connPtr = drmModeGetConnector(fd, resPtr->connectors[c]); drmModeConnectorPtr connPtr = drmModeGetConnector(fd, resPtr->connectors[c]);
@ -138,7 +138,7 @@ void modeset_enum_modes_for_display(int fd, uint32_t display, uint32_t* numModes
uint32_t tmpNumModes = 0; uint32_t tmpNumModes = 0;
modeset_display_mode tmpModes[1024]; modeset_display_mode tmpModes[1024];
for(uint32_t c = 0; c < connPtr->count_modes; ++c) for(int c = 0; c < connPtr->count_modes; ++c)
{ {
uint32_t found = 0; uint32_t found = 0;
for(uint32_t d = 0; d < tmpNumModes; ++d) for(uint32_t d = 0; d < tmpNumModes; ++d)
@ -296,7 +296,7 @@ void modeset_create_surface_for_mode(int fd, uint32_t display, uint32_t mode, mo
// TODO if we were to output to multiple displays, we'd need to make sure we don't use a CRTC // TODO if we were to output to multiple displays, we'd need to make sure we don't use a CRTC
// that we'd be using to drive the other screen // that we'd be using to drive the other screen
for(uint32_t c = 0; c < connPtr->count_encoders; ++c) for(int c = 0; c < connPtr->count_encoders; ++c)
{ {
drmModeEncoderPtr encPtr = drmModeGetEncoder(fd, connPtr->encoders[c]); drmModeEncoderPtr encPtr = drmModeGetEncoder(fd, connPtr->encoders[c]);
@ -526,7 +526,7 @@ void modeset_debug_print(int fd)
printf("res max width %i height %i\n", resPtr->max_width, resPtr->max_height); printf("res max width %i height %i\n", resPtr->max_width, resPtr->max_height);
printf("\ncrtc count %i\n", resPtr->count_crtcs); printf("\ncrtc count %i\n", resPtr->count_crtcs);
for(uint32_t c = 0; c < resPtr->count_crtcs; ++c) for(int c = 0; c < resPtr->count_crtcs; ++c)
{ {
drmModeCrtcPtr tmpCrtcPtr = drmModeGetCrtc(fd, resPtr->crtcs[c]); drmModeCrtcPtr tmpCrtcPtr = drmModeGetCrtc(fd, resPtr->crtcs[c]);
printf("crtc id %i, buffer id %i\n", tmpCrtcPtr->crtc_id, tmpCrtcPtr->buffer_id); printf("crtc id %i, buffer id %i\n", tmpCrtcPtr->crtc_id, tmpCrtcPtr->buffer_id);
@ -534,7 +534,7 @@ void modeset_debug_print(int fd)
} }
printf("\nfb count %i\n", resPtr->count_fbs); printf("\nfb count %i\n", resPtr->count_fbs);
for(uint32_t c = 0; c < resPtr->count_fbs; ++c) for(int c = 0; c < resPtr->count_fbs; ++c)
{ {
drmModeFBPtr tmpFBptr = drmModeGetFB(fd, resPtr->fbs[c]); drmModeFBPtr tmpFBptr = drmModeGetFB(fd, resPtr->fbs[c]);
printf("fb id %i, handle %i\n", tmpFBptr->fb_id, tmpFBptr->handle); printf("fb id %i, handle %i\n", tmpFBptr->fb_id, tmpFBptr->handle);
@ -542,7 +542,7 @@ void modeset_debug_print(int fd)
} }
printf("\nencoder count %i\n", resPtr->count_encoders); printf("\nencoder count %i\n", resPtr->count_encoders);
for(uint32_t c = 0; c < resPtr->count_encoders; ++c) for(int c = 0; c < resPtr->count_encoders; ++c)
{ {
drmModeEncoderPtr tmpEncoderPtr = drmModeGetEncoder(fd, resPtr->encoders[c]); drmModeEncoderPtr tmpEncoderPtr = drmModeGetEncoder(fd, resPtr->encoders[c]);
printf("encoder id %i, crtc id %i\n", tmpEncoderPtr->encoder_id, tmpEncoderPtr->crtc_id); printf("encoder id %i, crtc id %i\n", tmpEncoderPtr->encoder_id, tmpEncoderPtr->crtc_id);
@ -570,7 +570,7 @@ void modeset_debug_print(int fd)
} }
printf("\nconnector count %i\n", resPtr->count_connectors); printf("\nconnector count %i\n", resPtr->count_connectors);
for(uint32_t c = 0; c < resPtr->count_connectors; ++c) for(int c = 0; c < resPtr->count_connectors; ++c)
{ {
drmModeConnectorPtr tmpConnPtr = drmModeGetConnector(fd, resPtr->connectors[c]); drmModeConnectorPtr tmpConnPtr = drmModeGetConnector(fd, resPtr->connectors[c]);
printf("connector id %i, encoder id %i\n", tmpConnPtr->connector_id, tmpConnPtr->encoder_id); printf("connector id %i, encoder id %i\n", tmpConnPtr->connector_id, tmpConnPtr->encoder_id);

View File

@ -29,6 +29,7 @@ void RPIFUNC(vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoi
PROFILEEND(RPIFUNC(vkCmdBindPipeline)); PROFILEEND(RPIFUNC(vkCmdBindPipeline));
} }
/**
//multiple attachments //multiple attachments
void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, const VkPipelineDepthStencilStateCreateInfo* dsi, const VkPipelineColorBlendAttachmentState* bas, const VkAllocationCallbacks* pAllocator) void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, const VkPipelineDepthStencilStateCreateInfo* dsi, const VkPipelineColorBlendAttachmentState* bas, const VkAllocationCallbacks* pAllocator)
{ {
@ -176,6 +177,7 @@ void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, co
*instructions = tmp; *instructions = tmp;
*size = newSize; *size = newSize;
} }
/**/
/* /*
* https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#vkCreateGraphicsPipelines * https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#vkCreateGraphicsPipelines
@ -196,7 +198,7 @@ VkResult RPIFUNC(vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pip
//TODO flags //TODO flags
for(int c = 0; c < createInfoCount; ++c) for(uint32_t c = 0; c < createInfoCount; ++c)
{ {
_pipeline* pip = ALLOCATE(sizeof(_pipeline), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); _pipeline* pip = ALLOCATE(sizeof(_pipeline), 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if(!pip) if(!pip)
@ -208,7 +210,7 @@ VkResult RPIFUNC(vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pip
memset(pip->names, 0, sizeof(char*)*6); memset(pip->names, 0, sizeof(char*)*6);
memset(pip->modules, 0, sizeof(_shaderModule*)*6); memset(pip->modules, 0, sizeof(_shaderModule*)*6);
for(int d = 0; d < pCreateInfos[c].stageCount; ++d) for(uint32_t d = 0; d < pCreateInfos[c].stageCount; ++d)
{ {
uint32_t idx = ulog2(pCreateInfos[c].pStages[d].stage); uint32_t idx = ulog2(pCreateInfos[c].pStages[d].stage);
pip->modules[idx] = pCreateInfos[c].pStages[d].module; pip->modules[idx] = pCreateInfos[c].pStages[d].module;

View File

@ -124,7 +124,7 @@ void profilePrintResults()
int32_t numFunctions = 0; int32_t numFunctions = 0;
//insertion sort, linear search //insertion sort, linear search
for(int32_t c = 0; c < globalProfiler->funcDatabase.maxData; ++c) for(uint32_t c = 0; c < globalProfiler->funcDatabase.maxData; ++c)
{ {
if(!globalProfiler->funcDatabase.elements[c].data) if(!globalProfiler->funcDatabase.elements[c].data)
{ {

View File

@ -131,7 +131,7 @@ void RPIFUNC(vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRender
} }
clFit(commandBuffer, &commandBuffer->binCl, sizeof(CLMarker)); clFit(&commandBuffer->binCl, sizeof(CLMarker));
clInsertNewCLMarker(&commandBuffer->binCl, &cb->handlesCl, &cb->shaderRecCl, cb->shaderRecCount, &cb->uniformsCl); clInsertNewCLMarker(&commandBuffer->binCl, &cb->handlesCl, &cb->shaderRecCl, cb->shaderRecCount, &cb->uniformsCl);
CLMarker* currMarker = getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset); CLMarker* currMarker = getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset);
currMarker->writeImage = writeImage; currMarker->writeImage = writeImage;
@ -199,37 +199,37 @@ void RPIFUNC(vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRender
if(writeImage) if(writeImage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeImage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeImage->boundMem->bo);
} }
if(readImage) if(readImage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, readImage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, readImage->boundMem->bo);
} }
if(writeDepthStencilImage) if(writeDepthStencilImage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeDepthStencilImage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeDepthStencilImage->boundMem->bo);
} }
if(readDepthStencilImage) if(readDepthStencilImage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, readDepthStencilImage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, readDepthStencilImage->boundMem->bo);
} }
if(writeMSAAimage) if(writeMSAAimage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeMSAAimage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeMSAAimage->boundMem->bo);
} }
if(writeMSAAdepthStencilImage) if(writeMSAAdepthStencilImage)
{ {
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeMSAAdepthStencilImage->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesBufOffset + cb->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->handlesSize, writeMSAAdepthStencilImage->boundMem->bo);
} }
@ -264,7 +264,7 @@ void RPIFUNC(vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRender
width = width < 4 ? 4 : width; width = width < 4 ? 4 : width;
} }
clFit(commandBuffer, &commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length); clFit(&commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length);
clInsertTileBinningModeConfiguration(&commandBuffer->binCl, clInsertTileBinningModeConfiguration(&commandBuffer->binCl,
0, //double buffer in non ms mode 0, //double buffer in non ms mode
0, //tile allocation block size 0, //tile allocation block size
@ -281,7 +281,7 @@ void RPIFUNC(vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRender
//which are what is used when a primitive is binned to a tile to //which are what is used when a primitive is binned to a tile to
//figure out what new state packets need to be written to that tile's //figure out what new state packets need to be written to that tile's
//command list. //command list.
clFit(commandBuffer, &commandBuffer->binCl, V3D21_START_TILE_BINNING_length); clFit(&commandBuffer->binCl, V3D21_START_TILE_BINNING_length);
clInsertStartTileBinning(&commandBuffer->binCl); clInsertStartTileBinning(&commandBuffer->binCl);
((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->perfmonID = cb->perfmonID; ((CLMarker*)getCPAptrFromOffset(cb->binCl.CPA, cb->binCl.currMarkerOffset))->perfmonID = cb->perfmonID;
@ -311,9 +311,9 @@ void RPIFUNC(vkCmdEndRenderPass)(VkCommandBuffer commandBuffer)
//until the FLUSH completes. //until the FLUSH completes.
//The FLUSH caps all of our bin lists with a //The FLUSH caps all of our bin lists with a
//VC4_PACKET_RETURN. //VC4_PACKET_RETURN.
clFit(commandBuffer, &cb->binCl, V3D21_INCREMENT_SEMAPHORE_length); clFit(&cb->binCl, V3D21_INCREMENT_SEMAPHORE_length);
clInsertIncrementSemaphore(&cb->binCl); clInsertIncrementSemaphore(&cb->binCl);
clFit(commandBuffer, &cb->binCl, V3D21_FLUSH_length); clFit(&cb->binCl, V3D21_FLUSH_length);
clInsertFlush(&cb->binCl); clInsertFlush(&cb->binCl);
cb->currRenderPass = 0; cb->currRenderPass = 0;
@ -362,7 +362,7 @@ VkResult RPIFUNC(vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateIn
return VK_ERROR_OUT_OF_HOST_MEMORY; return VK_ERROR_OUT_OF_HOST_MEMORY;
} }
for(int c = 0; c < rp->numSubpasses; ++c) for(uint32_t c = 0; c < rp->numSubpasses; ++c)
{ {
rp->subpasses[c].flags = pCreateInfo->pSubpasses[c].flags; rp->subpasses[c].flags = pCreateInfo->pSubpasses[c].flags;
rp->subpasses[c].pipelineBindPoint = pCreateInfo->pSubpasses[c].pipelineBindPoint; rp->subpasses[c].pipelineBindPoint = pCreateInfo->pSubpasses[c].pipelineBindPoint;
@ -479,7 +479,7 @@ void RPIFUNC(vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, cons
{ {
FREE(rp->subpassDependencies); FREE(rp->subpassDependencies);
for(int c = 0; c < rp->numSubpasses; ++c) for(uint32_t c = 0; c < rp->numSubpasses; ++c)
{ {
FREE(rp->subpasses[c].pInputAttachments); FREE(rp->subpasses[c].pInputAttachments);
FREE(rp->subpasses[c].pColorAttachments); FREE(rp->subpasses[c].pColorAttachments);

View File

@ -203,7 +203,7 @@ void createClearShaderModule(VkDevice device, VkShaderModule* blitShaderModule,
VkRpiAssemblyMappingEXT* asm_mappings[4] = {}; VkRpiAssemblyMappingEXT* asm_mappings[4] = {};
uint32_t asm_mappings_sizes[4] = {}; uint32_t asm_mappings_sizes[4] = {};
VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {}; VkRpiShaderModuleAssemblyCreateInfoEXT shaderModuleCreateInfo = {0};
shaderModuleCreateInfo.instructions = asm_ptrs; shaderModuleCreateInfo.instructions = asm_ptrs;
shaderModuleCreateInfo.numInstructions = asm_sizes; shaderModuleCreateInfo.numInstructions = asm_sizes;
shaderModuleCreateInfo.mappings = asm_mappings; shaderModuleCreateInfo.mappings = asm_mappings;
@ -251,7 +251,7 @@ void createClearShaderModule(VkDevice device, VkShaderModule* blitShaderModule,
//words start here //words start here
spirv[5] = 1 << 16; spirv[5] = 1 << 16;
VkShaderModuleCreateInfo smci = {}; VkShaderModuleCreateInfo smci = {0};
smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
smci.codeSize = sizeof(uint32_t)*6; smci.codeSize = sizeof(uint32_t)*6;
smci.pCode = spirv; smci.pCode = spirv;
@ -296,32 +296,32 @@ void createClearPipeline(VkDevice device, VkPipelineDepthStencilStateCreateInfo*
vertexInputAttributeDescription[0].format = VK_FORMAT_R32G32_SFLOAT; vertexInputAttributeDescription[0].format = VK_FORMAT_R32G32_SFLOAT;
} }
VkPipelineVertexInputStateCreateInfo vertexInputInfo = {}; VkPipelineVertexInputStateCreateInfo vertexInputInfo = {0};
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputInfo.vertexAttributeDescriptionCount = 1; vertexInputInfo.vertexAttributeDescriptionCount = 1;
vertexInputInfo.pVertexAttributeDescriptions = vertexInputAttributeDescription; vertexInputInfo.pVertexAttributeDescriptions = vertexInputAttributeDescription;
vertexInputInfo.vertexBindingDescriptionCount = 1; vertexInputInfo.vertexBindingDescriptionCount = 1;
vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription; vertexInputInfo.pVertexBindingDescriptions = &vertexInputBindingDescription;
VkPipelineInputAssemblyStateCreateInfo pipelineIACreateInfo = {}; VkPipelineInputAssemblyStateCreateInfo pipelineIACreateInfo = {0};
pipelineIACreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; pipelineIACreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
pipelineIACreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; pipelineIACreateInfo.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
VkPipelineRasterizationStateCreateInfo rastCreateInfo = {}; VkPipelineRasterizationStateCreateInfo rastCreateInfo = {0};
rastCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rastCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rastCreateInfo.polygonMode = VK_POLYGON_MODE_FILL; rastCreateInfo.polygonMode = VK_POLYGON_MODE_FILL;
rastCreateInfo.cullMode = VK_CULL_MODE_NONE; rastCreateInfo.cullMode = VK_CULL_MODE_NONE;
rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rastCreateInfo.lineWidth = 1.0f; rastCreateInfo.lineWidth = 1.0f;
VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {}; VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {0};
pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
VkPipelineColorBlendAttachmentState blendAttachState = {}; VkPipelineColorBlendAttachmentState blendAttachState = {0};
blendAttachState.colorWriteMask = 0xf; blendAttachState.colorWriteMask = 0xf;
blendAttachState.blendEnable = false; blendAttachState.blendEnable = false;
VkPipelineColorBlendStateCreateInfo blendCreateInfo = {}; VkPipelineColorBlendStateCreateInfo blendCreateInfo = {0};
blendCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; blendCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blendCreateInfo.attachmentCount = 1; blendCreateInfo.attachmentCount = 1;
blendCreateInfo.pAttachments = &blendAttachState; blendCreateInfo.pAttachments = &blendAttachState;
@ -347,7 +347,7 @@ void createClearPipeline(VkDevice device, VkPipelineDepthStencilStateCreateInfo*
shaderStageCreateInfo[1].module = blitShaderModule; shaderStageCreateInfo[1].module = blitShaderModule;
shaderStageCreateInfo[1].pName = "main"; shaderStageCreateInfo[1].pName = "main";
VkPipelineLayoutCreateInfo pipelineLayoutCI = {}; VkPipelineLayoutCreateInfo pipelineLayoutCI = {0};
pipelineLayoutCI.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutCI.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutCI.setLayoutCount = 1; pipelineLayoutCI.setLayoutCount = 1;
pipelineLayoutCI.pSetLayouts = &blitDsl; pipelineLayoutCI.pSetLayouts = &blitDsl;
@ -357,17 +357,17 @@ void createClearPipeline(VkDevice device, VkPipelineDepthStencilStateCreateInfo*
VkDynamicState dynState = VK_DYNAMIC_STATE_VIEWPORT; VkDynamicState dynState = VK_DYNAMIC_STATE_VIEWPORT;
VkPipelineDynamicStateCreateInfo pdsci = {}; VkPipelineDynamicStateCreateInfo pdsci = {0};
pdsci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; pdsci.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
pdsci.dynamicStateCount = 1; pdsci.dynamicStateCount = 1;
pdsci.pDynamicStates = &dynState; pdsci.pDynamicStates = &dynState;
VkPipelineViewportStateCreateInfo pvsci = {}; VkPipelineViewportStateCreateInfo pvsci = {0};
pvsci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; pvsci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
pvsci.viewportCount = 0; pvsci.viewportCount = 0;
pvsci.scissorCount = 0; pvsci.scissorCount = 0;
VkGraphicsPipelineCreateInfo pipelineInfo = {}; VkGraphicsPipelineCreateInfo pipelineInfo = {0};
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipelineInfo.stageCount = 2; pipelineInfo.stageCount = 2;
pipelineInfo.pStages = &shaderStageCreateInfo[0]; pipelineInfo.pStages = &shaderStageCreateInfo[0];
@ -383,7 +383,7 @@ void createClearPipeline(VkDevice device, VkPipelineDepthStencilStateCreateInfo*
pipelineInfo.pDepthStencilState = dsState; pipelineInfo.pDepthStencilState = dsState;
pipelineInfo.layout = *blitPipelineLayout; pipelineInfo.layout = *blitPipelineLayout;
VkResult res = RPIFUNC(vkCreateGraphicsPipelines)(device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, blitPipeline); RPIFUNC(vkCreateGraphicsPipelines)(device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, blitPipeline);
} }
void createClearDescriptorSetLayouts(VkDevice device, VkDescriptorSetLayout* bufferDsl) void createClearDescriptorSetLayouts(VkDevice device, VkDescriptorSetLayout* bufferDsl)
@ -391,7 +391,7 @@ void createClearDescriptorSetLayouts(VkDevice device, VkDescriptorSetLayout* buf
assert(device); assert(device);
assert(bufferDsl); assert(bufferDsl);
VkDescriptorSetLayoutCreateInfo descriptorLayoutCI = {}; VkDescriptorSetLayoutCreateInfo descriptorLayoutCI = {0};
descriptorLayoutCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; descriptorLayoutCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
descriptorLayoutCI.bindingCount = 0; descriptorLayoutCI.bindingCount = 0;
descriptorLayoutCI.pBindings = 0; descriptorLayoutCI.pBindings = 0;
@ -463,7 +463,7 @@ void RPIFUNC(vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t fir
_commandBuffer* cb = commandBuffer; _commandBuffer* cb = commandBuffer;
for(int c = 0; c < bindingCount; ++c) for(uint32_t c = 0; c < bindingCount; ++c)
{ {
cb->vertexBuffers[firstBinding + c] = pBuffers[c]; cb->vertexBuffers[firstBinding + c] = pBuffers[c];
cb->vertexBufferOffsets[firstBinding + c] = pOffsets[c]; cb->vertexBufferOffsets[firstBinding + c] = pOffsets[c];
@ -511,16 +511,16 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearColorImage)(
assert(i->usageBits & VK_IMAGE_USAGE_TRANSFER_DST_BIT); assert(i->usageBits & VK_IMAGE_USAGE_TRANSFER_DST_BIT);
{ //Simplest case: just submit a job to clear the image { //Simplest case: just submit a job to clear the image
clFit(commandBuffer, &commandBuffer->binCl, sizeof(CLMarker)); clFit(&commandBuffer->binCl, sizeof(CLMarker));
clInsertNewCLMarker(&commandBuffer->binCl, &commandBuffer->handlesCl, &commandBuffer->shaderRecCl, commandBuffer->shaderRecCount, &commandBuffer->uniformsCl); clInsertNewCLMarker(&commandBuffer->binCl, &commandBuffer->handlesCl, &commandBuffer->shaderRecCl, commandBuffer->shaderRecCount, &commandBuffer->uniformsCl);
((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->writeImage = i; ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->writeImage = i;
//insert reloc for render target //insert reloc for render target
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesBufOffset + commandBuffer->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesSize, i->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesBufOffset + commandBuffer->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesSize, i->boundMem->bo);
clFit(commandBuffer, &commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length); clFit(&commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length);
clInsertTileBinningModeConfiguration(&commandBuffer->binCl, clInsertTileBinningModeConfiguration(&commandBuffer->binCl,
0, //double buffer in non ms mode 0, //double buffer in non ms mode
0, //tile allocation block size 0, //tile allocation block size
@ -537,7 +537,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearColorImage)(
//which are what is used when a primitive is binned to a tile to //which are what is used when a primitive is binned to a tile to
//figure out what new state packets need to be written to that tile's //figure out what new state packets need to be written to that tile's
//command list. //command list.
clFit(commandBuffer, &commandBuffer->binCl, V3D21_START_TILE_BINNING_length); clFit(&commandBuffer->binCl, V3D21_START_TILE_BINNING_length);
clInsertStartTileBinning(&commandBuffer->binCl); clInsertStartTileBinning(&commandBuffer->binCl);
//Increment the semaphore indicating that binning is done and //Increment the semaphore indicating that binning is done and
@ -545,9 +545,9 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearColorImage)(
//until the FLUSH completes. //until the FLUSH completes.
//The FLUSH caps all of our bin lists with a //The FLUSH caps all of our bin lists with a
//VC4_PACKET_RETURN. //VC4_PACKET_RETURN.
clFit(commandBuffer, &commandBuffer->binCl, V3D21_INCREMENT_SEMAPHORE_length); clFit(&commandBuffer->binCl, V3D21_INCREMENT_SEMAPHORE_length);
clInsertIncrementSemaphore(&commandBuffer->binCl); clInsertIncrementSemaphore(&commandBuffer->binCl);
clFit(commandBuffer, &commandBuffer->binCl, V3D21_FLUSH_length); clFit(&commandBuffer->binCl, V3D21_FLUSH_length);
clInsertFlush(&commandBuffer->binCl); clInsertFlush(&commandBuffer->binCl);
((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearColor[0] = ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearColor[1] = packVec4IntoABGR8(pColor->float32); ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearColor[0] = ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearColor[1] = packVec4IntoABGR8(pColor->float32);
@ -595,16 +595,16 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearDepthStencilImage)(
assert(i->usageBits & VK_IMAGE_USAGE_TRANSFER_DST_BIT); assert(i->usageBits & VK_IMAGE_USAGE_TRANSFER_DST_BIT);
{ //Simplest case: just submit a job to clear the image { //Simplest case: just submit a job to clear the image
clFit(commandBuffer, &commandBuffer->binCl, sizeof(CLMarker)); clFit(&commandBuffer->binCl, sizeof(CLMarker));
clInsertNewCLMarker(&commandBuffer->binCl, &commandBuffer->handlesCl, &commandBuffer->shaderRecCl, commandBuffer->shaderRecCount, &commandBuffer->uniformsCl); clInsertNewCLMarker(&commandBuffer->binCl, &commandBuffer->handlesCl, &commandBuffer->shaderRecCl, commandBuffer->shaderRecCount, &commandBuffer->uniformsCl);
((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->writeDepthStencilImage = i; ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->writeDepthStencilImage = i;
//insert reloc for render target //insert reloc for render target
clFit(commandBuffer, &commandBuffer->handlesCl, 4); clFit(&commandBuffer->handlesCl, 4);
clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesBufOffset + commandBuffer->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesSize, i->boundMem->bo); clGetHandleIndex(&commandBuffer->handlesCl, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesBufOffset + commandBuffer->handlesCl.offset, ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->handlesSize, i->boundMem->bo);
clFit(commandBuffer, &commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length); clFit(&commandBuffer->binCl, V3D21_TILE_BINNING_MODE_CONFIGURATION_length);
clInsertTileBinningModeConfiguration(&commandBuffer->binCl, clInsertTileBinningModeConfiguration(&commandBuffer->binCl,
0, //double buffer in non ms mode 0, //double buffer in non ms mode
0, //tile allocation block size 0, //tile allocation block size
@ -621,7 +621,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearDepthStencilImage)(
//which are what is used when a primitive is binned to a tile to //which are what is used when a primitive is binned to a tile to
//figure out what new state packets need to be written to that tile's //figure out what new state packets need to be written to that tile's
//command list. //command list.
clFit(commandBuffer, &commandBuffer->binCl, V3D21_START_TILE_BINNING_length); clFit(&commandBuffer->binCl, V3D21_START_TILE_BINNING_length);
clInsertStartTileBinning(&commandBuffer->binCl); clInsertStartTileBinning(&commandBuffer->binCl);
//Increment the semaphore indicating that binning is done and //Increment the semaphore indicating that binning is done and
@ -629,9 +629,9 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearDepthStencilImage)(
//until the FLUSH completes. //until the FLUSH completes.
//The FLUSH caps all of our bin lists with a //The FLUSH caps all of our bin lists with a
//VC4_PACKET_RETURN. //VC4_PACKET_RETURN.
clFit(commandBuffer, &commandBuffer->binCl, V3D21_INCREMENT_SEMAPHORE_length); clFit(&commandBuffer->binCl, V3D21_INCREMENT_SEMAPHORE_length);
clInsertIncrementSemaphore(&commandBuffer->binCl); clInsertIncrementSemaphore(&commandBuffer->binCl);
clFit(commandBuffer, &commandBuffer->binCl, V3D21_FLUSH_length); clFit(&commandBuffer->binCl, V3D21_FLUSH_length);
clInsertFlush(&commandBuffer->binCl); clInsertFlush(&commandBuffer->binCl);
((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearDepth = (uint32_t)(pDepthStencil->depth * 0xffffff) & 0xffffff; ((CLMarker*)getCPAptrFromOffset(commandBuffer->binCl.CPA, commandBuffer->binCl.currMarkerOffset))->clearDepth = (uint32_t)(pDepthStencil->depth * 0xffffff) & 0xffffff;
@ -708,7 +708,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)(
VkPipeline blitPipeline; VkPipeline blitPipeline;
VkPipelineLayout blitPipelineLayout; VkPipelineLayout blitPipelineLayout;
VkPipelineDepthStencilStateCreateInfo dsci = {}; VkPipelineDepthStencilStateCreateInfo dsci = {0};
dsci.depthCompareOp = VK_COMPARE_OP_ALWAYS; dsci.depthCompareOp = VK_COMPARE_OP_ALWAYS;
dsci.depthTestEnable = 1; dsci.depthTestEnable = 1;
dsci.depthWriteEnable = clearDepth; dsci.depthWriteEnable = clearDepth;
@ -748,7 +748,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)(
for(uint32_t d = 0; d < rectCount; ++d) for(uint32_t d = 0; d < rectCount; ++d)
{ {
VkViewport vp = {}; VkViewport vp = {0};
vp.x = pRects[d].rect.offset.x; vp.x = pRects[d].rect.offset.x;
vp.y = pRects[d].rect.offset.y; vp.y = pRects[d].rect.offset.y;
vp.width = pRects[d].rect.extent.width; vp.width = pRects[d].rect.extent.width;

View File

@ -179,17 +179,17 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdPipelineBarrier)(
//VK_IMAGE_LAYOUT_PRESENT_SRC_KHR //VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
//VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR //VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
for(int c = 0; c < memoryBarrierCount; ++c) for(uint32_t c = 0; c < memoryBarrierCount; ++c)
{ {
//TODO //TODO
} }
for(int c = 0; c < bufferMemoryBarrierCount; ++c) for(uint32_t c = 0; c < bufferMemoryBarrierCount; ++c)
{ {
//TODO //TODO
} }
for(int c = 0; c < imageMemoryBarrierCount; ++c) for(uint32_t c = 0; c < imageMemoryBarrierCount; ++c)
{ {
_image* i = pImageMemoryBarriers[c].image; _image* i = pImageMemoryBarriers[c].image;
@ -217,9 +217,9 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkDeviceWaitIdle)(
assert(device); assert(device);
for(int c = 0; c < numQueueFamilies; ++c) for(uint32_t c = 0; c < numQueueFamilies; ++c)
{ {
for(int d = 0; d < device->numQueues[c]; ++d) for(uint32_t d = 0; d < device->numQueues[c]; ++d)
{ {
uint64_t lastFinishedSeqno; uint64_t lastFinishedSeqno;
uint64_t timeout = WAIT_TIMEOUT_INFINITE; uint64_t timeout = WAIT_TIMEOUT_INFINITE;

View File

@ -31,10 +31,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkGetPhysicalDeviceDisplayPropertiesKHR)(
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pPropertyCount; uint32_t arraySize = *pPropertyCount;
int elementsWritten = min(numDisplays, arraySize); uint32_t elementsWritten = min(numDisplays, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pProperties[c].display = displays[c].connectorID; pProperties[c].display = displays[c].connectorID;
//fprintf(stderr, "display id %i\n", pProperties[c].display ); //fprintf(stderr, "display id %i\n", pProperties[c].display );
@ -83,10 +83,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkGetDisplayModePropertiesKHR)(
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pPropertyCount; uint32_t arraySize = *pPropertyCount;
int elementsWritten = min(numModes, arraySize); uint32_t elementsWritten = min(numModes, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
_displayMode mode = { modes[c].connectorID, modes[c].modeID }; _displayMode mode = { modes[c].connectorID, modes[c].modeID };
memcpy(&pProperties[c].displayMode, &mode, sizeof(_displayMode)); memcpy(&pProperties[c].displayMode, &mode, sizeof(_displayMode));
@ -127,6 +127,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateDisplayPlaneSurfaceKHR)(
*pSurface = surface; *pSurface = surface;
PROFILEEND(RPIFUNC(vkCreateDisplayPlaneSurfaceKHR)); PROFILEEND(RPIFUNC(vkCreateDisplayPlaneSurfaceKHR));
return VK_SUCCESS;
} }
/* /*
@ -281,10 +283,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkGetPhysicalDeviceSurfacePresentModesKHR
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pPresentModeCount; uint32_t arraySize = *pPresentModeCount;
int elementsWritten = min(numSupportedPresentModes, arraySize); uint32_t elementsWritten = min(numSupportedPresentModes, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pPresentModes[c] = supportedPresentModes[c]; pPresentModes[c] = supportedPresentModes[c];
} }
@ -345,11 +347,11 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateSwapchainKHR)(
s->numImages = pCreateInfo->minImageCount; s->numImages = pCreateInfo->minImageCount;
s->surface = pCreateInfo->surface; s->surface = pCreateInfo->surface;
for(int c = 0; c < pCreateInfo->minImageCount; ++c) for(uint32_t c = 0; c < pCreateInfo->minImageCount; ++c)
{ {
s->inFlight[c] = 0; s->inFlight[c] = 0;
VkImageCreateInfo imageCreateInfo = {}; VkImageCreateInfo imageCreateInfo = {0};
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D; imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
imageCreateInfo.format = pCreateInfo->imageFormat; imageCreateInfo.format = pCreateInfo->imageFormat;
@ -385,7 +387,7 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateSwapchainKHR)(
VkMemoryAllocateInfo ai; VkMemoryAllocateInfo ai;
ai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; ai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
ai.allocationSize = mr.size; ai.allocationSize = mr.size;
for(int d = 0; d < numMemoryTypes; ++d) for(uint32_t d = 0; d < numMemoryTypes; ++d)
{ {
if(memoryTypes[d].propertyFlags == mr.memoryTypeBits) if(memoryTypes[d].propertyFlags == mr.memoryTypeBits)
{ {
@ -437,10 +439,10 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkGetSwapchainImagesKHR)(
return VK_SUCCESS; return VK_SUCCESS;
} }
int arraySize = *pSwapchainImageCount; uint32_t arraySize = *pSwapchainImageCount;
int elementsWritten = min(s->numImages, arraySize); uint32_t elementsWritten = min(s->numImages, arraySize);
for(int c = 0; c < elementsWritten; ++c) for(uint32_t c = 0; c < elementsWritten; ++c)
{ {
pSwapchainImages[c] = &s->images[c]; pSwapchainImages[c] = &s->images[c];
} }
@ -555,12 +557,12 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueuePresentKHR)(
assert(pPresentInfo); assert(pPresentInfo);
//wait for semaphore in present info set by submit ioctl to make sure cls are flushed //wait for semaphore in present info set by submit ioctl to make sure cls are flushed
for(int c = 0; c < pPresentInfo->waitSemaphoreCount; ++c) for(uint32_t c = 0; c < pPresentInfo->waitSemaphoreCount; ++c)
{ {
sem_wait((sem_t*)pPresentInfo->pWaitSemaphores[c]); sem_wait((sem_t*)pPresentInfo->pWaitSemaphores[c]);
} }
for(int c = 0; c < pPresentInfo->swapchainCount; ++c) for(uint32_t c = 0; c < pPresentInfo->swapchainCount; ++c)
{ {
_swapchain* s = pPresentInfo->pSwapchains[c]; _swapchain* s = pPresentInfo->pSwapchains[c];
modeset_present(controlFd, &s->images[pPresentInfo->pImageIndices[c]], s->surface, queue->lastEmitSeqno); modeset_present(controlFd, &s->images[pPresentInfo->pImageIndices[c]], s->surface, queue->lastEmitSeqno);
@ -595,7 +597,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkDestroySwapchainKHR)(
if(s) if(s)
{ {
for(int c = 0; c < s->numImages; ++c) for(uint32_t c = 0; c < s->numImages; ++c)
{ {
RPIFUNC(vkFreeMemory)(device, s->images[c].boundMem, 0); RPIFUNC(vkFreeMemory)(device, s->images[c].boundMem, 0);
modeset_destroy_fb(controlFd, &s->images[c]); modeset_destroy_fb(controlFd, &s->images[c]);