Implement fallback for unsupported stencil operations

Added handling for unsupported bitwise stencil operations with a warning log.
This commit is contained in:
Hog 2026-06-07 14:39:08 +01:00 committed by GitHub
parent 9af54811a0
commit f47efc3200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,6 +35,19 @@ vk::StencilOp StencilOp(AmdGpu::StencilFunc op) {
return vk::StencilOp::eDecrementAndWrap;
case AmdGpu::StencilFunc::ReplaceOp:
return vk::StencilOp::eReplace;
case AmdGpu::StencilFunc::Ones:
// No Vulkan equivalent; eReplace with reference value 0xFF is the closest approximation.
return vk::StencilOp::eReplace;
case AmdGpu::StencilFunc::And:
case AmdGpu::StencilFunc::Or:
case AmdGpu::StencilFunc::Xor:
case AmdGpu::StencilFunc::Nand:
case AmdGpu::StencilFunc::Nor:
case AmdGpu::StencilFunc::Xnor:
// Bitwise stencil operations have no Vulkan equivalent; eKeep is the safest fallback.
LOG_WARNING(Render_Vulkan, "Unsupported bitwise stencil op {}, using Keep.",
static_cast<u32>(op));
return vk::StencilOp::eKeep;
default:
UNREACHABLE();
return vk::StencilOp::eKeep;