blob: 3ff6d9f8ae1b69fd2e0cbdd6f7e0729d7bd8caed [file] [log] [blame]
Mathias Agopian3f844832013-08-07 21:24:32 -07001/*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18#ifndef SF_GLES20RENDERENGINE_H_
19#define SF_GLES20RENDERENGINE_H_
20
21#include <stdint.h>
22#include <sys/types.h>
23
24#include <GLES2/gl2.h>
25
26#include "RenderEngine.h"
27#include "ProgramCache.h"
28#include "Description.h"
29
30// ---------------------------------------------------------------------------
31namespace android {
32// ---------------------------------------------------------------------------
33
34class String8;
35class Mesh;
Mathias Agopian49457ac2013-08-14 18:20:17 -070036class Texture;
Mathias Agopian3f844832013-08-07 21:24:32 -070037
38class GLES20RenderEngine : public RenderEngine {
39 GLuint mProtectedTexName;
40 GLint mMaxViewportDims[2];
41 GLint mMaxTextureSize;
42
43 Description mState;
44
Mathias Agopian458197d2013-08-15 14:56:51 -070045 virtual void bindImageAsFramebuffer(EGLImageKHR image,
46 uint32_t* texName, uint32_t* fbName, uint32_t* status);
47 virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
48
Mathias Agopian3f844832013-08-07 21:24:32 -070049public:
50 GLES20RenderEngine();
51
52protected:
53 virtual ~GLES20RenderEngine();
54
55 virtual void dump(String8& result);
56 virtual void setViewportAndProjection(size_t vpw, size_t vph, size_t w, size_t h, bool yswap);
57 virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha);
58 virtual void setupDimLayerBlending(int alpha);
Mathias Agopian49457ac2013-08-14 18:20:17 -070059 virtual void setupLayerTexturing(const Texture& texture);
Mathias Agopian3f844832013-08-07 21:24:32 -070060 virtual void setupLayerBlackedOut();
61 virtual void disableTexturing();
62 virtual void disableBlending();
63
64 virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a);
65 virtual void drawMesh(const Mesh& mesh);
66
67 virtual size_t getMaxTextureSize() const;
68 virtual size_t getMaxViewportDims() const;
69};
70
71// ---------------------------------------------------------------------------
72}; // namespace android
73// ---------------------------------------------------------------------------
74
75#endif /* SF_GLES20RENDERENGINE_H_ */