Commit Graph

460 Commits

Author SHA1 Message Date
Hajime Hoshi
5afcc65387 shareable: Add comments 2019-04-11 18:15:56 -07:00
Hajime Hoshi
b1b8d0b4b1 graphics: Move texel-region adjustment from shaders to program
This reduces GPU burden.
2019-02-16 14:50:03 +09:00
Hajime Hoshi
3f28592700 graphics: Refactoring: Remove PutVertex 2019-02-15 00:22:32 +09:00
Hajime Hoshi
7c506bc5bc restorable: Refactoring: Add (*Image).QuadVertices/PutVertex 2019-02-15 00:18:12 +09:00
Hajime Hoshi
fd250c8d8c graphics: Rename NextPowerOf2Int -> InternalImageSize and add image size adjustment
There is a minimum internal image size on some system like old iOS
devices. This change adds adjustment of the size.

Issue: #810
2019-02-14 23:06:01 +09:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
78ed824351 graphics: Make verticesBackend concurrent safe
Fixes #789
2019-01-19 02:06:50 +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
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
ff62876552 Add Metal implementation
Fixes #621
2018-12-20 02:37:10 +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
14f5a03a79 Merge math and graphics packages 2018-11-17 20:23:12 +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
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
bd1fc4439a graphicsutil: Avoid passing NaN to shaders experimentally (#696) 2018-10-04 02:02:19 +09:00
Hajime Hoshi
fad65f2f5d graphics: Use the viewport size same as the framebuffer size
Fixes #691
2018-09-29 19:53:22 +09:00
Hajime Hoshi
8827520d4a graphics: Bug fix: avoid jaggy rendering on macOS by adjusting texels (#669) 2018-08-30 00:17:03 +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
e46f9c6305 graphics: Bug fix: compile error 2018-08-10 03:10:57 +09:00
Hajime Hoshi
a03b335c24 graphics: Add logging when 'ebitendebug' tag is specified
Fixes #563
2018-08-10 02:39:07 +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
5a9235aaf9
graphics: Embed color matrices values to vertices (#655)
Fixes #531
2018-07-26 11:37:27 +09:00
Hajime Hoshi
6c8b7f8e9c graphics: Refactoring: Reduce error propagations 2018-07-12 03:08:50 +09:00
Hajime Hoshi
a9a21132ae graphics: Refactoring: Add pixelCommand 2018-07-12 02:40:06 +09:00
Hajime Hoshi
f6b7a6be73 graphics: Use copy function in appendVertices 2018-06-17 01:09:05 +09:00
Hajime Hoshi
c782380a1c restorable: Specify indices from restorable package 2018-06-10 18:17:58 +09:00
Hajime Hoshi
2853895e6b graphics: Refactoring: Rename functions 2018-06-10 17:53:57 +09:00
Hajime Hoshi
32ac3840a7 graphics: Add comments 2018-06-10 17:10:11 +09:00
Hajime Hoshi
4e21bfd005 graphics: Rename elements -> indices 2018-06-10 17:06:40 +09:00
Hajime Hoshi
8a268e871f graphics: Specify indices before commands 2018-06-10 17:04:58 +09:00
Hajime Hoshi
e6d0943366 graphics: Rename color_matrix -> color_matrix_body 2018-06-06 02:46:54 +09:00
Hajime Hoshi
b86860abcc graphics: Call BindBuffer only when the program was null 2018-06-04 00:13:23 +09:00
Hajime Hoshi
fac639f9b7 graphics: Refactoring: Remove drawImageCommand.quadsNum 2018-06-03 23:58:08 +09:00
Hajime Hoshi
c9dd04d471 graphics: Refactoring: Remove command groups 2018-06-03 23:13:01 +09:00
Hajime Hoshi
9d87622a19 graphics: Set elements for every EnqueueDrawImageCommand 2018-06-03 20:42:45 +09:00
Hajime Hoshi
525ad04568 graphics: Split the notion of vertices and elements 2018-06-03 16:07:26 +09:00
Hajime Hoshi
25f2dfc677 graphics: Refactoring 2018-06-03 01:43:10 +09:00
Hajime Hoshi
03e3f0f5f7 graphics: Call glBufferSubData for element array buffer every frame
This is a preparation for more flexible drawing commands.
2018-05-31 00:53:05 +09:00
Hajime Hoshi
5e93d75ae0 graphics: Fix comments 2018-05-28 02:38:26 +09:00
Hajime Hoshi
399f965729 opengl: Add BindBuffer accepting both element-array-buffer and array-buffer
This change is a pure refactoring to clarify that array buffer is
binded before its usage.
2018-05-28 00:34:00 +09:00