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
+1 -1
View File
@@ -48,6 +48,6 @@ void Camera::buildViewMatrix() {
Vector lookAt = eyePos + getTransform().getForward();
viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
cameraPos = eyePos;
cameraForward = getTransform().getForward();
cameraForward = -getTransform().getForward();
bNeedsViewBuild = false;
}
+1 -1
View File
@@ -503,7 +503,6 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
set->updateBuffer(NEIGHBOURS_BUFFER, 0, currentNeighborsBuffer);
set->updateBuffer(MEMORY_BUFFER, 0, memoryBuffer);
set->updateBuffer(ALLOCATE_BUFFER, 0, mesh.allocateBuffer);
set->updateBuffer(DEBUG_BUFFER, 0, debugBuffer);
set->writeChanges();
Gfx::OComputeCommand splitCmd = graphics->createComputeCommand("Split");
splitCmd->bindPipeline(split);
@@ -581,6 +580,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
set->updateBuffer(NEIGHBOURS_BUFFER, 0, currentNeighborsBuffer);
set->updateBuffer(NEIGHBOURS_OUTPUT_BUFFER, 0, nextNeighborsBuffer);
set->updateBuffer(PROPAGATE_BUFFER, 0, mesh.propagateBuffer);
set->updateBuffer(DEBUG_BUFFER, 0, debugBuffer);
set->writeChanges();
Gfx::OComputeCommand bisectCmd = graphics->createComputeCommand("Bisect");
bisectCmd->bindPipeline(bisect);
+2
View File
@@ -88,6 +88,8 @@ class Graphics {
virtual PComputePipeline createComputePipeline(ComputePipelineCreateInfo createInfo) = 0;
virtual OSampler createSampler(const SamplerCreateInfo& createInfo) = 0;
virtual OComputeShader createComputeShaderFromBinary(std::string_view binaryName) = 0;
virtual ODescriptorLayout createDescriptorLayout(const std::string& name = "") = 0;
virtual OPipelineLayout createPipelineLayout(const std::string& name = "", PPipelineLayout baseLayout = nullptr) = 0;
+6
View File
@@ -284,6 +284,12 @@ Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) {
return new Sampler(this, vkInfo);
}
Gfx::OComputeShader Graphics::createComputeShaderFromBinary(std::string_view binaryName) {
OComputeShader shader = new ComputeShader(this);
shader->create(binaryName);
return shader;
}
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); }
Gfx::OPipelineLayout Graphics::createPipelineLayout(const std::string& name, Gfx::PPipelineLayout baseLayout) {
+2
View File
@@ -66,6 +66,8 @@ class Graphics : public Gfx::Graphics {
virtual Gfx::PRayTracingPipeline createRayTracingPipeline(Gfx::RayTracingPipelineCreateInfo createInfo) override;
virtual Gfx::PComputePipeline createComputePipeline(Gfx::ComputePipelineCreateInfo createInfo) override;
virtual Gfx::OSampler createSampler(const SamplerCreateInfo& createInfo) override;
virtual Gfx::OComputeShader createComputeShaderFromBinary(std::string_view binaryName) override;
virtual Gfx::ODescriptorLayout createDescriptorLayout(const std::string& name = "") override;
virtual Gfx::OPipelineLayout createPipelineLayout(const std::string& name = "", Gfx::PPipelineLayout baseLayout = nullptr) override;
+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));
}
+1
View File
@@ -14,6 +14,7 @@ class Shader {
virtual ~Shader();
void create(const ShaderCreateInfo& createInfo);
void create(std::string_view binary);
constexpr VkShaderModule getModuleHandle() const { return module; }
constexpr const char* getEntryPointName() const {