Hajime Hoshi
bc3ca38f76
opengl: Rename ResetGLState -> Reset and other functions
2018-11-01 03:02:08 +09:00
seebs
74e204d952
graphics: Speed up DrawTriangles ( #723 )
...
DrawTriangles is expensive and slow because of massive memory
allocation and garbage collection costs. This patch moves from ~47TPS
on my laptop (with ~24k triangles) to 60TPS. The first part
is just allocating the right size of vertex buffer up front; that
got to about 55TPS. The second part replaces the frequent
allocations of []float32 in Vertex() calls with writing the
desired values into a provided destination slice.
Time spent in drawing triangles for 1,000 frames:
13.07s baseline
11.09s preallocate whole buffer to avoid resizing
6.13s use new PutVertex function
This might need some cleanup, but I think it's good evidence that
the design change is viable.
2018-10-31 10:53:17 +09:00
Hajime Hoshi
ce1c616f69
Merge graphics and graphicsutil
2018-10-28 23:03:06 +09:00
Hajime Hoshi
ff54d3b681
Move CompositeMode to graphics package
2018-10-28 21:49:47 +09:00
Hajime Hoshi
06f2052817
Add graphics package and move Filter to graphics
2018-10-28 20:25:52 +09:00
Hajime Hoshi
2da5192510
Rename graphics -> graphicscommand
2018-10-28 20:10:05 +09:00
Hajime Hoshi
2360b2930f
graphics: Add DrawTriangles
...
Fixes #624
2018-08-14 01:23:14 +09:00
Hajime Hoshi
690c3cf981
graphics: Embed 'scale' part of the color matrix
...
If the color matrix includes only 'scale' part, they are embedded
into vertices in order to reduce draw calls.
Fixes #662
2018-08-10 23:20:55 +09:00
Hajime Hoshi
3daaef2cab
restorable: Refactoring: Use ReplacePixels(nil, ...) for clearing an image
2018-08-09 01:16:46 +09:00
Hajime Hoshi
c68c36b0b7
restoreable: Add ClearState to clear the state explicitly
...
Fixes #566
2018-08-09 00:12:45 +09:00
Hajime Hoshi
cdc408d2c2
shareable: Suspend re-using shared images
...
Fixes #661
2018-08-08 18:40:52 +09:00
Hajime Hoshi
77e905eb25
Revert "graphics: Embed color matrices values to vertices ( #655 )"
...
This reverts commit 5a9235aaf9
.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
18d77d3f6e
shareable: Rename variables
2018-08-03 02:50:11 +09:00
Hajime Hoshi
d7d02e6d6a
Reland: graphics: mipmap images should be volatile when the base image is volatile
...
This is not a bug fix, but should improve performance.
2018-07-30 00:26:36 +09:00
Hajime Hoshi
5be58086b5
Revert "graphics: Bug fix: mipmap images should be volatile when the base image is volatile"
...
This reverts commit 0f82330009
.
2018-07-29 23:58:46 +09:00
Hajime Hoshi
0f82330009
graphics: Bug fix: mipmap images should be volatile when the base image is volatile
2018-07-29 23:54:46 +09:00
Hajime Hoshi
0bf62f392f
shareable: Bug fix: forceShared should allocate backend as shareable
2018-07-29 23:49:53 +09:00
Hajime Hoshi
056ed1c6db
shareable: Return color.RGBA instead of color.Color
2018-07-29 21:59:18 +09:00
Hajime Hoshi
5a9235aaf9
graphics: Embed color matrices values to vertices ( #655 )
...
Fixes #531
2018-07-26 11:37:27 +09:00
Hajime Hoshi
5beaf843a6
shareable: Bug fix: volatile or screen must not use shareable texture
2018-07-24 22:25:15 +09:00
Hajime Hoshi
b2a4ddf853
shareable: Refactoring: Add moveTo
2018-07-22 06:29:31 +09:00
Hajime Hoshi
693116ffd6
shareable: Bug fix: Double free
2018-07-22 05:52:11 +09:00
Hajime Hoshi
6687ffe8ba
shareable: Bug fix: SetFinalizer must not be reset at dispose(false)
2018-07-22 05:40:04 +09:00
Hajime Hoshi
09dcba40ab
shareable: Rename variables
2018-07-22 04:32:36 +09:00
Hajime Hoshi
a6edb90898
shareable: Use the shared backend again in some conditions
...
Fixes #633
2018-07-22 04:03:35 +09:00
Hajime Hoshi
9047e54ae6
shareable: Remove comments
2018-07-21 03:43:12 +09:00
Hajime Hoshi
5249afc06b
graphicsutil: Add QuadIndices
2018-07-21 03:40:37 +09:00
Hajime Hoshi
2e7745044d
shareable: Fix Image.DrawImage to accept vertices and indices
2018-07-21 03:30:27 +09:00
Hajime Hoshi
6c8b7f8e9c
graphics: Refactoring: Reduce error propagations
2018-07-12 03:08:50 +09:00
Hajime Hoshi
abdf52bc74
shareable: Bug fix: Call SetFinalizer whenever a new image is created
...
Fixes #637
2018-06-28 22:23:07 +09:00
Hajime Hoshi
dec921809b
shareable: Refactoring
2018-06-26 01:59:12 +09:00
Hajime Hoshi
55d832fc63
shareable: Don't extend textures on macOS
...
Fixes #593
2018-06-20 11:57:39 +09:00
Hajime Hoshi
840c4d24df
graphicsutil: Accept matrix parameters directly for performance
2018-06-19 00:19:32 +09:00
Hajime Hoshi
a3c754d2cc
graphics: Restrict QuadVertices to allow only power of 2 sizes
...
Now QuadVertices can skip calculating power of 2 values.
2018-06-17 23:05:19 +09:00
Hajime Hoshi
ac24a8382f
graphicsutil: Extract matrix applying for performance
2018-06-17 19:45:09 +09:00
Hajime Hoshi
95561bbf6b
affine: Use float32 values for GeoM
...
float32 was slow on GopherJS, but not slow on Wasm.
2018-06-17 15:38:10 +09:00
Hajime Hoshi
4c2fc30311
graphicsutil: Don't allow nil GeoM
2018-06-17 01:48:56 +09:00
Hajime Hoshi
b4ace53596
affine: Remove GeoM to avoid GeoM allocations on the heap
2018-06-17 00:59:50 +09:00
Hajime Hoshi
a90b7efdf4
shareable: Refactoring
2018-06-11 01:02:25 +09:00
Hajime Hoshi
3ee76ffd8e
graphicsutil: Move vertices.go to graphicsutil
2018-06-10 23:08:22 +09:00
Hajime Hoshi
9745ccee47
restorable: Make (*Image).DrawImage accept vertices and indices
2018-06-10 22:59:00 +09:00
Hajime Hoshi
92631e64ed
Remove internal/sync
...
nosync package for GopherJS is problematic since nosync's mutex
assumes that Lock call is never duplicated, which is not true in
actual applications.
See also #603 .
2018-05-09 23:41:08 +09:00
Hajime Hoshi
03dcd94884
shareable: Bug fix: Don't mark disposed when the image becomes not shared
2018-05-03 11:49:55 +09:00
Hajime Hoshi
ea1444ea7e
shareable: Add checks at operations for disposed images
2018-04-30 03:34:35 +09:00
Hajime Hoshi
9df977dff8
shareable: Add 'disposed' state instead of 'allocated' state
2018-04-30 03:30:10 +09:00
Hajime Hoshi
1f1847c259
shareable: Remove println
2018-04-29 19:10:36 +09:00
Hajime Hoshi
9c408dce7c
shareable: Lazy allocation ( #592 )
...
Clear is called when an image becomes a render target, and it
looks like Clear causes the memory spikes.
Before this change, when an image is created, shared region on a GL
texture is allocated. After that, the image's region is copied to
non-shared region when the image becomes a rendering target.
After this change, an image is not allocated on a GL texture first,
and allocated only when it is necessary. Then, Clear calls can be
avoided as much as possible.
2018-04-29 18:51:51 +09:00
Hajime Hoshi
45afb6db67
Reland: restorable: Merge Clear to ReplacePixel
2018-04-29 13:40:18 +09:00
Hajime Hoshi
613f384cb5
graphics: Add EBITEN_DUMP_IMAGES_KEY
...
Fixes #589
2018-04-28 22:08:20 +09:00
Hajime Hoshi
dff492955d
shareable: Reset finalizer in any cases
2018-04-26 01:51:57 +09:00
Hajime Hoshi
1cf4f30541
Revert "restorable: Merge Clear to ReplacePixels"
...
This reverts commit fb641d88cd
.
Reason: When restoring the image where ReplacePixels is called,
dummyImage might not be restored since there is no record of
relationships between this image and dummyImage. Now pixels is not
nil when reverting by chance, but this would cause problems in the
future.
2018-04-25 22:31:48 +09:00
Hajime Hoshi
fb641d88cd
restorable: Merge Clear to ReplacePixels
...
This can avoid unnecessary stale images that requires loading
pixels from GPU.
2018-04-25 01:30:57 +09:00
Hajime Hoshi
070c8ec737
shareable: Rename variables
2018-04-09 02:18:46 +09:00
Hajime Hoshi
7b5ad46e49
shareable: NewImage* now returns a cleared image
2018-04-06 02:08:12 +09:00
Hajime Hoshi
1a335032a2
shareable: Bug fix: backend's restorable image must be disposed
2018-04-06 01:12:08 +09:00
Hajime Hoshi
8ff79c970a
shareable: Use defer for tests
2018-04-05 12:02:08 +09:00
Hajime Hoshi
24e20306f2
restorable: Move 'putting random-colored dot' to restorable
2018-04-05 11:18:28 +09:00
Hajime Hoshi
810dc33b4a
shareable: Fix comments
2018-04-05 02:41:50 +09:00
Hajime Hoshi
15dcd5764d
shareable: Add shareable_test
2018-04-05 02:35:30 +09:00
Hajime Hoshi
6680b4f8d5
shareable: Bug fix: wrong source image rect in ensureNotShared
2018-04-05 01:07:36 +09:00
Hajime Hoshi
92e5bc31dc
shareable: Refactoring
2018-04-05 00:40:35 +09:00
Hajime Hoshi
e14c05b0fe
shareable: Add comments
2018-03-26 00:13:26 +09:00
Hajime Hoshi
97ce612785
Refactoring: Don't access restorable package directly from ebiten package
2018-03-25 23:37:32 +09:00
Hajime Hoshi
ce8b9283a1
Re^2-land: shareable: Implement extending shareable texture again
2018-03-25 22:41:15 +09:00
Hajime Hoshi
b15fb523a8
shareable: Rename variables
2018-03-24 04:27:10 +09:00
Hajime Hoshi
b92bc6f21c
Revert "shareable: Implement extending shareable texture again"
...
This reverts commit b474946619
.
Reason: #567
2018-03-24 04:23:00 +09:00
Hajime Hoshi
aaa603dd08
Revert "Revert "shareable: Avoid unneeded extending images""
...
This reverts commit 96b9f09058
.
Fixes #561
2018-03-20 02:15:49 +09:00
Hajime Hoshi
3e929de08a
shareable: Revert extending images
...
Fixes #562
2018-03-20 02:14:04 +09:00
Hajime Hoshi
d421648e57
shareable: Bug fix: workaround to fix #562 by disabling extending
2018-03-19 03:26:31 +09:00
Hajime Hoshi
96b9f09058
Revert "shareable: Avoid unneeded extending images"
...
This reverts commit ce4e00ff79
.
Reason: #560
2018-03-19 02:28:17 +09:00
Hajime Hoshi
ce4e00ff79
shareable: Avoid unneeded extending images
2018-03-17 17:41:36 +09:00
Hajime Hoshi
e7925a12bd
shareable: Refactoring
2018-03-16 01:21:33 +09:00
Hajime Hoshi
b474946619
shareable: Implement extending shareable texture again
...
Related to #509
2018-03-11 01:36:47 +09:00
Hajime Hoshi
c37dd9d961
packing: Add Extend
2018-03-11 01:13:53 +09:00
Hajime Hoshi
48408cba11
shareable: Bug fix: Protect critical sections
2018-03-11 00:38:49 +09:00
Hajime Hoshi
c411ca492f
shareable: Set finalizers
2018-03-11 00:07:32 +09:00
Hajime Hoshi
a2d6ae7eee
shareable: Rename ImagePart -> Image
2018-03-11 00:05:06 +09:00
Hajime Hoshi
6c6b25647a
shareable: Rename Image -> backend
2018-03-11 00:02:23 +09:00
Hajime Hoshi
df3960a97c
Add internal/shareable
2018-03-10 23:59:26 +09:00