blob: 4cd968d12520b2ccd0d1d9a1f5b2cb5839dbcc8b [file] [log] [blame]
Mathias Agopian875d8e12013-06-07 15:35:48 -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_GLES11RENDERENGINE_H_
19#define SF_GLES11RENDERENGINE_H_
20
21#include <stdint.h>
22#include <sys/types.h>
23
24#include <GLES/gl.h>
Riley Andrewsc3ebe662014-09-04 16:20:31 -070025#include <Transform.h>
Mathias Agopian875d8e12013-06-07 15:35:48 -070026
27#include "RenderEngine.h"
28
29// ---------------------------------------------------------------------------
30namespace android {
31// ---------------------------------------------------------------------------
32
33class String8;
Mathias Agopian3f844832013-08-07 21:24:32 -070034class Mesh;
Mathias Agopian49457ac2013-08-14 18:20:17 -070035class Texture;
Mathias Agopian875d8e12013-06-07 15:35:48 -070036
37class GLES11RenderEngine : public RenderEngine {
38 GLuint mProtectedTexName;
39 GLint mMaxViewportDims[2];
40 GLint mMaxTextureSize;
41
Mathias Agopian458197d2013-08-15 14:56:51 -070042 virtual void bindImageAsFramebuffer(EGLImageKHR image,
43 uint32_t* texName, uint32_t* fbName, uint32_t* status);
44 virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
45
Mathias Agopian875d8e12013-06-07 15:35:48 -070046public:
47 GLES11RenderEngine();
48
49protected:
50 virtual ~GLES11RenderEngine();
51
52 virtual void dump(String8& result);
Dan Stozac1879002014-05-22 15:59:05 -070053 virtual void setViewportAndProjection(size_t vpw, size_t vph,
Dan Stoza9e56aa02015-11-02 13:00:03 -080054 Rect sourceCrop, size_t hwh, bool yswap,
55 Transform::orientation_flags rotation);
Fabien Sanglard9d96de42016-10-11 00:15:18 +000056#ifdef USE_HWC2
Dan Stoza9e56aa02015-11-02 13:00:03 -080057 virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque,
58 float alpha) override;
59 virtual void setupDimLayerBlending(float alpha) override;
Fabien Sanglard9d96de42016-10-11 00:15:18 +000060#else
61 virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque,
62 int alpha);
63 virtual void setupDimLayerBlending(int alpha);
64#endif
Mathias Agopian49457ac2013-08-14 18:20:17 -070065 virtual void setupLayerTexturing(const Texture& texture);
Mathias Agopian875d8e12013-06-07 15:35:48 -070066 virtual void setupLayerBlackedOut();
Mathias Agopian19733a32013-08-28 18:13:56 -070067 virtual void setupFillWithColor(float r, float g, float b, float a) ;
Mathias Agopian875d8e12013-06-07 15:35:48 -070068 virtual void disableTexturing();
69 virtual void disableBlending();
70
Mathias Agopian3f844832013-08-07 21:24:32 -070071 virtual void drawMesh(const Mesh& mesh);
Mathias Agopian875d8e12013-06-07 15:35:48 -070072
Mathias Agopian875d8e12013-06-07 15:35:48 -070073 virtual size_t getMaxTextureSize() const;
74 virtual size_t getMaxViewportDims() const;
75};
76
77// ---------------------------------------------------------------------------
78}; // namespace android
79// ---------------------------------------------------------------------------
80
81#endif /* SF_GLES11RENDERENGINE_H_ */