mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Feat] (MG_Backend/DirectVulkan): wire glPolygonMode and glColorMaski into pipeline creation
Consume the polygon mode and per-draw-buffer color write masks that the frontend already tracks, with runtime fallback for the device features they require. glPolygonMode: - Add ConvertPolygonModeToVkEnum (GL_FILL/LINE/POINT -> VkPolygonMode). - Thread a polygonMode field through PipelineCreatePayload, fold it into the pipeline cache hash (distinct modes need distinct pipelines), and apply it in PipelineFactory instead of the hardcoded VK_POLYGON_MODE_FILL. - LINE/POINT require the fillModeNonSolid device feature: detect and enable it at device creation, cache m_fillModeNonSolidFeatureEnabled, and fall back to FILL at pipeline-build time when it is absent. glColorMaski: - The per-attachment color-blend loop now reads GetColorMaskIndexed(i) instead of the broadcast GetColorMask(), so each draw buffer gets its own write mask (already covered by the pipeline hash). - Divergent per-attachment masks require independentBlend: cache m_independentBlendFeatureEnabled (was enabled but never recorded) and fall back to draw buffer 0's mask for every attachment when it is absent. The internal depth-mipmap utility pipeline keeps VK_POLYGON_MODE_FILL (not GL-driven). Library builds clean; full SanityTest sweep green (30/30).
This commit is contained in:
@@ -31,6 +31,20 @@ namespace MobileGL {
|
||||
}
|
||||
}
|
||||
|
||||
VkPolygonMode ConvertPolygonModeToVkEnum(GLenum mode) {
|
||||
switch (mode) {
|
||||
case GL_FILL:
|
||||
return VK_POLYGON_MODE_FILL;
|
||||
case GL_LINE:
|
||||
return VK_POLYGON_MODE_LINE;
|
||||
case GL_POINT:
|
||||
return VK_POLYGON_MODE_POINT;
|
||||
default:
|
||||
MGLOG_W("Unrecognized polygon mode");
|
||||
return VK_POLYGON_MODE_FILL;
|
||||
}
|
||||
}
|
||||
|
||||
VkCullModeFlags ConvertCullFaceModeToVkEnum(CullFaceMode v, Bool invertClockwise) {
|
||||
switch (v) {
|
||||
case CullFaceMode::Front:
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
VkPrimitiveTopology ConvertPrimitiveModeToVkEnum(GLenum mode);
|
||||
// Maps GL_FILL/GL_LINE/GL_POINT to the matching VkPolygonMode. LINE/POINT require the
|
||||
// fillModeNonSolid device feature; the caller is responsible for falling back to FILL when
|
||||
// that feature is unavailable.
|
||||
VkPolygonMode ConvertPolygonModeToVkEnum(GLenum mode);
|
||||
VkCullModeFlags ConvertCullFaceModeToVkEnum(CullFaceMode value, Bool invertClockwise = false);
|
||||
VkLogicOp ConvertLogicOperationToVkEnum(LogicOperation value);
|
||||
VkCompareOp ConvertDepthTestFuncToVkEnum(DepthTestFunc value);
|
||||
|
||||
Reference in New Issue
Block a user