renderer_vulkan: Disable culling for RectList. (#1749)

This commit is contained in:
squidbus 2024-12-12 01:05:59 -08:00 committed by GitHub
parent 856d2d1bfa
commit 0908d69002
3 changed files with 32 additions and 1 deletions

View file

@ -65,6 +65,33 @@ vk::CompareOp CompareOp(Liverpool::CompareFunc func) {
}
}
bool IsPrimitiveCulled(AmdGpu::PrimitiveType type) {
switch (type) {
case AmdGpu::PrimitiveType::TriangleList:
case AmdGpu::PrimitiveType::TriangleFan:
case AmdGpu::PrimitiveType::TriangleStrip:
case AmdGpu::PrimitiveType::PatchPrimitive:
case AmdGpu::PrimitiveType::AdjTriangleList:
case AmdGpu::PrimitiveType::AdjTriangleStrip:
case AmdGpu::PrimitiveType::QuadList:
case AmdGpu::PrimitiveType::QuadStrip:
case AmdGpu::PrimitiveType::Polygon:
return true;
case AmdGpu::PrimitiveType::None:
case AmdGpu::PrimitiveType::PointList:
case AmdGpu::PrimitiveType::LineList:
case AmdGpu::PrimitiveType::LineStrip:
case AmdGpu::PrimitiveType::AdjLineList:
case AmdGpu::PrimitiveType::AdjLineStrip:
case AmdGpu::PrimitiveType::RectList: // Screen-aligned rectangles that are not culled
case AmdGpu::PrimitiveType::LineLoop:
return false;
default:
UNREACHABLE();
return true;
}
}
vk::PrimitiveTopology PrimitiveType(AmdGpu::PrimitiveType type) {
switch (type) {
case AmdGpu::PrimitiveType::PointList:

View file

@ -18,6 +18,8 @@ vk::StencilOp StencilOp(Liverpool::StencilFunc op);
vk::CompareOp CompareOp(Liverpool::CompareFunc func);
bool IsPrimitiveCulled(AmdGpu::PrimitiveType type);
vk::PrimitiveTopology PrimitiveType(AmdGpu::PrimitiveType type);
vk::PolygonMode PolygonMode(Liverpool::PolygonMode mode);

View file

@ -110,7 +110,9 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
.depthClampEnable = false,
.rasterizerDiscardEnable = false,
.polygonMode = LiverpoolToVK::PolygonMode(key.polygon_mode),
.cullMode = LiverpoolToVK::CullMode(key.cull_mode),
.cullMode = LiverpoolToVK::IsPrimitiveCulled(key.prim_type)
? LiverpoolToVK::CullMode(key.cull_mode)
: vk::CullModeFlagBits::eNone,
.frontFace = key.front_face == Liverpool::FrontFace::Clockwise
? vk::FrontFace::eClockwise
: vk::FrontFace::eCounterClockwise,