flip the viewport in vulkan so that top is on the top

This commit is contained in:
Greg Wells
2025-05-30 13:41:11 -04:00
parent 7ebb109c44
commit eb244447cc
7 changed files with 14 additions and 9 deletions

View File

@@ -22,10 +22,10 @@ void gnCommandBeginRenderPassFn(struct gnCommandBuffer_t* buffer, struct gnRende
.framebuffer = passInfo.framebuffer->framebuffer->framebuffer,
.renderArea = {
.extent = { passInfo.size.x, passInfo.size.y },
.offset = { passInfo.offset.x, passInfo.offset.x }
.offset = { passInfo.offset.x, passInfo.offset.y }
},
.clearValueCount = passInfo.clearValueCount,
.pClearValues = values
.pClearValues = values,
};
vkCmdBeginRenderPass(buffer->commandBuffer->buffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
@@ -39,9 +39,9 @@ void gnCommandBindGraphicsPipelineFn(struct gnCommandBuffer_t* buffer, struct gn
void gnCommandSetViewportFn(struct gnCommandBuffer_t* buffer, struct gnViewport_t viewport) {
VkViewport vkViewport = {
.x = viewport.position.x,
.y = viewport.position.y,
.y = viewport.size.y,
.width = viewport.size.x,
.height = viewport.size.y,
.height = -viewport.size.y,
.minDepth = viewport.minDepth,
.maxDepth = viewport.maxDepth
};

View File

@@ -65,10 +65,10 @@ gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstance* in
}
void gnWaitForDeviceFn(const gnOutputDevice* device) {
// vkDeviceWaitIdle(device->outputDevice->device);
vkDeviceWaitIdle(device->outputDevice->device);
}
void gnDestroyOutputDeviceFn(gnOutputDevice* device) {
// vkDestroyCommandPool(device.outputDevice->device, device.outputDevice->commandPool, nullptr);
vkDestroyDevice(device->outputDevice->device, NULL);
free(device->outputDevice);
}

View File

@@ -113,7 +113,7 @@ gnReturnCode gnCreateGraphicsPipelineFn(struct gnGraphicsPipeline_t* graphicsPip
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
.polygonMode = vkGryphnPolygonMode(info.fillMode),
.lineWidth = 1.0f,
.frontFace = ( info.cullMode.direction == GN_DIRECTION_CLOCK_WISE ) ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE,
.frontFace = ( info.cullMode.direction == GN_DIRECTION_CLOCK_WISE ) ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE,
.cullMode = vkGryphnCullMode(info.cullMode.face),
.depthBiasEnable = VK_FALSE,
.depthBiasConstantFactor = 0.0f,

View File

@@ -89,6 +89,8 @@ typedef struct gnDeviceFunctions_t {
gnReturnCode (*_gnSubmit)(struct gnOutputDevice_t* device, struct gnSubmitInfo_t submit);
gnReturnCode (*_gnPresent)(struct gnOutputDevice_t* device, struct gnPresentInfo_t info);
void (*_gnWaitForDevice)(struct gnOutputDevice_t* device);
} gnDeviceFunctions;
typedef struct gnCommandFunctions_t {

View File

@@ -91,6 +91,7 @@ void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFuncti
gnLoadDLLFunction(lib, functions->_gnDestroyFence, "gnDestroyFenceFn");
gnLoadDLLFunction(lib, functions->_gnSubmit, "gnSubmitFn");
gnLoadDLLFunction(lib, functions->_gnPresent, "gnPresentFn");
gnLoadDLLFunction(lib, functions->_gnWaitForDevice, "gnWaitForDeviceFn");
}
void gnLoadCommandFunctions(struct gnDynamicLibrary_t* lib, struct gnCommandFunctions_t* functions) {

View File

@@ -17,6 +17,9 @@ gnReturnCode gnCreateOutputDevice(gnOutputDevice* outputDevice, gnInstance* inst
outputDevice->deviceInfo = deviceInfo;
return instance->functions->_gnCreateOutputDevoce(outputDevice, instance, deviceInfo);
}
void gnWaitForDevice(gnOutputDevice *device) {
device->deviceFunctions->_gnWaitForDevice(device);
}
void gnDestroyOutputDevice(gnOutputDevice* device) {
device->instance->functions->_gnDestroyOutputDevice(device);
}

View File

@@ -26,6 +26,5 @@ typedef struct gnOutputDevice_t {
} gnOutputDevice;
gnReturnCode gnCreateOutputDevice(gnOutputDevice* outputDevice, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo);
void gnWaitForDevice(gnOutputDevice* device);
void gnDestroyOutputDevice(gnOutputDevice* device);
// inline void (*gnWaitForDevice)(const gnOutputDevice& device);