Commit Graph

4923 Commits

Author SHA1 Message Date
Hajime Hoshi
9c637c65be shareable: Add Shader 2020-05-29 00:15:42 +09:00
Hajime Hoshi
1c980a16f5 graphicsdriver/opengl: Ignore non-existent uniform locations
Shader users should not have to care about the existence of uniform
variables.

Updates #1168
2020-05-27 11:39:11 +09:00
Hajime Hoshi
f80719ef9a driver: Use slices for uniform variables instead of maps
Fixes #1172
2020-05-26 23:50:11 +09:00
Hajime Hoshi
fd5c34cbc3 Update dependencies 2020-05-26 20:23:19 +09:00
Hajime Hoshi
f14f3b6456 restorable: Fix comments 2020-05-26 00:28:00 +09:00
Hajime Hoshi
7b9cc8deb4 restorable: Add tests to dispose shaders
When a shader is disposed, all the images depending on it should
become stale, i.e., discard its all the rendering history items,
because they cannot be restored due to the lack of data on the GPU.
2020-05-26 00:20:11 +09:00
Hajime Hoshi
8e6f19b37a restorable: Add a test using shaders with multiple sources 2020-05-25 23:57:55 +09:00
Hajime Hoshi
ca73f17dd4 restorable: Bug fix: Fill didn't invalidate its dependencies
Fixes #1170
2020-05-25 23:37:25 +09:00
seebs
982a68e5a2
inpututil: use slices for maps where keys are small contiguous integers (#1169)
Durations for key presses and gamepad button presses were being stored
in map[int]int, where the key values were always small integers, and
furthermore, were always contiguous and contained the whole set. It's
much faster and cheaper to do those with slices.

We could probably do this with mouse buttons, but I was wary of that
code because I don't see any handling for more-than-three-button
mice. Similar logic could perhaps apply to touch events, but there
it might make more sense to use a dynamic allocation of some kind.

It might be more efficient to just swap the two slices back and
forth, computing the new values from the previous values and
then swapping the slice arrays themselves, but that seemed like
a more intrusive change.
2020-05-25 03:20:21 +09:00
Hajime Hoshi
1cfc1964bf graphicsdriver/opengl: Bug fix: fmt arguments 2020-05-25 02:36:45 +09:00
Hajime Hoshi
8738d182fb restoreble: Add test with shaders rendering an image
Updates #1168
2020-05-25 02:32:23 +09:00
Hajime Hoshi
85730b433e graphicsdriver: Bug fix: Pass texture natives as uniform variables correctly 2020-05-25 02:31:54 +09:00
Hajime Hoshi
732f288d20 restorable: Add Shader (WIP) 2020-05-25 00:50:01 +09:00
Hajime Hoshi
9bf24ba545 graphicsdriver/opengl: Remove println and add error messages 2020-05-24 23:15:00 +09:00
Hajime Hoshi
fc50f9b0be testing: Refactoring 2020-05-24 22:30:11 +09:00
Hajime Hoshi
155c63ec76 graphicscommand: Move the shader program to testing package 2020-05-24 20:15:07 +09:00
Hajime Hoshi
465d8aa273 graphicscommand: Add IsShaderAvailable for other packages 2020-05-24 19:15:18 +09:00
Hajime Hoshi
c5aba02723 graphicscommand: Update comments 2020-05-24 16:54:28 +09:00
Hajime Hoshi
6506c20f4e graphicscommand: Use an image in the uniform variables 2020-05-24 16:43:08 +09:00
Hajime Hoshi
968c0a9b9a graphicscommand: Bug fix: test failures 2020-05-24 03:04:52 +09:00
Hajime Hoshi
d94b84b8de graphciscommand: Add coments 2020-05-24 02:51:37 +09:00
Hajime Hoshi
a4d419bab1 graphicscommand: Merge DrawTriangles and DrawShader 2020-05-24 02:36:09 +09:00
Hajime Hoshi
3ed9f8ee3b shaderir: Update comments 2020-05-24 02:07:57 +09:00
Hajime Hoshi
47f415fe5a examples/raycasting: Use RunGame
Updates #1111
2020-05-24 00:12:44 +09:00
Hajime Hoshi
0bbf0d5291 examples: Use RunGame
Updates #1111
2020-05-23 23:36:53 +09:00
Hajime Hoshi
3306a957ba graphicscommand: Skip the shader test on browsers
Updates #482
2020-05-23 22:41:06 +09:00
Hajime Hoshi
521f9dcac5 graphicsdriver/opengl: Bug fix: deleted a wrong shader program
Updates #482
2020-05-23 22:40:49 +09:00
Hajime Hoshi
1a0d92267b driver: Add shader API and implement it on OpenGL
Updates #482
2020-05-23 22:09:12 +09:00
Hajime Hoshi
14e90a34aa shaderir: Add more builtin functions 2020-05-23 22:01:10 +09:00
Hajime Hoshi
f38ca35608 shaderir: Remove attribute variables from fragment shaders 2020-05-23 19:06:44 +09:00
Hajime Hoshi
125f85effe shaaderir: Use gl_FragColor 2020-05-23 18:18:22 +09:00
Hajime Hoshi
da4d5b1338 shaderir: Add more builtin functions 2020-05-23 18:07:32 +09:00
Hajime Hoshi
7937b302e3 shaderir: Do not use () for the callees 2020-05-23 18:06:50 +09:00
Hajime Hoshi
7b960a2df4 uidriver/glfw: Use the actual window size for the offscreen
On Windows, a specified window size might not match with the
actual window size when the size is too big. In this case, Ebiten
could not render the offscreen well and the upper side was cropped.

To avoid this, use the actual window size for the offscreen.

Fixes #1163
2020-05-22 18:18:38 +09:00
Hajime Hoshi
a338c7180c shaderir: Split vertex shader and fragment shader at Glsl() 2020-05-21 23:58:08 +09:00
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
7ccc29e3c7 uidriver/js: Clean up 2020-05-19 04:08:33 +09:00
Hajime Hoshi
be1a8bddbf uidriver/js: Bug fix: Create goroutine for a function passed to rAF
This is necessary not to cause dead-lock.

Updates #1161
2020-05-19 03:28:20 +09:00
Hajime Hoshi
a6c7c608e4 Update Go version to 1.14.3 for testing 2020-05-19 02:22:21 +09:00
Hajime Hoshi
a1ac574a60 docs: Use 'Deprecated:' annotation
Fixes #1160
2020-05-19 01:50:55 +09:00
Hajime Hoshi
7f2092f964 graphicsdriver/opengl: Enable to bind multiple textures (in theory) 2020-05-17 23:57:42 +09:00
Hajime Hoshi
733c463e26 graphicsdriver/opengl: Treat a texture as a uniform variable 2020-05-17 23:25:49 +09:00
Hajime Hoshi
68ef41e256 graphicsdriver/opengl: Integrate uniform variables 2020-05-17 20:20:29 +09:00
Hajime Hoshi
ff311dd564 graphicsdriver/opengl: Pass uniform values to useProgram 2020-05-17 19:43:01 +09:00
Hajime Hoshi
84e2c6f994 graphicsdriver/opengl/gl: Bug fix: misuse of unsafe.Pointer 2020-05-17 19:42:23 +09:00
Hajime Hoshi
8ab12827c0 graphicsdriver/opengl: Refactoring 2020-05-17 19:01:46 +09:00
Hajime Hoshi
9cc128fb40 graphicsdriver/opengl: Integrate last uniform values 2020-05-17 18:36:33 +09:00
Hajime Hoshi
d12b406e0a graphicsdriver/opengl: Remove unused variables 2020-05-17 18:15:27 +09:00
Hajime Hoshi
29dbad28f9 shaderir: Add new lines 2020-05-17 17:06:21 +09:00
Hajime Hoshi
f4a1f90d92 graphicsdriver/opengl/gl: Reduce reflect usage 2020-05-17 14:28:13 +09:00