diff --git a/include/gryphn/gryphn.h b/include/gryphn/gryphn.h index 9dd774e..b40146e 100644 --- a/include/gryphn/gryphn.h +++ b/include/gryphn/gryphn.h @@ -11,3 +11,5 @@ #include #include #include +#include +#include diff --git a/rendering_api/metal/src/core/presentation_queue/metal_presentation_queue.m b/rendering_api/metal/src/core/presentation_queue/metal_presentation_queue.m index 442ee9c..1da44b0 100644 --- a/rendering_api/metal/src/core/presentation_queue/metal_presentation_queue.m +++ b/rendering_api/metal/src/core/presentation_queue/metal_presentation_queue.m @@ -2,6 +2,7 @@ #include "core/surface/metal_surface.h" #include "core/devices/metal_output_devices.h" #include "core/debugger/gryphn_debugger.h" +#include "core/texture/metal_texture.h" gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo) { if (presentationInfo.minImageCount > 3) { @@ -33,9 +34,12 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, textureDescriptor.usage = MTLTextureUsageRenderTarget; textureDescriptor.textureType = MTLTextureType2D; - + presentationQueue->imageCount = presentationInfo.minImageCount; + presentationQueue->images = malloc(sizeof(gnTexture) * presentationInfo.minImageCount); for (int i = 0; i < presentationInfo.minImageCount; i++) { presentationQueue->presentationQueue->textures[i] = [device->outputDevice->device newTextureWithDescriptor:textureDescriptor]; + presentationQueue->images[i].texture = malloc(sizeof(gnPlatformTexture)); + presentationQueue->images[i].texture->texture = presentationQueue->presentationQueue->textures[i]; } return GN_SUCCESS; diff --git a/rendering_api/metal/src/core/texture/metal_texture.h b/rendering_api/metal/src/core/texture/metal_texture.h new file mode 100644 index 0000000..5ec174a --- /dev/null +++ b/rendering_api/metal/src/core/texture/metal_texture.h @@ -0,0 +1,7 @@ +#pragma once +#include "core/textures/gryphn_texture.h" +#import + +typedef struct gnPlatformTexture_t { + id texture; +} gnPlatformTexture; diff --git a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c index 00f54d3..fb582af 100644 --- a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c +++ b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c @@ -3,6 +3,7 @@ #include #include "vulkan_surface/vulkan_surface.h" #include "core/debugger/gryphn_debugger.h" +#include "textures/vulkan_texture.h" gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo) { presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t)); @@ -93,11 +94,16 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; imageViewCreateInfo.subresourceRange.layerCount = 1; + presentationQueue->images = malloc(sizeof(gnTexture) * presentationQueue->imageCount); for (int i = 0; i < presentationQueue->imageCount; i++) { + presentationQueue->images[i].texture = malloc(sizeof(gnPlatformTexture)); imageViewCreateInfo.image = presentationQueue->presentationQueue->swapChainImages[i]; if (vkCreateImageView(device->outputDevice->device, &imageViewCreateInfo, NULL, &presentationQueue->presentationQueue->swapChainImageViews[i]) != VK_SUCCESS) { return GN_FAILED_TO_CREATE_IMAGE_VIEW; } + + presentationQueue->images[i].texture->image = presentationQueue->presentationQueue->swapChainImages[i]; + presentationQueue->images[i].texture->imageView = presentationQueue->presentationQueue->swapChainImageViews[i]; } return GN_SUCCESS; diff --git a/rendering_api/vulkan/src/textures/vulkan_texture.h b/rendering_api/vulkan/src/textures/vulkan_texture.h new file mode 100644 index 0000000..32d0e01 --- /dev/null +++ b/rendering_api/vulkan/src/textures/vulkan_texture.h @@ -0,0 +1,8 @@ +#pragma once +#include +#include "core/textures/gryphn_texture.h" + +typedef struct gnPlatformTexture_t { + VkImage image; + VkImageView imageView; +} gnPlatformTexture; diff --git a/src/core/framebuffer/gryphn_framebuffer.h b/src/core/framebuffer/gryphn_framebuffer.h new file mode 100644 index 0000000..031e0cd --- /dev/null +++ b/src/core/framebuffer/gryphn_framebuffer.h @@ -0,0 +1,5 @@ +#pragma once + +typedef struct gnFramebuffer_t { + +} gnFramebuffer; diff --git a/src/core/presentation_queue/gryphn_presentation_queue.h b/src/core/presentation_queue/gryphn_presentation_queue.h index 39985fe..969961e 100644 --- a/src/core/presentation_queue/gryphn_presentation_queue.h +++ b/src/core/presentation_queue/gryphn_presentation_queue.h @@ -21,6 +21,7 @@ typedef struct gnPresentationQueue_t { struct gnOutputDevice_t* outputDevice; gnBool valid; uint32_t imageCount; + struct gnTexture_t* images; } gnPresentationQueue; gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo); diff --git a/src/core/textures/gryphn_texture.h b/src/core/textures/gryphn_texture.h new file mode 100644 index 0000000..ab26be2 --- /dev/null +++ b/src/core/textures/gryphn_texture.h @@ -0,0 +1,7 @@ +#pragma once + +struct gnPlatformTexture_t; + +typedef struct gnTexture_t { + struct gnPlatformTexture_t* texture; +} gnTexture;