Commit Graph

88 Commits

Author SHA1 Message Date
Hajime Hoshi
4cd98d512e internal/graphicsdriver/opengl: refactoring 2023-03-21 23:06:49 +09:00
Hajime Hoshi
23e90b7e39 internal/graphicsdriver/opengl: refactoring 2023-03-20 22:48:20 +09:00
Hajime Hoshi
8ae6ea5ff6 internal/graphicsdriver/opengl: update comments 2023-03-20 01:42:54 +09:00
divVerent
abece041f4
internal/graphicsdriver/opengl: fix state tracking of glBindTexture / glActiveTexture interaction (#2526)
After switching texture units using glActiveTexture, a different texture may
be bound. For now, let's just force the active texture state variable to zero
so the next glBindTexture call isn't skipped.

Closes #2525
2023-01-07 23:13:14 +09:00
Hajime Hoshi
edf35b02cb internal/graphicsdriver/opengl: record last uniform variables and reset them before swapping buffers
This is basically a revert of 6b4c696b31.
This change resets the last uniform variables before swapping
buffers.

Updates #2517
2023-01-03 03:13:46 +09:00
Hajime Hoshi
6b4c696b31 internal/graphicsdriver/opengl: bug fix: needed always to set uniform variables
Before this fix, setting uniform variables could be skipped when the
values were the same. This caused some issues when a number of drawing
commands were much small than usual (e.g. SetScreenClearedEveryFrame
with false).

This change fixes this by not doing such optimization. Unfortunately
it was impossible to create a minimum reproducible unit test since
we cannot test the final screen framebuffer's states so far.

Closes #2517
2023-01-03 00:43:10 +09:00
Hajime Hoshi
95b4e67c77 internal/graphicsdriver/opengl: reduce context functions 2022-11-18 03:18:30 +09:00
Hajime Hoshi
74d9515345 internal/graphicsdriver/opengl: refactoring: move gl_js to gl/context_js.go
This unifies the OpenGL context interface for all the platforms.
2022-11-17 12:22:46 +09:00
Hajime Hoshi
1ecac8d834 all: allow integer uniform variables for Kage shaders
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
384dee7160 internal/graphicscommand: remove unused uniform variables
This improves possibility of merging graphics commands by reducing
uniform variables.

Updates #2232
2022-11-03 22:45:17 +09:00
Hajime Hoshi
033997d928 internal/graphicsdriver/opengl: remove the built-in shaders
Updates #2369
2022-10-02 21:26:13 +09:00
Hajime Hoshi
35f597e682 internal/graphicsdriver: refactoring: remove FilterScreen
Closes #2282
2022-09-06 19:04:15 +09:00
Hajime Hoshi
63e3c4adea Revert "internal/graphics: remove FilterScreen and use an original Kage program instead"
This reverts these commits

* 3259ef3daf
* 7c55065490
* 5bb70f485e

Reason: iOS crash. Probably we have to prepare a special rendering
pipeline for the final screen.

Closes #2278
2022-08-30 01:56:06 +09:00
Hajime Hoshi
f7c44f086f replace Ebiten with Ebitengine in comments 2022-08-29 11:17:17 +09:00
Hajime Hoshi
5bb70f485e internal/graphics: remove FilterScreen and use an original Kage program instead
Updates #2046
2022-08-26 17:41:29 +09:00
Hajime Hoshi
16ff5c5039 internal/shaderir: change the naming convention: Num -> Count 2022-07-13 02:02:48 +09:00
Hajime Hoshi
afed6a83c6 internal/graphics: change the naming convention: Num -> Count
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
7d0f95e9be internal/graphicsdriver: refactoring: replace Uniform with []float32
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +09:00
Hajime Hoshi
15f62bfeb5 internal/graphicsdriver/opengl: Optimization: Cache texture variable names 2021-10-31 05:40:44 +09:00
Hajime Hoshi
7b7791156c internal/graphicsdriver/opengl: Remove unreached return 2021-10-31 01:38:01 +09:00
Hajime Hoshi
98083ccd0a internal/graphicsdriver/opengl: Avoid heap allocation of a local variable
If a variable is passed to an argument interface{}, the variable might be
allocated on the heap unexpectedly.
2021-10-31 01:11:12 +09:00
Hajime Hoshi
06f4142ca0 internal/driver: Optimization: Replace interface{} with driver.Uniform
Converting a value from/to interface{} can create a value in heap
and this is not efficient.
2021-10-30 02:58:28 +09:00
Hajime Hoshi
1f82bb297c internal/graphicsdriver/opengl: Optimization: Avoid the empty interface 2021-10-30 02:28:57 +09:00
Hajime Hoshi
b4f45edff8 internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame 2021-10-30 00:13:57 +09:00
Hajime Hoshi
76324254c1 internal/graphicsdriver/opengl: Avoid creating objects for debugging 2021-10-30 00:04:03 +09:00
Hajime Hoshi
3c1f8da7f8 internal/graphicsdriver/opengl: Optimization: Avoid interface conversion 2021-10-29 21:35:40 +09:00
Hajime Hoshi
ce8fc39451 internal/graphicsdriver/opengl: Bug fix: the current program must be reset
Updates #1751
2021-08-13 23:44:30 +09:00
Hajime Hoshi
067e3c004d Remove internal/web 2021-06-26 17:04:00 +09:00
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