floooh / sokol-tools

Command line tools for use with sokol headers
MIT License
219 stars 54 forks source link

Disable joint texture and sampler names? #106

Open julhe opened 11 months ago

julhe commented 11 months ago

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 commented 11 months ago

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: https://github.com/floooh/sokol-tools/blob/b7f3e4729bfd4784af263ab0f04fffbcf8b71351/src/shdc/spirvcross.cc#L250-L260, but I'm not sure how much more code needs to be changed to make it work.