2
// Copyright (c) 2012 Linaro Limited
4
// All rights reserved. This program and the accompanying materials
5
// are made available under the terms of the MIT License which accompanies
6
// this distribution, and is available at
7
// http://www.opensource.org/licenses/mit-license.php
10
// Jesse Barker - original implementation.
13
#include "libmatrix_test.h"
14
#include "shader_source_test.h"
15
#include "../shader-source.h"
19
using LibMatrix::vec4;
22
ShaderSourceBasic::run(const Options& options)
24
static const string vtx_shader_filename("test/basic.vert");
26
ShaderSource vtx_source(vtx_shader_filename);
27
ShaderSource vtx_source2(vtx_shader_filename);
29
pass_ = (vtx_source.str() == vtx_source2.str());
33
ShaderSourceAddConstGlobal::run(const Options& options)
35
// Load the original shader source.
36
static const string src_shader_filename("test/basic.vert");
37
ShaderSource src_shader(src_shader_filename);
39
// Add constant at global scope
40
static const vec4 constantColor(1.0, 1.0, 1.0, 1.0);
41
src_shader.add_const("ConstantColor", constantColor);
43
// Load the pre-modified shader
44
static const string result_shader_filename("test/basic-global-const.vert");
45
ShaderSource result_shader(result_shader_filename);
47
// Compare the output strings to confirm the results.
48
pass_ = (src_shader.str() == result_shader.str());