# Can I use the GCMP instruction on a GLSL shader?

**URL:** <https://forums.imgtec.com/t/can-i-use-the-gcmp-instruction-on-a-glsl-shader/2866>\
**Category:** PowerVR Insider\
**Created:** [January 28, 2019, 4:06pm UTC](https://forums.imgtec.com/t/can-i-use-the-gcmp-instruction-on-a-glsl-shader/2866 "2019-01-28T16:06:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreckneck](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dreckneck](https://forums.imgtec.com/u/dreckneck)\
**Post date:** [January 28, 2019, 4:06pm UTC](https://forums.imgtec.com/t/can-i-use-the-gcmp-instruction-on-a-glsl-shader/2866/1 "2019-01-28T16:06:19Z")

</div>

Hi,  
I’m currently working on a GLSL compute shader to convert RAW camera images to sRGB color space.  
I’ve read the [PowerVR Instruction Set Reference](http://cdn.imgtec.com/sdk-documentation/PowerVR+Instruction+Set+Reference.pdf) and I’ve found the GCMP and GEXP instructions but I don’t know how to instruct the compiler to use them from GLSL code.

I’m looking for these instructions mostly because my naïve implementation of gamma compression (based from [here](https://en.wikipedia.org/wiki/SRGB) ) costs about 20 cycles!

Typing pow(x, 1.0 / 2.2) on PVRShaderEditor (and other possible combinations around pow(); ) doesn’t hint the compiler to use the GCMP instruction, for example.

Is there some way to use these instructions, like a OpenGL extension?  
Right now, I wouldn’t mind to have my code to only work under Series 6 GPUs.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![MartonTamas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/martontamas/32/297_2.png) [@MartonTamas](https://forums.imgtec.com/u/MartonTamas)\
**Post date:** [January 28, 2019, 4:22pm UTC](https://forums.imgtec.com/t/can-i-use-the-gcmp-instruction-on-a-glsl-shader/2866/2 "2019-01-28T16:22:18Z")

</div>

Hi,

have you tried the sRGB extensions?  
[https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT\_texture\_sRGB\_decode.txt](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt)  
[https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT\_sRGB.txt](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_sRGB.txt)

These should instruct the compiler to sample the texture using sRGB decoding.  
It might not show up in the offline compiler because I wouldn’t know that you’re sampling an sRGB texture.

bests,  
Marton
