GameMaker (2.3)
Icon

shader_replace_simple

YellowAfterlife

You must be logged in to obtain assets

Description

Links: itch.io page (has demo)

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.

Supported platforms:

  • GMS1: Windows, recent versions (1.4.1804+) only.
  • GMS2: Windows, no version restriction.

Functions:

  • 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.

Notes:

  • 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.

End User Licence Agreement (EULA).

Age Rating: 4+

Versions

GMS2 - Version 1.0.1. Published January 28, 2020

GMS2.3 - Version 1.1.0. Published November 28, 2022

x64 support

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait