Rasterize works again
This commit is contained in:
+4
-1
@@ -3,4 +3,7 @@
|
||||
url = https://github.com/d-bahr/CRCpp.git
|
||||
[submodule "external/vcpkg"]
|
||||
path = external/vcpkg
|
||||
url = https://github.com/Microsoft/vcpkg.git
|
||||
url = https://github.com/Microsoft/vcpkg.git
|
||||
[submodule "external/slang"]
|
||||
path = external/slang
|
||||
url = https://github.com/shader-slang/slang.git
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ target_compile_definitions(Editor PRIVATE EDITOR=1)
|
||||
add_executable(AssetViewer "")
|
||||
target_link_libraries(AssetViewer PRIVATE Engine)
|
||||
target_include_directories(AssetViewer PRIVATE src/AssetViewer)
|
||||
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_options(Engine PUBLIC /std:c++20 /Zi /MP14 /W4 /wd4505)
|
||||
|
||||
+1
Submodule external/slang added at 52b5bb43fd
@@ -7,7 +7,7 @@ import Scene;
|
||||
FragmentParameter vertexMain(
|
||||
VertexInput input
|
||||
){
|
||||
InstanceData inst = pScene.instances[pOffsets.instanceOffset + input.instanceId];
|
||||
InstanceData inst = pScene.instances[input.instanceId];
|
||||
VertexAttributes attr = pVertexData.getAttributes(input.vertexId);
|
||||
return attr.getParameter(inst.transformMatrix);
|
||||
}
|
||||
@@ -18,8 +18,8 @@ void meshMain(
|
||||
out vertices FragmentParameter vertices[MAX_VERTICES],
|
||||
out indices uint3 indices[MAX_PRIMITIVES]
|
||||
){
|
||||
InstanceData inst = meshPayload.instanceData;
|
||||
MeshData data = meshPayload.meshData;
|
||||
InstanceData inst = pScene.instanceData[meshPayload.instanceId];
|
||||
MeshData data = pScene.meshData[meshPayload.instanceId];
|
||||
MeshletDescription m = pScene.meshletInfos[data.meshletOffset + groupID];
|
||||
SetMeshOutputCounts(m.vertexCount, m.primitiveCount);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ groupshared Frustum viewFrustum;
|
||||
[shader("amplification")]
|
||||
void taskMain(
|
||||
uint threadID: SV_GroupIndex,
|
||||
uint groupID: SV_GroupThreadID
|
||||
uint groupID: SV_GroupID
|
||||
){
|
||||
InstanceData instance = pScene.instances[pOffsets.instanceOffset + groupID];
|
||||
MeshData mesh = pScene.meshData[pOffsets.instanceOffset + groupID];
|
||||
|
||||
@@ -53,8 +53,7 @@ ParameterBlock<Scene> pScene;
|
||||
|
||||
struct MeshPayload
|
||||
{
|
||||
InstanceData instanceData;
|
||||
MeshData meshData;
|
||||
uint instanceId;
|
||||
uint culledMeshlets[2048];
|
||||
};
|
||||
|
||||
|
||||
@@ -124,28 +124,42 @@ void BasePass::render()
|
||||
assert(collection != nullptr);
|
||||
if (graphics->supportMeshShading())
|
||||
{
|
||||
Gfx::MeshPipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.taskShader = collection->taskShader;
|
||||
pipelineInfo.meshShader = collection->meshShader;
|
||||
pipelineInfo.fragmentShader = collection->fragmentShader;
|
||||
pipelineInfo.pipelineLayout = collection->pipelineLayout;
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER_OR_EQUAL;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
pipelineInfo.colorBlend.attachmentCount = 2;
|
||||
Gfx::MeshPipelineCreateInfo pipelineInfo = {
|
||||
.taskShader = collection->taskShader,
|
||||
.meshShader = collection->meshShader,
|
||||
.fragmentShader = collection->fragmentShader,
|
||||
.renderPass = renderPass,
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.multisampleState = {
|
||||
.samples = viewport->getSamples(),
|
||||
},
|
||||
.depthStencilState = {
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER_OR_EQUAL,
|
||||
},
|
||||
.colorBlend = {
|
||||
.attachmentCount = 2,
|
||||
},
|
||||
};
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.vertexShader = collection->vertexShader;
|
||||
pipelineInfo.fragmentShader = collection->fragmentShader;
|
||||
pipelineInfo.pipelineLayout = collection->pipelineLayout;
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER_OR_EQUAL;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
pipelineInfo.colorBlend.attachmentCount = 2;
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo = {
|
||||
.vertexShader = collection->vertexShader,
|
||||
.fragmentShader = collection->fragmentShader,
|
||||
.renderPass = renderPass,
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.multisampleState = {
|
||||
.samples = viewport->getSamples(),
|
||||
},
|
||||
.depthStencilState = {
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER_OR_EQUAL,
|
||||
},
|
||||
.colorBlend = {
|
||||
.attachmentCount = 2,
|
||||
},
|
||||
};
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
@@ -154,9 +168,9 @@ void BasePass::render()
|
||||
command->bindDescriptor(scene->getLightEnvironment()->getDescriptorSet());
|
||||
command->bindDescriptor(opaqueCulling);
|
||||
command->bindDescriptor(vertexData->getInstanceDataSet());
|
||||
command->bindDescriptor(vertexData->getInstanceDataSet());
|
||||
for (const auto& drawCall : materialData.instances)
|
||||
{
|
||||
command->bindDescriptor(vertexData->getInstanceDataSet());
|
||||
command->bindDescriptor(drawCall.materialInstance->getDescriptorSet());
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets), &drawCall.offsets);
|
||||
if (graphics->supportMeshShading())
|
||||
@@ -166,10 +180,11 @@ void BasePass::render()
|
||||
else
|
||||
{
|
||||
command->bindIndexBuffer(vertexData->getIndexBuffer());
|
||||
uint32 inst = drawCall.offsets.instanceOffset;
|
||||
for (const auto& meshData : drawCall.instanceMeshData)
|
||||
{
|
||||
// all meshlets of a mesh share the same indices offset
|
||||
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, vertexData->getIndicesOffset(meshData.meshletOffset), 0);
|
||||
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, vertexData->getIndicesOffset(meshData.meshletOffset), inst++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,22 +101,29 @@ void DepthPrepass::render()
|
||||
}
|
||||
else
|
||||
{
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.vertexShader = collection->vertexShader;
|
||||
pipelineInfo.fragmentShader = collection->fragmentShader;
|
||||
pipelineInfo.pipelineLayout = collection->pipelineLayout;
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
pipelineInfo.colorBlend.attachmentCount = 1;
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo = {
|
||||
.vertexShader = collection->vertexShader,
|
||||
.fragmentShader = collection->fragmentShader,
|
||||
.renderPass = renderPass,
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.multisampleState = {
|
||||
.samples = viewport->getSamples(),
|
||||
},
|
||||
.depthStencilState = {
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER,
|
||||
},
|
||||
.colorBlend = {
|
||||
.attachmentCount = 1,
|
||||
},
|
||||
};
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
command->bindDescriptor(vertexData->getVertexDataSet());
|
||||
command->bindDescriptor(viewParamsSet);
|
||||
command->bindDescriptor(vertexData->getInstanceDataSet());
|
||||
for (const auto& drawCall : materialData.instances)
|
||||
{
|
||||
command->bindDescriptor(vertexData->getInstanceDataSet());
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets), &drawCall.offsets);
|
||||
if (graphics->supportMeshShading())
|
||||
{
|
||||
@@ -125,10 +132,11 @@ void DepthPrepass::render()
|
||||
else
|
||||
{
|
||||
command->bindIndexBuffer(vertexData->getIndexBuffer());
|
||||
uint32 inst = drawCall.offsets.instanceOffset;
|
||||
for (const auto& meshData : drawCall.instanceMeshData)
|
||||
{
|
||||
// all meshlets of a mesh share the same indices offset
|
||||
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, vertexData->getIndicesOffset(meshData.meshletOffset), 0);
|
||||
command->drawIndexed(meshData.numIndices, 1, meshData.firstIndex, vertexData->getIndicesOffset(meshData.meshletOffset), inst++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ void VertexData::updateMesh(PMesh mesh, Component::Transform& transform)
|
||||
});
|
||||
const auto& data = meshData[mesh->id];
|
||||
matInstanceData.instanceMeshData.add(data);
|
||||
referencedInstance->updateDescriptor();
|
||||
for (size_t i = 0; i < 0; ++i)
|
||||
{
|
||||
auto bounding = meshlets[data.meshletOffset + i].bounding;
|
||||
@@ -100,7 +101,6 @@ void VertexData::updateMesh(PMesh mesh, Component::Transform& transform)
|
||||
addDebugVertex(DebugVertex{ .position = corners[7], .color = meshlets[data.meshletOffset + i].color });
|
||||
}
|
||||
|
||||
referencedInstance->updateDescriptor();
|
||||
}
|
||||
|
||||
void VertexData::createDescriptors()
|
||||
|
||||
Reference in New Issue
Block a user