Commit Graph

7129 Commits

Author SHA1 Message Date
Hajime Hoshi
3e44a20b22 internal/graphicscommand: swap arguments 2022-03-20 00:09:17 +09:00
Hajime Hoshi
8e3576b404 internal/mipmap: remove unused functions 2022-03-19 23:45:15 +09:00
Hajime Hoshi
7c2300b352 internal/graphicscommand: reduce the usages of the graphicsDriver function 2022-03-19 23:03:34 +09:00
Hajime Hoshi
839e442412 .github/workflow: add a test for internal/shader on Windows
This also required to configure Git for Windows.
2022-03-18 21:43:09 +09:00
Hajime Hoshi
58366ce64d internal/glfw: make the file operation atomic
If multiple Ebiten processes start at the same time, the file operation
can cause a race condition. Add a file lock to avoid this.
2022-03-18 20:32:25 +09:00
Hajime Hoshi
f60134bf6a .github/workflow: bug fix 2022-03-18 19:46:03 +09:00
Hajime Hoshi
cdd46912dc .github/workflow: clean up the YAML 2022-03-18 19:45:14 +09:00
Hajime Hoshi
c3b712a54e add Go 1.18 for testing 2022-03-16 03:00:22 +09:00
Hajime Hoshi
2e6bb8c4e2 internal/graphicsdriver/metal: add comments 2022-03-14 22:02:44 +09:00
Hajime Hoshi
82fcff9549 update Oto to v2.1.0-alpha.8 2022-03-14 13:03:50 +09:00
Hajime Hoshi
a617576879 internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
This is a preparation for DirectX / HLSL.

Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
044d41dd2d internal/shaderir: change Op from string to int
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.

Updates #1007
2022-03-13 16:20:04 +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
98e2d86ea3 internal/shaderir/msl: refactoring 2022-03-12 00:18:55 +09:00
Hajime Hoshi
5715539a0f internal/shaderir/glsl, internal/shaderir/msl: refactoring 2022-03-11 15:18:38 +09:00
Hajime Hoshi
e63709a2a5 internal/shaderir/glsl: refactoring 2022-03-11 02:03:15 +09:00
Hajime Hoshi
6f00221051 internal/shaderir/msl: rename the package name
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
5f97bdc1d3 internal/shader: fix typo
Updates #2011
2022-03-10 02:54:32 +09:00
Hajime Hoshi
5614e9d7eb internal/shader: fix misspellings 2022-03-10 02:52:44 +09:00
Hajime Hoshi
880dd0682e internal/shader: bug fix: fix some failing tests 2022-03-10 02:24:29 +09:00
Hajime Hoshi
d3b72d4ef9 internal/shader: add test files
Updates #2011
2022-03-10 01:02:51 +09:00
Hajime Hoshi
de05ede27e internal/shader: bug fix: evaluate the builtin float/int functions in the pre-compile phase correctly
Closes #2011
2022-03-10 00:47:16 +09:00
Hajime Hoshi
47bfd0db9e internal/shaderir/metal: rename to msl
Closes #2010
2022-03-10 00:14:06 +09:00
Bertrand Jung
2453f8f0df
examples/shader: add CRT shader example (#2012)
Closes #2008
2022-03-10 00:02:07 +09:00
Hajime Hoshi
5e5e3c64ac internal/shaderir/metal: remove a redundant case 2022-03-09 02:54:31 +09:00
Hajime Hoshi
15064dbdc1 internal/shaderir/glsl, internal/shaderir/metal: simplify function names 2022-03-09 01:43:36 +09:00
Hajime Hoshi
e4fba8b047 bug fix: compile error with Go 1.16 and older 2022-03-08 00:08:53 +09:00
Hajime Hoshi
86ba7719eb internal/ui: bug fix: use CompareAndSwap 2022-03-07 23:51:10 +09:00
Hajime Hoshi
518e7f7022 update Oto 2022-03-07 23:47:28 +09:00
Hajime Hoshi
6a1c17b06f audio/internal/cbackend: bug fix: use CompareAndSwap 2022-03-07 23:45:42 +09:00
Hajime Hoshi
35f268dfc3 update Oto to v2.1.0-alpha.7 2022-03-06 00:40:44 +09:00
Hajime Hoshi
c37ffecafd internal/graphicsdriver/metal: reorder uniform variables
This might improve memory allocations.

This makes the code more consistent with HLSL's packing rule [1]

[1] https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules
2022-03-05 22:12:08 +09:00
Hajime Hoshi
86698481f6 ebiten: add a comment 2022-03-05 01:58:44 +09:00
Hajime Hoshi
4610505fc5 ebiten: check the current error at Set and ReplacePixels 2022-03-05 01:52:55 +09:00
Hajime Hoshi
9c6b7aaca3 internal/ui: catch the error at At correctly 2022-03-05 01:44:59 +09:00
Hajime Hoshi
df2133186d internal/shaderir: bug fix: test failures 2022-03-04 19:01:58 +09:00
Hajime Hoshi
3c1e64dd67 internal/shaderir/metal: bug fix: define the 'mod' function correctly
Closes #2006
2022-03-04 18:05:44 +09:00
Hajime Hoshi
d4d4b9c070 internal/graphicsdriver/metal, internal/graphicsdriver/opengl: more efficient modulo 2022-03-04 03:47:55 +09:00
Hajime Hoshi
ed22052e5f internal/graphicscommand: add a comment 2022-02-28 00:15:52 +09:00
Hajime Hoshi
dd8900ea48 internal/graphicsdriver: refactoring: choose the graphics driver at this package 2022-02-27 23:51:19 +09:00
Hajime Hoshi
99f8e335ee ebiten: refactoring 2022-02-27 22:21:57 +09:00
Hajime Hoshi
77f765d483 internal/testing: bug fix: considering the case when Y is inverted
Closes #2003
2022-02-27 22:14:32 +09:00
Hajime Hoshi
4ca1220671 internal/graphicscommand: bug fix: compile error, test failures 2022-02-27 20:13:21 +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
1cb7633ff6 internal/ui: bug fix: atomic.Value.Store cannot be called when a differnet type value is already stored 2022-02-27 17:41:19 +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
ea35296be7
ebiten: provide SetScreenFilterEnabled, a way to disable the default screen filter (#1997)
Using FilterNearest rather than filterScreen or FilterLinear speeds up a
Dell E6500 from 23fps->36fps and 27fps->48fps.

Updates #1772
2022-02-24 03:46:27 +09:00
divVerent
99aef33970
examples/blur: fix the blur filter example to be a real box blur. (#2000)
Also add a note that this is not how games should implement a blur if avoidable.

Krita's blur and the original blur:
https://rm.cloudns.org/img/uploaded/29c0418f25bf56b802f746d2f269e215.png
The original image and the new blur (Krita's): 
https://rm.cloudns.org/img/uploaded/bd04828baf6c01fcf7301a6672a4c406.png

Note how Ebiten's blur has almost no vertical component.

Note how after the change it looks basically like Krita's.
2022-02-24 03:15:52 +09:00
divVerent
62229e82a6
Pre-failing test for color interpolation during rendering. (#2001)
Before #1996, this failed with:

image_test.go:1997: At(1, 0): got: {64 64 128 255}, want: {0 128 128 255}

The difference is:

- Before, colors were interpolated in straight-color space:
  - Background: {0 0 255 255}
  - Vertex A: {255 0 0 0}
  - Vertex B: {0 255 0 255}
  - Interpolated: {128 128 0 128}
  - Premultiplied: {64 64 0 128}
  - Onto Background: {64 64 128 255}
- After, colors are interpolated in premultiplied space:
  - Background: {0 0 255 255}
  - Vertex A: {255 0 0 0}
  - Vertex A premultiplied: {0 0 0 0}
  - Vertex B: {0 255 0 255}
  - Vertex B premultiplied: {0 255 0 255}
  - Interpolated: {0 128 0 128}
  - Onto Background: {0 128 128 255}

This DIFFERS from the sample fragment shader, which returns the color as is
(Kage allows vertex color values to be used for arbitrary purposes and
interpolates independently):

- Shader sample:
  - Background: {0 0 255 255}
  - Vertex A: {255 0 0 0}
  - Vertex B: {0 255 0 255}
  - Interpolated: {128 128 0 128}
  - Onto Background: {128 128 128 255}

as the blend function is `GL_ONE` / `GL_ONE_MINUS_SRC_ALPHA`. This shader behavior
is unchanged but has been documented by #1996.
2022-02-24 03:12:33 +09:00