We currently only check textures loaded from files when selecting a random texture. Since we purge textures between presets, if a preset uses something like sampler_rand00, no presets will be found, the returned sampler will be null, and we end up creating invalid GLSL. This PR doesn't check the results of GetRandomSampler to make sure they're valid, but does extend GetRandomSampler to include preloaded textures. As this list includes volumetric textures, also filter textures by type. This type defaults to 2D textures and is not otherwise specified elsewhere as I can't find evidence that GetRandomSampler is ever expected to return a 3D texture.
This turned out to be an empty search path in frontend-sdl2, which I'll fix separately. It looks like things work as expected when the texture search path is sane.
We currently only check textures loaded from files when selecting a random texture. Since we purge textures between presets, if a preset uses something like
sampler_rand00
, no presets will be found, the returned sampler will be null, and we end up creating invalid GLSL. This PR doesn't check the results ofGetRandomSampler
to make sure they're valid, but does extendGetRandomSampler
to include preloaded textures. As this list includes volumetric textures, also filter textures by type. This type defaults to 2D textures and is not otherwise specified elsewhere as I can't find evidence thatGetRandomSampler
is ever expected to return a 3D texture.