92 lines
1.9 KiB
C++
92 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <sophia/handles.hpp>
|
|
#include <sophia/math.hpp>
|
|
#include <sophia/types.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "vulkan/buffer.hpp"
|
|
|
|
namespace sophia {
|
|
|
|
struct DrawPacket {
|
|
/* Geometry */
|
|
// BufferHandle vertexBuffer;
|
|
// BufferHandle indexBuffer;
|
|
u32 indexCount;
|
|
u32 firstIndex;
|
|
|
|
/* Shader & state */
|
|
// PipelineHandle pipelineState; // Contains shaders, blend state, depth
|
|
// settings
|
|
|
|
/* Bindings */
|
|
// DescriptorSetHandle resourceBindings; // Textures, Uniform Buffers,
|
|
// Storage Buffers
|
|
|
|
/* Transform / Constants */
|
|
u32 pushConstantData[16];
|
|
};
|
|
|
|
struct RenderView {
|
|
mat4 view;
|
|
mat4 projection;
|
|
vec2 viewport;
|
|
|
|
RenderTargetHandle target;
|
|
};
|
|
|
|
// struct ComputePacket {
|
|
// ComputePipelineHandle pipeline;
|
|
// DescriptorSetHandle
|
|
// resourceBindings; // Includes storage buffers, uniforms, textures
|
|
|
|
// // Grid dimensions
|
|
// uint32_t groupCountX = 1;
|
|
// uint32_t groupCountY = 1;
|
|
// uint32_t groupCountZ = 1;
|
|
|
|
// // Optional push constants for dynamic per-dispatch parameters
|
|
// uint8_t pushConstants[64];
|
|
// uint32_t pushConstantSize = 0;
|
|
// };
|
|
|
|
// !TODO move to render graph
|
|
enum class RenderPassType { Graphics, Compute };
|
|
|
|
// !TODO move to render graph (???)
|
|
struct RenderPass {
|
|
std::string name;
|
|
RenderPassType type;
|
|
|
|
// Declared for automatic barrier injection & resource synchronization
|
|
std::vector<Buffer> readBuffers; // BufferHandle instead?
|
|
std::vector<Buffer> writeBuffers; // BufferHandle instead?
|
|
|
|
// Commands in this pass
|
|
// std::vector<ComputePacket> computeDispatches;
|
|
std::vector<DrawPacket> opaqueDrawPackets;
|
|
std::vector<DrawPacket> transparentDrawPackets;
|
|
};
|
|
|
|
struct RenderPacket {
|
|
RenderView view;
|
|
std::vector<RenderPass> passes;
|
|
};
|
|
|
|
class Renderer {
|
|
public:
|
|
Renderer(const Renderer&) = delete;
|
|
Renderer& operator=(const Renderer&) = delete;
|
|
|
|
Renderer();
|
|
~Renderer();
|
|
|
|
// PipelineHandle createPipeline();
|
|
|
|
private:
|
|
};
|
|
|
|
} // namespace sophia
|