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
diff --git a/src/libGLESv2/renderer/Renderer.cpp b/src/libGLESv2/renderer/Renderer.cpp
index 6edc935..ae94b79 100644
--- a/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/libGLESv2/renderer/Renderer.cpp
@@ -73,7 +73,7 @@
}
// 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 @@
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 @@
}
else
{
- flags |= ANGLE_COMPILE_OPTIMIZATION_LEVEL;
+ flags |= optimizationFlags;
sourceText = hlsl;
}
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 9be65a4..a5acd4e 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -225,7 +225,7 @@
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;
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 40a6954..84d9cbb 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -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 @@
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;
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index 4d0e7c4..4552a6a 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -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 @@
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;