• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2017 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 
7 // ProgramParameterTest: validate parameters of ProgramParameter
8 
9 #include "test_utils/ANGLETest.h"
10 
11 using namespace angle;
12 
13 namespace
14 {
15 
16 class ProgramParameterTest : public ANGLETest
17 {
18   protected:
ProgramParameterTest()19     ProgramParameterTest()
20     {
21         setWindowWidth(64);
22         setWindowHeight(64);
23         setConfigRedBits(8);
24         setConfigGreenBits(8);
25         setConfigBlueBits(8);
26         setConfigAlphaBits(8);
27     }
28 };
29 
30 class ProgramParameterTestES31 : public ProgramParameterTest
31 {
32   protected:
ProgramParameterTestES31()33     ProgramParameterTestES31() : ProgramParameterTest() {}
34 };
35 
36 // If es version < 3.1, PROGRAM_SEPARABLE is not supported.
TEST_P(ProgramParameterTest,ValidatePname)37 TEST_P(ProgramParameterTest, ValidatePname)
38 {
39     GLuint program = glCreateProgram();
40     ASSERT_NE(program, 0u);
41 
42     glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
43     ASSERT_GL_NO_ERROR();
44 
45     glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE);
46     if (getClientMajorVersion() < 3 || getClientMinorVersion() < 1)
47     {
48         ASSERT_GL_ERROR(GL_INVALID_ENUM);
49     }
50     else
51     {
52         ASSERT_GL_NO_ERROR();
53     }
54 
55     glDeleteProgram(program);
56 }
57 
58 // Validate parameters for ProgramParameter when pname is PROGRAM_SEPARABLE.
TEST_P(ProgramParameterTestES31,ValidateParameters)59 TEST_P(ProgramParameterTestES31, ValidateParameters)
60 {
61     GLuint program = glCreateProgram();
62     ASSERT_NE(program, 0u);
63 
64     glProgramParameteri(0, GL_PROGRAM_SEPARABLE, GL_TRUE);
65     ASSERT_GL_ERROR(GL_INVALID_VALUE);
66 
67     glProgramParameteri(program, GL_PROGRAM_SEPARABLE, 2);
68     ASSERT_GL_ERROR(GL_INVALID_VALUE);
69 
70     glDeleteProgram(program);
71 }
72 
73 ANGLE_INSTANTIATE_TEST_ES3_AND_ES31(ProgramParameterTest);
74 ANGLE_INSTANTIATE_TEST_ES31(ProgramParameterTestES31);
75 }  // namespace
76