• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // NV_draw_buffers_test.cpp:
7 //   Test for NV_draw_buffers setting
8 //
9 
10 #include "GLSLANG/ShaderLang.h"
11 #include "angle_gl.h"
12 #include "gtest/gtest.h"
13 #include "tests/test_utils/compiler_test.h"
14 
15 using namespace sh;
16 
17 class NVDrawBuffersTest : public MatchOutputCodeTest
18 {
19   public:
NVDrawBuffersTest()20     NVDrawBuffersTest() : MatchOutputCodeTest(GL_FRAGMENT_SHADER, SH_ESSL_OUTPUT)
21     {
22         ShBuiltInResources *resources = getResources();
23         resources->MaxDrawBuffers     = 8;
24         resources->EXT_draw_buffers   = 1;
25         resources->NV_draw_buffers    = 1;
26     }
27 };
28 
TEST_F(NVDrawBuffersTest,NVDrawBuffers)29 TEST_F(NVDrawBuffersTest, NVDrawBuffers)
30 {
31     const std::string &shaderString =
32         "#extension GL_EXT_draw_buffers : require\n"
33         "precision mediump float;\n"
34         "void main() {\n"
35         "   gl_FragData[0] = vec4(1.0);\n"
36         "   gl_FragData[1] = vec4(0.0);\n"
37         "}\n";
38     compile(shaderString);
39     ASSERT_TRUE(foundInCode("GL_NV_draw_buffers"));
40     ASSERT_FALSE(foundInCode("GL_EXT_draw_buffers"));
41 }
42