Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable joint texture and sampler names? #106

Open
julhe opened this issue Oct 3, 2023 · 1 comment
Open

Disable joint texture and sampler names? #106

julhe opened this issue Oct 3, 2023 · 1 comment

Comments

@julhe
Copy link

julhe commented Oct 3, 2023

If I declare a texture as:

//...
uniform texture2D texture0;
uniform sampler smp;
//...

The output for glsl100 and glsls330 is

//...
uniform sampler2D texture0_smp;
//...

This causes me headache, since I'm using Raylib, which expects the main texture to be "texture0".

Is there anyway to disable or avoid this behaviour?

@floooh
Copy link
Owner

floooh commented Oct 4, 2023

Currently there's no way to disable this behaviour, and it would cause problems if the same texture is used with multiple samplers.

The renaming happens here if you want to experiment:

static void to_combined_image_samplers(CompilerGLSL& compiler) {
compiler.build_combined_image_samplers();
// give the combined samplers new names
uint32_t binding = 0;
for (auto& remap: compiler.get_combined_image_samplers()) {
const std::string img_name = compiler.get_name(remap.image_id);
const std::string smp_name = compiler.get_name(remap.sampler_id);
compiler.set_name(remap.combined_id, pystring::join("_", { img_name, smp_name }));
compiler.set_decoration(remap.combined_id, spv::DecorationBinding, binding++);
}
}
, but I'm not sure how much more code needs to be changed to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants