mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
VideoCommon: Fix D3D shader warning X3571 (negative base for pow())
Add abs() to fix "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them".
This commit is contained in:
parent
7cc89f5642
commit
0fac1d6e87
@ -749,8 +749,8 @@ static void WriteXFBEncoder(ShaderCode& code, APIType api_type, const EFBCopyPar
|
|||||||
WriteSampleColor(code, "rgb", "color1", 1, api_type, params);
|
WriteSampleColor(code, "rgb", "color1", 1, api_type, params);
|
||||||
|
|
||||||
// Gamma is only applied to XFB copies.
|
// Gamma is only applied to XFB copies.
|
||||||
code.Write(" color0 = pow(color0, float3(gamma_rcp, gamma_rcp, gamma_rcp));\n"
|
code.Write(" color0 = pow(abs(color0), float3(gamma_rcp, gamma_rcp, gamma_rcp));\n"
|
||||||
" color1 = pow(color1, float3(gamma_rcp, gamma_rcp, gamma_rcp));\n");
|
" color1 = pow(abs(color1), float3(gamma_rcp, gamma_rcp, gamma_rcp));\n");
|
||||||
|
|
||||||
// Convert to YUV.
|
// Convert to YUV.
|
||||||
code.Write(" const float3 y_const = float3(0.257, 0.504, 0.098);\n"
|
code.Write(" const float3 y_const = float3(0.257, 0.504, 0.098);\n"
|
||||||
|
@ -313,8 +313,8 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EFBCopyFormat::XFB:
|
case EFBCopyFormat::XFB:
|
||||||
out.Write(
|
out.Write(" ocol0 = float4(pow(abs(texcol.rgb), float3(gamma_rcp, gamma_rcp, gamma_rcp)), "
|
||||||
" ocol0 = float4(pow(texcol.rgb, float3(gamma_rcp, gamma_rcp, gamma_rcp)), 1.0f);\n");
|
"1.0f);\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user