OGLRender:
- When doing the depth buffer calculation, clamp the depth value to GL_DEPTH_RANGE {0.0, 1.0} in the fragment shader itself. Fixes 3D rendering on older drivers that won’t do the clamp for you. (Regression from r5133.)
This commit is contained in:
parent
8a9295796d
commit
0161ced7ff
|
@ -331,8 +331,8 @@ static const char *fragmentShader_100 = {"\
|
||||||
discard; \n\
|
discard; \n\
|
||||||
} \n\
|
} \n\
|
||||||
\n\
|
\n\
|
||||||
float vertW = (vtxPosition.w == 0.0f) ? 0.00000001f : vtxPosition.w; \n\
|
float vertW = (vtxPosition.w == 0.0) ? 0.00000001 : vtxPosition.w; \n\
|
||||||
gl_FragDepth = (oglWBuffer) ? vtxPosition.w/4096.0 : (vtxPosition.z / vertW) * 0.5 + 0.5; \n\
|
gl_FragDepth = (oglWBuffer) ? vtxPosition.w/4096.0 : clamp((vtxPosition.z/vertW) * 0.5 + 0.5, 0.0, 1.0); \n\
|
||||||
gl_FragColor = fragColor; \n\
|
gl_FragColor = fragColor; \n\
|
||||||
} \n\
|
} \n\
|
||||||
"};
|
"};
|
||||||
|
|
|
@ -181,8 +181,8 @@ static const char *fragmentShader_150 = {"\
|
||||||
discard; \n\
|
discard; \n\
|
||||||
} \n\
|
} \n\
|
||||||
\n\
|
\n\
|
||||||
float vertW = (vtxPosition.w == 0.0f) ? 0.00000001f : vtxPosition.w; \n\
|
float vertW = (vtxPosition.w == 0.0) ? 0.00000001 : vtxPosition.w; \n\
|
||||||
gl_FragDepth = (oglWBuffer) ? vtxPosition.w/4096.0 : (vtxPosition.z / vertW) * 0.5 + 0.5; \n\
|
gl_FragDepth = (oglWBuffer) ? vtxPosition.w/4096.0 : clamp((vtxPosition.z/vertW) * 0.5 + 0.5, 0.0, 1.0); \n\
|
||||||
outFragColor = fragColor; \n\
|
outFragColor = fragColor; \n\
|
||||||
} \n\
|
} \n\
|
||||||
"};
|
"};
|
||||||
|
|
Loading…
Reference in New Issue