Use optimization level 0 for D3D11.

TRAC #22516 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1926 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9cbce920
......@@ -73,7 +73,7 @@ bool Renderer::initializeCompiler()
}
// Compiles HLSL code into executable binaries
ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, bool alternateFlags)
ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags)
{
if (!hlsl)
{
......@@ -86,8 +86,9 @@ ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, co
if (gl::perfActive())
{
flags |= D3DCOMPILE_DEBUG;
#ifdef NDEBUG
flags |= ANGLE_COMPILE_OPTIMIZATION_LEVEL;
flags |= optimizationFlags;
#else
flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
#endif
......@@ -98,7 +99,7 @@ ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, co
}
else
{
flags |= ANGLE_COMPILE_OPTIMIZATION_LEVEL;
flags |= optimizationFlags;
sourceText = hlsl;
}
......
......@@ -225,7 +225,7 @@ class Renderer
protected:
bool initializeCompiler();
ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, bool alternateFlags);
ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags);
egl::Display *mDisplay;
......
......@@ -6,6 +6,8 @@
// Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
#include <D3Dcompiler.h>
#include "common/debug.h"
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
......@@ -2730,7 +2732,7 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const ch
return NULL;
}
ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, false);
ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
if (!binary)
return NULL;
......
......@@ -46,6 +46,10 @@
#define ANGLE_ENABLE_D3D9EX 1
#endif // !defined(ANGLE_ENABLE_D3D9EX)
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
#endif
namespace rx
{
static const D3DFORMAT RenderTargetFormats[] =
......@@ -3010,7 +3014,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
return NULL;
}
ID3DBlob *binary = (ID3DBlob*) compileToBinary(infoLog, shaderHLSL, profile, true);
ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, ANGLE_COMPILE_OPTIMIZATION_LEVEL, true);
if (!binary)
return NULL;
......
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