summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/tests/compiler_tests
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
commitfc61780b35af913801d72086456f493f63197da6 (patch)
treef85891288a7bd988da9f0f15ae64e5c63f00d493 /gfx/angle/src/tests/compiler_tests
parent69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff)
parent50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff)
downloadUXP-fc61780b35af913801d72086456f493f63197da6.tar
UXP-fc61780b35af913801d72086456f493f63197da6.tar.gz
UXP-fc61780b35af913801d72086456f493f63197da6.tar.lz
UXP-fc61780b35af913801d72086456f493f63197da6.tar.xz
UXP-fc61780b35af913801d72086456f493f63197da6.zip
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts: # browser/app/profile/firefox.js # browser/components/preferences/jar.mn
Diffstat (limited to 'gfx/angle/src/tests/compiler_tests')
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/API_test.cpp4
-rw-r--r--gfx/angle/src/tests/compiler_tests/BuiltInFunctionEmulator_test.cpp43
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/CollectVariables_test.cpp106
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/ConstantFolding_test.cpp272
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/DebugShaderPrecision_test.cpp22
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp12
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/EmulateGLFragColorBroadcast_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/ExpressionLimit_test.cpp55
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/FragDepth_test.cpp12
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/IntermNode_test.cpp23
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/MalformedShader_test.cpp749
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/NV_draw_buffers_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/Pack_Unpack_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/PruneEmptyDeclarations_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/PruneUnusedFunctions_test.cpp2
-rw-r--r--gfx/angle/src/tests/compiler_tests/QualificationOrderESSL31_test.cpp184
-rw-r--r--gfx/angle/src/tests/compiler_tests/QualificationOrder_test.cpp571
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/RecordConstantPrecision_test.cpp10
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/RemovePow_test.cpp9
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/ShCompile_test.cpp18
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/ShaderExtension_test.cpp12
-rw-r--r--gfx/angle/src/tests/compiler_tests/ShaderImage_test.cpp259
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/ShaderVariable_test.cpp66
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/TypeTracking_test.cpp30
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/UnrollFlatten_test.cpp2
-rwxr-xr-xgfx/angle/src/tests/compiler_tests/WorkGroupSize_test.cpp10
27 files changed, 232 insertions, 2249 deletions
diff --git a/gfx/angle/src/tests/compiler_tests/API_test.cpp b/gfx/angle/src/tests/compiler_tests/API_test.cpp
index 090e31ebc..217a260fa 100755
--- a/gfx/angle/src/tests/compiler_tests/API_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/API_test.cpp
@@ -15,11 +15,11 @@ TEST(APITest, CompareShBuiltInResources)
{
ShBuiltInResources a_resources;
memset(&a_resources, 88, sizeof(a_resources));
- sh::InitBuiltInResources(&a_resources);
+ ShInitBuiltInResources(&a_resources);
ShBuiltInResources b_resources;
memset(&b_resources, 77, sizeof(b_resources));
- sh::InitBuiltInResources(&b_resources);
+ ShInitBuiltInResources(&b_resources);
EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0);
}
diff --git a/gfx/angle/src/tests/compiler_tests/BuiltInFunctionEmulator_test.cpp b/gfx/angle/src/tests/compiler_tests/BuiltInFunctionEmulator_test.cpp
new file mode 100644
index 000000000..edf979f53
--- /dev/null
+++ b/gfx/angle/src/tests/compiler_tests/BuiltInFunctionEmulator_test.cpp
@@ -0,0 +1,43 @@
+//
+// Copyright (c) 2015 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.
+//
+// BuiltInFunctionEmulator_test.cpp:
+// Tests for writing the code for built-in function emulation.
+//
+
+#include "angle_gl.h"
+#include "gtest/gtest.h"
+#include "GLSLANG/ShaderLang.h"
+#include "tests/test_utils/compiler_test.h"
+
+namespace
+{
+
+// Test for the SH_EMULATE_BUILT_IN_FUNCTIONS flag.
+class EmulateBuiltInFunctionsTest : public MatchOutputCodeTest
+{
+ public:
+ EmulateBuiltInFunctionsTest()
+ : MatchOutputCodeTest(GL_VERTEX_SHADER,
+ SH_EMULATE_BUILT_IN_FUNCTIONS,
+ SH_GLSL_COMPATIBILITY_OUTPUT)
+ {
+ }
+};
+
+TEST_F(EmulateBuiltInFunctionsTest, DotEmulated)
+{
+ const std::string shaderString =
+ "precision mediump float;\n"
+ "uniform float u;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = vec4(dot(u, 1.0), 1.0, 1.0, 1.0);\n"
+ "}\n";
+ compile(shaderString);
+ ASSERT_TRUE(foundInCode("webgl_dot_emu("));
+}
+
+} // namespace
diff --git a/gfx/angle/src/tests/compiler_tests/CollectVariables_test.cpp b/gfx/angle/src/tests/compiler_tests/CollectVariables_test.cpp
index a93411668..f29374f54 100755
--- a/gfx/angle/src/tests/compiler_tests/CollectVariables_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/CollectVariables_test.cpp
@@ -14,21 +14,19 @@
#include "GLSLANG/ShaderLang.h"
#include "compiler/translator/TranslatorGLSL.h"
-using namespace sh;
-
#define EXPECT_GLENUM_EQ(expected, actual) \
- EXPECT_EQ(static_cast<::GLenum>(expected), static_cast<::GLenum>(actual))
+ EXPECT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
class CollectVariablesTest : public testing::Test
{
public:
- CollectVariablesTest(::GLenum shaderType) : mShaderType(shaderType) {}
+ CollectVariablesTest(GLenum shaderType) : mShaderType(shaderType) {}
protected:
void SetUp() override
{
ShBuiltInResources resources;
- InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
resources.MaxDrawBuffers = 8;
initTranslator(resources);
@@ -47,10 +45,10 @@ class CollectVariablesTest : public testing::Test
const char *shaderStrings[] = { shaderString.c_str() };
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, SH_VARIABLES));
- const std::vector<Uniform> &uniforms = mTranslator->getUniforms();
+ const std::vector<sh::Uniform> &uniforms = mTranslator->getUniforms();
ASSERT_EQ(1u, uniforms.size());
- const Uniform &uniform = uniforms[0];
+ const sh::Uniform &uniform = uniforms[0];
EXPECT_EQ("gl_DepthRange", uniform.name);
ASSERT_TRUE(uniform.isStruct());
ASSERT_EQ(3u, uniform.fields.size());
@@ -92,7 +90,7 @@ class CollectVariablesTest : public testing::Test
void validateOutputVariableForShader(const std::string &shaderString,
unsigned int varIndex,
const char *varName,
- const OutputVariable **outResult)
+ const sh::OutputVariable **outResult)
{
const char *shaderStrings[] = {shaderString.c_str()};
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, SH_VARIABLES))
@@ -100,7 +98,7 @@ class CollectVariablesTest : public testing::Test
const auto &outputVariables = mTranslator->getOutputVariables();
ASSERT_LT(varIndex, outputVariables.size());
- const OutputVariable &outputVariable = outputVariables[varIndex];
+ const sh::OutputVariable &outputVariable = outputVariables[varIndex];
EXPECT_EQ(-1, outputVariable.location);
EXPECT_TRUE(outputVariable.staticUse);
EXPECT_EQ(varName, outputVariable.name);
@@ -113,7 +111,7 @@ class CollectVariablesTest : public testing::Test
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, SH_VARIABLES));
}
- ::GLenum mShaderType;
+ GLenum mShaderType;
std::unique_ptr<TranslatorGLSL> mTranslator;
};
@@ -144,7 +142,7 @@ TEST_F(CollectFragmentVariablesTest, SimpleOutputVar)
const auto &outputVariables = mTranslator->getOutputVariables();
ASSERT_EQ(1u, outputVariables.size());
- const OutputVariable &outputVariable = outputVariables[0];
+ const sh::OutputVariable &outputVariable = outputVariables[0];
EXPECT_EQ(0u, outputVariable.arraySize);
EXPECT_EQ(-1, outputVariable.location);
@@ -169,7 +167,7 @@ TEST_F(CollectFragmentVariablesTest, LocationOutputVar)
const auto &outputVariables = mTranslator->getOutputVariables();
ASSERT_EQ(1u, outputVariables.size());
- const OutputVariable &outputVariable = outputVariables[0];
+ const sh::OutputVariable &outputVariable = outputVariables[0];
EXPECT_EQ(0u, outputVariable.arraySize);
EXPECT_EQ(5, outputVariable.location);
@@ -190,10 +188,10 @@ TEST_F(CollectVertexVariablesTest, LocationAttribute)
compile(shaderString);
- const std::vector<Attribute> &attributes = mTranslator->getAttributes();
+ const std::vector<sh::Attribute> &attributes = mTranslator->getAttributes();
ASSERT_EQ(1u, attributes.size());
- const Attribute &attribute = attributes[0];
+ const sh::Attribute &attribute = attributes[0];
EXPECT_EQ(0u, attribute.arraySize);
EXPECT_EQ(5, attribute.location);
@@ -216,20 +214,20 @@ TEST_F(CollectVertexVariablesTest, SimpleInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_FALSE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("b", interfaceBlock.name);
EXPECT_TRUE(interfaceBlock.staticUse);
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_GLENUM_EQ(GL_HIGH_FLOAT, field.precision);
EXPECT_TRUE(field.staticUse);
@@ -252,21 +250,21 @@ TEST_F(CollectVertexVariablesTest, SimpleInstancedInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_FALSE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("b", interfaceBlock.name);
EXPECT_EQ("blockInstance", interfaceBlock.instanceName);
EXPECT_TRUE(interfaceBlock.staticUse);
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_GLENUM_EQ(GL_HIGH_FLOAT, field.precision);
EXPECT_TRUE(field.staticUse);
@@ -290,27 +288,27 @@ TEST_F(CollectVertexVariablesTest, StructInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_FALSE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("b", interfaceBlock.name);
EXPECT_TRUE(interfaceBlock.staticUse);
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_TRUE(field.isStruct());
EXPECT_TRUE(field.staticUse);
EXPECT_EQ("s", field.name);
EXPECT_FALSE(field.isRowMajorLayout);
- const ShaderVariable &member = field.fields[0];
+ const sh::ShaderVariable &member = field.fields[0];
// NOTE: we don't currently mark struct members as statically used or not
EXPECT_FALSE(member.isStruct());
@@ -333,28 +331,28 @@ TEST_F(CollectVertexVariablesTest, StructInstancedInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_FALSE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("b", interfaceBlock.name);
EXPECT_EQ("instanceName", interfaceBlock.instanceName);
EXPECT_TRUE(interfaceBlock.staticUse);
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_TRUE(field.isStruct());
EXPECT_TRUE(field.staticUse);
EXPECT_EQ("s", field.name);
EXPECT_FALSE(field.isRowMajorLayout);
- const ShaderVariable &member = field.fields[0];
+ const sh::ShaderVariable &member = field.fields[0];
// NOTE: we don't currently mark struct members as statically used or not
EXPECT_FALSE(member.isStruct());
@@ -377,27 +375,27 @@ TEST_F(CollectVertexVariablesTest, NestedStructRowMajorInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_TRUE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("b", interfaceBlock.name);
EXPECT_TRUE(interfaceBlock.staticUse);
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_TRUE(field.isStruct());
EXPECT_TRUE(field.staticUse);
EXPECT_EQ("s", field.name);
EXPECT_TRUE(field.isRowMajorLayout);
- const ShaderVariable &member = field.fields[0];
+ const sh::ShaderVariable &member = field.fields[0];
// NOTE: we don't currently mark struct members as statically used or not
EXPECT_FALSE(member.isStruct());
@@ -419,10 +417,10 @@ TEST_F(CollectVertexVariablesTest, VaryingInterpolation)
compile(shaderString);
- const std::vector<Varying> &varyings = mTranslator->getVaryings();
+ const std::vector<sh::Varying> &varyings = mTranslator->getVaryings();
ASSERT_EQ(2u, varyings.size());
- const Varying *varying = &varyings[0];
+ const sh::Varying *varying = &varyings[0];
if (varying->name == "gl_Position")
{
@@ -434,7 +432,7 @@ TEST_F(CollectVertexVariablesTest, VaryingInterpolation)
EXPECT_TRUE(varying->staticUse);
EXPECT_GLENUM_EQ(GL_FLOAT, varying->type);
EXPECT_EQ("vary", varying->name);
- EXPECT_EQ(INTERPOLATION_CENTROID, varying->interpolation);
+ EXPECT_EQ(sh::INTERPOLATION_CENTROID, varying->interpolation);
}
// Test for builtin uniform "gl_DepthRange" (Vertex shader)
@@ -471,7 +469,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1FragColor)
" gl_FragColor = vec4(1.0);\n"
"}\n";
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(fragColorShader, 0u, "gl_FragColor", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(0u, outputVariable->arraySize);
@@ -497,7 +495,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1FragData)
resources.MaxDrawBuffers = kMaxDrawBuffers;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(fragDataShader, 0u, "gl_FragData", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(kMaxDrawBuffers, outputVariable->arraySize);
@@ -520,7 +518,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1FragDepthMediump)
resources.EXT_frag_depth = 1;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(fragDepthShader, 0u, "gl_FragDepthEXT", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(0u, outputVariable->arraySize);
@@ -543,7 +541,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1FragDepthHighp)
resources.FragmentPrecisionHigh = 1;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(fragDepthHighShader, 0u, "gl_FragDepthEXT", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(0u, outputVariable->arraySize);
@@ -566,7 +564,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL3FragDepthHighp)
resources.EXT_frag_depth = 1;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(fragDepthHighShader, 0u, "gl_FragDepth", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(0u, outputVariable->arraySize);
@@ -594,7 +592,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1EXTBlendFuncExtendedSecondary
resources.MaxDualSourceDrawBuffers = resources.MaxDrawBuffers;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(secondaryFragColorShader, 0u, "gl_FragColor", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(0u, outputVariable->arraySize);
@@ -632,7 +630,7 @@ TEST_F(CollectFragmentVariablesTest, OutputVarESSL1EXTBlendFuncExtendedSecondary
resources.MaxDualSourceDrawBuffers = resources.MaxDrawBuffers;
initTranslator(resources);
- const OutputVariable *outputVariable = nullptr;
+ const sh::OutputVariable *outputVariable = nullptr;
validateOutputVariableForShader(secondaryFragDataShader, 0u, "gl_FragData", &outputVariable);
ASSERT_NE(outputVariable, nullptr);
EXPECT_EQ(kMaxDrawBuffers, outputVariable->arraySize);
@@ -660,7 +658,7 @@ class CollectHashedVertexVariablesTest : public CollectVertexVariablesTest
{
// Initialize the translate with a hash function
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
resources.HashFunction = SimpleTestHash;
initTranslator(resources);
}
@@ -679,14 +677,14 @@ TEST_F(CollectHashedVertexVariablesTest, InstancedInterfaceBlock)
compile(shaderString);
- const std::vector<InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks = mTranslator->getInterfaceBlocks();
ASSERT_EQ(1u, interfaceBlocks.size());
- const InterfaceBlock &interfaceBlock = interfaceBlocks[0];
+ const sh::InterfaceBlock &interfaceBlock = interfaceBlocks[0];
EXPECT_EQ(0u, interfaceBlock.arraySize);
EXPECT_FALSE(interfaceBlock.isRowMajorLayout);
- EXPECT_EQ(BLOCKLAYOUT_SHARED, interfaceBlock.layout);
+ EXPECT_EQ(sh::BLOCKLAYOUT_SHARED, interfaceBlock.layout);
EXPECT_EQ("blockName", interfaceBlock.name);
EXPECT_EQ("blockInstance", interfaceBlock.instanceName);
EXPECT_EQ("webgl_9", interfaceBlock.mappedName);
@@ -694,7 +692,7 @@ TEST_F(CollectHashedVertexVariablesTest, InstancedInterfaceBlock)
ASSERT_EQ(1u, interfaceBlock.fields.size());
- const InterfaceBlockField &field = interfaceBlock.fields[0];
+ const sh::InterfaceBlockField &field = interfaceBlock.fields[0];
EXPECT_GLENUM_EQ(GL_HIGH_FLOAT, field.precision);
EXPECT_TRUE(field.staticUse);
@@ -722,7 +720,7 @@ TEST_F(CollectHashedVertexVariablesTest, StructUniform)
const auto &uniforms = mTranslator->getUniforms();
ASSERT_EQ(1u, uniforms.size());
- const Uniform &uniform = uniforms[0];
+ const sh::Uniform &uniform = uniforms[0];
EXPECT_EQ(0u, uniform.arraySize);
EXPECT_EQ("u", uniform.name);
@@ -731,7 +729,7 @@ TEST_F(CollectHashedVertexVariablesTest, StructUniform)
ASSERT_EQ(1u, uniform.fields.size());
- const ShaderVariable &field = uniform.fields[0];
+ const sh::ShaderVariable &field = uniform.fields[0];
EXPECT_GLENUM_EQ(GL_HIGH_FLOAT, field.precision);
// EXPECT_TRUE(field.staticUse); // we don't yet support struct static use
diff --git a/gfx/angle/src/tests/compiler_tests/ConstantFolding_test.cpp b/gfx/angle/src/tests/compiler_tests/ConstantFolding_test.cpp
index 4c5baffe7..1185613de 100755
--- a/gfx/angle/src/tests/compiler_tests/ConstantFolding_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/ConstantFolding_test.cpp
@@ -15,8 +15,6 @@
#include "compiler/translator/PoolAlloc.h"
#include "compiler/translator/TranslatorESSL.h"
-using namespace sh;
-
template <typename T>
class ConstantFinder : public TIntermTraverser
{
@@ -109,7 +107,7 @@ class ConstantFoldingTest : public testing::Test
allocator.push();
SetGlobalPoolAllocator(&allocator);
ShBuiltInResources resources;
- InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslatorESSL = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_GLES3_SPEC);
ASSERT_TRUE(mTranslatorESSL->Init(resources));
@@ -794,271 +792,3 @@ TEST_F(ConstantFoldingTest, FoldNonSquareOuterProduct)
std::vector<float> result(outputElements, outputElements + 6);
ASSERT_TRUE(constantColumnMajorMatrixFoundInAST(result));
}
-
-// Test that folding bit shift left with non-matching signedness works.
-TEST_F(ConstantFoldingTest, FoldBitShiftLeftDifferentSignedness)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " uint u = 0xffffffffu << 31;\n"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0x80000000u));
-}
-
-// Test that folding bit shift right with non-matching signedness works.
-TEST_F(ConstantFoldingTest, FoldBitShiftRightDifferentSignedness)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " uint u = 0xffffffffu >> 30;\n"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0x3u));
-}
-
-// Test that folding signed bit shift right extends the sign bit.
-// ESSL 3.00.6 section 5.9 Expressions.
-TEST_F(ConstantFoldingTest, FoldBitShiftRightExtendSignBit)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " const int i = 0x8fffe000 >> 6;\n"
- " uint u = uint(i);"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- // The bits of the operand are 0x8fffe000 = 1000 1111 1111 1111 1110 0000 0000 0000
- // After shifting, they become 1111 1110 0011 1111 1111 1111 1000 0000 = 0xfe3fff80
- ASSERT_TRUE(constantFoundInAST(0xfe3fff80u));
-}
-
-// Signed bit shift left should interpret its operand as a bit pattern. As a consequence a number
-// may turn from positive to negative when shifted left.
-// ESSL 3.00.6 section 5.9 Expressions.
-TEST_F(ConstantFoldingTest, FoldBitShiftLeftInterpretedAsBitPattern)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " const int i = 0x1fffffff << 3;\n"
- " uint u = uint(i);"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0xfffffff8u));
-}
-
-// Test that dividing the minimum signed integer by -1 works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "However, for the case where the minimum representable value is divided by -1, it is allowed to
-// return either the minimum representable value or the maximum representable value."
-TEST_F(ConstantFoldingTest, FoldDivideMinimumIntegerByMinusOne)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = 0x80000000 / (-1);\n"
- " my_FragColor = vec4(i);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0x7fffffff) || constantFoundInAST(-0x7fffffff - 1));
-}
-
-// Test that folding an unsigned integer addition that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldUnsignedIntegerAddOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " uint u = 0xffffffffu + 43u;\n"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(42u));
-}
-
-// Test that folding a signed integer addition that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldSignedIntegerAddOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = 0x7fffffff + 4;\n"
- " my_FragColor = vec4(i);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(-0x7ffffffd));
-}
-
-// Test that folding an unsigned integer subtraction that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldUnsignedIntegerDiffOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " uint u = 0u - 5u;\n"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0xfffffffbu));
-}
-
-// Test that folding a signed integer subtraction that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldSignedIntegerDiffOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = -0x7fffffff - 7;\n"
- " my_FragColor = vec4(i);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0x7ffffffa));
-}
-
-// Test that folding an unsigned integer multiplication that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldUnsignedIntegerMultiplyOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " uint u = 0xffffffffu * 10u;\n"
- " my_FragColor = vec4(u);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(0xfffffff6u));
-}
-
-// Test that folding a signed integer multiplication that overflows works.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldSignedIntegerMultiplyOverflow)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = 0x7fffffff * 42;\n"
- " my_FragColor = vec4(i);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(-42));
-}
-
-// Test that folding of negating the minimum representable integer works. Note that in the test
-// "0x80000000" is a negative literal, and the minus sign before it is the negation operator.
-// ESSL 3.00.6 section 4.1.3 Integers:
-// "For all precisions, operations resulting in overflow or underflow will not cause any exception,
-// nor will they saturate, rather they will 'wrap' to yield the low-order n bits of the result where
-// n is the size in bits of the integer."
-TEST_F(ConstantFoldingTest, FoldMinimumSignedIntegerNegation)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = -0x80000000;\n"
- " my_FragColor = vec4(i);\n"
- "}\n";
- compile(shaderString);
- // Negating the minimum signed integer overflows the positive range, so it wraps back to itself.
- ASSERT_TRUE(constantFoundInAST(-0x7fffffff - 1));
-}
-
-// Test that folding of shifting the minimum representable integer works.
-TEST_F(ConstantFoldingTest, FoldMinimumSignedIntegerRightShift)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = (0x80000000 >> 1);\n"
- " int j = (0x80000000 >> 7);\n"
- " my_FragColor = vec4(i, j, i, j);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(-0x40000000));
- ASSERT_TRUE(constantFoundInAST(-0x01000000));
-}
-
-// Test that folding of shifting by 0 works.
-TEST_F(ConstantFoldingTest, FoldShiftByZero)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = (3 >> 0);\n"
- " int j = (73 << 0);\n"
- " my_FragColor = vec4(i, j, i, j);\n"
- "}\n";
- compile(shaderString);
- ASSERT_TRUE(constantFoundInAST(3));
- ASSERT_TRUE(constantFoundInAST(73));
-}
diff --git a/gfx/angle/src/tests/compiler_tests/DebugShaderPrecision_test.cpp b/gfx/angle/src/tests/compiler_tests/DebugShaderPrecision_test.cpp
index d1bee424a..dbaffa5d4 100755
--- a/gfx/angle/src/tests/compiler_tests/DebugShaderPrecision_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/DebugShaderPrecision_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
class DebugShaderPrecisionTest : public MatchOutputCodeTest
{
public:
@@ -1025,23 +1023,3 @@ TEST_F(DebugShaderPrecisionTest, ModfOutParameter)
ASSERT_TRUE(foundInAllGLSLCode("modf(angle_frm(u), o)"));
ASSERT_TRUE(foundInHLSLCode("modf(angle_frm(_u), _o)"));
}
-
-#if defined(ANGLE_ENABLE_HLSL)
-// Tests precision emulation with HLSL 3.0 output -- should error gracefully.
-TEST(DebugShaderPrecisionNegativeTest, HLSL3Unsupported)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "uniform float u;\n"
- "void main() {\n"
- " gl_FragColor = vec4(u);\n"
- "}\n";
- std::string infoLog;
- std::string translatedCode;
- ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
- resources.WEBGL_debug_shader_precision = 1;
- ASSERT_FALSE(compileTestShader(GL_FRAGMENT_SHADER, SH_GLES3_SPEC, SH_HLSL_3_0_OUTPUT,
- shaderString, &resources, 0, &translatedCode, &infoLog));
-}
-#endif // defined(ANGLE_ENABLE_HLSL)
diff --git a/gfx/angle/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp b/gfx/angle/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp
index 3ac0ff6d8..40aeed28d 100755
--- a/gfx/angle/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp
@@ -124,7 +124,7 @@ class EXTBlendFuncExtendedTest
protected:
virtual void SetUp()
{
- sh::InitBuiltInResources(&mResources);
+ ShInitBuiltInResources(&mResources);
// EXT_draw_buffers is used in some of the shaders for test purposes.
mResources.EXT_draw_buffers = 1;
mResources.NV_draw_buffers = 2;
@@ -137,7 +137,7 @@ class EXTBlendFuncExtendedTest
{
if (mCompiler)
{
- sh::Destruct(mCompiler);
+ ShDestruct(mCompiler);
mCompiler = NULL;
}
}
@@ -145,8 +145,8 @@ class EXTBlendFuncExtendedTest
void InitializeCompiler()
{
DestroyCompiler();
- mCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, testing::get<0>(GetParam()),
- SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
+ mCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, testing::get<0>(GetParam()),
+ SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
ASSERT_TRUE(mCompiler != NULL) << "Compiler could not be constructed.";
}
@@ -163,12 +163,12 @@ class EXTBlendFuncExtendedTest
const char *shader)
{
const char *shaderStrings[] = {version, pragma, shader};
- bool success = sh::Compile(mCompiler, shaderStrings, 3, 0);
+ bool success = ShCompile(mCompiler, shaderStrings, 3, 0);
if (success)
{
return ::testing::AssertionSuccess() << "Compilation success";
}
- return ::testing::AssertionFailure() << sh::GetInfoLog(mCompiler);
+ return ::testing::AssertionFailure() << ShGetInfoLog(mCompiler);
}
protected:
diff --git a/gfx/angle/src/tests/compiler_tests/EmulateGLFragColorBroadcast_test.cpp b/gfx/angle/src/tests/compiler_tests/EmulateGLFragColorBroadcast_test.cpp
index 07cf3fd68..dc286b814 100755
--- a/gfx/angle/src/tests/compiler_tests/EmulateGLFragColorBroadcast_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/EmulateGLFragColorBroadcast_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
namespace
{
diff --git a/gfx/angle/src/tests/compiler_tests/ExpressionLimit_test.cpp b/gfx/angle/src/tests/compiler_tests/ExpressionLimit_test.cpp
index 8f7d7ef4f..5d80f2acf 100755
--- a/gfx/angle/src/tests/compiler_tests/ExpressionLimit_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/ExpressionLimit_test.cpp
@@ -32,7 +32,7 @@ protected:
// Set up the per compile resources
static void GenerateResources(ShBuiltInResources *res)
{
- sh::InitBuiltInResources(res);
+ ShInitBuiltInResources(res);
res->MaxVertexAttribs = 8;
res->MaxVertexUniformVectors = 128;
@@ -176,17 +176,17 @@ protected:
// to the issue we are testing.
bool CheckShaderCompilation(ShHandle compiler,
const char *source,
- ShCompileOptions compileOptions,
+ int compileOptions,
const char *expected_error)
{
- bool success = sh::Compile(compiler, &source, 1, compileOptions) != 0;
- if (success)
- {
- success = !expected_error;
+ bool success = ShCompile(compiler, &source, 1, compileOptions) != 0;
+ if (success)
+ {
+ success = !expected_error;
}
else
{
- std::string log = sh::GetInfoLog(compiler);
+ std::string log = ShGetInfoLog(compiler);
if (expected_error)
success = log.find(expected_error) != std::string::npos;
@@ -211,8 +211,9 @@ TEST_F(ExpressionLimitTest, ExpressionComplexity)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle vertexCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
+ ShHandle vertexCompiler = ShConstructCompiler(
+ GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
// Test expression under the limit passes.
EXPECT_TRUE(CheckShaderCompilation(
@@ -232,15 +233,16 @@ TEST_F(ExpressionLimitTest, ExpressionComplexity)
GenerateShaderWithLongExpression(
kMaxExpressionComplexity + 10).c_str(),
compileOptions & ~SH_LIMIT_EXPRESSION_COMPLEXITY, NULL));
- sh::Destruct(vertexCompiler);
+ ShDestruct(vertexCompiler);
}
TEST_F(ExpressionLimitTest, UnusedExpressionComplexity)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle vertexCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
+ ShHandle vertexCompiler = ShConstructCompiler(
+ GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
// Test expression under the limit passes.
EXPECT_TRUE(CheckShaderCompilation(
@@ -260,15 +262,16 @@ TEST_F(ExpressionLimitTest, UnusedExpressionComplexity)
GenerateShaderWithUnusedLongExpression(
kMaxExpressionComplexity + 10).c_str(),
compileOptions & ~SH_LIMIT_EXPRESSION_COMPLEXITY, NULL));
- sh::Destruct(vertexCompiler);
+ ShDestruct(vertexCompiler);
}
TEST_F(ExpressionLimitTest, CallStackDepth)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle vertexCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
+ ShHandle vertexCompiler = ShConstructCompiler(
+ GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
// Test call stack under the limit passes.
EXPECT_TRUE(CheckShaderCompilation(
@@ -288,15 +291,16 @@ TEST_F(ExpressionLimitTest, CallStackDepth)
GenerateShaderWithDeepFunctionStack(
kMaxCallStackDepth + 10).c_str(),
compileOptions & ~SH_LIMIT_CALL_STACK_DEPTH, NULL));
- sh::Destruct(vertexCompiler);
+ ShDestruct(vertexCompiler);
}
TEST_F(ExpressionLimitTest, UnusedCallStackDepth)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle vertexCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
+ ShHandle vertexCompiler = ShConstructCompiler(
+ GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
// Test call stack under the limit passes.
EXPECT_TRUE(CheckShaderCompilation(
@@ -316,15 +320,16 @@ TEST_F(ExpressionLimitTest, UnusedCallStackDepth)
GenerateShaderWithUnusedDeepFunctionStack(
kMaxCallStackDepth + 10).c_str(),
compileOptions & ~SH_LIMIT_CALL_STACK_DEPTH, NULL));
- sh::Destruct(vertexCompiler);
+ ShDestruct(vertexCompiler);
}
TEST_F(ExpressionLimitTest, Recursion)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle vertexCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = 0;
+ ShHandle vertexCompiler = ShConstructCompiler(
+ GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = 0;
static const char* shaderWithRecursion0 = SHADER(
precision mediump float;
@@ -531,15 +536,15 @@ TEST_F(ExpressionLimitTest, Recursion)
EXPECT_TRUE(CheckShaderCompilation(
vertexCompiler, shaderWithNoRecursion,
compileOptions | SH_LIMIT_CALL_STACK_DEPTH, NULL));
- sh::Destruct(vertexCompiler);
+ ShDestruct(vertexCompiler);
}
TEST_F(ExpressionLimitTest, FunctionParameterCount)
{
ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
- ShHandle compiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
- ShCompileOptions compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
+ ShHandle compiler = ShConstructCompiler(GL_FRAGMENT_SHADER, spec, output, &resources);
+ int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
// Test parameters under the limit succeeds.
EXPECT_TRUE(CheckShaderCompilation(
@@ -553,5 +558,5 @@ TEST_F(ExpressionLimitTest, FunctionParameterCount)
EXPECT_TRUE(CheckShaderCompilation(
compiler, GenerateShaderWithFunctionParameters(kMaxFunctionParameters + 1).c_str(),
compileOptions & ~SH_LIMIT_EXPRESSION_COMPLEXITY, nullptr));
- sh::Destruct(compiler);
+ ShDestruct(compiler);
}
diff --git a/gfx/angle/src/tests/compiler_tests/FragDepth_test.cpp b/gfx/angle/src/tests/compiler_tests/FragDepth_test.cpp
index 1d3e358ca..d3c87987a 100755
--- a/gfx/angle/src/tests/compiler_tests/FragDepth_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/FragDepth_test.cpp
@@ -23,7 +23,7 @@ class FragDepthTest : public testing::TestWithParam<bool>
protected:
void SetUp() override
{
- sh::InitBuiltInResources(&mResources);
+ ShInitBuiltInResources(&mResources);
mCompiler = nullptr;
mResources.EXT_frag_depth = GetParam();
}
@@ -33,7 +33,7 @@ class FragDepthTest : public testing::TestWithParam<bool>
{
if (mCompiler)
{
- sh::Destruct(mCompiler);
+ ShDestruct(mCompiler);
mCompiler = nullptr;
}
}
@@ -41,8 +41,8 @@ class FragDepthTest : public testing::TestWithParam<bool>
void InitializeCompiler()
{
DestroyCompiler();
- mCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, SH_GLES3_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
+ mCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, SH_GLES3_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
ASSERT_TRUE(mCompiler != nullptr) << "Compiler could not be constructed.";
}
@@ -51,12 +51,12 @@ class FragDepthTest : public testing::TestWithParam<bool>
const char *shader)
{
const char *shaderStrings[] = {version, pragma, shader};
- bool success = sh::Compile(mCompiler, shaderStrings, 3, 0);
+ bool success = ShCompile(mCompiler, shaderStrings, 3, 0);
if (success)
{
return ::testing::AssertionSuccess() << "Compilation success";
}
- return ::testing::AssertionFailure() << sh::GetInfoLog(mCompiler);
+ return ::testing::AssertionFailure() << ShGetInfoLog(mCompiler);
}
protected:
diff --git a/gfx/angle/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp b/gfx/angle/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp
index 8adec774a..326d70d29 100755
--- a/gfx/angle/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/GLSLCompatibilityOutput_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
class GLSLCompatibilityOutputTest : public MatchOutputCodeTest
{
public:
diff --git a/gfx/angle/src/tests/compiler_tests/IntermNode_test.cpp b/gfx/angle/src/tests/compiler_tests/IntermNode_test.cpp
index 1a14ad86c..b0f7404d3 100755
--- a/gfx/angle/src/tests/compiler_tests/IntermNode_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/IntermNode_test.cpp
@@ -13,8 +13,6 @@
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/PoolAlloc.h"
-using namespace sh;
-
class IntermNodeTest : public testing::Test
{
public:
@@ -149,8 +147,10 @@ TEST_F(IntermNodeTest, DeepCopyBinaryNode)
{
TType type(EbtFloat, EbpHigh);
- TIntermBinary *original = new TIntermBinary(EOpAdd, createTestSymbol(), createTestSymbol());
+ TIntermBinary *original = new TIntermBinary(EOpAdd);
original->setLine(getTestSourceLoc());
+ original->setLeft(createTestSymbol());
+ original->setRight(createTestSymbol());
TIntermTyped *copyTyped = original->deepCopy();
TIntermBinary *copy = copyTyped->getAsBinaryNode();
ASSERT_NE(nullptr, copy);
@@ -168,8 +168,9 @@ TEST_F(IntermNodeTest, DeepCopyUnaryNode)
{
TType type(EbtFloat, EbpHigh);
- TIntermUnary *original = new TIntermUnary(EOpPreIncrement, createTestSymbol());
+ TIntermUnary *original = new TIntermUnary(EOpPreIncrement);
original->setLine(getTestSourceLoc());
+ original->setOperand(createTestSymbol());
TIntermTyped *copyTyped = original->deepCopy();
TIntermUnary *copy = copyTyped->getAsUnaryNode();
ASSERT_NE(nullptr, copy);
@@ -209,24 +210,24 @@ TEST_F(IntermNodeTest, DeepCopyAggregateNode)
}
}
-// Check that the deep copy of a ternary node is an actual copy with the same attributes as the
+// Check that the deep copy of a selection node is an actual copy with the same attributes as the
// original. Child nodes also need to be copies with the same attributes as the original children.
-TEST_F(IntermNodeTest, DeepCopyTernaryNode)
+TEST_F(IntermNodeTest, DeepCopySelectionNode)
{
TType type(EbtFloat, EbpHigh);
- TIntermTernary *original = new TIntermTernary(createTestSymbol(TType(EbtBool, EbpUndefined)),
- createTestSymbol(), createTestSymbol());
+ TIntermSelection *original = new TIntermSelection(
+ createTestSymbol(TType(EbtBool, EbpUndefined)), createTestSymbol(), createTestSymbol());
original->setLine(getTestSourceLoc());
TIntermTyped *copyTyped = original->deepCopy();
- TIntermTernary *copy = copyTyped->getAsTernaryNode();
+ TIntermSelection *copy = copyTyped->getAsSelectionNode();
ASSERT_NE(nullptr, copy);
ASSERT_NE(original, copy);
checkTestSourceLoc(copy->getLine());
checkTypeEqualWithQualifiers(original->getType(), copy->getType());
checkSymbolCopy(original->getCondition(), copy->getCondition());
- checkSymbolCopy(original->getTrueExpression(), copy->getTrueExpression());
- checkSymbolCopy(original->getFalseExpression(), copy->getFalseExpression());
+ checkSymbolCopy(original->getTrueBlock(), copy->getTrueBlock());
+ checkSymbolCopy(original->getFalseBlock(), copy->getFalseBlock());
}
diff --git a/gfx/angle/src/tests/compiler_tests/MalformedShader_test.cpp b/gfx/angle/src/tests/compiler_tests/MalformedShader_test.cpp
index e84fc7014..51ad72a0f 100755
--- a/gfx/angle/src/tests/compiler_tests/MalformedShader_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/MalformedShader_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "compiler/translator/TranslatorESSL.h"
-using namespace sh;
-
class MalformedShaderTest : public testing::Test
{
public:
@@ -23,7 +21,7 @@ class MalformedShaderTest : public testing::Test
virtual void SetUp()
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_GLES3_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
@@ -53,7 +51,7 @@ class MalformedShaderTest : public testing::Test
protected:
std::string mInfoLog;
TranslatorESSL *mTranslator;
- ShCompileOptions mExtraCompileOptions;
+ int mExtraCompileOptions;
};
class MalformedVertexShaderTest : public MalformedShaderTest
@@ -65,7 +63,7 @@ class MalformedVertexShaderTest : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_VERTEX_SHADER, SH_GLES3_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
@@ -81,7 +79,7 @@ class MalformedWebGL2ShaderTest : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_WEBGL2_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
@@ -97,7 +95,7 @@ class MalformedWebGL1ShaderTest : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_WEBGL_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
@@ -113,7 +111,7 @@ class MalformedVertexShaderGLES31Test : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_VERTEX_SHADER, SH_GLES3_1_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
}
@@ -128,7 +126,7 @@ class MalformedFragmentShaderGLES31Test : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_GLES3_1_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
}
@@ -143,7 +141,7 @@ class MalformedComputeShaderTest : public MalformedShaderTest
void SetUp() override
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_COMPUTE_SHADER, SH_GLES3_1_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
}
@@ -2325,7 +2323,7 @@ TEST_F(MalformedComputeShaderTest, CorrectUsageOfComputeBuiltins)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableNumWorkGroups)
{
const std::string &shaderString =
@@ -2341,7 +2339,7 @@ TEST_F(MalformedComputeShaderTest, SpecialVariableNumWorkGroups)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableWorkGroupID)
{
const std::string &shaderString =
@@ -2357,7 +2355,7 @@ TEST_F(MalformedComputeShaderTest, SpecialVariableWorkGroupID)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableLocalInvocationID)
{
const std::string &shaderString =
@@ -2373,7 +2371,7 @@ TEST_F(MalformedComputeShaderTest, SpecialVariableLocalInvocationID)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableGlobalInvocationID)
{
const std::string &shaderString =
@@ -2389,7 +2387,7 @@ TEST_F(MalformedComputeShaderTest, SpecialVariableGlobalInvocationID)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableLocalInvocationIndex)
{
const std::string &shaderString =
@@ -2405,7 +2403,7 @@ TEST_F(MalformedComputeShaderTest, SpecialVariableLocalInvocationIndex)
}
}
-// It is illegal to write to a special variable.
+// It is illegal to write to a special variable
TEST_F(MalformedComputeShaderTest, SpecialVariableWorkGroupSize)
{
const std::string &shaderString =
@@ -2437,722 +2435,3 @@ TEST_F(MalformedShaderTest, SamplerUnaryOperator)
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
-
-// Invariant cannot be used with a work group size declaration.
-TEST_F(MalformedComputeShaderTest, InvariantBlockSize)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "invariant layout(local_size_x = 15) in;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Invariant cannot be used with a non-output variable in ESSL3.
-TEST_F(MalformedShaderTest, InvariantNonOuput)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "invariant int value;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Invariant declaration should follow the following format "invariant <out variable name>".
-// Test having an incorrect qualifier in the invariant declaration.
-TEST_F(MalformedShaderTest, InvariantDeclarationWithStorageQualifier)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 foo;\n"
- "invariant centroid foo;\n"
- "void main() {\n"
- "}\n";
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Invariant declaration should follow the following format "invariant <out variable name>".
-// Test having an incorrect precision qualifier in the invariant declaration.
-TEST_F(MalformedShaderTest, InvariantDeclarationWithPrecisionQualifier)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 foo;\n"
- "invariant highp foo;\n"
- "void main() {\n"
- "}\n";
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Invariant declaration should follow the following format "invariant <out variable name>".
-// Test having an incorrect layout qualifier in the invariant declaration.
-TEST_F(MalformedShaderTest, InvariantDeclarationWithLayoutQualifier)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 foo;\n"
- "invariant layout(location=0) foo;\n"
- "void main() {\n"
- "}\n";
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Variable declaration with both invariant and layout qualifiers is not valid in the formal grammar
-// provided in the ESSL 3.00 spec. ESSL 3.10 starts allowing this combination, but ESSL 3.00 should
-// still disallow it.
-TEST_F(MalformedShaderTest, VariableDeclarationWithInvariantAndLayoutQualifierESSL300)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "invariant layout(location = 0) out vec4 my_FragColor;\n"
- "void main() {\n"
- "}\n";
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Bit shift with a rhs value > 31 has an undefined result in the GLSL spec. We disallow it.
-// ESSL 3.00.6 section 5.9.
-TEST_F(MalformedShaderTest, ShiftBy32)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "void main() {\n"
- " uint u = 1u << 32u;\n"
- "}\n";
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Test that deferring global variable init works with an empty main().
-TEST_F(MalformedShaderTest, DeferGlobalVariableInitWithEmptyMain)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "uniform float u;\n"
- "float foo = u;\n"
- "void main() {}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// Test that pruning empty declarations from loop init expression works.
-TEST_F(MalformedShaderTest, EmptyDeclarationAsLoopInit)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " int i = 0;\n"
- " for (int; i < 3; i++)\n"
- " {\n"
- " my_FragColor = vec4(i);\n"
- " }\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-// r32f, r32i, r32ui do not require either the writeonly or readonly memory qualifiers.
-// GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, ImageR32FNoMemoryQualifier)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "in vec4 myInput;\n"
- "layout(r32f) uniform image2D myImage;\n"
- "void main() {\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// Images which do not have r32f, r32i or r32ui as internal format, must have readonly or writeonly
-// specified.
-// GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, ImageR32FWithCorrectMemoryQualifier)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "in vec4 myInput;\n"
- "layout(rgba32f) uniform image2D myImage;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// It is a compile-time error to call imageStore when the image is qualified as readonly.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, StoreInReadOnlyImage)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "in vec4 myInput;\n"
- "layout(r32f) uniform readonly image2D myImage;\n"
- "void main() {\n"
- " imageStore(myImage, ivec2(0), vec4(1.0));\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// It is a compile-time error to call imageLoad when the image is qualified as writeonly.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, LoadFromWriteOnlyImage)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "in vec4 myInput;\n"
- "layout(r32f) uniform writeonly image2D myImage;\n"
- "void main() {\n"
- " imageLoad(myImage, ivec2(0));\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A valid declaration and usage of an image3D.
-TEST_F(MalformedFragmentShaderGLES31Test, ValidImage3D)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image3D;\n"
- "in vec4 myInput;\n"
- "layout(rgba32f) uniform readonly image3D myImage;\n"
- "void main() {\n"
- " imageLoad(myImage, ivec3(0));\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// A valid declaration and usage of an imageCube.
-TEST_F(MalformedFragmentShaderGLES31Test, ValidImageCube)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump imageCube;\n"
- "in vec4 myInput;\n"
- "layout(rgba32f) uniform readonly imageCube myImage;\n"
- "void main() {\n"
- " imageLoad(myImage, ivec3(0));\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// A valid declaration and usage of an image2DArray.
-TEST_F(MalformedFragmentShaderGLES31Test, ValidImage2DArray)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2DArray;\n"
- "in vec4 myInput;\n"
- "layout(rgba32f) uniform readonly image2DArray myImage;\n"
- "void main() {\n"
- " imageLoad(myImage, ivec3(0));\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// Images cannot be l-values.
-// GLSL ES 3.10 Revision 4, 4.1.7 Opaque Types
-TEST_F(MalformedFragmentShaderGLES31Test, ImageLValueFunctionDefinitionInOut)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "void myFunc(inout image2D someImage) {}\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Cannot assign to images.
-// GLSL ES 3.10 Revision 4, 4.1.7 Opaque Types
-TEST_F(MalformedFragmentShaderGLES31Test, ImageAssignment)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(rgba32f) uniform readonly image2D myImage;\n"
- "layout(rgba32f) uniform readonly image2D myImage2;\n"
- "void main() {\n"
- " myImage = myImage2;\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Passing an image qualifier to a function should not be able to discard the readonly qualifier.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, ReadOnlyQualifierMissingInFunctionArgument)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(rgba32f) uniform readonly image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Passing an image qualifier to a function should not be able to discard the writeonly qualifier.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, WriteOnlyQualifierMissingInFunctionArgument)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(rgba32f) uniform writeonly image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Passing an image parameter as an argument to another function should not be able to discard the
-// writeonly qualifier.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, DiscardWriteonlyInFunctionBody)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(rgba32f) uniform writeonly image2D myImage;\n"
- "void myFunc1(in image2D someImage) {}\n"
- "void myFunc2(in writeonly image2D someImage) { myFunc1(someImage); }\n"
- "void main() {\n"
- " myFunc2(myImage);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// The memory qualifiers for the image declaration and function argument match and the test should
-// pass.
-TEST_F(MalformedFragmentShaderGLES31Test, CorrectImageMemoryQualifierSpecified)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// The test adds additional qualifiers to the argument in the function header.
-// This is correct since no memory qualifiers are discarded upon the function call.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, CorrectImageMemoryQualifierSpecified2)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform image2D myImage;\n"
- "void myFunc(in readonly writeonly image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// Images are not allowed in structs.
-// GLSL ES 3.10 Revision 4, 4.1.8 Structures
-TEST_F(MalformedFragmentShaderGLES31Test, ImageInStruct)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "struct myStruct { layout(r32f) image2D myImage; };\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Images are not allowed in interface blocks.
-// GLSL ES 3.10 Revision 4, 4.3.9 Interface Blocks
-TEST_F(MalformedFragmentShaderGLES31Test, ImageInInterfaceBlock)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "uniform myBlock { layout(r32f) image2D myImage; };\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Readonly used with an interface block.
-TEST_F(MalformedFragmentShaderGLES31Test, ReadonlyWithInterfaceBlock)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "uniform readonly myBlock { float something; };\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Readonly used with an invariant.
-TEST_F(MalformedFragmentShaderGLES31Test, ReadonlyWithInvariant)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "out vec4 something;\n"
- "invariant readonly something;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Readonly used with a member of a structure.
-TEST_F(MalformedFragmentShaderGLES31Test, ReadonlyWithStructMember)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "out vec4 something;\n"
- "struct MyStruct { readonly float myMember; };\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// It should not be possible to use an internal format layout qualifier with an interface block.
-TEST_F(MalformedFragmentShaderGLES31Test, ImageInternalFormatWithInterfaceBlock)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "out vec4 something;\n"
- "layout(rgba32f) uniform MyStruct { float myMember; };\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// It should not be possible to use an internal format layout qualifier with a uniform without a
-// type.
-TEST_F(MalformedFragmentShaderGLES31Test, ImageInternalFormatInGlobalLayoutQualifier)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "out vec4 something;\n"
- "layout(rgba32f) uniform;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// ESSL 1.00 section 4.1.7.
-// Samplers are not allowed as operands for most operations. Test this for ternary operator.
-TEST_F(MalformedShaderTest, SamplerAsTernaryOperand)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "uniform bool u;\n"
- "uniform sampler2D s1;\n"
- "uniform sampler2D s2;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(u ? s1 : s2, vec2(0, 0));\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// ESSL 1.00.17 section 4.5.2.
-// ESSL 3.00.6 section 4.5.3.
-// Precision must be specified for floats. Test this with a declaration with no qualifiers.
-TEST_F(MalformedShaderTest, FloatDeclarationNoQualifiersNoPrecision)
-{
- const std::string &shaderString =
- "vec4 foo = vec4(0.0);\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = foo;\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Check compiler doesn't crash on incorrect unsized array declarations.
-TEST_F(MalformedShaderTest, IncorrectUnsizedArray)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "float foo[] = 0.0;\n"
- "out vec4 my_FragColor;\n"
- "void main()\n"
- "{\n"
- " foo[0] = 1.0;\n"
- " my_FragColor = vec4(foo[0]);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Check compiler doesn't crash when a bvec is on the right hand side of a logical operator.
-// ESSL 3.00.6 section 5.9.
-TEST_F(MalformedShaderTest, LogicalOpRHSIsBVec)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "void main()\n"
- "{\n"
- " bool b;\n"
- " bvec3 b3;\n"
- " b && b3;\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Check compiler doesn't crash when there's an unsized array constructor with no parameters.
-// ESSL 3.00.6 section 4.1.9: Array size must be greater than zero.
-TEST_F(MalformedShaderTest, UnsizedArrayConstructorNoParameters)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "void main()\n"
- "{\n"
- " int[]();\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Passing an image parameter as an argument to another function should not be able to discard the
-// coherent qualifier.
-TEST_F(MalformedFragmentShaderGLES31Test, CoherentQualifierMissingInFunctionArgument)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform coherent image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Passing an image parameter as an argument to another function should not be able to discard the
-// volatile qualifier.
-TEST_F(MalformedFragmentShaderGLES31Test, VolatileQualifierMissingInFunctionArgument)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform volatile image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (compile(shaderString))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// The restrict qualifier can be discarded from a function argument.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, RestrictQualifierDiscardedInFunctionArgument)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform restrict image2D myImage;\n"
- "void myFunc(in image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-}
-
-// Function image arguments can be overqualified.
-// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
-TEST_F(MalformedFragmentShaderGLES31Test, OverqualifyingImageParameter)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision mediump float;\n"
- "precision mediump image2D;\n"
- "layout(r32f) uniform image2D myImage;\n"
- "void myFunc(in coherent volatile image2D someImage) {}\n"
- "void main() {\n"
- " myFunc(myImage);\n"
- "}\n";
-
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
- }
-} \ No newline at end of file
diff --git a/gfx/angle/src/tests/compiler_tests/NV_draw_buffers_test.cpp b/gfx/angle/src/tests/compiler_tests/NV_draw_buffers_test.cpp
index 13a44fd59..49c43c93c 100755
--- a/gfx/angle/src/tests/compiler_tests/NV_draw_buffers_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/NV_draw_buffers_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
class NVDrawBuffersTest : public MatchOutputCodeTest
{
public:
diff --git a/gfx/angle/src/tests/compiler_tests/Pack_Unpack_test.cpp b/gfx/angle/src/tests/compiler_tests/Pack_Unpack_test.cpp
index a6333e78e..85673d5f7 100755
--- a/gfx/angle/src/tests/compiler_tests/Pack_Unpack_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/Pack_Unpack_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
namespace
{
diff --git a/gfx/angle/src/tests/compiler_tests/PruneEmptyDeclarations_test.cpp b/gfx/angle/src/tests/compiler_tests/PruneEmptyDeclarations_test.cpp
index 6b59e0cd5..4652117c4 100755
--- a/gfx/angle/src/tests/compiler_tests/PruneEmptyDeclarations_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/PruneEmptyDeclarations_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
namespace
{
diff --git a/gfx/angle/src/tests/compiler_tests/PruneUnusedFunctions_test.cpp b/gfx/angle/src/tests/compiler_tests/PruneUnusedFunctions_test.cpp
index fe710d8e6..8880abe3f 100755
--- a/gfx/angle/src/tests/compiler_tests/PruneUnusedFunctions_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/PruneUnusedFunctions_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
namespace
{
diff --git a/gfx/angle/src/tests/compiler_tests/QualificationOrderESSL31_test.cpp b/gfx/angle/src/tests/compiler_tests/QualificationOrderESSL31_test.cpp
deleted file mode 100644
index dd3aa9a65..000000000
--- a/gfx/angle/src/tests/compiler_tests/QualificationOrderESSL31_test.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// 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.
-//
-// QualificationOrderESSL31_test.cpp:
-// OpenGL ES 3.1 removes the strict order of qualifiers imposed by the grammar.
-// This file contains tests for invalid order and usage of qualifiers in GLSL ES 3.10.
-
-#include "gtest/gtest.h"
-
-#include "angle_gl.h"
-#include "compiler/translator/TranslatorESSL.h"
-#include "GLSLANG/ShaderLang.h"
-#include "tests/test_utils/compiler_test.h"
-
-using namespace sh;
-
-class QualificationVertexShaderTestESSL31 : public testing::Test
-{
- public:
- QualificationVertexShaderTestESSL31() {}
- protected:
- virtual void SetUp()
- {
- ShBuiltInResources resources;
- InitBuiltInResources(&resources);
-
- mTranslator = new TranslatorESSL(GL_VERTEX_SHADER, SH_GLES3_1_SPEC);
- ASSERT_TRUE(mTranslator->Init(resources));
- }
-
- virtual void TearDown() { delete mTranslator; }
-
- // Return true when compilation succeeds
- bool compile(const std::string &shaderString)
- {
- const char *shaderStrings[] = {shaderString.c_str()};
- mASTRoot = mTranslator->compileTreeForTesting(shaderStrings, 1,
- SH_INTERMEDIATE_TREE | SH_VARIABLES);
- TInfoSink &infoSink = mTranslator->getInfoSink();
- mInfoLog = infoSink.info.c_str();
- return mASTRoot != nullptr;
- }
-
- const TIntermSymbol *findSymbolInAST(const TString &symbolName, TBasicType basicType)
- {
- return FindSymbolNode(mASTRoot, symbolName, basicType);
- }
-
- protected:
- TranslatorESSL *mTranslator;
- TIntermNode *mASTRoot;
- std::string mInfoLog;
-};
-
-// GLSL ES 3.10 has relaxed checks on qualifier order. Any order is correct.
-TEST_F(QualificationVertexShaderTestESSL31, CentroidOut)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision lowp float;\n"
- "out centroid float something;\n"
- "void main(){\n"
- " something = 1.0;\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success" << mInfoLog;
- }
- else
- {
- const TIntermSymbol *node = findSymbolInAST("something", EbtFloat);
- ASSERT_NE(nullptr, node);
-
- const TType &type = node->getType();
- EXPECT_EQ(EvqCentroidOut, type.getQualifier());
- }
-}
-
-// GLSL ES 3.10 has relaxed checks on qualifier order. Any order is correct.
-TEST_F(QualificationVertexShaderTestESSL31, AllQualifiersMixed)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision lowp float;\n"
- "highp out invariant centroid flat vec4 something;\n"
- "void main(){\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success" << mInfoLog;
- }
- else
- {
- const TIntermSymbol *node = findSymbolInAST("something", EbtFloat);
- ASSERT_NE(nullptr, node);
-
- const TType &type = node->getType();
- EXPECT_TRUE(type.isInvariant());
- EXPECT_EQ(EvqFlatOut, type.getQualifier());
- EXPECT_EQ(EbpHigh, type.getPrecision());
- }
-}
-
-// GLSL ES 3.10 allows multiple layout qualifiers to be specified.
-TEST_F(QualificationVertexShaderTestESSL31, MultipleLayouts)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision lowp float;\n"
- "in layout(location=1) layout(location=2) vec4 something;\n"
- "void main(){\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success" << mInfoLog;
- }
- else
- {
- const TIntermSymbol *node = findSymbolInAST("something", EbtFloat);
- ASSERT_NE(nullptr, node);
-
- const TType &type = node->getType();
- EXPECT_EQ(EvqVertexIn, type.getQualifier());
- EXPECT_EQ(2, type.getLayoutQualifier().location);
- }
-}
-
-// The test checks layout qualifier overriding when multiple layouts are specified.
-TEST_F(QualificationVertexShaderTestESSL31, MultipleLayoutsInterfaceBlock)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision lowp float;\n"
- "out float someValue;\n"
- "layout(shared) layout(std140) layout(column_major) uniform MyInterface\n"
- "{ vec4 something; } MyInterfaceName;\n"
- "void main(){\n"
- " someValue = MyInterfaceName.something.r;\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success" << mInfoLog;
- }
- else
- {
- const TIntermSymbol *node = findSymbolInAST("MyInterfaceName", EbtInterfaceBlock);
- ASSERT_NE(nullptr, node);
-
- const TType &type = node->getType();
- TLayoutQualifier layoutQualifier = type.getLayoutQualifier();
- EXPECT_EQ(EbsStd140, layoutQualifier.blockStorage);
- EXPECT_EQ(EmpColumnMajor, layoutQualifier.matrixPacking);
- }
-}
-
-// The test checks layout qualifier overriding when multiple layouts are specified.
-TEST_F(QualificationVertexShaderTestESSL31, MultipleLayoutsInterfaceBlock2)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "precision lowp float;\n"
- "out float someValue;\n"
- "layout(row_major) layout(std140) layout(shared) uniform MyInterface\n"
- "{ vec4 something; } MyInterfaceName;\n"
- "void main(){\n"
- " someValue = MyInterfaceName.something.r;\n"
- "}\n";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed, expecting success" << mInfoLog;
- }
- else
- {
- const TIntermSymbol *node = findSymbolInAST("MyInterfaceName", EbtInterfaceBlock);
- ASSERT_NE(nullptr, node);
-
- const TType &type = node->getType();
- TLayoutQualifier layoutQualifier = type.getLayoutQualifier();
- EXPECT_EQ(EbsShared, layoutQualifier.blockStorage);
- EXPECT_EQ(EmpRowMajor, layoutQualifier.matrixPacking);
- }
-}
diff --git a/gfx/angle/src/tests/compiler_tests/QualificationOrder_test.cpp b/gfx/angle/src/tests/compiler_tests/QualificationOrder_test.cpp
deleted file mode 100644
index 33ecbf77d..000000000
--- a/gfx/angle/src/tests/compiler_tests/QualificationOrder_test.cpp
+++ /dev/null
@@ -1,571 +0,0 @@
-//
-// 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.
-//
-// QualificationOrder_test.cpp:
-// OpenGL ES 3.1 removes the strict order of qualifiers imposed by the grammar.
-// This file contains tests for invalid order and usage of qualifiers.
-
-#include "angle_gl.h"
-#include "gtest/gtest.h"
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/translator/TranslatorESSL.h"
-
-using namespace sh;
-
-class QualificationOrderShaderTest : public testing::Test
-{
- public:
- QualificationOrderShaderTest() {}
-
- protected:
- virtual void SetUp() {}
-
- virtual void TearDown() {}
-
- // Return true when compilation succeeds
- bool compile(const std::string &shaderString, ::GLenum shaderType, ShShaderSpec spec)
- {
- ShBuiltInResources resources;
- InitBuiltInResources(&resources);
- resources.MaxDrawBuffers = (spec == SH_GLES2_SPEC) ? 1 : 8;
-
- TranslatorESSL *translator = new TranslatorESSL(shaderType, spec);
- EXPECT_TRUE(translator->Init(resources));
-
- const char *shaderStrings[] = {shaderString.c_str()};
- bool compilationSuccess = translator->compile(shaderStrings, 1, SH_INTERMEDIATE_TREE);
- TInfoSink &infoSink = translator->getInfoSink();
- mInfoLog = infoSink.info.c_str();
-
- delete translator;
-
- return compilationSuccess;
- }
-
- protected:
- std::string mInfoLog;
-};
-
-// Repeating centroid qualifier is invalid.
-TEST_F(QualificationOrderShaderTest, RepeatingCentroid)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "flat centroid centroid in float myValue;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_1_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Repeating uniform storage qualifiers is invalid.
-TEST_F(QualificationOrderShaderTest, RepeatingUniforms)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "uniform uniform float myValue;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_1_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Repeating varying storage qualifiers is invalid.
-TEST_F(QualificationOrderShaderTest, RepeatingVaryings)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "varying varying vec4 myColor;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_1_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Layout qualifier should be before the storage qualifiers.
-TEST_F(QualificationOrderShaderTest, WrongOrderQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out layout(location=1) vec4 myColor;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_1_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Centroid out is the correct order. Out centroid is incorrect.
-TEST_F(QualificationOrderShaderTest, WrongOrderCentroidOut)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 uv;\n"
- "out centroid vec4 position;\n"
- "void main() {\n"
- "position = uv;\n"
- "gl_Position = uv;\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Centroid in is the correct order. In centroid is incorrect.
-TEST_F(QualificationOrderShaderTest, WrongOrderCentroidIn)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in centroid vec4 colorIN;\n"
- "out vec4 colorOUT;\n"
- "void main() {\n"
- "colorOUT = colorIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Type cannot be before the storage qualifier.
-TEST_F(QualificationOrderShaderTest, WrongOrderTypeStorage)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "centroid in vec4 colorIN;\n"
- "vec4 out colorOUT;\n"
- "void main() {\n"
- "colorOUT = colorIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have two conflicting storage qualifiers.
-TEST_F(QualificationOrderShaderTest, RepeatingDifferentStorageQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "centroid in vec4 colorIN;\n"
- "uniform out vec4 colorOUT;\n"
- "void main() {\n"
- "colorOUT = colorIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have two different layout qualifiers.
-TEST_F(QualificationOrderShaderTest, RepeatingLayoutQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 colorIN;\n"
- "layout(location=0) layout(location=0) out vec4 colorOUT;\n"
- "void main() {\n"
- "colorOUT = colorIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have repeating invariant qualifiers.
-TEST_F(QualificationOrderShaderTest, RepeatingInvariantQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 colorIN;\n"
- "invariant invariant out vec4 colorOUT;\n"
- "void main() {\n"
- "colorOUT = colorIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have repeating storage qualifiers.
-TEST_F(QualificationOrderShaderTest, RepeatingAttributes)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "attribute attribute vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Wrong order for invariant varying. It should be 'invariant varying', not 'varying invariant'.
-TEST_F(QualificationOrderShaderTest, VaryingInvariantWrongOrder)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "attribute vec4 positionIN;\n"
- "varying invariant vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have repeating storage qualifiers.
-TEST_F(QualificationOrderShaderTest, AttributeVaryingMix)
-{
- const std::string &shaderString1 =
- "precision mediump float;\n"
- "attribute varying vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- const std::string &shaderString2 =
- "precision mediump float;\n"
- "varying attribute vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- if (compile(shaderString1, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-
- if (compile(shaderString2, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have repeating interpolation qualifiers.
-TEST_F(QualificationOrderShaderTest, RepeatingInterpolationQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 positionIN;\n"
- "flat flat out vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Wrong order for the interpolation and storage qualifier. The correct order is interpolation
-// qualifier and then storage qualifier.
-TEST_F(QualificationOrderShaderTest, WrongOrderInterpolationStorageQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 positionIN;\n"
- "out flat vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// The correct order is invariant, interpolation, storage.
-TEST_F(QualificationOrderShaderTest, WrongOrderInvariantInterpolationStorageQualifiers)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 positionIN;\n"
- "flat invariant out vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// The invariant qualifer has to be before the storage qualifiers.
-TEST_F(QualificationOrderShaderTest, WrongOrderInvariantNotFirst)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 positionIN;\n"
- "centroid out invariant vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// The precision qualifier is after the storage qualifiers.
-TEST_F(QualificationOrderShaderTest, WrongOrderPrecision)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in vec4 positionIN;\n"
- "highp centroid out vec4 dataOUT;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "dataOUT = 0.5 * dataOUT + vec4(0.5);\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have multiple declarations of the 'in' storage qualifier.
-TEST_F(QualificationOrderShaderTest, RepeatingInQualifier)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "in in vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// A variable cannot have multiple declarations of the 'attribute' storage qualifier.
-TEST_F(QualificationOrderShaderTest, RepeatingAttributeQualifier)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "attribute attribute vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Vertex input cannot be qualified with invariant.
-TEST_F(QualificationOrderShaderTest, InvariantVertexInput)
-{
- const std::string &shaderString =
- "precision mediump float;\n"
- "invariant attribute vec4 positionIN;\n"
- "void main() {\n"
- "gl_Position = positionIN;\n"
- "}\n";
-
- if (compile(shaderString, GL_VERTEX_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the invariant qualifier.
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersInvariant)
-{
- const std::string &shaderString =
- "precision lowp float;\n"
- "varying float value;\n"
- "float foo0 (invariant in float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the attribute qualifier.
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersAttribute)
-{
- const std::string &shaderString =
- "precision lowp float;\n"
- "varying float value;\n"
- "float foo0 (attribute float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the varying qualifier.
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersVarying)
-{
- const std::string &shaderString =
- "precision lowp float;\n"
- "varying float value;\n"
- "float foo0 (varying float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the layout qualifier
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersLayout)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision lowp float;\n"
- "in float value;\n"
- "float foo0 (layout(location = 3) in float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "out vec4 colorOUT;\n"
- "void main()\n"
- "{\n"
- " colorOUT = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the centroid qualifier
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersCentroidIn)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision lowp float;\n"
- "in float value;\n"
- "float foo0 (centroid in float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "out vec4 colorOUT;\n"
- "void main()\n"
- "{\n"
- " colorOUT = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Cannot have a function parameter with the flat qualifier
-TEST_F(QualificationOrderShaderTest, InvalidFunctionParametersFlatIn)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision lowp float;\n"
- "in float value;\n"
- "float foo0 (flat in float x) {\n"
- " return 2.0*x;\n"
- "}\n"
- "out vec4 colorOUT;\n"
- "void main()\n"
- "{\n"
- " colorOUT = vec4(foo0(value));\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure" << mInfoLog;
- }
-}
-
-// Output layout location qualifier can't appear more than once within a declaration.
-// GLSL ES 3.00.6 section 4.3.8.2 Output Layout Qualifiers.
-TEST_F(QualificationOrderShaderTest, TwoOutputLocations)
-{
- const std::string &shaderString =
- "#version 300 es\n"
- "precision mediump float;\n"
- "layout(location=1, location=2) out vec4 myColor;\n"
- "void main() {\n"
- "}\n";
-
- if (compile(shaderString, GL_FRAGMENT_SHADER, SH_GLES3_SPEC))
- {
- FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
- }
-}
diff --git a/gfx/angle/src/tests/compiler_tests/RecordConstantPrecision_test.cpp b/gfx/angle/src/tests/compiler_tests/RecordConstantPrecision_test.cpp
index 2cd2bfdf4..783a93c10 100755
--- a/gfx/angle/src/tests/compiler_tests/RecordConstantPrecision_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/RecordConstantPrecision_test.cpp
@@ -12,8 +12,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
class RecordConstantPrecisionTest : public MatchOutputCodeTest
{
public:
@@ -33,7 +31,7 @@ TEST_F(RecordConstantPrecisionTest, HigherPrecisionConstantAsParameter)
" gl_FragColor = vec4(b);\n"
"}\n";
compile(shaderString);
- ASSERT_TRUE(foundInCode("const highp float webgl_angle_s"));
+ ASSERT_TRUE(foundInCode("const highp float s"));
ASSERT_FALSE(foundInCode("fract(4096.5"));
ASSERT_FALSE(foundInCode("fract((4096.5"));
}
@@ -51,7 +49,7 @@ TEST_F(RecordConstantPrecisionTest, EqualPrecisionConstantAsParameter)
" gl_FragColor = vec4(b);\n"
"}\n";
compile(shaderString);
- ASSERT_FALSE(foundInCode("const mediump float webgl_angle_s"));
+ ASSERT_FALSE(foundInCode("const mediump float s"));
ASSERT_TRUE(foundInCode("fract((4096.5"));
}
@@ -69,7 +67,7 @@ TEST_F(RecordConstantPrecisionTest, FoldedBinaryConstantPrecisionIsHigher)
" gl_FragColor = vec4(b);\n"
"}\n";
compile(shaderString);
- ASSERT_TRUE(foundInCode("const highp float webgl_angle_s"));
+ ASSERT_TRUE(foundInCode("const highp float s"));
ASSERT_FALSE(foundInCode("fract(4096.5"));
ASSERT_FALSE(foundInCode("fract((4096.5"));
}
@@ -89,7 +87,7 @@ TEST_F(RecordConstantPrecisionTest, FoldedUnaryConstantPrecisionIsHigher)
" gl_FragColor = vec4(b);\n"
"}\n";
compile(shaderString);
- ASSERT_TRUE(foundInCode("const highp float webgl_angle_s"));
+ ASSERT_TRUE(foundInCode("const highp float s"));
ASSERT_FALSE(foundInCode("sin(0.5"));
ASSERT_FALSE(foundInCode("sin((0.5"));
}
diff --git a/gfx/angle/src/tests/compiler_tests/RemovePow_test.cpp b/gfx/angle/src/tests/compiler_tests/RemovePow_test.cpp
index 8367ac745..2434f09a0 100755
--- a/gfx/angle/src/tests/compiler_tests/RemovePow_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/RemovePow_test.cpp
@@ -13,8 +13,6 @@
#include "compiler/translator/NodeSearch.h"
#include "compiler/translator/TranslatorGLSL.h"
-using namespace sh;
-
class RemovePowTest : public testing::Test
{
public:
@@ -26,9 +24,8 @@ class RemovePowTest : public testing::Test
allocator.push();
SetGlobalPoolAllocator(&allocator);
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
- mTranslatorGLSL =
- new sh::TranslatorGLSL(GL_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_GLSL_COMPATIBILITY_OUTPUT);
+ ShInitBuiltInResources(&resources);
+ mTranslatorGLSL = new TranslatorGLSL(GL_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_GLSL_COMPATIBILITY_OUTPUT);
ASSERT_TRUE(mTranslatorGLSL->Init(resources));
}
@@ -58,7 +55,7 @@ class RemovePowTest : public testing::Test
}
private:
- sh::TranslatorGLSL *mTranslatorGLSL;
+ TranslatorGLSL *mTranslatorGLSL;
TIntermNode *mASTRoot;
TPoolAllocator allocator;
diff --git a/gfx/angle/src/tests/compiler_tests/ShCompile_test.cpp b/gfx/angle/src/tests/compiler_tests/ShCompile_test.cpp
index 21e4a3cbe..2a514a9e4 100755
--- a/gfx/angle/src/tests/compiler_tests/ShCompile_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/ShCompile_test.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
// ShCompile_test.cpp
-// Test the sh::Compile interface with different parameters.
+// Test the ShCompile interface with different parameters.
//
#include "angle_gl.h"
@@ -19,9 +19,9 @@ class ShCompileTest : public testing::Test
protected:
void SetUp() override
{
- sh::InitBuiltInResources(&mResources);
- mCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, SH_WEBGL_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
+ ShInitBuiltInResources(&mResources);
+ mCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, SH_WEBGL_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
ASSERT_TRUE(mCompiler != nullptr) << "Compiler could not be constructed.";
}
@@ -29,15 +29,15 @@ class ShCompileTest : public testing::Test
{
if (mCompiler)
{
- sh::Destruct(mCompiler);
+ ShDestruct(mCompiler);
mCompiler = nullptr;
}
}
void testCompile(const char **shaderStrings, int stringCount, bool expectation)
{
- bool success = sh::Compile(mCompiler, shaderStrings, stringCount, 0);
- const std::string &compileLog = sh::GetInfoLog(mCompiler);
+ bool success = ShCompile(mCompiler, shaderStrings, stringCount, 0);
+ const std::string &compileLog = ShGetInfoLog(mCompiler);
EXPECT_EQ(expectation, success) << compileLog;
}
@@ -46,7 +46,7 @@ class ShCompileTest : public testing::Test
ShHandle mCompiler;
};
-// Test calling sh::Compile with more than one shader source string.
+// Test calling ShCompile with more than one shader source string.
TEST_F(ShCompileTest, MultipleShaderStrings)
{
const std::string &shaderString1 =
@@ -61,7 +61,7 @@ TEST_F(ShCompileTest, MultipleShaderStrings)
testCompile(shaderStrings, 2, true);
}
-// Test calling sh::Compile with a tokens split into different shader source strings.
+// Test calling ShCompile with a tokens split into different shader source strings.
TEST_F(ShCompileTest, TokensSplitInShaderStrings)
{
const std::string &shaderString1 =
diff --git a/gfx/angle/src/tests/compiler_tests/ShaderExtension_test.cpp b/gfx/angle/src/tests/compiler_tests/ShaderExtension_test.cpp
index eb2d9b9bd..a23de3dee 100755
--- a/gfx/angle/src/tests/compiler_tests/ShaderExtension_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/ShaderExtension_test.cpp
@@ -52,7 +52,7 @@ class ShaderExtensionTest : public testing::Test
protected:
virtual void SetUp()
{
- sh::InitBuiltInResources(&mResources);
+ ShInitBuiltInResources(&mResources);
mCompiler = NULL;
}
@@ -65,7 +65,7 @@ class ShaderExtensionTest : public testing::Test
{
if (mCompiler)
{
- sh::Destruct(mCompiler);
+ ShDestruct(mCompiler);
mCompiler = NULL;
}
}
@@ -73,15 +73,15 @@ class ShaderExtensionTest : public testing::Test
void InitializeCompiler()
{
DestroyCompiler();
- mCompiler = sh::ConstructCompiler(GL_FRAGMENT_SHADER, SH_WEBGL_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
+ mCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, SH_WEBGL_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &mResources);
ASSERT_TRUE(mCompiler != NULL) << "Compiler could not be constructed.";
}
void TestShaderExtension(const char **shaderStrings, int stringCount, bool expectation)
{
- bool success = sh::Compile(mCompiler, shaderStrings, stringCount, 0);
- const std::string &compileLog = sh::GetInfoLog(mCompiler);
+ bool success = ShCompile(mCompiler, shaderStrings, stringCount, 0);
+ const std::string& compileLog = ShGetInfoLog(mCompiler);
EXPECT_EQ(expectation, success) << compileLog;
}
diff --git a/gfx/angle/src/tests/compiler_tests/ShaderImage_test.cpp b/gfx/angle/src/tests/compiler_tests/ShaderImage_test.cpp
deleted file mode 100644
index b069c6547..000000000
--- a/gfx/angle/src/tests/compiler_tests/ShaderImage_test.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-//
-// 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.
-//
-// ShaderImage_test.cpp:
-// Tests for images
-//
-
-#include "angle_gl.h"
-#include "gtest/gtest.h"
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/translator/TranslatorESSL.h"
-#include "tests/test_utils/compiler_test.h"
-
-using namespace sh;
-
-namespace
-{
-
-// Checks that the imageStore call with mangled name imageStoreMangledName exists in the AST.
-// Further each argument is checked whether it matches the expected properties given the compiled
-// shader.
-void CheckImageStoreCall(TIntermNode *astRoot,
- const TString &imageStoreMangledName,
- TBasicType imageType,
- int storeLocationNominalSize,
- TBasicType storeValueType,
- int storeValueNominalSize)
-{
- const TIntermAggregate *imageStoreFunctionCall =
- FindFunctionCallNode(astRoot, imageStoreMangledName);
- ASSERT_NE(nullptr, imageStoreFunctionCall);
-
- const TIntermSequence *storeArguments = imageStoreFunctionCall->getSequence();
- ASSERT_EQ(3u, storeArguments->size());
-
- const TIntermTyped *storeArgument1Typed = (*storeArguments)[0]->getAsTyped();
- ASSERT_EQ(imageType, storeArgument1Typed->getBasicType());
-
- const TIntermTyped *storeArgument2Typed = (*storeArguments)[1]->getAsTyped();
- ASSERT_EQ(EbtInt, storeArgument2Typed->getBasicType());
- ASSERT_EQ(storeLocationNominalSize, storeArgument2Typed->getNominalSize());
-
- const TIntermTyped *storeArgument3Typed = (*storeArguments)[2]->getAsTyped();
- ASSERT_EQ(storeValueType, storeArgument3Typed->getBasicType());
- ASSERT_EQ(storeValueNominalSize, storeArgument3Typed->getNominalSize());
-}
-
-// Checks that the imageLoad call with mangled name imageLoadMangledName exists in the AST.
-// Further each argument is checked whether it matches the expected properties given the compiled
-// shader.
-void CheckImageLoadCall(TIntermNode *astRoot,
- const TString &imageLoadMangledName,
- TBasicType imageType,
- int loadLocationNominalSize)
-{
- const TIntermAggregate *imageLoadFunctionCall =
- FindFunctionCallNode(astRoot, imageLoadMangledName);
- ASSERT_NE(nullptr, imageLoadFunctionCall);
-
- const TIntermSequence *loadArguments = imageLoadFunctionCall->getSequence();
- ASSERT_EQ(2u, loadArguments->size());
-
- const TIntermTyped *loadArgument1Typed = (*loadArguments)[0]->getAsTyped();
- ASSERT_EQ(imageType, loadArgument1Typed->getBasicType());
-
- const TIntermTyped *loadArgument2Typed = (*loadArguments)[1]->getAsTyped();
- ASSERT_EQ(EbtInt, loadArgument2Typed->getBasicType());
- ASSERT_EQ(loadLocationNominalSize, loadArgument2Typed->getNominalSize());
-}
-
-// Checks whether the image is properly exported as a uniform by the compiler.
-void CheckExportedImageUniform(const std::vector<sh::Uniform> &uniforms,
- size_t uniformIndex,
- ::GLenum imageTypeGL,
- const TString &imageName)
-{
- ASSERT_EQ(1u, uniforms.size());
-
- const auto &imageUniform = uniforms[uniformIndex];
- ASSERT_EQ(imageTypeGL, imageUniform.type);
- ASSERT_STREQ(imageUniform.name.c_str(), imageName.c_str());
-}
-
-// Checks whether the image is saved in the AST as a node with the correct properties given the
-// shader.
-void CheckImageDeclaration(TIntermNode *astRoot,
- const TString &imageName,
- TBasicType imageType,
- TLayoutImageInternalFormat internalFormat,
- bool readonly,
- bool writeonly,
- bool coherent,
- bool restrictQualifier,
- bool volatileQualifier)
-{
- const TIntermSymbol *myImageNode = FindSymbolNode(astRoot, imageName, imageType);
- ASSERT_NE(nullptr, myImageNode);
-
- const TType &myImageType = myImageNode->getType();
- TLayoutQualifier myImageLayoutQualifier = myImageType.getLayoutQualifier();
- ASSERT_EQ(internalFormat, myImageLayoutQualifier.imageInternalFormat);
- TMemoryQualifier myImageMemoryQualifier = myImageType.getMemoryQualifier();
- ASSERT_EQ(readonly, myImageMemoryQualifier.readonly);
- ASSERT_EQ(writeonly, myImageMemoryQualifier.writeonly);
- ASSERT_EQ(coherent, myImageMemoryQualifier.coherent);
- ASSERT_EQ(restrictQualifier, myImageMemoryQualifier.restrictQualifier);
- ASSERT_EQ(volatileQualifier, myImageMemoryQualifier.volatileQualifier);
-}
-
-} // namespace
-
-class ShaderImageTest : public testing::Test
-{
- public:
- ShaderImageTest() {}
-
- protected:
- virtual void SetUp()
- {
- ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
-
- mTranslator = new sh::TranslatorESSL(GL_COMPUTE_SHADER, SH_GLES3_1_SPEC);
- ASSERT_TRUE(mTranslator->Init(resources));
- }
-
- virtual void TearDown() { delete mTranslator; }
-
- // Return true when compilation succeeds
- bool compile(const std::string &shaderString)
- {
- const char *shaderStrings[] = {shaderString.c_str()};
- mASTRoot = mTranslator->compileTreeForTesting(shaderStrings, 1,
- SH_INTERMEDIATE_TREE | SH_VARIABLES);
- TInfoSink &infoSink = mTranslator->getInfoSink();
- mInfoLog = infoSink.info.c_str();
- return mASTRoot != nullptr;
- }
-
- protected:
- std::string mTranslatedCode;
- std::string mInfoLog;
- sh::TranslatorESSL *mTranslator;
- TIntermNode *mASTRoot;
-};
-
-// Test that an image2D is properly parsed and exported as a uniform.
-TEST_F(ShaderImageTest, Image2DDeclaration)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "layout(local_size_x = 4) in;\n"
- "layout(rgba32f) uniform highp readonly image2D myImage;\n"
- "void main() {\n"
- " ivec2 sz = imageSize(myImage);\n"
- "}";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed" << mInfoLog;
- }
-
- CheckExportedImageUniform(mTranslator->getUniforms(), 0, GL_IMAGE_2D, "myImage");
- CheckImageDeclaration(mASTRoot, "myImage", EbtImage2D, EiifRGBA32F, true, false, false, false,
- false);
-}
-
-// Test that an image3D is properly parsed and exported as a uniform.
-TEST_F(ShaderImageTest, Image3DDeclaration)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "layout(local_size_x = 4) in;\n"
- "layout(rgba32ui) uniform highp writeonly readonly uimage3D myImage;\n"
- "void main() {\n"
- " ivec3 sz = imageSize(myImage);\n"
- "}";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed" << mInfoLog;
- }
-
- CheckExportedImageUniform(mTranslator->getUniforms(), 0, GL_UNSIGNED_INT_IMAGE_3D, "myImage");
- CheckImageDeclaration(mASTRoot, "myImage", EbtUImage3D, EiifRGBA32UI, true, true, false, false,
- false);
-}
-
-// Check that imageLoad calls get correctly parsed.
-TEST_F(ShaderImageTest, ImageLoad)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "layout(local_size_x = 4) in;\n"
- "layout(rgba32f) uniform highp readonly image2D my2DImageInput;\n"
- "layout(rgba32i) uniform highp readonly iimage3D my3DImageInput;\n"
- "void main() {\n"
- " vec4 result = imageLoad(my2DImageInput, ivec2(gl_LocalInvocationID.xy));\n"
- " ivec4 result2 = imageLoad(my3DImageInput, ivec3(gl_LocalInvocationID.xyz));\n"
- "}";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed" << mInfoLog;
- }
-
- // imageLoad call with image2D passed
- CheckImageLoadCall(mASTRoot, "imageLoad(im21;vi2;", EbtImage2D, 2);
-
- // imageLoad call with image3D passed
- CheckImageLoadCall(mASTRoot, "imageLoad(iim31;vi3;", EbtIImage3D, 3);
-}
-
-// Check that imageStore calls get correctly parsed.
-TEST_F(ShaderImageTest, ImageStore)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "layout(local_size_x = 4) in;\n"
- "layout(rgba32f) uniform highp writeonly image2D my2DImageOutput;\n"
- "layout(rgba32ui) uniform highp writeonly uimage2DArray my2DImageArrayOutput;\n"
- "void main() {\n"
- " imageStore(my2DImageOutput, ivec2(gl_LocalInvocationID.xy), vec4(0.0));\n"
- " imageStore(my2DImageArrayOutput, ivec3(gl_LocalInvocationID.xyz), uvec4(0));\n"
- "}";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed" << mInfoLog;
- }
-
- // imageStore call with image2D
- CheckImageStoreCall(mASTRoot, "imageStore(im21;vi2;vf4;", EbtImage2D, 2, EbtFloat, 4);
-
- // imageStore call with image2DArray
- CheckImageStoreCall(mASTRoot, "imageStore(uim2a1;vi3;vu4;", EbtUImage2DArray, 3, EbtUInt, 4);
-}
-
-// Check that memory qualifiers are correctly parsed.
-TEST_F(ShaderImageTest, ImageMemoryQualifiers)
-{
- const std::string &shaderString =
- "#version 310 es\n"
- "layout(local_size_x = 4) in;"
- "layout(rgba32f) uniform highp coherent readonly image2D image1;\n"
- "layout(rgba32f) uniform highp volatile writeonly image2D image2;\n"
- "layout(rgba32f) uniform highp volatile restrict readonly writeonly image2D image3;\n"
- "void main() {\n"
- "}";
- if (!compile(shaderString))
- {
- FAIL() << "Shader compilation failed" << mInfoLog;
- }
-
- CheckImageDeclaration(mASTRoot, "image1", EbtImage2D, EiifRGBA32F, true, false, true, false,
- false);
- CheckImageDeclaration(mASTRoot, "image2", EbtImage2D, EiifRGBA32F, false, true, true, false,
- true);
- CheckImageDeclaration(mASTRoot, "image3", EbtImage2D, EiifRGBA32F, true, true, true, true,
- true);
-}
diff --git a/gfx/angle/src/tests/compiler_tests/ShaderVariable_test.cpp b/gfx/angle/src/tests/compiler_tests/ShaderVariable_test.cpp
index 53dd93fe4..6b90f1f5d 100755
--- a/gfx/angle/src/tests/compiler_tests/ShaderVariable_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/ShaderVariable_test.cpp
@@ -229,10 +229,10 @@ TEST(ShaderVariableTest, IsSameVaryingWithDifferentInvariance)
TEST(ShaderVariableTest, InvariantDoubleDeleteBug)
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
- ShHandle compiler = sh::ConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
EXPECT_NE(static_cast<ShHandle>(0), compiler);
const char *program[] =
@@ -246,18 +246,18 @@ TEST(ShaderVariableTest, InvariantDoubleDeleteBug)
"}"
};
- EXPECT_TRUE(sh::Compile(compiler, program, 1, SH_OBJECT_CODE));
- EXPECT_TRUE(sh::Compile(compiler, program, 1, SH_OBJECT_CODE));
- sh::Destruct(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program, 1, SH_OBJECT_CODE));
+ EXPECT_TRUE(ShCompile(compiler, program, 1, SH_OBJECT_CODE));
+ ShDestruct(compiler);
}
TEST(ShaderVariableTest, IllegalInvariantVarying)
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
- ShHandle compiler = sh::ConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
EXPECT_NE(static_cast<ShHandle>(0), compiler);
const char *program1[] =
@@ -284,17 +284,17 @@ TEST(ShaderVariableTest, IllegalInvariantVarying)
"}"
};
- EXPECT_TRUE(sh::Compile(compiler, program1, 1, SH_VARIABLES));
- EXPECT_FALSE(sh::Compile(compiler, program2, 1, SH_VARIABLES));
+ EXPECT_TRUE(ShCompile(compiler, program1, 1, SH_VARIABLES));
+ EXPECT_FALSE(ShCompile(compiler, program2, 1, SH_VARIABLES));
}
TEST(ShaderVariableTest, InvariantLeakAcrossShaders)
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
- ShHandle compiler = sh::ConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
EXPECT_NE(static_cast<ShHandle>(0), compiler);
const char *program1[] =
@@ -313,15 +313,15 @@ TEST(ShaderVariableTest, InvariantLeakAcrossShaders)
"}"
};
- EXPECT_TRUE(sh::Compile(compiler, program1, 1, SH_VARIABLES));
- const std::vector<sh::Varying> *varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program1, 1, SH_VARIABLES));
+ const std::vector<sh::Varying> *varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "v_varying")
EXPECT_TRUE(varying.isInvariant);
}
- EXPECT_TRUE(sh::Compile(compiler, program2, 1, SH_VARIABLES));
- varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program2, 1, SH_VARIABLES));
+ varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "v_varying")
@@ -332,10 +332,10 @@ TEST(ShaderVariableTest, InvariantLeakAcrossShaders)
TEST(ShaderVariableTest, GlobalInvariantLeakAcrossShaders)
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
- ShHandle compiler = sh::ConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
EXPECT_NE(static_cast<ShHandle>(0), compiler);
const char *program1[] =
@@ -354,15 +354,15 @@ TEST(ShaderVariableTest, GlobalInvariantLeakAcrossShaders)
"}"
};
- EXPECT_TRUE(sh::Compile(compiler, program1, 1, SH_VARIABLES));
- const std::vector<sh::Varying> *varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program1, 1, SH_VARIABLES));
+ const std::vector<sh::Varying> *varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "v_varying")
EXPECT_TRUE(varying.isInvariant);
}
- EXPECT_TRUE(sh::Compile(compiler, program2, 1, SH_VARIABLES));
- varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program2, 1, SH_VARIABLES));
+ varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "v_varying")
@@ -374,10 +374,10 @@ TEST(ShaderVariableTest, BuiltinInvariantVarying)
{
ShBuiltInResources resources;
- sh::InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
- ShHandle compiler = sh::ConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
- SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
+ ShHandle compiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC,
+ SH_GLSL_COMPATIBILITY_OUTPUT, &resources);
EXPECT_NE(static_cast<ShHandle>(0), compiler);
const char *program1[] =
@@ -401,21 +401,21 @@ TEST(ShaderVariableTest, BuiltinInvariantVarying)
"}"
};
- EXPECT_TRUE(sh::Compile(compiler, program1, 1, SH_VARIABLES));
- const std::vector<sh::Varying> *varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program1, 1, SH_VARIABLES));
+ const std::vector<sh::Varying> *varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "gl_Position")
EXPECT_TRUE(varying.isInvariant);
}
- EXPECT_TRUE(sh::Compile(compiler, program2, 1, SH_VARIABLES));
- varyings = sh::GetVaryings(compiler);
+ EXPECT_TRUE(ShCompile(compiler, program2, 1, SH_VARIABLES));
+ varyings = ShGetVaryings(compiler);
for (const sh::Varying &varying : *varyings)
{
if (varying.name == "gl_Position")
EXPECT_FALSE(varying.isInvariant);
}
- EXPECT_FALSE(sh::Compile(compiler, program3, 1, SH_VARIABLES));
+ EXPECT_FALSE(ShCompile(compiler, program3, 1, SH_VARIABLES));
}
} // namespace sh
diff --git a/gfx/angle/src/tests/compiler_tests/TypeTracking_test.cpp b/gfx/angle/src/tests/compiler_tests/TypeTracking_test.cpp
index ac8ee70f6..516c94a16 100755
--- a/gfx/angle/src/tests/compiler_tests/TypeTracking_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/TypeTracking_test.cpp
@@ -13,32 +13,33 @@
#include "GLSLANG/ShaderLang.h"
#include "compiler/translator/TranslatorESSL.h"
-using namespace sh;
-
class TypeTrackingTest : public testing::Test
{
public:
TypeTrackingTest() {}
protected:
- void SetUp() override
+ virtual void SetUp()
{
ShBuiltInResources resources;
- InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
resources.FragmentPrecisionHigh = 1;
mTranslator = new TranslatorESSL(GL_FRAGMENT_SHADER, SH_GLES3_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
}
- void TearDown() override { delete mTranslator; }
+ virtual void TearDown()
+ {
+ delete mTranslator;
+ }
void compile(const std::string& shaderString)
{
const char *shaderStrings[] = { shaderString.c_str() };
bool compilationSuccess = mTranslator->compile(shaderStrings, 1, SH_INTERMEDIATE_TREE);
TInfoSink &infoSink = mTranslator->getInfoSink();
- mInfoLog = RemoveSymbolIdsFromInfoLog(infoSink.info.c_str());
+ mInfoLog = infoSink.info.c_str();
if (!compilationSuccess)
FAIL() << "Shader compilation failed " << mInfoLog;
}
@@ -54,23 +55,6 @@ class TypeTrackingTest : public testing::Test
}
private:
- // Remove symbol ids from info log - the tests don't care about them.
- static std::string RemoveSymbolIdsFromInfoLog(const char *infoLog)
- {
- std::string filteredLog(infoLog);
- size_t idPrefixPos = 0u;
- do
- {
- idPrefixPos = filteredLog.find(" (symbol id");
- if (idPrefixPos != std::string::npos)
- {
- size_t idSuffixPos = filteredLog.find(")", idPrefixPos);
- filteredLog.erase(idPrefixPos, idSuffixPos - idPrefixPos + 1u);
- }
- } while (idPrefixPos != std::string::npos);
- return filteredLog;
- }
-
TranslatorESSL *mTranslator;
std::string mInfoLog;
};
diff --git a/gfx/angle/src/tests/compiler_tests/UnrollFlatten_test.cpp b/gfx/angle/src/tests/compiler_tests/UnrollFlatten_test.cpp
index 78f388a44..3819c3bea 100755
--- a/gfx/angle/src/tests/compiler_tests/UnrollFlatten_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/UnrollFlatten_test.cpp
@@ -14,8 +14,6 @@
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
namespace
{
diff --git a/gfx/angle/src/tests/compiler_tests/WorkGroupSize_test.cpp b/gfx/angle/src/tests/compiler_tests/WorkGroupSize_test.cpp
index 980617f84..f2a9d4e8d 100755
--- a/gfx/angle/src/tests/compiler_tests/WorkGroupSize_test.cpp
+++ b/gfx/angle/src/tests/compiler_tests/WorkGroupSize_test.cpp
@@ -13,8 +13,6 @@
#include "compiler/translator/TranslatorESSL.h"
#include "tests/test_utils/compiler_test.h"
-using namespace sh;
-
class WorkGroupSizeTest : public testing::Test
{
public:
@@ -24,7 +22,7 @@ class WorkGroupSizeTest : public testing::Test
void SetUp() override
{
ShBuiltInResources resources;
- InitBuiltInResources(&resources);
+ ShInitBuiltInResources(&resources);
mTranslator = new TranslatorESSL(GL_COMPUTE_SHADER, SH_GLES3_1_SPEC);
ASSERT_TRUE(mTranslator->Init(resources));
@@ -58,7 +56,7 @@ TEST_F(WorkGroupSizeTest, OnlyLocalSizeXSpecified)
compile(shaderString);
- const WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
+ const sh::WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
ASSERT_EQ(5, localSize[0]);
ASSERT_EQ(1, localSize[1]);
ASSERT_EQ(1, localSize[2]);
@@ -75,7 +73,7 @@ TEST_F(WorkGroupSizeTest, LocalSizeXandZ)
compile(shaderString);
- const WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
+ const sh::WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
ASSERT_EQ(5, localSize[0]);
ASSERT_EQ(1, localSize[1]);
ASSERT_EQ(10, localSize[2]);
@@ -92,7 +90,7 @@ TEST_F(WorkGroupSizeTest, LocalSizeAll)
compile(shaderString);
- const WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
+ const sh::WorkGroupSize &localSize = mTranslator->getComputeShaderLocalSize();
ASSERT_EQ(5, localSize[0]);
ASSERT_EQ(15, localSize[1]);
ASSERT_EQ(10, localSize[2]);