Implemented gl_FragCoord support for DX11.

TRAC #22375 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1689 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 2eb7ab71
...@@ -1401,7 +1401,13 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std:: ...@@ -1401,7 +1401,13 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std::
if (fragmentShader->mUsesFragCoord) if (fragmentShader->mUsesFragCoord)
{ {
pixelHLSL += " float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n"; pixelHLSL += " float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
if (sm3) {
if (sm4)
{
pixelHLSL += " float4 dx_VPos : SV_Position;\n";
}
else if (sm3)
{
pixelHLSL += " float2 dx_VPos : VPOS;\n"; pixelHLSL += " float2 dx_VPos : VPOS;\n";
} }
} }
...@@ -1430,7 +1436,12 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std:: ...@@ -1430,7 +1436,12 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std::
{ {
pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n"; pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
if (sm3) if (sm4)
{
pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
" gl_FragCoord.y = input.dx_VPos.y;\n";
}
else if (sm3)
{ {
pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n" pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
" gl_FragCoord.y = input.dx_VPos.y + 0.5;\n"; " gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment