Fixing some potential crashes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "RayTracingPass.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/MeshAsset.h"
|
||||
#include "Asset/EnvironmentMapAsset.h"
|
||||
#include "Graphics/Mesh.h"
|
||||
#include "Graphics/RayTracing.h"
|
||||
#include "Graphics/Shader.h"
|
||||
@@ -59,7 +60,7 @@ RayTracingPass::RayTracingPass(Gfx::PGraphics graphics, PScene scene) : RenderPa
|
||||
.useMaterial = true,
|
||||
.rayTracing = true,
|
||||
});
|
||||
skyBox = AssetRegistry::findTexture("", "skybox")->getTexture().cast<Gfx::TextureCube>();
|
||||
skyBox = AssetRegistry::findEnvironmentMap("", "newport_loft")->getIrradianceMap();
|
||||
skyBoxSampler = graphics->createSampler({});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ using namespace Seele::Vulkan;
|
||||
BufferAllocation::BufferAllocation(PGraphics graphics, const std::string& name, VkBufferCreateInfo bufferInfo,
|
||||
VmaAllocationCreateInfo allocInfo, Gfx::QueueType owner, uint64 alignment)
|
||||
: CommandBoundResource(graphics, name), size(bufferInfo.size), owner(owner) {
|
||||
if (bufferInfo.size == 0)
|
||||
return;
|
||||
VK_CHECK(vmaCreateBufferWithAlignment(graphics->getAllocator(), &bufferInfo, &allocInfo, alignment, &buffer, &allocation, &info));
|
||||
vmaGetAllocationMemoryProperties(graphics->getAllocator(), allocation, &properties);
|
||||
assert(!name.empty());
|
||||
@@ -437,6 +439,8 @@ void* ShaderBuffer::map() { return Vulkan::Buffer::map(); }
|
||||
void ShaderBuffer::unmap() { Vulkan::Buffer::unmap(); }
|
||||
|
||||
void ShaderBuffer::clear() {
|
||||
if (getAlloc() == nullptr)
|
||||
return;
|
||||
PCommand command = graphics->getQueueCommands(getAlloc()->owner)->getCommands();
|
||||
command->bindResource(PBufferAllocation(getAlloc()));
|
||||
vkCmdFillBuffer(command->getHandle(), Vulkan::Buffer::getHandle(), 0, VK_WHOLE_SIZE, 0);
|
||||
|
||||
@@ -447,7 +447,7 @@ Gfx::OTopLevelAS Graphics::createTopLevelAccelerationStructure(const Gfx::TopLev
|
||||
}
|
||||
|
||||
void Graphics::buildBottomLevelAccelerationStructures(Array<Gfx::PBottomLevelAS> data) {
|
||||
if (!supportRayTracing())
|
||||
if (!supportRayTracing() || data.empty())
|
||||
return;
|
||||
Gfx::PShaderBuffer verticesBuffer = StaticMeshVertexData::getInstance()->getPositionBuffer();
|
||||
Gfx::PIndexBuffer indexBuffer = StaticMeshVertexData::getInstance()->getIndexBuffer();
|
||||
|
||||
Reference in New Issue
Block a user