Hajime Hoshi
107dfe5074
graphics: Improve Set speed
...
On GopherJS, copying a struct is very heavy. This change avoids
copying (color) structs when possible.
2019-01-14 04:25:43 +09:00
Hajime Hoshi
1e1f309a1c
shareable: Add Fill
...
Before introducing Fill, filling an image with a solid color was
implemented by ReplacePixels. When an offscreen image is used, the
offscreen image is not fully cleared or filled with a color and
out of (0,0)-(width,height) region. This causes a glitch thin line
on mobile platforms.
This change adds (*shareable.Image).Fill to fill the whole
framebuffer region of the image.
2019-01-13 02:12:47 +09:00
Hajime Hoshi
6783aaae56
graphics: Better test for a crash
2019-01-11 00:31:32 +09:00
Hajime Hoshi
c4e98de804
shareable: Refactoring
2019-01-10 23:31:53 +09:00
Hajime Hoshi
4a587f495d
restorable: Bug fix: ReplacePixels might call DrawImage, which violates some assumptions
2019-01-10 23:22:59 +09:00
Hajime Hoshi
b34834a895
graphicscommand: Explicitly forbide ReplacePixels for a part after DrawImage
2019-01-06 05:15:27 +09:00
Hajime Hoshi
b5c9cd6253
shareable: Fix comments
2019-01-06 03:15:32 +09:00
Hajime Hoshi
fbf7007056
restorable: Pixels() should return immediately when it doesn't have to access GPU
...
Fixes #763
2018-12-26 20:25:40 +09:00
Hajime Hoshi
f1582c2d73
graphics: Add Address representing a sampler address mode
...
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
189b8a17e9
graphics: Use source-border check even at DrawTriangles
...
DrawTriangles can now take a sub-image.
2018-12-23 03:24:39 +09:00
Hajime Hoshi
e809991c9f
shareable: Bug fix: Image invalidation by ReplacePixels
...
ReplacePixels on a part of image might invalidate the other part of
the image on MacBook Pro 2013, especially when the other part is
rendered by DrawImage.
Fixes #593 #758
2018-12-21 11:50:10 +09:00
Hajime Hoshi
ff62876552
Add Metal implementation
...
Fixes #621
2018-12-20 02:37:10 +09:00
Hajime Hoshi
2c25318634
shareable: Add TestReplacePixelsAfterDrawImage
2018-12-16 15:13:35 +09:00
Hajime Hoshi
17b225083d
shareable: Improve TestExtend
2018-12-16 05:09:43 +09:00
Hajime Hoshi
22b11aafac
shareable: Add TestExtend
2018-12-15 19:51:17 +09:00
Hajime Hoshi
155ee828b8
Fix misspelling
2018-12-03 18:23:25 +01:00
Hajime Hoshi
c6dd0a75d9
graphicscommand: Optimize replace-image calls
...
Now ReplacePixels command is called only when necessary.
This also ensures that DrawImage must be called after ReplacePixels
is called since there is a potential problem that rendering images
on a texture without initializing by replacing pixels might cause
problems (escpecially on Metal. Perhaps #593 might be related).
2018-12-01 21:36:47 +01:00
Hajime Hoshi
e799a0c6a8
shareable: Fix wrong variable names
2018-12-01 11:31:32 +01:00
Hajime Hoshi
1a54ff34e6
graphics: Forbid nil at ReplacePixels explicitly
2018-11-28 22:26:34 +01:00
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
a988082be1
shareable: Bug fix: disable tests
2018-08-09 00:19:55 +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
81094da3a1
shareable: Bug fix: test failures
2018-07-29 23:28:13 +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
2559979c2b
shareable: Add tests
2018-07-25 01:08:04 +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