update gryphn to use GN_FALSE + GN_TRUE
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "metal_loader.h"
|
||||
|
||||
gnBool metalIsExtensionSupported(gnExtension extension) {
|
||||
if (extension == GN_EXT_SYNCHRONIZATION) return gnTrue;
|
||||
if (extension == GN_EXT_QUEUES) return gnFalse;
|
||||
return gnFalse;
|
||||
if (extension == GN_EXT_SYNCHRONIZATION) return GN_TRUE;
|
||||
if (extension == GN_EXT_QUEUES) return GN_FALSE;
|
||||
return GN_FALSE;
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ gnReturnCode allocateMetalCommandBuffers(gnCommandBufferHandle* commandBuffers,
|
||||
|
||||
// write a command log at some point
|
||||
if ((pool->info.flags & GN_REUSE_COMMAND_BUFFERS) == GN_REUSE_COMMAND_BUFFERS)
|
||||
commandBuffers[i]->commandBuffer->isIndirectCommandBuffer = gnTrue;
|
||||
commandBuffers[i]->commandBuffer->isIndirectCommandBuffer = GN_TRUE;
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
|
@@ -117,7 +117,7 @@ void metalBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t
|
||||
if (uniform->uniform->isDynamic[c]) {
|
||||
gnBufferUniformInfo updateInfo = {
|
||||
.binding = c,
|
||||
.dynamic = gnTrue,
|
||||
.dynamic = GN_TRUE,
|
||||
.offset = dynamicOffsets[i],
|
||||
.size = 0
|
||||
};
|
||||
|
@@ -23,14 +23,6 @@ gnPhysicalDevice* getMetalDevices(gnInstanceHandle instance, uint32_t* deviceCou
|
||||
else if (deviceLocation == MTLDeviceLocationExternal)
|
||||
devicesList[i]->properties.deviceType = GN_EXTERNAL_DEVICE;
|
||||
|
||||
// below I am going to fake that there is one queue that can support graphics, compute, and transfer queues
|
||||
// devicesList[i]->queueProperties.queueCount = 1;
|
||||
// devicesList[i]->queueProperties.queueProperties = malloc(sizeof(gnQueueProperties));
|
||||
// devicesList[i]->queueProperties.queueProperties[0] = (gnQueueProperties){
|
||||
// .queueCount = 1,
|
||||
// .queueType = GN_QUEUE_GRAPHICS | GN_QUEUE_COMPUTE | GN_QUEUE_TRANSFER
|
||||
// };
|
||||
|
||||
devicesList[i]->features.maxColorSamples = GN_SAMPLE_BIT_1;
|
||||
if ([device supportsTextureSampleCount:2]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_2; } else {}
|
||||
if ([device supportsTextureSampleCount:4]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_4; } else {}
|
||||
@@ -47,5 +39,5 @@ gnPhysicalDevice* getMetalDevices(gnInstanceHandle instance, uint32_t* deviceCou
|
||||
}
|
||||
|
||||
gnBool metalCanDevicePresent(gnPhysicalDevice device, gnWindowSurface windowSurface) {
|
||||
return gnTrue; // I belive that a window should always be able to present to a surface in metal
|
||||
return GN_TRUE; // I belive that a window should always be able to present to a surface in metal
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ gnReturnCode createMetalFramebuffer(gnFramebuffer framebuffer, gnOutputDevice de
|
||||
framebuffer->framebuffer->clearCopyCount = info.attachmentCount;
|
||||
framebuffer->framebuffer->clearCopies = malloc(sizeof(mtlClearCopy) * info.attachmentCount);
|
||||
for (int i = 0; i < info.attachmentCount; i++) {
|
||||
framebuffer->framebuffer->clearCopies[i].clear = gnFalse;
|
||||
framebuffer->framebuffer->clearCopies[i].clear = GN_FALSE;
|
||||
}
|
||||
|
||||
framebuffer->framebuffer->subpassCount = info.renderPassDescriptor->renderPassDescriptor->subpassCount;
|
||||
@@ -27,7 +27,7 @@ gnReturnCode createMetalFramebuffer(gnFramebuffer framebuffer, gnOutputDevice de
|
||||
colorPass.texture = info.attachments[info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].attachmentIndex]->texture->texture;
|
||||
if (info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].resolveAttachmentIndex >= 0)
|
||||
colorPass.resolveTexture = info.attachments[info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].resolveAttachmentIndex]->texture->texture;
|
||||
framebuffer->framebuffer->clearCopies[info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].attachmentIndex].clear = gnTrue;
|
||||
framebuffer->framebuffer->clearCopies[info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].attachmentIndex].clear = GN_TRUE;
|
||||
framebuffer->framebuffer->clearCopies[info.renderPassDescriptor->renderPassDescriptor->copyInfos[i].colorAttachments[c].attachmentIndex].descriptor = colorPass;
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn
|
||||
MTLRenderPassColorAttachmentDescriptor* colorPass = subpass.colorAttachments[i];
|
||||
|
||||
descriptor.colorAttachments[i].pixelFormat = copyInfo.colorAttachments[i].format;
|
||||
if (info.colorBlending.enable == gnTrue) {
|
||||
if (info.colorBlending.enable == GN_TRUE) {
|
||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = YES;
|
||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].rgbBlendOperation = mtlGryphnBlendOperation(info.colorBlending.colorBlendOperation);
|
||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].alphaBlendOperation = mtlGryphnBlendOperation(info.colorBlending.alphaBlendOperation);
|
||||
|
@@ -22,7 +22,7 @@ gnReturnCode metalSyncSubmit(gnOutputDevice device, gnSubmitSyncInfo info) {
|
||||
NSLog(@"Command buffer error: %s", buffer.error.localizedDescription.UTF8String);
|
||||
}
|
||||
if (atomic_fetch_sub_explicit(&buffersLeft, 1, memory_order_acq_rel) == 1) {
|
||||
fenceToSignal->signaled = gnTrue;
|
||||
fenceToSignal->signaled = GN_TRUE;
|
||||
}
|
||||
}];
|
||||
|
||||
|
@@ -15,7 +15,7 @@ void singalMetalFence(gnFence fence) {
|
||||
}
|
||||
void waitForMetalFence(gnFence fence, uint64_t timeout) {
|
||||
// dispatch_semaphore_wait(fence->fence->semaphore, timeout);
|
||||
while (fence->signaled == gnFalse) {}
|
||||
while (fence->signaled == GN_FALSE) {}
|
||||
}
|
||||
void resetMetalFence(gnFence fence) {
|
||||
// dispatch_semaphore_signal(fence->fence->semaphore);
|
||||
|
Reference in New Issue
Block a user