Fixing some import problems
This commit is contained in:
@@ -169,8 +169,8 @@ static constexpr bool useMeshShading = true;
|
||||
static constexpr uint32 numFramesBuffered = 3;
|
||||
|
||||
// meshlet dimensions curated by NVIDIA
|
||||
static constexpr uint32 numVerticesPerMeshlet = 64;
|
||||
static constexpr uint32 numPrimitivesPerMeshlet = 126;
|
||||
static constexpr uint32 numVerticesPerMeshlet = 256;
|
||||
static constexpr uint32 numPrimitivesPerMeshlet = 256;
|
||||
double getCurrentFrameDelta();
|
||||
uint32 getCurrentFrameIndex();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Containers/Map.h"
|
||||
#include "Containers/List.h"
|
||||
#include "Containers/Set.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -194,7 +195,7 @@ bool addTriangle(const Array<Vector>& positions, Meshlet ¤t, Triangle& tri
|
||||
int f2 = findIndex(current, tri.indices[1]);
|
||||
int f3 = findIndex(current, tri.indices[2]);
|
||||
|
||||
if (f1 == -1 || f2 == -1 || f3 == -1)
|
||||
if (f1 == -1 || f2 == -1 || f3 == -1 || current.numPrimitives == Gfx::numPrimitivesPerMeshlet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -214,16 +215,16 @@ void Meshlet::build(const Array<Vector> &positions, const Array<uint32> &indices
|
||||
.numVertices = 0,
|
||||
.numPrimitives = 0,
|
||||
};
|
||||
Array<uint32> optimizedIndices;
|
||||
tipsifyIndexBuffer(indices, positions.size(), 25, optimizedIndices);
|
||||
Array<Triangle> triangles(optimizedIndices.size() / 3);
|
||||
//Array<uint32> optimizedIndices = indices;
|
||||
//tipsifyIndexBuffer(indices, positions.size(), 25, optimizedIndices);
|
||||
Array<Triangle> triangles(indices.size() / 3);
|
||||
for (size_t i = 0; i < triangles.size(); ++i)
|
||||
{
|
||||
triangles[i] = Triangle{
|
||||
.indices = {
|
||||
optimizedIndices[i * 3 + 0],
|
||||
optimizedIndices[i * 3 + 1],
|
||||
optimizedIndices[i * 3 + 2],
|
||||
indices[i * 3 + 0],
|
||||
indices[i * 3 + 1],
|
||||
indices[i * 3 + 2],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -164,11 +164,7 @@ void VertexData::loadMesh(MeshId id, Array<uint32> loadedIndices, Array<Meshlet>
|
||||
std::memcpy(vertexIndices.data() + vertexOffset, m.uniqueVertices, m.numVertices * sizeof(uint32));
|
||||
uint32 primitiveOffset = primitiveIndices.size();
|
||||
primitiveIndices.resize(primitiveOffset + (m.numPrimitives * 3));
|
||||
for(size_t x = 0; x < m.numPrimitives*3; ++x)
|
||||
{
|
||||
primitiveIndices[primitiveOffset + x] = m.primitiveLayout[x];
|
||||
}
|
||||
//std::memcpy(primitiveIndices.data() + primitiveOffset, m.primitiveLayout, m.numPrimitives * 3 * sizeof(uint8));
|
||||
std::memcpy(primitiveIndices.data() + primitiveOffset, m.primitiveLayout, m.numPrimitives * 3 * sizeof(uint8));
|
||||
meshlets.add(MeshletDescription{
|
||||
.bounding = m.boundingBox.toSphere(),
|
||||
.vertexCount = m.numVertices,
|
||||
@@ -218,7 +214,7 @@ void VertexData::loadMesh(MeshId id, Array<uint32> loadedIndices, Array<Meshlet>
|
||||
});
|
||||
primitiveIndicesBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.sourceData = {
|
||||
.size = sizeof(uint32) * primitiveIndices.size(),
|
||||
.size = sizeof(uint8) * primitiveIndices.size(),
|
||||
.data = (uint8*)primitiveIndices.data(),
|
||||
},
|
||||
.numElements = primitiveIndices.size(),
|
||||
@@ -280,11 +276,11 @@ void Seele::VertexData::init(Gfx::PGraphics _graphics)
|
||||
// meshData
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding = 1, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER,});
|
||||
// meshletData
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding =2, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding = 2, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
// primitiveIndices
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding =3, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding = 3, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
// vetexIndices
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding =4, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
instanceDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.binding = 4, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
|
||||
instanceDataLayout->create();
|
||||
resizeBuffers();
|
||||
|
||||
@@ -99,7 +99,7 @@ protected:
|
||||
Map<MeshId, uint64> meshOffsets;
|
||||
Map<MeshId, uint64> meshVertexCounts;
|
||||
Array<MeshletDescription> meshlets;
|
||||
Array<uint32> primitiveIndices;
|
||||
Array<uint8> primitiveIndices;
|
||||
Array<uint32> vertexIndices;
|
||||
Array<uint32> indices;
|
||||
Gfx::PGraphics graphics;
|
||||
|
||||
@@ -328,7 +328,7 @@ void PipelineLayout::create() {
|
||||
PDescriptorLayout layout = desc.cast<DescriptorLayout>();
|
||||
layout->create();
|
||||
uint32 parameterIndex = parameterMapping[layout->getName()];
|
||||
if (parameterIndex > vulkanDescriptorLayouts.size())
|
||||
if (parameterIndex >= vulkanDescriptorLayouts.size())
|
||||
{
|
||||
vulkanDescriptorLayouts.resize(parameterIndex + 1);
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ void Graphics::pickPhysicalDevice()
|
||||
{
|
||||
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0)
|
||||
{
|
||||
meshShadingEnabled = true;
|
||||
//meshShadingEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
}
|
||||
slang::SessionDesc sessionDesc;
|
||||
sessionDesc.flags = 0;
|
||||
StaticArray<slang::CompilerOptionEntry, 4> option;
|
||||
StaticArray<slang::CompilerOptionEntry, 2> option;
|
||||
option[0].name = slang::CompilerOptionName::DumpIntermediates;
|
||||
option[0].value = slang::CompilerOptionValue();
|
||||
option[0].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
@@ -25,14 +25,6 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
option[1].value = slang::CompilerOptionValue();
|
||||
option[1].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[1].value.intValue0 = 1;
|
||||
option[2].name = slang::CompilerOptionName::DebugInformation;
|
||||
option[2].value = slang::CompilerOptionValue();
|
||||
option[2].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[2].value.intValue0 = 3;
|
||||
option[3].name = slang::CompilerOptionName::DebugInformationFormat;
|
||||
option[3].value = slang::CompilerOptionValue();
|
||||
option[3].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[3].value.stringValue0 = "c7";
|
||||
sessionDesc.compilerOptionEntries = option.data();
|
||||
sessionDesc.compilerOptionEntryCount = option.size();
|
||||
sessionDesc.defaultMatrixLayoutMode = SLANG_MATRIX_LAYOUT_COLUMN_MAJOR;
|
||||
@@ -112,8 +104,19 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
for(size_t i = 0; i < signature->getParameterCount(); ++i)
|
||||
{
|
||||
auto param = signature->getParameterByIndex(i);
|
||||
paramMapping[param->getName()] = param->getBindingIndex();
|
||||
std::cout << "Parameter " << param->getName() << " index " << param->getBindingIndex() << std::endl;
|
||||
// workaround
|
||||
if (std::strcmp(param->getName(), "pVertexData") == 0)
|
||||
{
|
||||
paramMapping[param->getName()] = 1;
|
||||
}
|
||||
else if (std::strcmp(param->getName(), "pMaterial") == 0)
|
||||
{
|
||||
paramMapping[param->getName()] = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
paramMapping[param->getName()] = param->getBindingIndex();
|
||||
}
|
||||
}
|
||||
return kernelBlob;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user