Commit Graph

11 Commits

Author SHA1 Message Date
Hajime Hoshi
78ed824351 graphics: Make verticesBackend concurrent safe
Fixes #789
2019-01-19 02:06:50 +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
4149a56524 graphics: Refactoring: Use 12 floats for each vertex
This is a preparation for #761.
2018-12-23 02:36:28 +09:00
Hajime Hoshi
5f8a0e34bb graphics: isPowerOf2(0 or negative) should return false 2018-12-16 14:26:16 +09:00
Hajime Hoshi
155ee828b8 Fix misspelling 2018-12-03 18:23:25 +01:00
Hajime Hoshi
31f15bc5ad Revert "graphics: Change the number of floats for a vertex from 10 to 12"
This reverts commit 7586c660d5.
2018-11-18 00:07:15 +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
09c8516545 graphcis: Move IndicesNum from opengl to graphics 2018-11-07 01:49:45 +09:00
Hajime Hoshi
c9f49efd41 graphics: Add VertexFlaotNum 2018-11-06 02:34:52 +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