Fixed all validation errors on Windows machine.

This commit is contained in:
connellpaxton 2024-01-25 20:33:45 -05:00
parent c9e2877530
commit 9ffe7c14de
6 changed files with 10 additions and 4 deletions

View File

@ -173,6 +173,7 @@ GraphicsPipeline::GraphicsPipeline(vk::Device dev, const std::vector<Shader>& sh
} }
pipeline = res.value; pipeline = res.value;
dev.destroyPipelineLayout(layout);
} }
void GraphicsPipeline::update(uint32_t binding, const UniformBuffer& uni) { void GraphicsPipeline::update(uint32_t binding, const UniformBuffer& uni) {

View File

@ -188,6 +188,9 @@ Renderer::Renderer(Window& win) : win(win) {
}; };
pipeline = std::make_unique<GraphicsPipeline>(dev, shaders, swapchain->extent, *render_pass, bindings, *vertex_buffer); pipeline = std::make_unique<GraphicsPipeline>(dev, shaders, swapchain->extent, *render_pass, bindings, *vertex_buffer);
shaders[0].cleanup();
shaders[1].cleanup();
} }
void Renderer::draw() { void Renderer::draw() {

View File

@ -5,7 +5,7 @@
using namespace std::string_literals; using namespace std::string_literals;
Shader::Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits stage) : fname(fname), stage(stage) { Shader::Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits stage) : dev(dev), fname(fname), stage(stage) {
std::vector<uint8_t> src; std::vector<uint8_t> src;
try { try {
src = file::slurpb(fname); src = file::slurpb(fname);
@ -25,6 +25,7 @@ Shader::Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits
Log::info("Successfully created shader "s + fname + "\n"); Log::info("Successfully created shader "s + fname + "\n");
} }
void Shader::cleanup(vk::Device dev) { void Shader::cleanup() {
dev.destroyShaderModule(module); dev.destroyShaderModule(module);
} }

View File

@ -4,11 +4,11 @@
#include <vulkan/vulkan.hpp> #include <vulkan/vulkan.hpp>
struct Shader { struct Shader {
vk::Device dev;
vk::ShaderModule module; vk::ShaderModule module;
vk::ShaderStageFlagBits stage; vk::ShaderStageFlagBits stage;
Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits stage); Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits stage);
void cleanup(vk::Device dev);
inline operator vk::ShaderModule() const { inline operator vk::ShaderModule() const {
return module; return module;
@ -28,4 +28,5 @@ struct Shader {
std::string fname; std::string fname;
void cleanup();
}; };

View File

@ -1,7 +1,7 @@
#version 460 core #version 460 core
layout (location = 0) out vec4 FragColor; layout (location = 0) out vec4 FragColor;
layout (set = 1, binding = 0) uniform Matrices { layout (set = 0, binding = 0) uniform Matrices {
mat4 mpv; mat4 mpv;
float time; float time;
}; };

Binary file not shown.