Material reloading/unloading bug on new pipeline
spiralhalo opened this issue ยท 1 comments
Material definitions (as located in <namespace>/materials/<material name>.json
) fail to reload or unload after being loaded once.
How to reproduce:
Method 1:
- Load any world (for observation purpose, it seems to give the same result if resource pack changes happen in title screen).
- Load any resourcepack with custom material shader.
- Unload the resourcepack.
- The world will fail to render with an error message:
OpenGL debug message, id=1282, source=API, type=ERROR, severity=HIGH, message=GL_INVALID_OPERATION error generated. No active program.
Method 2:
- Load any world.
- Load any resourcepack with custom material definition.
- Place any block affected by the custom material.
- Change the material definition. For example: change the fragmentSource into "canvas:shaders/material/default.frag".
- Reload the resources (F3+T / rearrange resource packs / remove then re-add the resource pack).
- Notice lack of change in the block with custom material.
Tested on:
- 1.0.1075
- 1.0.1076
- 1.0.1081-snapshot
Notes:
- Only unloading/reloading part is buggy. New material definitions can be loaded just fine, they simply won't unload until the client is restarted.
- Material maps and custom shaders seem to reload/unload properly. Only material definitions are affected.
- Method 2 has been tested with and without "layers" in the material definition.
Fixed in latest build. Note the log will still show "file not found" warnings until restart but the world renders correctly. Removing all traces of shaders removed at run time would probably do some damage to performance and add unwanted complexity to render state management, so instead the shader source processor stubs them out when the source is missing.