Shader Disk Cache implementation for D3D. Saves generated shaders on disk. Eliminates "freeze jerks" in D3D plugin the _second_ and later times you play something.... not much to do about the first time. The D3D shader compiler is just slow.

Also assorted cleanup around the shader code.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4869 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2010-01-17 17:44:09 +00:00
parent f599fdcec5
commit 3e01152793
24 changed files with 551 additions and 265 deletions

View File

@ -75,7 +75,7 @@ void CreateRgbToYuyvProgram()
" float3 c01 = (c0 + c1) * 0.5f;\n"
" ocol0 = float4(dot(c1,y_const),dot(c01,u_const),dot(c0,y_const),dot(c01, v_const)) + const3;\n"
"}\n";
s_rgbToYuyvProgram = D3D::CompilePixelShader(FProgram, (int)strlen(FProgram));
s_rgbToYuyvProgram = D3D::CompileAndCreatePixelShader(FProgram, (int)strlen(FProgram));
if (!s_rgbToYuyvProgram) {
ERROR_LOG(VIDEO, "Failed to create RGB to YUYV fragment program");
}
@ -102,7 +102,7 @@ void CreateYuyvToRgbProgram()
" yComp + (2.018f * uComp),\n"
" 1.0f);\n"
"}\n";
s_yuyvToRgbProgram = D3D::CompilePixelShader(FProgram, (int)strlen(FProgram));
s_yuyvToRgbProgram = D3D::CompileAndCreatePixelShader(FProgram, (int)strlen(FProgram));
if (!s_yuyvToRgbProgram) {
ERROR_LOG(VIDEO, "Failed to create YUYV to RGB fragment program");
}
@ -129,7 +129,7 @@ LPDIRECT3DPIXELSHADER9 GetOrCreateEncodingShader(u32 format)
SaveData(szTemp, shader);
}
#endif
s_encodingPrograms[format] = D3D::CompilePixelShader(shader, (int)strlen(shader));
s_encodingPrograms[format] = D3D::CompileAndCreatePixelShader(shader, (int)strlen(shader));
if (!s_encodingPrograms[format]) {
ERROR_LOG(VIDEO, "Failed to create encoding fragment program");
}