Hash :
924b7de2
Author :
Date :
2016-01-21T13:54:28
Always write to gl_Position when compiling shaders with SH_GLSL_COMPATIBILITY_OUTPUT. BUG=angleproject:1277 Change-Id: Ib820a46151637e8c61e94b966b970de46ccca6b9 Reviewed-on: https://chromium-review.googlesource.com/323160 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Ian Ewell <ewell@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// GLSLCompatibilityOutputTest.cpp
// Test compiler output for glsl compatibility mode
//
#include "angle_gl.h"
#include "gtest/gtest.h"
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
class GLSLCompatibilityOutputTest : public testing::Test
{
public:
GLSLCompatibilityOutputTest() {}
protected:
void compile(const std::string &shaderString)
{
int compilationFlags = SH_VARIABLES;
std::string infoLog;
bool compilationSuccess =
compileTestShader(GL_VERTEX_SHADER, SH_GLES2_SPEC, SH_GLSL_COMPATIBILITY_OUTPUT,
shaderString, compilationFlags, &mTranslatedSource, &infoLog);
if (!compilationSuccess)
{
FAIL() << "Shader compilation failed " << infoLog;
}
}
bool find(const char *name) const { return mTranslatedSource.find(name) != std::string::npos; }
private:
std::string mTranslatedSource;
};
// Verify gl_Position is written when compiling in compatibility mode
TEST_F(GLSLCompatibilityOutputTest, GLPositionWrittenTest)
{
const std::string &shaderString =
"precision mediump float;\n"
"void main() {\n"
"}";
compile(shaderString);
EXPECT_TRUE(find("gl_Position"));
}