Repository navigation
Always declare random texture samplers used by a preset shader - #1071
Open
Coastrnaut wants to merge 1 commit into
Open
Coastrnaut wants to merge 1 commit into
Coastrnaut wants to merge 1 commit into
Conversation
Two cases left a "sampler_randNN" sampler used by a preset shader without a declaration, so HLSL parsing failed and the default shader was used: - If no texture file was available, or none matched the prefix of a name like "rand00_smalltiled", GetRandomTexture() returned an empty descriptor, which declares nothing. A missing regular texture uses the placeholder texture instead, so the shader still compiles. Do the same for random textures. - The texture of a random slot is shared between the warp and composite shader, but the second shader reused the first one's descriptor including its sampler name. If the shaders used different names for the same slot, e.g. "sampler_rand00" and "sampler_rand00_smalltiled", the second name was never declared. Keep the texture, but use the sampler name of the current shader.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two cases left a
sampler_randNNsampler used by a preset shader undeclared, so HLSL parsing failed and the default shader was used:rand00_smalltiled,GetRandomTexture()returned an empty descriptor, which declares nothing. A missing regular texture uses the placeholder texture instead, so the shader still compiles. This does the same for random textures. It matters most for apps that don't ship a texture pack.sampler_rand00andsampler_rand00_smalltiled, the second name was never declared. The texture is still shared, but the descriptor now uses the current shader's sampler name.Results
amandio c, flexi - Op illusions - random1andFlexi - mindblob [where it's at now] gno sth air fetch.TextureManagerneeds a GL context, so this is covered by the preset run.Note: #1042 changes the same lines in
MilkdropShader::LoadTexturesAndCompile()where the slot descriptor is reused, so whichever is merged second needs a small manual merge: create the descriptor with the current shader's sampler name, then applyPrefixSampler().How I tested it
I loaded all 14,536 presets from cream-of-the-crop, en-d, milkdrop-original and projectm-classic one after another (Windows, RTX A6000, GL 3.3 core and GLES contexts), both with the preset folders as texture search path and without any textures, rendered frames with fixed audio and frame times, and recorded shader compile/link results, failed loads, logged shader fallbacks and frame hashes. For the pixel comparison both builds had their random seeds fixed (a local patch only, identical on both sides). The presets this PR fixes are excluded from the pixel comparison, since loading them changes shared state (e.g. the expression evaluator's random generator) for every preset after them.
Retested on current master (2026-11-12)