mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 21:16:24 +02:00
Support depth clamping in OpenGL where available.
Should make support for depth texturing quite easy. Unfortunately, this extension does not exist on OpenGL ES. There we'll have to use ugly tricks with gl_FragDepth if we want this.
This commit is contained in:
1 parent
5bd9e93196
commit
df6abe83a3
9 files changed
+44
-6
No files matched your search
@@ -230,7 +230,24 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
GLenum cullMode = cullingMode[gstate.getCullMode() ^ !useBufferedRendering];
|
||||
|
||||
cullEnable = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
|
||||
renderManager->SetRaster(cullEnable, GL_CCW, cullMode, dither);
|
||||
|
||||
bool depthClampEnable = false;
|
||||
if (gstate.isModeClear() || gstate.isModeThrough()) {
|
||||
// TODO: Might happen in clear mode if not through...
|
||||
depthClampEnable = false;
|
||||
} else {
|
||||
// Set cull
|
||||
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
|
||||
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
|
||||
// But the alternate is not clamping in either direction...
|
||||
depthClampEnable = gstate.isDepthClampEnabled() && gstate_c.Supports(GPU_SUPPORTS_DEPTH_CLAMP);
|
||||
} else {
|
||||
// We just want to clip in this case, the clamp would be clipped anyway.
|
||||
depthClampEnable = false;
|
||||
}
|
||||
}
|
||||
|
||||
renderManager->SetRaster(cullEnable, GL_CCW, cullMode, dither, depthClampEnable);
|
||||
}
|
||||
|
||||
if (gstate_c.IsDirty(DIRTY_DEPTHSTENCIL_STATE)) {
|
||||
|
||||
Reference in new issue
Block a user