1 #ifndef _GLSSAMPLEROBJECTTEST_HPP
2 #define _GLSSAMPLEROBJECTTEST_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES 3.0 Module
5 * -------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Sampler object testcases.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuTestCase.hpp"
27 #include "tcuTestLog.hpp"
28 #include "deRandom.hpp"
29 #include "tcuSurface.hpp"
30 #include "gluRenderContext.hpp"
32 #include "glwEnums.hpp"
33 #include "gluShaderProgram.hpp"
40 class TextureSamplerTest : public tcu::TestCase
59 SamplingState textureState;
60 SamplingState samplerState;
63 TextureSamplerTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const TestSpec& spec);
64 ~TextureSamplerTest (void);
69 IterateResult iterate (void);
72 void renderReferences (tcu::Surface& textureRef, tcu::Surface& samplerRef, int x, int y);
73 void renderResults (tcu::Surface& textureResult, tcu::Surface& samplerResult, int x, int y);
77 static void setTextureState (const glw::Functions& gl, GLenum target, SamplingState state);
78 static void setSamplerState (const glw::Functions& gl, SamplingState state, GLuint sampler);
80 static GLuint createTexture2D (const glw::Functions& gl);
81 static GLuint createTexture3D (const glw::Functions& gl);
82 static GLuint createTextureCube (const glw::Functions& gl);
83 static GLuint createTexture (const glw::Functions& gl, GLenum target);
85 static const char* selectVertexShader (GLenum target);
86 static const char* selectFragmentShader (GLenum target);
88 glu::RenderContext& m_renderCtx;
89 glu::ShaderProgram* m_program;
92 SamplingState m_textureState;
93 SamplingState m_samplerState;
98 class MultiTextureSamplerTest : public tcu::TestCase
117 SamplingState textureState1;
118 SamplingState textureState2;
119 SamplingState samplerState;
122 MultiTextureSamplerTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const TestSpec& spec);
123 ~MultiTextureSamplerTest (void);
128 IterateResult iterate (void);
131 void renderReferences (tcu::Surface& textureRef, tcu::Surface& samplerRef, int x, int y);
132 void renderResults (tcu::Surface& textureResult, tcu::Surface& samplerResult, int x, int y);
136 static void setTextureState (const glw::Functions& gl, GLenum target, SamplingState state);
137 static void setSamplerState (const glw::Functions& gl, SamplingState state, GLuint sampler);
139 static GLuint createTexture2D (const glw::Functions& gl, int id);
140 static GLuint createTexture3D (const glw::Functions& gl, int id);
141 static GLuint createTextureCube (const glw::Functions& gl, int id);
142 static GLuint createTexture (const glw::Functions& gl, GLenum target, int id);
144 static const char* selectVertexShader (GLenum target);
145 static const char* selectFragmentShader (GLenum target);
147 glu::RenderContext& m_renderCtx;
148 glu::ShaderProgram* m_program;
151 SamplingState m_textureState1;
152 SamplingState m_textureState2;
153 SamplingState m_samplerState;
162 #endif // _GLSSAMPLEROBJECTTEST_HPP