Rt works now, no idea why

This commit is contained in:
Dynamitos
2024-07-15 09:18:59 +02:00
parent 42d98d7233
commit 38986f4bfc
21 changed files with 251 additions and 206 deletions
+2 -2
View File
@@ -120,11 +120,11 @@ void BasePass::beginFrame(const Component::Camera& cam) {
.size = sizeof(SkyboxData),
.data = (uint8*)&skyboxData,
});
skyboxBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_UNIFORM_READ_BIT,
Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
skyboxDataSet = skyboxDataLayout->allocateDescriptorSet();
skyboxDataSet->updateBuffer(0, skyboxBuffer);
skyboxDataSet->writeChanges();
skyboxBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_UNIFORM_READ_BIT,
Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
textureSet = textureLayout->allocateDescriptorSet();
textureSet->updateTexture(0, skybox.day);
textureSet->updateTexture(1, skybox.night);
@@ -1,4 +1,7 @@
#include "RayTracingPass.h"
#include "Asset/AssetRegistry.h"
#include "Asset/MeshAsset.h"
#include "Graphics/Mesh.h"
#include "Graphics/RayTracing.h"
#include "Graphics/Shader.h"
#include "Graphics/StaticMeshVertexData.h"
@@ -74,7 +77,7 @@ void RayTracingPass::render() {
}
}
}
Gfx::OTopLevelAS tlas = graphics->createTopLevelAccelerationStructure(Gfx::TopLevelASCreateInfo{
tlas = graphics->createTopLevelAccelerationStructure(Gfx::TopLevelASCreateInfo{
.instances = instanceData,
.bottomLevelStructures = accelerationStructures,
});
@@ -84,14 +87,6 @@ void RayTracingPass::render() {
desc->updateBuffer(2, StaticMeshVertexData::getInstance()->getIndexBuffer());
desc->writeChanges();
Gfx::PRayTracingPipeline pipeline = graphics->createRayTracingPipeline(Gfx::RayTracingPipelineCreateInfo{
.pipelineLayout = pipelineLayout,
.rayGenGroup = {.shader = rayGen},
.hitGroups = {{.closestHitShader = closestHit}},
.missGroups = {{.shader = miss}},
.callableGroups = callableGroups,
});
command->bindPipeline(pipeline);
StaticMeshVertexData::getInstance()->getInstanceDataSet()->writeChanges();
StaticMeshVertexData::getInstance()->getVertexDataSet()->writeChanges();
@@ -123,9 +118,8 @@ void RayTracingPass::publishOutputs() {
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
ShaderCompilationInfo compileInfo = {
.name = "RT",
.modules = {"RayGen", "ClosestHit", "Miss", "StaticMeshVertexData"},
.modules = {"RayGen", "ClosestHit", "Miss"},
.entryPoints = {{"raygen", "RayGen"}, {"closestHit", "ClosestHit"}, {"miss", "Miss"}},
.typeParameter = {{"IVertexData", "StaticMeshVertexData"}},
.defines = {{"RAY_TRACING", "1"}},
.rootSignature = pipelineLayout,
};
@@ -134,6 +128,16 @@ void RayTracingPass::publishOutputs() {
closestHit = graphics->createClosestHitShader({1});
miss = graphics->createMissShader({2});
pipelineLayout->create();
pipeline = graphics->createRayTracingPipeline(Gfx::RayTracingPipelineCreateInfo{
.pipelineLayout = pipelineLayout,
.rayGenGroup = {.shader = rayGen},
.hitGroups = {{.closestHitShader = closestHit}},
.missGroups = {{.shader = miss}},
//.callableGroups = callableGroups,
});
Component::Transform transform;
transform.setScale(Vector(1, 1, 1));
transform.setPosition(Vector(0, 0, 1));
}
void RayTracingPass::createRenderPass() {}
@@ -21,5 +21,7 @@ class RayTracingPass : public RenderPass {
Gfx::ORayGenShader rayGen;
Gfx::OClosestHitShader closestHit;
Gfx::OMissShader miss;
Gfx::PRayTracingPipeline pipeline;
Gfx::OTopLevelAS tlas;
};
} // namespace Seele