throw together the worlds worst texture api
This commit is contained in:
@@ -11,3 +11,5 @@
|
||||
#include <core/shader_module/gryphn_shader_module.h>
|
||||
#include <core/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h>
|
||||
#include <core/renderpass/gryphn_render_pass_descriptor.h>
|
||||
#include <core/framebuffer/gryphn_framebuffer.h>
|
||||
#include <core/textures/gryphn_texture.h>
|
||||
|
@@ -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;
|
||||
|
7
rendering_api/metal/src/core/texture/metal_texture.h
Normal file
7
rendering_api/metal/src/core/texture/metal_texture.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "core/textures/gryphn_texture.h"
|
||||
#import <Metal/MTLTexture.h>
|
||||
|
||||
typedef struct gnPlatformTexture_t {
|
||||
id<MTLTexture> texture;
|
||||
} gnPlatformTexture;
|
@@ -3,6 +3,7 @@
|
||||
#include <output_device/vulkan_physical_device.h>
|
||||
#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;
|
||||
|
8
rendering_api/vulkan/src/textures/vulkan_texture.h
Normal file
8
rendering_api/vulkan/src/textures/vulkan_texture.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "core/textures/gryphn_texture.h"
|
||||
|
||||
typedef struct gnPlatformTexture_t {
|
||||
VkImage image;
|
||||
VkImageView imageView;
|
||||
} gnPlatformTexture;
|
5
src/core/framebuffer/gryphn_framebuffer.h
Normal file
5
src/core/framebuffer/gryphn_framebuffer.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct gnFramebuffer_t {
|
||||
|
||||
} gnFramebuffer;
|
@@ -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);
|
||||
|
7
src/core/textures/gryphn_texture.h
Normal file
7
src/core/textures/gryphn_texture.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
struct gnPlatformTexture_t;
|
||||
|
||||
typedef struct gnTexture_t {
|
||||
struct gnPlatformTexture_t* texture;
|
||||
} gnTexture;
|
Reference in New Issue
Block a user