Jump to content

[SOLVED] Macro redefinition in 2.6.1 shaders


photo

Recommended Posts

Posted

Our shader compilers are complaining about redefinitions of SCALE_UV and DEPTH_RESOLUTION_ZERO when we run on GPUS other than NVIDIA (for which the GLSL compilers are notoriously slack).
I doubt this line will be working the way it was intended in ssr.frag or ssrtgi.frag:

#ifndef SCALE_UV || DEPTH_RESOLUTION_ZERO
Posted

Hi Greg,

To remove this warning you will need slightly patch the #ifndef SCALE_UV || DEPTH_RESOLUTION_ZERO define, so it will look more like this:

#ifndef SCALE_UV || DEPTH_RESOLUTION_ZERO
	#undef SCALE_UV // add this line
	#undef DEPTH_RESOLUTION_ZERO // add this line
	#define SCALE_UV 1.0f
	#define DEPTH_RESOLUTION_ZERO 0
#endif

Thanks for the report!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

  • silent changed the title to [SOLVED] Macro redefinition in 2.6.1 shaders
Posted

Shouldn't the line I quoted be something like

#if !defined(SCALE_UV) || !defined(DEPTH_RESOLUTION_ZERO)

then?

Posted

Greg,

I believe proposed fix should be enough. I've tested on Intel Iris Pro 580 with latest Windows 10 drivers and can't see any warnings in console anymore.

This fix will be also available with an upcoming SDK update.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Yes, doing the #undefs will prevent the warnings. But have you tested that the code actually does what you intend it to? I expect it's ignoring everything after SCALE_UV because an #ifdef can only apply to a single token. And even if _your_ compiler is broken enough to do what you want here, other compilers are likely to behave differently or refuse to compile it.

×
×
  • Create New...