blob: 5066da22d2c9b79e072680a849fac8b17edbcb1e [file] [log] [blame]
Jarkko Poyry3c827362014-09-02 11:48:52 +03001/*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief GLES1 render utils.
22 *//*--------------------------------------------------------------------*/
23
24#include "teglGLES1RenderUtil.hpp"
25
26#if defined(DEQP_SUPPORT_GLES1)
27# include <GLES/gl.h>
28#endif
29
30using std::vector;
31
32namespace deqp
33{
34namespace egl
35{
36namespace gles1
37{
38
39#if defined(DEQP_SUPPORT_GLES1)
40
41void clear (int x, int y, int width, int height, const tcu::Vec4& color)
42{
43 glEnable(GL_SCISSOR_TEST);
44 glScissor(x, y, width, height);
45 glClearColor(color.x(), color.y(), color.z(), color.w());
46 glClear(GL_COLOR_BUFFER_BIT);
47 glDisable(GL_SCISSOR_TEST);
48}
49
50void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
51{
52 dst.setSize(width, height);
53 glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dst.getAccess().getDataPtr());
54}
55
56#else // DEQP_SUPPORT_GLES1
57
58void clear (int x, int y, int width, int height, const tcu::Vec4& color)
59{
60 DE_UNREF(x && y && width && height);
61 DE_UNREF(color);
Pyry Haulos3c67e4f2014-12-19 15:45:39 -080062 TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
Jarkko Poyry3c827362014-09-02 11:48:52 +030063}
64
65void readPixels (tcu::Surface& dst, int x, int y, int width, int height)
66{
67 DE_UNREF(x && y && width && height);
68 DE_UNREF(dst);
Pyry Haulos3c67e4f2014-12-19 15:45:39 -080069 TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
Jarkko Poyry3c827362014-09-02 11:48:52 +030070}
71
72#endif // DEQP_SUPPORT_GLES1
73
74} // gles1
75} // egl
76} // deqp