문제

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?

도움이 되었습니까?

해결책

Instead of b^t use the HLSL pow function:

return a * (1 - t) + pow(b, t);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top