Commit Graph

2399 Commits

Author SHA1 Message Date
Hajime Hoshi
6003d85f75 shaderir: Remove some builtin functions
'degrees' and 'radians' are not defined in Metal.
2020-08-05 02:06:28 +09:00
Hajime Hoshi
ffee5eb6b8 shaderir/glsl: Fix the panic messages 2020-08-05 01:50:41 +09:00
Hajime Hoshi
c22ec580bc shaderir: Remove bultin functions for bvec 2020-08-05 01:41:06 +09:00
Hajime Hoshi
fb59901609 graphicscommand: Bug fix: build error 2020-08-04 01:08:29 +09:00
Hajime Hoshi
cf2f7009aa graphicscommand: Allow shader tests on browsers
Updates #1166
2020-08-04 00:59:27 +09:00
Hajime Hoshi
8bac08cbd9 Add internal/shaderir/glsl 2020-08-03 23:27:27 +09:00
Hajime Hoshi
79e252c158 shaderir: Refactoring 2020-08-02 00:09:12 +09:00
Hajime Hoshi
fa60e31997 shaderir: Bug fix: Pass tests 2020-08-01 21:22:47 +09:00
Hajime Hoshi
4bd01fd038 graphicsdriver/opengl: Implement shaders for browsers
Fixes #1166
2020-08-01 20:27:46 +09:00
Hajime Hoshi
bab05874cd shaderir: Remove unnecessary empty lines 2020-08-01 19:04:10 +09:00
Hajime Hoshi
38dcadb233 graphicsdriver/opengl: Add program error info to the error 2020-08-01 18:58:05 +09:00
Hajime Hoshi
a4334c5464 shader: Use arrays at uniform variables
Fixes #1274
2020-08-01 17:22:10 +09:00
Hajime Hoshi
2b4cf7fd17 shader: Remove unnecessary Println 2020-08-01 16:47:17 +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
ac16564e95 shaderir: Add indexing
Fixes #1235
2020-07-29 23:49:57 +09:00
Hajime Hoshi
a0549820fd shadeir: Add array composite literals
Updates #1235
2020-07-29 23:49:54 +09:00
Hajime Hoshi
004b279e4f shader: Add array initialization
Updates #1235
2020-07-29 22:43:51 +09:00
Hajime Hoshi
62fbac2290 mipmap: Bug fix: HasHighPrecisionFloat cannot be called before the main loop
Instead, use the common number for the too-big scale.

Fixes #1270
2020-07-29 12:46:09 +09:00
Hajime Hoshi
2dc6cbe51a shader: Make parseType return a boolean value indicating ok 2020-07-29 12:02:07 +09:00
Hajime Hoshi
d9c54bc0d0 shader: Implement an array variable
Updates #1235
2020-07-29 02:27:05 +09:00
Hajime Hoshi
da98e67345 mipmap: Bug fix: Wrong level calculation when the indices are empty
Fixes #1269
2020-07-28 14:02:51 +09:00
Hajime Hoshi
a43efb66b2 shaderir: Bug fix: Function prototypes were required for GLSL
Fixes #1267
2020-07-28 00:04:03 +09:00
Hajime Hoshi
a0197d4c2f graphicsdriver/opengl: Bug fix: Build error on Android
Fixes #1266
2020-07-26 17:01:11 +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
637afe6d67 mipmap: Skip mipmap calculation if possible
If we know we can skip mipmap calculation from GeoM, let's skip it.

Updates #1265
2020-07-26 12:25:03 +09:00
Hajime Hoshi
d017a1b95e Swap the order of the dependencies 'buffered and 'mipmap' 2020-07-26 12:15:23 +09:00
Hajime Hoshi
71aec36ef3 graphics: Update comments 2020-07-26 01:11:11 +09:00
Hajime Hoshi
eb056690aa graphicsdriver/metal: Update the minimum macOS version to 10.12 for Go 1.15 2020-07-25 04:18:26 +09:00
Hajime Hoshi
75d34ab585
graphicsdriver/opengl: Forbids PBO on Raspberry Pi 4 (#1261)
Fixes #1208
2020-07-23 19:15:34 +09:00
Hajime Hoshi
bb1d08a681 shader: Remove the comments 2020-07-20 11:14:54 +09:00
Hajime Hoshi
1217db3b1e ebiten: Remove user-defined vertex shaders
Fixes #1253
2020-07-20 10:07:55 +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
c8fa937a0a shaderir: Format 2020-07-20 02:12:31 +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
5dd073fcbb restorable, graphicscommand: Remove uniform variables 2020-07-19 01:55:01 +09:00
Hajime Hoshi
fe79bb27af graphicscommand: Refactoring 2020-07-18 23:25:16 +09:00
Hajime Hoshi
6ccb614b08 graphicsdriver/metal: Implement CompositeModeMultiply
Updates #410
2020-07-18 21:51:57 +09:00
nanoslayer
72babcd420
ebiten: Add CompositeModeMultiply (#1251)
This change adds a new composite mode called `CompositeModeMultiply`,
which multiplies the source color with the destination color.

This is tested on Linux and Windows only.

Fixes #410
2020-07-18 21:37:17 +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
52773e1d12 mipmap: Bug fix: Crash at DrawTrianglesWithShader 2020-07-16 23:02:33 +09:00
Hajime Hoshi
c4c9771b78 mipmap: Bug fix: Infinite loop at (*Mipmap).mipmapLevelFromDistance 2020-07-16 03:00:10 +09:00
Hajime Hoshi
bf56492d2d mipmap: Bug fix: mipmapLevelFromDistance must be called from the source 2020-07-16 02:43:08 +09:00
Hajime Hoshi
f927e09f56 mipmap: Unify DrawImage and DrawTriangles
Fixes #909
2020-07-16 02:31:17 +09:00
Hajime Hoshi
7f2be42410 mipmap: Use mipmap for DrawTriangles
Updates #909
2020-07-16 02:31:11 +09:00
Hajime Hoshi
275dd438fa mipmap: Refactoring: Do not use mipmap when the image is volatile 2020-07-16 01:19:57 +09:00
Hajime Hoshi
04b26adf3d mipmap: Refactoring 2020-07-16 00:52:41 +09:00
Hajime Hoshi
38d3811f13 Revert "mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image"
This reverts commit 48b192dbe9.
2020-07-16 00:51:38 +09:00
Hajime Hoshi
48b192dbe9 mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image 2020-07-15 22:59:27 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
ab95c9014d buffered, shareable: Bug fix: Check source images correctly 2020-07-15 03:37:35 +09:00
Hajime Hoshi
f8956941b7 mipmap: Do not allocate independent mipmaps for each sub-image
Fixes #1247
2020-07-15 02:23:45 +09:00
Hajime Hoshi
2a9fd5ef13 mipmap: Avoid using the vertex backend when GopherJS is not used
The backend logic is especially for GopherJS. As the backend logic
tends to consume a lot of memory, let's avoid this when possible.

Updates #797
2020-07-14 12:16:37 +09:00
Hajime Hoshi
385ff8efdf shader: Bug fix: Wrong local variable names at for-loop
Fixes #1245
2020-07-13 22:49:15 +09:00
Hajime Hoshi
0e6f4fccc0 shader: Add break/continue 2020-07-13 02:59:11 +09:00
Hajime Hoshi
c02213e900 shader: Use the loop counters in the test 2020-07-13 01:48:00 +09:00
Hajime Hoshi
2ca551cdc6 shader: Implement 'for' statement
Fixes #1230
2020-07-13 01:44:05 +09:00
Hajime Hoshi
e15ee77e8e shader: Implement operators ++ and -- 2020-07-12 23:07:30 +09:00
Hajime Hoshi
f95ca46c99 shaderir: Add Stmt.ForVarType and use constant.Value
Updates #1230
2020-07-12 22:31:12 +09:00
Hajime Hoshi
291d69500b shaderir: Add Stmt.ForVarIndex
Updates #1230
2020-07-12 21:55:07 +09:00
Hajime Hoshi
4a8bd688a9 shader: Bug fix: index out of range at defining a var 2020-07-12 18:40:01 +09:00
Hajime Hoshi
dcb693460e shader: Refactoring: Let parseDecl return statements 2020-07-12 15:51:06 +09:00
Hajime Hoshi
202bb34bac shaderir: Add builtin funcs dfdx, dfdy, fwidth
Fixes #1242
2020-07-11 21:50:10 +09:00
Hajime Hoshi
aecd29325e shaderir: Bug fix: Wrong function names for some bulitin funcs 2020-07-11 21:46:21 +09:00
Hajime Hoshi
776de77744 shaderir: Remove and rename some builtin functions
Apparently matrixCompMult and outerProduct are not portable.

We adopted the naming rule foobar instead of fooBar.
2020-07-11 21:43:24 +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
914eb093f8 shader: Bug fix: Compile error on the test 2020-07-08 01:38:27 +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
98ae0826c7 shaderir: Bug fix: Early-returns in the entry points didn't work
Fixes #1238
2020-07-05 17:57:57 +09:00
Hajime Hoshi
f4a72165e4 shader: Bug fix: Comparison with constants didn't work 2020-07-05 17:33:10 +09:00
Hajime Hoshi
3eaa7dd0e1 uidriver/glfw: Set No-API when creating a hidden window first
GLFW tries to create an OpenGL context by default when creating a
window. This is not necessary when OpenGL is not used. This is an
optimization by skipping to create an OpenGL context if possible.
2020-07-05 15:01:06 +09:00
Hajime Hoshi
8369a4cc15 shader: Bug fix: Wrong out-params when returning is in a block 2020-07-05 04:30:14 +09:00
Hajime Hoshi
ce4732a7dc shader: Treat if's 'init' part correctly
Updates #1230
2020-07-05 04:08:57 +09:00
Hajime Hoshi
f3651e23e4 shader: Bug fix: Some oeprators should be evaluated as bool 2020-07-05 03:29:34 +09:00
Hajime Hoshi
fb63df48ae shader: Better error message 2020-07-05 03:23:56 +09:00
Hajime Hoshi
380b7382ac shader: Add 'if'
Updates #1230
2020-07-05 02:33:49 +09:00
Hajime Hoshi
3ca6e41194 shader: Refactoring: Add statements later 2020-07-05 00:33:54 +09:00
Hajime Hoshi
b00666df22 shader: Refactoring: Split files 2020-07-04 23:47:23 +09:00
Hajime Hoshi
49b389c8b1 shader: Add tests for invalid binary expressions 2020-07-04 20:23:37 +09:00
Hajime Hoshi
f362455387 shader: Bug fix: correct type deduction from 'mat2*vec2'
Fixes #1236
2020-07-04 20:08:01 +09:00
Hajime Hoshi
6c33ed107f affine: Add more tests for (*ColorM).Invert 2020-07-04 01:58:37 +09:00
Hajime Hoshi
2e8e35750d affine: Refactoring 2020-07-04 01:36:48 +09:00
Gabriel Ochsenhofer
94b5747806
affine: Add functions to invert ColorM (#1233)
Fixes #548
2020-07-04 01:23:47 +09:00
Hajime Hoshi
d08f57e610 uidriver/glfw: Bug fix: Skip some special 'joysticks'
Apparently, there are some special devices that are recognized as
joysticks by GLFW, even though they are not. Such devices can have
too many 'buttons'. Skip them as a tentative solution.

Updates #1173
2020-07-03 22:58:49 +09:00
Hajime Hoshi
b7a1e85788 uidriver/glfw: Remove unused logics 2020-07-03 22:24:30 +09:00
Hajime Hoshi
02ef92f4cd ebiten: Remove copying pixels from ReplacePixels and copyImage (renamed to imageToBytes)
This optimization utilizes the fact that copying happens in the
'shareable' package to add paddings.

Updates #1222
2020-07-03 03:01:48 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
4c640d2500 buffered, restorable: Remove copying pixels
Instead, the callers (ebiten.NewImageFromImage and
(*ebiten.Image).ReplacePixels) have responsibility to copy the
pixels now. This change should reduce unnecessary copying pixels.

Updates #1222
2020-07-01 02:56:40 +09:00
Hajime Hoshi
f636cdf5f7 testing: Bug fix: Wrong uniform variables 2020-06-30 01:49:40 +09:00
Hajime Hoshi
8c5f8c03b7 buffered: Refactoring 2020-06-30 01:16:50 +09:00
Hajime Hoshi
999b726b72 shareable: Bug fix: The first image's region in the uniform vriables was ignored 2020-06-30 00:50:40 +09:00
Hajime Hoshi
1fe2f47701 graphicscommand: Remove the source-region parts from the uniform variables 2020-06-30 00:44:05 +09:00
Hajime Hoshi
780465b702 ebitenutil: Cache ColorM and reuse them at DrawRect
Fixes #1221
2020-06-29 22:35:28 +09:00
Hajime Hoshi
09322dfdc8 buffered: Avoid creating func objects whenever possible
Fixes #1220
2020-06-29 21:50:32 +09:00
Hajime Hoshi
dea3785750 shareable, restorable, graphicscommand: Remove making arrays at DrawTriangles
Updates #1220
2020-06-29 13:37:37 +09:00