// ============================================= // Aster: pipeline_utils.h // Copyright (c) 2020-2024 Anish Bhobe // ============================================= #pragma once #include "pipeline.h" #include struct RenderResourceManager; struct Swapchain; struct Device; constexpr auto VERTEX_SHADER_FILE = "shader/model.vert.glsl.spv"; constexpr auto FRAGMENT_SHADER_FILE = "shader/model.frag.glsl.spv"; struct Vertex { vec3 m_Position; vec2 m_UV0; constexpr static vk::VertexInputBindingDescription GetBinding(const u32 binding) { return {.binding = binding, .stride = sizeof(Vertex), .inputRate = vk::VertexInputRate::eVertex}; } constexpr static eastl::array GetAttributes(const u32 binding) { return { vk::VertexInputAttributeDescription{ .location = 0, .binding = binding, .format = vk::Format::eR32G32B32Sfloat, .offset = offsetof(Vertex, m_Position), }, vk::VertexInputAttributeDescription{ .location = 1, .binding = binding, .format = vk::Format::eR32G32Sfloat, .offset = offsetof(Vertex, m_UV0), }, }; } }; vk::ShaderModule CreateShader(const Device *device, cstr shaderFile); Pipeline CreatePipeline(const Device *device, const Swapchain *swapchain, const RenderResourceManager *resourceManager);