Commit Graph

350 Commits

Author SHA1 Message Date
Hajime Hoshi
ea9eac0461 graphics: Add explicit types for documents (godoc.org) 2018-12-24 19:36:41 +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
529cd3376b graphics: Fix comments about Vertex 2018-12-23 06:14:35 +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
1a54ff34e6 graphics: Forbid nil at ReplacePixels explicitly 2018-11-28 22:26:34 +01:00
Hajime Hoshi
b48d501bc0 graphics: Explicit limitation of indices at DrawTriangles
Fixes #728
2018-11-23 19:02:10 +09:00
Hajime Hoshi
7586c660d5 graphics: Change the number of floats for a vertex from 10 to 12
This is a preparation for Metal, that forces 4 floats for a vertex
position.
2018-11-17 15:30:11 +09:00
Hajime Hoshi
dfb63852c2 graphics: Refactoring 2018-11-09 01:40:05 +09:00
Hajime Hoshi
9f0d14dd05 graphics: Add tests for #732 2018-11-09 00:48:21 +09:00
Hajime Hoshi
f54bdfa159 Reland: graphics: Bug fix: a sub image's Size was wrong
Size() usages are also fixed.

Fixes #732
2018-11-08 12:58:14 +09:00
Hajime Hoshi
27331024af Revert "graphics: Bug fix: a sub image's Size was wrong"
This reverts commit 76ac850f6b.

Reason: This breaks many examples
2018-11-08 12:19:38 +09:00
Hajime Hoshi
76ac850f6b graphics: Bug fix: a sub image's Size was wrong
Fixes #732
2018-11-08 04:22:19 +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
ec92f61a3e graphics: Misspelling 2018-10-29 02:05:59 +09:00
Hajime Hoshi
27ee54b008 graphics: Forbid using a subimage at DrawTriangles (#727) 2018-10-29 01:37:59 +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
3349a2c520 graphics: Add comments 2018-10-28 19:41:39 +09:00
Hajime Hoshi
781554ecb9 graphics: Refactoring 2018-10-28 19:35:01 +09:00
Hajime Hoshi
710f56531f graphics: Experimental: (*image.Image).SubImage
Fixes #722
2018-10-28 02:19:14 +09:00
Hajime Hoshi
41877bba0b graphics: Add image state check at DrawTriangles 2018-10-28 01:43:28 +09:00
Hajime Hoshi
170f0fcaa9 graphics: Refactoring 2018-10-28 01:39:58 +09:00
Hajime Hoshi
5f04f05cb1 graphics: Add comments 2018-10-26 03:29:20 +09:00
Hajime Hoshi
d3bd858aba graphics: Bug fix: Mipmap was not invalidated at DrawTriangle
Fixes #725
2018-10-26 02:08:18 +09:00
Hajime Hoshi
8b82667df1 graphics: Bug fix: Violating edge pixels with linear filter
Fixes #724
2018-10-26 00:48:51 +09:00
Hajime Hoshi
58f4feda8d graphics: Refactoring (preparing SubImage) 2018-10-25 12:48:24 +09:00
Hajime Hoshi
765af5a7af gofmt -s -w 2018-10-25 12:47:27 +09:00
Hajime Hoshi
ce60f44490 graphics: Add (*mipmap).original() 2018-10-25 02:11:54 +09:00
Hajime Hoshi
15cad6ed9a graphics: Rename shareableImages -> mipmap 2018-10-25 02:05:25 +09:00
Hajime Hoshi
022c40aa17 graphics: Move creating mipmap logic to shareableImages 2018-10-25 01:35:34 +09:00
Hajime Hoshi
4cd3e3ae30 Update go.mod/go.sum 2018-10-24 01:16:17 +09:00
Hajime Hoshi
7494b19dea graphics: Refactoring: Add shareableImages struct 2018-10-24 01:09:59 +09:00
Hajime Hoshi
5e09da1298 graphics: Bug fix: don't apply color matrix when creating mipmap images
TODO: Add tests.

Fixes #710
2018-10-11 02:34:07 +09:00
Yuval Langer
8ba787522f Fix minor typo (#706) 2018-10-09 03:19:27 +09:00
Hajime Hoshi
8772d310fe Revert "Revert "graphics: Fix documentation about DrawImage""
This reverts commit f16c7cb90d.

Reason: Oops, I reverted a wrong commit
2018-08-14 12:27:18 +09:00
Hajime Hoshi
f16c7cb90d Revert "graphics: Fix documentation about DrawImage"
This reverts commit 610bf6e39f.

Reason: This caused a new black line at the bottom (macOS).
2018-08-14 12:26:28 +09:00
Hajime Hoshi
2360b2930f graphics: Add DrawTriangles
Fixes #624
2018-08-14 01:23:14 +09:00
Hajime Hoshi
610bf6e39f graphics: Fix documentation about DrawImage 2018-08-11 02:14:37 +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
77e905eb25 Revert "graphics: Embed color matrices values to vertices (#655)"
This reverts commit 5a9235aaf9.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
bf19f902af Revert "graphics: Fix DrawImage comment"
This reverts commit 8e6314f856.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
bac0431c9f graphics: Simplify mipmap calculation 2018-08-03 00:02:49 +09:00
Hajime Hoshi
5c201af311 graphics: Bug fix: compile error 2018-07-31 01:56:59 +09:00
Hajime Hoshi
0956ca0ea6 graphicsutil: Add MipmapLevel 2018-07-31 01:47:03 +09:00
Hajime Hoshi
b8ab1363d2 graphics: Bug fix: mipmap level calculation 2018-07-31 01:02:09 +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