mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
GPU: Keep spline/bezier tessellation from reaching zero
Reduce only the larger factor when over the vertex limit, and stop at 1. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
9d3022642b
commit
4c2086aac5
1 file changed
+13
-6
@@ -68,6 +68,15 @@ struct SurfaceInfo {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Only the larger factor, so a lopsided patch keeps at least one step along its short axis.
|
||||
void ReduceLargerTess() {
|
||||
if (tess_u >= tess_v) {
|
||||
tess_u--;
|
||||
} else {
|
||||
tess_v--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct BezierSurface : public SurfaceInfo {
|
||||
@@ -78,9 +87,8 @@ struct BezierSurface : public SurfaceInfo {
|
||||
void Init(int maxVertices) {
|
||||
SurfaceInfo::BaseInit();
|
||||
// Downsample until it fits, in case crazy tessellation factors are sent.
|
||||
while ((tess_u + 1) * (tess_v + 1) * num_patches_u * num_patches_v > maxVertices) {
|
||||
tess_u--;
|
||||
tess_v--;
|
||||
while ((tess_u + 1) * (tess_v + 1) * num_patches_u * num_patches_v > maxVertices && (tess_u > 1 || tess_v > 1)) {
|
||||
ReduceLargerTess();
|
||||
}
|
||||
num_verts_per_patch = (tess_u + 1) * (tess_v + 1);
|
||||
}
|
||||
@@ -116,9 +124,8 @@ struct SplineSurface : public SurfaceInfo {
|
||||
void Init(int maxVertices) {
|
||||
SurfaceInfo::BaseInit();
|
||||
// Downsample until it fits, in case crazy tessellation factors are sent.
|
||||
while ((num_patches_u * tess_u + 1) * (num_patches_v * tess_v + 1) > maxVertices) {
|
||||
tess_u--;
|
||||
tess_v--;
|
||||
while ((num_patches_u * tess_u + 1) * (num_patches_v * tess_v + 1) > maxVertices && (tess_u > 1 || tess_v > 1)) {
|
||||
ReduceLargerTess();
|
||||
}
|
||||
num_vertices_u = num_patches_u * tess_u + 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user