How to query GPU Dependent stats in TD? (max # samplers, max width/height, etc)

I’m trying to make some of my glsl shader code as dynamic as possible to work for as many different platforms as possible. One of the areas where I run into trouble is places where I need to replicate a glsl TOP or shader, to get around a shader limit of some kind.

For example, 32 texture samplers is a limit for me, but it’s not always the limit for others gpus.
How can I query stuff like this in TD or a shader somehow?

Things I would like to be able to query:

  • Maximum number of samplers (for me it’s 32)
  • Maximum texture size (for me it’s 32,768)

Looking here:
https://www.khronos.org/opengl/wiki/Built-in_Variable_(GLSL)#Fragment_shader_inputs
image

I see some variables that seem somewhat relevant, but none of them match up entirely or at all to the two items I listed above. I see maxFragmentInputComponents, which does sound like max inputs * 4 - but is it reliable? Are there better ways?

Thanks!