1
votes

I have the following pixel shader function in HLSL:

float GammaCorrectA(float3 color, float alpha) {
    float a = 1 - sqrt(1 - alpha);
    float b = sqrt(alpha);
    float t = (color.x + color.y + color.z) / 3;
    return a * (1 - t) + b^t;
}

This is being called thusly:

float screen = GammaCorrectA(strokeColor, alpha);

strokeColor and alpha are both floats.

This is resulting in the following error on the 'return' line:

error X3082: int or unsigned int type required.

I am compiling with Shader Model 4 Level 9_3, with optimizations disabled and debugging information enabled.

I can't seem to find this error documented on MSDN, or anywhere.

Broadly, can anybody point me to where this error is documented? I would like to understand what's going on here. More specifically, can anybody spot my error?

1

1 Answers

2
votes

Instead of b^t use the HLSL pow function:

return a * (1 - t) + pow(b, t);