Commit 8547e8b
[TextureMapper] Polygon clipping performance is extremely slow
https://bugs.webkit.org/show_bug.cgi?id=284027
Reviewed by Fujii Hironori.
Rendering complex preserve-3D scenes might involve a lot of layer splitting.
These splits are handled using polygon clipping, but the current implementation
is inefficient. Each clip operation clears the full stencil buffer and masks
the clipped part using separate vertex buffer objects that are allocated on
demand. This places significant stress on the GPU and on hardware like rpi3 it
completely chokes the rendering pipeline.
To address this issue, polygon clip vertices for preserve-3d scenes should be
loaded to the GPU only once, leveraging cached VBOs. Additionally, stencil
buffer clearing should be optimized using scissors to restrict stencil clears to
relevant areas, avoiding full-buffer operations.
* Source/WebCore/platform/TextureMapper.cmake:
* Source/WebCore/platform/graphics/texmap/ClipPath.cpp: Added.
(WebCore::ClipPath::ClipPath):
(WebCore::ClipPath::data const):
* Source/WebCore/platform/graphics/texmap/ClipPath.h: Added.
* Source/WebCore/platform/graphics/texmap/TextureMapper.cpp:
(WebCore::nextPowerOf2):
(WebCore::TextureMapperGLData::initializeStencil):
(WebCore::TextureMapperGLData::getBufferFromPool):
(WebCore::TextureMapper::beginClip):
(WebCore::TextureMapper::updateProjectionMatrix):
(WebCore::TextureMapper::acquireBufferFromPool):
* Source/WebCore/platform/graphics/texmap/TextureMapper.h:
* Source/WebCore/platform/graphics/texmap/TextureMapperGPUBuffer.cpp: Added.
(WebCore::TextureMapperGPUBuffer::TextureMapperGPUBuffer):
(WebCore::TextureMapperGPUBuffer::~TextureMapperGPUBuffer):
(WebCore::TextureMapperGPUBuffer::updateData):
* Source/WebCore/platform/graphics/texmap/TextureMapperGPUBuffer.h: Added.
* Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintWith3DRenderingContext):
* Source/WebCore/platform/graphics/texmap/TextureMapperLayer3DRenderingContext.cpp:
(WebCore::TextureMapperLayer3DRenderingContext::paint):
(WebCore::TextureMapperLayer3DRenderingContext::traverseTree):
(WebCore::TextureMapperLayer3DRenderingContext::traverseTreeAndPaint): Deleted.
* Source/WebCore/platform/graphics/texmap/TextureMapperLayer3DRenderingContext.h:
Canonical link: https://commits.webkit.org/287519@main1 parent a17bc29 commit 8547e8b
File tree
10 files changed
+399
-55
lines changed- Source/WebCore/platform
- graphics/texmap
10 files changed
+399
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 67 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
| 76 | + | |
66 | 77 | | |
67 | 78 | | |
68 | 79 | | |
| |||
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
| |||
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
133 | 148 | | |
134 | 149 | | |
135 | 150 | | |
| |||
141 | 156 | | |
142 | 157 | | |
143 | 158 | | |
144 | | - | |
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
| |||
169 | 183 | | |
170 | 184 | | |
171 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
172 | 209 | | |
173 | 210 | | |
174 | 211 | | |
| |||
1319 | 1356 | | |
1320 | 1357 | | |
1321 | 1358 | | |
1322 | | - | |
| 1359 | + | |
1323 | 1360 | | |
1324 | 1361 | | |
1325 | 1362 | | |
| |||
1329 | 1366 | | |
1330 | 1367 | | |
1331 | 1368 | | |
1332 | | - | |
1333 | | - | |
1334 | | - | |
1335 | | - | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1340 | 1377 | | |
1341 | 1378 | | |
1342 | 1379 | | |
| |||
1348 | 1385 | | |
1349 | 1386 | | |
1350 | 1387 | | |
1351 | | - | |
| 1388 | + | |
1352 | 1389 | | |
1353 | | - | |
| 1390 | + | |
1354 | 1391 | | |
1355 | 1392 | | |
1356 | 1393 | | |
| |||
1360 | 1397 | | |
1361 | 1398 | | |
1362 | 1399 | | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
| 1400 | + | |
| 1401 | + | |
1369 | 1402 | | |
1370 | 1403 | | |
1371 | | - | |
1372 | | - | |
| 1404 | + | |
| 1405 | + | |
1373 | 1406 | | |
1374 | 1407 | | |
1375 | 1408 | | |
1376 | 1409 | | |
1377 | 1410 | | |
1378 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1379 | 1415 | | |
1380 | 1416 | | |
1381 | 1417 | | |
| |||
1417 | 1453 | | |
1418 | 1454 | | |
1419 | 1455 | | |
| 1456 | + | |
1420 | 1457 | | |
1421 | 1458 | | |
1422 | 1459 | | |
| |||
1427 | 1464 | | |
1428 | 1465 | | |
1429 | 1466 | | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1430 | 1477 | | |
1431 | 1478 | | |
1432 | 1479 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
0 commit comments