big commit, implemented depth textures with hardware support in D3D, so now they will be correct as in opengl. please test a lot because i only tested the ati path, nvidia path is "Theoretical" :).

Also reimplemented screen clearing as a color quad to support alpha blending when clearing as in the original hardware.
the funny thing is how is implemented peeking, as locking depth textures is not supported, implemented peeking copying the values form the depth texture to a r32f render target and then reading back the data.
please a lot of testing to this commit.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4599 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2009-11-22 02:37:00 +00:00
parent 7fa29f0b66
commit 19d7bb2c84
16 changed files with 288 additions and 223 deletions

View File

@ -453,10 +453,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, u32 HLSL)
WRITE(p, "uniform float4 "I_FOG"[2] : register(c%d);\n", C_FOG);
WRITE(p, "void main(\n");
WRITE(p, " out float4 ocol0 : COLOR0,\n");
if (HLSL == 1)
WRITE(p, " out float4 ocol1 : COLOR1,\n");
WRITE(p, " out float4 ocol0 : COLOR0,\n");
WRITE(p, " out float depth : DEPTH,\n");
// compute window position if needed because binding semantic WPOS is not widely supported
@ -541,13 +538,6 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, u32 HLSL)
WRITE(p, "depth = zCoord;\n");
if(HLSL == 1)
{
WRITE(p, "float4 EncodedDepth = frac(zCoord * float4(254.0f/255.0,254.0f,254.0f*255.0f,0.0f));\n");
WRITE(p, "EncodedDepth -= EncodedDepth.raag * float4(0.0f,1.0f/255.0f,1.0f/255.0f,0.0f);\n");
WRITE(p, "ocol1 = float4(EncodedDepth.rgb,1.0f);\n");
}
//if (bpmem.genMode.numindstages ) WRITE(p, "prev.rg = indtex0.xy;\nprev.b = 0;\n");
if (!WriteAlphaTest(p, HLSL))