More fixes
This commit is contained in:
@@ -48,7 +48,7 @@ void taskMain(
|
|||||||
{
|
{
|
||||||
uint m = mesh.meshletOffset + i;
|
uint m = mesh.meshletOffset + i;
|
||||||
MeshletDescription meshlet = pScene.meshletInfos[m];
|
MeshletDescription meshlet = pScene.meshletInfos[m];
|
||||||
if(meshlet.boundingBox.insideFrustum(localToClip, viewFrustum))
|
//if(meshlet.boundingBox.insideFrustum(localToClip, viewFrustum))
|
||||||
{
|
{
|
||||||
uint index;
|
uint index;
|
||||||
InterlockedAdd(head, 1, index);
|
InterlockedAdd(head, 1, index);
|
||||||
|
|||||||
@@ -20,13 +20,11 @@ struct AABB
|
|||||||
for(int i = 0; i < 8; ++i)
|
for(int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
float3 adjusted = corners[i].xyz / corners[i].w;
|
float3 adjusted = corners[i].xyz / corners[i].w;
|
||||||
if(adjusted.z > 0)
|
|
||||||
{
|
|
||||||
if(frustum.pointInside(adjusted))
|
if(frustum.pointInside(adjusted))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct Plane
|
|||||||
float d;
|
float d;
|
||||||
bool pointInside(float3 point)
|
bool pointInside(float3 point)
|
||||||
{
|
{
|
||||||
return dot(n, point) - d > 0.0f;
|
return dot(n, point) - d < 0.0f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ struct Frustum
|
|||||||
{
|
{
|
||||||
for(int p = 0; p < 4; ++p)
|
for(int p = 0; p < 4; ++p)
|
||||||
{
|
{
|
||||||
if(!sides[p].pointInside(point))
|
if(sides[p].pointInside(point))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,5 @@ public:
|
|||||||
const Component::Mesh& getMesh() const;
|
const Component::Mesh& getMesh() const;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
DEFINE_REF(StaticMeshActor)
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void BasePass::render()
|
|||||||
permutation.setMaterial(materialData.material->getName());
|
permutation.setMaterial(materialData.material->getName());
|
||||||
Gfx::PermutationId id(permutation);
|
Gfx::PermutationId id(permutation);
|
||||||
|
|
||||||
Gfx::PRenderCommand command = graphics->createRenderCommand("DepthRender");
|
Gfx::PRenderCommand command = graphics->createRenderCommand("BaseRender");
|
||||||
command->setViewport(viewport);
|
command->setViewport(viewport);
|
||||||
Gfx::OPipelineLayout layout = graphics->createPipelineLayout(basePassLayout);
|
Gfx::OPipelineLayout layout = graphics->createPipelineLayout(basePassLayout);
|
||||||
layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout());
|
layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout());
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ void Graphics::pickPhysicalDevice()
|
|||||||
{
|
{
|
||||||
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0)
|
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0)
|
||||||
{
|
{
|
||||||
//meshShadingEnabled = true;
|
meshShadingEnabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,12 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
|||||||
PVertexShader vertexShader = gfxInfo.vertexShader.cast<VertexShader>();
|
PVertexShader vertexShader = gfxInfo.vertexShader.cast<VertexShader>();
|
||||||
stageInfos[stageCount++] = {
|
stageInfos[stageCount++] = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.flags = 0,
|
||||||
.stage = VK_SHADER_STAGE_VERTEX_BIT,
|
.stage = VK_SHADER_STAGE_VERTEX_BIT,
|
||||||
.module = vertexShader->getModuleHandle(),
|
.module = vertexShader->getModuleHandle(),
|
||||||
.pName = vertexShader->getEntryPointName(),
|
.pName = vertexShader->getEntryPointName(),
|
||||||
|
.pSpecializationInfo = nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (gfxInfo.fragmentShader != nullptr)
|
if (gfxInfo.fragmentShader != nullptr)
|
||||||
@@ -105,9 +108,12 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
|||||||
|
|
||||||
stageInfos[stageCount++] = {
|
stageInfos[stageCount++] = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.flags = 0,
|
||||||
.stage = VK_SHADER_STAGE_FRAGMENT_BIT,
|
.stage = VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||||
.module = fragment->getModuleHandle(),
|
.module = fragment->getModuleHandle(),
|
||||||
.pName = fragment->getEntryPointName(),
|
.pName = fragment->getEntryPointName(),
|
||||||
|
.pSpecializationInfo = nullptr,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
hash = CRC::Calculate(stageInfos, sizeof(stageInfos), CRC::CRC_32(), hash);
|
hash = CRC::Calculate(stageInfos, sizeof(stageInfos), CRC::CRC_32(), hash);
|
||||||
@@ -124,7 +130,9 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
|||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.viewportCount = 1,
|
.viewportCount = 1,
|
||||||
|
.pViewports = nullptr,
|
||||||
.scissorCount = 1,
|
.scissorCount = 1,
|
||||||
|
.pScissors = nullptr,
|
||||||
};
|
};
|
||||||
hash = CRC::Calculate(&viewportInfo, sizeof(viewportInfo), CRC::CRC_32(), hash);
|
hash = CRC::Calculate(&viewportInfo, sizeof(viewportInfo), CRC::CRC_32(), hash);
|
||||||
VkPipelineRasterizationStateCreateInfo rasterizationState = {
|
VkPipelineRasterizationStateCreateInfo rasterizationState = {
|
||||||
@@ -198,6 +206,7 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
|||||||
.pAttachments = blendAttachments.data(),
|
.pAttachments = blendAttachments.data(),
|
||||||
};
|
};
|
||||||
std::memcpy(blendState.blendConstants, gfxInfo.colorBlend.blendConstants.data(), sizeof(blendState.blendConstants));
|
std::memcpy(blendState.blendConstants, gfxInfo.colorBlend.blendConstants.data(), sizeof(blendState.blendConstants));
|
||||||
|
hash = CRC::Calculate(&blendState, sizeof(blendState), CRC::CRC_32(), hash);
|
||||||
|
|
||||||
uint32 numDynamicEnabled = 0;
|
uint32 numDynamicEnabled = 0;
|
||||||
StaticArray<VkDynamicState, 2> dynamicEnabled;
|
StaticArray<VkDynamicState, 2> dynamicEnabled;
|
||||||
@@ -208,6 +217,7 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf
|
|||||||
VkPipelineDynamicStateCreateInfo dynamicState = {
|
VkPipelineDynamicStateCreateInfo dynamicState = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
|
.flags = 0,
|
||||||
.dynamicStateCount = (uint32)dynamicEnabled.size(),
|
.dynamicStateCount = (uint32)dynamicEnabled.size(),
|
||||||
.pDynamicStates = dynamicEnabled.data(),
|
.pDynamicStates = dynamicEnabled.data(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
PGraphicsPipeline createPipeline(Gfx::MeshPipelineCreateInfo createInfo);
|
PGraphicsPipeline createPipeline(Gfx::MeshPipelineCreateInfo createInfo);
|
||||||
PComputePipeline createPipeline(Gfx::ComputePipelineCreateInfo createInfo);
|
PComputePipeline createPipeline(Gfx::ComputePipelineCreateInfo createInfo);
|
||||||
private:
|
private:
|
||||||
Map<uint32, OGraphicsPipeline> graphicsPipelines;
|
std::map<uint32, OGraphicsPipeline> graphicsPipelines;
|
||||||
Map<uint32, OComputePipeline> computePipelines;
|
Map<uint32, OComputePipeline> computePipelines;
|
||||||
std::mutex cacheLock;
|
std::mutex cacheLock;
|
||||||
VkPipelineCache cache;
|
VkPipelineCache cache;
|
||||||
|
|||||||
Reference in New Issue
Block a user