Preparing for Writeup

This commit is contained in:
2021-10-15 23:12:29 +02:00
parent 2cb70d7b16
commit b1d8ef4120
40 changed files with 284 additions and 192 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ typedef uint32 KeyModifierFlags;
namespace Gfx
{
static constexpr bool useAsyncCompute = true;
static constexpr bool waitIdleOnSubmit = true;
static constexpr bool waitIdleOnSubmit = false;
static constexpr uint32 numFramesBuffered = 8;
extern uint32 currentFrameIndex;
extern double currentFrameDelta;
@@ -26,8 +26,10 @@ void modifyRenderPassMacros(Gfx::RenderPassType type, Map<const char*, const cha
{
case Gfx::RenderPassType::DepthPrepass:
DepthPrepass::modifyRenderPassMacros(defines);
break;
case Gfx::RenderPassType::BasePass:
BasePass::modifyRenderPassMacros(defines);
break;
}
}
@@ -138,10 +138,10 @@ void DepthPrepass::render()
Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT);
depthAttachment->getTexture()->transferOwnership(Gfx::QueueType::GRAPHICS);
graphics->beginRenderPass(renderPass);
/*for (auto &&meshBatch : scene->getStaticMeshes())
for (auto &&meshBatch : passData.staticDrawList)
{
processor->addMeshBatch(meshBatch, renderPass, depthPrepassLayout, primitiveLayout, descriptorSets);
}*/
}
graphics->executeCommands(processor->getRenderCommands());
graphics->endRenderPass();
}
@@ -232,7 +232,7 @@ void LightCullingPass::createRenderPass()
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH")->getTexture();
}
void LightCullingPass::modifyRenderPassMacros(Map<const char*, const char*>& defines)
void LightCullingPass::modifyRenderPassMacros(Map<const char*, const char*>&)
{
}
@@ -304,7 +304,7 @@ ComputeCommand::~ComputeCommand()
{
}
void ComputeCommand::begin(PCmdBuffer parent)
void ComputeCommand::begin(PCmdBuffer)
{
ready = false;
VkCommandBufferBeginInfo beginInfo =
@@ -117,7 +117,7 @@ DescriptorSet::~DescriptorSet()
void DescriptorSet::updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer)
{
PUniformBuffer vulkanBuffer = uniformBuffer.cast<UniformBuffer>();
UniformBuffer* cachedBuffer = reinterpret_cast<UniformBuffer*>(cachedData[binding]);
//UniformBuffer* cachedBuffer = reinterpret_cast<UniformBuffer*>(cachedData[binding]);
/*if(vulkanBuffer->isDataEquals(cachedBuffer))
{
std::cout << "uniform data equal, skip" << std::endl;
@@ -63,8 +63,8 @@ public:
: setHandle(VK_NULL_HANDLE)
, graphics(graphics)
, owner(owner)
, currentlyInUse(false)
, currentlyBound(false)
, currentlyInUse(false)
{
}
virtual ~DescriptorSet();
@@ -432,16 +432,19 @@ void Graphics::pickPhysicalDevice()
vkGetPhysicalDeviceFeatures(dev, &features);
if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
{
std::cout << "found dedicated gpu " << props.deviceName << std::endl;
currentRating += 100;
}
else if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)
{
std::cout << "found integrated gpu " << props.deviceName << std::endl;
currentRating += 10;
}
if (currentRating > deviceRating)
{
deviceRating = currentRating;
bestDevice = dev;
std::cout << "bestDevice: " << props.deviceName << std::endl;
}
}
physicalDevice = bestDevice;
@@ -765,8 +765,7 @@ VkPipelineShaderStageCreateInfo init::PipelineShaderStageCreateInfo(VkShaderStag
return info;
}
#pragma warning(disable : 4100)
VkBool32 Seele::Vulkan::debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char *layerPrefix, const char *msg, void *userDataManager)
VkBool32 Seele::Vulkan::debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *layerPrefix, const char *msg, void *)
{
if(flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)
{
@@ -778,7 +777,6 @@ VkBool32 Seele::Vulkan::debugCallback(VkDebugReportFlagsEXT flags, VkDebugReport
return VK_FALSE;
}
}
#pragma warning(default : 4100)
VkResult Seele::Vulkan::CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback)
{
+2 -2
View File
@@ -2,7 +2,7 @@
#include "VulkanGraphics.h"
#include "VulkanDescriptorSets.h"
#include "slang.h"
//#include "spirv_cross/spirv_reflect.hpp"
#include "stdlib.h"
using namespace slang;
using namespace Seele;
@@ -55,7 +55,7 @@ static SlangStage getStageFromShaderType(ShaderType type)
void Shader::create(const ShaderCreateInfo& createInfo)
{
entryPointName = createInfo.entryPoint;
static SlangSession* session = spCreateSession(NULL);
static SlangSession* session = spCreateSession(nullptr);
SlangCompileRequest* request = spCreateCompileRequest(session);
int targetIndex = spAddCodeGenTarget(request, SLANG_SPIRV);
@@ -162,9 +162,9 @@ void Window::advanceBackBuffer()
imageAcquiredSemaphore = imageAcquired[semaphoreIndex];
currentImageIndex = imageIndex;
PCmdBuffer cmdBuffer = graphics->getGraphicsCommands()->getCommands();
backBufferImages[currentImageIndex]->changeLayout(Gfx::SE_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
VkClearColorValue clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
PCmdBuffer cmdBuffer = graphics->getGraphicsCommands()->getCommands();
VkImageSubresourceRange range = init::ImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT);
vkCmdClearColorImage(
cmdBuffer->getHandle(),