- Home /
Can a CG shader fail to work on hardware?
I've been writing some shaders and trying to find out if I need to write a backup for my CG shader in HLSL. All the references to HLSL in Unity I can find seem to indicate that CG/HLSL are interchangeable and you don't need both, but I was under the impression that some graphics cards only support HLSL/CG was an NVIDIA-centric thing.
Right now I have a working CG shader with a GLSL backup if that fails to compile. Do I need to also create an HLSL backup?
If you're not running the Editor in OpenGL mode, then GLSL won't compile. That's on Windows, anyway.
Answer by Jessy · Jun 25, 2013 at 07:22 PM
No. Unity compiles Cg to assembly. Look at the compiled shader to see this. GLSL is there. Cg isn't.
Your answer
![](https://koobas.hobune.stream/wayback/20220613104852im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can this shader run in unity? 1 Answer
Shardelab/CG shaders not working on iOS 1 Answer
How to prevent shader optimizations? 1 Answer
Grabpass refraction masking 0 Answers
ShaderLab on Unity3d Indie 2 Answers