Commit 6e05c272 by Geoff Lang

Compile shaders with the best profile available.

Instead of always compiling D3D11 shaders with shader model 4, compile with the latest profile that the current feature level allows. BUG=angle:495 Change-Id: I478d3d4a1aadf24d893508eee1a8c11e501bc084 Reviewed-on: https://chromium-review.googlesource.com/190340Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4c5c6bbb
...@@ -3023,24 +3023,43 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const ch ...@@ -3023,24 +3023,43 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const ch
const std::vector<gl::LinkedVarying> &transformFeedbackVaryings, const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
bool separatedOutputBuffers, D3DWorkaroundType workaround) bool separatedOutputBuffers, D3DWorkaroundType workaround)
{ {
const char *profile = NULL; const char *profileType = NULL;
switch (type) switch (type)
{ {
case rx::SHADER_VERTEX: case rx::SHADER_VERTEX:
profile = "vs_4_0"; profileType = "vs";
break; break;
case rx::SHADER_PIXEL: case rx::SHADER_PIXEL:
profile = "ps_4_0"; profileType = "ps";
break; break;
case rx::SHADER_GEOMETRY: case rx::SHADER_GEOMETRY:
profile = "gs_4_0"; profileType = "gs";
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
return NULL; return NULL;
} }
const char *profileVersion = NULL;
switch (mFeatureLevel)
{
case D3D_FEATURE_LEVEL_11_0:
profileVersion = "5_0";
break;
case D3D_FEATURE_LEVEL_10_1:
profileVersion = "4_1";
break;
case D3D_FEATURE_LEVEL_10_0:
profileVersion = "4_0";
break;
default:
UNREACHABLE();
return NULL;
}
char profile[32];
snprintf(profile, ArraySize(profile), "%s_%s", profileType, profileVersion);
ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false); ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
if (!binary) if (!binary)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment