Вопрос

This code will work fine in HLSL ps_2_0 but will not compile in ps_3_0. If I replace the variable with true it will compile. Does anyone know how to do this?

float4 setBoolToFloat(bool input)
{
    float4 output;
    output.xyzw = (input) ? 1.0f : 0.0f;
    return output;
}
Это было полезно?

Решение

Not sure why this worked but when I moved the three lines of code to the location where setBoolToFloat was originally called the error went away. I'm only calling this function in a couple of places so I'm not going to try and spend more time trying to make it work. I'd like to know why it didn't but I'll just live with it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top