Hajime Hoshi
eeb5687b73
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to pointers
...
On second thought, returning pointers is more natural. Handling
nil is a caller's responsibility.
2022-03-24 13:20:36 +09:00
Hajime Hoshi
7bb7e45522
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to interface
...
Converting a nil with a pointer type to an interface type is no longer
a nil-nil interface, and then comparing with nil causes an unexpected
results.
2022-03-24 03:24:58 +09:00
Hajime Hoshi
cd57bccbfc
internal/graphicsdriver: let some functions return an error
...
This is a preparation for the DirectX driver.
Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
35a5c88901
internal/graphics: rename constants
2022-03-12 04:01:48 +09:00
Hajime Hoshi
d4d4b9c070
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: more efficient modulo
2022-03-04 03:47:55 +09:00
Hajime Hoshi
b22309a0e5
internal/graphicsdriver: replace Pixels with ReadPixels
...
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
566957dc1c
internal/graphicsdriver/metal: invert Y at the vertex shader
...
Instead of using a negative height in the viewport, invert the Y direction
at the vertex shader. This is a little more readable as a negative height
is hacky.
This is a preparation for DirectX 12. DirectX 12's coodination system
is very similar to Metal, but doesn't treat a negative height in its
viewport unfortunately.
Updates #1007
2022-02-27 01:53:03 +09:00
divVerent
f2209a0b51
internal/atlas: optimization: send premultiplied alpha from vertex to fragment shader. ( #1996 )
...
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.
Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.
I assume this is a strict improvement, however this may warrant some testing.
Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.
Updates #1772
2022-02-24 02:27:50 +09:00
Hajime Hoshi
8b7273b74a
internal/graphicsdriver/metal: call PresentDrawable only when necessary
2022-02-22 01:37:13 +09:00
Hajime Hoshi
ab1ad2c72f
.github/workflow: add a test to build with the build tag ebitencbackend
2022-02-13 16:57:48 +09:00
Hajime Hoshi
4c6c31e384
all: reorder build tags in an alphabetical order
2022-02-08 15:49:15 +09:00
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Hajime Hoshi
84e53d4c61
internal/graphicsdriver/opengl, internal/uidriver/glfw: treat Win32 API errors correctly
...
The returned errors from syscall.Syscall* and windows.LazyProc.Call come
from GetLastError. The value of GetLastError is not reliable when the
function succeeds.
This change fixes the usages of error values. The error value is now
used only when the API explicitly fails.
2022-01-30 15:54:24 +09:00
Hajime Hoshi
cdf2335f5a
refactoring: better error handlings on Windows
2022-01-23 18:30:40 +09:00
Hajime Hoshi
3b0ce21a56
Revert "internal/graphicsdriver: bug fix: render semi-transparent vectors correctly"
...
This reverts commit 202f642395
.
Reason: TestImageEvenOdd failed
Updates #1933
2022-01-06 03:19:46 +09:00
Hajime Hoshi
202f642395
internal/graphicsdriver: bug fix: render semi-transparent vectors correctly
...
Closes #1933
2022-01-06 03:00:25 +09:00
Hajime Hoshi
6b34ddecfa
internal/graphicsdriver/opengl/gles: add GLES_SILENCE_DEPRECATION to suppress warnings
2022-01-05 01:54:00 +09:00
Hajime Hoshi
1799ed0b28
add a build tag 'ebitencbackend' and internal/cbackend
...
This enables to create a C archive with Ebiten without an actual driver
implementation. This enables Ebiten work on a platform Go doesn't support.
See also Hitsumabushi project: github.com/hajimehoshi/hitsumabushi.
The backend C API is not stable and might change later. Then, the build
tag 'ebitencbackend' is not documented on purpose.
Closes #1900
2021-12-22 21:12:48 +09:00
Hajime Hoshi
00e2b15e2a
shaderir: Bug fix: A wrong argument for fmt.Sprintf
...
This change also improves the result of espcae analysis.
Closes #1863
2021-11-02 00:05:07 +09:00
Hajime Hoshi
7661147e31
internal/graphicsdriver/opengl: Avoid allocations by escaping to heap
2021-10-31 22:34:14 +09:00
Hajime Hoshi
15f62bfeb5
internal/graphicsdriver/opengl: Optimization: Cache texture variable names
2021-10-31 05:40:44 +09:00
Hajime Hoshi
9d51356eef
internal/graphicsdriver/opengl: Optimization
2021-10-31 05:17:23 +09:00
Hajime Hoshi
b74a4a0275
internal/graphicsdriver/opengl: Optimization: Avoid heap allocations
2021-10-31 02:10: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
a082db04fd
internal/jsutil: Optimization: Avoid using empty interface{} conversions
2021-10-30 18:53:21 +09:00
Hajime Hoshi
a826ecb29b
internal/jsutil: Move a function to internal/graphicsdriver/opengl
2021-10-30 18:33:43 +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
60f2c7ace6
internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame (uniform variables)
2021-10-30 00:22:31 +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
d3ac199aa9
internal/graphicsdriver/opengl: Optimization: Avoid fmt.Sprintf
2021-10-29 21:43:40 +09:00
Hajime Hoshi
3c1f8da7f8
internal/graphicsdriver/opengl: Optimization: Avoid interface conversion
2021-10-29 21:35:40 +09:00
Hajime Hoshi
99bfdef416
internal/graphicsdriver/opengl/gl: Support OpenBSD
2021-10-24 15:09:16 +09:00
Hajime Hoshi
ef62f407d1
Clean up build tags
2021-10-24 15:05:36 +09:00
Hajime Hoshi
878831b842
internal/graphicsdriver/opengl: Bug fix: compile error
2021-10-24 14:55:50 +09:00
Hajime Hoshi
a5198275fa
internal/graphicsdriver/opengl/gl: Remove an unused file
2021-10-24 14:46:38 +09:00
Hajime Hoshi
3f5d1762bb
internal/graphicsdriver/opengl: Return an error when initializing OpenGL fails
...
Updates #1838
2021-10-06 00:38:47 +09:00
Hajime Hoshi
58ea710a84
internal/affine: Rename UnsafeElements -> Elements as this is no longer unsafe
2021-09-04 18:08:27 +09:00
Hajime Hoshi
df710a5c63
internal/affine: Change UnsafeElements to take arguments
...
This will enable to suppress unnecessary array allocations in the
future.
Updates #1796
2021-09-04 17:38:30 +09:00
Hajime Hoshi
d1c764640d
internal/glfw, internal/graphicsdriver/opengl/gl: Use the last byte to detect a bool
...
When a C function returns a bool value, only the first byte of a
uintptr value matters. When we want to get a bool value from a C
function, filter this for sefety.
2021-08-25 02:09:55 +09:00
Hajime Hoshi
6c8a7d1079
internal/graphicsdriver/opengl: Bug fix: A location cache map must be reset when a program is deleted
...
Closes #1753
2021-08-15 04:54:20 +09:00
Hajime Hoshi
da08577095
internal/graphicsdriver/opengl: Refactoring
2021-08-14 04:05:18 +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
15ac69b8d5
internal/graphicsdriver/metal: Bug fix: Disable presentsWithTransaction on fullscreen
...
Closes #1745
2021-08-08 17:40:37 +09:00
Hajime Hoshi
8967384dac
internal/graphicsdriver: Bug fix: getting a WebGL2 context might fail even though WebGL2RenderingContext exists
...
Closes #1738
2021-08-01 22:00:47 +09:00
Hajime Hoshi
e4329d0349
internal/driver: Refactoring: Reduce dependencies on affine
2021-07-27 12:19:50 +09:00
Hajime Hoshi
21aa96f9f5
internal/affine: Refactoring: Make ColorM interface
2021-07-27 12:10:22 +09:00