Search code examples
openglgraphicsobfuscationvulkan

Does any graphics API implement shader obfuscation?


Suppose a company has implemented a novel shader in their application, and they want to make it difficult to steal. However, OpenGL shaders are sent to the GPU as plaintext, and Vulkan accepts an easily decompileable bytecode. Does any graphics API have a non-zero level of shader obfuscation?


Solution

  • Does any graphics API have a non-zero level of shader obfuscation?

    No. And it wouldn't make any sense. Shaders are not nearly as complex as full blown applications. There are pretty hard limits on the complexity a shader may reach to allow for keep interactivity. And any kind of obfuscation layer, deep down, is just a weird instruction set that can be easily deobfuscated using an optimizing compiler/transpiler.

    The general rule is: If it can be executed and produces a readable result*, it can be deobfuscated. It's that simple.

    Also a skilled graphics hacker will be able to look at the final rendering and/or the intermediate results (which are easily obtained using tools like renderdoc) and figure out the gists of what a shader does just from that. Heck, 90% of graphics coding consists of this kind of visual output debugging, when you try to figure out why and how your shader does not what you want and how that mess you see on screen came to happen in the first place. So any experienced graphics hacker will already have built much of the skillset required to reverse engineer a shader just by "looking" at it.


    * if it were not for the constraint of a "readable result" then Homomorphic Encryption might allow for true code obfuscation. But you normally want the output of a shader readable by a human.