Preparing stuff for DX11:

- be more strict with the input signature of generated pixel shaders
- replace the D3D parameter with an API_TYPE one, so that we can further distinguish between DX9 and DX11
- for what it's worth dx11 (using vs_4_0) doesn't support D3DCOLORtoUBYTE4; added a workaround for this
- add a "dx9-" prefix to the shader cache files to avoid conflicts with dx11 shaders

Apart from that we're calling CommandProcessor::Shutdown() in main.cpp,Shutdown() now.
Delete all files in User/ShaderCache if you want to save a few KB disk space :P


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5659 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-06-12 15:49:21 +00:00
parent f0d178122e
commit a6ebc8234f
11 changed files with 75 additions and 61 deletions

View File

@ -425,25 +425,27 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, u32 H
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");
WRITE(p, " out float4 ocol0 : COLOR0,\n");
WRITE(p, " out float depth : DEPTH,\n");
WRITE(p, " in float4 rawpos : POSITION,\n");
WRITE(p, " in float4 colors_0 : COLOR0,\n");
WRITE(p, " in float4 colors_1 : COLOR1\n");
// compute window position if needed because binding semantic WPOS is not widely supported
if (numTexgen < 7)
{
for (int i = 0; i < numTexgen; ++i)
WRITE(p, " in float3 uv%d : TEXCOORD%d, \n", i, i);
WRITE(p, ", \n in float3 uv%d : TEXCOORD%d", i, i);
WRITE(p, " in float4 clipPos : TEXCOORD%d, \n", numTexgen);
WRITE(p, ", \n in float4 clipPos : TEXCOORD%d", numTexgen);
}
else
{
// wpos is in w of first 4 texcoords
for (int i = 0; i < numTexgen; ++i)
WRITE(p, " in float%d uv%d : TEXCOORD%d, \n", i<4?4:3, i, i);
WRITE(p, ", \n in float%d uv%d : TEXCOORD%d", i<4?4:3, i, i);
}
WRITE(p, " in float4 colors_0 : COLOR0,\n in float4 colors_1 : COLOR1){\n");
WRITE(p, " ) {\n");
char* pmainstart = p;
@ -490,7 +492,6 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, u32 H
}
}
for (int i = 0; i < numStages; i++)
WriteStage(p, i, texture_mask,HLSL); //build the equation for this stage
@ -533,9 +534,9 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, u32 H
WRITE(p, "zCoord = frac(zCoord);\n");
WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n");
}
WRITE(p, "depth = zCoord;\n");
if (dstAlphaEnable)
WRITE(p, " ocol0 = float4(prev.rgb,"I_ALPHA"[0].a);\n");
else
@ -544,7 +545,7 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, u32 H
WRITE(p, " ocol0 = prev;\n");
}
}
WRITE(p, "}\n");
if (text[sizeof(text) - 1] != 0x7C)
@ -620,9 +621,9 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
if (bpmem.tevind[n].bs != ITBA_OFF)
{
WRITE(p, "alphabump = indtex%d.%s %s;\n",
bpmem.tevind[n].bt,
tevIndAlphaSel[bpmem.tevind[n].bs],
tevIndAlphaScale[bpmem.tevind[n].fmt]);
bpmem.tevind[n].bt,
tevIndAlphaSel[bpmem.tevind[n].bs],
tevIndAlphaScale[bpmem.tevind[n].fmt]);
}
// format
WRITE(p, "float3 indtevcrd%d = indtex%d * %s;\n", n, bpmem.tevind[n].bt, tevIndFmtScale[bpmem.tevind[n].fmt]);