Commit Graph

31 Commits

Author SHA1 Message Date
Hajime Hoshi
b1d7a5f595 shaderir/glsl: Enable dFdx for WebGL
With WebGL1, an extension is required for dFdx. On the other hand,
with WebGL2, GLSL ES 300 is required and the extension is forbidden.
This change fixes shaderir/glsl to switch the output depends on the
WebGL version.

This change also adds a new build tag 'ebitenwebgl1' forcing WebGL 1.

Updates #1404
2020-11-21 19:07:54 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
28c638cb5b graphicsdriver/opengl: Unexpose NewShader 2020-08-08 03:12:44 +09:00
Hajime Hoshi
8bac08cbd9 Add internal/shaderir/glsl 2020-08-03 23:27:27 +09:00
Hajime Hoshi
1cfc1964bf graphicsdriver/opengl: Bug fix: fmt arguments 2020-05-25 02:36:45 +09:00
Hajime Hoshi
9bf24ba545 graphicsdriver/opengl: Remove println and add error messages 2020-05-24 23:15:00 +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
f40798b586 graphics: Move const definitions to driver package
Let's keep 'graphics' package as a package for utility functions
or testable functions as much as possible.
2019-06-26 01:05:13 +09:00
Hajime Hoshi
84b1c282ff graphicsdriver/opengl: Refactoring by reduing unused variables 2019-02-17 20:22:03 +09:00
Hajime Hoshi
3aa6eb3a66 graphicsdriver: Optimize shaders for the case of FILTER_SCREEN
Assume a color matrix or color vertex values are not used when
the filter is FILTER_SCREEN.
2019-02-17 19:40:52 +09:00
Hajime Hoshi
cbb0a1da95 graphicsdriver: Refactoring
This improved FPS on mobiles a little bit. Maybe now texture2D is
called only when necessary, but not sure.
2019-02-17 17:37:11 +09:00
Hajime Hoshi
742bbb4ccd graphicsdriver: Simplify clamping color values
For negative values, OpenGL (and Metal) should take care of them
so we don't have to care.
2019-02-17 15:09:05 +09:00
Hajime Hoshi
3ecb00f717 graphicsdriver: Optimize shaders
Simplified the case when a color matrix is not used.
2019-02-16 23:53:22 +09:00
Hajime Hoshi
a8b97c9755 graphicsdriver: Optimize shader (skip color matrix calculation)
Skip multiplying with a color matrix when possible.
2019-02-16 17:33:12 +09:00
Hajime Hoshi
815ed8cda2 graphicsdriver: Optimize shader by removing 'if' 2019-02-16 16:39:02 +09: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
09ca873c41 graphicsdriver/opengl: Use glBindAttribLocation instead of glGetAttribLocation
Attribute variables are often optimized out and it is really hard
to prevent this.

Instead of implicit indices of attribute variables, use explicit
indices by glBindAttribLocation.

Bug: #816
2019-02-16 14:35:53 +09:00
Hajime Hoshi
c2c3579cde graphicsdriver/opengl: Reduce 'if' in shader programs
Fixes #812
2019-02-12 12:46:18 +09:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
12f7d14d91 graphicsdriver/opengl: Check the reserved keyword
Fixes #772
2019-01-08 00:07:49 +09:00
Hajime Hoshi
758b957b01 graphicsdriver/opengl: Bug fix: filter is a preserved keyword (#771) 2019-01-07 11:20:29 +09:00
Hajime Hoshi
f5708cb58a graphicsdriver/opengl: Bug fix: Rename a function not to override an existing function 2018-12-24 17:45:16 +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
7e50ae39c9 graphicsdriver/opengl: Refactoring: Filter as a uniform value 2018-12-24 16:06:25 +09:00
Hajime Hoshi
85df49dc96 graphicsdriver/opengl: Bug fix: variables can be optimized out 2018-12-23 06:04:35 +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
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
ef08e218c8 graphicsdriver/opengl: Refactoring: Remove framebuffer.projectionMatrix 2018-11-17 22:29:04 +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
241716d0e6 Add package graphicsdriver; Move opengl to graphicsdriver/opengl 2018-11-10 22:52:37 +09:00