The first frames work finally

This commit is contained in:
Dynamitos
2024-10-19 11:54:04 +02:00
parent 1193406dd8
commit 17746f8d20
11 changed files with 101 additions and 134 deletions
+18 -1
View File
@@ -4,6 +4,7 @@
#include "slang-com-ptr.h"
#include "slang.h"
#include "stdlib.h"
#include <fstream>
#include <fmt/core.h>
using namespace Seele;
@@ -32,4 +33,20 @@ void Shader::create(const ShaderCreateInfo& createInfo) {
VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module));
hash = CRC::Calculate(kernelBlob->getBufferPointer(), kernelBlob->getBufferSize(), CRC::CRC_32(), hash);
}
}
void Shader::create(std::string_view binary) {
std::ifstream stream(binary.data(), std::ios::binary | std::ios::ate);
uint64 fullSize = stream.tellg();
stream.seekg(0, std::ios::beg);
Array<uint32> buffer(fullSize);
stream.read((char*)buffer.data(), fullSize);
VkShaderModuleCreateInfo moduleInfo = {
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
.codeSize = buffer.size() / sizeof(uint32),
.pCode = (uint32*)buffer.data(),
};
VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module));
}