This commit is contained in:
Martin Slachta
2026-07-18 14:31:15 +02:00
commit a04f0dc262
3343 changed files with 1140208 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
//
// Created by martin on 10/24/23.
//
#ifndef LOFT_SHADER_HPP
#define LOFT_SHADER_HPP
#include "Gpu.hpp"
#include "io/ShaderBinary.h"
#include <volk.h>
#include <utility>
struct Shader {
private:
VkShaderModule m_module;
public:
Shader(Shader&& s) :
m_module(s.m_module) {
}
Shader(VkShaderModule m) :
m_module(m) {
}
const inline Shader& set_name(const Gpu* gpu, const std::string &name) {
#if LOFT_DEBUG
VkDebugUtilsObjectNameInfoEXT nameInfo = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.objectType = VK_OBJECT_TYPE_SHADER_MODULE,
.objectHandle = (uint64_t) m_module,
.pObjectName = name.c_str(),
};
vkSetDebugUtilsObjectNameEXT(gpu->dev(), &nameInfo);
#endif
return *this;
}
[[nodiscard]] inline VkShaderModule module() const {
return m_module;
}
};
#endif //LOFT_SHADER_HPP