1 #ifndef _GL4CPOSTDEPTHCOVERAGETESTS_HPP
2 #define _GL4CPOSTDEPTHCOVERAGETESTS_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2016 The Khronos Group Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */ /*!
22  * \file
23  * \brief
24  */ /*-------------------------------------------------------------------*/
25 
26 /**
27  */ /*!
28  * \file  gl4cPostDepthCoverageTests.hpp
29  * \brief Conformance tests for the GL_ARB_post_depth_coverage functionality.
30  */ /*-------------------------------------------------------------------*/
31 #include "glcTestCase.hpp"
32 #include "glwDefs.hpp"
33 #include "tcuDefs.hpp"
34 
35 namespace gl4cts
36 {
37 /** Verify if:
38  *  * #extension GL_ARB_post_depth_coverage : <behavior> is allowed in the shader.
39  *  * #define GL_ARB_post_depth_coverage is available and equal to 1.
40  *  * Shader with layout(early_fragment_tests) in; builds without an error.
41  *  * Shader with layout(post_depth_coverage) in; builds without an error.
42  */
43 class PostDepthShaderCase : public deqp::TestCase
44 {
45 public:
46 	/* Public methods */
47 	PostDepthShaderCase(deqp::Context& context);
48 
49 	void						 deinit();
50 	void						 init();
51 	tcu::TestNode::IterateResult iterate();
52 
53 private:
54 	/* Private methods */
55 	/* Private members */
56 	std::string m_vertShader;
57 	std::string m_fragShader1;
58 	std::string m_fragShader2;
59 	std::string m_fragShader3;
60 	std::string m_fragShader4;
61 };
62 
63 /** Verify if fragment shader is allowed to control whether values in
64  *  gl_SampleMaskIn[] reflect the coverage after application of the early
65  *  depth and stencil tests.
66  */
67 class PostDepthSampleMaskCase : public deqp::TestCase
68 {
69 public:
70 	/* Public methods */
71 	PostDepthSampleMaskCase(deqp::Context& context);
72 
73 	virtual void						 deinit();
74 	virtual void						 init();
75 	virtual tcu::TestNode::IterateResult iterate();
76 
77 private:
78 	/* Private enums */
79 	enum BufferCase
80 	{
81 		BUFFERCASE_FIRST   = 0,
82 		BUFFERCASE_DEPTH   = BUFFERCASE_FIRST,
83 		BUFFERCASE_STENCIL = BUFFERCASE_FIRST + 1,
84 		BUFFERCASE_LAST	= BUFFERCASE_STENCIL,
85 	};
86 
87 	enum PDCCase
88 	{
89 		PDCCASE_FIRST	= 0,
90 		PDCCASE_DISABLED = PDCCASE_FIRST,
91 		PDCCASE_ENABLED  = PDCCASE_FIRST + 1,
92 		PDCCASE_LAST	 = PDCCASE_ENABLED,
93 	};
94 
95 	/* Private methods */
96 	/* Private members */
97 	deUint32 m_framebufferMS;
98 	deUint32 m_framebuffer;
99 	deUint32 m_textureMS;
100 	deUint32 m_texture;
101 	deUint32 m_depthStencilRenderbuffer;
102 
103 	std::string m_vertShader;
104 	std::string m_fragShader1a;
105 	std::string m_fragShader1b;
106 	std::string m_fragShader2;
107 };
108 
109 /** Test group which encapsulates all sparse buffer conformance tests */
110 class PostDepthCoverage : public deqp::TestCaseGroup
111 {
112 public:
113 	/* Public methods */
114 	PostDepthCoverage(deqp::Context& context);
115 
116 	void init();
117 
118 private:
119 	PostDepthCoverage(const PostDepthCoverage& other);
120 	PostDepthCoverage& operator=(const PostDepthCoverage& other);
121 };
122 
123 } /* glcts namespace */
124 
125 #endif // _GL4CPOSTDEPTHCOVERAGETESTS_HPP
126