~glcompbench-dev/glcompbench/blur-update

« back to all changes in this revision

Viewing changes to src/libmatrix/test/shader_source_test.cc

  • Committer: Jesse Barker
  • Date: 2012-01-27 22:26:02 UTC
  • mfrom: (74.1.5 libmatrix-util)
  • Revision ID: jesse.barker@linaro.org-20120127222602-osainr4na7opoiij
Merge of lp:~glcompbench-dev/glcompbench/libmatrix-util.

Updates glcompbench to reflect the latest lp:libmatrix, which, in and of itself,
conslidates code previously duplicated between glcompbench and glmark2 into
libmatrix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Copyright (c) 2012 Linaro Limited
 
3
//
 
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
 
8
//
 
9
// Contributors:
 
10
//     Jesse Barker - original implementation.
 
11
//
 
12
#include <string>
 
13
#include "libmatrix_test.h"
 
14
#include "shader_source_test.h"
 
15
#include "../shader-source.h"
 
16
#include "../vec.h"
 
17
 
 
18
using std::string;
 
19
using LibMatrix::vec4;
 
20
 
 
21
void
 
22
ShaderSourceBasic::run(const Options& options)
 
23
{
 
24
    static const string vtx_shader_filename("test/basic.vert");
 
25
 
 
26
    ShaderSource vtx_source(vtx_shader_filename);
 
27
    ShaderSource vtx_source2(vtx_shader_filename);
 
28
    
 
29
    pass_ = (vtx_source.str() == vtx_source2.str());
 
30
}
 
31
 
 
32
void
 
33
ShaderSourceAddConstGlobal::run(const Options& options)
 
34
{
 
35
    // Load the original shader source.
 
36
    static const string src_shader_filename("test/basic.vert");
 
37
    ShaderSource src_shader(src_shader_filename);
 
38
 
 
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);
 
42
 
 
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);
 
46
 
 
47
    // Compare the output strings to confirm the results.
 
48
    pass_ = (src_shader.str() == result_shader.str());
 
49
}