Files
RayTracer/src/gpu/GPURenderer.h
T

71 lines
1.4 KiB
C++
Raw Normal View History

2025-01-25 13:04:12 +01:00
#pragma once
2025-01-28 13:11:40 +01:00
#include "gpu/GPUScene.h"
2025-01-25 20:08:21 +01:00
#include "scene/Renderer.h"
2025-01-25 13:04:12 +01:00
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_raii.hpp>
2025-01-28 00:08:52 +01:00
#include <vma/vk_mem_alloc.h>
2025-01-25 13:04:12 +01:00
using namespace vk::raii;
2025-01-25 20:08:21 +01:00
struct GPURenderer : public Renderer
2025-01-25 13:04:12 +01:00
{
public:
2025-01-25 20:08:21 +01:00
GPURenderer();
virtual ~GPURenderer();
2025-01-25 13:04:12 +01:00
private:
2025-01-28 00:08:52 +01:00
struct GPUCamera
{
glm::vec3 cameraPosition;
float f;
glm::vec3 cameraForward;
float S_O;
glm::vec3 fogEmm;
float ks;
float A;
float ka;
};
2025-01-25 14:51:17 +01:00
void createDevice();
void createCommands();
void createDescriptors();
void createShaders();
2025-01-28 13:11:40 +01:00
std::unique_ptr<GPUScene> scene;
2025-01-25 13:04:12 +01:00
Context context;
Instance instance;
PhysicalDevice physicalDevice;
Device device;
Queue queue;
2025-01-28 00:08:52 +01:00
VmaAllocator allocator;
2025-01-25 13:04:12 +01:00
2025-01-25 14:51:17 +01:00
uint32_t computeQueueFamily;
2025-01-25 13:04:12 +01:00
CommandPool cmdPool;
CommandBuffers cmdBuffers;
2025-01-28 13:11:40 +01:00
std::vector<Semaphore> semaphores;
std::vector<Fence> fences;
2025-01-25 13:04:12 +01:00
DescriptorSetLayout descriptorLayout;
DescriptorSet descriptorSet;
DescriptorPool descriptorPool;
PipelineLayout pipelineLayout;
ShaderModule rayGen;
ShaderModule closestHit;
ShaderModule miss;
Pipeline pipeline;
2025-01-28 13:11:40 +01:00
Buffer cameraBuffer;
2025-01-28 00:08:52 +01:00
VmaAllocation cameraAllocation;
2025-01-28 13:11:40 +01:00
Image radianceAccumulator;
ImageView radianceView;
2025-01-28 00:08:52 +01:00
VmaAllocation radianceAllocation;
2025-01-28 13:11:40 +01:00
Image image;
ImageView imageView;
2025-01-28 00:08:52 +01:00
VmaAllocation imageAllocation;
2025-01-25 13:04:12 +01:00
virtual void render(Camera cam, RenderParameter param);
};