Commit Graph

58 Commits

Author SHA1 Message Date
Hajime Hoshi
b8694aa66a internal/graphicsdriver/opengl: Optimization 2021-01-26 00:45:17 +09:00
Hajime Hoshi
912e13071f graphicsdriver/opengl: Refactoring 2020-11-29 23:04:00 +09:00
Hajime Hoshi
526a92256b graphicsdriver/opengl: Refactoring: Remove shaderType 2020-11-21 23:33:25 +09:00
Hajime Hoshi
8dba7b7722 graphicsdriver/opengl: Refactoring: Remove dataType 2020-11-21 23:14:43 +09:00
Hajime Hoshi
9c014a281a graphicsdriver/opengl: Refactoring 2020-11-21 23:00:57 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
3dab49fc39 graphicsdriver/opengl: Better error message 2020-09-17 20:35:57 +09:00
Hajime Hoshi
073fd329f2 graphicsdriver/opengl: Enable to pass any type of uniform variables
Updates #1274
2020-08-01 05:11:24 +09:00
Hajime Hoshi
a50ef46ed0 graphicsdriver/opengl: Do not allow nil value for uniform variables 2020-08-01 02:01:51 +09:00
Hajime Hoshi
da5642cd0e graphicsdriver/opengl: Add type checks of uniform variables 2020-08-01 02:01:51 +09:00
Hajime Hoshi
29d53edf1d graphicsdriver/opengl: Bug fix: Rename the attribute variables along with custom shaders 2020-07-20 04:06:35 +09:00
Hajime Hoshi
5506491c03 graphicsdriver/opengl: Bug fix: Binding the same texture multiple times did not work
Updates #1193
2020-07-19 04:34:53 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
4021c24534 shader: Separate uniform variables and texture variabls
Textures cannot be treated as a regular variable, then they should
be treated differently from other uniform variables.

Add a new function texture0At replacing texture2D.

Updates #1239
2020-07-08 01:12:07 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
2a63512c6e driver: Add AddressUnsafe
This skips the source-region check and reduces 'if' branches from
shader programs.

AddressUnsafe is internal only so far. We might expose this value
later.

Updates #1210
2020-06-25 01:00:38 +09:00
Hajime Hoshi
f39c591252 shader: Enable more Go syntax 2020-06-11 01:13:03 +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
85730b433e graphicsdriver: Bug fix: Pass texture natives as uniform variables correctly 2020-05-25 02:31:54 +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
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
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
eabe4152a7 graphicsdriver/opengl: Rename Driver -> Graphics 2020-04-04 17:23:38 +09:00
Hajime Hoshi
85cbc7e56b Enable to compile Ebiten on js/wasm with Go 1.14
Fixes #1024
2019-12-19 00:45:53 +09:00
Hajime Hoshi
52f6be2639 graphicsdriver/opengl: Fix suspicious GL function calls
Before this change, the pixel object buffer is unbound just after
getting a pointer by glMapBuffer. This seemed suspicious.

This change fixes to do all pixel manipulations once between
glMapBuffer and glUnmapBuffer without changing a bound buffer.

This might fix a wrong rendering on some machines, but I am not
sure.

Updates #993
2019-11-20 02:41:34 +09:00
Hajime Hoshi
acc933b7c3 graphicsdriver/opengl: Experimental PBO implementation
This change is an experimental implementation to use Pixel Buffer
Objects. This reduces calls of glTexSubImage2D.

This works only on desktops. Unfortunately WebGL does not have
this features. Mobiles can have PBO as of OpenGL ES 3.

Updates #976
2019-11-17 05:01:43 +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
Acid147
21abd85a63 Small cleanup (#877)
* Remove unused variables and constants
* Remove redundant return statement
* Change flock.NewFlock to flock.New
2019-05-26 18:06:43 +09:00
Hajime Hoshi
3d8a45a770 graphicsdriver/opengl: Refactoring 2019-02-17 14:30:32 +09:00
Hajime Hoshi
d927241223 graphicsdriver/opengl: Remove unnecessary function calls 2019-02-17 11:44:50 +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
1f46299870 graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter 2019-02-16 15:14:48 +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
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
c2c3579cde graphicsdriver/opengl: Reduce 'if' in shader programs
Fixes #812
2019-02-12 12:46:18 +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
454a7d8ef9 graphicsdriver/opengl: Bug fix: misspelling on variables
Fixes #764
2018-12-26 03:03:06 +09:00
Hajime Hoshi
de788603d6 graphicsdriver/opengl: Remove init order dependency 2018-12-25 23:58:01 +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
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