Very strange mask bug

This commit is contained in:
Dynamitos
2024-10-30 10:28:10 +01:00
parent 289b759498
commit 2811757476
11 changed files with 276 additions and 950 deletions
+62 -62
View File
@@ -1,16 +1,16 @@
#include "CBT.h"
#include "Graphics/Shader.h"
#include "Asset/AssetRegistry.h"
#include "Graphics/Shader.h"
using namespace Seele;
Array<Vector4> basePoints = {
//Vector4(0.0f / 3, 0, 0.0f / 3, 1), Vector4(0.0f / 3, 0, 1.0f / 3, 1), Vector4(0.0f / 3, 0, 2.0f / 3, 1),
//Vector4(0.0f / 3, 0, 3.0f / 3, 1), Vector4(1.0f / 3, 0, 0.0f / 3, 1), Vector4(1.0f / 3, 0, 1.0f / 3, 1),
//Vector4(1.0f / 3, 0, 2.0f / 3, 1), Vector4(1.0f / 3, 0, 3.0f / 3, 1), Vector4(2.0f / 3, 0, 0.0f / 3, 1),
//Vector4(2.0f / 3, 0, 1.0f / 3, 1), Vector4(2.0f / 3, 0, 2.0f / 3, 1), Vector4(2.0f / 3, 0, 3.0f / 3, 1),
//Vector4(3.0f / 3, 0, 0.0f / 3, 1), Vector4(3.0f / 3, 0, 1.0f / 3, 1), Vector4(3.0f / 3, 0, 2.0f / 3, 1),
//Vector4(3.0f / 3, 0, 3.0f / 3, 1),
// Vector4(0.0f / 3, 0, 0.0f / 3, 1), Vector4(0.0f / 3, 0, 1.0f / 3, 1), Vector4(0.0f / 3, 0, 2.0f / 3, 1),
// Vector4(0.0f / 3, 0, 3.0f / 3, 1), Vector4(1.0f / 3, 0, 0.0f / 3, 1), Vector4(1.0f / 3, 0, 1.0f / 3, 1),
// Vector4(1.0f / 3, 0, 2.0f / 3, 1), Vector4(1.0f / 3, 0, 3.0f / 3, 1), Vector4(2.0f / 3, 0, 0.0f / 3, 1),
// Vector4(2.0f / 3, 0, 1.0f / 3, 1), Vector4(2.0f / 3, 0, 2.0f / 3, 1), Vector4(2.0f / 3, 0, 3.0f / 3, 1),
// Vector4(3.0f / 3, 0, 0.0f / 3, 1), Vector4(3.0f / 3, 0, 1.0f / 3, 1), Vector4(3.0f / 3, 0, 2.0f / 3, 1),
// Vector4(3.0f / 3, 0, 3.0f / 3, 1),
Vector4(0, -0.525731, 0.850651, 1), Vector4(0.850651, 0, 0.525731, 1), Vector4(0.850651, 0, -0.525731, 1),
Vector4(-0.850651, 0, -0.525731, 1), Vector4(-0.850651, 0, 0.525731, 1), Vector4(-0.525731, 0.850651, 0, 1),
Vector4(0.525731, 0.850651, 0, 1), Vector4(0.525731, -0.850651, 0, 1), Vector4(-0.525731, -0.850651, 0, 1),
@@ -23,77 +23,77 @@ struct Halfedge {
uint32 twinID;
};
Array<Halfedge> edges = {
//Halfedge{0, 1, 2, 4294967295},
//Halfedge{4, 2, 0, 3},
//Halfedge{1, 0, 1, 4294967295},
// Halfedge{0, 1, 2, 4294967295},
// Halfedge{4, 2, 0, 3},
// Halfedge{1, 0, 1, 4294967295},
//
//Halfedge{4, 4, 5, 1},
//Halfedge{5, 5, 3, 8},
//Halfedge{1, 3, 4, 18},
// Halfedge{4, 4, 5, 1},
// Halfedge{5, 5, 3, 8},
// Halfedge{1, 3, 4, 18},
//
//Halfedge{1, 7, 8, 4294967295},
//Halfedge{5, 8, 6, 9},
//Halfedge{2, 6, 7, 4},
// Halfedge{1, 7, 8, 4294967295},
// Halfedge{5, 8, 6, 9},
// Halfedge{2, 6, 7, 4},
//
//Halfedge{5, 10, 11, 7},
//Halfedge{6, 11, 9, 14},
//Halfedge{2, 9, 10, 24},
// Halfedge{5, 10, 11, 7},
// Halfedge{6, 11, 9, 14},
// Halfedge{2, 9, 10, 24},
//
//Halfedge{2, 13, 14, 4294967295},
//Halfedge{6, 14, 12, 15},
//Halfedge{3, 12, 13, 10},
// Halfedge{2, 13, 14, 4294967295},
// Halfedge{6, 14, 12, 15},
// Halfedge{3, 12, 13, 10},
//
//Halfedge{6, 16, 17, 13},
//Halfedge{7, 17, 15, 4294967295},
//Halfedge{3, 15, 16, 30},
// Halfedge{6, 16, 17, 13},
// Halfedge{7, 17, 15, 4294967295},
// Halfedge{3, 15, 16, 30},
//
//Halfedge{4, 19, 20, 5},
//Halfedge{8, 20, 18, 21},
//Halfedge{5, 18, 19, 4294967295},
// Halfedge{4, 19, 20, 5},
// Halfedge{8, 20, 18, 21},
// Halfedge{5, 18, 19, 4294967295},
//
//Halfedge{8, 22, 23, 19},
//Halfedge{9, 23, 21, 26},
//Halfedge{5, 21, 22, 36},
// Halfedge{8, 22, 23, 19},
// Halfedge{9, 23, 21, 26},
// Halfedge{5, 21, 22, 36},
//
//Halfedge{5, 25, 26, 11},
//Halfedge{9, 26, 24, 27},
//Halfedge{6, 24, 25, 22},
// Halfedge{5, 25, 26, 11},
// Halfedge{9, 26, 24, 27},
// Halfedge{6, 24, 25, 22},
//
//Halfedge{9, 28, 29, 25},
//Halfedge{10, 29, 27, 32},
//Halfedge{6, 27, 28, 42},
// Halfedge{9, 28, 29, 25},
// Halfedge{10, 29, 27, 32},
// Halfedge{6, 27, 28, 42},
//
//Halfedge{6, 31, 32, 17},
//Halfedge{10, 32, 30, 33},
//Halfedge{7, 30, 31, 28},
// Halfedge{6, 31, 32, 17},
// Halfedge{10, 32, 30, 33},
// Halfedge{7, 30, 31, 28},
//
//Halfedge{10, 34, 35, 31},
//Halfedge{11, 35, 33, 4294967295},
//Halfedge{7, 33, 34, 48},
// Halfedge{10, 34, 35, 31},
// Halfedge{11, 35, 33, 4294967295},
// Halfedge{7, 33, 34, 48},
//
//Halfedge{8, 37, 38, 23},
//Halfedge{12, 38, 36, 39},
//Halfedge{9, 36, 37, 4294967295},
// Halfedge{8, 37, 38, 23},
// Halfedge{12, 38, 36, 39},
// Halfedge{9, 36, 37, 4294967295},
//
//Halfedge{12, 40, 41, 37},
//Halfedge{13, 41, 39, 44},
//Halfedge{9, 39, 40, 4294967295},
// Halfedge{12, 40, 41, 37},
// Halfedge{13, 41, 39, 44},
// Halfedge{9, 39, 40, 4294967295},
//
//Halfedge{9, 43, 44, 29},
//Halfedge{13, 44, 42, 45},
//Halfedge{10, 42, 43, 40},
// Halfedge{9, 43, 44, 29},
// Halfedge{13, 44, 42, 45},
// Halfedge{10, 42, 43, 40},
//
//Halfedge{13, 46, 47, 43},
//Halfedge{14, 47, 45, 50},
//Halfedge{10, 45, 46, 4294967295},
// Halfedge{13, 46, 47, 43},
// Halfedge{14, 47, 45, 50},
// Halfedge{10, 45, 46, 4294967295},
//
//Halfedge{10, 49, 50, 35},
//Halfedge{14, 50, 48, 51},
//Halfedge{11, 48, 49, 46},
// Halfedge{10, 49, 50, 35},
// Halfedge{14, 50, 48, 51},
// Halfedge{11, 48, 49, 46},
//
//Halfedge{14, 52, 53, 49},
//Halfedge{15, 53, 51, 4294967295},
//Halfedge{11, 51, 52, 4294967295},
// Halfedge{14, 52, 53, 49},
// Halfedge{15, 53, 51, 4294967295},
// Halfedge{11, 51, 52, 4294967295},
Halfedge{1, 1, 2, 5}, Halfedge{2, 2, 0, 36}, Halfedge{6, 0, 1, 39}, Halfedge{1, 4, 5, 51}, Halfedge{7, 5, 3, 48},
Halfedge{2, 3, 4, 0}, Halfedge{3, 7, 8, 9}, Halfedge{4, 8, 6, 45}, Halfedge{5, 6, 7, 42}, Halfedge{4, 10, 11, 6},
@@ -609,7 +609,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
mesh.propagateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
mesh.gpuCBT.bufferArray[1]->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
}
graphics->endDebugRegion();
@@ -13,7 +13,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
Gfx::OPipelineLayout test = graphics->createPipelineLayout();
graphics->beginShaderCompilation(ShaderCompilationInfo{
.modules = {"CompileTest"},
.entryPoints = {{"GetHeap", "CompileTest"}},
.entryPoints = {{"TestHeap", "CompileTest"}},
.rootSignature = test,
});
graphics->createComputeShader({0});
@@ -302,7 +302,7 @@ void TerrainRenderer::setViewport(Gfx::PViewport _viewport, Gfx::PRenderPass ren
.rasterizationState =
{
.polygonMode = Gfx::SE_POLYGON_MODE_LINE,
.cullMode = Gfx::SE_CULL_MODE_BACK_BIT,
.cullMode = Gfx::SE_CULL_MODE_NONE,
},
.colorBlend =
{
+18 -2
View File
@@ -35,6 +35,8 @@ PFN_vkCmdDrawMeshTasksIndirectEXT cmdDrawMeshTasksIndirect;
PFN_vkSetDebugUtilsObjectNameEXT setDebugUtilsObjectName;
PFN_vkQueueBeginDebugUtilsLabelEXT queueBeginDebugUtilsLabelEXT;
PFN_vkQueueEndDebugUtilsLabelEXT queueEndDebugUtilsLabelEXT;
PFN_vkCmdBeginDebugUtilsLabelEXT cmdBeginDebugUtilsLabelEXT;
PFN_vkCmdEndDebugUtilsLabelEXT cmdEndDebugUtilsLabelEXT;
PFN_vkCreateAccelerationStructureKHR createAccelerationStructure;
PFN_vkCmdBuildAccelerationStructuresKHR cmdBuildAccelerationStructures;
PFN_vkGetAccelerationStructureBuildSizesKHR getAccelerationStructureBuildSize;
@@ -71,6 +73,18 @@ void vkQueueEndDebugUtilsLabelEXT(VkQueue queue) {
}
}
void vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo) {
if (cmdBeginDebugUtilsLabelEXT != nullptr) {
cmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo);
}
}
void vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer) {
if (cmdEndDebugUtilsLabelEXT != nullptr) {
cmdEndDebugUtilsLabelEXT(commandBuffer);
}
}
VkResult vkCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkAccelerationStructureKHR* pAccelerationStructure) {
return createAccelerationStructure(device, pCreateInfo, pAllocator, pAccelerationStructure);
@@ -314,10 +328,10 @@ void Graphics::beginDebugRegion(const std::string& name) {
.pNext = nullptr,
.pLabelName = name.c_str(),
};
vkQueueBeginDebugUtilsLabelEXT(queues[graphicsQueue]->getHandle(), &label);
vkCmdBeginDebugUtilsLabelEXT(getGraphicsCommands()->getCommands()->getHandle(), &label);
}
void Graphics::endDebugRegion() { vkQueueEndDebugUtilsLabelEXT(queues[graphicsQueue]->getHandle()); }
void Graphics::endDebugRegion() { vkCmdEndDebugUtilsLabelEXT(getGraphicsCommands()->getCommands()->getHandle()); }
void Graphics::resolveTexture(Gfx::PTexture source, Gfx::PTexture destination) {
PTextureBase sourceTex = source.cast<TextureBase>();
@@ -952,6 +966,8 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
setDebugUtilsObjectName = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectNameEXT");
queueBeginDebugUtilsLabelEXT = (PFN_vkQueueBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkQueueBeginDebugUtilsLabelEXT");
queueEndDebugUtilsLabelEXT = (PFN_vkQueueEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkQueueEndDebugUtilsLabelEXT");
cmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkCmdBeginDebugUtilsLabelEXT");
cmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkCmdEndDebugUtilsLabelEXT");
createAccelerationStructure = (PFN_vkCreateAccelerationStructureKHR)vkGetDeviceProcAddr(handle, "vkCreateAccelerationStructureKHR");
cmdBuildAccelerationStructures =