Trying to fix everything
This commit is contained in:
@@ -281,27 +281,27 @@ void MeshUpdater::init(Gfx::PGraphics gfx, Gfx::PDescriptorLayout viewParamsLayo
|
||||
|
||||
graphics->beginShaderCompilation(ShaderCompilationInfo{
|
||||
.name = "CBTCompute",
|
||||
.modules = {"CBTCompute"},
|
||||
.modules = {"CBTCompute", "LEB"},
|
||||
.entryPoints =
|
||||
{
|
||||
{"reset", "CBTCompute"},
|
||||
{"classify", "CBTCompute"},
|
||||
{"split", "CBTCompute"},
|
||||
{"prepareIndirect", "CBTCompute"},
|
||||
{"allocate", "CBTCompute"},
|
||||
{"bisect", "CBTCompute"},
|
||||
{"propagateBisect", "CBTCompute"},
|
||||
{"prepareSimplify", "CBTCompute"},
|
||||
{"simplify", "CBTCompute"},
|
||||
{"propagateSimplify", "CBTCompute"},
|
||||
{"reducePrePass", "CBTCompute"},
|
||||
{"reduceFirstPass", "CBTCompute"},
|
||||
{"reduceSecondPass", "CBTCompute"},
|
||||
{"bisectorIndexation", "CBTCompute"},
|
||||
{"prepareBisectorIndirect", "CBTCompute"},
|
||||
{"validate", "CBTCompute"},
|
||||
{"clearLeb", "CBTCompute"},
|
||||
{"evaluateLeb", "CBTCompute"},
|
||||
{"Reset", "CBTCompute"},
|
||||
{"Classify", "CBTCompute"},
|
||||
{"Split", "CBTCompute"},
|
||||
{"PrepareIndirect", "CBTCompute"},
|
||||
{"Allocate", "CBTCompute"},
|
||||
{"Bisect", "CBTCompute"},
|
||||
{"PropagateBisect", "CBTCompute"},
|
||||
{"PrepareSimplify", "CBTCompute"},
|
||||
{"Simplify", "CBTCompute"},
|
||||
{"PropagateSimplify", "CBTCompute"},
|
||||
{"ReducePrePass", "CBTCompute"},
|
||||
{"ReduceFirstPass", "CBTCompute"},
|
||||
{"ReduceSecondPass", "CBTCompute"},
|
||||
{"BisectorIndexation", "CBTCompute"},
|
||||
{"PrepareBisectorIndirect", "CBTCompute"},
|
||||
{"Validate", "CBTCompute"},
|
||||
{"ClearBuffer", "LEB"},
|
||||
{"EvaluateLEB", "LEB"},
|
||||
},
|
||||
.rootSignature = pipelineLayout,
|
||||
});
|
||||
@@ -412,9 +412,11 @@ void MeshUpdater::evaluateLeb(const BaseMesh& baseMesh, CBTMesh& mesh, Gfx::PDes
|
||||
clearCmd->bindPipeline(lebClear);
|
||||
clearCmd->bindDescriptor(set);
|
||||
clearCmd->dispatch((mesh.totalNumElements * 3 + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE, 1, 1);
|
||||
graphics->executeCommands(std::move(clearCmd));
|
||||
mesh.currentVertexBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
Gfx::PDescriptorSet set = layout->allocateDescriptorSet();
|
||||
set->updateBuffer(GEOMETRY_CB, 0, geometryBuffer);
|
||||
set->updateBuffer(UPDATE_CB, 0, updateBuffer);
|
||||
@@ -432,7 +434,7 @@ void MeshUpdater::evaluateLeb(const BaseMesh& baseMesh, CBTMesh& mesh, Gfx::PDes
|
||||
evalCmd->pushConstants(Gfx::SE_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(uint32), &val);
|
||||
evalCmd->dispatchIndirect(mesh.indirectDispatchBuffer, complete ? 0 : sizeof(uint32) * 6);
|
||||
graphics->executeCommands(std::move(evalCmd));
|
||||
mesh.currentVertexBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
mesh.lebVertexBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
|
||||
@@ -456,7 +458,6 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
set->updateBuffer(HEAP_ID_BUFFER, 0, mesh.heapIDBuffer);
|
||||
set->updateBuffer(BISECTOR_DATA_BUFFER, 0, mesh.updateBuffer);
|
||||
set->updateBuffer(CLASSIFICATION_BUFFER, 0, mesh.classificationBuffer);
|
||||
set->updateBuffer(DEBUG_BUFFER, 0, debugBuffer);
|
||||
set->writeChanges();
|
||||
Gfx::OComputeCommand classifyCmd = graphics->createComputeCommand("Classify");
|
||||
classifyCmd->bindPipeline(classify);
|
||||
@@ -482,6 +483,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
|
||||
graphics->waitDeviceIdle();
|
||||
// split pass
|
||||
{
|
||||
Gfx::PDescriptorSet set = layout->allocateDescriptorSet();
|
||||
@@ -494,6 +496,7 @@ 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);
|
||||
@@ -502,7 +505,10 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
graphics->executeCommands(std::move(splitCmd));
|
||||
mesh.updateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
mesh.allocateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// prepare indirect pass
|
||||
{
|
||||
@@ -518,6 +524,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
indirectBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Allocate Pass
|
||||
{
|
||||
@@ -539,6 +546,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
mesh.updateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// copy
|
||||
currentNeighborsBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
@@ -546,6 +554,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
graphics->copyBuffer(currentNeighborsBuffer, nextNeighborsBuffer);
|
||||
nextNeighborsBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// bisect
|
||||
{
|
||||
@@ -570,6 +579,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
nextNeighborsBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Prepare indirect pass
|
||||
{
|
||||
@@ -585,6 +595,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
indirectBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// propagate split pass
|
||||
{
|
||||
@@ -604,6 +615,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
mesh.updateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// prepare simplify
|
||||
{
|
||||
@@ -625,6 +637,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
mesh.simplificationBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Prepare Indirect Simplify
|
||||
{
|
||||
@@ -640,6 +653,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
indirectBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Simplify Pass
|
||||
{
|
||||
@@ -663,6 +677,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
nextNeighborsBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Prepare Indirect Propagate Simplify
|
||||
{
|
||||
@@ -678,6 +693,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
indirectBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Propagate Simplify Pass
|
||||
{
|
||||
@@ -698,6 +714,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
nextNeighborsBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
// Update Tree
|
||||
{
|
||||
@@ -730,10 +747,12 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
mesh.gpuCBT.bufferArray[0]->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
mesh.currentNeighborsBufferIdx = nextNeighborsBufferIdx;
|
||||
|
||||
prepareIndirection(mesh, geometryCB);
|
||||
graphics->waitDeviceIdle();
|
||||
}
|
||||
|
||||
void MeshUpdater::validation(const CBTMesh& mesh, Gfx::PUniformBuffer geometryCB) {
|
||||
|
||||
@@ -327,6 +327,7 @@ struct GeometryCB {
|
||||
uint32 totalNumVertices;
|
||||
};
|
||||
struct UpdateCB {
|
||||
Matrix4 viewProjectionMatrix;
|
||||
float triangleSize;
|
||||
uint32_t maxSubdivisionDepth;
|
||||
float fov;
|
||||
@@ -355,10 +356,10 @@ constexpr int64 BISECT_ELEMENT = 1;
|
||||
constexpr int64 SIMPLIFY_ELEMENT = 2;
|
||||
constexpr int64 MERGED_ELEMENT = 3;
|
||||
struct BisectorData {
|
||||
uint32 subdivisionPattern;
|
||||
|
||||
UVector indices;
|
||||
|
||||
uint32 subdivisionPattern;
|
||||
|
||||
uint32 problematicNeighbor;
|
||||
|
||||
uint32 bisectorState;
|
||||
|
||||
@@ -97,7 +97,6 @@ struct ShaderBufferCreateInfo {
|
||||
DataSource sourceData = DataSource();
|
||||
uint64 numElements = 1;
|
||||
uint32 clearValue = 0;
|
||||
uint8 createCleared = 0;
|
||||
Gfx::SeBufferUsageFlags usage = 0;
|
||||
std::string name = "Unnamed";
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ void BasePass::beginFrame(const Component::Camera& cam) {
|
||||
transparentCulling = lightCullingLayout->allocateDescriptorSet();
|
||||
|
||||
//waterRenderer->beginFrame();
|
||||
terrainRenderer->beginFrame(viewParamsSet);
|
||||
terrainRenderer->beginFrame(viewParamsSet, cam);
|
||||
|
||||
// Debug vertices
|
||||
{
|
||||
|
||||
@@ -10,11 +10,19 @@ using namespace Seele;
|
||||
TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDescriptorLayout viewParamsLayout,
|
||||
Gfx::PDescriptorSet viewParamsSet)
|
||||
: graphics(graphics), scene(scene) {
|
||||
//Gfx::OPipelineLayout test = graphics->createPipelineLayout();
|
||||
//graphics->beginShaderCompilation(ShaderCompilationInfo{
|
||||
// .modules = {"CompileTest"},
|
||||
// .entryPoints = {{"Reset", "CompileTest"}},
|
||||
// .rootSignature = test,
|
||||
//});
|
||||
//graphics->createComputeShader({0});
|
||||
meshUpdater.init(graphics, viewParamsLayout);
|
||||
lebCache.init(graphics, 5);
|
||||
CBT<18> cbt;
|
||||
CPUMesh cpuMesh = generateCPUMesh(cbt.numElements());
|
||||
plainMesh.gpuCBT.lastLevelSize = cbt.lastLevelSize();
|
||||
plainMesh.gpuCBT.bufferCount = 2;
|
||||
for (uint32 i = 0; i < 2; ++i) {
|
||||
uint32 bufferSize = cbt.bufferSize(i);
|
||||
uint32 elementSize = cbt.elementSize(i);
|
||||
@@ -74,7 +82,6 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
{
|
||||
.size = sizeof(BisectorData) * cpuMesh.totalNumElements,
|
||||
},
|
||||
.usage = Gfx::SE_BUFFER_USAGE_INDIRECT_BUFFER_BIT,
|
||||
.name = "UpdateBuffer",
|
||||
});
|
||||
plainMesh.classificationBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
@@ -151,6 +158,8 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
},
|
||||
.name = "LebVertexBuffer",
|
||||
});
|
||||
plainMesh.lebVertexBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
plainMesh.currentVertexBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.sourceData =
|
||||
{
|
||||
@@ -213,6 +222,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
geometryBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_UNIFORM_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
UpdateCB updateCB = {
|
||||
.viewProjectionMatrix = Matrix4(0),
|
||||
.triangleSize = 10.0f,
|
||||
.maxSubdivisionDepth = 63,
|
||||
.fov = 70.0f,
|
||||
@@ -234,7 +244,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
{
|
||||
{"vert", "TerrainPass"},
|
||||
{"frag", "TerrainPass"},
|
||||
{"deform", "TerrainPass"},
|
||||
{"EvaluateDeformation", "TerrainPass"},
|
||||
},
|
||||
.rootSignature = meshUpdater.pipelineLayout,
|
||||
});
|
||||
@@ -245,20 +255,47 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
.computeShader = deformCS,
|
||||
.pipelineLayout = meshUpdater.pipelineLayout,
|
||||
});
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
meshUpdater.resetBuffers(plainMesh);
|
||||
graphics->waitDeviceIdle();
|
||||
meshUpdater.prepareIndirection(plainMesh, geometryBuffer);
|
||||
graphics->waitDeviceIdle();
|
||||
meshUpdater.evaluateLeb(baseMesh, plainMesh, viewParamsSet, geometryBuffer, updateBuffer, lebCache.getLebMatrixBuffer(), true, true);
|
||||
graphics->waitDeviceIdle();
|
||||
applyDeformation(viewParamsSet);
|
||||
graphics->waitDeviceIdle();
|
||||
}
|
||||
|
||||
TerrainRenderer::~TerrainRenderer() {}
|
||||
|
||||
static bool first = true;
|
||||
|
||||
void TerrainRenderer::beginFrame(Gfx::PDescriptorSet viewParamsSet) {
|
||||
void TerrainRenderer::beginFrame(Gfx::PDescriptorSet viewParamsSet, const Component::Camera& cam) {
|
||||
UpdateCB updateCB = {
|
||||
.viewProjectionMatrix = viewport->getProjectionMatrix() * cam.getViewMatrix(),
|
||||
.triangleSize = 10.0f,
|
||||
.maxSubdivisionDepth = 63,
|
||||
.fov = 70.0f,
|
||||
.farPlaneDistance = 1000.0f,
|
||||
};
|
||||
updateBuffer = graphics->createUniformBuffer(UniformBufferCreateInfo{
|
||||
.sourceData =
|
||||
{
|
||||
.size = sizeof(UpdateCB),
|
||||
.data = (uint8*)&updateCB,
|
||||
},
|
||||
.name = "UpdateCB",
|
||||
});
|
||||
updateBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_UNIFORM_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
graphics->waitDeviceIdle();
|
||||
meshUpdater.update(plainMesh, viewParamsSet, geometryBuffer, updateBuffer);
|
||||
graphics->waitDeviceIdle();
|
||||
meshUpdater.evaluateLeb(baseMesh, plainMesh, viewParamsSet, geometryBuffer, updateBuffer, lebCache.getLebMatrixBuffer(), false, false);
|
||||
graphics->waitDeviceIdle();
|
||||
applyDeformation(viewParamsSet);
|
||||
graphics->waitDeviceIdle();
|
||||
}
|
||||
|
||||
Gfx::ORenderCommand TerrainRenderer::render(Gfx::PDescriptorSet viewParamsSet) {
|
||||
|
||||
@@ -8,7 +8,7 @@ class TerrainRenderer {
|
||||
public:
|
||||
TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDescriptorLayout viewParamsLayout, Gfx::PDescriptorSet viewParamsSet);
|
||||
~TerrainRenderer();
|
||||
void beginFrame(Gfx::PDescriptorSet viewParamsSet);
|
||||
void beginFrame(Gfx::PDescriptorSet viewParamsSet, const Component::Camera& cam);
|
||||
Gfx::ORenderCommand render(Gfx::PDescriptorSet viewParamsSet);
|
||||
void setViewport(Gfx::PViewport viewport, Gfx::PRenderPass renderPass);
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ void VisibilityPass::publishOutputs() {
|
||||
|
||||
cullingBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.clearValue = 0xffffffff,
|
||||
.createCleared = true,
|
||||
.name = "CullingBuffer",
|
||||
});
|
||||
resources->registerBufferOutput("CULLINGBUFFER", cullingBuffer);
|
||||
|
||||
@@ -314,7 +314,7 @@ void Buffer::createBuffer(uint64 size, uint32 destIndex) {
|
||||
command->bindResource(PBufferAllocation(buffers[destIndex]));
|
||||
vkCmdFillBuffer(command->getHandle(), buffers[destIndex]->buffer, 0, VK_WHOLE_SIZE, clearValue);
|
||||
pipelineBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ void UniformBuffer::executePipelineBarrier(VkAccessFlags srcAccess, VkPipelineSt
|
||||
ShaderBuffer::ShaderBuffer(PGraphics graphics, const ShaderBufferCreateInfo& createInfo)
|
||||
: Gfx::ShaderBuffer(graphics->getFamilyMapping(), createInfo),
|
||||
Vulkan::Buffer(graphics, createInfo.sourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | createInfo.usage,
|
||||
createInfo.sourceData.owner, true, createInfo.name, createInfo.createCleared, createInfo.clearValue) {
|
||||
createInfo.sourceData.owner, true, createInfo.name, createInfo.sourceData.data == nullptr, createInfo.clearValue) {
|
||||
if (createInfo.sourceData.size > 0 && createInfo.sourceData.data != nullptr) {
|
||||
getAlloc()->updateContents(createInfo.sourceData.offset, createInfo.sourceData.size, createInfo.sourceData.data);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ using namespace Seele;
|
||||
{ \
|
||||
if (diagnostics) { \
|
||||
std::cout << (const char*)diagnostics->getBufferPointer() << std::endl; \
|
||||
assert(false); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -35,15 +34,15 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg
|
||||
sessionDesc.flags = 0;
|
||||
Array<slang::CompilerOptionEntry> option = {
|
||||
{
|
||||
.name = slang::CompilerOptionName::IgnoreCapabilities,
|
||||
.name = slang::CompilerOptionName::Capability,
|
||||
.value =
|
||||
{
|
||||
.kind = slang::CompilerOptionValueKind::Int,
|
||||
.intValue0 = 1,
|
||||
.intValue0 = globalSession->findCapability("GLSL_450"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = slang::CompilerOptionName::EmitSpirvViaGLSL,
|
||||
.name = slang::CompilerOptionName::EmitSpirvDirectly,
|
||||
.value =
|
||||
{
|
||||
.kind = slang::CompilerOptionValueKind::Int,
|
||||
@@ -89,7 +88,7 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg
|
||||
sessionDesc.preprocessorMacroCount = macros.size();
|
||||
sessionDesc.preprocessorMacros = macros.data();
|
||||
slang::TargetDesc targetDesc;
|
||||
targetDesc.profile = globalSession->findProfile("GLSL_450");
|
||||
targetDesc.profile = globalSession->findProfile("glsl_450");
|
||||
targetDesc.format = target;
|
||||
sessionDesc.targetCount = 1;
|
||||
sessionDesc.targets = &targetDesc;
|
||||
|
||||
Reference in New Issue
Block a user