Fixing a few warnings
This commit is contained in:
Vendored
-1
@@ -28,7 +28,6 @@
|
||||
"res/shaders/",
|
||||
"res/shaders/lib"
|
||||
],
|
||||
"slang.slangdLocation": "C:\\Users\\Dynamitos\\slang\\build\\Release\\bin\\slangd.exe",
|
||||
"slang.searchInAllWorkspaceDirectories": false,
|
||||
"files.associations": {
|
||||
"type_traits": "cpp",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
SVGLoader::SVGLoader(Gfx::PGraphics graphic) {}
|
||||
SVGLoader::SVGLoader(Gfx::PGraphics) {}
|
||||
|
||||
SVGLoader::~SVGLoader() {}
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ EnvironmentMapAsset::EnvironmentMapAsset(std::string_view folderPath, std::strin
|
||||
|
||||
EnvironmentMapAsset::~EnvironmentMapAsset() {}
|
||||
|
||||
void EnvironmentMapAsset::save(ArchiveBuffer& buffer) const {}
|
||||
void EnvironmentMapAsset::save(ArchiveBuffer&) const {}
|
||||
|
||||
void EnvironmentMapAsset::load(ArchiveBuffer& buffer) {}
|
||||
void EnvironmentMapAsset::load(ArchiveBuffer&) {}
|
||||
|
||||
@@ -8,7 +8,7 @@ FontAsset::FontAsset() {}
|
||||
|
||||
FontAsset::FontAsset(std::string_view folderPath, std::string_view name) : Asset(folderPath, name) {
|
||||
FT_Error error = FT_Init_FreeType(&ft);
|
||||
assert(!error);
|
||||
if(error) abort();
|
||||
}
|
||||
|
||||
FontAsset::~FontAsset() {
|
||||
@@ -29,7 +29,7 @@ void FontAsset::load(ArchiveBuffer& buffer) {
|
||||
|
||||
void FontAsset::loadFace() {
|
||||
FT_Error error = FT_New_Memory_Face(ft, (unsigned char*)ttfFile.data(), (uint32)ttfFile.size(), 0, &ft_face);
|
||||
assert(!error);
|
||||
if(error) abort();
|
||||
blob = hb_blob_create(ttfFile.data(), (uint32)ttfFile.size(), HB_MEMORY_MODE_DUPLICATE, nullptr, nullptr);
|
||||
hb_face = hb_face_create(blob, 0);
|
||||
hb_font = hb_font_create(hb_face);
|
||||
|
||||
@@ -185,8 +185,4 @@ bool addTriangle(const Array<Vector>& positions, Meshlet& current, Triangle& tri
|
||||
current.primitiveLayout[current.numPrimitives * 3 + 2] = uint8(f3);
|
||||
current.numPrimitives++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices, Array<Meshlet>& meshlets) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,5 @@ struct Meshlet {
|
||||
uint32 numVertices;
|
||||
uint32 numPrimitives;
|
||||
uint32 lod = 0;
|
||||
static void build(const Array<Vector>& positions, const Array<uint32>& indices, Array<Meshlet>& meshlets);
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -28,7 +28,7 @@ void Seele::addDebugVertex(DebugVertex vert) { gDebugVertices.add(vert); }
|
||||
void Seele::addDebugVertices(Array<DebugVertex> verts) { gDebugVertices.addAll(verts); }
|
||||
|
||||
BasePass::BasePass(Gfx::PGraphics graphics, PScene scene) : RenderPass(graphics), scene(scene) {
|
||||
//waterRenderer = new WaterRenderer(graphics, scene, viewParamsLayout);
|
||||
// waterRenderer = new WaterRenderer(graphics, scene, viewParamsLayout);
|
||||
basePassLayout = graphics->createPipelineLayout("BasePassLayout");
|
||||
|
||||
basePassLayout->addDescriptorLayout(viewParamsLayout);
|
||||
@@ -98,8 +98,8 @@ void BasePass::beginFrame(const Component::Camera& cam, const Component::Transfo
|
||||
opaqueCulling = lightCullingLayout->allocateDescriptorSet();
|
||||
transparentCulling = lightCullingLayout->allocateDescriptorSet();
|
||||
|
||||
//waterRenderer->beginFrame();
|
||||
//terrainRenderer->beginFrame(viewParamsSet, cam);
|
||||
// waterRenderer->beginFrame();
|
||||
// terrainRenderer->beginFrame(viewParamsSet, cam);
|
||||
|
||||
// Debug vertices
|
||||
{
|
||||
@@ -122,7 +122,7 @@ void BasePass::beginFrame(const Component::Camera& cam, const Component::Transfo
|
||||
skyboxDataLayout->reset();
|
||||
textureLayout->reset();
|
||||
skyboxData.transformMatrix = glm::rotate(skyboxData.transformMatrix, (float)(Gfx::getCurrentFrameDelta()), Vector(0, 1, 0));
|
||||
|
||||
|
||||
skyboxDataSet = skyboxDataLayout->allocateDescriptorSet();
|
||||
skyboxDataSet->updateConstants("transformMatrix", 0, &skyboxData.transformMatrix);
|
||||
skyboxDataSet->updateConstants("fogBlend", 0, &skyboxData.fogColor);
|
||||
@@ -194,7 +194,7 @@ void BasePass::render() {
|
||||
},
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
.cullMode = twoSided ? Gfx::SE_CULL_MODE_NONE : Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
@@ -214,7 +214,7 @@ void BasePass::render() {
|
||||
},
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
.cullMode = twoSided ? Gfx::SE_CULL_MODE_NONE : Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
@@ -246,11 +246,10 @@ void BasePass::render() {
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endDebugRegion();
|
||||
}
|
||||
|
||||
|
||||
//commands.add(waterRenderer->render(viewParamsSet));
|
||||
//commands.add(terrainRenderer->render(viewParamsSet));
|
||||
|
||||
|
||||
// commands.add(waterRenderer->render(viewParamsSet));
|
||||
// commands.add(terrainRenderer->render(viewParamsSet));
|
||||
|
||||
// Skybox
|
||||
{
|
||||
graphics->beginDebugRegion("Skybox");
|
||||
@@ -413,7 +412,7 @@ void BasePass::publishOutputs() {
|
||||
.samples = Gfx::SE_SAMPLE_COUNT_4_BIT,
|
||||
.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | Gfx::SE_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT,
|
||||
});
|
||||
|
||||
|
||||
msBasePassColor = graphics->createTexture2D(TextureCreateInfo{
|
||||
.format = Gfx::SE_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.width = viewport->getOwner()->getFramebufferWidth(),
|
||||
@@ -422,17 +421,18 @@ void BasePass::publishOutputs() {
|
||||
.usage = Gfx::SE_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | Gfx::SE_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT,
|
||||
});
|
||||
|
||||
depthAttachment =
|
||||
Gfx::RenderTargetAttachment(Gfx::PTexture2D(basePassDepth), Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
depthAttachment = Gfx::RenderTargetAttachment(Gfx::PTexture2D(basePassDepth), Gfx::SE_IMAGE_LAYOUT_UNDEFINED,
|
||||
Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
|
||||
msDepthAttachment =
|
||||
Gfx::RenderTargetAttachment(msBasePassDepth, Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_DONT_CARE);
|
||||
msDepthAttachment.clear.depthStencil.depth = 0.0f;
|
||||
|
||||
colorAttachment = Gfx::RenderTargetAttachment(basePassColor, Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
colorAttachment =
|
||||
Gfx::RenderTargetAttachment(basePassColor, Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
|
||||
msColorAttachment =
|
||||
Gfx::RenderTargetAttachment(msBasePassColor, Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
@@ -451,8 +451,8 @@ void BasePass::publishOutputs() {
|
||||
}
|
||||
|
||||
void BasePass::createRenderPass() {
|
||||
//RenderPass::beginFrame(Component::Camera());
|
||||
//terrainRenderer = new TerrainRenderer(graphics, scene, viewParamsLayout, viewParamsSet);
|
||||
// RenderPass::beginFrame(Component::Camera());
|
||||
// terrainRenderer = new TerrainRenderer(graphics, scene, viewParamsLayout, viewParamsSet);
|
||||
cullingBuffer = resources->requestBuffer("CULLINGBUFFER");
|
||||
timestamps = resources->requestTimestampQuery("TIMESTAMPS");
|
||||
|
||||
@@ -494,8 +494,8 @@ void BasePass::createRenderPass() {
|
||||
oLightGrid = resources->requestTexture("LIGHTCULLING_OLIGHTGRID");
|
||||
tLightGrid = resources->requestTexture("LIGHTCULLING_TLIGHTGRID");
|
||||
|
||||
//waterRenderer->setViewport(viewport, renderPass);
|
||||
//terrainRenderer->setViewport(viewport, renderPass);
|
||||
// waterRenderer->setViewport(viewport, renderPass);
|
||||
// terrainRenderer->setViewport(viewport, renderPass);
|
||||
|
||||
// Debug rendering
|
||||
{
|
||||
@@ -569,14 +569,8 @@ void BasePass::createRenderPass() {
|
||||
// Skybox
|
||||
{
|
||||
skyboxDataLayout = graphics->createDescriptorLayout("pSkyboxData");
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = "transformMatrix",
|
||||
.uniformLength = sizeof(Matrix4)
|
||||
});
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = "fogBlend",
|
||||
.uniformLength = sizeof(Vector4)
|
||||
});
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "transformMatrix", .uniformLength = sizeof(Matrix4)});
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "fogBlend", .uniformLength = sizeof(Vector4)});
|
||||
skyboxDataLayout->create();
|
||||
textureLayout = graphics->createDescriptorLayout("pSkyboxTextures");
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
|
||||
@@ -79,7 +79,6 @@ void ShadowPass::render() {
|
||||
.offset = {0, 0},
|
||||
},
|
||||
"Shadow");
|
||||
auto light = scene->getLightEnvironment()->getDirectionalLight(shadowIndex);
|
||||
Component::Camera lightCamera = Component::Camera{
|
||||
.nearPlane = -100.f,
|
||||
.farPlane = 100.0f,
|
||||
@@ -105,7 +104,7 @@ void ShadowPass::render() {
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_NONE,
|
||||
.cullMode = Gfx::SE_CULL_MODE_FRONT_BIT,
|
||||
.depthBiasEnable = true,
|
||||
.depthBiasConstantFactor = depthBiasConstant,
|
||||
.depthBiasSlopeFactor = depthBiasSlope,
|
||||
@@ -121,7 +120,7 @@ void ShadowPass::render() {
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_NONE,
|
||||
.cullMode = Gfx::SE_CULL_MODE_FRONT_BIT,
|
||||
.depthBiasEnable = true,
|
||||
.depthBiasConstantFactor = depthBiasConstant,
|
||||
.depthBiasSlopeFactor = depthBiasSlope,
|
||||
|
||||
@@ -75,7 +75,7 @@ void ShaderCompiler::compile() {
|
||||
} else {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
for (int y = 0; y < 2; y++) {
|
||||
work.add([=]() {
|
||||
work.add([=, this]() {
|
||||
ShaderPermutation permutation = getTemplate(name);
|
||||
permutation.setPositionOnly(x);
|
||||
permutation.setDepthCulling(y);
|
||||
|
||||
@@ -131,7 +131,7 @@ struct ShaderPermutation {
|
||||
}
|
||||
void setVertexData(std::string_view name) {
|
||||
std::memset(vertexDataName, 0, sizeof(vertexDataName));
|
||||
strncpy(vertexDataName, name.data(), name.size());
|
||||
strncpy(vertexDataName, name.data(), sizeof(vertexDataName));
|
||||
}
|
||||
void setMaterial(std::string_view name, std::string_view brdf) {
|
||||
std::memset(materialName, 0, sizeof(materialName));
|
||||
|
||||
@@ -251,7 +251,10 @@ Array<VertexData::MeshletGroup> VertexData::groupMeshlets(std::span<MeshletDescr
|
||||
int result = METIS_PartGraphKway(&vertexCount, &ncon, xadjacency.data(), edgeAdjacency.data(), nullptr, nullptr, edgeWeights.data(),
|
||||
&nparts, nullptr, nullptr, options, &edgeCut, partition.data());
|
||||
|
||||
assert(result == METIS_OK);
|
||||
if(result != METIS_OK)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
Array<MeshletGroup> groups;
|
||||
groups.resize(nparts);
|
||||
|
||||
@@ -50,6 +50,8 @@ void Command::end() {
|
||||
}
|
||||
|
||||
void Command::beginRenderPass(PRenderPass renderPass, PFramebuffer framebuffer) {
|
||||
renderPass->getCommandHandle()->bind();
|
||||
boundResources.add(renderPass->getCommandHandle());
|
||||
assert(state == State::Begin);
|
||||
boundRenderPass = renderPass;
|
||||
boundFramebuffer = framebuffer;
|
||||
@@ -265,6 +267,10 @@ void RenderCommand::bindDescriptor(Gfx::PDescriptorSet descriptor) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptorSet->constantsBuffer != nullptr) {
|
||||
descriptorSet->bind();
|
||||
boundResources.add(PBufferAllocation(descriptorSet->constantsBuffer));
|
||||
}
|
||||
|
||||
VkDescriptorSet setHandle = descriptorSet->getHandle();
|
||||
Gfx::PPipelineLayout layout = pipeline != nullptr ? pipeline->getPipelineLayout() : rtPipeline->getPipelineLayout();
|
||||
@@ -292,6 +298,10 @@ void RenderCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorS
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptorSet->constantsBuffer != nullptr) {
|
||||
descriptorSet->bind();
|
||||
boundResources.add(PBufferAllocation(descriptorSet->constantsBuffer));
|
||||
}
|
||||
sets[layout->findParameter(descriptorSet->getName())] = descriptorSet->getHandle();
|
||||
}
|
||||
vkCmdBindDescriptorSets(handle, pipeline != nullptr ? VK_PIPELINE_BIND_POINT_GRAPHICS : VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR,
|
||||
@@ -438,6 +448,10 @@ void ComputeCommand::bindDescriptor(Gfx::PDescriptorSet descriptor) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptorSet->constantsBuffer != nullptr) {
|
||||
descriptorSet->bind();
|
||||
boundResources.add(PBufferAllocation(descriptorSet->constantsBuffer));
|
||||
}
|
||||
|
||||
VkDescriptorSet setHandle = descriptorSet->getHandle();
|
||||
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(),
|
||||
@@ -461,6 +475,10 @@ void ComputeCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptor
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptorSet->constantsBuffer != nullptr) {
|
||||
descriptorSet->bind();
|
||||
boundResources.add(PBufferAllocation(descriptorSet->constantsBuffer));
|
||||
}
|
||||
sets[pipeline->getPipelineLayout()->findParameter(descriptorSet->getName())] = descriptorSet->getHandle();
|
||||
}
|
||||
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(), 0, (uint32)descriptorSets.size(), sets, 0,
|
||||
|
||||
@@ -12,7 +12,6 @@ using namespace Seele::Vulkan;
|
||||
Framebuffer::Framebuffer(PGraphics graphics, PRenderPass renderPass, Gfx::RenderTargetLayout renderTargetLayout)
|
||||
: graphics(graphics), layout(renderTargetLayout), renderPass(renderPass) {
|
||||
FramebufferDescription description;
|
||||
std::memset(&description, 0, sizeof(FramebufferDescription));
|
||||
Array<VkImageView> attachments;
|
||||
uint32 width = 0;
|
||||
uint32 height = 0;
|
||||
|
||||
@@ -733,15 +733,6 @@ void Graphics::pickPhysicalDevice() {
|
||||
vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, physicalDevices.data());
|
||||
VkPhysicalDevice bestDevice = VK_NULL_HANDLE;
|
||||
uint32 deviceRating = 0;
|
||||
props.get<VkPhysicalDeviceProperties2>() = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
|
||||
};
|
||||
props.get<VkPhysicalDeviceAccelerationStructurePropertiesKHR>() = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR,
|
||||
};
|
||||
props.get<VkPhysicalDeviceRayTracingPipelinePropertiesKHR>() = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR,
|
||||
};
|
||||
for (auto dev : physicalDevices) {
|
||||
uint32 currentRating = 0;
|
||||
vkGetPhysicalDeviceProperties2(dev, &props.get());
|
||||
@@ -761,7 +752,32 @@ void Graphics::pickPhysicalDevice() {
|
||||
physicalDevice = bestDevice;
|
||||
|
||||
vkGetPhysicalDeviceProperties2(physicalDevice, &props.get());
|
||||
vkGetPhysicalDeviceFeatures2(physicalDevice, &features.get());
|
||||
features.get<VkPhysicalDeviceFeatures2>().features = {
|
||||
.geometryShader = true,
|
||||
.fillModeNonSolid = true,
|
||||
.wideLines = true,
|
||||
.pipelineStatisticsQuery = true,
|
||||
.fragmentStoresAndAtomics = true,
|
||||
.shaderInt64 = true,
|
||||
.shaderInt16 = true,
|
||||
.inheritedQueries = true,
|
||||
};
|
||||
features.get<VkPhysicalDeviceVulkan11Features>().multiview = true;
|
||||
features.get<VkPhysicalDeviceVulkan11Features>().storageBuffer16BitAccess = true;
|
||||
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().descriptorIndexing = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().descriptorBindingPartiallyBound = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().bufferDeviceAddress = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().storageBuffer8BitAccess = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().shaderInt8 = true;
|
||||
|
||||
features.get<VkPhysicalDeviceAccelerationStructureFeaturesKHR>().accelerationStructure = true;
|
||||
|
||||
features.get<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>().rayTracingPipeline = true;
|
||||
|
||||
features.get<VkPhysicalDeviceMeshShaderFeaturesEXT>().meshShader = true;
|
||||
features.get<VkPhysicalDeviceMeshShaderFeaturesEXT>().taskShader = true;
|
||||
features.get<VkPhysicalDeviceMeshShaderFeaturesEXT>().meshShaderQueries = true;
|
||||
bool rayTracingPipelineSupport = false;
|
||||
bool accelerationStructureSupport = false;
|
||||
bool hostOperationsSupport = false;
|
||||
|
||||
@@ -233,7 +233,9 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
||||
|
||||
PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo gfxInfo) {
|
||||
uint32 hash = CRC::Calculate(&gfxInfo, sizeof(Gfx::MeshPipelineCreateInfo), CRC::CRC_32());
|
||||
std::cout << hash << std::endl;
|
||||
if (graphicsPipelines.contains(hash)) {
|
||||
std::cout << "found exisiting" << std::endl;
|
||||
return graphicsPipelines[hash];
|
||||
}
|
||||
PPipelineLayout layout = Gfx::PPipelineLayout(gfxInfo.pipelineLayout).cast<PipelineLayout>();
|
||||
|
||||
@@ -22,7 +22,7 @@ BottomLevelAS::BottomLevelAS(PGraphics graphics, const Gfx::BottomLevelASCreateI
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
VertexData* vertexData = createInfo.mesh->vertexData;
|
||||
//todo: indices might be split as well
|
||||
// todo: indices might be split as well
|
||||
MeshData meshData = vertexData->getMeshData(createInfo.mesh->id);
|
||||
vertexOffset = vertexData->getMeshOffset(createInfo.mesh->id) * sizeof(Vector);
|
||||
vertexCount = vertexData->getMeshVertexCount(createInfo.mesh->id);
|
||||
@@ -77,6 +77,8 @@ TopLevelAS::TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& crea
|
||||
},
|
||||
Gfx::QueueType::GRAPHICS);
|
||||
instanceAllocation->updateContents(0, sizeof(VkAccelerationStructureInstanceKHR) * instances.size(), instances.data());
|
||||
instanceAllocation->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR);
|
||||
VkDeviceOrHostAddressConstKHR instanceDeviceAddress = {
|
||||
.deviceAddress = instanceAllocation->deviceAddress,
|
||||
};
|
||||
@@ -138,20 +140,20 @@ TopLevelAS::TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& crea
|
||||
};
|
||||
VK_CHECK(vkCreateAccelerationStructureKHR(graphics->getDevice(), &accelerationInfo, nullptr, &handle));
|
||||
|
||||
OBufferAllocation scratchBuffer =
|
||||
new BufferAllocation(graphics, "ScratchBuffer",
|
||||
VkBufferCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.size = buildSizesInfo.buildScratchSize,
|
||||
.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
|
||||
OBufferAllocation scratchBuffer = new BufferAllocation(
|
||||
graphics, "ScratchBuffer",
|
||||
VkBufferCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.size = buildSizesInfo.buildScratchSize,
|
||||
.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
|
||||
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
Gfx::QueueType::GRAPHICS, graphics->getAccelerationProperties().minAccelerationStructureScratchOffsetAlignment);
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
Gfx::QueueType::GRAPHICS, graphics->getAccelerationProperties().minAccelerationStructureScratchOffsetAlignment);
|
||||
|
||||
VkAccelerationStructureBuildGeometryInfoKHR buildGeometry = {
|
||||
.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR,
|
||||
@@ -188,8 +190,8 @@ TopLevelAS::TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& crea
|
||||
.offset = 0,
|
||||
.size = buffer->size,
|
||||
};
|
||||
vkCmdPipelineBarrier(cmd->getHandle(), VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 0, 0,
|
||||
nullptr, 1, &barrier, 0, nullptr);
|
||||
vkCmdPipelineBarrier(cmd->getHandle(), VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 0, 0, nullptr, 1, &barrier, 0, nullptr);
|
||||
|
||||
cmd->bindResource(PBufferAllocation(scratchBuffer));
|
||||
graphics->getDestructionManager()->queueResourceForDestruction(std::move(scratchBuffer));
|
||||
|
||||
@@ -11,7 +11,7 @@ using namespace Seele::Vulkan;
|
||||
|
||||
RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Array<Gfx::SubPassDependency> _dependencies, std::string name,
|
||||
Array<uint32> viewMasks, Array<uint32> correlationMasks)
|
||||
: Gfx::RenderPass(std::move(_layout), std::move(_dependencies)), name(name), graphics(graphics) {
|
||||
: Gfx::RenderPass(std::move(_layout), std::move(_dependencies)), graphics(graphics), name(name) {
|
||||
subpassContents = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS;
|
||||
Array<VkAttachmentDescription2> attachments;
|
||||
Array<VkAttachmentReference2> inputRefs;
|
||||
@@ -196,21 +196,22 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::RenderTargetLayout _layout, Arra
|
||||
.correlatedViewMaskCount = (uint32)correlationMasks.size(),
|
||||
.pCorrelatedViewMasks = correlationMasks.data(),
|
||||
};
|
||||
VK_CHECK(vkCreateRenderPass2(graphics->getDevice(), &info, nullptr, &renderPass));
|
||||
VkRenderPass handle;
|
||||
VK_CHECK(vkCreateRenderPass2(graphics->getDevice(), &info, nullptr, &handle));
|
||||
VkDebugUtilsObjectNameInfoEXT nameInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = nullptr,
|
||||
.objectType = VK_OBJECT_TYPE_RENDER_PASS,
|
||||
.objectHandle = (uint64)renderPass,
|
||||
.objectHandle = (uint64)handle,
|
||||
.pObjectName = name.c_str(),
|
||||
};
|
||||
assert(!name.empty());
|
||||
vkSetDebugUtilsObjectNameEXT(graphics->getDevice(), &nameInfo);
|
||||
renderPass = new RenderPassHandle(graphics, name, handle);
|
||||
}
|
||||
|
||||
RenderPass::~RenderPass() {
|
||||
vkDestroyRenderPass(graphics->getDevice(), renderPass, nullptr);
|
||||
// graphics->getDestructionManager()->queueRenderPass(graphics->getGraphicsCommands()->getCommands(), renderPass);
|
||||
graphics->getDestructionManager()->queueResourceForDestruction(std::move(renderPass));
|
||||
}
|
||||
|
||||
uint32 RenderPass::getFramebufferHash() {
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
#pragma once
|
||||
#include "Graphics.h"
|
||||
#include "Resources.h"
|
||||
#include "Graphics/RenderTarget.h"
|
||||
|
||||
namespace Seele {
|
||||
namespace Vulkan {
|
||||
|
||||
class RenderPass : public Gfx::RenderPass {
|
||||
public:
|
||||
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies,
|
||||
std::string name, Array<uint32> viewMasks = {}, Array<uint32> correlationMasks = {});
|
||||
RenderPass(PGraphics graphics, Gfx::RenderTargetLayout layout, Array<Gfx::SubPassDependency> dependencies, std::string name,
|
||||
Array<uint32> viewMasks = {}, Array<uint32> correlationMasks = {});
|
||||
virtual ~RenderPass();
|
||||
uint32 getFramebufferHash();
|
||||
void endRenderPass();
|
||||
constexpr VkRenderPass getHandle() const { return renderPass; }
|
||||
constexpr VkRenderPass getHandle() const { return renderPass->getHandle(); }
|
||||
constexpr size_t getClearValueCount() const { return clearValues.size(); }
|
||||
constexpr VkClearValue* getClearValues() const { return clearValues.data(); }
|
||||
constexpr VkSubpassContents getSubpassContents() const { return subpassContents; }
|
||||
constexpr const std::string& getName() const { return name; }
|
||||
constexpr PRenderPassHandle getCommandHandle() const { return renderPass; }
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
PGraphics graphics;
|
||||
VkRenderPass renderPass;
|
||||
std::string name;
|
||||
ORenderPassHandle renderPass;
|
||||
Array<VkClearValue> clearValues;
|
||||
VkRect2D renderArea;
|
||||
VkSubpassContents subpassContents;
|
||||
|
||||
@@ -124,6 +124,16 @@ class Sampler : public Gfx::Sampler {
|
||||
OSamplerHandle handle;
|
||||
};
|
||||
DEFINE_REF(Sampler)
|
||||
struct RenderPassHandle : public CommandBoundResource {
|
||||
public:
|
||||
RenderPassHandle(PGraphics graphics, std::string name, VkRenderPass renderPass)
|
||||
: CommandBoundResource(graphics, name), handle(renderPass) {}
|
||||
virtual ~RenderPassHandle() {}
|
||||
constexpr VkRenderPass getHandle() const { return handle; }
|
||||
|
||||
private:
|
||||
VkRenderPass handle;
|
||||
};
|
||||
DEFINE_REF(RenderPassHandle)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
|
||||
@@ -33,6 +33,7 @@ class LightEnvironment {
|
||||
const Array<Gfx::OTexture2D>& getShadowMaps() const { return shadowMaps; }
|
||||
|
||||
private:
|
||||
Gfx::PGraphics graphics;
|
||||
Gfx::OShaderBuffer directionalLights;
|
||||
Array<Gfx::OTexture2D> shadowMaps;
|
||||
Array<Gfx::OSampler> shadowSamplers;
|
||||
@@ -44,7 +45,6 @@ class LightEnvironment {
|
||||
Gfx::OSampler environmentSampler;
|
||||
Gfx::ODescriptorLayout layout;
|
||||
Gfx::PDescriptorSet set;
|
||||
Gfx::PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(LightEnvironment)
|
||||
} // namespace Seele
|
||||
@@ -53,7 +53,7 @@ void ArchiveBuffer::seek(int64 s, SeekOp op) {
|
||||
break;
|
||||
}
|
||||
assert(newPos >= 0 && size_t(newPos) < memory.size());
|
||||
newPos = position;
|
||||
position = newPos;
|
||||
}
|
||||
|
||||
bool ArchiveBuffer::eof() const { return position == memory.size(); }
|
||||
|
||||
@@ -54,6 +54,7 @@ class Element {
|
||||
case InnerDisplayType::Flow:
|
||||
flowLayout();
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
// normal flow of the elements, inline elements go left to right, blocks get their own new lines
|
||||
|
||||
Reference in New Issue
Block a user