mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (DirectVulkan): run the tessellation stages
The backend already turned a tessellation control/evaluation shader into the right VkShaderStage, but nothing downstream knew what to do with it: GL_PATCHES had no topology, so it fell through to the triangle-list default, and the pipeline carried no tessellation state at all. A GL_PATCHES draw therefore ran the vertex and fragment stages over raw triangles. Map GL_PATCHES to VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, carry GL_PATCH_VERTICES into the pipeline as patchControlPoints (part of the key, since two patch sizes are two pipelines), attach VkPipelineTessellationStateCreateInfo for a patch topology only, and enable the tessellationShader device feature. POST reports the feature, because without it a program with a tessellation stage cannot build a pipeline at all and GL_PATCHES draws render nothing.
This commit is contained in:
@@ -38,6 +38,10 @@ namespace MobileGL {
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY;
|
||||
case GL_TRIANGLE_STRIP_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY;
|
||||
case GL_PATCHES:
|
||||
// The tessellator decides what a patch becomes; its vertex count is pipeline
|
||||
// state (patchControlPoints), not part of the topology.
|
||||
return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
|
||||
default:
|
||||
MGLOG_W("Unrecognized primitive topology");
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
|
||||
@@ -1431,6 +1431,18 @@ namespace MobileGL::MG_Util::SelfTest {
|
||||
"hard-fails at draw");
|
||||
}
|
||||
|
||||
// Core 1.0 features the backend turns GL stages into pipeline stages with.
|
||||
VkPhysicalDeviceFeatures coreFeatures{};
|
||||
vkGetPhysicalDeviceFeatures(physicalDevice, &coreFeatures);
|
||||
if (coreFeatures.tessellationShader == VK_TRUE) {
|
||||
builder.Pass("tessellationShader",
|
||||
"supported (GL_PATCHES draws run the tessellation control/evaluation stages)");
|
||||
} else {
|
||||
builder.Warn("tessellationShader",
|
||||
"unsupported; a program with a tessellation control/evaluation shader cannot build a "
|
||||
"pipeline, so GL_PATCHES draws render nothing");
|
||||
}
|
||||
|
||||
Bool vertexAttributeInstanceRateDivisor = false;
|
||||
if (vkGetPhysicalDeviceFeatures2Fn != nullptr &&
|
||||
HasVkExtension(deviceExtensions, VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME)) {
|
||||
|
||||
Reference in New Issue
Block a user