summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorpierre <pierre@pirsoft.de>2010-08-08 22:27:35 +0000
committerpierre <pierre@pirsoft.de>2010-08-08 22:27:35 +0000
commit468b9bfe68ed5531cc64b521746f34a05290dfce (patch)
tree42fa947b956913d0cff62c8930c5a8d0511d550b /Source/Core/VideoCommon
parent244191f18fb486c05e88ce76a36936a29c89afdf (diff)
Fix the OpenGL depth buffer values from the vertex shader.
I am not sure i am understanding what the pipeline really does, and more so what the GC/WII expects here. If my comments are incorrect, please let me know. This was tested with MP2:E, ZWW on r6075. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6078 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderGen.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
index f04bc5ed15..dfda6c1673 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
@@ -468,7 +468,19 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
if (is_d3d) {
WRITE(p, "o.pos.z = "I_DEPTHPARAMS".x * o.pos.w + o.pos.z * "I_DEPTHPARAMS".y;\n");
} else {
- WRITE(p, "o.pos.z = "I_DEPTHPARAMS".x * o.pos.w + o.pos.z * "I_DEPTHPARAMS".y * 2.0f;\n");
+ // this results in a scale from -1..0 to -1..1 after perspective
+ // divide
+ WRITE(p, "o.pos.z = o.pos.w + o.pos.z * 2.0f;\n");
+ // the next steps of the OGL pipeline are:
+ // o.pos.xyz /= o.pos.w; //perspective divide
+ // o.pos.z = clamp(o.pos.z,-1,1) //clamp to -1..1
+ // o.pos.z = (o.pos.z+1)/2; //scale to 0..1
+ // o.pos.z = o.pos.z/(glFar-glNear))+glNear
+ //scale to glNear..glFar of glDepthRange
+ // o.pos.z now contains the value to go to the 0..1 depth buffer
+
+ //trying to get the correct semantic while not using glDepthRange
+ //seems to get rather complicated
}
WRITE(p, "return o;\n}\n");