shader_replace_simple for GameMaker
A downloadable extensions for Windows
This extension lets you replace a GMS1 or GMS2 shader while the game is running.
It is primarily intended for use with GMLive, but might be useful on its own too.
- GMS1: Windows, recent versions (1.4.1804+) only.
- GMS2: Windows, no version restriction.
- GMS2.3: Windows, no version restriction.
- shader_replace_simple(shader_index, vertex_hlsl_code, pixel_hlsl_code)->error_string
Attempts to compile a shader from vertex+fragment strings and replace the given game shader by it. Returns "" if successful or error message otherwise.
- Shader must be in GM-compliant HLSL format
As per above, HLSL9 for GMS1 or HLSL11 for GMS2. Internally, GM always compiles your shaders to HLSL when targeting Windows.
The easiest way to do so is to pass your GLSL shader through GM's own HLSLCompiler.exe (see demo project for arguments). Or, if you want to get advanced, use Google's ANGLE compiler to assemble your own converter.
For convenience, I include a "execute_program_pipe" extension that can execute a program and return the output from it, allowing this to be done in-game.
- Layout must match between old and new shader
That is, must have the same number/order of attributes/variyings/uniforms.
If the layout doesn't match, result is undefined.
Demo: Allows you to edit and reload a shader on click.
In order to download this extensions you must purchase it at or above the minimum price of $9.95 USD. You will get access to the following files:
- A GMS2.3-specific versionMar 09, 2021