# Gradient calculation inside a conditional block

**URL:** <https://forums.imgtec.com/t/gradient-calculation-inside-a-conditional-block/3404>\
**Category:** PowerVR Insider\
**Created:** [July 15, 2021, 12:15pm UTC](https://forums.imgtec.com/t/gradient-calculation-inside-a-conditional-block/3404 "2021-07-15T12:15:33Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![DiharaWijetunga](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/diharawijetunga/32/320_2.png) [@DiharaWijetunga](https://forums.imgtec.com/u/DiharaWijetunga)\
**Post date:** [July 20, 2021, 11:35am UTC](https://forums.imgtec.com/t/gradient-calculation-inside-a-conditional-block/3404/5 "2021-07-20T11:35:48Z")

</div>

Hi jduchniewicz,

I heard back from the compiler team and they suggested to manually unroll the for-loops to supress the warning.

With GLSL ES 3.0 you could potentially use the textureLod() function to avoid derivatives being computed, however this isn’t available in the GLSL version you are using, so unrolling the for-loops is the only viable solution here.

Best regards,  
Dihara

---

_[View the full topic](https://forums.imgtec.com/t/gradient-calculation-inside-a-conditional-block/3404)._
