Difference between revisions of "GLES Shader Testing in Desktop"
m (AMD notice.) |
m (→Using ANGLE in Windows) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | Writing shaders to support mobile devices might be not trivial. You may wondering is | + | Writing shaders to support mobile devices might be not trivial. You may be wondering if there is a way to test shaders on mobile devices without really using mobile device. |
The answer is yes, there's a way. | The answer is yes, there's a way. | ||
− | + | GPUs nowadays (even integrated ones) should support creating OpenGL ES context, which means all shaders must be GLSL ES/ESSL compatible. We can make LOVE use OpenGL ES context by using the environment variable <code>LOVE_GRAPHICS_USE_OPENGLES=1</code>. | |
Note that this guide is mostly Windows oriented. For other desktop platforms, please adapt accordingly! | Note that this guide is mostly Windows oriented. For other desktop platforms, please adapt accordingly! | ||
Line 13: | Line 13: | ||
== Requirements == | == Requirements == | ||
− | You need GPU which supports OpenGL ES context or ANGLE. As previously written, | + | You need a GPU which supports OpenGL ES context or ANGLE. As previously written, today's GPUs should support this, thus ANGLE is normally unnecessary. |
== Tell LOVE to use OpenGL ES context == | == Tell LOVE to use OpenGL ES context == | ||
− | FIXME: AMD drivers expose OpenGL ES context under EGL (and it's very hidden) which is not compatible with LOVE SDL build. For AMD GPUs in Windows, proceed below directly. | + | FIXME: AMD drivers expose OpenGL ES context under EGL (and it's very hidden) which is not compatible with LOVE SDL build. For AMD GPUs in Windows, proceed below on using ANGLE directly. |
Now, we need to tell LOVE to use OpenGL ES context. You need to set this environment variable before starting LOVE. It can be set using Command Prompt/Terminal and launching LOVE from same Terminal, or from Windows, from Advanced System Settings. | Now, we need to tell LOVE to use OpenGL ES context. You need to set this environment variable before starting LOVE. It can be set using Command Prompt/Terminal and launching LOVE from same Terminal, or from Windows, from Advanced System Settings. | ||
Line 27: | Line 27: | ||
Verify if LOVE uses OpenGL ES context by checking the 1st return value of [[love.graphics.getRendererInfo]] which should be "OpenGL ES". | Verify if LOVE uses OpenGL ES context by checking the 1st return value of [[love.graphics.getRendererInfo]] which should be "OpenGL ES". | ||
− | Once you got OpenGL ES context, you can test your shader code | + | Once you've got OpenGL ES context, you can test if your shader code works on mobile devices. Otherwise, if you're on Windows, proceed below. |
== Using ANGLE in Windows == | == Using ANGLE in Windows == | ||
− | [https://chromium.googlesource.com/angle/angle ANGLE] is an implementation of OpenGL ES 2.0 and 3.0 on top of other rendering backends. In Windows, it will run OpenGL ES using Direct3D 11 or Direct3D 9. If your GPU doesn't support OpenGL ES context or if you want to force ANGLE, you can copy '''libEGL.dll''' and '''libGLESv2.dll''' from one of these | + | {{notice|Using ANGLE with AMD GPU in Windows requires LÖVE [[11.5]] or later.}} |
+ | |||
+ | [https://chromium.googlesource.com/angle/angle ANGLE] is an implementation of OpenGL ES 2.0 and 3.0 on top of other rendering backends. In Windows, it will run OpenGL ES using Direct3D 11 or Direct3D 9. If your GPU doesn't support OpenGL ES context or if you want to force ANGLE, you can copy '''libEGL.dll''' and '''libGLESv2.dll''' from [https://github.com/MikuAuahDark/angle-winbuild here], or on one of these applications: | ||
* Google Chrome | * Google Chrome | ||
Line 40: | Line 42: | ||
* osu! stable (32-bit DLL) | * osu! stable (32-bit DLL) | ||
− | |||
− | |||
Note: Using Firefox's DLLs doesn't work because it links with Firefox-specific DLLs and copying all the dependent DLLs can be troublesome. | Note: Using Firefox's DLLs doesn't work because it links with Firefox-specific DLLs and copying all the dependent DLLs can be troublesome. | ||
− | One thing for sure is '''make sure the | + | One thing for sure is '''make sure the bit count of the DLL matches''', i.e. 64-bit Chrome has 64-bit DLLs and can only be used on 64-bit LOVE. |
Next, set the environment <code>LOVE_GRAPHICS_USE_OPENGLES=1</code> and <code>SDL_OPENGL_ES_DRIVER=1</code> then launch LOVE. To confirm you're using ANGLE backend, check the 2nd return value of [[love.graphics.getRendererInfo]] which should contain "ANGLE" (all uppercase). | Next, set the environment <code>LOVE_GRAPHICS_USE_OPENGLES=1</code> and <code>SDL_OPENGL_ES_DRIVER=1</code> then launch LOVE. To confirm you're using ANGLE backend, check the 2nd return value of [[love.graphics.getRendererInfo]] which should contain "ANGLE" (all uppercase). |
Latest revision as of 03:13, 16 February 2024
Writing shaders to support mobile devices might be not trivial. You may be wondering if there is a way to test shaders on mobile devices without really using mobile device.
The answer is yes, there's a way.
GPUs nowadays (even integrated ones) should support creating OpenGL ES context, which means all shaders must be GLSL ES/ESSL compatible. We can make LOVE use OpenGL ES context by using the environment variable LOVE_GRAPHICS_USE_OPENGLES=1
.
Note that this guide is mostly Windows oriented. For other desktop platforms, please adapt accordingly!
Contents
love.graphics.validateShader
Since 11.0, there's love.graphics.validateShader which can be used to validate both GLSL and ESSL shader code. Note that it only validates, it doesn't run your shader code. If you really want to run your game under GLES context, proceed below!
Requirements
You need a GPU which supports OpenGL ES context or ANGLE. As previously written, today's GPUs should support this, thus ANGLE is normally unnecessary.
Tell LOVE to use OpenGL ES context
FIXME: AMD drivers expose OpenGL ES context under EGL (and it's very hidden) which is not compatible with LOVE SDL build. For AMD GPUs in Windows, proceed below on using ANGLE directly.
Now, we need to tell LOVE to use OpenGL ES context. You need to set this environment variable before starting LOVE. It can be set using Command Prompt/Terminal and launching LOVE from same Terminal, or from Windows, from Advanced System Settings.
- Windows:
set LOVE_GRAPHICS_USE_OPENGLES=1
thenlovec ...
. 0.10.2 or later is assumed.
- Linux/macOS:
LOVE_GRAPHICS_USE_OPENGLES=1 love ...
Verify if LOVE uses OpenGL ES context by checking the 1st return value of love.graphics.getRendererInfo which should be "OpenGL ES".
Once you've got OpenGL ES context, you can test if your shader code works on mobile devices. Otherwise, if you're on Windows, proceed below.
Using ANGLE in Windows
Using ANGLE with AMD GPU in Windows requires LÖVE 11.5 or later. |
ANGLE is an implementation of OpenGL ES 2.0 and 3.0 on top of other rendering backends. In Windows, it will run OpenGL ES using Direct3D 11 or Direct3D 9. If your GPU doesn't support OpenGL ES context or if you want to force ANGLE, you can copy libEGL.dll and libGLESv2.dll from here, or on one of these applications:
- Google Chrome
- Microsoft Edge Chromium
- Visual Studio Code
- osu! stable (32-bit DLL)
Note: Using Firefox's DLLs doesn't work because it links with Firefox-specific DLLs and copying all the dependent DLLs can be troublesome.
One thing for sure is make sure the bit count of the DLL matches, i.e. 64-bit Chrome has 64-bit DLLs and can only be used on 64-bit LOVE.
Next, set the environment LOVE_GRAPHICS_USE_OPENGLES=1
and SDL_OPENGL_ES_DRIVER=1
then launch LOVE. To confirm you're using ANGLE backend, check the 2nd return value of love.graphics.getRendererInfo which should contain "ANGLE" (all uppercase).