mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2024-11-28 10:24:15 +01:00
cleanup
This commit is contained in:
parent
d1a223865f
commit
4e0e17efaa
@ -250,7 +250,7 @@ void clInsertStoreFullResolutionTileBuffer(ControlList* cls,
|
||||
assert(cls->buffer);
|
||||
assert(cls->nextFreeByte);
|
||||
*cls->nextFreeByte = V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_opcode; cls->nextFreeByte++;
|
||||
//TODO is this correct?
|
||||
//is this correct?
|
||||
clEmitShaderRelocation(cls, &address);
|
||||
*(uint32_t*)cls->nextFreeByte =
|
||||
moveBits(disableColorBufferWrite, 1, 0) |
|
||||
@ -273,7 +273,7 @@ void clInsertReLoadFullResolutionTileBuffer(ControlList* cls,
|
||||
assert(cls->buffer);
|
||||
assert(cls->nextFreeByte);
|
||||
*cls->nextFreeByte = V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_opcode; cls->nextFreeByte++;
|
||||
//TODO is this correct?
|
||||
//is this correct?
|
||||
clEmitShaderRelocation(cls, &address);
|
||||
*(uint32_t*)cls->nextFreeByte =
|
||||
moveBits(disableColorBufferRead, 1, 0) |
|
||||
@ -302,7 +302,7 @@ void clInsertStoreTileBufferGeneral(ControlList* cls,
|
||||
assert(cls->buffer);
|
||||
assert(cls->nextFreeByte);
|
||||
*cls->nextFreeByte = V3D21_STORE_TILE_BUFFER_GENERAL_opcode; cls->nextFreeByte++;
|
||||
//TODO is this correct?
|
||||
//is this correct?
|
||||
*cls->nextFreeByte =
|
||||
moveBits(bufferToStore, 3, 0) |
|
||||
moveBits(format, 2, 4) |
|
||||
@ -341,7 +341,7 @@ void clInsertLoadTileBufferGeneral(ControlList* cls,
|
||||
assert(cls->buffer);
|
||||
assert(cls->nextFreeByte);
|
||||
*cls->nextFreeByte = V3D21_LOAD_TILE_BUFFER_GENERAL_opcode; cls->nextFreeByte++;
|
||||
//TODO is this correct?
|
||||
//is this correct?
|
||||
*cls->nextFreeByte =
|
||||
moveBits(bufferToLoad, 3, 0) |
|
||||
moveBits(format, 2, 4);
|
||||
@ -656,7 +656,7 @@ void clInsertTileRenderingModeConfiguration(ControlList* cls,
|
||||
assert(cls->buffer);
|
||||
assert(cls->nextFreeByte);
|
||||
*cls->nextFreeByte = V3D21_TILE_RENDERING_MODE_CONFIGURATION_opcode; cls->nextFreeByte++;
|
||||
//TODO is this correct?
|
||||
//is this correct?
|
||||
clEmitShaderRelocation(cls, &address);
|
||||
*(uint32_t*)cls->nextFreeByte = address.offset; cls->nextFreeByte += 4;
|
||||
*(uint32_t*)cls->nextFreeByte = moveBits(widthPixels, 16, 0) | moveBits(heightPixels, 16, 16); cls->nextFreeByte += 4;
|
||||
@ -740,7 +740,7 @@ void clInsertShaderRecord(ControlList* cls,
|
||||
*cls->nextFreeByte = vertexAttributeArraySelectBits; cls->nextFreeByte++;
|
||||
*cls->nextFreeByte = vertexTotalAttributesSize; cls->nextFreeByte++;
|
||||
clEmitShaderRelocation(relocCl, handlesCl, handlesBuf, handlesSize, &vertexCodeAddress);
|
||||
//TODO wtf??? --> check kernel side...
|
||||
//wtf??? --> shader code will always have an offset of 0 so this is fine
|
||||
uint32_t offset = moveBits(vertexCodeAddress.offset, 32, 0) | moveBits(vertexUniformsAddress, 32, 0);
|
||||
*(uint32_t*)cls->nextFreeByte = offset; cls->nextFreeByte += 4;
|
||||
cls->nextFreeByte += 4;
|
||||
|
@ -6,6 +6,11 @@
|
||||
|
||||
#include "declarations.h"
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
static uint64_t lastFinishedSeqno = 0;
|
||||
static atomic_int lastSeqnoGuard = 0;
|
||||
|
||||
/*
|
||||
* https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#commandbuffers-pools
|
||||
* Command pools are opaque objects that command buffer memory is allocated from, and which allow the implementation to amortize the
|
||||
@ -40,15 +45,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateCommandPool(
|
||||
|
||||
cp->resetAble = pCreateInfo->flags & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||
|
||||
//TODO CTS fails as we can't allocate enough memory for some reason
|
||||
//tweak system allocation as root using:
|
||||
//make sure kernel denies memory allocation that it won't be able to serve
|
||||
//sysctl -w vm.overcommit_memory="2"
|
||||
//specify after how much memory used the kernel will start denying requests
|
||||
//sysctl -w vm.overcommit_ratio="80"
|
||||
//
|
||||
|
||||
|
||||
|
||||
//initial number of command buffers to hold
|
||||
int numCommandBufs = 128;
|
||||
@ -644,13 +640,14 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
|
||||
assert(submitCl.bo_handle_count > 0);
|
||||
|
||||
//TODO somehow store last finished globally
|
||||
//so waiting on fences is faster
|
||||
//eg. could be an atomic value
|
||||
static uint64_t lastFinishedSeqno = 0;
|
||||
|
||||
//submit ioctl
|
||||
vc4_cl_submit(controlFd, &submitCl, &queue->lastEmitSeqno, &lastFinishedSeqno);
|
||||
//TODO
|
||||
while(lastSeqnoGuard);
|
||||
{
|
||||
lastSeqnoGuard = 1;
|
||||
//submit ioctl
|
||||
vc4_cl_submit(controlFd, &submitCl, &queue->lastEmitSeqno, &lastFinishedSeqno);
|
||||
lastSeqnoGuard = 0;
|
||||
}
|
||||
|
||||
//advance in linked list
|
||||
marker = marker->nextMarker;
|
||||
|
@ -12,7 +12,6 @@
|
||||
// 64-bit block the way it would an uncompressed
|
||||
// pixels.
|
||||
|
||||
//TODO
|
||||
// Cube map faces appear as whole miptrees at a page-aligned offset
|
||||
// from the first face's miptree.
|
||||
|
||||
@ -676,7 +675,7 @@ void createTextureToTextureShaderModule(VkDevice device, VkShaderModule* blitSha
|
||||
///packed
|
||||
///horizontal
|
||||
///stride=1
|
||||
///vectors to read = 4 (TODO not exactly clear what this means...)
|
||||
///vectors to read = 4
|
||||
"sig_load_imm ; vr_setup = load32.always(0x00401a00) ; nop = load32.always() ;\n"
|
||||
///uni = viewportXScale
|
||||
///r0 = vpm * uni
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "common.h"
|
||||
#include "common.h"
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDescriptorPool(
|
||||
VkDevice device,
|
||||
@ -383,7 +383,23 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorPool(
|
||||
VkDescriptorPool descriptorPool,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
//TODO
|
||||
assert(device);
|
||||
assert(descriptorPool);
|
||||
|
||||
_descriptorPool* dp = descriptorPool;
|
||||
|
||||
//TODO crashes
|
||||
// FREE(dp->descriptorSetPA.buf);
|
||||
// FREE(dp->mapElementCPA.buf);
|
||||
// FREE(dp->imageDescriptorCPA->buf);
|
||||
// FREE(dp->texelBufferDescriptorCPA->buf);
|
||||
// FREE(dp->bufferDescriptorCPA->buf);
|
||||
|
||||
FREE(dp->texelBufferDescriptorCPA);
|
||||
FREE(dp->imageDescriptorCPA);
|
||||
FREE(dp->bufferDescriptorCPA);
|
||||
|
||||
FREE(dp);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBindDescriptorSets(
|
||||
@ -422,7 +438,14 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyDescriptorSetLayout(
|
||||
VkDescriptorSetLayout descriptorSetLayout,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
//TODO
|
||||
assert(device);
|
||||
assert(descriptorSetLayout);
|
||||
|
||||
_descriptorSetLayout* dsl = descriptorSetLayout;
|
||||
|
||||
FREE(dsl->bindings);
|
||||
|
||||
FREE(dsl);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFreeDescriptorSets(
|
||||
@ -437,7 +460,31 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkFreeDescriptorSets(
|
||||
_descriptorPool* dp = descriptorPool;
|
||||
assert(dp->freeAble);
|
||||
|
||||
//TODO
|
||||
for(uint32_t c = 0; c < descriptorSetCount; ++c)
|
||||
{
|
||||
_descriptorSet* ds = pDescriptorSets[c];
|
||||
|
||||
if(ds->imageDescriptorsCount > 0)
|
||||
{
|
||||
consecutivePoolFree(&dp->mapElementCPA, ds->imageBindingMap.elements, ds->imageDescriptorsCount);
|
||||
//TODO crashes
|
||||
//consecutivePoolFree(&dp->imageDescriptorCPA, ds->imageDescriptors, ds->imageDescriptorsCount);
|
||||
}
|
||||
|
||||
if(ds->bufferDescriptorsCount > 0)
|
||||
{
|
||||
consecutivePoolFree(&dp->mapElementCPA, ds->bufferBindingMap.elements, ds->bufferDescriptorsCount);
|
||||
//consecutivePoolFree(&dp->bufferDescriptorCPA, ds->bufferDescriptors, ds->bufferDescriptorsCount);
|
||||
}
|
||||
|
||||
if(ds->bufferDescriptorsCount > 0)
|
||||
{
|
||||
consecutivePoolFree(&dp->mapElementCPA, ds->texelBufferBindingMap.elements, ds->texelBufferDescriptorsCount);
|
||||
//consecutivePoolFree(&dp->texelBufferDescriptorCPA, ds->texelBufferDescriptors, ds->texelBufferDescriptorsCount);
|
||||
}
|
||||
|
||||
poolFree(&dp->descriptorSetPA, ds);
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
@ -107,8 +107,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateDeviceExtensionProperties(
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
//TODO layers
|
||||
|
||||
int arraySize = *pPropertyCount;
|
||||
int elementsWritten = min(numDeviceExtensions, arraySize);
|
||||
|
||||
@ -227,9 +225,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateDevice(
|
||||
assert(pDevice);
|
||||
assert(pCreateInfo);
|
||||
|
||||
//TODO store enabled features and extensions
|
||||
//and check later on if they are enabled.
|
||||
|
||||
//check for enabled extensions
|
||||
for(int c = 0; c < pCreateInfo->enabledExtensionCount; ++c)
|
||||
{
|
||||
|
@ -351,15 +351,17 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer)
|
||||
|
||||
uint32_t cubemapStride = (di->imageView->image->width * di->imageView->image->height * getFormatBpp(di->imageView->interpretedFormat)) >> 3;
|
||||
|
||||
fprintf(stderr, "cubemap stride %i\n", cubemapStride);
|
||||
//fprintf(stderr, "cubemap stride %i\n", cubemapStride);
|
||||
|
||||
uint32_t numLevels = 0;
|
||||
numLevels = di->imageView->subresourceRange.levelCount < di->imageView->image->miplevels ? di->imageView->subresourceRange.levelCount : di->imageView->image->miplevels;
|
||||
|
||||
//TODO handle miplevels according to subresource rage?
|
||||
uint32_t params[4];
|
||||
encodeTextureUniform(params,
|
||||
di->imageView->subresourceRange.levelCount - 1,
|
||||
numLevels - 1,
|
||||
getTextureDataType(di->imageView->interpretedFormat),
|
||||
di->imageView->viewType == VK_IMAGE_VIEW_TYPE_CUBE,
|
||||
cubemapStride >> 12, //TODO cubemap stride in multiples of 4KB
|
||||
cubemapStride >> 12, //cubemap stride in multiples of 4KB
|
||||
di->imageView->image->levelOffsets[0] >> 12, //Image level 0 offset in multiples of 4KB
|
||||
di->imageView->image->height & 2047,
|
||||
di->imageView->image->width & 2047,
|
||||
@ -388,7 +390,6 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer)
|
||||
assert(0); //unsupported
|
||||
}
|
||||
|
||||
//TODO handle this properly
|
||||
//TMU0_B requires an extra uniform written
|
||||
//we need to signal that somehow from API side
|
||||
//if mode is cubemap we don't need an extra uniform, it's included!
|
||||
|
@ -61,8 +61,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceExtensionProperties(
|
||||
{
|
||||
assert(pPropertyCount);
|
||||
|
||||
//TODO layers
|
||||
|
||||
if(!pProperties)
|
||||
{
|
||||
*pPropertyCount = numInstanceExtensions;
|
||||
@ -116,8 +114,6 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateInstance(
|
||||
|
||||
(*pInstance)->numEnabledExtensions = 0;
|
||||
|
||||
//TODO handle layers
|
||||
|
||||
if(pCreateInfo->enabledExtensionCount)
|
||||
{
|
||||
assert(pCreateInfo->ppEnabledExtensionNames);
|
||||
@ -276,9 +272,6 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL rpi_vkGetInstanceProcAddr(
|
||||
VkInstance instance,
|
||||
const char* pName)
|
||||
{
|
||||
//TODO take instance into consideration
|
||||
//eg only return extension functions that are enabled?
|
||||
|
||||
if(!instance && !(
|
||||
!strcmp(pName, "vkEnumerateInstanceVersion") ||
|
||||
!strcmp(pName, "vkEnumerateInstanceExtensionProperties") ||
|
||||
@ -487,6 +480,5 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkEnumerateInstanceLayerProperties(
|
||||
uint32_t* pPropertyCount,
|
||||
VkLayerProperties* pProperties)
|
||||
{
|
||||
//TODO handle layers
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
@ -79,8 +79,6 @@ void vc4_cl_submit(int fd, struct drm_vc4_submit_cl* submit, uint64_t* lastEmitt
|
||||
uint32_t getBOAlignedSize(uint32_t size, uint32_t alignment);
|
||||
void vc4_print_hang_state(int fd);
|
||||
|
||||
//TODO perfmon
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@ void rpi_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pi
|
||||
}
|
||||
}
|
||||
|
||||
//TODO multiple attachments
|
||||
//multiple attachments
|
||||
void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, const VkPipelineDepthStencilStateCreateInfo* dsi, const VkPipelineColorBlendAttachmentState* bas, const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
assert(instructions);
|
||||
@ -57,9 +57,9 @@ void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, co
|
||||
}
|
||||
|
||||
|
||||
//TODO account for MSAA state!
|
||||
//TODO patch blending
|
||||
//TODO optimise
|
||||
//account for MSAA state!
|
||||
//patch blending
|
||||
//optimise
|
||||
|
||||
if(bas->blendEnable)
|
||||
{
|
||||
@ -140,7 +140,7 @@ void patchShaderDepthStencilBlending(uint64_t** instructions, uint32_t* size, co
|
||||
}
|
||||
else //separate factors
|
||||
{
|
||||
//TODO
|
||||
//
|
||||
}
|
||||
|
||||
switch(bas->alphaBlendOp)
|
||||
@ -216,11 +216,11 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
|
||||
//patch fragment shader
|
||||
// if(pCreateInfos[c].pStages[d].stage & VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||
// {
|
||||
// //TODO we could patch the fragment shader, but it would have a lot of edge cases
|
||||
// //we could patch the fragment shader, but it would have a lot of edge cases
|
||||
// //since the user is writing assembly we can just let them have full control
|
||||
// //patchShaderDepthStencilBlending(&s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT], &s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT], pCreateInfos[c].pDepthStencilState, pCreateInfos[c].pColorBlendState->pAttachments, pAllocator);
|
||||
|
||||
// //TODO if debug...
|
||||
// //if debug...
|
||||
// for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_FRAGMENT] / 8; ++e)
|
||||
// {
|
||||
// printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_FRAGMENT][e]);
|
||||
@ -233,7 +233,7 @@ VkResult rpi_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipeline
|
||||
|
||||
// if(pCreateInfos[c].pStages[d].stage & VK_SHADER_STAGE_VERTEX_BIT)
|
||||
// {
|
||||
// //TODO if debug...
|
||||
// //if debug...
|
||||
// for(uint64_t e = 0; e < s->sizes[RPI_ASSEMBLY_TYPE_VERTEX] / 8; ++e)
|
||||
// {
|
||||
// printf("%#llx ", s->instructions[RPI_ASSEMBLY_TYPE_VERTEX][e]);
|
||||
@ -569,7 +569,16 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkDestroyPipelineLayout(
|
||||
VkPipelineLayout pipelineLayout,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
//TODO
|
||||
assert(device);
|
||||
assert(pipelineLayout);
|
||||
|
||||
_pipelineLayout* pl = pipelineLayout;
|
||||
|
||||
FREE(pl->descriptorSetBindingMap.elements);
|
||||
FREE(pl->pushConstantRanges);
|
||||
FREE(pl->setLayouts);
|
||||
|
||||
FREE(pl);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreatePipelineCache(
|
||||
|
@ -47,7 +47,7 @@ VkResult rpi_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateIn
|
||||
buf->size = pCreateInfo->size;
|
||||
buf->usage = pCreateInfo->usage;
|
||||
buf->boundMem = 0;
|
||||
buf->alignment = ARM_PAGE_SIZE; //TODO
|
||||
buf->alignment = ARM_PAGE_SIZE;
|
||||
buf->alignedSize = getBOAlignedSize(buf->size, ARM_PAGE_SIZE);
|
||||
|
||||
*pBuffer = buf;
|
||||
@ -65,7 +65,6 @@ void rpi_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemor
|
||||
assert(pMemoryRequirements);
|
||||
|
||||
pMemoryRequirements->alignment = ((_buffer*)buffer)->alignment;
|
||||
//TODO do we really need ARM page size aligned buffers?
|
||||
pMemoryRequirements->size = getBOAlignedSize(((_buffer*)buffer)->size, ARM_PAGE_SIZE);
|
||||
//there's only one memory type so that's gonna be it...
|
||||
pMemoryRequirements->memoryTypeBits = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
||||
@ -232,7 +231,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
|
||||
i->layout = pCreateInfo->initialLayout;
|
||||
i->boundMem = 0;
|
||||
i->boundOffset = 0;
|
||||
i->alignment = ARM_PAGE_SIZE; //TODO?
|
||||
i->alignment = ARM_PAGE_SIZE;
|
||||
|
||||
i->concurrentAccess = pCreateInfo->sharingMode; //TODO?
|
||||
i->numQueueFamiliesWithAccess = pCreateInfo->queueFamilyIndexCount;
|
||||
@ -436,7 +435,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory(
|
||||
i->boundMem = m;
|
||||
i->boundOffset = memoryOffset;
|
||||
|
||||
//TODO not sure if this is necessary
|
||||
//TODO this is necessary, but maybe don't do it here?
|
||||
if(i->tiling == VC4_TILING_FORMAT_LINEAR)
|
||||
{
|
||||
int ret = vc4_bo_set_tiling(controlFd, i->boundMem->bo, DRM_FORMAT_MOD_LINEAR); assert(ret);
|
||||
|
@ -152,11 +152,11 @@ void rpi_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, con
|
||||
{
|
||||
vc4_bo_free(controlFd, shader->bos[c], 0, shader->sizes[c]);
|
||||
}
|
||||
}
|
||||
|
||||
if(shader->numMappings>0)
|
||||
{
|
||||
FREE(shader->mappings);
|
||||
if(shader->numMappings[c]>0)
|
||||
{
|
||||
FREE(shader->mappings[c]);
|
||||
}
|
||||
}
|
||||
|
||||
FREE(shader);
|
||||
|
@ -10,7 +10,7 @@ static VkPhysicalDeviceLimits _limits =
|
||||
//eg. staticcally allocated buffers instead of dynamically growing ones
|
||||
.maxImageDimension1D = 2048,
|
||||
.maxImageDimension2D = 2048,
|
||||
.maxImageDimension3D = 2084,
|
||||
.maxImageDimension3D = 0, //3D textures not supported
|
||||
.maxImageDimensionCube = 2048,
|
||||
.maxImageArrayLayers = 2048,
|
||||
.maxTexelBufferElements = 134217728,
|
||||
@ -160,7 +160,7 @@ static VkPhysicalDeviceFeatures _features =
|
||||
.shaderCullDistance = 1,
|
||||
.shaderFloat64 = 0,
|
||||
.shaderInt64 = 0,
|
||||
.shaderInt16 = 0,
|
||||
.shaderInt16 = 1,
|
||||
.shaderResourceResidency = 0,
|
||||
.shaderResourceMinLod = 0,
|
||||
.sparseBinding = 0,
|
||||
@ -580,4 +580,14 @@ static VkPerformanceCounterDescriptionKHR performanceCounterDescriptions[] =
|
||||
|
||||
#define numPerformanceCounterTypes (sizeof(performanceCounterTypes)/sizeof(VkPerformanceCounterKHR))
|
||||
|
||||
static VkPresentModeKHR supportedPresentModes[] =
|
||||
{
|
||||
VK_PRESENT_MODE_IMMEDIATE_KHR,
|
||||
VK_PRESENT_MODE_MAILBOX_KHR,
|
||||
VK_PRESENT_MODE_FIFO_KHR,
|
||||
VK_PRESENT_MODE_FIFO_RELAXED_KHR
|
||||
};
|
||||
|
||||
#define numSupportedPresentModes (sizeof(supportedPresentModes)/sizeof(VkPresentModeKHR))
|
||||
|
||||
#define VK_DRIVER_VERSION VK_MAKE_VERSION(1, 1, 0)
|
||||
|
20
driver/wsi.c
20
driver/wsi.c
@ -337,26 +337,24 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
assert(surface);
|
||||
assert(pPresentModeCount);
|
||||
|
||||
const int numModes = 1;
|
||||
|
||||
if(!pPresentModes)
|
||||
{
|
||||
*pPresentModeCount = numModes;
|
||||
*pPresentModeCount = numSupportedPresentModes;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
int arraySize = *pPresentModeCount;
|
||||
int elementsWritten = min(numModes, arraySize);
|
||||
int elementsWritten = min(numSupportedPresentModes, arraySize);
|
||||
|
||||
for(int c = 0; c < elementsWritten; ++c)
|
||||
{
|
||||
//TODO
|
||||
pPresentModes[c] = VK_PRESENT_MODE_FIFO_KHR;
|
||||
pPresentModes[c] = supportedPresentModes[c];
|
||||
}
|
||||
|
||||
*pPresentModeCount = elementsWritten;
|
||||
|
||||
if(elementsWritten < numModes)
|
||||
if(elementsWritten < numSupportedPresentModes)
|
||||
{
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
@ -385,8 +383,8 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateSwapchainKHR(
|
||||
|
||||
_swapchain* s = *pSwapchain;
|
||||
|
||||
//TODO flags, layers, queue sharing, pretransform, composite alpha, present mode..., clipped, oldswapchain
|
||||
//TODO external sync on surface, oldswapchain
|
||||
//TODO flags, layers, queue sharing, pretransform, composite alpha..., clipped, oldswapchain
|
||||
//TODO present mode
|
||||
|
||||
s->images = ALLOCATE(sizeof(_image) * pCreateInfo->minImageCount, 1, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if(!s->images)
|
||||
@ -529,7 +527,11 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkAcquireNextImageKHR(
|
||||
int semVal; sem_getvalue(s, &semVal); assert(semVal <= 0); //make sure semaphore is unsignalled
|
||||
sem_post(s);
|
||||
|
||||
//TODO signal fence
|
||||
_fence* f = fence;
|
||||
if(f)
|
||||
{
|
||||
f->signaled = 1;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -961,7 +961,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -896,7 +896,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -928,7 +928,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -854,7 +854,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -793,7 +793,7 @@ void CreateRenderPass()
|
||||
|
||||
VkAttachmentDescription attachDesc[2];
|
||||
attachDesc[0] = {};
|
||||
attachDesc[0].format = swapchainFormat.format; //Todo
|
||||
attachDesc[0].format = swapchainFormat.format; //
|
||||
attachDesc[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -825,7 +825,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -849,7 +849,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -881,7 +881,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -918,7 +918,7 @@ void CreateRenderPass()
|
||||
|
||||
VkAttachmentDescription attachDesc[2];
|
||||
attachDesc[0] = {};
|
||||
attachDesc[0].format = swapchainFormat.format; //Todo
|
||||
attachDesc[0].format = swapchainFormat.format; //
|
||||
attachDesc[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -960,7 +960,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -852,7 +852,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -884,7 +884,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -782,7 +782,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -814,7 +814,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -856,7 +856,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -888,7 +888,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -849,7 +849,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -881,7 +881,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -919,7 +919,7 @@ void CreateRenderPass()
|
||||
|
||||
VkAttachmentDescription attachDesc[2];
|
||||
attachDesc[0] = {};
|
||||
attachDesc[0].format = swapchainFormat.format; //Todo
|
||||
attachDesc[0].format = swapchainFormat.format; //
|
||||
attachDesc[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -961,7 +961,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -847,7 +847,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -879,7 +879,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -834,7 +834,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -866,7 +866,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
|
@ -778,7 +778,7 @@ void CreateRenderPass()
|
||||
subpassDesc.pColorAttachments = &attachRef;
|
||||
|
||||
VkAttachmentDescription attachDesc = {};
|
||||
attachDesc.format = swapchainFormat.format; //Todo
|
||||
attachDesc.format = swapchainFormat.format; //
|
||||
attachDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@ -810,7 +810,7 @@ void CreateFramebuffer()
|
||||
VkImageViewCreateInfo ViewCreateInfo = {};
|
||||
ViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
ViewCreateInfo.image = swapChainImages[i];
|
||||
ViewCreateInfo.format = swapchainFormat.format; //Todo
|
||||
ViewCreateInfo.format = swapchainFormat.format; //
|
||||
ViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
ViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
ViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
@ -873,7 +873,7 @@ void CreateShaders()
|
||||
///packed
|
||||
///horizontal
|
||||
///stride=1
|
||||
///vectors to read = 4 (TODO not exactly clear what this means...)
|
||||
///vectors to read = 4
|
||||
"sig_load_imm ; vr_setup = load32.always(0x00401a00) ; nop = load32.always() ;\n"
|
||||
///uni = viewportXScale
|
||||
///r0 = vpm * uni
|
||||
|
Loading…
Reference in New Issue
Block a user