2017.11520 GLSL Top: undefined variable uTD2DInfos

Hi,

I was trying to future proof some GLSL code and came across an odd issue.

I wanted to scale a pattern based on buffer resolution, but when I call uTD2DInfos[0].res.zw, the compiler comes back with a ‘undefined variable’ for uTD2DInfos.

Can someone else try this just to confirm that i’m screwing up somehow?

Thanks!

Confirmed - same error here.

As soon as you connect another TOP to your GLSL TOP or GLSL Multi TOP the error should disappear. I don’t think that uTD2DInfos is actually declared until you have an input that’s connected - hence the error you’re seeing.

copy.

so the workaround (or possibly just saner workflow) is to drive the TOP with a constant.

I do that a fair bit for shaders these days - it keeps you from having to set the resolution of the TOP and then a vec2 with the resolution as well. In the BOS example I would create a single constant and then every shader had a select connected to a glsl multi top. It seemed like a sane way to think about keeping it organized. I tried it the other way around with a different set of examples and I didn’t like setting all the resolution pars the other way at all.