mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Merge branch 'master' into framebuffer-texture
Conflicts: GPU/GLES/TextureCache.cpp
This commit is contained in:
commit
aef2376b34
75 files changed
+2801
-579
No files matched your search
@@ -171,7 +171,7 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
bool wantDepthTest = gstate.isModeClear() || gstate.isDepthTestEnabled();
|
||||
glstate.depthTest.set(wantDepthTest);
|
||||
if(wantDepthTest) {
|
||||
// Force GL_ALWAYS if mode clear
|
||||
// Force GL_ALWAYS if mode clear - without depth test, no depth write.
|
||||
int depthTestFunc = gstate.isModeClear() ? 1 : gstate.getDepthTestFunc();
|
||||
glstate.depthFunc.set(ztests[depthTestFunc]);
|
||||
}
|
||||
@@ -208,10 +208,6 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
|
||||
bool wantDepthWrite = gstate.isModeClear() || gstate.isDepthWriteEnabled();
|
||||
glstate.depthWrite.set(wantDepthWrite ? GL_TRUE : GL_FALSE);
|
||||
|
||||
float depthRangeMin = gstate_c.zOff - gstate_c.zScale;
|
||||
float depthRangeMax = gstate_c.zOff + gstate_c.zScale;
|
||||
glstate.depthRange.set(depthRangeMin, depthRangeMax);
|
||||
}
|
||||
|
||||
void TransformDrawEngine::UpdateViewportAndProjection() {
|
||||
@@ -240,14 +236,13 @@ void TransformDrawEngine::UpdateViewportAndProjection() {
|
||||
if (throughmode) {
|
||||
// No viewport transform here. Let's experiment with using region.
|
||||
glstate.viewport.set((0 + regionX1) * renderWidthFactor, (0 - regionY1) * renderHeightFactor, (regionX2 - regionX1) * renderWidthFactor, (regionY2 - regionY1) * renderHeightFactor);
|
||||
glstate.depthRange.set(1.0, 0.0);
|
||||
} else {
|
||||
// These we can turn into a glViewport call, offset by offsetX and offsetY. Math after.
|
||||
float vpXa = getFloat24(gstate.viewportx1);
|
||||
float vpXb = getFloat24(gstate.viewportx2);
|
||||
float vpYa = getFloat24(gstate.viewporty1);
|
||||
float vpYb = getFloat24(gstate.viewporty2);
|
||||
float vpZa = getFloat24(gstate.viewportz1); // / 65536.0f should map it to OpenGL's 0.0-1.0 Z range
|
||||
float vpZb = getFloat24(gstate.viewportz2); // / 65536.0f
|
||||
|
||||
// The viewport transform appears to go like this:
|
||||
// Xscreen = -offsetX + vpXb + vpXa * Xview
|
||||
@@ -263,10 +258,6 @@ void TransformDrawEngine::UpdateViewportAndProjection() {
|
||||
float vpWidth = fabsf(gstate_c.vpWidth);
|
||||
float vpHeight = fabsf(gstate_c.vpHeight);
|
||||
|
||||
// TODO: These two should feed into glDepthRange somehow.
|
||||
float vpZ0 = (vpZb - vpZa) / 65536.0f;
|
||||
float vpZ1 = (vpZa * 2) / 65536.0f;
|
||||
|
||||
vpX0 *= renderWidthFactor;
|
||||
vpY0 *= renderHeightFactor;
|
||||
vpWidth *= renderWidthFactor;
|
||||
@@ -277,5 +268,11 @@ void TransformDrawEngine::UpdateViewportAndProjection() {
|
||||
glstate.viewport.set(vpX0, vpY0, vpWidth, vpHeight);
|
||||
// Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh.
|
||||
// shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);
|
||||
|
||||
float zScale = getFloat24(gstate.viewportz1) / 65535.f;
|
||||
float zOff = getFloat24(gstate.viewportz2) / 65535.f;
|
||||
float depthRangeMin = zOff - zScale;
|
||||
float depthRangeMax = zOff + zScale;
|
||||
glstate.depthRange.set(depthRangeMin, depthRangeMax);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user