]> git.mxchange.org Git - flightgear.git/blob - src/Canvas/ShivaVG/MYTODO
Fix a Clang warning in Shiva.
[flightgear.git] / src / Canvas / ShivaVG / MYTODO
1 shIsValid* functions do a search through array!!!
2 That is required because user handles are actually pointers and need to be found in the valid path array. Solution would be to use indices into an array of pointers for internal handle-to-pointer conversion. When a path is deleted, an empty space would be left in the array and used when the next path is created.
3
4 How to speed up image upload / manipulation
5 =============================================
6
7 1) shCopyPixels uses memcpy
8
9 First, manipulation can be speeded up by modifying shCopyPixels
10 to copy lines using memcpy directly when source and target
11 formats are equal. If stride is same too, than we can memcpy
12 the whole block of memory.
13
14 2) What about mapping image manipulation directly to OpenGL
15 texture manipulation calls? Which formats could support this?
16
17 PROBLEM: if NOPS textures are not supported, then writing
18 and reading the image data back results in a precision loss!
19 Even if PBO available we'd need to gluScaleImage into it.
20
21 --> means: no NOPS, need intermediate buffer anyway
22
23 === Solution1: PBO are available ====
24
25 Extension required: EXT_pixel_buffer_object (ARB_pixel_buffer_object ?)
26
27 Complexity of implementation: really easy - PBO simply
28 replaces the buffer that would be used if NOPS were not there
29
30 Cannot just glBindBuffer(GL_PIXEL_UNPACK_BUFFER) and then
31 glReadPixels into client memory, because glPixelStore
32 doesn't allow for random row byte size ("stride" must be
33 a multiple of pixel byte size).
34
35 We can safely glMapBuffer and copy from it whatever we want
36 however we want, and do any kind of conversion inbetween.
37 Is glMapBuffer + memcpy into user memory faster than just
38 glGetTexImage? Probably yes, since glGetTexImage probably
39 first downloads the data from GPU anyway.
40
41 glMapBuffer better anyway, because we can directly do the format
42 conversions unsupported by OpenGL (premultiplied to unpremultiplied,
43 grayscale conversion with different per component coefficients
44 instead of simple averaging etc.). We use all the exact same code
45 as when NOPS not supported.
46
47
48 === Solution2: no PBOs ===
49
50 - vgImageSubData     => glTexSubImage2D
51 - vgGetImageSubData  => glGetTexImage
52 - vgCopyImage        => glGetTexImage, glTexSubImage2D
53 - vgSetPixels        => glGetTexImage, glDrawPixels
54
55   (PROBLEM: for glGetTexImage, row length in glPixelStore must
56    be a multiple of pixel byte size!)
57
58 - when copying pixels to/from the texture, we still need to
59   manually clip the working pixel region to the intersection
60   of the source and destination rectangles, since opengl spec
61   says INVALID_VALUE error is generated for invalid regions
62   (e.g. dstX + copyW > dstW)
63
64
65 How to solve great slow-down when scaled up?
66 =============================================
67
68 Reasons:
69 - cpu is subdividing a loooong path
70 - fill-rate is a bad thing
71
72 1. By writing gradient shaders, there would be no need to
73 draw into stencil first and then fill the whole area where stencil
74 odd - at least not when drawing stroke (optimizes half of the pipeline)
75
76 2. Real tesselation would reduce fill rate for filled paths, but does
77 the CPU bottleneck outweight the gain?
78
79 3. Early path discarding (transformed bounds outside surface? maybe
80 early convex-hull rule removal?)