Difference between revisions of "GLES Shader Testing in Desktop"
m (Where to place the ANGLE DLLs?) |
m (love.graphics.validateShader) |
||
Line 4: | Line 4: | ||
Desktop GPU nowadays (even integrated one) should supports creating OpenGLES context, which means all shaders must be GLSLES/ESSL compatible. We can make LOVE to use OpenGLES context by using environment variable <code>LOVE_GRAPHICS_USE_OPENGLES=1</code>. | Desktop GPU nowadays (even integrated one) should supports creating OpenGLES context, which means all shaders must be GLSLES/ESSL compatible. We can make LOVE to use OpenGLES context by using environment variable <code>LOVE_GRAPHICS_USE_OPENGLES=1</code>. | ||
+ | |||
+ | == 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. | ||
== Requirements == | == Requirements == |
Revision as of 01:23, 31 December 2019
Writing shaders to support mobile devices might be not trivial. You may wondering is there a way to test shader in mobile devices without really using mobile device.
The answer is yes, there's a way.
Desktop GPU nowadays (even integrated one) should supports creating OpenGLES context, which means all shaders must be GLSLES/ESSL compatible. We can make LOVE to use OpenGLES context by using environment variable LOVE_GRAPHICS_USE_OPENGLES=1
.
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.
Requirements
You need GPU which supports OpenGLES context. As previously written, todays desktop GPU should support this.
If your GPU doesn't supports it, you might can use ANGLE. If you're under Windows, you can actually run LOVE using only DirectX 9 capable GPU by using ANGLE (you can grab the DLLs from your Google Chrome or Firefox installation, named libegl.dll
and libopenglesv2.dll
. Just make sure it's 32-bit DLLs if you're using 32-bit version of LOVE (same also for 64-bit) and place it beside love.exe
).
Tell LOVE to use OpenGLES context
Now, we need to tell LOVE to use OpenGLES 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 ...
(this assume 0.10.2 used)
- Linux/macOS:
LOVE_GRAPHICS_USE_OPENGLES=1 love ...
Verify if LOVE uses OpenGLES context by calling love.graphics.getRendererInfo and check if the 1st return value is "OpenGL ES".
Once you got OpenGLES context, you can test your shader code if it works under mobile devices.