Hajime Hoshi
6710808cd1
ebiten: compile shaders at NewShader
...
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
81b9f91f86
internal/graphicscommand: compile shaders lazily
...
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.
This change delays compiling shaders until the graphics commands
are actually executed in the main loop.
Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
b5bb576a58
internal/ui: refactoring: unexport ConvertUniforms
2022-03-21 17:05:50 +09:00
Hajime Hoshi
1d9982ee6d
internal/ui: move the dependency on graphicscommand from ebiten to ui
2022-03-20 02:00:44 +09:00
Hajime Hoshi
e78f34aa26
internal/ui: add Image
...
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
99f8e335ee
ebiten: refactoring
2022-02-27 22:21:57 +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
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Hajime Hoshi
610ebbbab5
ebiten: Bug fix: zeroUniformValue panicked with vec2 or other vector/matrix types
2021-10-30 04:30:29 +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
718273c2d7
ebiten: Add a new shader function imageDstRegionOnTexture
...
Updates #1428
2020-12-09 11:36:29 +09:00
Hajime Hoshi
bf515bb594
Update version to v2.0.0-alpha
2020-10-04 04:30:40 +09:00
Hajime Hoshi
88c340f32d
ebiten: Add comments about shaders
2020-09-23 17:13:18 +09:00
Hajime Hoshi
e406ebb1aa
ebiten: Rename imageSrcTextureRegion -> imageSrcRegionOnTexture
...
Updates #1325
2020-09-19 19:36:53 +09:00
Hajime Hoshi
9f7d6962ff
ebiten: Rename shader functions to get colors from textures
...
Updates #1325
2020-09-19 19:01:05 +09:00
Hajime Hoshi
b52de27d49
ebiten: Refactoring shader.go
2020-09-19 17:35:43 +09:00
Hajime Hoshi
806e30926c
ebiten: Remove unreachable code
2020-09-17 20:57:13 +09:00
Hajime Hoshi
abbb929148
ebiten: Bug fix: Wrong uniform type was used
...
This change also includes PanicOnErrorAtImageAt, which panics when
an error is detected at (*Image).At. This function is only for testing.
Fixes #1349
2020-09-17 20:52:32 +09:00
Hajime Hoshi
5e15ebf580
ebiten: Set zero values for lacking uniform variables
...
Fixes #1338
2020-09-13 04:29:32 +09:00
Hajime Hoshi
850303b770
ebiten: Change the type of Uniforms to map[string]interface{}
...
Fixes #1324
2020-09-06 21:02:30 +09:00
Hajime Hoshi
dd7b0d81ae
ebiten: Rename shader builtin functions
...
* imageSrcTextureSourceRegion -> imageSrcTextureRegion
* image[N]TextureAt -> imageSrc[N]At
* image[N]TextureBoundsAt -> imageSrc[N]BoundsAt
Updates #1325
2020-09-01 21:31:50 +09:00
Hajime Hoshi
20a01ed328
ebiten: Error when the entrypoint is missing
...
Fixes #1323
2020-09-01 00:37:16 +09:00
Hajime Hoshi
ed240b8393
ebiten: Add shader builtin functions: imageSrcTextureSourceRegion
...
Updates #1294
2020-08-12 03:34:46 +09:00
Hajime Hoshi
8bc1c8bbd8
ebiten: Rename shader internal variables
2020-08-11 05:18:14 +09:00
Hajime Hoshi
70acb9c1f6
shader: Rename shader bultin functions
...
Renamed image0TextureSize to imageSrcTextureSize, and removed the
other texture-size functions.
As texture-coordinates are always in image0's texture texels,
calculations with texels are always done with image0's texture texels.
Then, other texture-size functions are useless. To avoid confusion,
let's remove the functions and leave the necessary funciton.
2020-08-11 05:02:22 +09:00
Hajime Hoshi
609a3c4e22
ebiten: Bug fix: Fix the texel calculation
...
In shaders, texCoord is always in texture0's texels. Convert them
at imageNTextureAt functions correctly.
Fixes #1290
2020-08-11 04:15:07 +09:00
Hajime Hoshi
69f87d5fd1
ebiten: Add new shader builtin functions: image[N]TextureBoundAt
...
Fixes #1287
2020-08-11 03:24:54 +09:00
Hajime Hoshi
68ca0c634e
ebiten: Rename builtin shader functions
...
* textureDstSize -> imageDstTextureSize
* texture[N]Size -> image[N]TextureSize
* texture[N]At -> image[N]TextureAt
Updates #1287
2020-08-11 02:07:53 +09:00
Hajime Hoshi
a4334c5464
shader: Use arrays at uniform variables
...
Fixes #1274
2020-08-01 17:22:10 +09:00
Hajime Hoshi
ca3fd4eaa4
ebiten: Add texture[ID]Size functions for shaders
...
Fixes #1239
2020-07-26 15:18:01 +09:00
Hajime Hoshi
d08a04a635
ebiten: Refactoring
2020-07-26 15:05:00 +09:00
Hajime Hoshi
d017a1b95e
Swap the order of the dependencies 'buffered and 'mipmap'
2020-07-26 12:15:23 +09:00
Hajime Hoshi
2fb5108bbe
shader: Rename viewportSize to textureDstSize
...
Updates #1239
2020-07-26 00:03:55 +09:00
Hajime Hoshi
1217db3b1e
ebiten: Remove user-defined vertex shaders
...
Fixes #1253
2020-07-20 10:07:55 +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
4bd3bc16ac
shader: Define special variables for textures __t%d
...
This eanbles to define texture0At to texture3At.
Updates #1193
2020-07-18 19:37:50 +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
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
545342262f
examples/shader: Show an image
2020-06-24 01:41:27 +09:00
Hajime Hoshi
b64dc627e9
shader: Add a builtin function viewportSize
2020-06-10 23:07:57 +09:00
Hajime Hoshi
ba36d5a8e9
shader: Reland: Add a predefined uniform variable: __viewportSize
2020-06-07 00:14:09 +09:00
Hajime Hoshi
dde7d00231
shader: Accept an ast directly
...
This is a preparation to modify the AST before passign to Compile.
2020-06-06 23:12:01 +09:00
Hajime Hoshi
fe308f1971
Revert "shader: Add a predefined uniform variable: Internal_ViewportSize"
...
This reverts commit 6f411842f0
.
Reason: Test failures on internal/restorable
2020-06-05 04:36:09 +09:00
Hajime Hoshi
6f411842f0
shader: Add a predefined uniform variable: Internal_ViewportSize
2020-06-05 03:00:43 +09:00
Hajime Hoshi
3dbf4c0a83
shader: Enable to specify entrypoint names
2020-06-05 01:11:39 +09:00
Hajime Hoshi
d0aa18ddb9
Add shader public APIs experimentally
...
Updates #1168
2020-06-04 01:40:50 +09:00