SPIR-V and ps_2_0, ps_2_x shader profiles


Could a fragment shader as represented by SPIR-V be compatible with ps_2_0/ps_2_x shader profiles?

ps_2_0/ps_2_x shader profiles target DirectX 9 -era hardware.


In other terms, could a ps_2_0/ps_2_x fragment shader (equivalent to GLSL 1.20 or GLES 2.0’s ESSL) be correctly represented by a SPIR-V intermediate representation?

The SPIR-V representation would then be translated to a native ps_2_0 shader and executed on the related GPU.

I don’t see why not. You’ll have to build a translation layer between SPIR-V and the 2.0 pixel shaders. And that layer will need to make sure that the input SPIR-V doesn’t have constructs that PS 2.0 can’t handle.