Commit 2db1fbbc by Jamie Madill

Make compile optimization level hidden outside D3D.

BUG=angle:773 Change-Id: Ia6f16d2e4644c02d94cf99b73f70d05486886925 Reviewed-on: https://chromium-review.googlesource.com/232696Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org>
parent 27839c6d
...@@ -448,14 +448,6 @@ Error Program::loadBinary(GLenum binaryFormat, const void *binary, GLsizei lengt ...@@ -448,14 +448,6 @@ Error Program::loadBinary(GLenum binaryFormat, const void *binary, GLsizei lengt
return Error(GL_NO_ERROR); return Error(GL_NO_ERROR);
} }
// TODO: move to ProgramImpl
int compileFlags = stream.readInt<int>();
if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
{
mInfoLog.append("Mismatched compilation flags.");
return Error(GL_NO_ERROR);
}
for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i) for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{ {
stream.readInt(&mLinkedAttribute[i].type); stream.readInt(&mLinkedAttribute[i].type);
...@@ -492,9 +484,6 @@ Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, G ...@@ -492,9 +484,6 @@ Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, G
stream.writeInt(ANGLE_MINOR_VERSION); stream.writeInt(ANGLE_MINOR_VERSION);
stream.writeBytes(reinterpret_cast<const unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE); stream.writeBytes(reinterpret_cast<const unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE);
// TODO: move to ProgramImpl
stream.writeInt(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i) for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{ {
stream.writeInt(mLinkedAttribute[i].type); stream.writeInt(mLinkedAttribute[i].type);
......
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
// WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
// It should only be used selectively to work around specific bugs.
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL1
#endif
namespace egl namespace egl
{ {
class AttributeMap; class AttributeMap;
......
...@@ -402,6 +402,13 @@ bool ProgramD3D::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) ...@@ -402,6 +402,13 @@ bool ProgramD3D::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
{ {
int compileFlags = stream->readInt<int>();
if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
{
infoLog.append("Mismatched compilation flags.");
return LinkResult(false, gl::Error(GL_NO_ERROR));
}
stream->readInt(&mShaderVersion); stream->readInt(&mShaderVersion);
const unsigned int psSamplerCount = stream->readInt<unsigned int>(); const unsigned int psSamplerCount = stream->readInt<unsigned int>();
...@@ -654,6 +661,8 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) ...@@ -654,6 +661,8 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
gl::Error ProgramD3D::save(gl::BinaryOutputStream *stream) gl::Error ProgramD3D::save(gl::BinaryOutputStream *stream)
{ {
stream->writeInt(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
stream->writeInt(mShaderVersion); stream->writeInt(mShaderVersion);
stream->writeInt(mSamplersPS.size()); stream->writeInt(mSamplersPS.size());
......
...@@ -29,6 +29,12 @@ class RendererD3D; ...@@ -29,6 +29,12 @@ class RendererD3D;
class UniformStorage; class UniformStorage;
class ShaderExecutable; class ShaderExecutable;
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
// WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
// It should only be used selectively to work around specific bugs.
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL1
#endif
class ProgramD3D : public ProgramImpl class ProgramD3D : public ProgramImpl
{ {
public: public:
......
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