update gryphn to use GN_FALSE + GN_TRUE
This commit is contained in:
@@ -20,7 +20,7 @@ uint32_t VkMemoryIndex(VkPhysicalDevice device, uint32_t memoryType, VkMemoryPro
|
||||
vkGetPhysicalDeviceMemoryProperties(device, &memoryProperties);
|
||||
for (uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++) {
|
||||
if ((memoryType & (1 << i)) && (memoryProperties.memoryTypes[i].propertyFlags & flags) == flags) {
|
||||
*foundMemory = gnTrue;
|
||||
*foundMemory = GN_TRUE;
|
||||
return i;
|
||||
}
|
||||
} // this whole thing was adapted from vulkan-tutorial.com
|
||||
@@ -43,7 +43,7 @@ gnReturnCode VkCreateBuffer(
|
||||
VkMemoryRequirements bufferRequirements;
|
||||
vkGetBufferMemoryRequirements(device->outputDevice->device, buffer->buffer, &bufferRequirements);
|
||||
|
||||
gnBool foundMemory = gnFalse;
|
||||
gnBool foundMemory = GN_FALSE;
|
||||
VkMemoryAllocateInfo memoryAllocateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
.allocationSize = bufferRequirements.size,
|
||||
|
@@ -56,7 +56,7 @@ void bindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBuf
|
||||
if (type == GN_VERTEX_BUFFER)
|
||||
vkCmdBindVertexBuffers(buffer->commandBuffer->buffer, 0, 1, &bufferToBind->buffer->buffer.buffer, offsets);
|
||||
else if (type == GN_INDEX_BUFFER) {
|
||||
buffer->commandBuffer->changedBuffer = gnTrue;
|
||||
buffer->commandBuffer->changedBuffer = GN_TRUE;
|
||||
buffer->commandBuffer->boundIndexBuffer = bufferToBind;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void draw(gnCommandBuffer buffer, int vertexCount, int firstVertex, int instance
|
||||
void drawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
||||
if (buffer->commandBuffer->changedBuffer) vkCmdBindIndexBuffer(buffer->commandBuffer->buffer, buffer->commandBuffer->boundIndexBuffer->buffer->buffer.buffer, 0, (type == GN_UINT32) ? VK_INDEX_TYPE_UINT32 : VK_INDEX_TYPE_UINT16);
|
||||
vkCmdDrawIndexed(buffer->commandBuffer->buffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
|
||||
buffer->commandBuffer->changedBuffer = gnFalse;
|
||||
buffer->commandBuffer->changedBuffer = GN_FALSE;
|
||||
}
|
||||
|
||||
void bindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set, uint32_t dynamicOffsetCount, uint32_t* dynamicOffsets) {
|
||||
|
@@ -36,7 +36,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
||||
vkUserData* userData = (vkUserData*)pUserData;
|
||||
gnDebuggerCallback callback = userData->debuggerCallback;
|
||||
gnBool result = callback(severity, type, data, userData->userData);
|
||||
if (result == gnFalse) return VK_FALSE;
|
||||
if (result == GN_FALSE) return VK_FALSE;
|
||||
return VK_TRUE;
|
||||
}
|
||||
|
||||
@@ -110,12 +110,12 @@ gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceInfo instanceIn
|
||||
VkResult result = vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance);
|
||||
if (result != VK_SUCCESS)
|
||||
return GN_FAILED_CREATE_INSTANCE;
|
||||
instance->valid = gnTrue;
|
||||
instance->valid = GN_TRUE;
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
void destroyInstance(gnInstanceHandle instance) {
|
||||
instance->valid = gnFalse;
|
||||
instance->valid = GN_FALSE;
|
||||
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
||||
}
|
||||
|
@@ -20,10 +20,10 @@ const char* *vkGetGryphnDeviceExtensions(uint32_t* outCount, VkPhysicalDevice de
|
||||
VkExtensionProperties* vkExtensions = malloc(sizeof(VkExtensionProperties) * extensionCount);
|
||||
vkEnumerateDeviceExtensionProperties(device, NULL, &extensionCount, vkExtensions);
|
||||
|
||||
gnBool supportsDescriptorPoolOverallocation = gnFalse;
|
||||
gnBool supportsDescriptorPoolOverallocation = GN_FALSE;
|
||||
for (uint32_t i = 0; i < extensionCount; i++) {
|
||||
if (strcmp(VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME, vkExtensions[i].extensionName) == 0) {
|
||||
supportsDescriptorPoolOverallocation = gnTrue;
|
||||
supportsDescriptorPoolOverallocation = GN_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
||||
};
|
||||
deviceCreateInfo.ppEnabledExtensionNames = vkGetGryphnDeviceExtensions(&deviceCreateInfo.enabledExtensionCount, deviceInfo.physicalDevice->physicalDevice->device);
|
||||
|
||||
outputDevice->outputDevice->enabledOversizedDescriptorPools = gnFalse;
|
||||
outputDevice->outputDevice->enabledOversizedDescriptorPools = GN_FALSE;
|
||||
for (int i = 0; i < deviceCreateInfo.enabledExtensionCount; i++)
|
||||
if (strcmp(deviceCreateInfo.ppEnabledExtensionNames[i], VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME) == 0) outputDevice->outputDevice->enabledOversizedDescriptorPools = gnTrue;
|
||||
if (strcmp(deviceCreateInfo.ppEnabledExtensionNames[i], VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME) == 0) outputDevice->outputDevice->enabledOversizedDescriptorPools = GN_TRUE;
|
||||
|
||||
if (instance->hasDebugger)
|
||||
deviceCreateInfo.enabledLayerCount = 0;
|
||||
|
@@ -38,24 +38,24 @@ void vulkanLoadNeededQueues(VkPhysicalDevice vulkanDevice, gnPhysicalDevice gryp
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(vulkanDevice, &queueFamilyCount, queueFamilies);
|
||||
|
||||
gryphnDevice->physicalDevice->neededQueues = malloc(sizeof(vulkanNeededQueue) * queueFamilyCount);
|
||||
gnBool foundGraphicsQueueFamily = gnFalse, foundTransferQueueFamily = gnFalse;
|
||||
gnBool foundGraphicsQueueFamily = GN_FALSE, foundTransferQueueFamily = GN_FALSE;
|
||||
for (int c = 0; c < queueFamilyCount; c++) {
|
||||
gnBool hasNeededQueue = gnFalse;
|
||||
gnBool hasNeededQueue = GN_FALSE;
|
||||
|
||||
if ((queueFamilies[c].queueFlags & VK_QUEUE_GRAPHICS_BIT) == VK_QUEUE_GRAPHICS_BIT) {
|
||||
foundGraphicsQueueFamily = true;
|
||||
hasNeededQueue = gnTrue;
|
||||
foundGraphicsQueueFamily = GN_TRUE;
|
||||
hasNeededQueue = GN_TRUE;
|
||||
}
|
||||
if ((queueFamilies[c].queueFlags & VK_QUEUE_TRANSFER_BIT) == VK_QUEUE_TRANSFER_BIT) {
|
||||
foundTransferQueueFamily = true;
|
||||
hasNeededQueue = gnTrue;
|
||||
foundTransferQueueFamily = GN_TRUE;
|
||||
hasNeededQueue = GN_TRUE;
|
||||
}
|
||||
|
||||
if (hasNeededQueue) {
|
||||
vulkanNeededQueue neededQueue = {
|
||||
.queueIndex = c,
|
||||
.createFlags = 0,
|
||||
.usedForPresent = gnFalse
|
||||
.usedForPresent = GN_FALSE
|
||||
};
|
||||
if ((queueFamilies[c].queueFlags & VK_QUEUE_GRAPHICS_BIT)) neededQueue.createFlags |= VK_QUEUE_GRAPHICS_BIT;
|
||||
if ((queueFamilies[c].queueFlags & VK_QUEUE_TRANSFER_BIT)) neededQueue.createFlags |= VK_QUEUE_TRANSFER_BIT;
|
||||
@@ -94,7 +94,7 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device
|
||||
case VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM: outputDevices[i]->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
}
|
||||
|
||||
if (instance->enabledExtensions[GN_EXT_QUEUES] == gnFalse)
|
||||
if (instance->enabledExtensions[GN_EXT_QUEUES] == GN_FALSE)
|
||||
vulkanLoadNeededQueues(physicalDevices[i], outputDevices[i]);
|
||||
|
||||
|
||||
@@ -111,13 +111,13 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device
|
||||
}
|
||||
|
||||
gnBool deviceCanPresentToSurface(gnPhysicalDevice device, gnWindowSurface surface) {
|
||||
gnBool foundQueue = gnFalse;
|
||||
gnBool foundQueue = GN_FALSE;
|
||||
for (int i = 0; i < device->physicalDevice->neededQueueCount; i++) {
|
||||
VkBool32 supportsPresent = VK_FALSE;
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, device->physicalDevice->neededQueues[i].queueIndex, surface->windowSurface->surface, &supportsPresent);
|
||||
if (supportsPresent) {
|
||||
device->physicalDevice->neededQueues[i].usedForPresent = gnTrue;
|
||||
foundQueue = gnTrue;
|
||||
device->physicalDevice->neededQueues[i].usedForPresent = GN_TRUE;
|
||||
foundQueue = GN_TRUE;
|
||||
break;
|
||||
}
|
||||
surface->windowSurface->presentQueueIndex = i;
|
||||
@@ -134,9 +134,9 @@ gnBool deviceCanPresentToSurface(gnPhysicalDevice device, gnWindowSurface surfac
|
||||
device->physicalDevice->neededQueues[device->physicalDevice->neededQueueCount] = (vulkanNeededQueue){
|
||||
.queueIndex = i,
|
||||
.createFlags = 0,
|
||||
.usedForPresent = gnTrue
|
||||
.usedForPresent = GN_TRUE
|
||||
};
|
||||
foundQueue = gnTrue;
|
||||
foundQueue = GN_TRUE;
|
||||
surface->windowSurface->presentQueueIndex = device->physicalDevice->neededQueueCount;
|
||||
device->physicalDevice->neededQueueCount++;
|
||||
break;
|
||||
@@ -146,11 +146,3 @@ gnBool deviceCanPresentToSurface(gnPhysicalDevice device, gnWindowSurface surfac
|
||||
|
||||
return foundQueue;
|
||||
}
|
||||
|
||||
// gnBool queueCanPresentToSurface(gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
||||
// VkBool32 supportsPresent = VK_FALSE;
|
||||
// vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent);
|
||||
// if (supportsPresent)
|
||||
// return gnTrue;
|
||||
// return gnFalse;
|
||||
// }
|
||||
|
@@ -91,11 +91,11 @@ VkStencilOp vkGryphnStencilOperation(gnStencilOperation operation) {
|
||||
|
||||
gnReturnCode createGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnDevice device, gnGraphicsPipelineInfo info) {
|
||||
graphicsPipeline->graphicsPipeline = malloc(sizeof(gnPlatformGraphicsPipeline));
|
||||
for (int i = 0; i < GN_DYNAMIC_STATE_MAX; i++) graphicsPipeline->graphicsPipeline->isDynamic[i] = gnFalse;
|
||||
for (int i = 0; i < GN_DYNAMIC_STATE_MAX; i++) graphicsPipeline->graphicsPipeline->isDynamic[i] = GN_FALSE;
|
||||
|
||||
graphicsPipeline->graphicsPipeline->dynamicStates = malloc(sizeof(VkDynamicState) * info.dynamicState.dynamicStateCount);
|
||||
for (int i = 0; i < info.dynamicState.dynamicStateCount; i++) {
|
||||
graphicsPipeline->graphicsPipeline->isDynamic[info.dynamicState.dynamicStates[i]] = gnTrue;
|
||||
graphicsPipeline->graphicsPipeline->isDynamic[info.dynamicState.dynamicStates[i]] = GN_TRUE;
|
||||
graphicsPipeline->graphicsPipeline->dynamicStates[i] = vkGryphnDynamicStateToVulkanDynamicState(info.dynamicState.dynamicStates[i]);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ gnReturnCode createGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnDevic
|
||||
|
||||
graphicsPipeline->graphicsPipeline->colorBlendAttachment = (VkPipelineColorBlendAttachmentState){
|
||||
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT,
|
||||
.blendEnable = ( info.colorBlending.enable == gnTrue ) ? VK_TRUE : VK_FALSE,
|
||||
.blendEnable = ( info.colorBlending.enable == GN_TRUE ) ? VK_TRUE : VK_FALSE,
|
||||
.srcColorBlendFactor = vkGryphnBlendFactor(info.colorBlending.sourceColorBlendFactor),
|
||||
.dstColorBlendFactor = vkGryphnBlendFactor(info.colorBlending.destinationColorBlendFactor),
|
||||
.colorBlendOp = vkGryphnBlendOperation(info.colorBlending.colorBlendOperation),
|
||||
|
@@ -178,7 +178,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
VkMemoryRequirements memRequirements;
|
||||
vkGetImageMemoryRequirements(device->outputDevice->device, texture->texture->image.image, &memRequirements);
|
||||
|
||||
gnBool foundMemory = gnFalse;
|
||||
gnBool foundMemory = GN_FALSE;
|
||||
VkMemoryAllocateInfo allocInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
.allocationSize = memRequirements.size,
|
||||
@@ -191,7 +191,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
|
||||
vkBindImageMemory(device->outputDevice->device, texture->texture->image.image, texture->texture->image.memory, 0);
|
||||
|
||||
texture->texture->beenWrittenToo = gnFalse;
|
||||
texture->texture->beenWrittenToo = GN_FALSE;
|
||||
|
||||
VkImageViewCreateInfo viewInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
@@ -255,7 +255,7 @@ void textureData(gnTextureHandle texture, void* pixelData) {
|
||||
VkCopyBufferToImage(texture->texture->buffer, texture->texture->image, texture->info.extent, texture->device);
|
||||
VkTransitionImageLayout(texture->device, texture->texture->image.image, texture->info.format, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
|
||||
texture->texture->beenWrittenToo = gnTrue;
|
||||
texture->texture->beenWrittenToo = GN_TRUE;
|
||||
}
|
||||
|
||||
void gnDestroyVulkanImage(VkGryphnImage* image, VkDevice device) {
|
||||
|
@@ -12,7 +12,7 @@ gnReturnCode createUniformPool(gnUniformPool pool, gnDeviceHandle device) {
|
||||
pool->uniformPool = malloc(sizeof(struct gnPlatformUniformPool_t));
|
||||
pool->uniformPool->pools = VkGryphnUniformPoolArrayListCreate();
|
||||
|
||||
if (device->outputDevice->enabledOversizedDescriptorPools == gnTrue) {
|
||||
if (device->outputDevice->enabledOversizedDescriptorPools == GN_TRUE) {
|
||||
{
|
||||
VkGryphnUniformPool firstPool = {
|
||||
.pool = VK_NULL_HANDLE,
|
||||
|
Reference in New Issue
Block a user