aboutsummaryrefslogtreecommitdiff
path: root/tests/glmark2/src/libmatrix/test/shader_source_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/glmark2/src/libmatrix/test/shader_source_test.cc')
-rw-r--r--tests/glmark2/src/libmatrix/test/shader_source_test.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/glmark2/src/libmatrix/test/shader_source_test.cc b/tests/glmark2/src/libmatrix/test/shader_source_test.cc
new file mode 100644
index 00000000..31d0265e
--- /dev/null
+++ b/tests/glmark2/src/libmatrix/test/shader_source_test.cc
@@ -0,0 +1,49 @@
+//
+// Copyright (c) 2012 Linaro Limited
+//
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the MIT License which accompanies
+// this distribution, and is available at
+// http://www.opensource.org/licenses/mit-license.php
+//
+// Contributors:
+// Jesse Barker - original implementation.
+//
+#include <string>
+#include "libmatrix_test.h"
+#include "shader_source_test.h"
+#include "../shader-source.h"
+#include "../vec.h"
+
+using std::string;
+using LibMatrix::vec4;
+
+void
+ShaderSourceBasic::run(const Options& options)
+{
+ static const string vtx_shader_filename("test/basic.vert");
+
+ ShaderSource vtx_source(vtx_shader_filename);
+ ShaderSource vtx_source2(vtx_shader_filename);
+
+ pass_ = (vtx_source.str() == vtx_source2.str());
+}
+
+void
+ShaderSourceAddConstGlobal::run(const Options& options)
+{
+ // Load the original shader source.
+ static const string src_shader_filename("test/basic.vert");
+ ShaderSource src_shader(src_shader_filename);
+
+ // Add constant at global scope
+ static const vec4 constantColor(1.0, 1.0, 1.0, 1.0);
+ src_shader.add_const("ConstantColor", constantColor);
+
+ // Load the pre-modified shader
+ static const string result_shader_filename("test/basic-global-const.vert");
+ ShaderSource result_shader(result_shader_filename);
+
+ // Compare the output strings to confirm the results.
+ pass_ = (src_shader.str() == result_shader.str());
+}