diff options
| author | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2010-07-18 00:18:31 +0000 |
|---|---|---|
| committer | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2010-07-18 00:18:31 +0000 |
| commit | f78133f261f45dced11142cb546feba7a389d416 (patch) | |
| tree | 64c5378d499d430c15ff808bc0caf1ea70f77333 /Source/Core/VideoCommon/Src/VertexShaderGen.cpp | |
| parent | 4b1a3152b6d0de5baf59771c3ad32ebf6c818864 (diff) | |
big changes here:
- Eliminate the useless check for cpu modifications option from efb to ram as it must be enabled always
- use constant names in dx11 for buffer length calculation instead to simplify code reading
- implemented scaled efb copy in opengl, still bugy in some games, the option is not in the gui but will add it when it works perfect
- Change the depth calculation behavior:
if the game use z textures is exactly the same as before.
if the game do not use z texture calculate z values in the vertex shader. the advantage id this approach is that early z culling is applied,
improving fill rate. this mus speed up things, even with ssaa and msaa enabled.
please test for regression and enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5896 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 582cae9d64..02a482229b 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -135,6 +135,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) WRITE(p, "uniform s_"I_LIGHTS" "I_LIGHTS" : register(c%d);\n", C_LIGHTS); WRITE(p, "uniform s_"I_MATERIALS" "I_MATERIALS" : register(c%d);\n", C_MATERIALS); WRITE(p, "uniform s_"I_PROJECTION" "I_PROJECTION" : register(c%d);\n", C_PROJECTION); + WRITE(p, "uniform float4 "I_DEPTHPARAMS" : register(c%d);\n", C_DEPTHPARAMS); WRITE(p, "VS_OUTPUT main(\n"); @@ -462,14 +463,11 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) WRITE(p, "o.tex3.w = o.pos.w;\n"); } + //write the true depth value, if the game uses depth textures pixel shaders will override with the correct values + //if not early z culling will improve speed if (is_d3d) { - WRITE(p, "o.pos.z = o.pos.z + o.pos.w;\n"); - } - else - { - // scale to gl clip space - which is -o.pos.w to o.pos.w, hence the addition. - WRITE(p, "o.pos.z = (o.pos.z * 2.0f) + o.pos.w;\n"); + WRITE(p, "o.pos.z = "I_DEPTHPARAMS".x * o.pos.w + o.pos.z * "I_DEPTHPARAMS".y;\n"); } WRITE(p, "return o;\n}\n"); |
